After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 746896 - Center pointer on primary monitor on startup
Center pointer on primary monitor on startup
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2015-03-27 15:05 UTC by Carlos Garnacho
Modified: 2015-03-30 12:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
backends: Add meta_monitor_manager_transform_monitor_coords() (2.86 KB, patch)
2015-03-27 15:07 UTC, Carlos Garnacho
none Details | Review
backends: Center pointer on primary monitor on startup (1.94 KB, patch)
2015-03-27 15:07 UTC, Carlos Garnacho
reviewed Details | Review
backends: Add meta_monitor_manager_get_monitor_at_point() (4.78 KB, patch)
2015-03-27 16:43 UTC, Carlos Garnacho
accepted-commit_now Details | Review
backends: Center pointer on primary monitor on startup (4.55 KB, patch)
2015-03-27 16:43 UTC, Carlos Garnacho
accepted-commit_now Details | Review

Description Carlos Garnacho 2015-03-27 15:05:19 UTC
The current default pointer positions on startup are not very nice IMO:

- on Xorg, the pointer appears centered on the span of all monitors, so on the typical case of smaller laptop display as primary, and attached larger monitor, there's high chances the pointer will actually be on the secondary monitor.

- on the native backend, clutter sets the pointer at 16px from the top left corner, this makes it sort of frequent to trigger the activities overview involuntarily (a lot less now thanks to pointer barriers)

I'm attaching some patches that center the pointer on the primary output on startup, which is both close and far enough from the areas you'll most likely interact with.
Comment 1 Carlos Garnacho 2015-03-27 15:07:33 UTC
Created attachment 300462 [details] [review]
backends: Add meta_monitor_manager_transform_monitor_coords()

This function takes an output and [0..1] relative coordinates and returns
the corresponding stage coordinates for that point.
Comment 2 Carlos Garnacho 2015-03-27 15:07:37 UTC
Created attachment 300463 [details] [review]
backends: Center pointer on primary monitor on startup

This seems nicer/tidier than the current X11 (center on the span of all
monitors) or native (so close to the activities corner it's hard not
to trigger it) platform behaviors.
Comment 3 Rui Matos 2015-03-27 15:42:54 UTC
Review of attachment 300463 [details] [review]:

I agree that having the same behavior in both backends is a good idea.

Any reason why you do all this in terms of MetaOutputs (i.e. hardware monitors) instead of MetaMonitorInfos (i.e. viewports into the framebuffer) ?

See also how meta_backend_native_post_init() already does something like this (but conditionally). That should be removed in favor of this unconditional approach.

::: src/backends/meta-backend.c
@@ +307,3 @@
   priv->input_settings = meta_input_settings_create ();
+
+  center_pointer (backend);

you could just pass priv->monitor_manager directly here
Comment 4 Carlos Garnacho 2015-03-27 16:43:36 UTC
Created attachment 300475 [details] [review]
backends: Add meta_monitor_manager_get_monitor_at_point()

This function returns the monitor_info index corresponding to the given
coordinates, or -1 if none is found at that point. The native backend
has been changed in places where it could make use of this function.
Comment 5 Carlos Garnacho 2015-03-27 16:43:54 UTC
Created attachment 300476 [details] [review]
backends: Center pointer on primary monitor on startup

This seems nicer/tidier than the current X11 (center on the span of all
monitors) or native (so close to the activities corner it's hard not
to trigger it) platform behaviors.

This code also takes over the native-specific pointer that happens when
the output the pointer is on is removed.
Comment 6 Rui Matos 2015-03-27 16:58:19 UTC
Review of attachment 300475 [details] [review]:

It's annoying how the meta_screen_get_current_monitor* functions duplicate this. Maybe those should be written in terms of this one? Anyway this looks fine
Comment 7 Rui Matos 2015-03-27 17:01:59 UTC
Review of attachment 300476 [details] [review]:

"...the native-specific pointer that happens..." - this doesn't sound right

code looks good
Comment 8 Carlos Garnacho 2015-03-30 12:00:22 UTC
(In reply to Rui Matos from comment #6)
> Review of attachment 300475 [details] [review] [review]:
> 
> It's annoying how the meta_screen_get_current_monitor* functions duplicate
> this. Maybe those should be written in terms of this one? Anyway this looks
> fine

Oh, well spotted, I didn't notice that duplication. It does look like we can do that indeed, I'll test the change and address in a separate bug.

(In reply to Rui Matos from comment #7)
> Review of attachment 300476 [details] [review] [review]:
> 
> "...the native-specific pointer that happens..." - this doesn't sound right

Indeed, "warping" is the missing word there, I'm pushing with reworded commit log.
Comment 9 Carlos Garnacho 2015-03-30 12:03:02 UTC
Attachment 300475 [details] pushed as 8188cdd - backends: Add meta_monitor_manager_get_monitor_at_point()
Attachment 300476 [details] pushed as c6e6ed8 - backends: Center pointer on primary monitor on startup