Commit Graph

4169 Commits

Author SHA1 Message Date
Ryan Dwyer
84cd22c8cb Fix crash when a deferred command destroys a workspace
Example config that produces the crash (with a single output):

    workspace 1
    workspace 2

Prior to this commit, container_workspace_free would manually mark the
L_FLOATING container as destroying and free it. This assumed the
L_FLOATING container would never be involved in a transaction. This was
a safe assumption when it was implemented, but became an incorrect
assumption once parent/child relationships became transactionised.

This commit removes the L_FLOATING free from container_workspace_free.
When the workspace is destroyed, it starts the normal destroy process on
the L_FLOATING container so it can be freed via transactions.
2018-07-28 22:41:24 +10:00
Brian Ashworth
a2164c6661
Merge pull request #2372 from RyanDwyer/fix-use-after-free-v2
Second attempt at fixing transaction use-after-free
2018-07-28 08:38:09 -04:00
Ryan Dwyer
52cf410d3c Second attempt at fixing transaction use-after-free
The solution used in 073ac425d5 doesn't
work in all cases because the freed instruction might be ahead in the
list, not necessarily behind.

The new solution delays running the queue until after the loop has
finished iterating, thus avoiding the problem completely.
2018-07-28 17:43:18 +10:00
Brian Ashworth
92a4bc646a
Merge pull request #2370 from RyanDwyer/transactions-use-after-free
Fix use after free in transactions
2018-07-28 01:31:43 -04:00
Ryan Dwyer
073ac425d5 Fix use after free in transactions
In set_instructions_ready, calling set_instruction_ready may cause any
number of transactions to get applied, which removes them from the list
being iterated.  The iteration variables need to be adjusted
accordingly.
2018-07-28 15:21:39 +10:00
Drew DeVault
7ad9d743fa
Merge pull request #2369 from mihaicmn/preserve-workspace-name
Preserve workspace name
2018-07-27 21:24:22 -04:00
Mihai Coman
d37c94d1b6 Preserve workspace name 2018-07-28 00:18:52 +00:00
Brian Ashworth
f6db3acd24
Merge pull request #2357 from RyanDwyer/cleanup-view-map
Refactor view_map
2018-07-26 21:53:05 -04:00
Ryan Dwyer
6ceb1d33fd Fix assign to workspace 2018-07-27 09:21:55 +10:00
Ryan Dwyer
a90f2dbde9 Refactor view_map
* Move workspace selection into separate function
* Instead of keeping a `prev_focus` variable, do the check in
`should_focus` (ie. views can only take focus if they're mapped into the
active workspace)
* Fix assign-to-output - it previously set `prev_focus` but should be
`target_sibling`
* Remove call to `workspace_switch` as we'll only ever focus the view if
it's in the active workspace
2018-07-26 19:18:47 +10:00
Brian Ashworth
75ebeb4a16
Merge pull request #2356 from RyanDwyer/fullscreen-containers
Allow containers to be fullscreen
2018-07-25 21:30:56 -04:00
Ryan Dwyer
868dcde14e Fix indent 2018-07-26 08:28:05 +10:00
Ryan Dwyer
27a20a4884 Allow containers to be fullscreen 2018-07-26 08:27:07 +10:00
Brian Ashworth
c8dc9b3b30
Merge pull request #2330 from progandy/set-modifier-locks
Configure initial state for numlock/capslock
2018-07-25 12:07:35 -04:00
ProgAndy
76ece5788b Fix LEDs for configured modifier states 2018-07-25 17:24:45 +02:00
ProgAndy
0ba52458ab Restrict CapsLock and NumLock commands to the configuration file 2018-07-25 17:24:45 +02:00
ProgAndy
d07463d53b Add documentation for xkb_capslock/xkb_numlock 2018-07-25 17:24:45 +02:00
ProgAndy
c7a3a03115 Add xkb_numlock/xkb_capslock commands (#2311) 2018-07-25 17:24:45 +02: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
emersion
6a8d1e5044
Merge pull request #2358 from CedricCabessa/fix-2355-move-workspace-crashes
fix #2355: "move workspace to output up" crashes
2018-07-25 16:24:15 +01:00
Cédric Cabessa
445a09575c fix #2355: "move workspace to output up" crashes
when using 2 display, if scaling is different
`container_update_textures_recursive` is called when moving workspace on
different display.
We need to call `container_update_title_textures` only for container of type
"CONTAINER" or "VIEW" in order to be consistent with the assert in
`update_title_texture`.
2018-07-25 17:06:50 +02:00
Drew DeVault
53dbe2da4b
Merge pull request #2353 from emersion/render-opaque-overlay
Improve rendering with a fullscreen opaque overlay surface
2018-07-25 08:32:32 -04:00
Drew DeVault
fc718f629a
Merge pull request #2350 from ppascher/xwayland-optional
Added meson option to allow building sway without xwayland support
2018-07-25 08:27:40 -04:00
Pascal Pascher
384c55c0b4 more style fixes, reorder config.h include 2018-07-25 13:43:21 +02: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
79a45d4a40 more style fixes, included "sway/config.h" where needed 2018-07-25 12:17:10 +02:00
emersion
fd1e2c172c
Merge pull request #2354 from RyanDwyer/fix-crash-on-tab-reap
Fix crash when closing last child of a tabbed container
2018-07-25 10:49:43 +01:00
Ryan Dwyer
b14bd1b0b1 Fix crash when closing last child of a tabbed container
The crash only occurs if the mouse cursor is above the tabbed container
when the last child is closed.

Introduced in 03d49490cc, over a week ago
and unnoticed until now :O

The above commit changes the behaviour of a focus change. When you
change focus, it sends pointer motion which makes the client set a new
cursor image. We already had this behaviour for workspace switching, but
this commit adds it for view switching too, such as in a tabbed
container or when closing a view.

The sequence of events that leads to the crash is:

* The last child of a tabbed container unmaps, which triggers a
`destroy` event before we've cleaned up the child or reaped the tabbed
container.
* The seat code listens to the `destroy` event and removes the seat
container from the focus stack. As part of this, it decides to set focus
to the parent (my fix alters this decision).
* When setting focus to the new parent, the container motion is sent as
per the previously mentioned commit.
* The motion code uses `container_at`, which encounters the tabbed
container and its child in a half destroyed state, and everything blows
up from there.

`con->parent` is needed because scratchpad containers don't have parents
if they're hidden, so this probably fixes a crash when a hidden
scratchpad container closes too.

The `con->parent->children->length > 1` check should catch any cases
where the parent is about to be reaped.
2018-07-25 19:26:12 +10:00
emersion
0e79b2114c Improve rendering with a fullscreen opaque overlay surface
The rendering code doesn't use the exclusive input surface at all
anymore to decide to skip rendering of shell surfaces. This fixes
a weird situation in which a client requests exclusive input but
isn't an overlay layer surface.

The renderer also renders all overlay surfaces in this situation,
not just one. This simplifies the code and fixes rendering when
there are more than one overlay surfaces (e.g. for a virtual
keyboard to type the lockscreen password).
2018-07-25 08:55:41 +01:00
emersion
cdc4ad2b4f
Merge pull request #2352 from RedSoxFan/implement-2335
Implement floating_modifier <mod> [inverse|normal]
2018-07-25 00:04:38 +01:00
Brian Ashworth
3a75bb7f32 Change button var passed to seat_begin_move 2018-07-24 18:52:54 -04:00
Brian Ashworth
dca02944ce Implement floating_modifier <mod> [inverse|normal] 2018-07-24 18:41:08 -04: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
Drew DeVault
817d37c950
Merge pull request #2165 from swaywm/pid-workspaces
Implement pid->workspace tracking
2018-07-24 14:44:01 -04:00
Drew DeVault
c80258c3b3 Address @emersion's review comments 2018-07-24 14:31:38 -04:00
Drew DeVault
347f7cb4c1
Merge pull request #2346 from RyanDwyer/fix-crash-on-click
Fix crash when clicking certain surfaces
2018-07-24 07:50:55 -04:00
Ryan Dwyer
2f1b84a0f3 Fix crash when clicking certain surfaces
cont was NULL.
2018-07-24 21:12:24 +10:00
emersion
354731f161
Merge pull request #2344 from RyanDwyer/mod-resize-any-direction
Make mod+resize work in any direction
2018-07-24 12:10:08 +01:00
Ryan Dwyer
e7c10f1871 Make mod+resize work in any direction
This makes it so if you hold mod and right click on a surface to resize
it, the resize direction is chosen based on which quarter of the surface
you've clicked. The previous implementation only resized towards the
bottom right.
2018-07-24 20:20:00 +10:00
Ryan Dwyer
1a9179dbab
Merge pull request #2303 from frsfnrrg/mouse-bindings
Implement mouse bindings
2018-07-24 19:48:27 +10:00
Ryan Dwyer
e02a6718c2
Merge branch 'master' into mouse-bindings 2018-07-24 19:23:04 +10:00
Brian Ashworth
6ccf2a2c66
Merge pull request #2284 from frsfnrrg/resolve-workspace-name-todo
Also extract first workspace name from bindcodes
2018-07-23 22:01:25 -04:00
frsfnrrg
ab0efebc3e Also extract first workspace name from bindcodes 2018-07-23 21:51:00 -04:00
Drew DeVault
71774ecd36
Merge pull request #2340 from RedSoxFan/parse_boolean
Switch to using a function to parse booleans
2018-07-23 21:49:16 -04:00
frsfnrrg
94dd8823a0 Invoke mouse bindings
The mouse binding logic is inspired/copied from the
keyboard binding logic; we store a sorted list of the
currently pressed buttons, and trigger a binding when
the currently pressed (or just recently pressed, in
the case of a release binding) buttons, as well as
modifiers/container region, match those of a given
binding.

As the code to execute a binding is not very keyboard
specific, keyboard_execute_command is renamed to
seat_execute_command and moved to where the other
binding handling functions are. The call to
transaction_commit_dirty has been lifted out.
2018-07-23 21:38:29 -04:00
Brian Ashworth
9ec1d6cf79 Address review comments on parse_boolean 2018-07-23 21:37:53 -04:00
Brian Ashworth
d56d62c1c0 Remove unneeded const 2018-07-23 21:33:17 -04:00
Brian Ashworth
863914ec95 Switch to using a function to parse booleans 2018-07-23 21:33:17 -04:00
frsfnrrg
754372c3de Parse mouse binding options
First, the existing sway_binding structure is given an
enumerated type code. As all flags to bindsym/bindcode
are boolean, a single uint32 is used to hold all flags.
The _BORDER, _CONTENTS, _TITLEBAR flags, when active,
indicate in which part of a container the binding can
trigger; to localize complexity, they do not overlap
with the command line arguments, which center around
_TITLEBAR being set by default.

The keyboard handling code is adjusted for this change,
as is binding_key_compare; note that BINDING_LOCKED
is *not* part of the key portion of the binding.

Next, list of mouse bindings is introduced and cleaned up.

Finally, the binding command parsing code is extended
to handle the case where bindsym is used to describe
a mouse binding rather than a keysym binding; the
difference between the two may be detected as late as
when the first key/button is parsed, or as early as
the first flag.  As bindings can have multiple
keycodes/keysyms/buttons, mixed keysym/button sequences
are prohibited.
2018-07-23 21:14:22 -04:00