- Update to snapshot

- Enable profiling
This commit is contained in:
William Jon McCann 2008-03-26 15:13:00 +00:00
parent 964253372c
commit 6c32b09f69
3 changed files with 81 additions and 96 deletions

View File

@ -1,6 +1,5 @@
diff -up gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c.add-randr-12 gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c
--- gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c.add-randr-12 2008-02-20 09:20:27.000000000 -0500
+++ gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c 2008-03-02 17:48:02.000000000 -0500
--- 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-03-24 18:23:32.000000000 -0400
@@ -35,7 +35,10 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
@ -13,8 +12,8 @@ diff -up gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c.add-r
#ifdef HAVE_RANDR
#include <X11/extensions/Xrandr.h>
@@ -43,6 +46,22 @@
@@ -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))
@ -36,7 +35,7 @@ diff -up gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c.add-r
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);
@@ -51,248 +70,74 @@ G_DEFINE_TYPE (GsdXrandrManager, gsd_xra
@@ -52,252 +71,74 @@ G_DEFINE_TYPE (GsdXrandrManager, gsd_xra
static gpointer manager_object = NULL;
@ -95,30 +94,11 @@ diff -up gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c.add-r
- 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;
+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;
}
- }
-
- g_free (val);
-
@ -126,9 +106,10 @@ diff -up gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c.add-r
- *height = h;
-
- return i;
+
+ /* Pass the event on to GTK+ */
+ return GDK_FILTER_CONTINUE;
+static Atom
+gnome_randr_xatom (void)
+{
+ return gdk_x11_atom_to_xatom (gnome_randr_atom());
}
-static int
@ -136,31 +117,29 @@ diff -up gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c.add-r
- char *display,
- int screen)
+static GdkFilterReturn
+event_filter (GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data)
+on_client_message (GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data)
{
- char *key;
- int val;
- GError *error;
+ GsdXrandrManager *manager = data;
+ XEvent *xev = (XEvent *) xevent;
+ RWScreen *screen = data;
+ XEvent *ev = (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 (ev->type == ClientMessage &&
+ ev->xclient.message_type == gnome_randr_xatom()) {
- 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;
+ configuration_apply_stored (screen);
- return 0;
-}
@ -187,23 +166,21 @@ diff -up gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c.add-r
- 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_REMOVE;
}
- return closest;
+ /* Pass the event on to GTK+ */
+ return GDK_FILTER_CONTINUE;
}
-#endif /* HAVE_RANDR */
static void
-static void
-apply_settings (GsdXrandrManager *manager)
+on_randr_event (RWScreen *screen, gpointer data)
+static GdkFilterReturn
+event_filter (GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data)
{
-#ifdef HAVE_RANDR
- GdkDisplay *display;
@ -230,24 +207,28 @@ diff -up gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c.add-r
- int i;
- int residx;
-
- gnome_settings_profile_start (NULL);
-
- display = gdk_display_get_default ();
- xdisplay = gdk_x11_display_get_xdisplay (display);
-
- /* Check if XRandR is supported on the display */
- if (!XRRQueryExtension (xdisplay, &event_base, &error_base)
- || XRRQueryVersion (xdisplay, &major, &minor) == 0) {
- return;
- goto out;
- }
+ GsdXrandrManager *manager = data;
-
- if (major != 1 || minor < 1) {
- g_message ("Display has unsupported version of XRandR (%d.%d), not setting resolution.", major, minor);
+ if (!manager->priv->running)
return;
- goto out;
- }
-
+ GsdXrandrManager *manager = data;
+ XEvent *xev = (XEvent *) xevent;
- client = gconf_client_get_default ();
-
+ if (!manager->priv->running)
+ return GDK_FILTER_CONTINUE;
- i = 0;
- specific_path = NULL;
- if (gethostname (hostname, sizeof (hostname)) == 0) {
@ -256,7 +237,10 @@ diff -up gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c.add-r
- }
- keys[i++] = "/desktop/gnome/screen/default";
- keys[i++] = NULL;
-
+ /* verify we have a key event */
+ if (xev->xany.type != KeyPress && xev->xany.type != KeyRelease)
+ return GDK_FILTER_CONTINUE;
- n_screens = gdk_display_get_n_screens (display);
- for (i = 0; i < n_screens; i++) {
- screen = gdk_display_get_screen (display, i);
@ -311,72 +295,85 @@ diff -up gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c.add-r
- rate,
- GDK_CURRENT_TIME);
- }
-
+ 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);
- XRRFreeScreenConfigInfo (config);
- }
- }
-
+ return GDK_FILTER_CONTINUE;
}
- g_free (specific_path);
-
- /* We need to make sure we process the screen resize event. */
- gdk_display_sync (display);
-
+ return GDK_FILTER_CONTINUE;
+}
- while (gtk_events_pending ()) {
- gtk_main_iteration ();
- }
-
+static void
+on_randr_event (RWScreen *screen, gpointer data)
+{
+ GsdXrandrManager *manager = data;
- if (client != NULL) {
- g_object_unref (client);
- }
-
- out:
- gnome_settings_profile_end (NULL);
+ if (!manager->priv->running)
+ return;
-#endif /* HAVE_RANDR */
+
+ /* FIXME: Set up any new screens here */
}
gboolean
@@ -301,8 +146,25 @@ gsd_xrandr_manager_start (GsdXrandrManag
@@ -306,7 +147,24 @@ gsd_xrandr_manager_start (GsdXrandrManag
{
g_debug ("Starting xrandr manager");
- apply_settings (manager);
-
+ manager->priv->running = TRUE;
+
+
+ if (manager->priv->keycode) {
+ XGrabKey (gdk_x11_get_default_xdisplay(),
+ manager->priv->keycode, AnyModifier,
+ gdk_x11_get_default_root_xwindow(),
+ True, GrabModeAsync, GrabModeAsync);
+ }
+
+
+ configuration_apply_stored (manager->priv->rw_screen);
+
+
+ gdk_window_add_filter (gdk_get_default_root_window(),
+ (GdkFilterFunc)event_filter,
+ manager);
+
+
+ gdk_add_client_message_filter (gnome_randr_atom(),
+ on_client_message,
+ manager->priv->rw_screen);
+
return TRUE;
}
@@ -310,6 +172,12 @@ void
@@ -315,6 +173,12 @@ void
gsd_xrandr_manager_stop (GsdXrandrManager *manager)
{
g_debug ("Stopping xrandr manager");
+
+ manager->priv->running = FALSE;
+
+
+ XUngrabKey (gdk_x11_get_default_xdisplay(),
+ manager->priv->keycode, AnyModifier,
+ gdk_x11_get_default_root_xwindow());
}
static void
@@ -383,11 +251,22 @@ gsd_xrandr_manager_class_init (GsdXrandr
@@ -388,11 +252,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;
@ -390,7 +387,7 @@ diff -up gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c.add-r
+ Display *dpy = gdk_x11_get_default_xdisplay ();
+ guint keyval = gdk_keyval_from_name (VIDEO_KEYSYM);
+ guint keycode = XKeysymToKeycode (dpy, keyval);
+
+
+ manager->priv = GSD_XRANDR_MANAGER_GET_PRIVATE (manager);
+
+ manager->priv->keycode = keycode;
@ -399,7 +396,7 @@ diff -up gnome-settings-daemon-2.21.92/plugins/xrandr/gsd-xrandr-manager.c.add-r
}
static void
@@ -400,6 +279,8 @@ gsd_xrandr_manager_finalize (GObject *ob
@@ -405,6 +280,8 @@ gsd_xrandr_manager_finalize (GObject *ob
xrandr_manager = GSD_XRANDR_MANAGER (object);

View File

@ -1,6 +1,6 @@
Name: gnome-settings-daemon
Version: 2.22.0
Release: 3%{?dist}
Version: 2.22.1
Release: 0.2008.03.26.1%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
Group: System Environment/Daemons
@ -30,8 +30,6 @@ BuildRequires: perl(XML::Parser)
Patch1: add-randr-12.patch
Patch2: gnome-settings-daemon-2.21.91-ignore-model-if-evdev.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=523676
Patch3: mouse-no-eat-keys.patch
%description
A daemon to share settings from GNOME to other applications. It also
@ -53,10 +51,9 @@ developing applications that use %{name}.
%patch1 -p1 -b .add-randr-12
%patch2 -p1 -b .ignore-layout-if-using-evdev
%patch3 -p1 -b .mouse-no-eat-keys
%build
%configure --enable-static=no
%configure --enable-static=no --enable-profiling
make %{?_smp_mflags}
cd po
@ -135,6 +132,10 @@ fi
%{_libdir}/pkgconfig/gnome-settings-daemon.pc
%changelog
* Wed Mar 26 2008 Jon McCann <jmccann@redhat.com> - 2.22.1-0.2008.03.26.1
- Update to snapshot
- Enable profiling
* Wed Mar 26 2008 - Bastien Nocera <bnocera@redhat.com> - 2.22.0-3
- apps_gnome_settings_daemon_default_editor.schemas is obsolete (#438937)

View File

@ -1,13 +0,0 @@
Index: gnome-settings-daemon-2.22.0/plugins/mouse/gsd-mouse-manager.c
===================================================================
--- gnome-settings-daemon-2.22.0/plugins/mouse/gsd-mouse-manager.c (revision 224)
+++ gnome-settings-daemon-2.22.0/plugins/mouse/gsd-mouse-manager.c (working copy)
@@ -439,8 +439,6 @@
XUngrabKeyboard (gdk_x11_get_default_xdisplay (),
xev->xkey.time);
}
-
- return GDK_FILTER_REMOVE;
}
return GDK_FILTER_CONTINUE;
}