Author: Sebastien Bacher Description: add cursor theme and size support Origin: vendor, ubuntu (1:0.3.6-1ubuntu4) Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/86184 --- compiz.orig/configure.ac +++ compiz/configure.ac @@ -123,6 +123,7 @@ COMPIZ_REQUIRES="xcomposite \ xdamage \ xrandr \ xinerama \ + xcursor \ ice \ sm \ libxml-2.0 \ --- compiz.orig/gtk/window-decorator/gtk-window-decorator.c +++ compiz/gtk/window-decorator/gtk-window-decorator.c @@ -30,6 +30,7 @@ #include #include #include +#include #ifndef GDK_DISABLE_DEPRECATED #define GDK_DISABLE_DEPRECATED @@ -83,6 +84,14 @@ #include #endif +#define GNOME_MOUSE_DIR "/desktop/gnome/peripherals/mouse" + +#define GNOME_CURSOR_THEME_KEY \ + GNOME_MOUSE_DIR "/cursor_theme" + +#define GNOME_CURSOR_SIZE_KEY \ + GNOME_MOUSE_DIR "/cursor_size" + #define METACITY_GCONF_DIR "/apps/metacity/general" #define COMPIZ_USE_SYSTEM_FONT_KEY \ @@ -146,6 +155,13 @@ #define WHEEL_ACTION_KEY \ GCONF_DIR "/mouse_wheel_action" +#define COMPIZ_GCONF_DIR2 "/apps/compiz/general/allscreens/options" +#define COMPIZ_CURSOR_THEME_KEY \ + COMPIZ_GCONF_DIR2 "/cursor_theme" + +#define COMPIZ_CURSOR_SIZE_KEY \ + COMPIZ_GCONF_DIR2 "/cursor_size" + #define DBUS_DEST "org.freedesktop.compiz" #define DBUS_PATH "/org/freedesktop/compiz/decoration/allscreens" #define DBUS_INTERFACE "org.freedesktop.compiz" @@ -6491,6 +6507,44 @@ button_layout_changed (GConfClient *clie return FALSE; } + static void +cursor_theme_changed (GConfClient *client) +{ + gchar *theme; + gint size; + + theme = gconf_client_get_string(client, GNOME_CURSOR_THEME_KEY, NULL); + size = gconf_client_get_int(client, GNOME_CURSOR_SIZE_KEY, NULL); + + gconf_client_set_string(client, COMPIZ_CURSOR_THEME_KEY, theme, NULL); + + gconf_client_set_int(client, COMPIZ_CURSOR_SIZE_KEY, size, NULL); + + if (theme && strlen(theme)) + { + gint i, j; + GdkDisplay *gdkdisplay = gdk_display_get_default (); + Display *xdisplay = gdk_x11_display_get_xdisplay (gdkdisplay); + + + XcursorSetTheme (xdisplay, theme); + XcursorSetDefaultSize (xdisplay, size); + + for (i = 0; i < 3; i++) + { + for (j = 0; j < 3; j++) + { + if (cursor[i][j].shape != XC_left_ptr) + { + XFreeCursor (xdisplay, cursor[i][j].cursor); + cursor[i][j].cursor = + XCreateFontCursor (xdisplay, cursor[i][j].shape); + } + } + } + } +} + static void value_changed (GConfClient *client, const gchar *key, @@ -6569,6 +6623,11 @@ value_changed (GConfClient *client, if (theme_opacity_changed (client)) changed = TRUE; } + else if (strcmp (key, GNOME_CURSOR_THEME_KEY) == 0 || + strcmp (key, GNOME_CURSOR_SIZE_KEY) == 0) + { + cursor_theme_changed (client); + } if (changed) decorations_changed (data); @@ -6732,6 +6791,11 @@ init_settings (WnckScreen *screen) NULL); gconf_client_add_dir (gconf, + GNOME_MOUSE_DIR, + GCONF_CLIENT_PRELOAD_ONELEVEL, + NULL); + + gconf_client_add_dir (gconf, COMPIZ_GCONF_DIR1, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); @@ -6740,6 +6804,9 @@ init_settings (WnckScreen *screen) "value_changed", G_CALLBACK (value_changed), screen); + + cursor_theme_changed(gconf); + #elif USE_DBUS_GLIB DBusConnection *connection; DBusMessage *reply; --- compiz.orig/metadata/core.xml.in.in +++ compiz/metadata/core.xml.in.in @@ -35,6 +35,18 @@ 0 10000 + +