Commit Graph

251 Commits

Author SHA1 Message Date
Ryan Dwyer 0c87bff5d1 Replace static handle_end_operation with seat_end_mouse_operation 2018-07-22 23:10:19 +10:00
Ryan Dwyer ff445cc855 Implement xdg shell request_move and request_resize events
Also does a few other related things:

* Now uses enum wlr_edges instead of our own enum resize_edge
* Now uses wlr_xcursor_get_resize_name and removes our own
find_resize_edge_name
* Renames drag to move for consistency
2018-07-22 23:10:19 +10:00
Ryan Dwyer 1b3b75a094 Use wlr_keyboard_get_modifiers 2018-07-22 23:10:19 +10:00
Ryan Dwyer dd337127d8 Use separate function for choosing edge cursor 2018-07-22 23:10:19 +10:00
Ryan Dwyer 350e9ea929 Fix clicking xwayland menus 2018-07-22 23:10:19 +10:00
Ryan Dwyer c299b6b5cd Use max multiplier when resizing while preserving ratio 2018-07-22 23:10:19 +10:00
Ryan Dwyer 2c6616050a Make mod + resize do it from the top left corner 2018-07-22 23:10:19 +10:00
Ryan Dwyer 3aadf944ae Use WLR_MODIFIER_SHIFT 2018-07-22 23:10:19 +10:00
Ryan Dwyer 9fbe13b9be Implement floating_modifier and mouse operations for floating views
This implements the following:

* `floating_modifier` configuration directive
* Drag a floating window by its title bar
* Hold mod + drag a floating window from anywhere
* Resize a floating view by dragging the border
* Resize a floating view by holding mod and right clicking anywhere on
the view
* Resize a floating view and keep aspect ratio by holding shift while
resizing using either method
* Mouse cursor turns into resize when hovering floating border or corner
2018-07-22 23:10:19 +10:00
Ryan Dwyer 37b33f92e8 Fix urgent timer logic and remove unnecessary header includes 2018-07-21 10:28:07 +10:00
Ryan Dwyer c2ed3d8bd6 Implement force_display_urgency_hint
The directive sets the timeout before an urgent view becomes normal
again after switching to it from another workspace.

Also:

* When an xwayland surface removes the urgent hint while the timer is
active, we now ignore the request. This happens as soon as the view
receives focus, so it was effectively making the timer pointless.
* The timeout is now only applied when switching to it from another
workspace.
2018-07-21 10:28:07 +10:00
Ryan Dwyer 8533c35a9f Fix crash and render issues involving cursor_send_pointer_motion
Fixes #2303, as well as a crash.

To replicate the crash:

* Have multiple outputs
* In config: for_window [<criteria>] workspace foo
* Also in config: workspace foo output <left-output-name>
* Focus the right output, and ensure workspace foo doesn't exist
* Launch the app that triggers the criteria

When the view maps, it calls workspace_switch which calls
send_set_focus which calls cursor_send_pointer_motion which calls
transaction_commit_dirty. This call to transaction_commit_dirty is not
meant to happen at this time because the tree isn't guaranteed to be in
a consistent state, but I'm not sure how exactly this leads to the crash
or render issues.

In this case the transaction is already committed by the view
implementation's handle_map function. So the solution is to remove it
from cursor_send_pointer_motion and add it to the other functions in
cursor.c which call cursor_send_pointer_motion.
2018-07-19 19:49:50 +10:00
emersion 747725b8bb Don't unfocus when an override redirect window is mapped 2018-07-18 20:00:48 +01:00
emersion 03d49490cc Update cursor on focus change
This allows to send wl_pointer.enter when switching between views
in a split/tabbed layout for instance. This (1) updates the cursor
image accordingly (2) makes it unnecessary to move the mouse before
scrolling. It's harmless to always call cursor_send_pointer_motion
because in case the focused surface hasn't changed this is a no-op.

