Commit Graph

4873 Commits

Author SHA1 Message Date
Ryan Dwyer 41bfd8c790 swaybar: allow null status_command
Sway sets a default status_command which runs date every second. This
patch removes this behaviour so the user can have a NULL status bar if
desired.

I had to swap swaybar's event_loop_poll and wl_display_flush so that it
would map the initial surface.
2018-10-08 22:23:55 +10:00
Ian Fan b3b17280de
Merge pull request #2789 from RyanDwyer/reload-idle
Reload config using idle event
2018-10-08 12:05:18 +00:00
Ryan Dwyer e168e8f0ff Don't apply seat config when validating 2018-10-08 21:18:30 +10:00
Ryan Dwyer 88a5e26c6e Remove unneeded variable 2018-10-08 20:40:47 +10:00
Ryan Dwyer 82423991a8 Reload config using idle event
This patch makes it so when you run reload, the actual reloading is
deferred to the next time the event loop becomes idle. This avoids
several use-after-frees and removes the workarounds we have to avoid
them.

When you run reload, we validate the config before creating the idle
event. This is so the reload command will still return an error if there
are validation errors. To allow this, load_main_config has been adjusted
so it doesn't apply the config if validating is true rather than
applying it unconditionally.

This also fixes a memory leak in the reload command where if the config
failed to load, the bar_ids list would not be freed.
2018-10-08 19:28:53 +10:00
Drew DeVault 89f4ebef06
Merge pull request #2786 from swaywm/no-op-client-commands
Shim client.background and client.placeholder
2018-10-07 23:30:05 +02:00
Drew DeVault 92e1fc00fd Shim client.background and client.placeholder
These are not supported by sway, but are valid i3 commands and should not
cause config errors.

Also includes a couple of minor touch-ups.
2018-10-07 14:44:37 -04:00
Drew DeVault 7252c7f715 swaynag: s/Toggle Details/Toggle details/ 2018-10-07 14:37:53 -04:00
emersion 06fade1c8b
Merge pull request #2783 from martinetd/swaynag_uaf
swaynag: fix use-after-free in wl_display_dispatch
2018-10-07 09:57:51 +02:00
Dominique Martinet e5ece5f8b3 swaynag: fix use-after-free in wl_display_dispatch
When destroying swaynag from within wl_display_dispatch, we cannot
disconnect the display as that will free the queue's event_list.
Free it after running the loop instead.

Fixes this use-after-free:
==7312==ERROR: AddressSanitizer: heap-use-after-free on address 0x612000000110 at pc 0x000000412a9f bp 0x7ffd4e811760 sp 0x7ffd4e811750
READ of size 8 at 0x612000000110 thread T0
    #0 0x412a9e in wl_list_empty ../common/list.c:206
    #1 0x7f5b58f0d42f in dispatch_queue src/wayland-client.c:1572
    #2 0x7f5b58f0d42f in wl_display_dispatch_queue_pending src/wayland-client.c:1815
    #3 0x40f465 in swaynag_run ../swaynag/swaynag.c:390
    #4 0x407576 in main ../swaynag/main.c:123
    #5 0x7f5b58bb9412 in __libc_start_main ../csu/libc-start.c:308
    #6 0x404a3d in _start (/opt/wayland/bin/swaynag+0x404a3d)

0x612000000110 is located 208 bytes inside of 320-byte region [0x612000000040,0x612000000180)
freed by thread T0 here:
    #0 0x7f5b594ab480 in free (/lib64/libasan.so.5+0xef480)
    #1 0x40faff in swaynag_destroy ../swaynag/swaynag.c:454
    #2 0x40cbb4 in layer_surface_closed ../swaynag/swaynag.c:82
    #3 0x7f5b583e1acd in ffi_call_unix64 (/lib64/libffi.so.6+0x6acd)

previously allocated by thread T0 here:
    #0 0x7f5b594aba50 in __interceptor_calloc (/lib64/libasan.so.5+0xefa50)
    #1 0x7f5b58f0c902 in wl_display_connect_to_fd src/wayland-private.h:236

(you need a wayland compiled with asan, my wl_list hack, or running
with valgrind to see this trace)
2018-10-07 16:35:10 +09:00
Drew DeVault 8393266eb5
Merge pull request #2778 from emersion/swaybar-seat-pointer
swaybar: fix binding to wl_pointer multiple times
2018-10-06 20:10:09 +02:00
emersion f1d8ba69a6
Merge pull request #2779 from ianyfan/ipc
ipc: set "type" of floating containers to "floating_con"
2018-10-06 19:45:54 +02:00
emersion d50f54fa42 swaybar: fix binding to wl_pointer multiple times 2018-10-06 19:13:44 +02:00
Ian Fan 2cda0b1fe1 ipc: set "type" of floating containers to "floating_con" 2018-10-06 18:11:05 +01:00
emersion 176832fe30
Merge pull request #2776 from swaywm/swaylock-setuid
Fix swaylock w/shadow on glibc, improve security
2018-10-06 18:47:34 +02:00
Drew DeVault c89e00a97e Fix swaylock w/shadow on glibc, improve security
Today I learned that GNU flaunts the POSIX standard in yet another
creative way. Additionally, this adds some security improvements,
namely:

