Commit graph

663 commits

Author SHA1 Message Date
Arkadiusz Hiler 1e70f7b19e Turn funcs() into funcs(void)
If they really do not take undefined number of arguments.
2018-09-30 14:09:05 +03:00
emersion a53171669a
Merge pull request #2698 from ianyfan/hide-cursor
Only show cursor if pointer configured
2018-09-29 14:32:05 +02:00
PP ae2b70f59e add tap-and-drag setting to sway-input 2018-09-29 11:49:41 +02:00
Ryan Dwyer 7b138e5ef0 Add CSD to border modes
This replaces view.using_csd with a new border mode: B_CSD. This also
removes sway_xdg_shell{_v6}_view.deco_mode and
view->has_client_side_decorations as we can now get these from the
border.

You can use `border toggle` to cycle through the modes including CSD, or
use `border csd` to set it directly. The client must support the
xdg-decoration protocol, and the only client I know of that does is the
example in wlroots.

If the client switches from SSD to CSD without us expecting it (via the
server-decoration protocol), we stash the previous border type into
view.saved_border so we can restore it if the client returns to SSD. I
haven't found a way to test this though.
2018-09-27 22:51:37 +10:00
Drew DeVault 5912be46c3
Merge pull request #2704 from ianyfan/tablet-config
input: enable configuring tablets with libinput
2018-09-27 02:07:15 -05:00
Alexander Bakker d129108cdd Add a missing null check for moving tiling containers 2018-09-25 22:19:46 +02:00
Ian Fan 6194a445d3 input: enable configuring tablets with libinput 2018-09-24 12:49:20 +01:00
Ian Fan a10fef9ae8 cursor: allow cursor_set_image to accept a NULL image to hide cursor 2018-09-24 12:34:09 +01:00
Ian Fan dafb0526d7 seat: only show cursor if pointer configured 2018-09-24 10:55:42 +01:00
Brian Ashworth baeb28ea62 Implement support for input wildcard 2018-09-23 19:56:52 -04:00
Ryan Dwyer 271b24ddfb Fix GtkMenuBar always opening first item
It seems like advertising that we support touch when we don't, while
using SSD, makes GtkMenuBar misbehave. Please don't ask me why...
2018-09-23 22:00:18 +10:00
Ryan Dwyer bf5933c501 Implement tab cycling using mouse wheel
Firstly, a change had to be made to the container_at functions. If you
create layout `T[view H[view view]]` and hover the second tab, the
container_at functions would return the focus_inactive child. They now
return the split container itself. To compensate for this,
dispatch_cursor_button has been adjusted to find the focus_inactive
child before focusing it.

The actual implementation of wheel scrolling is pretty straightforward.
This uses handle_cursor_axis, so I took a similar approach to
handle_cursor_button (ie. creating a dispatch_cursor_axis function).
2018-09-22 10:42:59 +10:00
Ryan Dwyer f6e218a643 Rename seat_get_active_child to seat_get_active_tiling_child
Also renames container to con in one function to prevent ugly line
wrapping.
2018-09-16 22:01:54 +10:00
Ryan Dwyer 48bc15e758 Make seat_get_active_child ignore floating children
seat_get_active_child is used to get the active tiling child in a few
places, such as outputs getting their active workspace and
tabbed/stacked containers getting their visible child. When a workspace
uses a tabbed or stacked layout and contains a focused floating view,
calling seat_get_active_child on the workspace would incorrectly return
the floating view. This changes it so it will return the tiling child.

This fixes the following bug:

* Create layout T[view view] then float one of the views
* Attempt to click the tiling view to give it focus - it wouldn't work
because seat_get_active_child would return the floating view
2018-09-16 21:57:19 +10:00
emersion 7699c5444c Update for swaywm/wlroots#1243 2018-09-14 19:21:44 +02:00
Ryan Dwyer 679c7eb08c Minor fixes to tiling drag implementation
* Make container_add_sibling's `after` argument a boolean.
* Use a constant for drop layout border
* Make thickness an int
* Add button state check
* Move comments in seat_end_move_tiling
2018-09-12 08:46:46 +10:00
Ryan Dwyer 403905c11b Fix line length 2018-09-11 23:24:57 +10:00
Ryan Dwyer 8bb40c24c7 Implement tiling drag
Hold floating_modifier and drag a tiling view to a new location.
2018-09-11 21:34:21 +10:00
Ryan Dwyer d4e80cf301 Rename OP_MOVE to OP_MOVE_FLOATING
In preparation for introducing OP_MOVE_TILING.
2018-09-11 16:56:05 +10:00
Drew DeVault 030b5bc024
Merge pull request #2603 from emersion/fix-dnd
Fix drag-and-drop
2018-09-07 11:09:02 -04:00
emersion 251a7ebc4b Fix drag-and-drop 2018-09-07 15:43:15 +02:00
Ryan Dwyer 763554e1be Fix workspace switching
The output also needs to be made dirty when focusing a new output.
2018-09-07 08:08:40 +10:00
Ryan Dwyer f30527e0cd Don't dirty outputs unnecessarily 2018-09-06 23:25:10 +10:00
Ryan Dwyer 5896781df4 Make outputs dirty when changing focus
Fixes a workspace switch bug introduced by
5967ee1fbc.
2018-09-06 21:15:24 +10:00
Ryan Dwyer 908095ef9a Introduce seat_set_focus_container and seat_set_focus_workspace
These are the same as seat_set_focus, but accept a specific type rather
than using nodes. Doing this adds more typesafety and lets us avoid
using &con->node which looks a little ugly.

This fixes a crash that pretty much nobody would ever come across. If
you have a bindsym for "focus" with no arguments and run it from an
empty workspace, sway would crash because it assumes `container` is not
NULL.
2018-09-06 19:26:56 +10:00
emersion bea9f9c63f
Merge pull request #2578 from RyanDwyer/fix-binding-reload
Fix management of bindings during reload
2018-09-06 10:41:49 +02:00
Ryan Dwyer 5cc70d1dfd Restore focus correctly when closing a fullscreen view
We weren't calling seat_send_focus. I think this was previously called
by seat_set_focus_warp.
2018-09-06 09:33:37 +10:00
Ryan Dwyer 32c7386b0f Fix management of bindings during reload
seat_execute_command needs to check the flags on `binding_copy`, as
`binding` will be a dangling pointer after a reload command.

