Merge lp:~muktupavels/compiz/gwd-theme-style-window into lp:compiz/0.9.12
- gwd-theme-style-window
- Merge into 0.9.12
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | 4076 |
Merged at revision: | 4057 |
Proposed branch: | lp:~muktupavels/compiz/gwd-theme-style-window |
Merge into: | lp:compiz/0.9.12 |
Prerequisite: | lp:~muktupavels/compiz/gwd-titlebar-font |
Diff against target: |
1218 lines (+380/-333) 10 files modified
gtk/window-decorator/decorator.c (+23/-26) gtk/window-decorator/frames.c (+2/-252) gtk/window-decorator/gtk-window-decorator.c (+0/-1) gtk/window-decorator/gtk-window-decorator.h (+0/-7) gtk/window-decorator/gwd-theme-cairo.c (+218/-5) gtk/window-decorator/gwd-theme-metacity.c (+29/-18) gtk/window-decorator/gwd-theme.c (+73/-1) gtk/window-decorator/gwd-theme.h (+6/-1) gtk/window-decorator/switcher.c (+19/-22) gtk/window-decorator/wnck.c (+10/-0) |
To merge this branch: | bzr merge lp:~muktupavels/compiz/gwd-theme-style-window |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Approve | ||
Review via email: mp+296867@code.launchpad.net |
Commit message
gtk-window-
- Use only one style window - there is no reason to keep multiple windows. More windows just meant that on style-updated signal we called decorations_changed multiple times for no reason - just extra work.
- Switcher label was added to style window, but my tests shows that it is not needed...
- On style-updated signal _title_color was updated multiple times, but it is used only by Cairo theme.
Description of the change
- Use only one style window - there is no reason to keep multiple windows. More windows just meant that on style-updated signal we called decorations_changed multiple times for no reason - just extra work.
- Switcher label was added to style window, but my tests shows that it is not needed...
- On style-updated signal _title_color was updated multiple times, but it is used only by Cairo theme.
- 4075. By Alberts Muktupāvels
-
Merge with lp:~albertsmuktupavels/compiz/gwd-titlebar-font.
- 4076. By Alberts Muktupāvels
-
Merge with lp:~albertsmuktupavels/compiz/gwd-titlebar-font.
Preview Diff
1 | === modified file 'gtk/window-decorator/decorator.c' | |||
2 | --- gtk/window-decorator/decorator.c 2016-06-09 14:58:49 +0000 | |||
3 | +++ gtk/window-decorator/decorator.c 2016-06-09 14:58:49 +0000 | |||
4 | @@ -55,15 +55,19 @@ | |||
5 | 55 | void | 55 | void |
6 | 56 | frame_update_titlebar_font (decor_frame_t *frame) | 56 | frame_update_titlebar_font (decor_frame_t *frame) |
7 | 57 | { | 57 | { |
8 | 58 | GtkWidget *style_window = gwd_theme_get_style_window (gwd_theme); | ||
9 | 58 | PangoFontDescription *font_desc = gwd_theme_get_titlebar_font (gwd_theme, frame); | 59 | PangoFontDescription *font_desc = gwd_theme_get_titlebar_font (gwd_theme, frame); |
11 | 59 | PangoLanguage *lang = pango_context_get_language (frame->pango_context); | 60 | PangoLanguage *lang; |
12 | 60 | PangoFontMetrics *metrics; | 61 | PangoFontMetrics *metrics; |
13 | 61 | gint ascent, descent; | 62 | gint ascent, descent; |
14 | 62 | 63 | ||
15 | 63 | frame = gwd_decor_frame_ref (frame); | 64 | frame = gwd_decor_frame_ref (frame); |
16 | 64 | 65 | ||
17 | 66 | if (frame->pango_context == NULL) | ||
18 | 67 | frame->pango_context = gtk_widget_create_pango_context (style_window); | ||
19 | 65 | pango_context_set_font_description (frame->pango_context, font_desc); | 68 | pango_context_set_font_description (frame->pango_context, font_desc); |
20 | 66 | 69 | ||
21 | 70 | lang = pango_context_get_language (frame->pango_context); | ||
22 | 67 | metrics = pango_context_get_metrics (frame->pango_context, font_desc, lang); | 71 | metrics = pango_context_get_metrics (frame->pango_context, font_desc, lang); |
23 | 68 | ascent = pango_font_metrics_get_ascent (metrics); | 72 | ascent = pango_font_metrics_get_ascent (metrics); |
24 | 69 | descent = pango_font_metrics_get_descent (metrics); | 73 | descent = pango_font_metrics_get_descent (metrics); |
25 | @@ -76,14 +80,6 @@ | |||
26 | 76 | gwd_decor_frame_unref (frame); | 80 | gwd_decor_frame_unref (frame); |
27 | 77 | } | 81 | } |
28 | 78 | 82 | ||
29 | 79 | void | ||
30 | 80 | update_frames_titlebar_fonts (gpointer key, | ||
31 | 81 | gpointer value, | ||
32 | 82 | gpointer user_data) | ||
33 | 83 | { | ||
34 | 84 | frame_update_titlebar_font ((decor_frame_t *) value); | ||
35 | 85 | } | ||
36 | 86 | |||
37 | 87 | /* | 83 | /* |
38 | 88 | * update_event_windows | 84 | * update_event_windows |
39 | 89 | * | 85 | * |
40 | @@ -284,8 +280,6 @@ | |||
41 | 284 | if (!d->layout) | 280 | if (!d->layout) |
42 | 285 | { | 281 | { |
43 | 286 | d->layout = pango_layout_new (d->frame->pango_context); | 282 | d->layout = pango_layout_new (d->frame->pango_context); |
44 | 287 | if (!d->layout) | ||
45 | 288 | return 0; | ||
46 | 289 | 283 | ||
47 | 290 | pango_layout_set_wrap (d->layout, PANGO_WRAP_CHAR); | 284 | pango_layout_set_wrap (d->layout, PANGO_WRAP_CHAR); |
48 | 291 | } | 285 | } |
49 | @@ -353,6 +347,10 @@ | |||
50 | 353 | w = 1; | 347 | w = 1; |
51 | 354 | } | 348 | } |
52 | 355 | 349 | ||
53 | 350 | /* Ensure that a layout is created */ | ||
54 | 351 | if (d->layout == NULL) | ||
55 | 352 | d->layout = pango_layout_new (d->frame->pango_context); | ||
56 | 353 | |||
57 | 356 | /* Set the maximum width for the layout (in case | 354 | /* Set the maximum width for the layout (in case |
58 | 357 | * decoration size < text width) since we | 355 | * decoration size < text width) since we |
59 | 358 | * still need to show the buttons and the window name */ | 356 | * still need to show the buttons and the window name */ |
60 | @@ -417,6 +415,7 @@ | |||
61 | 417 | update_window_decoration_icon (WnckWindow *win) | 415 | update_window_decoration_icon (WnckWindow *win) |
62 | 418 | { | 416 | { |
63 | 419 | decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); | 417 | decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
64 | 418 | GtkWidget *style_window = gwd_theme_get_style_window (gwd_theme); | ||
65 | 420 | 419 | ||
66 | 421 | /* Destroy old stuff */ | 420 | /* Destroy old stuff */ |
67 | 422 | if (d->icon) | 421 | if (d->icon) |
68 | @@ -442,8 +441,7 @@ | |||
69 | 442 | 441 | ||
70 | 443 | g_object_ref (G_OBJECT (d->icon_pixbuf)); | 442 | g_object_ref (G_OBJECT (d->icon_pixbuf)); |
71 | 444 | 443 | ||
74 | 445 | d->icon_surface = surface_new_from_pixbuf (d->icon_pixbuf, | 444 | d->icon_surface = surface_new_from_pixbuf (d->icon_pixbuf, style_window); |
73 | 446 | d->frame->style_window_rgba); | ||
75 | 447 | 445 | ||
76 | 448 | cr = cairo_create (d->icon_surface); | 446 | cr = cairo_create (d->icon_surface); |
77 | 449 | d->icon = cairo_pattern_create_for_surface (cairo_get_target (cr)); | 447 | d->icon = cairo_pattern_create_for_surface (cairo_get_target (cr)); |
78 | @@ -514,6 +512,7 @@ | |||
79 | 514 | cairo_surface_t *surface, *buffer_surface = NULL; | 512 | cairo_surface_t *surface, *buffer_surface = NULL; |
80 | 515 | Picture picture; | 513 | Picture picture; |
81 | 516 | Display *xdisplay; | 514 | Display *xdisplay; |
82 | 515 | GtkWidget *style_window; | ||
83 | 517 | 516 | ||
84 | 518 | if (win == NULL) | 517 | if (win == NULL) |
85 | 519 | return FALSE; | 518 | return FALSE; |
86 | @@ -524,10 +523,11 @@ | |||
87 | 524 | return FALSE; | 523 | return FALSE; |
88 | 525 | 524 | ||
89 | 526 | xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); | 525 | xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); |
90 | 526 | style_window = gwd_theme_get_style_window (gwd_theme); | ||
91 | 527 | 527 | ||
92 | 528 | gdk_error_trap_push (); | 528 | gdk_error_trap_push (); |
93 | 529 | 529 | ||
95 | 530 | surface = create_native_surface_and_wrap (d->width, d->height, d->frame->style_window_rgba); | 530 | surface = create_native_surface_and_wrap (d->width, d->height, style_window); |
96 | 531 | 531 | ||
97 | 532 | gdk_flush (); | 532 | gdk_flush (); |
98 | 533 | 533 | ||
99 | @@ -541,7 +541,7 @@ | |||
100 | 541 | 541 | ||
101 | 542 | gdk_error_trap_push (); | 542 | gdk_error_trap_push (); |
102 | 543 | 543 | ||
104 | 544 | buffer_surface = create_surface (d->width, d->height, d->frame->style_window_rgba); | 544 | buffer_surface = create_surface (d->width, d->height, style_window); |
105 | 545 | 545 | ||
106 | 546 | gdk_flush (); | 546 | gdk_flush (); |
107 | 547 | 547 | ||
108 | @@ -1174,21 +1174,18 @@ | |||
109 | 1174 | void | 1174 | void |
110 | 1175 | update_default_decorations (GdkScreen *screen) | 1175 | update_default_decorations (GdkScreen *screen) |
111 | 1176 | { | 1176 | { |
112 | 1177 | GdkDisplay *display = gdk_display_get_default (); | ||
113 | 1178 | Display *xdisplay = gdk_x11_display_get_xdisplay (display); | ||
114 | 1179 | Window xroot = RootWindowOfScreen (gdk_x11_screen_get_xscreen (screen)); | ||
115 | 1180 | Atom bareAtom = XInternAtom (xdisplay, DECOR_BARE_ATOM_NAME, FALSE); | ||
116 | 1181 | Atom activeAtom = XInternAtom (xdisplay, DECOR_ACTIVE_ATOM_NAME, FALSE); | ||
117 | 1182 | GtkWidget *style_window = gwd_theme_get_style_window (gwd_theme); | ||
118 | 1177 | long *data; | 1183 | long *data; |
119 | 1178 | Window xroot; | ||
120 | 1179 | GdkDisplay *gdkdisplay = gdk_display_get_default (); | ||
121 | 1180 | Display *xdisplay = gdk_x11_display_get_xdisplay (gdkdisplay); | ||
122 | 1181 | Atom bareAtom, activeAtom; | ||
123 | 1182 | decor_frame_t *frame; | 1184 | decor_frame_t *frame; |
124 | 1183 | decor_frame_t *bare_frame = gwd_get_decor_frame ("bare"); | 1185 | decor_frame_t *bare_frame = gwd_get_decor_frame ("bare"); |
125 | 1184 | decor_extents_t extents; | 1186 | decor_extents_t extents; |
126 | 1185 | unsigned int i; | 1187 | unsigned int i; |
127 | 1186 | 1188 | ||
128 | 1187 | xroot = RootWindowOfScreen (gdk_x11_screen_get_xscreen (screen)); | ||
129 | 1188 | |||
130 | 1189 | bareAtom = XInternAtom (xdisplay, DECOR_BARE_ATOM_NAME, FALSE); | ||
131 | 1190 | activeAtom = XInternAtom (xdisplay, DECOR_ACTIVE_ATOM_NAME, FALSE); | ||
132 | 1191 | |||
133 | 1192 | if (bare_frame->border_shadow_active) | 1189 | if (bare_frame->border_shadow_active) |
134 | 1193 | { | 1190 | { |
135 | 1194 | decor_layout_t layout; | 1191 | decor_layout_t layout; |
136 | @@ -1266,7 +1263,7 @@ | |||
137 | 1266 | 1263 | ||
138 | 1267 | default_frames[i].d->context = i < WINDOW_TYPE_FRAMES_NUM ? &frame->window_context_active : &frame->window_context_inactive; | 1264 | default_frames[i].d->context = i < WINDOW_TYPE_FRAMES_NUM ? &frame->window_context_active : &frame->window_context_inactive; |
139 | 1268 | default_frames[i].d->shadow = i < WINDOW_TYPE_FRAMES_NUM ? frame->border_shadow_active : frame->border_shadow_inactive; | 1265 | default_frames[i].d->shadow = i < WINDOW_TYPE_FRAMES_NUM ? frame->border_shadow_active : frame->border_shadow_inactive; |
141 | 1269 | default_frames[i].d->layout = pango_layout_new (frame->pango_context); | 1266 | default_frames[i].d->layout = NULL; |
142 | 1270 | 1267 | ||
143 | 1271 | decor_get_default_layout (default_frames[i].d->context, 1, 1, &default_frames[i].d->border_layout); | 1268 | decor_get_default_layout (default_frames[i].d->context, 1, 1, &default_frames[i].d->border_layout); |
144 | 1272 | 1269 | ||
145 | @@ -1279,7 +1276,7 @@ | |||
146 | 1279 | default_frames[i].d->draw = draw_window_decoration; | 1276 | default_frames[i].d->draw = draw_window_decoration; |
147 | 1280 | default_frames[i].d->surface = create_native_surface_and_wrap (default_frames[i].d->width, | 1277 | default_frames[i].d->surface = create_native_surface_and_wrap (default_frames[i].d->width, |
148 | 1281 | default_frames[i].d->height, | 1278 | default_frames[i].d->height, |
150 | 1282 | frame->style_window_rgba); | 1279 | style_window); |
151 | 1283 | 1280 | ||
152 | 1284 | unsigned int j, k; | 1281 | unsigned int j, k; |
153 | 1285 | 1282 | ||
154 | 1286 | 1283 | ||
155 | === modified file 'gtk/window-decorator/frames.c' | |||
156 | --- gtk/window-decorator/frames.c 2016-06-09 14:58:49 +0000 | |||
157 | +++ gtk/window-decorator/frames.c 2016-06-09 14:58:49 +0000 | |||
158 | @@ -32,236 +32,7 @@ | |||
159 | 32 | GHashTable *frame_info_table; | 32 | GHashTable *frame_info_table; |
160 | 33 | GHashTable *frames_table; | 33 | GHashTable *frames_table; |
161 | 34 | 34 | ||
392 | 35 | /* from clearlooks theme */ | 35 | static void |
163 | 36 | static void | ||
164 | 37 | rgb_to_hls (gdouble *r, | ||
165 | 38 | gdouble *g, | ||
166 | 39 | gdouble *b) | ||
167 | 40 | { | ||
168 | 41 | gdouble min; | ||
169 | 42 | gdouble max; | ||
170 | 43 | gdouble red; | ||
171 | 44 | gdouble green; | ||
172 | 45 | gdouble blue; | ||
173 | 46 | gdouble h, l, s; | ||
174 | 47 | gdouble delta; | ||
175 | 48 | |||
176 | 49 | red = *r; | ||
177 | 50 | green = *g; | ||
178 | 51 | blue = *b; | ||
179 | 52 | |||
180 | 53 | if (red > green) | ||
181 | 54 | { | ||
182 | 55 | if (red > blue) | ||
183 | 56 | max = red; | ||
184 | 57 | else | ||
185 | 58 | max = blue; | ||
186 | 59 | |||
187 | 60 | if (green < blue) | ||
188 | 61 | min = green; | ||
189 | 62 | else | ||
190 | 63 | min = blue; | ||
191 | 64 | } | ||
192 | 65 | else | ||
193 | 66 | { | ||
194 | 67 | if (green > blue) | ||
195 | 68 | max = green; | ||
196 | 69 | else | ||
197 | 70 | max = blue; | ||
198 | 71 | |||
199 | 72 | if (red < blue) | ||
200 | 73 | min = red; | ||
201 | 74 | else | ||
202 | 75 | min = blue; | ||
203 | 76 | } | ||
204 | 77 | |||
205 | 78 | l = (max + min) / 2; | ||
206 | 79 | s = 0; | ||
207 | 80 | h = 0; | ||
208 | 81 | |||
209 | 82 | if (max != min) | ||
210 | 83 | { | ||
211 | 84 | if (l <= 0.5) | ||
212 | 85 | s = (max - min) / (max + min); | ||
213 | 86 | else | ||
214 | 87 | s = (max - min) / (2 - max - min); | ||
215 | 88 | |||
216 | 89 | delta = max -min; | ||
217 | 90 | if (red == max) | ||
218 | 91 | h = (green - blue) / delta; | ||
219 | 92 | else if (green == max) | ||
220 | 93 | h = 2 + (blue - red) / delta; | ||
221 | 94 | else if (blue == max) | ||
222 | 95 | h = 4 + (red - green) / delta; | ||
223 | 96 | |||
224 | 97 | h *= 60; | ||
225 | 98 | if (h < 0.0) | ||
226 | 99 | h += 360; | ||
227 | 100 | } | ||
228 | 101 | |||
229 | 102 | *r = h; | ||
230 | 103 | *g = l; | ||
231 | 104 | *b = s; | ||
232 | 105 | } | ||
233 | 106 | |||
234 | 107 | static void | ||
235 | 108 | hls_to_rgb (gdouble *h, | ||
236 | 109 | gdouble *l, | ||
237 | 110 | gdouble *s) | ||
238 | 111 | { | ||
239 | 112 | gdouble hue; | ||
240 | 113 | gdouble lightness; | ||
241 | 114 | gdouble saturation; | ||
242 | 115 | gdouble m1, m2; | ||
243 | 116 | gdouble r, g, b; | ||
244 | 117 | |||
245 | 118 | lightness = *l; | ||
246 | 119 | saturation = *s; | ||
247 | 120 | |||
248 | 121 | if (lightness <= 0.5) | ||
249 | 122 | m2 = lightness * (1 + saturation); | ||
250 | 123 | else | ||
251 | 124 | m2 = lightness + saturation - lightness * saturation; | ||
252 | 125 | |||
253 | 126 | m1 = 2 * lightness - m2; | ||
254 | 127 | |||
255 | 128 | if (saturation == 0) | ||
256 | 129 | { | ||
257 | 130 | *h = lightness; | ||
258 | 131 | *l = lightness; | ||
259 | 132 | *s = lightness; | ||
260 | 133 | } | ||
261 | 134 | else | ||
262 | 135 | { | ||
263 | 136 | hue = *h + 120; | ||
264 | 137 | while (hue > 360) | ||
265 | 138 | hue -= 360; | ||
266 | 139 | while (hue < 0) | ||
267 | 140 | hue += 360; | ||
268 | 141 | |||
269 | 142 | if (hue < 60) | ||
270 | 143 | r = m1 + (m2 - m1) * hue / 60; | ||
271 | 144 | else if (hue < 180) | ||
272 | 145 | r = m2; | ||
273 | 146 | else if (hue < 240) | ||
274 | 147 | r = m1 + (m2 - m1) * (240 - hue) / 60; | ||
275 | 148 | else | ||
276 | 149 | r = m1; | ||
277 | 150 | |||
278 | 151 | hue = *h; | ||
279 | 152 | while (hue > 360) | ||
280 | 153 | hue -= 360; | ||
281 | 154 | while (hue < 0) | ||
282 | 155 | hue += 360; | ||
283 | 156 | |||
284 | 157 | if (hue < 60) | ||
285 | 158 | g = m1 + (m2 - m1) * hue / 60; | ||
286 | 159 | else if (hue < 180) | ||
287 | 160 | g = m2; | ||
288 | 161 | else if (hue < 240) | ||
289 | 162 | g = m1 + (m2 - m1) * (240 - hue) / 60; | ||
290 | 163 | else | ||
291 | 164 | g = m1; | ||
292 | 165 | |||
293 | 166 | hue = *h - 120; | ||
294 | 167 | while (hue > 360) | ||
295 | 168 | hue -= 360; | ||
296 | 169 | while (hue < 0) | ||
297 | 170 | hue += 360; | ||
298 | 171 | |||
299 | 172 | if (hue < 60) | ||
300 | 173 | b = m1 + (m2 - m1) * hue / 60; | ||
301 | 174 | else if (hue < 180) | ||
302 | 175 | b = m2; | ||
303 | 176 | else if (hue < 240) | ||
304 | 177 | b = m1 + (m2 - m1) * (240 - hue) / 60; | ||
305 | 178 | else | ||
306 | 179 | b = m1; | ||
307 | 180 | |||
308 | 181 | *h = r; | ||
309 | 182 | *l = g; | ||
310 | 183 | *s = b; | ||
311 | 184 | } | ||
312 | 185 | } | ||
313 | 186 | |||
314 | 187 | static void | ||
315 | 188 | shade (const decor_color_t *a, | ||
316 | 189 | decor_color_t *b, | ||
317 | 190 | float k) | ||
318 | 191 | { | ||
319 | 192 | double red; | ||
320 | 193 | double green; | ||
321 | 194 | double blue; | ||
322 | 195 | |||
323 | 196 | red = a->r; | ||
324 | 197 | green = a->g; | ||
325 | 198 | blue = a->b; | ||
326 | 199 | |||
327 | 200 | rgb_to_hls (&red, &green, &blue); | ||
328 | 201 | |||
329 | 202 | green *= k; | ||
330 | 203 | if (green > 1.0) | ||
331 | 204 | green = 1.0; | ||
332 | 205 | else if (green < 0.0) | ||
333 | 206 | green = 0.0; | ||
334 | 207 | |||
335 | 208 | blue *= k; | ||
336 | 209 | if (blue > 1.0) | ||
337 | 210 | blue = 1.0; | ||
338 | 211 | else if (blue < 0.0) | ||
339 | 212 | blue = 0.0; | ||
340 | 213 | |||
341 | 214 | hls_to_rgb (&red, &green, &blue); | ||
342 | 215 | |||
343 | 216 | b->r = red; | ||
344 | 217 | b->g = green; | ||
345 | 218 | b->b = blue; | ||
346 | 219 | } | ||
347 | 220 | |||
348 | 221 | static void | ||
349 | 222 | update_style (GtkWidget *widget) | ||
350 | 223 | { | ||
351 | 224 | GtkStyleContext *context; | ||
352 | 225 | GdkRGBA bg; | ||
353 | 226 | decor_color_t spot_color; | ||
354 | 227 | |||
355 | 228 | context = gtk_widget_get_style_context (widget); | ||
356 | 229 | |||
357 | 230 | gtk_style_context_save (context); | ||
358 | 231 | gtk_style_context_set_state (context, GTK_STATE_FLAG_SELECTED); | ||
359 | 232 | gtk_style_context_get_background_color (context, GTK_STATE_FLAG_SELECTED, &bg); | ||
360 | 233 | gtk_style_context_restore (context); | ||
361 | 234 | |||
362 | 235 | spot_color.r = bg.red; | ||
363 | 236 | spot_color.g = bg.green; | ||
364 | 237 | spot_color.b = bg.blue; | ||
365 | 238 | |||
366 | 239 | shade (&spot_color, &_title_color[0], 1.05); | ||
367 | 240 | shade (&_title_color[0], &_title_color[1], 0.85); | ||
368 | 241 | } | ||
369 | 242 | |||
370 | 243 | static void | ||
371 | 244 | style_updated (GtkWidget *widget, | ||
372 | 245 | void *user_data) | ||
373 | 246 | { | ||
374 | 247 | GdkDisplay *gdkdisplay; | ||
375 | 248 | GdkScreen *gdkscreen; | ||
376 | 249 | WnckScreen *screen; | ||
377 | 250 | |||
378 | 251 | PangoContext *context = (PangoContext *) user_data; | ||
379 | 252 | |||
380 | 253 | gdkdisplay = gdk_display_get_default (); | ||
381 | 254 | gdkscreen = gdk_display_get_default_screen (gdkdisplay); | ||
382 | 255 | screen = wnck_screen_get_default (); | ||
383 | 256 | |||
384 | 257 | update_style (widget); | ||
385 | 258 | |||
386 | 259 | pango_cairo_context_set_resolution (context, gdk_screen_get_resolution (gdkscreen)); | ||
387 | 260 | |||
388 | 261 | decorations_changed (screen); | ||
389 | 262 | } | ||
390 | 263 | |||
391 | 264 | void | ||
393 | 265 | decor_frame_refresh (decor_frame_t *frame) | 36 | decor_frame_refresh (decor_frame_t *frame) |
394 | 266 | { | 37 | { |
395 | 267 | decor_shadow_options_t active_o, inactive_o; | 38 | decor_shadow_options_t active_o, inactive_o; |
396 | @@ -269,8 +40,6 @@ | |||
397 | 269 | 40 | ||
398 | 270 | gwd_decor_frame_ref (frame); | 41 | gwd_decor_frame_ref (frame); |
399 | 271 | 42 | ||
400 | 272 | update_style (frame->style_window_rgba); | ||
401 | 273 | |||
402 | 274 | frame_update_titlebar_font (frame); | 43 | frame_update_titlebar_font (frame); |
403 | 275 | 44 | ||
404 | 276 | if (strcmp (frame->type, "switcher") != 0 && strcmp (frame->type, "bare") != 0) | 45 | if (strcmp (frame->type, "switcher") != 0 && strcmp (frame->type, "bare") != 0) |
405 | @@ -421,8 +190,6 @@ | |||
406 | 421 | decor_frame_t * | 190 | decor_frame_t * |
407 | 422 | decor_frame_new (const gchar *type) | 191 | decor_frame_new (const gchar *type) |
408 | 423 | { | 192 | { |
409 | 424 | GdkScreen *gdkscreen = gdk_screen_get_default (); | ||
410 | 425 | GdkVisual *visual; | ||
411 | 426 | decor_frame_t *frame = malloc (sizeof (decor_frame_t)); | 193 | decor_frame_t *frame = malloc (sizeof (decor_frame_t)); |
412 | 427 | 194 | ||
413 | 428 | if (!frame) | 195 | if (!frame) |
414 | @@ -438,21 +205,7 @@ | |||
415 | 438 | frame->max_border_shadow_active = NULL; | 205 | frame->max_border_shadow_active = NULL; |
416 | 439 | frame->max_border_shadow_inactive = NULL; | 206 | frame->max_border_shadow_inactive = NULL; |
417 | 440 | 207 | ||
433 | 441 | frame->style_window_rgba = gtk_window_new (GTK_WINDOW_POPUP); | 208 | frame->pango_context = NULL; |
419 | 442 | |||
420 | 443 | visual = gdk_screen_get_rgba_visual (gdkscreen); | ||
421 | 444 | if (visual) | ||
422 | 445 | gtk_widget_set_visual (frame->style_window_rgba, visual); | ||
423 | 446 | |||
424 | 447 | gtk_widget_realize (frame->style_window_rgba); | ||
425 | 448 | |||
426 | 449 | gtk_window_move (GTK_WINDOW (frame->style_window_rgba), -100, -100); | ||
427 | 450 | |||
428 | 451 | frame->pango_context = gtk_widget_create_pango_context (frame->style_window_rgba); | ||
429 | 452 | |||
430 | 453 | g_signal_connect_data (frame->style_window_rgba, "style-updated", | ||
431 | 454 | G_CALLBACK (style_updated), | ||
432 | 455 | (gpointer) frame->pango_context, 0, 0); | ||
434 | 456 | 209 | ||
435 | 457 | return frame; | 210 | return frame; |
436 | 458 | } | 211 | } |
437 | @@ -474,9 +227,6 @@ | |||
438 | 474 | if (frame->max_border_shadow_inactive) | 227 | if (frame->max_border_shadow_inactive) |
439 | 475 | decor_shadow_destroy (xdisplay, frame->max_border_shadow_inactive); | 228 | decor_shadow_destroy (xdisplay, frame->max_border_shadow_inactive); |
440 | 476 | 229 | ||
441 | 477 | if (frame->style_window_rgba) | ||
442 | 478 | gtk_widget_destroy (GTK_WIDGET (frame->style_window_rgba)); | ||
443 | 479 | |||
444 | 480 | if (frame->pango_context) | 230 | if (frame->pango_context) |
445 | 481 | g_object_unref (G_OBJECT (frame->pango_context)); | 231 | g_object_unref (G_OBJECT (frame->pango_context)); |
446 | 482 | 232 | ||
447 | 483 | 233 | ||
448 | === modified file 'gtk/window-decorator/gtk-window-decorator.c' | |||
449 | --- gtk/window-decorator/gtk-window-decorator.c 2016-06-09 14:58:49 +0000 | |||
450 | +++ gtk/window-decorator/gtk-window-decorator.c 2016-06-09 14:58:49 +0000 | |||
451 | @@ -107,7 +107,6 @@ | |||
452 | 107 | GHashTable *frame_table; | 107 | GHashTable *frame_table; |
453 | 108 | GtkWidget *action_menu = NULL; | 108 | GtkWidget *action_menu = NULL; |
454 | 109 | gboolean action_menu_mapped = FALSE; | 109 | gboolean action_menu_mapped = FALSE; |
455 | 110 | decor_color_t _title_color[2]; | ||
456 | 111 | gint double_click_timeout = 250; | 110 | gint double_click_timeout = 250; |
457 | 112 | 111 | ||
458 | 113 | GtkWidget *tip_window; | 112 | GtkWidget *tip_window; |
459 | 114 | 113 | ||
460 | === modified file 'gtk/window-decorator/gtk-window-decorator.h' | |||
461 | --- gtk/window-decorator/gtk-window-decorator.h 2016-06-09 14:58:49 +0000 | |||
462 | +++ gtk/window-decorator/gtk-window-decorator.h 2016-06-09 14:58:49 +0000 | |||
463 | @@ -218,7 +218,6 @@ | |||
464 | 218 | decor_context_t max_window_context_active; | 218 | decor_context_t max_window_context_active; |
465 | 219 | decor_context_t max_window_context_inactive; | 219 | decor_context_t max_window_context_inactive; |
466 | 220 | PangoContext *pango_context; | 220 | PangoContext *pango_context; |
467 | 221 | GtkWidget *style_window_rgba; | ||
468 | 222 | gint text_height; | 221 | gint text_height; |
469 | 223 | gchar *type; | 222 | gchar *type; |
470 | 224 | 223 | ||
471 | @@ -279,7 +278,6 @@ | |||
472 | 279 | /* action menu */ | 278 | /* action menu */ |
473 | 280 | extern GtkWidget *action_menu; | 279 | extern GtkWidget *action_menu; |
474 | 281 | extern gboolean action_menu_mapped; | 280 | extern gboolean action_menu_mapped; |
475 | 282 | extern decor_color_t _title_color[2]; | ||
476 | 283 | extern gint double_click_timeout; | 281 | extern gint double_click_timeout; |
477 | 284 | 282 | ||
478 | 285 | 283 | ||
479 | @@ -387,11 +385,6 @@ | |||
480 | 387 | update_shadow (void); | 385 | update_shadow (void); |
481 | 388 | 386 | ||
482 | 389 | void | 387 | void |
483 | 390 | update_frames_titlebar_fonts (gpointer key, | ||
484 | 391 | gpointer value, | ||
485 | 392 | gpointer user_data); | ||
486 | 393 | |||
487 | 394 | void | ||
488 | 395 | update_window_decoration (WnckWindow *win); | 388 | update_window_decoration (WnckWindow *win); |
489 | 396 | 389 | ||
490 | 397 | void | 390 | void |
491 | 398 | 391 | ||
492 | === modified file 'gtk/window-decorator/gwd-theme-cairo.c' | |||
493 | --- gtk/window-decorator/gwd-theme-cairo.c 2016-06-09 14:58:49 +0000 | |||
494 | +++ gtk/window-decorator/gwd-theme-cairo.c 2016-06-09 14:58:49 +0000 | |||
495 | @@ -33,7 +33,9 @@ | |||
496 | 33 | 33 | ||
497 | 34 | struct _GWDThemeCairo | 34 | struct _GWDThemeCairo |
498 | 35 | { | 35 | { |
500 | 36 | GObject parent; | 36 | GObject parent; |
501 | 37 | |||
502 | 38 | decor_color_t title_color[2]; | ||
503 | 37 | }; | 39 | }; |
504 | 38 | 40 | ||
505 | 39 | G_DEFINE_TYPE (GWDThemeCairo, gwd_theme_cairo, GWD_TYPE_THEME) | 41 | G_DEFINE_TYPE (GWDThemeCairo, gwd_theme_cairo, GWD_TYPE_THEME) |
506 | @@ -45,6 +47,195 @@ | |||
507 | 45 | } | 47 | } |
508 | 46 | 48 | ||
509 | 47 | static void | 49 | static void |
510 | 50 | rgb_to_hls (gdouble *r, | ||
511 | 51 | gdouble *g, | ||
512 | 52 | gdouble *b) | ||
513 | 53 | { | ||
514 | 54 | gdouble red = *r; | ||
515 | 55 | gdouble green = *g; | ||
516 | 56 | gdouble blue = *b; | ||
517 | 57 | gdouble min; | ||
518 | 58 | gdouble max; | ||
519 | 59 | gdouble h, l, s; | ||
520 | 60 | gdouble delta; | ||
521 | 61 | |||
522 | 62 | if (red > green) { | ||
523 | 63 | if (red > blue) | ||
524 | 64 | max = red; | ||
525 | 65 | else | ||
526 | 66 | max = blue; | ||
527 | 67 | |||
528 | 68 | if (green < blue) | ||
529 | 69 | min = green; | ||
530 | 70 | else | ||
531 | 71 | min = blue; | ||
532 | 72 | } else { | ||
533 | 73 | if (green > blue) | ||
534 | 74 | max = green; | ||
535 | 75 | else | ||
536 | 76 | max = blue; | ||
537 | 77 | |||
538 | 78 | if (red < blue) | ||
539 | 79 | min = red; | ||
540 | 80 | else | ||
541 | 81 | min = blue; | ||
542 | 82 | } | ||
543 | 83 | |||
544 | 84 | l = (max + min) / 2; | ||
545 | 85 | s = 0; | ||
546 | 86 | h = 0; | ||
547 | 87 | |||
548 | 88 | if (max != min) { | ||
549 | 89 | if (l <= 0.5) | ||
550 | 90 | s = (max - min) / (max + min); | ||
551 | 91 | else | ||
552 | 92 | s = (max - min) / (2 - max - min); | ||
553 | 93 | |||
554 | 94 | delta = max -min; | ||
555 | 95 | if (red == max) | ||
556 | 96 | h = (green - blue) / delta; | ||
557 | 97 | else if (green == max) | ||
558 | 98 | h = 2 + (blue - red) / delta; | ||
559 | 99 | else if (blue == max) | ||
560 | 100 | h = 4 + (red - green) / delta; | ||
561 | 101 | |||
562 | 102 | h *= 60; | ||
563 | 103 | if (h < 0.0) | ||
564 | 104 | h += 360; | ||
565 | 105 | } | ||
566 | 106 | |||
567 | 107 | *r = h; | ||
568 | 108 | *g = l; | ||
569 | 109 | *b = s; | ||
570 | 110 | } | ||
571 | 111 | |||
572 | 112 | static void | ||
573 | 113 | hls_to_rgb (gdouble *h, | ||
574 | 114 | gdouble *l, | ||
575 | 115 | gdouble *s) | ||
576 | 116 | { | ||
577 | 117 | gdouble lightness = *l; | ||
578 | 118 | gdouble saturation = *s; | ||
579 | 119 | gdouble hue; | ||
580 | 120 | gdouble m1, m2; | ||
581 | 121 | gdouble r, g, b; | ||
582 | 122 | |||
583 | 123 | if (lightness <= 0.5) | ||
584 | 124 | m2 = lightness * (1 + saturation); | ||
585 | 125 | else | ||
586 | 126 | m2 = lightness + saturation - lightness * saturation; | ||
587 | 127 | |||
588 | 128 | m1 = 2 * lightness - m2; | ||
589 | 129 | |||
590 | 130 | if (saturation == 0) { | ||
591 | 131 | *h = lightness; | ||
592 | 132 | *l = lightness; | ||
593 | 133 | *s = lightness; | ||
594 | 134 | } else { | ||
595 | 135 | hue = *h + 120; | ||
596 | 136 | while (hue > 360) | ||
597 | 137 | hue -= 360; | ||
598 | 138 | while (hue < 0) | ||
599 | 139 | hue += 360; | ||
600 | 140 | |||
601 | 141 | if (hue < 60) | ||
602 | 142 | r = m1 + (m2 - m1) * hue / 60; | ||
603 | 143 | else if (hue < 180) | ||
604 | 144 | r = m2; | ||
605 | 145 | else if (hue < 240) | ||
606 | 146 | r = m1 + (m2 - m1) * (240 - hue) / 60; | ||
607 | 147 | else | ||
608 | 148 | r = m1; | ||
609 | 149 | |||
610 | 150 | hue = *h; | ||
611 | 151 | while (hue > 360) | ||
612 | 152 | hue -= 360; | ||
613 | 153 | while (hue < 0) | ||
614 | 154 | hue += 360; | ||
615 | 155 | |||
616 | 156 | if (hue < 60) | ||
617 | 157 | g = m1 + (m2 - m1) * hue / 60; | ||
618 | 158 | else if (hue < 180) | ||
619 | 159 | g = m2; | ||
620 | 160 | else if (hue < 240) | ||
621 | 161 | g = m1 + (m2 - m1) * (240 - hue) / 60; | ||
622 | 162 | else | ||
623 | 163 | g = m1; | ||
624 | 164 | |||
625 | 165 | hue = *h - 120; | ||
626 | 166 | while (hue > 360) | ||
627 | 167 | hue -= 360; | ||
628 | 168 | while (hue < 0) | ||
629 | 169 | hue += 360; | ||
630 | 170 | |||
631 | 171 | if (hue < 60) | ||
632 | 172 | b = m1 + (m2 - m1) * hue / 60; | ||
633 | 173 | else if (hue < 180) | ||
634 | 174 | b = m2; | ||
635 | 175 | else if (hue < 240) | ||
636 | 176 | b = m1 + (m2 - m1) * (240 - hue) / 60; | ||
637 | 177 | else | ||
638 | 178 | b = m1; | ||
639 | 179 | |||
640 | 180 | *h = r; | ||
641 | 181 | *l = g; | ||
642 | 182 | *s = b; | ||
643 | 183 | } | ||
644 | 184 | } | ||
645 | 185 | |||
646 | 186 | static void | ||
647 | 187 | shade (const decor_color_t *a, | ||
648 | 188 | decor_color_t *b, | ||
649 | 189 | gfloat k) | ||
650 | 190 | { | ||
651 | 191 | gdouble red = a->r; | ||
652 | 192 | gdouble green = a->g; | ||
653 | 193 | gdouble blue = a->b; | ||
654 | 194 | |||
655 | 195 | rgb_to_hls (&red, &green, &blue); | ||
656 | 196 | |||
657 | 197 | green *= k; | ||
658 | 198 | if (green > 1.0) | ||
659 | 199 | green = 1.0; | ||
660 | 200 | else if (green < 0.0) | ||
661 | 201 | green = 0.0; | ||
662 | 202 | |||
663 | 203 | blue *= k; | ||
664 | 204 | if (blue > 1.0) | ||
665 | 205 | blue = 1.0; | ||
666 | 206 | else if (blue < 0.0) | ||
667 | 207 | blue = 0.0; | ||
668 | 208 | |||
669 | 209 | hls_to_rgb (&red, &green, &blue); | ||
670 | 210 | |||
671 | 211 | b->r = red; | ||
672 | 212 | b->g = green; | ||
673 | 213 | b->b = blue; | ||
674 | 214 | } | ||
675 | 215 | |||
676 | 216 | static void | ||
677 | 217 | update_title_colors (GWDThemeCairo *cairo) | ||
678 | 218 | { | ||
679 | 219 | GWDTheme *theme = GWD_THEME (cairo); | ||
680 | 220 | GtkWidget *style_window = gwd_theme_get_style_window (theme); | ||
681 | 221 | GtkStyleContext *context = gtk_widget_get_style_context (style_window); | ||
682 | 222 | GdkRGBA bg; | ||
683 | 223 | decor_color_t spot_color; | ||
684 | 224 | |||
685 | 225 | gtk_style_context_save (context); | ||
686 | 226 | gtk_style_context_set_state (context, GTK_STATE_FLAG_SELECTED); | ||
687 | 227 | gtk_style_context_get_background_color (context, GTK_STATE_FLAG_SELECTED, &bg); | ||
688 | 228 | gtk_style_context_restore (context); | ||
689 | 229 | |||
690 | 230 | spot_color.r = bg.red; | ||
691 | 231 | spot_color.g = bg.green; | ||
692 | 232 | spot_color.b = bg.blue; | ||
693 | 233 | |||
694 | 234 | shade (&spot_color, &cairo->title_color[0], 1.05); | ||
695 | 235 | shade (&cairo->title_color[0], &cairo->title_color[1], 0.85); | ||
696 | 236 | } | ||
697 | 237 | |||
698 | 238 | static void | ||
699 | 48 | decor_update_window_property (decor_t *d) | 239 | decor_update_window_property (decor_t *d) |
700 | 49 | { | 240 | { |
701 | 50 | GdkDisplay *display = gdk_display_get_default (); | 241 | GdkDisplay *display = gdk_display_get_default (); |
702 | @@ -320,11 +511,31 @@ | |||
703 | 320 | } | 511 | } |
704 | 321 | 512 | ||
705 | 322 | static void | 513 | static void |
706 | 514 | gwd_theme_cairo_constructed (GObject *object) | ||
707 | 515 | { | ||
708 | 516 | GWDThemeCairo *cairo = GWD_THEME_CAIRO (object); | ||
709 | 517 | |||
710 | 518 | G_OBJECT_CLASS (gwd_theme_cairo_parent_class)->constructed (object); | ||
711 | 519 | |||
712 | 520 | update_title_colors (cairo); | ||
713 | 521 | } | ||
714 | 522 | |||
715 | 523 | static void | ||
716 | 524 | gwd_theme_cairo_style_updated (GWDTheme *theme) | ||
717 | 525 | { | ||
718 | 526 | GWDThemeCairo *cairo = GWD_THEME_CAIRO (theme); | ||
719 | 527 | |||
720 | 528 | update_title_colors (cairo); | ||
721 | 529 | } | ||
722 | 530 | |||
723 | 531 | static void | ||
724 | 323 | gwd_theme_cairo_draw_window_decoration (GWDTheme *theme, | 532 | gwd_theme_cairo_draw_window_decoration (GWDTheme *theme, |
725 | 324 | decor_t *decor) | 533 | decor_t *decor) |
726 | 325 | { | 534 | { |
727 | 535 | GWDThemeCairo *cairo = GWD_THEME_CAIRO (theme); | ||
728 | 536 | GtkWidget *style_window = gwd_theme_get_style_window (theme); | ||
729 | 537 | GtkStyleContext *context = gtk_widget_get_style_context (style_window); | ||
730 | 326 | cairo_t *cr; | 538 | cairo_t *cr; |
731 | 327 | GtkStyleContext *context; | ||
732 | 328 | GdkRGBA bg, fg; | 539 | GdkRGBA bg, fg; |
733 | 329 | cairo_surface_t *surface; | 540 | cairo_surface_t *surface; |
734 | 330 | decor_color_t color; | 541 | decor_color_t color; |
735 | @@ -338,8 +549,6 @@ | |||
736 | 338 | if (!decor->surface) | 549 | if (!decor->surface) |
737 | 339 | return; | 550 | return; |
738 | 340 | 551 | ||
739 | 341 | context = gtk_widget_get_style_context (decor->frame->style_window_rgba); | ||
740 | 342 | |||
741 | 343 | gtk_style_context_save (context); | 552 | gtk_style_context_save (context); |
742 | 344 | gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); | 553 | gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); |
743 | 345 | gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg); | 554 | gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg); |
744 | @@ -380,7 +589,7 @@ | |||
745 | 380 | draw_shadow_background (decor, cr, decor->shadow, decor->context); | 589 | draw_shadow_background (decor, cr, decor->shadow, decor->context); |
746 | 381 | 590 | ||
747 | 382 | if (decor->active) { | 591 | if (decor->active) { |
749 | 383 | decor_color_t *title_color = _title_color; | 592 | decor_color_t *title_color = cairo->title_color; |
750 | 384 | 593 | ||
751 | 385 | alpha = decoration_alpha + 0.3; | 594 | alpha = decoration_alpha + 0.3; |
752 | 386 | 595 | ||
753 | @@ -848,8 +1057,12 @@ | |||
754 | 848 | static void | 1057 | static void |
755 | 849 | gwd_theme_cairo_class_init (GWDThemeCairoClass *cairo_class) | 1058 | gwd_theme_cairo_class_init (GWDThemeCairoClass *cairo_class) |
756 | 850 | { | 1059 | { |
757 | 1060 | GObjectClass *object_class = G_OBJECT_CLASS (cairo_class); | ||
758 | 851 | GWDThemeClass *theme_class = GWD_THEME_CLASS (cairo_class); | 1061 | GWDThemeClass *theme_class = GWD_THEME_CLASS (cairo_class); |
759 | 852 | 1062 | ||
760 | 1063 | object_class->constructed = gwd_theme_cairo_constructed; | ||
761 | 1064 | |||
762 | 1065 | theme_class->style_updated = gwd_theme_cairo_style_updated; | ||
763 | 853 | theme_class->draw_window_decoration = gwd_theme_cairo_draw_window_decoration; | 1066 | theme_class->draw_window_decoration = gwd_theme_cairo_draw_window_decoration; |
764 | 854 | theme_class->calc_decoration_size = gwd_theme_cairo_calc_decoration_size; | 1067 | theme_class->calc_decoration_size = gwd_theme_cairo_calc_decoration_size; |
765 | 855 | theme_class->update_border_extents = gwd_theme_cairo_update_border_extents; | 1068 | theme_class->update_border_extents = gwd_theme_cairo_update_border_extents; |
766 | 856 | 1069 | ||
767 | === modified file 'gtk/window-decorator/gwd-theme-metacity.c' | |||
768 | --- gtk/window-decorator/gwd-theme-metacity.c 2016-06-09 14:58:49 +0000 | |||
769 | +++ gtk/window-decorator/gwd-theme-metacity.c 2016-06-09 14:58:49 +0000 | |||
770 | @@ -572,14 +572,14 @@ | |||
771 | 572 | } | 572 | } |
772 | 573 | 573 | ||
773 | 574 | static void | 574 | static void |
782 | 575 | decor_update_meta_window_property (decor_t *d, | 575 | decor_update_meta_window_property (GWDThemeMetacity *metacity, |
783 | 576 | MetaTheme *theme, | 576 | decor_t *d, |
784 | 577 | MetaFrameFlags flags, | 577 | MetaFrameFlags flags, |
785 | 578 | MetaFrameType type, | 578 | MetaFrameType type, |
786 | 579 | Region top, | 579 | Region top, |
787 | 580 | Region bottom, | 580 | Region bottom, |
788 | 581 | Region left, | 581 | Region left, |
789 | 582 | Region right) | 582 | Region right) |
790 | 583 | { | 583 | { |
791 | 584 | long *data; | 584 | long *data; |
792 | 585 | GdkDisplay *display; | 585 | GdkDisplay *display; |
793 | @@ -616,11 +616,13 @@ | |||
794 | 616 | 616 | ||
795 | 617 | /* Add the invisible grab area padding */ | 617 | /* Add the invisible grab area padding */ |
796 | 618 | { | 618 | { |
798 | 619 | GdkScreen *screen = gtk_widget_get_screen (d->frame->style_window_rgba); | 619 | GWDTheme *theme = GWD_THEME (metacity); |
799 | 620 | GtkWidget *style_window = gwd_theme_get_style_window (theme); | ||
800 | 621 | GdkScreen *screen = gtk_widget_get_screen (style_window); | ||
801 | 620 | MetaStyleInfo *style_info = meta_theme_create_style_info (screen, d->gtk_theme_variant); | 622 | MetaStyleInfo *style_info = meta_theme_create_style_info (screen, d->gtk_theme_variant); |
802 | 621 | MetaFrameBorders borders; | 623 | MetaFrameBorders borders; |
803 | 622 | 624 | ||
805 | 623 | meta_theme_get_frame_borders (theme, style_info, type, | 625 | meta_theme_get_frame_borders (metacity->theme, style_info, type, |
806 | 624 | d->frame->text_height, | 626 | d->frame->text_height, |
807 | 625 | flags, &borders); | 627 | flags, &borders); |
808 | 626 | 628 | ||
809 | @@ -696,7 +698,9 @@ | |||
810 | 696 | MetaFrameGeometry *fgeom, | 698 | MetaFrameGeometry *fgeom, |
811 | 697 | MetaFrameType frame_type) | 699 | MetaFrameType frame_type) |
812 | 698 | { | 700 | { |
814 | 699 | GdkScreen *screen = gtk_widget_get_screen (decor->frame->style_window_rgba); | 701 | GWDTheme *theme = GWD_THEME (metacity); |
815 | 702 | GtkWidget *style_window = gwd_theme_get_style_window (theme); | ||
816 | 703 | GdkScreen *screen = gtk_widget_get_screen (style_window); | ||
817 | 700 | MetaStyleInfo *style_info = meta_theme_create_style_info (screen, decor->gtk_theme_variant); | 704 | MetaStyleInfo *style_info = meta_theme_create_style_info (screen, decor->gtk_theme_variant); |
818 | 701 | gint client_width; | 705 | gint client_width; |
819 | 702 | gint client_height; | 706 | gint client_height; |
820 | @@ -936,6 +940,11 @@ | |||
821 | 936 | } | 940 | } |
822 | 937 | 941 | ||
823 | 938 | static void | 942 | static void |
824 | 943 | gwd_theme_metacity_style_updated (GWDTheme *theme) | ||
825 | 944 | { | ||
826 | 945 | } | ||
827 | 946 | |||
828 | 947 | static void | ||
829 | 939 | gwd_theme_metacity_draw_window_decoration (GWDTheme *theme, | 948 | gwd_theme_metacity_draw_window_decoration (GWDTheme *theme, |
830 | 940 | decor_t *decor) | 949 | decor_t *decor) |
831 | 941 | { | 950 | { |
832 | @@ -943,9 +952,9 @@ | |||
833 | 943 | GWDSettings *settings = gwd_theme_get_settings (gwd_theme); | 952 | GWDSettings *settings = gwd_theme_get_settings (gwd_theme); |
834 | 944 | GdkDisplay *display = gdk_display_get_default (); | 953 | GdkDisplay *display = gdk_display_get_default (); |
835 | 945 | Display *xdisplay = gdk_x11_display_get_xdisplay (display); | 954 | Display *xdisplay = gdk_x11_display_get_xdisplay (display); |
837 | 946 | GdkScreen *screen = gtk_widget_get_screen (decor->frame->style_window_rgba); | 955 | GtkWidget *style_window = gwd_theme_get_style_window (theme); |
838 | 956 | GdkScreen *screen = gtk_widget_get_screen (style_window); | ||
839 | 947 | MetaStyleInfo *style_info = meta_theme_create_style_info (screen, decor->gtk_theme_variant); | 957 | MetaStyleInfo *style_info = meta_theme_create_style_info (screen, decor->gtk_theme_variant); |
840 | 948 | GtkWidget *style_window = decor->frame->style_window_rgba; | ||
841 | 949 | GtkStyleContext *context = gtk_widget_get_style_context (style_window); | 958 | GtkStyleContext *context = gtk_widget_get_style_context (style_window); |
842 | 950 | cairo_surface_t *surface; | 959 | cairo_surface_t *surface; |
843 | 951 | Picture src; | 960 | Picture src; |
844 | @@ -1018,7 +1027,7 @@ | |||
845 | 1018 | 1027 | ||
846 | 1019 | cairo_destroy (cr); | 1028 | cairo_destroy (cr); |
847 | 1020 | 1029 | ||
849 | 1021 | surface = create_surface (fgeom.width, fgeom.height, decor->frame->style_window_rgba); | 1030 | surface = create_surface (fgeom.width, fgeom.height, style_window); |
850 | 1022 | 1031 | ||
851 | 1023 | cr = cairo_create (surface); | 1032 | cr = cairo_create (surface); |
852 | 1024 | 1033 | ||
853 | @@ -1096,8 +1105,7 @@ | |||
854 | 1096 | if (left_region) | 1105 | if (left_region) |
855 | 1097 | XOffsetRegion (left_region, -fgeom.borders.total.left, 0); | 1106 | XOffsetRegion (left_region, -fgeom.borders.total.left, 0); |
856 | 1098 | 1107 | ||
859 | 1099 | decor_update_meta_window_property (decor, metacity->theme, flags, | 1108 | decor_update_meta_window_property (metacity, decor, flags, frame_type, |
858 | 1100 | frame_type, | ||
860 | 1101 | top_region, bottom_region, | 1109 | top_region, bottom_region, |
861 | 1102 | left_region, right_region); | 1110 | left_region, right_region); |
862 | 1103 | 1111 | ||
863 | @@ -1172,7 +1180,8 @@ | |||
864 | 1172 | decor_frame_t *frame) | 1180 | decor_frame_t *frame) |
865 | 1173 | { | 1181 | { |
866 | 1174 | GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme); | 1182 | GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme); |
868 | 1175 | GdkScreen *screen = gtk_widget_get_screen (frame->style_window_rgba); | 1183 | GtkWidget *style_window = gwd_theme_get_style_window (theme); |
869 | 1184 | GdkScreen *screen = gtk_widget_get_screen (style_window); | ||
870 | 1176 | MetaStyleInfo *style_info = meta_theme_create_style_info (screen, NULL); | 1185 | MetaStyleInfo *style_info = meta_theme_create_style_info (screen, NULL); |
871 | 1177 | MetaFrameType frame_type = frame_type_from_string (frame->type); | 1186 | MetaFrameType frame_type = frame_type_from_string (frame->type); |
872 | 1178 | MetaFrameBorders borders; | 1187 | MetaFrameBorders borders; |
873 | @@ -1414,7 +1423,8 @@ | |||
874 | 1414 | decor_frame_t *frame) | 1423 | decor_frame_t *frame) |
875 | 1415 | { | 1424 | { |
876 | 1416 | GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme); | 1425 | GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme); |
878 | 1417 | GdkScreen *screen = gtk_widget_get_screen (frame->style_window_rgba); | 1426 | GtkWidget *style_window = gwd_theme_get_style_window (theme); |
879 | 1427 | GdkScreen *screen = gtk_widget_get_screen (style_window); | ||
880 | 1418 | MetaStyleInfo *style_info = meta_theme_create_style_info (screen, NULL); | 1428 | MetaStyleInfo *style_info = meta_theme_create_style_info (screen, NULL); |
881 | 1419 | PangoFontDescription *font_desc = meta_style_info_create_font_desc (style_info); | 1429 | PangoFontDescription *font_desc = meta_style_info_create_font_desc (style_info); |
882 | 1420 | MetaFrameType type = frame_type_from_string (frame->type); | 1430 | MetaFrameType type = frame_type_from_string (frame->type); |
883 | @@ -1436,6 +1446,7 @@ | |||
884 | 1436 | object_class->constructed = gwd_theme_metacity_constructed; | 1446 | object_class->constructed = gwd_theme_metacity_constructed; |
885 | 1437 | object_class->dispose = gwd_theme_metacity_dispose; | 1447 | object_class->dispose = gwd_theme_metacity_dispose; |
886 | 1438 | 1448 | ||
887 | 1449 | theme_class->style_updated = gwd_theme_metacity_style_updated; | ||
888 | 1439 | theme_class->draw_window_decoration = gwd_theme_metacity_draw_window_decoration; | 1450 | theme_class->draw_window_decoration = gwd_theme_metacity_draw_window_decoration; |
889 | 1440 | theme_class->calc_decoration_size = gwd_theme_metacity_calc_decoration_size; | 1451 | theme_class->calc_decoration_size = gwd_theme_metacity_calc_decoration_size; |
890 | 1441 | theme_class->update_border_extents = gwd_theme_metacity_update_border_extents; | 1452 | theme_class->update_border_extents = gwd_theme_metacity_update_border_extents; |
891 | 1442 | 1453 | ||
892 | === modified file 'gtk/window-decorator/gwd-theme.c' | |||
893 | --- gtk/window-decorator/gwd-theme.c 2016-06-09 14:58:49 +0000 | |||
894 | +++ gtk/window-decorator/gwd-theme.c 2016-06-09 14:58:49 +0000 | |||
895 | @@ -32,6 +32,8 @@ | |||
896 | 32 | GWDSettings *settings; | 32 | GWDSettings *settings; |
897 | 33 | 33 | ||
898 | 34 | PangoFontDescription *titlebar_font; | 34 | PangoFontDescription *titlebar_font; |
899 | 35 | |||
900 | 36 | GtkWidget *style_window; | ||
901 | 35 | } GWDThemePrivate; | 37 | } GWDThemePrivate; |
902 | 36 | 38 | ||
903 | 37 | enum | 39 | enum |
904 | @@ -48,6 +50,59 @@ | |||
905 | 48 | G_DEFINE_TYPE_WITH_PRIVATE (GWDTheme, gwd_theme, G_TYPE_OBJECT) | 50 | G_DEFINE_TYPE_WITH_PRIVATE (GWDTheme, gwd_theme, G_TYPE_OBJECT) |
906 | 49 | 51 | ||
907 | 50 | static void | 52 | static void |
908 | 53 | frames_update_pango_contexts (gpointer key, | ||
909 | 54 | gpointer value, | ||
910 | 55 | gpointer user_data) | ||
911 | 56 | { | ||
912 | 57 | decor_frame_t *frame = (decor_frame_t *) value; | ||
913 | 58 | GdkDisplay *display = gdk_display_get_default (); | ||
914 | 59 | GdkScreen *screen = gdk_display_get_default_screen (display); | ||
915 | 60 | gdouble dpi = gdk_screen_get_resolution (screen); | ||
916 | 61 | |||
917 | 62 | if (frame->pango_context == NULL) | ||
918 | 63 | return; | ||
919 | 64 | |||
920 | 65 | /* FIXME: PangoContext created by gtk_widget_create_pango_context is not | ||
921 | 66 | * automatically updated. Resolution is not only thing that can change... | ||
922 | 67 | */ | ||
923 | 68 | pango_cairo_context_set_resolution (frame->pango_context, dpi); | ||
924 | 69 | } | ||
925 | 70 | |||
926 | 71 | static void | ||
927 | 72 | style_updated_cb (GtkWidget *widget, | ||
928 | 73 | GWDTheme *theme) | ||
929 | 74 | { | ||
930 | 75 | gwd_frames_foreach (frames_update_pango_contexts, NULL); | ||
931 | 76 | |||
932 | 77 | GWD_THEME_GET_CLASS (theme)->style_updated (theme); | ||
933 | 78 | |||
934 | 79 | decorations_changed (wnck_screen_get_default ()); | ||
935 | 80 | } | ||
936 | 81 | |||
937 | 82 | static void | ||
938 | 83 | create_style_window (GWDTheme *theme) | ||
939 | 84 | { | ||
940 | 85 | GWDThemePrivate *priv = gwd_theme_get_instance_private (theme); | ||
941 | 86 | GdkScreen *screen = gdk_screen_get_default (); | ||
942 | 87 | GdkVisual *visual = gdk_screen_get_rgba_visual (screen); | ||
943 | 88 | GtkWindow *window; | ||
944 | 89 | |||
945 | 90 | priv->style_window = gtk_window_new (GTK_WINDOW_POPUP); | ||
946 | 91 | window = GTK_WINDOW (priv->style_window); | ||
947 | 92 | |||
948 | 93 | if (visual) | ||
949 | 94 | gtk_widget_set_visual (priv->style_window, visual); | ||
950 | 95 | |||
951 | 96 | gtk_window_move (window, -100, -100); | ||
952 | 97 | gtk_window_resize (window, 1, 1); | ||
953 | 98 | |||
954 | 99 | gtk_widget_show (priv->style_window); | ||
955 | 100 | |||
956 | 101 | g_signal_connect (priv->style_window, "style-updated", | ||
957 | 102 | G_CALLBACK (style_updated_cb), theme); | ||
958 | 103 | } | ||
959 | 104 | |||
960 | 105 | static void | ||
961 | 51 | gwd_theme_constructed (GObject *object) | 106 | gwd_theme_constructed (GObject *object) |
962 | 52 | { | 107 | { |
963 | 53 | GWDTheme *theme = GWD_THEME (object); | 108 | GWDTheme *theme = GWD_THEME (object); |
964 | @@ -55,6 +110,7 @@ | |||
965 | 55 | G_OBJECT_CLASS (gwd_theme_parent_class)->constructed (object); | 110 | G_OBJECT_CLASS (gwd_theme_parent_class)->constructed (object); |
966 | 56 | 111 | ||
967 | 57 | gwd_theme_update_titlebar_font (theme); | 112 | gwd_theme_update_titlebar_font (theme); |
968 | 113 | create_style_window (theme); | ||
969 | 58 | } | 114 | } |
970 | 59 | 115 | ||
971 | 60 | static void | 116 | static void |
972 | @@ -68,6 +124,8 @@ | |||
973 | 68 | pango_font_description_free (priv->titlebar_font); | 124 | pango_font_description_free (priv->titlebar_font); |
974 | 69 | priv->titlebar_font = NULL; | 125 | priv->titlebar_font = NULL; |
975 | 70 | 126 | ||
976 | 127 | g_clear_pointer (&priv->style_window, gtk_widget_destroy); | ||
977 | 128 | |||
978 | 71 | G_OBJECT_CLASS (gwd_theme_parent_class)->dispose (object); | 129 | G_OBJECT_CLASS (gwd_theme_parent_class)->dispose (object); |
979 | 72 | } | 130 | } |
980 | 73 | 131 | ||
981 | @@ -112,6 +170,11 @@ | |||
982 | 112 | } | 170 | } |
983 | 113 | 171 | ||
984 | 114 | static void | 172 | static void |
985 | 173 | gwd_theme_real_style_updated (GWDTheme *theme) | ||
986 | 174 | { | ||
987 | 175 | } | ||
988 | 176 | |||
989 | 177 | static void | ||
990 | 115 | gwd_theme_real_get_shadow (GWDTheme *theme, | 178 | gwd_theme_real_get_shadow (GWDTheme *theme, |
991 | 116 | decor_frame_t *frame, | 179 | decor_frame_t *frame, |
992 | 117 | decor_shadow_options_t *options, | 180 | decor_shadow_options_t *options, |
993 | @@ -205,6 +268,7 @@ | |||
994 | 205 | object_class->get_property = gwd_theme_get_property; | 268 | object_class->get_property = gwd_theme_get_property; |
995 | 206 | object_class->set_property = gwd_theme_set_property; | 269 | object_class->set_property = gwd_theme_set_property; |
996 | 207 | 270 | ||
997 | 271 | theme_class->style_updated = gwd_theme_real_style_updated; | ||
998 | 208 | theme_class->get_shadow = gwd_theme_real_get_shadow; | 272 | theme_class->get_shadow = gwd_theme_real_get_shadow; |
999 | 209 | theme_class->draw_window_decoration = gwd_theme_real_draw_window_decoration; | 273 | theme_class->draw_window_decoration = gwd_theme_real_draw_window_decoration; |
1000 | 210 | theme_class->calc_decoration_size = gwd_theme_real_calc_decoration_size; | 274 | theme_class->calc_decoration_size = gwd_theme_real_calc_decoration_size; |
1001 | @@ -269,6 +333,14 @@ | |||
1002 | 269 | return priv->settings; | 333 | return priv->settings; |
1003 | 270 | } | 334 | } |
1004 | 271 | 335 | ||
1005 | 336 | GtkWidget * | ||
1006 | 337 | gwd_theme_get_style_window (GWDTheme *theme) | ||
1007 | 338 | { | ||
1008 | 339 | GWDThemePrivate *priv = gwd_theme_get_instance_private (theme); | ||
1009 | 340 | |||
1010 | 341 | return priv->style_window; | ||
1011 | 342 | } | ||
1012 | 343 | |||
1013 | 272 | void | 344 | void |
1014 | 273 | gwd_theme_get_shadow (GWDTheme *theme, | 345 | gwd_theme_get_shadow (GWDTheme *theme, |
1015 | 274 | decor_frame_t *frame, | 346 | decor_frame_t *frame, |
1016 | @@ -360,7 +432,7 @@ | |||
1017 | 360 | { | 432 | { |
1018 | 361 | PangoFontDescription *font_desc = NULL; | 433 | PangoFontDescription *font_desc = NULL; |
1019 | 362 | GWDThemePrivate *priv = gwd_theme_get_instance_private (theme); | 434 | GWDThemePrivate *priv = gwd_theme_get_instance_private (theme); |
1021 | 363 | GtkStyleContext *context = gtk_widget_get_style_context (frame->style_window_rgba); | 435 | GtkStyleContext *context = gtk_widget_get_style_context (priv->style_window); |
1022 | 364 | 436 | ||
1023 | 365 | /* Check if Metacity or Cairo will create titlebar font */ | 437 | /* Check if Metacity or Cairo will create titlebar font */ |
1024 | 366 | font_desc = GWD_THEME_GET_CLASS (theme)->get_titlebar_font (theme, frame); | 438 | font_desc = GWD_THEME_GET_CLASS (theme)->get_titlebar_font (theme, frame); |
1025 | 367 | 439 | ||
1026 | === modified file 'gtk/window-decorator/gwd-theme.h' | |||
1027 | --- gtk/window-decorator/gwd-theme.h 2016-06-09 14:58:49 +0000 | |||
1028 | +++ gtk/window-decorator/gwd-theme.h 2016-06-09 14:58:49 +0000 | |||
1029 | @@ -22,7 +22,7 @@ | |||
1030 | 22 | 22 | ||
1031 | 23 | #include <decoration.h> | 23 | #include <decoration.h> |
1032 | 24 | #include <glib-object.h> | 24 | #include <glib-object.h> |
1034 | 25 | #include <pango/pango.h> | 25 | #include <gtk/gtk.h> |
1035 | 26 | 26 | ||
1036 | 27 | G_BEGIN_DECLS | 27 | G_BEGIN_DECLS |
1037 | 28 | 28 | ||
1038 | @@ -37,6 +37,8 @@ | |||
1039 | 37 | { | 37 | { |
1040 | 38 | GObjectClass parent_class; | 38 | GObjectClass parent_class; |
1041 | 39 | 39 | ||
1042 | 40 | void (* style_updated) (GWDTheme *theme); | ||
1043 | 41 | |||
1044 | 40 | void (* get_shadow) (GWDTheme *theme, | 42 | void (* get_shadow) (GWDTheme *theme, |
1045 | 41 | decor_frame_t *frame, | 43 | decor_frame_t *frame, |
1046 | 42 | decor_shadow_options_t *options, | 44 | decor_shadow_options_t *options, |
1047 | @@ -97,6 +99,9 @@ | |||
1048 | 97 | GWDSettings * | 99 | GWDSettings * |
1049 | 98 | gwd_theme_get_settings (GWDTheme *theme); | 100 | gwd_theme_get_settings (GWDTheme *theme); |
1050 | 99 | 101 | ||
1051 | 102 | GtkWidget * | ||
1052 | 103 | gwd_theme_get_style_window (GWDTheme *theme); | ||
1053 | 104 | |||
1054 | 100 | void | 105 | void |
1055 | 101 | gwd_theme_get_shadow (GWDTheme *theme, | 106 | gwd_theme_get_shadow (GWDTheme *theme, |
1056 | 102 | decor_frame_t *frame, | 107 | decor_frame_t *frame, |
1057 | 103 | 108 | ||
1058 | === modified file 'gtk/window-decorator/switcher.c' | |||
1059 | --- gtk/window-decorator/switcher.c 2016-06-09 14:58:49 +0000 | |||
1060 | +++ gtk/window-decorator/switcher.c 2016-06-09 14:58:49 +0000 | |||
1061 | @@ -30,18 +30,20 @@ | |||
1062 | 30 | static void | 30 | static void |
1063 | 31 | decor_update_switcher_property (decor_t *d) | 31 | decor_update_switcher_property (decor_t *d) |
1064 | 32 | { | 32 | { |
1065 | 33 | GdkDisplay *display = gdk_display_get_default (); | ||
1066 | 34 | Display *xdisplay = gdk_x11_display_get_xdisplay (display); | ||
1067 | 35 | GtkWidget *style_window = gwd_theme_get_style_window (gwd_theme); | ||
1068 | 36 | GtkStyleContext *context = gtk_widget_get_style_context (style_window); | ||
1069 | 33 | long *data; | 37 | long *data; |
1070 | 34 | Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); | ||
1071 | 35 | gint nQuad; | 38 | gint nQuad; |
1072 | 36 | decor_quad_t quads[N_QUADS_MAX]; | 39 | decor_quad_t quads[N_QUADS_MAX]; |
1073 | 37 | unsigned int nOffset = 1; | 40 | unsigned int nOffset = 1; |
1074 | 38 | unsigned int frame_type = populate_frame_type (d); | 41 | unsigned int frame_type = populate_frame_type (d); |
1075 | 39 | unsigned int frame_state = populate_frame_state (d); | 42 | unsigned int frame_state = populate_frame_state (d); |
1076 | 40 | unsigned int frame_actions = populate_frame_actions (d); | 43 | unsigned int frame_actions = populate_frame_actions (d); |
1077 | 41 | GtkStyleContext *context; | ||
1078 | 42 | GdkRGBA fg; | 44 | GdkRGBA fg; |
1079 | 43 | long fgColor[4]; | 45 | long fgColor[4]; |
1081 | 44 | 46 | ||
1082 | 45 | nQuad = decor_set_lSrStSbX_window_quads (quads, &d->frame->window_context_active, | 47 | nQuad = decor_set_lSrStSbX_window_quads (quads, &d->frame->window_context_active, |
1083 | 46 | &d->border_layout, | 48 | &d->border_layout, |
1084 | 47 | d->border_layout.top.x2 - | 49 | d->border_layout.top.x2 - |
1085 | @@ -56,8 +58,6 @@ | |||
1086 | 56 | &d->frame->win_extents, &d->frame->win_extents, | 58 | &d->frame->win_extents, &d->frame->win_extents, |
1087 | 57 | 0, 0, quads, nQuad, frame_type, frame_state, frame_actions); | 59 | 0, 0, quads, nQuad, frame_type, frame_state, frame_actions); |
1088 | 58 | 60 | ||
1089 | 59 | context = gtk_widget_get_style_context (d->frame->style_window_rgba); | ||
1090 | 60 | |||
1091 | 61 | gtk_style_context_save (context); | 61 | gtk_style_context_save (context); |
1092 | 62 | gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); | 62 | gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); |
1093 | 63 | gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg); | 63 | gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg); |
1094 | @@ -112,7 +112,6 @@ | |||
1095 | 112 | switcher_label = gtk_label_new (""); | 112 | switcher_label = gtk_label_new (""); |
1096 | 113 | switcher_label_obj = gtk_widget_get_accessible (switcher_label); | 113 | switcher_label_obj = gtk_widget_get_accessible (switcher_label); |
1097 | 114 | atk_object_set_role (switcher_label_obj, ATK_ROLE_STATUSBAR); | 114 | atk_object_set_role (switcher_label_obj, ATK_ROLE_STATUSBAR); |
1098 | 115 | gtk_container_add (GTK_CONTAINER (frame->style_window_rgba), switcher_label); | ||
1099 | 116 | 115 | ||
1100 | 117 | return frame; | 116 | return frame; |
1101 | 118 | } | 117 | } |
1102 | @@ -127,9 +126,11 @@ | |||
1103 | 127 | static void | 126 | static void |
1104 | 128 | draw_switcher_background (decor_t *d) | 127 | draw_switcher_background (decor_t *d) |
1105 | 129 | { | 128 | { |
1107 | 130 | Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); | 129 | GdkDisplay *display = gdk_display_get_default (); |
1108 | 130 | Display *xdisplay = gdk_x11_display_get_xdisplay (display); | ||
1109 | 131 | GtkWidget *style_window = gwd_theme_get_style_window (gwd_theme); | ||
1110 | 132 | GtkStyleContext *context = gtk_widget_get_style_context (style_window); | ||
1111 | 131 | cairo_t *cr; | 133 | cairo_t *cr; |
1112 | 132 | GtkStyleContext *context; | ||
1113 | 133 | GdkRGBA bg, fg; | 134 | GdkRGBA bg, fg; |
1114 | 134 | decor_color_t color; | 135 | decor_color_t color; |
1115 | 135 | double alpha = SWITCHER_ALPHA / 65535.0; | 136 | double alpha = SWITCHER_ALPHA / 65535.0; |
1116 | @@ -141,8 +142,6 @@ | |||
1117 | 141 | if (!d->buffer_surface) | 142 | if (!d->buffer_surface) |
1118 | 142 | return; | 143 | return; |
1119 | 143 | 144 | ||
1120 | 144 | context = gtk_widget_get_style_context (d->frame->style_window_rgba); | ||
1121 | 145 | |||
1122 | 146 | gtk_style_context_save (context); | 145 | gtk_style_context_save (context); |
1123 | 147 | gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); | 146 | gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); |
1124 | 148 | gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg); | 147 | gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg); |
1125 | @@ -329,16 +328,15 @@ | |||
1126 | 329 | static void | 328 | static void |
1127 | 330 | draw_switcher_foreground (decor_t *d) | 329 | draw_switcher_foreground (decor_t *d) |
1128 | 331 | { | 330 | { |
1131 | 332 | cairo_t *cr; | 331 | GtkWidget *style_window = gwd_theme_get_style_window (gwd_theme); |
1132 | 333 | GtkStyleContext *context; | 332 | GtkStyleContext *context = gtk_widget_get_style_context (style_window); |
1133 | 333 | cairo_t *cr; | ||
1134 | 334 | GdkRGBA bg, fg; | 334 | GdkRGBA bg, fg; |
1135 | 335 | double alpha = SWITCHER_ALPHA / 65535.0; | 335 | double alpha = SWITCHER_ALPHA / 65535.0; |
1136 | 336 | 336 | ||
1137 | 337 | if (!d->surface || !d->buffer_surface) | 337 | if (!d->surface || !d->buffer_surface) |
1138 | 338 | return; | 338 | return; |
1139 | 339 | 339 | ||
1140 | 340 | context = gtk_widget_get_style_context (d->frame->style_window_rgba); | ||
1141 | 341 | |||
1142 | 342 | gtk_style_context_save (context); | 340 | gtk_style_context_save (context); |
1143 | 343 | gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); | 341 | gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); |
1144 | 344 | gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg); | 342 | gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg); |
1145 | @@ -436,24 +434,23 @@ | |||
1146 | 436 | return d; | 434 | return d; |
1147 | 437 | } | 435 | } |
1148 | 438 | 436 | ||
1149 | 439 | |||
1150 | 440 | gboolean | 437 | gboolean |
1151 | 441 | update_switcher_window (Window popup, | 438 | update_switcher_window (Window popup, |
1152 | 442 | Window selected) | 439 | Window selected) |
1153 | 443 | { | 440 | { |
1154 | 441 | GdkDisplay *display = gdk_display_get_default (); | ||
1155 | 442 | Display *xdisplay = gdk_x11_display_get_xdisplay (display); | ||
1156 | 443 | GtkWidget *style_window = gwd_theme_get_style_window (gwd_theme); | ||
1157 | 444 | decor_t *d = switcher_window; | 444 | decor_t *d = switcher_window; |
1158 | 445 | cairo_surface_t *surface, *buffer_surface = NULL; | 445 | cairo_surface_t *surface, *buffer_surface = NULL; |
1159 | 446 | unsigned int height, width = 0, border, depth; | 446 | unsigned int height, width = 0, border, depth; |
1160 | 447 | int x, y; | 447 | int x, y; |
1161 | 448 | Window root_return; | 448 | Window root_return; |
1162 | 449 | WnckWindow *selected_win; | 449 | WnckWindow *selected_win; |
1163 | 450 | Display *xdisplay; | ||
1164 | 451 | 450 | ||
1165 | 452 | if (!d) | 451 | if (!d) |
1166 | 453 | d = switcher_window_opened (popup, selected); | 452 | d = switcher_window_opened (popup, selected); |
1167 | 454 | 453 | ||
1168 | 455 | xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); | ||
1169 | 456 | |||
1170 | 457 | /* FIXME: Thats a round-trip */ | 454 | /* FIXME: Thats a round-trip */ |
1171 | 458 | XGetGeometry (gdk_x11_get_default_xdisplay (), popup, &root_return, | 455 | XGetGeometry (gdk_x11_get_default_xdisplay (), popup, &root_return, |
1172 | 459 | &x, &y, &width, &height, &border, &depth); | 456 | &x, &y, &width, &height, &border, &depth); |
1173 | @@ -486,8 +483,8 @@ | |||
1174 | 486 | if (!d->layout) | 483 | if (!d->layout) |
1175 | 487 | { | 484 | { |
1176 | 488 | d->layout = pango_layout_new (d->frame->pango_context); | 485 | d->layout = pango_layout_new (d->frame->pango_context); |
1179 | 489 | if (d->layout) | 486 | |
1180 | 490 | pango_layout_set_wrap (d->layout, PANGO_WRAP_CHAR); | 487 | pango_layout_set_wrap (d->layout, PANGO_WRAP_CHAR); |
1181 | 491 | } | 488 | } |
1182 | 492 | 489 | ||
1183 | 493 | if (d->layout) | 490 | if (d->layout) |
1184 | @@ -538,11 +535,11 @@ | |||
1185 | 538 | switcher_selected_window = selected; | 535 | switcher_selected_window = selected; |
1186 | 539 | } | 536 | } |
1187 | 540 | 537 | ||
1189 | 541 | surface = create_native_surface_and_wrap (width, height, d->frame->style_window_rgba); | 538 | surface = create_native_surface_and_wrap (width, height, style_window); |
1190 | 542 | if (!surface) | 539 | if (!surface) |
1191 | 543 | return FALSE; | 540 | return FALSE; |
1192 | 544 | 541 | ||
1194 | 545 | buffer_surface = create_surface (width, height, d->frame->style_window_rgba); | 542 | buffer_surface = create_surface (width, height, style_window); |
1195 | 546 | if (!buffer_surface) | 543 | if (!buffer_surface) |
1196 | 547 | { | 544 | { |
1197 | 548 | cairo_surface_destroy (surface); | 545 | cairo_surface_destroy (surface); |
1198 | 549 | 546 | ||
1199 | === modified file 'gtk/window-decorator/wnck.c' | |||
1200 | --- gtk/window-decorator/wnck.c 2016-06-09 14:58:49 +0000 | |||
1201 | +++ gtk/window-decorator/wnck.c 2016-06-09 14:58:49 +0000 | |||
1202 | @@ -170,6 +170,16 @@ | |||
1203 | 170 | } | 170 | } |
1204 | 171 | 171 | ||
1205 | 172 | static void | 172 | static void |
1206 | 173 | update_frames_titlebar_fonts (gpointer key, | ||
1207 | 174 | gpointer value, | ||
1208 | 175 | gpointer user_data) | ||
1209 | 176 | { | ||
1210 | 177 | decor_frame_t *frame = (decor_frame_t *) value; | ||
1211 | 178 | |||
1212 | 179 | frame_update_titlebar_font (frame); | ||
1213 | 180 | } | ||
1214 | 181 | |||
1215 | 182 | static void | ||
1216 | 173 | update_frames_border_extents (gpointer key, | 183 | update_frames_border_extents (gpointer key, |
1217 | 174 | gpointer value, | 184 | gpointer value, |
1218 | 175 | gpointer user_data) | 185 | gpointer user_data) |
Fine. Good a try to an offscreenwindow once you've time.