- Zeroing out password buffers in the privileged child process
- setuid/setgid after reading /etc/shadow
2018-10-06 12:20:12 -04:00
Drew DeVault 85961f63bf Update CONTRIBUTING.md 2018-10-06 11:52:28 -04:00
emersion 0f45aa4ea9
Merge pull request #2693 from RyanDwyer/move-sticky-in-seat
Move sticky containers when switching workspace via criteria
2018-10-06 14:53:09 +02:00
Ryan Dwyer c620f76bea Move sticky containers when switching workspace via criteria
* Create a view on workspace 1
* Switch to workspace 2 (on the same output) and create a floating
sticky view
* Use criteria to focus the view on workspace 1

Previously, we only moved the sticky containers when using
workspace_switch, but the above method of focusing doesn't call it. This
patch relocates the sticky-moving code into seat_set_focus_warp.

A side effect of this patch is that if you have a sticky container
focused and then switch workspaces, the sticky container will no longer
be focused. It would previously retain focus.

In seat_set_focus_warp, new_output_last_ws was only set when changing
outputs, but now it's always set. This means new_output_last_ws and
last_workspace might point to the same workspace, which means we have to
make sure we don't destroy it twice. It now checks to make sure they're
different, and to make this more obvious I've moved both calls to
workspace_consider_destroy to be next to each other.
2018-10-06 19:16:41 +10:00
Drew DeVault 5d21c33f13
Merge pull request #2771 from RyanDwyer/swaylock-seat-capabilities
swaylock: Support keyboard and pointer disconnects and reconnects
2018-10-06 01:51:35 +02:00
Ryan Dwyer b0393ae34b swaylock: Support keyboard and pointer disconnects and reconnects 2018-10-06 09:38:12 +10:00
emersion c1f09939ae
Merge pull request #2768 from RyanDwyer/fix-flatten-crash
Fix crash when flattening container after moving
2018-10-05 09:40:05 +02:00
Ryan Dwyer 44b550298e Fix crash when flattening container after moving
container_flatten removes the container from the tree (via
container_replace) before destroying it. When destroying, the recent
changes to handle_seat_node_destroy incorrectly assumes that the
container has a parent.

This adds a check for destroying a container which is no longer in the
tree. If this is the case, focus does not need to be changed.
2018-10-05 16:39:20 +10:00
emersion c8d1f376d3
Merge pull request #2764 from ianyfan/rm-base64
Remove obsolete base64.c file
2018-10-04 21:50:05 +02:00
Ian Fan e2dc6dfcd8 Remove obsolete base64.c file 2018-10-04 20:17:19 +01:00
Drew DeVault eecebcafc6 Fix #2763 2018-10-04 15:00:18 -04:00
emersion 0d5c2f75b5
Merge pull request #2760 from RyanDwyer/swaylock-handle-output-disconnect
Give focus to another swaylock surface when output is disconnected
2018-10-04 14:18:13 +02:00
emersion 192ec7d6c8
Merge pull request #2761 from RyanDwyer/seat-op-ignore-buttons
Ignore unrelated cursor buttons while doing seat operations
2018-10-04 13:29:09 +02:00
Ryan Dwyer 4feedbf7cf Ignore unrelated cursor buttons while doing seat operations
* Click and hold a scrollbar
* Drag the cursor onto another surface
* While still holding the original button, press and release another
cursor button
* Things get weird

There's two ways to fix this. Either cancel the seat operation and do
the other click, or continue the seat operation and ignore the other
click. I opted for the latter (ignoring the click) because it's easier
to implement, and I suspect a second click during a seat operation is
probably unintentional anyway.
2018-10-04 20:57:03 +10:00
Ryan Dwyer 32cb631143 Give focus to another swaylock surface when output is disconnected
* Have multiple outputs
* Launch swaylock
* Unplug an output (possibly has to be the last "connected" one)
* The swaylock surface on the remaining output would not respond to key
events

This was happening because when the output destroys, focus was not given
to the other swaylock surface.

This patch makes focus be transferred to another surface owned by the
same Wayland client, but only if input was inhibited by the surface
being destroyed, and only if it's in the overlay layer. I figure it's
best to be overly specific and relax the requirements later if needed.

