OBS User unknown 2008-06-25 17:24:22 +00:00 committed by Git OBS Bridge
parent 7b226219f0
commit d8164c0d9f
5 changed files with 26 additions and 487 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:54743f9b26e8991f1316123aa1e26dce70599d556015c278ded9123b614693c6
size 1179247

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:db82d4c9f6db85874dac1f3aa9b38b3120a00c24fda8c25dd2389ebe4dfc60e4
size 1164206

View File

@ -1,478 +0,0 @@
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 620d783..baf8f97 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -44,6 +44,10 @@
#include "gnome-settings-profile.h"
#include "gsd-xrandr-manager.h"
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX 255
+#endif
+
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);
@@ -186,11 +190,7 @@ apply_settings (GsdXrandrManager *manager)
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;
@@ -381,7 +381,7 @@ gsd_xrandr_manager_dispose (GObject *object)
static void
gsd_xrandr_manager_class_init (GsdXrandrManagerClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = gsd_xrandr_manager_get_property;
object_class->set_property = gsd_xrandr_manager_set_property;
diff --git a/plugins/background/gsd-background-manager.c b/plugins/background/gsd-background-manager.c
index cf5119d..774bc66 100644
--- a/plugins/background/gsd-background-manager.c
+++ b/plugins/background/gsd-background-manager.c
@@ -2,6 +2,7 @@
*
* Copyright © 2001 Ximian, Inc.
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ * Copyright 2007 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index baf8f97..e1340c4 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ * Copyright (C) 2007, 2008 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,7 +36,11 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
+
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+
+#include <libgnomeui/monitor-db.h>
+#include <libgnomeui/randrwrap.h>
#ifdef HAVE_RANDR
#include <X11/extensions/Xrandr.h>
@@ -48,6 +53,22 @@
#define HOST_NAME_MAX 255
#endif
+#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;
+};
+
+enum {
+ 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);
@@ -56,248 +77,75 @@ G_DEFINE_TYPE (GsdXrandrManager, gsd_xrandr_manager, G_TYPE_OBJECT)
static gpointer manager_object = NULL;
-#ifdef HAVE_RANDR
-static int
-get_rotation (GConfClient *client,
- char *display,
- int screen)
-{
- char *key;
- int val;
- GError *error;
-
- key = g_strdup_printf ("%s/%d/rotation", display, screen);
- error = NULL;
- val = gconf_client_get_int (client, key, &error);
- g_free (key);
-
- if (error == NULL) {
- return val;
- }
- g_error_free (error);
-
- return 0;
+static GdkAtom
+gnome_randr_atom (void)
+{
+ return gdk_atom_intern ("_GNOME_RANDR_ATOM", FALSE);
}
-static int
-get_resolution (GConfClient *client,
- int screen,
- char *keys[],
- int *width,
- int *height)
+static Atom
+gnome_randr_xatom (void)
{
- int i;
- char *key;
- char *val;
- int w;
- int h;
-
- val = NULL;
- for (i = 0; keys[i] != NULL; i++) {
- key = g_strdup_printf ("%s/%d/resolution", keys[i], screen);
- val = gconf_client_get_string (client, key, NULL);
- g_free (key);
-
- if (val != NULL) {
- break;
- }
- }
-
- if (val == NULL) {
- return -1;
- }
-
- 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;
+
+ if (ev->type == ClientMessage &&
+ ev->xclient.message_type == gnome_randr_xatom()) {
+
+ configuration_apply_stored (screen);
+
+ return GDK_FILTER_REMOVE;
}
-
- g_error_free (error);
-
- return 0;
+
+ /* Pass the event on to GTK+ */
+ return GDK_FILTER_CONTINUE;
}
-static int
-find_closest_size (XRRScreenSize *sizes,
- int nsizes,
- int width,
- int height)
+static GdkFilterReturn
+event_filter (GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data)
{
- int closest;
- int closest_width;
- int closest_height;
- int i;
-
- closest = 0;
- closest_width = sizes[0].width;
- closest_height = sizes[0].height;
- for (i = 1; i < nsizes; i++) {
- if (ABS (sizes[i].width - width) < ABS (closest_width - width) ||
- (sizes[i].width == closest_width &&
- ABS (sizes[i].height - height) < ABS (closest_height - height))) {
- closest = i;
- 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
+ */
+ configuration_apply_stored (manager->priv->rw_screen);
+
+ return GDK_FILTER_CONTINUE;
}
- return closest;
+ return GDK_FILTER_CONTINUE;
}
-#endif /* HAVE_RANDR */
static void
-apply_settings (GsdXrandrManager *manager)
+on_randr_event (RWScreen *screen, gpointer data)
{
-#ifdef HAVE_RANDR
- GdkDisplay *display;
- Display *xdisplay;
- int major;
- int minor;
- int event_base;
- int error_base;
- GConfClient *client;
- int n_screens;
- GdkScreen *screen;
- GdkWindow *root_window;
- int width;
- int height;
- int rate;
- int rotation;
- char hostname[HOST_NAME_MAX + 1];
- char *specific_path;
- char *keys[3];
- 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) {
- goto out;
- }
-
- if (major != 1 || minor < 1) {
- g_message ("Display has unsupported version of XRandR (%d.%d), not setting resolution.", major, minor);
- goto out;
- }
-
- client = gconf_client_get_default ();
-
- i = 0;
- specific_path = NULL;
- if (gethostname (hostname, sizeof (hostname)) == 0) {
- specific_path = g_strconcat ("/desktop/gnome/screen/", hostname, NULL);
- keys[i++] = specific_path;
- }
- keys[i++] = "/desktop/gnome/screen/default";
- keys[i++] = NULL;
-
- n_screens = gdk_display_get_n_screens (display);
- for (i = 0; i < n_screens; i++) {
- screen = gdk_display_get_screen (display, i);
- root_window = gdk_screen_get_root_window (screen);
- residx = get_resolution (client, i, keys, &width, &height);
-
- if (residx != -1) {
- XRRScreenSize *sizes;
- int nsizes;
- int j;
- int closest;
- short *rates;
- int nrates;
- int status;
- int current_size;
- short current_rate;
- XRRScreenConfiguration *config;
- Rotation current_rotation;
-
- config = XRRGetScreenInfo (xdisplay, gdk_x11_drawable_get_xid (GDK_DRAWABLE (root_window)));
-
- rate = get_rate (client, keys[residx], i);
-
- sizes = XRRConfigSizes (config, &nsizes);
- closest = find_closest_size (sizes, nsizes, width, height);
-
- rates = XRRConfigRates (config, closest, &nrates);
- for (j = 0; j < nrates; j++) {
- if (rates[j] == rate)
- break;
- }
-
- /* Rate not supported, let X pick */
- if (j == nrates)
- rate = 0;
-
- rotation = get_rotation (client, keys[residx], i);
- if (rotation == 0)
- rotation = RR_Rotate_0;
-
- current_size = XRRConfigCurrentConfiguration (config, &current_rotation);
- current_rate = XRRConfigCurrentRate (config);
-
- if (closest != current_size ||
- rate != current_rate ||
- rotation != current_rotation) {
- status = XRRSetScreenConfigAndRate (xdisplay,
- config,
- gdk_x11_drawable_get_xid (GDK_DRAWABLE (root_window)),
- closest,
- (Rotation) rotation,
- rate,
- GDK_CURRENT_TIME);
- }
-
- XRRFreeScreenConfigInfo (config);
- }
- }
-
- g_free (specific_path);
+ GsdXrandrManager *manager = data;
- /* We need to make sure we process the screen resize event. */
- gdk_display_sync (display);
-
- while (gtk_events_pending ()) {
- gtk_main_iteration ();
- }
-
- if (client != NULL) {
- g_object_unref (client);
- }
- out:
- gnome_settings_profile_end (NULL);
-
-#endif /* HAVE_RANDR */
+ if (!manager->priv->running)
+ return;
+
+ /* FIXME: Set up any new screens here */
}
gboolean
@@ -306,8 +154,30 @@ gsd_xrandr_manager_start (GsdXrandrManager *manager,
{
g_debug ("Starting xrandr manager");
- apply_settings (manager);
-
+ manager->priv->running = TRUE;
+
+ if (manager->priv->keycode) {
+ gdk_error_trap_push ();
+
+ XGrabKey (gdk_x11_get_default_xdisplay(),
+ manager->priv->keycode, AnyModifier,
+ gdk_x11_get_default_root_xwindow(),
+ True, GrabModeAsync, GrabModeAsync);
+
+ gdk_flush ();
+ gdk_error_trap_pop ();
+ }
+
+ 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;
}
@@ -315,6 +185,16 @@ void
gsd_xrandr_manager_stop (GsdXrandrManager *manager)
{
g_debug ("Stopping xrandr manager");
+
+ manager->priv->running = FALSE;
+
+ gdk_error_trap_push ();
+
+ XUngrabKey (gdk_x11_get_default_xdisplay(),
+ manager->priv->keycode, AnyModifier,
+ gdk_x11_get_default_root_xwindow());
+
+ gdk_error_trap_pop ();
}
static void
@@ -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;
+
+ g_type_class_add_private (klass, sizeof (GsdXrandrManagerPrivate));
}
static void
gsd_xrandr_manager_init (GsdXrandrManager *manager)
{
+ 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;
+ manager->priv->rw_screen = rw_screen_new (
+ gdk_screen_get_default(), on_randr_event, NULL);
}
static void
@@ -405,6 +296,8 @@ gsd_xrandr_manager_finalize (GObject *object)
xrandr_manager = GSD_XRANDR_MANAGER (object);
+ g_return_if_fail (xrandr_manager->priv != NULL);
+
G_OBJECT_CLASS (gsd_xrandr_manager_parent_class)->finalize (object);
}

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Fri Jun 20 17:51:33 CEST 2008 - maw@suse.de
- Update to version 2.23.4:
+ Bugs fixed: bgo#523743, bgo#523159, bgo#507386, bgo#525042,
bgo#524425, bgo#525426, bgo#530356, bgo#531487, bgo#531589,
bgo#530975, bgo#531861, bgo#531862, bgo#522017, bgo#531665,
bgo#536177, bgo#490374, bgo#536581, and bgo#531868
+ Updated translations
- Drop obsolete patches: gnome-settings-daemon-randr-1.2.diff
-------------------------------------------------------------------
Thu May 29 20:39:30 CEST 2008 - federico@novell.com

