Commit Graph

68 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
7eee0e0ed6 magnifier: Return all parameters on sprite content preferred size
ClutterContent's get_preferred_size should return a boolean weather the
preferred size is valid, so in javascript we've to return this state value
before out width and height.

Since this was not happening, clutter was considering the width as the state
(converting the non-zero value to true), the height as the width, while ignoring
the returned height (that was then defaulted to 0)

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1020
2019-04-01 22:13:50 +02:00
Marco Trevisan (Treviño)
3e0915521a magnifier: Only connect to signals when ZoomRegion is active
There's no need to listen signals when the zoom region is inactive, so let's
just connect/disconnect them.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/472
2019-03-28 00:38:42 +01:00
Marco Trevisan (Treviño)
a298943fac magnifier: Update screen position on activation
The default ZoomRegion is created at startup and only updated if it is active
when the monitor setup changes. Thus when reactivating the magnifier after a
display change, the viewport used is still the one that been computed with the
old screen geometry values.

Move screen update code inside a function and call it both when activating
the zoom region and when the monitor changes during a zoom session.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1120
2019-03-28 00:38:42 +01:00
Florian Müllner
ede0fd8660 magnifier: Fix color argument
Clutter.TextureNode takes a Clutter.Color, not a Cogl.Color.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1020
2019-03-12 01:52:22 +00:00
Florian Müllner
fd50b9a45e cleanup: Use destructuring for imports from GI
This is *much* nicer than repetitive "imports.gi" lines ...

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/399
2019-02-09 07:39:20 +01:00
Florian Müllner
15e7625c80 cleanup: Remove erroneous vfunc parameters
Unlike in C or signal handlers, vfuncs don't include the this-object
in their arguments.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/388
2019-02-05 02:21:40 +00:00
Florian Müllner
ba97e8da7a magnifier: Add missing import
This was missing from commit a7bb8ee639.
2019-01-31 14:10:30 +01:00
Georges Basile Stavracas Neto
a7bb8ee639
magnifier: Use a ClutterContent to render mouse sprite
The Magnifier class uses a small subtree of actors to track the
current cursor's position and sprite. Specifically, it uses the
deprecated ClutterTexture to paint the cursor sprites.

Add a new, very simple ClutterContent implementation to track the
cursor sprite, and replace the ClutterTexture by a ClutterActor.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/371
2019-01-29 16:31:57 -02:00
Florian Müllner
bacfdbbb03 cleanup: Port non-GObject classes to JS6 classes
ES6 finally adds standard class syntax to the language, so we can
replace our custom Lang.Class framework with the new syntax. Any
classes that inherit from GObject will need special treatment,
so limit the port to regular javascript classes for now.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361
2019-01-25 14:02:44 +00:00
Jonas Ådahl
47ea10b7c9 Remove usage of MetaScreen
Remove any usage of MetaScreen, as it has been removed from libmutter
in the API version 3. The corresponding functionality has been moved
into three different places: MetaDisplay, MetaX11Display (for X11
specific functionality) and MetaWorkspaceManager.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:56:19 +02:00
Daniel van Vugt
94101e8bb8 magnifier.js: Fix zoom juddering
Make Zoom respond to the mouse silky-smoothly.

It was previously hard-coded to: 1000/50 = 20 FPS.

