Merge lp:~macslow/notify-osd/fix-546650 into lp:notify-osd/lucid

Proposed by Mirco Müller
Status: Merged
Merged at revision: not available
Proposed branch: lp:~macslow/notify-osd/fix-546650
Merge into: lp:notify-osd/lucid
Diff against target: 174 lines (+52/-86)
1 file modified
src/bubble.c (+52/-86)
To merge this branch: bzr merge lp:~macslow/notify-osd/fix-546650
Reviewer Review Type Date Requested Status
Cody Russell (community) Approve
Review via email: mp+22469@code.launchpad.net

Description of the change

Change the way the "empty" 1x1 pixel large input-mask is created. This is needed to fix a regression introduced by gtk+ 2.20.0 in Lucid. Without this branch the click-through capability of notify-osd does not work. This fixes LP: #546650.

To post a comment you must log in.
Revision history for this message
Cody Russell (bratsche) :
review: Approve
lp:~macslow/notify-osd/fix-546650 updated
422. By Mirco Müller

Made the creation of the empty input-mask for the click-through feature
much tighter. Less is more :)

423. By Mirco Müller

Fix the masking out of the bubble on mouse-over for the non-composited
desktop. Use gtk_widget_hide() and gtk_widget_show() for this case.
Initially the plan was to use an animated shape-mask for the
non-composited case, but that has not been designed yet. So we'll stick
to this simple binary on/off solution. Fixing LP: #546650

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/bubble.c'
2--- src/bubble.c 2010-03-09 12:20:32 +0000
3+++ src/bubble.c 2010-04-01 09:20:46 +0000
4@@ -1591,48 +1591,18 @@
5
6 static
7 void
8-update_input_shape (GtkWidget* window,
9- gint width,
10- gint height)
11+update_input_shape (GtkWidget* window)
12 {
13- GdkBitmap* mask = NULL;
14- cairo_t* cr = NULL;
15-
16- mask = (GdkBitmap*) gdk_pixmap_new (NULL, width, height, 1);
17- if (mask)
18- {
19- cr = gdk_cairo_create (mask);
20- if (cairo_status (cr) == CAIRO_STATUS_SUCCESS)
21- {
22- cairo_scale (cr, 1.0f, 1.0f);
23- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
24- cairo_paint (cr);
25- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
26- cairo_set_source_rgb (cr, 1.0f, 1.0f, 1.0f);
27-
28- // just draw something
29- draw_round_rect (cr,
30- 1.0f,
31- 0.0f, 0.0f,
32- 10.0f,
33- 10.0f, 10.0f);
34-
35- cairo_fill (cr);
36-
37- cairo_destroy (cr);
38-
39- gtk_widget_input_shape_combine_mask (window,
40- NULL,
41- 0,
42- 0);
43- gtk_widget_input_shape_combine_mask (window,
44- mask,
45- 0,
46- 0);
47- }
48-
49- g_object_unref ((gpointer) mask);
50- }
51+ GdkRegion* region = NULL;
52+
53+ // sanity check
54+ if (!window)
55+ return;
56+
57+ // set an empty input-mask to allow click-through
58+ region = gdk_region_new ();
59+ gdk_window_input_shape_combine_region (window->window, region, 0, 0);
60+ gdk_region_destroy (region);
61 }
62
63 static void
64@@ -1659,61 +1629,57 @@
65 return;
66 }
67
68- // guess we need one
69- gtk_widget_get_size_request (priv->widget, &width, &height);
70- mask = (GdkBitmap*) gdk_pixmap_new (NULL, width, height, 1);
71- if (mask)
72- {
73- // create context from mask/pixmap
74- cr = gdk_cairo_create (mask);
75- if (cairo_status (cr) == CAIRO_STATUS_SUCCESS)
76+ // we're not-composited, so deal with mouse-over differently
77+ if (bubble_is_mouse_over (self))
78+ {
79+ gtk_widget_hide (priv->widget);
80+ }
81+ else
82+ {
83+ gtk_widget_show (priv->widget);
84+ gtk_widget_get_size_request (priv->widget, &width, &height);
85+ mask = (GdkBitmap*) gdk_pixmap_new (NULL, width, height, 1);
86+ if (mask)
87 {
88- // clear mask/context
89- cairo_scale (cr, 1.0f, 1.0f);
90- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
91- cairo_paint (cr);
92-
93- width -= 2 * EM2PIXELS (defaults_get_bubble_shadow_size (d), d);
94- height -= 2 * EM2PIXELS (defaults_get_bubble_shadow_size (d), d);
95-
96- // draw rounded rectangle shape/mask
97- if (bubble_is_mouse_over (self))
98+ // create context from mask/pixmap
99+ cr = gdk_cairo_create (mask);
100+ if (cairo_status (cr) == CAIRO_STATUS_SUCCESS)
101+ {
102+ // clear mask/context
103+ cairo_scale (cr, 1.0f, 1.0f);
104 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
105- else
106+ cairo_paint (cr);
107+
108+ width -= 2 * EM2PIXELS (defaults_get_bubble_shadow_size (d), d);
109+ height -= 2 * EM2PIXELS (defaults_get_bubble_shadow_size (d), d);
110+
111+ // draw rounded rectangle shape/mask
112 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
113- cairo_set_source_rgb (cr, 1.0f, 1.0f, 1.0f);
114- draw_round_rect (cr,
115+ cairo_set_source_rgb (cr, 1.0f, 1.0f, 1.0f);
116+ draw_round_rect (cr,
117 1.0f,
118 EM2PIXELS (defaults_get_bubble_shadow_size (d), d),
119 EM2PIXELS (defaults_get_bubble_shadow_size (d), d),
120 EM2PIXELS (defaults_get_bubble_corner_radius (d), d),
121 width,
122 height);
123- cairo_fill (cr);
124- /*if (bubble_is_mouse_over (self))
125- {
126- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
127- draw_round_rect (
128- cr,
129- 1.0f,
130- 2 + EM2PIXELS (defaults_get_bubble_shadow_size (d), d),
131- 2 + EM2PIXELS (defaults_get_bubble_shadow_size (d), d),
132- EM2PIXELS (defaults_get_bubble_corner_radius (d), d),
133- width - 4,
134- height - 4);
135 cairo_fill (cr);
136- }*/
137-
138- cairo_destroy (cr);
139-
140- // remove any current shape-mask
141- gtk_widget_shape_combine_mask (priv->widget,NULL, 0, 0);
142-
143- // set new shape-mask
144- gtk_widget_shape_combine_mask (priv->widget,mask, 0, 0);
145+ cairo_destroy (cr);
146+
147+ // remove any current shape-mask
148+ gtk_widget_shape_combine_mask (priv->widget,
149+ NULL,
150+ 0,
151+ 0);
152+
153+ // set new shape-mask
154+ gtk_widget_shape_combine_mask (priv->widget,
155+ mask,
156+ 0,
157+ 0);
158+ }
159+ g_object_unref ((gpointer) mask);
160 }
161-
162- g_object_unref ((gpointer) mask);
163 }
164 }
165
166@@ -2307,7 +2273,7 @@
167 this->priv->prevent_fade = FALSE;
168 this->priv->old_icon_filename = g_string_new ("");
169
170- update_input_shape (window, 1, 1);
171+ update_input_shape (window);
172
173 return this;
174 }

Subscribers

People subscribed via source and target branches

to all changes: