Commit graph

47 commits

Author SHA1 Message Date
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
Drew DeVault 1e65439a54 Add virtual keyboard protocol
Ref #2373
2018-07-28 20:47:56 -04:00
Brian Ashworth 13c6627ddb Implement tap_button_map for input devices 2018-07-14 01:01:47 -04: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
emersion 63b4bf5000
Update for swaywm/wlroots#1126 2018-07-09 22:54:30 +01: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
emersion ff61df17ff
Add map_from_region command 2018-04-26 10:53:47 +01:00
emersion 2b357af7ee
Give keyboard focus to unmanaged xwayland surfaces
This fixes dmenu
2018-04-07 14:03:30 -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
Tony Crisci c7a6524954 fix segfault 2018-04-02 13:56:35 -04:00
Tony Crisci 22287b42bf dont copy input config 2018-04-02 13:19:58 -04:00
Tony Crisci a82c107c76 80col 2018-04-02 11:44:42 -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 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 83d09cf594 remove swayc_t typedef 2018-03-29 14:31:10 -04: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 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
Tony Crisci c353e01c85 add kill command 2018-01-20 14:10:11 -05:00
Tony Crisci 9f54cd8935 copy config references for input and seat 2018-01-17 09:49:02 -05:00
Dominique Martinet 67985e9031 sway: change all sway_log to wlr_log 2018-01-05 23:39:46 +01: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 730af5e721 use snprintf to get identifier len 2017-12-19 04:57:42 -05:00
Tony Crisci 4c436a1a6f remove assumption of one device per identifier 2017-12-18 10:44:51 -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 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 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 21626e8153 seat focus on button press 2017-12-10 11:11:47 -05:00
Tony Crisci d76e745b73 input include directory 2017-12-08 08:07:47 -05:00
Tony Crisci f6f63f60d6 basic input manager and seat 2017-12-07 09:58:32 -05:00
Tony Crisci 21ce20885a rename input to input-manager 2017-12-07 07:35:10 -05:00
Renamed from sway/input/input.c (Browse further)