View File

@ -1,5 +1,5 @@
#
# spec file for package gnome-settings-daemon (Version 2.22.1)
# spec file for package gnome-settings-daemon (Version 2.23.4)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@ -16,14 +16,12 @@ Name: gnome-settings-daemon
BuildRequires: fdupes gnome-common gnome-desktop-devel gnome-patch-translation gstreamer-0_10-plugins-base-devel intltool libglade2-devel libgnomekbd-devel update-desktop-files xorg-x11
License: GPL v2 or later
Group: System/GUI/GNOME
Version: 2.22.1
Release: 21
Version: 2.23.4
Release: 1
Summary: Settings daemon for the GNOME desktop
Source: %{_name}-%{version}.tar.bz2
# PATCH-FEATURE-OPENSUSE gnome-settings-daemon-system-proxy-configuration.patch
Patch2: %{name}-system-proxy-configuration.patch
# PATCH-FEATURE-UPSTREAM gnome-settings-daemon-1.2.diff -- Add support for RandR 1.2 to the daemon. federico@novell.com
Patch3: gnome-settings-daemon-randr-1.2.diff
# PATCH-FIX-UPSTREAM gnome-settings-daemon-bnc369263-broken-xkb-layout.patch bnc369263 bfo16105 vuntz@novell.com -- This is a hack to fix a major bug.
Patch4: gnome-settings-daemon-bnc369263-broken-xkb-layout.patch
Url: http://www.gnome.org
@ -80,7 +78,6 @@ Authors:
%setup -q -n %{_name}-%{version}
#gnome-patch-translation-prepare
%patch2
%patch3 -p1
%patch4 -p1
#gnome-patch-translation-update
@ -124,6 +121,7 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/gnome-settings-daemon
%{_prefix}/lib/gnome-settings-daemon
%{_libdir}/gnome-settings-daemon-2.0
%{_sysconfdir}/xdg/autostart/*.desktop
%files lang -f %{_name}.lang
@ -133,6 +131,14 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/pkgconfig/*.pc
%changelog
* Fri Jun 20 2008 maw@suse.de
- Update to version 2.23.4:
+ Bugs fixed: bgo#523743, bgo#523159, bgo#507386, bgo#525042,
bgo#524425, bgo#525426, bgo#530356, bgo#531487, bgo#531589,
bgo#530975, bgo#531861, bgo#531862, bgo#522017, bgo#531665,
bgo#536177, bgo#490374, bgo#536581, and bgo#531868
+ Updated translations
- Drop obsolete patches: gnome-settings-daemon-randr-1.2.diff
* Thu May 29 2008 federico@novell.com
- Updated gnome-settings-daemon-randr-1.2.diff with the latest fixes from upstream.
* Mon May 26 2008 vuntz@suse.de