From 530224a7628bb0e6364baed62b47aa280b518fba Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 2 Nov 2009 04:22:13 +0000 Subject: [PATCH] Copy F12 work over --- allow-set-hint.patch | 11 + appearance-crash.patch | 24 - compose-sequences.patch | 271 ++++ csw-fixes.patch | 183 --- dont-use-deprecated-api.patch | 150 -- entry-include-fix.patch | 13 - fix-anchors.patch | 94 -- fresh-tooltips.patch | 374 +++++ gdm-background.patch | 30 - gtk-bell.patch | 12 - gtk2-fix-install.patch | 24 - gtk2-printing-nonblocking-printer-list.patch | 212 --- gtk2-printing-smb-auth.patch | 770 ---------- gtk2.spec | 108 +- icon-padding.patch | 261 ++++ iconview-crash.patch | 23 - iconview-hang.patch | 15 + image-size-alloc.patch | 73 + print_authentication.patch | 1389 ------------------ root-event-mask.patch | 17 - set-cursor.patch | 15 - symbolic-color-parsing.patch | 160 ++ toolbutton-assert.patch | 23 + tooltip-positioning.patch | 190 +++ 24 files changed, 1468 insertions(+), 2974 deletions(-) create mode 100644 allow-set-hint.patch delete mode 100644 appearance-crash.patch create mode 100644 compose-sequences.patch delete mode 100644 csw-fixes.patch delete mode 100644 dont-use-deprecated-api.patch delete mode 100644 entry-include-fix.patch delete mode 100644 fix-anchors.patch create mode 100644 fresh-tooltips.patch delete mode 100644 gdm-background.patch delete mode 100644 gtk-bell.patch delete mode 100644 gtk2-fix-install.patch delete mode 100644 gtk2-printing-nonblocking-printer-list.patch delete mode 100644 gtk2-printing-smb-auth.patch create mode 100644 icon-padding.patch delete mode 100644 iconview-crash.patch create mode 100644 iconview-hang.patch create mode 100644 image-size-alloc.patch delete mode 100644 print_authentication.patch delete mode 100644 root-event-mask.patch delete mode 100644 set-cursor.patch create mode 100644 symbolic-color-parsing.patch create mode 100644 toolbutton-assert.patch create mode 100644 tooltip-positioning.patch diff --git a/allow-set-hint.patch b/allow-set-hint.patch new file mode 100644 index 0000000..94bccfe --- /dev/null +++ b/allow-set-hint.patch @@ -0,0 +1,11 @@ +--- gtk+-2.18.3/gtk/gtkwindow.c 2009-10-09 01:00:44.000000000 -0400 ++++ hacked/gtk/gtkwindow.c 2009-10-28 11:45:33.583105288 -0400 +@@ -2414,7 +2414,7 @@ + GtkWindowPrivate *priv; + + g_return_if_fail (GTK_IS_WINDOW (window)); +- g_return_if_fail (!GTK_WIDGET_VISIBLE (window)); ++ g_return_if_fail (!GTK_WIDGET_MAPPED (window)); + + priv = GTK_WINDOW_GET_PRIVATE (window); + diff --git a/appearance-crash.patch b/appearance-crash.patch deleted file mode 100644 index d90a24b..0000000 --- a/appearance-crash.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -up gtk+-2.17.7/gtk/gtkiconview.c.appearance-crash gtk+-2.17.7/gtk/gtkiconview.c ---- gtk+-2.17.7/gtk/gtkiconview.c.appearance-crash 2009-08-13 10:03:01.717854077 -0400 -+++ gtk+-2.17.7/gtk/gtkiconview.c 2009-08-13 10:03:31.483855146 -0400 -@@ -3498,16 +3498,16 @@ gtk_icon_view_get_item_at_coords (GtkIco - { - if (cell_at_pos) - *cell_at_pos = info; -- -+ - return item; - } - } - -- if (only_in_cell) -- return NULL; -- - if (cell_at_pos) - *cell_at_pos = NULL; -+ -+ if (only_in_cell) -+ return NULL; - } - - return item; diff --git a/compose-sequences.patch b/compose-sequences.patch new file mode 100644 index 0000000..dffd1c9 --- /dev/null +++ b/compose-sequences.patch @@ -0,0 +1,271 @@ +From 4eb82ed9624da58cff9dd6c348b12d35967ae3c3 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Thu, 22 Oct 2009 15:25:19 +1000 +Subject: [PATCH] Update compose sequences + +Signed-off-by: Peter Hutterer +--- + gtk/gtkimcontextsimple.c | 2 +- + gtk/gtkimcontextsimpleseqs.h | 91 +++++++++++++++++++++++++++-------------- + 2 files changed, 61 insertions(+), 32 deletions(-) + +diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c +index 62bab7c..f36dcf5 100644 +--- a/gtk/gtkimcontextsimple.c ++++ b/gtk/gtkimcontextsimple.c +@@ -61,7 +61,7 @@ struct _GtkComposeTableCompact + static const GtkComposeTableCompact gtk_compose_table_compact = { + gtk_compose_seqs_compact, + 5, +- 23, ++ 24, + 6 + }; + +diff --git a/gtk/gtkimcontextsimpleseqs.h b/gtk/gtkimcontextsimpleseqs.h +index 9e3fc29..131b3db 100644 +--- a/gtk/gtkimcontextsimpleseqs.h ++++ b/gtk/gtkimcontextsimpleseqs.h +@@ -18,10 +18,9 @@ + */ + + /* +- * File auto-generated from script found at gtk/compose-parse.py, with the --gtk parameter, ++ * File auto-generated from script found at http://bugzilla.gnome.org/show_bug.cgi?id=321896 + * using the input files + * Input : http://gitweb.freedesktop.org/?p=xorg/lib/libX11.git;a=blob_plain;f=nls/en_US.UTF-8/Compose.pre +- * Input : http://svn.gnome.org/viewcvs/gtk%2B/trunk/gtk/gtk-compose-lookaside.txt + * Input : http://www.cl.cam.ac.uk/~mgk25/ucs/keysyms.txt + * Input : http://www.unicode.org/Public/UNIDATA/UnicodeData.txt + * +@@ -68,29 +67,30 @@ + */ + + static const guint16 gtk_compose_seqs_compact[] = { +-GDK_dead_stroke, 138, 226, 235, 235, 235, +-GDK_Greek_accentdieresis, 235, 239, 239, 239, 239, +-GDK_dead_grave, 239, 299, 386, 598, 598, +-GDK_dead_acute, 598, 664, 760, 1036, 1036, +-GDK_dead_circumflex, 1036, 1176, 1176, 1376, 1376, +-GDK_dead_tilde, 1376, 1458, 1521, 1661, 1661, +-GDK_dead_macron, 1661, 1707, 1707, 1779, 1779, +-GDK_dead_breve, 1779, 1833, 1833, 1857, 1857, +-GDK_dead_abovedot, 1857, 1887, 1890, 1922, 1922, +-GDK_dead_diaeresis, 1922, 2010, 2019, 2043, 2043, +-GDK_dead_abovering, 2043, 2053, 2053, 2053, 2053, +-GDK_dead_doubleacute, 2053, 2063, 2063, 2063, 2063, +-GDK_dead_caron, 2063, 2089, 2089, 2097, 2097, +-GDK_dead_cedilla, 2097, 2111, 2111, 2111, 2111, +-GDK_dead_ogonek, 2111, 2121, 2121, 2121, 2121, +-GDK_dead_iota, 2121, 2143, 2242, 2674, 3334, +-GDK_dead_voiced_sound, 3334, 3380, 3380, 3380, 3380, +-GDK_dead_semivoiced_sound, 3380, 3390, 3390, 3390, 3390, +-GDK_dead_belowdot, 3390, 3400, 3400, 3416, 3416, +-GDK_dead_hook, 3416, 3494, 3494, 3550, 3550, +-GDK_dead_psili, 3550, 3578, 3578, 3578, 3578, +-GDK_dead_dasia, 3578, 3610, 3610, 3610, 3610, +-GDK_Multi_key, 3610, 3610, 9589, 13297, 15157, ++GDK_dead_stroke, 144, 232, 241, 241, 241, ++GDK_Greek_accentdieresis, 241, 245, 245, 245, 245, ++GDK_dead_grave, 245, 307, 394, 606, 606, ++GDK_dead_acute, 606, 674, 770, 1046, 1046, ++GDK_dead_circumflex, 1046, 1186, 1186, 1386, 1386, ++GDK_dead_tilde, 1386, 1470, 1533, 1673, 1673, ++GDK_dead_macron, 1673, 1719, 1719, 1791, 1791, ++GDK_dead_breve, 1791, 1845, 1845, 1869, 1869, ++GDK_dead_abovedot, 1869, 1899, 1902, 1934, 1934, ++GDK_dead_diaeresis, 1934, 2022, 2031, 2055, 2055, ++GDK_dead_abovering, 2055, 2065, 2065, 2065, 2065, ++GDK_dead_doubleacute, 2065, 2075, 2075, 2075, 2075, ++GDK_dead_caron, 2075, 2121, 2121, 2129, 2129, ++GDK_dead_cedilla, 2129, 2143, 2143, 2143, 2143, ++GDK_dead_ogonek, 2143, 2153, 2153, 2153, 2153, ++GDK_dead_iota, 2153, 2175, 2274, 2706, 3366, ++GDK_dead_voiced_sound, 3366, 3412, 3412, 3412, 3412, ++GDK_dead_semivoiced_sound, 3412, 3422, 3422, 3422, 3422, ++GDK_dead_belowdot, 3422, 3438, 3438, 3454, 3454, ++GDK_dead_hook, 3454, 3532, 3532, 3588, 3588, ++GDK_dead_horn, 3588, 3598, 3598, 3598, 3598, ++GDK_dead_psili, 3598, 3626, 3626, 3626, 3626, ++GDK_dead_dasia, 3626, 3658, 3658, 3658, 3658, ++GDK_Multi_key, 3658, 3658, 9658, 13366, 15231, + GDK_space, 0x002F, + GDK_2, 0x01BB, + GDK_A, 0x023A, +@@ -143,6 +143,7 @@ GDK_Greek_upsilon, 0x03B0, + GDK_space, 0x0060, + GDK_V, 0x01DB, + GDK_v, 0x01DC, ++GDK_nobreakspace, 0x0300, + GDK_Abreve, 0x1EB0, + GDK_abreve, 0x1EB1, + GDK_Emacron, 0x1E14, +@@ -255,6 +256,7 @@ GDK_Multi_key, GDK_macron, GDK_o, 0x1E51, + GDK_space, 0x0027, + GDK_V, 0x01D7, + GDK_v, 0x01D8, ++GDK_nobreakspace, 0x0301, + GDK_Abreve, 0x1EAE, + GDK_abreve, 0x1EAF, + GDK_Emacron, 0x1E16, +@@ -510,6 +512,7 @@ GDK_space, 0x007E, + GDK_less, 0x2272, + GDK_equal, 0x2243, + GDK_greater, 0x2273, ++GDK_nobreakspace, 0x0303, + GDK_Oacute, 0x1E4C, + GDK_Odiaeresis, 0x1E4E, + GDK_Uacute, 0x1E78, +@@ -769,6 +772,16 @@ GDK_parenleft, 0x208D, + GDK_parenright, 0x208E, + GDK_plus, 0x208A, + GDK_minus, 0x208B, ++GDK_0, 0x2080, ++GDK_1, 0x2081, ++GDK_2, 0x2082, ++GDK_3, 0x2083, ++GDK_4, 0x2084, ++GDK_5, 0x2085, ++GDK_6, 0x2086, ++GDK_7, 0x2087, ++GDK_8, 0x2088, ++GDK_9, 0x2088, + GDK_equal, 0x208C, + GDK_V, 0x01D9, + GDK_v, 0x01DA, +@@ -1103,11 +1116,14 @@ GDK_kana_HI, 0x30D4, + GDK_kana_FU, 0x30D7, + GDK_kana_HE, 0x30DA, + GDK_kana_HO, 0x30DD, ++GDK_space, 0x0323, + GDK_plus, 0x2A25, + GDK_minus, 0x2A2A, + GDK_equal, 0x2A66, ++GDK_nobreakspace, 0x0323, + GDK_Abreve, 0x1EB6, + GDK_abreve, 0x1EB7, ++GDK_dead_belowdot, 0x0323, + GDK_Multi_key, GDK_plus, GDK_O, 0x1EE2, + GDK_Multi_key, GDK_plus, GDK_U, 0x1EF0, + GDK_Multi_key, GDK_plus, GDK_o, 0x1EE3, +@@ -1165,6 +1181,11 @@ GDK_Multi_key, GDK_asciicircum, GDK_e, 0x1EC3, + GDK_Multi_key, GDK_asciicircum, GDK_o, 0x1ED5, + GDK_Multi_key, GDK_b, GDK_A, 0x1EB2, + GDK_Multi_key, GDK_b, GDK_a, 0x1EB3, ++GDK_space, 0x031B, ++GDK_nobreakspace, 0x031B, ++GDK_Utilde, 0x1EEE, ++GDK_utilde, 0x1EEF, ++GDK_dead_horn, 0x031B, + GDK_Greek_ALPHA, 0x1F08, + GDK_Greek_EPSILON, 0x1F18, + GDK_Greek_ETA, 0x1F28, +@@ -1368,7 +1389,7 @@ GDK_apostrophe, GDK_Idiaeresis, 0x1E2E, + GDK_apostrophe, GDK_Ocircumflex, 0x1ED0, + GDK_apostrophe, GDK_Otilde, 0x1E4C, + GDK_apostrophe, GDK_Ooblique, 0x01FE, +-GDK_apostrophe, 0x00DC, 0x01D7, ++GDK_apostrophe, GDK_Udiaeresis, 0x01D7, + GDK_apostrophe, GDK_acircumflex, 0x1EA5, + GDK_apostrophe, GDK_aring, 0x01FB, + GDK_apostrophe, GDK_ae, 0x01FD, +@@ -1529,6 +1550,7 @@ GDK_minus, GDK_parenright, 0x007D, + GDK_minus, GDK_plus, 0x00B1, + GDK_minus, GDK_comma, 0x00AC, + GDK_minus, GDK_colon, 0x00F7, ++GDK_minus, GDK_greater, 0x2192, + GDK_minus, GDK_A, 0x00C3, + GDK_minus, GDK_D, 0x0110, + GDK_minus, GDK_E, 0x0112, +@@ -1603,6 +1625,7 @@ GDK_period, 0x1E62, 0x1E68, + GDK_period, 0x1E63, 0x1E69, + GDK_slash, GDK_slash, 0x005C, + GDK_slash, GDK_less, 0x005C, ++GDK_slash, GDK_equal, 0x2260, + GDK_slash, GDK_C, 0x00A2, + GDK_slash, GDK_D, 0x0110, + GDK_slash, GDK_G, 0x01E4, +@@ -1682,8 +1705,11 @@ GDK_semicolon, GDK_u, 0x0173, + GDK_less, GDK_space, 0x02C7, + GDK_less, GDK_quotedbl, 0x201C, + GDK_less, GDK_apostrophe, 0x2018, ++GDK_less, GDK_minus, 0x2190, + GDK_less, GDK_slash, 0x005C, ++GDK_less, GDK_3, 0x2665, + GDK_less, GDK_less, 0x00AB, ++GDK_less, GDK_equal, 0x2264, + GDK_less, GDK_C, 0x010C, + GDK_less, GDK_D, 0x010E, + GDK_less, GDK_E, 0x011A, +@@ -1703,6 +1729,7 @@ GDK_less, GDK_s, 0x0161, + GDK_less, GDK_t, 0x0165, + GDK_less, GDK_z, 0x017E, + GDK_less, 0x0338, 0x226E, ++GDK_equal, GDK_slash, 0x2260, + GDK_equal, GDK_C, 0x20AC, + GDK_equal, GDK_E, 0x20AC, + GDK_equal, GDK_L, 0x00A3, +@@ -1725,6 +1752,7 @@ GDK_equal, GDK_Cyrillic_U, 0x04F2, + GDK_greater, GDK_space, 0x005E, + GDK_greater, GDK_quotedbl, 0x201D, + GDK_greater, GDK_apostrophe, 0x2019, ++GDK_greater, GDK_equal, 0x2265, + GDK_greater, GDK_greater, 0x00BB, + GDK_greater, GDK_A, 0x00C2, + GDK_greater, GDK_E, 0x00CA, +@@ -2068,7 +2096,7 @@ GDK_underscore, GDK_Adiaeresis, 0x01DE, + GDK_underscore, GDK_AE, 0x01E2, + GDK_underscore, GDK_Otilde, 0x022C, + GDK_underscore, GDK_Odiaeresis, 0x022A, +-GDK_underscore, 0x00DC, 0x01D5, ++GDK_underscore, GDK_Udiaeresis, 0x01D5, + GDK_underscore, GDK_adiaeresis, 0x01DF, + GDK_underscore, GDK_ae, 0x01E3, + GDK_underscore, GDK_otilde, 0x022D, +@@ -2128,7 +2156,7 @@ GDK_grave, GDK_y, 0x1EF3, + GDK_grave, GDK_Acircumflex, 0x1EA6, + GDK_grave, GDK_Ecircumflex, 0x1EC0, + GDK_grave, GDK_Ocircumflex, 0x1ED2, +-GDK_grave, 0x00DC, 0x01DB, ++GDK_grave, GDK_Udiaeresis, 0x01DB, + GDK_grave, GDK_acircumflex, 0x1EA7, + GDK_grave, GDK_ecircumflex, 0x1EC1, + GDK_grave, GDK_ocircumflex, 0x1ED3, +@@ -2279,7 +2307,7 @@ GDK_c, GDK_t, 0x0165, + GDK_c, GDK_u, 0x01D4, + GDK_c, GDK_z, 0x017E, + GDK_c, GDK_bar, 0x00A2, +-GDK_c, 0x00DC, 0x01D9, ++GDK_c, GDK_Udiaeresis, 0x01D9, + GDK_c, GDK_udiaeresis, 0x01DA, + GDK_c, 0x01B7, 0x01EE, + GDK_c, 0x0292, 0x01EF, +@@ -2517,7 +2545,7 @@ GDK_macron, GDK_Adiaeresis, 0x01DE, + GDK_macron, GDK_AE, 0x01E2, + GDK_macron, GDK_Otilde, 0x022C, + GDK_macron, GDK_Odiaeresis, 0x022A, +-GDK_macron, 0x00DC, 0x01D5, ++GDK_macron, GDK_Udiaeresis, 0x01D5, + GDK_macron, GDK_adiaeresis, 0x01DF, + GDK_macron, GDK_ae, 0x01E3, + GDK_macron, GDK_otilde, 0x022D, +@@ -2586,7 +2614,7 @@ GDK_acute, GDK_Idiaeresis, 0x1E2E, + GDK_acute, GDK_Ocircumflex, 0x1ED0, + GDK_acute, GDK_Otilde, 0x1E4C, + GDK_acute, GDK_Ooblique, 0x01FE, +-GDK_acute, 0x00DC, 0x01D7, ++GDK_acute, GDK_Udiaeresis, 0x01D7, + GDK_acute, GDK_acircumflex, 0x1EA5, + GDK_acute, GDK_aring, 0x01FB, + GDK_acute, GDK_ae, 0x01FD, +@@ -4320,6 +4348,7 @@ GDK_parenleft, GDK_KP_4, GDK_KP_7, GDK_parenright, 0x32BC, + GDK_parenleft, GDK_KP_4, GDK_KP_8, GDK_parenright, 0x32BD, + GDK_parenleft, GDK_KP_4, GDK_KP_9, GDK_parenright, 0x32BE, + GDK_parenleft, GDK_KP_5, GDK_KP_0, GDK_parenright, 0x32BF, ++GDK_C, GDK_C, GDK_C, GDK_P, 0x262D, + GDK_Greek_iota, GDK_apostrophe, GDK_parenleft, GDK_Greek_ALPHA, 0x1F8D, + GDK_Greek_iota, GDK_apostrophe, GDK_parenleft, GDK_Greek_ETA, 0x1F9D, + GDK_Greek_iota, GDK_apostrophe, GDK_parenleft, GDK_Greek_OMEGA, 0x1FAD, +-- +1.6.5.rc2 + diff --git a/csw-fixes.patch b/csw-fixes.patch deleted file mode 100644 index bb280e3..0000000 --- a/csw-fixes.patch +++ /dev/null @@ -1,183 +0,0 @@ -diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c -index 869d535..44652bc 100644 ---- a/gdk/gdkdraw.c -+++ b/gdk/gdkdraw.c -@@ -752,9 +752,6 @@ gdk_draw_image (GdkDrawable *drawable, - * On older X servers, rendering pixbufs with an alpha channel involves round - * trips to the X server, and may be somewhat slow. - * -- * The clip mask of @gc is ignored, but clip rectangles and clip regions work -- * fine. -- * - * If GDK is built with the Sun mediaLib library, the gdk_draw_pixbuf - * function is accelerated using mediaLib, which provides hardware - * acceleration on Intel, AMD, and Sparc chipsets. If desired, mediaLib -diff --git a/gdk/gdkgc.c b/gdk/gdkgc.c -index b4c6f81..699cebf 100644 ---- a/gdk/gdkgc.c -+++ b/gdk/gdkgc.c -@@ -646,24 +646,49 @@ _gdk_gc_add_drawable_clip (GdkGC *gc, - GdkPixmap *new_mask; - GdkGC *tmp_gc; - GdkColor black = {0, 0, 0, 0}; -+ GdkRectangle r; -+ GdkOverlapType overlap; - -- priv->old_clip_mask = g_object_ref (priv->clip_mask); -- gdk_drawable_get_size (priv->old_clip_mask, &w, &h); -- -- new_mask = gdk_pixmap_new (priv->old_clip_mask, w, h, -1); -- tmp_gc = _gdk_drawable_get_scratch_gc ((GdkDrawable *)new_mask, FALSE); -- -- gdk_gc_set_foreground (tmp_gc, &black); -- gdk_draw_rectangle (new_mask, tmp_gc, TRUE, 0, 0, -1, -1); -- _gdk_gc_set_clip_region_internal (tmp_gc, region, TRUE); /* Takes ownership of region */ -- gdk_draw_drawable (new_mask, -- tmp_gc, -- priv->old_clip_mask, -- 0, 0, -- 0, 0, -- -1, -1); -- gdk_gc_set_clip_region (tmp_gc, NULL); -- gdk_gc_set_clip_mask (gc, new_mask); -+ gdk_drawable_get_size (priv->clip_mask, &w, &h); -+ -+ r.x = 0; -+ r.y = 0; -+ r.width = w; -+ r.height = h; -+ -+ /* Its quite common to expose areas that are completely in or outside -+ * the region, so we try to avoid allocating bitmaps that are just fully -+ * set or completely unset. -+ */ -+ overlap = gdk_region_rect_in (region, &r); -+ if (overlap == GDK_OVERLAP_RECTANGLE_PART) -+ { -+ /* The region and the mask intersect, create a new clip mask that -+ includes both areas */ -+ priv->old_clip_mask = g_object_ref (priv->clip_mask); -+ new_mask = gdk_pixmap_new (priv->old_clip_mask, w, h, -1); -+ tmp_gc = _gdk_drawable_get_scratch_gc ((GdkDrawable *)new_mask, FALSE); -+ -+ gdk_gc_set_foreground (tmp_gc, &black); -+ gdk_draw_rectangle (new_mask, tmp_gc, TRUE, 0, 0, -1, -1); -+ _gdk_gc_set_clip_region_internal (tmp_gc, region, TRUE); /* Takes ownership of region */ -+ gdk_draw_drawable (new_mask, -+ tmp_gc, -+ priv->old_clip_mask, -+ 0, 0, -+ 0, 0, -+ -1, -1); -+ gdk_gc_set_clip_region (tmp_gc, NULL); -+ gdk_gc_set_clip_mask (gc, new_mask); -+ } -+ else if (overlap == GDK_OVERLAP_RECTANGLE_OUT) -+ { -+ GdkRegion *empty = gdk_region_new (); -+ -+ priv->old_clip_mask = g_object_ref (priv->clip_mask); -+ _gdk_windowing_gc_set_clip_region (gc, empty, FALSE); -+ gdk_region_destroy (empty); -+ } - } - else - { -@@ -775,6 +800,24 @@ _gdk_gc_get_clip_region (GdkGC *gc) - } - - /** -+ * _gdk_gc_get_clip_mask: -+ * @gc: a #GdkGC -+ * -+ * Gets the current clip mask for @gc, if any. -+ * -+ * Return value: the clip mask for the GC, or %NULL. -+ * (if a clip region is set, the return will be %NULL) -+ * This value is owned by the GC and must not be freed. -+ **/ -+GdkBitmap * -+_gdk_gc_get_clip_mask (GdkGC *gc) -+{ -+ g_return_val_if_fail (GDK_IS_GC (gc), NULL); -+ -+ return GDK_GC_GET_PRIVATE (gc)->clip_mask; -+} -+ -+/** - * _gdk_gc_get_fill: - * @gc: a #GdkGC - * -diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h -index 946c3f9..c984386 100644 ---- a/gdk/gdkinternals.h -+++ b/gdk/gdkinternals.h -@@ -399,6 +399,7 @@ void _gdk_gc_init (GdkGC *gc, - GdkGCValuesMask values_mask); - - GdkRegion *_gdk_gc_get_clip_region (GdkGC *gc); -+GdkBitmap *_gdk_gc_get_clip_mask (GdkGC *gc); - gboolean _gdk_gc_get_exposures (GdkGC *gc); - GdkFill _gdk_gc_get_fill (GdkGC *gc); - GdkPixmap *_gdk_gc_get_tile (GdkGC *gc); -diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c -index 6e72cab..d9b1e5b 100644 ---- a/gdk/gdkwindow.c -+++ b/gdk/gdkwindow.c -@@ -639,7 +639,12 @@ remove_child_area (GdkWindowObject *private, - child_region = gdk_region_rectangle (&r); - - if (child->shape) -- gdk_region_intersect (child_region, child->shape); -+ { -+ /* Adjust shape region to parent window coords */ -+ gdk_region_offset (child->shape, child->x, child->y); -+ gdk_region_intersect (child_region, child->shape); -+ gdk_region_offset (child->shape, -child->x, -child->y); -+ } - else if (private->window_type == GDK_WINDOW_FOREIGN) - { - shape = _gdk_windowing_window_get_shape ((GdkWindow *)child); -@@ -4660,7 +4665,12 @@ _gdk_window_process_updates_recurse (GdkWindow *window, - - child_region = gdk_region_rectangle (&r); - if (child->shape) -- gdk_region_intersect (child_region, child->shape); -+ { -+ /* Adjust shape region to parent window coords */ -+ gdk_region_offset (child->shape, child->x, child->y); -+ gdk_region_intersect (child_region, child->shape); -+ gdk_region_offset (child->shape, -child->x, -child->y); -+ } - - if (child->impl == private->impl) - { -diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c -index 537a47e..b2cac29 100644 ---- a/gdk/x11/gdkdrawable-x11.c -+++ b/gdk/x11/gdkdrawable-x11.c -@@ -388,9 +388,22 @@ gdk_x11_drawable_update_picture_clip (GdkDrawable *drawable, - else - { - XRenderPictureAttributes pa; -- pa.clip_mask = None; -+ GdkBitmap *mask; -+ gulong pa_mask; -+ -+ pa_mask = CPClipMask; -+ if (gc && (mask = _gdk_gc_get_clip_mask (gc))) -+ { -+ pa.clip_mask = GDK_PIXMAP_XID (mask); -+ pa.clip_x_origin = gc->clip_x_origin; -+ pa.clip_y_origin = gc->clip_y_origin; -+ pa_mask |= CPClipXOrigin | CPClipYOrigin; -+ } -+ else -+ pa.clip_mask = None; -+ - XRenderChangePicture (xdisplay, picture, -- CPClipMask, &pa); -+ pa_mask, &pa); - } - } - diff --git a/dont-use-deprecated-api.patch b/dont-use-deprecated-api.patch deleted file mode 100644 index c9135fa..0000000 --- a/dont-use-deprecated-api.patch +++ /dev/null @@ -1,150 +0,0 @@ -diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c -index 555418a..2a84a48 100644 ---- a/gtk/gtkcombobox.c -+++ b/gtk/gtkcombobox.c -@@ -1695,7 +1695,7 @@ cell_view_is_sensitive (GtkCellView *cell_view) - GList *cells, *list; - gboolean sensitive; - -- cells = gtk_cell_view_get_cell_renderers (cell_view); -+ cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (cell_view)); - - sensitive = FALSE; - for (list = cells; list; list = list->next) -@@ -1732,7 +1732,7 @@ tree_column_row_is_sensitive (GtkComboBox *combo_box, - priv->model, - iter, FALSE, FALSE); - -- cells = gtk_tree_view_column_get_cell_renderers (priv->column); -+ cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (priv->column)); - - sensitive = FALSE; - for (list = cells; list; list = list->next) -@@ -4097,7 +4097,7 @@ gtk_combo_box_list_select_func (GtkTreeSelection *selection, - gtk_tree_view_column_cell_set_cell_data (column, model, &iter, - FALSE, FALSE); - -- cell = cells = gtk_tree_view_column_get_cell_renderers (column); -+ cell = cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); - while (cell) - { - g_object_get (cell->data, -diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c -index e2e0142..a3a01be 100644 ---- a/gtk/gtkentrycompletion.c -+++ b/gtk/gtkentrycompletion.c -@@ -758,7 +758,7 @@ gtk_entry_completion_get_cells (GtkCellLayout *cell_layout) - - priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (cell_layout); - -- return gtk_tree_view_column_get_cell_renderers (priv->column); -+ return gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (priv->column)); - } - - /* all those callbacks */ -@@ -1486,7 +1486,7 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion) - completion->priv->ignore_enter = TRUE; - - column = gtk_tree_view_get_column (GTK_TREE_VIEW (completion->priv->action_view), 0); -- renderers = gtk_tree_view_column_get_cell_renderers (column); -+ renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); - gtk_widget_ensure_style (completion->priv->tree_view); - g_object_set (GTK_CELL_RENDERER (renderers->data), "cell-background-gdk", - &completion->priv->tree_view->style->bg[GTK_STATE_NORMAL], -diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c -index 22836c1..7dc9867 100644 ---- a/gtk/gtkfilechooserdefault.c -+++ b/gtk/gtkfilechooserdefault.c -@@ -3707,7 +3707,7 @@ rename_selected_bookmark (GtkFileChooserDefault *impl) - { - path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter); - column = gtk_tree_view_get_column (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), 0); -- renderers = gtk_tree_view_column_get_cell_renderers (column); -+ renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); - cell = g_list_nth_data (renderers, 1); - g_list_free (renderers); - g_object_set (cell, "editable", TRUE, NULL); -diff --git a/gtk/tests/builder.c b/gtk/tests/builder.c -index 3dbf40d..224660d 100644 ---- a/gtk/tests/builder.c -+++ b/gtk/tests/builder.c -@@ -1147,7 +1147,7 @@ test_treeview_column (void) - g_assert (GTK_IS_TREE_VIEW_COLUMN (column)); - g_assert (strcmp (gtk_tree_view_column_get_title (column), "Test") == 0); - -- renderers = gtk_tree_view_column_get_cell_renderers (column); -+ renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); - g_assert (g_list_length (renderers) == 1); - renderer = g_list_nth_data (renderers, 0); - g_assert (renderer); -@@ -1423,7 +1423,7 @@ test_cell_view (void) - path = gtk_tree_path_new_first (); - gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (cellview), path); - -- renderers = gtk_cell_view_get_cell_renderers (GTK_CELL_VIEW (cellview)); -+ renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (cellview)); - g_assert (renderers); - g_assert (g_list_length (renderers) == 1); - -diff --git a/gtk/tests/treeview-scrolling.c b/gtk/tests/treeview-scrolling.c -index 5ee24c1..0207dbc 100644 ---- a/gtk/tests/treeview-scrolling.c -+++ b/gtk/tests/treeview-scrolling.c -@@ -728,7 +728,7 @@ scroll_new_row (ScrollFixture *fixture, - - /* Set up a signal handler to acquire the editable widget */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (fixture->tree_view), 0); -- renderers = gtk_tree_view_column_get_cell_renderers (column); -+ renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); - - g_signal_connect (G_OBJECT (renderers->data), "editing-started", - G_CALLBACK (scroll_new_row_editing_started), -diff --git a/modules/other/gail/gailtreeview.c b/modules/other/gail/gailtreeview.c -index d615a45..d305ae0 100644 ---- a/modules/other/gail/gailtreeview.c -+++ b/modules/other/gail/gailtreeview.c -@@ -867,7 +867,7 @@ gail_tree_view_ref_child (AtkObject *obj, - gtk_tree_view_column_cell_set_cell_data (tv_col, tree_model, &iter, - is_expander, is_expanded); - -- renderer_list = gtk_tree_view_column_get_cell_renderers (tv_col); -+ renderer_list = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tv_col)); - - /* If there are more than one renderer in the list, make a container */ - -@@ -2127,7 +2127,7 @@ gail_tree_view_get_cell_area (GailCellParent *parent, - GtkCellRenderer *renderer; - - cell_index = atk_object_get_index_in_parent (ATK_OBJECT (cell)); -- renderers = gtk_tree_view_column_get_cell_renderers (tv_col); -+ renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tv_col)); - renderer = g_list_nth_data (renderers, cell_index); - - found = gtk_tree_view_column_cell_get_position (tv_col, renderer, &cell_start, &cell_width); -@@ -2180,7 +2180,7 @@ gail_tree_view_grab_cell_focus (GailCellParent *parent, - */ - GList *renderers; - -- renderers = gtk_tree_view_column_get_cell_renderers (tv_col); -+ renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tv_col)); - if (cell_info->in_use) { - index = atk_object_get_index_in_parent (cell_object); - renderer = g_list_nth_data (renderers, index); -@@ -3177,7 +3177,7 @@ update_cell_value (GailRendererCell *renderer_cell, - gtk_tree_view_column_cell_set_cell_data (cell_info->cell_col_ref, - tree_model, &iter, is_expander, is_expanded); - } -- renderers = gtk_tree_view_column_get_cell_renderers (cell_info->cell_col_ref); -+ renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (cell_info->cell_col_ref)); - gail_return_val_if_fail (renderers, FALSE); - - /* -@@ -4001,7 +4001,7 @@ toggle_cell_toggled (GailCell *cell) - gail_return_if_fail (path); - pathstring = gtk_tree_path_to_string (path); - -- renderers = gtk_tree_view_column_get_cell_renderers (cell_info->cell_col_ref); -+ renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (cell_info->cell_col_ref)); - gail_return_if_fail (renderers); - - /* diff --git a/entry-include-fix.patch b/entry-include-fix.patch deleted file mode 100644 index 20ac20e..0000000 --- a/entry-include-fix.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/gtk/gtkentrybuffer.h b/gtk/gtkentrybuffer.h -index cf2ddda..275aaa1 100644 ---- a/gtk/gtkentrybuffer.h -+++ b/gtk/gtkentrybuffer.h -@@ -17,7 +17,7 @@ - * Boston, MA 02111-1307, USA. - */ - --#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) -+#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) - #error "Only can be included directly." - #endif - diff --git a/fix-anchors.patch b/fix-anchors.patch deleted file mode 100644 index 149e3a1..0000000 --- a/fix-anchors.patch +++ /dev/null @@ -1,94 +0,0 @@ -diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c -index 319b8ce..8c5d419 100644 ---- a/gtk/gtktextlayout.c -+++ b/gtk/gtktextlayout.c -@@ -1812,56 +1812,59 @@ allocate_child_widgets (GtkTextLayout *text_layout, - { - PangoLayout *layout = display->layout; - PangoLayoutIter *run_iter; -- -+ - run_iter = pango_layout_get_iter (layout); -- - do - { - PangoLayoutRun *run = pango_layout_iter_get_run_readonly (run_iter); -- -+ - if (run && is_shape (run)) - { - gint byte_index; - GtkTextIter text_iter; -- GtkTextChildAnchor *anchor = 0; -- GList *widgets = 0; -- -- /* The pango iterator iterates in visual order. -+ GtkTextChildAnchor *anchor = NULL; -+ GList *widgets = NULL; -+ GList *l; -+ -+ /* The pango iterator iterates in visual order. - * We use the byte index to find the child widget. - */ -- - byte_index = pango_layout_iter_get_index (run_iter); - line_display_index_to_iter (text_layout, display, &text_iter, byte_index, 0); - anchor = gtk_text_iter_get_child_anchor (&text_iter); -- widgets = gtk_text_child_anchor_get_widgets (anchor); -- -- if (widgets) -+ if (anchor) -+ widgets = gtk_text_child_anchor_get_widgets (anchor); -+ -+ for (l = widgets; l; l = l->next) - { - PangoRectangle extents; -- GtkWidget *child = widgets->data; -+ GtkWidget *child = l->data; - -- /* We emit "allocate_child" with the x,y of -- * the widget with respect to the top of the line -- * and the left side of the buffer -- */ -- -- pango_layout_iter_get_run_extents (run_iter, -- NULL, -- &extents); -- -- g_signal_emit (text_layout, -- signals[ALLOCATE_CHILD], -- 0, -- child, -- PANGO_PIXELS (extents.x) + display->x_offset, -- PANGO_PIXELS (extents.y) + display->top_margin); -- -- g_list_free (widgets); -+ if (_gtk_anchored_child_get_layout (child) == text_layout) -+ { -+ -+ /* We emit "allocate_child" with the x,y of -+ * the widget with respect to the top of the line -+ * and the left side of the buffer -+ */ -+ pango_layout_iter_get_run_extents (run_iter, -+ NULL, -+ &extents); -+ -+ g_signal_emit (text_layout, -+ signals[ALLOCATE_CHILD], -+ 0, -+ child, -+ PANGO_PIXELS (extents.x) + display->x_offset, -+ PANGO_PIXELS (extents.y) + display->top_margin); -+ } - } -+ -+ g_list_free (widgets); - } - } - while (pango_layout_iter_next_run (run_iter)); -- -+ - pango_layout_iter_free (run_iter); - } - diff --git a/fresh-tooltips.patch b/fresh-tooltips.patch new file mode 100644 index 0000000..abb17c9 --- /dev/null +++ b/fresh-tooltips.patch @@ -0,0 +1,374 @@ +diff -up gtk+-2.18.3/gtk/gtktooltip.c.fresh-tooltips gtk+-2.18.3/gtk/gtktooltip.c +--- gtk+-2.18.3/gtk/gtktooltip.c.fresh-tooltips 2009-10-16 10:35:45.000000000 -0400 ++++ gtk+-2.18.3/gtk/gtktooltip.c 2009-10-31 14:53:37.120183113 -0400 +@@ -29,6 +29,10 @@ + #include "gtkhbox.h" + #include "gtkalignment.h" + ++#ifdef GDK_WINDOWING_X11 ++#include "gdk/x11/gdkx.h" ++#endif ++ + #include "gtkalias.h" + + #include +@@ -95,6 +99,7 @@ static void gtk_tooltip_display_cl + GtkTooltip *tooltip); + static void gtk_tooltip_set_last_window (GtkTooltip *tooltip, + GdkWindow *window); ++static void update_shape (GtkTooltip *tooltip); + + + G_DEFINE_TYPE (GtkTooltip, gtk_tooltip, G_TYPE_OBJECT); +@@ -110,8 +115,43 @@ gtk_tooltip_class_init (GtkTooltipClass + } + + static void ++on_composited_changed (GtkWidget *window, ++ GtkTooltip *tooltip) ++{ ++ update_shape (tooltip); ++} ++ ++static void ++on_screen_changed (GtkWidget *window, ++ GdkScreen *previous, ++ GtkTooltip *tooltip) ++{ ++ GdkScreen *screen; ++ GdkColormap *cmap; ++ ++ screen = gtk_widget_get_screen (window); ++ ++ cmap = NULL; ++ if (gdk_screen_is_composited (screen)) ++ cmap = gdk_screen_get_rgba_colormap (screen); ++ if (cmap == NULL) ++ cmap = gdk_screen_get_rgb_colormap (screen); ++ ++ gtk_widget_set_colormap (window, cmap); ++} ++ ++static void ++on_realized (GtkWidget *window, ++ GtkTooltip *tooltip) ++{ ++ update_shape (tooltip); ++} ++ ++static void + gtk_tooltip_init (GtkTooltip *tooltip) + { ++ GdkScreen *screen; ++ + tooltip->timeout_id = 0; + tooltip->browse_mode_timeout_id = 0; + +@@ -127,8 +167,12 @@ gtk_tooltip_init (GtkTooltip *tooltip) + tooltip->last_window = NULL; + + tooltip->window = g_object_ref (gtk_window_new (GTK_WINDOW_POPUP)); ++ ++ on_screen_changed (tooltip->window, NULL, tooltip); ++ + gtk_window_set_type_hint (GTK_WINDOW (tooltip->window), + GDK_WINDOW_TYPE_HINT_TOOLTIP); ++ + gtk_widget_set_app_paintable (tooltip->window, TRUE); + gtk_window_set_resizable (GTK_WINDOW (tooltip->window), FALSE); + gtk_widget_set_name (tooltip->window, "gtk-tooltip"); +@@ -145,7 +189,7 @@ gtk_tooltip_init (GtkTooltip *tooltip) + gtk_widget_show (tooltip->alignment); + + g_signal_connect_swapped (tooltip->window, "style-set", +- G_CALLBACK (gtk_tooltip_window_style_set), tooltip); ++ G_CALLBACK (gtk_tooltip_window_style_set), tooltip); + g_signal_connect_swapped (tooltip->window, "expose-event", + G_CALLBACK (gtk_tooltip_paint_window), tooltip); + +@@ -162,6 +206,13 @@ gtk_tooltip_init (GtkTooltip *tooltip) + gtk_box_pack_start (GTK_BOX (tooltip->box), tooltip->label, + FALSE, FALSE, 0); + ++ g_signal_connect (tooltip->window, "composited-changed", ++ G_CALLBACK (on_composited_changed), tooltip); ++ g_signal_connect (tooltip->window, "screen-changed", ++ G_CALLBACK (on_screen_changed), tooltip); ++ g_signal_connect (tooltip->window, "realize", ++ G_CALLBACK (on_realized), tooltip); ++ + tooltip->custom_widget = NULL; + } + +@@ -318,9 +369,9 @@ gtk_tooltip_set_icon_from_stock (GtkTool + * Since: 2.14 + */ + void +-gtk_tooltip_set_icon_from_icon_name(GtkTooltip *tooltip, +- const gchar *icon_name, +- GtkIconSize size) ++gtk_tooltip_set_icon_from_icon_name (GtkTooltip *tooltip, ++ const gchar *icon_name, ++ GtkIconSize size) + { + g_return_if_fail (GTK_IS_TOOLTIP (tooltip)); + +@@ -471,27 +522,217 @@ static void + gtk_tooltip_window_style_set (GtkTooltip *tooltip) + { + gtk_alignment_set_padding (GTK_ALIGNMENT (tooltip->alignment), +- tooltip->window->style->ythickness, +- tooltip->window->style->ythickness, +- tooltip->window->style->xthickness, ++ tooltip->window->style->ythickness, ++ tooltip->window->style->ythickness, ++ tooltip->window->style->xthickness, + tooltip->window->style->xthickness); +- ++ gtk_box_set_spacing (GTK_BOX (tooltip->box), ++ tooltip->window->style->xthickness); + gtk_widget_queue_draw (tooltip->window); + } + ++static void ++draw_round_rect (cairo_t *cr, ++ gdouble aspect, ++ gdouble x, ++ gdouble y, ++ gdouble corner_radius, ++ gdouble width, ++ gdouble height) ++{ ++ gdouble radius = corner_radius / aspect; ++ ++ cairo_move_to (cr, x + radius, y); ++ ++ /* top-right, left of the corner */ ++ cairo_line_to (cr, x + width - radius, y); ++ ++ /* top-right, below the corner */ ++ cairo_arc (cr, ++ x + width - radius, y + radius, radius, ++ -90.0f * G_PI / 180.0f, 0.0f * G_PI / 180.0f); ++ ++ /* bottom-right, above the corner */ ++ cairo_line_to (cr, x + width, y + height - radius); ++ ++ /* bottom-right, left of the corner */ ++ cairo_arc (cr, ++ x + width - radius, y + height - radius, radius, ++ 0.0f * G_PI / 180.0f, 90.0f * G_PI / 180.0f); ++ ++ /* bottom-left, right of the corner */ ++ cairo_line_to (cr, x + radius, y + height); ++ ++ /* bottom-left, above the corner */ ++ cairo_arc (cr, ++ x + radius, y + height - radius, radius, ++ 90.0f * G_PI / 180.0f, 180.0f * G_PI / 180.0f); ++ ++ /* top-left, below the corner */ ++ cairo_line_to (cr, x, y + radius); ++ ++ /* top-left, right of the corner */ ++ cairo_arc (cr, ++ x + radius, y + radius, radius, ++ 180.0f * G_PI / 180.0f, 270.0f * G_PI / 180.0f); ++ ++ cairo_close_path (cr); ++} ++ ++static void ++fill_background (GtkWidget *widget, ++ cairo_t *cr) ++{ ++ GdkColor color; ++ gdouble r, g, b; ++ gint radius; ++ gdouble background_alpha; ++ ++ if (gdk_screen_is_composited (gtk_widget_get_screen (widget))) ++ background_alpha = 0.90; ++ else ++ background_alpha = 1.0; ++ ++ radius = MIN (widget->style->xthickness, widget->style->ythickness); ++ radius = MAX (radius, 1); ++ ++ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); ++ cairo_paint (cr); ++ cairo_set_operator (cr, CAIRO_OPERATOR_OVER); ++ ++ draw_round_rect (cr, ++ 1.0, 0.5, 0.5, radius, ++ widget->allocation.width - 1, ++ widget->allocation.height - 1); ++ ++ color = widget->style->bg [GTK_STATE_NORMAL]; ++ r = (float)color.red / 65535.0; ++ g = (float)color.green / 65535.0; ++ b = (float)color.blue / 65535.0; ++ cairo_set_source_rgba (cr, r, g, b, background_alpha); ++ cairo_fill_preserve (cr); ++ ++ color = widget->style->bg [GTK_STATE_SELECTED]; ++ r = (float) color.red / 65535.0; ++ g = (float) color.green / 65535.0; ++ b = (float) color.blue / 65535.0; ++ ++ cairo_set_source_rgba (cr, r, g, b, background_alpha); ++ cairo_set_line_width (cr, 1.0); ++ cairo_stroke (cr); ++} ++ ++static void ++update_shape (GtkTooltip *tooltip) ++{ ++ GdkScreen *screen; ++ GdkBitmap *mask; ++ cairo_t *cr; ++ gint width, height; ++ gboolean new_style; ++ gint radius; ++ ++ gtk_widget_style_get (tooltip->window, "new-tooltip-style", &new_style, NULL); ++ ++ if (!new_style) ++ { ++ gtk_widget_shape_combine_mask (tooltip->window, NULL, 0, 0); ++ return; ++ } ++ ++ screen = gtk_widget_get_screen (tooltip->window); ++ ++ gtk_window_get_size (GTK_WINDOW (tooltip->window), &width, &height); ++ ++ if (gdk_screen_is_composited (screen)) ++ { ++ GdkRectangle rect; ++ GdkRegion *region; ++ const char *wm; ++ ++ gtk_widget_shape_combine_mask (tooltip->window, NULL, 0, 0); ++#ifdef GDK_WINDOWING_X11 ++ /* This is a hack to keep the Metacity compositor from slapping a ++ * non-shaped shadow around the shaped tooltip ++ */ ++ if (!GTK_WIDGET_MAPPED (tooltip->window)) ++ { ++ wm = gdk_x11_screen_get_window_manager_name (screen); ++ if (g_strcmp0 (wm, "Metacity") == 0) ++ gtk_window_set_type_hint (GTK_WINDOW (tooltip->window), ++ GDK_WINDOW_TYPE_HINT_DND); ++ } ++#endif ++ return; ++ } ++ ++ radius = MIN (tooltip->window->style->xthickness, ++ tooltip->window->style->ythickness); ++ radius = MAX (radius, 1); ++ mask = (GdkBitmap *) gdk_pixmap_new (NULL, width, height, 1); ++ cr = gdk_cairo_create (mask); ++ if (cairo_status (cr) == CAIRO_STATUS_SUCCESS) ++ { ++ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); ++ cairo_paint (cr); ++ ++ cairo_set_operator (cr, CAIRO_OPERATOR_OVER); ++ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); ++ draw_round_rect (cr, 1.0, 0, 0, radius + 1, width, height); ++ cairo_fill (cr); ++ ++ gtk_widget_shape_combine_mask (tooltip->window, mask, 0, 0); ++ } ++ cairo_destroy (cr); ++ ++ g_object_unref (mask); ++} ++ + static gboolean + gtk_tooltip_paint_window (GtkTooltip *tooltip) + { +- gtk_paint_flat_box (tooltip->window->style, +- tooltip->window->window, +- GTK_STATE_NORMAL, +- GTK_SHADOW_OUT, +- NULL, +- tooltip->window, +- "tooltip", +- 0, 0, +- tooltip->window->allocation.width, +- tooltip->window->allocation.height); ++ gboolean new_style; ++ ++ gtk_widget_style_get (tooltip->window, "new-tooltip-style", &new_style, NULL); ++ ++ if (new_style) ++ { ++ cairo_t *context; ++ cairo_surface_t *surface; ++ cairo_t *cr; ++ ++ context = gdk_cairo_create (tooltip->window->window); ++ ++ cairo_set_operator (context, CAIRO_OPERATOR_SOURCE); ++ surface = cairo_surface_create_similar (cairo_get_target (context), ++ CAIRO_CONTENT_COLOR_ALPHA, ++ tooltip->window->allocation.width, ++ tooltip->window->allocation.height); ++ cr = cairo_create (surface); ++ ++ fill_background (tooltip->window, cr); ++ ++ cairo_destroy (cr); ++ cairo_set_source_surface (context, surface, 0, 0); ++ cairo_paint (context); ++ cairo_surface_destroy (surface); ++ cairo_destroy (context); ++ ++ update_shape (tooltip); ++ } ++ else ++ { ++ gtk_paint_flat_box (tooltip->window->style, ++ tooltip->window->window, ++ GTK_STATE_NORMAL, ++ GTK_SHADOW_OUT, ++ NULL, ++ tooltip->window, ++ "tooltip", ++ 0, 0, ++ tooltip->window->allocation.width, ++ tooltip->window->allocation.height); ++ } + + return FALSE; + } +@@ -631,7 +872,7 @@ find_widget_under_pointer (GdkWindow *wi + + #ifdef DEBUG_TOOLTIP + g_print ("event window %p (belonging to %p (%s)) (%d, %d)\n", +- window, event_widget, gtk_widget_get_name (event_widget), ++ gindow, event_widget, gtk_widget_get_name (event_widget), + *x, *y); + #endif + +diff -up gtk+-2.18.3/gtk/gtkwidget.c.fresh-tooltips gtk+-2.18.3/gtk/gtkwidget.c +--- gtk+-2.18.3/gtk/gtkwidget.c.fresh-tooltips 2009-10-09 01:00:44.000000000 -0400 ++++ gtk+-2.18.3/gtk/gtkwidget.c 2009-10-31 14:27:50.333957199 -0400 +@@ -2386,6 +2386,14 @@ gtk_widget_class_init (GtkWidgetClass *k + P_("The length of vertical scroll arrows"), + 1, G_MAXINT, 16, + GTK_PARAM_READABLE)); ++ ++ gtk_widget_class_install_style_property (klass, ++ g_param_spec_boolean ("new-tooltip-style", ++ NULL, ++ NULL, ++ FALSE, ++ GTK_PARAM_READABLE)); ++ + } + + static void diff --git a/gdm-background.patch b/gdm-background.patch deleted file mode 100644 index 2a1f8b1..0000000 --- a/gdm-background.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c -index 7a000aa..ec36191 100644 ---- a/gdk/gdkwindow.c -+++ b/gdk/gdkwindow.c -@@ -5049,7 +5049,7 @@ gdk_window_invalidate_rect (GdkWindow *window, - if (GDK_WINDOW_DESTROYED (window)) - return; - -- if (private->input_only || !private->viewable) -+ if (private->input_only || !private->viewable || !GDK_WINDOW_IS_MAPPED (window)) - return; - - if (!rect) -@@ -5135,6 +5135,7 @@ gdk_window_invalidate_maybe_recurse (GdkWindow *window, - - if (private->input_only || - !private->viewable || -+ !GDK_WINDOW_IS_MAPPED (window) || - gdk_region_empty (region)) - return; - -@@ -7929,7 +7930,7 @@ _gdk_window_calculate_full_clip_region (GdkWindow *window, - if (base_y_offset) - *base_y_offset = 0; - -- if (!private->viewable || private->input_only) -+ if (!private->viewable || !GDK_WINDOW_IS_MAPPED (window) || private->input_only) - return gdk_region_new (); - - window_get_size_rectangle (window, &visible_rect); diff --git a/gtk-bell.patch b/gtk-bell.patch deleted file mode 100644 index b36040d..0000000 --- a/gtk-bell.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up gtk+-2.17.11/gdk/x11/gdkdisplay-x11.c.bell gtk+-2.17.11/gdk/x11/gdkdisplay-x11.c ---- gtk+-2.17.11/gdk/x11/gdkdisplay-x11.c.bell 2009-09-13 23:20:20.540275068 -0400 -+++ gtk+-2.17.11/gdk/x11/gdkdisplay-x11.c 2009-09-13 23:20:39.649290396 -0400 -@@ -691,7 +691,7 @@ gdk_display_beep (GdkDisplay *display) - { - g_return_if_fail (GDK_IS_DISPLAY (display)); - -- XBell (GDK_DISPLAY_XDISPLAY (display), 0); -+ XkbBell (GDK_DISPLAY_XDISPLAY (display), None, 0, None); - } - - /** diff --git a/gtk2-fix-install.patch b/gtk2-fix-install.patch deleted file mode 100644 index d1d972d..0000000 --- a/gtk2-fix-install.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -up gtk+-2.17.11/po/Makefile.in.in.fix-install gtk+-2.17.11/po/Makefile.in.in ---- gtk+-2.17.11/po/Makefile.in.in.fix-install 2009-09-05 01:19:45.303824009 -0400 -+++ gtk+-2.17.11/po/Makefile.in.in 2009-09-05 01:19:14.632573806 -0400 -@@ -126,7 +126,7 @@ install-data: install-data-@USE_NLS@ - install-data-no: all - install-data-yes: all - $(mkdir_p) $(DESTDIR)$(datadir); \ -- @catalogs='$(CATALOGS)'; \ -+ catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - case "$$cat" in \ -diff -up gtk+-2.17.11/po-properties/Makefile.in.in.fix-install gtk+-2.17.11/po-properties/Makefile.in.in ---- gtk+-2.17.11/po-properties/Makefile.in.in.fix-install 2009-09-05 01:19:54.543583934 -0400 -+++ gtk+-2.17.11/po-properties/Makefile.in.in 2009-09-05 01:20:16.427830666 -0400 -@@ -107,7 +107,7 @@ install-data: install-data-@USE_NLS@ - install-data-no: all - install-data-yes: all - $(mkdir_p) $(DESTDIR)$(datadir); \ -- @catalogs='$(CATALOGS)'; \ -+ catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - case "$$cat" in \ diff --git a/gtk2-printing-nonblocking-printer-list.patch b/gtk2-printing-nonblocking-printer-list.patch deleted file mode 100644 index 53e24ee..0000000 --- a/gtk2-printing-nonblocking-printer-list.patch +++ /dev/null @@ -1,212 +0,0 @@ -diff -up gtk+-2.18.0/gtk/gtkprintunixdialog.c.printing-nonblocking-printer-list gtk+-2.18.0/gtk/gtkprintunixdialog.c ---- gtk+-2.18.0/gtk/gtkprintunixdialog.c.printing-nonblocking-printer-list 2009-09-11 22:58:38.000000000 -0400 -+++ gtk+-2.18.0/gtk/gtkprintunixdialog.c 2009-09-23 01:28:27.595033076 -0400 -@@ -596,7 +596,7 @@ gtk_print_unix_dialog_destroy (GtkPrintU - } - - static void --disconnect_printer_details_request (GtkPrintUnixDialog *dialog) -+disconnect_printer_details_request (GtkPrintUnixDialog *dialog, gboolean details_failed) - { - GtkPrintUnixDialogPrivate *priv = dialog->priv; - -@@ -606,12 +606,20 @@ disconnect_printer_details_request (GtkP - priv->request_details_tag); - priv->request_details_tag = 0; - set_busy_cursor (dialog, FALSE); -- gtk_list_store_set (GTK_LIST_STORE (priv->printer_list), -- g_object_get_data (G_OBJECT (priv->request_details_printer), -- "gtk-print-tree-iter"), -- PRINTER_LIST_COL_STATE, -- gtk_printer_get_state_message (priv->request_details_printer), -- -1); -+ if (details_failed) -+ gtk_list_store_set (GTK_LIST_STORE (priv->printer_list), -+ g_object_get_data (G_OBJECT (priv->request_details_printer), -+ "gtk-print-tree-iter"), -+ PRINTER_LIST_COL_STATE, -+ _("Getting printer information failed"), -+ -1); -+ else -+ gtk_list_store_set (GTK_LIST_STORE (priv->printer_list), -+ g_object_get_data (G_OBJECT (priv->request_details_printer), -+ "gtk-print-tree-iter"), -+ PRINTER_LIST_COL_STATE, -+ gtk_printer_get_state_message (priv->request_details_printer), -+ -1); - g_object_unref (priv->request_details_printer); - priv->request_details_printer = NULL; - } -@@ -626,7 +634,7 @@ gtk_print_unix_dialog_finalize (GObject - GList *node; - - unschedule_idle_mark_conflicts (dialog); -- disconnect_printer_details_request (dialog); -+ disconnect_printer_details_request (dialog, FALSE); - - if (priv->current_printer) - { -@@ -1781,7 +1789,7 @@ printer_details_acquired (GtkPrinter - { - GtkPrintUnixDialogPrivate *priv = dialog->priv; - -- disconnect_printer_details_request (dialog); -+ disconnect_printer_details_request (dialog, !success); - - if (success) - { -@@ -1809,7 +1817,7 @@ selected_printer_changed (GtkTreeSelecti - priv->waiting_for_printer = NULL; - } - -- disconnect_printer_details_request (dialog); -+ disconnect_printer_details_request (dialog, FALSE); - - printer = NULL; - if (gtk_tree_selection_get_selected (selection, NULL, &filter_iter)) -diff -up gtk+-2.18.0/modules/printbackends/cups/gtkprintbackendcups.c.printing-nonblocking-printer-list gtk+-2.18.0/modules/printbackends/cups/gtkprintbackendcups.c ---- gtk+-2.18.0/modules/printbackends/cups/gtkprintbackendcups.c.printing-nonblocking-printer-list 2009-09-23 01:28:27.557052405 -0400 -+++ gtk+-2.18.0/modules/printbackends/cups/gtkprintbackendcups.c 2009-09-23 01:28:27.600060112 -0400 -@@ -156,7 +156,7 @@ static GList * cups_printer - static GtkPageSetup * cups_printer_get_default_page_size (GtkPrinter *printer); - static void cups_printer_request_details (GtkPrinter *printer); - static gboolean cups_request_default_printer (GtkPrintBackendCups *print_backend); --static void cups_request_ppd (GtkPrinter *printer); -+static gboolean cups_request_ppd (GtkPrinter *printer); - static void cups_printer_get_hard_margins (GtkPrinter *printer, - double *top, - double *bottom, -@@ -1906,6 +1906,8 @@ cups_request_printer_list_cb (GtkPrintBa - else - g_object_ref (printer); - -+ GTK_PRINTER_CUPS (printer)->remote = remote_printer; -+ - gtk_printer_set_is_paused (printer, is_paused); - gtk_printer_set_is_accepting_jobs (printer, is_accepting_jobs); - -@@ -2206,7 +2208,7 @@ done: - GDK_THREADS_LEAVE (); - } - --static void -+static gboolean - cups_request_ppd (GtkPrinter *printer) - { - GError *error; -@@ -2226,6 +2228,26 @@ cups_request_ppd (GtkPrinter *printer) - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); - -+ if (cups_printer->remote) -+ { -+ GtkCupsConnectionState state; -+ -+ state = gtk_cups_connection_test_get_state (cups_printer->remote_cups_connection_test); -+ -+ if (state == GTK_CUPS_CONNECTION_IN_PROGRESS) -+ return TRUE; -+ -+ gtk_cups_connection_test_free (cups_printer->remote_cups_connection_test); -+ cups_printer->remote_cups_connection_test = NULL; -+ cups_printer->get_remote_ppd_poll = 0; -+ -+ if (state == GTK_CUPS_CONNECTION_NOT_AVAILABLE) -+ { -+ g_signal_emit_by_name (printer, "details-acquired", FALSE); -+ return FALSE; -+ } -+ } -+ - http = httpConnectEncrypt (cups_printer->hostname, - cups_printer->port, - cupsEncryption ()); -@@ -2255,7 +2277,7 @@ cups_request_ppd (GtkPrinter *printer) - g_free (data); - - g_signal_emit_by_name (printer, "details-acquired", FALSE); -- return; -+ return FALSE; - } - - data->http = http; -@@ -2293,6 +2315,8 @@ cups_request_ppd (GtkPrinter *printer) - - g_free (resource); - g_free (ppd_filename); -+ -+ return FALSE; - } - - /* Ordering matters for default preference */ -@@ -2590,7 +2614,22 @@ cups_printer_request_details (GtkPrinter - cups_printer = GTK_PRINTER_CUPS (printer); - if (!cups_printer->reading_ppd && - gtk_printer_cups_get_ppd (cups_printer) == NULL) -- cups_request_ppd (printer); -+ { -+ if (cups_printer->remote) -+ { -+ if (cups_printer->get_remote_ppd_poll == 0) -+ { -+ cups_printer->remote_cups_connection_test = gtk_cups_connection_test_new (cups_printer->hostname); -+ -+ if (cups_request_ppd (printer)) -+ cups_printer->get_remote_ppd_poll = gdk_threads_add_timeout (200, -+ (GSourceFunc) cups_request_ppd, -+ printer); -+ } -+ } -+ else -+ cups_request_ppd (printer); -+ } - } - - static char * -diff -up gtk+-2.18.0/modules/printbackends/cups/gtkprintercups.c.printing-nonblocking-printer-list gtk+-2.18.0/modules/printbackends/cups/gtkprintercups.c ---- gtk+-2.18.0/modules/printbackends/cups/gtkprintercups.c.printing-nonblocking-printer-list 2009-09-23 01:28:27.558041288 -0400 -+++ gtk+-2.18.0/modules/printbackends/cups/gtkprintercups.c 2009-09-23 01:30:55.841053044 -0400 -@@ -78,6 +78,9 @@ gtk_printer_cups_init (GtkPrinterCups *p - printer->default_cover_before = NULL; - printer->default_cover_after = NULL; - printer->auth_info_required = NULL; -+ printer->remote = FALSE; -+ printer->get_remote_ppd_poll = 0; -+ printer->remote_cups_connection_test = NULL; - } - - static void -@@ -100,6 +103,11 @@ gtk_printer_cups_finalize (GObject *obje - if (printer->ppd_file) - ppdClose (printer->ppd_file); - -+ if (printer->get_remote_ppd_poll > 0) -+ g_source_remove (printer->get_remote_ppd_poll); -+ -+ gtk_cups_connection_test_free (printer->remote_cups_connection_test); -+ - G_OBJECT_CLASS (gtk_printer_cups_parent_class)->finalize (object); - } - -diff -up gtk+-2.18.0/modules/printbackends/cups/gtkprintercups.h.printing-nonblocking-printer-list gtk+-2.18.0/modules/printbackends/cups/gtkprintercups.h ---- gtk+-2.18.0/modules/printbackends/cups/gtkprintercups.h.printing-nonblocking-printer-list 2009-09-23 01:28:27.559041206 -0400 -+++ gtk+-2.18.0/modules/printbackends/cups/gtkprintercups.h 2009-09-23 01:31:02.087036708 -0400 -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include "gtkcupsutils.h" - - #include - -@@ -56,6 +57,10 @@ struct _GtkPrinterCups - - gchar *default_cover_before; - gchar *default_cover_after; -+ -+ gboolean remote; -+ guint get_remote_ppd_poll; -+ GtkCupsConnectionTest *remote_cups_connection_test; - }; - - struct _GtkPrinterCupsClass diff --git a/gtk2-printing-smb-auth.patch b/gtk2-printing-smb-auth.patch deleted file mode 100644 index 964fb6b..0000000 --- a/gtk2-printing-smb-auth.patch +++ /dev/null @@ -1,770 +0,0 @@ -From 82562ae5ddd7e50428aaedb5eb1edeec57c3f54f Mon Sep 17 00:00:00 2001 -From: Marek Kasik -Date: Wed, 16 Sep 2009 14:54:05 +0200 -Subject: [PATCH] Add support for 'auth-info' attribute to the CUPS backend - -Check for 'auth-info-required' attribute from printer attributes to -find out whether an authentization of user is needed. -Change password dialog of print backend to be able to require informations -requested thru 'auth-info-required' (#566522). ---- - gtk/gtkmarshalers.list | 1 + - gtk/gtkprintbackend.c | 164 +++++++------- - gtk/gtkprintbackend.h | 16 +- - modules/printbackends/cups/gtkcupsutils.c | 5 + - modules/printbackends/cups/gtkcupsutils.h | 3 + - modules/printbackends/cups/gtkprintbackendcups.c | 255 ++++++++++++++++++++-- - modules/printbackends/cups/gtkprintercups.c | 2 + - modules/printbackends/cups/gtkprintercups.h | 1 + - 8 files changed, 339 insertions(+), 108 deletions(-) - -diff --git a/gtk/gtkmarshalers.list b/gtk/gtkmarshalers.list -index 533a266..77873cb 100644 ---- a/gtk/gtkmarshalers.list -+++ b/gtk/gtkmarshalers.list -@@ -111,3 +111,4 @@ VOID:UINT,STRING,UINT - VOID:UINT,UINT - VOID:VOID - OBJECT:OBJECT,INT,INT -+VOID:POINTER,POINTER,POINTER,POINTER,STRING -diff --git a/gtk/gtkprintbackend.c b/gtk/gtkprintbackend.c -index 567273b..3c64823 100644 ---- a/gtk/gtkprintbackend.c -+++ b/gtk/gtkprintbackend.c -@@ -50,9 +50,8 @@ struct _GtkPrintBackendPrivate - guint printer_list_requested : 1; - guint printer_list_done : 1; - GtkPrintBackendStatus status; -- char *hostname; -- char *username; -- char *password; -+ char **auth_info_required; -+ char **auth_info; - }; - - enum { -@@ -359,8 +358,10 @@ static GList * fallback_printer_list_papers (GtkPrinter - static GtkPageSetup * fallback_printer_get_default_page_size (GtkPrinter *printer); - static GtkPrintCapabilities fallback_printer_get_capabilities (GtkPrinter *printer); - static void request_password (GtkPrintBackend *backend, -- const gchar *hostname, -- const gchar *username, -+ gpointer auth_info_required, -+ gpointer auth_info_default, -+ gpointer auth_info_display, -+ gpointer auth_info_visible, - const gchar *prompt); - - static void -@@ -441,8 +442,8 @@ gtk_print_backend_class_init (GtkPrintBackendClass *class) - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GtkPrintBackendClass, request_password), - NULL, NULL, -- _gtk_marshal_VOID__STRING_STRING_STRING, -- G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); -+ _gtk_marshal_VOID__POINTER_POINTER_POINTER_POINTER_STRING, -+ G_TYPE_NONE, 5, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_STRING); - } - - static void -@@ -455,9 +456,8 @@ gtk_print_backend_init (GtkPrintBackend *backend) - priv->printers = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) g_object_unref); -- priv->hostname = NULL; -- priv->username = NULL; -- priv->password = NULL; -+ priv->auth_info_required = NULL; -+ priv->auth_info = NULL; - } - - static void -@@ -662,40 +662,29 @@ gtk_print_backend_print_stream (GtkPrintBackend *backend, - } - - void --gtk_print_backend_set_password (GtkPrintBackend *backend, -- const gchar *hostname, -- const gchar *username, -- const gchar *password) -+gtk_print_backend_set_password (GtkPrintBackend *backend, -+ gchar **auth_info_required, -+ gchar **auth_info) - { - g_return_if_fail (GTK_IS_PRINT_BACKEND (backend)); - - if (GTK_PRINT_BACKEND_GET_CLASS (backend)->set_password) -- GTK_PRINT_BACKEND_GET_CLASS (backend)->set_password (backend, hostname, username, password); -+ GTK_PRINT_BACKEND_GET_CLASS (backend)->set_password (backend, auth_info_required, auth_info); - } - - static void --store_password (GtkEntry *entry, -- GtkPrintBackend *backend) -+store_entry (GtkEntry *entry, -+ gpointer user_data) - { -- GtkPrintBackendPrivate *priv = backend->priv; -+ gchar **data = (gchar **) user_data; - -- if (priv->password != NULL) -+ if (*data != NULL) - { -- memset (priv->password, 0, strlen (priv->password)); -- g_free (priv->password); -+ memset (*data, 0, strlen (*data)); -+ g_free (*data); - } - -- priv->password = g_strdup (gtk_entry_get_text (entry)); --} -- --static void --store_username (GtkEntry *entry, -- GtkPrintBackend *backend) --{ -- GtkPrintBackendPrivate *priv = backend->priv; -- -- g_free (priv->username); -- priv->username = g_strdup (gtk_entry_get_text (entry)); -+ *data = g_strdup (gtk_entry_get_text (entry)); - } - - static void -@@ -704,21 +693,24 @@ password_dialog_response (GtkWidget *dialog, - GtkPrintBackend *backend) - { - GtkPrintBackendPrivate *priv = backend->priv; -+ gint i; - - if (response_id == GTK_RESPONSE_OK) -- gtk_print_backend_set_password (backend, priv->hostname, priv->username, priv->password); -+ gtk_print_backend_set_password (backend, priv->auth_info_required, priv->auth_info); - else -- gtk_print_backend_set_password (backend, priv->hostname, priv->username, NULL); -+ gtk_print_backend_set_password (backend, priv->auth_info_required, NULL); - -- if (priv->password != NULL) -- { -- memset (priv->password, 0, strlen (priv->password)); -- g_free (priv->password); -- priv->password = NULL; -- } -+ for (i = 0; i < g_strv_length (priv->auth_info_required); i++) -+ if (priv->auth_info[i] != NULL) -+ { -+ memset (priv->auth_info[i], 0, strlen (priv->auth_info[i])); -+ g_free (priv->auth_info[i]); -+ priv->auth_info[i] = NULL; -+ } -+ g_free (priv->auth_info); -+ priv->auth_info = NULL; - -- g_free (priv->username); -- priv->username = NULL; -+ g_strfreev (priv->auth_info_required); - - gtk_widget_destroy (dialog); - -@@ -726,16 +718,27 @@ password_dialog_response (GtkWidget *dialog, - } - - static void --request_password (GtkPrintBackend *backend, -- const gchar *hostname, -- const gchar *username, -- const gchar *prompt) -+request_password (GtkPrintBackend *backend, -+ gpointer auth_info_required, -+ gpointer auth_info_default, -+ gpointer auth_info_display, -+ gpointer auth_info_visible, -+ const gchar *prompt) - { - GtkPrintBackendPrivate *priv = backend->priv; -- GtkWidget *dialog, *username_box, *password_box, *main_box, *label, *icon, *vbox, -- *password_prompt, *username_prompt, -- *password_entry, *username_entry; -+ GtkWidget *dialog, *box, *main_box, *label, *icon, *vbox, *entry; -+ GtkWidget *focus = NULL; - gchar *markup; -+ gint length; -+ gint i; -+ gchar **ai_required = (gchar **) auth_info_required; -+ gchar **ai_default = (gchar **) auth_info_default; -+ gchar **ai_display = (gchar **) auth_info_display; -+ gboolean *ai_visible = (gboolean *) auth_info_visible; -+ -+ priv->auth_info_required = g_strdupv (ai_required); -+ length = g_strv_length (ai_required); -+ priv->auth_info = g_new0 (gchar *, length); - - dialog = gtk_dialog_new_with_buttons ( _("Authentication"), NULL, GTK_DIALOG_MODAL, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, -@@ -766,27 +769,6 @@ request_password (GtkPrintBackend *backend, - g_free (markup); - - -- /* Right - 2. */ -- username_box = gtk_hbox_new (TRUE, 0); -- -- username_prompt = gtk_label_new (_("Username:")); -- gtk_misc_set_alignment (GTK_MISC (username_prompt), 0.0, 0.5); -- -- username_entry = gtk_entry_new (); -- gtk_entry_set_text (GTK_ENTRY (username_entry), username); -- -- -- /* Right - 3. */ -- password_box = gtk_hbox_new (TRUE, 0); -- -- password_prompt = gtk_label_new (_("Password:")); -- gtk_misc_set_alignment (GTK_MISC (password_prompt), 0.0, 0.5); -- -- password_entry = gtk_entry_new (); -- gtk_entry_set_visibility (GTK_ENTRY (password_entry), FALSE); -- gtk_entry_set_activates_default (GTK_ENTRY (password_entry), TRUE); -- -- - /* Packing */ - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), main_box, TRUE, FALSE, 0); - -@@ -794,26 +776,42 @@ request_password (GtkPrintBackend *backend, - gtk_box_pack_start (GTK_BOX (main_box), vbox, FALSE, FALSE, 6); - - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 6); -- gtk_box_pack_start (GTK_BOX (vbox), username_box, FALSE, TRUE, 6); -- gtk_box_pack_start (GTK_BOX (vbox), password_box, FALSE, TRUE, 6); -+ -+ /* Right - 2. */ -+ for (i = 0; i < length; i++) -+ { -+ priv->auth_info[i] = g_strdup (ai_default[i]); -+ if (ai_display[i] != NULL) -+ { -+ box = gtk_hbox_new (TRUE, 0); -+ -+ label = gtk_label_new (ai_display[i]); -+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - -- gtk_box_pack_start (GTK_BOX (username_box), username_prompt, TRUE, TRUE, 0); -- gtk_box_pack_start (GTK_BOX (username_box), username_entry, TRUE, TRUE, 0); -+ entry = gtk_entry_new (); -+ focus = entry; - -- gtk_box_pack_start (GTK_BOX (password_box), password_prompt, TRUE, TRUE, 0); -- gtk_box_pack_start (GTK_BOX (password_box), password_entry, TRUE, TRUE, 0); -+ if (ai_default[i] != NULL) -+ gtk_entry_set_text (GTK_ENTRY (entry), ai_default[i]); - -+ gtk_entry_set_visibility (GTK_ENTRY (entry), ai_visible[i]); -+ gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); - -- gtk_widget_grab_focus (password_entry); -+ gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, TRUE, 6); - -- priv->hostname = g_strdup (hostname); -- priv->username = g_strdup (username); -+ gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0); -+ gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 0); - -- g_signal_connect (password_entry, "changed", -- G_CALLBACK (store_password), backend); -+ g_signal_connect (entry, "changed", -+ G_CALLBACK (store_entry), &(priv->auth_info[i])); -+ } -+ } - -- g_signal_connect (username_entry, "changed", -- G_CALLBACK (store_username), backend); -+ if (focus != NULL) -+ { -+ gtk_widget_grab_focus (focus); -+ focus = NULL; -+ } - - g_object_ref (backend); - g_signal_connect (G_OBJECT (dialog), "response", -diff --git a/gtk/gtkprintbackend.h b/gtk/gtkprintbackend.h -index 7d75f8e..c4b43b1 100644 ---- a/gtk/gtkprintbackend.h -+++ b/gtk/gtkprintbackend.h -@@ -121,15 +121,16 @@ struct _GtkPrintBackendClass - void (*printer_status_changed) (GtkPrintBackend *backend, - GtkPrinter *printer); - void (*request_password) (GtkPrintBackend *backend, -- const gchar *hostname, -- const gchar *username, -+ gpointer auth_info_required, -+ gpointer auth_info_default, -+ gpointer auth_info_display, -+ gpointer auth_info_visible, - const gchar *prompt); - - /* not a signal */ - void (*set_password) (GtkPrintBackend *backend, -- const gchar *hostname, -- const gchar *username, -- const gchar *password); -+ gchar **auth_info_required, -+ gchar **auth_info); - - /* Padding for future expansion */ - void (*_gtk_reserved1) (void); -@@ -153,9 +154,8 @@ void gtk_print_backend_print_stream (GtkPrintBackend *pri - GList * gtk_print_backend_load_modules (void); - void gtk_print_backend_destroy (GtkPrintBackend *print_backend); - void gtk_print_backend_set_password (GtkPrintBackend *backend, -- const gchar *hostname, -- const gchar *username, -- const gchar *password); -+ gchar **auth_info_required, -+ gchar **auth_info); - - /* Backend-only functions for GtkPrintBackend */ - -diff --git a/modules/printbackends/cups/gtkcupsutils.c b/modules/printbackends/cups/gtkcupsutils.c -index bcd03dc..cd97f10 100644 ---- a/modules/printbackends/cups/gtkcupsutils.c -+++ b/modules/printbackends/cups/gtkcupsutils.c -@@ -187,6 +187,10 @@ gtk_cups_request_new_with_username (http_t *connection, - "requesting-user-name", - NULL, cupsUser ()); - -+ request->auth_info_required = NULL; -+ request->auth_info = NULL; -+ request->need_auth_info = FALSE; -+ - cupsLangFree (language); - - return request; -@@ -241,6 +245,7 @@ gtk_cups_request_free (GtkCupsRequest *request) - } - - g_free (request->username); -+ g_strfreev (request->auth_info_required); - - gtk_cups_result_free (request->result); - -diff --git a/modules/printbackends/cups/gtkcupsutils.h b/modules/printbackends/cups/gtkcupsutils.h -index 47fd106..ba43f87 100644 ---- a/modules/printbackends/cups/gtkcupsutils.h -+++ b/modules/printbackends/cups/gtkcupsutils.h -@@ -99,6 +99,9 @@ struct _GtkCupsRequest - - gint own_http : 1; - gint need_password : 1; -+ gint need_auth_info : 1; -+ gchar **auth_info_required; -+ gchar **auth_info; - GtkCupsPasswordState password_state; - }; - -diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c -index 92d4b9b..b715817 100644 ---- a/modules/printbackends/cups/gtkprintbackendcups.c -+++ b/modules/printbackends/cups/gtkprintbackendcups.c -@@ -94,6 +94,8 @@ typedef struct - GtkCupsRequest *request; - GPollFD *data_poll; - GtkPrintBackendCups *backend; -+ GtkPrintCupsResponseCallbackFunc callback; -+ gpointer callback_data; - - } GtkPrintCupsDispatchWatch; - -@@ -179,13 +181,13 @@ static cairo_surface_t * cups_printer_create_cairo_surface (GtkPrinter - gdouble height, - GIOChannel *cache_io); - --static void gtk_print_backend_cups_set_password (GtkPrintBackend *backend, -- const gchar *hostname, -- const gchar *username, -- const gchar *password); -+static void gtk_print_backend_cups_set_password (GtkPrintBackend *backend, -+ gchar **auth_info_required, -+ gchar **auth_info); - --void overwrite_and_free (gpointer data); --static gboolean is_address_local (const gchar *address); -+void overwrite_and_free (gpointer data); -+static gboolean is_address_local (const gchar *address); -+static gboolean request_auth_info (gpointer data); - - static void - gtk_print_backend_cups_register_type (GTypeModule *module) -@@ -557,6 +559,9 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend, - ps->dnotify = dnotify; - ps->job = g_object_ref (job); - -+ request->need_auth_info = cups_printer->auth_info_required != NULL; -+ request->auth_info_required = g_strdupv (cups_printer->auth_info_required); -+ - cups_request_execute (GTK_PRINT_BACKEND_CUPS (print_backend), - request, - (GtkPrintCupsResponseCallbackFunc) cups_print_cb, -@@ -656,18 +661,38 @@ is_address_local (const gchar *address) - } - - static void --gtk_print_backend_cups_set_password (GtkPrintBackend *backend, -- const gchar *hostname, -- const gchar *username, -- const gchar *password) -+gtk_print_backend_cups_set_password (GtkPrintBackend *backend, -+ gchar **auth_info_required, -+ gchar **auth_info) - { - GtkPrintBackendCups *cups_backend = GTK_PRINT_BACKEND_CUPS (backend); - GList *l; - char dispatch_hostname[HTTP_MAX_URI]; - gchar *key; -+ gchar *username = NULL; -+ gchar *hostname = NULL; -+ gchar *password = NULL; -+ gint length; -+ gint i; - -- key = g_strconcat (username, "@", hostname, NULL); -- g_hash_table_insert (cups_backend->auth, key, g_strdup (password)); -+ length = g_strv_length (auth_info_required); -+ -+ if (auth_info != NULL) -+ for (i = 0; i < length; i++) -+ { -+ if (g_strcmp0 (auth_info_required[i], "username") == 0) -+ username = g_strdup (auth_info[i]); -+ else if (g_strcmp0 (auth_info_required[i], "hostname") == 0) -+ hostname = g_strdup (auth_info[i]); -+ else if (g_strcmp0 (auth_info_required[i], "password") == 0) -+ password = g_strdup (auth_info[i]); -+ } -+ -+ if (hostname != NULL && username != NULL && password != NULL) -+ { -+ key = g_strconcat (username, "@", hostname, NULL); -+ g_hash_table_insert (cups_backend->auth, key, g_strdup (password)); -+ } - - g_free (cups_backend->username); - cups_backend->username = g_strdup (username); -@@ -683,7 +708,18 @@ gtk_print_backend_cups_set_password (GtkPrintBackend *backend, - if (is_address_local (dispatch_hostname)) - strcpy (dispatch_hostname, "localhost"); - -- if (strcmp (hostname, dispatch_hostname) == 0) -+ if (dispatch->request->need_auth_info) -+ { -+ if (auth_info != NULL) -+ { -+ dispatch->request->auth_info = g_new0 (gchar *, length + 1); -+ for (i = 0; i < length; i++) -+ dispatch->request->auth_info[i] = g_strdup (auth_info[i]); -+ } -+ dispatch->backend->authentication_lock = FALSE; -+ dispatch->request->need_auth_info = FALSE; -+ } -+ else if (dispatch->request->password_state == GTK_CUPS_PASSWORD_REQUESTED || auth_info == NULL) - { - overwrite_and_free (dispatch->request->password); - dispatch->request->password = g_strdup (password); -@@ -704,6 +740,12 @@ request_password (gpointer data) - gchar *prompt = NULL; - gchar *key = NULL; - char hostname[HTTP_MAX_URI]; -+ gchar **auth_info_required; -+ gchar **auth_info_default; -+ gchar **auth_info_display; -+ gboolean *auth_info_visible; -+ gint length = 3; -+ gint i; - - if (dispatch->backend->authentication_lock) - return FALSE; -@@ -717,6 +759,22 @@ request_password (gpointer data) - else - username = cupsUser (); - -+ auth_info_required = g_new0 (gchar*, length + 1); -+ auth_info_required[0] = g_strdup ("hostname"); -+ auth_info_required[1] = g_strdup ("username"); -+ auth_info_required[2] = g_strdup ("password"); -+ -+ auth_info_default = g_new0 (gchar*, length + 1); -+ auth_info_default[0] = g_strdup (hostname); -+ auth_info_default[1] = g_strdup (username); -+ -+ auth_info_display = g_new0 (gchar*, length + 1); -+ auth_info_display[1] = g_strdup (_("Username:")); -+ auth_info_display[2] = g_strdup (_("Password:")); -+ -+ auth_info_visible = g_new0 (gboolean, length + 1); -+ auth_info_visible[1] = TRUE; -+ - key = g_strconcat (username, "@", hostname, NULL); - password = g_hash_table_lookup (dispatch->backend->auth, key); - -@@ -784,11 +842,22 @@ request_password (gpointer data) - g_free (printer_name); - - g_signal_emit_by_name (dispatch->backend, "request-password", -- hostname, username, prompt); -+ auth_info_required, auth_info_default, auth_info_display, auth_info_visible, prompt); - - g_free (prompt); - } - -+ for (i = 0; i < length; i++) -+ { -+ g_free (auth_info_required[i]); -+ g_free (auth_info_default[i]); -+ g_free (auth_info_display[i]); -+ } -+ -+ g_free (auth_info_required); -+ g_free (auth_info_default); -+ g_free (auth_info_display); -+ g_free (auth_info_visible); - g_free (key); - - return FALSE; -@@ -828,6 +897,133 @@ cups_dispatch_add_poll (GSource *source) - } - - static gboolean -+check_auth_info (gpointer user_data) -+{ -+ GtkPrintCupsDispatchWatch *dispatch; -+ dispatch = (GtkPrintCupsDispatchWatch *) user_data; -+ -+ if (!dispatch->request->need_auth_info) -+ { -+ if (dispatch->request->auth_info == NULL) -+ { -+ dispatch->callback (GTK_PRINT_BACKEND (dispatch->backend), -+ gtk_cups_request_get_result (dispatch->request), -+ dispatch->callback_data); -+ g_source_destroy ((GSource *) dispatch); -+ } -+ else -+ { -+ gint length; -+ gint i; -+ -+ length = g_strv_length (dispatch->request->auth_info_required); -+ -+ gtk_cups_request_ipp_add_strings (dispatch->request, -+ IPP_TAG_JOB, -+ IPP_TAG_TEXT, -+ "auth-info", -+ length, -+ NULL, -+ dispatch->request->auth_info); -+ -+ g_source_attach ((GSource *) dispatch, NULL); -+ g_source_unref ((GSource *) dispatch); -+ -+ for (i = 0; i < length; i++) -+ overwrite_and_free (dispatch->request->auth_info[i]); -+ g_free (dispatch->request->auth_info); -+ dispatch->request->auth_info = NULL; -+ } -+ -+ return FALSE; -+ } -+ -+ return TRUE; -+} -+ -+static gboolean -+request_auth_info (gpointer user_data) -+{ -+ GtkPrintCupsDispatchWatch *dispatch; -+ const char *job_title; -+ const char *printer_uri; -+ gchar *prompt = NULL; -+ char *printer_name = NULL; -+ gint length; -+ gint i; -+ gboolean *auth_info_visible = NULL; -+ gchar **auth_info_default = NULL; -+ gchar **auth_info_display = NULL; -+ -+ dispatch = (GtkPrintCupsDispatchWatch *) user_data; -+ -+ if (dispatch->backend->authentication_lock) -+ return FALSE; -+ -+ job_title = gtk_cups_request_ipp_get_string (dispatch->request, IPP_TAG_NAME, "job-name"); -+ printer_uri = gtk_cups_request_ipp_get_string (dispatch->request, IPP_TAG_URI, "printer-uri"); -+ length = g_strv_length (dispatch->request->auth_info_required); -+ -+ auth_info_visible = g_new0 (gboolean, length); -+ auth_info_default = g_new0 (gchar *, length + 1); -+ auth_info_display = g_new0 (gchar *, length + 1); -+ -+ for (i = 0; i < length; i++) -+ { -+ if (g_strcmp0 (dispatch->request->auth_info_required[i], "domain") == 0) -+ { -+ auth_info_display[i] = g_strdup (_("Domain:")); -+ auth_info_default[i] = g_strdup ("WORKGROUP"); -+ auth_info_visible[i] = TRUE; -+ } -+ else if (g_strcmp0 (dispatch->request->auth_info_required[i], "username") == 0) -+ { -+ auth_info_display[i] = g_strdup (_("Username:")); -+ if (dispatch->backend->username != NULL) -+ auth_info_default[i] = g_strdup (dispatch->backend->username); -+ else -+ auth_info_default[i] = g_strdup (cupsUser ()); -+ auth_info_visible[i] = TRUE; -+ } -+ else if (g_strcmp0 (dispatch->request->auth_info_required[i], "password") == 0) -+ { -+ auth_info_display[i] = g_strdup (_("Password:")); -+ auth_info_visible[i] = FALSE; -+ } -+ } -+ -+ if (printer_uri != NULL && strrchr (printer_uri, '/') != NULL) -+ printer_name = g_strdup (strrchr (printer_uri, '/') + 1); -+ -+ dispatch->backend->authentication_lock = TRUE; -+ -+ if (job_title != NULL && printer_name != NULL) -+ prompt = g_strdup_printf ( _("Authentication informations are required to print document '%s' on printer %s"), job_title, printer_name); -+ -+ g_signal_emit_by_name (dispatch->backend, "request-password", -+ dispatch->request->auth_info_required, -+ auth_info_default, -+ auth_info_display, -+ auth_info_visible, -+ prompt); -+ -+ for (i = 0; i < length; i++) -+ { -+ g_free (auth_info_default[i]); -+ g_free (auth_info_display[i]); -+ } -+ -+ g_free (auth_info_default); -+ g_free (auth_info_display); -+ g_free (printer_name); -+ g_free (prompt); -+ -+ g_idle_add (check_auth_info, user_data); -+ -+ return FALSE; -+} -+ -+static gboolean - cups_dispatch_watch_check (GSource *source) - { - GtkPrintCupsDispatchWatch *dispatch; -@@ -1008,13 +1204,24 @@ cups_request_execute (GtkPrintBackendCups *print_backend, - dispatch->request = request; - dispatch->backend = g_object_ref (print_backend); - dispatch->data_poll = NULL; -+ dispatch->callback = NULL; -+ dispatch->callback_data = NULL; - - print_backend->requests = g_list_prepend (print_backend->requests, dispatch); - - g_source_set_callback ((GSource *) dispatch, (GSourceFunc) callback, user_data, notify); - -- g_source_attach ((GSource *) dispatch, NULL); -- g_source_unref ((GSource *) dispatch); -+ if (request->need_auth_info) -+ { -+ dispatch->callback = callback; -+ dispatch->callback_data = user_data; -+ request_auth_info (dispatch); -+ } -+ else -+ { -+ g_source_attach ((GSource *) dispatch, NULL); -+ g_source_unref ((GSource *) dispatch); -+ } - } - - #if 0 -@@ -1435,6 +1642,7 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend, - gchar *default_cover_before = NULL; - gchar *default_cover_after = NULL; - gboolean remote_printer = FALSE; -+ gchar **auth_info_required = NULL; - - /* Skip leading attributes until we hit a printer... - */ -@@ -1553,6 +1761,15 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend, - else - remote_printer = FALSE; - } -+ else if (strcmp (attr->name, "auth-info-required") == 0) -+ { -+ if (strcmp (attr->values[0].string.text, "none") != 0) -+ { -+ auth_info_required = g_new0 (gchar *, attr->num_values + 1); -+ for (i = 0; i < attr->num_values; i++) -+ auth_info_required[i] = g_strdup (attr->values[i].string.text); -+ } -+ } - else - { - GTK_NOTE (PRINTING, -@@ -1674,6 +1891,9 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend, - cups_printer->hostname = g_strdup (hostname); - cups_printer->port = port; - -+ cups_printer->auth_info_required = g_strdupv (auth_info_required); -+ g_strfreev (auth_info_required); -+ - printer = GTK_PRINTER (cups_printer); - - if (cups_backend->default_printer != NULL && -@@ -1866,7 +2086,8 @@ cups_request_printer_list (GtkPrintBackendCups *cups_backend) - "printer-is-accepting-jobs", - "job-sheets-supported", - "job-sheets-default", -- "printer-type" -+ "printer-type", -+ "auth-info-required" - }; - - if (cups_backend->list_printers_pending) -diff --git a/modules/printbackends/cups/gtkprintercups.c b/modules/printbackends/cups/gtkprintercups.c -index cd27b17..efdb0e5 100644 ---- a/modules/printbackends/cups/gtkprintercups.c -+++ b/modules/printbackends/cups/gtkprintercups.c -@@ -77,6 +77,7 @@ gtk_printer_cups_init (GtkPrinterCups *printer) - printer->ppd_file = NULL; - printer->default_cover_before = NULL; - printer->default_cover_after = NULL; -+ printer->auth_info_required = NULL; - } - - static void -@@ -94,6 +95,7 @@ gtk_printer_cups_finalize (GObject *object) - g_free (printer->ppd_name); - g_free (printer->default_cover_before); - g_free (printer->default_cover_after); -+ g_strfreev (printer->auth_info_required); - - if (printer->ppd_file) - ppdClose (printer->ppd_file); -diff --git a/modules/printbackends/cups/gtkprintercups.h b/modules/printbackends/cups/gtkprintercups.h -index cd2b318..7a869a0 100644 ---- a/modules/printbackends/cups/gtkprintercups.h -+++ b/modules/printbackends/cups/gtkprintercups.h -@@ -47,6 +47,7 @@ struct _GtkPrinterCups - gchar *printer_uri; - gchar *hostname; - gint port; -+ gchar **auth_info_required; - - ipp_pstate_t state; - gboolean reading_ppd; --- -1.6.2.5 - diff --git a/gtk2.spec b/gtk2.spec index b4c62c9..1c9c7dc 100644 --- a/gtk2.spec +++ b/gtk2.spec @@ -11,13 +11,13 @@ %define libpng_version 2:1.2.2-16 %define xrandr_version 1.2.99.4-2 -%define base_version 2.18.0 +%define base_version 2.18.3 %define bin_version 2.10.0 Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X Name: gtk2 Version: %{base_version} -Release: 5%{?dist} +Release: 16%{?dist} License: LGPLv2+ Group: System Environment/Libraries Source: http://download.gnome.org/sources/gtk+/2.18/gtk+-%{version}.tar.bz2 @@ -27,15 +27,25 @@ Source3: im-cedilla.conf # Biarch changes Patch0: gtk+-2.13.5-lib64.patch - -# https://bugzilla.gnome.org/show_bug.cgi?id=566522 -Patch1: gtk2-printing-smb-auth.patch -# https://bugzilla.gnome.org/show_bug.cgi?id=586207 -Patch2: gtk2-printing-nonblocking-printer-list.patch +Patch1: system-python.patch +# https://bugzilla.gnome.org/show_bug.cgi?id=583273 +Patch2: icon-padding.patch # from upstream -Patch3: fix-anchors.patch +Patch3: image-size-alloc.patch +# https://bugzilla.gnome.org/show_bug.cgi?id=599617 +Patch4: fresh-tooltips.patch # from upstream -Patch4: iconview-crash.patch +Patch5: allow-set-hint.patch +# from upstream +Patch6: compose-sequences.patch +# from upstream +Patch7: symbolic-color-parsing.patch +# https://bugzilla.gnome.org/show_bug.cgi?id=599618 +Patch8: tooltip-positioning.patch +# https://bugzilla.gnome.org/show_bug.cgi?id=581150 +Patch9: iconview-hang.patch +# https://bugzilla.gnome.org/show_bug.cgi?id=599446 +Patch10: toolbutton-assert.patch BuildRequires: atk-devel >= %{atk_version} BuildRequires: pango-devel >= %{pango_version} @@ -147,15 +157,16 @@ This package contains developer documentation for the GTK+ widget toolkit. %setup -q -n gtk+-%{version} %patch0 -p1 -b .lib64 -%patch1 -p1 -b .printing-smb-auth -%patch2 -p1 -b .printing-nonblocking-printer-list -%patch3 -p1 -b .fix-anchors -%patch4 -p1 -b .iconview-crash - -# make sure that gtkmarshalers.{c, h} get regenerated during the build -# - caused by print_authentication.patch -rm --force ./gtk/gtkmarshalers.c -rm --force ./gtk/gtkmarshalers.h +%patch1 -p1 -b .system-python +%patch2 -p1 -b .icon-padding +%patch3 -p1 -b .image-size-alloc +%patch4 -p1 -b .fresh-tooltips +%patch5 -p1 -b .allow-set-hint +%patch6 -p1 -b .compose-sequences +%patch7 -p1 -b .symbolic-color-parsing +%patch8 -p1 -b .tooltip-positioning +%patch9 -p1 -b .iconview-hang +%patch10 -p1 -b .toolbutton-assert %build libtoolize --force --copy @@ -392,6 +403,67 @@ fi %changelog +* Sat Oct 31 2009 Matthias Clasen - 2.18.3-16 +- Handle screen changes for tooltips (#531568) + +* Wed Oct 28 2009 Matthias Clasen - 2.18.3-15 +- Work around a bug in the X automatic compositor (#531443) + +* Wed Oct 28 2009 Matthias Clasen - 2.18.3-14 +- Make the new tooltips sharp +- Improve the Metacity compositor workaround for new tooltips + +* Mon Oct 26 2009 Matthias Clasen - 2.18.3-12 +- Fix a possible assertion failure in GtkToolButton + +* Fri Oct 23 2009 Matthew Barnes - 2.18.3-11 +- Fix a GtkIconView hang + +* Fri Oct 23 2009 Matthias Clasen - 2.18.3-10 +- Tweak tooltip positioning +- Make new tooltip style an opt-in theme choice + +* Thu Oct 22 2009 Matthias Clasen - 2.18.3-9 +- Fix a problem with parsing symbolic colors in rc files (#528662) + +* Thu Oct 22 2009 Peter Hutterer - 2.18.3-8 +- compose-sequences.patch: update compose sequences to what's currently in + libX11 git. + +* Wed Oct 21 2009 Matthias Clasen - 2.18.3-7 +- Try to catch some nm-applet problems by rejecting requests to + load icons at size 0 + +* Wed Oct 21 2009 Matthias Clasen - 2.18.3-6 +- Hack around metacity compositor limitations + +* Wed Oct 21 2009 Matthias Clasen - 2.18.3-5 +- Tweak tooltip appearance + +* Tue Oct 20 2009 Matthias Clasen - 2.18.3-4 +- Make tooltips look nicer + +* Sun Oct 18 2009 Matthias Clasen - 2.18.3-3 +- Fix a size allocation problem uncovered by the previous patch + +* Sat Oct 17 2009 Matthias Clasen - 2.18.3-2 +- Support padding around status icons + +* Sat Oct 17 2009 Matthias Clasen - 2.18.3-1 +- Update to 2.18.3 + +* Tue Oct 13 2009 Matthias Clasen - 2.18.2-3 +- Make gtk-builder-convert use system python + +* Fri Oct 9 2009 Matthias Clasen - 2.18.2-2 +- Make selecting the final char work again (#528072) + +* Mon Oct 5 2009 Matthias Clasen - 2.18.2-1 +- Update to 2.18.2 + +* Wed Sep 30 2009 Matthias Clasen - 2.18.1-1 +- Update to 2.18.1 + * Mon Sep 28 2009 Matthias Clasen - 2.18.0-3 - Fix a crash in the appearance capplet diff --git a/icon-padding.patch b/icon-padding.patch new file mode 100644 index 0000000..f891d49 --- /dev/null +++ b/icon-padding.patch @@ -0,0 +1,261 @@ +diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c +index 1cdb0c1..62b3913 100644 +--- a/gtk/gtkstatusicon.c ++++ b/gtk/gtkstatusicon.c +@@ -170,6 +170,7 @@ static void gtk_status_icon_screen_changed (GtkStatusIcon *status_icon, + GdkScreen *old_screen); + static void gtk_status_icon_embedded_changed (GtkStatusIcon *status_icon); + static void gtk_status_icon_orientation_changed (GtkStatusIcon *status_icon); ++static void gtk_status_icon_padding_changed (GtkStatusIcon *status_icon); + static gboolean gtk_status_icon_scroll (GtkStatusIcon *status_icon, + GdkEventScroll *event); + static gboolean gtk_status_icon_query_tooltip (GtkStatusIcon *status_icon, +@@ -850,6 +851,8 @@ gtk_status_icon_init (GtkStatusIcon *status_icon) + G_CALLBACK (gtk_status_icon_embedded_changed), status_icon); + g_signal_connect_swapped (priv->tray_icon, "notify::orientation", + G_CALLBACK (gtk_status_icon_orientation_changed), status_icon); ++ g_signal_connect_swapped (priv->tray_icon, "notify::padding", ++ G_CALLBACK (gtk_status_icon_padding_changed), status_icon); + g_signal_connect_swapped (priv->tray_icon, "button-press-event", + G_CALLBACK (gtk_status_icon_button_press), status_icon); + g_signal_connect_swapped (priv->tray_icon, "button-release-event", +@@ -975,6 +978,8 @@ gtk_status_icon_finalize (GObject *object) + g_signal_handlers_disconnect_by_func (priv->tray_icon, + gtk_status_icon_orientation_changed, status_icon); + g_signal_handlers_disconnect_by_func (priv->tray_icon, ++ gtk_status_icon_padding_changed, status_icon); ++ g_signal_handlers_disconnect_by_func (priv->tray_icon, + gtk_status_icon_button_press, status_icon); + g_signal_handlers_disconnect_by_func (priv->tray_icon, + gtk_status_icon_button_release, status_icon); +@@ -1679,14 +1684,32 @@ gtk_status_icon_screen_changed (GtkStatusIcon *status_icon, + #ifdef GDK_WINDOWING_X11 + + static void ++gtk_status_icon_padding_changed (GtkStatusIcon *status_icon) ++{ ++ GtkStatusIconPrivate *priv = status_icon->priv; ++ GtkOrientation orientation; ++ gint padding; ++ ++ orientation = _gtk_tray_icon_get_orientation (GTK_TRAY_ICON (priv->tray_icon)); ++ padding = _gtk_tray_icon_get_padding (GTK_TRAY_ICON (priv->tray_icon)); ++ ++ if (orientation == GTK_ORIENTATION_HORIZONTAL) ++ gtk_misc_set_padding (GTK_MISC (priv->image), padding, 0); ++ else ++ gtk_misc_set_padding (GTK_MISC (priv->image), 0, padding); ++} ++ ++static void + gtk_status_icon_embedded_changed (GtkStatusIcon *status_icon) + { ++ gtk_status_icon_padding_changed (status_icon); + g_object_notify (G_OBJECT (status_icon), "embedded"); + } + + static void + gtk_status_icon_orientation_changed (GtkStatusIcon *status_icon) + { ++ gtk_status_icon_padding_changed (status_icon); + g_object_notify (G_OBJECT (status_icon), "orientation"); + } + +@@ -1804,7 +1827,7 @@ gtk_status_icon_reset_image_data (GtkStatusIcon *status_icon) + + g_object_notify (G_OBJECT (status_icon), "stock"); + break; +- ++ + case GTK_IMAGE_ICON_NAME: + g_free (priv->image_data.icon_name); + priv->image_data.icon_name = NULL; +diff --git a/gtk/gtktrayicon-x11.c b/gtk/gtktrayicon-x11.c +index 32c3140..74413df 100644 +--- a/gtk/gtktrayicon-x11.c ++++ b/gtk/gtktrayicon-x11.c +@@ -43,23 +43,26 @@ + + enum { + PROP_0, +- PROP_ORIENTATION ++ PROP_ORIENTATION, ++ PROP_PADDING + }; + + struct _GtkTrayIconPrivate + { + guint stamp; +- ++ + Atom selection_atom; + Atom manager_atom; + Atom system_tray_opcode_atom; + Atom orientation_atom; + Atom visual_atom; ++ Atom padding_atom; + Window manager_window; + GdkVisual *manager_visual; + gboolean manager_visual_rgba; + + GtkOrientation orientation; ++ gint padding; + }; + + static void gtk_tray_icon_constructed (GObject *object); +@@ -113,6 +116,16 @@ gtk_tray_icon_class_init (GtkTrayIconClass *class) + GTK_ORIENTATION_HORIZONTAL, + GTK_PARAM_READABLE)); + ++ g_object_class_install_property (gobject_class, ++ PROP_PADDING, ++ g_param_spec_int ("padding", ++ P_("Padding"), ++ P_("Padding that should be put around icons in the tray"), ++ 0, ++ G_MAXINT, ++ 0, ++ GTK_PARAM_READABLE)); ++ + g_type_class_add_private (class, sizeof (GtkTrayIconPrivate)); + } + +@@ -124,6 +137,7 @@ gtk_tray_icon_init (GtkTrayIcon *icon) + + icon->priv->stamp = 1; + icon->priv->orientation = GTK_ORIENTATION_HORIZONTAL; ++ icon->priv->padding = 0; + + gtk_widget_set_app_paintable (GTK_WIDGET (icon), TRUE); + gtk_widget_add_events (GTK_WIDGET (icon), GDK_PROPERTY_CHANGE_MASK); +@@ -161,6 +175,10 @@ gtk_tray_icon_constructed (GObject *object) + "_NET_SYSTEM_TRAY_VISUAL", + False); + ++ icon->priv->padding_atom = XInternAtom (xdisplay, ++ "_NET_SYSTEM_TRAY_PADDING", ++ False); ++ + /* Add a root window filter so that we get changes on MANAGER */ + gdk_window_add_filter (root_window, + gtk_tray_icon_manager_filter, icon); +@@ -212,6 +230,9 @@ gtk_tray_icon_get_property (GObject *object, + case PROP_ORIENTATION: + g_value_set_enum (value, icon->priv->orientation); + break; ++ case PROP_PADDING: ++ g_value_set_int (value, icon->priv->padding); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -372,9 +393,58 @@ gtk_tray_icon_get_visual_property (GtkTrayIcon *icon) + XFree (prop.prop); + } + ++static void ++gtk_tray_icon_get_padding_property (GtkTrayIcon *icon) ++{ ++ GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (icon)); ++ GdkDisplay *display = gdk_screen_get_display (screen); ++ Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); ++ ++ Atom type; ++ int format; ++ union { ++ gulong *prop; ++ guchar *prop_ch; ++ } prop = { NULL }; ++ gulong nitems; ++ gulong bytes_after; ++ int error, result; ++ ++ g_assert (icon->priv->manager_window != None); ++ ++ gdk_error_trap_push (); ++ type = None; ++ result = XGetWindowProperty (xdisplay, ++ icon->priv->manager_window, ++ icon->priv->padding_atom, ++ 0, G_MAXLONG, FALSE, ++ XA_CARDINAL, ++ &type, &format, &nitems, ++ &bytes_after, &(prop.prop_ch)); ++ error = gdk_error_trap_pop (); ++ ++ if (!error && result == Success && ++ type == XA_CARDINAL && nitems == 1 && format == 32) ++ { ++ gint padding; ++ ++ padding = prop.prop[0]; ++ ++ if (icon->priv->padding != padding) ++ { ++ icon->priv->padding = padding; ++ ++ g_object_notify (G_OBJECT (icon), "padding"); ++ } ++ } ++ ++ if (type != None) ++ XFree (prop.prop); ++} ++ + static GdkFilterReturn +-gtk_tray_icon_manager_filter (GdkXEvent *xevent, +- GdkEvent *event, ++gtk_tray_icon_manager_filter (GdkXEvent *xevent, ++ GdkEvent *event, + gpointer user_data) + { + GtkTrayIcon *icon = user_data; +@@ -399,6 +469,11 @@ gtk_tray_icon_manager_filter (GdkXEvent *xevent, + + gtk_tray_icon_get_orientation_property (icon); + } ++ else if (xev->xany.type == PropertyNotify && ++ xev->xproperty.atom == icon->priv->padding_atom) ++ { ++ gtk_tray_icon_get_padding_property (icon); ++ } + else if (xev->xany.type == DestroyNotify) + { + GTK_NOTE (PLUGSOCKET, +@@ -504,6 +579,7 @@ gtk_tray_icon_update_manager_window (GtkTrayIcon *icon) + + gtk_tray_icon_get_orientation_property (icon); + gtk_tray_icon_get_visual_property (icon); ++ gtk_tray_icon_get_padding_property (icon); + + if (GTK_WIDGET_REALIZED (icon)) + { +@@ -740,6 +816,14 @@ _gtk_tray_icon_get_orientation (GtkTrayIcon *icon) + return icon->priv->orientation; + } + ++gint ++_gtk_tray_icon_get_padding (GtkTrayIcon *icon) ++{ ++ g_return_val_if_fail (GTK_IS_TRAY_ICON (icon), 0); ++ ++ return icon->priv->padding; ++} ++ + + #define __GTK_TRAY_ICON_X11_C__ + #include "gtkaliasdef.c" +diff --git a/gtk/gtktrayicon.h b/gtk/gtktrayicon.h +index 4c1e184..6dc9852 100644 +--- a/gtk/gtktrayicon.h ++++ b/gtk/gtktrayicon.h +@@ -69,7 +69,8 @@ void _gtk_tray_icon_cancel_message (GtkTrayIcon *icon, + guint id); + + GtkOrientation _gtk_tray_icon_get_orientation (GtkTrayIcon *icon); +- ++gint _gtk_tray_icon_get_padding (GtkTrayIcon *icon); ++ + G_END_DECLS + + #endif /* __GTK_TRAY_ICON_H__ */ diff --git a/iconview-crash.patch b/iconview-crash.patch deleted file mode 100644 index 90d547f..0000000 --- a/iconview-crash.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -up gtk+-2.18.0/gtk/gtkiconview.c.iconview-crash gtk+-2.18.0/gtk/gtkiconview.c ---- gtk+-2.18.0/gtk/gtkiconview.c.iconview-crash 2009-09-28 12:38:46.956098207 -0400 -+++ gtk+-2.18.0/gtk/gtkiconview.c 2009-09-28 12:40:03.636858596 -0400 -@@ -3469,6 +3469,9 @@ gtk_icon_view_get_item_at_coords (GtkIco - GList *items, *l; - GdkRectangle box; - -+ if (cell_at_pos) -+ *cell_at_pos = NULL; -+ - for (items = icon_view->priv->items; items; items = items->next) - { - GtkIconViewItem *item = items->data; -@@ -3503,9 +3506,6 @@ gtk_icon_view_get_item_at_coords (GtkIco - } - } - -- if (cell_at_pos) -- *cell_at_pos = NULL; -- - if (only_in_cell) - return NULL; - } diff --git a/iconview-hang.patch b/iconview-hang.patch new file mode 100644 index 0000000..8c441c8 --- /dev/null +++ b/iconview-hang.patch @@ -0,0 +1,15 @@ +diff -up gtk+-2.18.3/gtk/gtkiconview.c.icon-view-hang gtk+-2.18.3/gtk/gtkiconview.c +--- gtk+-2.18.3/gtk/gtkiconview.c.icon-view-hang 2009-10-09 01:00:44.000000000 -0400 ++++ gtk+-2.18.3/gtk/gtkiconview.c 2009-10-23 20:09:18.670311545 -0400 +@@ -1545,6 +1545,11 @@ gtk_icon_view_expose (GtkWidget *widget, + if (expose->window != icon_view->priv->bin_window) + return FALSE; + ++ /* If a layout has been scheduled, do it now so that all ++ * cell view items have valid sizes before we proceed. */ ++ if (icon_view->priv->layout_idle_id != 0) ++ gtk_icon_view_layout (icon_view); ++ + cr = gdk_cairo_create (icon_view->priv->bin_window); + cairo_set_line_width (cr, 1.); + diff --git a/image-size-alloc.patch b/image-size-alloc.patch new file mode 100644 index 0000000..ce9729a --- /dev/null +++ b/image-size-alloc.patch @@ -0,0 +1,73 @@ +--- /home/mclasen/git.gnome.org/gtk+/gtk/gtkimage.c 2009-06-04 15:18:04.063943764 -0400 ++++ gtk+-2.18.3/gtk/gtkimage.c 2009-10-18 01:31:00.705062264 -0400 +@@ -45,6 +45,7 @@ + gchar *filename; + + gint pixel_size; ++ guint need_calc_size : 1; + }; + + #define GTK_IMAGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_IMAGE, GtkImagePrivate)) +@@ -1710,6 +1711,7 @@ + { + GtkImage *image; + GtkMisc *misc; ++ GtkImagePrivate *priv; + GdkRectangle area, image_bound; + gfloat xalign; + gint x, y, mask_x, mask_y; +@@ -1719,6 +1721,7 @@ + + image = GTK_IMAGE (widget); + misc = GTK_MISC (widget); ++ priv = GTK_IMAGE_GET_PRIVATE (image); + + area = event->area; + +@@ -1727,7 +1730,7 @@ + * and size_request() if something explicitely forces + * a redraw. + */ +- if (widget->requisition.width == 0 && widget->requisition.height == 0) ++ if (priv->need_calc_size) + gtk_image_calc_size (image); + + if (!gdk_rectangle_intersect (&area, &widget->allocation, &area)) +@@ -1737,7 +1740,7 @@ + xalign = misc->xalign; + else + xalign = 1.0 - misc->xalign; +- ++ + x = floor (widget->allocation.x + misc->xpad + + ((widget->allocation.width - widget->requisition.width) * xalign)); + y = floor (widget->allocation.y + misc->ypad +@@ -2149,8 +2152,13 @@ + void + gtk_image_clear (GtkImage *image) + { +- gtk_image_reset (image); ++ GtkImagePrivate *priv; ++ ++ priv = GTK_IMAGE_GET_PRIVATE (image); ++ ++ priv->need_calc_size = 1; + ++ gtk_image_reset (image); + gtk_image_update_size (image, 0, 0); + } + +@@ -2159,7 +2167,12 @@ + { + GtkWidget *widget = GTK_WIDGET (image); + GdkPixbuf *pixbuf = NULL; +- ++ GtkImagePrivate *priv; ++ ++ priv = GTK_IMAGE_GET_PRIVATE (image); ++ ++ priv->need_calc_size = 0; ++ + /* We update stock/icon set on every size request, because + * the theme could have affected the size; for other kinds of + * image, we just update the requisition when the image data diff --git a/print_authentication.patch b/print_authentication.patch deleted file mode 100644 index 19b809c..0000000 --- a/print_authentication.patch +++ /dev/null @@ -1,1389 +0,0 @@ -Index: gtk/gtkmarshalers.list -=================================================================== ---- gtk/gtkmarshalers.list (revision 22586) -+++ gtk/gtkmarshalers.list (working copy) -@@ -97,6 +97,7 @@ - VOID:STRING - VOID:STRING,BOXED - VOID:STRING,STRING -+VOID:STRING,STRING,STRING - VOID:STRING,INT,POINTER - VOID:STRING,UINT,FLAGS - VOID:STRING,UINT,FLAGS,UINT -Index: gtk/gtkprintbackend.c -=================================================================== ---- gtk/gtkprintbackend.c (revision 22586) -+++ gtk/gtkprintbackend.c (working copy) -@@ -25,6 +25,7 @@ - - #include "gtkintl.h" - #include "gtkmodules.h" -+#include "gtkmarshalers.h" - #include "gtkprivate.h" - #include "gtkprintbackend.h" - #include "gtkprinter-private.h" -@@ -49,6 +50,9 @@ - guint printer_list_requested : 1; - guint printer_list_done : 1; - GtkPrintBackendStatus status; -+ char *hostname; -+ char *username; -+ char *password; - }; - - enum { -@@ -57,6 +61,7 @@ - PRINTER_ADDED, - PRINTER_REMOVED, - PRINTER_STATUS_CHANGED, -+ REQUEST_PASSWORD, - LAST_SIGNAL - }; - -@@ -353,6 +358,10 @@ - static GList * fallback_printer_list_papers (GtkPrinter *printer); - static GtkPageSetup * fallback_printer_get_default_page_size (GtkPrinter *printer); - static GtkPrintCapabilities fallback_printer_get_capabilities (GtkPrinter *printer); -+static void request_password (GtkPrintBackend *backend, -+ const gchar *hostname, -+ const gchar *username, -+ const gchar *prompt); - - static void - gtk_print_backend_class_init (GtkPrintBackendClass *class) -@@ -372,6 +381,7 @@ - class->printer_list_papers = fallback_printer_list_papers; - class->printer_get_default_page_size = fallback_printer_get_default_page_size; - class->printer_get_capabilities = fallback_printer_get_capabilities; -+ class->request_password = request_password; - - g_object_class_install_property (object_class, - PROP_STATUS, -@@ -425,6 +435,14 @@ - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, GTK_TYPE_PRINTER); -+ signals[REQUEST_PASSWORD] = -+ g_signal_new (I_("request-password"), -+ G_TYPE_FROM_CLASS (class), -+ G_SIGNAL_RUN_LAST, -+ G_STRUCT_OFFSET (GtkPrintBackendClass, request_password), -+ NULL, NULL, -+ _gtk_marshal_VOID__STRING_STRING_STRING, -+ G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); - } - - static void -@@ -437,6 +455,9 @@ - priv->printers = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) g_object_unref); -+ priv->hostname = NULL; -+ priv->username = NULL; -+ priv->password = NULL; - } - - static void -@@ -640,6 +661,167 @@ - dnotify); - } - -+void -+gtk_print_backend_set_password (GtkPrintBackend *backend, -+ const gchar *hostname, -+ const gchar *username, -+ const gchar *password) -+{ -+ g_return_if_fail (GTK_IS_PRINT_BACKEND (backend)); -+ -+ if (GTK_PRINT_BACKEND_GET_CLASS (backend)->set_password) -+ GTK_PRINT_BACKEND_GET_CLASS (backend)->set_password (backend, hostname, username, password); -+} -+ -+static void -+store_password (GtkEntry *entry, -+ GtkPrintBackend *backend) -+{ -+ GtkPrintBackendPrivate *priv = backend->priv; -+ -+ if (priv->password != NULL) -+ { -+ memset (priv->password, 0, strlen (priv->password)); -+ g_free (priv->password); -+ } -+ -+ priv->password = g_strdup (gtk_entry_get_text (entry)); -+} -+ -+static void -+store_username (GtkEntry *entry, -+ GtkPrintBackend *backend) -+{ -+ GtkPrintBackendPrivate *priv = backend->priv; -+ -+ g_free (priv->username); -+ priv->username = g_strdup (gtk_entry_get_text (entry)); -+} -+ -+static void -+password_dialog_response (GtkWidget *dialog, -+ gint response_id, -+ GtkPrintBackend *backend) -+{ -+ GtkPrintBackendPrivate *priv = backend->priv; -+ -+ if (response_id == GTK_RESPONSE_OK) -+ gtk_print_backend_set_password (backend, priv->hostname, priv->username, priv->password); -+ else -+ gtk_print_backend_set_password (backend, priv->hostname, priv->username, NULL); -+ -+ if (priv->password != NULL) -+ { -+ memset (priv->password, 0, strlen (priv->password)); -+ g_free (priv->password); -+ priv->password = NULL; -+ } -+ -+ g_free (priv->username); -+ priv->username = NULL; -+ -+ gtk_widget_destroy (dialog); -+ -+ g_object_unref (backend); -+} -+ -+static void -+request_password (GtkPrintBackend *backend, -+ const gchar *hostname, -+ const gchar *username, -+ const gchar *prompt) -+{ -+ GtkPrintBackendPrivate *priv = backend->priv; -+ GtkWidget *dialog, *username_box, *password_box, *main_box, *label, *icon, *vbox, -+ *password_prompt, *username_prompt, -+ *password_entry, *username_entry; -+ gchar *markup; -+ -+ dialog = gtk_dialog_new_with_buttons ( _("Authentication"), NULL, GTK_DIALOG_MODAL, -+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, -+ GTK_STOCK_OK, GTK_RESPONSE_OK, -+ NULL); -+ -+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); -+ gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); -+ -+ main_box = gtk_hbox_new (FALSE, 0); -+ -+ /* Left */ -+ icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); -+ gtk_misc_set_alignment (GTK_MISC (icon), 0.5, 0.0); -+ gtk_misc_set_padding (GTK_MISC (icon), 6, 6); -+ -+ -+ /* Right */ -+ vbox = gtk_vbox_new (FALSE, 0); -+ gtk_widget_set_size_request (GTK_WIDGET (vbox), 320, -1); -+ -+ /* Right - 1. */ -+ label = gtk_label_new (NULL); -+ markup = g_markup_printf_escaped ("%s", prompt); -+ gtk_label_set_markup (GTK_LABEL (label), markup); -+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); -+ gtk_widget_set_size_request (GTK_WIDGET (label), 320, -1); -+ g_free (markup); -+ -+ -+ /* Right - 2. */ -+ username_box = gtk_hbox_new (TRUE, 0); -+ -+ username_prompt = gtk_label_new (_("Username:")); -+ gtk_misc_set_alignment (GTK_MISC (username_prompt), 0.0, 0.5); -+ -+ username_entry = gtk_entry_new (); -+ gtk_entry_set_text (GTK_ENTRY (username_entry), username); -+ -+ -+ /* Right - 3. */ -+ password_box = gtk_hbox_new (TRUE, 0); -+ -+ password_prompt = gtk_label_new (_("Password:")); -+ gtk_misc_set_alignment (GTK_MISC (password_prompt), 0.0, 0.5); -+ -+ password_entry = gtk_entry_new (); -+ gtk_entry_set_visibility (GTK_ENTRY (password_entry), FALSE); -+ gtk_entry_set_activates_default (GTK_ENTRY (password_entry), TRUE); -+ -+ -+ /* Packing */ -+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), main_box, TRUE, FALSE, 0); -+ -+ gtk_box_pack_start (GTK_BOX (main_box), icon, FALSE, FALSE, 6); -+ gtk_box_pack_start (GTK_BOX (main_box), vbox, FALSE, FALSE, 6); -+ -+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 6); -+ gtk_box_pack_start (GTK_BOX (vbox), username_box, FALSE, TRUE, 6); -+ gtk_box_pack_start (GTK_BOX (vbox), password_box, FALSE, TRUE, 6); -+ -+ gtk_box_pack_start (GTK_BOX (username_box), username_prompt, TRUE, TRUE, 0); -+ gtk_box_pack_start (GTK_BOX (username_box), username_entry, TRUE, TRUE, 0); -+ -+ gtk_box_pack_start (GTK_BOX (password_box), password_prompt, TRUE, TRUE, 0); -+ gtk_box_pack_start (GTK_BOX (password_box), password_entry, TRUE, TRUE, 0); -+ -+ -+ gtk_widget_grab_focus (password_entry); -+ -+ priv->hostname = g_strdup (hostname); -+ priv->username = g_strdup (username); -+ -+ g_signal_connect (password_entry, "changed", -+ G_CALLBACK (store_password), backend); -+ -+ g_signal_connect (username_entry, "changed", -+ G_CALLBACK (store_username), backend); -+ -+ g_object_ref (backend); -+ g_signal_connect (G_OBJECT (dialog), "response", -+ G_CALLBACK (password_dialog_response), backend); -+ -+ gtk_widget_show_all (dialog); -+} -+ - void - gtk_print_backend_destroy (GtkPrintBackend *print_backend) - { -Index: gtk/gtkprintbackend.h -=================================================================== ---- gtk/gtkprintbackend.h (revision 22586) -+++ gtk/gtkprintbackend.h (working copy) -@@ -120,14 +120,22 @@ - GtkPrinter *printer); - void (*printer_status_changed) (GtkPrintBackend *backend, - GtkPrinter *printer); -+ void (*request_password) (GtkPrintBackend *backend, -+ const gchar *hostname, -+ const gchar *username, -+ const gchar *prompt); - -+ /* not a signal */ -+ void (*set_password) (GtkPrintBackend *backend, -+ const gchar *hostname, -+ const gchar *username, -+ const gchar *password); -+ - /* Padding for future expansion */ - void (*_gtk_reserved1) (void); - void (*_gtk_reserved2) (void); - void (*_gtk_reserved3) (void); - void (*_gtk_reserved4) (void); -- void (*_gtk_reserved5) (void); -- void (*_gtk_reserved6) (void); - }; - - GType gtk_print_backend_get_type (void) G_GNUC_CONST; -@@ -144,6 +152,10 @@ - GDestroyNotify dnotify); - GList * gtk_print_backend_load_modules (void); - void gtk_print_backend_destroy (GtkPrintBackend *print_backend); -+void gtk_print_backend_set_password (GtkPrintBackend *backend, -+ const gchar *hostname, -+ const gchar *username, -+ const gchar *password); - - /* Backend-only functions for GtkPrintBackend */ - -Index: gtk/gtkprintunixdialog.c -=================================================================== ---- gtk/gtkprintunixdialog.c (revision 22586) -+++ gtk/gtkprintunixdialog.c (working copy) -@@ -757,7 +757,10 @@ - priv->print_backends = gtk_print_backend_load_modules (); - - for (node = priv->print_backends; node != NULL; node = node->next) -- printer_list_initialize (dialog, GTK_PRINT_BACKEND (node->data)); -+ { -+ GtkPrintBackend *backend = node->data; -+ printer_list_initialize (dialog, backend); -+ } - } - - static void -Index: modules/printbackends/cups/gtkcupsutils.c -=================================================================== ---- modules/printbackends/cups/gtkcupsutils.c (revision 22586) -+++ modules/printbackends/cups/gtkcupsutils.c (working copy) -@@ -39,10 +39,12 @@ - static void _post_write_request (GtkCupsRequest *request); - static void _post_write_data (GtkCupsRequest *request); - static void _post_check (GtkCupsRequest *request); -+static void _post_auth (GtkCupsRequest *request); - static void _post_read_response (GtkCupsRequest *request); - - static void _get_send (GtkCupsRequest *request); - static void _get_check (GtkCupsRequest *request); -+static void _get_auth (GtkCupsRequest *request); - static void _get_read_data (GtkCupsRequest *request); - - struct _GtkCupsResult -@@ -69,6 +71,7 @@ - _post_write_request, - _post_write_data, - _post_check, -+ _post_auth, - _post_read_response - }; - -@@ -76,6 +79,7 @@ - _connect, - _get_send, - _get_check, -+ _get_auth, - _get_read_data - }; - -@@ -101,12 +105,13 @@ - } - - GtkCupsRequest * --gtk_cups_request_new (http_t *connection, -- GtkCupsRequestType req_type, -- gint operation_id, -- GIOChannel *data_io, -- const char *server, -- const char *resource) -+gtk_cups_request_new_with_username (http_t *connection, -+ GtkCupsRequestType req_type, -+ gint operation_id, -+ GIOChannel *data_io, -+ const char *server, -+ const char *resource, -+ const char *username) - { - GtkCupsRequest *request; - cups_lang_t *language; -@@ -123,6 +128,8 @@ - request->type = req_type; - request->state = GTK_CUPS_REQUEST_START; - -+ request->password_state = GTK_CUPS_PASSWORD_NONE; -+ - if (server) - request->server = g_strdup (server); - else -@@ -171,15 +178,37 @@ - "attributes-natural-language", - NULL, language->language); - -- gtk_cups_request_ipp_add_string (request, IPP_TAG_OPERATION, IPP_TAG_NAME, -- "requesting-user-name", -- NULL, cupsUser ()); -- -+ if (username != NULL) -+ gtk_cups_request_ipp_add_string (request, IPP_TAG_OPERATION, IPP_TAG_NAME, -+ "requesting-user-name", -+ NULL, username); -+ else -+ gtk_cups_request_ipp_add_string (request, IPP_TAG_OPERATION, IPP_TAG_NAME, -+ "requesting-user-name", -+ NULL, cupsUser ()); -+ - cupsLangFree (language); - - return request; - } - -+GtkCupsRequest * -+gtk_cups_request_new (http_t *connection, -+ GtkCupsRequestType req_type, -+ gint operation_id, -+ GIOChannel *data_io, -+ const char *server, -+ const char *resource) -+{ -+ return gtk_cups_request_new_with_username (connection, -+ req_type, -+ operation_id, -+ data_io, -+ server, -+ resource, -+ NULL); -+} -+ - static void - gtk_cups_result_free (GtkCupsResult *result) - { -@@ -205,7 +234,14 @@ - - g_free (request->server); - g_free (request->resource); -+ if (request->password != NULL) -+ { -+ memset (request->password, 0, strlen (request->password)); -+ g_free (request->password); -+ } - -+ g_free (request->username); -+ - gtk_cups_result_free (request->result); - - g_free (request); -@@ -290,8 +326,25 @@ - values); - } - -+const char * -+gtk_cups_request_ipp_get_string (GtkCupsRequest *request, -+ ipp_tag_t tag, -+ const char *name) -+{ -+ ipp_attribute_t *attribute = NULL; - -+ if (request != NULL && request->ipp_request != NULL) -+ attribute = ippFindAttribute (request->ipp_request, -+ name, -+ tag); - -+ if (attribute != NULL && attribute->values != NULL) -+ return attribute->values[0].string.text; -+ else -+ return NULL; -+} -+ -+ - typedef struct - { - const char *name; -@@ -786,12 +839,83 @@ - return; - } - } -- else -+ else if (http_status == HTTP_UNAUTHORIZED) - { -+ request->state = GTK_CUPS_POST_CHECK; -+ request->poll_state = GTK_CUPS_HTTP_READ; -+ -+ request->attempts = 0; -+ return; -+ } -+ else -+ { - request->attempts++; - } - } - -+static void -+_post_auth (GtkCupsRequest *request) -+{ -+ if (request->password_state == GTK_CUPS_PASSWORD_HAS) -+ { -+ if (request->password == NULL) -+ { -+ request->state = GTK_CUPS_POST_DONE; -+ request->poll_state = GTK_CUPS_HTTP_IDLE; -+ -+ gtk_cups_result_set_error (request->result, -+ GTK_CUPS_ERROR_AUTH, -+ 0, -+ 1, -+ "Canceled by user"); -+ } -+ else -+ request->state = GTK_CUPS_POST_CHECK; -+ } -+} -+ -+static void -+_get_auth (GtkCupsRequest *request) -+{ -+ if (request->password_state == GTK_CUPS_PASSWORD_HAS) -+ { -+ if (request->password == NULL) -+ { -+ request->state = GTK_CUPS_GET_DONE; -+ request->poll_state = GTK_CUPS_HTTP_IDLE; -+ -+ gtk_cups_result_set_error (request->result, -+ GTK_CUPS_ERROR_AUTH, -+ 0, -+ 1, -+ "Canceled by user"); -+ } -+ else -+ request->state = GTK_CUPS_GET_CHECK; -+ } -+} -+ -+/* Very ugly hack: cups has a stupid synchronous password callback -+ * that doesn't even take the request or user data parameters, so -+ * we have to use a static variable to pass the password to it. -+ * Not threadsafe ! -+ * The callback sets cups_password to NULL to signal that the -+ * password has been used. -+ */ -+static char *cups_password; -+static char *cups_username; -+ -+static const char * -+passwordCB (const char *prompt) -+{ -+ char *pwd = cups_password; -+ cups_password = NULL; -+ -+ cupsSetUser (cups_username); -+ -+ return pwd; -+} -+ - static void - _post_check (GtkCupsRequest *request) - { -@@ -810,18 +934,91 @@ - } - else if (http_status == HTTP_UNAUTHORIZED) - { -- /* TODO: callout for auth */ -- g_warning ("NOT IMPLEMENTED: We need to prompt for authorization"); -- request->state = GTK_CUPS_POST_DONE; -- request->poll_state = GTK_CUPS_HTTP_IDLE; -+ int auth_result = -1; -+ httpFlush (request->http); -+ -+ if (request->password_state == GTK_CUPS_PASSWORD_APPLIED) -+ { -+ request->password_state = GTK_CUPS_PASSWORD_NOT_VALID; -+ request->state = GTK_CUPS_POST_AUTH; -+ request->need_password = TRUE; -+ -+ return; -+ } -+ -+ /* Negotiate */ -+ if (strncmp (httpGetField (request->http, HTTP_FIELD_WWW_AUTHENTICATE), "Negotiate", 9) == 0) -+ { -+ auth_result = cupsDoAuthentication (request->http, "POST", request->resource); -+ } -+ /* Basic, BasicDigest, Digest and PeerCred */ -+ else -+ { -+ if (request->password_state == GTK_CUPS_PASSWORD_NONE) -+ { -+ cups_password = g_strdup (""); -+ cups_username = request->username; -+ cupsSetPasswordCB (passwordCB); -+ -+ /* This call success for PeerCred authentication */ -+ auth_result = cupsDoAuthentication (request->http, "POST", request->resource); -+ -+ if (auth_result != 0) -+ { -+ /* move to AUTH state to let the backend -+ * ask for a password -+ */ -+ request->state = GTK_CUPS_POST_AUTH; -+ request->need_password = TRUE; -+ -+ return; -+ } -+ } -+ else -+ { -+ cups_password = request->password; -+ cups_username = request->username; -+ -+ auth_result = cupsDoAuthentication (request->http, "POST", request->resource); -+ -+ if (cups_password != NULL) -+ return; -+ -+ if (request->password != NULL) -+ { -+ memset (request->password, 0, strlen (request->password)); -+ g_free (request->password); -+ request->password = NULL; -+ } -+ -+ request->password_state = GTK_CUPS_PASSWORD_APPLIED; -+ } -+ } -+ -+ if (auth_result || -+ httpReconnect (request->http)) -+ { -+ /* if the password has been used, reset password_state -+ * so that we ask for a new one next time around -+ */ -+ if (cups_password == NULL) -+ request->password_state = GTK_CUPS_PASSWORD_NONE; -+ -+ request->state = GTK_CUPS_POST_DONE; -+ request->poll_state = GTK_CUPS_HTTP_IDLE; -+ gtk_cups_result_set_error (request->result, -+ GTK_CUPS_ERROR_AUTH, -+ 0, -+ 0, -+ "Not authorized"); -+ return; -+ } - -- /* TODO: create a not implemented error code */ -- gtk_cups_result_set_error (request->result, -- GTK_CUPS_ERROR_GENERAL, -- 0, -- 0, -- "Can't prompt for authorization"); -- return; -+ if (request->data_io != NULL) -+ g_io_channel_seek_position (request->data_io, 0, G_SEEK_SET, NULL); -+ -+ request->state = GTK_CUPS_POST_CONNECT; -+ request->poll_state = GTK_CUPS_HTTP_WRITE; - } - else if (http_status == HTTP_ERROR) - { -@@ -883,7 +1080,7 @@ - http_errno, - "HTTP Error in POST %s", - g_strerror (http_errno)); -- request->poll_state = GTK_CUPS_HTTP_IDLE; -+ request->poll_state = GTK_CUPS_HTTP_IDLE; - - httpFlush (request->http); - return; -@@ -975,9 +1172,13 @@ - } - - httpClearFields (request->http); -+#ifdef HAVE_HTTPGETAUTHSTRING -+ httpSetField (request->http, HTTP_FIELD_AUTHORIZATION, httpGetAuthString (request->http)); -+#else - #ifdef HAVE_HTTP_AUTHSTRING - httpSetField (request->http, HTTP_FIELD_AUTHORIZATION, request->http->authstring); - #endif -+#endif - - if (httpGet (request->http, request->resource)) - { -@@ -997,6 +1198,9 @@ - request->attempts++; - return; - } -+ -+ if (httpCheck (request->http)) -+ request->last_status = httpUpdate (request->http); - - request->attempts = 0; - -@@ -1024,18 +1228,90 @@ - } - else if (http_status == HTTP_UNAUTHORIZED) - { -- /* TODO: callout for auth */ -- g_warning ("NOT IMPLEMENTED: We need to prompt for authorization in a non blocking manner"); -- request->state = GTK_CUPS_GET_DONE; -- request->poll_state = GTK_CUPS_HTTP_IDLE; -+ int auth_result = -1; -+ httpFlush (request->http); - -- /* TODO: should add a status or error code for not implemented */ -- gtk_cups_result_set_error (request->result, -- GTK_CUPS_ERROR_GENERAL, -- 0, -- 0, -- "Can't prompt for authorization"); -- return; -+ if (request->password_state == GTK_CUPS_PASSWORD_APPLIED) -+ { -+ request->password_state = GTK_CUPS_PASSWORD_NOT_VALID; -+ request->state = GTK_CUPS_GET_AUTH; -+ request->need_password = TRUE; -+ -+ return; -+ } -+ -+ /* Negotiate */ -+ if (strncmp (httpGetField (request->http, HTTP_FIELD_WWW_AUTHENTICATE), "Negotiate", 9) == 0) -+ { -+ auth_result = cupsDoAuthentication (request->http, "GET", request->resource); -+ } -+ /* Basic, BasicDigest, Digest and PeerCred */ -+ else -+ { -+ if (request->password_state == GTK_CUPS_PASSWORD_NONE) -+ { -+ cups_password = g_strdup (""); -+ cups_username = request->username; -+ cupsSetPasswordCB (passwordCB); -+ -+ /* This call success for PeerCred authentication */ -+ auth_result = cupsDoAuthentication (request->http, "GET", request->resource); -+ -+ if (auth_result != 0) -+ { -+ /* move to AUTH state to let the backend -+ * ask for a password -+ */ -+ request->state = GTK_CUPS_GET_AUTH; -+ request->need_password = TRUE; -+ -+ return; -+ } -+ } -+ else -+ { -+ cups_password = request->password; -+ cups_username = request->username; -+ -+ auth_result = cupsDoAuthentication (request->http, "GET", request->resource); -+ -+ if (cups_password != NULL) -+ return; -+ -+ if (request->password != NULL) -+ { -+ memset (request->password, 0, strlen (request->password)); -+ g_free (request->password); -+ request->password = NULL; -+ } -+ -+ request->password_state = GTK_CUPS_PASSWORD_APPLIED; -+ } -+ } -+ -+ if (auth_result || -+ httpReconnect (request->http)) -+ { -+ /* if the password has been used, reset password_state -+ * so that we ask for a new one next time around -+ */ -+ if (cups_password == NULL) -+ request->password_state = GTK_CUPS_PASSWORD_NONE; -+ -+ request->state = GTK_CUPS_GET_DONE; -+ request->poll_state = GTK_CUPS_HTTP_IDLE; -+ gtk_cups_result_set_error (request->result, -+ GTK_CUPS_ERROR_AUTH, -+ 0, -+ 0, -+ "Not authorized"); -+ return; -+ } -+ -+ request->state = GTK_CUPS_GET_SEND; -+ request->last_status = HTTP_CONTINUE; -+ -+ return; - } - else if (http_status == HTTP_UPGRADE_REQUIRED) - { -@@ -1043,7 +1319,7 @@ - httpFlush (request->http); - - cupsSetEncryption (HTTP_ENCRYPT_REQUIRED); -- request->state = GTK_CUPS_POST_CONNECT; -+ request->state = GTK_CUPS_GET_CONNECT; - - /* Reconnect... */ - httpReconnect (request->http); -@@ -1143,7 +1419,7 @@ - - if (io_status == G_IO_STATUS_ERROR) - { -- request->state = GTK_CUPS_POST_DONE; -+ request->state = GTK_CUPS_GET_DONE; - request->poll_state = GTK_CUPS_HTTP_IDLE; - - gtk_cups_result_set_error (request->result, -Index: modules/printbackends/cups/gtkprintbackendcups.c -=================================================================== ---- modules/printbackends/cups/gtkprintbackendcups.c (revision 22586) -+++ modules/printbackends/cups/gtkprintbackendcups.c (working copy) -@@ -118,6 +118,11 @@ - char *default_cover_before; - char *default_cover_after; - int number_of_covers; -+ -+ GList *requests; -+ GHashTable *auth; -+ gchar *username; -+ gboolean authentication_lock; - }; - - static GObjectClass *backend_parent_class; -@@ -176,7 +181,14 @@ - gdouble height, - GIOChannel *cache_io); - -+static void gtk_print_backend_cups_set_password (GtkPrintBackend *backend, -+ const gchar *hostname, -+ const gchar *username, -+ const gchar *password); - -+void overwrite_and_free (gpointer data); -+static gboolean is_address_local (const gchar *address); -+ - static void - gtk_print_backend_cups_register_type (GTypeModule *module) - { -@@ -271,6 +283,7 @@ - backend_class->printer_get_default_page_size = cups_printer_get_default_page_size; - backend_class->printer_get_hard_margins = cups_printer_get_hard_margins; - backend_class->printer_get_capabilities = cups_printer_get_capabilities; -+ backend_class->set_password = gtk_print_backend_cups_set_password; - } - - static cairo_status_t -@@ -511,12 +524,13 @@ - cups_printer = GTK_PRINTER_CUPS (gtk_print_job_get_printer (job)); - settings = gtk_print_job_get_settings (job); - -- request = gtk_cups_request_new (NULL, -- GTK_CUPS_POST, -- IPP_PRINT_JOB, -- data_io, -- NULL, -- cups_printer->device_uri); -+ request = gtk_cups_request_new_with_username (NULL, -+ GTK_CUPS_POST, -+ IPP_PRINT_JOB, -+ data_io, -+ NULL, -+ cups_printer->device_uri, -+ GTK_PRINT_BACKEND_CUPS (print_backend)->username); - - #if (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2) || CUPS_VERSION_MAJOR > 1 - httpAssembleURIf (HTTP_URI_CODING_ALL, -@@ -561,7 +575,17 @@ - (GDestroyNotify)cups_free_print_stream_data); - } - -+void overwrite_and_free (gpointer data) -+{ -+ gchar *password = (gchar *) data; - -+ if (password != NULL) -+ { -+ memset (password, 0, strlen (password)); -+ g_free (password); -+ } -+} -+ - static void - gtk_print_backend_cups_init (GtkPrintBackendCups *backend_cups) - { -@@ -569,6 +593,10 @@ - backend_cups->got_default_printer = FALSE; - backend_cups->list_printers_pending = FALSE; - -+ backend_cups->requests = NULL; -+ backend_cups->auth = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, overwrite_and_free); -+ backend_cups->authentication_lock = FALSE; -+ - backend_cups->covers = NULL; - backend_cups->default_cover_before = NULL; - backend_cups->default_cover_after = NULL; -@@ -577,6 +605,8 @@ - backend_cups->default_printer_poll = 0; - backend_cups->cups_connection_test = NULL; - -+ backend_cups->username = NULL; -+ - cups_get_local_default_printer (backend_cups); - } - -@@ -602,6 +632,10 @@ - gtk_cups_connection_test_free (backend_cups->cups_connection_test); - backend_cups->cups_connection_test = NULL; - -+ g_hash_table_destroy (backend_cups->auth); -+ -+ g_free (backend_cups->username); -+ - backend_parent_class->finalize (object); - } - -@@ -626,8 +660,157 @@ - backend_parent_class->dispose (object); - } - -+static gboolean -+is_address_local (const gchar *address) -+{ -+ if (address[0] == '/' || -+ strcmp (address, "127.0.0.1") == 0 || -+ strcmp (address, "[::1]") == 0) -+ return TRUE; -+ else -+ return FALSE; -+} - -+static void -+gtk_print_backend_cups_set_password (GtkPrintBackend *backend, -+ const gchar *hostname, -+ const gchar *username, -+ const gchar *password) -+{ -+ GtkPrintBackendCups *cups_backend = GTK_PRINT_BACKEND_CUPS (backend); -+ GList *l; -+ char dispatch_hostname[HTTP_MAX_URI]; -+ gchar *key; -+ -+ key = g_strconcat (username, "@", hostname, NULL); -+ g_hash_table_insert (cups_backend->auth, key, g_strdup (password)); -+ -+ g_free (cups_backend->username); -+ cups_backend->username = g_strdup (username); -+ -+ GTK_NOTE (PRINTING, -+ g_print ("CUPS backend: storing password for %s\n", key)); -+ -+ for (l = cups_backend->requests; l; l = l->next) -+ { -+ GtkPrintCupsDispatchWatch *dispatch = l->data; -+ -+ httpGetHostname (dispatch->request->http, dispatch_hostname, sizeof (dispatch_hostname)); -+ if (is_address_local (dispatch_hostname)) -+ strcpy (dispatch_hostname, "localhost"); -+ -+ if (strcmp (hostname, dispatch_hostname) == 0) -+ { -+ overwrite_and_free (dispatch->request->password); -+ dispatch->request->password = g_strdup (password); -+ g_free (dispatch->request->username); -+ dispatch->request->username = g_strdup (username); -+ dispatch->request->password_state = GTK_CUPS_PASSWORD_HAS; -+ dispatch->backend->authentication_lock = FALSE; -+ } -+ } -+} -+ - static gboolean -+request_password (gpointer data) -+{ -+ GtkPrintCupsDispatchWatch *dispatch = data; -+ const gchar *username; -+ gchar *password; -+ gchar *prompt = NULL; -+ gchar *key = NULL; -+ char hostname[HTTP_MAX_URI]; -+ -+ if (dispatch->backend->authentication_lock) -+ return FALSE; -+ -+ httpGetHostname (dispatch->request->http, hostname, sizeof (hostname)); -+ if (is_address_local (hostname)) -+ strcpy (hostname, "localhost"); -+ -+ if (dispatch->backend->username != NULL) -+ username = dispatch->backend->username; -+ else -+ username = cupsUser (); -+ -+ key = g_strconcat (username, "@", hostname, NULL); -+ password = g_hash_table_lookup (dispatch->backend->auth, key); -+ -+ if (password && dispatch->request->password_state != GTK_CUPS_PASSWORD_NOT_VALID) -+ { -+ GTK_NOTE (PRINTING, -+ g_print ("CUPS backend: using stored password for %s\n", key)); -+ -+ overwrite_and_free (dispatch->request->password); -+ dispatch->request->password = g_strdup (password); -+ g_free (dispatch->request->username); -+ dispatch->request->username = g_strdup (username); -+ dispatch->request->password_state = GTK_CUPS_PASSWORD_HAS; -+ } -+ else -+ { -+ const char *job_title = gtk_cups_request_ipp_get_string (dispatch->request, IPP_TAG_NAME, "job-name"); -+ const char *printer_uri = gtk_cups_request_ipp_get_string (dispatch->request, IPP_TAG_URI, "printer-uri"); -+ char *printer_name = NULL; -+ -+ if (printer_uri != NULL && strrchr (printer_uri, '/') != NULL) -+ printer_name = g_strdup (strrchr (printer_uri, '/') + 1); -+ -+ if (dispatch->request->password_state == GTK_CUPS_PASSWORD_NOT_VALID) -+ g_hash_table_remove (dispatch->backend->auth, key); -+ -+ dispatch->request->password_state = GTK_CUPS_PASSWORD_REQUESTED; -+ -+ dispatch->backend->authentication_lock = TRUE; -+ -+ switch (dispatch->request->ipp_request->request.op.operation_id) -+ { -+ case 0: -+ prompt = g_strdup_printf ( _("Authentication is required to get a file from %s"), hostname); -+ break; -+ case IPP_PRINT_JOB: -+ if (job_title != NULL && printer_name != NULL) -+ prompt = g_strdup_printf ( _("Authentication is required to print document '%s' on printer %s"), job_title, printer_name); -+ else -+ prompt = g_strdup_printf ( _("Authentication is required to print a document on %s"), hostname); -+ break; -+ case IPP_GET_JOB_ATTRIBUTES: -+ if (job_title != NULL) -+ prompt = g_strdup_printf ( _("Authentication is required to get attributes of job '%s'"), job_title); -+ else -+ prompt = g_strdup ( _("Authentication is required to get attributes of a job")); -+ break; -+ case IPP_GET_PRINTER_ATTRIBUTES: -+ if (printer_name != NULL) -+ prompt = g_strdup_printf ( _("Authentication is required to get attributes of printer %s"), printer_name); -+ else -+ prompt = g_strdup ( _("Authentication is required to get attributes of a printer")); -+ break; -+ case CUPS_GET_DEFAULT: -+ prompt = g_strdup_printf ( _("Authentication is required to get default printer of %s"), hostname); -+ break; -+ case CUPS_GET_PRINTERS: -+ prompt = g_strdup_printf ( _("Authentication is required to get printers from %s"), hostname); -+ break; -+ default: -+ prompt = g_strdup_printf ( _("Authentication is required on %s"), hostname); -+ break; -+ } -+ -+ g_free (printer_name); -+ -+ g_signal_emit_by_name (dispatch->backend, "request-password", -+ hostname, username, prompt); -+ -+ g_free (prompt); -+ } -+ -+ g_free (key); -+ -+ return FALSE; -+} -+ -+static gboolean - cups_dispatch_watch_check (GSource *source) - { - GtkPrintCupsDispatchWatch *dispatch; -@@ -665,7 +848,7 @@ - #endif - } - -- if (poll_state != GTK_CUPS_HTTP_IDLE) -+ if (poll_state != GTK_CUPS_HTTP_IDLE && !dispatch->request->need_password) - if (!(dispatch->data_poll->revents & dispatch->data_poll->events)) - return FALSE; - -@@ -676,6 +859,13 @@ - g_free (dispatch->data_poll); - dispatch->data_poll = NULL; - } -+ -+ if (dispatch->request->need_password && dispatch->request->password_state != GTK_CUPS_PASSWORD_REQUESTED) -+ { -+ dispatch->request->need_password = FALSE; -+ g_idle_add (request_password, dispatch); -+ result = FALSE; -+ } - - return result; - } -@@ -735,12 +925,39 @@ - cups_dispatch_watch_finalize (GSource *source) - { - GtkPrintCupsDispatchWatch *dispatch; -+ GtkCupsResult *result; - - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s \n", G_STRFUNC, source)); - - dispatch = (GtkPrintCupsDispatchWatch *) source; - -+ result = gtk_cups_request_get_result (dispatch->request); -+ if (gtk_cups_result_get_error_type (result) == GTK_CUPS_ERROR_AUTH) -+ { -+ const gchar *username; -+ gchar hostname[HTTP_MAX_URI]; -+ gchar *key; -+ -+ httpGetHostname (dispatch->request->http, hostname, sizeof (hostname)); -+ if (is_address_local (hostname)) -+ strcpy (hostname, "localhost"); -+ -+ if (dispatch->backend->username != NULL) -+ username = dispatch->backend->username; -+ else -+ username = cupsUser (); -+ -+ key = g_strconcat (username, "@", hostname, NULL); -+ GTK_NOTE (PRINTING, -+ g_print ("CUPS backend: removing stored password for %s\n", key)); -+ g_hash_table_remove (dispatch->backend->auth, key); -+ g_free (key); -+ -+ if (dispatch->backend) -+ dispatch->backend->authentication_lock = FALSE; -+ } -+ - gtk_cups_request_free (dispatch->request); - - if (dispatch->backend) -@@ -754,6 +971,10 @@ - * of print backends. See _gtk_print_backend_create for the - * disabling. - */ -+ -+ dispatch->backend->requests = g_list_remove (dispatch->backend->requests, dispatch); -+ -+ - g_object_unref (dispatch->backend); - dispatch->backend = NULL; - } -@@ -788,6 +1009,8 @@ - dispatch->backend = g_object_ref (print_backend); - dispatch->data_poll = NULL; - -+ print_backend->requests = g_list_prepend (print_backend->requests, dispatch); -+ - g_source_set_callback ((GSource *) dispatch, (GSourceFunc) callback, user_data, notify); - - g_source_attach ((GSource *) dispatch, NULL); -@@ -890,12 +1113,13 @@ - "job-sheets-default" - }; - -- request = gtk_cups_request_new (NULL, -- GTK_CUPS_POST, -- IPP_GET_PRINTER_ATTRIBUTES, -- NULL, -- NULL, -- NULL); -+ request = gtk_cups_request_new_with_username (NULL, -+ GTK_CUPS_POST, -+ IPP_GET_PRINTER_ATTRIBUTES, -+ NULL, -+ NULL, -+ NULL, -+ print_backend->username); - - printer_uri = g_strdup_printf ("ipp://localhost/printers/%s", - printer_name); -@@ -1029,12 +1253,13 @@ - GtkCupsRequest *request; - gchar *job_uri; - -- request = gtk_cups_request_new (NULL, -- GTK_CUPS_POST, -- IPP_GET_JOB_ATTRIBUTES, -- NULL, -- NULL, -- NULL); -+ request = gtk_cups_request_new_with_username (NULL, -+ GTK_CUPS_POST, -+ IPP_GET_JOB_ATTRIBUTES, -+ NULL, -+ NULL, -+ NULL, -+ data->print_backend->username); - - job_uri = g_strdup_printf ("ipp://localhost/jobs/%d", data->job_id); - gtk_cups_request_ipp_add_string (request, IPP_TAG_OPERATION, IPP_TAG_URI, -@@ -1121,9 +1346,20 @@ - if (gtk_cups_result_is_error (result)) - { - GTK_NOTE (PRINTING, -- g_warning ("CUPS Backend: Error getting printer list: %s", -- gtk_cups_result_get_error_string (result))); -+ g_warning ("CUPS Backend: Error getting printer list: %s %d %d", -+ gtk_cups_result_get_error_string (result), -+ gtk_cups_result_get_error_type (result), -+ gtk_cups_result_get_error_code (result))); - -+ if (gtk_cups_result_get_error_type (result) == GTK_CUPS_ERROR_AUTH && -+ gtk_cups_result_get_error_code (result) == 1) -+ { -+ /* Canceled by user, stop popping up more password dialogs */ -+ if (cups_backend->list_printers_poll > 0) -+ g_source_remove (cups_backend->list_printers_poll); -+ cups_backend->list_printers_poll = 0; -+ } -+ - goto done; - } - -@@ -1609,12 +1845,13 @@ - - cups_backend->list_printers_pending = TRUE; - -- request = gtk_cups_request_new (NULL, -- GTK_CUPS_POST, -- CUPS_GET_PRINTERS, -- NULL, -- NULL, -- NULL); -+ request = gtk_cups_request_new_with_username (NULL, -+ GTK_CUPS_POST, -+ CUPS_GET_PRINTERS, -+ NULL, -+ NULL, -+ NULL, -+ cups_backend->username); - - gtk_cups_request_ipp_add_strings (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, - "requested-attributes", G_N_ELEMENTS (pattrs), -@@ -1776,28 +2013,30 @@ - resource = g_strdup_printf ("/printers/%s.ppd", - gtk_printer_cups_get_ppd_name (GTK_PRINTER_CUPS (printer))); - -- request = gtk_cups_request_new (data->http, -- GTK_CUPS_GET, -- 0, -- data->ppd_io, -- cups_printer->hostname, -- resource); -+ print_backend = gtk_printer_get_backend (printer); - -+ request = gtk_cups_request_new_with_username (data->http, -+ GTK_CUPS_GET, -+ 0, -+ data->ppd_io, -+ cups_printer->hostname, -+ resource, -+ GTK_PRINT_BACKEND_CUPS (print_backend)->username); -+ - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Requesting resource %s to be written to temp file %s\n", resource, ppd_filename)); - -- g_free (resource); -- g_free (ppd_filename); - - cups_printer->reading_ppd = TRUE; - -- print_backend = gtk_printer_get_backend (printer); -- - cups_request_execute (GTK_PRINT_BACKEND_CUPS (print_backend), - request, - (GtkPrintCupsResponseCallbackFunc) cups_request_ppd_cb, - data, - (GDestroyNotify)get_ppd_data_free); -+ -+ g_free (resource); -+ g_free (ppd_filename); - } - - /* Ordering matters for default preference */ -@@ -2018,6 +2257,20 @@ - - GDK_THREADS_ENTER (); - -+ if (gtk_cups_result_is_error (result)) -+ { -+ if (gtk_cups_result_get_error_type (result) == GTK_CUPS_ERROR_AUTH && -+ gtk_cups_result_get_error_code (result) == 1) -+ { -+ /* Canceled by user, stop popping up more password dialogs */ -+ if (print_backend->list_printers_poll > 0) -+ g_source_remove (print_backend->list_printers_poll); -+ print_backend->list_printers_poll = 0; -+ } -+ -+ return; -+ } -+ - response = gtk_cups_result_get_response (result); - - if ((attr = ippFindAttribute (response, "printer-name", IPP_TAG_NAME)) != NULL) -@@ -2056,12 +2309,13 @@ - if (state == GTK_CUPS_CONNECTION_IN_PROGRESS || state == GTK_CUPS_CONNECTION_NOT_AVAILABLE) - return TRUE; - -- request = gtk_cups_request_new (NULL, -- GTK_CUPS_POST, -- CUPS_GET_DEFAULT, -- NULL, -- NULL, -- NULL); -+ request = gtk_cups_request_new_with_username (NULL, -+ GTK_CUPS_POST, -+ CUPS_GET_DEFAULT, -+ NULL, -+ NULL, -+ NULL, -+ print_backend->username); - - cups_request_execute (print_backend, - request, -Index: modules/printbackends/cups/gtkcupsutils.h -=================================================================== ---- modules/printbackends/cups/gtkcupsutils.h (revision 22586) -+++ modules/printbackends/cups/gtkcupsutils.h (working copy) -@@ -37,6 +37,7 @@ - GTK_CUPS_ERROR_HTTP, - GTK_CUPS_ERROR_IPP, - GTK_CUPS_ERROR_IO, -+ GTK_CUPS_ERROR_AUTH, - GTK_CUPS_ERROR_GENERAL - } GtkCupsErrorType; - -@@ -66,6 +67,15 @@ - GTK_CUPS_CONNECTION_IN_PROGRESS - } GtkCupsConnectionState; - -+typedef enum -+{ -+ GTK_CUPS_PASSWORD_NONE, -+ GTK_CUPS_PASSWORD_REQUESTED, -+ GTK_CUPS_PASSWORD_HAS, -+ GTK_CUPS_PASSWORD_APPLIED, -+ GTK_CUPS_PASSWORD_NOT_VALID -+} GtkCupsPasswordState; -+ - struct _GtkCupsRequest - { - GtkCupsRequestType type; -@@ -84,7 +94,12 @@ - gint state; - GtkCupsPollState poll_state; - -- gint own_http : 1; -+ gchar *password; -+ gchar *username; -+ -+ gint own_http : 1; -+ gint need_password : 1; -+ GtkCupsPasswordState password_state; - }; - - struct _GtkCupsConnectionTest -@@ -108,6 +123,7 @@ - GTK_CUPS_POST_WRITE_REQUEST, - GTK_CUPS_POST_WRITE_DATA, - GTK_CUPS_POST_CHECK, -+ GTK_CUPS_POST_AUTH, - GTK_CUPS_POST_READ_RESPONSE, - GTK_CUPS_POST_DONE = GTK_CUPS_REQUEST_DONE - }; -@@ -118,10 +134,18 @@ - GTK_CUPS_GET_CONNECT = GTK_CUPS_REQUEST_START, - GTK_CUPS_GET_SEND, - GTK_CUPS_GET_CHECK, -+ GTK_CUPS_GET_AUTH, - GTK_CUPS_GET_READ_DATA, - GTK_CUPS_GET_DONE = GTK_CUPS_REQUEST_DONE - }; - -+GtkCupsRequest * gtk_cups_request_new_with_username (http_t *connection, -+ GtkCupsRequestType req_type, -+ gint operation_id, -+ GIOChannel *data_io, -+ const char *server, -+ const char *resource, -+ const char *username); - GtkCupsRequest * gtk_cups_request_new (http_t *connection, - GtkCupsRequestType req_type, - gint operation_id, -@@ -141,6 +165,9 @@ - int num_values, - const char *charset, - const char * const *values); -+const char * gtk_cups_request_ipp_get_string (GtkCupsRequest *request, -+ ipp_tag_t tag, -+ const char *name); - gboolean gtk_cups_request_read_write (GtkCupsRequest *request); - GtkCupsPollState gtk_cups_request_get_poll_state (GtkCupsRequest *request); - void gtk_cups_request_free (GtkCupsRequest *request); diff --git a/root-event-mask.patch b/root-event-mask.patch deleted file mode 100644 index f461ec4..0000000 --- a/root-event-mask.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -up gtk+-2.17.11/gdk/x11/gdkwindow-x11.c.event-mask gtk+-2.17.11/gdk/x11/gdkwindow-x11.c ---- gtk+-2.17.11/gdk/x11/gdkwindow-x11.c.event-mask 2009-09-06 21:31:08.926764157 -0400 -+++ gtk+-2.17.11/gdk/x11/gdkwindow-x11.c 2009-09-06 21:32:03.142614346 -0400 -@@ -455,8 +455,12 @@ _gdk_windowing_window_init (GdkScreen * - private->width = WidthOfScreen (screen_x11->xscreen); - private->height = HeightOfScreen (screen_x11->xscreen); - private->viewable = TRUE; -+ -+ /* see init_randr_support() in gdkscreen-x11.c */ -+ private->event_mask = GDK_STRUCTURE_MASK; -+ - _gdk_window_update_size (screen_x11->root_window); -- -+ - _gdk_xid_table_insert (screen_x11->display, - &screen_x11->xroot_window, - screen_x11->root_window); diff --git a/set-cursor.patch b/set-cursor.patch deleted file mode 100644 index 7fe9db2..0000000 --- a/set-cursor.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -up gtk+-2.17.6/gdk/gdkwindow.c.set-cursor gtk+-2.17.6/gdk/gdkwindow.c ---- gtk+-2.17.6/gdk/gdkwindow.c.set-cursor 2009-08-11 14:26:41.041772299 -0400 -+++ gtk+-2.17.6/gdk/gdkwindow.c 2009-08-11 14:27:40.703522466 -0400 -@@ -6982,7 +6982,10 @@ gdk_window_set_cursor (GdkWindow *window - if (cursor) - private->cursor = gdk_cursor_ref (cursor); - -- if (_gdk_window_event_parent_of (window, display->pointer_info.window_under_pointer)) -+ if (private->window_type == GDK_WINDOW_ROOT || -+ private->window_type == GDK_WINDOW_FOREIGN) -+ GDK_WINDOW_IMPL_GET_IFACE (private->impl)->set_cursor (window, cursor); -+ else if (_gdk_window_event_parent_of (window, display->pointer_info.window_under_pointer)) - update_cursor (display); - } - } diff --git a/symbolic-color-parsing.patch b/symbolic-color-parsing.patch new file mode 100644 index 0000000..7af2f3d --- /dev/null +++ b/symbolic-color-parsing.patch @@ -0,0 +1,160 @@ +diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c +index a2ac58b..70540a3 100644 +--- a/gtk/gtkrc.c ++++ b/gtk/gtkrc.c +@@ -659,11 +659,15 @@ gtk_rc_color_hash_changed (GtkSettings *settings, + GParamSpec *pspec, + GtkRcContext *context) + { +- if (context->color_hash) +- g_hash_table_unref (context->color_hash); +- ++ GHashTable *old_hash; ++ ++ old_hash = context->color_hash; ++ + g_object_get (settings, "color-hash", &context->color_hash, NULL); + ++ if (old_hash) ++ g_hash_table_unref (old_hash); ++ + gtk_rc_reparse_all_for_settings (settings, TRUE); + } + +@@ -3148,8 +3152,10 @@ gtk_rc_parse_style (GtkRcContext *context, + break; + case GTK_RC_TOKEN_COLOR: + if (our_hash == NULL) +- gtk_rc_style_prepend_empty_color_hash (rc_style); +- our_hash = rc_priv->color_hashes->data; ++ { ++ gtk_rc_style_prepend_empty_color_hash (rc_style); ++ our_hash = rc_priv->color_hashes->data; ++ } + token = gtk_rc_parse_logical_color (scanner, rc_style, our_hash); + break; + case G_TOKEN_IDENTIFIER: +diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c +index 4917263..2b6b24e 100644 +--- a/gtk/gtksettings.c ++++ b/gtk/gtksettings.c +@@ -2190,8 +2190,8 @@ settings_update_color_scheme (GtkSettings *settings) + } + + static gboolean +-add_color_to_hash (gchar *name, +- GdkColor *color, ++add_color_to_hash (gchar *name, ++ GdkColor *color, + GHashTable *target) + { + GdkColor *old; +@@ -2200,7 +2200,7 @@ add_color_to_hash (gchar *name, + if (!old || !gdk_color_equal (old, color)) + { + g_hash_table_insert (target, g_strdup (name), gdk_color_copy (color)); +- ++ + return TRUE; + } + +@@ -2208,7 +2208,7 @@ add_color_to_hash (gchar *name, + } + + static gboolean +-add_colors_to_hash_from_string (GHashTable *hash, ++add_colors_to_hash_from_string (GHashTable *hash, + const gchar *colors) + { + gchar *s, *p, *name; +@@ -2256,24 +2256,27 @@ add_colors_to_hash_from_string (GHashTable *hash, + + static gboolean + update_color_hash (ColorSchemeData *data, +- const gchar *str, ++ const gchar *str, + GtkSettingsSource source) + { + gboolean changed = FALSE; + gint i; + GHashTable *old_hash; ++ GHashTableIter iter; ++ gchar *name; ++ GdkColor *color; + +- if ((str == NULL || *str == '\0') && ++ if ((str == NULL || *str == '\0') && + (data->lastentry[source] == NULL || data->lastentry[source][0] == '\0')) + return FALSE; + + if (str && data->lastentry[source] && strcmp (str, data->lastentry[source]) == 0) + return FALSE; + +- /* For the RC_FILE source we merge the values rather than over-writing ++ /* For the RC_FILE source we merge the values rather than over-writing + * them, since multiple rc files might define independent sets of colors + */ +- if ((source != GTK_SETTINGS_SOURCE_RC_FILE) && ++ if ((source != GTK_SETTINGS_SOURCE_RC_FILE) && + data->tables[source] && g_hash_table_size (data->tables[source]) > 0) + { + g_hash_table_unref (data->tables[source]); +@@ -2282,22 +2285,36 @@ update_color_hash (ColorSchemeData *data, + } + + if (data->tables[source] == NULL) +- data->tables[source] = g_hash_table_new_full (g_str_hash, g_str_equal, ++ data->tables[source] = g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, + (GDestroyNotify) gdk_color_free); + + g_free (data->lastentry[source]); + data->lastentry[source] = g_strdup (str); +- ++ + changed |= add_colors_to_hash_from_string (data->tables[source], str); + + if (!changed) + return FALSE; +- ++ + /* Rebuild the merged hash table. */ +- old_hash = data->color_hash; +- data->color_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, +- (GDestroyNotify) gdk_color_free); ++ if (data->color_hash) ++ { ++ old_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, ++ (GDestroyNotify) gdk_color_free); ++ ++ g_hash_table_iter_init (&iter, data->color_hash); ++ while (g_hash_table_iter_next (&iter, &name, &color)) ++ { ++ g_hash_table_insert (old_hash, name, color); ++ g_hash_table_iter_steal (&iter); ++ } ++ } ++ else ++ { ++ old_hash = NULL; ++ } ++ + for (i = 0; i <= GTK_SETTINGS_SOURCE_APPLICATION; i++) + { + if (data->tables[i]) +@@ -2324,13 +2341,13 @@ update_color_hash (ColorSchemeData *data, + { + changed = TRUE; + break; +- } ++ } + } + } + + g_hash_table_unref (old_hash); + } +- else ++ else + changed = TRUE; + + return changed; diff --git a/toolbutton-assert.patch b/toolbutton-assert.patch new file mode 100644 index 0000000..7d81faf --- /dev/null +++ b/toolbutton-assert.patch @@ -0,0 +1,23 @@ +diff -up gtk+-2.18.3/gtk/gtktoolbutton.c.toolbutton-assert gtk+-2.18.3/gtk/gtktoolbutton.c +--- gtk+-2.18.3/gtk/gtktoolbutton.c.toolbutton-assert 2009-10-16 10:38:56.000000000 -0400 ++++ gtk+-2.18.3/gtk/gtktoolbutton.c 2009-10-26 01:12:26.146186990 -0400 +@@ -916,11 +916,15 @@ gtk_tool_button_set_label (GtkToolButton + button->priv->label_text = g_strdup (label); + button->priv->contents_invalid = TRUE; + +- elided_label = _gtk_toolbar_elide_underscores (label); +- accessible = gtk_widget_get_accessible (GTK_WIDGET (button->priv->button)); +- atk_object_set_name (accessible, elided_label); ++ if (label) ++ { ++ elided_label = _gtk_toolbar_elide_underscores (label); ++ accessible = gtk_widget_get_accessible (GTK_WIDGET (button->priv->button)); ++ atk_object_set_name (accessible, elided_label); ++ ++ g_free (elided_label); ++ } + +- g_free (elided_label); + g_free (old_label); + + g_object_notify (G_OBJECT (button), "label"); diff --git a/tooltip-positioning.patch b/tooltip-positioning.patch new file mode 100644 index 0000000..2eb614b --- /dev/null +++ b/tooltip-positioning.patch @@ -0,0 +1,190 @@ +diff -up gtk+-2.18.3/gtk/gtktooltip.c.positioning gtk+-2.18.3/gtk/gtktooltip.c +--- gtk+-2.18.3/gtk/gtktooltip.c.positioning 2009-10-23 13:12:16.205437913 -0400 ++++ gtk+-2.18.3/gtk/gtktooltip.c 2009-10-23 13:52:15.922749329 -0400 +@@ -1023,57 +1023,134 @@ gtk_tooltip_position (GtkTooltip *toolti + GtkWidget *new_tooltip_widget) + { + gint x, y; ++ gint wx, wy; + GdkScreen *screen; ++ gint monitor_num; ++ GdkRectangle monitor; ++ GtkRequisition requisition; ++ guint cursor_size; ++ ++#define MAX_DISTANCE 32 + + tooltip->tooltip_widget = new_tooltip_widget; + ++ screen = gtk_widget_get_screen (new_tooltip_widget); ++ ++ gtk_widget_size_request (GTK_WIDGET (tooltip->current_window), &requisition); ++ ++ monitor_num = gdk_screen_get_monitor_at_point (screen, ++ tooltip->last_x, ++ tooltip->last_y); ++ gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); ++ ++ gdk_window_get_origin (new_tooltip_widget->window, &wx, &wy); ++ if (GTK_WIDGET_NO_WINDOW (new_tooltip_widget)) ++ { ++ wx += new_tooltip_widget->allocation.x; ++ wy += new_tooltip_widget->allocation.y; ++ } ++ + /* Position the tooltip */ +- /* FIXME: should we swap this when RTL is enabled? */ +- if (tooltip->keyboard_mode_enabled) ++ ++ cursor_size = gdk_display_get_default_cursor_size (display); ++ ++ /* Try below */ ++ x = wx + new_tooltip_widget->allocation.width / 2 - requisition.width / 2; ++ y = wy + new_tooltip_widget->allocation.height + 4; ++ ++ if (y + requisition.height <= monitor.y + monitor.height) + { +- gdk_window_get_origin (new_tooltip_widget->window, &x, &y); +- if (GTK_WIDGET_NO_WINDOW (new_tooltip_widget)) ++ if (tooltip->keyboard_mode_enabled) ++ goto found; ++ ++ if (y <= tooltip->last_y + cursor_size + MAX_DISTANCE) + { +- x += new_tooltip_widget->allocation.x; +- y += new_tooltip_widget->allocation.y; +- } ++ if (tooltip->last_x + cursor_size + MAX_DISTANCE < x) ++ x = tooltip->last_x + cursor_size + MAX_DISTANCE; ++ else if (x + requisition.width < tooltip->last_x - MAX_DISTANCE) ++ x = tooltip->last_x - MAX_DISTANCE - requisition.width; + +- /* For keyboard mode we position the tooltip below the widget, +- * right of the center of the widget. +- */ +- x += new_tooltip_widget->allocation.width / 2; +- y += new_tooltip_widget->allocation.height + 4; ++ goto found; ++ } ++ } ++ ++ /* Try above */ ++ x = wx + new_tooltip_widget->allocation.width / 2 - requisition.width / 2; ++ y = wy - requisition.height - 4; ++ ++ if (y >= monitor.y) ++ { ++ if (tooltip->keyboard_mode_enabled) ++ goto found; ++ ++ if (y + requisition.height >= tooltip->last_y - MAX_DISTANCE) ++ { ++ if (tooltip->last_x + cursor_size + MAX_DISTANCE < x) ++ x = tooltip->last_x + cursor_size + MAX_DISTANCE; ++ else if (x + requisition.width < tooltip->last_x - MAX_DISTANCE) ++ x = tooltip->last_x - MAX_DISTANCE - requisition.width; ++ ++ goto found; ++ } + } +- else ++ ++ /* Try right FIXME: flip on rtl ? */ ++ x = wx + new_tooltip_widget->allocation.width + 4; ++ y = wy + new_tooltip_widget->allocation.height / 2 - requisition.height / 2; ++ ++ if (x + requisition.width <= monitor.x + monitor.width) + { +- guint cursor_size; ++ if (tooltip->keyboard_mode_enabled) ++ goto found; + +- x = tooltip->last_x; +- y = tooltip->last_y; ++ if (x <= tooltip->last_x + cursor_size + MAX_DISTANCE) ++ { ++ if (tooltip->last_y + cursor_size + MAX_DISTANCE < y) ++ y = tooltip->last_y + cursor_size + MAX_DISTANCE; ++ else if (y + requisition.height < tooltip->last_y - MAX_DISTANCE) ++ y = tooltip->last_y - MAX_DISTANCE - requisition.height; + +- /* For mouse mode, we position the tooltip right of the cursor, +- * a little below the cursor's center. +- */ +- cursor_size = gdk_display_get_default_cursor_size (display); +- x += cursor_size / 2; +- y += cursor_size / 2; ++ goto found; ++ } + } + +- screen = gtk_widget_get_screen (new_tooltip_widget); ++ /* Try left FIXME: flip on rtl ? */ ++ x = wx - requisition.width - 4; ++ y = wy + new_tooltip_widget->allocation.height / 2 - requisition.height / 2; + +- /* Show it */ +- if (tooltip->current_window) ++ if (x >= monitor.x) + { +- gint monitor_num; +- GdkRectangle monitor; +- GtkRequisition requisition; ++ if (tooltip->keyboard_mode_enabled) ++ goto found; + +- gtk_widget_size_request (GTK_WIDGET (tooltip->current_window), +- &requisition); ++ if (x + requisition.width >= tooltip->last_x - MAX_DISTANCE) ++ { ++ if (tooltip->last_y + cursor_size + MAX_DISTANCE < y) ++ y = tooltip->last_y + cursor_size + MAX_DISTANCE; ++ else if (y + requisition.height < tooltip->last_y - MAX_DISTANCE) ++ y = tooltip->last_y - MAX_DISTANCE - requisition.height; + +- monitor_num = gdk_screen_get_monitor_at_point (screen, x, y); +- gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); ++ goto found; ++ } ++ } + ++ /* Fallback */ ++ if (tooltip->keyboard_mode_enabled) ++ { ++ x = wx + new_tooltip_widget->allocation.width / 2 - requisition.width / 2; ++ y = wy + new_tooltip_widget->allocation.height + 4; ++ } ++ else ++ { ++ /* At cursor */ ++ x = tooltip->last_x + cursor_size * 3 / 4; ++ y = tooltip->last_y + cursor_size * 3 / 4; ++ } ++ ++found: ++ /* Show it */ ++ if (tooltip->current_window) ++ { + if (x + requisition.width > monitor.x + monitor.width) + x -= x - (monitor.x + monitor.width) + requisition.width; + else if (x < monitor.x) +@@ -1081,7 +1158,9 @@ gtk_tooltip_position (GtkTooltip *toolti + + if (y + requisition.height > monitor.y + monitor.height) + y -= y - (monitor.y + monitor.height) + requisition.height; +- ++ else if (y < monitor.y) ++ y = monitor.y; ++ + if (!tooltip->keyboard_mode_enabled) + { + /* don't pop up under the pointer */ +@@ -1089,7 +1168,7 @@ gtk_tooltip_position (GtkTooltip *toolti + y <= tooltip->last_y && tooltip->last_y < y + requisition.height) + y = tooltip->last_y - requisition.height - 2; + } +- ++ + gtk_window_move (GTK_WINDOW (tooltip->current_window), x, y); + gtk_widget_show (GTK_WIDGET (tooltip->current_window)); + }