Commit graph

209 commits

Author SHA1 Message Date
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
2e7401772e Rename sway_root.outputs to sway_root.all_outputs
This list includes disabled outputs.

When sway_container is demoted, we'll need to store the root's children
(ie. enabled outputs) in the sway_root. It makes sense to put these in a
list called `outputs`, so I'm renaming the existing list in advance.
2018-08-25 23:41:11 +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
Brian Ashworth
43d1ffc9dd Allow a fallback color to be specified for swaybg
This allows for a color to be set when the wallpaper does not fill the
entire output. If specified, the fallback color is also used when the
image path is inaccessible.
2018-08-08 15:37:06 -04:00
Marien Zwart
7d8413d962 Reset signal mask after fork
wlroots uses wl_event_loop_add_signal to handle SIGUSR1 from Xwayland.
wl_event_loop_add_signal works by masking the signal and receiving it from a
signalfd. The signal mask is preserved across fork and exec, so subprocesses
spawned by Sway start with SIGUSR1 masked. Most subprocesses do not expect this
and never unmask the signal, resulting in missing functionality or unexpected
behavior for processes that use SIGUSR1 (such as i3status).

Fix this by unmasking all signals between fork and exec.
2018-08-02 21:31:34 +10: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
Brian Ashworth
bc7d332109 Reset outputs on reload 2018-07-20 22:17:20 -04:00
Brian Ashworth
9605ab45f1 Fix output wildcard handling 2018-07-20 12:32:29 -04:00
Ian Fan
9559e3e2af config output: free command string if unused 2018-07-15 21:51:00 +01:00
Brian Ashworth
13c6627ddb Implement tap_button_map for input devices 2018-07-14 01:01:47 -04:00
Robert Kubosz
08edaf4e76
increase maximum value of button identifier
and also cleanup spaces
2018-07-12 12:08:53 +02: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
Dominique Martinet
9f5d539657 config: add a couple of forgotten frees 2018-07-05 08:13:10 +09:00
Dominique Martinet
248ea93c1a bar config: fix uninitialized accesses on init error
If init fails halfway through it will call the destroy function,
which needs some coherent stuff filled.
Allocate with calloc and fill in what cannot fail first

Found through static analysis.
2018-07-02 08:03:41 +09:00
Dominique Martinet
9c8fb7d025 invoke_swaybar: fix message length header size
size_t/ssize_t are 8 bytes on 64bit systems, so use the proper size to
transmit that information.
This could lead to ridiculously large alloc as len is not initialized to zero

Found through static analysis
2018-07-02 08:03:41 +09:00
Brian Ashworth
a1b5b93d29 Store sway_outputs so that they can be reenabled 2018-06-06 20:11:24 -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
db
22170bde77 Fix layer surface crash on output destroy
Before freeing sway_output, NULL the wlr_output reference to it. Check for that
NULL in layer_shell handle_destroy. Don't damage null container in unmap.
Additionaly, terminate swaybg if its output is being disabled.
2018-05-01 19:05:32 +02:00
Geoff Greer
5587af1782 Rename len to msg_len. Avoids an aliased variable that was a little confusing to follow. 2018-04-26 18:16:29 -07:00
Geoff Greer
b9726afd48 invoke_swaybar(): Set process group. Kill process group.
Fixes a bug where terminate_swaybar() did not terminate swaybar.
2018-04-26 18:13:44 -07:00
emersion
ff61df17ff
Add map_from_region command 2018-04-26 10:53:47 +01: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
Drew DeVault
0e3ddf255e Add input "identifier" map_to_output "identifier" 2018-04-08 15:09:12 -04:00
Tony Crisci
741e3959e3 Merge branch 'wlroots' into split-containers2 2018-04-04 00:20:44 -04:00
emersion
f3ef1da750
Fix wrong output container coordinates 2018-04-03 21:06:13 -04:00
Tony Crisci
09d448ea2d unify container destroy functions 2018-04-03 12:34:01 -04:00
Drew DeVault
18173fb5ad Free bar configs on reload and exit 2018-03-31 00:35:06 -04:00
Drew DeVault
f26ecd9f58 Merge remote-tracking branch 'origin/wlroots' into swaybar-layers 2018-03-30 00:04:04 -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
Drew DeVault
2e84f21ab7 Terminate swaybar when freeing bar config 2018-03-29 22:11:08 -04:00
Drew DeVault
2719ddfe5e Spawn swaybars when outputs are added 2018-03-29 22:11:08 -04:00
Drew DeVault
5c9cdbcdd2 Add swaybg_command 2018-03-29 22:11:08 -04:00
Drew DeVault
569b2bfd5d Move bar config into its own file 2018-03-29 22:11:08 -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
Drew DeVault
8d6bce02af Address review feedback 2018-03-28 18:11:03 -04:00
Drew DeVault
68cfa7ef67 Render layer surfaces and respect exclusive zone 2018-03-28 16:42:13 -04: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
emersion
ead3f1e676
Allow to configure outputs by their identifier 2017-12-29 19:04:16 +01:00
emersion
21c61f1c09
Refactor output command, add output enable 2017-12-27 21:23:30 +01:00
Tony Crisci
63f7fb9517 cleanup 2017-12-20 06:12:08 -05:00
Tony Crisci
a949d7de5a Merge branch 'wlroots' into feature/input 2017-12-18 11:01:11 -05:00
emersion
c815d6d1a9
Add support for fractional output scale 2017-12-18 14:13:07 +01:00
Tony Crisci
88bcd43ebf seat fallback config 2017-12-17 10:39:22 -05:00
Tony Crisci
f4a5a0ead4 put seat and input config in their own files 2017-12-16 11:25:59 -05:00
emersion
4d389f8b65
Replace refresh_rate and position by mode in output command 2017-12-14 00:45:47 +01:00
emersion
a4619e98c4
Update output containers on output layout change 2017-12-13 15:52:18 +01:00
emersion
d293c42942
Update output container box in event handler 2017-12-12 21:09:51 +01:00
emersion
c7abb77f22
Listen to output layout change 2017-12-12 20:02:01 +01:00
emersion
f3d880b0ec
Add scale and transform events to sway_output 2017-12-12 19:40:17 +01:00
emersion
475a0132a9
Use custom modes when output has no mode 2017-12-11 21:47:40 +01:00
emersion
4a14aa9ad9
Remove output from layout 2017-12-09 15:48:52 +01:00
emersion
8764dc26c6
Add new_output_config, update root container size on output hotplug 2017-12-06 19:45:43 +01:00
emersion
7c5d8c553c
Simplify free calls, use wlr_output_set_scale 2017-12-06 19:16:12 +01:00
emersion
68ae989cee
Init, merge output config params, use wlr_output_layout 2017-12-06 12:57:13 +01:00
emersion
aaae59026f
Add output config 2017-12-06 12:36:06 +01:00