https://bugzilla.gnome.org/show_bug.cgi?id=682013
https://launchpad.net/bugs/1691675
2018-05-17 11:42:20 +08:00
Florian Müllner
3b1330880f cleanup: Use Function.prototype.bind()
When not using arrow notation with anonymous functions, we use Lang.bind()
to bind `this` to named callbacks. However since ES5, this functionality
is already provided by Function.prototype.bind() - in fact, Lang.bind()
itself uses it when no extra arguments are specified. Just use the built-in
function directly where possible, and use arrow notation in the few places
where we pass additional arguments.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:02 +00:00
Florian Müllner
213e38c2ef cleanup: Use arrow notation for anonymous functions
Arrow notation is great, use it consistently through-out the code base
to bind `this` to anonymous functions, replacing the more overbose
Lang.bind(this, function() {}).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:00 +00:00
Florian Müllner
76f09b1e49 cleanup: Use method syntax
Modern javascript has a short-hand for function properties, embrace
it for better readability and to prepare for an eventual port to
ES6 classes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:54:58 +00:00
Florian Müllner
033277b68f Define externally accessible contants with 'var' instead of 'const'
Just as we did with classes, define other constants that are (or
may be) used from other modules with 'var' to cut down on warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=785084
2017-07-18 21:52:06 +02:00
Florian Müllner
2582d16ca7 Define classes with 'var' instead of 'const'
Any symbols (including class properties) that should be visible
outside the module it's defined in need to be defined as global.
For now gjs still allows the access for 'const', but get rid of
the warnings spill now by changing it.

https://bugzilla.gnome.org/show_bug.cgi?id=785084
2017-07-18 21:52:06 +02:00
Rui Matos
f5865e895e magnifier: Avoid caret/focus viewport changes while the pointer moves
If there's a caret or focus move we should delay it until the pointer
is stationary for a little while so as to avoid jittery and spurious
viewport movements.

https://bugzilla.gnome.org/show_bug.cgi?id=752138
2015-07-27 18:04:44 +02:00
Giovanni Campagna
bbe417121c Magnifier: invert connection to settings changes and initial read
If there is no signal connected to changed for a key, get_value()
will not subscribe to changes.

https://bugzilla.gnome.org/show_bug.cgi?id=746509
2015-03-27 13:11:22 -07:00
Owen W. Taylor
2f5a226bc2 Fix handling of SystemBackground
Since the background rework, SystemBackground is no longer a transparent
actor that you have to stack on top of a solid background, it is an
opaque actor. Fix the color of the background actor, and remove places
where we were setting the background color underneath the system background
and expecting blending - in particular, we can always set no_clear_hint
on the stage.

https://bugzilla.gnome.org/show_bug.cgi?id=738652
2014-10-16 17:16:06 -04:00
Jasper St. Pierre
83cb26d70e js: Adapt to GSettings API change
The 'schema' property has been deprecated for a long time. Even though
this will likely be reverted in glib, let's stop using it.
2014-06-24 15:17:09 -04:00
Giovanni Campagna
793c6c2f7b Magnifier: clip the UI group clone to the allocation
Without clipping, we show parts of the message tray and workspace
thumbnails that are normally clipped by the screen.

https://bugzilla.gnome.org/show_bug.cgi?id=724305
2014-02-13 19:43:44 +01:00
Giovanni Campagna
f8f4d0f646 Magnifier: use the system noise texture for the dead area
The design says that the noise texture is the implicit bottom
layer, and so it's appropriate to use it togheter with the default
color to cover the dead area outside the screen which becomes
visibile when scrolling.

https://bugzilla.gnome.org/show_bug.cgi?id=724305
2014-02-13 19:43:44 +01:00
Giovanni Campagna
3a92aa751f Magnifier: don't listen for focus/tracker events if the magnifier is not active
In addition to checking the current settings, check also if the
zoom region is active before registering the event listener.
This way, we avoid DBus traffic for events we're not interested in.

Also, make FocusCaretTracker resilient to multiple register/deregister
calls (which can now happen).

https://bugzilla.gnome.org/show_bug.cgi?id=724305
2014-02-13 19:43:41 +01:00
Giovanni Campagna
6882273aa0 Magnifier: demote exceptions reading focus/caret position
It's possible that the DBus call goes in timeout (which is bad,
but unavoidable, given that atspi is synchronous) or fails
because the component has been removed (race condition). Those
errors are not dependent on gnome-shell, but on faulty applications
(mostly).
If they happen, log a debug message and continue.

