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
1=== modified file 'gtk/window-decorator/frames.c'
2--- gtk/window-decorator/frames.c 2016-06-01 13:35:20 +0000
3+++ gtk/window-decorator/frames.c 2016-06-01 13:35:20 +0000
4@@ -516,8 +516,6 @@
5 set_frame_scale (decor_frame_t *frame,
6 const gchar *font_str)
7 {
8- gfloat scale = 1.0f;
9-
10 gwd_decor_frame_ref (frame);
11
12 if (frame->titlebar_font) {
13@@ -526,14 +524,8 @@
14 }
15
16 if (font_str) {
17- gint size;
18-
19 frame->titlebar_font = pango_font_description_from_string (font_str);
20-
21- scale = gwd_theme_get_title_scale (gwd_theme, frame);
22- size = MAX (pango_font_description_get_size (frame->titlebar_font) * scale, 1);
23-
24- pango_font_description_set_size (frame->titlebar_font, size);
25+ gwd_theme_update_titlebar_font_size (gwd_theme, frame, frame->titlebar_font);
26 }
27
28 gwd_decor_frame_unref (frame);
29
30=== modified file 'gtk/window-decorator/gwd-theme-metacity.c'
31--- gtk/window-decorator/gwd-theme-metacity.c 2016-06-01 13:35:20 +0000
32+++ gtk/window-decorator/gwd-theme-metacity.c 2016-06-01 13:35:20 +0000
33@@ -1414,18 +1414,22 @@
34 return TRUE;
35 }
36
37-static gfloat
38-gwd_theme_metacity_get_title_scale (GWDTheme *theme,
39- decor_frame_t *frame)
40+static void
41+gwd_theme_metacity_update_titlebar_font_size (GWDTheme *theme,
42+ decor_frame_t *frame,
43+ PangoFontDescription *titlebar_font)
44 {
45 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);
46 MetaFrameType type = meta_frame_type_from_string (frame->type);
47- MetaFrameFlags flags = 0xc33; /* FIXME */
48+ MetaFrameFlags flags = 0xc33; /* FIXME */
49+ MetaFrameStyle *style;
50
51 if (type == META_FRAME_TYPE_LAST)
52- return 1.0f;
53-
54- return meta_theme_get_title_scale (metacity->theme, type, flags);
55+ type = META_FRAME_TYPE_NORMAL;
56+
57+ style = meta_theme_get_frame_style (metacity->theme, type, flags);
58+
59+ meta_frame_style_apply_scale (style, titlebar_font);
60 }
61
62 static void
63@@ -1442,7 +1446,7 @@
64 theme_class->update_border_extents = gwd_theme_metacity_update_border_extents;
65 theme_class->get_event_window_position = gwd_theme_metacity_get_event_window_position;
66 theme_class->get_button_position = gwd_theme_metacity_get_button_position;
67- theme_class->get_title_scale = gwd_theme_metacity_get_title_scale;
68+ theme_class->update_titlebar_font_size = gwd_theme_metacity_update_titlebar_font_size;
69 }
70
71 static void
72
73=== modified file 'gtk/window-decorator/gwd-theme.c'
74--- gtk/window-decorator/gwd-theme.c 2016-05-26 13:33:24 +0000
75+++ gtk/window-decorator/gwd-theme.c 2016-06-01 13:35:20 +0000
76@@ -175,11 +175,11 @@
77 return FALSE;
78 }
79
80-static gfloat
81-gwd_theme_real_get_title_scale (GWDTheme *theme,
82- decor_frame_t *frame)
83+static void
84+gwd_theme_real_update_titlebar_font_size (GWDTheme *theme,
85+ decor_frame_t *frame,
86+ PangoFontDescription *titlebar_font)
87 {
88- return 1.0;
89 }
90
91 static void
92@@ -199,7 +199,7 @@
93 theme_class->update_border_extents = gwd_theme_real_update_border_extents;
94 theme_class->get_event_window_position = gwd_theme_real_get_event_window_position;
95 theme_class->get_button_position = gwd_theme_real_get_button_position;
96- theme_class->get_title_scale = gwd_theme_real_get_title_scale;
97+ theme_class->update_titlebar_font_size = gwd_theme_real_update_titlebar_font_size;
98
99 properties[PROP_SETTINGS] =
100 g_param_spec_object ("settings", "GWDSettings", "GWDSettings",
101@@ -328,9 +328,11 @@
102 x, y, w, h);
103 }
104
105-gfloat
106-gwd_theme_get_title_scale (GWDTheme *theme,
107- decor_frame_t *frame)
108+void
109+gwd_theme_update_titlebar_font_size (GWDTheme *theme,
110+ decor_frame_t *frame,
111+ PangoFontDescription *titlebar_font)
112 {
113- return GWD_THEME_GET_CLASS (theme)->get_title_scale (theme, frame);
114+ GWD_THEME_GET_CLASS (theme)->update_titlebar_font_size (theme, frame,
115+ titlebar_font);
116 }
117
118=== modified file 'gtk/window-decorator/gwd-theme.h'
119--- gtk/window-decorator/gwd-theme.h 2016-05-20 11:56:36 +0000
120+++ gtk/window-decorator/gwd-theme.h 2016-06-01 13:35:20 +0000
121@@ -22,6 +22,7 @@
122
123 #include <decoration.h>
124 #include <glib-object.h>
125+#include <pango/pango.h>
126
127 G_BEGIN_DECLS
128
129@@ -76,8 +77,9 @@
130 gint *w,
131 gint *h);
132
133- gfloat (* get_title_scale) (GWDTheme *theme,
134- decor_frame_t *frame);
135+ void (* update_titlebar_font_size) (GWDTheme *theme,
136+ decor_frame_t *frame,
137+ PangoFontDescription *titlebar_font);
138 };
139
140 typedef enum
141@@ -139,9 +141,10 @@
142 gint *w,
143 gint *h);
144
145-gfloat
146-gwd_theme_get_title_scale (GWDTheme *theme,
147- decor_frame_t *frame);
148+void
149+gwd_theme_update_titlebar_font_size (GWDTheme *theme,
150+ decor_frame_t *frame,
151+ PangoFontDescription *titlebar_font);
152
153 G_END_DECLS
154

Subscribers

People subscribed via source and target branches