diff --git a/add-randr-12.patch b/add-randr-12.patch index 0644991..1be2b9a 100644 --- a/add-randr-12.patch +++ b/add-randr-12.patch @@ -1,7 +1,7 @@ -diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-randr-12 gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c ---- gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-randr-12 2008-03-24 17:21:50.000000000 -0400 -+++ gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c 2008-04-05 12:42:41.000000000 -0400 -@@ -35,15 +35,33 @@ +diff -up gnome-settings-daemon-2.23.1.1/plugins/xrandr/gsd-xrandr-manager.c.add-randr-12 gnome-settings-daemon-2.23.1.1/plugins/xrandr/gsd-xrandr-manager.c +--- gnome-settings-daemon-2.23.1.1/plugins/xrandr/gsd-xrandr-manager.c.add-randr-12 2008-04-23 06:38:37.000000000 -0400 ++++ gnome-settings-daemon-2.23.1.1/plugins/xrandr/gsd-xrandr-manager.c 2008-04-26 14:57:00.000000000 -0400 +@@ -35,7 +35,10 @@ #include #include #include @@ -13,31 +13,30 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra #ifdef HAVE_RANDR #include +@@ -48,6 +51,22 @@ + #define HOST_NAME_MAX 255 #endif --#include "gnome-settings-profile.h" - #include "gsd-xrandr-manager.h" - +#define GSD_XRANDR_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_XRANDR_MANAGER, GsdXrandrManagerPrivate)) + +#define VIDEO_KEYSYM "XF86Display" + +struct GsdXrandrManagerPrivate +{ -+ /* Key code of the fn-F7 video key (XF86Display) */ -+ guint keycode; -+ RWScreen *rw_screen; -+ gboolean running; ++ /* Key code of the fn-F7 video key (XF86Display) */ ++ guint keycode; ++ RWScreen *rw_screen; ++ gboolean running; +}; -+ ++ +enum { -+ PROP_0, ++ PROP_0, +}; + static void gsd_xrandr_manager_class_init (GsdXrandrManagerClass *klass); static void gsd_xrandr_manager_init (GsdXrandrManager *xrandr_manager); static void gsd_xrandr_manager_finalize (GObject *object); -@@ -52,252 +70,74 @@ G_DEFINE_TYPE (GsdXrandrManager, gsd_xra +@@ -56,248 +75,74 @@ G_DEFINE_TYPE (GsdXrandrManager, gsd_xra static gpointer manager_object = NULL; @@ -66,7 +65,7 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra +static GdkAtom +gnome_randr_atom (void) +{ -+ return gdk_atom_intern ("_GNOME_RANDR_ATOM", FALSE); ++ return gdk_atom_intern ("_GNOME_RANDR_ATOM", FALSE); } -static int @@ -99,37 +98,35 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra +static Atom +gnome_randr_xatom (void) +{ -+ return gdk_x11_atom_to_xatom (gnome_randr_atom()); ++ return gdk_x11_atom_to_xatom (gnome_randr_atom()); +} - if (sscanf (val, "%dx%d", &w, &h) != 2) { - g_free (val); - return -1; +- } +static GdkFilterReturn +on_client_message (GdkXEvent *xevent, + GdkEvent *event, + gpointer data) +{ -+ RWScreen *screen = data; -+ XEvent *ev = (XEvent *)xevent; -+ -+ if (ev->type == ClientMessage && -+ ev->xclient.message_type == gnome_randr_xatom()) { -+ -+ configuration_apply_stored (screen); -+ -+ return GDK_FILTER_REMOVE; - } -- ++ RWScreen *screen = data; ++ XEvent *ev = (XEvent *)xevent; ++ ++ if (ev->type == ClientMessage && ++ ev->xclient.message_type == gnome_randr_xatom()) { + - g_free (val); -- ++ configuration_apply_stored (screen); + - *width = w; - *height = h; -- ++ return GDK_FILTER_REMOVE; ++ } + - return i; -+ -+ /* Pass the event on to GTK+ */ -+ return GDK_FILTER_CONTINUE; ++ /* Pass the event on to GTK+ */ ++ return GDK_FILTER_CONTINUE; } -static int @@ -138,30 +135,35 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra - int screen) +static GdkFilterReturn +event_filter (GdkXEvent *xevent, -+ GdkEvent *event, -+ gpointer data) ++ GdkEvent *event, ++ gpointer data) { - char *key; - int val; - GError *error; -+ GsdXrandrManager *manager = data; -+ XEvent *xev = (XEvent *) xevent; ++ GsdXrandrManager *manager = data; ++ XEvent *xev = (XEvent *) xevent; - key = g_strdup_printf ("%s/%d/rate", display, screen); - error = NULL; - val = gconf_client_get_int (client, key, &error); - g_free (key); -+ if (!manager->priv->running) -+ return GDK_FILTER_CONTINUE; ++ if (!manager->priv->running) ++ return GDK_FILTER_CONTINUE; - if (error == NULL) { - return val; - } -- ++ /* verify we have a key event */ ++ if (xev->xany.type != KeyPress && xev->xany.type != KeyRelease) ++ return GDK_FILTER_CONTINUE; + - g_error_free (error); -+ /* verify we have a key event */ -+ if (xev->xany.type != KeyPress && xev->xany.type != KeyRelease) -+ return GDK_FILTER_CONTINUE; ++ if (xev->xkey.keycode == manager->priv->keycode) { ++ /* FIXME: here we should cycle between valid ++ * configurations, and save them ++ */ ++ configuration_apply_stored (manager->priv->rw_screen); - return 0; -} @@ -188,17 +190,12 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra - closest_width = sizes[i].width; - closest_height = sizes[i].height; - } -+ if (xev->xkey.keycode == manager->priv->keycode) { -+ /* FIXME: here we should cycle between valid -+ * configurations, and save them -+ */ -+ configuration_apply_stored (manager->priv->rw_screen); -+ -+ return GDK_FILTER_CONTINUE; - } +- } ++ return GDK_FILTER_CONTINUE; ++ } - return closest; -+ return GDK_FILTER_CONTINUE; ++ return GDK_FILTER_CONTINUE; } -#endif /* HAVE_RANDR */ @@ -221,11 +218,7 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra - int height; - int rate; - int rotation; --#ifdef HOST_NAME_MAX - char hostname[HOST_NAME_MAX + 1]; --#else -- char hostname[256]; --#endif - char *specific_path; - char *keys[3]; - int i; @@ -316,10 +309,10 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra - XRRFreeScreenConfigInfo (config); - } - } -+ GsdXrandrManager *manager = data; - -- g_free (specific_path); - +- g_free (specific_path); ++ GsdXrandrManager *manager = data; + - /* We need to make sure we process the screen resize event. */ - gdk_display_sync (display); - @@ -334,14 +327,14 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra - gnome_settings_profile_end (NULL); - -#endif /* HAVE_RANDR */ -+ if (!manager->priv->running) -+ return; ++ if (!manager->priv->running) ++ return; + -+ /* FIXME: Set up any new screens here */ ++ /* FIXME: Set up any new screens here */ } gboolean -@@ -306,8 +146,30 @@ gsd_xrandr_manager_start (GsdXrandrManag +@@ -306,8 +151,30 @@ gsd_xrandr_manager_start (GsdXrandrManag { g_debug ("Starting xrandr manager"); @@ -374,7 +367,7 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra return TRUE; } -@@ -315,6 +177,16 @@ void +@@ -315,6 +182,16 @@ void gsd_xrandr_manager_stop (GsdXrandrManager *manager) { g_debug ("Stopping xrandr manager"); @@ -391,7 +384,7 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra } static void -@@ -388,11 +260,22 @@ gsd_xrandr_manager_class_init (GsdXrandr +@@ -388,11 +265,22 @@ gsd_xrandr_manager_class_init (GsdXrandr object_class->constructor = gsd_xrandr_manager_constructor; object_class->dispose = gsd_xrandr_manager_dispose; object_class->finalize = gsd_xrandr_manager_finalize; @@ -414,7 +407,7 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra } static void -@@ -405,6 +288,8 @@ gsd_xrandr_manager_finalize (GObject *ob +@@ -405,6 +293,8 @@ gsd_xrandr_manager_finalize (GObject *ob xrandr_manager = GSD_XRANDR_MANAGER (object);