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
This commit is contained in:
Joseph Scheuhammer 2010-05-10 12:40:03 -04:00 committed by Colin Walters
parent 865976cfe7
commit 7b7c34a399
6 changed files with 232 additions and 3 deletions

View File

@ -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>

View File

@ -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;
}

View File

@ -17,6 +17,8 @@ dist_jsui_DATA = \
link.js \
lookingGlass.js \
main.js \
magnifier.js \
magnifierDBus.js \
messageTray.js \
notificationDaemon.js \
overview.js \

View File

@ -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);

View File

@ -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 = \

View File

@ -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,6 +854,20 @@ 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);
}