Merge lp:~muktupavels/compiz/add-gwd-application-v3 into lp:compiz/0.9.12
- add-gwd-application-v3
- Merge into 0.9.12
Status: | Work in progress |
---|---|
Proposed branch: | lp:~muktupavels/compiz/add-gwd-application-v3 |
Merge into: | lp:compiz/0.9.12 |
Prerequisite: | lp:~muktupavels/compiz/gwd-remove-2d |
Diff against target: |
838 lines (+360/-107) 14 files modified
gtk/window-decorator/CMakeLists.txt (+1/-0) gtk/window-decorator/blurprops.c (+1/-1) gtk/window-decorator/decorator.c (+1/-1) gtk/window-decorator/events.c (+4/-4) gtk/window-decorator/frames.c (+1/-1) gtk/window-decorator/gtk-window-decorator.c (+5/-6) gtk/window-decorator/gtk-window-decorator.h (+2/-0) gtk/window-decorator/gwd-application.c (+149/-0) gtk/window-decorator/gwd-application.h (+40/-0) gtk/window-decorator/gwd-theme-cairo.c (+73/-1) gtk/window-decorator/gwd-theme-metacity.c (+62/-14) gtk/window-decorator/gwd-theme.c (+20/-74) gtk/window-decorator/gwd-theme.h (+0/-4) gtk/window-decorator/wnck.c (+1/-1) |
To merge this branch: | bzr merge lp:~muktupavels/compiz/add-gwd-application-v3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sam Spilsbury | Needs Fixing | ||
Review via email: mp+295921@code.launchpad.net |
Commit message
gtk-window-
Description of the change
gtk-window-
Alberts Muktupāvels (muktupavels) wrote : | # |
> See diff comments (use after free).
>
> I don't quite understand the purpose of this abstraction either. Could you add
> a little more detail in the description of the change or the commit message
> explaining the need to create a GWDApplication? It seems to me like we just
> moved parts of GWDTheme over to it.
Will fix use after free and also update description when I will be back to my main pc. GWDSettings moved to GWDApplication is only small part.
It looks like there is no reason to create style window for each frame style - so I will create only one style window and GWDApplication will be good place to store/keep it.
Also GWDTheme probably can be moved to it like other global variables, for example, frame_table... I simply want keep merge proposals more or less simple so it is easier to review.
Unmerged revisions
- 4051. By Alberts Muktupāvels
-
Remove uneeded include.
- 4050. By Alberts Muktupāvels
-
Remove get_settings from GWDTheme.
- 4049. By Alberts Muktupāvels
-
Add GWDApplication.
Preview Diff
1 | === modified file 'gtk/window-decorator/CMakeLists.txt' | |||
2 | --- gtk/window-decorator/CMakeLists.txt 2016-05-21 11:06:24 +0000 | |||
3 | +++ gtk/window-decorator/CMakeLists.txt 2016-05-27 09:42:08 +0000 | |||
4 | @@ -79,6 +79,7 @@ | |||
5 | 79 | util.c | 79 | util.c |
6 | 80 | wnck.c | 80 | wnck.c |
7 | 81 | decorator.c | 81 | decorator.c |
8 | 82 | ${CMAKE_CURRENT_SOURCE_DIR}/gwd-application.c | ||
9 | 82 | ${CMAKE_CURRENT_SOURCE_DIR}/gwd-settings-xproperty-storage.c | 83 | ${CMAKE_CURRENT_SOURCE_DIR}/gwd-settings-xproperty-storage.c |
10 | 83 | ${CMAKE_CURRENT_SOURCE_DIR}/gwd-theme.c | 84 | ${CMAKE_CURRENT_SOURCE_DIR}/gwd-theme.c |
11 | 84 | ${CMAKE_CURRENT_SOURCE_DIR}/gwd-theme-cairo.c | 85 | ${CMAKE_CURRENT_SOURCE_DIR}/gwd-theme-cairo.c |
12 | 85 | 86 | ||
13 | === modified file 'gtk/window-decorator/blurprops.c' | |||
14 | --- gtk/window-decorator/blurprops.c 2016-05-21 16:08:47 +0000 | |||
15 | +++ gtk/window-decorator/blurprops.c 2016-05-27 09:42:08 +0000 | |||
16 | @@ -35,7 +35,7 @@ | |||
17 | 35 | Region right_region, | 35 | Region right_region, |
18 | 36 | int right_offset) | 36 | int right_offset) |
19 | 37 | { | 37 | { |
21 | 38 | GWDSettings *settings = gwd_theme_get_settings (gwd_theme); | 38 | GWDSettings *settings = gwd_application_get_settings (application); |
22 | 39 | gint blur_type = gwd_settings_get_blur_type (settings); | 39 | gint blur_type = gwd_settings_get_blur_type (settings); |
23 | 40 | Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); | 40 | Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); |
24 | 41 | long *data = NULL; | 41 | long *data = NULL; |
25 | 42 | 42 | ||
26 | === modified file 'gtk/window-decorator/decorator.c' | |||
27 | --- gtk/window-decorator/decorator.c 2016-05-27 09:42:08 +0000 | |||
28 | +++ gtk/window-decorator/decorator.c 2016-05-27 09:42:08 +0000 | |||
29 | @@ -55,7 +55,7 @@ | |||
30 | 55 | static const PangoFontDescription * | 55 | static const PangoFontDescription * |
31 | 56 | get_titlebar_font (decor_frame_t *frame) | 56 | get_titlebar_font (decor_frame_t *frame) |
32 | 57 | { | 57 | { |
34 | 58 | GWDSettings *settings = gwd_theme_get_settings (gwd_theme); | 58 | GWDSettings *settings = gwd_application_get_settings (application); |
35 | 59 | const gchar *titlebar_font = gwd_settings_get_titlebar_font (settings); | 59 | const gchar *titlebar_font = gwd_settings_get_titlebar_font (settings); |
36 | 60 | 60 | ||
37 | 61 | /* Using system font */ | 61 | /* Using system font */ |
38 | 62 | 62 | ||
39 | === modified file 'gtk/window-decorator/events.c' | |||
40 | --- gtk/window-decorator/events.c 2016-05-27 09:42:08 +0000 | |||
41 | +++ gtk/window-decorator/events.c 2016-05-27 09:42:08 +0000 | |||
42 | @@ -109,7 +109,7 @@ | |||
43 | 109 | int max, | 109 | int max, |
44 | 110 | char *tooltip) | 110 | char *tooltip) |
45 | 111 | { | 111 | { |
47 | 112 | GWDSettings *settings = gwd_theme_get_settings (gwd_theme); | 112 | GWDSettings *settings = gwd_application_get_settings (application); |
48 | 113 | gboolean use_tooltips = gwd_settings_get_use_tooltips (settings); | 113 | gboolean use_tooltips = gwd_settings_get_use_tooltips (settings); |
49 | 114 | decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); | 114 | decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
50 | 115 | guint state = d->button_states[button]; | 115 | guint state = d->button_states[button]; |
51 | @@ -448,7 +448,7 @@ | |||
52 | 448 | handle_mouse_wheel_title_event (WnckWindow *win, | 448 | handle_mouse_wheel_title_event (WnckWindow *win, |
53 | 449 | unsigned int button) | 449 | unsigned int button) |
54 | 450 | { | 450 | { |
56 | 451 | GWDSettings *settings = gwd_theme_get_settings (gwd_theme); | 451 | GWDSettings *settings = gwd_application_get_settings (application); |
57 | 452 | gint wheel_action = gwd_settings_get_mouse_wheel_action (settings); | 452 | gint wheel_action = gwd_settings_get_mouse_wheel_action (settings); |
58 | 453 | 453 | ||
59 | 454 | switch (wheel_action) { | 454 | switch (wheel_action) { |
60 | @@ -474,7 +474,7 @@ | |||
61 | 474 | decor_event *gtkwd_event, | 474 | decor_event *gtkwd_event, |
62 | 475 | decor_event_type gtkwd_type) | 475 | decor_event_type gtkwd_type) |
63 | 476 | { | 476 | { |
65 | 477 | GWDSettings *settings = gwd_theme_get_settings (gwd_theme); | 477 | GWDSettings *settings = gwd_application_get_settings (application); |
66 | 478 | static Window last_button_xwindow = None; | 478 | static Window last_button_xwindow = None; |
67 | 479 | static Time last_button_time = 0; | 479 | static Time last_button_time = 0; |
68 | 480 | gint titlebar_action = 0; | 480 | gint titlebar_action = 0; |
69 | @@ -541,7 +541,7 @@ | |||
70 | 541 | decor_event *gtkwd_event, | 541 | decor_event *gtkwd_event, |
71 | 542 | decor_event_type gtkwd_type) | 542 | decor_event_type gtkwd_type) |
72 | 543 | { | 543 | { |
74 | 544 | GWDSettings *settings = gwd_theme_get_settings (gwd_theme); | 544 | GWDSettings *settings = gwd_application_get_settings (application); |
75 | 545 | gint titlebar_action = 0; | 545 | gint titlebar_action = 0; |
76 | 546 | 546 | ||
77 | 547 | if (gtkwd_type != GButtonPress) | 547 | if (gtkwd_type != GButtonPress) |
78 | 548 | 548 | ||
79 | === modified file 'gtk/window-decorator/frames.c' | |||
80 | --- gtk/window-decorator/frames.c 2016-05-27 09:42:08 +0000 | |||
81 | +++ gtk/window-decorator/frames.c 2016-05-27 09:42:08 +0000 | |||
82 | @@ -264,7 +264,7 @@ | |||
83 | 264 | void | 264 | void |
84 | 265 | decor_frame_refresh (decor_frame_t *frame) | 265 | decor_frame_refresh (decor_frame_t *frame) |
85 | 266 | { | 266 | { |
87 | 267 | GWDSettings *settings = gwd_theme_get_settings (gwd_theme); | 267 | GWDSettings *settings = gwd_application_get_settings (application); |
88 | 268 | const gchar *titlebar_font = gwd_settings_get_titlebar_font (settings); | 268 | const gchar *titlebar_font = gwd_settings_get_titlebar_font (settings); |
89 | 269 | decor_shadow_options_t active_o, inactive_o; | 269 | decor_shadow_options_t active_o, inactive_o; |
90 | 270 | decor_shadow_info_t *info; | 270 | decor_shadow_info_t *info; |
91 | 271 | 271 | ||
92 | === modified file 'gtk/window-decorator/gtk-window-decorator.c' | |||
93 | --- gtk/window-decorator/gtk-window-decorator.c 2016-05-27 09:42:08 +0000 | |||
94 | +++ gtk/window-decorator/gtk-window-decorator.c 2016-05-27 09:42:08 +0000 | |||
95 | @@ -26,6 +26,7 @@ | |||
96 | 26 | #include "gtk-window-decorator.h" | 26 | #include "gtk-window-decorator.h" |
97 | 27 | #include "gwd-settings.h" | 27 | #include "gwd-settings.h" |
98 | 28 | 28 | ||
99 | 29 | GWDApplication *application; | ||
100 | 29 | GWDTheme *gwd_theme; | 30 | GWDTheme *gwd_theme; |
101 | 30 | 31 | ||
102 | 31 | gdouble decoration_alpha = 0.5; | 32 | gdouble decoration_alpha = 0.5; |
103 | @@ -302,10 +303,8 @@ | |||
104 | 302 | 303 | ||
105 | 303 | initialize_decorations (); | 304 | initialize_decorations (); |
106 | 304 | 305 | ||
111 | 305 | settings = gwd_settings_new (option_blur_type, option_meta_theme); | 306 | application = gwd_application_new (option_blur_type, option_meta_theme); |
112 | 306 | 307 | settings = gwd_application_get_settings (application); | |
109 | 307 | if (!settings) | ||
110 | 308 | return 1; | ||
113 | 309 | 308 | ||
114 | 310 | g_signal_connect (settings, "update-decorations", | 309 | g_signal_connect (settings, "update-decorations", |
115 | 311 | G_CALLBACK (update_decorations_cb), NULL); | 310 | G_CALLBACK (update_decorations_cb), NULL); |
116 | @@ -334,7 +333,7 @@ | |||
117 | 334 | 333 | ||
118 | 335 | if (!create_tooltip_window ()) | 334 | if (!create_tooltip_window ()) |
119 | 336 | { | 335 | { |
121 | 337 | g_object_unref (settings); | 336 | g_object_unref (application); |
122 | 338 | 337 | ||
123 | 339 | fprintf (stderr, "%s, Couldn't create tooltip window\n", argv[0]); | 338 | fprintf (stderr, "%s, Couldn't create tooltip window\n", argv[0]); |
124 | 340 | return 1; | 339 | return 1; |
125 | @@ -418,7 +417,7 @@ | |||
126 | 418 | 417 | ||
127 | 419 | g_clear_object (&gwd_theme); | 418 | g_clear_object (&gwd_theme); |
128 | 420 | fini_settings (); | 419 | fini_settings (); |
130 | 421 | g_clear_object (&settings); | 420 | g_clear_object (&application); |
131 | 422 | 421 | ||
132 | 423 | return 0; | 422 | return 0; |
133 | 424 | } | 423 | } |
134 | 425 | 424 | ||
135 | === modified file 'gtk/window-decorator/gtk-window-decorator.h' | |||
136 | --- gtk/window-decorator/gtk-window-decorator.h 2016-05-27 09:42:08 +0000 | |||
137 | +++ gtk/window-decorator/gtk-window-decorator.h 2016-05-27 09:42:08 +0000 | |||
138 | @@ -63,6 +63,7 @@ | |||
139 | 63 | #define _(x) gettext (x) | 63 | #define _(x) gettext (x) |
140 | 64 | #define N_(x) x | 64 | #define N_(x) x |
141 | 65 | 65 | ||
142 | 66 | #include "gwd-application.h" | ||
143 | 66 | #include "gwd-theme.h" | 67 | #include "gwd-theme.h" |
144 | 67 | 68 | ||
145 | 68 | extern const unsigned short ICON_SPACE; | 69 | extern const unsigned short ICON_SPACE; |
146 | @@ -90,6 +91,7 @@ | |||
147 | 90 | 91 | ||
148 | 91 | extern gboolean minimal; | 92 | extern gboolean minimal; |
149 | 92 | 93 | ||
150 | 94 | extern GWDApplication *application; | ||
151 | 93 | extern GWDTheme *gwd_theme; | 95 | extern GWDTheme *gwd_theme; |
152 | 94 | 96 | ||
153 | 95 | extern gdouble decoration_alpha; | 97 | extern gdouble decoration_alpha; |
154 | 96 | 98 | ||
155 | === added file 'gtk/window-decorator/gwd-application.c' | |||
156 | --- gtk/window-decorator/gwd-application.c 1970-01-01 00:00:00 +0000 | |||
157 | +++ gtk/window-decorator/gwd-application.c 2016-05-27 09:42:08 +0000 | |||
158 | @@ -0,0 +1,149 @@ | |||
159 | 1 | /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*- */ | ||
160 | 2 | |||
161 | 3 | /* | ||
162 | 4 | * Copyright (C) 2016 Alberts Muktupāvels | ||
163 | 5 | * | ||
164 | 6 | * This program is free software; you can redistribute it and/or modify | ||
165 | 7 | * it under the terms of the GNU General Public License as published by | ||
166 | 8 | * the Free Software Foundation; either version 2 of the License, or | ||
167 | 9 | * (at your option) any later version. | ||
168 | 10 | * | ||
169 | 11 | * This program is distributed in the hope that it will be useful, | ||
170 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
171 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
172 | 14 | * GNU General Public License for more details. | ||
173 | 15 | * | ||
174 | 16 | * You should have received a copy of the GNU General Public License | ||
175 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
176 | 18 | */ | ||
177 | 19 | |||
178 | 20 | #include "config.h" | ||
179 | 21 | #include "gwd-application.h" | ||
180 | 22 | |||
181 | 23 | struct _GWDApplication | ||
182 | 24 | { | ||
183 | 25 | GObject parent; | ||
184 | 26 | |||
185 | 27 | gint blur_type; | ||
186 | 28 | gchar *metacity_theme; | ||
187 | 29 | |||
188 | 30 | GWDSettings *settings; | ||
189 | 31 | }; | ||
190 | 32 | |||
191 | 33 | enum | ||
192 | 34 | { | ||
193 | 35 | PROP_0, | ||
194 | 36 | |||
195 | 37 | PROP_BLUR_TYPE, | ||
196 | 38 | PROP_METACITY_THEME, | ||
197 | 39 | |||
198 | 40 | LAST_PROP | ||
199 | 41 | }; | ||
200 | 42 | |||
201 | 43 | static GParamSpec *properties[LAST_PROP] = { NULL }; | ||
202 | 44 | |||
203 | 45 | G_DEFINE_TYPE (GWDApplication, gwd_application, G_TYPE_OBJECT) | ||
204 | 46 | |||
205 | 47 | static void | ||
206 | 48 | gwd_application_constructed (GObject *object) | ||
207 | 49 | { | ||
208 | 50 | GWDApplication *application = GWD_APPLICATION (object); | ||
209 | 51 | |||
210 | 52 | G_OBJECT_CLASS (gwd_application_parent_class)->constructed (object); | ||
211 | 53 | |||
212 | 54 | application->settings = gwd_settings_new (application->blur_type, | ||
213 | 55 | application->metacity_theme); | ||
214 | 56 | } | ||
215 | 57 | |||
216 | 58 | static void | ||
217 | 59 | gwd_application_dispose (GObject *object) | ||
218 | 60 | { | ||
219 | 61 | GWDApplication *application = GWD_APPLICATION (object); | ||
220 | 62 | |||
221 | 63 | g_clear_object (&application->settings); | ||
222 | 64 | |||
223 | 65 | G_OBJECT_CLASS (gwd_application_parent_class)->dispose (object); | ||
224 | 66 | } | ||
225 | 67 | |||
226 | 68 | static void | ||
227 | 69 | gwd_application_finalize (GObject *object) | ||
228 | 70 | { | ||
229 | 71 | GWDApplication *application = GWD_APPLICATION (object); | ||
230 | 72 | |||
231 | 73 | g_clear_pointer (&application->metacity_theme, g_free); | ||
232 | 74 | |||
233 | 75 | G_OBJECT_CLASS (gwd_application_parent_class)->finalize (object); | ||
234 | 76 | } | ||
235 | 77 | |||
236 | 78 | static void | ||
237 | 79 | gwd_application_set_property (GObject *object, | ||
238 | 80 | guint property_id, | ||
239 | 81 | const GValue *value, | ||
240 | 82 | GParamSpec *pspec) | ||
241 | 83 | { | ||
242 | 84 | GWDApplication *application = GWD_APPLICATION (object); | ||
243 | 85 | |||
244 | 86 | switch (property_id) { | ||
245 | 87 | case PROP_BLUR_TYPE: | ||
246 | 88 | application->blur_type = g_value_get_int (value); | ||
247 | 89 | break; | ||
248 | 90 | |||
249 | 91 | case PROP_METACITY_THEME: | ||
250 | 92 | application->metacity_theme = g_value_dup_string (value); | ||
251 | 93 | break; | ||
252 | 94 | |||
253 | 95 | default: | ||
254 | 96 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
255 | 97 | break; | ||
256 | 98 | } | ||
257 | 99 | } | ||
258 | 100 | |||
259 | 101 | static void | ||
260 | 102 | gwd_application_class_init (GWDApplicationClass *application_class) | ||
261 | 103 | { | ||
262 | 104 | GObjectClass *object_class = G_OBJECT_CLASS (application_class); | ||
263 | 105 | |||
264 | 106 | object_class->constructed = gwd_application_constructed; | ||
265 | 107 | object_class->dispose = gwd_application_dispose; | ||
266 | 108 | object_class->finalize = gwd_application_finalize; | ||
267 | 109 | object_class->set_property = gwd_application_set_property; | ||
268 | 110 | |||
269 | 111 | properties[PROP_BLUR_TYPE] = | ||
270 | 112 | g_param_spec_int ("blur-type", | ||
271 | 113 | "Blur Type", | ||
272 | 114 | "Blur type", | ||
273 | 115 | BLUR_TYPE_UNSET, BLUR_TYPE_ALL, BLUR_TYPE_UNSET, | ||
274 | 116 | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | | ||
275 | 117 | G_PARAM_STATIC_STRINGS); | ||
276 | 118 | |||
277 | 119 | properties[PROP_METACITY_THEME] = | ||
278 | 120 | g_param_spec_string ("metacity-theme", | ||
279 | 121 | "Metacity Theme", | ||
280 | 122 | "Metacity Theme", | ||
281 | 123 | NULL, | ||
282 | 124 | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | | ||
283 | 125 | G_PARAM_STATIC_STRINGS); | ||
284 | 126 | |||
285 | 127 | g_object_class_install_properties (object_class, LAST_PROP, properties); | ||
286 | 128 | } | ||
287 | 129 | |||
288 | 130 | static void | ||
289 | 131 | gwd_application_init (GWDApplication *application) | ||
290 | 132 | { | ||
291 | 133 | } | ||
292 | 134 | |||
293 | 135 | GWDApplication * | ||
294 | 136 | gwd_application_new (gint blur_type, | ||
295 | 137 | const gchar *metacity_theme) | ||
296 | 138 | { | ||
297 | 139 | return g_object_new (GWD_TYPE_APPLICATION, | ||
298 | 140 | "blur-type", blur_type, | ||
299 | 141 | "metacity-theme", metacity_theme, | ||
300 | 142 | NULL); | ||
301 | 143 | } | ||
302 | 144 | |||
303 | 145 | GWDSettings * | ||
304 | 146 | gwd_application_get_settings (GWDApplication *application) | ||
305 | 147 | { | ||
306 | 148 | return application->settings; | ||
307 | 149 | } | ||
308 | 0 | 150 | ||
309 | === added file 'gtk/window-decorator/gwd-application.h' | |||
310 | --- gtk/window-decorator/gwd-application.h 1970-01-01 00:00:00 +0000 | |||
311 | +++ gtk/window-decorator/gwd-application.h 2016-05-27 09:42:08 +0000 | |||
312 | @@ -0,0 +1,40 @@ | |||
313 | 1 | /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*- */ | ||
314 | 2 | |||
315 | 3 | /* | ||
316 | 4 | * Copyright (C) 2016 Alberts Muktupāvels | ||
317 | 5 | * | ||
318 | 6 | * This program is free software; you can redistribute it and/or modify | ||
319 | 7 | * it under the terms of the GNU General Public License as published by | ||
320 | 8 | * the Free Software Foundation; either version 2 of the License, or | ||
321 | 9 | * (at your option) any later version. | ||
322 | 10 | * | ||
323 | 11 | * This program is distributed in the hope that it will be useful, | ||
324 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
325 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
326 | 14 | * GNU General Public License for more details. | ||
327 | 15 | * | ||
328 | 16 | * You should have received a copy of the GNU General Public License | ||
329 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
330 | 18 | */ | ||
331 | 19 | |||
332 | 20 | #ifndef GWD_APPLICATION_H | ||
333 | 21 | #define GWD_APPLICATION_H | ||
334 | 22 | |||
335 | 23 | #include "gwd-settings.h" | ||
336 | 24 | |||
337 | 25 | G_BEGIN_DECLS | ||
338 | 26 | |||
339 | 27 | #define GWD_TYPE_APPLICATION gwd_application_get_type () | ||
340 | 28 | G_DECLARE_FINAL_TYPE (GWDApplication, gwd_application, | ||
341 | 29 | GWD, APPLICATION, GObject) | ||
342 | 30 | |||
343 | 31 | GWDApplication * | ||
344 | 32 | gwd_application_new (gint blur_type, | ||
345 | 33 | const gchar *metacity_theme); | ||
346 | 34 | |||
347 | 35 | GWDSettings * | ||
348 | 36 | gwd_application_get_settings (GWDApplication *application); | ||
349 | 37 | |||
350 | 38 | G_END_DECLS | ||
351 | 39 | |||
352 | 40 | #endif | ||
353 | 0 | 41 | ||
354 | === modified file 'gtk/window-decorator/gwd-theme-cairo.c' | |||
355 | --- gtk/window-decorator/gwd-theme-cairo.c 2016-05-27 09:42:08 +0000 | |||
356 | +++ gtk/window-decorator/gwd-theme-cairo.c 2016-05-27 09:42:08 +0000 | |||
357 | @@ -33,7 +33,18 @@ | |||
358 | 33 | 33 | ||
359 | 34 | struct _GWDThemeCairo | 34 | struct _GWDThemeCairo |
360 | 35 | { | 35 | { |
362 | 36 | GObject parent; | 36 | GObject parent; |
363 | 37 | |||
364 | 38 | GWDSettings *settings; | ||
365 | 39 | }; | ||
366 | 40 | |||
367 | 41 | enum | ||
368 | 42 | { | ||
369 | 43 | PROP_0, | ||
370 | 44 | |||
371 | 45 | PROP_SETTINGS, | ||
372 | 46 | |||
373 | 47 | LAST_PROP | ||
374 | 37 | }; | 48 | }; |
375 | 38 | 49 | ||
376 | 39 | G_DEFINE_TYPE (GWDThemeCairo, gwd_theme_cairo, GWD_TYPE_THEME) | 50 | G_DEFINE_TYPE (GWDThemeCairo, gwd_theme_cairo, GWD_TYPE_THEME) |
377 | @@ -230,6 +241,52 @@ | |||
378 | 230 | } | 241 | } |
379 | 231 | 242 | ||
380 | 232 | static void | 243 | static void |
381 | 244 | gwd_theme_cairo_dispose (GObject *object) | ||
382 | 245 | { | ||
383 | 246 | GWDThemeCairo *cairo = GWD_THEME_CAIRO (object); | ||
384 | 247 | |||
385 | 248 | g_clear_object (&cairo->settings); | ||
386 | 249 | |||
387 | 250 | G_OBJECT_CLASS (gwd_theme_cairo_parent_class)->dispose (object); | ||
388 | 251 | } | ||
389 | 252 | |||
390 | 253 | static void | ||
391 | 254 | gwd_theme_cairo_set_property (GObject *object, | ||
392 | 255 | guint property_id, | ||
393 | 256 | const GValue *value, | ||
394 | 257 | GParamSpec *pspec) | ||
395 | 258 | { | ||
396 | 259 | GWDThemeCairo *cairo = GWD_THEME_CAIRO (object); | ||
397 | 260 | |||
398 | 261 | switch (property_id) { | ||
399 | 262 | case PROP_SETTINGS: | ||
400 | 263 | cairo->settings = g_value_dup_object (value); | ||
401 | 264 | break; | ||
402 | 265 | |||
403 | 266 | default: | ||
404 | 267 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
405 | 268 | break; | ||
406 | 269 | } | ||
407 | 270 | } | ||
408 | 271 | |||
409 | 272 | static void | ||
410 | 273 | gwd_theme_cairo_get_shadow (GWDTheme *theme, | ||
411 | 274 | decor_frame_t *frame, | ||
412 | 275 | decor_shadow_options_t *options, | ||
413 | 276 | gboolean active) | ||
414 | 277 | { | ||
415 | 278 | GWDThemeCairo *cairo = GWD_THEME_CAIRO (theme); | ||
416 | 279 | decor_shadow_options_t shadow; | ||
417 | 280 | |||
418 | 281 | if (active) | ||
419 | 282 | shadow = gwd_settings_get_active_shadow (cairo->settings); | ||
420 | 283 | else | ||
421 | 284 | shadow = gwd_settings_get_inactive_shadow (cairo->settings); | ||
422 | 285 | |||
423 | 286 | memcpy (options, &shadow, sizeof (decor_shadow_options_t)); | ||
424 | 287 | } | ||
425 | 288 | |||
426 | 289 | static void | ||
427 | 233 | gwd_theme_cairo_draw_window_decoration (GWDTheme *theme, | 290 | gwd_theme_cairo_draw_window_decoration (GWDTheme *theme, |
428 | 234 | decor_t *decor) | 291 | decor_t *decor) |
429 | 235 | { | 292 | { |
430 | @@ -750,16 +807,31 @@ | |||
431 | 750 | return TRUE; | 807 | return TRUE; |
432 | 751 | } | 808 | } |
433 | 752 | 809 | ||
434 | 810 | static gfloat | ||
435 | 811 | gwd_theme_cairo_get_title_scale (GWDTheme *theme, | ||
436 | 812 | decor_frame_t *frame) | ||
437 | 813 | { | ||
438 | 814 | return 1.0; | ||
439 | 815 | } | ||
440 | 816 | |||
441 | 753 | static void | 817 | static void |
442 | 754 | gwd_theme_cairo_class_init (GWDThemeCairoClass *cairo_class) | 818 | gwd_theme_cairo_class_init (GWDThemeCairoClass *cairo_class) |
443 | 755 | { | 819 | { |
444 | 820 | GObjectClass *object_class = G_OBJECT_CLASS (cairo_class); | ||
445 | 756 | GWDThemeClass *theme_class = GWD_THEME_CLASS (cairo_class); | 821 | GWDThemeClass *theme_class = GWD_THEME_CLASS (cairo_class); |
446 | 757 | 822 | ||
447 | 823 | object_class->dispose = gwd_theme_cairo_dispose; | ||
448 | 824 | object_class->set_property = gwd_theme_cairo_set_property; | ||
449 | 825 | |||
450 | 826 | theme_class->get_shadow = gwd_theme_cairo_get_shadow; | ||
451 | 758 | theme_class->draw_window_decoration = gwd_theme_cairo_draw_window_decoration; | 827 | theme_class->draw_window_decoration = gwd_theme_cairo_draw_window_decoration; |
452 | 759 | theme_class->calc_decoration_size = gwd_theme_cairo_calc_decoration_size; | 828 | theme_class->calc_decoration_size = gwd_theme_cairo_calc_decoration_size; |
453 | 760 | theme_class->update_border_extents = gwd_theme_cairo_update_border_extents; | 829 | theme_class->update_border_extents = gwd_theme_cairo_update_border_extents; |
454 | 761 | theme_class->get_event_window_position = gwd_theme_cairo_get_event_window_position; | 830 | theme_class->get_event_window_position = gwd_theme_cairo_get_event_window_position; |
455 | 762 | theme_class->get_button_position = gwd_theme_cairo_get_button_position; | 831 | theme_class->get_button_position = gwd_theme_cairo_get_button_position; |
456 | 832 | theme_class->get_title_scale = gwd_theme_cairo_get_title_scale; | ||
457 | 833 | |||
458 | 834 | g_object_class_override_property (object_class, PROP_SETTINGS, "settings"); | ||
459 | 763 | } | 835 | } |
460 | 764 | 836 | ||
461 | 765 | static void | 837 | static void |
462 | 766 | 838 | ||
463 | === modified file 'gtk/window-decorator/gwd-theme-metacity.c' | |||
464 | --- gtk/window-decorator/gwd-theme-metacity.c 2016-05-27 09:42:08 +0000 | |||
465 | +++ gtk/window-decorator/gwd-theme-metacity.c 2016-05-27 09:42:08 +0000 | |||
466 | @@ -37,12 +37,23 @@ | |||
467 | 37 | { | 37 | { |
468 | 38 | GObject parent; | 38 | GObject parent; |
469 | 39 | 39 | ||
470 | 40 | GWDSettings *settings; | ||
471 | 41 | |||
472 | 40 | MetaTheme *theme; | 42 | MetaTheme *theme; |
473 | 41 | 43 | ||
474 | 42 | gulong button_layout_id; | 44 | gulong button_layout_id; |
475 | 43 | MetaButtonLayout button_layout; | 45 | MetaButtonLayout button_layout; |
476 | 44 | }; | 46 | }; |
477 | 45 | 47 | ||
478 | 48 | enum | ||
479 | 49 | { | ||
480 | 50 | PROP_0, | ||
481 | 51 | |||
482 | 52 | PROP_SETTINGS, | ||
483 | 53 | |||
484 | 54 | LAST_PROP | ||
485 | 55 | }; | ||
486 | 56 | |||
487 | 46 | G_DEFINE_TYPE (GWDThemeMetacity, gwd_theme_metacity, GWD_TYPE_THEME) | 57 | G_DEFINE_TYPE (GWDThemeMetacity, gwd_theme_metacity, GWD_TYPE_THEME) |
488 | 47 | 58 | ||
489 | 48 | static void | 59 | static void |
490 | @@ -857,8 +868,7 @@ | |||
491 | 857 | static gboolean | 868 | static gboolean |
492 | 858 | setup_theme (GWDThemeMetacity *metacity) | 869 | setup_theme (GWDThemeMetacity *metacity) |
493 | 859 | { | 870 | { |
496 | 860 | GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity)); | 871 | const gchar *metacity_theme = gwd_settings_get_metacity_theme (metacity->settings); |
495 | 861 | const gchar *metacity_theme = gwd_settings_get_metacity_theme (settings); | ||
497 | 862 | MetaTheme *theme; | 872 | MetaTheme *theme; |
498 | 863 | 873 | ||
499 | 864 | /* metacity_theme can be NULL only in one case - if user has disabled | 874 | /* metacity_theme can be NULL only in one case - if user has disabled |
500 | @@ -890,14 +900,13 @@ | |||
501 | 890 | static void | 900 | static void |
502 | 891 | setup_button_layout (GWDThemeMetacity *metacity) | 901 | setup_button_layout (GWDThemeMetacity *metacity) |
503 | 892 | { | 902 | { |
506 | 893 | GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity)); | 903 | const gchar *button_layout = gwd_settings_get_metacity_button_layout (metacity->settings); |
505 | 894 | const gchar *button_layout = gwd_settings_get_metacity_button_layout (settings); | ||
507 | 895 | 904 | ||
508 | 896 | metacity->button_layout_id = | 905 | metacity->button_layout_id = |
510 | 897 | g_signal_connect (settings, "update-metacity-button-layout", | 906 | g_signal_connect (metacity->settings, "update-metacity-button-layout", |
511 | 898 | G_CALLBACK (update_metacity_button_layout_cb), metacity); | 907 | G_CALLBACK (update_metacity_button_layout_cb), metacity); |
512 | 899 | 908 | ||
514 | 900 | update_metacity_button_layout_cb (settings, button_layout, metacity); | 909 | update_metacity_button_layout_cb (metacity->settings, button_layout, metacity); |
515 | 901 | } | 910 | } |
516 | 902 | 911 | ||
517 | 903 | static void | 912 | static void |
518 | @@ -918,10 +927,10 @@ | |||
519 | 918 | { | 927 | { |
520 | 919 | GWDThemeMetacity *metacity = GWD_THEME_METACITY (object); | 928 | GWDThemeMetacity *metacity = GWD_THEME_METACITY (object); |
521 | 920 | 929 | ||
522 | 930 | g_clear_object (&metacity->settings); | ||
523 | 931 | |||
524 | 921 | if (metacity->button_layout_id != 0) { | 932 | if (metacity->button_layout_id != 0) { |
528 | 922 | GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity)); | 933 | g_signal_handler_disconnect (metacity->settings, metacity->button_layout_id); |
526 | 923 | |||
527 | 924 | g_signal_handler_disconnect (settings, metacity->button_layout_id); | ||
529 | 925 | metacity->button_layout_id = 0; | 934 | metacity->button_layout_id = 0; |
530 | 926 | } | 935 | } |
531 | 927 | 936 | ||
532 | @@ -929,11 +938,46 @@ | |||
533 | 929 | } | 938 | } |
534 | 930 | 939 | ||
535 | 931 | static void | 940 | static void |
536 | 941 | gwd_theme_metacity_set_property (GObject *object, | ||
537 | 942 | guint property_id, | ||
538 | 943 | const GValue *value, | ||
539 | 944 | GParamSpec *pspec) | ||
540 | 945 | { | ||
541 | 946 | GWDThemeMetacity *metacity = GWD_THEME_METACITY (object); | ||
542 | 947 | |||
543 | 948 | switch (property_id) { | ||
544 | 949 | case PROP_SETTINGS: | ||
545 | 950 | metacity->settings = g_value_dup_object (value); | ||
546 | 951 | break; | ||
547 | 952 | |||
548 | 953 | default: | ||
549 | 954 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
550 | 955 | break; | ||
551 | 956 | } | ||
552 | 957 | } | ||
553 | 958 | |||
554 | 959 | static void | ||
555 | 960 | gwd_theme_metacity_get_shadow (GWDTheme *theme, | ||
556 | 961 | decor_frame_t *frame, | ||
557 | 962 | decor_shadow_options_t *options, | ||
558 | 963 | gboolean active) | ||
559 | 964 | { | ||
560 | 965 | GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme); | ||
561 | 966 | decor_shadow_options_t shadow; | ||
562 | 967 | |||
563 | 968 | if (active) | ||
564 | 969 | shadow = gwd_settings_get_active_shadow (metacity->settings); | ||
565 | 970 | else | ||
566 | 971 | shadow = gwd_settings_get_inactive_shadow (metacity->settings); | ||
567 | 972 | |||
568 | 973 | memcpy (options, &shadow, sizeof (decor_shadow_options_t)); | ||
569 | 974 | } | ||
570 | 975 | |||
571 | 976 | static void | ||
572 | 932 | gwd_theme_metacity_draw_window_decoration (GWDTheme *theme, | 977 | gwd_theme_metacity_draw_window_decoration (GWDTheme *theme, |
573 | 933 | decor_t *decor) | 978 | decor_t *decor) |
574 | 934 | { | 979 | { |
575 | 935 | GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme); | 980 | GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme); |
576 | 936 | GWDSettings *settings = gwd_theme_get_settings (gwd_theme); | ||
577 | 937 | GdkDisplay *display; | 981 | GdkDisplay *display; |
578 | 938 | GdkScreen *screen; | 982 | GdkScreen *screen; |
579 | 939 | Display *xdisplay; | 983 | Display *xdisplay; |
580 | @@ -969,11 +1013,11 @@ | |||
581 | 969 | right_region = NULL; | 1013 | right_region = NULL; |
582 | 970 | 1014 | ||
583 | 971 | if (decor->active) { | 1015 | if (decor->active) { |
586 | 972 | alpha = gwd_settings_get_metacity_active_opacity (settings); | 1016 | alpha = gwd_settings_get_metacity_active_opacity (metacity->settings); |
587 | 973 | shade_alpha = gwd_settings_get_metacity_active_shade_opacity (settings); | 1017 | shade_alpha = gwd_settings_get_metacity_active_shade_opacity (metacity->settings); |
588 | 974 | } else { | 1018 | } else { |
591 | 975 | alpha = gwd_settings_get_metacity_inactive_opacity (settings); | 1019 | alpha = gwd_settings_get_metacity_inactive_opacity (metacity->settings); |
592 | 976 | shade_alpha = gwd_settings_get_metacity_inactive_shade_opacity (settings); | 1020 | shade_alpha = gwd_settings_get_metacity_inactive_shade_opacity (metacity->settings); |
593 | 977 | } | 1021 | } |
594 | 978 | 1022 | ||
595 | 979 | if (decoration_alpha == 1.0) | 1023 | if (decoration_alpha == 1.0) |
596 | @@ -1436,13 +1480,17 @@ | |||
597 | 1436 | 1480 | ||
598 | 1437 | object_class->constructed = gwd_theme_metacity_constructed; | 1481 | object_class->constructed = gwd_theme_metacity_constructed; |
599 | 1438 | object_class->dispose = gwd_theme_metacity_dispose; | 1482 | object_class->dispose = gwd_theme_metacity_dispose; |
600 | 1483 | object_class->set_property = gwd_theme_metacity_set_property; | ||
601 | 1439 | 1484 | ||
602 | 1485 | theme_class->get_shadow = gwd_theme_metacity_get_shadow; | ||
603 | 1440 | theme_class->draw_window_decoration = gwd_theme_metacity_draw_window_decoration; | 1486 | theme_class->draw_window_decoration = gwd_theme_metacity_draw_window_decoration; |
604 | 1441 | theme_class->calc_decoration_size = gwd_theme_metacity_calc_decoration_size; | 1487 | theme_class->calc_decoration_size = gwd_theme_metacity_calc_decoration_size; |
605 | 1442 | theme_class->update_border_extents = gwd_theme_metacity_update_border_extents; | 1488 | theme_class->update_border_extents = gwd_theme_metacity_update_border_extents; |
606 | 1443 | theme_class->get_event_window_position = gwd_theme_metacity_get_event_window_position; | 1489 | theme_class->get_event_window_position = gwd_theme_metacity_get_event_window_position; |
607 | 1444 | theme_class->get_button_position = gwd_theme_metacity_get_button_position; | 1490 | theme_class->get_button_position = gwd_theme_metacity_get_button_position; |
608 | 1445 | theme_class->get_title_scale = gwd_theme_metacity_get_title_scale; | 1491 | theme_class->get_title_scale = gwd_theme_metacity_get_title_scale; |
609 | 1492 | |||
610 | 1493 | g_object_class_override_property (object_class, PROP_SETTINGS, "settings"); | ||
611 | 1446 | } | 1494 | } |
612 | 1447 | 1495 | ||
613 | 1448 | static void | 1496 | static void |
614 | 1449 | 1497 | ||
615 | === modified file 'gtk/window-decorator/gwd-theme.c' | |||
616 | --- gtk/window-decorator/gwd-theme.c 2016-05-26 13:33:24 +0000 | |||
617 | +++ gtk/window-decorator/gwd-theme.c 2016-05-27 09:42:08 +0000 | |||
618 | @@ -26,11 +26,6 @@ | |||
619 | 26 | #include "gwd-theme-metacity.h" | 26 | #include "gwd-theme-metacity.h" |
620 | 27 | #endif | 27 | #endif |
621 | 28 | 28 | ||
622 | 29 | typedef struct | ||
623 | 30 | { | ||
624 | 31 | GWDSettings *settings; | ||
625 | 32 | } GWDThemePrivate; | ||
626 | 33 | |||
627 | 34 | enum | 29 | enum |
628 | 35 | { | 30 | { |
629 | 36 | PROP_0, | 31 | PROP_0, |
630 | @@ -42,44 +37,7 @@ | |||
631 | 42 | 37 | ||
632 | 43 | static GParamSpec *properties[LAST_PROP] = { NULL }; | 38 | static GParamSpec *properties[LAST_PROP] = { NULL }; |
633 | 44 | 39 | ||
672 | 45 | G_DEFINE_TYPE_WITH_PRIVATE (GWDTheme, gwd_theme, G_TYPE_OBJECT) | 40 | G_DEFINE_TYPE (GWDTheme, gwd_theme, G_TYPE_OBJECT) |
635 | 46 | |||
636 | 47 | static void | ||
637 | 48 | gwd_theme_dispose (GObject *object) | ||
638 | 49 | { | ||
639 | 50 | GWDTheme *theme; | ||
640 | 51 | GWDThemePrivate *priv; | ||
641 | 52 | |||
642 | 53 | theme = GWD_THEME (object); | ||
643 | 54 | priv = gwd_theme_get_instance_private (theme); | ||
644 | 55 | |||
645 | 56 | g_clear_object (&priv->settings); | ||
646 | 57 | |||
647 | 58 | G_OBJECT_CLASS (gwd_theme_parent_class)->dispose (object); | ||
648 | 59 | } | ||
649 | 60 | |||
650 | 61 | static void | ||
651 | 62 | gwd_theme_get_property (GObject *object, | ||
652 | 63 | guint property_id, | ||
653 | 64 | GValue *value, | ||
654 | 65 | GParamSpec *pspec) | ||
655 | 66 | { | ||
656 | 67 | GWDTheme *theme; | ||
657 | 68 | GWDThemePrivate *priv; | ||
658 | 69 | |||
659 | 70 | theme = GWD_THEME (object); | ||
660 | 71 | priv = gwd_theme_get_instance_private (theme); | ||
661 | 72 | |||
662 | 73 | switch (property_id) { | ||
663 | 74 | case PROP_SETTINGS: | ||
664 | 75 | g_value_set_object (value, priv->settings); | ||
665 | 76 | break; | ||
666 | 77 | |||
667 | 78 | default: | ||
668 | 79 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
669 | 80 | break; | ||
670 | 81 | } | ||
671 | 82 | } | ||
673 | 83 | 41 | ||
674 | 84 | static void | 42 | static void |
675 | 85 | gwd_theme_set_property (GObject *object, | 43 | gwd_theme_set_property (GObject *object, |
676 | @@ -87,15 +45,8 @@ | |||
677 | 87 | const GValue *value, | 45 | const GValue *value, |
678 | 88 | GParamSpec *pspec) | 46 | GParamSpec *pspec) |
679 | 89 | { | 47 | { |
680 | 90 | GWDTheme *theme; | ||
681 | 91 | GWDThemePrivate *priv; | ||
682 | 92 | |||
683 | 93 | theme = GWD_THEME (object); | ||
684 | 94 | priv = gwd_theme_get_instance_private (theme); | ||
685 | 95 | |||
686 | 96 | switch (property_id) { | 48 | switch (property_id) { |
687 | 97 | case PROP_SETTINGS: | 49 | case PROP_SETTINGS: |
688 | 98 | priv->settings = g_value_dup_object (value); | ||
689 | 99 | break; | 50 | break; |
690 | 100 | 51 | ||
691 | 101 | default: | 52 | default: |
692 | @@ -110,23 +61,17 @@ | |||
693 | 110 | decor_shadow_options_t *options, | 61 | decor_shadow_options_t *options, |
694 | 111 | gboolean active) | 62 | gboolean active) |
695 | 112 | { | 63 | { |
707 | 113 | GWDThemePrivate *priv; | 64 | g_critical ("GWDThemeClass::get_shadow not implemented for '%s'", |
708 | 114 | decor_shadow_options_t shadow; | 65 | g_type_name (G_TYPE_FROM_INSTANCE (theme))); |
698 | 115 | |||
699 | 116 | priv = gwd_theme_get_instance_private (theme); | ||
700 | 117 | |||
701 | 118 | if (active) | ||
702 | 119 | shadow = gwd_settings_get_active_shadow (priv->settings); | ||
703 | 120 | else | ||
704 | 121 | shadow = gwd_settings_get_inactive_shadow (priv->settings); | ||
705 | 122 | |||
706 | 123 | memcpy (options, &shadow, sizeof (decor_shadow_options_t)); | ||
709 | 124 | } | 66 | } |
710 | 125 | 67 | ||
711 | 126 | static void | 68 | static void |
712 | 127 | gwd_theme_real_draw_window_decoration (GWDTheme *theme, | 69 | gwd_theme_real_draw_window_decoration (GWDTheme *theme, |
713 | 128 | decor_t *decor) | 70 | decor_t *decor) |
714 | 129 | { | 71 | { |
715 | 72 | g_critical ("GWDThemeClass::draw_window_decoration not implemented for '%s'", | ||
716 | 73 | g_type_name (G_TYPE_FROM_INSTANCE (theme))); | ||
717 | 74 | |||
718 | 130 | } | 75 | } |
719 | 131 | 76 | ||
720 | 132 | static gboolean | 77 | static gboolean |
721 | @@ -138,6 +83,9 @@ | |||
722 | 138 | gint *width, | 83 | gint *width, |
723 | 139 | gint *height) | 84 | gint *height) |
724 | 140 | { | 85 | { |
725 | 86 | g_critical ("GWDThemeClass::calc_decoration_size not implemented for '%s'", | ||
726 | 87 | g_type_name (G_TYPE_FROM_INSTANCE (theme))); | ||
727 | 88 | |||
728 | 141 | return FALSE; | 89 | return FALSE; |
729 | 142 | } | 90 | } |
730 | 143 | 91 | ||
731 | @@ -145,6 +93,8 @@ | |||
732 | 145 | gwd_theme_real_update_border_extents (GWDTheme *theme, | 93 | gwd_theme_real_update_border_extents (GWDTheme *theme, |
733 | 146 | decor_frame_t *frame) | 94 | decor_frame_t *frame) |
734 | 147 | { | 95 | { |
735 | 96 | g_critical ("GWDThemeClass::update_border_extents not implemented for '%s'", | ||
736 | 97 | g_type_name (G_TYPE_FROM_INSTANCE (theme))); | ||
737 | 148 | } | 98 | } |
738 | 149 | 99 | ||
739 | 150 | static void | 100 | static void |
740 | @@ -159,6 +109,8 @@ | |||
741 | 159 | gint *w, | 109 | gint *w, |
742 | 160 | gint *h) | 110 | gint *h) |
743 | 161 | { | 111 | { |
744 | 112 | g_critical ("GWDThemeClass::get_event_window_position not implemented for '%s'", | ||
745 | 113 | g_type_name (G_TYPE_FROM_INSTANCE (theme))); | ||
746 | 162 | } | 114 | } |
747 | 163 | 115 | ||
748 | 164 | static gboolean | 116 | static gboolean |
749 | @@ -172,6 +124,9 @@ | |||
750 | 172 | gint *w, | 124 | gint *w, |
751 | 173 | gint *h) | 125 | gint *h) |
752 | 174 | { | 126 | { |
753 | 127 | g_critical ("GWDThemeClass::get_button_position not implemented for '%s'", | ||
754 | 128 | g_type_name (G_TYPE_FROM_INSTANCE (theme))); | ||
755 | 129 | |||
756 | 175 | return FALSE; | 130 | return FALSE; |
757 | 176 | } | 131 | } |
758 | 177 | 132 | ||
759 | @@ -179,6 +134,9 @@ | |||
760 | 179 | gwd_theme_real_get_title_scale (GWDTheme *theme, | 134 | gwd_theme_real_get_title_scale (GWDTheme *theme, |
761 | 180 | decor_frame_t *frame) | 135 | decor_frame_t *frame) |
762 | 181 | { | 136 | { |
763 | 137 | g_critical ("GWDThemeClass::get_title_scale not implemented for '%s'", | ||
764 | 138 | g_type_name (G_TYPE_FROM_INSTANCE (theme))); | ||
765 | 139 | |||
766 | 182 | return 1.0; | 140 | return 1.0; |
767 | 183 | } | 141 | } |
768 | 184 | 142 | ||
769 | @@ -189,8 +147,6 @@ | |||
770 | 189 | 147 | ||
771 | 190 | object_class = G_OBJECT_CLASS (theme_class); | 148 | object_class = G_OBJECT_CLASS (theme_class); |
772 | 191 | 149 | ||
773 | 192 | object_class->dispose = gwd_theme_dispose; | ||
774 | 193 | object_class->get_property = gwd_theme_get_property; | ||
775 | 194 | object_class->set_property = gwd_theme_set_property; | 150 | object_class->set_property = gwd_theme_set_property; |
776 | 195 | 151 | ||
777 | 196 | theme_class->get_shadow = gwd_theme_real_get_shadow; | 152 | theme_class->get_shadow = gwd_theme_real_get_shadow; |
778 | @@ -204,7 +160,7 @@ | |||
779 | 204 | properties[PROP_SETTINGS] = | 160 | properties[PROP_SETTINGS] = |
780 | 205 | g_param_spec_object ("settings", "GWDSettings", "GWDSettings", | 161 | g_param_spec_object ("settings", "GWDSettings", "GWDSettings", |
781 | 206 | GWD_TYPE_SETTINGS, | 162 | GWD_TYPE_SETTINGS, |
783 | 207 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | | 163 | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | |
784 | 208 | G_PARAM_STATIC_STRINGS); | 164 | G_PARAM_STATIC_STRINGS); |
785 | 209 | 165 | ||
786 | 210 | g_object_class_install_properties (object_class, LAST_PROP, properties); | 166 | g_object_class_install_properties (object_class, LAST_PROP, properties); |
787 | @@ -248,16 +204,6 @@ | |||
788 | 248 | NULL); | 204 | NULL); |
789 | 249 | } | 205 | } |
790 | 250 | 206 | ||
791 | 251 | GWDSettings * | ||
792 | 252 | gwd_theme_get_settings (GWDTheme *theme) | ||
793 | 253 | { | ||
794 | 254 | GWDThemePrivate *priv; | ||
795 | 255 | |||
796 | 256 | priv = gwd_theme_get_instance_private (theme); | ||
797 | 257 | |||
798 | 258 | return priv->settings; | ||
799 | 259 | } | ||
800 | 260 | |||
801 | 261 | void | 207 | void |
802 | 262 | gwd_theme_get_shadow (GWDTheme *theme, | 208 | gwd_theme_get_shadow (GWDTheme *theme, |
803 | 263 | decor_frame_t *frame, | 209 | decor_frame_t *frame, |
804 | 264 | 210 | ||
805 | === modified file 'gtk/window-decorator/gwd-theme.h' | |||
806 | --- gtk/window-decorator/gwd-theme.h 2016-05-20 11:56:36 +0000 | |||
807 | +++ gtk/window-decorator/gwd-theme.h 2016-05-27 09:42:08 +0000 | |||
808 | @@ -27,7 +27,6 @@ | |||
809 | 27 | 27 | ||
810 | 28 | typedef struct _decor decor_t; | 28 | typedef struct _decor decor_t; |
811 | 29 | typedef struct _decor_frame decor_frame_t; | 29 | typedef struct _decor_frame decor_frame_t; |
812 | 30 | typedef struct _GWDSettings GWDSettings; | ||
813 | 31 | 30 | ||
814 | 32 | #define GWD_TYPE_THEME gwd_theme_get_type () | 31 | #define GWD_TYPE_THEME gwd_theme_get_type () |
815 | 33 | G_DECLARE_DERIVABLE_TYPE (GWDTheme, gwd_theme, GWD, THEME, GObject) | 32 | G_DECLARE_DERIVABLE_TYPE (GWDTheme, gwd_theme, GWD, THEME, GObject) |
816 | @@ -90,9 +89,6 @@ | |||
817 | 90 | gwd_theme_new (GWDThemeType type, | 89 | gwd_theme_new (GWDThemeType type, |
818 | 91 | GWDSettings *settings); | 90 | GWDSettings *settings); |
819 | 92 | 91 | ||
820 | 93 | GWDSettings * | ||
821 | 94 | gwd_theme_get_settings (GWDTheme *theme); | ||
822 | 95 | |||
823 | 96 | void | 92 | void |
824 | 97 | gwd_theme_get_shadow (GWDTheme *theme, | 93 | gwd_theme_get_shadow (GWDTheme *theme, |
825 | 98 | decor_frame_t *frame, | 94 | decor_frame_t *frame, |
826 | 99 | 95 | ||
827 | === modified file 'gtk/window-decorator/wnck.c' | |||
828 | --- gtk/window-decorator/wnck.c 2016-05-27 09:42:08 +0000 | |||
829 | +++ gtk/window-decorator/wnck.c 2016-05-27 09:42:08 +0000 | |||
830 | @@ -190,7 +190,7 @@ | |||
831 | 190 | gdkdisplay = gdk_display_get_default (); | 190 | gdkdisplay = gdk_display_get_default (); |
832 | 191 | gdkscreen = gdk_display_get_default_screen (gdkdisplay); | 191 | gdkscreen = gdk_display_get_default_screen (gdkdisplay); |
833 | 192 | 192 | ||
835 | 193 | GWDSettings *settings = gwd_theme_get_settings (gwd_theme); | 193 | GWDSettings *settings = gwd_application_get_settings (application); |
836 | 194 | const gchar *titlebar_font = gwd_settings_get_titlebar_font (settings); | 194 | const gchar *titlebar_font = gwd_settings_get_titlebar_font (settings); |
837 | 195 | 195 | ||
838 | 196 | gwd_frames_foreach (set_frames_scales, (gpointer) titlebar_font); | 196 | gwd_frames_foreach (set_frames_scales, (gpointer) titlebar_font); |
See diff comments (use after free).
I don't quite understand the purpose of this abstraction either. Could you add a little more detail in the description of the change or the commit message explaining the need to create a GWDApplication? It seems to me like we just moved parts of GWDTheme over to it.