Merge lp:~muktupavels/compiz/gwd-theme-implement-calc-decoration-size into lp:compiz/0.9.12
- gwd-theme-implement-calc-decoration-size
- Merge into 0.9.12
Proposed by
Alberts Muktupāvels
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | 4034 |
Merged at revision: | 4032 |
Proposed branch: | lp:~muktupavels/compiz/gwd-theme-implement-calc-decoration-size |
Merge into: | lp:compiz/0.9.12 |
Prerequisite: | lp:~muktupavels/compiz/gwd-theme-implement-get-event-window-position |
Diff against target: |
655 lines (+239/-290) 7 files modified
gtk/window-decorator/cairo.c (+0/-112) gtk/window-decorator/decorator.c (+1/-1) gtk/window-decorator/gtk-window-decorator.c (+0/-3) gtk/window-decorator/gtk-window-decorator.h (+0/-22) gtk/window-decorator/gwd-theme-cairo.c (+105/-0) gtk/window-decorator/gwd-theme-metacity.c (+133/-0) gtk/window-decorator/metacity.c (+0/-152) |
To merge this branch: | bzr merge lp:~muktupavels/compiz/gwd-theme-implement-calc-decoration-size |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sam Spilsbury | Approve | ||
Review via email:
|
Commit message
GWDTheme: implement calc_decoration
Description of the change
GWDTheme: implement calc_decoration
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'gtk/window-decorator/cairo.c' |
2 | --- gtk/window-decorator/cairo.c 2016-05-20 11:20:59 +0000 |
3 | +++ gtk/window-decorator/cairo.c 2016-05-20 11:21:00 +0000 |
4 | @@ -710,115 +710,3 @@ |
5 | d->prop_xid = 0; |
6 | } |
7 | } |
8 | - |
9 | -static void |
10 | -calc_button_size (decor_t *d) |
11 | -{ |
12 | - gint button_width = 0; |
13 | - |
14 | - if (d->actions & WNCK_WINDOW_ACTION_CLOSE) |
15 | - button_width += 17; |
16 | - |
17 | - if (d->actions & (WNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY | |
18 | - WNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY | |
19 | - WNCK_WINDOW_ACTION_UNMAXIMIZE_HORIZONTALLY | |
20 | - WNCK_WINDOW_ACTION_UNMAXIMIZE_VERTICALLY)) |
21 | - button_width += 17; |
22 | - |
23 | - if (d->actions & WNCK_WINDOW_ACTION_MINIMIZE) |
24 | - button_width += 17; |
25 | - |
26 | - if (button_width) |
27 | - ++button_width; |
28 | - |
29 | - d->button_width = button_width; |
30 | -} |
31 | - |
32 | -gboolean |
33 | -calc_decoration_size (decor_t *d, |
34 | - gint w, |
35 | - gint h, |
36 | - gint name_width, |
37 | - gint *width, |
38 | - gint *height) |
39 | -{ |
40 | - decor_layout_t layout; |
41 | - int top_width; |
42 | - |
43 | - if (!d->decorated) |
44 | - return FALSE; |
45 | - |
46 | - /* To avoid wasting texture memory, we only calculate the minimal |
47 | - * required decoration size then clip and stretch the texture where |
48 | - * appropriate |
49 | - */ |
50 | - |
51 | - if (!d->frame_window) |
52 | - { |
53 | - calc_button_size (d); |
54 | - |
55 | - if (w < ICON_SPACE + d->button_width) |
56 | - return FALSE; |
57 | - |
58 | - top_width = name_width + d->button_width + ICON_SPACE; |
59 | - if (w < top_width) |
60 | - top_width = MAX (ICON_SPACE + d->button_width, w); |
61 | - |
62 | - if (d->active) |
63 | - decor_get_default_layout (&d->frame->window_context_active, top_width, 1, &layout); |
64 | - else |
65 | - decor_get_default_layout (&d->frame->window_context_inactive, top_width, 1, &layout); |
66 | - |
67 | - if (!d->context || memcmp (&layout, &d->border_layout, sizeof (layout))) |
68 | - { |
69 | - *width = layout.width; |
70 | - *height = layout.height; |
71 | - |
72 | - d->border_layout = layout; |
73 | - if (d->active) |
74 | - { |
75 | - d->context = &d->frame->window_context_active; |
76 | - d->shadow = d->frame->border_shadow_active; |
77 | - } |
78 | - else |
79 | - { |
80 | - d->context = &d->frame->window_context_inactive; |
81 | - d->shadow = d->frame->border_shadow_inactive; |
82 | - } |
83 | - |
84 | - return TRUE; |
85 | - } |
86 | - } |
87 | - else |
88 | - { |
89 | - calc_button_size (d); |
90 | - |
91 | - /* _default_win_extents + top height */ |
92 | - |
93 | - top_width = name_width + d->button_width + ICON_SPACE; |
94 | - if (w < top_width) |
95 | - top_width = MAX (ICON_SPACE + d->button_width, w); |
96 | - |
97 | - decor_get_default_layout (&d->frame->window_context_no_shadow, |
98 | - d->client_width, d->client_height, &layout); |
99 | - |
100 | - *width = layout.width; |
101 | - *height = layout.height; |
102 | - |
103 | - d->border_layout = layout; |
104 | - if (d->active) |
105 | - { |
106 | - d->context = &d->frame->window_context_active; |
107 | - d->shadow = d->frame->border_shadow_active; |
108 | - } |
109 | - else |
110 | - { |
111 | - d->context = &d->frame->window_context_inactive; |
112 | - d->shadow = d->frame->border_shadow_inactive; |
113 | - } |
114 | - |
115 | - return TRUE; |
116 | - } |
117 | - |
118 | - return FALSE; |
119 | -} |
120 | |
121 | === modified file 'gtk/window-decorator/decorator.c' |
122 | --- gtk/window-decorator/decorator.c 2016-05-20 11:20:59 +0000 |
123 | +++ gtk/window-decorator/decorator.c 2016-05-20 11:21:00 +0000 |
124 | @@ -531,7 +531,7 @@ |
125 | |
126 | /* Ask the theme to tell us how much space it needs. If this is not successful |
127 | * update the decoration name and return false */ |
128 | - if (!(*theme_calc_decoration_size) (d, w, h, name_width, &width, &height)) |
129 | + if (!gwd_theme_calc_decoration_size (gwd_theme, d, w, h, name_width, &width, &height)) |
130 | { |
131 | update_window_decoration_name (win); |
132 | return FALSE; |
133 | |
134 | === modified file 'gtk/window-decorator/gtk-window-decorator.c' |
135 | --- gtk/window-decorator/gtk-window-decorator.c 2016-05-20 11:20:59 +0000 |
136 | +++ gtk/window-decorator/gtk-window-decorator.c 2016-05-20 11:21:00 +0000 |
137 | @@ -173,20 +173,17 @@ |
138 | type = GWD_THEME_TYPE_METACITY; |
139 | |
140 | theme_draw_window_decoration = meta_draw_window_decoration; |
141 | - theme_calc_decoration_size = meta_calc_decoration_size; |
142 | } else { |
143 | g_log ("gtk-window-decorator", G_LOG_LEVEL_INFO, "using cairo decoration"); |
144 | |
145 | type = GWD_THEME_TYPE_CAIRO; |
146 | |
147 | theme_draw_window_decoration = draw_window_decoration; |
148 | - theme_calc_decoration_size = calc_decoration_size; |
149 | } |
150 | #else |
151 | type = GWD_THEME_TYPE_CAIRO; |
152 | |
153 | theme_draw_window_decoration = draw_window_decoration; |
154 | - theme_calc_decoration_size = calc_decoration_size; |
155 | #endif |
156 | |
157 | g_set_object (&gwd_theme, gwd_theme_new (type, settings)); |
158 | |
159 | === modified file 'gtk/window-decorator/gtk-window-decorator.h' |
160 | --- gtk/window-decorator/gtk-window-decorator.h 2016-05-20 11:20:59 +0000 |
161 | +++ gtk/window-decorator/gtk-window-decorator.h 2016-05-20 11:21:00 +0000 |
162 | @@ -309,12 +309,6 @@ |
163 | const gchar * window_type_frames[WINDOW_TYPE_FRAMES_NUM]; |
164 | |
165 | void (*theme_draw_window_decoration) (decor_t *d); |
166 | -gboolean (*theme_calc_decoration_size) (decor_t *d, |
167 | - int client_width, |
168 | - int client_height, |
169 | - int text_width, |
170 | - int *width, |
171 | - int *height); |
172 | |
173 | extern char *program_name; |
174 | |
175 | @@ -538,14 +532,6 @@ |
176 | double radius, |
177 | int corner); |
178 | |
179 | -gboolean |
180 | -calc_decoration_size (decor_t *d, |
181 | - gint w, |
182 | - gint h, |
183 | - gint name_width, |
184 | - gint *width, |
185 | - gint *height); |
186 | - |
187 | /* gdk.c */ |
188 | |
189 | GdkWindow * |
190 | @@ -577,14 +563,6 @@ |
191 | void |
192 | meta_draw_window_decoration (decor_t *d); |
193 | |
194 | -gboolean |
195 | -meta_calc_decoration_size (decor_t *d, |
196 | - gint w, |
197 | - gint h, |
198 | - gint name_width, |
199 | - gint *width, |
200 | - gint *height); |
201 | - |
202 | void |
203 | meta_update_button_layout (const char *value); |
204 | |
205 | |
206 | === modified file 'gtk/window-decorator/gwd-theme-cairo.c' |
207 | --- gtk/window-decorator/gwd-theme-cairo.c 2016-05-20 11:20:59 +0000 |
208 | +++ gtk/window-decorator/gwd-theme-cairo.c 2016-05-20 11:21:00 +0000 |
209 | @@ -29,6 +29,29 @@ |
210 | |
211 | G_DEFINE_TYPE (GWDThemeCairo, gwd_theme_cairo, GWD_TYPE_THEME) |
212 | |
213 | +static void |
214 | +calc_button_size (decor_t *decor) |
215 | +{ |
216 | + gint button_width = 0; |
217 | + |
218 | + if (decor->actions & WNCK_WINDOW_ACTION_CLOSE) |
219 | + button_width += 17; |
220 | + |
221 | + if (decor->actions & (WNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY | |
222 | + WNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY | |
223 | + WNCK_WINDOW_ACTION_UNMAXIMIZE_HORIZONTALLY | |
224 | + WNCK_WINDOW_ACTION_UNMAXIMIZE_VERTICALLY)) |
225 | + button_width += 17; |
226 | + |
227 | + if (decor->actions & WNCK_WINDOW_ACTION_MINIMIZE) |
228 | + button_width += 17; |
229 | + |
230 | + if (button_width) |
231 | + ++button_width; |
232 | + |
233 | + decor->button_width = button_width; |
234 | +} |
235 | + |
236 | static gboolean |
237 | button_present (decor_t *decor, |
238 | gint i) |
239 | @@ -65,6 +88,87 @@ |
240 | return FALSE; |
241 | } |
242 | |
243 | +static gboolean |
244 | +gwd_theme_cairo_calc_decoration_size (GWDTheme *theme, |
245 | + decor_t *decor, |
246 | + gint w, |
247 | + gint h, |
248 | + gint name_width, |
249 | + gint *width, |
250 | + gint *height) |
251 | +{ |
252 | + decor_layout_t layout; |
253 | + gint top_width; |
254 | + |
255 | + if (!decor->decorated) |
256 | + return FALSE; |
257 | + |
258 | + /* To avoid wasting texture memory, we only calculate the minimal |
259 | + * required decoration size then clip and stretch the texture where |
260 | + * appropriate |
261 | + */ |
262 | + |
263 | + if (!decor->frame_window) { |
264 | + calc_button_size (decor); |
265 | + |
266 | + if (w < ICON_SPACE + decor->button_width) |
267 | + return FALSE; |
268 | + |
269 | + top_width = name_width + decor->button_width + ICON_SPACE; |
270 | + if (w < top_width) |
271 | + top_width = MAX (ICON_SPACE + decor->button_width, w); |
272 | + |
273 | + if (decor->active) |
274 | + decor_get_default_layout (&decor->frame->window_context_active, top_width, 1, &layout); |
275 | + else |
276 | + decor_get_default_layout (&decor->frame->window_context_inactive, top_width, 1, &layout); |
277 | + |
278 | + if (!decor->context || memcmp (&layout, &decor->border_layout, sizeof (layout))) { |
279 | + *width = layout.width; |
280 | + *height = layout.height; |
281 | + |
282 | + decor->border_layout = layout; |
283 | + if (decor->active) { |
284 | + decor->context = &decor->frame->window_context_active; |
285 | + decor->shadow = decor->frame->border_shadow_active; |
286 | + } else { |
287 | + decor->context = &decor->frame->window_context_inactive; |
288 | + decor->shadow = decor->frame->border_shadow_inactive; |
289 | + } |
290 | + |
291 | + return TRUE; |
292 | + } |
293 | + } else { |
294 | + calc_button_size (decor); |
295 | + |
296 | + /* _default_win_extents + top height */ |
297 | + |
298 | + top_width = name_width + decor->button_width + ICON_SPACE; |
299 | + if (w < top_width) |
300 | + top_width = MAX (ICON_SPACE + decor->button_width, w); |
301 | + |
302 | + decor_get_default_layout (&decor->frame->window_context_no_shadow, |
303 | + decor->client_width, decor->client_height, |
304 | + &layout); |
305 | + |
306 | + *width = layout.width; |
307 | + *height = layout.height; |
308 | + |
309 | + decor->border_layout = layout; |
310 | + if (decor->active) { |
311 | + decor->context = &decor->frame->window_context_active; |
312 | + decor->shadow = decor->frame->border_shadow_active; |
313 | + } else { |
314 | + decor->context = &decor->frame->window_context_inactive; |
315 | + decor->shadow = decor->frame->border_shadow_inactive; |
316 | + } |
317 | + |
318 | + return TRUE; |
319 | + } |
320 | + |
321 | + return FALSE; |
322 | +} |
323 | + |
324 | static void |
325 | gwd_theme_cairo_update_border_extents (GWDTheme *theme, |
326 | decor_frame_t *frame) |
327 | @@ -169,6 +273,7 @@ |
328 | { |
329 | GWDThemeClass *theme_class = GWD_THEME_CLASS (cairo_class); |
330 | |
331 | + theme_class->calc_decoration_size = gwd_theme_cairo_calc_decoration_size; |
332 | theme_class->update_border_extents = gwd_theme_cairo_update_border_extents; |
333 | theme_class->get_event_window_position = gwd_theme_cairo_get_event_window_position; |
334 | theme_class->get_button_position = gwd_theme_cairo_get_button_position; |
335 | |
336 | === modified file 'gtk/window-decorator/gwd-theme-metacity.c' |
337 | --- gtk/window-decorator/gwd-theme-metacity.c 2016-05-20 11:20:59 +0000 |
338 | +++ gtk/window-decorator/gwd-theme-metacity.c 2016-05-20 11:21:00 +0000 |
339 | @@ -31,6 +31,54 @@ |
340 | |
341 | G_DEFINE_TYPE (GWDThemeMetacity, gwd_theme_metacity, GWD_TYPE_THEME) |
342 | |
343 | +static void |
344 | +calc_button_size (GWDTheme *theme, |
345 | + decor_t *decor) |
346 | +{ |
347 | + MetaFrameType frame_type; |
348 | + MetaFrameFlags flags; |
349 | + MetaFrameGeometry fgeom; |
350 | + MetaButtonLayout button_layout; |
351 | + gint i, min_x, x, y, w, h, width; |
352 | + |
353 | + if (!decor->context) { |
354 | + decor->button_width = 0; |
355 | + return; |
356 | + } |
357 | + |
358 | + frame_type = meta_frame_type_from_string (decor->frame->type); |
359 | + if (!(frame_type < META_FRAME_TYPE_LAST)) |
360 | + frame_type = META_FRAME_TYPE_NORMAL; |
361 | + |
362 | + gwd_theme_metacity_get_decoration_geometry (GWD_THEME_METACITY (theme), |
363 | + decor, &flags, &fgeom, |
364 | + &button_layout, frame_type); |
365 | + |
366 | + width = decor->border_layout.top.x2 - decor->border_layout.top.x1 - |
367 | + decor->context->left_space - decor->context->right_space + |
368 | + fgeom.borders.total.left + fgeom.borders.total.right; |
369 | + |
370 | + min_x = width; |
371 | + |
372 | + for (i = 0; i < 3; ++i) { |
373 | + static guint button_actions[3] = { |
374 | + WNCK_WINDOW_ACTION_CLOSE, |
375 | + WNCK_WINDOW_ACTION_MAXIMIZE, |
376 | + WNCK_WINDOW_ACTION_MINIMIZE |
377 | + }; |
378 | + |
379 | + if (decor->actions & button_actions[i]) { |
380 | + if (gwd_theme_get_button_position (theme, decor, i, width, 256, |
381 | + &x, &y, &w, &h)) { |
382 | + if (x > width / 2 && x < min_x) |
383 | + min_x = x; |
384 | + } |
385 | + } |
386 | + } |
387 | + |
388 | + decor->button_width = width - min_x; |
389 | +} |
390 | + |
391 | static gboolean |
392 | button_present (MetaButtonLayout *button_layout, |
393 | MetaButtonFunction function) |
394 | @@ -200,6 +248,90 @@ |
395 | return object; |
396 | } |
397 | |
398 | +static gboolean |
399 | +gwd_theme_metacity_calc_decoration_size (GWDTheme *theme, |
400 | + decor_t *decor, |
401 | + gint w, |
402 | + gint h, |
403 | + gint name_width, |
404 | + gint *width, |
405 | + gint *height) |
406 | +{ |
407 | + decor_layout_t layout; |
408 | + decor_context_t *context; |
409 | + decor_shadow_t *shadow; |
410 | + |
411 | + if (!decor->decorated) |
412 | + return FALSE; |
413 | + |
414 | + if ((decor->state & META_MAXIMIZED) == META_MAXIMIZED) { |
415 | + if (!decor->frame_window) { |
416 | + if (decor->active) { |
417 | + context = &decor->frame->max_window_context_active; |
418 | + shadow = decor->frame->max_border_shadow_active; |
419 | + } else { |
420 | + context = &decor->frame->max_window_context_inactive; |
421 | + shadow = decor->frame->max_border_shadow_inactive; |
422 | + } |
423 | + } else { |
424 | + context = &decor->frame->max_window_context_no_shadow; |
425 | + shadow = decor->frame->max_border_no_shadow; |
426 | + } |
427 | + } else { |
428 | + if (!decor->frame_window) { |
429 | + if (decor->active) { |
430 | + context = &decor->frame->window_context_active; |
431 | + shadow = decor->frame->border_shadow_active; |
432 | + } else { |
433 | + context = &decor->frame->window_context_inactive; |
434 | + shadow = decor->frame->border_shadow_inactive; |
435 | + } |
436 | + } else { |
437 | + context = &decor->frame->window_context_no_shadow; |
438 | + shadow = decor->frame->border_no_shadow; |
439 | + } |
440 | + } |
441 | + |
442 | + if (!decor->frame_window) { |
443 | + decor_get_best_layout (context, w, h, &layout); |
444 | + |
445 | + if (context != decor->context || |
446 | + memcmp (&layout, &decor->border_layout, sizeof (layout))) { |
447 | + *width = layout.width; |
448 | + *height = layout.height; |
449 | + |
450 | + decor->border_layout = layout; |
451 | + decor->context = context; |
452 | + decor->shadow = shadow; |
453 | + |
454 | + calc_button_size (theme, decor); |
455 | + |
456 | + return TRUE; |
457 | + } |
458 | + } else { |
459 | + if ((decor->state & META_MAXIMIZED) == META_MAXIMIZED) |
460 | + decor_get_default_layout (context, decor->client_width, |
461 | + decor->client_height - decor->frame->titlebar_height, |
462 | + &layout); |
463 | + else |
464 | + decor_get_default_layout (context, decor->client_width, |
465 | + decor->client_height, &layout); |
466 | + |
467 | + *width = layout.width; |
468 | + *height = layout.height; |
469 | + |
470 | + decor->border_layout = layout; |
471 | + decor->shadow = shadow; |
472 | + decor->context = context; |
473 | + |
474 | + calc_button_size (theme, decor); |
475 | + |
476 | + return TRUE; |
477 | + } |
478 | + |
479 | + return FALSE; |
480 | +} |
481 | + |
482 | static void |
483 | gwd_theme_metacity_update_border_extents (GWDTheme *theme, |
484 | decor_frame_t *frame) |
485 | @@ -506,6 +638,7 @@ |
486 | |
487 | object_class->constructor = gwd_theme_metacity_constructor; |
488 | |
489 | + theme_class->calc_decoration_size = gwd_theme_metacity_calc_decoration_size; |
490 | theme_class->update_border_extents = gwd_theme_metacity_update_border_extents; |
491 | theme_class->get_event_window_position = gwd_theme_metacity_get_event_window_position; |
492 | theme_class->get_button_position = gwd_theme_metacity_get_button_position; |
493 | |
494 | === modified file 'gtk/window-decorator/metacity.c' |
495 | --- gtk/window-decorator/metacity.c 2016-05-20 11:20:59 +0000 |
496 | +++ gtk/window-decorator/metacity.c 2016-05-20 11:21:00 +0000 |
497 | @@ -697,158 +697,6 @@ |
498 | XDestroyRegion (right_region); |
499 | } |
500 | |
501 | -static void |
502 | -meta_calc_button_size (decor_t *d) |
503 | -{ |
504 | - MetaFrameType frame_type; |
505 | - MetaFrameFlags flags; |
506 | - MetaFrameGeometry fgeom; |
507 | - MetaButtonLayout button_layout; |
508 | - gint i, min_x, x, y, w, h, width; |
509 | - |
510 | - if (!d->context) |
511 | - { |
512 | - d->button_width = 0; |
513 | - return; |
514 | - } |
515 | - |
516 | - frame_type = meta_frame_type_from_string (d->frame->type); |
517 | - if (!(frame_type < META_FRAME_TYPE_LAST)) |
518 | - frame_type = META_FRAME_TYPE_NORMAL; |
519 | - |
520 | - gwd_theme_metacity_get_decoration_geometry (GWD_THEME_METACITY (gwd_theme), |
521 | - d, &flags, &fgeom, |
522 | - &button_layout, frame_type); |
523 | - |
524 | - width = d->border_layout.top.x2 - d->border_layout.top.x1 - |
525 | - d->context->left_space - d->context->right_space + |
526 | - fgeom.borders.total.left + fgeom.borders.total.right; |
527 | - |
528 | - min_x = width; |
529 | - |
530 | - for (i = 0; i < 3; ++i) |
531 | - { |
532 | - static guint button_actions[3] = { |
533 | - WNCK_WINDOW_ACTION_CLOSE, |
534 | - WNCK_WINDOW_ACTION_MAXIMIZE, |
535 | - WNCK_WINDOW_ACTION_MINIMIZE |
536 | - }; |
537 | - |
538 | - if (d->actions & button_actions[i]) |
539 | - { |
540 | - if (gwd_theme_get_button_position (gwd_theme, d, i, width, 256, |
541 | - &x, &y, &w, &h)) |
542 | - { |
543 | - if (x > width / 2 && x < min_x) |
544 | - min_x = x; |
545 | - } |
546 | - } |
547 | - } |
548 | - |
549 | - d->button_width = width - min_x; |
550 | -} |
551 | - |
552 | -gboolean |
553 | -meta_calc_decoration_size (decor_t *d, |
554 | - gint w, |
555 | - gint h, |
556 | - gint name_width, |
557 | - gint *width, |
558 | - gint *height) |
559 | -{ |
560 | - decor_layout_t layout; |
561 | - decor_context_t *context; |
562 | - decor_shadow_t *shadow; |
563 | - |
564 | - if (!d->decorated) |
565 | - return FALSE; |
566 | - |
567 | - if ((d->state & META_MAXIMIZED) == META_MAXIMIZED) |
568 | - { |
569 | - if (!d->frame_window) |
570 | - { |
571 | - if (d->active) |
572 | - { |
573 | - context = &d->frame->max_window_context_active; |
574 | - shadow = d->frame->max_border_shadow_active; |
575 | - } |
576 | - else |
577 | - { |
578 | - context = &d->frame->max_window_context_inactive; |
579 | - shadow = d->frame->max_border_shadow_inactive; |
580 | - } |
581 | - } |
582 | - else |
583 | - { |
584 | - context = &d->frame->max_window_context_no_shadow; |
585 | - shadow = d->frame->max_border_no_shadow; |
586 | - } |
587 | - } |
588 | - else |
589 | - { |
590 | - if (!d->frame_window) |
591 | - { |
592 | - if (d->active) |
593 | - { |
594 | - context = &d->frame->window_context_active; |
595 | - shadow = d->frame->border_shadow_active; |
596 | - } |
597 | - else |
598 | - { |
599 | - context = &d->frame->window_context_inactive; |
600 | - shadow = d->frame->border_shadow_inactive; |
601 | - } |
602 | - } |
603 | - else |
604 | - { |
605 | - context = &d->frame->window_context_no_shadow; |
606 | - shadow = d->frame->border_no_shadow; |
607 | - } |
608 | - } |
609 | - |
610 | - if (!d->frame_window) |
611 | - { |
612 | - decor_get_best_layout (context, w, h, &layout); |
613 | - |
614 | - if (context != d->context || memcmp (&layout, &d->border_layout, sizeof (layout))) |
615 | - { |
616 | - *width = layout.width; |
617 | - *height = layout.height; |
618 | - |
619 | - d->border_layout = layout; |
620 | - d->context = context; |
621 | - d->shadow = shadow; |
622 | - |
623 | - meta_calc_button_size (d); |
624 | - |
625 | - return TRUE; |
626 | - } |
627 | - } |
628 | - else |
629 | - { |
630 | - if ((d->state & META_MAXIMIZED) == META_MAXIMIZED) |
631 | - decor_get_default_layout (context, d->client_width, |
632 | - d->client_height - d->frame->titlebar_height, |
633 | - &layout); |
634 | - else |
635 | - decor_get_default_layout (context, d->client_width, |
636 | - d->client_height, &layout); |
637 | - |
638 | - *width = layout.width; |
639 | - *height = layout.height; |
640 | - |
641 | - d->border_layout = layout; |
642 | - d->shadow = shadow; |
643 | - d->context = context; |
644 | - |
645 | - meta_calc_button_size (d); |
646 | - |
647 | - return TRUE; |
648 | - } |
649 | - |
650 | - return FALSE; |
651 | -} |
652 | - |
653 | static MetaButtonFunction |
654 | meta_button_function_from_string (const char *str) |
655 | { |
LGTM