diff --git a/data/gnome-shell.schemas b/data/gnome-shell.schemas index b2de7038a..8e5c91f7f 100644 --- a/data/gnome-shell.schemas +++ b/data/gnome-shell.schemas @@ -244,6 +244,200 @@ + + + /schemas/desktop/gnome/accessibility/magnifier/show_magnifier + /desktop/gnome/accessibility/magnifier/show_magnifier + gnome-shell + bool + false + + Show or hide the magnifier + + Show or hide the magnifier and all of its zoom regions. + + + + + + /schemas/desktop/gnome/accessibility/magnifier/mouse_tracking + /desktop/gnome/accessibility/magnifier/mouse_tracking + gnome-shell + int + 1 + + Mouse Tracking Mode + + 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. + + + + + + /schemas/desktop/gnome/accessibility/magnifier/screen_position + /desktop/gnome/accessibility/magnifier/screen_position + gnome-shell + int + 3 + + Screen position + + 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. + + + + + + /schemas/desktop/gnome/accessibility/magnifier/mag_factor + /desktop/gnome/accessibility/magnifier/mag_factor + gnome-shell + float + 2.0 + + Magnification factor + + The power of the magnification. A value of 1.0 means no + magnification. A value of 2.0 doubles the size. + + + + + + /schemas/desktop/gnome/accessibility/magnifier/lens_mode + /desktop/gnome/accessibility/magnifier/lens_mode + gnome-shell + bool + false + + Enable lens mode + + Whether the magnified view should be centered over the location + of the system mouse and move with it. + + + + + + /schemas/desktop/gnome/accessibility/magnifier/scroll_at_edges + /desktop/gnome/accessibility/magnifier/scroll_at_edges + gnome-shell + bool + false + + Scroll magnified contents beyond the edges of the desktop + + 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. + + + + + + + /schemas/desktop/gnome/accessibility/magnifier/show_cross_hairs + /desktop/gnome/accessibility/magnifier/show_cross_hairs + gnome-shell + bool + false + + Show or hide crosshairs + + Enables/disables display of crosshairs centered on the magnified mouse + sprite. + + + + + + /schemas/desktop/gnome/accessibility/magnifier/cross_hairs_thickness + /desktop/gnome/accessibility/magnifier/cross_hairs_thickness + gnome-shell + int + 8 + + Thickness of the crosshairs + + Width of the vertical and horizontal lines that make up the + crosshairs. + + + + + + /schemas/desktop/gnome/accessibility/magnifier/cross_hairs_color + /desktop/gnome/accessibility/magnifier/cross_hairs_color + gnome-shell + string + #ff0000 + + Color of the crosshairs + + The color of the the vertical and horizontal lines that make up + the crosshairs. + + + + + + /schemas/desktop/gnome/accessibility/magnifier/cross_hairs_opacity + /desktop/gnome/accessibility/magnifier/cross_hairs_opacity + gnome-shell + int + 169 + + Opacity of the crosshairs + + Determines the transparency of the crosshairs, from fully opaque + to fully transparent. + + + + + + /schemas/desktop/gnome/accessibility/magnifier/cross_hairs_length + /desktop/gnome/accessibility/magnifier/cross_hairs_length + gnome-shell + int + 4096 + + Length of the crosshairs + + Determines the length of the vertical and horizontal lines that + make up the crosshairs. + + + + + + /schemas/desktop/gnome/accessibility/magnifier/cross_hairs_clip + /desktop/gnome/accessibility/magnifier/cross_hairs_clip + gnome-shell + bool + false + + Clip the crosshairs at the center + + 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. + + + + diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css index 00c031fe7..b00de1a5a 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 08e2ac2c1..e46bc9793 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 0b453c0af..af51612d1 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 7fc7a56a9..833f461f8 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 d755b26bd..2228ef40e 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);