Merge lp:~muktupavels/compiz/gwd-meta-theme-get-title-scale-removed into lp:compiz/0.9.12

Proposed by Alberts Muktupāvels
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 4050
Merged at revision: 4047
Proposed branch: lp:~muktupavels/compiz/gwd-meta-theme-get-title-scale-removed
Merge into: lp:compiz/0.9.12
Prerequisite: lp:~muktupavels/compiz/gwd-remove-2d
Diff against target: 153 lines (+32/-31)
4 files modified
gtk/window-decorator/frames.c (+1/-9)
gtk/window-decorator/gwd-theme-metacity.c (+12/-8)
gtk/window-decorator/gwd-theme.c (+11/-9)
gtk/window-decorator/gwd-theme.h (+8/-5)
To merge this branch: bzr merge lp:~muktupavels/compiz/gwd-meta-theme-get-title-scale-removed
Reviewer Review Type Date Requested Status
Sam Spilsbury Approve
Marco Trevisan (Treviño) Approve
Review via email: mp+296190@code.launchpad.net

Commit message

gtk-window-decorator: replace get_title_scale with update_titlebar_font_size.

Description of the change

Replace get_title_scale with update_titlebar_font_size. meta_theme_get_title_scale will be removed in Metacity 3.20.

This also removes useless calls to pango_font_description_get_size and pango_font_description_set_size when Cairo theme is used.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Thanks

review: Approve
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

