[gnome-shell] Adds magnifier functionality to gnome-shell.
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Adds magnifier functionality to gnome-shell.
- Date: Tue, 11 May 2010 18:52:51 +0000 (UTC)
commit 7b7c34a3998788d9fba3aa197b7a6f7659b5fd5f
Author: Joseph Scheuhammer <clown utoronto ca>
Date: Mon May 10 12:40:03 2010 -0400
Adds magnifier functionality to gnome-shell.
Adds the ability to create one or more zoom regions that show magnified or
enhanced views of the desktop. The magnifier provides options for:
* magnification factor,
* four mouse tracking modes common to screen magnifiers,
* positioning the magnified view in one of four screen location, or full screen,
* crosshairs to accentuate the position of the mouse,
* user preferences persistence via GConf (schemas in
.../data/gnome-shell.schemas).
* a DBus API to allow other processes to drive the magnifier as a service.
https://bugzilla.gnome.org/show_bug.cgi?id=595507
data/gnome-shell.schemas | 194 ++++++++++++++++++++++++++++++++++++++++++++
data/theme/gnome-shell.css | 10 +++
js/ui/Makefile.am | 2 +
js/ui/main.js | 5 +
src/Makefile.am | 7 +-
src/shell-global.c | 17 ++++-
6 files changed, 232 insertions(+), 3 deletions(-)
---
diff --git a/data/gnome-shell.schemas b/data/gnome-shell.schemas
index b2de703..8e5c91f 100644
--- a/data/gnome-shell.schemas
+++ b/data/gnome-shell.schemas
@@ -244,6 +244,200 @@
</locale>
</schema>
+ <!-- Magnifier -->
+ <schema>
+ <key>/schemas/desktop/gnome/accessibility/magnifier/show_magnifier</key>
+ <applyto>/desktop/gnome/accessibility/magnifier/show_magnifier</applyto>
+ <owner>gnome-shell</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Show or hide the magnifier</short>
+ <long>
+ Show or hide the magnifier and all of its zoom regions.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/desktop/gnome/accessibility/magnifier/mouse_tracking</key>
+ <applyto>/desktop/gnome/accessibility/magnifier/mouse_tracking</applyto>
+ <owner>gnome-shell</owner>
+ <type>int</type>
+ <default>1</default>
+ <locale name="C">
+ <short>Mouse Tracking Mode</short>
+ <long>
+ Determines the position of the magnified mouse image within
+ the magnified view and how it reacts to system mouse movement.
+ The values are 0 - none: no mouse tracking; 1 - centered: the
+ mouse image is displayed at the center of the zoom region
+ (which also represents the point under the system mouse) and the
+ magnified contents are scrolled as the system mouse moves; 2 -
+ proportional: the position of the magnified mouse in the zoom
+ region is proportionally the same as the position of the system
+ mouse on screen; or 3 - push: when the magnified mouse
+ intersects a boundary of the zoom region, the contents are
+ scrolled into view.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/desktop/gnome/accessibility/magnifier/screen_position</key>
+ <applyto>/desktop/gnome/accessibility/magnifier/screen_position</applyto>
+ <owner>gnome-shell</owner>
+ <type>int</type>
+ <default>3</default>
+ <locale name="C">
+ <short>Screen position</short>
+ <long>
+ The magnified view either fills the entire screen (1), or
+ occupies the top-half (2), bottom-half (3), left-half (4), or
+ right-half (5) of the screen.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/desktop/gnome/accessibility/magnifier/mag_factor</key>
+ <applyto>/desktop/gnome/accessibility/magnifier/mag_factor</applyto>
+ <owner>gnome-shell</owner>
+ <type>float</type>
+ <default>2.0</default>
+ <locale name="C">
+ <short>Magnification factor</short>
+ <long>
+ The power of the magnification. A value of 1.0 means no
+ magnification. A value of 2.0 doubles the size.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/desktop/gnome/accessibility/magnifier/lens_mode</key>
+ <applyto>/desktop/gnome/accessibility/magnifier/lens_mode</applyto>
+ <owner>gnome-shell</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Enable lens mode</short>
+ <long>
+ Whether the magnified view should be centered over the location
+ of the system mouse and move with it.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/desktop/gnome/accessibility/magnifier/scroll_at_edges</key>
+ <applyto>/desktop/gnome/accessibility/magnifier/scroll_at_edges</applyto>
+ <owner>gnome-shell</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Scroll magnified contents beyond the edges of the desktop</short>
+ <long>
+ For centered mouse tracking, when the system pointer is at
+ or near the edge of the screen, the magnified contents continue
+ to scroll such that the screen edge moves into the magnified
+ view.
+ </long>
+ </locale>
+ </schema>
+
+ <!-- Magnifier: Crosshairs -->
+ <schema>
+ <key>/schemas/desktop/gnome/accessibility/magnifier/show_cross_hairs</key>
+ <applyto>/desktop/gnome/accessibility/magnifier/show_cross_hairs</applyto>
+ <owner>gnome-shell</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Show or hide crosshairs</short>
+ <long>
+ Enables/disables display of crosshairs centered on the magnified mouse
+ sprite.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/desktop/gnome/accessibility/magnifier/cross_hairs_thickness</key>
+ <applyto>/desktop/gnome/accessibility/magnifier/cross_hairs_thickness</applyto>
+ <owner>gnome-shell</owner>
+ <type>int</type>
+ <default>8</default>
+ <locale name="C">
+ <short>Thickness of the crosshairs</short>
+ <long>
+ Width of the vertical and horizontal lines that make up the
+ crosshairs.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/desktop/gnome/accessibility/magnifier/cross_hairs_color</key>
+ <applyto>/desktop/gnome/accessibility/magnifier/cross_hairs_color</applyto>
+ <owner>gnome-shell</owner>
+ <type>string</type>
+ <default>#ff0000</default>
+ <locale name="C">
+ <short>Color of the crosshairs</short>
+ <long>
+ The color of the the vertical and horizontal lines that make up
+ the crosshairs.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/desktop/gnome/accessibility/magnifier/cross_hairs_opacity</key>
+ <applyto>/desktop/gnome/accessibility/magnifier/cross_hairs_opacity</applyto>
+ <owner>gnome-shell</owner>
+ <type>int</type>
+ <default>169</default>
+ <locale name="C">
+ <short>Opacity of the crosshairs</short>
+ <long>
+ Determines the transparency of the crosshairs, from fully opaque
+ to fully transparent.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/desktop/gnome/accessibility/magnifier/cross_hairs_length</key>
+ <applyto>/desktop/gnome/accessibility/magnifier/cross_hairs_length</applyto>
+ <owner>gnome-shell</owner>
+ <type>int</type>
+ <default>4096</default>
+ <locale name="C">
+ <short>Length of the crosshairs</short>
+ <long>
+ Determines the length of the vertical and horizontal lines that
+ make up the crosshairs.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/desktop/gnome/accessibility/magnifier/cross_hairs_clip</key>
+ <applyto>/desktop/gnome/accessibility/magnifier/cross_hairs_clip</applyto>
+ <owner>gnome-shell</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Clip the crosshairs at the center</short>
+ <long>
+ Determines whether the crosshairs intersect the magnified mouse
+ sprite, or are clipped such that the ends of the horizontal
+ and vertical lines surround the mouse image.
+ </long>
+ </locale>
+ </schema>
+
</schemalist>
</gconfschemafile>
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 00c031f..b00de1a 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -1006,3 +1006,13 @@ StTooltip {
.lightbox {
background-color: rgba(0, 0, 0, 0.27);
}
+
+/* Magnifier */
+
+.magnifier-zoom-region {
+ border: 2px solid rgba(128, 0, 0, 255);
+}
+
+.magnifier-zoom-region.full-screen {
+ border-width: 0px;
+}
diff --git a/js/ui/Makefile.am b/js/ui/Makefile.am
index 08e2ac2..e46bc97 100644
--- a/js/ui/Makefile.am
+++ b/js/ui/Makefile.am
@@ -17,6 +17,8 @@ dist_jsui_DATA = \
link.js \
lookingGlass.js \
main.js \
+ magnifier.js \
+ magnifierDBus.js \
messageTray.js \
notificationDaemon.js \
overview.js \
diff --git a/js/ui/main.js b/js/ui/main.js
index 0b453c0..af51612 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -26,6 +26,7 @@ const WindowAttentionHandler = imports.ui.windowAttentionHandler;
const ShellDBus = imports.ui.shellDBus;
const TelepathyClient = imports.ui.telepathyClient;
const WindowManager = imports.ui.windowManager;
+const Magnifier = imports.ui.magnifier;
const DEFAULT_BACKGROUND_COLOR = new Clutter.Color();
DEFAULT_BACKGROUND_COLOR.from_pixel(0x2266bbff);
@@ -46,6 +47,7 @@ let shellDBusService = null;
let modalCount = 0;
let modalActorFocusStack = [];
let uiGroup = null;
+let magnifier = null;
let _errorLogStack = [];
let _startDate;
@@ -162,6 +164,9 @@ function start() {
global.stage.connect('captured-event', _globalKeyPressHandler);
+ // Install magnifier.
+ magnifier = new Magnifier.Magnifier();
+
_log('info', 'loaded at ' + _startDate);
log('GNOME Shell started at ' + _startDate);
diff --git a/src/Makefile.am b/src/Makefile.am
index 7fc7a56..833f461 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -76,7 +76,8 @@ shell_public_headers_h = \
shell-tray-manager.h \
shell-uri-util.h \
shell-window-tracker.h \
- shell-wm.h
+ shell-wm.h \
+ shell-xfixes-cursor.h
libgnome_shell_la_SOURCES = \
$(shell_built_sources) \
@@ -105,7 +106,9 @@ libgnome_shell_la_SOURCES = \
shell-tray-manager.c \
shell-uri-util.c \
shell-window-tracker.c \
- shell-wm.c
+ shell-wm.c \
+ shell-xfixes-cursor.c
+
non_gir_sources = \
diff --git a/src/shell-global.c b/src/shell-global.c
index d755b26..2228ef4 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -26,6 +26,7 @@
#endif
#define SHELL_DBUS_SERVICE "org.gnome.Shell"
+#define MAGNIFIER_DBUS_SERVICE "org.gnome.Magnifier"
static void grab_notify (GtkWidget *widget, gboolean is_grab, gpointer user_data);
static void update_root_window_pixmap (ShellGlobal *global);
@@ -853,10 +854,24 @@ shell_global_grab_dbus_service (ShellGlobal *global)
exit (1);
}
}
+
+ /* ...and the org.gnome.Magnifier service.
+ */
+ if (!dbus_g_proxy_call (bus, "RequestName", &error,
+ G_TYPE_STRING, MAGNIFIER_DBUS_SERVICE,
+ G_TYPE_UINT, 0,
+ G_TYPE_INVALID,
+ G_TYPE_UINT, &request_name_result,
+ G_TYPE_INVALID))
+ {
+ g_print ("failed to acquire %s: %s\n", MAGNIFIER_DBUS_SERVICE, error->message);
+ /* Failing to acquire the magnifer service is not fatal. Log the error,
+ * but keep going. */
+ }
g_object_unref (bus);
}
-static void
+static void
grab_notify (GtkWidget *widget, gboolean was_grabbed, gpointer user_data)
{
ShellGlobal *global = SHELL_GLOBAL (user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]