compiz: Changes to 'upstream-unstable'
Rebased ref, commits from common ancestor:
commit 9849ca3ce14e8398a01e18347c0a69f25e9c15c0
Author: Sam Spilsbury <smspillaz@gmail.com>
Date: Thu Feb 24 02:11:46 2011 +0800
Nuke warning
diff --git a/gtk/window-decorator/wnck.c b/gtk/window-decorator/wnck.c
index d6ec9a2..2118511 100644
--- a/gtk/window-decorator/wnck.c
+++ b/gtk/window-decorator/wnck.c
@@ -646,7 +646,6 @@ void
window_closed (WnckScreen *screen,
WnckWindow *win)
{
- Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
if (d)
commit 792260c0d31a7bad6d2754bb4c3cd34001039c69
Author: Sam Spilsbury <smspillaz@gmail.com>
Date: Thu Feb 24 02:10:33 2011 +0800
Preprocessor abuse to handle the Gtk+ 2.24 transition
diff --git a/gtk/window-decorator/events.c b/gtk/window-decorator/events.c
index f6ed81b..f3213e5 100644
--- a/gtk/window-decorator/events.c
+++ b/gtk/window-decorator/events.c
@@ -894,8 +894,7 @@ event_filter_func (GdkXEvent *gdkxevent,
{
if (!wnck_window_get (xevent->xcreatewindow.window))
{
- GdkWindow *toplevel = gdk_x11_window_foreign_new_for_display (gdkdisplay,
- xevent->xcreatewindow.window);
+ GdkWindow *toplevel = create_foreign_window (xevent->xcreatewindow.window);
if (toplevel)
{
diff --git a/gtk/window-decorator/gdk.c b/gtk/window-decorator/gdk.c
index 9e59cbd..7b43ca4 100644
--- a/gtk/window-decorator/gdk.c
+++ b/gtk/window-decorator/gdk.c
@@ -62,8 +62,7 @@ create_gdk_window (Window xframe)
{
GdkDisplay *display = gdk_display_get_default ();
GdkScreen *screen = gdk_display_get_default_screen (display);
- GdkWindow *window = gdk_x11_window_foreign_new_for_display (display,
- xframe);
+ GdkWindow *window = create_foreign_window (xframe);
GdkColormap *cmap = gdk_screen_get_rgb_colormap (screen);
gdk_drawable_set_colormap (GDK_DRAWABLE (window), cmap);
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index 957ea7d..03c558c 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -370,8 +370,7 @@ main (int argc, char *argv[])
if (!minimal)
{
- GdkWindow *root = gdk_x11_window_foreign_new_for_display (gdkdisplay,
- gdk_x11_get_default_root_xwindow ());
+ GdkWindow *root = create_foreign_window (gdk_x11_get_default_root_xwindow ());
gdk_window_add_filter (NULL,
event_filter_func,
@@ -382,8 +381,7 @@ main (int argc, char *argv[])
for (i = 0; i < nchildren; i++)
{
- GdkWindow *toplevel = gdk_x11_window_foreign_new_for_display (gdkdisplay,
- children[i]);
+ GdkWindow *toplevel = create_foreign_window (children[i]);
/* Need property notify on all windows */
diff --git a/gtk/window-decorator/gtk-window-decorator.h b/gtk/window-decorator/gtk-window-decorator.h
index ab90085..6b43a94 100644
--- a/gtk/window-decorator/gtk-window-decorator.h
+++ b/gtk/window-decorator/gtk-window-decorator.h
@@ -37,10 +37,26 @@
#include <X11/extensions/Xrender.h>
#include <X11/Xregion.h>
+#ifdef HAVE_GTK_2_24
+
#ifndef GDK_DISABLE_DEPRECATED
#define GDK_DISABLE_DEPRECATED
#endif
+#define create_foreign_window(xid) \
+ gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), \
+ xid)
+#else
+
+#define create_foreign_window(xid) \
+ gdk_window_foreign_new (xid)
+
+#ifdef GDK_DISABLE_DEPRECATED
+#undef GDK_DISABLE_DEPRECATED
+#endif
+
+#endif
+
#ifndef GTK_DISABLE_DEPRECATED
#define GTK_DISABLE_DEPRECATED
#endif
commit 54d17f08447938d53d9ee6348cac1bf9ec220db6
Author: Travis Watkins <amaranth@ubuntu.com>
Date: Tue Feb 22 11:02:23 2011 -0600
stop using deprecated gdk functions
diff --git a/gtk/window-decorator/events.c b/gtk/window-decorator/events.c
index 73e44ef..f6ed81b 100644
--- a/gtk/window-decorator/events.c
+++ b/gtk/window-decorator/events.c
@@ -894,8 +894,8 @@ event_filter_func (GdkXEvent *gdkxevent,
{
if (!wnck_window_get (xevent->xcreatewindow.window))
{
- GdkWindow *toplevel = gdk_window_foreign_new_for_display (gdkdisplay,
- xevent->xcreatewindow.window);
+ GdkWindow *toplevel = gdk_x11_window_foreign_new_for_display (gdkdisplay,
+ xevent->xcreatewindow.window);
if (toplevel)
{
diff --git a/gtk/window-decorator/gdk.c b/gtk/window-decorator/gdk.c
index 77ead1e..9e59cbd 100644
--- a/gtk/window-decorator/gdk.c
+++ b/gtk/window-decorator/gdk.c
@@ -62,7 +62,8 @@ create_gdk_window (Window xframe)
{
GdkDisplay *display = gdk_display_get_default ();
GdkScreen *screen = gdk_display_get_default_screen (display);
- GdkWindow *window = gdk_window_foreign_new (xframe);
+ GdkWindow *window = gdk_x11_window_foreign_new_for_display (display,
+ xframe);
GdkColormap *cmap = gdk_screen_get_rgb_colormap (screen);
gdk_drawable_set_colormap (GDK_DRAWABLE (window), cmap);
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index 147f48a..957ea7d 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -370,8 +370,8 @@ main (int argc, char *argv[])
if (!minimal)
{
- GdkWindow *root = gdk_window_foreign_new_for_display (gdkdisplay,
- gdk_x11_get_default_root_xwindow ());
+ GdkWindow *root = gdk_x11_window_foreign_new_for_display (gdkdisplay,
+ gdk_x11_get_default_root_xwindow ());
gdk_window_add_filter (NULL,
event_filter_func,
@@ -382,8 +382,8 @@ main (int argc, char *argv[])
for (i = 0; i < nchildren; i++)
{
- GdkWindow *toplevel = gdk_window_foreign_new_for_display (gdkdisplay,
- children[i]);
+ GdkWindow *toplevel = gdk_x11_window_foreign_new_for_display (gdkdisplay,
+ children[i]);
/* Need property notify on all windows */
commit e2ead0a157e34de75d0d76aa202540f4e3882cfb
Author: Sam Spilsbury <sam.spilsbury@canonical.com>
Date: Wed Feb 23 00:06:29 2011 +0800
Fix crash on exit
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index 37a2773..147f48a 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -424,19 +424,18 @@ main (int argc, char *argv[])
WnckWindow *w = (WnckWindow *) win->data;
window_closed (screen, w);
+
+ win = g_list_next (win);
}
g_list_free (windows);
- if (screen)
- g_object_unref (screen);
+ if (tip_label)
+ gtk_widget_destroy (GTK_WIDGET (tip_label));
if (tip_window)
gtk_widget_destroy (GTK_WIDGET (tip_window));
- if (tip_label)
- gtk_widget_destroy (GTK_WIDGET (tip_label));
-
gwd_decor_frame_unref (default_p);
gwd_decor_frame_unref (bare_p);
gwd_decor_frame_unref (switcher_p);
diff --git a/gtk/window-decorator/wnck.c b/gtk/window-decorator/wnck.c
index 96d2113..d6ec9a2 100644
--- a/gtk/window-decorator/wnck.c
+++ b/gtk/window-decorator/wnck.c
@@ -508,6 +508,11 @@ remove_frame_window (WnckWindow *win)
d->frame = NULL;
}
+ gdk_error_trap_push ();
+ XDeleteProperty (xdisplay, wnck_window_get_xid (win), win_decor_atom);
+ gdk_display_sync (gdk_display_get_default ());
+ gdk_error_trap_pop ();
+
d->width = 0;
d->height = 0;
@@ -644,16 +649,12 @@ window_closed (WnckScreen *screen,
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
- remove_frame_window (win);
-
- g_object_set_data (G_OBJECT (win), "decor", NULL);
-
- gdk_error_trap_push ();
- XDeleteProperty (xdisplay, wnck_window_get_xid (win), win_decor_atom);
- gdk_display_sync (gdk_display_get_default ());
- gdk_error_trap_pop ();
-
- g_free (d);
+ if (d)
+ {
+ remove_frame_window (win);
+ g_object_set_data (G_OBJECT (win), "decor", NULL);
+ g_free (d);
+ }
}
void
commit 3eda41caaa6127fe899275c4ef4f1027cc97db9b
Author: Scott Moreau <oreaus@gmail.com>
Date: Tue Feb 22 07:54:43 2011 -0700
Use glib CLAMP macro.
diff --git a/src/window.cpp b/src/window.cpp
index e9b8604..fba90e3 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -3493,7 +3493,6 @@ CompWindow::constrainNewWindowSize (int width,
#define FLOOR(value, base) (((int) ((value) / (base))) * (base))
#define FLOOR64(value, base) (((uint64_t) ((value) / (base))) * (base))
-#define CLAMPW(v, min, max) ((v) <= (min) ? (min) : (v) >= (max) ? (max) : (v))
if ((flags & PBaseSize) && (flags & PMinSize))
{
@@ -3530,8 +3529,8 @@ CompWindow::constrainNewWindowSize (int width,
yinc = MAX (yinc, hints->height_inc);
/* clamp width and height to min and max values */
- width = CLAMPW (width, min_width, max_width);
- height = CLAMPW (height, min_height, max_height);
+ width = CLAMP (width, min_width, max_width);
+ height = CLAMP (height, min_height, max_height);
/* shrink to base + N * inc */
width = base_width + FLOOR (width - base_width, xinc);
@@ -3584,7 +3583,7 @@ CompWindow::constrainNewWindowSize (int width,
}
}
-#undef CLAMPW
+#undef CLAMP
#undef FLOOR64
#undef FLOOR
commit d1cb4117ca6209152c4d666d6251d9aa8e258ad9
Author: Scott Moreau <oreaus@gmail.com>
Date: Tue Feb 22 07:48:05 2011 -0700
Remove unnecessary definition.
diff --git a/plugins/water/src/water.cpp b/plugins/water/src/water.cpp
index 1793747..435bcf7 100644
--- a/plugins/water/src/water.cpp
+++ b/plugins/water/src/water.cpp
@@ -460,7 +460,7 @@ WaterScreen::softwareUpdate (float dt, float fade)
value = (2.0f * D (d11, j) - D (d01, j) + accel) * fade;
- CLAMPW (value, 0.0f, 1.0f);
+ value = CLAMP (value, 0.0f, 1.0f);
D (d01, j) = value;
}
diff --git a/plugins/water/src/water.h b/plugins/water/src/water.h
index 75cf5e4..5b48159 100644
--- a/plugins/water/src/water.h
+++ b/plugins/water/src/water.h
@@ -50,12 +50,6 @@
#define TINDEX(ws, i) (((ws)->tIndex + (i)) % TEXTURE_NUM)
-#define CLAMPW(v, min, max) \
- if ((v) > (max)) \
- (v) = (max); \
- else if ((v) < (min)) \
- (v) = (min)
-
#define WATER_INITIATE_MODIFIERS_DEFAULT (ControlMask | CompSuperMask)
struct WaterFunction {
commit e8a3722c4a748477c245c4985e8c7c40d8617d51
Author: Sam Spilsbury <sam.spilsbury@canonical.com>
Date: Tue Feb 22 22:32:33 2011 +0800
Remove debug message
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index 86e684f..37a2773 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -331,7 +331,6 @@ main (int argc, char *argv[])
if (theme)
{
- fprintf (stderr, "setting procs\n");
theme_draw_window_decoration = meta_draw_window_decoration;
theme_calc_decoration_size = meta_calc_decoration_size;
theme_update_border_extents = meta_update_border_extents;
commit 7f58d0ee826bc3f24dadbf17ec7b0bd9a3f92b47
Author: Scott Moreau <oreaus@gmail.com>
Date: Tue Feb 22 07:13:33 2011 -0700
Avoid using reserved definition.
diff --git a/plugins/water/src/water.cpp b/plugins/water/src/water.cpp
index 47fbc3a..1793747 100644
--- a/plugins/water/src/water.cpp
+++ b/plugins/water/src/water.cpp
@@ -460,7 +460,7 @@ WaterScreen::softwareUpdate (float dt, float fade)
value = (2.0f * D (d11, j) - D (d01, j) + accel) * fade;
- CLAMP (value, 0.0f, 1.0f);
+ CLAMPW (value, 0.0f, 1.0f);
D (d01, j) = value;
}
diff --git a/plugins/water/src/water.h b/plugins/water/src/water.h
index 567a0d3..75cf5e4 100644
--- a/plugins/water/src/water.h
+++ b/plugins/water/src/water.h
@@ -50,7 +50,7 @@
#define TINDEX(ws, i) (((ws)->tIndex + (i)) % TEXTURE_NUM)
-#define CLAMP(v, min, max) \
+#define CLAMPW(v, min, max) \
if ((v) > (max)) \
(v) = (max); \
else if ((v) < (min)) \
commit 363a34cdeff1fd1990fcad3e4f640901784d0c3a
Author: Adam Williamson <awilliam@redhat.com>
Date: Tue Feb 22 19:28:28 2011 +0800
Generate GConf Schema files even if we don't want to install them
diff --git a/cmake/plugin_extensions/CompizGenGconf.cmake b/cmake/plugin_extensions/CompizGenGconf.cmake
index 20070d6..c9987ce 100644
--- a/cmake/plugin_extensions/CompizGenGconf.cmake
+++ b/cmake/plugin_extensions/CompizGenGconf.cmake
@@ -63,7 +63,7 @@ endfunction ()
find_program (XSLTPROC_EXECUTABLE xsltproc)
mark_as_advanced (FORCE XSLTPROC_EXECUTABLE)
-if (XSLTPROC_EXECUTABLE AND NOT COMPIZ_DISABLE_SCHEMAS_INSTALL)
+if (XSLTPROC_EXECUTABLE)
compiz_gconf_prepare_install_dirs ()
add_custom_command (
OUTPUT "${CMAKE_BINARY_DIR}/generated/compiz-${COMPIZ_CURRENT_PLUGIN}.schemas"
commit 81b3c23247e3f04417fe039229b51de0009f8ad9
Author: Adam Williamson <awilliam@redhat.com>
Date: Tue Feb 22 19:27:28 2011 +0800
Import CFLAGS and CXXFLAGS env variables
diff --git a/cmake/CompizCommon.cmake b/cmake/CompizCommon.cmake
index 8f2a249..ead3240 100644
--- a/cmake/CompizCommon.cmake
+++ b/cmake/CompizCommon.cmake
@@ -42,11 +42,11 @@ set (
option (COMPIZ_SIGN_WARNINGS "Should compiz use -Wsign-conversion during compilation." OFF)
if (COMPIZ_SIGN_WARNINGS)
- set (CMAKE_CXX_FLAGS "-Wall -Wsign-conversion")
- set (CMAKE_C_FLAGS "-Wall -Wsign-conversion")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wsign-conversion")
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wsign-conversion")
else ()
- set (CMAKE_CXX_FLAGS "-Wall")
- set (CMAKE_C_FLAGS "-Wall")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
endif ()
function (compiz_ensure_linkage)
commit b9cbf7a14aa8f1f0d4415064eb7488187a817f54
Author: Sam Spilsbury <sam.spilsbury@canonical.com>
Date: Tue Feb 22 17:59:57 2011 +0800
s/Novell Inc./Canonical Ltd./ in eventsource.cpp copyright
diff --git a/src/eventsource.cpp b/src/eventsource.cpp
index bb3d3ef..2973d17 100644
--- a/src/eventsource.cpp
+++ b/src/eventsource.cpp
@@ -6,9 +6,9 @@
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
+ * Canonical Ltd. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
+ * Canonical Ltd. makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
commit 96eaecceaccccb2c857e565c9e24ba8de457054e
Author: Sam Spilsbury <sam.spilsbury@canonical.com>
Date: Mon Feb 21 23:31:22 2011 +0800
Fix initial stacking issues
diff --git a/src/screen.cpp b/src/screen.cpp
index bf02566..81180ca 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -4633,10 +4633,12 @@ CompScreen::init (const char *name)
}
}
+ i = 0;
+
/* enforce restack on all windows */
for (CompWindowList::reverse_iterator rit = priv->windows.rbegin ();
rit != priv->windows.rend (); rit++)
- children[i] = (*rit)->id ();
+ children[i++] = (*rit)->id ();
XRestackWindows (dpy, children, i);
commit 3c073f1f63b54538d9e8814ef63e0402e60b26d8
Author: Sam Spilsbury <sam.spilsbury@canonical.com>
Date: Mon Feb 21 23:28:57 2011 +0800
Fix down-left shift and wrong offsets for default decorations.
Initialize settings before creating decoration frames
diff --git a/gtk/window-decorator/events.c b/gtk/window-decorator/events.c
index 1dea221..73e44ef 100644
--- a/gtk/window-decorator/events.c
+++ b/gtk/window-decorator/events.c
@@ -980,7 +980,8 @@ event_filter_func (GdkXEvent *gdkxevent,
if (screen)
{
- shadow_property_changed (screen);
+ if (shadow_property_changed (screen))
+ decorations_changed (screen);
}
}
else if (xevent->xproperty.atom == mwm_hints_atom)
diff --git a/gtk/window-decorator/frames.c b/gtk/window-decorator/frames.c
index c735e7b..06482c5 100644
--- a/gtk/window-decorator/frames.c
+++ b/gtk/window-decorator/frames.c
@@ -41,8 +41,6 @@ decor_frame_refresh (decor_frame_t *frame)
update_style (frame->style_window_rgba);
update_style (frame->style_window_rgb);
- /* Should really read gconf for that */
-
gchar *str = settings->font;
set_frame_scale (frame, str);
@@ -51,9 +49,8 @@ decor_frame_refresh (decor_frame_t *frame)
frame_update_titlebar_font (frame);
- /* FIXME */
- if (strcmp (frame->type, "bare") &&
- strcmp (frame->type, "switcher"))
+ if (strcmp (frame->type, "switcher") != 0 &&
+ strcmp (frame->type, "bare") != 0)
(*theme_update_border_extents) (frame);
opt_shadow.shadow_radius = settings->shadow_radius;
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index 545c7ed..86e684f 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -125,6 +125,7 @@ main (int argc, char *argv[])
#ifdef USE_METACITY
char *meta_theme = NULL;
+ MetaTheme *theme = NULL;
#endif
program_name = argv[0];
@@ -239,29 +240,6 @@ main (int argc, char *argv[])
}
}
- theme_draw_window_decoration = draw_window_decoration;
- theme_calc_decoration_size = calc_decoration_size;
- theme_update_border_extents = update_border_extents;
- theme_get_event_window_position = get_event_window_position;
- theme_get_button_position = get_button_position;
- theme_get_title_scale = get_title_scale;
-
-#ifdef USE_METACITY
- if (meta_theme)
- {
- meta_theme_set_current (meta_theme, TRUE);
- if (meta_theme_get_current ())
- {
- theme_draw_window_decoration = meta_draw_window_decoration;
- theme_calc_decoration_size = meta_calc_decoration_size;
- theme_update_border_extents = meta_update_border_extents;
- theme_get_event_window_position = meta_get_event_window_position;
- theme_get_button_position = meta_get_button_position;
- theme_get_title_scale = meta_get_title_scale;
- }
- }
-#endif
-
gdkdisplay = gdk_display_get_default ();
xdisplay = gdk_x11_display_get_xdisplay (gdkdisplay);
gdkscreen = gdk_display_get_default_screen (gdkdisplay);
@@ -320,6 +298,49 @@ main (int argc, char *argv[])
return 1;
}
+ screen = wnck_screen_get_default ();
+
+ initialize_decorations ();
+
+ if (!init_settings (screen))
+ {
+ free (settings);
+ fprintf (stderr, "%s: Failed to get necessary gtk settings\n", argv[0]);
+ return 1;
+ }
+
+ theme_draw_window_decoration = draw_window_decoration;
+ theme_calc_decoration_size = calc_decoration_size;
+ theme_update_border_extents = update_border_extents;
+ theme_get_event_window_position = get_event_window_position;
+ theme_get_button_position = get_button_position;
+ theme_get_title_scale = get_title_scale;
+
+#ifdef USE_METACITY
+ if (meta_theme)
+ {
+ meta_theme_set_current (meta_theme, TRUE);
+
+ theme = meta_theme_get_current ();
+
+ if (!theme)
+ g_warning ("specified a theme that does not exist! falling back to cairo decoration\n");
+ }
+ else
+ theme = meta_theme_get_current ();
+
+ if (theme)
+ {
+ fprintf (stderr, "setting procs\n");
+ theme_draw_window_decoration = meta_draw_window_decoration;
+ theme_calc_decoration_size = meta_calc_decoration_size;
+ theme_update_border_extents = meta_update_border_extents;
+ theme_get_event_window_position = meta_get_event_window_position;
+ theme_get_button_position = meta_get_button_position;
+ theme_get_title_scale = meta_get_title_scale;
+ }
+#endif
+
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
@@ -342,15 +363,14 @@ main (int argc, char *argv[])
return 1;
}
- screen = wnck_screen_get_default ();
wnck_set_client_type (WNCK_CLIENT_TYPE_PAGER);
gdk_window_add_filter (NULL,
selection_event_filter_func,
NULL);
- if (!minimal)
- {
+ if (!minimal)
+ {
GdkWindow *root = gdk_window_foreign_new_for_display (gdkdisplay,
gdk_x11_get_default_root_xwindow ());
@@ -383,8 +403,6 @@ main (int argc, char *argv[])
connect_screen (screen);
}
- initialize_decorations ();
-
/* Keep the default, bare and switcher decorations around
* since otherwise they will be spuriously recreated */
@@ -392,13 +410,6 @@ main (int argc, char *argv[])
bare_p = gwd_get_decor_frame ("bare");
switcher_p = gwd_get_decor_frame ("switcher");
- if (!init_settings (screen))
- {
- free (settings);
- fprintf (stderr, "%s: Failed to get necessary gtk settings\n", argv[0]);
- return 1;
- }
-
decor_set_dm_check_hint (xdisplay, gdk_screen_get_number (gdkscreen),
WINDOW_DECORATION_TYPE_PIXMAP |
WINDOW_DECORATION_TYPE_WINDOW);
diff --git a/gtk/window-decorator/gtk-window-decorator.h b/gtk/window-decorator/gtk-window-decorator.h
index 4e973e7..ab90085 100644
--- a/gtk/window-decorator/gtk-window-decorator.h
+++ b/gtk/window-decorator/gtk-window-decorator.h
@@ -611,7 +611,7 @@ update_event_windows (WnckWindow *win);
int
update_shadow (void);
-void
+gboolean
shadow_property_changed (WnckScreen *screen);
void
diff --git a/gtk/window-decorator/settings.c b/gtk/window-decorator/settings.c
index 3934554..0ceea0b 100644
--- a/gtk/window-decorator/settings.c
+++ b/gtk/window-decorator/settings.c
@@ -25,7 +25,7 @@
* instead - much much cleaner!
*/
-void
+gboolean
shadow_property_changed (WnckScreen *s)
{
GdkDisplay *display = gdk_display_get_default ();
@@ -44,7 +44,7 @@ shadow_property_changed (WnckScreen *s)
&format, &n, &left, &prop_data);
if (result != Success)
- return;
+ return FALSE;
if (n == 4)
{
@@ -102,8 +102,7 @@ shadow_property_changed (WnckScreen *s)
XFreeStringList (t_data);
}
- if (changed)
- decorations_changed (s);
+ return changed;
}
#ifdef USE_GCONF
@@ -540,17 +539,8 @@ init_settings (WnckScreen *screen)
g_object_unref (gconf);
#endif
-
- update_titlebar_font ();
-
- gwd_process_frames (update_frames_border_extents,
- window_type_frames,
- WINDOW_TYPE_FRAMES_NUM,
- NULL);
shadow_property_changed (screen);
- update_shadow ();
-
return TRUE;
}
commit 7c0ba7303eb16626346a05d14e7832eef27eac5c
Author: Sam Spilsbury <sam.spilsbury@canonical.com>
Date: Mon Feb 21 21:15:56 2011 +0800
Relicence eventsource.cpp to MIT
diff --git a/src/eventsource.cpp b/src/eventsource.cpp
index e621cd8..bb3d3ef 100644
--- a/src/eventsource.cpp
+++ b/src/eventsource.cpp
@@ -1,17 +1,24 @@
/*
- * Copyright © 2010 Canonical Ltd
+ * Copyright © 2010 Canonical Ltd.
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Authored by: Jason Smith <jason.smith@canonical.com>
* : Sam Spilsbury <sam.spilsbury@canonical.com>
commit d10bd89e7ca542bd227281e81626adcaf65f9adb
Author: Sam Spilsbury <sam.spilsbury@canonical.com>
Date: Mon Feb 21 20:55:51 2011 +0800
Fix memory leaks
- Use gtk_main_quit ();
- Don't create gconf clients where we don't need to
diff --git a/gtk/window-decorator/events.c b/gtk/window-decorator/events.c
index 6bbad04..1dea221 100644
--- a/gtk/window-decorator/events.c
+++ b/gtk/window-decorator/events.c
@@ -1163,7 +1163,7 @@ selection_event_filter_func (GdkXEvent *gdkxevent,
case SelectionClear:
status = decor_handle_selection_clear (xdisplay, xevent, 0);
if (status == DECOR_SELECTION_GIVE_UP)
- exit (0);
+ gtk_main_quit ();
default:
break;
}
diff --git a/gtk/window-decorator/frames.c b/gtk/window-decorator/frames.c
index 40c4e04..c735e7b 100644
--- a/gtk/window-decorator/frames.c
+++ b/gtk/window-decorator/frames.c
@@ -43,18 +43,7 @@ decor_frame_refresh (decor_frame_t *frame)
/* Should really read gconf for that */
- gchar *str = NULL;
-
-#ifdef USE_GCONF
-
- GConfClient *client = gconf_client_get_default ();
-
- str = gconf_client_get_string (client,
- COMPIZ_TITLEBAR_FONT_KEY,
- NULL);
-#endif
- if (!str)
- str = g_strdup ("Sans Bold 12");
+ gchar *str = settings->font;
set_frame_scale (frame, str);
@@ -281,6 +270,32 @@ decor_frame_new (const gchar *type)
void
decor_frame_destroy (decor_frame_t *frame)
{
+ Display *xdisplay = gdk_x11_get_default_xdisplay ();
+
+ if (frame->border_shadow)
+ decor_shadow_destroy (xdisplay, frame->border_shadow);
+
+ if (frame->border_no_shadow)
+ decor_shadow_destroy (xdisplay, frame->border_no_shadow);
+
+ if (frame->max_border_shadow)
+ decor_shadow_destroy (xdisplay, frame->max_border_shadow);
+
+ if (frame->max_border_no_shadow)
+ decor_shadow_destroy (xdisplay, frame->max_border_no_shadow);
+
+ if (frame->style_window_rgba)
+ gtk_widget_destroy (GTK_WIDGET (frame->style_window_rgba));
+
+ if (frame->style_window_rgb)
+ gtk_widget_destroy (GTK_WIDGET (frame->style_window_rgb));
+
+ if (frame->pango_context)
+ g_object_unref (G_OBJECT (frame->pango_context));
+
+ if (frame->titlebar_font)
+ pango_font_description_free (frame->titlebar_font);
+
if (frame)
free (frame->type);
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index 526e989..545c7ed 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -120,6 +120,7 @@ main (int argc, char *argv[])
unsigned int nchildren;
Window root_ret, parent_ret;
Window *children = NULL;
+ GList *windows, *win;
decor_frame_t *default_p, *bare_p, *switcher_p;
#ifdef USE_METACITY
@@ -406,6 +407,26 @@ main (int argc, char *argv[])
gtk_main ();
+ win = windows = wnck_screen_get_windows (screen);
+
+ while (win != NULL)
+ {
+ WnckWindow *w = (WnckWindow *) win->data;
+
+ window_closed (screen, w);
+ }
+
+ g_list_free (windows);
+
+ if (screen)
+ g_object_unref (screen);
+
+ if (tip_window)
+ gtk_widget_destroy (GTK_WIDGET (tip_window));
+
+ if (tip_label)
+ gtk_widget_destroy (GTK_WIDGET (tip_label));
+
gwd_decor_frame_unref (default_p);
gwd_decor_frame_unref (bare_p);
gwd_decor_frame_unref (switcher_p);
diff --git a/gtk/window-decorator/gtk-window-decorator.h b/gtk/window-decorator/gtk-window-decorator.h
index f6b1c44..4e973e7 100644
--- a/gtk/window-decorator/gtk-window-decorator.h
+++ b/gtk/window-decorator/gtk-window-decorator.h
@@ -641,6 +641,14 @@ void
connect_screen (WnckScreen *screen);
void
+window_opened (WnckScreen *screen,
+ WnckWindow *window);
+
+void
+window_closed (WnckScreen *screen,
+ WnckWindow *window);
+
+void
add_frame_window (WnckWindow *win,
Window frame,
Bool mode);
diff --git a/gtk/window-decorator/settings.c b/gtk/window-decorator/settings.c
index ccc1361..3934554 100644
--- a/gtk/window-decorator/settings.c
+++ b/gtk/window-decorator/settings.c
@@ -363,7 +363,8 @@ titlebar_font_changed (GConfClient *client)
gwd_frames_foreach (set_frames_scales, (gpointer) settings->font);
- g_free (str);
+ if (str)
+ g_free (str);
}
static void
diff --git a/gtk/window-decorator/switcher.c b/gtk/window-decorator/switcher.c
index 177e4c3..1aec3b1 100644
--- a/gtk/window-decorator/switcher.c
+++ b/gtk/window-decorator/switcher.c
@@ -63,6 +63,7 @@ create_switcher_frame (const gchar *type)
void
destroy_switcher_frame (decor_frame_t *frame)
{
+ gtk_widget_destroy (switcher_label);
decor_frame_destroy (frame);
}
@@ -244,10 +245,6 @@ draw_switcher_background (decor_t *d)
cairo_destroy (cr);
- GdkPixbuf *buf = gdk_pixbuf_get_from_drawable (NULL, d->buffer_pixmap, NULL, 0, 0, 0, 0, d->width, d->height);
-
- gdk_pixbuf_save (buf, "/home/smspillaz/rendered_switcher.png", "png", NULL, NULL);
-
copy_to_front_buffer (d);
pixel = ((((a * style->bg[GTK_STATE_NORMAL].blue ) >> 24) & 0x0000ff) |
@@ -330,6 +327,27 @@ draw_switcher_decoration (decor_t *d)
void
switcher_window_closed ()
{
+ decor_t *d = switcher_window;
+ Display *xdisplay = gdk_x11_get_default_xdisplay ();
+
+ if (d->layout)
+ g_object_unref (G_OBJECT (d->layout));
+
+ if (d->name)
+ g_free (d->name);
+
+ if (d->pixmap)
+ g_object_unref (G_OBJECT (d->pixmap));
+
+ if (d->buffer_pixmap)
+ g_object_unref (G_OBJECT (d->buffer_pixmap));
+
+ if (d->cr)
+ cairo_destroy (d->cr);
+
+ if (d->picture)
+ XRenderFreePicture (xdisplay, d->picture);
+
gwd_decor_frame_unref (switcher_window->frame);
g_free (switcher_window);
switcher_window = NULL;
diff --git a/gtk/window-decorator/wnck.c b/gtk/window-decorator/wnck.c
index 1c962e6..96d2113 100644
--- a/gtk/window-decorator/wnck.c
+++ b/gtk/window-decorator/wnck.c
@@ -571,7 +571,7 @@ active_window_changed (WnckScreen *screen)
}
}
-static void
+void
window_opened (WnckScreen *screen,
WnckWindow *win)
{
@@ -637,7 +637,7 @@ window_opened (WnckScreen *screen,
}
}
-static void
+void
window_closed (WnckScreen *screen,
WnckWindow *win)
{
commit 04c7585cd31d4b1ccd9be175ff9f296bad41598e
Author: Sam Spilsbury <sam.spilsbury@canonical.com>
Date: Mon Feb 21 17:55:25 2011 +0800
Remove dead code
diff --git a/gtk/window-decorator/frames.c b/gtk/window-decorator/frames.c
index fe378eb..40c4e04 100644
--- a/gtk/window-decorator/frames.c
+++ b/gtk/window-decorator/frames.c
@@ -28,7 +28,6 @@ typedef struct _decor_frame_type_info
destroy_frame_proc destroy_func;
} decor_frame_type_info_t;
-decor_frame_t decor_frames[NUM_DECOR_FRAMES];
Reply to: