Commit graph

844 commits

Author SHA1 Message Date
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
emersion 9b16227ec3 Don't disable borders for xwayland floating views 2018-07-12 20:01:33 +01: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
Drew DeVault edfe42032c
Merge pull request #2240 from RedSoxFan/implement-1961
Implement swaylock customization flags
2018-07-11 04:39:13 -07:00
Ryan Dwyer 15dc5286e2 Move floating windows to front when focused 2018-07-11 19:50:02 +10:00
Brian Ashworth 936a920a8e Implement swaylock customization flags 2018-07-10 21:29:15 -04:00
emersion ba3511b243 Remove clipboard command and get_clipboard message 2018-07-10 22:09:21 +01:00
Ian Fan 23c1c26c3f Add get_config message type to ipc 2018-07-10 12:37:37 +01:00
Ian Fan 5fd36164a0 Add get_binding_modes message type to ipc 2018-07-10 12:03:46 +01:00
emersion 63b4bf5000
Update for swaywm/wlroots#1126 2018-07-09 22:54:30 +01:00
Ryan Dwyer b0fc7e9850 Remove duplicate function declaration and add assertion 2018-07-09 23:41:00 +10:00
Ryan Dwyer ab8a86369c Implement some floating move commands
This implements the following for floating containers:

* move <direction> <amount>
* move [absolute] position <x> <y>
* move [absolute] position mouse
2018-07-09 23:38:29 +10:00
emersion ceb08b6365
swaylock: daemonize after locking 2018-07-07 18:36:49 +01:00
emersion f9625d1d56
Split renderer 2018-07-07 10:30:52 +01:00
Drew DeVault 817e847749
Merge pull request #2206 from martinetd/leaks
Fix a bunch of leaks
2018-07-06 08:43:33 -07:00
emersion b3c55dd909
Merge branch 'master' into leaks 2018-07-06 16:22:13 +01:00
Ryan Dwyer 839c3a5500 Use opaque region to determine if frame done should be sent 2018-07-07 00:03:49 +10:00
Brian Ashworth 78c08fb0a2 Implement mode --pango_markup 2018-07-05 18:12:14 -04:00
Dominique Martinet fe72e3b349 cmd_results_to_json: return copied string and properly free the json
The only user of this function would copy the string right away
to get rid of the const flag anyway, and freeing a const string
afterwards might work but is not meant to be done according to the
json-c API.
2018-07-05 13:11:02 +09:00
Dominique Martinet b0918b1058 ipc-server: add display destroy listener and remove ipc_terminate
wl_event_source_remove() is illegal after display has been destroyed,
so just destroy everything when we still can.

==20392==ERROR: AddressSanitizer: heap-use-after-free on address 0x607000001240 at pc 0x00000048e86e bp 0x7ffe4b557e00 sp 0x7ffe4b557df0
READ of size 8 at 0x607000001240 thread T0
    #0 0x48e86d in wl_list_insert ../common/list.c:149
    #1 0x7fdf673d4d7d in wl_event_source_remove src/event-loop.c:487
    #2 0x41b742 in ipc_terminate ../sway/ipc-server.c:94
    #3 0x40b1ad in main ../sway/main.c:440
    #4 0x7fdf6664c18a in __libc_start_main ../csu/libc-start.c:308
    #5 0x409359 in _start (/opt/wayland/bin/sway+0x409359)

0x607000001240 is located 48 bytes inside of 72-byte region [0x607000001210,0x607000001258)
freed by thread T0 here:
    #0 0x7fdf692c4880 in __interceptor_free (/lib64/libasan.so.5+0xee880)
    #1 0x7fdf673d371a in wl_display_destroy src/wayland-server.c:1097

previously allocated by thread T0 here:
    #0 0x7fdf692c4c48 in malloc (/lib64/libasan.so.5+0xeec48)
    #1 0x7fdf673d4d9e in wl_event_loop_create src/event-loop.c:522
    #2 0x40acb2 in main ../sway/main.c:363
    #3 0x7fdf6664c18a in __libc_start_main ../csu/libc-start.c:308
2018-07-04 18:47:11 +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
Drew DeVault acd79e1505 Implement pid->workspace tracking
When you spawn a process with the exec command, sway now notes the
workspace you had focused and the pid of the child process, then assigns
that workspace to the child when its window appears.

