Commit graph

154 commits

Author SHA1 Message Date
Simon Ser
7488d33d42 Remove xdg-shell v6 support
All major toolkits and apps have gained xdg-shell stable support.

Closes: https://github.com/swaywm/sway/issues/3690
2019-08-20 10:57:20 +09:00
Simon Ser
f984f21b6a Remove all wayland-server.h includes
The documentation for wayland-server.h says:

> Use of this header file is discouraged. Prefer including
> wayland-server-core.h instead, which does not include the server protocol
> header and as such only defines the library PI, excluding the deprecated API
> below.

Replacing wayland-server.h with wayland-server-core.h allows us to drop the
WL_HIDE_DEPRECATED declaration.

This commit si similar to wlroots' ca45f4490ccc ("Remove all wayland-server.h
includes").
2019-07-27 17:16:56 -04:00
Josef Gajdusek
ac87df23ea Update output manager on layout change
The output manager config was not properly updated if the position
of the output got changed.
2019-07-17 19:36:15 +03:00
Daniel Eklöf
190546fd31 add seat sub command 'xcursor_theme'
New 'seat <name> xcursor_theme <theme> [<size>]' command that
configures the default xcursor theme.

The default seat's xcursor theme is also propagated to XWayland, and
exported through the XCURSOR_THEME and XCURSOR_SIZE environment
variables. This is done every time the default seat's configuration is
changed.
2019-06-05 11:00:10 -04:00
Simon Ser
4105982169 Remove orbital gamma-control protocol 2019-06-02 10:12:58 -04:00
Josef Gajdusek
b3a5effef2 Implement wlr-output-management-v1 2019-05-24 18:59:14 +03:00
emersion
a6711740bc Set DISPLAY after initializing Xwayland
This is necessary after https://github.com/swaywm/wlroots/pull/1596
2019-03-04 21:16:00 +01:00
emersion
444e00662c
Add wp-primary-selection-unstable-v1 2019-02-20 11:16:05 +01:00
absrd
ee4b8a3938 Add relative pointer 2019-01-30 19:53:59 +01:00
Las
cedde21c96 Implement pointer-constraints-unstable-v1 2019-01-30 19:53:59 +01:00
Ryan Dwyer
2301349ad5 Use noop output when there's no outputs connected
Instead of having NULL workspace->output pointers, use a noop output.
This should be safer.
2019-01-22 09:55:13 +01:00
M Stoeckl
1211a81aad Replace wlr_log with sway_log
This commit mostly duplicates the wlr_log functions, although
with a sway_* prefix. (This is very similar to PR #2009.)
However, the logging function no longer needs to be replaceable,
so sway_log_init's second argument is used to set the exit
callback for sway_abort.

wlr_log_init is still invoked in sway/main.c

This commit makes it easier to remove the wlroots dependency for
the helper programs swaymsg, swaybg, swaybar, and swaynag.
2019-01-21 12:59:42 +01:00
Drew DeVault
4879d40695
Merge pull request #3144 from emersion/cmd-xwayland
Add xwayland command
2019-01-13 20:42:39 -05:00
emersion
327236a7ab Add data-control-v1 2019-01-07 17:01:53 -05:00
emersion
cc28f9712e
Update for swaywm/wlroots#1387 2018-11-23 12:07:46 +01:00
emersion
311c7db7e3
Add xwayland command 2018-11-19 17:38:37 +01:00
emersion
cad851805b
Use #if instead of #ifdef 2018-11-18 00:33:06 +01:00
emersion
a654ac1bd6
Implement the presentation-time protocol 2018-10-23 23:38:57 +02:00
Ryan Dwyer
c006717910 Minor refactor of input manager
The input manager is a singleton object. Passing the sway_input_manager
argument to each of its functions is unnecessary, while removing the
argument makes it obvious to the caller that it's a singleton. This
patch removes the argument and makes the input manager use server.input
instead.

On a similar note:

* sway_input_manager.server is removed in favour of using the server
global.
* seat.input is removed because it can get it from server.input.

Due to a circular dependency, creating seat0 is now done directly in
server_init rather than in input_manager_create. This is because
creating seats must be done after server.input is set.

Lastly, it now stores the default seat name using a constant and removes
a second reference to seat0 (in input_manager_get_default_seat).
2018-10-20 13:11:43 +10:00
emersion
fd9198a3a4 Export XCURSOR_SIZE and XCURSOR_THEME
These can be used by toolkits (currently Qt, libxcursor, glfw) to
choose a default cursor theme and size.

This backports this rootston commit:
3a181ab430
2018-10-17 21:10:30 +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
64d567be9b
Merge branch 'master' into wlroots-1243 2018-09-14 21:03:59 -04:00
Drew DeVault
3b92d5bb6d Additional fix for xdg-output 2018-09-14 21:03:35 -04:00
Drew DeVault
b4d60da856
Merge branch 'master' into wlroots-1243 2018-09-14 20:56:50 -04:00
Drew DeVault
73aab86b6d Postfix xdg-output headers
"Doesn't need an update" my ass...
2018-09-14 20:55:05 -04:00
emersion
7699c5444c Update for swaywm/wlroots#1243 2018-09-14 19:21:44 +02: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
sghctoma
df730a8891 Merge remote-tracking branch 'upstream/master' into fix-freebsd-build 2018-09-03 08:57:17 +02:00
emersion
407c12fddd Update for swaywm/wlroots#1216 2018-09-01 19:33:24 +02:00
sghctoma
ac7a0aa038 Add missing destroy calls to server_fini
Rootston calls "wlr_xwayland_destroy" and "wl_display_destroy_clients"
on shutdown, but these were not called by Sway. Without them, Sway
crashes on exit before the display destroy event handler could be
called. This causes two problems:

 - The TTY is not reset, and it locks up after exiting Sway.
 - drmDropMaster is not called, and the implicit drop (that should
   occur when the DRM fd is closed) seems not to be working in some
   scenarios (e.g. if you have a tmux session running - maybe the fd
   is retained somehow by tmux?). In other words, it you exit Sway,
   you can't start it (or any other program that wants to be DRM
   master) again until you close all your tmux sessions.
2018-08-30 10:05:04 +02: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
8d1dd03823 Standardise debug variables
This makes all debug options stored in a single struct rather than in
various places, changes/fixes the behaviour of existing options, and
introduces some new options.

* Fixes damage issues with `-Drender-tree` texture (by removing scissor)
* Offsets the render tree overlay's `y` position for those who have
swaybar at the top
* Replaces `-Ddamage=rerender` with `-Dnodamage`
* Replaces `-Ddamage=highlight` with `-Dhighlight-damage`
* Replaces `-Dtxn-debug` with `-Dtxn-wait`
* Introduces `-Dnoatomic`
* Removes the `create_time` and `ms_arranging` figures from transactions
and the log message. Transactions are created after arranging and the
create time is of no significance.
* Fixes `-Dtxn-debug` (now `-Dtxn-wait`) not working.
2018-08-19 16:17:24 +10:00
emersion
9d578e0a0f Handle views created after decoration mode is sent for xdg-shell 2018-08-06 15:20:30 +01:00
emersion
700941dde8 Listen to server-decoration mode changes 2018-08-06 15:20:30 +01:00
emersion
3a54e2291c
Merge branch 'master' into wlr-gamma-control 2018-08-02 23:49:25 +01: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
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
emersion
c35a34262f Enable wlr-gamma-control-unstable-v1 2018-07-22 16:27:54 +01: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
Brian Ashworth
ec65286606 Fix deferred command handling 2018-07-19 01:39:58 -04:00
Drew DeVault
53e3f35ba3
Merge pull request #2272 from RyanDwyer/simplify-transactions
Simplify transactions by using a dirty flag on containers
2018-07-15 05:01:25 -07:00
Ryan Dwyer
2032f85d94 Simplify transactions by utilising a dirty flag on containers
This PR changes the way we handle transactions to a more simple method.
The new method is to mark containers as dirty from low level code
(eg. arranging, or container_destroy, and eventually seat_set_focus),
then call transaction_commit_dirty which picks up those containers and
runs them through a transaction. The old methods of using transactions
(arrange_and_commit, or creating one manually) are now no longer
possible.

