Merge lp:~muktupavels/compiz/add-gwd-application-v3 into lp:compiz/0.9.12

Proposed by Alberts Muktupāvels
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
Reviewer Review Type Date Requested Status
Sam Spilsbury Needs Fixing
Review via email: mp+295921@code.launchpad.net

Commit message

gtk-window-decorator: add GWDApplication.

Description of the change

gtk-window-decorator: add GWDApplication.

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) 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.

review: Needs Fixing
Revision history for this message
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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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 util.c
6 wnck.c
7 decorator.c
8+ ${CMAKE_CURRENT_SOURCE_DIR}/gwd-application.c
9 ${CMAKE_CURRENT_SOURCE_DIR}/gwd-settings-xproperty-storage.c
10 ${CMAKE_CURRENT_SOURCE_DIR}/gwd-theme.c
11 ${CMAKE_CURRENT_SOURCE_DIR}/gwd-theme-cairo.c
12
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 Region right_region,
18 int right_offset)
19 {
20- GWDSettings *settings = gwd_theme_get_settings (gwd_theme);
21+ GWDSettings *settings = gwd_application_get_settings (application);
22 gint blur_type = gwd_settings_get_blur_type (settings);
23 Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
24 long *data = NULL;
25
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 static const PangoFontDescription *
31 get_titlebar_font (decor_frame_t *frame)
32 {
33- GWDSettings *settings = gwd_theme_get_settings (gwd_theme);
34+ GWDSettings *settings = gwd_application_get_settings (application);
35 const gchar *titlebar_font = gwd_settings_get_titlebar_font (settings);
36
37 /* Using system font */
38
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 int max,
44 char *tooltip)
45 {
46- GWDSettings *settings = gwd_theme_get_settings (gwd_theme);
47+ GWDSettings *settings = gwd_application_get_settings (application);
48 gboolean use_tooltips = gwd_settings_get_use_tooltips (settings);
49 decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
50 guint state = d->button_states[button];
51@@ -448,7 +448,7 @@
52 handle_mouse_wheel_title_event (WnckWindow *win,
53 unsigned int button)
54 {
55- GWDSettings *settings = gwd_theme_get_settings (gwd_theme);
56+ GWDSettings *settings = gwd_application_get_settings (application);
57 gint wheel_action = gwd_settings_get_mouse_wheel_action (settings);
58
59 switch (wheel_action) {
60@@ -474,7 +474,7 @@
61 decor_event *gtkwd_event,
62 decor_event_type gtkwd_type)
63 {
64- GWDSettings *settings = gwd_theme_get_settings (gwd_theme);
65+ GWDSettings *settings = gwd_application_get_settings (application);
66 static Window last_button_xwindow = None;
67 static Time last_button_time = 0;
68 gint titlebar_action = 0;
69@@ -541,7 +541,7 @@
70 decor_event *gtkwd_event,
71 decor_event_type gtkwd_type)
72 {
73- GWDSettings *settings = gwd_theme_get_settings (gwd_theme);
74+ GWDSettings *settings = gwd_application_get_settings (application);
75 gint titlebar_action = 0;
76
77 if (gtkwd_type != GButtonPress)
78
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 void
84 decor_frame_refresh (decor_frame_t *frame)
85 {
86- GWDSettings *settings = gwd_theme_get_settings (gwd_theme);
87+ GWDSettings *settings = gwd_application_get_settings (application);
88 const gchar *titlebar_font = gwd_settings_get_titlebar_font (settings);
89 decor_shadow_options_t active_o, inactive_o;
90 decor_shadow_info_t *info;
91
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 #include "gtk-window-decorator.h"
97 #include "gwd-settings.h"
98
99+GWDApplication *application;
100 GWDTheme *gwd_theme;
101
102 gdouble decoration_alpha = 0.5;
103@@ -302,10 +303,8 @@
104
105 initialize_decorations ();
106
107- settings = gwd_settings_new (option_blur_type, option_meta_theme);
108-
109- if (!settings)
110- return 1;
111+ application = gwd_application_new (option_blur_type, option_meta_theme);
112+ settings = gwd_application_get_settings (application);
113
114 g_signal_connect (settings, "update-decorations",
115 G_CALLBACK (update_decorations_cb), NULL);
116@@ -334,7 +333,7 @@
117
118 if (!create_tooltip_window ())
119 {
120- g_object_unref (settings);
121+ g_object_unref (application);
122
123 fprintf (stderr, "%s, Couldn't create tooltip window\n", argv[0]);
124 return 1;
125@@ -418,7 +417,7 @@
126
127 g_clear_object (&gwd_theme);
128 fini_settings ();
129- g_clear_object (&settings);
130+ g_clear_object (&application);
131
132 return 0;
133 }
134
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 #define _(x) gettext (x)
140 #define N_(x) x
141
142+#include "gwd-application.h"
143 #include "gwd-theme.h"
144
145 extern const unsigned short ICON_SPACE;
146@@ -90,6 +91,7 @@
147
148 extern gboolean minimal;
149
150+extern GWDApplication *application;
151 extern GWDTheme *gwd_theme;
152
153 extern gdouble decoration_alpha;
154
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+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*- */
160+
161+/*
162+ * Copyright (C) 2016 Alberts Muktupāvels
163+ *
164+ * This program is free software; you can redistribute it and/or modify
165+ * it under the terms of the GNU General Public License as published by
166+ * the Free Software Foundation; either version 2 of the License, or
167+ * (at your option) any later version.
168+ *
169+ * This program is distributed in the hope that it will be useful,
170+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
171+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
172+ * GNU General Public License for more details.
173+ *
174+ * You should have received a copy of the GNU General Public License
175+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
176+ */
177+
178+#include "config.h"
179+#include "gwd-application.h"
180+
181+struct _GWDApplication
182+{
183+ GObject parent;
184+
185+ gint blur_type;
186+ gchar *metacity_theme;
187+
188+ GWDSettings *settings;
189+};
190+
191+enum
192+{
193+ PROP_0,
194+
195+ PROP_BLUR_TYPE,
196+ PROP_METACITY_THEME,
197+
198+ LAST_PROP
199+};
200+
201+static GParamSpec *properties[LAST_PROP] = { NULL };
202+
203+G_DEFINE_TYPE (GWDApplication, gwd_application, G_TYPE_OBJECT)
204+
205+static void
206+gwd_application_constructed (GObject *object)
207+{
208+ GWDApplication *application = GWD_APPLICATION (object);
209+
210+ G_OBJECT_CLASS (gwd_application_parent_class)->constructed (object);
211+
212+ application->settings = gwd_settings_new (application->blur_type,
213+ application->metacity_theme);
214+}
215+
216+static void
217+gwd_application_dispose (GObject *object)
218+{
219+ GWDApplication *application = GWD_APPLICATION (object);
220+
221+ g_clear_object (&application->settings);
222+
223+ G_OBJECT_CLASS (gwd_application_parent_class)->dispose (object);
224+}
225+
226+static void
227+gwd_application_finalize (GObject *object)
228+{
229+ GWDApplication *application = GWD_APPLICATION (object);
230+
231+ g_clear_pointer (&application->metacity_theme, g_free);
232+
233+ G_OBJECT_CLASS (gwd_application_parent_class)->finalize (object);
234+}
235+
236+static void
237+gwd_application_set_property (GObject *object,
238+ guint property_id,
239+ const GValue *value,
240+ GParamSpec *pspec)
241+{
242+ GWDApplication *application = GWD_APPLICATION (object);
243+
244+ switch (property_id) {
245+ case PROP_BLUR_TYPE:
246+ application->blur_type = g_value_get_int (value);
247+ break;
248+
249+ case PROP_METACITY_THEME:
250+ application->metacity_theme = g_value_dup_string (value);
251+ break;
252+
253+ default:
254+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
255+ break;
256+ }
257+}
258+
259+static void
260+gwd_application_class_init (GWDApplicationClass *application_class)
261+{
262+ GObjectClass *object_class = G_OBJECT_CLASS (application_class);
263+
264+ object_class->constructed = gwd_application_constructed;
265+ object_class->dispose = gwd_application_dispose;
266+ object_class->finalize = gwd_application_finalize;
267+ object_class->set_property = gwd_application_set_property;
268+
269+ properties[PROP_BLUR_TYPE] =
270+ g_param_spec_int ("blur-type",
271+ "Blur Type",
272+ "Blur type",
273+ BLUR_TYPE_UNSET, BLUR_TYPE_ALL, BLUR_TYPE_UNSET,
274+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
275+ G_PARAM_STATIC_STRINGS);
276+
277+ properties[PROP_METACITY_THEME] =
278+ g_param_spec_string ("metacity-theme",
279+ "Metacity Theme",
280+ "Metacity Theme",
281+ NULL,
282+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
283+ G_PARAM_STATIC_STRINGS);
284+
285+ g_object_class_install_properties (object_class, LAST_PROP, properties);
286+}
287+
288+static void
289+gwd_application_init (GWDApplication *application)
290+{
291+}
292+
293+GWDApplication *
294+gwd_application_new (gint blur_type,
295+ const gchar *metacity_theme)
296+{
297+ return g_object_new (GWD_TYPE_APPLICATION,
298+ "blur-type", blur_type,
299+ "metacity-theme", metacity_theme,
300+ NULL);
301+}
302+
303+GWDSettings *
304+gwd_application_get_settings (GWDApplication *application)
305+{
306+ return application->settings;
307+}
308
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+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*- */
314+
315+/*
316+ * Copyright (C) 2016 Alberts Muktupāvels
317+ *
318+ * This program is free software; you can redistribute it and/or modify
319+ * it under the terms of the GNU General Public License as published by
320+ * the Free Software Foundation; either version 2 of the License, or
321+ * (at your option) any later version.
322+ *
323+ * This program is distributed in the hope that it will be useful,
324+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
325+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
326+ * GNU General Public License for more details.
327+ *
328+ * You should have received a copy of the GNU General Public License
329+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
330+ */
331+
332+#ifndef GWD_APPLICATION_H
333+#define GWD_APPLICATION_H
334+
335+#include "gwd-settings.h"
336+
337+G_BEGIN_DECLS
338+
339+#define GWD_TYPE_APPLICATION gwd_application_get_type ()
340+G_DECLARE_FINAL_TYPE (GWDApplication, gwd_application,
341+ GWD, APPLICATION, GObject)
342+
343+GWDApplication *
344+gwd_application_new (gint blur_type,
345+ const gchar *metacity_theme);
346+
347+GWDSettings *
348+gwd_application_get_settings (GWDApplication *application);
349+
350+G_END_DECLS
351+
352+#endif
353
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
359 struct _GWDThemeCairo
360 {
361- GObject parent;
362+ GObject parent;
363+
364+ GWDSettings *settings;
365+};
366+
367+enum
368+{
369+ PROP_0,
370+
371+ PROP_SETTINGS,
372+
373+ LAST_PROP
374 };
375
376 G_DEFINE_TYPE (GWDThemeCairo, gwd_theme_cairo, GWD_TYPE_THEME)
377@@ -230,6 +241,52 @@
378 }
379
380 static void
381+gwd_theme_cairo_dispose (GObject *object)
382+{
383+ GWDThemeCairo *cairo = GWD_THEME_CAIRO (object);
384+
385+ g_clear_object (&cairo->settings);
386+
387+ G_OBJECT_CLASS (gwd_theme_cairo_parent_class)->dispose (object);
388+}
389+
390+static void
391+gwd_theme_cairo_set_property (GObject *object,
392+ guint property_id,
393+ const GValue *value,
394+ GParamSpec *pspec)
395+{
396+ GWDThemeCairo *cairo = GWD_THEME_CAIRO (object);
397+
398+ switch (property_id) {
399+ case PROP_SETTINGS:
400+ cairo->settings = g_value_dup_object (value);
401+ break;
402+
403+ default:
404+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
405+ break;
406+ }
407+}
408+
409+static void
410+gwd_theme_cairo_get_shadow (GWDTheme *theme,
411+ decor_frame_t *frame,
412+ decor_shadow_options_t *options,
413+ gboolean active)
414+{
415+ GWDThemeCairo *cairo = GWD_THEME_CAIRO (theme);
416+ decor_shadow_options_t shadow;
417+
418+ if (active)
419+ shadow = gwd_settings_get_active_shadow (cairo->settings);
420+ else
421+ shadow = gwd_settings_get_inactive_shadow (cairo->settings);
422+
423+ memcpy (options, &shadow, sizeof (decor_shadow_options_t));
424+}
425+
426+static void
427 gwd_theme_cairo_draw_window_decoration (GWDTheme *theme,
428 decor_t *decor)
429 {
430@@ -750,16 +807,31 @@
431 return TRUE;
432 }
433
434+static gfloat
435+gwd_theme_cairo_get_title_scale (GWDTheme *theme,
436+ decor_frame_t *frame)
437+{
438+ return 1.0;
439+}
440+
441 static void
442 gwd_theme_cairo_class_init (GWDThemeCairoClass *cairo_class)
443 {
444+ GObjectClass *object_class = G_OBJECT_CLASS (cairo_class);
445 GWDThemeClass *theme_class = GWD_THEME_CLASS (cairo_class);
446
447+ object_class->dispose = gwd_theme_cairo_dispose;
448+ object_class->set_property = gwd_theme_cairo_set_property;
449+
450+ theme_class->get_shadow = gwd_theme_cairo_get_shadow;
451 theme_class->draw_window_decoration = gwd_theme_cairo_draw_window_decoration;
452 theme_class->calc_decoration_size = gwd_theme_cairo_calc_decoration_size;
453 theme_class->update_border_extents = gwd_theme_cairo_update_border_extents;
454 theme_class->get_event_window_position = gwd_theme_cairo_get_event_window_position;
455 theme_class->get_button_position = gwd_theme_cairo_get_button_position;
456+ theme_class->get_title_scale = gwd_theme_cairo_get_title_scale;
457+
458+ g_object_class_override_property (object_class, PROP_SETTINGS, "settings");
459 }
460
461 static void
462
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 {
468 GObject parent;
469
470+ GWDSettings *settings;
471+
472 MetaTheme *theme;
473
474 gulong button_layout_id;
475 MetaButtonLayout button_layout;
476 };
477
478+enum
479+{
480+ PROP_0,
481+
482+ PROP_SETTINGS,
483+
484+ LAST_PROP
485+};
486+
487 G_DEFINE_TYPE (GWDThemeMetacity, gwd_theme_metacity, GWD_TYPE_THEME)
488
489 static void
490@@ -857,8 +868,7 @@
491 static gboolean
492 setup_theme (GWDThemeMetacity *metacity)
493 {
494- GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity));
495- const gchar *metacity_theme = gwd_settings_get_metacity_theme (settings);
496+ const gchar *metacity_theme = gwd_settings_get_metacity_theme (metacity->settings);
497 MetaTheme *theme;
498
499 /* metacity_theme can be NULL only in one case - if user has disabled
500@@ -890,14 +900,13 @@
501 static void
502 setup_button_layout (GWDThemeMetacity *metacity)
503 {
504- GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity));
505- const gchar *button_layout = gwd_settings_get_metacity_button_layout (settings);
506+ const gchar *button_layout = gwd_settings_get_metacity_button_layout (metacity->settings);
507
508 metacity->button_layout_id =
509- g_signal_connect (settings, "update-metacity-button-layout",
510+ g_signal_connect (metacity->settings, "update-metacity-button-layout",
511 G_CALLBACK (update_metacity_button_layout_cb), metacity);
512
513- update_metacity_button_layout_cb (settings, button_layout, metacity);
514+ update_metacity_button_layout_cb (metacity->settings, button_layout, metacity);
515 }
516
517 static void
518@@ -918,10 +927,10 @@
519 {
520 GWDThemeMetacity *metacity = GWD_THEME_METACITY (object);
521
522+ g_clear_object (&metacity->settings);
523+
524 if (metacity->button_layout_id != 0) {
525- GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity));
526-
527- g_signal_handler_disconnect (settings, metacity->button_layout_id);
528+ g_signal_handler_disconnect (metacity->settings, metacity->button_layout_id);
529 metacity->button_layout_id = 0;
530 }
531
532@@ -929,11 +938,46 @@
533 }
534
535 static void
536+gwd_theme_metacity_set_property (GObject *object,
537+ guint property_id,
538+ const GValue *value,
539+ GParamSpec *pspec)
540+{
541+ GWDThemeMetacity *metacity = GWD_THEME_METACITY (object);
542+
543+ switch (property_id) {
544+ case PROP_SETTINGS:
545+ metacity->settings = g_value_dup_object (value);
546+ break;
547+
548+ default:
549+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
550+ break;
551+ }
552+}
553+
554+static void
555+gwd_theme_metacity_get_shadow (GWDTheme *theme,
556+ decor_frame_t *frame,
557+ decor_shadow_options_t *options,
558+ gboolean active)
559+{
560+ GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);
561+ decor_shadow_options_t shadow;
562+
563+ if (active)
564+ shadow = gwd_settings_get_active_shadow (metacity->settings);
565+ else
566+ shadow = gwd_settings_get_inactive_shadow (metacity->settings);
567+
568+ memcpy (options, &shadow, sizeof (decor_shadow_options_t));
569+}
570+
571+static void
572 gwd_theme_metacity_draw_window_decoration (GWDTheme *theme,
573 decor_t *decor)
574 {
575 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);
576- GWDSettings *settings = gwd_theme_get_settings (gwd_theme);
577 GdkDisplay *display;
578 GdkScreen *screen;
579 Display *xdisplay;
580@@ -969,11 +1013,11 @@
581 right_region = NULL;
582
583 if (decor->active) {
584- alpha = gwd_settings_get_metacity_active_opacity (settings);
585- shade_alpha = gwd_settings_get_metacity_active_shade_opacity (settings);
586+ alpha = gwd_settings_get_metacity_active_opacity (metacity->settings);
587+ shade_alpha = gwd_settings_get_metacity_active_shade_opacity (metacity->settings);
588 } else {
589- alpha = gwd_settings_get_metacity_inactive_opacity (settings);
590- shade_alpha = gwd_settings_get_metacity_inactive_shade_opacity (settings);
591+ alpha = gwd_settings_get_metacity_inactive_opacity (metacity->settings);
592+ shade_alpha = gwd_settings_get_metacity_inactive_shade_opacity (metacity->settings);
593 }
594
595 if (decoration_alpha == 1.0)
596@@ -1436,13 +1480,17 @@
597
598 object_class->constructed = gwd_theme_metacity_constructed;
599 object_class->dispose = gwd_theme_metacity_dispose;
600+ object_class->set_property = gwd_theme_metacity_set_property;
601
602+ theme_class->get_shadow = gwd_theme_metacity_get_shadow;
603 theme_class->draw_window_decoration = gwd_theme_metacity_draw_window_decoration;
604 theme_class->calc_decoration_size = gwd_theme_metacity_calc_decoration_size;
605 theme_class->update_border_extents = gwd_theme_metacity_update_border_extents;
606 theme_class->get_event_window_position = gwd_theme_metacity_get_event_window_position;
607 theme_class->get_button_position = gwd_theme_metacity_get_button_position;
608 theme_class->get_title_scale = gwd_theme_metacity_get_title_scale;
609+
610+ g_object_class_override_property (object_class, PROP_SETTINGS, "settings");
611 }
612
613 static void
614
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 #include "gwd-theme-metacity.h"
620 #endif
621
622-typedef struct
623-{
624- GWDSettings *settings;
625-} GWDThemePrivate;
626-
627 enum
628 {
629 PROP_0,
630@@ -42,44 +37,7 @@
631
632 static GParamSpec *properties[LAST_PROP] = { NULL };
633
634-G_DEFINE_TYPE_WITH_PRIVATE (GWDTheme, gwd_theme, G_TYPE_OBJECT)
635-
636-static void
637-gwd_theme_dispose (GObject *object)
638-{
639- GWDTheme *theme;
640- GWDThemePrivate *priv;
641-
642- theme = GWD_THEME (object);
643- priv = gwd_theme_get_instance_private (theme);
644-
645- g_clear_object (&priv->settings);
646-
647- G_OBJECT_CLASS (gwd_theme_parent_class)->dispose (object);
648-}
649-
650-static void
651-gwd_theme_get_property (GObject *object,
652- guint property_id,
653- GValue *value,
654- GParamSpec *pspec)
655-{
656- GWDTheme *theme;
657- GWDThemePrivate *priv;
658-
659- theme = GWD_THEME (object);
660- priv = gwd_theme_get_instance_private (theme);
661-
662- switch (property_id) {
663- case PROP_SETTINGS:
664- g_value_set_object (value, priv->settings);
665- break;
666-
667- default:
668- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
669- break;
670- }
671-}
672+G_DEFINE_TYPE (GWDTheme, gwd_theme, G_TYPE_OBJECT)
673
674 static void
675 gwd_theme_set_property (GObject *object,
676@@ -87,15 +45,8 @@
677 const GValue *value,
678 GParamSpec *pspec)
679 {
680- GWDTheme *theme;
681- GWDThemePrivate *priv;
682-
683- theme = GWD_THEME (object);
684- priv = gwd_theme_get_instance_private (theme);
685-
686 switch (property_id) {
687 case PROP_SETTINGS:
688- priv->settings = g_value_dup_object (value);
689 break;
690
691 default:
692@@ -110,23 +61,17 @@
693 decor_shadow_options_t *options,
694 gboolean active)
695 {
696- GWDThemePrivate *priv;
697- decor_shadow_options_t shadow;
698-
699- priv = gwd_theme_get_instance_private (theme);
700-
701- if (active)
702- shadow = gwd_settings_get_active_shadow (priv->settings);
703- else
704- shadow = gwd_settings_get_inactive_shadow (priv->settings);
705-
706- memcpy (options, &shadow, sizeof (decor_shadow_options_t));
707+ g_critical ("GWDThemeClass::get_shadow not implemented for '%s'",
708+ g_type_name (G_TYPE_FROM_INSTANCE (theme)));
709 }
710
711 static void
712 gwd_theme_real_draw_window_decoration (GWDTheme *theme,
713 decor_t *decor)
714 {
715+ g_critical ("GWDThemeClass::draw_window_decoration not implemented for '%s'",
716+ g_type_name (G_TYPE_FROM_INSTANCE (theme)));
717+
718 }
719
720 static gboolean
721@@ -138,6 +83,9 @@
722 gint *width,
723 gint *height)
724 {
725+ g_critical ("GWDThemeClass::calc_decoration_size not implemented for '%s'",
726+ g_type_name (G_TYPE_FROM_INSTANCE (theme)));
727+
728 return FALSE;
729 }
730
731@@ -145,6 +93,8 @@
732 gwd_theme_real_update_border_extents (GWDTheme *theme,
733 decor_frame_t *frame)
734 {
735+ g_critical ("GWDThemeClass::update_border_extents not implemented for '%s'",
736+ g_type_name (G_TYPE_FROM_INSTANCE (theme)));
737 }
738
739 static void
740@@ -159,6 +109,8 @@
741 gint *w,
742 gint *h)
743 {
744+ g_critical ("GWDThemeClass::get_event_window_position not implemented for '%s'",
745+ g_type_name (G_TYPE_FROM_INSTANCE (theme)));
746 }
747
748 static gboolean
749@@ -172,6 +124,9 @@
750 gint *w,
751 gint *h)
752 {
753+ g_critical ("GWDThemeClass::get_button_position not implemented for '%s'",
754+ g_type_name (G_TYPE_FROM_INSTANCE (theme)));
755+
756 return FALSE;
757 }
758
759@@ -179,6 +134,9 @@
760 gwd_theme_real_get_title_scale (GWDTheme *theme,
761 decor_frame_t *frame)
762 {
763+ g_critical ("GWDThemeClass::get_title_scale not implemented for '%s'",
764+ g_type_name (G_TYPE_FROM_INSTANCE (theme)));
765+
766 return 1.0;
767 }
768
769@@ -189,8 +147,6 @@
770
771 object_class = G_OBJECT_CLASS (theme_class);
772
773- object_class->dispose = gwd_theme_dispose;
774- object_class->get_property = gwd_theme_get_property;
775 object_class->set_property = gwd_theme_set_property;
776
777 theme_class->get_shadow = gwd_theme_real_get_shadow;
778@@ -204,7 +160,7 @@
779 properties[PROP_SETTINGS] =
780 g_param_spec_object ("settings", "GWDSettings", "GWDSettings",
781 GWD_TYPE_SETTINGS,
782- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
783+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
784 G_PARAM_STATIC_STRINGS);
785
786 g_object_class_install_properties (object_class, LAST_PROP, properties);
787@@ -248,16 +204,6 @@
788 NULL);
789 }
790
791-GWDSettings *
792-gwd_theme_get_settings (GWDTheme *theme)
793-{
794- GWDThemePrivate *priv;
795-
796- priv = gwd_theme_get_instance_private (theme);
797-
798- return priv->settings;
799-}
800-
801 void
802 gwd_theme_get_shadow (GWDTheme *theme,
803 decor_frame_t *frame,
804
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
810 typedef struct _decor decor_t;
811 typedef struct _decor_frame decor_frame_t;
812-typedef struct _GWDSettings GWDSettings;
813
814 #define GWD_TYPE_THEME gwd_theme_get_type ()
815 G_DECLARE_DERIVABLE_TYPE (GWDTheme, gwd_theme, GWD, THEME, GObject)
816@@ -90,9 +89,6 @@
817 gwd_theme_new (GWDThemeType type,
818 GWDSettings *settings);
819
820-GWDSettings *
821-gwd_theme_get_settings (GWDTheme *theme);
822-
823 void
824 gwd_theme_get_shadow (GWDTheme *theme,
825 decor_frame_t *frame,
826
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 gdkdisplay = gdk_display_get_default ();
832 gdkscreen = gdk_display_get_default_screen (gdkdisplay);
833
834- GWDSettings *settings = gwd_theme_get_settings (gwd_theme);
835+ GWDSettings *settings = gwd_application_get_settings (application);
836 const gchar *titlebar_font = gwd_settings_get_titlebar_font (settings);
837
838 gwd_frames_foreach (set_frames_scales, (gpointer) titlebar_font);

Subscribers

People subscribed via source and target branches