Commit graph

372 commits

Author SHA1 Message Date
Ryan Dwyer 5ac6f2f429 Fix crash when running move container to workspace back_and_forth
The back_and_forth condition is intended to be handled in the else-if
block, but this was never reached because it remained in the first
block's conditions.
2018-08-07 23:04:21 +10:00
Brian Ashworth 639f3368e1
Merge branch 'master' into workspace-move-to-output 2018-08-06 11:47:00 -04:00
Ryan Dwyer f57a3919cf Move workspace moving code out of container_move_to
container_move_to handled moving containers to new parents, as well as
moving workspaces to new outputs.

This commit removes the workspace-moving code from this function and
introduces workspace_move_to_output. Moving workspaces using
container_move_to only happened from the move command, so it's been
implemented as a static function in that file.

Simplifying container_move_to makes it easier for me to fix some issues
in #2420.
2018-08-07 00:03:01 +10:00
Ian Fan f7c21451df commands: fix workspace edge cases 2018-08-06 14:17:58 +01:00
Ian Fan 667b8dcb67 commands: check for special workspaces in workspace & move commands 2018-08-06 14:17:58 +01:00
Ian Fan dd48c8a579 commands: add optional flags to move 2018-08-06 14:17:58 +01:00
Ian Fan 85ae121caa commands: complete workspace implementation
Allow optional --no-auto-back-and-forth flag, as well as refactoring some logic
2018-08-06 14:17:58 +01:00
Ian Fan 356063b6c0 commands: fix layout implementation (also better name for previous split layout) 2018-08-06 14:17:58 +01:00
Ian Fan 69e1a421fc commands: complete move implementation 2018-08-06 14:17:58 +01:00
Ian Fan be64c46624 commands: complete layout implementation 2018-08-06 14:17:58 +01:00
Ryan Dwyer 30e7e0f7c7 Move workspace pid code to root.c 2018-08-04 14:01:49 +10:00
Ryan Dwyer 04489ff420 Separate root-related code
This creates a root.c and moves bits and pieces from elsewhere into it.

* layout_init has been renamed to root_create and moved into root.c
* root_destroy has been created and is called on shutdown
* scratchpad code has been moved into root.c, because hidden scratchpad
containers are stored in the root struct
2018-08-04 14:01:20 +10:00
Brian Ashworth a7f7d4a488 Write to swaynag pipe fd directly on config errors 2018-08-03 10:37:35 -04:00
Brian Ashworth f9a6407111 Show swaynag on config errors 2018-08-03 10:37:35 -04:00
Ryan Dwyer 9e8d628a17 Deny "move container" when an empty workspace is focused 2018-08-03 17:13:37 +10:00
Drew DeVault 8e60f6a732
Merge pull request #2404 from RyanDwyer/move-containers-when-workspace-focused
Allow moving containers when workspace itself is focused
2018-08-02 08:11:23 -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
Ryan Dwyer d64c8df7ce Allow moving containers when workspace itself is focused 2018-08-02 20:59:44 +10:00
Ian Fan 03eaf444a4 ipc: prevent emitting a workspace::focus event when moving a container to a different workspace or output
When a container is moved from, say, workspace 1 to workspace 2, workspace 2 is focused in order to arrange the windows before focus is moved back to workspace 1, which caused a workspace:focus event from workspace 2 to workspace 1 to be emitted. This commit inhibits that event.
2018-08-01 16:57:15 +01:00
Ian Fan d898e035ba ipc: add workspace::reload event 2018-08-01 16:57:15 +01:00
Ian Fan 6865b8aae9 ipc: add binding event 2018-08-01 16:57:15 +01:00
Ian Fan 317217f2c8 ipc: add window::mark event 2018-08-01 16:57:15 +01:00
Ian Fan dd6debf367 ipc: add barconfig_update event on config reload 2018-08-01 16:57:14 +01:00
Brian Ashworth 00a00aacef Create list for mouse binds when creating new mode 2018-07-31 23:49:42 -04:00
Ryan Dwyer 9d1f6e095b Send floating container to scratchpad when a child is focused 2018-07-28 22:41:04 +10:00
Ryan Dwyer 538e083f61 Fix focus mode_toggle from a child of a floating container
Also fixes a crash when unfloating a window. It needs to add it back to
the tiling tree as a sibling rather than a child, because the reference
container might be a view.
2018-07-28 22:41:04 +10:00
Ryan Dwyer c95847c9e1 Allow splitting a floating view 2018-07-28 22:41:04 +10:00
Ryan Dwyer da2a87f6c7 When unfloating, return container to previously focused tiled container
This introduces seat_get_focus_inactive_tiling and updates
`focus mode_toggle` to use it instead, because the previous method
wasn't guaranteed to return a tiling view.
2018-07-28 22:41:04 +10:00
Ryan Dwyer 936168e740 Operate on floating split container when a child is focused 2018-07-28 22:41:04 +10:00
Ryan Dwyer 08cfba2192 Allow containers to float
Things worth noting:

* When a fullscreen view unmaps, the check to unset fullscreen on the
workspace has been moved out of view_unmap and into container_destroy,
because containers can be fullscreen too
* The calls to `container_reap_empty_recursive(workspace)` have been
removed from `container_set_floating`. That function reaps upwards so it
wouldn't do anything. I'm probably the one who originally added it...
* My fix (b14bd1b0b1) for the tabbed child
crash has a side effect where when you close a floating container, focus
is not given to the tiled container again. I've removed my fix and
removed the call to `send_cursor_motion` from `seat_set_focus_warp`. We
should consider calling it from somewhere earlier in the call stack.
2018-07-28 22:41:04 +10:00
Ryan Dwyer 27a20a4884 Allow containers to be fullscreen 2018-07-26 08:27:07 +10:00
ProgAndy 0ba52458ab Restrict CapsLock and NumLock commands to the configuration file 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
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 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
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
Ryan Dwyer e02a6718c2
Merge branch 'master' into mouse-bindings 2018-07-24 19:23:04 +10: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 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
Drew DeVault f4b882475e Merge branch 'master' into pid-workspaces 2018-07-23 20:31:11 -04:00
Ryan Dwyer 12e90fa600 Store scratchpad list in sway_root instead of server 2018-07-23 08:24:32 +10:00
Ryan Dwyer 81e8f31cc6 Implement scratchpad
Implements the following commands:

* move scratchpad
* scratchpad show
* [criteria] scratchpad show

Also fixes these:

* Fix memory leak when executing command with criteria
(use `list_free(views)` instead of `free(views)`)
* Fix crash when running `move to` with no further arguments
2018-07-23 08:24:32 +10:00
Ryan Dwyer 86f5531511 Remove unnecessary includes 2018-07-22 23:10:19 +10:00
Ryan Dwyer 9fbe13b9be Implement floating_modifier and mouse operations for floating views
This implements the following:

* `floating_modifier` configuration directive
* Drag a floating window by its title bar
* Hold mod + drag a floating window from anywhere
* Resize a floating view by dragging the border
* Resize a floating view by holding mod and right clicking anywhere on
the view
* Resize a floating view and keep aspect ratio by holding shift while
resizing using either method
* Mouse cursor turns into resize when hovering floating border or corner
2018-07-22 23:10:19 +10:00