Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag and drop windows while navigating #259

Closed
wants to merge 60 commits into from
Closed

Drag and drop windows while navigating #259

wants to merge 60 commits into from

Conversation

hedning
Copy link
Member

@hedning hedning commented Mar 8, 2020

Mutter's window grab blocks all other input, but it's possible to deactivate a grab from js.

So to make navigation while dragging work we implement the whole process using clone's and clutter events. The native grab-op-begin signal is only used to initiate a grab (we can't listen to arbitrary button events on WindowActors) which we immediately cancel in favor of the before mentioned implementation.

In addition to navigation while grabbing, we now support <super><ctrl>button-press as a shortcut to go straight into DnD mode. This can be very handy when you want to move a floating window into the tiling.

olejorgenb and others added 30 commits March 8, 2020 14:46
This is much more flexible: we can drag windows across workspaces in the
carousel, react on keybindings, scroll, etc.
…ting workspace switch

This simplifies code moving windows between workspaces without messing with the
focus. (since mutter enforce focus_window.workspace == active_workspace)

Mainly preparation for DnD fixes in the next commit.
- delay workspace change until DnD end (partial Navigator destroy)
- sync scratch window frame with clone on grab end

Bug in the wip commit fixed: (focus was not always preserved on workspace dnd)
- DnD a window
- switch to a different workspace using the workspace carousel
- drop the window

-> the DnD-window loose focus on workspace change (in step 2)

Note: Mutter enforce focus_window.workspace === active_workspace, changing focus
window if necessary.
Use get_pointer, and transform_stage_point for to get correct
coordinates...
For some reason this is accurate
- Activate destination workspace if it isn't active, fake it if not.

If a «stuck» window have focus, consider it selected.

If selected window or one its transient window has focus, fake focus
handler. Otherwise activate it.
hedning and others added 20 commits March 8, 2020 14:48
Precreated zones doesn't work when the user can alter the space during
grab. (eg. resize a window or insert new ones)

TODO: handle empty spaces
This is necessary for events to pass through to the space.
This is a bit ugly, should probably have a proper method for this.
Also move zone actor creation to zone activation.

(regression after "dnd: create zones and actors on the fly")
When ending a grab we want to have full control over what space and
window gains focus. So simply pass the window through navigator.finish
in addition to the space.
The clutter reported modifier state is easily stuck on X11:
- Enter "clutter mode". Press and hold ctrl whild exiting (usually ctrl-ecs)
- Clutter will now report ctrl after ctrl is released causing windows to go
  directly to dnd mode when moved.
The `global.get_pointer` is not necessarily in sync with the clutter motion event.

We use `global.get_pointer` to set the anchor in `begin`, but sometimes (fast
motions more likely to trigger) it's an extra event in the `motion` event queue.
The motion handler will in effect see a reality that occured before the anchor
was set, triggering a "jump".

Also notice that `global.get_pointer` seems to be ahead of the actual grab event
:/ meaning we get less responsive window moving. We don't have access the actual
click coordinates which triggered the move :(
@smichel17
Copy link
Collaborator

smichel17 commented Sep 8, 2022

All of these commits are already in develop. They must have been rebase-merged, so the hashes don't match, but if you search by commit message, you can confirm they are all there.

@smichel17 smichel17 closed this Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants