Merge branch 'gtk-3-0' into broadway

Conflicts:
	gdk/gdkdisplaymanager.c
This commit is contained in:
Alexander Larsson 2011-03-10 10:51:04 +01:00
commit 4765f37484
166 changed files with 46538 additions and 37073 deletions

92
NEWS
View File

@ -1,3 +1,95 @@
Overview of Changes in GTK+ 3.0.2
=================================
* GtkSettings have been made multi-backend-safe
* Many improvements to themability and the default theme
- GtkScale slider theming can adjust to scale marks, using style classes
- A new style class for 'primary' toolbars
- Widget style classes can now be specified in GtkBuilder files
- Improved scrollbar drawing
- Improved combobox drawing
- Improved spinbutton drawing
- Improved switch drawing
- Improved checkbutton drawing
- Improved menu drawing
- Improved notebook tab drawing
* Bugs fixed:
643041 Gtk-CRITICAL **: gtk_render_slider: assertion `height > 0'...
643131 gtk_tray_icon_dispose
643170 gtk_file_chooser_set_filename does not work if "Show hidden...
643216 Extraneous emits of GdkScreen::monitors-changed
643321 Keypresses in window contextual menu go through to app
643347 consider allowing style data in builder data
643370 gtk_style_context_get_font return NULL
643440 gdkconfig.h included in tarball
643496 GtkDialog does not use separators any more. Description is...
643543 App Chooser classes abort if no content-type is given
643584 crash in gdk_event_free()
643630 Tabs disappear from notebook on scrolling back and resizing...
643685 Normalise marks positions internally in GtkScale
643911 Inactive tab content allocation should respect tab-overlap
643912 Tab allocation should respect tab-curvature
643925 Mouse wheel is following URLs
643967 Add a style property to flip rendering order
644089 treeview: propagate the selected state from the row
* Translation updates:
Esperanto
German
Latvian
Portuguese
Russian
Simplified Chinese
Slovenian
Spanish
Ukrainian
Overview of Changes in GTK+ 3.0.1
=================================
* A autoconf macro, GTK_CHECK_BACKEND, has been added
to allow easy checking for certain gdk backends
* A number of memory leaks and segfaults involving accessibility
have been fixed
* Bugs fixed:
586201 GtkLinkButton doesn't implement neither HyperLink nor...
599907 Gail implementation of atk_add_key_event_listener return...
626730 Check menu item does not set indeterminate state
630971 gailstatusbar attempts to cast a GtkHBox to a GtkBin
633291 Handle Shift-keys in X11 gdk_test_simulate_key()
642213 gtk_widget_render_icon_pixbuf fails with non-standard...
642263 undefined reference to "GTK_IS_SOCKET" and "GTK_IS_PLUG"
642541 Missing semi-colon in gtkseparatormenuitem.c
642677 "migrating" guide not in sync with GTK+ 3.0
642681 gtk_combo_box_text_get_active_text doesn't work as stated
642751 Typo in migrating-2to3.xml
642771 Fix tiny leak in tracker backend
642772 GTK does not correctly process input sent via SendInput...
642778 TextView broken for large files
642782 gail_misc_buffer_get_run_attributes doesn't set background-gdk...
642791 Fix a typo in gtk_socket_notify
* Translation updates:
Bengali India
British English
Bulgarian
Hebrew
Hungarian
Korean
Norwegian bokmål
Punjabi
Spanish
Uighur
Ukranian
Vietnamese
Overview of Changes in GTK+ 3.0.0
=================================

View File

@ -10,8 +10,8 @@
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [0])
m4_define([gtk_micro_version], [1])
m4_define([gtk_interface_age], [1])
m4_define([gtk_micro_version], [3])
m4_define([gtk_interface_age], [3])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
m4_define([gtk_version],
@ -39,7 +39,7 @@ m4_define([gtk_binary_version], [3.0.0])
# required versions of other packages
m4_define([glib_required_version], [2.28.0])
m4_define([pango_required_version], [1.20])
m4_define([pango_required_version], [1.24.0])
m4_define([atk_required_version], [1.30])
m4_define([cairo_required_version], [1.10.0])
m4_define([gdk_pixbuf_required_version], [2.22.0])
@ -529,10 +529,10 @@ AC_CHECK_FUNCS(localtime_r)
# _NL_TIME_FIRST_WEEKDAY is an enum and not a define
AC_MSG_CHECKING([for _NL_TIME_FIRST_WEEKDAY])
AC_TRY_LINK([#include <langinfo.h>], [
char c;
c = *((unsigned char *) nl_langinfo(_NL_TIME_FIRST_WEEKDAY));
], gtk_ok=yes, gtk_ok=no)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
[[char c;
c = *((unsigned char *) nl_langinfo(_NL_TIME_FIRST_WEEKDAY));]])],
[gtk_ok=yes], [gtk_ok=no])
AC_MSG_RESULT($gtk_ok)
if test "$gtk_ok" = "yes"; then
AC_DEFINE([HAVE__NL_TIME_FIRST_WEEKDAY], [1],
@ -541,10 +541,10 @@ fi
# _NL_MEASUREMENT_MEASUREMENT is an enum and not a define
AC_MSG_CHECKING([for _NL_MEASUREMENT_MEASUREMENT])
AC_TRY_LINK([#include <langinfo.h>], [
char c;
c = *((unsigned char *) nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
], gtk_ok=yes, gtk_ok=no)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
[[char c;
c = *((unsigned char *) nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));]])],
[gtk_ok=yes], [gtk_ok=no])
AC_MSG_RESULT($gtk_ok)
if test "$gtk_ok" = "yes"; then
AC_DEFINE([HAVE__NL_MEASUREMENT_MEASUREMENT], [1],
@ -553,10 +553,10 @@ fi
# _NL_PAPER_HEIGHT is an enum and not a define
AC_MSG_CHECKING([for _NL_PAPER_HEIGHT])
AC_TRY_LINK([#include <langinfo.h>], [
char c;
c = *((unsigned char *) nl_langinfo(_NL_PAPER_HEIGHT));
], gtk_ok=yes, gtk_ok=no)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
[[char c;
c = *((unsigned char *) nl_langinfo(_NL_PAPER_HEIGHT));]])],
[gtk_ok=yes], [gtk_ok=no])
AC_MSG_RESULT($gtk_ok)
if test "$gtk_ok" = "yes"; then
AC_DEFINE([HAVE__NL_PAPER_HEIGHT], [1],
@ -565,10 +565,10 @@ fi
# _NL_PAPER_WIDTH is an enum and not a define
AC_MSG_CHECKING([for _NL_PAPER_WIDTH])
AC_TRY_LINK([#include <langinfo.h>], [
char c;
c = *((unsigned char *) nl_langinfo(_NL_PAPER_WIDTH));
], gtk_ok=yes, gtk_ok=no)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
[[char c;
c = *((unsigned char *) nl_langinfo(_NL_PAPER_WIDTH));]])],
[gtk_ok=yes], [gtk_ok=no])
AC_MSG_RESULT($gtk_ok)
if test "$gtk_ok" = "yes"; then
AC_DEFINE([HAVE__NL_PAPER_WIDTH], [1],
@ -579,9 +579,11 @@ fi
ALL_LINGUAS="`grep -v '^#' "$srcdir/po/LINGUAS" | tr '\n' ' '`"
AM_GLIB_GNU_GETTEXT
LIBS="$LIBS $INTLLIBS"
AC_OUTPUT_COMMANDS([case "$CONFIG_FILES" in *po-properties/Makefile.in*)
sed -e "/POTFILES =/r po-properties/POTFILES" po-properties/Makefile.in > po-properties/Makefile
esac])
AC_CONFIG_COMMANDS([po-properties],
[[case "$CONFIG_FILES" in *po-properties/Makefile.in*)
sed -e "/POTFILES =/r po-properties/POTFILES" po-properties/Makefile.in > po-properties/Makefile
esac]],
[[]])
dnl Snippet below is copied from AM_GLIB_GNU_GETTEXT to generate a first
dnl po-properties/POTFILES during configure; see GNOME #573515.
@ -611,22 +613,20 @@ AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
gtk_save_LIBS=$LIBS
LIBS="$LIBS -lm"
AC_TRY_RUN([#include <math.h>
int main (void) { return (log(1) != log(1.)); }],
AC_MSG_RESULT(none needed),
gtk_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -std1"
AC_TRY_RUN([#include <math.h>
int main (void) { return (log(1) != log(1.)); }],
AC_MSG_RESULT(-std1),
AC_MSG_RESULT()
CFLAGS="$gtk_save_CFLAGS"
AC_MSG_WARN(
[No ANSI prototypes found in library. (-std1 didn't work.)]),
true
),
AC_MSG_RESULT(none needed)
)
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <math.h>
int main (void) { return (log(1) != log(1.)); }]])],
[AC_MSG_RESULT(none needed)],
[gtk_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -std1"
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <math.h>
int main (void) { return (log(1) != log(1.)); }]])],
[AC_MSG_RESULT(-std1)],
[AC_MSG_RESULT()
CFLAGS="$gtk_save_CFLAGS"
AC_MSG_WARN([No ANSI prototypes found in library. (-std1 did not work.)])],
[true])],
[AC_MSG_RESULT(none needed)])
LIBS=$gtk_save_LIBS
AC_MSG_CHECKING(for the BeOS)
@ -722,29 +722,10 @@ AC_CHECK_FUNCS(mallinfo)
AC_CHECK_FUNCS(getresuid)
AC_TYPE_UID_T
# Check if <sys/select.h> needs to be included for fd_set
AC_MSG_CHECKING([for fd_set])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]],
[[fd_set readMask, writeMask;]])],
[gtk_ok=yes],[gtk_ok=no])
if test $gtk_ok = yes; then
AC_MSG_RESULT([yes, found in sys/types.h])
else
AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
if test $gtk_ok = yes; then
AC_DEFINE(HAVE_SYS_SELECT_H, 1,
[Define to 1 if sys/select.h is available])
AC_MSG_RESULT([yes, found in sys/select.h])
else
AC_DEFINE(NO_FD_SET, 1,
[Define to 1 if fd_set is not available])
AC_MSG_RESULT(no)
fi
fi
# Check for uxtheme.h (for MS-Windows Engine)
AC_MSG_CHECKING(for uxtheme.h)
AC_TRY_CPP([#include <uxtheme.h>], gtk_uxtheme_h=yes, gtk_uxtheme_h=no)
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <uxtheme.h>]])],
[gtk_uxtheme_h=yes], [gtk_uxtheme_h=no])
if test $gtk_uxtheme_h = yes; then
AC_DEFINE(HAVE_UXTHEME_H, 1, [Have uxtheme.h include file])
fi
@ -1620,11 +1601,12 @@ AC_ARG_ENABLE(Bsymbolic,
[SAVED_LDFLAGS="${LDFLAGS}"
AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
LDFLAGS=-Wl,-Bsymbolic-functions
AC_TRY_LINK([], [int main (void) { return 0; }],
AC_MSG_RESULT(yes)
enable_Bsymbolic=yes,
AC_MSG_RESULT(no)
enable_Bsymbolic=no)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
[[int main (void) { return 0; }]])],
[AC_MSG_RESULT(yes)
enable_Bsymbolic=yes],
[AC_MSG_RESULT(no)
enable_Bsymbolic=no])
LDFLAGS="${SAVED_LDFLAGS}"])
if test "x${enable_Bsymbolic}" = "xyes" ; then

View File

@ -48,27 +48,27 @@ add_items (void)
g_return_if_fail (articles != NULL);
foo.number = 3;
foo.product = g_strdup ("bottles of coke");
foo.product = "bottles of coke";
foo.yummy = 20;
g_array_append_vals (articles, &foo, 1);
foo.number = 5;
foo.product = g_strdup ("packages of noodles");
foo.product = "packages of noodles";
foo.yummy = 50;
g_array_append_vals (articles, &foo, 1);
foo.number = 2;
foo.product = g_strdup ("packages of chocolate chip cookies");
foo.product = "packages of chocolate chip cookies";
foo.yummy = 90;
g_array_append_vals (articles, &foo, 1);
foo.number = 1;
foo.product = g_strdup ("can vanilla ice cream");
foo.product = "can vanilla ice cream";
foo.yummy = 60;
g_array_append_vals (articles, &foo, 1);
foo.number = 6;
foo.product = g_strdup ("eggs");
foo.product = "eggs";
foo.yummy = 10;
g_array_append_vals (articles, &foo, 1);
}

View File

@ -105,6 +105,7 @@ fill_store (GtkListStore *store)
name = g_dir_read_name (dir);
}
g_dir_close (dir);
}
static gint

View File

@ -74,47 +74,17 @@ change_orientation (GtkWidget *button,
GtkWidget *menubar)
{
GtkWidget *parent;
GtkWidget *box = NULL;
GtkOrientation orientation;
parent = gtk_widget_get_parent (menubar);
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (parent));
gtk_orientable_set_orientation (GTK_ORIENTABLE (parent), 1 - orientation);
if (GTK_IS_VBOX (parent))
{
box = gtk_widget_get_parent (parent);
g_object_ref (menubar);
gtk_container_remove (GTK_CONTAINER (parent), menubar);
gtk_container_add (GTK_CONTAINER (box), menubar);
gtk_box_reorder_child (GTK_BOX (box), menubar, 0);
g_object_unref (menubar);
g_object_set (menubar,
"pack-direction", GTK_PACK_DIRECTION_TTB,
NULL);
}
if (orientation == GTK_ORIENTATION_VERTICAL)
g_object_set (menubar, "pack-direction", GTK_PACK_DIRECTION_TTB, NULL);
else
{
GList *children, *l;
g_object_set (menubar, "pack-direction", GTK_PACK_DIRECTION_LTR, NULL);
children = gtk_container_get_children (GTK_CONTAINER (parent));
for (l = children; l; l = l->next)
{
if (GTK_IS_VBOX (l->data))
{
box = l->data;
break;
}
}
g_list_free (children);
g_object_ref (menubar);
gtk_container_remove (GTK_CONTAINER (parent), menubar);
gtk_container_add (GTK_CONTAINER (box), menubar);
gtk_box_reorder_child (GTK_BOX (box), menubar, 0);
g_object_unref (menubar);
g_object_set (menubar,
"pack-direction", GTK_PACK_DIRECTION_LTR,
NULL);
}
}
static GtkWidget *window = NULL;

View File

@ -9,12 +9,10 @@
<title>GDK 3 Reference Manual</title>
<releaseinfo>
This document is for the GDK 3 library, version &version;
The latest version can be found online at
<ulink role="online-location" url="http://library.gnome.org/devel/gdk3/unstable/">http://library.gnome.org/devel/gdk3/unstable/</ulink>.
The latest versions can be found online at
<ulink role="online-location" url="http://library.gnome.org/devel/gdk3/">http://library.gnome.org/devel/gdk3/</ulink>.
If you are looking for the older GDK 2 series of libraries,
they can be found under their version numbers; for example,
2.24 is available at
<ulink role="online-location" url="http://library.gnome.org/devel/gdk/2.24/">http://library.gnome.org/devel/gdk/2.24/</ulink>.
see <ulink role="online-location" url="http://library.gnome.org/devel/gdk/">http://library.gnome.org/devel/gdk/</ulink>.
</releaseinfo>
</bookinfo>

View File

@ -69,5 +69,34 @@ define the preprocessor symbol GDK_MULTIDEVICE_SAFE by using the command
line option <literal>-DGTK_MULTIDEVICE_SAFE=1</literal>.
</para>
<refsect2>
<title>Useful autotools macros</title>
<para>
GTK+ provides various macros for easily checking version and backends
supported. The macros are
<variablelist>
<varlistentry>
<term>AM_PATH_GTK_3_0([minimum-version], [if-found], [if-not-found], [modules])</term>
<listitem>This macro should be used to check that GTK+ is installed
and available for compilation. The four arguments are optional, and
they are: <emphasis>minimum-version</emphasis>, the minimum version
of GTK+ required for compilation; <emphasis>if-found</emphasis>, the
action to perform if a valid version of GTK+ has been found;
<emphasis>if-not-found</emphasis>, the action to perform if a valid
version of GTK+ has not been found; <emphasis>modules</emphasis>, a
list of modules to be checked along with GTK+.</listitem>
</varlistentry>
<varlistentry>
<term>GTK_CHECK_BACKEND([backend-name], [minimum-version], [if-found], [if-not-found])</term>
<listitem>This macro should be used to check if a specific backend
is supported by GTK+. The <emphasis>minimum-version</emphasis>,
<emphasis>if-found</emphasis> and <emphasis>if-not-found</emphasis>
arguments are optional.</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsect1>
</refentry>

View File

@ -11,12 +11,10 @@
<title>GTK+ 3 Reference Manual</title>
<releaseinfo>
This document is for the GTK+ 3 library, version &version;.
The latest version can be found online at
<ulink role="online-location" url="http://library.gnome.org/devel/gtk3/unstable/">http://library.gnome.org/devel/gtk3/unstable/</ulink>.
The latest versions can be found online at
<ulink role="online-location" url="http://library.gnome.org/devel/gtk3/">http://library.gnome.org/devel/gtk3/</ulink>.
If you are looking for the older GTK+ 2 series of libraries,
they can be found under their version numbers; for example,
2.24 is available at
<ulink role="online-location" url="http://library.gnome.org/devel/gtk/2.24/">http://library.gnome.org/devel/gtk/2.24/</ulink>.
see <ulink role="online-location" url="http://library.gnome.org/devel/gtk/">http://library.gnome.org/devel/gtk/</ulink>.
</releaseinfo>
</bookinfo>

View File

@ -5534,7 +5534,9 @@ GTK_STYLE_CLASS_MENUITEM
GTK_STYLE_CLASS_PROGRESSBAR
GTK_STYLE_CLASS_SPINNER
GTK_STYLE_CLASS_TOOLBAR
GTK_STYLE_CLASS_PRIMARY_TOOLBAR
GTK_STYLE_CLASS_PANE_SEPARATOR
GTK_STYLE_CLASS_SEPARATOR
GTK_STYLE_CLASS_DND
GTK_STYLE_CLASS_ERROR
GTK_STYLE_CLASS_EXPANDER

View File

@ -199,7 +199,7 @@
<title>Drawing a GdkPixbuf onto a GdkWindow</title>
<para>
Drawing a pixbuf onto a drawable used to be done like this:
<programlisting><![CDATA[
<informalexample><programlisting>
gdk_draw_pixbuf (window,
gtk_widget_get_style (widget)->black_gc,
pixbuf,
@ -209,16 +209,17 @@ gdk_draw_pixbuf (window,
gdk_pixbuf_get_height (pixbuf),
GDK_RGB_DITHER_NORMAL,
0, 0);
]]></programlisting>
</programlisting></informalexample>
Doing the same thing with cairo:
<programlisting><![CDATA[
<informalexample><programlisting>
cairo_t *cr = gdk_cairo_create (window);
gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y);
cairo_paint (cr);
cairo_destroy (cr);
]]></programlisting>
Note that very similar code can be used for drawing pixmaps
by using gdk_cairo_set_source_pixmap() instead of
</programlisting></informalexample>
Note that very similar code can be used when porting code
using GdkPixmap to #cairo_surface_t by calling
cairo_set_source_surface() instead of
gdk_cairo_set_source_pixbuf().
</para>
</example>
@ -227,7 +228,7 @@ cairo_destroy (cr);
<para>
Tiled pixmaps are often used for drawing backgrounds.
Old code looked something like this:
<programlisting><![CDATA[
<informalexample><programlisting>
GdkGCValues gc_values;
GdkGC *gc;
@ -237,26 +238,30 @@ gdk_gc_set_tile (gc, pixmap);
gdk_gc_set_fill (gc, GDK_TILED);
gdk_gc_set_ts_origin (gc, x_origin, y_origin);
/* use */
gdk_draw_rectangle (drawable, gc, TRUE, 0, 0, width, height);
gdk_draw_rectangle (window, gc, TRUE, 0, 0, width, height);
/* restore */
gdk_gc_set_tile (gc, NULL);
gdk_gc_set_fill (gc, GDK_SOLID);
gdk_gc_set_ts_origin (gc, 0, 0);
]]></programlisting>
The equivalent cairo code looks like this:
<programlisting><![CDATA[
</programlisting></informalexample>
The equivalent cairo code to draw a tiled surface looks
like this:
<informalexample><programlisting>
cairo_t *cr;
cairo_surface_t *surface;
cr = gdk_cairo_create (drawable);
gdk_cairo_set_source_pixmap (cr, pixmap, x_origin, y_origin);
surface = ...
cr = gdk_cairo_create (window);
cairo_set_source_surface (cr, surface, x_origin, y_origin);
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
cairo_rectangle (cr, 0, 0, width, height);
cairo_fill (cr);
cairo_destroy (cr);
]]></programlisting>
Again, you can exchange pixbufs and pixmaps by using
gdk_cairo_set_source_pixbuf() instead of
gdk_cairo_set_source_pixmap().
</programlisting></informalexample>
The surface here can be either an image surface or a X surface,
and can either be created on the spot or kept around for caching purposes.
Another alternative is to use pixbufs instead of surfaces with
gdk_cairo_set_source_pixbuf() instead of cairo_set_source_surface().
</para>
</example>
<example>
@ -264,32 +269,38 @@ cairo_destroy (cr);
<para>
Drawing layouts clipped is often used to avoid overdraw or to
allow drawing selections. Code would have looked like this:
<programlisting><![CDATA[
<informalexample><programlisting>
GdkGC *gc;
/* setup */
gc = gtk_widget_get_style (widget)->text_gc[state];
gdk_gc_set_clip_rectangle (gc, &area);
gdk_gc_set_clip_rectangle (gc, &amp;area);
/* use */
gdk_draw_layout (drawable, gc, x, y, layout);
/* restore */
gdk_gc_set_clip_rectangle (gc, NULL);
]]></programlisting>
</programlisting></informalexample>
With cairo, the same effect can be achieved using:
<programlisting><![CDATA[
<informalexample><programlisting>
GtkStyleContext *context;
GtkStateFlags flags;
GdkRGBA rgba;
cairo_t *cr;
cr = gdk_cairo_create (drawable);
/* clip */
gdk_cairo_rectangle (cr, &area);
gdk_cairo_rectangle (cr, &amp;area);
cairo_clip (cr);
/* set the correct source color */
gdk_cairo_set_source_color (cr, &gtk_widget_get_style (widget)->text[state]);
context = gtk_widget_get_style_context (widget));
state = gtk_widget_get_state_flags (widget);
gtk_style_context_get_color (context, state, &amp;rgba);
gdk_cairo_set_source_rgba (cr, &amp;rgba);
/* draw the text */
cairo_move_to (cr, x, y);
pango_cairo_show_layout (cr, layout);
cairo_destroy (cr);
]]></programlisting>
</programlisting></informalexample>
Clipping using cairo_clip() is of course not restricted to text
rendering and can be used everywhere where GC clips were used.
And using gdk_cairo_set_source_color() with style colors should
@ -305,7 +316,7 @@ cairo_destroy (cr);
It was often used to achieve a checkerboard effect. You can use
cairo_mask() to achieve this effect. To get a checkerbox mask,
you can use code like this:
<programlisting><![CDATA[
<informalexample><programlisting>
static cairo_pattern_t *
gtk_color_button_get_checkered (void)
{
@ -326,44 +337,50 @@ gtk_color_button_get_checkered (void)
return pattern;
}
]]></programlisting>
</programlisting></informalexample>
Note that stippling looks very outdated in UIs, and is rarely
used in modern applications. All properties that made use of
stippling have been removed from GTK+ 3. Most prominently,
stippling is absent from text rendering, in particular #GtkTextTag.
</para>
</formalpara>
<formalpara><title>Using the the target drawable also as source or mask</title>
<formalpara><title>Using the target also as source or mask</title>
<para>
The gdk_draw_drawable() function allowed using the same drawable
as source and target. This was often used to achieve a scrolling
effect. Cairo does not allow this yet. You can however use
cairo_push_group() to get a different intermediate target that
you can copy to. So you can replace this code:
<programlisting><![CDATA[
<informalexample><programlisting>
gdk_draw_drawable (pixmap,
gc,
pixmap,
area.x + dx, area.y + dy,
area.x, area.y,
area.width, area.height);
]]></programlisting>
</programlisting></informalexample>
By using this code:
<programlisting><![CDATA[
cairo_t *cr = gdk_cairo_create (pixmap);
<informalexample><programlisting>
cairo_t *cr = cairo_create (surface);
/* clipping restricts the intermediate surface's size, so it's a good idea
* to use it. */
gdk_cairo_rectangle (cr, &area);
gdk_cairo_rectangle (cr, &amp;area);
cairo_clip (cr);
/* Now push a group to change the target */
cairo_push_group (cr);
gdk_cairo_set_source_pixmap (cr, pixmap, dx, dy);
cairo_set_source_surface (cr, surface, dx, dy);
cairo_paint (cr);
/* Now copy the intermediate target back */
cairo_pop_group_to_source (cr);
cairo_paint (cr);
cairo_destroy (cr);
]]></programlisting>
</programlisting></informalexample>
The surface here can be either an image surface or a X surface,
and can either be created on the spot or kept around for caching purposes.
Another alternative is to use pixbufs instead of surfaces with
gdk_cairo_set_source_pixbuf() instead of cairo_set_source_surface().
</para>
<para>
The cairo developers plan to add self-copies in the future to allow
exactly this effect, so you might want to keep up on cairo
development to be able to change your code.
@ -656,7 +673,7 @@ gtk_fixed_get_preferred_height (GtkWidget *widget,
<para>
One place where pixmaps were commonly used is to create custom
cursors:
<programlisting>
<informalexample><programlisting>
GdkCursor *cursor;
GdkPixmap *pixmap;
cairo_t *cr;
@ -672,10 +689,10 @@ cairo_destroy (cr);
cursor = gdk_cursor_new_from_pixmap (pixmap, pixmap, &amp;fg, &amp;fg, 0, 0);
g_object_unref (pixmap);
</programlisting>
</programlisting></informalexample>
The same can be achieved without pixmaps, by drawing onto
an image surface:
<programlisting>
<informalexample><programlisting>
GdkCursor *cursor;
cairo_surface_t *s;
cairo_t *cr;
@ -696,7 +713,7 @@ cairo_surface_destroy (s);
cursor = gdk_cursor_new_from_pixbuf (display, pixbuf, 0, 0);
g_object_unref (pixbuf);
</programlisting>
</programlisting></informalexample>
</para>
</example>
</section>
@ -715,7 +732,7 @@ g_object_unref (pixbuf);
<para>You might have a screen-changed handler like the following
to set up a translucent window with an alpha-channel:
</para>
<programlisting>
<informalexample><programlisting>
static void
on_alpha_screen_changed (GtkWidget *widget,
GdkScreen *old_screen,
@ -729,11 +746,11 @@ on_alpha_screen_changed (GtkWidget *widget,
gtk_widget_set_colormap (widget, colormap);
}
</programlisting>
</programlisting></informalexample>
<para>
With visuals instead of colormaps, this will look as follows:
</para>
<programlisting>
<informalexample><programlisting>
static void
on_alpha_screen_changed (GtkWindow *window,
GdkScreen *old_screen,
@ -747,7 +764,7 @@ on_alpha_screen_changed (GtkWindow *window,
gtk_widget_set_visual (window, visual);
}
</programlisting>
</programlisting></informalexample>
</example>
</section>
@ -757,8 +774,8 @@ on_alpha_screen_changed (GtkWindow *window,
<para>
#GdkDrawable has been removed in GTK+ 3, together with #GdkPixmap
and #GdkImage. The only remaining drawable class is #GdkWindow.
For dealing with image data, you should use cairo surfaces or
#GdkPixbufs.
For dealing with image data, you should use a #cairo_surface_t or
a #GdkPixbuf.
</para>
<para>
@ -891,6 +908,19 @@ gdk_window_add_filter (NULL, message_filter, NULL);
}
</programlisting></informalexample>
</para>
<para>
If you used the pkg-config variable <varname>target</varname> to
conditionally build part of your project depending on the GDK backend,
for instance like this:
<informalexample><programlisting>
AM_CONDITIONAL(BUILD_X11, test `$PKG_CONFIG --variable=target gtk+-2.0` = "x11")
</programlisting></informalexample>
then you should now use the M4 macro provided by GTK+ itself:
<informalexample><programlisting>
GTK_CHECK_BACKEND([x11], [3.0.2], [have_x11=yes], [have_x11=no])
AM_CONDITIONAL(BUILD_x11, [test "x$have_x11" = "xyes"])
</programlisting></informalexample>
</para>
</section>
<section>
@ -922,7 +952,7 @@ gdk_window_add_filter (NULL, message_filter, NULL);
is available via the new gtk_widget_get_allocated_width() and
gtk_widget_get_allocated_height() functions. It is not necessary to
check for GTK_WIDGET_IS_DRAWABLE(), since GTK+ already does this check
before emitting the ::draw signal.
before emitting the #GtkWidget::draw signal.
</para>
<para>
There are some special considerations for widgets with multiple windows.
@ -941,7 +971,7 @@ gdk_window_add_filter (NULL, message_filter, NULL);
}
...
</programlisting></informalexample>
In contrast, the ::draw signal handler may have to draw multiple
In contrast, the #GtkWidget::draw signal handler may have to draw multiple
windows in one call. GTK+ has a convenience function
gtk_cairo_should_draw_window() that can be used to find out if
a window needs to be drawn. With that, the example above would look
@ -974,10 +1004,13 @@ gboolean
gtk_arrow_draw (GtkWidget *widget,
cairo_t *cr)
{
GtkStyleContext *context;
gint x, y;
gint width, height;
gint extent;
context = gtk_widget_get_style_context (widget);
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
@ -985,15 +1018,7 @@ gtk_arrow_draw (GtkWidget *widget,
x = PAD;
y = PAD;
gtk_paint_arrow (gtk_widget_get_style (widget),
cr,
gtk_widget_get_state (widget),
GTK_SHADOW_OUT,
widget,
"arrow",
widget->priv->arrow_type,
TRUE,
x, y, extent, extent);
gtk_render_arrow (context, rc, G_PI / 2, x, y, extent);
}
</programlisting>
</example>
@ -1078,7 +1103,7 @@ gtk_arrow_draw (GtkWidget *widget,
classes that are directly derived from GtkObject, you have to make
them derive from #GInitiallyUnowned (or, if you don't need the floating
functionality, #GObject). If you have widgets that override the
destroy class handler, you have to adust your class_init function,
destroy class handler, you have to adjust your class_init function,
since destroy is now a member of GtkWidgetClass:
<informalexample><programlisting>
GtkObjectClass *object_class = GTK_OBJECT_CLASS (class);

View File

@ -382,12 +382,30 @@ nevertheless.
</formalpara>
<formalpara>
<title><envar>GDK_NATIVE_WINDOWS</envar></title>
<title><envar>GDK_BACKEND</envar></title>
<para>
If set, GDK creates all windows as native windows. This can help
applications that make assumptions about 1-1 correspondence between
GDK windows and X11 windows.
If set, selects the GDK backend to use. Selecting a backend requires that GTK is compiled
with support for that backend. The following backends can be selected:
<variablelist>
<varlistentry>
<term>quartz</term>
<listitem><para>Selects the native Quartz backend</para></listitem>
</varlistentry>
<varlistentry>
<term>win32</term>
<listitem><para>Selects the native backend for Microsoft Windows</para></listitem>
</varlistentry>
<varlistentry>
<term>x11</term>
<listitem><para>Selects the native backend for connecting to X11 servers.</para></listitem>
</varlistentry>
</variablelist>
For more information about selecting backends, see the gdk_display_manager_get() function.
</para>
</formalpara>

View File

@ -92,10 +92,6 @@ gdk_public_h_sources = \
gdkvisual.h \
gdkwindow.h
gdk_built_public_sources = \
gdkconfig.h \
gdkenumtypes.h
gdk_private_headers = \
gdkapplaunchcontextprivate.h \
gdkcursorprivate.h \
@ -141,14 +137,15 @@ gdk_built_sources = \
gdkenumtypes.c \
gdkmarshalers.h \
gdkmarshalers.c \
$(gdk_built_public_sources)
gdkenumtypes.h
#
# setup GDK sources and their dependencies
#
gdkincludedir = $(includedir)/gtk-3.0/gdk
gdkinclude_HEADERS = $(gdk_public_h_sources) $(gdk_built_public_sources)
gdkinclude_HEADERS = $(gdk_public_h_sources) gdkenumtypes.h
nodist_gdkinclude_HEADERS = gdkconfig.h
common_sources = \
$(gdk_private_headers) \
@ -229,7 +226,7 @@ x11_introspection_files = \
x11/gdkxid.c \
x11/xsettings-client.c \
x11/xsettings-common.c \
x11/gdkx.h \
x11/gdkx.h \
x11/gdkx11cursor.h \
x11/gdkx11display.h \
x11/gdkx11property.h \
@ -305,14 +302,12 @@ lib_LTLIBRARIES = libgdk-3.la
MAINTAINERCLEANFILES = $(gdk_built_sources) stamp-gdkenumtypes.h
EXTRA_DIST += $(gdk_built_sources)
EXTRA_HEADERS =
install-exec-hook:
if DISABLE_EXPLICIT_DEPS
$(SHELL) $(top_srcdir)/sanitize-la.sh $(DESTDIR)$(libdir)/libgdk-3.la
endif
#note: not gdkconfig.h
BUILT_SOURCES = \
$(gdk_built_sources) \
gdkconfig.h

View File

@ -236,8 +236,8 @@ gdk_pre_parse_libgtk_only (void)
if (getenv ("GDK_NATIVE_WINDOWS"))
{
_gdk_native_windows = TRUE;
/* Ensure that this is not propagated to spawned applications */
g_warning ("The GDK_NATIVE_WINDOWS environment variable is not supported in GTK3.\n"
"See the documentation for gdk_window_ensure_native() on how to get native windows.");
g_unsetenv ("GDK_NATIVE_WINDOWS");
}

View File

@ -1216,10 +1216,7 @@ gdk_device_grab (GdkDevice *device,
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_GRAB_SUCCESS);
g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_GRAB_SUCCESS);
if (_gdk_native_windows)
native = window;
else
native = gdk_window_get_toplevel (window);
native = gdk_window_get_toplevel (window);
while (native->window_type == GDK_WINDOW_OFFSCREEN)
{

View File

@ -41,19 +41,19 @@
* By default, and if the platform supports it, GDK is aware of multiple
* keyboard/pointer pairs and multitouch devices, this behavior can be
* changed by calling gdk_disable_multidevice() before gdk_display_open(),
* although there would be rarely a reason to do that. For a widget or
* although there would rarely be a reason to do that. For a widget or
* window to be dealt as multipointer aware,
* gdk_window_set_support_multidevice() or
* gtk_widget_set_support_multidevice() must have been called on it.
*
* Conceptually, in multidevice mode there are 2 device types, virtual
* Conceptually, in multidevice mode there are 2 device types. Virtual
* devices (or master devices) are represented by the pointer cursors
* and keyboard foci that are seen on the screen. Physical devices (or
* slave devices) represent the hardware that is controlling the virtual
* devices, and thus has no visible cursor on the screen.
* devices, and thus have no visible cursor on the screen.
*
* Virtual devices are always paired, there is a keyboard device for every
* pointer device, associations between devices may be inspected through
* Virtual devices are always paired, so there is a keyboard device for every
* pointer device. Associations between devices may be inspected through
* gdk_device_get_associated_device().
*
* There may be several virtual devices, and several physical devices could
@ -72,9 +72,9 @@
* #GDK_DRAG_MOTION, #GDK_DRAG_STATUS, #GDK_DROP_START, #GDK_DROP_FINISHED
* and #GDK_GRAB_BROKEN.
* </footnote>
* although gdk_window_set_support_multidevice() has to be called on
* Although gdk_window_set_support_multidevice() must be called on
* #GdkWindows in order to support additional features of multiple pointer
* interaction, such as multiple, per-device enter/leave events. The default
* interaction, such as multiple per-device enter/leave events, the default
* setting will emit just one enter/leave event pair for all devices on the
* window. See gdk_window_set_support_multidevice() documentation for more
* information.
@ -101,7 +101,7 @@
* physical devices being plugged or unplugged), GDK provides
* #GdkDeviceManager. On X11, multidevice support is implemented through
* XInput 2. Unless gdk_disable_multidevice() is called, the XInput 2.x
* #GdkDeviceManager implementation will be used as input source, else
* #GdkDeviceManager implementation will be used as the input source. Otherwise
* either the core or XInput 1.x implementations will be used.
*/

View File

@ -764,10 +764,6 @@ synthesize_crossing_events (GdkDisplay *display,
GdkModifierType state;
int x, y;
/* We use the native crossing events if all native */
if (_gdk_native_windows)
return;
if (src_window)
src_toplevel = gdk_window_get_toplevel (src_window);
else
@ -1342,7 +1338,9 @@ gdk_display_get_device_manager (GdkDisplay *display)
G_CONST_RETURN gchar *
gdk_display_get_name (GdkDisplay *display)
{
return GDK_DISPLAY_GET_CLASS(display)->get_name (display);
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_DISPLAY_GET_CLASS (display)->get_name (display);
}
gchar *
@ -1364,7 +1362,9 @@ gdk_get_display (void)
gint
gdk_display_get_n_screens (GdkDisplay *display)
{
return GDK_DISPLAY_GET_CLASS(display)->get_n_screens (display);
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
return GDK_DISPLAY_GET_CLASS (display)->get_n_screens (display);
}
/**
@ -1382,7 +1382,9 @@ GdkScreen *
gdk_display_get_screen (GdkDisplay *display,
gint screen_num)
{
return GDK_DISPLAY_GET_CLASS(display)->get_screen (display, screen_num);
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_DISPLAY_GET_CLASS (display)->get_screen (display, screen_num);
}
/**
@ -1398,7 +1400,9 @@ gdk_display_get_screen (GdkDisplay *display,
GdkScreen *
gdk_display_get_default_screen (GdkDisplay *display)
{
return GDK_DISPLAY_GET_CLASS(display)->get_default_screen (display);
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_DISPLAY_GET_CLASS (display)->get_default_screen (display);
}
/**
@ -1412,7 +1416,9 @@ gdk_display_get_default_screen (GdkDisplay *display)
void
gdk_display_beep (GdkDisplay *display)
{
GDK_DISPLAY_GET_CLASS(display)->beep (display);
g_return_if_fail (GDK_IS_DISPLAY (display));
GDK_DISPLAY_GET_CLASS (display)->beep (display);
}
/**
@ -1434,7 +1440,9 @@ gdk_display_beep (GdkDisplay *display)
void
gdk_display_sync (GdkDisplay *display)
{
GDK_DISPLAY_GET_CLASS(display)->sync (display);
g_return_if_fail (GDK_IS_DISPLAY (display));
GDK_DISPLAY_GET_CLASS (display)->sync (display);
}
/**
@ -1456,7 +1464,9 @@ gdk_display_sync (GdkDisplay *display)
void
gdk_display_flush (GdkDisplay *display)
{
GDK_DISPLAY_GET_CLASS(display)->flush (display);
g_return_if_fail (GDK_IS_DISPLAY (display));
GDK_DISPLAY_GET_CLASS (display)->flush (display);
}
/**
@ -1475,7 +1485,9 @@ gdk_display_flush (GdkDisplay *display)
GdkWindow *
gdk_display_get_default_group (GdkDisplay *display)
{
return GDK_DISPLAY_GET_CLASS(display)->get_default_group (display);
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_DISPLAY_GET_CLASS (display)->get_default_group (display);
}
/**
@ -1493,7 +1505,9 @@ gdk_display_get_default_group (GdkDisplay *display)
gboolean
gdk_display_supports_selection_notification (GdkDisplay *display)
{
return GDK_DISPLAY_GET_CLASS(display)->supports_selection_notification (display);
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return GDK_DISPLAY_GET_CLASS (display)->supports_selection_notification (display);
}
/**
@ -1515,7 +1529,9 @@ gdk_display_request_selection_notification (GdkDisplay *display,
GdkAtom selection)
{
return GDK_DISPLAY_GET_CLASS(display)->request_selection_notification (display, selection);
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return GDK_DISPLAY_GET_CLASS (display)->request_selection_notification (display, selection);
}
/**
@ -1534,7 +1550,9 @@ gdk_display_request_selection_notification (GdkDisplay *display,
gboolean
gdk_display_supports_clipboard_persistence (GdkDisplay *display)
{
return GDK_DISPLAY_GET_CLASS(display)->supports_clipboard_persistence (display);
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return GDK_DISPLAY_GET_CLASS (display)->supports_clipboard_persistence (display);
}
/**
@ -1562,7 +1580,9 @@ gdk_display_store_clipboard (GdkDisplay *display,
const GdkAtom *targets,
gint n_targets)
{
GDK_DISPLAY_GET_CLASS(display)->store_clipboard (display, clipboard_window, time_, targets, n_targets);
g_return_if_fail (GDK_IS_DISPLAY (display));
GDK_DISPLAY_GET_CLASS (display)->store_clipboard (display, clipboard_window, time_, targets, n_targets);
}
/**
@ -1579,7 +1599,9 @@ gdk_display_store_clipboard (GdkDisplay *display,
gboolean
gdk_display_supports_shapes (GdkDisplay *display)
{
return GDK_DISPLAY_GET_CLASS(display)->supports_shapes (display);
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return GDK_DISPLAY_GET_CLASS (display)->supports_shapes (display);
}
/**
@ -1596,7 +1618,9 @@ gdk_display_supports_shapes (GdkDisplay *display)
gboolean
gdk_display_supports_input_shapes (GdkDisplay *display)
{
return GDK_DISPLAY_GET_CLASS(display)->supports_input_shapes (display);
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return GDK_DISPLAY_GET_CLASS (display)->supports_input_shapes (display);
}
/**
@ -1616,7 +1640,9 @@ gdk_display_supports_input_shapes (GdkDisplay *display)
gboolean
gdk_display_supports_composite (GdkDisplay *display)
{
return GDK_DISPLAY_GET_CLASS(display)->supports_composite (display);
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return GDK_DISPLAY_GET_CLASS (display)->supports_composite (display);
}
/**
@ -1636,7 +1662,9 @@ gdk_display_supports_composite (GdkDisplay *display)
GList *
gdk_display_list_devices (GdkDisplay *display)
{
return GDK_DISPLAY_GET_CLASS(display)->list_devices (display);
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_DISPLAY_GET_CLASS (display)->list_devices (display);
}
static GdkAppLaunchContext *
@ -1666,7 +1694,9 @@ gdk_display_real_get_app_launch_context (GdkDisplay *display)
GdkAppLaunchContext *
gdk_display_get_app_launch_context (GdkDisplay *display)
{
return GDK_DISPLAY_GET_CLASS(display)->get_app_launch_context (display);
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_DISPLAY_GET_CLASS (display)->get_app_launch_context (display);
}
/**
@ -1683,7 +1713,8 @@ gdk_display_get_app_launch_context (GdkDisplay *display)
GdkDisplay *
gdk_display_open (const gchar *display_name)
{
return gdk_display_manager_open_display (gdk_display_manager_get (), display_name);
return gdk_display_manager_open_display (gdk_display_manager_get (),
display_name);
}
/**
@ -1700,6 +1731,8 @@ gdk_display_open (const gchar *display_name)
gboolean
gdk_display_has_pending (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return GDK_DISPLAY_GET_CLASS (display)->has_pending (display);
}
@ -1818,6 +1851,8 @@ gdk_display_warp_pointer (GdkDisplay *display,
gint x,
gint y)
{
g_return_if_fail (GDK_IS_DISPLAY (display));
gdk_device_warp (display->core_pointer,
screen,
x, y);
@ -1895,6 +1930,8 @@ void
gdk_display_notify_startup_complete (GdkDisplay *display,
const gchar *startup_id)
{
g_return_if_fail (GDK_IS_DISPLAY (display));
GDK_DISPLAY_GET_CLASS (display)->notify_startup_complete (display, startup_id);
}
@ -1950,6 +1987,8 @@ _gdk_display_create_window (GdkDisplay *display)
GdkKeymap*
gdk_keymap_get_for_display (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_DISPLAY_GET_CLASS (display)->get_keymap (display);
}

View File

@ -229,11 +229,6 @@ gdk_display_manager_get (void)
const gchar *backend;
backend = g_getenv ("GDK_BACKEND");
#ifdef GDK_WINDOWING_X11
if (backend == NULL || strcmp (backend, "x11") == 0)
manager = g_object_new (gdk_x11_display_manager_get_type (), NULL);
else
#endif
#ifdef GDK_WINDOWING_QUARTZ
if (backend == NULL || strcmp (backend, "quartz") == 0)
manager = g_object_new (gdk_quartz_display_manager_get_type (), NULL);
@ -244,6 +239,11 @@ gdk_display_manager_get (void)
manager = g_object_new (gdk_win32_display_manager_get_type (), NULL);
else
#endif
#ifdef GDK_WINDOWING_X11
if (backend == NULL || strcmp (backend, "x11") == 0)
manager = g_object_new (gdk_x11_display_manager_get_type (), NULL);
else
#endif
#ifdef GDK_WINDOWING_BROADWAY
if (backend == NULL || strcmp (backend, "broadway") == 0)
manager = g_object_new (gdk_broadway_display_manager_get_type (), NULL);

View File

@ -555,6 +555,8 @@ gdk_event_copy (const GdkEvent *event)
break;
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
if (event->button.axes)
new_event->button.axes = g_memdup (event->button.axes,
@ -632,6 +634,8 @@ gdk_event_free (GdkEvent *event)
break;
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
g_free (event->button.axes);
break;

View File

@ -36,6 +36,5 @@ guint _gdk_debug_flags = 0;
GList *_gdk_default_filters = NULL;
gchar *_gdk_display_name = NULL;
gchar *_gdk_display_arg_name = NULL;
gboolean _gdk_native_windows = FALSE;
gboolean _gdk_disable_multidevice = FALSE;

View File

@ -91,7 +91,6 @@ extern GList *_gdk_default_filters;
extern GdkWindow *_gdk_parent_root;
extern guint _gdk_debug_flags;
extern gboolean _gdk_native_windows;
#ifdef G_ENABLE_DEBUG

View File

@ -78,7 +78,7 @@
* composited and therefore is no longer automatically drawn to the screen.
*
* When the contents of the event box change, an expose event is generated on
* it's parent window (which, in this case, belongs to the toplevel #GtkWindow).
* its parent window (which, in this case, belongs to the toplevel #GtkWindow).
* The expose handler for this widget is responsible for merging the changes
* back on the screen in the way that it wishes.
*
@ -920,14 +920,8 @@ recompute_visible_regions_internal (GdkWindow *private,
{
cairo_region_intersect (new_clip, private->parent->clip_region);
/* Remove all overlapping children from parent.
* Unless we're all native, because then we don't need to take
* siblings into account since X does that clipping for us.
* This makes things like SWT that modify the raw X stacking
* order without GDKs knowledge work.
*/
if (!_gdk_native_windows)
remove_child_area (private->parent, private, FALSE, new_clip);
/* Remove all overlapping children from parent. */
remove_child_area (private->parent, private, FALSE, new_clip);
}
/* Convert from parent coords to window coords */
@ -1146,8 +1140,7 @@ get_native_device_event_mask (GdkWindow *private,
else
event_mask = private->event_mask;
if (_gdk_native_windows ||
private->window_type == GDK_WINDOW_ROOT ||
if (private->window_type == GDK_WINDOW_ROOT ||
private->window_type == GDK_WINDOW_FOREIGN)
return event_mask;
else
@ -1288,13 +1281,6 @@ gdk_window_new (GdkWindow *parent,
return NULL;
}
if (attributes->window_type == GDK_WINDOW_OFFSCREEN &&
_gdk_native_windows)
{
g_warning ("Offscreen windows not supported with native-windows gdk");
return NULL;
}
display = gdk_screen_get_display (screen);
window = _gdk_display_create_window (display);
@ -1384,7 +1370,7 @@ gdk_window_new (GdkWindow *parent,
window->device_cursor = g_hash_table_new_full (NULL, NULL,
NULL, g_object_unref);
native = _gdk_native_windows; /* Default */
native = FALSE;
if (window->parent->window_type == GDK_WINDOW_ROOT)
native = TRUE; /* Always use native windows for toplevels */
else if (!window->input_only &&
@ -2639,9 +2625,6 @@ gdk_window_begin_implicit_paint (GdkWindow *window, GdkRectangle *rect)
g_assert (gdk_window_has_impl (window));
if (_gdk_native_windows)
return FALSE; /* No need for implicit paints since we can't merge draws anyway */
if (GDK_IS_PAINTABLE (window->impl))
return FALSE; /* Implementation does double buffering */
@ -5143,8 +5126,7 @@ set_viewable (GdkWindow *w,
set_viewable (child, val);
}
if (!_gdk_native_windows &&
gdk_window_has_impl (w) &&
if (gdk_window_has_impl (w) &&
w->window_type != GDK_WINDOW_FOREIGN &&
!gdk_window_is_toplevel (w))
{
@ -5169,9 +5151,6 @@ set_viewable (GdkWindow *w,
* do the show ourselves. We can't really tell this case from the normal
* toplevel show as such toplevels are seen by gdk as parents of the
* root window, so we make an exception for all toplevels.
*
* Also, when in GDK_NATIVE_WINDOW mode we never need to play games
* like this, so we just always show/hide directly.
*/
impl_class = GDK_WINDOW_IMPL_GET_CLASS (w->impl);
@ -5843,10 +5822,7 @@ gdk_window_set_device_events (GdkWindow *window,
g_hash_table_insert (window->device_events, device,
GINT_TO_POINTER (event_mask));
if (_gdk_native_windows)
native = window;
else
native = gdk_window_get_toplevel (window);
native = gdk_window_get_toplevel (window);
while (gdk_window_is_offscreen (native))
{
@ -6596,8 +6572,7 @@ update_cursor_foreach (GdkDisplay *display,
{
GdkWindow *window = user_data;
if (_gdk_native_windows ||
window->window_type == GDK_WINDOW_ROOT ||
if (window->window_type == GDK_WINDOW_ROOT ||
window->window_type == GDK_WINDOW_FOREIGN)
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_device_cursor (window, device, window->cursor);
else if (_gdk_window_event_parent_of (window, pointer_info->window_under_pointer))
@ -8569,11 +8544,6 @@ _gdk_display_set_window_under_pointer (GdkDisplay *display,
{
GdkPointerWindowInfo *device_info;
/* We don't track this if all native, and it can cause issues
with the update_cursor call below */
if (_gdk_native_windows)
return;
device_info = _gdk_display_get_pointer_info (display, device);
if (device_info->window_under_pointer)
@ -8672,10 +8642,7 @@ gdk_pointer_grab (GdkWindow * window,
!gdk_window_is_viewable (window))
return GDK_GRAB_NOT_VIEWABLE;
if (_gdk_native_windows)
native = window;
else
native = gdk_window_get_toplevel (window);
native = gdk_window_get_toplevel (window);
while (gdk_window_is_offscreen (native))
{
native = gdk_offscreen_window_get_embedder (native);
@ -8775,10 +8742,7 @@ gdk_keyboard_grab (GdkWindow *window,
!gdk_window_is_viewable (window))
return GDK_GRAB_NOT_VIEWABLE;
if (_gdk_native_windows)
native = window;
else
native = gdk_window_get_toplevel (window);
native = gdk_window_get_toplevel (window);
while (gdk_window_is_offscreen (native))
{
@ -9047,9 +9011,6 @@ _gdk_synthesize_crossing_events_for_geometry_change (GdkWindow *changed_window)
{
GdkWindow *toplevel;
if (_gdk_native_windows)
return; /* We use the native crossing events if all native */
toplevel = get_event_toplevel (changed_window);
if (!toplevel->synthesize_crossing_event_queued)
@ -9584,45 +9545,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
}
#endif
if (_gdk_native_windows)
{
if (event->type == GDK_BUTTON_PRESS &&
!event->any.send_event &&
_gdk_display_has_device_grab (display, device, serial) == NULL)
{
_gdk_display_add_device_grab (display,
device,
event_window,
event_window,
GDK_OWNERSHIP_NONE,
FALSE,
gdk_window_get_events (event_window),
serial,
gdk_event_get_time (event),
TRUE);
_gdk_display_device_grab_update (display, device, source_device, serial);
}
if (event->type == GDK_BUTTON_RELEASE &&
!event->any.send_event)
{
button_release_grab =
_gdk_display_has_device_grab (display, device, serial);
if (button_release_grab &&
button_release_grab->implicit &&
(event->button.state & GDK_ANY_BUTTON_MASK & ~(GDK_BUTTON1_MASK << (event->button.button - 1))) == 0)
{
button_release_grab->serial_end = serial;
button_release_grab->implicit_ungrab = FALSE;
_gdk_display_device_grab_update (display, device, source_device, serial);
}
}
if (event->type == GDK_BUTTON_PRESS)
_gdk_event_button_generate (display, event);
return;
}
if (event->type == GDK_VISIBILITY_NOTIFY)
{
event_window->native_visibility = event->visibility.state;

View File

@ -874,7 +874,7 @@ run_loop_before_waiting (void)
}
else if (timeout > 0)
{
/* We need to get the run loop to break out of it's wait when our timeout
/* We need to get the run loop to break out of its wait when our timeout
* expires. We do this by adding a dummy timer that we'll remove immediately
* after the wait wakes up.
*/

View File

@ -24,17 +24,14 @@
#include <math.h>
#include <gdk/gdk.h>
#include "gdkwin32.h"
#include "gdkprivate-win32.h"
#include "gdkdevicemanager-win32.h"
#include "gdkdeviceprivate.h"
#include "gdkdevice-win32.h"
#include "gdkdevice-wintab.h"
#include "gdkwin32.h"
#include "gdkdisplayprivate.h"
#include <windows.h>
#include <wintab.h>
#define WINTAB32_DLL "Wintab32.dll"
#define PACKETDATA (PK_CONTEXT | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_ORIENTATION)

View File

@ -48,11 +48,11 @@
#include "gdk.h"
#include "gdkdisplayprivate.h"
#include "gdkprivate-win32.h"
#include "gdkwin32.h"
#include "gdkkeysyms.h"
#include "gdkdevicemanager-win32.h"
#include "gdkdeviceprivate.h"
#include "gdkdevice-wintab.h"
#include "gdkwin32.h"
#include "gdkwin32dnd.h"
#include "gdkdndprivate.h"
@ -1958,12 +1958,16 @@ gdk_event_translate (MSG *msg,
build_key_event_state (event, key_state);
gdk_keymap_translate_keyboard_state (_gdk_win32_display_get_keymap (_gdk_display),
event->key.hardware_keycode,
event->key.state,
event->key.group,
&event->key.keyval,
NULL, NULL, NULL);
if (msg->wParam == VK_PACKET &&
ToUnicode (VK_PACKET, HIWORD (msg->lParam), key_state, wbuf, 1, 0) == 1)
event->key.keyval = gdk_unicode_to_keyval (wbuf[0]);
else
gdk_keymap_translate_keyboard_state (_gdk_win32_display_get_keymap (_gdk_display),
event->key.hardware_keycode,
event->key.state,
event->key.group,
&event->key.keyval,
NULL, NULL, NULL);
fill_key_event_string (event);

View File

@ -417,7 +417,7 @@ update_keymap (void)
{
guint keysym = gdk_unicode_to_keyval (wcs[0]);
/* It is a dead key, and it's has been stored in
/* It is a dead key, and it has been stored in
* the keyboard layout's state by
* ToAsciiEx()/ToUnicodeEx(). Yes, this is an
* incredibly silly API! Make the keyboard

View File

@ -404,7 +404,6 @@ RegisterGdkClass (GdkWindowType wtype, GdkWindowTypeHint wtype_hint)
* Create native windows.
*
* With the default Gdk the created windows are mostly toplevel windows.
* A lot of child windows are only created for GDK_NATIVE_WINDOWS.
*
* Placement of the window is derived from the passed in window,
* except for toplevel window where OS/Window Manager placement

View File

@ -24,9 +24,13 @@ libgdk_x11_la_SOURCES = \
gdkasync.h \
gdkcursor-x11.c \
gdkdevice-core-x11.c \
gdkdevice-xi.c \
gdkdevice-xi2.c \
gdkdeviceprivate-xi.h \
gdkdevicemanager-core-x11.c \
gdkdevicemanager-x11.c \
gdkdevicemanager-xi.c \
gdkdevicemanager-xi2.c \
gdkdevicemanagerprivate-core.h \
gdkdisplaymanager-x11.c \
gdkdisplay-x11.c \
@ -56,34 +60,18 @@ libgdk_x11_la_SOURCES = \
xsettings-common.h \
xsettings-common.c
libgdkx11include_HEADERS =
if XINPUT_XFREE
libgdk_x11_la_SOURCES += \
gdkdevicemanager-xi.c \
gdkdevice-xi.c
libgdkx11include_HEADERS += \
gdkx11devicemanager-xi.h \
gdkx11device-xi.h
if XINPUT_2
libgdk_x11_la_SOURCES += \
gdkdevicemanager-xi2.c \
gdkdevice-xi2.c
libgdkx11include_HEADERS += \
gdkx11devicemanager-xi2.h \
gdkx11device-xi2.h
endif
endif
libgdkinclude_HEADERS = \
gdkx.h
libgdkx11include_HEADERS += \
libgdkx11include_HEADERS = \
gdkx11applaunchcontext.h \
gdkx11cursor.h \
gdkx11device-core.h \
gdkx11device-xi.h \
gdkx11device-xi2.h \
gdkx11devicemanager-core.h \
gdkx11devicemanager-xi.h \
gdkx11devicemanager-xi2.h \
gdkx11display.h \
gdkx11displaymanager.h \
gdkx11dnd.h \

View File

@ -288,99 +288,6 @@ _gdk_x11_send_client_message_async (GdkDisplay *display,
SyncHandle();
}
static Bool
set_input_focus_handler (Display *dpy,
xReply *rep,
char *buf,
int len,
XPointer data)
{
SetInputFocusState *state = (SetInputFocusState *)data;
if (dpy->last_request_read == state->set_input_focus_req)
{
if (rep->generic.type == X_Error &&
rep->error.errorCode == BadMatch)
{
/* Consume BadMatch errors, since we have no control
* over them.
*/
return True;
}
}
if (dpy->last_request_read == state->get_input_focus_req)
{
xGetInputFocusReply replbuf;
xGetInputFocusReply *repl G_GNUC_UNUSED;
if (rep->generic.type != X_Error)
{
/* Actually does nothing, since there are no additional bytes
* to read, but maintain good form.
*/
repl = (xGetInputFocusReply *)
_XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len,
(sizeof(xGetInputFocusReply) - sizeof(xReply)) >> 2,
True);
}
DeqAsyncHandler(state->dpy, &state->async);
g_free (state);
return (rep->generic.type != X_Error);
}
return False;
}
void
_gdk_x11_set_input_focus_safe (GdkDisplay *display,
Window window,
int revert_to,
Time time)
{
Display *dpy;
SetInputFocusState *state;
dpy = GDK_DISPLAY_XDISPLAY (display);
state = g_new (SetInputFocusState, 1);
state->dpy = dpy;
LockDisplay(dpy);
state->async.next = dpy->async_handlers;
state->async.handler = set_input_focus_handler;
state->async.data = (XPointer) state;
dpy->async_handlers = &state->async;
{
xSetInputFocusReq *req;
GetReq(SetInputFocus, req);
req->focus = window;
req->revertTo = revert_to;
req->time = time;
state->set_input_focus_req = dpy->request;
}
/*
* XSync (dpy, 0)
*/
{
xReq *req;
GetEmptyReq(GetInputFocus, req);
state->get_input_focus_req = dpy->request;
}
UnlockDisplay(dpy);
SyncHandle();
}
static Bool
list_children_handler (Display *dpy,
xReply *rep,

View File

@ -54,10 +54,6 @@ void _gdk_x11_send_client_message_async (GdkDisplay *display,
XClientMessageEvent *event_send,
GdkSendXEventCallback callback,
gpointer data);
void _gdk_x11_set_input_focus_safe (GdkDisplay *display,
Window window,
int revert_to,
Time time);
gboolean _gdk_x11_get_window_child_info (GdkDisplay *display,
Window window,

View File

@ -694,7 +694,7 @@ gdk_cursor_new_from_pixmap (GdkDisplay *display,
xbg.blue = bg->blue;
xbg.green = bg->green;
if (gdk_display_is_closed (display->closed))
if (gdk_display_is_closed (display))
xcursor = None;
else
xcursor = XCreatePixmapCursor (GDK_DISPLAY_XDISPLAY (display),

View File

@ -20,13 +20,22 @@
#include "config.h"
#include "gdkx11device-xi.h"
#include "gdkdeviceprivate-xi.h"
#ifdef XINPUT_XFREE
#include "gdkwindow.h"
#include "gdkintl.h"
#include "gdkprivate-x11.h"
#include "gdkasync.h"
#endif
G_DEFINE_TYPE (GdkX11DeviceXI, gdk_x11_device_xi, GDK_TYPE_DEVICE)
#ifdef XINPUT_XFREE
#define MAX_DEVICE_CLASSES 13
static GQuark quark_window_input_info = 0;
@ -97,8 +106,6 @@ static void gdk_x11_device_xi_select_window_events (GdkDevice *device,
GdkEventMask mask);
G_DEFINE_TYPE (GdkX11DeviceXI, gdk_x11_device_xi, GDK_TYPE_DEVICE)
enum {
PROP_0,
PROP_DEVICE_ID
@ -639,3 +646,17 @@ _gdk_x11_device_xi_translate_axes (GdkDevice *device,
if (y)
*y = temp_y;
}
#else /* XINPUT_XFREE */
static void
gdk_x11_device_xi_class_init (GdkX11DeviceXIClass *klass)
{
}
static void
gdk_x11_device_xi_init (GdkX11DeviceXI *device)
{
}
#endif /* XINPUT_XFREE */

View File

@ -26,11 +26,15 @@
#include "gdkasync.h"
#include "gdkprivate-x11.h"
#ifdef XINPUT_2
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/XInput2.h>
#endif
struct _GdkX11DeviceXI2
{
GdkDevice parent_instance;
@ -43,6 +47,10 @@ struct _GdkX11DeviceXI2Class
GdkDeviceClass parent_class;
};
G_DEFINE_TYPE (GdkX11DeviceXI2, gdk_x11_device_xi2, GDK_TYPE_DEVICE)
#ifdef XINPUT_2
static void gdk_x11_device_xi2_get_property (GObject *object,
guint prop_id,
GValue *value,
@ -93,8 +101,6 @@ static void gdk_x11_device_xi2_select_window_events (GdkDevice *device,
GdkEventMask event_mask);
G_DEFINE_TYPE (GdkX11DeviceXI2, gdk_x11_device_xi2, GDK_TYPE_DEVICE)
enum {
PROP_0,
PROP_DEVICE_ID
@ -177,16 +183,17 @@ gdk_x11_device_xi2_get_state (GdkDevice *device,
GdkModifierType *mask)
{
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
GdkDisplay *display;
XIDeviceInfo *info;
gint i, j, ndevices;
display = gdk_device_get_display (device);
if (axes)
{
info = XIQueryDevice(GDK_DISPLAY_XDISPLAY (display),
device_xi2->device_id, &ndevices);
GdkDisplay *display;
XIDeviceInfo *info;
gint i, j, ndevices;
display = gdk_device_get_display (device);
info = XIQueryDevice (GDK_DISPLAY_XDISPLAY (display),
device_xi2->device_id, &ndevices);
for (i = 0, j = 0; i < info->num_classes; i++)
{
@ -742,3 +749,17 @@ _gdk_x11_device_xi2_translate_state (XIModifierState *mods_state,
return state;
}
#else /* XINPUT_2 */
static void
gdk_x11_device_xi2_class_init (GdkX11DeviceXI2Class *klass)
{
}
static void
gdk_x11_device_xi2_init (GdkX11DeviceXI2 *device)
{
}
#endif /* XINPUT_2 */

View File

@ -28,8 +28,11 @@
#include "gdkintl.h"
#include "gdkprivate-x11.h"
#ifdef XINPUT_XFREE
#include <X11/extensions/XInput.h>
#endif /* XINPUT_XFREE */
struct _GdkX11DeviceManagerXI
{
@ -46,6 +49,13 @@ struct _GdkX11DeviceManagerXIClass
GdkX11DeviceManagerCoreClass parent_class;
};
static void gdk_x11_device_manager_xi_event_translator_init (GdkEventTranslatorIface *iface);
G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI, gdk_x11_device_manager_xi, GDK_TYPE_X11_DEVICE_MANAGER_CORE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
gdk_x11_device_manager_xi_event_translator_init))
#ifdef XINPUT_XFREE
static void gdk_x11_device_manager_xi_constructed (GObject *object);
static void gdk_x11_device_manager_xi_dispose (GObject *object);
@ -58,7 +68,6 @@ static void gdk_x11_device_manager_xi_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void gdk_x11_device_manager_xi_event_translator_init (GdkEventTranslatorIface *iface);
static gboolean gdk_x11_device_manager_xi_translate_event (GdkEventTranslator *translator,
GdkDisplay *display,
GdkEvent *event,
@ -67,10 +76,6 @@ static GList * gdk_x11_device_manager_xi_list_devices (GdkDeviceManager *de
GdkDeviceType type);
G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI, gdk_x11_device_manager_xi, GDK_TYPE_X11_DEVICE_MANAGER_CORE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
gdk_x11_device_manager_xi_event_translator_init))
enum {
PROP_0,
PROP_EVENT_BASE
@ -661,3 +666,22 @@ gdk_x11_device_manager_xi_list_devices (GdkDeviceManager *manager,
else
return NULL;
}
#else /* XINPUT_XFREE */
static void
gdk_x11_device_manager_xi_class_init (GdkX11DeviceManagerXIClass *klass)
{
}
static void
gdk_x11_device_manager_xi_init (GdkX11DeviceManagerXI *device_manager)
{
}
static void
gdk_x11_device_manager_xi_event_translator_init (GdkEventTranslatorIface *iface)
{
}
#endif /* XINPUT_XFREE */

View File

@ -22,7 +22,7 @@
#include "gdkx11devicemanager-xi2.h"
#include "gdkx11device-xi2.h"
#include "gdkdevicemanagerprivate.h"
#include "gdkdevicemanagerprivate-core.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkeventtranslator.h"
@ -30,15 +30,19 @@
#include "gdkintl.h"
#include "gdkkeysyms.h"
#ifdef XINPUT_2
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/XInput2.h>
#include <string.h>
#endif /* XINPUT_2 */
struct _GdkX11DeviceManagerXI2
{
GdkDeviceManager parent_object;
GdkX11DeviceManagerCore parent_object;
GHashTable *id_table;
@ -52,6 +56,15 @@ struct _GdkX11DeviceManagerXI2Class
GdkDeviceManagerClass parent_class;
};
static void gdk_x11_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface);
G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI2, gdk_x11_device_manager_xi2, GDK_TYPE_X11_DEVICE_MANAGER_CORE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
gdk_x11_device_manager_xi2_event_translator_init))
#ifdef XINPUT_2
#define HAS_FOCUS(toplevel) ((toplevel)->has_focus || (toplevel)->has_pointer_focus)
@ -70,8 +83,6 @@ static GList * gdk_x11_device_manager_xi2_list_devices (GdkDeviceManager *device
GdkDeviceType type);
static GdkDevice * gdk_x11_device_manager_xi2_get_client_pointer (GdkDeviceManager *device_manager);
static void gdk_x11_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface);
static gboolean gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
GdkDisplay *display,
GdkEvent *event,
@ -82,11 +93,6 @@ static void gdk_x11_device_manager_xi2_select_window_events (GdkEventTra
GdkEventMask event_mask);
G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI2, gdk_x11_device_manager_xi2, GDK_TYPE_X11_DEVICE_MANAGER_CORE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
gdk_x11_device_manager_xi2_event_translator_init))
enum {
PROP_0,
PROP_OPCODE
@ -1098,6 +1104,12 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->scroll.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
break;
}
/* Button presses of button 4-7 are scroll events, so ignore the release */
else if (ev->evtype == XI_ButtonRelease)
{
return_val = FALSE;
break;
}
/* else (XI_ButtonRelease) fall thru */
default:
event->button.type = (ev->evtype == XI_ButtonPress) ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
@ -1135,6 +1147,9 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->button.button = xev->detail;
}
if (return_val == FALSE)
break;
if (!set_screen_from_root (display, event, xev->root))
{
return_val = FALSE;
@ -1301,3 +1316,22 @@ gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator,
_gdk_x11_device_manager_xi2_select_events (device_manager, window, &event_mask);
g_free (event_mask.mask);
}
#else /* XINPUT_2 */
static void
gdk_x11_device_manager_xi2_class_init (GdkX11DeviceManagerXI2Class *klass)
{
}
static void
gdk_x11_device_manager_xi2_init (GdkX11DeviceManagerXI2 *device_manager)
{
}
static void
gdk_x11_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface)
{
}
#endif /* XINPUT_2 */

View File

@ -1024,12 +1024,17 @@ _gdk_wm_protocols_filter (GdkXEvent *xev,
GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (event->any.window);
/* There is no way of knowing reliably whether we are viewable;
* _gdk_x11_set_input_focus_safe() traps errors asynchronously.
* so trap errors asynchronously around the XSetInputFocus call
*/
if (toplevel && win->accept_focus)
_gdk_x11_set_input_focus_safe (display, toplevel->focus_window,
RevertToParent,
xevent->xclient.data.l[1]);
{
gdk_x11_display_error_trap_push (display);
XSetInputFocus (GDK_DISPLAY_XDISPLAY (display),
toplevel->focus_window,
RevertToParent,
xevent->xclient.data.l[1]);
gdk_x11_display_error_trap_pop_ignored (display);
}
return GDK_FILTER_REMOVE;
}

View File

@ -271,22 +271,6 @@ _gdk_x11_window_translate (GdkWindow *window,
GdkWindowQueueItem *item;
GC xgc;
GdkRectangle extents;
GdkWindow *parent;
/* We need to get data from subwindows here, because we might have
* shaped a native window over the moving region (with bg none,
* so the pixels are still there). In fact we might need to get data
* from overlapping native window that are not children of this window,
* so we copy from the toplevel with INCLUDE_INFERIORS.
*/
parent = window;
while (parent->parent != NULL &&
parent->parent->window_type != GDK_WINDOW_ROOT)
{
dx -= parent->parent->abs_x + parent->x;
dy -= parent->parent->abs_y + parent->y;
parent = _gdk_window_get_impl_window (parent->parent);
}
cairo_region_get_extents (area, &extents);
@ -302,7 +286,7 @@ _gdk_x11_window_translate (GdkWindow *window,
gdk_window_queue (window, item);
XCopyArea (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (parent),
GDK_WINDOW_XID (window),
GDK_WINDOW_XID (window),
xgc,
extents.x - dx, extents.y - dy,

View File

@ -41,8 +41,12 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#ifdef XINPUT_XFREE
#include <X11/extensions/XInput.h>
#endif
#ifdef XINPUT_2
#include <X11/extensions/XInput2.h>
#endif
#include <cairo-xlib.h>
@ -225,6 +229,7 @@ void _gdk_x11_device_check_extension_events (GdkDevice *device);
GdkDeviceManager *_gdk_x11_device_manager_new (GdkDisplay *display);
#ifdef XINPUT_XFREE
void _gdk_x11_device_xi_update_window_info (GdkWindow *window);
void _gdk_x11_device_xi_update_axes (GdkDevice *device,
@ -237,12 +242,15 @@ void _gdk_x11_device_xi_translate_axes (GdkDevice *device,
gdouble *axes,
gdouble *x,
gdouble *y);
#endif
#ifdef XINPUT_2
guchar * _gdk_x11_device_xi2_translate_event_mask (GdkEventMask event_mask,
gint *len);
guint _gdk_x11_device_xi2_translate_state (XIModifierState *mods_state,
XIButtonState *buttons_state,
XIGroupState *group_state);
#endif
void _gdk_x11_event_translate_keyboard_string (GdkEventKey *event);

View File

@ -867,9 +867,11 @@ process_monitors_change (GdkScreen *screen)
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
gint n_monitors;
gint primary_monitor;
GdkX11Monitor *monitors;
gboolean changed;
primary_monitor = x11_screen->primary_monitor;
n_monitors = x11_screen->n_monitors;
monitors = x11_screen->monitors;
@ -878,8 +880,11 @@ process_monitors_change (GdkScreen *screen)
init_multihead (screen);
changed = !compare_monitors (monitors, n_monitors,
x11_screen->monitors, x11_screen->n_monitors);
changed =
!compare_monitors (monitors, n_monitors,
x11_screen->monitors, x11_screen->n_monitors) ||
x11_screen->primary_monitor != primary_monitor;
free_monitors (monitors, n_monitors);
@ -903,10 +908,7 @@ _gdk_x11_screen_size_changed (GdkScreen *screen,
display_x11 = GDK_X11_DISPLAY (gdk_screen_get_display (screen));
if (display_x11->have_randr13 && event->type == ConfigureNotify)
{
g_signal_emit_by_name (screen, "monitors-changed");
return;
}
return;
XRRUpdateConfiguration (event);
#else

View File

@ -94,12 +94,17 @@ _gdk_x11_window_simulate_key (GdkWindow *window,
{
gint i;
for (i = 0; i < n_keys; i++)
if (keys[i].group == 0 && keys[i].level == 0)
if (keys[i].group == 0 && (keys[i].level == 0 || keys[i].level == 1))
{
xev.keycode = keys[i].keycode;
if (keys[i].level == 1)
{
/* Assume shift takes us to level 1 */
xev.state |= GDK_SHIFT_MASK;
}
break;
}
if (i >= n_keys) /* no match for group==0 and level==0 */
if (i >= n_keys) /* no match for group==0 and level==0 or 1 */
xev.keycode = keys[0].keycode;
}
g_free (keys);

View File

@ -1821,11 +1821,14 @@ gdk_x11_window_focus (GdkWindow *window,
XRaiseWindow (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window));
/* There is no way of knowing reliably whether we are viewable;
* _gdk_x11_set_input_focus_safe() traps errors asynchronously.
* so trap errors asynchronously around the XSetInputFocus call
*/
_gdk_x11_set_input_focus_safe (display, GDK_WINDOW_XID (window),
RevertToParent,
timestamp);
gdk_x11_display_error_trap_push (display);
XSetInputFocus (GDK_DISPLAY_XDISPLAY (display),
GDK_WINDOW_XID (window),
RevertToParent,
timestamp);
gdk_x11_display_error_trap_pop_ignored (display);
}
}

View File

@ -376,6 +376,7 @@ endif
gtk_private_h_sources = \
gtk9slice.h \
gtkaccelgroupprivate.h \
gtkaccessibleprivate.h \
gtkanimationdescription.h \
gtkappchooserprivate.h \
gtkappchoosermodule.h \
@ -871,10 +872,10 @@ gtktypebuiltins.c: @REBUILD@ $(gtk_public_h_sources) gtktypebuiltins.c.template
gtktypefuncs.c: @REBUILD@ stamp-gtktypebuiltins.h $(top_srcdir)/gtk/*.h $(top_srcdir)/gdk/*.h Makefile
$(AM_V_GEN) echo '#include <gtk/gtkx.h>' > xgen-gtfsrc.c && \
${CPP} $(DEFS) $(INCLUDES) -DGTK_ENABLE_BROKEN $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) xgen-gtfsrc.c | \
${CPP} $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) xgen-gtfsrc.c | \
$(GREP) -o '\bg[td]k_[a-zA-Z0-9_]*_get_type\b' | \
sort | uniq | \
$(SED) '{ s/^/*tp++ = /; s/$$/();/; }' > xgen-gtf \
$(SED) '{ s/^/*tp++ = /; s/$$/();/; s/^.*\(gdk_x11\|gtk_plug_\|gtk_socket_\).*$$/#ifdef GDK_WINDOWING_X11\n&\n#endif/; }' > xgen-gtf \
&& cp xgen-gtf $@ && rm -f xgen-gtf
gtktestutils.c: gtktypefuncs.c
@ -1060,6 +1061,7 @@ STOCK_ICONS = \
stock-icons/16/window-close.png \
stock-icons/16/gtk-connect.png \
stock-icons/16/gtk-convert.png \
stock-icons/16/edit-clear.png \
stock-icons/16/edit-copy.png \
stock-icons/16/edit-cut.png \
stock-icons/16/edit-delete.png \
@ -1067,7 +1069,7 @@ STOCK_ICONS = \
stock-icons/16/gtk-disconnect.png \
stock-icons/16/gtk-edit.png \
stock-icons/16/system-run.png \
stock-icons/16/document-x-generic.png \
stock-icons/16/text-x-generic.png \
stock-icons/16/edit-find-replace.png \
stock-icons/16/edit-find.png \
stock-icons/16/media-floppy.png \
@ -1080,6 +1082,8 @@ STOCK_ICONS = \
stock-icons/16/go-last-ltr.png \
stock-icons/16/go-top.png \
stock-icons/16/go-up.png \
stock-icons/16/gtk-caps-lock-warning.png \
stock-icons/16/gtk-color-picker.png \
stock-icons/16/drive-harddisk.png \
stock-icons/16/help-contents.png \
stock-icons/16/go-home.png \
@ -1107,6 +1111,10 @@ STOCK_ICONS = \
stock-icons/16/network-idle.png \
stock-icons/16/document-new.png \
stock-icons/16/document-open.png \
stock-icons/16/gtk-orientation-landscape.png \
stock-icons/16/gtk-orientation-portrait.png \
stock-icons/16/gtk-orientation-reverse-landscape.png \
stock-icons/16/gtk-orientation-reverse-portrait.png \
stock-icons/16/gtk-page-setup.png \
stock-icons/16/edit-paste.png \
stock-icons/16/gtk-preferences.png \
@ -1164,6 +1172,7 @@ STOCK_ICONS = \
stock-icons/24/media-optical.png \
stock-icons/24/edit-clear.png \
stock-icons/24/window-close.png \
stock-icons/24/gtk-caps-lock-warning.png \
stock-icons/24/gtk-color-picker.png \
stock-icons/24/gtk-connect.png \
stock-icons/24/gtk-convert.png \
@ -1173,7 +1182,7 @@ STOCK_ICONS = \
stock-icons/24/gtk-disconnect.png \
stock-icons/24/gtk-edit.png \
stock-icons/24/system-run.png \
stock-icons/24/document-x-generic.png \
stock-icons/24/text-x-generic.png \
stock-icons/24/edit-find-replace.png \
stock-icons/24/edit-find.png \
stock-icons/24/gtk-font.png \
@ -1331,8 +1340,6 @@ stamp-icons: $(STOCK_ICONS)
&& $(LN_S) folder.png user-home.png \
&& $(RM) user-desktop.png \
&& $(LN_S) folder.png user-desktop.png \
&& $(RM) text-x-generic.png \
&& $(LN_S) document-x-generic.png text-x-generic.png \
) done \
&& touch stamp-icons

View File

@ -45,11 +45,11 @@ static void gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessi
G_DEFINE_TYPE (GtkAccessible, gtk_accessible, ATK_TYPE_OBJECT)
static void
gtk_accessible_init (GtkAccessible *accesible)
gtk_accessible_init (GtkAccessible *accessible)
{
accesible->priv = G_TYPE_INSTANCE_GET_PRIVATE (accesible,
GTK_TYPE_ACCESSIBLE,
GtkAccessiblePrivate);
accessible->priv = G_TYPE_INSTANCE_GET_PRIVATE (accessible,
GTK_TYPE_ACCESSIBLE,
GtkAccessiblePrivate);
}
static void
@ -131,3 +131,34 @@ gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible)
&priv->widget);
}
}
/*
* _gtk_accessible_set_factory_type:
* @widget_type: a #GtkWidget subtype
* @factory_type: a #AtkObjectFactory subtype
*
* A wrapper around atk_registry_set_factory_type().
*
* Only installs the factory if accessibility is
* enabled.
*/
void
_gtk_accessible_set_factory_type (GType widget_type,
GType factory_type)
{
AtkObjectFactory *factory;
AtkRegistry *registry;
GType accessible_type;
/*
* Figure out whether accessibility is enabled by looking
* at the type of the accessible object which would be created
* for GtkWidget.
*/
registry = atk_get_default_registry ();
factory = atk_registry_get_factory (registry, GTK_TYPE_WIDGET);
accessible_type = atk_object_factory_get_accessible_type (factory);
if (g_type_is_a (accessible_type, GTK_TYPE_ACCESSIBLE))
atk_registry_set_factory_type (registry, widget_type, factory_type);
}

View File

@ -0,0 +1,31 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __GTK_ACCESSIBLE_PRIVATE_H__
#define __GTK_ACCESSIBLE_PRIVATE_H__
#include "gtkaccessible.h"
G_BEGIN_DECLS
void _gtk_accessible_set_factory_type (GType widget_type,
GType factory_type);
G_END_DECLS
#endif /* __GTK_ACCESSIBLE_PRIVATE_H__ */

View File

@ -248,7 +248,7 @@ gtk_app_chooser_button_ensure_dialog_item (GtkAppChooserButton *self,
{
GtkTreeIter iter, iter2;
if (!self->priv->show_dialog_item)
if (!self->priv->show_dialog_item || !self->priv->content_type)
return;
if (prev_iter == NULL)
@ -275,7 +275,8 @@ gtk_app_chooser_button_populate (GtkAppChooserButton *self)
gboolean cycled_recommended;
#ifndef G_OS_WIN32
recommended_apps = g_app_info_get_recommended_for_type (self->priv->content_type);
if (self->priv->content_type)
recommended_apps = g_app_info_get_recommended_for_type (self->priv->content_type);
#endif
cycled_recommended = FALSE;
@ -325,14 +326,6 @@ gtk_app_chooser_button_build_ui (GtkAppChooserButton *self)
GtkCellRenderer *cell;
GtkCellArea *area;
self->priv->store = gtk_list_store_new (NUM_COLUMNS,
G_TYPE_APP_INFO,
G_TYPE_STRING, /* name */
G_TYPE_STRING, /* label */
G_TYPE_ICON,
G_TYPE_BOOLEAN, /* separator */
G_TYPE_BOOLEAN); /* custom */
gtk_combo_box_set_model (GTK_COMBO_BOX (self),
GTK_TREE_MODEL (self->priv->store));
@ -457,8 +450,6 @@ gtk_app_chooser_button_constructed (GObject *obj)
if (G_OBJECT_CLASS (gtk_app_chooser_button_parent_class)->constructed != NULL)
G_OBJECT_CLASS (gtk_app_chooser_button_parent_class)->constructed (obj);
g_assert (self->priv->content_type != NULL);
gtk_app_chooser_button_build_ui (self);
}
@ -521,6 +512,8 @@ gtk_app_chooser_button_finalize (GObject *obj)
g_free (self->priv->content_type);
g_free (self->priv->heading);
g_object_unref (self->priv->store);
G_OBJECT_CLASS (gtk_app_chooser_button_parent_class)->finalize (obj);
}
@ -605,6 +598,14 @@ gtk_app_chooser_button_init (GtkAppChooserButton *self)
self->priv->custom_item_names =
g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
self->priv->store = gtk_list_store_new (NUM_COLUMNS,
G_TYPE_APP_INFO,
G_TYPE_STRING, /* name */
G_TYPE_STRING, /* label */
G_TYPE_ICON,
G_TYPE_BOOLEAN, /* separator */
G_TYPE_BOOLEAN); /* custom */
}
static gboolean

View File

@ -142,10 +142,10 @@ online_button_clicked_cb (GtkButton *b,
GtkAppChooserDialog *self = user_data;
_gtk_app_chooser_online_search_for_mimetype_async (self->priv->online,
self->priv->content_type,
GTK_WINDOW (self),
search_for_mimetype_ready_cb,
self);
self->priv->content_type,
GTK_WINDOW (self),
search_for_mimetype_ready_cb,
self);
}
static void
@ -170,6 +170,10 @@ app_chooser_online_get_default_ready_cb (GObject *source,
g_signal_connect (self->priv->online_button, "clicked",
G_CALLBACK (online_button_clicked_cb), self);
if (!self->priv->content_type)
gtk_widget_set_sensitive (self->priv->online_button, FALSE);
gtk_widget_show (self->priv->online_button);
}
}
@ -247,9 +251,10 @@ add_or_find_application (GtkAppChooserDialog *self)
app = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (self));
/* we don't care about reporting errors here */
g_app_info_set_as_last_used_for_type (app,
self->priv->content_type,
NULL);
if (self->priv->content_type)
g_app_info_set_as_last_used_for_type (app,
self->priv->content_type,
NULL);
g_object_unref (app);
}
@ -313,12 +318,14 @@ set_dialog_properties (GtkAppChooserDialog *self)
gchar *description;
gchar *default_text;
gchar *string;
gboolean unknown;
PangoFontDescription *font_desc;
name = NULL;
extension = NULL;
label = NULL;
description = NULL;
unknown = TRUE;
if (self->priv->gfile != NULL)
{
@ -326,7 +333,12 @@ set_dialog_properties (GtkAppChooserDialog *self)
extension = get_extension (name);
}
description = g_content_type_get_description (self->priv->content_type);
if (self->priv->content_type)
{
description = g_content_type_get_description (self->priv->content_type);
unknown = g_content_type_is_unknown (self->priv->content_type);
}
gtk_window_set_title (GTK_WINDOW (self), "");
if (name != NULL)
@ -340,11 +352,9 @@ set_dialog_properties (GtkAppChooserDialog *self)
{
/* Translators: %s is a file type description */
label = g_strdup_printf (_("Select an application for \"%s\" files"),
g_content_type_is_unknown (self->priv->content_type) ?
self->priv->content_type : description);
unknown ? self->priv->content_type : description);
string = g_strdup_printf (_("No applications available to open \"%s\" files"),
g_content_type_is_unknown (self->priv->content_type) ?
self->priv->content_type : description);
unknown ? self->priv->content_type : description);
}
font_desc = pango_font_description_new ();
@ -575,9 +585,6 @@ gtk_app_chooser_dialog_constructed (GObject *object)
{
GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object);
g_assert (self->priv->content_type != NULL ||
self->priv->gfile != NULL);
if (G_OBJECT_CLASS (gtk_app_chooser_dialog_parent_class)->constructed != NULL)
G_OBJECT_CLASS (gtk_app_chooser_dialog_parent_class)->constructed (object);

View File

@ -630,13 +630,15 @@ gtk_app_chooser_add_default (GtkAppChooserWidget *self,
static void
add_no_applications_label (GtkAppChooserWidget *self)
{
gchar *text = NULL, *desc;
gchar *text = NULL, *desc = NULL;
const gchar *string;
GtkTreeIter iter;
if (self->priv->default_text == NULL)
{
desc = g_content_type_get_description (self->priv->content_type);
if (self->priv->content_type)
desc = g_content_type_get_description (self->priv->content_type);
string = text = g_strdup_printf (_("No applications available to open \"%s\""),
desc);
g_free (desc);
@ -706,7 +708,7 @@ gtk_app_chooser_widget_real_add_items (GtkAppChooserWidget *self)
if (self->priv->show_all)
show_headings = FALSE;
if (self->priv->show_default)
if (self->priv->show_default && self->priv->content_type)
{
default_app = g_app_info_get_default_for_type (self->priv->content_type, FALSE);
@ -719,9 +721,10 @@ gtk_app_chooser_widget_real_add_items (GtkAppChooserWidget *self)
}
#ifndef G_OS_WIN32
if (self->priv->show_recommended || self->priv->show_all)
if ((self->priv->content_type && self->priv->show_recommended) || self->priv->show_all)
{
recommended_apps = g_app_info_get_recommended_for_type (self->priv->content_type);
if (self->priv->content_type)
recommended_apps = g_app_info_get_recommended_for_type (self->priv->content_type);
apps_added |= gtk_app_chooser_widget_add_section (self, _("Recommended Applications"),
show_headings,
@ -733,9 +736,10 @@ gtk_app_chooser_widget_real_add_items (GtkAppChooserWidget *self)
g_list_copy (recommended_apps));
}
if (self->priv->show_fallback || self->priv->show_all)
if ((self->priv->content_type && self->priv->show_fallback) || self->priv->show_all)
{
fallback_apps = g_app_info_get_fallback_for_type (self->priv->content_type);
if (self->priv->content_type)
fallback_apps = g_app_info_get_fallback_for_type (self->priv->content_type);
apps_added |= gtk_app_chooser_widget_add_section (self, _("Related Applications"),
show_headings,
@ -953,8 +957,6 @@ gtk_app_chooser_widget_constructed (GObject *object)
{
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (object);
g_assert (self->priv->content_type != NULL);
if (G_OBJECT_CLASS (gtk_app_chooser_widget_parent_class)->constructed != NULL)
G_OBJECT_CLASS (gtk_app_chooser_widget_parent_class)->constructed (object);

View File

@ -312,7 +312,8 @@ gtk_arrow_draw (GtkWidget *widget,
GtkMisc *misc = GTK_MISC (widget);
GtkStyleContext *context;
GtkStateFlags state;
gint x, y, width, height;
gdouble x, y;
gint width, height;
gint extent;
gint xpad, ypad;
gfloat xalign, yalign;
@ -344,8 +345,8 @@ gtk_arrow_draw (GtkWidget *widget,
effective_arrow_type = GTK_ARROW_LEFT;
}
x = floor (xpad + ((width - extent) * xalign));
y = floor (ypad + ((height - extent) * yalign));
x = xpad + ((width - extent) * xalign);
y = ypad + ((height - extent) * yalign);
switch (effective_arrow_type)
{

View File

@ -62,7 +62,7 @@
#include "gtkassistant.h"
#include "gtkaccessible.h"
#include "gtkaccessibleprivate.h"
#include "gtkbutton.h"
#include "gtkhbox.h"
#include "gtkhbbox.h"
@ -2485,24 +2485,8 @@ gtk_assistant_get_accessible (GtkWidget *widget)
if (first_time)
{
AtkObjectFactory *factory;
AtkRegistry *registry;
GType derived_type;
GType derived_atk_type;
/* Figure out whether accessibility is enabled by looking
* at the type of the accessible object which would be
* created for the parent type of GtkAssistant.
*/
derived_type = g_type_parent (GTK_TYPE_ASSISTANT);
registry = atk_get_default_registry ();
factory = atk_registry_get_factory (registry, derived_type);
derived_atk_type = atk_object_factory_get_accessible_type (factory);
if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
atk_registry_set_factory_type (registry,
GTK_TYPE_ASSISTANT,
gtk_assistant_accessible_factory_get_type ());
_gtk_accessible_set_factory_type (GTK_TYPE_ASSISTANT,
gtk_assistant_accessible_factory_get_type ());
first_time = FALSE;
}
@ -2527,7 +2511,7 @@ gtk_assistant_accessible_get_n_children (AtkObject *accessible)
if (widget == NULL)
return 0;
return g_list_length (GTK_ASSISTANT (accessible)->priv->pages) + 1;
return g_list_length (GTK_ASSISTANT (widget)->priv->pages) + 1;
}
static AtkObject *

View File

@ -1164,7 +1164,7 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
gint largest_child = 0, largest_natural = 0;
for (children = private->children; children != NULL;
children = children->next, nvis_children++)
children = children->next)
{
GtkBoxChild *child = children->data;
@ -1190,6 +1190,8 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
required_size += child_size;
required_natural += child_natural;
nvis_children += 1;
}
}

View File

@ -30,7 +30,7 @@
*
* The GtkBuildable interface is implemented by all widgets and
* many of the non-widget objects that are provided by GTK+. The
* main user of this interface is #GtkBuilder, there should be
* main user of this interface is #GtkBuilder. There should be
* very little need for applications to call any
* <function>gtk_buildable_...</function> functions.
*

View File

@ -266,7 +266,7 @@ gtk_button_class_init (GtkButtonClass *klass)
* GtkButton:xalign:
*
* If the child of the button is a #GtkMisc or #GtkAlignment, this property
* can be used to control it's horizontal alignment. 0.0 is left aligned,
* can be used to control its horizontal alignment. 0.0 is left aligned,
* 1.0 is right aligned.
*
* Since: 2.4
@ -285,7 +285,7 @@ gtk_button_class_init (GtkButtonClass *klass)
* GtkButton:yalign:
*
* If the child of the button is a #GtkMisc or #GtkAlignment, this property
* can be used to control it's vertical alignment. 0.0 is top aligned,
* can be used to control its vertical alignment. 0.0 is top aligned,
* 1.0 is bottom aligned.
*
* Since: 2.4

View File

@ -35,7 +35,7 @@
* size requests and allocations for a given row of data.
*
* Usually users dont have to interact with the #GtkCellArea directly
* unless they are implementing a cell layouting widget themselves.
* unless they are implementing a cell-layouting widget themselves.
*
* <refsect2 id="cell-area-geometry-management">
* <title>Requesting area sizes</title>
@ -47,7 +47,7 @@
* size of an area for an arbitrary number of #GtkTreeModel rows.
*
* When requesting the size of a cell area one needs to calculate
* the size for a handful of rows, this will be done differently by
* the size for a handful of rows, and this will be done differently by
* different layouting widgets. For instance a #GtkTreeViewColumn
* always lines up the areas from top to bottom while a #GtkIconView
* on the other hand might enforce that all areas received the same
@ -65,10 +65,10 @@
*
* The #GtkCellAreaContext is an opaque object specific to the
* #GtkCellArea which created it (see gtk_cell_area_create_context()).
* The owning cell layouting widget can create as many contexts as
* The owning cell-layouting widget can create as many contexts as
* it wishes to calculate sizes of rows which should receive the
* same size in at least one orientation (horizontally or vertically),
* however it's important that the same #GtkCellAreaContext which
* However, it's important that the same #GtkCellAreaContext which
* was used to request the sizes for a given #GtkTreeModel row be
* used when rendering or processing events for that row.
*
@ -94,7 +94,7 @@
* </example>
* Note that in this example it's not important to observe the
* returned minimum and natural width of the area for each row
* unless the cell layouting object is actually interested in the
* unless the cell-layouting object is actually interested in the
* widths of individual rows. The overall width is however stored
* in the accompanying #GtkCellAreaContext object and can be consulted
* at any time.
@ -136,7 +136,7 @@
* Requesting the height for width (or width for height) of an area is
* a similar task except in this case the #GtkCellAreaContext does not
* store the data (actually, it does not know how much space the layouting
* widget plans to allocate it for every row, it's up to the layouting
* widget plans to allocate it for every row. It's up to the layouting
* widget to render each row of data with the appropriate height and
* width which was requested by the #GtkCellArea).
*
@ -228,7 +228,7 @@
* </example>
* Note that the cached height in this example really depends on how
* the layouting widget works. The layouting widget might decide to
* give every row it's minimum or natural height or, if the model content
* give every row its minimum or natural height or, if the model content
* is expected to fit inside the layouting widget without scrolling, it
* would make sense to calculate the allocation for each row at
* #GtkWidget::size-allocate time using gtk_distribute_natural_allocation().
@ -337,7 +337,7 @@
* for #GtkWidgets. This provides some general interfaces for defining
* the relationship cell areas have with their cells. For instance in a
* #GtkCellAreaBox a cell might "expand" and receive extra space when
* the area is allocated more than it's full natural request, or a cell
* the area is allocated more than its full natural request, or a cell
* might be configured to "align" with adjacent rows which were requested
* and rendered with the same #GtkCellAreaContext.
*
@ -720,7 +720,7 @@ gtk_cell_area_class_init (GtkCellAreaClass *class)
* @path: the #GtkTreePath string this edit was initiated for
*
* Indicates that editing has started on @renderer and that @editable
* should be added to the owning cell layouting widget at @cell_area.
* should be added to the owning cell-layouting widget at @cell_area.
*
* Since: 3.0
*/
@ -745,7 +745,7 @@ gtk_cell_area_class_init (GtkCellAreaClass *class)
* @editable: the #GtkCellEditable widget to remove
*
* Indicates that editing finished on @renderer and that @editable
* should be removed from the owning cell layouting widget.
* should be removed from the owning cell-layouting widget.
*
* Since: 3.0
*/
@ -2107,7 +2107,7 @@ gtk_cell_area_get_preferred_width (GtkCellArea *area,
* the specified @width.
*
* @area stores some geometrical information in @context along the way
* while calling gtk_cell_area_get_preferred_width(), it's important to
* while calling gtk_cell_area_get_preferred_width(). It's important to
* perform a series of gtk_cell_area_get_preferred_width() requests with
* @context first and then call gtk_cell_area_get_preferred_height_for_width()
* on each cell area individually to get the height for width of each
@ -2183,7 +2183,7 @@ gtk_cell_area_get_preferred_height (GtkCellArea *area,
* the specified @height.
*
* @area stores some geometrical information in @context along the way
* while calling gtk_cell_area_get_preferred_height(), it's important to
* while calling gtk_cell_area_get_preferred_height(). It's important to
* perform a series of gtk_cell_area_get_preferred_height() requests with
* @context first and then call gtk_cell_area_get_preferred_width_for_height()
* on each cell area individually to get the height for width of each
@ -2887,7 +2887,7 @@ gtk_cell_area_is_activatable (GtkCellArea *area)
* for a given @direction and row data.
*
* Implementing #GtkCellArea classes should implement this
* method to receive and navigate focus in it's own way particular
* method to receive and navigate focus in its own way particular
* to how it lays out cells.
*
* Return value: %TRUE if focus remains inside @area as a result of this call.
@ -3015,7 +3015,7 @@ gtk_cell_area_get_focus_cell (GtkCellArea *area)
* @sibling: the #GtkCellRenderer to add to @renderer's focus area
*
* Adds @sibling to @renderer's focusable area, focus will be drawn
* around @renderer and all of it's siblings if @renderer can
* around @renderer and all of its siblings if @renderer can
* focus for a given row.
*
* Events handled by focus siblings can also activate the given
@ -3368,7 +3368,7 @@ gtk_cell_area_get_edit_widget (GtkCellArea *area)
*
* This is used by #GtkCellArea subclasses when handling events
* to activate cells, the base #GtkCellArea class activates cells
* for keyboard events for free in it's own GtkCellArea->activate()
* for keyboard events for free in its own GtkCellArea->activate()
* implementation.
*
* Return value: whether cell activation was successful
@ -3629,8 +3629,8 @@ _gtk_cell_area_set_cell_data_func_with_proxy (GtkCellArea *area,
info = g_hash_table_lookup (priv->cell_info, cell);
/* Note we do not take a reference to the proxy, the proxy is a GtkCellLayout
* that is forwarding it's implementation to a delegate GtkCellArea therefore
* it's life-cycle is longer than the area's life cycle.
* that is forwarding its implementation to a delegate GtkCellArea therefore
* its life-cycle is longer than the area's life cycle.
*/
if (info)
{

View File

@ -1769,7 +1769,7 @@ compute_size_for_opposing_orientation (GtkCellAreaBox *box,
}
/* Now we have the allocation for the group,
* request it's height-for-width
* request its height-for-width
*/
compute_group_size_for_opposing_orientation (box, group, widget,
orientation_sizes[i].minimum_size,

View File

@ -27,7 +27,7 @@
* @Title: GtkCellAreaContext
*
* The #GtkCellAreaContext object is created by a given #GtkCellArea
* implementation via it's #GtkCellAreaClass.create_context() virtual
* implementation via its #GtkCellAreaClass.create_context() virtual
* method and is used to store cell sizes and alignments for a series of
* #GtkTreeModel rows that are requested and rendered in the same context.
*
@ -344,7 +344,7 @@ gtk_cell_area_context_real_allocate (GtkCellAreaContext *context,
* fetch information about the area it is being used for.
*
* For instance at #GtkCellAreaContextClass.allocate() time
* it's important to know details about any cell spacing
* its important to know details about any cell spacing
* that the #GtkCellArea is configured with in order to
* compute a proper allocation.
*
@ -371,7 +371,7 @@ gtk_cell_area_context_get_area (GtkCellAreaContext *context)
* Resets any previously cached request and allocation
* data.
*
* When underlying #GtkTreeModel data changes it's
* When underlying #GtkTreeModel data changes its
* important to reset the context if the content
* size is allowed to shrink. If the content size
* is only allowed to grow (this is usually an option

View File

@ -47,7 +47,7 @@
* is rendered in the correct location using gtk_cell_renderer_render().
*
* There are a number of rules that must be followed when writing a new
* #GtkCellRenderer. First and formost, it's important that a certain set
* #GtkCellRenderer. First and formost, its important that a certain set
* of properties will always yield a cell renderer of the same size,
* barring a #GtkStyle change. The #GtkCellRenderer also has a number of
* generic properties that are expected to be honored by all children.
@ -1266,7 +1266,7 @@ gtk_cell_renderer_real_get_preferred_width_for_height (GtkCellRenderer *cell,
/* Default implementation assumes that a cell renderer will never use more
* space than it's natural size (this is fine for toggles and pixbufs etc
* space than its natural size (this is fine for toggles and pixbufs etc
* but needs to be overridden from wrapping/ellipsizing text renderers) */
static void
gtk_cell_renderer_real_get_aligned_area (GtkCellRenderer *cell,

View File

@ -70,7 +70,7 @@ enum {
PROP_INDICATOR_SIZE
};
#define TOGGLE_WIDTH 13
#define TOGGLE_WIDTH 16
static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };

View File

@ -233,6 +233,9 @@ gtk_cell_view_class_init (GtkCellViewClass *klass)
*
* The #GtkCellArea rendering cells
*
* If no area is specified when creating the cell view with gtk_cell_view_new_with_context()
* a horizontally oriented #GtkCellAreaBox will be used.
*
* since 3.0
*/
g_object_class_install_property (gobject_class,
@ -253,7 +256,7 @@ gtk_cell_view_class_init (GtkCellViewClass *klass)
* the same context.
*
* #GtkComboBox menus uses this to assign the same context to all cell views
* in the menu items for a single menu (each submenu creates it's own
* in the menu items for a single menu (each submenu creates its own
* context since the size of each submenu does not depend on parent
* or sibling menus).
*
@ -1328,10 +1331,10 @@ gtk_cell_view_set_background_rgba (GtkCellView *cell_view,
* gtk_cell_view_get_draw_sensitive:
* @cell_view: a #GtkCellView
*
* Gets whether @cell_view is configured to draw all of it's
* Gets whether @cell_view is configured to draw all of its
* cells in a sensitive state.
*
* Return value: whether @cell_view draws all of it's
* Return value: whether @cell_view draws all of its
* cells in a sensitive state
*
* Since: 3.0
@ -1353,7 +1356,7 @@ gtk_cell_view_get_draw_sensitive (GtkCellView *cell_view)
* @cell_view: a #GtkCellView
* @draw_sensitive: whether to draw all cells in a sensitive state.
*
* Sets whether @cell_view should draw all of it's
* Sets whether @cell_view should draw all of its
* cells in a sensitive state, this is used by #GtkComboBox menus
* to ensure that rows with insensitive cells that contain
* children appear sensitive in the parent menu item.

View File

@ -35,7 +35,7 @@
#include "gtkintl.h"
#define INDICATOR_SIZE 13
#define INDICATOR_SIZE 16
#define INDICATOR_SPACING 2

View File

@ -34,7 +34,7 @@
#include "gtkprivate.h"
#include "gtkintl.h"
#define INDICATOR_SIZE 16
struct _GtkCheckMenuItemPrivate
{
@ -130,7 +130,7 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
P_("Size of check or radio indicator"),
0,
G_MAXINT,
13,
INDICATOR_SIZE,
GTK_PARAM_READABLE));
widget_class->draw = gtk_check_menu_item_draw;

View File

@ -176,7 +176,7 @@ gtk_clipboard_class_init (GtkClipboardClass *class)
/**
* GtkClipboard::owner-change:
* @clipboard: the #GtkClipboard on which the signal is emitted
* @event: the @GdkEventOwnerChange event
* @event: (type Gdk.EventOwnerChange): the @GdkEventOwnerChange event
*
* The ::owner-change signal is emitted when GTK+ receives an
* event that indicates that the ownership of the selection

View File

@ -1845,7 +1845,6 @@ key_press (GtkWidget *invisible,
return TRUE;
#if defined GDK_WINDOWING_X11 || defined GDK_WINDOWING_WIN32
case GDK_KEY_Up:
case GDK_KEY_KP_Up:
dy = state == GDK_MOD1_MASK ? -BIG_STEP : -1;
@ -1865,7 +1864,6 @@ key_press (GtkWidget *invisible,
case GDK_KEY_KP_Right:
dx = state == GDK_MOD1_MASK ? BIG_STEP : 1;
break;
#endif
default:
return FALSE;

View File

@ -933,6 +933,9 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
*
* The #GtkCellArea used to layout cell renderers for this combo box.
*
* If no area is specified when creating the combo box with gtk_combo_box_new_with_area()
* a horizontally oriented #GtkCellAreaBox will be used.
*
* Since: 3.0
*/
g_object_class_install_property (object_class,
@ -969,6 +972,23 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
15,
GTK_PARAM_READABLE));
/**
* GtkComboBox:arrow-scaling:
*
* Sets the amount of space used up by the combobox arrow,
* proportional to the font size.
*
* Since: 3.2
*/
gtk_widget_class_install_style_property (widget_class,
g_param_spec_float ("arrow-scaling",
P_("Arrow Scaling"),
P_("The amount of space used by the arrow"),
0,
2.0,
1.0,
GTK_PARAM_READABLE));
/**
* GtkComboBox:shadow-type:
*
@ -5261,6 +5281,7 @@ gtk_combo_box_get_preferred_width (GtkWidget *widget,
GtkStyleContext *style_context;
GtkStateFlags state;
GtkBorder *border;
gfloat arrow_scaling;
child = gtk_bin_get_child (GTK_BIN (widget));
@ -5271,6 +5292,7 @@ gtk_combo_box_get_preferred_width (GtkWidget *widget,
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
"arrow-size", &arrow_size,
"arrow-scaling", &arrow_scaling,
NULL);
style_context = gtk_widget_get_style_context (widget);
@ -5289,7 +5311,7 @@ gtk_combo_box_get_preferred_width (GtkWidget *widget,
pango_font_metrics_unref (metrics);
pango_font_description_free (font_desc);
arrow_size = MAX (arrow_size, font_size);
arrow_size = MAX (arrow_size, font_size) * arrow_scaling;
gtk_widget_set_size_request (priv->arrow, arrow_size, arrow_size);

View File

@ -563,12 +563,13 @@ gtk_combo_box_text_remove_all (GtkComboBoxText *combo_box)
* gtk_combo_box_text_get_active_text:
* @combo_box: A #GtkComboBoxText
*
* Returns the currently active string in @combo_box, or %NULL if none
* is selected. If @combo_box contains an entry, this function will return
* its contents (which will not necessarily be an item from the list).
* Returns the currently active string in @combo_box, or %NULL
* if none is selected. If @combo_box contains an entry, this
* function will return its contents (which will not necessarily
* be an item from the list).
*
* Returns: a newly allocated string containing the currently active text.
* Must be freed with g_free().
* Returns: a newly allocated string containing the currently
* active text. Must be freed with g_free().
*
* Since: 2.24
*/
@ -580,7 +581,14 @@ gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box)
g_return_val_if_fail (GTK_IS_COMBO_BOX_TEXT (combo_box), NULL);
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo_box), &iter))
if (gtk_combo_box_get_has_entry (GTK_COMBO_BOX (combo_box)))
{
GtkWidget *entry;
entry = gtk_bin_get_child (GTK_BIN (combo_box));
text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
}
else if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo_box), &iter))
{
GtkTreeModel *model;
gint text_column;

View File

@ -2837,7 +2837,7 @@ gtk_container_set_focus_chain (GtkContainer *container,
g_return_if_fail (GTK_IS_WIDGET (tmp_list->data));
/* In principle each widget in the chain should be a descendant
* of the container, but we don't want to check that here, it's
* of the container, but we don't want to check that here. It's
* expensive and also it's allowed to set the focus chain before
* you pack the widgets, or have a widget in the chain that isn't
* always packed. So we check for ancestor during actual traversal.

View File

@ -835,6 +835,7 @@ static void gtk_css_style_provider_iface_init (GtkStyleProviderIface *iface);
static void scanner_apply_scope (GScanner *scanner,
ParserScope scope);
static void css_provider_reset_parser (GtkCssProvider *css_provider);
static gboolean css_provider_parse_value (GtkCssProvider *css_provider,
const gchar *value_str,
GValue *value,
@ -1469,6 +1470,8 @@ gtk_css_provider_finalize (GObject *object)
css_provider = GTK_CSS_PROVIDER (object);
priv = css_provider->priv;
css_provider_reset_parser (css_provider);
g_scanner_destroy (priv->scanner);
g_free (priv->filename);
@ -1982,7 +1985,7 @@ symbolic_color_parse_str (const gchar *string,
str++;
end = str;
while (*end == '-' || *end == '_' || g_ascii_isalpha (*end))
while (*end == '-' || *end == '_' || g_ascii_isalnum (*end))
end++;
name = g_strndup (str, end - str);
@ -2463,6 +2466,8 @@ gradient_parse_str (const gchar *str,
if (*str != ')')
{
if (color)
gtk_symbolic_color_unref (color);
*end_ptr = (gchar *) str;
return gradient;
}
@ -3087,12 +3092,16 @@ css_provider_parse_value (GtkCssProvider *css_provider,
parsed = FALSE;
}
if (end)
SKIP_SPACES (end);
if (end && *end)
{
/* Set error position in the scanner
* according to what we've parsed so far
*/
priv->value_pos += (end - value_str);
parsed = FALSE;
if (error && !*error)
g_set_error_literal (error,
@ -3555,6 +3564,8 @@ parse_stylesheet (GtkCssProvider *css_provider,
g_clear_error (&err);
}
css_provider_reset_parser (css_provider);
while (!g_scanner_eof (priv->scanner) &&
priv->scanner->token != G_TOKEN_RIGHT_CURLY)
g_scanner_get_next_token (priv->scanner);

View File

@ -56,7 +56,7 @@
* be packed. The bottom area is known as the
* <structfield>action_area</structfield>. This is generally used for
* packing buttons into the dialog which may perform functions such as
* cancel, ok, or apply. The two areas are separated by a #GtkHSeparator.
* cancel, ok, or apply.
*
* #GtkDialog boxes are created with a call to gtk_dialog_new() or
* gtk_dialog_new_with_buttons(). gtk_dialog_new_with_buttons() is

View File

@ -465,7 +465,7 @@ grab_dnd_keys (GtkWidget *widget,
}
gdk_flush ();
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
gdk_window_add_filter (NULL, root_key_filter, (gpointer) GDK_WINDOW_XID (window));
}
@ -495,7 +495,7 @@ ungrab_dnd_keys (GtkWidget *widget,
}
gdk_flush ();
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
}
#else /* GDK_WINDOWING_X11 && !XINPUT_2 */

View File

@ -1603,7 +1603,7 @@ gtk_entry_class_init (GtkEntryClass *class)
* GtkEntry::icon-press:
* @entry: The entry on which the signal is emitted
* @icon_pos: The position of the clicked icon
* @event: the button press event
* @event: (type Gdk.EventButton): the button press event
*
* The ::icon-press signal is emitted when an activatable icon
* is clicked.
@ -1625,7 +1625,7 @@ gtk_entry_class_init (GtkEntryClass *class)
* GtkEntry::icon-release:
* @entry: The entry on which the signal is emitted
* @icon_pos: The position of the clicked icon
* @event: the button release event
* @event: (type Gdk.EventButton): the button release event
*
* The ::icon-release signal is emitted on the button release from a
* mouse click over an activatable icon.
@ -5106,7 +5106,7 @@ gtk_entry_paste_clipboard (GtkEntry *entry)
GtkEntryPrivate *priv = entry->priv;
if (priv->editable)
gtk_entry_paste (entry, GDK_NONE);
gtk_entry_paste (entry, GDK_SELECTION_CLIPBOARD);
else
gtk_widget_error_bell (GTK_WIDGET (entry));
}
@ -5880,7 +5880,7 @@ gtk_entry_reset_im_context (GtkEntry *entry)
/**
* gtk_entry_im_context_filter_keypress:
* @entry: a #GtkEntry
* @event: the key event
* @event: (type Gdk.EventKey): the key event
*
* Allow the #GtkEntry input method to internally handle key press
* and release events. If this function returns %TRUE, then no further
@ -6570,16 +6570,37 @@ gtk_entry_clear (GtkEntry *entry,
g_object_thaw_notify (G_OBJECT (entry));
}
static GdkPixbuf *
create_normal_pixbuf (GtkStyleContext *context,
const gchar *stock_id,
GtkIconSize icon_size)
{
GtkIconSet *icon_set;
GdkPixbuf *pixbuf;
gtk_style_context_save (context);
/* Unset any state */
gtk_style_context_set_state (context, 0);
icon_set = gtk_style_context_lookup_icon_set (context, stock_id);
pixbuf = gtk_icon_set_render_icon_pixbuf (icon_set, context, icon_size);
gtk_style_context_restore (context);
return pixbuf;
}
static void
gtk_entry_ensure_pixbuf (GtkEntry *entry,
GtkEntryIconPosition icon_pos)
{
GtkEntryPrivate *priv = entry->priv;
EntryIconInfo *icon_info = priv->icons[icon_pos];
GtkStyleContext *context;
GtkIconInfo *info;
GtkIconTheme *icon_theme;
GtkSettings *settings;
GtkStateFlags state;
GtkWidget *widget;
GdkScreen *screen;
gint width, height;
@ -6588,6 +6609,7 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
return;
widget = GTK_WIDGET (entry);
context = gtk_widget_get_style_context (widget);
switch (icon_info->storage_type)
{
@ -6595,16 +6617,13 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
case GTK_IMAGE_PIXBUF:
break;
case GTK_IMAGE_STOCK:
state = gtk_widget_get_state_flags (widget);
gtk_widget_set_state_flags (widget, 0, TRUE);
icon_info->pixbuf = gtk_widget_render_icon_pixbuf (widget,
icon_info->stock_id,
GTK_ICON_SIZE_MENU);
icon_info->pixbuf = create_normal_pixbuf (context, icon_info->stock_id,
GTK_ICON_SIZE_MENU);
if (!icon_info->pixbuf)
icon_info->pixbuf = gtk_widget_render_icon_pixbuf (widget,
GTK_STOCK_MISSING_IMAGE,
GTK_ICON_SIZE_MENU);
gtk_widget_set_state_flags (widget, state, TRUE);
icon_info->pixbuf = create_normal_pixbuf (context,
GTK_STOCK_MISSING_IMAGE,
GTK_ICON_SIZE_MENU);
break;
case GTK_IMAGE_ICON_NAME:
@ -6624,14 +6643,9 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
0, NULL);
if (icon_info->pixbuf == NULL)
{
state = gtk_widget_get_state_flags (widget);
gtk_widget_set_state_flags (widget, 0, TRUE);
icon_info->pixbuf = gtk_widget_render_icon_pixbuf (widget,
GTK_STOCK_MISSING_IMAGE,
GTK_ICON_SIZE_MENU);
gtk_widget_set_state_flags (widget, state, TRUE);
}
icon_info->pixbuf = create_normal_pixbuf (context,
GTK_STOCK_MISSING_IMAGE,
GTK_ICON_SIZE_MENU);
}
break;
@ -6657,14 +6671,9 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
}
if (icon_info->pixbuf == NULL)
{
state = gtk_widget_get_state_flags (widget);
gtk_widget_set_state_flags (widget, 0, TRUE);
icon_info->pixbuf = gtk_widget_render_icon_pixbuf (widget,
GTK_STOCK_MISSING_IMAGE,
GTK_ICON_SIZE_MENU);
gtk_widget_set_state_flags (widget, state, TRUE);
}
icon_info->pixbuf = create_normal_pixbuf (context,
GTK_STOCK_MISSING_IMAGE,
GTK_ICON_SIZE_MENU);
}
break;
@ -10188,7 +10197,7 @@ keymap_state_changed (GdkKeymap *keymap,
* This is a helper function for GtkComboBox. A GtkEntry in a GtkComboBox
* is supposed to behave like a GtkCellEditable when placed in a combo box.
*
* I.e take up it's allocation and get GtkEntry->is_cell_renderer = TRUE.
* I.e take up its allocation and get GtkEntry->is_cell_renderer = TRUE.
*
*/
void

View File

@ -437,6 +437,9 @@ gtk_entry_completion_class_init (GtkEntryCompletionClass *klass)
*
* The #GtkCellArea used to layout cell renderers in the treeview column.
*
* If no area is specified when creating the entry completion with gtk_entry_completion_new_with_area()
* a horizontally oriented #GtkCellAreaBox will be used.
*
* Since: 3.0
*/
g_object_class_install_property (object_class,

View File

@ -6229,20 +6229,25 @@ show_and_select_files (GtkFileChooserDefault *impl,
{
GtkTreeSelection *selection;
GtkFileSystemModel *fsmodel;
gboolean can_have_hidden, can_have_filtered, selected_a_file;
gboolean enabled_hidden, removed_filters;
gboolean selected_a_file;
GSList *walk;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
fsmodel = GTK_FILE_SYSTEM_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view)));
can_have_hidden = !impl->show_hidden;
can_have_filtered = impl->current_filter != NULL;
enabled_hidden = impl->show_hidden;
removed_filters = (impl->current_filter == NULL);
selected_a_file = FALSE;
for (walk = files; walk && (can_have_hidden || can_have_filtered); walk = walk->next)
for (walk = files; walk; walk = walk->next)
{
GFile *file = walk->data;
GtkTreeIter iter;
/* Is it a hidden file? */
if (!_gtk_file_system_model_get_iter_for_file (fsmodel, &iter, file))
continue;
@ -6250,21 +6255,35 @@ show_and_select_files (GtkFileChooserDefault *impl,
{
GFileInfo *info = _gtk_file_system_model_get_info (fsmodel, &iter);
if (can_have_hidden &&
if (!enabled_hidden &&
(g_file_info_get_is_hidden (info) ||
g_file_info_get_is_backup (info)))
{
g_object_set (impl, "show-hidden", TRUE, NULL);
can_have_hidden = FALSE;
}
if (can_have_filtered)
{
set_current_filter (impl, NULL);
can_have_filtered = FALSE;
enabled_hidden = TRUE;
}
}
/* Is it a filtered file? */
if (!_gtk_file_system_model_get_iter_for_file (fsmodel, &iter, file))
continue; /* re-get the iter as it may change when the model refilters */
if (!_gtk_file_system_model_iter_is_visible (fsmodel, &iter))
{
/* Maybe we should have a way to ask the fsmodel if it had filtered a file */
if (!removed_filters)
{
set_current_filter (impl, NULL);
removed_filters = TRUE;
}
}
/* Okay, can we select the file now? */
if (!_gtk_file_system_model_get_iter_for_file (fsmodel, &iter, file))
continue;
if (_gtk_file_system_model_iter_is_visible (fsmodel, &iter))
{
GtkTreePath *path;
@ -9611,6 +9630,13 @@ check_preview_change (GtkFileChooserDefault *impl)
g_signal_emit_by_name (impl, "update-preview");
}
else
{
if (new_file)
g_object_unref (new_file);
g_free (new_display_name);
}
}
static void

View File

@ -20,6 +20,8 @@
#include "config.h"
#include <string.h>
#include "gtkgrid.h"
#include "gtkorientableprivate.h"
@ -1061,6 +1063,7 @@ gtk_grid_get_size (GtkGrid *grid,
gtk_grid_request_count_lines (&request);
lines = &request.lines[orientation];
lines->lines = g_newa (GtkGridLine, lines->max - lines->min);
memset (lines->lines, 0, (lines->max - lines->min) * sizeof (GtkGridLine));
gtk_grid_request_run (&request, orientation, FALSE);
gtk_grid_request_sum (&request, orientation, minimum, natural);
@ -1081,8 +1084,10 @@ gtk_grid_get_size_for_size (GtkGrid *grid,
gtk_grid_request_count_lines (&request);
lines = &request.lines[0];
lines->lines = g_newa (GtkGridLine, lines->max - lines->min);
memset (lines->lines, 0, (lines->max - lines->min) * sizeof (GtkGridLine));
lines = &request.lines[1];
lines->lines = g_newa (GtkGridLine, lines->max - lines->min);
memset (lines->lines, 0, (lines->max - lines->min) * sizeof (GtkGridLine));
gtk_grid_request_run (&request, 1 - orientation, FALSE);
gtk_grid_request_sum (&request, 1 - orientation, &min_size, NULL);
@ -1218,11 +1223,14 @@ gtk_grid_size_allocate (GtkWidget *widget,
GtkGridLines *lines;
request.grid = grid;
gtk_grid_request_count_lines (&request);
lines = &request.lines[0];
lines->lines = g_newa (GtkGridLine, lines->max - lines->min);
memset (lines->lines, 0, (lines->max - lines->min) * sizeof (GtkGridLine));
lines = &request.lines[1];
lines->lines = g_newa (GtkGridLine, lines->max - lines->min);
memset (lines->lines, 0, (lines->max - lines->min) * sizeof (GtkGridLine));
gtk_widget_set_allocation (widget, allocation);

View File

@ -481,7 +481,7 @@ get_default_icons (GtkIconFactory *factory)
register_bidi_stock_icon (factory, GTK_STOCK_UNDELETE, GTK_STOCK_UNDELETE);
register_bidi_stock_icon (factory, GTK_STOCK_UNDO, "edit-undo");
register_stock_icon (factory, GTK_STOCK_GO_UP, "go-up");
register_stock_icon (factory, GTK_STOCK_FILE, "document-x-generic");
register_stock_icon (factory, GTK_STOCK_FILE, "text-x-generic");
register_stock_icon (factory, GTK_STOCK_DIRECTORY, "folder");
register_stock_icon (factory, GTK_STOCK_ABOUT, "help-about");
register_stock_icon (factory, GTK_STOCK_CONNECT, GTK_STOCK_CONNECT);

View File

@ -3053,7 +3053,7 @@ gdk_color_to_css (GdkColor *color)
}
static gchar *
gdk_rgba_to_css (GdkRGBA *color)
gdk_rgba_to_css (const GdkRGBA *color)
{
/* drop alpha for now, since librsvg does not understand rgba() */
return g_strdup_printf ("rgb(%d,%d,%d)",
@ -3175,13 +3175,13 @@ _gtk_icon_info_load_symbolic_internal (GtkIconInfo *icon_info,
* Since: 3.0
**/
GdkPixbuf *
gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
GdkRGBA *fg,
GdkRGBA *success_color,
GdkRGBA *warning_color,
GdkRGBA *error_color,
gboolean *was_symbolic,
GError **error)
gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
const GdkRGBA *fg,
const GdkRGBA *success_color,
const GdkRGBA *warning_color,
const GdkRGBA *error_color,
gboolean *was_symbolic,
GError **error)
{
GdkPixbuf *pixbuf;
gchar *css_fg;

View File

@ -179,10 +179,10 @@ GdkPixbuf * gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info
GdkPixbuf * gtk_icon_info_load_icon (GtkIconInfo *icon_info,
GError **error);
GdkPixbuf * gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
GdkRGBA *fg,
GdkRGBA *success_color,
GdkRGBA *warning_color,
GdkRGBA *error_color,
const GdkRGBA *fg,
const GdkRGBA *success_color,
const GdkRGBA *warning_color,
const GdkRGBA *error_color,
gboolean *was_symbolic,
GError **error);
GdkPixbuf * gtk_icon_info_load_symbolic_for_context (GtkIconInfo *icon_info,

View File

@ -23,6 +23,7 @@
#include <atk/atk.h>
#include "gtkaccessibleprivate.h"
#include "gtkiconview.h"
#include "gtkcelllayout.h"
#include "gtkcellrenderer.h"
@ -391,6 +392,8 @@ static void gtk_icon_view_remove_editable (GtkCel
static void gtk_icon_view_context_changed (GtkCellAreaContext *context,
GParamSpec *pspec,
GtkIconView *icon_view);
static void update_text_cell (GtkIconView *icon_view);
static void update_pixbuf_cell (GtkIconView *icon_view);
/* Source side drag signals */
static void gtk_icon_view_drag_begin (GtkWidget *widget,
@ -756,6 +759,9 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
*
* The #GtkCellArea used to layout cell renderers for this view.
*
* If no area is specified when creating the icon view with gtk_icon_view_new_with_area()
* a #GtkCellAreaBox will be used.
*
* Since: 3.0
*/
g_object_class_install_property (gobject_class,
@ -1898,7 +1904,8 @@ gtk_icon_view_set_cursor (GtkIconView *icon_view,
g_return_if_fail (path != NULL);
g_return_if_fail (cell == NULL || GTK_IS_CELL_RENDERER (cell));
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (gtk_tree_path_get_depth (path) == 1)
item = g_list_nth_data (icon_view->priv->items,
@ -1910,7 +1917,8 @@ gtk_icon_view_set_cursor (GtkIconView *icon_view,
gtk_icon_view_set_cursor_item (icon_view, item, cell);
gtk_icon_view_scroll_to_path (icon_view, path, FALSE, 0.0, 0.0);
if (start_editing)
if (start_editing &&
icon_view->priv->cell_area)
{
GtkCellAreaContext *context;
@ -1958,7 +1966,7 @@ gtk_icon_view_get_cursor (GtkIconView *icon_view,
*path = NULL;
}
if (cell != NULL && item != NULL)
if (cell != NULL && item != NULL && icon_view->priv->cell_area != NULL)
*cell = gtk_cell_area_get_focus_cell (icon_view->priv->cell_area);
return (item != NULL);
@ -2883,11 +2891,14 @@ gtk_icon_view_invalidate_sizes (GtkIconView *icon_view)
(GFunc)gtk_icon_view_item_invalidate_size, NULL);
/* Reset the context */
g_signal_handler_block (icon_view->priv->cell_area_context,
icon_view->priv->context_changed_id);
gtk_cell_area_context_reset (icon_view->priv->cell_area_context);
g_signal_handler_unblock (icon_view->priv->cell_area_context,
icon_view->priv->context_changed_id);
if (icon_view->priv->cell_area_context)
{
g_signal_handler_block (icon_view->priv->cell_area_context,
icon_view->priv->context_changed_id);
gtk_cell_area_context_reset (icon_view->priv->cell_area_context);
g_signal_handler_unblock (icon_view->priv->cell_area_context,
icon_view->priv->context_changed_id);
}
/* Re-layout the items */
gtk_icon_view_queue_layout (icon_view);
@ -3257,7 +3268,12 @@ gtk_icon_view_row_changed (GtkTreeModel *model,
if (gtk_tree_path_get_depth (path) > 1)
return;
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
/* An icon view subclass might add it's own model and populate
* things at init() time instead of waiting for the constructor()
* to be called
*/
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
/* Here we can use a "grow-only" strategy for optimization
* and only invalidate a single item and queue a relayout
@ -3339,7 +3355,8 @@ gtk_icon_view_row_deleted (GtkTreeModel *model,
list = g_list_nth (icon_view->priv->items, index);
item = list->data;
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (item == icon_view->priv->anchor_item)
icon_view->priv->anchor_item = NULL;
@ -3387,7 +3404,8 @@ gtk_icon_view_rows_reordered (GtkTreeModel *model,
if (iter != NULL)
return;
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
length = gtk_tree_model_iter_n_children (model, NULL);
@ -4120,6 +4138,9 @@ gtk_icon_view_ensure_cell_area (GtkIconView *icon_view,
priv->context_changed_id =
g_signal_connect (priv->cell_area_context, "notify",
G_CALLBACK (gtk_icon_view_context_changed), icon_view);
update_text_cell (icon_view);
update_pixbuf_cell (icon_view);
}
static GtkCellArea *
@ -4880,6 +4901,9 @@ gtk_icon_view_get_model (GtkIconView *icon_view)
static void
update_text_cell (GtkIconView *icon_view)
{
if (!icon_view->priv->cell_area)
return;
if (icon_view->priv->text_column == -1 &&
icon_view->priv->markup_column == -1)
{
@ -4930,6 +4954,9 @@ update_text_cell (GtkIconView *icon_view)
static void
update_pixbuf_cell (GtkIconView *icon_view)
{
if (!icon_view->priv->cell_area)
return;
if (icon_view->priv->pixbuf_column == -1)
{
if (icon_view->priv->pixbuf_cell != NULL)
@ -5000,8 +5027,8 @@ gtk_icon_view_set_text_column (GtkIconView *icon_view,
icon_view->priv->text_column = column;
}
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
update_text_cell (icon_view);
@ -5063,7 +5090,8 @@ gtk_icon_view_set_markup_column (GtkIconView *icon_view,
icon_view->priv->markup_column = column;
}
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
update_text_cell (icon_view);
@ -5123,7 +5151,8 @@ gtk_icon_view_set_pixbuf_column (GtkIconView *icon_view,
icon_view->priv->pixbuf_column = column;
}
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
update_pixbuf_cell (icon_view);
@ -5440,11 +5469,15 @@ gtk_icon_view_set_item_orientation (GtkIconView *icon_view,
{
icon_view->priv->item_orientation = orientation;
if (GTK_IS_ORIENTABLE (icon_view->priv->cell_area))
gtk_orientable_set_orientation (GTK_ORIENTABLE (icon_view->priv->cell_area),
icon_view->priv->item_orientation);
if (icon_view->priv->cell_area)
{
if (GTK_IS_ORIENTABLE (icon_view->priv->cell_area))
gtk_orientable_set_orientation (GTK_ORIENTABLE (icon_view->priv->cell_area),
icon_view->priv->item_orientation);
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
}
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
gtk_icon_view_invalidate_sizes (icon_view);
update_text_cell (icon_view);
@ -5496,7 +5529,9 @@ gtk_icon_view_set_columns (GtkIconView *icon_view,
{
icon_view->priv->columns = columns;
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
gtk_icon_view_queue_layout (icon_view);
g_object_notify (G_OBJECT (icon_view), "columns");
@ -5542,7 +5577,9 @@ gtk_icon_view_set_item_width (GtkIconView *icon_view,
{
icon_view->priv->item_width = item_width;
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
gtk_icon_view_invalidate_sizes (icon_view);
update_text_cell (icon_view);
@ -5591,9 +5628,11 @@ gtk_icon_view_set_spacing (GtkIconView *icon_view,
{
icon_view->priv->spacing = spacing;
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
gtk_icon_view_invalidate_sizes (icon_view);
g_object_notify (G_OBJECT (icon_view), "spacing");
}
}
@ -5636,9 +5675,11 @@ gtk_icon_view_set_row_spacing (GtkIconView *icon_view,
{
icon_view->priv->row_spacing = row_spacing;
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
gtk_icon_view_invalidate_sizes (icon_view);
g_object_notify (G_OBJECT (icon_view), "row-spacing");
}
}
@ -5681,9 +5722,11 @@ gtk_icon_view_set_column_spacing (GtkIconView *icon_view,
{
icon_view->priv->column_spacing = column_spacing;
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
gtk_icon_view_invalidate_sizes (icon_view);
g_object_notify (G_OBJECT (icon_view), "column-spacing");
}
}
@ -5727,9 +5770,11 @@ gtk_icon_view_set_margin (GtkIconView *icon_view,
{
icon_view->priv->margin = margin;
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
gtk_icon_view_invalidate_sizes (icon_view);
g_object_notify (G_OBJECT (icon_view), "margin");
}
}
@ -5772,9 +5817,11 @@ gtk_icon_view_set_item_padding (GtkIconView *icon_view,
{
icon_view->priv->item_padding = item_padding;
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
if (icon_view->priv->cell_area)
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
gtk_icon_view_invalidate_sizes (icon_view);
g_object_notify (G_OBJECT (icon_view), "item-padding");
}
}
@ -8171,26 +8218,6 @@ gtk_icon_view_item_accessible_finalize (GObject *object)
G_OBJECT_CLASS (accessible_item_parent_class)->finalize (object);
}
static G_CONST_RETURN gchar*
gtk_icon_view_item_accessible_get_name (AtkObject *obj)
{
if (obj->name)
return obj->name;
else
{
GtkIconViewItemAccessible *item;
GtkTextIter start_iter;
GtkTextIter end_iter;
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (obj);
gtk_text_buffer_get_start_iter (item->text_buffer, &start_iter);
gtk_text_buffer_get_end_iter (item->text_buffer, &end_iter);
return gtk_text_buffer_get_text (item->text_buffer, &start_iter, &end_iter, FALSE);
}
}
static AtkObject*
gtk_icon_view_item_accessible_get_parent (AtkObject *obj)
{
@ -8252,10 +8279,9 @@ gtk_icon_view_item_accessible_class_init (AtkObjectClass *klass)
gobject_class->finalize = gtk_icon_view_item_accessible_finalize;
klass->get_index_in_parent = gtk_icon_view_item_accessible_get_index_in_parent;
klass->get_name = gtk_icon_view_item_accessible_get_name;
klass->get_parent = gtk_icon_view_item_accessible_get_parent;
klass->ref_state_set = gtk_icon_view_item_accessible_ref_state_set;
klass->get_index_in_parent = gtk_icon_view_item_accessible_get_index_in_parent;
klass->get_parent = gtk_icon_view_item_accessible_get_parent;
klass->ref_state_set = gtk_icon_view_item_accessible_ref_state_set;
}
static GType
@ -8591,7 +8617,7 @@ gtk_icon_view_accessible_model_row_changed (GtkTreeModel *tree_model,
icon_view = GTK_ICON_VIEW (widget);
item = a11y_item->item;
name = gtk_icon_view_item_accessible_get_name (ATK_OBJECT (a11y_item));
name = atk_object_get_name (ATK_OBJECT (a11y_item));
if (!name || strcmp (name, "") == 0)
{
@ -9310,28 +9336,10 @@ gtk_icon_view_get_accessible (GtkWidget *widget)
if (first_time)
{
AtkObjectFactory *factory;
AtkRegistry *registry;
GType derived_type;
GType derived_atk_type;
/*
* Figure out whether accessibility is enabled by looking at the
* type of the accessible object which would be created for
* the parent type of GtkIconView.
*/
derived_type = g_type_parent (GTK_TYPE_ICON_VIEW);
registry = atk_get_default_registry ();
factory = atk_registry_get_factory (registry,
derived_type);
derived_atk_type = atk_object_factory_get_accessible_type (factory);
if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
atk_registry_set_factory_type (registry,
GTK_TYPE_ICON_VIEW,
gtk_icon_view_accessible_factory_get_type ());
_gtk_accessible_set_factory_type (GTK_TYPE_ICON_VIEW,
gtk_icon_view_accessible_factory_get_type ());
first_time = FALSE;
}
}
return GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->get_accessible (widget);
}

View File

@ -985,9 +985,12 @@ gtk_get_option_group (gboolean open_default_display)
/**
* gtk_init_with_args:
* @argc: a pointer to the number of command line arguments
* @argv: (inout) (array length=argc): a pointer to the array of
* command line arguments
* @argc: (inout): Address of the <parameter>argc</parameter> parameter of
* your main() function (or 0 if @argv is %NULL). This will be changed if
* any arguments were handled.
* @argv: (array length=argc) (inout) (allow-none): Address of the
* <parameter>argv</parameter> parameter of main(), or %NULL. Any options
* understood by GTK+ are stripped before return.
* @parameter_string: a string which is displayed in
* the first line of <option>--help</option> output, after
* <literal><replaceable>programname</replaceable> [OPTION...]</literal>
@ -1102,10 +1105,11 @@ gtk_parse_args (int *argc,
/**
* gtk_init_check:
* @argc: (inout): Address of the <parameter>argc</parameter> parameter of
* your main() function. Changed if any arguments were handled
* your main() function (or 0 if @argv is %NULL). This will be changed if
* any arguments were handled.
* @argv: (array length=argc) (inout) (allow-none): Address of the
* <parameter>argv</parameter> parameter of main()
* Any parameters understood by gtk_init() are stripped before return
* <parameter>argv</parameter> parameter of main(), or %NULL. Any options
* understood by GTK+ are stripped before return.
*
* This function does the same work as gtk_init() with only a single
* change: It does not terminate the program if the windowing system
@ -1135,15 +1139,20 @@ gtk_init_check (int *argc,
/**
* gtk_init:
* @argc: (inout): Address of the <parameter>argc</parameter> parameter of
* your main() function. Changed if any arguments were handled
* your main() function (or 0 if @argv is %NULL). This will be changed if
* any arguments were handled.
* @argv: (array length=argc) (inout) (allow-none): Address of the
* <parameter>argv</parameter> parameter of main(). Any options
* <parameter>argv</parameter> parameter of main(), or %NULL. Any options
* understood by GTK+ are stripped before return.
*
* Call this function before using any other GTK+ functions in your GUI
* applications. It will initialize everything needed to operate the
* toolkit and parses some standard command line options.
*
* Although you are expected to pass the @argc, @argv parameters from main() to
* this function, it is possible to pass %NULL if @argv is not available or
* commandline handling is not required.
*
* @argc and @argv are adjusted accordingly so your own code will
* never see those standard arguments.
*

View File

@ -1184,11 +1184,11 @@ attach_widget_screen_changed (GtkWidget *attach_widget,
}
/**
* gtk_menu_attach_to_widget: (skip)
* gtk_menu_attach_to_widget:
* @menu: a #GtkMenu
* @attach_widget: the #GtkWidget that the menu will be attached to
* @detacher: the user supplied callback function that will be called
* when the menu calls gtk_menu_detach()
* @detacher: (scope async)(allow-none): the user supplied callback function
* that will be called when the menu calls gtk_menu_detach()
*
* Attaches the menu to the widget and provides a callback function
* that will be invoked when the menu calls gtk_menu_detach() during
@ -5127,7 +5127,7 @@ compute_child_offset (GtkMenu *menu,
if (!priv->heights || priv->heights_length < gtk_menu_get_n_rows (menu))
return FALSE;
/* when we have a row with only invisible children, it's height will
/* when we have a row with only invisible children, its height will
* be zero, so there's no need to check WIDGET_VISIBLE here
*/
for (i = 0; i < item_top_attach; i++)

View File

@ -413,6 +413,7 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
static void
gtk_menu_item_init (GtkMenuItem *menu_item)
{
GtkStyleContext *context;
GtkMenuItemPrivate *priv;
priv = G_TYPE_INSTANCE_GET_PRIVATE (menu_item,
@ -437,6 +438,9 @@ gtk_menu_item_init (GtkMenuItem *menu_item)
priv->use_action_appearance = TRUE;
priv->timer = 0;
priv->action = NULL;
context = gtk_widget_get_style_context (GTK_WIDGET (menu_item));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MENUITEM);
}
GtkWidget*
@ -1590,6 +1594,9 @@ gtk_menu_item_draw (GtkWidget *widget,
gtk_style_context_get_padding (context, state, &padding);
if (GTK_IS_MENU_BAR (parent))
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MENUBAR);
if (child && (state & GTK_STATE_FLAG_PRELIGHT))
{
gtk_render_background (context, cr, x, y, w, h);

View File

@ -2189,8 +2189,7 @@ gtk_notebook_size_request (GtkWidget *widget,
if (!priv->homogeneous || priv->scrollable)
vis_pages = 1;
requisition->height = MAX (requisition->height,
vis_pages * tab_max +
tab_overlap);
vis_pages * tab_max + tab_overlap);
requisition->width += tab_width;
break;
@ -4907,7 +4906,7 @@ gtk_notebook_paint (GtkWidget *widget,
GtkNotebookPrivate *priv;
GtkNotebookPage *page;
GtkAllocation allocation;
GList *children;
GList *children, *other_order;
gboolean showarrow;
gint width, height;
gint x, y;
@ -5062,8 +5061,13 @@ gtk_notebook_paint (GtkWidget *widget,
while (children)
{
page = children->data;
if (page == priv->cur_page)
break;
children = gtk_notebook_search_page (notebook, children,
step, TRUE);
if (!gtk_widget_get_visible (page->child) ||
!gtk_widget_get_mapped (page->tab_label))
continue;
@ -5072,6 +5076,37 @@ gtk_notebook_paint (GtkWidget *widget,
gtk_notebook_draw_tab (notebook, page, cr, tab_flags);
}
if (children != NULL)
{
other_order = NULL;
while (children)
{
page = children->data;
children = gtk_notebook_search_page (notebook, children,
step, TRUE);
if (!gtk_widget_get_visible (page->child) ||
!gtk_widget_get_mapped (page->tab_label))
continue;
if (children != NULL)
other_order = g_list_prepend (other_order, children->data);
}
/* draw them with the opposite order */
children = other_order;
while (children)
{
page = children->data;
tab_flags = _gtk_notebook_get_tab_flags (notebook, page);
gtk_notebook_draw_tab (notebook, page, cr, tab_flags);
children = children->next;
}
}
if (showarrow && priv->scrollable)
{
if (priv->has_before_previous)
@ -5720,9 +5755,7 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
else
{
*children = (*children)->next;
if (!gtk_widget_get_visible (page->child))
continue;
continue;
}
if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page))
@ -5740,7 +5773,7 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
{
case GTK_POS_TOP:
case GTK_POS_BOTTOM:
child_allocation.width = page->requisition.width + tab_overlap + tab_extra_space;
child_allocation.width = MAX (1, page->requisition.width + tab_overlap + tab_extra_space);
/* make sure that the reordered tab doesn't go past the last position */
if (priv->operation == DRAG_OPERATION_REORDER &&
@ -5795,7 +5828,7 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
break;
case GTK_POS_LEFT:
case GTK_POS_RIGHT:
child_allocation.height = page->requisition.height + tab_overlap + tab_extra_space;
child_allocation.height = MAX (1, page->requisition.height + tab_overlap + tab_extra_space);
/* make sure that the reordered tab doesn't go past the last position */
if (priv->operation == DRAG_OPERATION_REORDER &&
@ -6020,7 +6053,7 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
GtkStyleContext *context;
gint padding;
gint focus_width;
gint tab_curvature;
gint tab_curvature, tab_overlap;
gint tab_pos = get_effective_tab_pos (notebook);
gboolean tab_allocation_changed;
gboolean was_visible = page->tab_allocated_visible;
@ -6046,6 +6079,7 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
gtk_widget_style_get (widget,
"focus-line-width", &focus_width,
"tab-curvature", &tab_curvature,
"tab-overlap", &tab_overlap,
NULL);
switch (tab_pos)
{
@ -6054,11 +6088,32 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
padding = tab_curvature + focus_width + priv->tab_hborder;
if (page->fill)
{
child_allocation.x = tab_padding.left + focus_width + priv->tab_hborder;
child_allocation.x = tab_padding.left + padding;
child_allocation.width = MAX (1, (page->allocation.width -
tab_padding.left - tab_padding.right -
2 * (focus_width + priv->tab_hborder)));
2 * (padding)));
child_allocation.x += page->allocation.x;
/* if we're drawing an inactive page, trim the allocation width
* for the children by the difference between tab-curvature
* and tab-overlap.
* if we're after the active tab, we need to trim the x
* coordinate of the allocation too, to position it after
* the end of the overlap.
*/
if (page != priv->cur_page && tab_overlap > tab_curvature + MIN (tab_padding.left, tab_padding.right))
{
if (gtk_notebook_page_num (notebook, page->child) >
gtk_notebook_page_num (notebook, priv->cur_page->child))
{
child_allocation.x += tab_overlap - tab_curvature - tab_padding.left;
child_allocation.width -= tab_overlap - tab_curvature - tab_padding.left;
}
else
{
child_allocation.width -= tab_overlap - tab_curvature - tab_padding.right;
}
}
}
else
{
@ -6087,6 +6142,22 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
tab_padding.bottom - tab_padding.top -
2 * padding));
child_allocation.y += page->allocation.y;
/* if we're drawing an inactive page, trim the allocation height
* for the children by the difference between tab-curvature
* and tab-overlap.
* if we're after the active tab, we need to trim the y
* coordinate of the allocation too, to position it after
* the end of the overlap.
*/
if (page != priv->cur_page && tab_overlap > tab_curvature)
{
child_allocation.height -= tab_overlap - tab_curvature;
if (gtk_notebook_page_num (notebook, page->child) >
gtk_notebook_page_num (notebook, priv->cur_page->child))
child_allocation.y += tab_overlap - tab_curvature;
}
}
else
{
@ -6134,7 +6205,6 @@ gtk_notebook_calc_tabs (GtkNotebook *notebook,
{
GtkNotebookPage *page = NULL;
GList *children;
GList *last_list = NULL;
GList *last_calculated_child = NULL;
gint tab_pos = get_effective_tab_pos (notebook);
@ -6143,81 +6213,71 @@ gtk_notebook_calc_tabs (GtkNotebook *notebook,
children = start;
while (1)
switch (tab_pos)
{
switch (tab_pos)
case GTK_POS_TOP:
case GTK_POS_BOTTOM:
while (children)
{
case GTK_POS_TOP:
case GTK_POS_BOTTOM:
while (children)
page = children->data;
if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) &&
gtk_widget_get_visible (page->child))
{
page = children->data;
if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) &&
gtk_widget_get_visible (page->child))
*tab_space -= page->requisition.width;
if (*tab_space < 0 || children == *end)
{
*tab_space -= page->requisition.width;
if (*tab_space < 0 || children == *end)
if (*tab_space < 0)
{
if (*tab_space < 0)
{
*tab_space = - (*tab_space +
page->requisition.width);
*tab_space = - (*tab_space +
page->requisition.width);
if (*tab_space == 0 && direction == STEP_PREV)
children = last_calculated_child;
if (*tab_space == 0 && direction == STEP_PREV)
children = last_calculated_child;
*end = children;
}
return;
*end = children;
}
last_calculated_child = children;
last_list = children;
return;
}
if (direction == STEP_NEXT)
children = children->next;
else
children = children->prev;
last_calculated_child = children;
}
break;
case GTK_POS_LEFT:
case GTK_POS_RIGHT:
while (children)
{
page = children->data;
if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) &&
gtk_widget_get_visible (page->child))
{
*tab_space -= page->requisition.height;
if (*tab_space < 0 || children == *end)
{
if (*tab_space < 0)
{
*tab_space = - (*tab_space +
page->requisition.height);
if (*tab_space == 0 && direction == STEP_PREV)
children = last_calculated_child;
*end = children;
}
return;
}
last_calculated_child = children;
last_list = children;
}
if (direction == STEP_NEXT)
children = children->next;
else
children = children->prev;
}
break;
if (direction == STEP_NEXT)
children = children->next;
else
children = children->prev;
}
if (direction == STEP_PREV)
return;
direction = STEP_PREV;
children = last_list;
break;
case GTK_POS_LEFT:
case GTK_POS_RIGHT:
while (children)
{
page = children->data;
if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) &&
gtk_widget_get_visible (page->child))
{
*tab_space -= page->requisition.height;
if (*tab_space < 0 || children == *end)
{
if (*tab_space < 0)
{
*tab_space = - (*tab_space + page->requisition.height);
if (*tab_space == 0 && direction == STEP_PREV)
children = last_calculated_child;
*end = children;
}
return;
}
last_calculated_child = children;
}
if (direction == STEP_NEXT)
children = children->next;
else
children = children->prev;
}
break;
}
}

View File

@ -924,7 +924,7 @@ gtk_range_get_flippable (GtkRange *range)
* @size_fixed: %TRUE to make the slider size constant
*
* Sets whether the range's slider has a fixed size, or a size that
* depends on it's adjustment's page size.
* depends on its adjustment's page size.
*
* This function is useful mainly for #GtkRange subclasses.
*
@ -1842,7 +1842,6 @@ _gtk_range_update_context_for_stepper (GtkRange *range,
}
gtk_style_context_set_junction_sides (context, sides);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
}
static void
@ -1860,8 +1859,8 @@ draw_stepper (GtkRange *range,
GtkWidget *widget = GTK_WIDGET (range);
gfloat arrow_scaling;
GdkRectangle *rect;
gint arrow_x;
gint arrow_y;
gdouble arrow_x;
gdouble arrow_y;
gdouble arrow_size, angle;
gboolean arrow_sensitive;
@ -1912,7 +1911,14 @@ draw_stepper (GtkRange *range,
context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
_gtk_range_update_context_for_stepper (range, context, stepper);
/* don't set juction sides on scrollbar steppers */
if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_SCROLLBAR))
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_NONE);
else
_gtk_range_update_context_for_stepper (range, context, stepper);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
gtk_style_context_set_state (context, state);
gtk_render_background (context, cr,

View File

@ -1962,7 +1962,7 @@ gtk_recent_info_get_icon (GtkRecentInfo *info,
strcmp (info->mime_type, "x-directory/normal") == 0)
retval = get_icon_fallback ("folder", size);
else
retval = get_icon_fallback ("document-x-generic", size);
retval = get_icon_fallback ("text-x-generic", size);
}
return retval;

View File

@ -77,7 +77,6 @@
* unrelated code portions otherwise
*/
typedef struct _GtkScaleMark GtkScaleMark;
struct _GtkScalePrivate
@ -96,7 +95,7 @@ struct _GtkScaleMark
{
gdouble value;
gchar *markup;
GtkPositionType position;
GtkPositionType position; /* always GTK_POS_TOP or GTK_POS_BOTTOM */
};
enum {
@ -792,17 +791,17 @@ gtk_scale_get_range_border (GtkRange *range,
NULL);
gtk_scale_get_mark_label_size (scale, GTK_POS_TOP, &n1, &w1, &h1, &n2, &w2, &h2);
if (gtk_orientable_get_orientation (GTK_ORIENTABLE (scale)) == GTK_ORIENTATION_HORIZONTAL)
{
gtk_scale_get_mark_label_size (scale, GTK_POS_TOP, &n1, &w1, &h1, &n2, &w2, &h2);
if (n1 > 0)
border->top += h1 + value_spacing + slider_width / 2;
if (n2 > 0)
border->bottom += h2 + value_spacing + slider_width / 2;
border->bottom += h2 + value_spacing + slider_width / 2;
}
else
{
gtk_scale_get_mark_label_size (scale, GTK_POS_LEFT, &n1, &w1, &h1, &n2, &w2, &h2);
if (n1 > 0)
border->left += w1 + value_spacing + slider_width / 2;
if (n2 > 0)
@ -897,8 +896,8 @@ gtk_scale_get_mark_label_size (GtkScale *scale,
pango_layout_set_markup (layout, mark->markup, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
w = logical_rect.width;
h = logical_rect.height;
w = logical_rect.width;
h = logical_rect.height;
}
else
{
@ -991,7 +990,7 @@ gtk_scale_get_preferred_height (GtkWidget *widget,
gtk_widget_style_get (widget, "slider-length", &slider_length, NULL);
gtk_scale_get_mark_label_size (GTK_SCALE (widget), GTK_POS_LEFT, &n1, &w1, &h1, &n2, &w2, &h2);
gtk_scale_get_mark_label_size (GTK_SCALE (widget), GTK_POS_TOP, &n1, &w1, &h1, &n2, &w2, &h2);
h1 = (n1 - 1) * h1 + MAX (h1, slider_length);
h2 = (n2 - 1) * h1 + MAX (h2, slider_length);
h = MAX (h1, h2);
@ -1021,7 +1020,7 @@ find_next_pos (GtkWidget *widget,
}
gtk_widget_get_allocation (widget, &allocation);
if (pos == GTK_POS_TOP || pos == GTK_POS_BOTTOM)
if (gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) == GTK_ORIENTATION_HORIZONTAL)
return allocation.width;
else
return allocation.height;
@ -1095,15 +1094,14 @@ gtk_scale_draw (GtkWidget *widget,
y1 = range_rect.y + range_rect.height;
y2 = y1 + slider_width / 2;
min_pos = min_pos_after;
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_TOP, 0) - min_sep;
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_BOTTOM, 1) - min_sep;
}
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MARK);
gtk_style_context_set_state (context, state);
gtk_render_line (context, cr,
x1, y1, x1, y2);
gtk_render_line (context, cr, x1, y1, x1, y2);
if (mark->markup)
{
@ -1128,27 +1126,26 @@ gtk_scale_draw (GtkWidget *widget,
min_pos_after = x3 + logical_rect.width + min_sep;
}
gtk_render_layout (context, cr,
x3, y3, layout);
gtk_render_layout (context, cr, x3, y3, layout);
}
gtk_style_context_restore (context);
}
else
{
if (mark->position == GTK_POS_LEFT)
if (mark->position == GTK_POS_TOP)
{
x1 = range_rect.x;
x2 = range_rect.x - slider_width / 2;
min_pos = min_pos_before;
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_LEFT, 1) - min_sep;
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_TOP, 1) - min_sep;
}
else
{
x1 = range_rect.x + range_rect.width;
x2 = range_rect.x + range_rect.width + slider_width / 2;
min_pos = min_pos_after;
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_LEFT, 0) - min_sep;
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_BOTTOM, 1) - min_sep;
}
y1 = marks[i];
@ -1156,8 +1153,7 @@ gtk_scale_draw (GtkWidget *widget,
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MARK);
gtk_style_context_set_state (context, state);
gtk_render_line (context, cr,
x1, y1, x2, y1);
gtk_render_line (context, cr, x1, y1, x2, y1);
if (mark->markup)
{
@ -1171,7 +1167,7 @@ gtk_scale_draw (GtkWidget *widget,
y3 = max_pos - logical_rect.height;
if (y3 < 0)
y3 = 0;
if (mark->position == GTK_POS_LEFT)
if (mark->position == GTK_POS_TOP)
{
x3 = x2 - value_spacing - logical_rect.width;
min_pos_before = y3 + logical_rect.height + min_sep;
@ -1182,8 +1178,7 @@ gtk_scale_draw (GtkWidget *widget,
min_pos_after = y3 + logical_rect.height + min_sep;
}
gtk_render_layout (context, cr,
x3, y3, layout);
gtk_render_layout (context, cr, x3, y3, layout);
}
gtk_style_context_restore (context);
@ -1463,6 +1458,7 @@ void
gtk_scale_clear_marks (GtkScale *scale)
{
GtkScalePrivate *priv;
GtkStyleContext *context;
g_return_if_fail (GTK_IS_SCALE (scale));
@ -1472,6 +1468,10 @@ gtk_scale_clear_marks (GtkScale *scale)
g_slist_free (priv->marks);
priv->marks = NULL;
context = gtk_widget_get_style_context (GTK_WIDGET (scale));
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE);
_gtk_range_set_stop_values (GTK_RANGE (scale), NULL, 0);
gtk_widget_queue_resize (GTK_WIDGET (scale));
@ -1490,22 +1490,22 @@ compare_marks (gpointer a, gpointer b)
/**
* gtk_scale_add_mark:
* @scale: a #GtkScale
* @value: the value at which the mark is placed, must be between
* @value: the value at which the mark is placed, must be between
* the lower and upper limits of the scales' adjustment
* @position: where to draw the mark. For a horizontal scale, #GTK_POS_TOP
* is drawn above the scale, anything else below. For a vertical scale,
* #GTK_POS_LEFT is drawn to the left of the scale, anything else to the
* right.
* and %GTK_POS_LEFT are drawn above the scale, anything else below.
* For a vertical scale, #GTK_POS_LEFT and %GTK_POS_TOP are drawn to
* the left of the scale, anything else to the right.
* @markup: (allow-none): Text to be shown at the mark, using <link linkend="PangoMarkupFormat">Pango markup</link>, or %NULL
*
*
* Adds a mark at @value.
* Adds a mark at @value.
*
* A mark is indicated visually by drawing a tick mark next to the scale,
* and GTK+ makes it easy for the user to position the scale exactly at the
* A mark is indicated visually by drawing a tick mark next to the scale,
* and GTK+ makes it easy for the user to position the scale exactly at the
* marks value.
*
* If @markup is not %NULL, text is shown next to the tick mark.
* If @markup is not %NULL, text is shown next to the tick mark.
*
* To remove marks from a scale, use gtk_scale_clear_marks().
*
@ -1522,6 +1522,8 @@ gtk_scale_add_mark (GtkScale *scale,
GSList *m;
gdouble *values;
gint n, i;
GtkStyleContext *context;
int all_pos;
g_return_if_fail (GTK_IS_SCALE (scale));
@ -1530,23 +1532,49 @@ gtk_scale_add_mark (GtkScale *scale,
mark = g_new (GtkScaleMark, 1);
mark->value = value;
mark->markup = g_strdup (markup);
mark->position = position;
if (position == GTK_POS_LEFT ||
position == GTK_POS_TOP)
mark->position = GTK_POS_TOP;
else
mark->position = GTK_POS_BOTTOM;
priv->marks = g_slist_insert_sorted (priv->marks, mark,
(GCompareFunc) compare_marks);
#define MARKS_ABOVE 1
#define MARKS_BELOW 2
all_pos = 0;
n = g_slist_length (priv->marks);
values = g_new (gdouble, n);
for (m = priv->marks, i = 0; m; m = m->next, i++)
{
mark = m->data;
values[i] = mark->value;
if (mark->position == GTK_POS_TOP)
all_pos |= MARKS_ABOVE;
else
all_pos |= MARKS_BELOW;
}
_gtk_range_set_stop_values (GTK_RANGE (scale), values, n);
g_free (values);
/* Set the style classes for the slider, so it could
* point to the right direction when marks are present
*/
context = gtk_widget_get_style_context (GTK_WIDGET (scale));
if (all_pos & MARKS_ABOVE)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE);
else
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE);
if (all_pos & MARKS_BELOW)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW);
else
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW);
gtk_widget_queue_resize (GTK_WIDGET (scale));
}
@ -1671,7 +1699,11 @@ marks_start_element (GMarkupParseContext *context,
mark = g_slice_new (MarkData);
mark->value = value;
mark->position = position;
if (position == GTK_POS_LEFT ||
position == GTK_POS_TOP)
mark->position = GTK_POS_TOP;
else
mark->position = GTK_POS_BOTTOM;
mark->markup = g_string_new ("");
mark->context = g_strdup (msg_context);
mark->translatable = translatable;

View File

@ -317,6 +317,7 @@ gtk_search_engine_tracker_start (GtkSearchEngine *engine)
g_debug ("Query starting, search criteria:'%s', location:'%s'", search_text, location_uri);
#ifdef FTS_MATCHING
/* Using FTS: */
sparql = g_string_new ("SELECT nie:url(?urn) "
"WHERE {"
@ -325,7 +326,6 @@ gtk_search_engine_tracker_start (GtkSearchEngine *engine)
" fts:match ");
sparql_append_string_literal (sparql, search_text);
#ifdef FTS_MATCHING
if (location_uri)
{
g_string_append (sparql, " . FILTER (fn:starts-with(nie:url(?urn),");

View File

@ -101,6 +101,7 @@ static void
gtk_separator_init (GtkSeparator *separator)
{
GtkSeparatorPrivate *private;
GtkStyleContext *context;
separator->priv = G_TYPE_INSTANCE_GET_PRIVATE (separator,
GTK_TYPE_SEPARATOR,
@ -110,6 +111,9 @@ gtk_separator_init (GtkSeparator *separator)
gtk_widget_set_has_window (GTK_WIDGET (separator), FALSE);
private->orientation = GTK_ORIENTATION_HORIZONTAL;
context = gtk_widget_get_style_context (GTK_WIDGET (separator));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
}
static void

View File

@ -25,6 +25,7 @@
*/
#include "config.h"
#include "gtkaccessibleprivate.h"
#include "gtkseparatormenuitem.h"
/**
@ -37,6 +38,7 @@
* make it appear sunken into the interface.
*/
static AtkObject *gtk_separator_menu_item_get_accessible (GtkWidget *widget);
G_DEFINE_TYPE (GtkSeparatorMenuItem, gtk_separator_menu_item, GTK_TYPE_MENU_ITEM)
@ -44,11 +46,16 @@ static void
gtk_separator_menu_item_class_init (GtkSeparatorMenuItemClass *class)
{
GTK_CONTAINER_CLASS (class)->child_type = NULL;
GTK_WIDGET_CLASS (class)->get_accessible = gtk_separator_menu_item_get_accessible;
}
static void
gtk_separator_menu_item_init (GtkSeparatorMenuItem *item)
{
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (item));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
}
/**
@ -63,3 +70,82 @@ gtk_separator_menu_item_new (void)
{
return g_object_new (GTK_TYPE_SEPARATOR_MENU_ITEM, NULL);
}
typedef struct _GtkSeparatorMenuItemAccessible GtkSeparatorMenuItemAccessible;
typedef struct _GtkSeparatorMenuItemAccessibleClass GtkSeparatorMenuItemAccessibleClass;
ATK_DEFINE_TYPE (GtkSeparatorMenuItemAccessible, _gtk_separator_menu_item_accessible, GTK_TYPE_MENU_ITEM);
static void
_gtk_separator_menu_item_accessible_initialize (AtkObject *accessible,
gpointer widget)
{
ATK_OBJECT_CLASS (_gtk_separator_menu_item_accessible_parent_class)->initialize (accessible, widget);
atk_object_set_role (accessible, ATK_ROLE_SEPARATOR);
}
static void
_gtk_separator_menu_item_accessible_class_init (GtkSeparatorMenuItemAccessibleClass *klass)
{
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
atk_class->initialize = _gtk_separator_menu_item_accessible_initialize;
}
static void
_gtk_separator_menu_item_accessible_init (GtkSeparatorMenuItemAccessible *self)
{
}
typedef AtkObjectFactoryClass GtkSeparatorMenuItemAccessibleFactoryClass;
typedef AtkObjectFactory GtkSeparatorMenuItemAccessibleFactory;
G_DEFINE_TYPE (GtkSeparatorMenuItemAccessibleFactory,
_gtk_separator_menu_item_accessible_factory,
ATK_TYPE_OBJECT_FACTORY);
static GType
_gtk_separator_menu_item_accessible_factory_get_accessible_type (void)
{
return _gtk_separator_menu_item_accessible_get_type ();
}
static AtkObject *
_gtk_separator_menu_item_accessible_factory_create_accessible (GObject *obj)
{
AtkObject *accessible;
accessible = g_object_new (_gtk_separator_menu_item_accessible_get_type (), NULL);
atk_object_initialize (accessible, obj);
return accessible;
}
static void
_gtk_separator_menu_item_accessible_factory_class_init (AtkObjectFactoryClass *klass)
{
klass->create_accessible = _gtk_separator_menu_item_accessible_factory_create_accessible;
klass->get_accessible_type = _gtk_separator_menu_item_accessible_factory_get_accessible_type;
}
static void
_gtk_separator_menu_item_accessible_factory_init (AtkObjectFactory *factory)
{
}
static AtkObject *
gtk_separator_menu_item_get_accessible (GtkWidget *widget)
{
static gboolean initialized = FALSE;
if (G_UNLIKELY (!initialized))
{
_gtk_accessible_set_factory_type (GTK_TYPE_SEPARATOR_MENU_ITEM,
_gtk_separator_menu_item_accessible_factory_get_type ());
initialized = TRUE;
}
return GTK_WIDGET_CLASS (gtk_separator_menu_item_parent_class)->get_accessible (widget);
}

View File

@ -152,12 +152,17 @@ gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class)
static void
gtk_separator_tool_item_init (GtkSeparatorToolItem *separator_item)
{
GtkStyleContext *context;
separator_item->priv = G_TYPE_INSTANCE_GET_PRIVATE (separator_item,
GTK_TYPE_SEPARATOR_TOOL_ITEM,
GtkSeparatorToolItemPrivate);
separator_item->priv->draw = TRUE;
gtk_widget_set_has_window (GTK_WIDGET (separator_item), FALSE);
context = gtk_widget_get_style_context (GTK_WIDGET (separator_item));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
}
static void

View File

@ -82,12 +82,6 @@
*/
#ifdef GDK_WINDOWING_QUARTZ
#define DEFAULT_KEY_THEME "Mac"
#else
#define DEFAULT_KEY_THEME NULL
#endif
#define DEFAULT_TIMEOUT_INITIAL 200
#define DEFAULT_TIMEOUT_REPEAT 20
#define DEFAULT_TIMEOUT_EXPAND 500
@ -141,7 +135,6 @@ enum {
PROP_FONT_NAME,
PROP_ICON_SIZES,
PROP_MODULES,
#ifdef GDK_WINDOWING_X11
PROP_XFT_ANTIALIAS,
PROP_XFT_HINTING,
PROP_XFT_HINTSTYLE,
@ -149,7 +142,6 @@ enum {
PROP_XFT_DPI,
PROP_CURSOR_THEME_NAME,
PROP_CURSOR_THEME_SIZE,
#endif
PROP_ALTERNATIVE_BUTTON_ORDER,
PROP_ALTERNATIVE_SORT_ARROWS,
PROP_SHOW_INPUT_METHOD_MENU,
@ -219,12 +211,10 @@ static guint settings_install_property_parser (GtkSettingsClass *class,
static void settings_update_double_click (GtkSettings *settings);
static void settings_update_modules (GtkSettings *settings);
#ifdef GDK_WINDOWING_X11
static void settings_update_cursor_theme (GtkSettings *settings);
static void settings_update_resolution (GtkSettings *settings);
static void settings_update_font_options (GtkSettings *settings);
static gboolean settings_update_fontconfig (GtkSettings *settings);
#endif
static void settings_update_color_scheme (GtkSettings *settings);
static void settings_update_theme (GtkSettings *settings);
static void settings_update_key_theme (GtkSettings *settings);
@ -423,7 +413,7 @@ gtk_settings_class_init (GtkSettingsClass *class)
g_param_spec_string ("gtk-key-theme-name",
P_("Key Theme Name"),
P_("Name of key theme to load"),
DEFAULT_KEY_THEME,
NULL,
GTK_PARAM_READWRITE),
NULL);
g_assert (result == PROP_KEY_THEME_NAME);
@ -487,7 +477,6 @@ gtk_settings_class_init (GtkSettingsClass *class)
NULL);
g_assert (result == PROP_MODULES);
#ifdef GDK_WINDOWING_X11
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-xft-antialias",
P_("Xft Antialias"),
@ -557,7 +546,6 @@ gtk_settings_class_init (GtkSettingsClass *class)
g_assert (result == PROP_CURSOR_THEME_SIZE);
#endif /* GDK_WINDOWING_X11 */
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-alternative-button-order",
P_("Alternative button order"),
@ -1458,18 +1446,21 @@ gtk_settings_get_for_screen (GdkScreen *screen)
settings = g_object_get_data (G_OBJECT (screen), "gtk-settings");
if (!settings)
{
settings = g_object_new (GTK_TYPE_SETTINGS, NULL);
#ifdef GDK_WINDOWING_QUARTZ
if (GDK_IS_QUARTZ_SCREEN (screen))
settings = g_object_new (GTK_TYPE_SETTINGS, "gtk-key-theme-name", "Mac", NULL);
else
#endif
settings = g_object_new (GTK_TYPE_SETTINGS, NULL);
settings->priv->screen = screen;
g_object_set_data_full (G_OBJECT (screen), I_("gtk-settings"),
settings, g_object_unref);
settings_init_style (settings);
settings_update_double_click (settings);
#ifdef GDK_WINDOWING_X11
settings_update_cursor_theme (settings);
settings_update_resolution (settings);
settings_update_font_options (settings);
#endif
settings_update_color_scheme (settings);
}
@ -1625,7 +1616,6 @@ gtk_settings_notify (GObject *object,
case PROP_APPLICATION_PREFER_DARK_THEME:
settings_update_theme (settings);
break;
#ifdef GDK_WINDOWING_X11
case PROP_XFT_DPI:
settings_update_resolution (settings);
/* This is a hack because with gtk_rc_reset_styles() doesn't get
@ -1649,7 +1639,6 @@ gtk_settings_notify (GObject *object,
case PROP_CURSOR_THEME_SIZE:
settings_update_cursor_theme (settings);
break;
#endif /* GDK_WINDOWING_X11 */
}
}
@ -2481,7 +2470,6 @@ settings_update_modules (GtkSettings *settings)
g_free (modules);
}
#ifdef GDK_WINDOWING_X11
static void
settings_update_cursor_theme (GtkSettings *settings)
{
@ -2489,14 +2477,19 @@ settings_update_cursor_theme (GtkSettings *settings)
gchar *theme = NULL;
gint size = 0;
g_object_get (settings,
"gtk-cursor-theme-name", &theme,
"gtk-cursor-theme-size", &size,
NULL);
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (display))
{
g_object_get (settings,
"gtk-cursor-theme-name", &theme,
"gtk-cursor-theme-size", &size,
NULL);
gdk_x11_display_set_cursor_theme (display, theme, size);
gdk_x11_display_set_cursor_theme (display, theme, size);
g_free (theme);
g_free (theme);
}
#endif
}
static void
@ -2573,10 +2566,10 @@ settings_update_font_options (GtkSettings *settings)
cairo_font_options_destroy (options);
}
#ifdef GDK_WINDOWING_X11
static gboolean
settings_update_fontconfig (GtkSettings *settings)
{
#ifdef GDK_WINDOWING_X11
static guint last_update_timestamp;
static gboolean last_update_needed;
@ -2608,8 +2601,8 @@ settings_update_fontconfig (GtkSettings *settings)
}
return last_update_needed;
}
#endif /* GDK_WINDOWING_X11 */
}
static void
settings_update_resolution (GtkSettings *settings)
@ -2629,7 +2622,6 @@ settings_update_resolution (GtkSettings *settings)
gdk_screen_set_resolution (priv->screen, dpi);
}
#endif
typedef struct
{
@ -2671,7 +2663,7 @@ settings_update_color_scheme (GtkSettings *settings)
data, (GDestroyNotify) color_scheme_data_free);
g_value_init (&value, G_TYPE_STRING);
if (gdk_screen_get_setting (priv->screen, "gtk-color-scheme", &value))
if (priv->screen && gdk_screen_get_setting (priv->screen, "gtk-color-scheme", &value))
{
merge_color_scheme (settings, &value, GTK_SETTINGS_SOURCE_XSETTING);
g_value_unset (&value);
@ -3097,7 +3089,7 @@ gtk_settings_load_from_key_file (GtkSettings *settings,
g_value_init (&svalue.value, G_TYPE_GSTRING);
s_val = g_key_file_get_string (keyfile, "Settings", key, &error);
if (!error)
g_value_set_boxed (&svalue.value, g_string_new (s_val));
g_value_take_boxed (&svalue.value, g_string_new (s_val));
g_free (s_val);
break;
}

View File

@ -916,9 +916,8 @@ static void
gtk_socket_notify (GObject *object,
GParamSpec *pspec)
{
if (!strcmp (pspec->name, "is-focus"))
return;
socket_update_focus_in (GTK_SOCKET (object));
if (strcmp (pspec->name, "is-focus") == 0)
socket_update_focus_in (GTK_SOCKET (object));
}
/**

View File

@ -988,14 +988,9 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
GtkJunctionSides junction;
GtkStateFlags state;
GtkWidget *widget;
GtkBorder padding;
gdouble angle;
gint x;
gint y;
gint panel_height;
gint height;
gint width;
gint h, w;
gdouble size, width, height, x, y;
g_return_if_fail (arrow_type == GTK_ARROW_UP || arrow_type == GTK_ARROW_DOWN);
@ -1008,25 +1003,6 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
panel_height = gdk_window_get_height (priv->panel);
if (arrow_type == GTK_ARROW_UP)
{
x = 0;
y = 0;
height = panel_height / 2;
angle = 0;
junction |= GTK_JUNCTION_BOTTOM;
}
else
{
x = 0;
y = panel_height / 2;
height = (panel_height + 1) / 2;
angle = G_PI;
junction |= GTK_JUNCTION_TOP;
}
if (spin_button_at_limit (spin_button, arrow_type))
state = GTK_STATE_FLAG_INSENSITIVE;
else
@ -1043,47 +1019,52 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
}
}
gtk_style_context_get_padding (context, state, &padding);
/* first, draw the background and the frame */
if (arrow_type == GTK_ARROW_UP)
{
x = 0;
y = 0;
junction |= GTK_JUNCTION_BOTTOM;
}
else if (arrow_type == GTK_ARROW_DOWN)
{
x = 0;
y = panel_height / 2.0;
junction |= GTK_JUNCTION_TOP;
}
gtk_style_context_set_junction_sides (context, junction);
gtk_style_context_set_state (context, state);
width = spin_button_get_arrow_size (spin_button) + padding.left + padding.right;
height = panel_height / 2.0;
width = gdk_window_get_width (priv->panel);
gtk_render_background (context, cr,
x, y, width, height);
gtk_render_frame (context, cr,
x, y, width, height);
gtk_render_background (context, cr, x, y, width, height);
gtk_render_frame (context, cr, x, y, width, height);
/* make the actual rendered arrow smaller than text size */
size = spin_button_get_arrow_size (spin_button);
size = MIN (size, width);
size *= 0.8;
height = panel_height;
x = (width - size) / 2.0;
if (arrow_type == GTK_ARROW_DOWN)
if (arrow_type == GTK_ARROW_UP)
{
y = height / 2;
height = height - y - 2;
y = (height - size / 2.0) / 2.0;
angle = 0;
}
else
else if (arrow_type == GTK_ARROW_DOWN)
{
y = 2;
height = height / 2 - 2;
y = height + ((height - size / 2.0) / 2.0) - size / 2.0;
angle = G_PI;
}
width -= 3;
if (widget && gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
x = 2;
else
x = 1;
w = width / 2;
w -= w % 2 - 1; /* force odd */
h = (w + 1) / 2;
x += (width - w) / 2;
y += (height - h) / 2;
height = h;
width = w;
gtk_render_arrow (context, cr,
angle, x, y, width);
angle, x, y, size);
gtk_style_context_restore (context);
}
@ -1115,10 +1096,7 @@ gtk_spin_button_enter_notify (GtkWidget *widget,
gtk_widget_queue_draw (GTK_WIDGET (spin));
}
if (GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->enter_notify_event)
return GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->enter_notify_event (widget, event);
return FALSE;
return GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->enter_notify_event (widget, event);
}
static gint
@ -1128,13 +1106,13 @@ gtk_spin_button_leave_notify (GtkWidget *widget,
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
GtkSpinButtonPrivate *priv = spin->priv;
priv->in_child = NO_ARROW;
gtk_widget_queue_draw (GTK_WIDGET (spin));
if (priv->in_child != NO_ARROW)
{
priv->in_child = NO_ARROW;
gtk_widget_queue_draw (GTK_WIDGET (spin));
}
if (GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->leave_notify_event)
return GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->leave_notify_event (widget, event);
return FALSE;
return GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->leave_notify_event (widget, event);
}
static gint

View File

@ -493,7 +493,8 @@ gtk_status_icon_class_init (GtkStatusIconClass *class)
/**
* GtkStatusIcon::button-press-event:
* @status_icon: the object which received the signal
* @event: the #GdkEventButton which triggered this signal
* @event: (type Gdk.EventButton): the #GdkEventButton which triggered
* this signal
*
* The ::button-press-event signal will be emitted when a button
* (typically from a mouse) is pressed.
@ -519,7 +520,8 @@ gtk_status_icon_class_init (GtkStatusIconClass *class)
/**
* GtkStatusIcon::button-release-event:
* @status_icon: the object which received the signal
* @event: the #GdkEventButton which triggered this signal
* @event: (type Gdk.EventButton): the #GdkEventButton which triggered
* this signal
*
* The ::button-release-event signal will be emitted when a button
* (typically from a mouse) is released.
@ -545,7 +547,8 @@ gtk_status_icon_class_init (GtkStatusIconClass *class)
/**
* GtkStatusIcon::scroll-event:
* @status_icon: the object which received the signal.
* @event: the #GdkEventScroll which triggered this signal
* @event: (type Gdk.EventScroll): the #GdkEventScroll which triggered
* this signal
*
* The ::scroll-event signal is emitted when a button in the 4 to 7
* range is pressed. Wheel mice are usually configured to generate

View File

@ -49,14 +49,14 @@
* can be either attached explicitly to the context through
* gtk_style_context_add_provider(), or to the screen through
* gtk_style_context_add_provider_for_screen(). The resulting style is a
* combination of all provider's information in priority order.
* combination of all providers' information in priority order.
*
* For GTK+ widgets, any #GtkStyleContext returned by
* gtk_widget_get_style_context() will already have a #GtkWidgetPath, a
* #GdkScreen and RTL/LTR information set, the style context will be also
* #GdkScreen and RTL/LTR information set. The style context will be also
* updated automatically if any of these settings change on the widget.
*
* If you are using are the theming layer standalone, you will need to set a
* If you are using the theming layer standalone, you will need to set a
* widget path and a screen yourself to the created style context through
* gtk_style_context_set_path() and gtk_style_context_set_screen(), as well
* as updating the context yourself using gtk_style_context_invalidate()
@ -406,7 +406,6 @@
* </refsect2>
*/
typedef struct GtkStyleContextPrivate GtkStyleContextPrivate;
typedef struct GtkStyleProviderData GtkStyleProviderData;
typedef struct GtkStyleInfo GtkStyleInfo;
typedef struct GtkRegion GtkRegion;
@ -468,7 +467,7 @@ struct AnimationInfo
GArray *rectangles;
};
struct GtkStyleContextPrivate
struct _GtkStyleContextPrivate
{
GdkScreen *screen;
@ -3621,9 +3620,9 @@ get_cursor_color (GtkStyleContext *context,
if (style_color)
{
color->red = style_color->red / 65535;
color->green = style_color->green / 65535;
color->blue = style_color->blue / 65535;
color->red = style_color->red / 65535.0;
color->green = style_color->green / 65535.0;
color->blue = style_color->blue / 65535.0;
color->alpha = 1;
gdk_color_free (style_color);
@ -3694,8 +3693,9 @@ gtk_render_check (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
g_return_if_fail (width > 0);
g_return_if_fail (height > 0);
if (width <= 0 || height <= 0)
return;
priv = context->priv;
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
@ -3744,8 +3744,9 @@ gtk_render_option (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
g_return_if_fail (width > 0);
g_return_if_fail (height > 0);
if (width <= 0 || height <= 0)
return;
priv = context->priv;
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
@ -3792,7 +3793,9 @@ gtk_render_arrow (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
g_return_if_fail (size > 0);
if (size <= 0)
return;
priv = context->priv;
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
@ -3842,8 +3845,9 @@ gtk_render_background (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
g_return_if_fail (width > 0);
g_return_if_fail (height > 0);
if (width <= 0 || height <= 0)
return;
priv = context->priv;
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
@ -3894,8 +3898,9 @@ gtk_render_frame (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
g_return_if_fail (width > 0);
g_return_if_fail (height > 0);
if (width <= 0 || height <= 0)
return;
priv = context->priv;
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
@ -3906,7 +3911,7 @@ gtk_render_frame (GtkStyleContext *context,
_gtk_theming_engine_set_context (priv->theming_engine, context);
engine_class->render_frame (priv->theming_engine, cr, x, y, width, height);
cairo_restore (cr);
}
@ -3943,8 +3948,9 @@ gtk_render_expander (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
g_return_if_fail (width > 0);
g_return_if_fail (height > 0);
if (width <= 0 || height <= 0)
return;
priv = context->priv;
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
@ -3989,8 +3995,9 @@ gtk_render_focus (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
g_return_if_fail (width > 0);
g_return_if_fail (height > 0);
if (width <= 0 || height <= 0)
return;
priv = context->priv;
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
@ -4124,8 +4131,9 @@ gtk_render_slider (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
g_return_if_fail (width > 0);
g_return_if_fail (height > 0);
if (width <= 0 || height <= 0)
return;
priv = context->priv;
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
@ -4180,11 +4188,12 @@ gtk_render_frame_gap (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
g_return_if_fail (width > 0);
g_return_if_fail (height > 0);
g_return_if_fail (xy0_gap <= xy1_gap);
g_return_if_fail (xy0_gap >= 0);
if (width <= 0 || height <= 0)
return;
if (gap_side == GTK_POS_LEFT ||
gap_side == GTK_POS_RIGHT)
g_return_if_fail (xy1_gap <= height);
@ -4241,8 +4250,9 @@ gtk_render_extension (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
g_return_if_fail (width > 0);
g_return_if_fail (height > 0);
if (width <= 0 || height <= 0)
return;
priv = context->priv;
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
@ -4290,8 +4300,9 @@ gtk_render_handle (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
g_return_if_fail (width > 0);
g_return_if_fail (height > 0);
if (width <= 0 || height <= 0)
return;
priv = context->priv;
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
@ -4334,8 +4345,9 @@ gtk_render_activity (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
g_return_if_fail (width > 0);
g_return_if_fail (height > 0);
if (width <= 0 || height <= 0)
return;
priv = context->priv;
engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
@ -4373,7 +4385,7 @@ gtk_render_icon_pixbuf (GtkStyleContext *context,
GtkThemingEngineClass *engine_class;
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
g_return_val_if_fail (size == -1 || size <= GTK_ICON_SIZE_DIALOG, NULL);
g_return_val_if_fail (size > GTK_ICON_SIZE_INVALID || size == -1, NULL);
g_return_val_if_fail (source != NULL, NULL);
priv = context->priv;

View File

@ -40,11 +40,12 @@ G_BEGIN_DECLS
typedef struct _GtkStyleContext GtkStyleContext;
typedef struct _GtkStyleContextClass GtkStyleContextClass;
typedef struct _GtkStyleContextPrivate GtkStyleContextPrivate;
struct _GtkStyleContext
{
GObject parent_object;
gpointer priv;
GtkStyleContextPrivate *priv;
};
struct _GtkStyleContextClass
@ -233,6 +234,13 @@ struct _GtkStyleContextClass
*/
#define GTK_STYLE_CLASS_TOOLBAR "toolbar"
/**
* GTK_STYLE_CLASS_PRIMARY_TOOLBAR:
*
* A CSS class to match primary toolbars.
*/
#define GTK_STYLE_CLASS_PRIMARY_TOOLBAR "primary-toolbar"
/**
* GTK_STYLE_CLASS_RADIO:
*
@ -275,6 +283,24 @@ struct _GtkStyleContextClass
*/
#define GTK_STYLE_CLASS_SCALE "scale"
/**
* GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE:
*
* A CSS class to match scale widgets with marks attached,
* all the marks are above for horizontal #GtkScale.
* left for vertical #GtkScale.
*/
#define GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE "scale-has-marks-above"
/**
* GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW:
*
* A CSS class to match scale widgets with marks attached,
* all the marks are below for horizontal #GtkScale,
* right for vertical #GtkScale.
*/
#define GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW "scale-has-marks-below"
/**
* GTK_STYLE_CLASS_HEADER:
*
@ -289,6 +315,14 @@ struct _GtkStyleContextClass
*/
#define GTK_STYLE_CLASS_ACCELERATOR "accelerator"
/**
* GTK_STYLE_CLASS_RAISED:
*
* A CSS class to match a raised control, such as a raised
* button on a toolbar.
*/
#define GTK_STYLE_CLASS_RAISED "raised"
/**
* GTK_STYLE_CLASS_GRIP:
*
@ -382,6 +416,13 @@ struct _GtkStyleContextClass
*/
#define GTK_STYLE_CLASS_PANE_SEPARATOR "pane-separator"
/**
* GTK_STYLE_CLASS_SEPARATOR:
*
* A CSS class for a separator.
*/
#define GTK_STYLE_CLASS_SEPARATOR "separator"
/**
* GTK_STYLE_CLASS_INFO:
*

View File

@ -29,8 +29,8 @@
* @Title: GtkStyleProvider
* @See_also: #GtkStyleContext, #GtkCssProvider
*
* GtkStyleProvider is an interface used to provide style information to a #GtkStyleContext,
* see gtk_style_context_add_provider() and gtk_style_context_add_provider_for_screen().
* GtkStyleProvider is an interface used to provide style information to a #GtkStyleContext.
* See gtk_style_context_add_provider() and gtk_style_context_add_provider_for_screen().
*/
static void gtk_style_provider_iface_init (gpointer g_iface);

View File

@ -40,13 +40,15 @@
#include "gtkswitch.h"
#include "gtkaccessible.h"
#include "gtkaccessibleprivate.h"
#include "gtkactivatable.h"
#include "gtkintl.h"
#include "gtkstyle.h"
#include "gtkprivate.h"
#include "gtktoggleaction.h"
#include "gtkwidget.h"
#include "gtkmarshalers.h"
#define DEFAULT_SLIDER_WIDTH (36)
#define DEFAULT_SLIDER_HEIGHT (22)
@ -77,6 +79,14 @@ enum
LAST_PROP
};
enum
{
ACTIVATE,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
static GParamSpec *switch_props[LAST_PROP] = { NULL, };
static GType gtk_switch_accessible_factory_get_type (void);
@ -262,22 +272,12 @@ gtk_switch_leave (GtkWidget *widget,
return FALSE;
}
static gboolean
gtk_switch_key_release (GtkWidget *widget,
GdkEventKey *event)
static void
gtk_switch_activate (GtkSwitch *sw)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
GtkSwitchPrivate *priv = sw->priv;
if (event->keyval == GDK_KEY_Return ||
event->keyval == GDK_KEY_KP_Enter ||
event->keyval == GDK_KEY_ISO_Enter ||
event->keyval == GDK_KEY_space ||
event->keyval == GDK_KEY_KP_Space)
{
gtk_switch_set_active (GTK_SWITCH (widget), !priv->is_active);
}
return FALSE;
gtk_switch_set_active (sw, !priv->is_active);
}
static void
@ -285,6 +285,7 @@ gtk_switch_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
GtkStyleContext *context;
GtkStateFlags state;
GtkBorder padding;
@ -294,10 +295,20 @@ gtk_switch_get_preferred_width (GtkWidget *widget,
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
if (priv->is_active)
state |= GTK_STATE_FLAG_ACTIVE;
gtk_style_context_save (context);
gtk_style_context_set_state (context, state);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SLIDER);
gtk_style_context_get_padding (context, state, &padding);
width = padding.left + padding.right;
gtk_style_context_restore (context);
gtk_widget_style_get (widget,
"slider-width", &slider_width,
"focus-line-width", &focus_width,
@ -337,6 +348,7 @@ gtk_switch_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
GtkStyleContext *context;
GtkStateFlags state;
GtkBorder padding;
@ -347,10 +359,20 @@ gtk_switch_get_preferred_height (GtkWidget *widget,
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
if (priv->is_active)
state |= GTK_STATE_FLAG_ACTIVE;
gtk_style_context_save (context);
gtk_style_context_set_state (context, state);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SLIDER);
gtk_style_context_get_padding (context, state, &padding);
height = padding.top + padding.bottom;
gtk_style_context_restore (context);
gtk_widget_style_get (widget,
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
@ -473,11 +495,15 @@ gtk_switch_paint_handle (GtkWidget *widget,
cairo_t *cr,
GdkRectangle *box)
{
GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
GtkStyleContext *context = gtk_widget_get_style_context (widget);
GtkStateFlags state;
state = gtk_widget_get_state_flags (widget);
if (priv->is_active)
state |= GTK_STATE_FLAG_ACTIVE;
gtk_style_context_save (context);
gtk_style_context_set_state (context, state);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SLIDER);
@ -516,8 +542,15 @@ gtk_switch_draw (GtkWidget *widget,
if (priv->is_active)
state |= GTK_STATE_FLAG_ACTIVE;
gtk_style_context_save (context);
gtk_style_context_set_state (context, state);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SLIDER);
gtk_style_context_get_padding (context, state, &padding);
gtk_style_context_restore (context);
x = 0;
y = 0;
width = gtk_widget_get_allocated_width (widget);
@ -526,25 +559,27 @@ gtk_switch_draw (GtkWidget *widget,
if (gtk_widget_has_focus (widget))
gtk_render_focus (context, cr, x, y, width, height);
gtk_style_context_save (context);
gtk_style_context_set_state (context, state);
x += focus_width + focus_pad;
y += focus_width + focus_pad;
width -= 2 * (focus_width + focus_pad);
height -= 2 * (focus_width + focus_pad);
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TROUGH);
gtk_style_context_set_state (context, state);
gtk_render_background (context, cr, x, y, width, height);
gtk_render_frame (context, cr, x, y, width, height);
/* XXX the +1/-1 it's pixel wriggling after checking with the default
* theme and xmag
*/
handle.y = y + padding.top + 1;
handle.width = (width - padding.left - padding.right) / 2;
handle.height = (height - padding.top - padding.bottom) - 1;
width -= padding.left + padding.right;
height -= padding.top + padding.bottom;
x += padding.left;
y += padding.top;
handle.y = y;
handle.width = width / 2;
handle.height = height;
/* Translators: if the "on" state label requires more than three
* glyphs then use MEDIUM VERTICAL BAR (U+2759) as the text for
@ -554,10 +589,8 @@ gtk_switch_draw (GtkWidget *widget,
pango_layout_get_extents (layout, NULL, &rect);
pango_extents_to_pixels (&rect, NULL);
label_x = x + padding.left
+ ((width / 2) - rect.width - padding.left - padding.right) / 2;
label_y = y + padding.top
+ (height - rect.height - padding.top - padding.bottom) / 2;
label_x = x + ((width / 2) - rect.width) / 2;
label_y = y + (height - rect.height) / 2;
gtk_render_layout (context, cr, label_x, label_y, layout);
@ -570,11 +603,8 @@ gtk_switch_draw (GtkWidget *widget,
pango_layout_get_extents (layout, NULL, &rect);
pango_extents_to_pixels (&rect, NULL);
label_x = x + padding.left
+ (width / 2)
+ ((width / 2) - rect.width - padding.left - padding.right) / 2;
label_y = y + padding.top
+ (height - rect.height - padding.top - padding.bottom) / 2;
label_x = x + (width / 2) + ((width / 2) - rect.width) / 2;
label_y = y + (height - rect.height) / 2;
gtk_render_layout (context, cr, label_x, label_y, layout);
@ -583,9 +613,9 @@ gtk_switch_draw (GtkWidget *widget,
if (priv->is_dragging)
handle.x = x + priv->handle_x;
else if (priv->is_active)
handle.x = x + width - handle.width - padding.right;
handle.x = x + width - handle.width;
else
handle.x = x + padding.left;
handle.x = x;
gtk_style_context_restore (context);
@ -601,25 +631,8 @@ gtk_switch_get_accessible (GtkWidget *widget)
if (G_UNLIKELY (first_time))
{
AtkObjectFactory *factory;
AtkRegistry *registry;
GType derived_type;
GType derived_atk_type;
/* Figure out whether accessibility is enabled by looking at the
* type of the accessible object which would be created for the
* parent type of GtkSwitch
*/
derived_type = g_type_parent (GTK_TYPE_SWITCH);
registry = atk_get_default_registry ();
factory = atk_registry_get_factory (registry, derived_type);
derived_atk_type = atk_object_factory_get_accessible_type (factory);
if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
atk_registry_set_factory_type (registry,
GTK_TYPE_SWITCH,
gtk_switch_accessible_factory_get_type ());
_gtk_accessible_set_factory_type (GTK_TYPE_SWITCH,
gtk_switch_accessible_factory_get_type ());
first_time = FALSE;
}
@ -773,9 +786,10 @@ gtk_switch_class_init (GtkSwitchClass *klass)
widget_class->motion_notify_event = gtk_switch_motion;
widget_class->enter_notify_event = gtk_switch_enter;
widget_class->leave_notify_event = gtk_switch_leave;
widget_class->key_release_event = gtk_switch_key_release;
widget_class->get_accessible = gtk_switch_get_accessible;
klass->activate = gtk_switch_activate;
/**
* GtkSwitch:slider-width:
*
@ -788,6 +802,26 @@ gtk_switch_class_init (GtkSwitchClass *klass)
DEFAULT_SLIDER_WIDTH, G_MAXINT,
DEFAULT_SLIDER_WIDTH,
GTK_PARAM_READABLE));
/**
* GtkSwitch::activate:
* @widget: the object which received the signal.
*
* The ::activate signal on GtkSwitch is an action signal and
* emitting it causes the switch to animate.
* Applications should never connect to this signal, but use the
* notify::active signal.
*/
signals[ACTIVATE] =
g_signal_new (I_("activate"),
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkSwitchClass, activate),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
widget_class->activate_signal = signals[ACTIVATE];
}
static void
@ -934,11 +968,21 @@ gtk_switch_activatable_interface_init (GtkActivatableIface *iface)
/* accessibility: object */
/* dummy typedefs */
typedef struct _GtkSwitchAccessible GtkSwitchAccessible;
typedef struct _GtkSwitchAccessibleClass GtkSwitchAccessibleClass;
typedef struct _GtkSwitchAccessible GtkSwitchAccessible;
typedef struct _GtkSwitchAccessibleClass GtkSwitchAccessibleClass;
ATK_DEFINE_TYPE (GtkSwitchAccessible, _gtk_switch_accessible, GTK_TYPE_WIDGET);
struct _GtkSwitchAccessible
{
GtkAccessible object;
gchar *description;
guint action_idle;
};
static void atk_action_interface_init (AtkActionIface *iface);
ATK_DEFINE_TYPE_WITH_CODE (GtkSwitchAccessible, _gtk_switch_accessible, GTK_TYPE_SWITCH,
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init))
static AtkStateSet *
gtk_switch_accessible_ref_state_set (AtkObject *accessible)
@ -958,6 +1002,19 @@ gtk_switch_accessible_ref_state_set (AtkObject *accessible)
return state_set;
}
static void
gtk_switch_accessible_finalize (GObject *obj)
{
GtkSwitchAccessible *accessible = (GtkSwitchAccessible *)obj;
g_free (accessible->description);
if (accessible->action_idle)
g_source_remove (accessible->action_idle);
G_OBJECT_CLASS (_gtk_switch_accessible_parent_class)->finalize (obj);
}
static void
_gtk_switch_accessible_initialize (AtkObject *accessible,
gpointer widget)
@ -972,8 +1029,11 @@ _gtk_switch_accessible_initialize (AtkObject *accessible,
static void
_gtk_switch_accessible_class_init (GtkSwitchAccessibleClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
object_class->finalize = gtk_switch_accessible_finalize;
atk_class->initialize = _gtk_switch_accessible_initialize;
atk_class->ref_state_set = gtk_switch_accessible_ref_state_set;
}
@ -981,6 +1041,98 @@ _gtk_switch_accessible_class_init (GtkSwitchAccessibleClass *klass)
static void
_gtk_switch_accessible_init (GtkSwitchAccessible *self)
{
self->description = NULL;
self->action_idle = 0;
}
/* accessibility: action interface */
static gint
gtk_switch_action_get_n_actions (AtkAction *action)
{
return 1;
}
static const gchar *
gtk_switch_action_get_name (AtkAction *action,
gint i)
{
return "toggle";
}
static const gchar *
gtk_switch_action_get_description (AtkAction *action,
gint i)
{
GtkSwitchAccessible *accessible = (GtkSwitchAccessible*)action;
return accessible->description;
}
static gboolean
gtk_switch_action_set_description (AtkAction *action,
gint i,
const gchar *description)
{
GtkSwitchAccessible *accessible = (GtkSwitchAccessible*)action;
g_free (accessible->description);
accessible->description = g_strdup (description);
return TRUE;
}
static gboolean
idle_do_action (gpointer data)
{
GtkSwitchAccessible *accessible = data;
GtkWidget *widget;
GtkSwitch *sw;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (data));
sw = GTK_SWITCH (widget);
accessible->action_idle = 0;
if (widget == NULL ||
!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget))
return FALSE;
gtk_switch_set_active (sw, !gtk_switch_get_active (sw));
return FALSE;
}
static gboolean
gtk_switch_action_do_action (AtkAction *action,
gint i)
{
GtkSwitchAccessible *accessible;
GtkWidget *widget;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
if (widget == NULL)
return FALSE;
if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget))
return FALSE;
accessible = (GtkSwitchAccessible *)action;
if (!accessible->action_idle)
accessible->action_idle = gdk_threads_add_idle (idle_do_action, accessible);
return TRUE;
}
static void
atk_action_interface_init (AtkActionIface *iface)
{
iface->do_action = gtk_switch_action_do_action;
iface->get_n_actions = gtk_switch_action_get_n_actions;
iface->get_name = gtk_switch_action_get_name;
iface->get_description = gtk_switch_action_get_description;
iface->set_description = gtk_switch_action_set_description;
}
/* accessibility: factory */

View File

@ -72,13 +72,14 @@ struct _GtkSwitchClass
/*< private >*/
GtkWidgetClass parent_class;
void (* activate) (GtkSwitch *sw);
void (* _switch_padding_1) (void);
void (* _switch_padding_2) (void);
void (* _switch_padding_3) (void);
void (* _switch_padding_4) (void);
void (* _switch_padding_5) (void);
void (* _switch_padding_6) (void);
void (* _switch_padding_7) (void);
};
GType gtk_switch_get_type (void) G_GNUC_CONST;

View File

@ -332,7 +332,7 @@ widget_geo_cmp (gconstpointer a,
* @base_widget will be returned.
* The general purpose of this function is to find the most likely "action"
* widget, relative to another labeling widget. Such as finding a
* button or text entry widget, given it's corresponding label widget.
* button or text entry widget, given its corresponding label widget.
*
* Returns: (transfer none): a widget of type @widget_type if any is found.
*

View File

@ -582,9 +582,6 @@ get_selected_clip (GtkTextRenderer *text_renderer,
static void
render_para (GtkTextRenderer *text_renderer,
GtkTextLineDisplay *line_display,
/* Top-left corner of paragraph including all margins */
int x,
int y,
int selection_start_index,
int selection_end_index)
{
@ -639,7 +636,7 @@ render_para (GtkTextRenderer *text_renderer,
/* Selection is the height of the line, plus top/bottom
* margin if we're the first/last line
*/
selection_y = y + PANGO_PIXELS (first_y) + line_display->top_margin;
selection_y = PANGO_PIXELS (first_y) + line_display->top_margin;
selection_height = PANGO_PIXELS (last_y) - PANGO_PIXELS (first_y);
if (first)
@ -662,7 +659,7 @@ render_para (GtkTextRenderer *text_renderer,
cairo_save (cr);
gdk_cairo_set_source_rgba (cr, &selection);
cairo_rectangle (cr,
x + line_display->left_margin, selection_y,
line_display->left_margin, selection_y,
screen_width, selection_height);
cairo_fill (cr);
cairo_restore(cr);
@ -670,8 +667,8 @@ render_para (GtkTextRenderer *text_renderer,
text_renderer_set_state (text_renderer, SELECTED);
pango_renderer_draw_layout_line (PANGO_RENDERER (text_renderer),
line,
PANGO_SCALE * x + line_rect.x,
PANGO_SCALE * y + baseline);
line_rect.x,
baseline);
}
else
{
@ -683,7 +680,7 @@ render_para (GtkTextRenderer *text_renderer,
gdk_cairo_set_source_color (cr, line_display->pg_bg_color);
cairo_rectangle (cr,
x + line_display->left_margin, selection_y,
line_display->left_margin, selection_y,
screen_width, selection_height);
cairo_fill (cr);
@ -693,8 +690,8 @@ render_para (GtkTextRenderer *text_renderer,
text_renderer_set_state (text_renderer, NORMAL);
pango_renderer_draw_layout_line (PANGO_RENDERER (text_renderer),
line,
PANGO_SCALE * x + line_rect.x,
PANGO_SCALE * y + baseline);
line_rect.x,
baseline);
/* Check if some part of the line is selected; the newline
* that is after line->length for the last line of the
@ -706,7 +703,7 @@ render_para (GtkTextRenderer *text_renderer,
{
cairo_t *cr = text_renderer->cr;
cairo_region_t *clip_region = get_selected_clip (text_renderer, layout, line,
x + line_display->x_offset,
line_display->x_offset,
selection_y,
selection_height,
selection_start_index, selection_end_index);
@ -718,7 +715,7 @@ render_para (GtkTextRenderer *text_renderer,
gdk_cairo_set_source_rgba (cr, &selection);
cairo_rectangle (cr,
x + PANGO_PIXELS (line_rect.x),
PANGO_PIXELS (line_rect.x),
selection_y,
PANGO_PIXELS (line_rect.width),
selection_height);
@ -727,8 +724,8 @@ render_para (GtkTextRenderer *text_renderer,
text_renderer_set_state (text_renderer, SELECTED);
pango_renderer_draw_layout_line (PANGO_RENDERER (text_renderer),
line,
PANGO_SCALE * x + line_rect.x,
PANGO_SCALE * y + baseline);
line_rect.x,
baseline);
cairo_restore (cr);
@ -741,7 +738,7 @@ render_para (GtkTextRenderer *text_renderer,
gdk_cairo_set_source_rgba (cr, &selection);
cairo_rectangle (cr,
x + line_display->left_margin,
line_display->left_margin,
selection_y,
PANGO_PIXELS (line_rect.x) - line_display->left_margin,
selection_height);
@ -765,7 +762,7 @@ render_para (GtkTextRenderer *text_renderer,
gdk_cairo_set_source_rgba (cr, &selection);
cairo_rectangle (cr,
x + PANGO_PIXELS (line_rect.x) + PANGO_PIXELS (line_rect.width),
PANGO_PIXELS (line_rect.x) + PANGO_PIXELS (line_rect.width),
selection_y,
nonlayout_width,
selection_height);
@ -788,8 +785,8 @@ render_para (GtkTextRenderer *text_renderer,
* (normally white on black) */
_gtk_style_context_get_cursor_color (context, &cursor_color, NULL);
cursor_rect.x = x + line_display->x_offset + line_display->block_cursor.x;
cursor_rect.y = y + line_display->block_cursor.y + line_display->top_margin;
cursor_rect.x = line_display->x_offset + line_display->block_cursor.x;
cursor_rect.y = line_display->block_cursor.y + line_display->top_margin;
cursor_rect.width = line_display->block_cursor.width;
cursor_rect.height = line_display->block_cursor.height;
@ -815,8 +812,8 @@ render_para (GtkTextRenderer *text_renderer,
pango_renderer_draw_layout_line (PANGO_RENDERER (text_renderer),
line,
PANGO_SCALE * x + line_rect.x,
PANGO_SCALE * y + baseline);
line_rect.x,
baseline);
}
cairo_restore (cr);
@ -847,7 +844,7 @@ gtk_text_layout_draw (GtkTextLayout *layout,
cairo_t *cr,
GList **widgets)
{
gint current_y;
gint offset_y;
GSList *cursor_list;
GtkTextRenderer *text_renderer;
GtkTextIter selection_start, selection_end;
@ -865,7 +862,7 @@ gtk_text_layout_draw (GtkTextLayout *layout,
if (!gdk_cairo_get_clip_rectangle (cr, &clip))
return;
line_list = gtk_text_layout_get_lines (layout, clip.y, clip.y + clip.height, &current_y);
line_list = gtk_text_layout_get_lines (layout, clip.y, clip.y + clip.height, &offset_y);
if (line_list == NULL)
return; /* nothing on the screen */
@ -873,6 +870,9 @@ gtk_text_layout_draw (GtkTextLayout *layout,
text_renderer = get_text_renderer ();
text_renderer_begin (text_renderer, widget, cr);
/* text_renderer_begin/end does cairo_save/restore */
cairo_translate (cr, 0, offset_y);
gtk_text_layout_wrap_loop_start (layout);
if (gtk_text_buffer_get_selection_bounds (layout->buffer,
@ -926,7 +926,6 @@ gtk_text_layout_draw (GtkTextLayout *layout,
}
render_para (text_renderer, line_display,
0, current_y,
selection_start_index, selection_end_index);
/* We paint the cursors last, because they overlap another chunk
@ -962,7 +961,7 @@ gtk_text_layout_draw (GtkTextLayout *layout,
}
cursor_location.x = line_display->x_offset + cursor->x;
cursor_location.y = current_y + line_display->top_margin + cursor->y;
cursor_location.y = line_display->top_margin + cursor->y;
cursor_location.width = 0;
cursor_location.height = cursor->height;
@ -974,7 +973,7 @@ gtk_text_layout_draw (GtkTextLayout *layout,
}
} /* line_display->height > 0 */
current_y += line_display->height;
cairo_translate (cr, 0, line_display->height);
gtk_text_layout_free_line_display (layout, line_display);
tmp_list = g_slist_next (tmp_list);

View File

@ -2178,7 +2178,7 @@ gtk_text_view_update_im_spot_location (GtkTextView *text_view)
area.y -= text_view->priv->yoffset;
/* Width returned by Pango indicates direction of cursor,
* by it's sign more than the size of cursor.
* by its sign more than the size of cursor.
*/
area.width = 0;

View File

@ -2972,7 +2972,6 @@ gtk_theming_engine_render_activity (GtkThemingEngine *engine,
GtkStateFlags state;
guint num_steps, step;
GdkRGBA *color;
gdouble dx, dy;
gdouble progress;
gdouble radius;
gdouble half;
@ -2992,13 +2991,10 @@ gtk_theming_engine_render_activity (GtkThemingEngine *engine,
cairo_save (cr);
cairo_translate (cr, x, y);
/* draw clip region */
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
cairo_set_line_width (cr, 2.0);
cairo_translate (cr, x + width / 2, y + height / 2);
dx = width / 2;
dy = height / 2;
radius = MIN (width / 2, height / 2);
half = num_steps / 2;
@ -3007,10 +3003,9 @@ gtk_theming_engine_render_activity (GtkThemingEngine *engine,
gint inset = 0.7 * radius;
/* transparency is a function of time and intial value */
gdouble t = (gdouble) ((i + num_steps - step)
% num_steps) / num_steps;
cairo_save (cr);
gdouble t = 1.0 - (gdouble) ((i + step) % num_steps) / num_steps;
gdouble xscale = - sin (i * G_PI / half);
gdouble yscale = - cos (i * G_PI / half);
cairo_set_source_rgba (cr,
color->red,
@ -3018,16 +3013,13 @@ gtk_theming_engine_render_activity (GtkThemingEngine *engine,
color->blue,
color->alpha * t);
cairo_set_line_width (cr, 2.0);
cairo_move_to (cr,
dx + (radius - inset) * cos (i * G_PI / half),
dy + (radius - inset) * sin (i * G_PI / half));
(radius - inset) * xscale,
(radius - inset) * yscale);
cairo_line_to (cr,
dx + radius * cos (i * G_PI / half),
dy + radius * sin (i * G_PI / half));
radius * xscale,
radius * yscale);
cairo_stroke (cr);
cairo_restore (cr);
}
cairo_restore (cr);

View File

@ -1988,7 +1988,7 @@ gtk_tool_palette_set_hadjustment (GtkToolPalette *palette,
G_CALLBACK (gtk_tool_palette_adjustment_value_changed),
palette);
priv->hadjustment = g_object_ref_sink (adjustment);
/* FIXME: Adjustment should probably have it's values updated now */
/* FIXME: Adjustment should probably have its values updated now */
g_object_notify (G_OBJECT (palette), "hadjustment");
}
@ -2037,7 +2037,7 @@ gtk_tool_palette_set_vadjustment (GtkToolPalette *palette,
G_CALLBACK (gtk_tool_palette_adjustment_value_changed),
palette);
priv->vadjustment = g_object_ref_sink (adjustment);
/* FIXME: Adjustment should probably have it's values updated now */
/* FIXME: Adjustment should probably have its values updated now */
g_object_notify (G_OBJECT (palette), "vadjustment");
}

Some files were not shown because too many files have changed in this diff Show More