handle_keyboard_key needs to set the next_repeat_binding for
non-reloads prior to executing the command in case the binding is
freed by the reload command.
2018-09-06 08:33:00 +10:00
Ryan Dwyer 6f71749398 Fix clicking workspace buttons
Because node_at_coords was returning the workspace's node, it
interpreted this as clicking the focused workspace which was a no op.
2018-09-05 18:01:43 +10:00
Ryan Dwyer e5c9204b49 Focus empty workspace when clicking it
Also removes container_at_coords as this function is no longer
necessary.
2018-09-05 18:01:43 +10:00
Ryan Dwyer 4e0452fce3 Fix scratchpad related crashes
* Was crashing when a view was moved to the scratchpad (prev focus had
no parent).
* Was crashing when a hidden scratchpad view unmaps because it has no
workspace.
2018-09-05 18:01:43 +10:00
Ryan Dwyer fb9b0f7a08 Fix focus bug
When changing focus from a view in one workspace to an empty workspace
using `focus <direction>`, the view in the previous workspace would keep
focused styling. This is because the check to unfocus it was only done
in the container case and not workspace case, so it's been moved out of
both.
2018-09-05 18:01:43 +10:00
Ryan Dwyer eccfcde2eb Fix crash when moving mouse over a fullscreen split container 2018-09-05 18:01:43 +10:00
Ryan Dwyer 2aa6afae54 Fix mouse_warping 2018-09-05 18:01:43 +10:00
Ryan Dwyer 7586f150c0 Implement type safe arguments and demote sway_container
This commit changes the meaning of sway_container so that it only refers
to layout containers and view containers. Workspaces, outputs and the
root are no longer known as containers. Instead, root, outputs,
workspaces and containers are all a type of node, and containers come in
two types: layout containers and view containers.

In addition to the above, this implements type safe variables. This
means we use specific types such as sway_output and sway_workspace
instead of generic containers or nodes. However, it's worth noting that
in a few places places (eg. seat focus and transactions) referring to
them in a generic way is unavoidable which is why we still use nodes in
some places.

If you want a TL;DR, look at node.h, as well as the struct definitions
for root, output, workspace and container. Note that sway_output now
contains a workspaces list, and workspaces now contain a tiling and
floating list, and containers now contain a pointer back to the
workspace.

There are now functions for seat_get_focused_workspace and
seat_get_focused_container. The latter will return NULL if a workspace
itself is focused. Most other seat functions like seat_get_focus and
seat_set_focus now accept and return nodes.

In the config->handler_context struct, current_container has been
replaced with three pointers: node, container and workspace. node is the
same as what current_container was, while workspace is the workspace
that the node resides on and container is the actual container, which
may be NULL if a workspace itself is focused.

The global root_container variable has been replaced with one simply
called root, which is a pointer to the sway_root instance.

The way outputs are created, enabled, disabled and destroyed has
changed. Previously we'd wrap the sway_output in a container when it is
enabled, but as we don't have containers any more it needs a different
approach. The output_create and output_destroy functions previously
created/destroyed the container, but now they create/destroy the
sway_output. There is a new function output_disable to disable an output
without destroying it.

Containers have a new view property. If this is populated then the
container is a view container, otherwise it's a layout container. Like
before, this property is immutable for the life of the container.

Containers have both a `sway_container *parent` and
`sway_workspace *workspace`. As we use specific types now, parent cannot
point to a workspace so it'll be NULL for containers which are direct
children of the workspace. The workspace property is set for all
containers, except those which are hidden in the scratchpad as they have
no workspace.

In some cases we need to refer to workspaces in a container-like way.
For example, workspaces have layout and children, but when using
specific types this makes it difficult. Likewise, it's difficult for a
container to get its parent's layout when the parent could be another
container or a workspace. To make it easier, some helper functions have
been created: container_parent_layout and container_get_siblings.

container_remove_child has been renamed to container_detach and
container_replace_child has been renamed to container_replace.

`container_handle_fullscreen_reparent(con, old_parent)` has had the
old_parent removed. We now unfullscreen the workspace when detaching the
container, so this function is simplified and only needs one argument
now.

container_notify_subtree_changed has been renamed to
container_update_representation. This is more descriptive of its
purpose. I also wanted to be able to call it with whatever container was
changed rather than the container's parent, which makes bubbling up to
the workspace easier.

There are now state structs per node thing. ie. sway_output_state,
sway_workspace_state and sway_container_state.

The focus, move and layout commands have been completely refactored to
work with the specific types. I considered making these a separate PR,
but I'd be backporting my changes only to replace them again, and it's
easier just to test everything at once.
2018-09-05 18:01:43 +10:00
Ryan Dwyer 7797490e9e Deny repeating reload by holding key
Fixes #2568

The binding that gets stored in the keyboard's `repeat_binding` would
get freed on reload, leaving a dangling pointer.

Rather than attempt to unset the keyboard's `repeat_binding` along with
the other bindings, I opted to just not set it for the reload command
because there's no point in reloading repeatedly by holding the binding.
This disables repeat bindings for the reload command.

As we now need to detect whether it's a reload command in two places,
I've added a binding flag to track whether it's a reload or not.
2018-09-04 20:00:04 +10:00
Drew DeVault 80270ba086
Merge pull request #2544 from RyanDwyer/fix-deferred-cmd-crash
Fix crash when running deferred commands
2018-09-01 13:00:26 -04:00
Ryan Dwyer dce549c537 Don't send never-ending transactions when a focused layer surface commits
This moves the arrange_windows call into the arrange_layers function,
where we know the output actually needs to be arranged.

Additionally, we shouldn't set focus to the parent of an unknown
container type, because the parent may be an output and this causes a
crash because outputs can't have direct focus.

Fixes #2543
2018-08-31 21:39:28 +10:00
Ryan Dwyer 1e0459f7f7 Fix crash when running deferred commands
Fixes #2541
2018-08-31 19:49:12 +10:00
Ian Fan 3bf849d993 seat.c: clean-up seat_set_focus_warp function 2018-08-27 13:25:01 +01:00
Ryan Dwyer 5dbbab7bdc Remove layout.c
When we have type safety we'll need to have functions for
workspace_add_tiling and so on. This means the existing container
functions will be just for containers, so they are being moved to
container.c. At this point layout.c doesn't contain much else, so I've
relocated everything and removed the file.

* container_swap and its static functions have been moved to the swap
command and made static.
* container_recursive_resize has been moved to the resize command and
made static.
* The following have been moved to container.c:
    * container_handle_fullscreen_reparent
    * container_insert_child
    * container_add_sibling
    * container_add_child
    * container_remove_child
    * container_replace_child
    * container_split
* enum movement_direction and sway_dir_to_wlr have been moved to util.c.

Side note: Several commands included layout.h which then included
root.h. With layout.h gone, root.h has to be included by those commands.
2018-08-26 12:05:16 +10:00
Ryan Dwyer b6058703fa Refactor destroy functions and save workspaces when there's no outputs
This changes the destroy functions to the following:

* output_begin_destroy
* output_destroy
* workspace_begin_destroy
* workspace_destroy
* container_begin_destroy
* container_destroy
* view_begin_destroy
* view_destroy

The terminology was `destroy` and `free`, and it has been changed to
`begin_destroy` and `destroy` respectively.