https://bugzilla.gnome.org/show_bug.cgi?id=724305
2014-02-13 19:31:00 +01:00
Giovanni Campagna
3b0197620f Magnifier: fix a warning when calling setActive() with the same value
We must not call enable/disable_unredirect if we didn't change the
active value, otherwise mutter gets confused and emits warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=724293
2014-02-13 19:31:00 +01:00
Magdalen Berns
8d8d1cfdd6 Magnifier: Restore crosshairs
This patch is to restore broken crosshairs so they may be used
once more

https://bugzilla.gnome.org/show_bug.cgi?id=723709
	magnifier.js
2014-02-08 23:47:40 +00:00
Magdalen Berns
583d2cb4e4 Magnifier: take x,y from center of focused widget
bug https://bugzilla.gnome.org/show_bug.cgi?id=720951
2014-02-05 18:21:42 +00:00
Magdalen Berns
0db3605f33 Magnifier: Disable unredirect when active
The unredirect feature does not apply to the magnifier and it
prevents users from gaming whilst it is on so disable when magnifier
is active and allow magnifier users to game!

Bug https://bugzilla.gnome.org/show_bug.cgi?id=708985
2014-02-04 16:58:25 +01:00
Giovanni Campagna
193f872ebe Magnifier: don't initialize if we don't need it
Let's avoid initializing AT-SPI and start monitoring events if we
are not actually using the magnifier.

https://bugzilla.gnome.org/show_bug.cgi?id=708020
2013-09-13 16:09:33 +02:00
Giovanni Campagna
c58448817b ShellGlobal: use MetaCursorTracker to query the pointer position
Gdk uses Xwayland, so it only sees the events we forward to X11
clients. Instead, we can use the abstraction API provided by
mutter and get the right value automatically.
Also, we need to use MetaCursorTracker to handle the cursor
visibility too.

https://bugzilla.gnome.org/show_bug.cgi?id=707467
2013-09-12 10:34:25 +02:00
Magdalen Berns
c9d6b13f6a Remove unused functions
Bug https://bugzilla.gnome.org/show_bug.cgi?id=707666
2013-09-07 15:05:59 +02:00
Magdalen Berns
9d8f30f955 Magnifier: Implement focus and caret tracking
A11y users who use the magnifier may have trouble
focusing when they're typing or trying to keynav.
Implement a new system so that they can have the
magnifier track the caret and focus instead instead
of just the mouse.

Bug https://bugzilla.gnome.org/show_bug.cgi?id=647074
2013-09-05 13:18:54 -04:00
Giovanni Campagna
2b8414a453 Replace ShellXFixesCursor with MetaCursorTracker
Mutter now includes an object with the same purpose and functionality
as ShellXFixesCursor, so we can replace our XFixes code with it
and work under wayland too.

https://bugzilla.gnome.org/show_bug.cgi?id=705911
2013-08-19 16:14:12 +02:00
Jasper St. Pierre
c815979f2a magnifier: Don't use some deprecated APIs
Stop using Clutter.Group and Clutter.Rectangle.

https://bugzilla.gnome.org/show_bug.cgi?id=683073
2012-08-31 16:43:52 -03:00
Jasper St. Pierre
54e5ffcac1 magnifier: Don't set the size of the uiGroup
The magnifier shouldn't mess with global properties like this.

https://bugzilla.gnome.org/show_bug.cgi?id=683073
2012-08-31 16:43:51 -03:00
Jasper St. Pierre
3fd0502cb9 magnifier: Round the uiGroup to integer positions
This removes the jaggies from text, and other sorts of things.

https://bugzilla.gnome.org/show_bug.cgi?id=683073
2012-08-31 16:43:51 -03:00
Jasper St. Pierre
8aed51180f magnifier: Use PointerWatcher to poll the mouse pointer
This gives us a more efficient method to watch the mouse pointer.

