[gnome-settings-daemon] media-keys: Add Rotation lock support
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] media-keys: Add Rotation lock support
- Date: Fri, 19 Apr 2013 12:54:02 +0000 (UTC)
commit 76b548e3dd4c52455e9c2684d2e64e41b9c5cd84
Author: Bastien Nocera <hadess hadess net>
Date: Wed Apr 3 18:25:01 2013 +0200
media-keys: Add Rotation lock support
Windows+O is used on recent Windows 8 certified hardware for the
orientation lock.
https://bugzilla.gnome.org/show_bug.cgi?id=697190
plugins/media-keys/gsd-media-keys-manager.c | 19 +++++++++++++++++++
plugins/media-keys/shortcuts-list.h | 2 ++
2 files changed, 21 insertions(+)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 1a33607..3e242d8 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -1643,6 +1643,22 @@ do_video_rotate_action (GsdMediaKeysManager *manager,
}
static void
+do_video_rotate_lock_action (GsdMediaKeysManager *manager,
+ gint64 timestamp)
+{
+ GSettings *settings;
+ gboolean locked;
+
+ settings = g_settings_new ("org.gnome.settings-daemon.peripherals.touchscreen");
+ locked = !g_settings_get_boolean (settings, "orientation-lock");
+ g_settings_set_boolean (settings, "orientation-lock", locked);
+ g_object_unref (settings);
+
+ show_osd (manager, locked ? "rotation-locked-symbolic"
+ : "rotation-allowed-symbolic", NULL, -1);
+}
+
+static void
do_toggle_accessibility_key (const char *key)
{
GSettings *settings;
@@ -2043,6 +2059,9 @@ do_action (GsdMediaKeysManager *manager,
case ROTATE_VIDEO_KEY:
do_video_rotate_action (manager, timestamp);
break;
+ case ROTATE_VIDEO_LOCK_KEY:
+ do_video_rotate_lock_action (manager, timestamp);
+ break;
case MAGNIFIER_KEY:
do_magnifier_action (manager);
break;
diff --git a/plugins/media-keys/shortcuts-list.h b/plugins/media-keys/shortcuts-list.h
index 1ac0798..69da940 100644
--- a/plugins/media-keys/shortcuts-list.h
+++ b/plugins/media-keys/shortcuts-list.h
@@ -63,6 +63,7 @@ typedef enum {
RANDOM_KEY,
VIDEO_OUT_KEY,
ROTATE_VIDEO_KEY,
+ ROTATE_VIDEO_LOCK_KEY,
MAGNIFIER_KEY,
SCREENREADER_KEY,
ON_SCREEN_KEYBOARD_KEY,
@@ -137,6 +138,7 @@ static struct {
{ VIDEO_OUT_KEY, NULL, N_("Video Out"), "XF86Display", SHELL_KEYBINDING_MODE_ALL },
/* Key code of the XF86RotateWindows key (present on some tablets) */
{ ROTATE_VIDEO_KEY, NULL, N_("Rotate Screen"), "XF86RotateWindows", SHELL_KEYBINDING_MODE_NORMAL },
+ { ROTATE_VIDEO_LOCK_KEY, NULL, N_("Orientation Lock"), "<Super>o", SHELL_KEYBINDING_MODE_ALL },
{ MAGNIFIER_KEY, "magnifier", NULL, NULL, SHELL_KEYBINDING_MODE_ALL },
{ SCREENREADER_KEY, "screenreader", NULL, NULL, SHELL_KEYBINDING_MODE_ALL },
{ ON_SCREEN_KEYBOARD_KEY, "on-screen-keyboard", NULL, NULL, SHELL_KEYBINDING_MODE_ALL },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]