When the last output is disconnected, its workspaces will now be stashed
in the root. Upon connection of a new output they will be restored.

There is a new function `workspace_consider_destroy` which decides
whether the given workspace should be destroyed or not (ie. empty and
not visible).

Calling container_begin_destroy will no longer automatically reap the
parents. In some places we want to reap the parents and in some we
don't, so this is left to the caller.

container_reap_empty_recursive and container_reap_empty have been
combined into one function and it will recurse up the tree.
2018-08-24 22:17:28 +10:00
Ryan Dwyer f129b1b89f Replace enum resize_edge with wlr_edges 2018-08-21 12:41:57 +10:00
Ryan Dwyer 2b5a404ac9 Replace hacky L_FLOATING container with a list
Workspaces previously had a magical `workspace->floating` container,
which had a layout of L_FLOATING and whose children were actual floating
views. This allowed some conveniences, but was a hacky solution because
the container has to be exempt from focus, coordinate transactions with
the workspace, and omit emitting IPC events (which we didn't do).

This commit changes it to be a list directly in the sway_workspace. The
L_FLOATING layout is no longer used so this has been removed as well.

* Fixes incorrect check in the swap command (it checked if the
containers had the L_FLOATING layout, but this layout applied to the
magical container).
* Introduces workspace_add_floating
2018-08-19 16:18:33 +10:00
Ryan Dwyer d6cd79c342 Implement iterators per container type
This introduces the following `for_each` functions:

* root_for_each_workspace
* root_for_each_container
* output_for_each_workspace
* output_for_each_container
* workspace_for_each_container

And introduces the following `find` functions:

* root_find_output
* root_find_workspace
* root_find_container
* output_find_workspace
* output_find_container
* workspace_find_container
* container_find_child

And removes the following functions:

* container_descendants
* container_for_each_descendant
* container_find

This change is preparing the way for demoting sway_container. Eventually
these functions will accept and return sway_outputs, sway_workspaces and
sway_containers (meaning a C_CONTAINER or C_VIEW).

This change also makes it easy to handle abnormalities like the
workspace floating list, root's scratchpad list and (once implemented)
root's saved workspaces list for when there's no connected outputs.
2018-08-18 23:38:54 +10:00
Drew DeVault d4a32800d5
Merge pull request #2460 from RyanDwyer/implement-mousedown
Implement mousedown operation
2018-08-18 09:32:04 -04:00
Ryan Dwyer d22420689d Fix mod+resize
Fixes #2479.

It was missing a mod_pressed check.

This also moves the parent traversal into the `if` block.
2018-08-18 17:50:37 +10:00
Ryan Dwyer 07a897b3b7 Don't send motion if the cursor hasn't moved
Prevents GTK+ comboboxes from immediately closing.
2018-08-18 09:29:18 +10:00
Ryan Dwyer b637b61a7a Rename mousedown to down and make seat operation a named enum 2018-08-18 09:18:32 +10:00
Ryan Dwyer a36625a482 Implement mousedown operation
This allows you to move the cursor off the surface while dragging its
scrollbar.
2018-08-18 09:18:32 +10:00
Ryan Dwyer 3a888163a0 Refactor seat_get_focus functions
Fixes #2467.

This commit introduces seat_get_focus_inactive_floating to supplement
seat_get_focus_inactive_tiling, and uses it during `focus mode_toggle`
which fixes a focus bug.

This also refactors the seat_get_focus_inactive functions so that they
do their selection logic themselves rather than offloading it to
seat_get_focus_by_type which was getting bloated. seat_get_focus_by_type
is now removed.

Lastly, this commit changes seat_get_focus to just return the first
container in the focus stack rather than looping and calling
seat_get_focus_by_type.
2018-08-17 17:32:53 +10:00
Ryan Dwyer 4d023c0390 Make mod+resize a floating container resize the container itself
Rather than resizing the split within the container.
2018-08-12 10:45:54 +10:00
Ryan Dwyer e9d46ccbdd Use col-resize and row-resize cursor images 2018-08-12 10:45:54 +10:00
Ryan Dwyer 1893515d3a Fix right-click/popups and add state checks 2018-08-12 10:45:54 +10:00
Ryan Dwyer 2dceae6224 Allow resizing tiled views via mod key 2018-08-12 10:45:54 +10:00
Ryan Dwyer f4280e506b Refactor dispatch_cursor_button
There was a separate function dispatch_cursor_button_floating which
dealt with the resize and move operations, but as resize is not really
limited to floating views, it doesn't make as much sense to have this
separate. So both functions are now combined into one.

Additionally, dispatch_cursor_button now uses a pattern of returning
early instead of using else-ifs.
2018-08-12 10:45:54 +10:00
Ryan Dwyer b4a0363d17 Implement resizing tiled containers via cursor
* The OP_RESIZE seat operation has been renamed to OP_RESIZE_FLOATING,
and OP_RESIZE_TILING has been introduced.
* Similar to the above, seat_begin_resize and handle_resize_motion have
been renamed and tiling variants introduced.
* resize.c's resize_tiled has to be used, so container_resize_tiled has
been introduced in resize.c to allow external code to call it.
2018-08-12 10:45:54 +10:00
Drew DeVault 2aa6d98c5a
Merge pull request #2449 from RyanDwyer/remove-bfs
Remove container_for_each_descendant_bfs
2018-08-11 08:29:34 -04:00
Ryan Dwyer 4ad1ccc9dc Remove container_for_each_descendant_bfs
The function was not used.

Also renames container_for_each_descendant_dfs to just
container_for_each_descendant.
2018-08-11 15:57:09 +10:00
Ryan Dwyer 31844bf42b Remove container_has_child
In all cases you can use container_has_ancestor with the arguments
swapped, which is faster than container_has_child.
2018-08-11 15:36:19 +10:00
Ryan Dwyer f5dc3ac09d Don't call send_pointer_notify_button when doing move or resize 2018-08-08 22:32:59 +10:00
Ryan Dwyer 4c5dc6f135 Focus floating views when beginning move/resize operations 2018-08-08 22:28:13 +10:00
Ryan Dwyer a0649190de Fix edge cases when moving floating container to new workspace
* Removes container_floating_move_to_container, instead opting to put
that logic in container_move_to
* In the seat code, focusing a floating view now updates the pending
state only and lets the next transaction carry it over to the current
state. This is required, otherwise it would crash.
* When unfullscreening a floating container, an output check is now done
to see if it should center it.
2018-08-08 08:48:20 +10:00
Ryan Dwyer c17f0870ef Fix crash when moving cursor over a fullscreen split container
Calling container_at_view fails an assertion if the container isn't a
view. Calling tiling_container_at works correctly, as that function
checks if the container is a view and calls container_at_view if so.
2018-08-03 18:08:20 +10:00
emersion b336564511 Fix pointer events for fullscreen views 2018-08-02 22:48:43 +01:00
minus e72f86784c Fix crash on mouse motion on fullscreen container
container_at expects a workspace, not the fullscreened container.
Fixes #2409
2018-08-02 23:19:01 +02:00
Ryan Dwyer 8392eae40f Revert "Revert "Fix popups""
This reverts commit 9aa258d33a.

Reverting the revert, so that popups can be fixed.
2018-08-02 23:36:36 +10:00
Drew DeVault 9aa258d33a Revert "Fix popups"
This reverts commit de86d65627.
2018-08-02 09:05:46 -04:00
Ryan Dwyer 9339026a31 Fix focus related crashes
* seat_set_focus_warp lacked a container NULL check
* view mapping code needs to use seat_get_focus_inactive

Also, seat_set_focus_warp triggered the wrong IPC event if focus was a
workspace, which resulted in swaybar not showing the workspace as
active.
2018-08-02 21:55:37 +10:00
Drew DeVault 9564c73c0d
Merge pull request #2391 from RyanDwyer/fix-popups-v2
Fix popups (v2)
2018-08-01 22:02:12 -04:00
Ian Fan 03eaf444a4 ipc: prevent emitting a workspace::focus event when moving a container to a different workspace or output
When a container is moved from, say, workspace 1 to workspace 2, workspace 2 is focused in order to arrange the windows before focus is moved back to workspace 1, which caused a workspace:focus event from workspace 2 to workspace 1 to be emitted. This commit inhibits that event.
2018-08-01 16:57:15 +01:00
Ian Fan b2ac234569 ipc: fix workspace::focus event behaviour 2018-08-01 16:57:15 +01:00
Ian Fan dd1d6255f0 ipc: add window::focus event 2018-08-01 16:57:14 +01:00
chr0me 77d74dd34f XCursor is not configured if no pointer device is available 2018-08-01 23:27:36 +08:00
Ryan Dwyer 7a59508da4 Close popups when changing focus
Also reverts the send frame done changes from the previous commit.
2018-07-31 19:58:34 +10:00
Ryan Dwyer de86d65627 Fix popups
Fixes the render and container_at order for popups.

Fixes #2210

For rendering:

* render_view_surfaces has been renamed to render_view_toplevels
* render_view_toplevels now uses output_surface_for_each_surface (which
is now public), as that function uses wlr_surface_for_each_surface which
doesn't descend into popups
* Views now have a for_each_popup iterator, which is used by the
renderer to render the focused view's popups
* When rendering a popup, toplevels (xdg subsurfaces) of that popup are
also rendered

For sending frame done, the logic has been updated to match the
rendering logic:

* send_frame_done_container no longer descends into popups
* for_each_popup is used to send frame done to the focused view's popups
and their child toplevels

For container_at:

* floating_container_at is now static, which means it had to be moved
higher in the file.
* container_at now considers popups for the focused view before checking
containers.
* tiling_container_at has been introduced, so that it doesn't call
container_at recursively (it would check popups recursively if it did)
2018-07-31 18:41:30 +10:00
frsfnrrg 8dbbfa5965 Bindings use advised keyboard repeat parameters
Now 'repeat_delay' and 'repeat_rate' control the initial delay
and rate (per second) of repeated binding invocations.

If the repeat delay is zero, binding repetition is disabled.
When the repeat rate is zero, the binding is repeated exactly
once, assuming no other key events intervene.
2018-07-29 19:15:10 -04:00
frsfnrrg e33dfbfa75 Implement key repeat for pressed key bindings
Each sway_keyboard is provided with a wayland timer event source.
When a valid keypress binding has been found, a callback to
handle_keyboard_repeat is set. Any key event will either clear
the callback or (if the new key event is a valid keypress binding)
delay the callback again.
2018-07-29 19:15:02 -04:00
emersion 5af776e734
Merge pull request #2376 from swaywm/virtual-keyboard
Add virtual keyboard protocol
2018-07-29 13:59:54 +01:00
Drew DeVault 1e65439a54 Add virtual keyboard protocol
Ref #2373
2018-07-28 20:47:56 -04:00
Geoff Greer 30fee94354 Don't enable numlock by default. This fixes an annoying issue where laptop keyboards would have 'numlock mode' enabled, remapping parts of the alphabet to numbers. 2018-07-28 16:22:20 -07:00
Drew DeVault 53069f1403
Merge pull request #2360 from RyanDwyer/floating-containers
Allow containers to float
2018-07-28 09:30:12 -04:00
Ryan Dwyer da2a87f6c7 When unfloating, return container to previously focused tiled container
This introduces seat_get_focus_inactive_tiling and updates
`focus mode_toggle` to use it instead, because the previous method
wasn't guaranteed to return a tiling view.
2018-07-28 22:41:04 +10:00
Ryan Dwyer 0b6b6716e2 Fix clicking a floating split container
It would focus the split container rather than the child.

This commit makes it track the child and the split container separately
and send the surface click to the child.
2018-07-28 22:41:04 +10:00
Ryan Dwyer 08cfba2192 Allow containers to float
Things worth noting:

* When a fullscreen view unmaps, the check to unset fullscreen on the
workspace has been moved out of view_unmap and into container_destroy,
because containers can be fullscreen too
* The calls to `container_reap_empty_recursive(workspace)` have been
removed from `container_set_floating`. That function reaps upwards so it
wouldn't do anything. I'm probably the one who originally added it...
* My fix (b14bd1b0b1) for the tabbed child
crash has a side effect where when you close a floating container, focus
is not given to the tiled container again. I've removed my fix and
removed the call to `send_cursor_motion` from `seat_set_focus_warp`. We
should consider calling it from somewhere earlier in the call stack.
2018-07-28 22:41:04 +10:00
Ryan Dwyer a4bcddcfdc Include errno.h 2018-07-28 22:40:43 +10:00
Ryan Dwyer d6daf10cad Show errno description in log 2018-07-28 22:40:43 +10:00
Ryan Dwyer 32663b7b01 Handle out-of-fd situations gracefully for transaction and urgent timers 2018-07-28 22:40:43 +10:00
Ryan Dwyer 27a20a4884 Allow containers to be fullscreen 2018-07-26 08:27:07 +10:00
ProgAndy 76ece5788b Fix LEDs for configured modifier states 2018-07-25 17:24:45 +02:00
ProgAndy 2166dbe2e4 Implement setting NumLock and CapsLock status
After setting the keymap, try to enable NumLock and disable CapsLock.
This only works if sway has the xkb master state and controls the keyboard.
Prepare configuration settings for later use as well.
2018-07-25 17:24:45 +02:00
Drew DeVault fc718f629a
Merge pull request #2350 from ppascher/xwayland-optional
Added meson option to allow building sway without xwayland support
2018-07-25 08:27:40 -04:00
Pascal Pascher f95cb9a7c1 reverted includes of "sway/config.h" and replaced with "config.h" from meson build 2018-07-25 13:32:20 +02:00
Pascal Pascher 79a45d4a40 more style fixes, included "sway/config.h" where needed 2018-07-25 12:17:10 +02:00
Ryan Dwyer b14bd1b0b1 Fix crash when closing last child of a tabbed container
The crash only occurs if the mouse cursor is above the tabbed container
when the last child is closed.

Introduced in 03d49490cc, over a week ago
and unnoticed until now :O

The above commit changes the behaviour of a focus change. When you
change focus, it sends pointer motion which makes the client set a new
cursor image. We already had this behaviour for workspace switching, but
this commit adds it for view switching too, such as in a tabbed
container or when closing a view.

The sequence of events that leads to the crash is:

* The last child of a tabbed container unmaps, which triggers a
`destroy` event before we've cleaned up the child or reaped the tabbed
container.
* The seat code listens to the `destroy` event and removes the seat
container from the focus stack. As part of this, it decides to set focus
to the parent (my fix alters this decision).
* When setting focus to the new parent, the container motion is sent as
per the previously mentioned commit.
* The motion code uses `container_at`, which encounters the tabbed
container and its child in a half destroyed state, and everything blows
up from there.

`con->parent` is needed because scratchpad containers don't have parents
if they're hidden, so this probably fixes a crash when a hidden
scratchpad container closes too.

The `con->parent->children->length > 1` check should catch any cases
where the parent is about to be reaped.
2018-07-25 19:26:12 +10:00
Brian Ashworth 3a75bb7f32 Change button var passed to seat_begin_move 2018-07-24 18:52:54 -04:00
Brian Ashworth dca02944ce Implement floating_modifier <mod> [inverse|normal] 2018-07-24 18:41:08 -04:00
Pascal Pascher 2bf893248a style fixes, exclude sway/desctop/xwayland.c when enable_xwayland: false 2018-07-24 23:37:41 +02:00
Pascal Pascher 24ad1c3983 Added meson option "enable_xwayland" (default: true) to enable/disable xwayland support 2018-07-24 22:16:06 +02:00
Ryan Dwyer 2f1b84a0f3 Fix crash when clicking certain surfaces
cont was NULL.
2018-07-24 21:12:24 +10:00
Ryan Dwyer e7c10f1871 Make mod+resize work in any direction
This makes it so if you hold mod and right click on a surface to resize
it, the resize direction is chosen based on which quarter of the surface
you've clicked. The previous implementation only resized towards the
bottom right.
2018-07-24 20:20:00 +10:00
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
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
Brian Ashworth 44e218574f Add missing checks to fix 2339 2018-07-23 15:40:05 -04: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 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 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
frsfnrrg a056419ad7 Rewrite shortcut handling code to avoid hardcoded values
The same shortcut algorithm is now used for keycodes,
raw keysyms, and translated keysyms. Pressed keysyms
are now stored in association with the keycodes that
generated them. Modifier keycodes (and associated
keysyms) are identified retroactively by the subsequent
change to the modifier flags.
2018-06-01 18:52:36 -04:00
Drew DeVault e605dc43bb Fix mouse warping interaction with layout coords 2018-06-01 23:14:58 +10:00
Ryan Dwyer e4e912ea91 Store swayc coordinates as layout-local 2018-06-01 23:14:58 +10:00
Ryan Dwyer 1f2e399ade Implement floating 2018-06-01 23:14:58 +10:00
Ryan Dwyer 7c7d24600b Fix ancestor typos 2018-05-28 12:45:42 +10:00
Drew DeVault b2c0ba5b18
Merge pull request #2050 from smlx/focus-fix
Focus containers only on entry.
2018-05-27 15:42:39 -04:00
frsfnrrg a78a5684ea Implement bindsym/bindcode --locked
Adds the --locked flag to bindsym and bindcode commands.

When a keyboard's associated seat has an exclusive client
(i.e, a screenlocker), then bindings are only executed if
they have the locked flag. When there is no such client,
this restriction is lifted.
2018-05-27 13:28:02 -04:00
Scott Leggett 4d8120ccf3 Improve comment. 2018-05-28 02:35:24 +10:00
Scott Leggett b57f88e7db Avoid assert on container type. 2018-05-28 02:25:42 +10:00
Scott Leggett 1b8de39287 Move previous cursor_position inline. 2018-05-28 02:14:19 +10:00
Scott Leggett d1ebbebea0 Remove unused function. 2018-05-28 01:38:46 +10:00
Scott Leggett 0039f7a4fd Simplify logic, remove redundant variables. 2018-05-28 01:38:46 +10:00
Scott Leggett dd86444e59 Rely on view_is_visible rather thank walking the tree ourselves. 2018-05-28 01:38:46 +10:00
Scott Leggett 4cd304e4ba Store previous position in sway_cursor. 2018-05-28 01:37:43 +10:00
Scott Leggett 06098bef98 Focus containers only on entry. 2018-05-27 15:29:48 +10:00
Drew DeVault fea654a6ce Replace oft-failing abort with if statement
Fixes #2045
2018-05-26 10:35:15 -04:00
Ivan Chebykin 464ec44b00
Check for next_focus before assert 2018-05-26 15:54:49 +03:00
Ivan Chebykin 6e6b0decd9
Fix usage of sway_assert 2018-05-26 15:51:36 +03:00
Ivan Chebykin 820a8c9c2d
Moved visibility check of of loop, added asserts 2018-05-26 13:34:14 +03:00
Ivan Chebykin 740234a4bc
Break after first tabbed/stacked layout 2018-05-25 17:45:41 +03:00
Ivan Chebykin 53516fa03f
Fix mouse focusing for horizontal/vertical views in tabbed containers 2018-05-25 17:22:25 +03:00
Ivan Chebykin f85d3e15ba
Fixed styling issues 2018-05-25 16:54:43 +03:00
Ivan Chebykin e19fe56e2f
Focus inactive container instead of checking cursor position 2018-05-25 16:54:43 +03:00
Ivan Chebykin 3b67253312
Skip all nested containers 2018-05-25 16:54:43 +03:00
Ivan Chebykin c62efbb5ce
Implement correct focusing for tabbed containers 2018-05-25 16:54:43 +03:00
Ivan Chebykin c1be4b0153
Fix focusing from other containers 2018-05-25 16:54:43 +03:00
Ivan Chebykin 87af08966a
Don't focus tabbed and stacked containers on mouseover 2018-05-25 16:54:43 +03:00
Drew DeVault 8bbf78fdd4 Fix focus follows mouse with no focus 2018-05-21 17:21:01 -04:00
Ryan Dwyer efc07fb3d4 Don't track damage for views on inactive tabs 2018-05-21 20:16:56 +10:00
Ryan Dwyer c08f9bf257 Implement tabbed layout 2018-05-21 20:16:56 +10:00
Brian Ashworth 82cd55a670 Fix border commands from changing focus 2018-05-20 23:12:33 -04:00
Drew DeVault a3d3c819cf Fix focus_follows_mouse over swaybar
If you moved your mouse over swaybar (e.g. to scroll between
workspaces), focus would move to the workspace. This is not the right
thing to do. The solution is complicated by the fact that if you move
your mouse into a new output with an empty workspace, that workspace
_should_ receive focus.
2018-05-20 14:46:29 -04:00
Mattias Eriksson 8fbafbfab5 Idle handling for dpms/lockscreen et al
Swayidle handles idle events and allows
for dpms and lockscreen handling. It also
handles systemd sleep events, and can
raise a lockscreen on sleep

Fixes #541
2018-05-13 00:30:09 +02:00
emersion 50298dc901
Send pointer discrete axis values and source
Update for swaywm/wlroots#970
2018-05-12 13:56:17 +01:00
Ryan Dwyer 83e314bf51 Highlight all child borders when using focus parent 2018-05-11 09:20:46 +10:00
emersion 70b80b4698
Damage container on focus 2018-05-10 23:03:50 +01:00
Drew DeVault 029c9b1796
Merge pull request #1907 from emersion/backend-input-mapping
Default to backend-wise input device mapping, if any
2018-05-03 10:46:02 -04:00
Drew DeVault d233e75eec Hide cursor on touch down 2018-05-03 10:39:34 -04:00
emersion 424006089e
Default to backend-wise input device mapping, if any 2018-05-03 14:16:17 +01:00
Drew DeVault 52aa245b24 Implement basic touch support
This required changing container_at_cursor to container_at_coords so
that we could get the appropriate surface (and sx/xy) without moving the
cursor.

Future work:

- Simulate a cursor for clients which have not bound to wl_touch
- Keep sending motion events when moving outside the surface (#1892)
- Bind gestures to sway commands
2018-05-02 09:00:26 -04:00
emersion 976e6b99b6
Merge branch 'master' into refactor-arrange-windows 2018-04-29 13:10:59 +01:00
Ryan Dwyer 167c2e1aa9 Refactor arrange_windows()
Replaces arrange_windows() with arrange_root(), arrange_output(),
arrange_workspace() and arrange_children_of().

Also makes fullscreen views save and restore their dimensions, which
allows it to preserve any custom resize and is also a requirement for
floating views once they are implemented.
2018-04-28 11:26:14 +10:00
emersion 860d2384b4
Update for swaywm/wlroots#923 2018-04-27 17:30:45 +01:00
emersion ff61df17ff
Add map_from_region command 2018-04-26 10:53:47 +01:00
emersion 3ed3bdf03f
Fix segfault when switching back to workspace with osu! 2018-04-24 18:18:49 +01:00
emersion 4cf77e1de4
Default to current time when triggering cursor events 2018-04-21 14:07:22 +01:00
emersion 33ed279494
Update cursor when workspace focus changes 2018-04-21 12:46:48 +01:00
Drew DeVault 777800e37a Fix qutebrowser crash on context menu dismissal 2018-04-19 09:15:21 -04:00
Drew DeVault 21eb63cc9e
Merge branch 'master' into fullscreen 2018-04-19 08:56:03 -04:00
Ryan Dwyer 5b30391383 Make key repeat configurable
This creates two input commands for configuring the repeat delay and rate.

Example config:

    input "myidentifier" {
        repeat_delay 250
        repeat_rate 25
    }
2018-04-18 23:19:23 +10:00
Ryan Dwyer 8d06b222f0 Fullscreen rendering and input fixes.
* Render background when using fullscreen, because transparency.
* Check that fullscreen surface allows input.
* Don't look for surfaces in top layer if there's a fullscreen view.
2018-04-18 13:06:10 +10:00
Ryan Dwyer 35ccdd67a8 More fullscreen fixes.
* Render fullscreen views without wlr function, which makes popups and
lockscreen work.
* Don't allow input events to surfaces behind fullscreen views.
* Use correct output dimensions (for rotated outputs).
2018-04-18 08:35:28 +10:00
Ryan Dwyer c685ef081f Create sway_workspace struct. 2018-04-17 09:31:34 +10:00
Ryan Dwyer 52420cc24d Implement fullscreen. 2018-04-16 20:36:40 +10:00
db f555edf353 remove empty workspace when focusing its output
Until now, focus changing code only considered cleaning up the last focused
workspace. This commit adds removal of empty workspace from output that just
received focus on a different workspace.

Fixes: #1797
2018-04-15 08:30:30 +02:00
Dominique Martinet 1fd21650d7 seat_set_focus_wrap: fix use-after-free when destroying last focused container 2018-04-13 14:58:23 +09:00
Danny Bautista 1edb2bd892 Implement cursor event simulation with sway commands. 2018-04-10 12:40:50 -04:00
Drew DeVault 07b6be6214
Merge pull request #1769 from acrisci/focus-inactive-fixes
Focus inactive fixes
2018-04-08 16:05:03 -04:00
Drew DeVault 0e3ddf255e Add input "identifier" map_to_output "identifier" 2018-04-08 15:09:12 -04:00
Tony Crisci ae78f6fb93 Merge branch 'wlroots' into focus-inactive-fixes 2018-04-08 12:47:56 -04:00
Drew DeVault 9c5a88a7bd Fix cursor motion issues
Use only one canonical cursor x/y position and send cursor enter when
mouse is warped.

Tangentally related to #1714
2018-04-08 12:42:56 -04:00
emersion 5ebc99253a
Use wlr_surface_point_accepts_input for unmanaged surfaces 2018-04-08 11:43:18 -04:00
Tony Crisci 46280460a5 push all parents of focused container in focus stack 2018-04-08 11:34:38 -04:00
Drew DeVault 9114d3b84c Implement tablet tool support 2018-04-08 10:48:13 -04:00
Tony Crisci de811823b6 seat focus inactive children foreach 2018-04-07 16:14:12 -04:00
Tony Crisci c0f9ee7bd1 seat get focus inactive view 2018-04-07 16:06:36 -04:00
emersion 2b357af7ee
Give keyboard focus to unmanaged xwayland surfaces
This fixes dmenu
2018-04-07 14:03:30 -04:00
Drew DeVault 603e0e42c5 Add debug tree view 2018-04-06 11:49:27 -04:00
Drew DeVault cca420b2f8 Fix focus_follows_mouse issues 2018-04-06 09:32:51 -04:00
Drew DeVault b08f7e5183 Fix deletion of still-visible workspaces on unfocus 2018-04-06 09:26:49 -04:00
emersion 641807d920
Handle unmanaged surfaces motion 2018-04-05 18:48:35 -04:00
Tony Crisci 65f254f3fb Merge branch 'wlroots' into fix-focus-inactive 2018-04-04 22:36:09 -04:00
Tony Crisci deda37469a fix focus child 2018-04-04 22:31:10 -04:00
emersion 8eff00f723 Remove unused SWAY_VIEW_TYPES 2018-04-04 22:03:14 -04:00
Tony Crisci 3e61718053 try to fix focus-inactive 2018-04-04 18:52:38 -04:00
Drew DeVault d2d050d59c Address review feedback 2018-04-04 18:47:48 -04:00
Drew DeVault b7e7794912 Implement input-inhibit in sway, swaylock 2018-04-04 18:47:48 -04:00
Drew DeVault 06fbd51ff5 Add input inhibitor to input manager 2018-04-04 18:47:48 -04:00
Drew DeVault 3ede718c06 Refocus the last focused container on lock exit 2018-04-04 18:47:48 -04:00
Tony Crisci 741e3959e3 Merge branch 'wlroots' into split-containers2 2018-04-04 00:20:44 -04:00
Tony Crisci 97b171649d move output damage to workspace destructor 2018-04-03 19:36:57 -04:00
Tony Crisci b4c5f79725 move view and workspace destructors to container.c 2018-04-03 12:25:19 -04:00
Drew DeVault 0bf3b88019 Give layer shells under the shell layer focus 2018-04-02 21:17:16 -04:00
Drew DeVault 56078edd65 Give exclusive focus to layers above shell layer 2018-04-02 21:09:09 -04:00
Tony Crisci a89096278b Merge branch 'wlroots' into split-containers 2018-04-02 19:22:10 -04:00
Tony Crisci d434da5632 Merge branch 'wlroots' into split-containers 2018-04-02 16:09:27 -04:00
emersion a4a241697a
Merge branch 'wlroots' into view-redesign 2018-04-02 15:30:58 -04:00
emersion 2f64ce86c4
Xwayland unmanaged views aren't views anymore 2018-04-02 14:35:43 -04:00
Tony Crisci 357a4401fa address feedback 2018-04-02 14:15:40 -04:00
Tony Crisci 2187684bd0 Merge branch 'wlroots' into split-containers 2018-04-02 14:06:04 -04:00
Tony Crisci c7a6524954 fix segfault 2018-04-02 13:56:35 -04:00
Tony Crisci 5e024278a6 Merge branch 'wlroots' into seat-fixes 2018-04-02 13:23:43 -04:00
Tony Crisci 22287b42bf dont copy input config 2018-04-02 13:19:58 -04:00
Tony Crisci 35445b40a2 remove unused attachment config 2018-04-02 12:16:00 -04:00
Tony Crisci a82c107c76 80col 2018-04-02 11:44:42 -04:00
Drew DeVault b2d871cfe2 Partially implement move command
Works:

- move [container|window] to workspace <name>
    - Note, this should be able to move C_CONTAINER but this is untested
- move [workspace] to output [left|right|up|down|<name>]

Not implemented yet:

- move [left|right|up|down]
- move scratchpad
- move position
2018-04-02 11:12:18 -04:00
Tony Crisci 53bb7ea996 dont copy seat config on the seat 2018-04-02 10:37:31 -04:00
Tony Crisci 0828c77251 rename input-manager functions 2018-04-02 08:49:38 -04:00
Tony Crisci e677c5b204 rename seat functions 2018-04-02 08:45:37 -04:00
Tony Crisci eda425fdab fix some segfaults 2018-03-31 18:52:02 -04:00
Tony Crisci 2aec85bf24 clean up view destroy seat cleanup 2018-03-31 17:07:37 -04:00
Tony Crisci 6f7b33e691 handle container destroy in the seat 2018-03-31 15:38:59 -04:00
Tony Crisci 7706d83160 basic split containers 2018-03-31 15:37:16 -04:00
Drew DeVault 122b96abed
Merge pull request #1684 from swaywm/follow-warp
Implement focus_follows_mouse, mouse_warping
2018-03-31 15:32:29 -04:00
Drew DeVault f2332dc75c Address review feedback 2018-03-31 15:20:43 -04:00
Drew DeVault b9d2983324 Fix interaction between warping and following 2018-03-31 13:05:45 -04:00
Drew DeVault 9b38ef950f Implement focus_follows_mouse
Also contains two other small changes:

- Clicking any button will focus the container clicked (not just left)
- Remove seamless_mouse (doesn't make sense on wlroots)
2018-03-31 13:05:45 -04:00
Drew DeVault ae6d459000 Implement mouse warping 2018-03-31 13:05:45 -04:00
emersion 98b67e2399
Fix xwayland configure in set_size 2018-03-31 11:30:15 -04:00
Drew DeVault eb5a8e03ff Check for null container 2018-03-31 10:51:39 -04:00
Drew DeVault e4fd47d3a1
Merge pull request #1682 from emersion/unmanaged-no-container
Make it clear that unmanaged views don't have a container
2018-03-31 10:49:06 -04:00
Drew DeVault ccdcaa478f Fix bug with previous commit 2018-03-31 10:47:04 -04:00
emersion a44a71c116
Make it clear that unmanaged views don't have a container
view->swayc is NULL anyway.
2018-03-31 10:39:05 -04:00
Drew DeVault 8aa195e311 Fix #1104 2018-03-31 09:45:11 -04:00
Drew DeVault 5c08e13e50 Set Xwayland seat on focus
Necessary to make primary selection syncronize
2018-03-31 09:29:34 -04:00
emersion b237fa0b22
Set xwayland cursor 2018-03-31 00:24:38 -04:00
Drew DeVault 212b503992 Use wlr_surface_point_accepts_input 2018-03-30 23:08:24 -04:00
Drew DeVault f5470f3338 Pass pointer events to surface layers 2018-03-30 21:03:35 -04:00
emersion 9665642765
Merge branch 'wlroots' into client-cursors 2018-03-30 19:04:06 -04:00
emersion eb716c6c43
Fix segfaults when focusing a workspace 2018-03-30 16:12:02 -04:00
emersion 03255fd202
Fix pointer events for hidden workspaces 2018-03-30 15:33:16 -04:00
emersion 6c9d67b105
Handle set_cursor requests from clients
Allow clients to set a custom cursor if they have the seat's
pointer focus.
2018-03-30 10:53:18 -04:00
Drew DeVault 01af343912 Destroy empty workspaces when moving away 2018-03-30 10:47:19 -04:00
Drew DeVault f26ecd9f58 Merge remote-tracking branch 'origin/wlroots' into swaybar-layers 2018-03-30 00:04:04 -04:00
Tony Crisci 8f490d7d2d Fix oversights from previous pull request 2018-03-29 23:53:38 -04:00
Tony Crisci dc8c9fbeb6 Revert "Merge pull request #1653 from swaywm/revert-1647-refactor-tree"
This reverts commit 472e81f35d, reversing
changes made to 6b7841b11f.
2018-03-29 23:41:33 -04:00
Drew DeVault d0c7f66e95
Revert "Refactor tree" 2018-03-29 23:29:29 -04:00
Tony Crisci 92c58b1e63 rename container_for_each_descendent 2018-03-29 23:08:59 -04:00
Drew DeVault 6836074fed Implement enough IPC for swaybar to work 2018-03-29 22:11:08 -04:00
Tony Crisci 4c394a0e9e address feedback 2018-03-29 21:22:39 -04:00
Tony Crisci eca029f218 more renaming things 2018-03-29 17:06:29 -04:00
Tony Crisci b90099b4b7 rename container functions 2018-03-29 16:40:40 -04:00
Tony Crisci 83d09cf594 remove swayc_t typedef 2018-03-29 14:31:10 -04:00
Tony Crisci 874f009866 move tree includes to their own directory 2018-03-29 14:21:42 -04:00
Drew DeVault 1e604f3e35 Update input events per swaywm/wlroots#765 2018-03-28 12:22:45 -04:00
Tony Crisci ac8269d536 take seat param for handle_command and rename 2018-02-24 12:50:24 -05:00
Tony Crisci 4b3aa59b8b rename new_input listener on input-manager 2018-02-20 19:09:38 -05:00
Tony Crisci 083e11ac7c fix build for latest api 2018-02-14 15:08:10 -05:00
Tony Crisci 06c71f115b input device destroy 2018-02-14 14:47:59 -05:00
Tony Crisci 946d9459c5 get swayc in direction 2018-02-14 14:30:27 -05:00
Tony Crisci ce3a1b3922 properly pick next focus 2018-02-10 18:19:53 -05:00
Tony Crisci 145b4fdf58 use bfs iterator to collect focus stack 2018-02-10 16:52:45 -05:00
Tony Crisci a7d49da239 separate seat get focus and seat get focus inactive 2018-02-07 18:17:57 -05:00
Tony Crisci 5151502298 basic focus overhaul 2018-02-04 14:08:54 -05:00
Drew DeVault b28602aa74 Implement workspaces 2018-01-30 23:09:21 -05:00
Dominique Martinet 5766f426aa config reload: destroy old seat when removed from config
This adds new sway_seat_destroy and sway_cursor_destroy helpers
and compare new and old config on free
2018-01-22 07:26:37 +01:00
emersion 0c58673c6a
Merge pull request #1574 from acrisci/config-refactor
Command criteria
2018-01-22 01:16:23 +01:00
Drew DeVault c933781fac
Merge pull request #1570 from acrisci/config-references
Copy input config references
2018-01-21 11:17:07 -05:00
Tony Crisci 0e3eae4baa view interface 2018-01-21 09:09:53 -05:00
Tony Crisci c353e01c85 add kill command 2018-01-20 14:10:11 -05:00
Tony Crisci 2bf76509f8 update for new wlr-keyboard modifiers 2018-01-17 11:47:27 -05:00
Tony Crisci 9f54cd8935 copy config references for input and seat 2018-01-17 09:49:02 -05:00
Tony Crisci 83ddd2d9db render override redirect 2018-01-14 13:19:21 -05:00
Dominique Martinet 67985e9031 sway: change all sway_log to wlr_log 2018-01-05 23:39:46 +01:00
Tony Crisci 8b4eb5d7d1 cleanup bindings 2018-01-04 07:54:14 -05:00
Tony Crisci 50e791cadb binding release 2018-01-04 07:25:52 -05:00
Tony Crisci bd3ca70e3d fix nitpicks 2017-12-29 09:11:15 -05:00
Tony Crisci 62b7ab3959 overwrite old bindings 2017-12-28 18:50:22 -05:00
Tony Crisci 0b8481f41a fix keyboard_execute_bindcode 2017-12-28 16:52:12 -05:00
Tony Crisci 8d567cd062 bindcode 2017-12-28 16:24:23 -05:00
Tony Crisci 27cd633b40 run compositor bindings last 2017-12-27 19:07:17 -05:00
Tony Crisci ccaedf5b15 run binding command 2017-12-27 15:25:16 -05:00
Tony Crisci d941246d58 match user bindsym 2017-12-27 15:17:01 -05:00
Tony Crisci daad222337 compositor bindings 2017-12-27 13:31:31 -05:00
Tony Crisci eea80e7276 keyboard translate keysyms 2017-12-27 13:20:28 -05:00
Dominique Martinet f3d8df45fc seat_configure_pointer: apply libinput config
Restore the code that used to be in config.c:apply_input_config() pre-wlroots
2017-12-24 20:54:48 +01:00
Tony Crisci 63f7fb9517 cleanup 2017-12-20 06:12:08 -05:00
Tony Crisci f35575f71d handle keymap not found 2017-12-19 05:36:17 -05:00
Tony Crisci 39e7871a85 dont set cursor image on motion 2017-12-19 05:28:06 -05:00
Tony Crisci 730af5e721 use snprintf to get identifier len 2017-12-19 04:57:42 -05:00
Tony Crisci a87960711a Merge branch 'feature/input' of github.com:acrisci/sway into feature/input 2017-12-18 10:45:04 -05:00
Tony Crisci 4c436a1a6f remove assumption of one device per identifier 2017-12-18 10:44:51 -05:00
Drew DeVault b0291d126f Fix compile error 2017-12-17 21:00:17 -05:00
Tony Crisci a27736adcd cleanup input-manager 2017-12-17 10:44:53 -05:00
Tony Crisci 88bcd43ebf seat fallback config 2017-12-17 10:39:22 -05:00
Tony Crisci e27eff8a29 send keyboard enter on keyboard configuration 2017-12-17 08:30:20 -05:00
Tony Crisci 0256cd1473 fix keyboard hotplugging 2017-12-16 19:16:00 -05:00
Tony Crisci 9e4fc7253e get device id correctly 2017-12-16 14:03:58 -05:00
Tony Crisci b0ed1ad28d device add/remove logging 2017-12-16 13:16:58 -05:00
Tony Crisci 24e2406429 strip whitespace for device id 2017-12-16 13:00:31 -05:00
Tony Crisci b3a0309f26 fix logging issue for new wlroots 2017-12-16 07:39:22 -05:00
Tony Crisci 9fa70ce426 Merge branch 'wlroots' into feature/input 2017-12-16 07:33:23 -05:00
Tony Crisci 030fcb64da keyboard cleanup 2017-12-16 07:21:21 -05:00
Tony Crisci 9eecbb5d8a xkb config 2017-12-15 05:22:51 -05:00
Tony Crisci 92fef27eaa basic configuration 2017-12-14 11:11:56 -05:00
Tony Crisci c173d30b92 seat configuration 2017-12-12 10:55:20 -05:00
Tony Crisci 163edc5a90 sway input device 2017-12-12 08:29:37 -05:00
Tony Crisci 9ae906cd37 sway pointer 2017-12-10 16:57:38 -05:00