Integrate fixes from other distributions

This commit is contained in:
Soren Sandmann Pedersen 2008-04-25 05:04:38 +00:00
parent b03019b0fa
commit c59c4dc489
2 changed files with 80 additions and 72 deletions

View File

@ -1,7 +1,8 @@
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 --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 620d783..ad5a914 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -35,7 +35,10 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
@ -13,9 +14,8 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra
#ifdef HAVE_RANDR
#include <X11/extensions/Xrandr.h>
#endif
-#include "gnome-settings-profile.h"
@@ -44,6 +47,22 @@
#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))
@ -37,7 +37,7 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra
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
@@ -52,262 +71,113 @@ G_DEFINE_TYPE (GsdXrandrManager, gsd_xrandr_manager, G_TYPE_OBJECT)
static gpointer manager_object = NULL;
@ -46,7 +46,9 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra
-get_rotation (GConfClient *client,
- char *display,
- int screen)
-{
+static GdkAtom
+gnome_randr_atom (void)
{
- char *key;
- int val;
- GError *error;
@ -63,9 +65,6 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra
- g_error_free (error);
-
- return 0;
+static GdkAtom
+gnome_randr_atom (void)
+{
+ return gdk_atom_intern ("_GNOME_RANDR_ATOM", FALSE);
}
@ -75,7 +74,9 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra
- char *keys[],
- int *width,
- int *height)
-{
+static Atom
+gnome_randr_xatom (void)
{
- int i;
- char *key;
- char *val;
@ -96,20 +97,41 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra
- if (val == NULL) {
- return -1;
- }
+static Atom
+gnome_randr_xatom (void)
+{
+ return gdk_x11_atom_to_xatom (gnome_randr_atom());
+}
-
- if (sscanf (val, "%dx%d", &w, &h) != 2) {
- g_free (val);
- return -1;
- }
-
- g_free (val);
-
- *width = w;
- *height = h;
-
- return i;
+ return gdk_x11_atom_to_xatom (gnome_randr_atom());
}
-static int
-get_rate (GConfClient *client,
- char *display,
- int screen)
+static GdkFilterReturn
+on_client_message (GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data)
+{
{
- char *key;
- int val;
- GError *error;
-
- key = g_strdup_printf ("%s/%d/rate", display, screen);
- error = NULL;
- val = gconf_client_get_int (client, key, &error);
- g_free (key);
-
- if (error == NULL) {
- return val;
+ RWScreen *screen = data;
+ XEvent *ev = (XEvent *)xevent;
+
@ -121,57 +143,24 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra
+ return GDK_FILTER_REMOVE;
}
-
- g_free (val);
- g_error_free (error);
-
- *width = w;
- *height = h;
-
- return i;
- return 0;
+
+ /* Pass the event on to GTK+ */
+ return GDK_FILTER_CONTINUE;
}
-static int
-get_rate (GConfClient *client,
- char *display,
- int screen)
-find_closest_size (XRRScreenSize *sizes,
- int nsizes,
- int width,
- int height)
+static GdkFilterReturn
+event_filter (GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data)
{
- char *key;
- int val;
- GError *error;
+ 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 (error == NULL) {
- return val;
- }
-
- g_error_free (error);
+ /* verify we have a key event */
+ if (xev->xany.type != KeyPress && xev->xany.type != KeyRelease)
+ return GDK_FILTER_CONTINUE;
- return 0;
-}
-
-static int
-find_closest_size (XRRScreenSize *sizes,
- int nsizes,
- int width,
- int height)
-{
- int closest;
- int closest_width;
- int closest_height;
@ -188,6 +177,16 @@ 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;
- }
+ GsdXrandrManager *manager = data;
+ XEvent *xev = (XEvent *) xevent;
+
+ if (!manager->priv->running)
+ return GDK_FILTER_CONTINUE;
+
+ /* 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
@ -316,13 +315,13 @@ 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);
-
- /* We need to make sure we process the screen resize event. */
- gdk_display_sync (display);
-
+ GsdXrandrManager *manager = data;
- while (gtk_events_pending ()) {
- gtk_main_iteration ();
- }
@ -341,12 +340,20 @@ diff -up gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c.add-ra
}
gboolean
@@ -306,8 +146,30 @@ gsd_xrandr_manager_start (GsdXrandrManag
gsd_xrandr_manager_start (GsdXrandrManager *manager,
GError **error)
{
g_debug ("Starting xrandr manager");
- g_debug ("Starting xrandr manager");
- apply_settings (manager);
-
+
+ g_debug ("Starting xrandr manager");
+ if (manager->priv->rw_screen == NULL) {
+ g_set_error (error, 0, 0, "Failed to initialize XRandR extension");
+ return FALSE;
+ }
+
+ manager->priv->running = TRUE;
+
+ if (manager->priv->keycode) {
@ -374,7 +381,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 +185,16 @@ void
gsd_xrandr_manager_stop (GsdXrandrManager *manager)
{
g_debug ("Stopping xrandr manager");
@ -391,7 +398,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 +268,22 @@ gsd_xrandr_manager_class_init (GsdXrandrManagerClass *klass)
object_class->constructor = gsd_xrandr_manager_constructor;
object_class->dispose = gsd_xrandr_manager_dispose;
object_class->finalize = gsd_xrandr_manager_finalize;
@ -414,7 +421,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 +296,8 @@ gsd_xrandr_manager_finalize (GObject *object)
xrandr_manager = GSD_XRANDR_MANAGER (object);

View File

@ -1,6 +1,6 @@
Name: gnome-settings-daemon
Version: 2.22.1
Release: 0.2008.03.26.6%{?dist}
Release: 0.2008.03.26.7%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
Group: System Environment/Daemons
@ -34,8 +34,6 @@ Patch2: gnome-settings-daemon-2.21.91-ignore-model-if-evdev.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=524499
Patch3: gsd-mouse-too-much-grab.patch
Patch4: gnome-settings-daemon-2.22.1-hide-white-screen.patch
# survive xrandr being absent (such as on Xnest in sabayon)
Patch5: xrandr-missingok.patch
%description
A daemon to share settings from GNOME to other applications. It also
@ -61,7 +59,6 @@ pushd plugins/mouse/
%patch3 -p0 -b .no-eat-keys
popd
%patch4 -p1 -b .hide-white-screen
%patch5 -p1 -b .xrandr-missingok
%build
%configure --enable-static=no --enable-profiling
@ -143,6 +140,10 @@ fi
%{_libdir}/pkgconfig/gnome-settings-daemon.pc
%changelog
* Fri Apr 25 2008 Soren Sandmann <sandmann@redhat.com> - 2.22.1-2008.03.26.7
- Integrate various fixes from other distributions. Remove xrandr-missingok
patch.
* Tue Apr 22 2008 Matthias Clasen <mclasen@redhat.com> - 2.22.1-2008.03.26.6
- Make the xrandr plugin survive the absence of Xrandr