Some of this is carried over from sway 0.15, but with some major
refactoring and centralization of state.
2018-07-01 09:58:18 -04:00
Dominique Martinet 9ea4cc13a0 sway views: add helpers to get view and layer from wlr_surface 2018-06-30 22:31:14 +09:00
Ryan Dwyer e396af853b Merge remote-tracking branch 'upstream/master' into atomic 2018-06-30 22:46:25 +10:00
Rostislav Pehlivanov e0d0e8f840 Revert "Don't unmaximize floating views"
This reverts commit 97672295ed.
2018-06-30 11:10:47 +01:00
Ryan Dwyer 3a6ed5110c Render saved buffers with the surface's dimensions 2018-06-29 21:13:22 +10:00
Ryan Dwyer a2fbb20a61 Merge remote-tracking branch 'upstream/master' into atomic 2018-06-29 20:04:24 +10:00
Ryan Dwyer 3c81a900b7 Add comment about usage to arrange_windows declaration 2018-06-29 19:52:31 +10:00
Ryan Dwyer d7169ee7ff Replace list_empty with a simple alternative 2018-06-29 19:44:54 +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 8773ed3970 Fix memleak in container_get_box
Rather than allocate a structure and expect callers to free it, take a
pointer to an existing struct as an argument.

This function is no longer called anywhere though.
2018-06-27 17:47:41 +10:00
Ryan Dwyer be86d3aba6 Remove transaction_add_damage
Instead, damage each container when applying the transaction.
2018-06-27 17:46:03 +10:00
Ryan Dwyer bf38081382
Merge branch 'master' into xwayland-wants-float 2018-06-27 13:21:00 +10:00
Dominique Martinet 6856866a61 layer_shell: order destroying before sway_output
Both sway_output and sway_layer_shell listen to wlr's output destroy event,
but sway_layer_shell needs to access into sway_output's data strucure and needs
to be destroyed first.

