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 756789 - Grabbing something unfocused with SUPER+Left-click does not focus it
Grabbing something unfocused with SUPER+Left-click does not focus it
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
3.18.x
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
: 756790 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-10-18 19:56 UTC by Bastian Ilsø
Modified: 2016-01-05 19:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screencast of grabbing an unfocused window without it receiving focus (710.89 KB, application/octet-stream)
2015-10-18 19:56 UTC, Bastian Ilsø
  Details
ui/frames: Don't focus if the button press is on the client area (1.66 KB, patch)
2015-10-20 15:59 UTC, Rui Matos
committed Details | Review
window: Remove a spurious meta_verbose() (1001 bytes, patch)
2015-10-21 18:07 UTC, Rui Matos
committed Details | Review
window: Focus windows on button press regardless of modifier state (2.38 KB, patch)
2015-10-21 18:12 UTC, Rui Matos
none Details | Review
window: Focus windows on button press regardless of modifier state (2.56 KB, patch)
2015-10-21 18:15 UTC, Rui Matos
committed Details | Review

Description Bastian Ilsø 2015-10-18 19:56:20 UTC
Created attachment 313628 [details]
screencast of grabbing an unfocused window without it receiving focus

If I grab a window which dont have focus and I do so with SUPER+Left-click, it is moved to top level but doesnt receive focus afterwards. Attached video demonstrates. I am using mutter 3.18.1 under Wayland 1.9.0.
Comment 1 Bastian Ilsø 2015-10-18 20:00:52 UTC
*** Bug 756790 has been marked as a duplicate of this bug. ***
Comment 2 Rui Matos 2015-10-20 15:59:25 UTC
Created attachment 313762 [details] [review]
ui/frames: Don't focus if the button press is on the client area

This is a really old behavior introduced in commit
585e3625266dd0fadcdb033739760db423d31714 which is inconsistent since
it only applies to SSD windows.

If we really want this, we should focus the window elsewhere so that
it applies consistently to all windows.
--

Now, do we want to focus all windows in this case?
Comment 3 Jasper St. Pierre (not reading bugmail) 2015-10-20 16:04:24 UTC
Does the frames code even get it? I thought we'd get the grab early and eat the event once we went into grab mode.

I always thought it was intentional behavior that moving a window doesn't focus it. Seems like kind of useful behavior to me, actually.
Comment 4 Rui Matos 2015-10-20 16:25:54 UTC
(In reply to Jasper St. Pierre from comment #3)
> Does the frames code even get it?

  • #0 request_xserver_input_focus_change
    at core/display.c line 1523
  • #1 meta_display_set_input_focus_window
    at core/display.c line 2833
  • #2 meta_window_x11_focus
    at x11/window-x11.c line 773
  • #3 meta_window_focus
    at core/window.c line 4299
  • #4 handle_button_press_event
    at ui/frames.c line 1080
  • #5 meta_ui_frame_handle_event
    at ui/frames.c line 1525
  • #6 meta_window_handle_ungrabbed_event
    at core/window.c line 7674
  • #7 meta_display_handle_event
    at core/events.c line 288
  • #8 event_callback
    at core/events.c line 353
  • #9 _clutter_event_process_filters
  • #10 _clutter_process_event
  • #11 _clutter_stage_process_queued_events
  • #12 clutter_clock_dispatch
  • #13 g_main_context_dispatch
    at gmain.c line 3154
  • #14 g_main_context_dispatch
    at gmain.c line 3769
  • #15 g_main_context_iterate
    at gmain.c line 3840
  • #16 g_main_loop_run
    at gmain.c line 4034
  • #17 meta_run
    at core/main.c line 437
  • #18 main
    at main.c line 471

Comment 5 Jasper St. Pierre (not reading bugmail) 2015-10-20 16:37:16 UTC
Ah, right, I made it call meta_frames_handle_event first thing in https://git.gnome.org/browse/mutter/tree/src/core/window.c#n7673

I'm actually not sure that's 100% right, because it means Super+Left Clicking on a button will activate the button. I definitely remember a bug about who should take precedence between two incompatible operations.

But still, we should decide on a behavior and implement it in all cases. Let's go for focusing -- your patch looks fine to me.
Comment 6 Jasper St. Pierre (not reading bugmail) 2015-10-20 16:37:31 UTC
Review of attachment 313762 [details] [review]:

OK.
Comment 7 Rui Matos 2015-10-21 18:07:18 UTC
Created attachment 313821 [details] [review]
window: Remove a spurious meta_verbose()

This was duplicated here by mistake in the big re-work commit
7a109a18affe6de25ade043e72f8bc3da739f233 .
Comment 8 Rui Matos 2015-10-21 18:12:12 UTC
Created attachment 313822 [details] [review]
window: Focus windows on button press regardless of modifier state

This seems like a more generally useful and intuitive behavior.
--

(In reply to Jasper St. Pierre from comment #5)
> But still, we should decide on a behavior and implement it in all
> cases.  Let's go for focusing

This should do it.

Also, while looking at it again, I found out that in X sessions this
wasn't a problem at all because _begin_grab_op() calls
meta_window_grab_all_keys() which, on X11, does meta_window_focus().
Comment 9 Rui Matos 2015-10-21 18:15:08 UTC
Created attachment 313823 [details] [review]
window: Focus windows on button press regardless of modifier state

This seems like a more generally useful and intuitive behavior. Note
that, in X sessions, this is what already happened in practice since
meta_display_begin_grab_op() calls meta_window_grab_all_keys() which,
on X11, does meta_window_focus().
--

forgot to update the commit message to reflect what I had found
Comment 10 Jasper St. Pierre (not reading bugmail) 2015-12-21 21:23:18 UTC
Review of attachment 313821 [details] [review]:

sure.
Comment 11 Jasper St. Pierre (not reading bugmail) 2015-12-21 21:24:10 UTC
Review of attachment 313823 [details] [review]:

Works for me.
Comment 12 Rui Matos 2016-01-05 19:45:53 UTC
Attachment 313762 [details] pushed as e0906a7 - ui/frames: Don't focus if the button press is on the client area
Attachment 313821 [details] pushed as 8e22dce - window: Remove a spurious meta_verbose()
Attachment 313823 [details] pushed as 88acfb8 - window: Focus windows on button press regardless of modifier state