diff options
author | John Ralls <jralls@ceridwen.us> | 2012-02-07 15:01:26 -0800 |
---|---|---|
committer | John Ralls <jralls@ceridwen.us> | 2012-02-07 15:01:26 -0800 |
commit | f459be2a1cff59bbff94520cc49c6d399be1dabf (patch) | |
tree | 57b9da688c512f1cc41bebde203c05b4874577f2 | |
parent | e72dfb2db6d93c03e2c02d1045022b51c4273a5c (diff) | |
parent | bfb50d563fe845fd55d6a535a0dcbbe6e3789780 (diff) | |
download | gtk+-f459be2a1cff59bbff94520cc49c6d399be1dabf.tar.gz |
Merge branch 'gtk-2-24' into gtk-2-24-quartz
42 files changed, 768 insertions, 375 deletions
@@ -1,3 +1,45 @@ +Overview of Changes from GTK+ 2.24.9 to 2.24.10 +=============================================== + +* Win32: make gdk_window_raise work again + +* Quartz: implement gdk_window_restack + +* Printing: fix a crash with custom option handling + that was introduced in 2.24.9 + +* Bugs fixed: + 665955 Trimmed arrow points drawn for GtkArrow + 667691 implement gdk_window_restack() for Quartz + + +Overview of Changes from GTK+ 2.24.8 to 2.24.9 +============================================== + +* Implement the editing-canceled property in GtkCellEditableEventBox +* Backport GtkScale fixes + +* Several fixes in the MS-Windows theme + +* quartz: fix a race condition when waking up the CGRunLoop + +* Several build fixes: + - Add gmodule-2.0 dependency for gtk-query-immodules-2.0 + - introspection: Fix srcdir != builddir builds + +* Bug fixed: + 663856 - Make option-foo accelerators use the right symbol + 664238 - GTK apps crash when dragging something + 665011 - Fix gtk-demo drawingarea example + 665013 - Fix 16bit pixmaps + 662814 - Don't print a g_warning() when GtkRecentManager can't find a file + 620240 - Fix problems with DND on some X servers + 629878 - Use the right icon-name for missing images + 543520 - Set cups Custom print options correctly + 639455 - Implement the editing-canceled property in GtkCellEditableEventBox + 667458 - introspection: Fix srcdir != builddir builds + + Overview of Changes from GTK+ 2.24.7 to 2.24.8 ============================================== diff --git a/configure.in b/configure.in index 1f81bf129d..dff4588dec 100644 --- a/configure.in +++ b/configure.in @@ -13,8 +13,8 @@ AC_PREREQ(2.62) m4_define([gtk_major_version], [2]) m4_define([gtk_minor_version], [24]) -m4_define([gtk_micro_version], [9]) -m4_define([gtk_interface_age], [9]) +m4_define([gtk_micro_version], [11]) +m4_define([gtk_interface_age], [11]) m4_define([gtk_binary_age], [m4_eval(100 * gtk_minor_version + gtk_micro_version)]) m4_define([gtk_version], @@ -392,6 +392,8 @@ fi PKG_CHECK_MODULES(CAIRO_BACKEND, [cairo-$cairo_backend >= cairo_required_version]) +PKG_CHECK_MODULES(GMODULE, [gmodule-2.0]) + if test "$os_win32" != yes; then # libtool option to control which symbols are exported # right now, symbols starting with _ are not exported diff --git a/demos/gtk-demo/drawingarea.c b/demos/gtk-demo/drawingarea.c index 84f3958c73..1b1c9bbb89 100644 --- a/demos/gtk-demo/drawingarea.c +++ b/demos/gtk-demo/drawingarea.c @@ -205,7 +205,7 @@ close_window (void) window = NULL; if (surface) - g_object_unref (surface); + cairo_surface_destroy (surface); surface = NULL; } diff --git a/docs/reference/gdk/tmpl/x_interaction.sgml b/docs/reference/gdk/tmpl/x_interaction.sgml index 52bb3db8b8..4341311afc 100644 --- a/docs/reference/gdk/tmpl/x_interaction.sgml +++ b/docs/reference/gdk/tmpl/x_interaction.sgml @@ -40,7 +40,7 @@ The current display. </para> @Returns: an Xlib <type>Display*</type>. -@Deprecated: 2.22: Use gdk_display_get_default() to get the default #GdkDisplay or gdk_x11_get_default_xdisplay() to get the corresponding Xlib <type>Display *</type>. +@Deprecated: 2.22: Use gdk_display_get_default() to get the default #GdkDisplay or gdk_x11_get_default_xdisplay() to get the corresponding Xlib Display * <!-- ##### MACRO GDK_WINDOW_XDISPLAY ##### --> @@ -536,7 +536,7 @@ Since: 2.2 @display: @message_type: -@Varargs: +@...: <!-- ##### FUNCTION gdk_x11_display_get_startup_notification_id ##### --> diff --git a/docs/reference/gtk/migrating-GtkComboBox.sgml b/docs/reference/gtk/migrating-GtkComboBox.sgml index 4114bdc15a..126e3ed15e 100644 --- a/docs/reference/gtk/migrating-GtkComboBox.sgml +++ b/docs/reference/gtk/migrating-GtkComboBox.sgml @@ -56,11 +56,11 @@ gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); <informalexample><programlisting> GtkWidget *combo_box; -combo_box = gtk_combo_box_new_text (<!-- -->); +combo_box = gtk_combo_box_text_new (<!-- -->); -gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "First Item"); -gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "Second Item"); -gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "Third Item"); +gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo_box), "First Item"); +gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo_box), "Second Item"); +gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo_box), "Third Item"); </programlisting></informalexample> In order to react to the user's selection, connect to the #GtkComboBox::changed signal and use gtk_combo_box_get_active() @@ -149,11 +149,11 @@ gtk_combo_set_popdown_strings (GTK_COMBO (combo), items); <para> And here is how it would be done using #GtkComboBoxEntry<!---->: <informalexample><programlisting> -combo_box = gtk_combo_box_entry_new_text (<!-- -->); +combo_box = gtk_combo_box_text_new_with_entry (<!-- -->); -gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "First Item"); -gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "Second Item"); -gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "Third Item"); +gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo_box), "First Item"); +gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo_box), "Second Item"); +gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo_box), "Third Item"); </programlisting></informalexample> In order to react to the user's selection, connect to the #GtkComboBox::changed signal on the combo and use diff --git a/docs/reference/gtk/tmpl/gtkbindings.sgml b/docs/reference/gtk/tmpl/gtkbindings.sgml index 3e5361f781..157d6b52f6 100644 --- a/docs/reference/gtk/tmpl/gtkbindings.sgml +++ b/docs/reference/gtk/tmpl/gtkbindings.sgml @@ -286,7 +286,7 @@ key binding signal emission as stored in #GtkBindingSignal. @modifiers: @signal_name: @n_args: -@Varargs: +@...: <!-- ##### FUNCTION gtk_binding_entry_skip ##### --> diff --git a/docs/reference/gtk/tmpl/gtkcelllayout.sgml b/docs/reference/gtk/tmpl/gtkcelllayout.sgml index 166d2cb996..456810062e 100644 --- a/docs/reference/gtk/tmpl/gtkcelllayout.sgml +++ b/docs/reference/gtk/tmpl/gtkcelllayout.sgml @@ -149,7 +149,7 @@ as appropriate. @cell_layout: @cell: -@Varargs: +@...: <!-- ##### FUNCTION gtk_cell_layout_add_attribute ##### --> diff --git a/docs/reference/gtk/tmpl/gtkcontainer.sgml b/docs/reference/gtk/tmpl/gtkcontainer.sgml index 7fd402c0d1..d498965327 100644 --- a/docs/reference/gtk/tmpl/gtkcontainer.sgml +++ b/docs/reference/gtk/tmpl/gtkcontainer.sgml @@ -249,7 +249,7 @@ Does the same as gtk_container_set_border_width(). @container: @widget: @first_prop_name: -@Varargs: +@...: <!-- ##### FUNCTION gtk_container_get_resize_mode ##### --> @@ -406,7 +406,7 @@ Does the same as gtk_container_get_children(). @container: @child: @first_prop_name: -@Varargs: +@...: <!-- ##### FUNCTION gtk_container_child_set ##### --> @@ -417,7 +417,7 @@ Does the same as gtk_container_get_children(). @container: @child: @first_prop_name: -@Varargs: +@...: <!-- ##### FUNCTION gtk_container_child_get_property ##### --> diff --git a/docs/reference/gtk/tmpl/gtkdialog.sgml b/docs/reference/gtk/tmpl/gtkdialog.sgml index aa57b69d8e..aa92b77ae3 100644 --- a/docs/reference/gtk/tmpl/gtkdialog.sgml +++ b/docs/reference/gtk/tmpl/gtkdialog.sgml @@ -272,7 +272,7 @@ directly, but into the @vbox and @action_area, as described above. @parent: @flags: @first_button_text: -@Varargs: +@...: @Returns: @@ -312,7 +312,7 @@ directly, but into the @vbox and @action_area, as described above. @dialog: @first_button_text: -@Varargs: +@...: <!-- ##### FUNCTION gtk_dialog_add_action_widget ##### --> @@ -416,7 +416,7 @@ directly, but into the @vbox and @action_area, as described above. @dialog: @first_response_id: -@Varargs: +@...: <!-- ##### FUNCTION gtk_dialog_set_alternative_button_order_from_array ##### --> diff --git a/docs/reference/gtk/tmpl/gtkfilechooserdialog.sgml b/docs/reference/gtk/tmpl/gtkfilechooserdialog.sgml index fed20abf06..493658c2b6 100644 --- a/docs/reference/gtk/tmpl/gtkfilechooserdialog.sgml +++ b/docs/reference/gtk/tmpl/gtkfilechooserdialog.sgml @@ -168,7 +168,7 @@ dialog = gtk_file_chooser_dialog_new ("Open File", @parent: @action: @first_button_text: -@Varargs: +@...: @Returns: @@ -182,7 +182,7 @@ dialog = gtk_file_chooser_dialog_new ("Open File", @action: @backend: @first_button_text: -@Varargs: +@...: @Returns: diff --git a/docs/reference/gtk/tmpl/gtkliststore.sgml b/docs/reference/gtk/tmpl/gtkliststore.sgml index 24f3a1c8b5..24e4c490d3 100644 --- a/docs/reference/gtk/tmpl/gtkliststore.sgml +++ b/docs/reference/gtk/tmpl/gtkliststore.sgml @@ -181,7 +181,7 @@ and common wisdom is to separate the two, as far as possible. </para> @n_columns: -@Varargs: +@...: @Returns: @@ -212,7 +212,7 @@ and common wisdom is to separate the two, as far as possible. @list_store: @iter: -@Varargs: +@...: <!-- ##### FUNCTION gtk_list_store_set_valist ##### --> @@ -296,7 +296,7 @@ and common wisdom is to separate the two, as far as possible. @list_store: @iter: @position: -@Varargs: +@...: <!-- ##### FUNCTION gtk_list_store_insert_with_valuesv ##### --> diff --git a/docs/reference/gtk/tmpl/gtkobject.sgml b/docs/reference/gtk/tmpl/gtkobject.sgml index f6ccdde1ce..4b3f9a3344 100644 --- a/docs/reference/gtk/tmpl/gtkobject.sgml +++ b/docs/reference/gtk/tmpl/gtkobject.sgml @@ -188,10 +188,12 @@ function. a #GTK_TYPE_FOO macro.) @first_property_name: name of the first property to set when constructing the object. -@Varargs: the first argument's value, followed by any number of -name/argument-value pairs, terminated with %NULL. +@...: @Returns: the new #GtkObject. @Deprecated: Use g_object_new() instead. +<!-- # Unused Parameters # --> +@Varargs: the first argument's value, followed by any number of +name/argument-value pairs, terminated with %NULL. <!-- ##### FUNCTION gtk_object_sink ##### --> @@ -273,8 +275,10 @@ Gets properties of an object. @object: a #GtkObject. @first_property_name: name of first property to get the value for. -@Varargs: %NULL-terminated list of name-return location pairs. +@...: @Deprecated: Use g_object_get() instead. +<!-- # Unused Parameters # --> +@Varargs: %NULL-terminated list of name-return location pairs. <!-- ##### FUNCTION gtk_object_set ##### --> @@ -296,9 +300,11 @@ void set_box_properties (GtkBox* box) @object: a #GtkObject. @first_property_name: name of the first property to set +@...: +@Deprecated: Use g_object_set() instead. +<!-- # Unused Parameters # --> @Varargs: the value of the first argument, followed optionally by more name/value pairs, followed by %NULL. -@Deprecated: Use g_object_set() instead. <!-- ##### FUNCTION gtk_object_set_data ##### --> diff --git a/docs/reference/gtk/tmpl/gtkrecentchooserdialog.sgml b/docs/reference/gtk/tmpl/gtkrecentchooserdialog.sgml index fd06e2b507..af1f3ab281 100644 --- a/docs/reference/gtk/tmpl/gtkrecentchooserdialog.sgml +++ b/docs/reference/gtk/tmpl/gtkrecentchooserdialog.sgml @@ -77,7 +77,7 @@ Recently used files are supported since GTK+ 2.10. @title: @parent: @first_button_text: -@Varargs: +@...: @Returns: @@ -90,7 +90,7 @@ Recently used files are supported since GTK+ 2.10. @parent: @manager: @first_button_text: -@Varargs: +@...: @Returns: diff --git a/docs/reference/gtk/tmpl/gtksignal.sgml b/docs/reference/gtk/tmpl/gtksignal.sgml index c632ba724b..9a7f875d0c 100644 --- a/docs/reference/gtk/tmpl/gtksignal.sgml +++ b/docs/reference/gtk/tmpl/gtksignal.sgml @@ -269,9 +269,11 @@ which takes a string and returns a boolean value. @return_val: the type of return value, or #GTK_TYPE_NONE for a signal without a return value. @n_args: the number of parameter the handlers may take. -@Varargs: a list of #GTK_TYPE_*, one for each parameter. +@...: @Returns: the signal id. @Deprecated: Use g_signal_new() instead. +<!-- # Unused Parameters # --> +@Varargs: a list of #GTK_TYPE_*, one for each parameter. <!-- ##### FUNCTION gtk_signal_newv ##### --> @@ -347,9 +349,11 @@ The default handler will be called first if @object: the object that emits the signal. @signal_id: the signal identifier. +@...: +@Deprecated: Use g_signal_emit() instead. +<!-- # Unused Parameters # --> @Varargs: the parameters to the function, followed by a pointer to the return type, if any. -@Deprecated: Use g_signal_emit() instead. <!-- ##### FUNCTION gtk_signal_emit_by_name ##### --> @@ -360,9 +364,11 @@ handlers to be run. @object: the object that emits the signal. @name: the name of the signal. +@...: +@Deprecated: Use g_signal_emit_by_name() instead. +<!-- # Unused Parameters # --> @Varargs: the parameters to the function, followed by a pointer to the return type, if any. -@Deprecated: Use g_signal_emit_by_name() instead. <!-- ##### FUNCTION gtk_signal_emitv ##### --> diff --git a/docs/reference/gtk/tmpl/gtkstyle.sgml b/docs/reference/gtk/tmpl/gtkstyle.sgml index bec1f1b977..82f9590044 100644 --- a/docs/reference/gtk/tmpl/gtkstyle.sgml +++ b/docs/reference/gtk/tmpl/gtkstyle.sgml @@ -251,7 +251,7 @@ Does the same as gtk_style_apply_default_background(). @style: @widget_type: @first_property_name: -@Varargs: +@...: <!-- ##### FUNCTION gtk_draw_hline ##### --> diff --git a/docs/reference/gtk/tmpl/gtktextbuffer.sgml b/docs/reference/gtk/tmpl/gtktextbuffer.sgml index f7cfdef356..66e6cb824a 100644 --- a/docs/reference/gtk/tmpl/gtktextbuffer.sgml +++ b/docs/reference/gtk/tmpl/gtktextbuffer.sgml @@ -289,7 +289,7 @@ types related to the text widget and how they work together. @text: @len: @first_tag: -@Varargs: +@...: <!-- ##### FUNCTION gtk_text_buffer_insert_with_tags_by_name ##### --> @@ -302,7 +302,7 @@ types related to the text widget and how they work together. @text: @len: @first_tag_name: -@Varargs: +@...: <!-- ##### FUNCTION gtk_text_buffer_delete ##### --> @@ -581,7 +581,7 @@ types related to the text widget and how they work together. @buffer: @tag_name: @first_property_name: -@Varargs: +@...: @Returns: diff --git a/docs/reference/gtk/tmpl/gtktreemodel.sgml b/docs/reference/gtk/tmpl/gtktreemodel.sgml index 083ce7c514..904566cab3 100644 --- a/docs/reference/gtk/tmpl/gtktreemodel.sgml +++ b/docs/reference/gtk/tmpl/gtktreemodel.sgml @@ -345,7 +345,7 @@ section. </para> @first_index: -@Varargs: +@...: @Returns: @@ -807,7 +807,7 @@ versions of GTK+. @tree_model: @iter: -@Varargs: +@...: <!-- ##### FUNCTION gtk_tree_model_get_valist ##### --> diff --git a/docs/reference/gtk/tmpl/gtktreestore.sgml b/docs/reference/gtk/tmpl/gtktreestore.sgml index efa84558c0..1fca1ee8cc 100644 --- a/docs/reference/gtk/tmpl/gtktreestore.sgml +++ b/docs/reference/gtk/tmpl/gtktreestore.sgml @@ -59,7 +59,7 @@ column. The "type" attribute specifies the data type for the column. </para> @n_columns: -@Varargs: +@...: @Returns: @@ -101,7 +101,7 @@ column. The "type" attribute specifies the data type for the column. @tree_store: @iter: -@Varargs: +@...: <!-- ##### FUNCTION gtk_tree_store_set_valist ##### --> @@ -178,7 +178,7 @@ column. The "type" attribute specifies the data type for the column. @iter: @parent: @position: -@Varargs: +@...: <!-- ##### FUNCTION gtk_tree_store_insert_with_valuesv ##### --> diff --git a/docs/reference/gtk/tmpl/gtktreeview.sgml b/docs/reference/gtk/tmpl/gtktreeview.sgml index 5c4e084a3a..a1cb74e4ee 100644 --- a/docs/reference/gtk/tmpl/gtktreeview.sgml +++ b/docs/reference/gtk/tmpl/gtktreeview.sgml @@ -670,7 +670,7 @@ has some similarity to strcmp() returning 0 for equal strings. @position: @title: @cell: -@Varargs: +@...: @Returns: diff --git a/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml b/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml index 3ea4aff1c7..0f27f63021 100644 --- a/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml +++ b/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml @@ -171,7 +171,7 @@ calling gtk_tree_view_column_set_cell_data_func() @title: @cell: -@Varargs: +@...: @Returns: @@ -230,7 +230,7 @@ calling gtk_tree_view_column_set_cell_data_func() @tree_column: @cell_renderer: -@Varargs: +@...: <!-- ##### FUNCTION gtk_tree_view_column_set_cell_data_func ##### --> diff --git a/docs/reference/libgail-util/gail-libgail-util-docs.sgml b/docs/reference/libgail-util/gail-libgail-util-docs.sgml index e35ae2b1d0..5e331c7397 100644 --- a/docs/reference/libgail-util/gail-libgail-util-docs.sgml +++ b/docs/reference/libgail-util/gail-libgail-util-docs.sgml @@ -2,6 +2,7 @@ <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ <!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'"> +<!ENTITY version "2.24.9"> ]> <book id="index" xmlns:xi="http://www.w3.org/2003/XInclude"> <bookinfo> diff --git a/gdk/Makefile.am b/gdk/Makefile.am index 4adb2f0eb9..c880f6e2ca 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -36,6 +36,7 @@ INCLUDES = \ -DG_LOG_DOMAIN=\"Gdk\" \ -DGDK_COMPILATION \ -I$(top_srcdir) \ + -I$(top_builddir) \ -I$(top_builddir)/gdk \ $(GTK_DEBUG_FLAGS) \ $(GDK_DEP_CFLAGS) diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index 3234f2ebf0..0bd803f1cd 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -680,7 +680,12 @@ GdkRegion *_gdk_region_new_from_yxbanded_rects (GdkRectangle *rects, int n_rect /***************************** * offscreen window routines * *****************************/ +typedef struct _GdkOffscreenWindow GdkOffscreenWindow; +#define GDK_TYPE_OFFSCREEN_WINDOW (gdk_offscreen_window_get_type()) +#define GDK_OFFSCREEN_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_OFFSCREEN_WINDOW, GdkOffscreenWindow)) +#define GDK_IS_OFFSCREEN_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_OFFSCREEN_WINDOW)) GType gdk_offscreen_window_get_type (void); +GdkDrawable * _gdk_offscreen_window_get_real_drawable (GdkOffscreenWindow *window); void _gdk_offscreen_window_new (GdkWindow *window, GdkScreen *screen, GdkVisual *visual, diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c index 23d92affd2..9ed5d45ef7 100644 --- a/gdk/gdkoffscreenwindow.c +++ b/gdk/gdkoffscreenwindow.c @@ -46,7 +46,6 @@ *Â GDK_POINTER_MOTION_HINT_MASK isn't effective */ -typedef struct _GdkOffscreenWindow GdkOffscreenWindow; typedef struct _GdkOffscreenWindowClass GdkOffscreenWindowClass; struct _GdkOffscreenWindow @@ -67,9 +66,6 @@ struct _GdkOffscreenWindowClass GdkDrawableClass parent_class; }; -#define GDK_TYPE_OFFSCREEN_WINDOW (gdk_offscreen_window_get_type()) -#define GDK_OFFSCREEN_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_OFFSCREEN_WINDOW, GdkOffscreenWindow)) -#define GDK_IS_OFFSCREEN_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_OFFSCREEN_WINDOW)) #define GDK_OFFSCREEN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_OFFSCREEN_WINDOW, GdkOffscreenWindowClass)) #define GDK_IS_OFFSCREEN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_OFFSCREEN_WINDOW)) #define GDK_OFFSCREEN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_OFFSCREEN_WINDOW, GdkOffscreenWindowClass)) @@ -846,6 +842,12 @@ gdk_offscreen_window_get_pointer (GdkWindow *window, return TRUE; } +GdkDrawable * +_gdk_offscreen_window_get_real_drawable (GdkOffscreenWindow *offscreen) +{ + return get_real_drawable (offscreen); +} + /** * gdk_offscreen_window_get_pixmap: * @window: a #GdkWindow diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c index 5bdab882c9..a8800f7ca2 100644 --- a/gdk/quartz/gdkevents-quartz.c +++ b/gdk/quartz/gdkevents-quartz.c @@ -959,6 +959,12 @@ fill_key_event (GdkWindow *window, event->key.state |= _gdk_quartz_events_get_current_mouse_modifiers (); + /* The X11 backend adds the first virtual modifier MOD2..MOD5 are + * mapped to. Since we only have one virtual modifier in the quartz + * backend, calling the standard function will do. + */ + gdk_keymap_add_virtual_modifiers (NULL, &event->key.state); + event->key.string = NULL; /* Fill in ->string since apps depend on it, taken from the x11 backend. */ diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index a637b07d3b..8e12ae6819 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -1687,7 +1687,18 @@ gdk_window_quartz_restack_toplevel (GdkWindow *window, GdkWindow *sibling, gboolean above) { - /* FIXME: Implement this */ + GdkWindowImplQuartz *impl; + gint sibling_num; + + impl = GDK_WINDOW_IMPL_QUARTZ (((GdkWindowObject *)sibling)->impl); + sibling_num = [impl->toplevel windowNumber]; + + impl = GDK_WINDOW_IMPL_QUARTZ (((GdkWindowObject *)window)->impl); + + if (above) + [impl->toplevel orderWindow:NSWindowAbove relativeTo:sibling_num]; + else + [impl->toplevel orderWindow:NSWindowBelow relativeTo:sibling_num]; } static void diff --git a/gdk/win32/gdkgc-win32.c b/gdk/win32/gdkgc-win32.c index 712bc28585..e7e6fd8f2e 100644 --- a/gdk/win32/gdkgc-win32.c +++ b/gdk/win32/gdkgc-win32.c @@ -743,6 +743,8 @@ predraw (GdkGC *gc, static GdkDrawableImplWin32 * get_impl_drawable (GdkDrawable *drawable) { + if (GDK_IS_OFFSCREEN_WINDOW (drawable)) + return _gdk_offscreen_window_get_real_drawable (GDK_OFFSCREEN_WINDOW (drawable)); if (GDK_IS_DRAWABLE_IMPL_WIN32 (drawable)) return GDK_DRAWABLE_IMPL_WIN32(drawable); else if (GDK_IS_WINDOW (drawable)) diff --git a/gdk/win32/gdkpixmap-win32.c b/gdk/win32/gdkpixmap-win32.c index 30b9c8ab0a..e803877437 100644 --- a/gdk/win32/gdkpixmap-win32.c +++ b/gdk/win32/gdkpixmap-win32.c @@ -138,7 +138,6 @@ _gdk_pixmap_new (GdkDrawable *drawable, gint depth) { HDC hdc; - HPALETTE holdpal = NULL; HBITMAP hbitmap; GdkPixmap *pixmap; GdkDrawableImplWin32 *drawable_impl; @@ -147,6 +146,7 @@ _gdk_pixmap_new (GdkDrawable *drawable, gint window_depth; cairo_surface_t *dib_surface, *image_surface; cairo_format_t format; + guchar *bits; g_return_val_if_fail (drawable == NULL || GDK_IS_DRAWABLE (drawable), NULL); g_return_val_if_fail ((drawable != NULL) || (depth != -1), NULL); @@ -175,6 +175,11 @@ _gdk_pixmap_new (GdkDrawable *drawable, format = CAIRO_FORMAT_A8; break; + case 15: + case 16: + format = CAIRO_FORMAT_RGB16_565; + break; + case 24: case 32: format = CAIRO_FORMAT_RGB24; @@ -203,16 +208,93 @@ _gdk_pixmap_new (GdkDrawable *drawable, gdk_drawable_set_colormap (pixmap, cmap); } - dib_surface = cairo_win32_surface_create_with_dib (format, width, height); - if (dib_surface == NULL) + if (depth != 15 && depth != 16) { - g_object_unref ((GObject *) pixmap); - return NULL; + dib_surface = cairo_win32_surface_create_with_dib (format, width, height); + if (dib_surface == NULL) + { + g_object_unref ((GObject *) pixmap); + return NULL; + } + + /* We need to have cairo create the dibsection for us, because + creating a cairo surface from a hdc only works for rgb24 format */ + hdc = cairo_win32_surface_get_dc (dib_surface); + + /* Get the bitmap from the cairo hdc */ + hbitmap = GetCurrentObject (hdc, OBJ_BITMAP); + + image_surface = cairo_win32_surface_get_image (dib_surface); + bits = cairo_image_surface_get_data (image_surface); + } + else + { + /* 16 bpp not supported by win32 cairo surface */ + struct { + BITMAPINFOHEADER bmiHeader; + union { + WORD bmiIndices[256]; + DWORD bmiMasks[3]; + RGBQUAD bmiColors[256]; + } u; + } bmi; + UINT iUsage; + HWND hwnd; + GdkVisual *visual; + + if (GDK_IS_WINDOW (drawable)) + hwnd = GDK_WINDOW_HWND (drawable); + else + hwnd = GetDesktopWindow (); + if ((hdc = GetDC (hwnd)) == NULL) + { + WIN32_GDI_FAILED ("GetDC"); + g_object_unref ((GObject *) pixmap); + return NULL; + } + + bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER); + bmi.bmiHeader.biWidth = width; + bmi.bmiHeader.biHeight = -height; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 16; + bmi.bmiHeader.biCompression = BI_BITFIELDS; + bmi.bmiHeader.biSizeImage = 0; + bmi.bmiHeader.biXPelsPerMeter = + bmi.bmiHeader.biYPelsPerMeter = 0; + bmi.bmiHeader.biClrUsed = 0; + bmi.bmiHeader.biClrImportant = 0; + + iUsage = DIB_RGB_COLORS; + visual = gdk_visual_get_system (); + bmi.u.bmiMasks[0] = visual->red_mask; + bmi.u.bmiMasks[1] = visual->green_mask; + bmi.u.bmiMasks[2] = visual->blue_mask; + + hbitmap = CreateDIBSection (hdc, (BITMAPINFO *) &bmi, + iUsage, (PVOID *) &bits, NULL, 0); + GDI_CALL (ReleaseDC, (hwnd, hdc)); + if (hbitmap == NULL) + { + WIN32_GDI_FAILED ("CreateDIBSection"); + g_object_unref ((GObject *) pixmap); + return NULL; + } + + dib_surface = cairo_image_surface_create_for_data (bits, + format, width, height, + (width * 2 + 3) & ~3); + + hdc = CreateCompatibleDC (NULL); + if (!hdc) + { + WIN32_GDI_FAILED ("CreateCompatibleDC"); + g_object_unref ((GObject *) pixmap); + return NULL; + } + + SelectObject (hdc, hbitmap); } - - /* We need to have cairo create the dibsection for us, because - creating a cairo surface from a hdc only works for rgb24 format */ - hdc = cairo_win32_surface_get_dc (dib_surface); /* We need to use the same hdc, because only one hdc can render to the same bitmap */ @@ -221,13 +303,8 @@ _gdk_pixmap_new (GdkDrawable *drawable, /* No need to create a new surface when needed, as we have one already */ drawable_impl->cairo_surface = dib_surface; - - /* Get the bitmap from the cairo hdc */ - hbitmap = GetCurrentObject (hdc, OBJ_BITMAP); drawable_impl->handle = hbitmap; - - image_surface = cairo_win32_surface_get_image (dib_surface); - pixmap_impl->bits = cairo_image_surface_get_data (image_surface); + pixmap_impl->bits = bits; gdk_win32_handle_table_insert (&GDK_PIXMAP_HBITMAP (pixmap), pixmap); diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 60a7dd65b4..ebe4ce22ff 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -655,7 +655,7 @@ _gdk_window_impl_new (GdkWindow *window, /* A temp window is not necessarily a top level window */ dwStyle = (_gdk_root == real_parent ? WS_POPUP : WS_CHILDWINDOW); dwStyle |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS; - dwExStyle |= WS_EX_TOOLWINDOW; + dwExStyle |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST; offset_x = _gdk_offset_x; offset_y = _gdk_offset_y; break; @@ -1266,10 +1266,11 @@ show_window_internal (GdkWindow *window, } /* Sync STATE_ABOVE to TOPMOST */ - if (((private->state & GDK_WINDOW_STATE_ABOVE) && + if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_TEMP && + (((private->state & GDK_WINDOW_STATE_ABOVE) && !(exstyle & WS_EX_TOPMOST)) || (!(private->state & GDK_WINDOW_STATE_ABOVE) && - (exstyle & WS_EX_TOPMOST))) + (exstyle & WS_EX_TOPMOST)))) { API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), (private->state & GDK_WINDOW_STATE_ABOVE)?HWND_TOPMOST:HWND_NOTOPMOST, @@ -1821,6 +1822,7 @@ gdk_window_win32_clear_region (GdkWindow *window, g_free (rectangles); } + static void gdk_win32_window_raise (GdkWindow *window) { @@ -1834,7 +1836,11 @@ gdk_win32_window_raise (GdkWindow *window) 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE)); else if (((GdkWindowObject *)window)->accept_focus) - API_CALL (BringWindowToTop, (GDK_WINDOW_HWND (window))); + /* Do not wrap this in an API_CALL macro as SetForegroundWindow might + * fail when for example dragging a window belonging to a different + * application at the time of a gtk_window_present() call due to focus + * stealing prevention. */ + SetForegroundWindow (GDK_WINDOW_HWND (window)); else API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP, 0, 0, 0, 0, @@ -3137,9 +3143,10 @@ update_style_bits (GdkWindow *window) new_style = old_style; new_exstyle = old_exstyle; - if (private->window_type == GDK_WINDOW_TEMP || - impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY) - new_exstyle |= WS_EX_TOOLWINDOW; + if (private->window_type == GDK_WINDOW_TEMP) + new_exstyle |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST; + else if (impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY) + new_exstyle |= WS_EX_TOOLWINDOW ; else new_exstyle &= ~WS_EX_TOOLWINDOW; diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index a78e593a7f..96788faf5e 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -683,11 +683,16 @@ is_pointer_within_shape (GdkDisplay *display, GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display); GdkRegion *input_shape; - child->shape = _xwindow_get_shape (display_x11->xdisplay, - child->xid, ShapeBounding); + child->shape = NULL; + if (gdk_display_supports_shapes (display)) + child->shape = _xwindow_get_shape (display_x11->xdisplay, + child->xid, ShapeBounding); #ifdef ShapeInput - input_shape = _xwindow_get_shape (display_x11->xdisplay, - child->xid, ShapeInput); + input_shape = NULL; + if (gdk_display_supports_input_shapes (display)) + input_shape = _xwindow_get_shape (display_x11->xdisplay, + child->xid, ShapeInput); + if (child->shape && input_shape) { gdk_region_intersect (child->shape, input_shape); diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index c2c32f015c..f32246ec95 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -4659,17 +4659,24 @@ _xwindow_get_shape (Display *xdisplay, shape = NULL; rn = 0; - xrl = XShapeGetRectangles (xdisplay, - window, - shape_type, &rn, &ord); + /* Note that XShapeGetRectangles returns NULL in two situations: + * - the server doesn't support the SHAPE extension + * - the shape is empty + * + * Since we can't discriminate these here, we always return + * an empty shape. It is the callers responsibility to check + * whether the server supports the SHAPE extensions beforehand. + */ + xrl = XShapeGetRectangles (xdisplay, window, shape_type, &rn, &ord); - if (xrl == NULL || rn == 0) + if (rn == 0) return gdk_region_new (); /* Empty */ if (ord != YXBanded) { /* This really shouldn't happen with any xserver, as they - generally convert regions to YXBanded internally */ + * generally convert regions to YXBanded internally + */ g_warning ("non YXBanded shape masks not supported"); XFree (xrl); return NULL; @@ -4684,10 +4691,10 @@ _xwindow_get_shape (Display *xdisplay, rl[i].height = xrl[i].height; } XFree (xrl); - + shape = _gdk_region_new_from_yxbanded_rects (rl, rn); g_free (rl); - + return shape; } @@ -4736,10 +4743,10 @@ _gdk_windowing_window_get_input_shape (GdkWindow *window) { #if defined(ShapeInput) if (!GDK_WINDOW_DESTROYED (window) && - gdk_display_supports_shapes (GDK_WINDOW_DISPLAY (window))) + gdk_display_supports_input_shapes (GDK_WINDOW_DISPLAY (window))) return _xwindow_get_shape (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), - ShapeInput); + GDK_WINDOW_XID (window), + ShapeInput); #endif return NULL; diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 76edf3c673..af6232371e 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -1022,7 +1022,7 @@ Gtk_2_0_gir_CFLAGS = \ -UGTK_DISABLE_DEPRECATED \ -DGTK_TEXT_USE_INTERNAL_UNSUPPORTED_API Gtk_2_0_gir_LIBS = $(gtktargetlib) -Gtk_2_0_gir_FILES = $(addprefix $(srcdir)/, $(introspection_files)) +Gtk_2_0_gir_FILES = $(introspection_files) INTROSPECTION_GIRS += Gtk-2.0.gir girdir = $(datadir)/gir-1.0 @@ -1077,7 +1077,7 @@ gtk-update-icon-cache.exe.manifest: endif gtk_query_immodules_2_0_DEPENDENCIES = $(DEPS) -gtk_query_immodules_2_0_LDADD = $(LDADDS) +gtk_query_immodules_2_0_LDADD = $(LDADDS) $(GMODULE_LIBS) gtk_query_immodules_2_0_SOURCES = queryimmodules.c gtk_update_icon_cache_LDADD = $(GDK_PIXBUF_LIBS) diff --git a/gtk/gtkcellrendereraccel.c b/gtk/gtkcellrendereraccel.c index d25ec80acf..4882fafb6d 100644 --- a/gtk/gtkcellrendereraccel.c +++ b/gtk/gtkcellrendereraccel.c @@ -144,14 +144,14 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class) * Since: 2.10 */ g_object_class_install_property (object_class, - PROP_KEYCODE, - g_param_spec_uint ("keycode", - P_("Accelerator keycode"), - P_("The hardware keycode of the accelerator"), - 0, - G_MAXINT, - 0, - GTK_PARAM_READWRITE)); + PROP_KEYCODE, + g_param_spec_uint ("keycode", + P_("Accelerator keycode"), + P_("The hardware keycode of the accelerator"), + 0, + G_MAXINT, + 0, + GTK_PARAM_READWRITE)); /** * GtkCellRendererAccel:accel-mode: @@ -166,11 +166,11 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class) g_object_class_install_property (object_class, PROP_ACCEL_MODE, g_param_spec_enum ("accel-mode", - P_("Accelerator Mode"), - P_("The type of accelerators"), - GTK_TYPE_CELL_RENDERER_ACCEL_MODE, - GTK_CELL_RENDERER_ACCEL_MODE_GTK, - GTK_PARAM_READWRITE)); + P_("Accelerator Mode"), + P_("The type of accelerators"), + GTK_TYPE_CELL_RENDERER_ACCEL_MODE, + GTK_CELL_RENDERER_ACCEL_MODE_GTK, + GTK_PARAM_READWRITE)); /** * GtkCellRendererAccel::accel-edited: @@ -185,16 +185,16 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class) * Since: 2.10 */ signals[ACCEL_EDITED] = g_signal_new (I_("accel-edited"), - GTK_TYPE_CELL_RENDERER_ACCEL, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GtkCellRendererAccelClass, accel_edited), - NULL, NULL, - _gtk_marshal_VOID__STRING_UINT_FLAGS_UINT, - G_TYPE_NONE, 4, - G_TYPE_STRING, - G_TYPE_UINT, - GDK_TYPE_MODIFIER_TYPE, - G_TYPE_UINT); + GTK_TYPE_CELL_RENDERER_ACCEL, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkCellRendererAccelClass, accel_edited), + NULL, NULL, + _gtk_marshal_VOID__STRING_UINT_FLAGS_UINT, + G_TYPE_NONE, 4, + G_TYPE_STRING, + G_TYPE_UINT, + GDK_TYPE_MODIFIER_TYPE, + G_TYPE_UINT); /** * GtkCellRendererAccel::accel-cleared: @@ -206,13 +206,13 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class) * Since: 2.10 */ signals[ACCEL_CLEARED] = g_signal_new (I_("accel-cleared"), - GTK_TYPE_CELL_RENDERER_ACCEL, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GtkCellRendererAccelClass, accel_cleared), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); + GTK_TYPE_CELL_RENDERER_ACCEL, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkCellRendererAccelClass, accel_cleared), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); } @@ -233,9 +233,9 @@ gtk_cell_renderer_accel_new (void) static gchar * convert_keysym_state_to_string (GtkCellRendererAccel *accel, - guint keysym, + guint keysym, GdkModifierType mask, - guint keycode) + guint keycode) { if (keysym == 0 && keycode == 0) /* This label is displayed in a treeview cell displaying @@ -256,24 +256,24 @@ convert_keysym_state_to_string (GtkCellRendererAccel *accel, return gtk_accelerator_get_label (keysym, mask); } else - { - gchar *name; + { + gchar *name; - name = gtk_accelerator_get_label (keysym, mask); - if (name == NULL) - name = gtk_accelerator_name (keysym, mask); + name = gtk_accelerator_get_label (keysym, mask); + if (name == NULL) + name = gtk_accelerator_name (keysym, mask); - if (keysym == 0) - { - gchar *tmp; + if (keysym == 0) + { + gchar *tmp; - tmp = name; - name = g_strdup_printf ("%s0x%02x", tmp, keycode); - g_free (tmp); - } + tmp = name; + name = g_strdup_printf ("%s0x%02x", tmp, keycode); + g_free (tmp); + } - return name; - } + return name; + } } } @@ -321,36 +321,36 @@ gtk_cell_renderer_accel_set_property (GObject *object, { case PROP_ACCEL_KEY: { - guint accel_key = g_value_get_uint (value); + guint accel_key = g_value_get_uint (value); - if (accel->accel_key != accel_key) - { - accel->accel_key = accel_key; - changed = TRUE; - } + if (accel->accel_key != accel_key) + { + accel->accel_key = accel_key; + changed = TRUE; + } } break; case PROP_ACCEL_MODS: { - guint accel_mods = g_value_get_flags (value); + guint accel_mods = g_value_get_flags (value); - if (accel->accel_mods != accel_mods) - { - accel->accel_mods = accel_mods; - changed = TRUE; - } + if (accel->accel_mods != accel_mods) + { + accel->accel_mods = accel_mods; + changed = TRUE; + } } break; case PROP_KEYCODE: { - guint keycode = g_value_get_uint (value); + guint keycode = g_value_get_uint (value); - if (accel->keycode != keycode) - { - accel->keycode = keycode; - changed = TRUE; - } + if (accel->keycode != keycode) + { + accel->keycode = keycode; + changed = TRUE; + } } break; @@ -431,8 +431,6 @@ grab_key_callback (GtkWidget *widget, event->group, &keyval, NULL, NULL, &consumed_modifiers); - gdk_keymap_add_virtual_modifiers (gdk_keymap_get_for_display (display), &accel_mods); - accel_key = gdk_keyval_to_lower (keyval); if (accel_key == GDK_ISO_Left_Tab) accel_key = GDK_Tab; @@ -467,11 +465,11 @@ grab_key_callback (GtkWidget *widget, if (accel->accel_mode == GTK_CELL_RENDERER_ACCEL_MODE_GTK) { if (!gtk_accelerator_valid (accel_key, accel_mods)) - { - gtk_widget_error_bell (widget); + { + gtk_widget_error_bell (widget); - return TRUE; - } + return TRUE; + } } edited = TRUE; @@ -490,7 +488,7 @@ grab_key_callback (GtkWidget *widget, if (edited) g_signal_emit (accel, signals[ACCEL_EDITED], 0, path, - accel_key, accel_mods, event->hardware_keycode); + accel_key, accel_mods, event->hardware_keycode); else if (cleared) g_signal_emit (accel, signals[ACCEL_CLEARED], 0, path); @@ -516,7 +514,7 @@ ungrab_stuff (GtkWidget *widget, static void _gtk_cell_editable_event_box_start_editing (GtkCellEditable *cell_editable, - GdkEvent *event) + GdkEvent *event) { /* do nothing, because we are pointless */ } @@ -527,17 +525,73 @@ _gtk_cell_editable_event_box_cell_editable_init (GtkCellEditableIface *iface) iface->start_editing = _gtk_cell_editable_event_box_start_editing; } -typedef GtkEventBox GtkCellEditableEventBox; -typedef GtkEventBoxClass GtkCellEditableEventBoxClass; +typedef struct _GtkCellEditableEventBox GtkCellEditableEventBox; +typedef GtkEventBoxClass GtkCellEditableEventBoxClass; + +struct _GtkCellEditableEventBox +{ + GtkEventBox box; + gboolean editing_canceled; +}; G_DEFINE_TYPE_WITH_CODE (GtkCellEditableEventBox, _gtk_cell_editable_event_box, GTK_TYPE_EVENT_BOX, { \ G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_EDITABLE, _gtk_cell_editable_event_box_cell_editable_init) \ }) +enum { + PROP_ZERO, + PROP_EDITING_CANCELED +}; + +static void +gtk_cell_editable_event_box_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GtkCellEditableEventBox *box = (GtkCellEditableEventBox*)object; + + switch (prop_id) + { + case PROP_EDITING_CANCELED: + box->editing_canceled = g_value_get_boolean (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gtk_cell_editable_event_box_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GtkCellEditableEventBox *box = (GtkCellEditableEventBox*)object; + + switch (prop_id) + { + case PROP_EDITING_CANCELED: + g_value_set_boolean (value, box->editing_canceled); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} static void _gtk_cell_editable_event_box_class_init (GtkCellEditableEventBoxClass *class) { + GObjectClass *gobject_class = G_OBJECT_CLASS (class); + + gobject_class->set_property = gtk_cell_editable_event_box_set_property; + gobject_class->get_property = gtk_cell_editable_event_box_get_property; + + g_object_class_override_property (gobject_class, + PROP_EDITING_CANCELED, + "editing-canceled"); } static void diff --git a/gtk/gtkiconfactory.c b/gtk/gtkiconfactory.c index b4146ad039..c4b6c9cdd4 100644 --- a/gtk/gtkiconfactory.c +++ b/gtk/gtkiconfactory.c @@ -1581,9 +1581,10 @@ render_fallback_image (GtkStyle *style, _gtk_icon_theme_ensure_builtin_cache (); index = _gtk_icon_cache_get_directory_index (_builtin_cache, "24"); - pixbuf = _gtk_icon_cache_get_icon (_builtin_cache, - GTK_STOCK_MISSING_IMAGE, - index); + pixbuf = _gtk_icon_cache_get_icon (_builtin_cache, "image-missing", index); + + g_return_val_if_fail(pixbuf != NULL, NULL); + gtk_icon_source_set_pixbuf (&fallback_source, pixbuf); g_object_unref (pixbuf); } diff --git a/gtk/gtkmodules.c b/gtk/gtkmodules.c index edc79eec9b..50729b61a5 100644 --- a/gtk/gtkmodules.c +++ b/gtk/gtkmodules.c @@ -281,6 +281,7 @@ load_module (GSList *module_list, info->ref_count++; success = TRUE; + break; } } @@ -362,6 +363,8 @@ load_module (GSList *module_list, { module_list = g_slist_prepend (module_list, info); } + else + info->ref_count--; } else { diff --git a/gtk/gtkprinteroptionwidget.c b/gtk/gtkprinteroptionwidget.c index fb4640f08d..2f43edfde4 100644 --- a/gtk/gtkprinteroptionwidget.c +++ b/gtk/gtkprinteroptionwidget.c @@ -366,25 +366,52 @@ combo_box_set (GtkWidget *combo, gtk_tree_model_foreach (model, set_cb, &set_data); } -static char * -combo_box_get (GtkWidget *combo) +static gchar * +combo_box_get (GtkWidget *combo, gboolean *custom) { GtkTreeModel *model; gchar *value; GtkTreeIter iter; - if (gtk_combo_box_get_has_entry (GTK_COMBO_BOX (combo))) + model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo)); + + value = NULL; + if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter)) { - value = gtk_combo_box_get_active_text(GTK_COMBO_BOX (combo)); + gtk_tree_model_get (model, &iter, VALUE_COLUMN, &value, -1); + *custom = FALSE; } else { - model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo)); + if (gtk_combo_box_get_has_entry (GTK_COMBO_BOX (combo))) + { + value = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo))))); + *custom = TRUE; + } - value = NULL; - if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter)) - gtk_tree_model_get (model, &iter, VALUE_COLUMN, &value, -1); - } + if (!value || !gtk_tree_model_get_iter_first (model, &iter)) + return value; + + /* If the user entered an item from the dropdown list manually, return + * the non-custom option instead. */ + do + { + gchar *val, *name; + gtk_tree_model_get (model, &iter, VALUE_COLUMN, &val, + NAME_COLUMN, &name, -1); + if (g_str_equal (value, name)) + { + *custom = FALSE; + g_free (name); + g_free (value); + return val; + } + + g_free (val); + g_free (name); + } + while (gtk_tree_model_iter_next (model, &iter)); + } return value; } @@ -560,25 +587,29 @@ combo_changed_cb (GtkWidget *combo, gchar *value; gchar *filtered_val = NULL; gboolean changed; + gboolean custom = TRUE; g_signal_handler_block (priv->source, priv->source_changed_handler); - value = combo_box_get (combo); + value = combo_box_get (combo, &custom); - /* handle some constraints */ - switch (priv->source->type) + /* Handle constraints if the user entered a custom value. */ + if (custom) { - case GTK_PRINTER_OPTION_TYPE_PICKONE_PASSCODE: - filtered_val = filter_numeric (value, FALSE, FALSE, &changed); - break; - case GTK_PRINTER_OPTION_TYPE_PICKONE_INT: - filtered_val = filter_numeric (value, TRUE, FALSE, &changed); - break; - case GTK_PRINTER_OPTION_TYPE_PICKONE_REAL: - filtered_val = filter_numeric (value, TRUE, TRUE, &changed); - break; - default: - break; + switch (priv->source->type) + { + case GTK_PRINTER_OPTION_TYPE_PICKONE_PASSCODE: + filtered_val = filter_numeric (value, FALSE, FALSE, &changed); + break; + case GTK_PRINTER_OPTION_TYPE_PICKONE_INT: + filtered_val = filter_numeric (value, TRUE, FALSE, &changed); + break; + case GTK_PRINTER_OPTION_TYPE_PICKONE_REAL: + filtered_val = filter_numeric (value, TRUE, TRUE, &changed); + break; + default: + break; + } } if (filtered_val) @@ -869,6 +900,22 @@ update_widgets (GtkPrinterOptionWidget *widget) case GTK_PRINTER_OPTION_TYPE_STRING: gtk_entry_set_text (GTK_ENTRY (priv->entry), source->value); break; + case GTK_PRINTER_OPTION_TYPE_PICKONE_PASSWORD: + case GTK_PRINTER_OPTION_TYPE_PICKONE_PASSCODE: + case GTK_PRINTER_OPTION_TYPE_PICKONE_REAL: + case GTK_PRINTER_OPTION_TYPE_PICKONE_INT: + case GTK_PRINTER_OPTION_TYPE_PICKONE_STRING: + { + GtkEntry *entry; + + entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->combo))); + if (gtk_printer_option_has_choice (source, source->value)) + combo_box_set (priv->combo, source->value); + else + gtk_entry_set_text (entry, source->value); + + break; + } case GTK_PRINTER_OPTION_TYPE_FILESAVE: { gchar *filename = g_filename_from_uri (source->value, NULL, NULL); diff --git a/gtk/gtkprintsettings.c b/gtk/gtkprintsettings.c index 94674f6a74..c850dac68a 100644 --- a/gtk/gtkprintsettings.c +++ b/gtk/gtkprintsettings.c @@ -1783,7 +1783,7 @@ gtk_print_settings_load_key_file (GtkPrintSettings *settings, gchar *value; value = g_key_file_get_string (key_file, - KEYFILE_GROUP_NAME, + group_name, keys[i], NULL); if (!value) diff --git a/gtk/gtkrecentmanager.c b/gtk/gtkrecentmanager.c index 35eea656fe..cb2554225a 100644 --- a/gtk/gtkrecentmanager.c +++ b/gtk/gtkrecentmanager.c @@ -893,20 +893,10 @@ gtk_recent_manager_add_item_query_info (GObject *source_object, GtkRecentData recent_data; GFileInfo *file_info; gchar *uri; - GError *error; uri = g_file_get_uri (file); - error = NULL; - file_info = g_file_query_info_finish (file, res, &error); - if (error) - { - g_warning ("Unable to retrieve the file info for `%s': %s", - uri, - error->message); - g_error_free (error); - goto out; - } + file_info = g_file_query_info_finish (file, res, NULL); /* NULL-GError */ recent_data.display_name = NULL; recent_data.description = NULL; @@ -926,7 +916,7 @@ gtk_recent_manager_add_item_query_info (GObject *source_object, g_object_unref (file_info); } else - recent_data.mime_type = g_strdup (GTK_RECENT_DEFAULT_MIME); + recent_data.mime_type = g_strdup (GTK_RECENT_DEFAULT_MIME); /* FIXME: maybe we should make up the MIME type from the filename's extension */ recent_data.app_name = g_strdup (g_get_application_name ()); recent_data.app_exec = g_strjoin (" ", g_get_prgname (), "%u", NULL); @@ -948,7 +938,6 @@ gtk_recent_manager_add_item_query_info (GObject *source_object, g_free (recent_data.app_name); g_free (recent_data.app_exec); -out: g_object_unref (manager); g_free (uri); } diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c index d7159d9bf3..ccf589b878 100644 --- a/gtk/gtkscale.c +++ b/gtk/gtkscale.c @@ -131,6 +131,59 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkScale, gtk_scale, GTK_TYPE_RANGE, gtk_scale_buildable_interface_init)) +static gint +compare_marks (gconstpointer a, gconstpointer b, gpointer data) +{ + gboolean inverted = GPOINTER_TO_INT (data); + const GtkScaleMark *ma, *mb; + gint val; + + val = inverted ? -1 : 1; + ma = a; mb = b; + + return (ma->value > mb->value) ? val : ((ma->value < mb->value) ? -val : 0); +} + +static void +gtk_scale_notify (GObject *object, + GParamSpec *pspec) +{ + if (strcmp (pspec->name, "orientation") == 0) + { + GtkRange *range = GTK_RANGE (object); + + range->flippable = (range->orientation == GTK_ORIENTATION_HORIZONTAL); + } + else if (strcmp (pspec->name, "inverted") == 0) + { + GtkScalePrivate *priv = GTK_SCALE_GET_PRIVATE (object); + GtkScaleMark *mark; + GSList *m; + gint i, n; + gdouble *values; + + priv->marks = g_slist_sort_with_data (priv->marks, + compare_marks, + GINT_TO_POINTER (gtk_range_get_inverted (GTK_RANGE (object)))); + + 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; + } + + _gtk_range_set_stop_values (GTK_RANGE (object), values, n); + + g_free (values); + } + + if (G_OBJECT_CLASS (gtk_scale_parent_class)->notify) + G_OBJECT_CLASS (gtk_scale_parent_class)->notify (object, pspec); +} + + static gboolean single_string_accumulator (GSignalInvocationHint *ihint, GValue *return_accu, @@ -167,6 +220,7 @@ gtk_scale_class_init (GtkScaleClass *class) gobject_class->set_property = gtk_scale_set_property; gobject_class->get_property = gtk_scale_get_property; + gobject_class->notify = gtk_scale_notify; gobject_class->finalize = gtk_scale_finalize; widget_class->style_set = gtk_scale_style_set; @@ -379,13 +433,6 @@ gtk_scale_class_init (GtkScaleClass *class) } static void -gtk_scale_orientation_notify (GtkRange *range, - const GParamSpec *pspec) -{ - range->flippable = (range->orientation == GTK_ORIENTATION_HORIZONTAL); -} - -static void gtk_scale_init (GtkScale *scale) { GtkRange *range = GTK_RANGE (scale); @@ -403,10 +450,7 @@ gtk_scale_init (GtkScale *scale) scale->digits = 1; range->round_digits = scale->digits; - gtk_scale_orientation_notify (range, NULL); - g_signal_connect (scale, "notify::orientation", - G_CALLBACK (gtk_scale_orientation_notify), - NULL); + range->flippable = (range->orientation == GTK_ORIENTATION_HORIZONTAL); } static void @@ -932,8 +976,7 @@ static gint find_next_pos (GtkWidget *widget, GSList *list, gint *marks, - GtkPositionType pos, - gint match) + GtkPositionType pos) { GSList *m; gint i; @@ -942,11 +985,14 @@ find_next_pos (GtkWidget *widget, { GtkScaleMark *mark = m->data; - if (match == (mark->position == pos)) + if (mark->position == pos) return marks[i]; } - - return widget->allocation.width; + + if (GTK_RANGE(widget)->orientation == GTK_ORIENTATION_HORIZONTAL) + return widget->allocation.width; + else + return widget->allocation.height; } static gboolean @@ -957,7 +1003,6 @@ gtk_scale_expose (GtkWidget *widget, GtkScalePrivate *priv = GTK_SCALE_GET_PRIVATE (scale); GtkRange *range = GTK_RANGE (scale); GtkStateType state_type; - gint n_marks; gint *marks; gint focus_padding; gint slider_width; @@ -989,7 +1034,8 @@ gtk_scale_expose (GtkWidget *widget, gint min_pos_before, min_pos_after; gint min_pos, max_pos; - n_marks = _gtk_range_get_stop_positions (range, &marks); + _gtk_range_get_stop_positions (range, &marks); + layout = gtk_widget_create_pango_layout (widget, NULL); if (range->orientation == GTK_ORIENTATION_HORIZONTAL) @@ -1008,14 +1054,14 @@ gtk_scale_expose (GtkWidget *widget, y1 = widget->allocation.y + range->range_rect.y; y2 = y1 - slider_width / 2; min_pos = min_pos_before; - max_pos = widget->allocation.x + find_next_pos (widget, m, marks + i, GTK_POS_TOP, 1) - min_sep; + max_pos = widget->allocation.x + find_next_pos (widget, m, marks + i, GTK_POS_TOP) - min_sep; } else { y1 = widget->allocation.y + range->range_rect.y + range->range_rect.height; y2 = y1 + slider_width / 2; min_pos = min_pos_after; - max_pos = widget->allocation.x + find_next_pos (widget, m, marks + i, GTK_POS_TOP, 0) - min_sep; + max_pos = widget->allocation.x + find_next_pos (widget, m, marks + i, GTK_POS_BOTTOM) - min_sep; } gtk_paint_vline (widget->style, widget->window, state_type, @@ -1056,14 +1102,14 @@ gtk_scale_expose (GtkWidget *widget, x1 = widget->allocation.x + range->range_rect.x; x2 = widget->allocation.x + range->range_rect.x - slider_width / 2; min_pos = min_pos_before; - max_pos = widget->allocation.y + find_next_pos (widget, m, marks + i, GTK_POS_LEFT, 1) - min_sep; + max_pos = widget->allocation.y + find_next_pos (widget, m, marks + i, GTK_POS_LEFT) - min_sep; } else { x1 = widget->allocation.x + range->range_rect.x + range->range_rect.width; x2 = widget->allocation.x + range->range_rect.x + range->range_rect.width + slider_width / 2; min_pos = min_pos_after; - max_pos = widget->allocation.y + find_next_pos (widget, m, marks + i, GTK_POS_LEFT, 0) - min_sep; + max_pos = widget->allocation.y + find_next_pos (widget, m, marks + i, GTK_POS_RIGHT) - min_sep; } y1 = widget->allocation.y + marks[i]; @@ -1378,16 +1424,6 @@ gtk_scale_clear_marks (GtkScale *scale) gtk_widget_queue_resize (GTK_WIDGET (scale)); } -static gint -compare_marks (gpointer a, gpointer b) -{ - GtkScaleMark *ma, *mb; - - ma = a; mb = b; - - return (gint) (ma->value - mb->value); -} - /** * gtk_scale_add_mark: * @scale: a #GtkScale @@ -1429,8 +1465,11 @@ gtk_scale_add_mark (GtkScale *scale, mark->markup = g_strdup (markup); mark->position = position; - priv->marks = g_slist_insert_sorted (priv->marks, mark, - (GCompareFunc) compare_marks); + priv->marks = g_slist_insert_sorted_with_data (priv->marks, mark, + (GCompareFunc) compare_marks, + GINT_TO_POINTER ( + gtk_range_get_inverted (GTK_RANGE (scale)) + )); n = g_slist_length (priv->marks); values = g_new (gdouble, n); diff --git a/modules/engines/ms-windows/msw_style.c b/modules/engines/ms-windows/msw_style.c index 069f531e19..aaaa1fb461 100755 --- a/modules/engines/ms-windows/msw_style.c +++ b/modules/engines/ms-windows/msw_style.c @@ -51,6 +51,9 @@ #endif +#define DETAIL(xx) ((detail) && (!strcmp(xx, detail))) + + /* Default values, not normally used */ static const GtkRequisition default_option_indicator_size = { 9, 8 }; @@ -661,26 +664,27 @@ setup_msw_rc_style (void) gtk_rc_parse_string (buf); /* enable coloring for text on buttons - * TODO: use GetThemeMetric for the border and outside border - * TODO: child-displacement-x & y should be 0 when XP theme is active */ + * TODO: use GetThemeMetric for the border and outside border */ g_snprintf (buf, sizeof (buf), - "style \"msw-button\" = \"msw-default\"\n" - "{\n" - "bg[NORMAL] = { %d, %d, %d }\n" - "bg[PRELIGHT] = { %d, %d, %d }\n" - "bg[INSENSITIVE] = { %d, %d, %d }\n" - "fg[PRELIGHT] = { %d, %d, %d }\n" - "GtkButton::default-border = { 0, 0, 0, 0 }\n" - "GtkButton::default-outside-border = { 0, 0, 0, 0 }\n" - "GtkButton::child-displacement-x = 1\n" - "GtkButton::child-displacement-y = 1\n" - "GtkButton::focus-padding = %d\n" - "}widget_class \"*Button*\" style \"msw-button\"\n", - btn_face.red, btn_face.green, btn_face.blue, - btn_face.red, btn_face.green, btn_face.blue, - btn_face.red, btn_face.green, btn_face.blue, - btn_fore.red, btn_fore.green, btn_fore.blue, - xp_theme_is_active ()? 1 : 2); + "style \"msw-button\" = \"msw-default\"\n" + "{\n" + "bg[NORMAL] = { %d, %d, %d }\n" + "bg[PRELIGHT] = { %d, %d, %d }\n" + "bg[INSENSITIVE] = { %d, %d, %d }\n" + "fg[PRELIGHT] = { %d, %d, %d }\n" + "GtkButton::default-border = { 0, 0, 0, 0 }\n" + "GtkButton::default-outside-border = { 0, 0, 0, 0 }\n" + "GtkButton::child-displacement-x = %d\n" + "GtkButton::child-displacement-y = %d\n" + "GtkWidget::focus-padding = %d\n" + "}widget_class \"*Button*\" style \"msw-button\"\n", + btn_face.red, btn_face.green, btn_face.blue, + btn_face.red, btn_face.green, btn_face.blue, + btn_face.red, btn_face.green, btn_face.blue, + btn_fore.red, btn_fore.green, btn_fore.blue, + xp_theme_is_active ()? 0 : 1, + xp_theme_is_active ()? 0 : 1, + xp_theme_is_active ()? 1 : 2); gtk_rc_parse_string (buf); /* enable coloring for progress bars */ @@ -937,39 +941,6 @@ is_combo_box_child (GtkWidget *w) return FALSE; } -/* This function is not needed anymore */ -/* static gboolean -combo_box_draw_arrow (GtkStyle *style, - GdkWindow *window, - GtkStateType state, - GdkRectangle *area, GtkWidget *widget) -{ - if (xp_theme_is_active ()) - return TRUE; - - if (widget && GTK_IS_TOGGLE_BUTTON (widget->parent)) - { - DWORD border; - RECT rect; - HDC dc; - XpDCInfo dc_info; - - dc = get_window_dc (style, window, state, &dc_info, area->x, area->y, area->width, - area->height, &rect); - border = (GTK_TOGGLE_BUTTON (widget->parent)-> - active ? DFCS_PUSHED | DFCS_FLAT : 0); - - InflateRect (&rect, 1, 1); - DrawFrameControl (dc, &rect, DFC_SCROLL, DFCS_SCROLLDOWN | border); - - release_window_dc (&dc_info); - - return TRUE; - } - - return FALSE; -}*/ - static void draw_part (GdkDrawable *drawable, GdkColor *gc, GdkRectangle *area, gint x, gint y, Part part) @@ -1007,7 +978,7 @@ draw_check (GtkStyle *style, x -= (1 + PART_SIZE - width) / 2; y -= (1 + PART_SIZE - height) / 2; - if (detail && strcmp (detail, "check") == 0) /* Menu item */ + if (DETAIL("check")) /* Menu item */ { if (shadow == GTK_SHADOW_IN) { @@ -1035,7 +1006,7 @@ draw_check (GtkStyle *style, if (!xp_theme_draw (window, theme_elt, style, x, y, width, height, state, area)) { - if (detail && !strcmp (detail, "cellcheck")) + if (DETAIL("cellcheck")) state = GTK_STATE_NORMAL; draw_part (window, &style->black, area, x, y, CHECK_BLACK); @@ -1063,22 +1034,42 @@ draw_check (GtkStyle *style, } static void -draw_expander (GtkStyle *style, - GdkWindow *window, - GtkStateType state, - GdkRectangle *area, - GtkWidget *widget, - const gchar *detail, - gint x, gint y, GtkExpanderStyle expander_style) +draw_expander (GtkStyle *style, + GdkWindow *window, + GtkStateType state, + GdkRectangle *area, + GtkWidget *widget, + const gchar *detail, + gint x, + gint y, + GtkExpanderStyle expander_style) { cairo_t *cr = gdk_cairo_create (window); gint expander_size; gint expander_semi_size; XpThemeElement xp_expander; + GtkOrientation orientation; gtk_widget_style_get (widget, "expander_size", &expander_size, NULL); + if (DETAIL("tool-palette-header")) + { + /* Expanders are usually drawn as little triangles and unfortunately + * do not support rotated drawing modes. So a hack is applied (see + * gtk_tool_item_group_header_expose_event_cb for details) when + * drawing a GtkToolItemGroup's header for horizontal GtkToolShells, + * forcing the triangle to point in the right direction. Except we + * don't draw expanders as triangles on Windows. Usually, expanders + * are represented as "+" and "-". It sucks for "+" to become "-" and + * the inverse when we don't want to, so reverse the hack here. */ + + orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (widget)); + + if (orientation == GTK_ORIENTATION_HORIZONTAL) + expander_style = GTK_EXPANDER_EXPANDED - expander_style; + } + switch (expander_style) { case GTK_EXPANDER_COLLAPSED: @@ -1086,9 +1077,13 @@ draw_expander (GtkStyle *style, xp_expander = XP_THEME_ELEMENT_TREEVIEW_EXPANDER_CLOSED; break; - default: + case GTK_EXPANDER_EXPANDED: + case GTK_EXPANDER_SEMI_EXPANDED: xp_expander = XP_THEME_ELEMENT_TREEVIEW_EXPANDER_OPENED; break; + + default: + g_assert_not_reached (); } if ((expander_size % 2) == 0) @@ -1161,7 +1156,7 @@ draw_option (GtkStyle *style, x -= (1 + PART_SIZE - width) / 2; y -= (1 + PART_SIZE - height) / 2; - if (detail && strcmp (detail, "option") == 0) /* Menu item */ + if (DETAIL("option")) /* Menu item */ { if (shadow == GTK_SHADOW_IN) { @@ -1178,7 +1173,7 @@ draw_option (GtkStyle *style, } else { - if (detail && !strcmp (detail, "cellradio")) + if (DETAIL("cellradio")) state = GTK_STATE_NORMAL; draw_part (window, &style->black, area, x, y, RADIO_BLACK); @@ -1228,12 +1223,17 @@ draw_varrow (GdkWindow *window, y_increment = -1; } - for (i = extra; i < height; i++) - { - _cairo_draw_line (cr, gc, - x + (i - extra), y_start + i * y_increment, - x + width - (i - extra) - 1, y_start + i * y_increment); - } + gdk_cairo_set_source_color (cr, gc); + cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE); + cairo_set_line_width (cr, 1.0); + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); + + cairo_move_to (cr, x + 0.5, y_start + extra * y_increment + 0.5); + cairo_line_to (cr, x + width - 1 + 0.5, y_start + extra * y_increment + 0.5); + cairo_line_to (cr, x + (height - 1 - extra) + 0.5, y_start + (height - 1) * y_increment + 0.5); + cairo_close_path (cr); + cairo_stroke_preserve (cr); + cairo_fill (cr); cairo_destroy(cr); } @@ -1273,12 +1273,17 @@ draw_harrow (GdkWindow *window, x_increment = -1; } - for (i = extra; i < width; i++) - { - _cairo_draw_line (cr, gc, - x_start + i * x_increment, y + (i - extra), - x_start + i * x_increment, y + height - (i - extra) - 1); - } + gdk_cairo_set_source_color (cr, gc); + cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE); + cairo_set_line_width (cr, 1.0); + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); + + cairo_move_to (cr, x_start + extra * x_increment + 0.5, y + 0.5); + cairo_line_to (cr, x_start + extra * x_increment + 0.5, y + height - 1 + 0.5); + cairo_line_to (cr, x_start + (width - 1) * x_increment + 0.5, y + height - (width - 1 - extra) - 1 + 0.5); + cairo_close_path (cr); + cairo_stroke_preserve (cr); + cairo_fill (cr); cairo_destroy(cr); } @@ -1373,7 +1378,7 @@ draw_arrow (GtkStyle *style, if (GTK_IS_ARROW (widget) && is_combo_box_child (widget) && xp_theme_is_active ()) return; - if (detail && strcmp (detail, "spinbutton") == 0) + if (DETAIL("spinbutton")) { if (xp_theme_is_drawable (XP_THEME_ELEMENT_SPIN_BUTTON_UP)) { @@ -1397,8 +1402,7 @@ draw_arrow (GtkStyle *style, return; } - else if (detail && (!strcmp (detail, "vscrollbar") - || !strcmp (detail, "hscrollbar"))) + else if (DETAIL("vscrollbar") || DETAIL("hscrollbar")) { gboolean is_disabled = FALSE; UINT btn_type = 0; @@ -1806,7 +1810,7 @@ draw_box (GtkStyle *style, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height) { - if (is_combo_box_child (widget) && detail && !strcmp (detail, "button")) + if (is_combo_box_child (widget) && DETAIL("button")) { RECT rect; XpDCInfo dc_info; @@ -1836,8 +1840,7 @@ draw_box (GtkStyle *style, } } - if (detail && - (!strcmp (detail, "button") || !strcmp (detail, "buttondefault"))) + if (DETAIL("button") || DETAIL("buttondefault")) { if (GTK_IS_TREE_VIEW (widget->parent) || GTK_IS_CLIST (widget->parent)) { @@ -1891,18 +1894,17 @@ draw_box (GtkStyle *style, return; } - else if (detail && !strcmp (detail, "spinbutton")) + else if (DETAIL("spinbutton")) { if (xp_theme_is_drawable (XP_THEME_ELEMENT_SPIN_BUTTON_UP)) { return; } } - else if (detail && (!strcmp (detail, "spinbutton_up") - || !strcmp (detail, "spinbutton_down"))) + else if (DETAIL("spinbutton_up") || DETAIL("spinbutton_down")) { if (!xp_theme_draw (window, - (!strcmp (detail, "spinbutton_up")) + DETAIL("spinbutton_up") ? XP_THEME_ELEMENT_SPIN_BUTTON_UP : XP_THEME_ELEMENT_SPIN_BUTTON_DOWN, style, x, y, width, height, state_type, area)) @@ -1920,21 +1922,29 @@ draw_box (GtkStyle *style, } return; } - else if (detail && !strcmp (detail, "slider")) + else if (DETAIL("slider")) { if (GTK_IS_SCROLLBAR (widget)) { GtkScrollbar *scrollbar = GTK_SCROLLBAR (widget); - gboolean is_v = GTK_IS_VSCROLLBAR (widget); + GtkOrientation orientation; + gboolean is_vertical; + + orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)); + + if (orientation == GTK_ORIENTATION_VERTICAL) + is_vertical = TRUE; + else + is_vertical = FALSE; if (xp_theme_draw (window, - is_v + is_vertical ? XP_THEME_ELEMENT_SCROLLBAR_V : XP_THEME_ELEMENT_SCROLLBAR_H, style, x, y, width, height, state_type, area)) { XpThemeElement gripper = - (is_v ? XP_THEME_ELEMENT_SCROLLBAR_GRIPPER_V : + (is_vertical ? XP_THEME_ELEMENT_SCROLLBAR_GRIPPER_V : XP_THEME_ELEMENT_SCROLLBAR_GRIPPER_H); /* Do not display grippers on tiny scroll bars, @@ -1965,7 +1975,7 @@ draw_box (GtkStyle *style, } } } - else if (detail && !strcmp (detail, "bar")) + else if (DETAIL("bar")) { if (widget && GTK_IS_PROGRESS_BAR (widget)) { @@ -1982,7 +1992,7 @@ draw_box (GtkStyle *style, shadow_type = GTK_SHADOW_NONE; } } - else if (detail && strcmp (detail, "menuitem") == 0) + else if (DETAIL("menuitem")) { shadow_type = GTK_SHADOW_NONE; if (draw_menu_item (window, widget, style, @@ -1991,7 +2001,7 @@ draw_box (GtkStyle *style, return; } } - else if (detail && !strcmp (detail, "trough")) + else if (DETAIL("trough")) { if (widget && GTK_IS_PROGRESS_BAR (widget)) { @@ -2011,7 +2021,15 @@ draw_box (GtkStyle *style, } else if (widget && GTK_IS_SCROLLBAR (widget)) { - gboolean is_vertical = GTK_IS_VSCROLLBAR (widget); + GtkOrientation orientation; + gboolean is_vertical; + + orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)); + + if (orientation == GTK_ORIENTATION_VERTICAL) + is_vertical = TRUE; + else + is_vertical = FALSE; if (xp_theme_draw (window, is_vertical @@ -2041,7 +2059,9 @@ draw_box (GtkStyle *style, } else if (widget && GTK_IS_SCALE (widget)) { - gboolean is_vertical = GTK_IS_VSCALE (widget); + GtkOrientation orientation; + + orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)); if (!xp_theme_is_active ()) { @@ -2050,7 +2070,7 @@ draw_box (GtkStyle *style, widget, detail, x, y, width, height); } - if (is_vertical) + if (orientation == GTK_ORIENTATION_VERTICAL) { if (xp_theme_draw (window, XP_THEME_ELEMENT_SCALE_TROUGH_V, @@ -2084,7 +2104,7 @@ draw_box (GtkStyle *style, return; } } - else if (detail && strcmp (detail, "optionmenu") == 0) + else if (DETAIL("optionmenu")) { if (xp_theme_draw (window, XP_THEME_ELEMENT_EDIT_TEXT, style, x, y, width, height, state_type, area)) @@ -2092,16 +2112,11 @@ draw_box (GtkStyle *style, return; } } - else if (detail - && (strcmp (detail, "vscrollbar") == 0 - || strcmp (detail, "hscrollbar") == 0)) + else if (DETAIL("vscrollbar") || DETAIL("hscrollbar")) { return; } - else if (detail - && (strcmp (detail, "handlebox_bin") == 0 - || strcmp (detail, "toolbar") == 0 - || strcmp (detail, "menubar") == 0)) + else if (DETAIL("handlebox_bin") || DETAIL("toolbar") || DETAIL("menubar")) { sanitize_size (window, &width, &height); if (xp_theme_draw (window, XP_THEME_ELEMENT_REBAR, @@ -2110,14 +2125,14 @@ draw_box (GtkStyle *style, return; } } - else if (detail && (!strcmp (detail, "handlebox"))) /* grip */ + else if (DETAIL("handlebox")) /* grip */ { if (!xp_theme_is_active ()) { return; } } - else if (detail && !strcmp (detail, "notebook") && GTK_IS_NOTEBOOK (widget)) + else if (DETAIL("notebook") && GTK_IS_NOTEBOOK (widget)) { if (xp_theme_draw (window, XP_THEME_ELEMENT_TAB_PANE, style, x, y, width, height, state_type, area)) @@ -2167,7 +2182,7 @@ draw_box (GtkStyle *style, parent_class->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); - if (detail && strcmp (detail, "optionmenu") == 0) + if (DETAIL("optionmenu")) { GtkRequisition indicator_size; GtkBorder indicator_spacing; @@ -2214,7 +2229,7 @@ draw_tab (GtkStyle *style, g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); - if (detail && !strcmp (detail, "optionmenutab")) + if (DETAIL("optionmenutab")) { if (xp_theme_draw (window, XP_THEME_ELEMENT_COMBOBUTTON, style, x - 5, widget->allocation.y + 1, @@ -2699,14 +2714,14 @@ draw_extension (GtkStyle *style, gint x, gint y, gint width, gint height, GtkPositionType gap_side) { - if (widget && GTK_IS_NOTEBOOK (widget) && detail && !strcmp (detail, "tab")) + if (widget && GTK_IS_NOTEBOOK (widget) && DETAIL("tab")) { GtkNotebook *notebook = GTK_NOTEBOOK (widget); /* draw_themed_tab_button and draw_tab_button expect to work with tab - * position, instead of simply taking the "side of the gap" (gap_side) - * which simply said is the side of the tab that touches the notebook - * frame and is always the exact opposite of the gap side... */ + * position, instead of simply taking the "side of the gap" (gap_side). + * The gap side, simply said, is the side of the tab that touches the notebook + * frame and is always the exact opposite of the tab position... */ int tab_pos = gtk_notebook_get_tab_pos (notebook); if (!draw_themed_tab_button (style, window, state_type, @@ -2743,7 +2758,7 @@ draw_box_gap (GtkStyle *style, gint gap_x, gint gap_width) { - if (GTK_IS_NOTEBOOK (widget) && detail && !strcmp (detail, "notebook")) + if (GTK_IS_NOTEBOOK (widget) && DETAIL("notebook")) { GtkNotebook *notebook = GTK_NOTEBOOK (widget); @@ -2819,7 +2834,7 @@ draw_flat_box (GtkStyle *style, GdkWindow *window, return; } - else if (!strcmp (detail, "checkbutton")) + else if (DETAIL("checkbutton")) { if (state_type == GTK_STATE_PRELIGHT) { @@ -2871,7 +2886,7 @@ draw_shadow (GtkStyle *style, gboolean is_handlebox; gboolean is_toolbar; - if (detail && !strcmp (detail, "frame")) + if (DETAIL("frame")) { HDC dc; @@ -2922,7 +2937,7 @@ draw_shadow (GtkStyle *style, return; } - if (detail && (!strcmp (detail, "entry") || !strcmp (detail, "combobox"))) + if (DETAIL("entry") || DETAIL("combobox")) { if (shadow_type != GTK_SHADOW_IN) return; @@ -2944,17 +2959,17 @@ draw_shadow (GtkStyle *style, return; } - if (detail && !strcmp (detail, "scrolled_window") && + if (DETAIL("scrolled_window") && xp_theme_draw (window, XP_THEME_ELEMENT_EDIT_TEXT, style, x, y, width, height, state_type, area)) { return; } - if (detail && !strcmp (detail, "spinbutton")) + if (DETAIL("spinbutton")) return; - if (detail && !strcmp (detail, "menu")) + if (DETAIL("menu")) { if (draw_menu_border (window, style, x, y, width, height)) { @@ -2962,13 +2977,11 @@ draw_shadow (GtkStyle *style, } } - if (detail && !strcmp (detail, "handlebox")) + if (DETAIL("handlebox")) return; - is_handlebox = (detail && !strcmp (detail, "handlebox_bin")); - is_toolbar = (detail - && (!strcmp (detail, "toolbar") - || !strcmp (detail, "menubar"))); + is_handlebox = (DETAIL("handlebox_bin")); + is_toolbar = (DETAIL("toolbar") || DETAIL("menubar")); if (is_toolbar || is_handlebox) { @@ -3068,7 +3081,7 @@ draw_shadow (GtkStyle *style, return; } - if (detail && !strcmp (detail, "statusbar")) + if (DETAIL("statusbar")) { return; } @@ -3089,7 +3102,7 @@ draw_hline (GtkStyle *style, cr = gdk_cairo_create (window); - if (xp_theme_is_active () && detail && !strcmp (detail, "menuitem")) + if (xp_theme_is_active () && DETAIL("menuitem")) { gint cx, cy; gint new_y, new_height; @@ -3218,7 +3231,7 @@ draw_resize_grip (GtkStyle *style, cr = gdk_cairo_create (window); - if (detail && !strcmp (detail, "statusbar")) + if (DETAIL("statusbar")) { if (xp_theme_draw (window, XP_THEME_ELEMENT_STATUS_GRIPPER, style, x, y, width, @@ -3372,7 +3385,7 @@ draw_layout (GtkStyle *style, * notebook tabs, so we give them a gentle nudge two pixels to the * right. A little hackish, but what are 'ya gonna do? -- Cody */ - if (xp_theme_is_active () && detail && !strcmp (detail, "label")) + if (xp_theme_is_active () && DETAIL("label")) { if (widget->parent != NULL) { diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c index 14a1b5d055..59914ba2ae 100644 --- a/modules/printbackends/cups/gtkprintbackendcups.c +++ b/modules/printbackends/cups/gtkprintbackendcups.c @@ -483,22 +483,68 @@ cups_print_cb (GtkPrintBackendCups *print_backend, GDK_THREADS_LEAVE (); } +typedef struct { + GtkCupsRequest *request; + GtkPrinterCups *printer; +} CupsOptionsData; + static void add_cups_options (const gchar *key, const gchar *value, gpointer user_data) { - GtkCupsRequest *request = user_data; + CupsOptionsData *data = (CupsOptionsData *) user_data; + GtkCupsRequest *request = data->request; + GtkPrinterCups *printer = data->printer; + gboolean custom_value = FALSE; + gchar *new_value = NULL; + gint i; + + if (!key || !value) + return; if (!g_str_has_prefix (key, "cups-")) return; if (strcmp (value, "gtk-ignore-value") == 0) return; - + key = key + strlen ("cups-"); - gtk_cups_request_encode_option (request, key, value); + if (printer && printer->ppd_file) + { + ppd_coption_t *coption; + gboolean found = FALSE; + gboolean custom_values_enabled = FALSE; + + coption = ppdFindCustomOption (printer->ppd_file, key); + if (coption && coption->option) + { + for (i = 0; i < coption->option->num_choices; i++) + { + /* Are custom values enabled ? */ + if (g_str_equal (coption->option->choices[i].choice, "Custom")) + custom_values_enabled = TRUE; + + /* Is the value among available choices ? */ + if (g_str_equal (coption->option->choices[i].choice, value)) + found = TRUE; + } + + if (custom_values_enabled && !found) + custom_value = TRUE; + } + } + + /* Add "Custom." prefix to custom values. */ + if (custom_value) + { + new_value = g_strdup_printf ("Custom.%s", value); + gtk_cups_request_encode_option (request, key, new_value); + g_free (new_value); + } + else + gtk_cups_request_encode_option (request, key, value); } static void @@ -511,6 +557,7 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend, { GtkPrinterCups *cups_printer; CupsPrintStreamData *ps; + CupsOptionsData *options_data; GtkCupsRequest *request; GtkPrintSettings *settings; const gchar *title; @@ -558,8 +605,12 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend, IPP_TAG_NAME, "job-name", NULL, title); - gtk_print_settings_foreach (settings, add_cups_options, request); - + options_data = g_new0 (CupsOptionsData, 1); + options_data->request = request; + options_data->printer = cups_printer; + gtk_print_settings_foreach (settings, add_cups_options, options_data); + g_free (options_data); + ps = g_new0 (CupsPrintStreamData, 1); ps->callback = callback; ps->user_data = user_data; @@ -3329,7 +3380,18 @@ create_pickone_option (ppd_file_t *ppd_file, option->choices_display[i] = get_choice_text (ppd_file, available[i]); } } - gtk_printer_option_set (option, ppd_option->defchoice); + + if (option->type != GTK_PRINTER_OPTION_TYPE_PICKONE) + { + if (g_str_has_prefix (ppd_option->defchoice, "Custom.")) + gtk_printer_option_set (option, ppd_option->defchoice + 7); + else + gtk_printer_option_set (option, ppd_option->defchoice); + } + else + { + gtk_printer_option_set (option, ppd_option->defchoice); + } } #ifdef PRINT_IGNORED_OPTIONS else @@ -4557,7 +4619,12 @@ cups_printer_get_default_page_size (GtkPrinter *printer) return NULL; option = ppdFindOption (ppd_file, "PageSize"); + if (option == NULL) + return NULL; + size = ppdPageSize (ppd_file, option->defchoice); + if (size == NULL) + return NULL; return create_page_setup (ppd_file, size); } diff --git a/tests/testmerge.c b/tests/testmerge.c index a9b1222d25..64baf639a3 100644 --- a/tests/testmerge.c +++ b/tests/testmerge.c @@ -209,11 +209,11 @@ enum { static GtkRadioActionEntry radio_entries[] = { { "justify-left", GTK_STOCK_JUSTIFY_LEFT, NULL, "<control>L", "Left justify the text", JUSTIFY_LEFT }, - { "justify-center", GTK_STOCK_JUSTIFY_CENTER, NULL, "<control>E", + { "justify-center", GTK_STOCK_JUSTIFY_CENTER, NULL, "<super>E", "Center justify the text", JUSTIFY_CENTER }, - { "justify-right", GTK_STOCK_JUSTIFY_RIGHT, NULL, "<control>R", + { "justify-right", GTK_STOCK_JUSTIFY_RIGHT, NULL, "<hyper>R", "Right justify the text", JUSTIFY_RIGHT }, - { "justify-fill", GTK_STOCK_JUSTIFY_FILL, NULL, "<control>J", + { "justify-fill", GTK_STOCK_JUSTIFY_FILL, NULL, "<super><hyper>J", "Fill justify the text", JUSTIFY_FILL }, }; static guint n_radio_entries = G_N_ELEMENTS (radio_entries); |