Resolve this by making sway_layer_shell listen to a new event that happens at
start of sway_output's destroy handler
2018-06-26 21:20:56 +09:00
Ryan Dwyer a7b3f29292 Remove incorrect assertion and supporting code
Children can exist when destroying a container, such as when destroying
the last output. Sway is not terminating in that case.
2018-06-26 20:18:57 +10:00
Ryan Dwyer 50190bc760 Rename view's free callback to destroy 2018-06-26 13:18:33 +10:00
Ryan Dwyer 7a922c65aa Damage output when a fullscreen view unmaps
Also moved the arranging into view_unmap to avoid excessive code
duplication.
2018-06-26 13:15:45 +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 1549fb719a Implement atomic layout updates for xwayland views 2018-06-24 23:01:09 +10:00
Ryan Dwyer f08a30d6d0 Force transactions to complete in order
This forces transactions to complete in order by using a singly linked
list stored in the sway server.
2018-06-24 12:33:23 +10: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
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
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
Ryan Dwyer 1c89f32533 Preserve buffers during transactions
* Also fix parts of the rendering where it was rendering the pending
state instead of current.
2018-06-18 20:42:12 +10:00
Ryan Dwyer 645bf446fa Merge remote-tracking branch 'upstream/master' into atomic 2018-06-18 15:58:48 +10: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
frsfnrrg b23cd827cf Sort binding key lists
Sort the list comprising the set of keys for the binding in ascending
order. (Keyboard shortcuts depend only on the set of simultaneously
pressed keys, not their order, so this change should have no external
effect.) This simplifies comparisons between bindings.
2018-06-12 11:26:24 -04:00
Ryan Dwyer 9e96cfd310 Merge remote-tracking branch 'upstream/master' into atomic 2018-06-11 11:03:43 +10:00
Drew DeVault 867fb6aedb
Merge pull request #2124 from emersion/drag-icons
Render drag icons
2018-06-09 10:50:34 -07:00
Nate Symer 6a910b9ba5 Implement gaps (PR #2047) 2018-06-09 09:34:56 -04:00
emersion cfd02918c0
Render drag icons 2018-06-09 13:26:03 +01:00
Ryan Dwyer bb66e6d578 Refactor everything that needs to arrange windows
* The arrange_foo functions are now replaced with arrange_and_commit, or
with manually created transactions and arrange_windows x2.
* The arrange functions are now only called from the highest level
functions rather than from both high level and low level functions.
* Due to the previous point, view_set_fullscreen_raw and
view_set_fullscreen are both merged into one function again.
* Floating and fullscreen are now working with transactions.
2018-06-09 10:11:25 +10:00
Ryan Dwyer f9e6d703d2 Make main properties be the pending state 2018-06-09 10:08:43 +10:00
Ryan Dwyer 59c9488701 WIP: Atomic layout updates ground work 2018-06-09 10:08:43 +10:00
Brian Ashworth 5c9a917df9 Restore workspaces to outputs based on priority 2018-06-08 13:08:00 -04:00
Dominique Martinet c78ce0770a swaylock: implement ^U to clear buffer
The whole state->xcb.modifiers thing didn't work at all (always 0)
The xkb doc says "[xkb_state_serialize_mods] should not be used in
regular clients; please use the xkb_state_mod_*_is_active API instead"
so here it is
2018-06-08 22:42:15 +09:00
Brian Ashworth e072fbc6d9 Switch output storing from list_t to wl_list 2018-06-06 20:11:24 -04:00
Brian Ashworth a1b5b93d29 Store sway_outputs so that they can be reenabled 2018-06-06 20:11:24 -04:00
Brian Ashworth 5ea4a4d3ee Refactor cmd_output to use config_subcommand 2018-06-03 10:26:06 -04:00
Brian Ashworth af87c7a1af Address emersion's feedback on peek_line 2018-06-02 08:07:44 -04:00
Brian Ashworth 8bfa2def88 Address first round of review for generic blocks 2018-06-02 08:07:44 -04:00
Brian Ashworth 51bb9d8573 Support braces on next line for config blocks 2018-06-02 08:07:44 -04:00
Brian Ashworth 7c810dc344 Make command block implementation generic 2018-06-02 08:07:44 -04:00
frsfnrrg c664d780cc Comment to explain sway_shortcut_state lists 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
Ryan Dwyer a2c1cb9072 Fix mpv damage issue when unfullscreening into floating 2018-06-01 23:14:58 +10:00
Ryan Dwyer 97672295ed Don't unmaximize floating views 2018-06-01 23:14:58 +10:00
Ryan Dwyer 5b1601c2e3 Don't let xwayland views set position unless unmanaged 2018-06-01 23:14:58 +10:00
Ryan Dwyer d4ed204d4d Remove container_self_or_parent_floating 2018-06-01 23:14:58 +10:00
Ryan Dwyer 70f5d6fcf3 Rename container_set_geometry_from_view 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 02de2a6f65 Rename set_maximized functions to set_tiled 2018-06-01 23:14:58 +10:00
Ryan Dwyer 13a4b0512e Fix unfullscreening a floating view 2018-06-01 23:14:58 +10:00
Ryan Dwyer aaba7642b3 Replace is_floating boolean with function 2018-06-01 23:14:58 +10:00
Ryan Dwyer 34f35f0bad Use L_FLOATING instead of reapable boolean 2018-06-01 23:14:58 +10:00
Ryan Dwyer 1f2e399ade Implement floating 2018-06-01 23:14:58 +10:00
Drew DeVault 1132efe42e Send frame done to floating views
Also centers them on the screen when initially floated

In the future we'll need a more sophisticated solution than that
2018-06-01 23:14:58 +10:00
Drew DeVault f3ab895916 Implement floating enable 2018-06-01 23:14:58 +10:00
Brian Ashworth c81d0ef1e8 Support i3's legacy force_focus_wrapping command 2018-05-28 11:09:46 -04:00
emersion 1071785f56
Merge pull request #2060 from RedSoxFan/focus-wrapping
Implement focus_wrapping
2018-05-28 10:30:11 +01:00
Brian Ashworth 46da1dc32b Implement focus_wrapping 2018-05-27 23:20:21 -04: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 1b8de39287 Move previous cursor_position inline. 2018-05-28 02:14:19 +10:00
Scott Leggett 4cd304e4ba Store previous position in sway_cursor. 2018-05-28 01:37:43 +10:00
Ryan Dwyer 8fda41dab5
Merge branch 'master' into cmd-swap 2018-05-28 00:14:22 +10:00
emersion 36d5d4b40f
client/pool-buffer: munmap in destroy_buffer 2018-05-27 14:09:48 +01:00
emersion cc10c7af65
swaylock: implement a proper render loop 2018-05-27 13:39:38 +01:00
Ryan Dwyer d3dd7e5bae Rename view_get_type to view_get_shell 2018-05-27 22:02:00 +10:00
Ryan Dwyer 484cc189e9 Add shell criteria token
Closes #2044.
2018-05-27 22:02:00 +10:00
Scott Leggett 06098bef98 Focus containers only on entry. 2018-05-27 15:29:48 +10:00
Brian Ashworth 569f4e0e4c Implement swap command 2018-05-26 11:05:02 -04:00
Ryan Dwyer db38b9bbf3 Clean up container title functions
* Add and use lenient_strcat and lenient_strncat functions
* Rename `concatenate_child_titles` function as that's no longer what it
does
* Rename `container_notify_child_title_changed` because we only need to
notify that the tree structure has changed, not titles
* Don't notify parents when a child changes its title
* Update ancestor titles when changing a container's layout
	* Eg. create nested tabs and change the inner container to stacking
* No need to store tree presentation in both container->name and
formatted_title
2018-05-25 21:07:59 +10:00
emersion df61bfbb57
swaylock: remove unused field 2018-05-23 22:59:24 +01:00