The `last_focus != NULL` condition is required otherwise
cursor_send_pointer_motion will crash when sway starts up (the
sway_output doesn't yet have a workspace).
2018-07-17 23:04:55 +01:00
Drew DeVault d6bd314dff
Merge pull request #2276 from RyanDwyer/urgency
Implement urgency base functionality
2018-07-16 15:39:08 -07:00
Ryan Dwyer 9ca5cb7faf Fix tab split focus bug
Fixes a bug where if you have a tab containing a split, then switch from
a non-split tab to the split tab, focus is not changed properly.
2018-07-16 18:09:35 +10:00
Ryan Dwyer 315d5311b2 Implement urgency base functionality
Introduces a command to manually set urgency, as well as rendering of
urgent views, sending the IPC event, removing urgency after focused for
one second, and matching urgent views via criteria.
2018-07-16 08:19:25 +10:00
Ryan Dwyer a120d4c79f Make focus part of transactions
Rather than maintain copies of the entire focus stack, this PR
transactionises the focus by introducing two new properties to the
container state and using those when rendering.

* `bool focused` means this container has actual focus. Only one
container should have this equalling true in its current state.
* `struct sway_container *focus_inactive_child` points to the immediate
child that was most recently focused (eg. for tabbed and stacked
containers).
2018-07-15 22:08:26 +10:00
Brian Ashworth 13c6627ddb Implement tap_button_map for input devices 2018-07-14 01:01:47 -04:00
Drew DeVault bcdf04d79c
Merge pull request #2252 from rkubosz/scroll-button-option
feature: scroll button option for input devices
2018-07-13 04:07:11 -07:00
Ryan Dwyer ee0e1b170e Fix crash in seat code
Container will be NULL if launching swaylock.
2018-07-12 14:43:08 +10:00
Robert Kubosz 41b80c28df
add scroll button option
This commit introduces a scroll_button option, which is intended to be
used with scroll_method. Now user can edit his sway config and add an
scroll_button option to device section.
2018-07-11 22:03:06 +02:00
dudemanguy 600c126150 fix crash on floating windows 2018-07-11 12:24:06 -05:00
Ryan Dwyer 15dc5286e2 Move floating windows to front when focused 2018-07-11 19:50:02 +10:00
emersion 63b4bf5000
Update for swaywm/wlroots#1126 2018-07-09 22:54:30 +01:00
emersion b3c55dd909
Merge branch 'master' into leaks 2018-07-06 16:22:13 +01:00
Drew DeVault 3d2595b102
Merge branch 'master' into remove-input-fix 2018-07-06 06:28:01 -07:00
Ian Fan f63b209d51 Attach destroy handler earlier
This prevents it from being bypassed when the device has no seat configuration
2018-07-06 14:13:45 +01:00
Brian Ashworth c833ae64bc Fix pointer button events for layer surfaces 2018-07-05 23:01:35 -04:00
Dominique Martinet 8a771785ad keyboard: free xkb keymap on destroy 2018-07-05 08:13:10 +09:00
Ryan Dwyer 0bd41a0dae Fix focus related damage
When you have an unfocused container (so one view is focused_inactive),
and you focus any other view in that container, the view with
focused_inactive was not damaged. This is because we damaged the
previous focus and new focus, but needed to damage the parent of the new
focus.
2018-07-04 15:38:08 +10:00
Ryan Dwyer 1e4807efa0 Don't return pending children in seat_get_active_current_child
Fixes #2192.

seat_get_active_current_child is intended to return a child of the given
container which has finished its mapping transaction and is able to be
rendered on screen. The previous implementation was capable of returning
a pending child, which caused a child of a tabbed or stacked view to be
rendered prematurely while it was mapping.
2018-07-02 22:16:20 +10:00
Ryan Dwyer a2fbb20a61 Merge remote-tracking branch 'upstream/master' into atomic 2018-06-29 20:04:24 +10:00
Armin Preiml 1eede432fc fix handling key modifiers if not pressed at first
fixes #2169
2018-06-28 15:23:26 +02:00
Ryan Dwyer bf38081382
Merge branch 'master' into xwayland-wants-float 2018-06-27 13:21:00 +10:00
Tony Crisci e9ad10c2d6 dont focus-follow-mouse when keyboard grab 2018-06-24 20:30:43 -04:00
Ryan Dwyer 32b865e610 Fix crash when deleting last child in a tabbed or stacked container
There was no `current` child because the container was destroyed. This
makes it fall back to looking in the parent's current children list.
2018-06-23 17:47:28 +10:00
emersion cda66e9a26
Automatically float xwayland windows 2018-06-18 22:52:10 +01:00
frsfnrrg ca061ba8bf Fix keyboard shortcut handling inconsistencies
* Ensure that modifier keys are identified even when the next key does
  not produce a keysym. This requires that modifier change tracking
  be done for each sway_shortcut_state.

* Permit regular and --release shortcuts on the same key combination.
  Distinct bindings are identified for press and release cases; note
  that the release binding needs to be identified for both key press
  and key release events.

* Maintain ascending sort order for the shortcut state list, and keep
  track of the number of pressed key ids, for simpler (and hence
  faster) searching of the list of key bindings.

* Move binding duplicate detection into get_active_binding to avoid
  duplicating error messages.
2018-06-12 20:26:57 -04:00
emersion cfd02918c0
Render drag icons 2018-06-09 13:26:03 +01:00
Scott Leggett 609c420501 Initialise previous cursor position.
Fix the problem with focus jumping to the container under the cursor
when first starting sway.
2018-06-06 20:45:02 +10:00
Ryan Dwyer bcdb676abb Don't set focus to NULL when clicking a surface which has no container 2018-06-04 11:31:25 +10:00
Ryan Dwyer 9253278328 Restore focus when unmapping layer shell surfaces 2018-06-04 11:31:07 +10:00
Ryan Dwyer 57e78414fa Fix seat_get_active_child
seat_get_active_child is used for tabbed and stacked containers to get
the active child. The previous implementation used seat_get_focus_inactive
then ascended the tree to the child of the tabbed/stacked container, but
this fails when the workspace itself is stacked or tabbed and the most
recently active child is floating.

The new implementation takes a more simple approach, where it directly
scans the focus stack for the first immediate child which isn't the
floating container.

Fixes #2098.
2018-06-03 22:31:54 +10:00
Brian Ashworth 7c810dc344 Make command block implementation generic 2018-06-02 08:07:44 -04:00
frsfnrrg 78b7b46895 Style fix, redundant entry removal, fix extra keysym delete 2018-06-01 18:52:36 -04:00
frsfnrrg 480f0c593c Rename update_shortcut_model to update_shortcut_state 2018-06-01 18:52:36 -04:00
frsfnrrg 83d559dd03 Rename check_shortcut_model to get_active_binding 2018-06-01 18:52:36 -04:00
frsfnrrg c53e4e6cde Style fixed for keyboard.c 2018-06-01 18:52:36 -04:00
frsfnrrg f2fe93d171 Remove almost-always redundant loop in key handling 2018-06-01 18:52:36 -04:00