GNOME Bugzilla – Bug 746896
Center pointer on primary monitor on startup
Last modified: 2015-03-30 12:03:02 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.
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.
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.
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
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.
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.
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
Review of attachment 300476 [details] [review]: "...the native-specific pointer that happens..." - this doesn't sound right code looks good
(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.
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