Commit graph

4119 commits

Author SHA1 Message Date
frsfnrrg 94dd8823a0 Invoke mouse bindings
The mouse binding logic is inspired/copied from the
keyboard binding logic; we store a sorted list of the
currently pressed buttons, and trigger a binding when
the currently pressed (or just recently pressed, in
the case of a release binding) buttons, as well as
modifiers/container region, match those of a given
binding.

As the code to execute a binding is not very keyboard
specific, keyboard_execute_command is renamed to
seat_execute_command and moved to where the other
binding handling functions are. The call to
transaction_commit_dirty has been lifted out.
2018-07-23 21:38:29 -04:00
frsfnrrg 754372c3de Parse mouse binding options
First, the existing sway_binding structure is given an
enumerated type code. As all flags to bindsym/bindcode
are boolean, a single uint32 is used to hold all flags.
The _BORDER, _CONTENTS, _TITLEBAR flags, when active,
indicate in which part of a container the binding can
trigger; to localize complexity, they do not overlap
with the command line arguments, which center around
_TITLEBAR being set by default.

The keyboard handling code is adjusted for this change,
as is binding_key_compare; note that BINDING_LOCKED
is *not* part of the key portion of the binding.

Next, list of mouse bindings is introduced and cleaned up.

Finally, the binding command parsing code is extended
to handle the case where bindsym is used to describe
a mouse binding rather than a keysym binding; the
difference between the two may be detected as late as
when the first key/button is parsed, or as early as
the first flag.  As bindings can have multiple
keycodes/keysyms/buttons, mixed keysym/button sequences
are prohibited.
2018-07-23 21:14:22 -04:00
emersion 224ade1382
Merge pull request #2342 from RyanDwyer/update-cursor
Fix some cases where the cursor doesn't update
2018-07-24 00:31:19 +01:00
Ryan Dwyer 0db6f2ef58 Fix some cases where the cursor doesn't update
cursor_set_image only uploads the named image if it doesn't match the
previous named image. This means when setting the cursor image to a
surface as given by a client, we have to clear the currently stored
image.
2018-07-24 09:09:49 +10:00
Drew DeVault e94fd0e6eb
Merge pull request #2341 from RedSoxFan/fix-2339
Add missing checks to fix 2339
2018-07-23 16:19:00 -04:00
Brian Ashworth 44e218574f Add missing checks to fix 2339 2018-07-23 15:40:05 -04:00
emersion 5a77bc3215
Merge pull request #2338 from somdoron/master
fix crash on new output while swaylock is running
2018-07-23 17:47:40 +01:00
somdoron 7ead2e85a7 fix crash on new output while swaylock is running 2018-07-23 19:35:40 +03:00
Drew DeVault 0515b37dfd
Merge pull request #2323 from RyanDwyer/scratchpad
Implement scratchpad
2018-07-23 07:57:48 -04:00
Ryan Dwyer 12e90fa600 Store scratchpad list in sway_root instead of server 2018-07-23 08:24:32 +10:00
Ryan Dwyer 81e8f31cc6 Implement scratchpad
Implements the following commands:

* move scratchpad
* scratchpad show
* [criteria] scratchpad show

Also fixes these:

