[gnome-settings-daemon/randr-osd] Let the user dismiss the OSD with the Escape key
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/randr-osd] Let the user dismiss the OSD with the Escape key
- Date: Thu, 4 Mar 2010 21:01:12 +0000 (UTC)
commit fd3a1960f582fb4c5dc0c5212197d0872aae3253
Author: Federico Mena Quintero <federico novell com>
Date: Thu Mar 4 14:19:22 2010 -0600
Let the user dismiss the OSD with the Escape key
Signed-off-by: Federico Mena Quintero <federico novell com>
plugins/xrandr/gsd-xrandr-manager.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 97526d3..8bc30fc 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -34,6 +34,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
@@ -1246,12 +1247,22 @@ osd_window_button_release_event_cb (GtkWidget *widget, GdkEventButton *event, gp
return FALSE;
}
+static gboolean
+osd_window_escape_pressed_cb (GtkAccelGroup *accel_group, GObject *acceleratable, guint keyval, GdkModifierType modifier, gpointer data)
+{
+ GsdXrandrManager *manager = data;
+
+ destroy_osd_window (manager);
+ return TRUE;
+}
+
static void
create_osd_window (GsdXrandrManager *manager)
{
GsdXrandrManagerPrivate *priv = manager->priv;
GtkWidget *box;
int i;
+ GtkAccelGroup *accel;
if (priv->osd_window != NULL)
destroy_osd_window (manager);
@@ -1268,6 +1279,14 @@ create_osd_window (GsdXrandrManager *manager)
g_signal_connect (priv->osd_window, "button-release-event",
G_CALLBACK (osd_window_button_release_event_cb), manager);
+ accel = gtk_accel_group_new ();
+ gtk_accel_group_connect (accel, GDK_Escape, 0, 0,
+ g_cclosure_new (G_CALLBACK (osd_window_escape_pressed_cb),
+ manager,
+ NULL));
+ gtk_window_add_accel_group (GTK_WINDOW (priv->osd_window), accel);
+ g_object_unref (accel);
+
box = gtk_hbox_new (TRUE, 12);
gtk_container_add (GTK_CONTAINER (priv->osd_window), box);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]