https://bugzilla.gnome.org/show_bug.cgi?id=683073
2012-08-31 16:43:51 -03:00
Jasper St. Pierre
e616877fd2 js: Fix up for Clutter.Color changes
Spotted by darkxst on IRC.

https://bugzilla.gnome.org/show_bug.cgi?id=683073
2012-08-31 16:43:51 -03:00
Alejandro Piñeiro
7431c4d611 magnifier: Using properly 'color-saturation'
As description of the setting says, color-saturation ranges from
0.0 (grayscale) to 1.0 (full color), but the real outcome was the
opposite. The reason is that clutter provides a desaturation effect,
and color-saturation was passed directly to that effect. This patch
renames the effect and compute the desaturation value.
2012-08-06 13:02:42 +02:00
Alejandro Piñeiro
ec78dd60fc magnifier: 'color-saturation' is a double not a boolean 2012-08-06 13:02:42 +02:00
Florian Müllner
b7018de7e0 magnifier: Fix grayscale effect
Commit 8754b2767c added a grayscale effect to the magnifier,
but missed actually adding it to the actor.

https://bugzilla.gnome.org/show_bug.cgi?id=674499
2012-07-14 00:46:32 +02:00
Cosimo Cecchi
6658660355 magnifier: fix a copy/paste typo
Introduced in 8754b2767c
2012-07-09 18:12:38 -04:00
Jasper St. Pierre
8754b2767c Add a grayscale effect
This commit adds a grayscale effect to the magnifier, similar to
the lightness, brightness and contrast effects that are already there.

The effect is configured with the
org.gnome.desktop.a11y.magnifier.color-saturation setting, which
can take values from 0.0 (grayscale) to 1.0 (full color).

Based on a patch by Matthias Clasen <mclasen@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=676782
2012-07-06 15:18:01 -04:00
Joseph Scheuhammer
61a17d7fab Magnifier: Add brightness and contrast functionality
Added clutter effects class that does lightness inversion.
Modified the magnifier to use this inversion effect.

https://bugzilla.gnome.org/show_bug.cgi?id=639851
2012-05-16 18:59:33 -04:00
Joseph Scheuhammer
865cfa5211 Magnifier: Add brightness and contrast functionality
Modified the magnifier to use the CluttterBrightnessContrastEffect
for changing overall brightness and/or contrast of a ZoomRegion.

https://bugzilla.gnome.org/show_bug.cgi?id=639851
2012-05-16 18:59:32 -04:00
Jasper St. Pierre
723a1c843a Refactor show()/hide() sequences
We seem to have a lot of code that does something along the lines of:

    if (condition)
        actor.show();
    else
        actor.hide();

ClutterActor already has such a thing for exactly this purpose: the 'visible'
property. Use it instead of the mess above.

https://bugzilla.gnome.org/show_bug.cgi?id=672272
2012-05-02 12:43:58 -04:00
Rui Matos
5a85fc0e55 magnifier: Handle screen size changes
Update everything that depends on the screen size whenever it changes.

https://bugzilla.gnome.org/show_bug.cgi?id=667860
2012-01-26 15:14:48 +00:00
Jasper St. Pierre
faff0738eb Do not use the default stage
https://bugzilla.gnome.org/show_bug.cgi?id=664052
2011-12-15 16:13:29 -05:00
Giovanni Campagna
17c46c2452 Port everything to class framework
The last patch in the sequence. Every place that was previously
setting prototype has been ported to Lang.Class, to make code more
concise and allow for better toString().

https://bugzilla.gnome.org/show_bug.cgi?id=664436
2011-11-24 09:50:04 +01:00
Florian Müllner
be1c4f26b5 magnifier: Use enum from gsettings-desktop-schemas
gsettings-desktop-schemas installs a public header file for enum
types in schemas - use those instead of mirroring the types in JS.

https://bugzilla.gnome.org/show_bug.cgi?id=662238
2011-11-04 23:28:53 +01:00