* Fix memory leak when executing command with criteria
(use `list_free(views)` instead of `free(views)`)
* Fix crash when running `move to` with no further arguments
2018-07-23 08:24:32 +10:00
Ryan Dwyer 89dc047ca9
Merge pull request #2328 from emersion/xdg-shell-set-title
Handle set_{title,app_id} for xdg-shell and zxdg-shell-v6
2018-07-23 08:18:58 +10:00
emersion 238c8afc74 Handle set_{title,app_id} for xdg-shell and zxdg-shell-v6
This allows to update the title even if the view doesn't commit.
This is useful e.g. when a terminal sets its toplevel title to
the currently running command and when the view isn't visible.
2018-07-22 22:20:07 +01:00
emersion be60e44b7c
Merge pull request #2296 from RyanDwyer/floating-modifier
Implement floating_modifier and mouse operations for floating views
2018-07-22 19:25:41 +01:00
Ryan Dwyer d21d4b83a3 Set cursor when beginning resize and move operations 2018-07-22 23:10:19 +10:00
Ryan Dwyer 009b426024 Fix damage when shrinking a floating view using cursor 2018-07-22 23:10:19 +10:00
Ryan Dwyer 5ba2ae9c6a Implement request_move and request_resize for xwayland views
I discovered we have to send a click event when ending the move or
resize operation to make xwayland's requests work correctly.
2018-07-22 23:10:19 +10:00
Ryan Dwyer 3faceadffe Fix focus bug with floating containers 2018-07-22 23:10:19 +10:00
Ryan Dwyer cf5f5eaf8c Deny move/resize events for tiled xdg shell views 2018-07-22 23:10:19 +10:00
Ryan Dwyer 011d1ebfa4 Consider view's min/max sizes when resizing 2018-07-22 23:10:19 +10:00
Ryan Dwyer 9df660ee31 Store last button and use it when views request to move or resize 2018-07-22 23:10:19 +10:00
Ryan Dwyer 6767d8a593 Prevent re-uploading the same cursor image multiple times 2018-07-22 23:10:19 +10:00
Ryan Dwyer 0c87bff5d1 Replace static handle_end_operation with seat_end_mouse_operation 2018-07-22 23:10:19 +10:00
Ryan Dwyer 86f5531511 Remove unnecessary includes 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 31f91bd483 Improve resize performance by partially flushing the transaction queue
When interactively resizing some views (eg. Nautilus), new transactions
are added to the queue faster than the client can process them.
Previously, we would wait for the entire queue to be ready before
applying any of them, but in this case the transactions would time out,
giving the client choppy performance.

This changes the queue handling so it applies the transactions up to the
first waiting transaction, without waiting for the entire queue to be
ready.
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 f9491c9584 Fix damage issue when moving and resizing 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 27f65b94ae
Merge pull request #2320 from RedSoxFan/reset-outputs-on-reload
Reset outputs on reload
2018-07-21 21:35:40 +10:00
Brian Ashworth bc7d332109 Reset outputs on reload 2018-07-20 22:17:20 -04:00
Brian Ashworth 51730a0597
Merge pull request #2317 from RyanDwyer/force-display-urgency-hint
Implement force_display_urgency_hint
2018-07-20 21:46:56 -04: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
emersion a2b2146f7f
Merge pull request #2318 from RedSoxFan/fix-output-wildcard
Fix output wildcard handling
2018-07-20 19:53:53 +01:00
Brian Ashworth 9605ab45f1 Fix output wildcard handling 2018-07-20 12:32:29 -04:00
Drew DeVault b642d47c7f
Merge pull request #2313 from minus7/swaybar-hotspot-input-fix
swaybar: Fix scroll handling on workspace buttons
2018-07-20 11:45:47 -04:00
Brian Ashworth 0a0b676f64
Merge pull request #2316 from RyanDwyer/fix-floating-pointer-events
Fix pointer events for overlapping floating views
2018-07-19 19:52:58 -04:00
Ryan Dwyer 8789ceea87 Fix pointer events for overlapping floating views
Fixes #2315.
2018-07-20 09:41:36 +10:00
Drew DeVault d28c4c0094
Merge pull request #2314 from emersion/update-wlroots-1148
Update for swaywm/wlroots#1148
2018-07-19 14:18:13 -07:00
Drew DeVault 3483f1ea1a
Merge branch 'master' into update-wlroots-1148 2018-07-19 14:09:19 -07:00
emersion 4154234eee Update for swaywm/wlroots#1148 2018-07-19 21:54:46 +01:00
minus bfcfabee2b swaybar: Fix scroll handling on workspace buttons
As well as ignoring scroll events on status elements when click_events
is enabled.
Previously, using the scroll wheel on a workspace button would switch to
that workspace instead of scrolling through them. Clicks and scrolling
on status elements would always be processed by swaybar, too. So in case
you were using scrolling as volume control on a status item, swaybar
would additionally scroll through your workspaces.
2018-07-19 21:15:01 +02:00
Drew DeVault da9c86c608
Merge pull request #2310 from RyanDwyer/assign-output
Implement assign to output
2018-07-19 10:10:38 -07:00
emersion d8badceb54
Merge pull request #2304 from RedSoxFan/fix-2298
Fix deferred command handling
2018-07-19 16:14:25 +01:00