The highest-level code (execute_command and view implementation
handlers) will call transaction_commit_dirty, so most other code just
needs to set containers as dirty. This is done by arranging, but can
also be done by calling container_set_dirty.
2018-07-14 23:14:55 +10:00
emersion
82c978d34b Remove orbital screenshooter 2018-07-13 19:29:44 +01:00
emersion
63b4bf5000
Update for swaywm/wlroots#1126 2018-07-09 22:54:30 +01:00
Dominique Martinet
c092f1fe6a startup: move setenv WAYLAND_DISPLAY before config execs
We would previously run all config commands without the environment,
which would appear to work as our socket name is the default one, but
wayland clients would start up in the wrong sway session.

(This explains why 'sometimes' my swayidle processes wouldn't die with
sway, as they weren't listening to the correct socket)
2018-07-04 13:52:26 +09:00
Dominique Martinet
71224781c4 idle_inhibit: move server data to its own struct 2018-07-02 09:29:16 +09:00
Dominique Martinet
072b334abc idle_inhibit: stop inhibitor when views become invisible 2018-07-02 09:29:16 +09:00
Dominique Martinet
e4bfb3bc98 Add idle inhibit unstable v1 support 2018-07-02 09:29:16 +09:00
emersion
7abb4d63e2
Init screencopy manager 2018-07-01 22:55:25 +01:00
Ryan Dwyer
a2fbb20a61 Merge remote-tracking branch 'upstream/master' into atomic 2018-06-29 20:04:24 +10:00
Ryan Dwyer
9652529cc1 Allow views to skip configures
To do this properly, the transaction queue will only be processed if it
can be completely processed.
2018-06-27 19:07:48 +10:00
Ryan Dwyer
bf38081382
Merge branch 'master' into xwayland-wants-float 2018-06-27 13:21:00 +10:00
Ryan Dwyer
289d696adc Implement transaction timings debug
Launch sway with SWAY_DEBUG=txn_timings to enable it.
2018-06-25 09:09:43 +10:00
Ryan Dwyer
b11c9199a6 Merge remote-tracking branch 'upstream/master' into atomic 2018-06-23 16:26:20 +10:00
Ryan Dwyer
38398e2d77 Implement atomic layout updates for tree operations
This implements atomic layout updates for when views map, reparent or
unmap.
2018-06-23 16:24:11 +10:00
Drew DeVault
e8fbda4d21
Merge pull request #2146 from tobiasblass/prepare_server_before_dropping_privileges
Perform (partial) server initialization before dropping privileges.
2018-06-22 06:41:34 -07:00
Rostislav Pehlivanov
aa9f058e3e Init the dmabuf exporting protocol in wlroots
Allows desktop capture via the dmabuf-capture wlroots example client.
2018-06-22 13:45:32 +01:00
Tobias Blass
a5c091e302 Perform (partial) server initialization before dropping privileges.
Some operations during backend creation (e.g. becoming DRM master)
require CAP_SYS_ADMIN privileges. At this point, sway has dropped them
already, though. This patch splits the privileged part of server_init
into its own function and calls it before dropping its privileges.
This fixes the bug with minimal security implications.
2018-06-19 00:19:57 +02:00
emersion
cda66e9a26
Automatically float xwayland windows 2018-06-18 22:52:10 +01:00
emersion
24832d8574
Update for swaywm/wlroots#1000 2018-05-25 13:55:47 +01:00
emersion
708ff238f3
Update for swaywm/wlroots#993 2018-05-21 19:11:20 +01:00
Dominique Martinet
89ae1792b5 sway: run commands without waiting for Xwayland
Xwayland is lazy now, there is no need to wait at all
2018-05-16 16:50:56 +09:00
emersion
95a10dd4f3
Kill wl_shell 2018-05-14 13:26:10 +01:00
Drew DeVault
404d006a1c Enable lazy xwayland 2018-05-13 14:18:07 -04:00
Drew DeVault
b2dec12368
Merge pull request #1970 from emersion/xdg-shell-stable
Add xdg-shell stable support
2018-05-13 13:45:15 -04:00
emersion
88d9d43b36
Add xdg-shell stable support 2018-05-13 16:38:56 +01: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
Dan Robertson
4ebd6f3507
Fix null deref in server_init
If the backend fails to be created, log an error and immidiately return
from server_init.
2018-05-09 16:32:55 +00:00
Vincent Vanlaer
95dac2a069 Update xwayland start for new API
https://github.com/swaywm/wlroots/pull/959
2018-05-07 14:23:44 +02:00
emersion
b96d774c70
Use wlr_renderer_init_wl_shm 2018-04-21 14:08:48 +01:00
emersion
7114451607
Destroy display in server_fini 2018-04-17 23:15:11 +01:00
emersion
9570e37016
Update for wlroots#850 2018-04-08 11:19:14 -04:00
Drew DeVault
5d34e4531f Add basic server decorations support 2018-04-07 13:21:07 -04:00
Drew DeVault
94ecd0f0aa Configure wlr_xdg_output_manager during init 2018-04-05 14:01:14 -04:00
Tony Crisci
0828c77251 rename input-manager functions 2018-04-02 08:49:38 -04:00
Drew DeVault
5c08e13e50 Set Xwayland seat on focus
Necessary to make primary selection syncronize
2018-03-31 09:29:34 -04:00
Drew DeVault
ae0552606b Configure linux_dmabuf, primary_selection 2018-03-31 09:21:15 -04:00
emersion
b237fa0b22
Set xwayland cursor 2018-03-31 00:24:38 -04:00
emersion
981827ca42
Cleanup and remove global renderer reference 2018-03-30 00:49:27 -04:00
Drew DeVault
d6acb3d86c Set WAYLAND_DISPLAY earlier in startup 2018-03-30 00:13:54 -04:00
Drew DeVault
2719ddfe5e Spawn swaybars when outputs are added 2018-03-29 22:11:08 -04:00
Drew DeVault
0c8a64942e Add initial layer shell skeleton 2018-03-28 15:47:22 -04:00
emersion
01beee5826
Update wlroots API
Breaking changes in wlr_xdg_shell_v6 and wlr_renderer have been
made upstream.
2018-03-19 23:31:18 +01:00
Tony Crisci
ac8269d536 take seat param for handle_command and rename 2018-02-24 12:50:24 -05:00
Tony Crisci
7dfbf06de9 output destroy 2018-02-14 14:51:51 -05:00
Drew DeVault
a686fb07ae Execute pending commands when Xwayland is ready 2018-01-30 20:01:49 -05:00
Calvin Lee
7196f59db0 Consolidate WLR and Sway logging
See #1390
2017-12-31 14:32:28 -07:00
Tony Crisci
163edc5a90 sway input device 2017-12-12 08:29:37 -05:00
Tony Crisci
d76e745b73 input include directory 2017-12-08 08:07:47 -05:00
Tony Crisci
21ce20885a rename input to input-manager 2017-12-07 07:35:10 -05:00
Tony Crisci
338a0399f8 input skeleton 2017-12-06 08:28:46 -05:00
Tony Crisci
0896b68675 Merge branch 'wlroots' into feature/xwayland 2017-12-04 07:32:25 -05:00
Tony Crisci
1870f116ba xwayland shell 2017-12-04 07:28:47 -05:00
Tony Crisci
8239067da4 basic wl-shell 2017-12-03 14:21:26 -05:00
Drew DeVault
4ca1e77fdb Add views to tree and render them 2017-11-22 21:06:08 -05:00
Dominique Martinet
b8f8de27b8 wlr_data_device header update
wlroots 6a7560 renamed the header file
2017-11-23 00:19:11 +01:00
Drew DeVault
733993a651 Move everything to sway/old/ 2017-11-18 11:22:02 -05:00
Drew DeVault
0c8491f7d0 Initial (awful) pass on xdg shell support 2017-11-11 18:06:50 -05:00