LGTM as well

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'gtk/window-decorator/frames.c'
--- gtk/window-decorator/frames.c 2016-06-01 13:35:20 +0000
+++ gtk/window-decorator/frames.c 2016-06-01 13:35:20 +0000
@@ -516,8 +516,6 @@
516set_frame_scale (decor_frame_t *frame,516set_frame_scale (decor_frame_t *frame,
517 const gchar *font_str)517 const gchar *font_str)
518{518{
519 gfloat scale = 1.0f;
520
521 gwd_decor_frame_ref (frame);519 gwd_decor_frame_ref (frame);
522520
523 if (frame->titlebar_font) {521 if (frame->titlebar_font) {
@@ -526,14 +524,8 @@
526 }524 }
527525
528 if (font_str) {526 if (font_str) {
529 gint size;
530
531 frame->titlebar_font = pango_font_description_from_string (font_str);527 frame->titlebar_font = pango_font_description_from_string (font_str);
532528 gwd_theme_update_titlebar_font_size (gwd_theme, frame, frame->titlebar_font);
533 scale = gwd_theme_get_title_scale (gwd_theme, frame);
534 size = MAX (pango_font_description_get_size (frame->titlebar_font) * scale, 1);
535
536 pango_font_description_set_size (frame->titlebar_font, size);
537 }529 }
538530
539 gwd_decor_frame_unref (frame);531 gwd_decor_frame_unref (frame);
540532
=== modified file 'gtk/window-decorator/gwd-theme-metacity.c'
--- gtk/window-decorator/gwd-theme-metacity.c 2016-06-01 13:35:20 +0000
+++ gtk/window-decorator/gwd-theme-metacity.c 2016-06-01 13:35:20 +0000
@@ -1414,18 +1414,22 @@
1414 return TRUE;1414 return TRUE;
1415}1415}
14161416
1417static gfloat1417static void
1418gwd_theme_metacity_get_title_scale (GWDTheme *theme,1418gwd_theme_metacity_update_titlebar_font_size (GWDTheme *theme,
1419 decor_frame_t *frame)1419 decor_frame_t *frame,
1420 PangoFontDescription *titlebar_font)
1420{1421{
1421 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);1422 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);
1422 MetaFrameType type = meta_frame_type_from_string (frame->type);1423 MetaFrameType type = meta_frame_type_from_string (frame->type);
1423 MetaFrameFlags flags = 0xc33; /* FIXME */ 1424 MetaFrameFlags flags = 0xc33; /* FIXME */
1425 MetaFrameStyle *style;
14241426
1425 if (type == META_FRAME_TYPE_LAST)1427 if (type == META_FRAME_TYPE_LAST)
1426 return 1.0f;1428 type = META_FRAME_TYPE_NORMAL;
14271429
1428 return meta_theme_get_title_scale (metacity->theme, type, flags);1430 style = meta_theme_get_frame_style (metacity->theme, type, flags);
1431
1432 meta_frame_style_apply_scale (style, titlebar_font);
1429}1433}
14301434
1431static void1435static void
@@ -1442,7 +1446,7 @@
1442 theme_class->update_border_extents = gwd_theme_metacity_update_border_extents;1446 theme_class->update_border_extents = gwd_theme_metacity_update_border_extents;
1443 theme_class->get_event_window_position = gwd_theme_metacity_get_event_window_position;1447 theme_class->get_event_window_position = gwd_theme_metacity_get_event_window_position;
1444 theme_class->get_button_position = gwd_theme_metacity_get_button_position;1448 theme_class->get_button_position = gwd_theme_metacity_get_button_position;
1445 theme_class->get_title_scale = gwd_theme_metacity_get_title_scale;1449 theme_class->update_titlebar_font_size = gwd_theme_metacity_update_titlebar_font_size;
1446}1450}
14471451
1448static void1452static void
14491453
=== modified file 'gtk/window-decorator/gwd-theme.c'
--- gtk/window-decorator/gwd-theme.c 2016-05-26 13:33:24 +0000
+++ gtk/window-decorator/gwd-theme.c 2016-06-01 13:35:20 +0000
@@ -175,11 +175,11 @@
175 return FALSE;175 return FALSE;
176}176}
177177
178static gfloat178static void
179gwd_theme_real_get_title_scale (GWDTheme *theme,179gwd_theme_real_update_titlebar_font_size (GWDTheme *theme,
180 decor_frame_t *frame)180 decor_frame_t *frame,
181 PangoFontDescription *titlebar_font)
181{182{
182 return 1.0;
183}183}
184184
185static void185static void
@@ -199,7 +199,7 @@
199 theme_class->update_border_extents = gwd_theme_real_update_border_extents;199 theme_class->update_border_extents = gwd_theme_real_update_border_extents;
200 theme_class->get_event_window_position = gwd_theme_real_get_event_window_position;200 theme_class->get_event_window_position = gwd_theme_real_get_event_window_position;
201 theme_class->get_button_position = gwd_theme_real_get_button_position;201 theme_class->get_button_position = gwd_theme_real_get_button_position;
202 theme_class->get_title_scale = gwd_theme_real_get_title_scale;202 theme_class->update_titlebar_font_size = gwd_theme_real_update_titlebar_font_size;
203203
204 properties[PROP_SETTINGS] =204 properties[PROP_SETTINGS] =
205 g_param_spec_object ("settings", "GWDSettings", "GWDSettings",205 g_param_spec_object ("settings", "GWDSettings", "GWDSettings",
@@ -328,9 +328,11 @@
328 x, y, w, h);328 x, y, w, h);
329}329}
330330
331gfloat331void
332gwd_theme_get_title_scale (GWDTheme *theme,332gwd_theme_update_titlebar_font_size (GWDTheme *theme,
333 decor_frame_t *frame)333 decor_frame_t *frame,
334 PangoFontDescription *titlebar_font)
334{335{
335 return GWD_THEME_GET_CLASS (theme)->get_title_scale (theme, frame);336 GWD_THEME_GET_CLASS (theme)->update_titlebar_font_size (theme, frame,
337 titlebar_font);
336}338}
337339
=== modified file 'gtk/window-decorator/gwd-theme.h'
--- gtk/window-decorator/gwd-theme.h 2016-05-20 11:56:36 +0000
+++ gtk/window-decorator/gwd-theme.h 2016-06-01 13:35:20 +0000
@@ -22,6 +22,7 @@
2222
23#include <decoration.h>23#include <decoration.h>
24#include <glib-object.h>24#include <glib-object.h>
25#include <pango/pango.h>
2526
26G_BEGIN_DECLS27G_BEGIN_DECLS
2728
@@ -76,8 +77,9 @@
76 gint *w,77 gint *w,
77 gint *h);78 gint *h);
7879
79 gfloat (* get_title_scale) (GWDTheme *theme,80 void (* update_titlebar_font_size) (GWDTheme *theme,
80 decor_frame_t *frame);81 decor_frame_t *frame,
82 PangoFontDescription *titlebar_font);
81};83};
8284
83typedef enum85typedef enum
@@ -139,9 +141,10 @@
139 gint *w,141 gint *w,
140 gint *h);142 gint *h);
141143
142gfloat144void
143gwd_theme_get_title_scale (GWDTheme *theme,145gwd_theme_update_titlebar_font_size (GWDTheme *theme,
144 decor_frame_t *frame);146 decor_frame_t *frame,
147 PangoFontDescription *titlebar_font);
145148
146G_END_DECLS149G_END_DECLS
147150

Subscribers

People subscribed via source and target branches