This patch removes a check in seat_set_focus_surface which was
preventing focus from being passed from a layer surface to any other
surface. I don't know of a use case for this check, but it's possible
that this change could produce issues.
2018-10-04 19:36:19 +10:00
emersion 681ed1826d
Merge pull request #2759 from minus7/fix-view-container-null
Fix crash if view has no container
2018-10-03 21:22:25 +02:00
Drew DeVault 7fdc557f1e
Merge pull request #2709 from BuJo/feature/raise_floating
raise floating
2018-10-03 21:21:25 +02:00
minus 95d7d5f4ee Fix crash if view has no container 2018-10-03 21:01:34 +02:00
Jonathan Buch 426c33f4dc
Reenable popup-handling for determining focus
This reenables the popup-handling code before the floating-window
focus change.
2018-10-03 16:23:14 +02:00
Jonathan Buch 7e978d7a4c
Use "raycasting" for determining focus for floating windows
Floating containers and their surfaces are ordered in "raised last".
This is used to detect the topmost surface and thus the focus.
2018-10-03 16:23:14 +02:00
Jonathan Buch 7727d54faf
Fix focusing topmost floating windows
Re-focus on the container on which the cursor hovers over.  A
special case is, if there are menus or other subsurfaces open
in the focused container.  It will prefer the focused container
as long as there are subsurfaces.

This commit starts caching the previous node as well as the
previous x/y cursor position.  Re-calculating the previous
focused node by looking at the current state of the cursor
position does not work, if the environment changes.
2018-10-03 16:23:14 +02:00
Jonathan Buch 8bec0c90c7
Add manpage documentatioon for raise_floating 2018-10-03 16:23:14 +02:00
Jonathan Buch ec713125c6
Simplify raising a container in seat
* Factor out raising a floating window into s separate function to
  enable reuse.
2018-10-03 16:23:14 +02:00
Jonathan Buch 298ccb539c
Add configuration for raising containers on focus
* New configuration option: raise_floating
  (From the discussion on https://github.com/i3/i3/issues/2990)
* By default, it still raises the window on focus, otherwise it
  will raise the window on click.
2018-10-03 16:23:12 +02:00
emersion 01b8e171b8
Merge pull request #2757 from RyanDwyer/check-focus-stack-empty
Add sanity check for empty focus stack
2018-10-03 14:17:28 +02:00
Ryan Dwyer 5dd535b67a Add sanity check for empty focus stack 2018-10-03 22:09:20 +10:00
Drew DeVault 54a835e962 Remove HACKING.md
Half of this is outdated and the other half is questionable.
2018-10-03 08:02:46 -04:00
Drew DeVault e60ad3f677 Fix some missing commands in sway-input(5) 2018-10-03 07:50:37 -04:00
Drew DeVault 06c214a800
Merge pull request #2703 from RyanDwyer/csd-border
Add CSD to border modes
2018-10-03 13:03:06 +02:00
Drew DeVault f74829d390
Merge pull request #2755 from RyanDwyer/fix-tiling-criteria
Fix tiling criteria
2018-10-03 13:02:06 +02:00
Ryan Dwyer a519fb6fde Fix tiling criteria 2018-10-03 20:33:32 +10:00
Drew DeVault 4e4d0c5191
Merge pull request #2749 from ianyfan/swaybar
swaybar: add leading comma to click event JSON
2018-10-02 17:00:33 +02:00
Ian Fan 65593f49bc swaybar: add leading comma to click event JSON 2018-10-02 14:05:51 +01:00
Drew DeVault 90352986e0
Merge pull request #2745 from RyanDwyer/fix-focus-inactive-on-destroy
Set focus_inactive on a sibling when a container closes in an inactive workspace
2018-10-02 14:14:13 +02:00
Ryan Dwyer 677e112733 Set focus_inactive on a sibling when a container closes in an inactive workspace
To reproduce the problem, create layout
H[view V[view view view-focused]], then switch to another workspace and
have the previously focused view in the vsplit close (eg. using
criteria, or an mpv video finishing). Return to the workspace using
`$mod+<num>` and the entire vsplit would be focused. This happens
because handle_seat_node_destroy would only set a new focus if the
currently focused view or a parent was being destroyed. To fix it, it
needs to set a sibling of the destroying container to focus_inactive
regardless of the current focus, then restore current focus if needed.

This patch changes the function accordingly. Additionally:

* The function now makes an early return if the node being destroyed is
a workspace.
* set_focus has been renamed to needs_new_focus. This variable is true
if the head focus needs to be changed.
2018-10-02 15:45:20 +10:00