Commit graph

3298 commits

Author SHA1 Message Date
Brian Ashworth 4d88c95790 hide_cursor: change to a seat subcommand
This makes hide_cursor a seat subcommand, which allows for seat specific
timeouts.
2018-12-30 14:17:24 +01:00
Brian Ashworth 09bb71f650 Verify seat fallback settings on reload
This fixes an issue where on reload, all input devices that were added
via an implicit fallback to the default seat would be removed from the
default seat and applications would crash due to the seat having no
capabilities.

On reload, there is a query for a seat config with the fallback setting
set (it can either be true or false). If no such seat config exists, the
default seat is created (if needed) and has the implicit fallback true
applied to its seat config. This is the same procedure that occurs when
a new input is detected.
2018-12-30 14:12:36 +01:00
Brian Ashworth 6ec2983d96 seat_cmd_cursor: work on seat name provided
Instead of simulating events on the current seat, this makes it so
seat_cmd_cursor respects the seat name provided by `seat <name> cursor
<args>`. It also adds support for simulating events on all seats when
the wildcard is given.

This also defers the command when reading the config, which allows the
user to set the initial position of the cursor when the command is
included in the config file.
2018-12-29 22:02:19 -05:00
Brian Ashworth 3e8f548d1d Revamp seat configs
This makes seat configs work like output and input configs do. This also
adds support for wildcard seat configs. A seat config is still created
in the main seat command handler, but instead of creating a new one in
the subcommands and destroying the main seat command's instance, the
seat subcommands modify the main one. The seat config is then stored,
where it is merged appropriately. The seat config returned from
`store_seat_config` is then applied. When attempting to apply a wildcard
seat config, a seat specific config is queried for and if found, that is
used. Otherwise, the wildcard config is applied directly.

Additionally, instead of adding input devices to the default seat
directly when there is no seat configs, a seat config for the default
seat is created with only fallback set to true, which is more explicit.
It also fixes an issue where running a seat command at runtime (with no
seat config in the sway config), would result in all input devices being
removed from the default seat and leaving sway in an unusable state.

Also, instead of checking for any seat config, the search is for a seat
config with a fallback option seat. This makes it so if there are only
seat configs with fallback set to -1, the default seat is still created
since there is no explicit notion on what to do regarding fallbacks.
However, if there is even a single fallback 0, then the default seat is
not used as a fallback. This will be needed for seat subcommands like
hide_cursor where the user may only want to set that property without
effecting anything else.
2018-12-29 19:40:40 +01:00
Brian Ashworth 4503ad2d19 sway-output(5): doc scaling consideration for pos
This copies the information regarding positioning outputs when there
is scaling involved from the wiki to sway-output(5).
2018-12-29 17:25:29 +01:00
Brian Ashworth ae8937b11a Add failure reply on IPC_SYNC
Since it was decided that sway will not support IPC_SYNC, just return
`{'success': false}` as a reply
2018-12-29 17:07:26 +01:00
Brian Ashworth 0dbf2673a1 Remove button from state on release during op
This fixes a bug in `dispatch_cursor_button` where if there was an
operation occurring, the button would not be removed from the state on
release. This resulted in the button appearing to be permanently pressed
and caused mouse bindings to not match correctly.
2018-12-29 16:36:48 +01:00
Drew DeVault c54258f323
Merge pull request #3346 from ermo/sway-bar_focused_statusline_colour-render-fix
swaybar: fix focused_statusline color parsing.
2018-12-29 10:24:34 -05:00
Rune Morling 612702591c swaybar: fix focused_statusline color parsing. 2018-12-29 13:34:52 +01:00
Ryan Dwyer dd8d2dedf7 Fix crash when scratchpad contains split containers
To reproduce:

* Launch two terminals in a workspace
* `focus parent` to select both terminals
* `move scratchpad`
* `scratchpad show` to show the terminals
* `scratchpad show` to hide the terminals
* `scratchpad show` - crash

When hiding the terminals, it should be moving focus to whatever is in
the workspace, but this wasn't happening because the focus check didn't
consider split containers. So the terminals were hidden in the
scratchpad while still having focus. This confused the next invocation
of scratchpad show, causing it to attempt to hide them instead of show
them, and the hide-related code caused a crash when it tried to arrange
the workspace which was NULL.

This patch corrects the focus check.
2018-12-29 14:45:42 +10:00
NokiDev 9bf1b7a029 added fullscreen_mode to get_tree output
Signed-off-by: NokiDev <noki.dev@gmail.com>
2018-12-25 15:24:01 +01:00
Brian Ashworth 3248c823ed Split image_surface handling into own function 2018-12-25 13:31:56 +01:00
Brian Ashworth 5fca74a1f1 Implement hide_cursor <timeout> command
Allows the cursor to be hidden after a specified timeout in
milliseconds
2018-12-25 13:31:56 +01:00
Brian Ashworth a223030b70 Change mouse buttons to x11 map and libevdev names
This modifies the way mouse bindings are parsed. Instead of adding to
BTN_LEFT, which results in button numbers that may not be expected,
buttons will be parsed in one of the following ways:

1. `button[1-9]` will now map to their x11 equivalents. This is already
the case for bar bindings. This adds support for binding to axis events,
which was not possible in the previous approach.

2. Anything that starts with `BTN_` will be parsed as an event code name
using `libevdev_event_code_from_name`. This allows for any button to be
mapped to instead of limiting usage to the ones near BTN_LEFT. This also
adds a dependency on libevdev, but since libevdev is already a dependency
of libinput, this should be fine. If needed, this option can have dependency
guards added.

Binding changes:
- button1: BTN_LEFT -> BTN_LEFT
- button2: BTN_RIGHT -> BTN_MIDDLE
- button3: BTN_MIDDLE -> BTN_RIGHT
- button4: BTN_SIDE -> SWAY_SCROLL_UP
- button5: BTN_EXTRA -> SWAY_SCROLL_DOWN
- button6: BTN_FORWARD -> SWAY_SCROLL_LEFT
- button7: BTN_BACK -> SWAY_SCROLL_RIGHT
- button8: BTN_TASK -> BTN_SIDE
- button9: BTN_JOYSTICK -> BTN_EXTRA

Since the axis events need to be mapped to an event code, this uses the
following mappings to avoid any conflicts:
- SWAY_SCROLL_UP: KEY_MAX + 1
- SWAY_SCROLL_DOWN: KEY_MAX + 2
- SWAY_SCROLL_LEFT: KEY_MAX + 3
- SWAY_SCROLL_RIGHT: KEY_MAX + 4
2018-12-25 13:27:08 +01:00
Brian Ashworth 00d97cb195 sway(5): document tiling_drag
Adds documentation in sway(5) for the tiling_drag command
2018-12-24 11:15:31 +01:00
Brian Ashworth cf7c77e56a Fix wlr_box_intersection args for wlroots 1441
The fix pushed to master missed wlr_box_intersection. This just fixes
those lines so sway renders properly again
2018-12-22 18:54:08 +01:00
Drew DeVault 788b715776 Fixes per wlroots#1441 2018-12-22 08:53:05 -05:00
Aidan Harris 0d3cf36c85 IPC_SUBSCRIBE ensure request object is an array
Fixes #3320
2018-12-22 14:02:29 +01:00
Brian Ashworth 88d96bc41f Combine output_by_name and output_by_identifier
This combines `output_by_name` and `output_by_identifier` into a single
function called `output_by_name_or_id`. This allows for output
identifiers to be used in all commands, simplifies the logic of the
callers, and is more efficient since worst case is a single pass through
the output list.
2018-12-20 19:55:29 +01:00
Brian Ashworth 477bca5e28 Terminate swaybg in output_disable
Moves the call to `terminate_swaybg` from inside `apply_output_config` to
`output_disable`. The former was only called when an output was being
disabled. The latter is called when an output is being disabled and when
an output becomes disconnected. Without this, disconnecting an enabled
output would result in a defunct swaybg process.
2018-12-19 09:24:15 +01:00
Ryan Dwyer 3a4f4f5d66 Return success when renaming a workspace to itself 2018-12-18 14:00:39 +01:00
Brian Ashworth 0ea54833d4 Focus node before tiling drag if on titlebar
Before attempting to drag a tiling container by its titlebar,
focus it. This fixes clicking on titlebars to focus a container.
2018-12-17 16:55:44 -05:00
Brian Ashworth 4e2cfe0526 cmd_split: add null checks in do_split
Fixes a crash when running `split` commands with the workspace focused.
2018-12-17 18:23:32 +01:00
Brian Ashworth 5f25541022 Allow output ids and wildcard for workspace output
This allows for output identifiers and to be used in the `workspace
<workspace> output <outputs...>` command. Previously, only output names
would be allowed. If an output identifier was given, it would never match
an output. This also allows for the wildcard character (`*`) to be
specified, which can be used to generate a list of workspace names that
should be used when generating new workspaces
2018-12-17 16:25:44 +01:00
Brian Ashworth 8d7ebc258a Allow tiling views to be dragged by the titlebar
Enables titling views to be dragged by the titlebar. This is in addition
to using the modifier and dragging them from anywhere on the container
surface. Floating views already allow this behavior.
2018-12-17 09:08:26 +01:00
Rostislav Pehlivanov 1442d4e688 Update for swaywm/wlroots#1377
-Werror is eͫ̐ͭ҉vi͆ͦ̏ͦlͥ̀͒̊͂͛
2018-12-16 15:04:06 +01:00
Brian Ashworth c2499772b9 Fix focusing on non-visible workspace
My previous attempt was not quite right. Changing the focus stack on a
non-visible workspace should only be blocked if the focus would be set
to the workspace itself
2018-12-14 13:59:54 -05:00
Brian Ashworth 1897edabba Rework default output configs
Default output configs were generated on reload to reset an output to
its default settings. The idea was that anything that was removed from
the config or changed at runtime and not in the config should be reset
on reload. Originally, they were created using the output name. Recently,
they were changed to use the output identifier. It turns out that there
are issues of shadowing with that solution as well. This should fix
those issues.

Instead of generating the default output configs on reload and storing
them in the output config list to merge on top of, they are now only
generated when retrieving the output config for an output during a
reload. This means that the default output configs are never stored
anywhere and just used as a base to merge unaltered user configs on top
of during a reload.

Starting with a blank output config, merges get applied in the following
order:
1. Default output config (only during a reload)
2. Wildcard config (only if neither output name or output identifier
exist)
3. Output name config
4. Output identifier config
2018-12-13 18:37:25 +01:00
mwenzkowski 01420193ef Fix criteria execution in view_map
This patch moves view_execute_criteria(view) below the fullscreen code.
Previously, if a view requested to be started in fullscreen, this was
done after execution of criteria and hence it was impossible to disable
fullscreen via criteria.

Fixes #3285
2018-12-12 13:41:47 +01:00
Brian Ashworth bc981b2bbb Keep focus when destroying containers on nonvis ws
Changing the focus stack when destroying a container's node on a
non-visible workspace (on an non-focused output) incorrectly causes
the non-visible workspace to become visible. If the workspace is empty,
it will not be destroyed since it is now visible. Additionally since
there was no workspace::focus event, swaybar still shows the previous
workspace as focus-inactive. It also makes no sense to change visible
workspaces due to a container on a non-visible workspace being
destroyed.

Since the focus will either be set when switching to the non-visible
workspace or the workspace will be destroyed due to being empty, there
is no need to change the focus stack when destroying a container on a
non-visible workspace.
2018-12-12 10:13:50 +01:00
Brian Ashworth 6acbe84fdd Call wlr_output_enable for disabled new outputs
When a new output is detected and it is disabled by the output config,
call `wlr_output_enable(output->wlr_output, false)` to DPMS off the
output.
2018-12-10 08:59:24 +01:00
Ian Fan 98c1e19466 list.c: rename free_flat_list to list_free_items_and_destroy 2018-12-09 01:15:38 +00:00
Ian Fan c8776fac42 Cleanup list code 2018-12-09 01:15:38 +00:00
Ian Fan 19e831ed3d list.c: Remove list_foreach
Most occurrences have been replaced by `free_flat_list` which has been
moved from stringop.c to list.c. The rest have been replaced by for loops.
2018-12-09 00:37:50 +00:00
Brian Ashworth 7b23a1a0d8 cmd_split: flatten when possible 2018-12-05 21:46:02 -05:00
mwenzkowski cf6edaf26a Fix command list execution
Determine the container/workspace a command is run on, each time when a
command of the command list will be run.
Previously the container/workspace was determined only once at the
beginning of command list execution, which led to wrong behaviour
because commands wouldn't take into account when a previous command
changed the focused container.
2018-12-05 11:32:23 +01:00
Ian Fan bca21ee0cf config: do not set $XDG_CONFIG_HOME if unset or empty
Instead redefine the config paths to use the default $HOME/.config
2018-12-03 13:28:31 +01:00
Ian Fan de66ed4beb config: set $XDG_CONFIG_HOME if empty
Before, it was only set if it was not set, but it should also be done
when empty.
2018-12-03 12:12:21 +01:00
Brian Ashworth 9b41db32ec Fix identifier output configs on reload
When generating default output configs to reset the outputs to their
default settings on reload, the output name was being used.
Additionally when determining the output config to apply, if there was
an output config with the output name, that was being used without
checking for an identifier config. This caused sway to completely ignore
the users specified output config.

To fix this issue, the following changes have been made:
1. Default output configs as created for the identifier now instead of
name. This actually makes more sense anyway since you could hotplug
multiple different outputs to the same port.
2. In get_output_config, which is only used to determine which output
config to apply, output configs for both the name and identifier are
queried. If both are found, a new output config is generated with the
identifier config merged on top of the name config. If just one is found,
a copy of that config is returned. This change also requires that the
result from get_output_config be freed after use to prevent memory
leaks, which required some minor changes to logic in
apply_output_config_to_outputs.
2018-12-03 08:51:27 +01:00
Brian Ashworth 2942bbbc60 cmd_focus: show scratchpad if hidden
If a scratchpad container is hidden, it is still focusable using
criteria and should be shown. This fixes a segfault when attempting to
rebase the cursor since previously the scratchpad container would not be
on any output.
2018-12-03 08:49:26 +01:00
Alex Maese 1a1a2d96cb Add option to bindsym/bindcode to suppress warning on override 2018-12-02 21:35:44 -06:00
bschacht bf11a77884 fix typo
tranform -> transform
2018-12-02 20:48:53 +01:00
Drew DeVault 974a3fbc59
Merge pull request #3227 from emersion/swap-buffers-damage-coords
Update for swaywm/wlroots#1403
2018-12-02 13:17:37 -05:00
emersion ed7bd683a7
Update for swaywm/wlroots#1403 2018-12-01 11:01:08 +01:00
mwenzkowski 68668c22e5 sway.5: Improve documentation
Document the optional arguments of the fullscreen command.
2018-11-30 18:15:26 +01:00
mwenzkowski b5c92e5d3b Fix the error result of the fullscreen command
Changes the error result from CMD_INVALID to CMD_FAILURE, since
CMD_INVALID indicates an unknown command or parser error and neither
occurs where CMD_INVALID was used.
2018-11-29 17:03:04 +01:00
John Axel Eriksson aef52154ec
Fix json object ipc return 2018-11-29 08:28:42 +01:00
emersion 9d18d81d48
Merge pull request #3216 from RedSoxFan/fix-empty-titlebars
Fix titlebar when no title or marks
2018-11-28 21:05:59 +01:00
Brian Ashworth 14cb39c772 Fix titlebar when no title or marks
This fixes the rendering of the titlebar when there is no title or marks.
2018-11-28 14:20:58 -05:00
Brian Ashworth 71ae08530a Fix default_orientation auto
Since the output config is no longer applied before creating the default
workspace, the layout for default workspaces on an output may not be
correct. Due to the ordering of calls in output_enable being changed in
several bug fix PRs, this just fixes the layout after the call to
apply_output_config.
2018-11-28 13:52:54 -05:00
emersion 9924d72ab2
Merge pull request #3213 from RedSoxFan/fix-3203
Fix scratchpad segfault - NULL focused workspace
2018-11-28 19:16:01 +01:00
Brian Ashworth f52277f66e Fix scratchpad segfault - NULL focused workspace
When adding a container to the scratchpad, it was possible for focus to
be removed from the seat. This occurred when a single child was moved
from it's parent to the scratchpad due to the focus_inactive for the
parent being NULL. If the focus_inactive for the parent is NULL, the
focus_inactive for the workspace should be focused.
2018-11-28 13:02:54 -05:00
emersion 67c7cc53ae
Merge pull request #3206 from RedSoxFan/ipc-subscribe
Implement support for swaymsg -t SUBSCRIBE [-m]
2018-11-28 17:58:36 +01:00
Brian Ashworth 1bd8463481 Implement bar gaps
Adds the bar subcommand `gaps <amount>|<horizontal> <vertical>|<top>
<right> <bottom> <left>` to set gaps for swaybar. Due to restrictions on
margins for a layer_surface, only the sides that are anchored to an edge
of the screen can have gaps. Since there is support for per-side outer
gaps for workspaces, those should be able to be used instead for the
last side.
2018-11-28 11:24:14 -05:00
Brian Ashworth bf9a52bab0 Implement support for swaymsg -t SUBSCRIBE [-m]
In `i3 4.16`, `i3-msg` can be used with the message type `subscribe`
and has the ability to monitor for responses until killed. This adds
support for both to swaymsg.

If the JSON array of event types is malformed or contains an invalid
event, sway will send a response with `success` set to `false`. If
swaymsg sees this, it will not display the failure and exit.

If the `subscribe` event is successful, swaymsg will wait for the first
response and display that instead of the success message. If
`-m/--monitor` is given, swaymsg will continue monitor for responses
until killed or a malformed response is received.

For the `subscribe` event, the responses will always be printed as JSON.
If `-r/--raw` is given, the JSON will not be pretty printed, which may
be preferred when monitoring due to there being multiple responses.

Example: `swaymsg -t SUBSCRIBE -m "['window']"`
2018-11-28 11:19:18 -05:00
Brian Ashworth 5341e034df
Merge pull request #3212 from martinetd/move_floating
move to workspace: fix moving floating container to non-empty workspace
2018-11-28 11:16:14 -05:00
Brian Ashworth e5f90f25d7 Introduce a way to show config warnings in swaynag
Adds the function `config_add_swaynag_warning(char *fmt, ...)` so that
handlers can add warnings to the swaynag config log in a uniform way.
The formatting is identical to errors and include the line number, line,
and config path.

This also alters the background file access warning to use the function
and introduces a warning for duplicate bindings.
2018-11-28 11:09:01 -05:00
Dominique Martinet 2543834172 move to workspace: fix moving floating container to non-empty workspace
moving a container to a non-empty workspace will find a container to move
to in the destination workspace and call container_move_to_container,
which must not just skip floating containers
2018-11-29 00:08:43 +09:00
emersion b98563d2d7
Fix segfault when destroying unmapped child view 2018-11-28 14:08:20 +01:00
Ryan Dwyer f737854e30
Merge pull request #3199 from emersion/handle-subsurface-destroy
Handle destroyed subsurfaces
2018-11-28 20:46:22 +10:00
emersion 048b96a56d
Merge pull request #3204 from RedSoxFan/cmd-res-list
Change execute_command to return a list of results
2018-11-28 09:26:47 +01:00
Brian Ashworth 315bca176c Do not strip quotes for cmd_mode
Like with cmd_bindsym and cmd_bindcode, the quotes should not be
stripped for cmd_mode. cmd_mode performs its own stripping for the mode
name and the only valid subcommands are cmd_bindsym and cmd_bindcode.
2018-11-28 01:28:03 -05:00
Brian Ashworth 5c6f3d7266 Change execute_command to return a list of results
This matches i3's behavior of returning a list of results that contain
the result of each command that was executed. Additionally, the
`parse_error` attribute has been added to the IPC JSON reply.
2018-11-27 21:42:09 -05:00
emersion 1d30b7c0f6
Damage view child when destroyed 2018-11-27 21:13:08 +01:00
emersion fc79b7c2d2
Handle destroyed subsurfaces
Damage subsurfaces when they are destroyed. Since subsurfaces don't have an
unmap event we need to do that on destroy.

We also don't want to keep a sway_view_child when the wlr_subsurface has been
destroyed.

Fixes https://github.com/swaywm/sway/issues/3197
2018-11-27 11:46:30 +01:00
Drew DeVault dbf8e1cead
Merge pull request #3175 from emersion/rename-gtk-primary-selection
Update for swaywm/wlroots#1387
2018-11-26 18:41:30 -05:00
Brian Ashworth a22e7b13ad
Merge pull request #3168 from mihaicmn/scratchpad-events
Fix missing IPC scratchpad replies/move events
2018-11-26 12:02:27 -05:00
Ryan Dwyer af7a97623b
Merge pull request #3185 from emersion/remove-xopen-source
Replace _XOPEN_SOURCE with _POSIX_C_SOURCE
2018-11-26 21:25:45 +10:00
Mihai Coman 39db9b855d IPC: Use consistent function names across ipc-json 2018-11-26 11:15:40 +02:00
Mihai Coman 65c32e41d4 IPC: Add scratchpad containers to get_tree reply
This patch lists all hidden scratchpad containers as floating nodes
on "__i3_scratch" workspace. This workspace resides on "__i3" output.
2018-11-26 11:15:25 +02:00
Mihai Coman 6aafdd2321 IPC: Trigger move events for scratchpad containers
This patch allows IPC clients to receive window::move events
when containers are moved to scratchpad or when hidden containers
are shown via "scratchpad show" command.
2018-11-26 11:13:47 +02:00
emersion c2921b2e61
Merge pull request #3169 from RedSoxFan/title-align
Implement title alignment
2018-11-26 09:28:25 +01:00
Brian Ashworth 0e6e5af983
Merge pull request #3183 from emersion/fix-escape-pango
Fix pango title escaping
2018-11-25 22:25:12 -05:00
Brian Ashworth e6562c8cd2 Implement title alignment
This adds support for `i3 4.16`'s ability to set the title alignment.
The command is `title_align left|center|right`.

When the title is on the right, marks are moved to the left. Otherwise,
they are on the right.
2018-11-25 22:08:58 -05:00
emersion 91bbb2a7dd
Merge pull request #3184 from kupospelov/fix-resize
resize set: fix units for floating containers
2018-11-25 17:41:45 +01:00
emersion 3a310f92ab
Replace _XOPEN_SOURCE with _POSIX_C_SOURCE
And make sure we don't define both in the same source file.
2018-11-25 17:19:43 +01:00
Konstantin Pospelov f9bde0030d resize set: add assertion for an invalid unit 2018-11-25 15:16:45 +03:00
Konstantin Pospelov a7b9e63cbc resize set: fix units for floating containers
This commit fixes the default size units for floating containers, so that
pixels are used if the units are not specified.
2018-11-25 12:33:11 +03:00
emersion b84bf3585c
Fix pango title escaping
This commit fixes two bugs.

First, commit [1] has inverted the condition when we escape pango markup. We
need to escape client-provided strings when markup is enabled.

Second, parse_title_format has a shortcut when title_format is set to `%title`,
and escape_pango_markup wasn't used anymore there.

Fixes https://github.com/swaywm/sway/issues/3181

[1]: caee2dff03
2018-11-25 09:09:32 +01:00
emersion 827e5513e0
Merge pull request #3179 from baloo/baloo/title_format-pango_markup
fixes pango_markup support with title_format
2018-11-24 23:07:13 +01:00
Arthur Gautier caee2dff03 fixes pango_markup support with title_format
The support for pango_markup was broken in title_format because the
formated title was escaped. I think only the payload should be escaped.

This commit fixes 789a877b37
2018-11-24 08:26:43 -08:00
emersion cc28f9712e
Update for swaywm/wlroots#1387 2018-11-23 12:07:46 +01:00
Florent de Lamotte 7555c7efdc Adding commands for configuring titlebar borders and padding 2018-11-22 10:30:04 +01:00
emersion 77554f545e
Merge pull request #3158 from emersion/get-outputs-focused
ipc: fix focused in get_outputs reply
2018-11-22 09:16:14 +01:00
emersion 2f1050796c
ipc: fix focused in get_outputs reply
It's set even if a child of the output is focused.
2018-11-19 19:57:41 +01:00
emersion bf7af9c690
Merge pull request #3083 from c-edw/feature/StripWorkspaceName
Implement strip_workspace_name.
2018-11-19 17:56:18 +01:00
emersion 311c7db7e3
Add xwayland command 2018-11-19 17:38:37 +01:00
Spencer Michaels 70bc4c3ab6 Add scroll factor config option. 2018-11-18 13:49:30 -05:00
emersion cad851805b
Use #if instead of #ifdef 2018-11-18 00:33:06 +01:00
Connor E 4bd46fb079 Implement strip_workspace_name. 2018-11-17 16:11:28 +00:00
Drew DeVault eda3bfeed5
Merge pull request #3142 from RyanDwyer/move-view-properties
Move view {x,y,width,height} into container struct
2018-11-17 11:04:34 -05:00
Ryan Dwyer be9348d25c Move view {x,y,width,height} into container struct
This renames/moves the following properties:

* sway_view.{x,y,width,height} ->
sway_container.content_{x,y,width,height}
    * This is required to support placeholder containers as they don't
    have a view.
* sway_container_state.view_{x,y,width,height} ->
sway_container_state.content_{x,y,width,height}
    * To remain consistent with the above.
* sway_container_state.con_{x,y,width,height} ->
sway_container_state.{x,y,width,height}
    * The con prefix was there to give it contrast from the view
    properties, and is no longer useful.

The function container_set_geometry_from_floating_view has also been
renamed to container_set_geometry_from_content.
2018-11-17 21:29:42 +10:00
Cole Mickens fb6ef83b16 commands/resize: fix grow vars uninitialized 2018-11-17 03:23:06 -08:00
Ryan Dwyer cb63321de6
Merge pull request #3132 from emersion/dispatch-cursor-btn-segfault
Fix segfault in dispatch_cursor_button
2018-11-17 20:24:01 +10:00
Trevor Slocum f4ccc51da0 resize set: convert ppt to px for floating containers 2018-11-16 07:30:46 -08:00
emersion 4ce18d2744
Fix segfault in dispatch_cursor_button 2018-11-15 16:35:19 +01:00
Ryan Dwyer 4e8bf5b328 Fix double free of mode
config->current_mode is a pointer into the config->modes list, and each
mode has already been freed.

Same with bars.
2018-11-15 23:48:11 +10:00
Ryan Dwyer 2115ebe39d Fix double free when unmapping any view 2018-11-15 15:22:09 +10:00
Drew DeVault 932d6ee0d4
Merge pull request #3126 from emersion/swap-unused-function
Fix unused function in swap command
2018-11-14 21:43:40 -05:00
Drew DeVault 484bf591be
Merge pull request #3121 from c-edw/feature/MissingFrees
[WIP] Free unfreed resources.
2018-11-14 21:25:26 -05:00
emersion 98a953a872
Fix unused function in swap command
Also fixes a size_t cast to void *.
2018-11-14 19:31:43 +01:00
Drew DeVault 47cca240e2
Merge pull request #3102 from emersion/render-software-cursors
Render software cursors with wlr_output_render_software_cursors
2018-11-13 14:59:48 -05:00
Connor E eda1bf769f More frees. 2018-11-13 14:42:00 +00:00
Connor E b5d95f264d Add some missing frees. 2018-11-13 13:45:01 +00:00
emersion 2afd930914
Use #if instead of #ifdef for WLR_HAS_* 2018-11-12 22:23:06 +01:00
emersion 3b8d4a9212
Merge pull request #3116 from harishkrupo/master
IPC: Send keyboard layout info in IPC_GET_INPUTS
2018-11-12 21:26:00 +01:00
Harish Krupo d8ad429e39 IPC: Send keyboard layout info in IPC_GET_INPUTS
Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
2018-11-12 22:00:22 +05:30
Drew DeVault 2e43f02427
Merge pull request #2979 from RedSoxFan/config-var-repl
Alter config variable replacement process
2018-11-12 11:13:59 -05:00
Brian Ashworth 62d69e9f14 cmd_ws_auto_back_and_forth: fix negation
In the conversion to `parse_boolean` for `cmd_ws_auto_back_and_forth`,
the `negation` was never removed causing the setting to be the opposite
of what it should be.
2018-11-11 16:05:13 -05:00
Brian Ashworth 12876932a9 Allow multiple outputs for workspace output
`i3 4.16` allows users to list multiple outputs for a workspace and the
first available will be used. The syntax is as follows:
`workspace <workspace> output <outputs...>`

Additionally when the workspace is created, the outputs get added to the
output priority list in the order specified. This ensures that if a higher
output gets connected, the workspace will move to the higher output. This
works the same way as if the user had a workspace on an output, disconnected
the output, and then later reconnected the output.
2018-11-11 11:22:38 -05:00
Brian Ashworth b277000601 Alter config variable replacement process
Currently, variables cannot contain commands and cannot span more than
one argument. This is due to variable replacement happening after
determining the handler and after splitting the config line into
arguments.

This changes the process to:
0. Check for empty lines and block boundaries
1. Split the arguments as before
2. Verify that the first argument is not a variable. If needed the
following occurs
    a. Perform variable replacement on just the first argument
    b. Join the arguments back together then split the arguments again. This is needed when the variable
contains the command and arguments for the command.
3. Determine the handler
4. If the handler is cmd_set, escape the variable name so that it does
not get replaced
5. Join the arguments back together, do variable replacement on the full
command, and split the arguments again
6. Perform any needed quote stripping or unescaping on arguments
7. Run the command handler

This allows for config snippets such as:

```
set $super bindsym Mod4
$super+a exec some-command
```

and

```
set $bg bg #ffffff solid_color
output * $bg
```
2018-11-10 21:53:10 -05:00
emersion 528f129c98
Render software cursors with wlr_output_render_software_cursors 2018-11-10 19:22:32 +01:00
Connor E b865dabeba Use parse_boolean where possible. 2018-11-10 12:55:06 +00:00
Drew DeVault 7fa7f4f48d
Merge pull request #3085 from 7415963987456321/master
Remove extra line.
2018-11-08 20:07:41 -05:00
7415963987456321 965abe077a Remove extra line 2018-11-09 00:57:09 +00:00
Connor E 78d07f5be4 Update documentation for focus_follows_mouse. 2018-11-08 20:38:50 +00:00
Brian Ashworth c248e96b84 resize set: implement width and height keywords
This implements the following syntaxes from `i3 4.16`:
* `resize set [width] <width> [px|ppt]`
* `resize set height <height> [px|ppt]`
* `resize set [width] <width> [px|ppt] [height] <height> [px|ppt]`

Additionally, a bug was fixed that caused setting the height of a tiled
container to change the width instead due to a typo.
2018-11-08 14:17:49 -05:00
sghctoma 7ead20bfcf Fix building with clang
The "struct sway_container *other" variable in swap.c was potentially
used uninitialized, depending on an "if" statement.
2018-11-08 13:57:04 +01:00
Ryan Dwyer aad2f444f0
Merge pull request #3087 from RedSoxFan/side-gaps
Implement per side and per direction outer gaps
2018-11-08 22:41:14 +10:00
Brian Ashworth 9e8aa39530 Implement per side and per direction outer gaps
This introduces the following command extensions from `i3-gaps`:
* `gaps horizontal|vertical|top|right|bottom|left <amount>`
* `gaps horizontal|vertical|top|right|bottom|left all|current
set|plus|minus <amount>`
* `workspace <ws> gaps horizontal|vertical|top|right|bottom|left
<amount>`

`inner` and `outer` are also still available as options for all three
of the above commands. `outer` now acts as a shorthand to set/alter
all sides.

Additionally, this fixes two bugs with the prevention of invalid gap
configurations for workspace configs:
1. If outer gaps were not set and inner gaps were, the outer gaps
would be snapped to the negation of the inner gaps due to `INT_MIN`
being less than the negation. This took precedence over the default
outer gaps.
2. Similarly, if inner gaps were not set and outer gaps were, inner
gaps would be set to zero, which would take precedence over the
default inner gaps.

Fixing both of the above items also requires checking the gaps again
when creating a workspace since the default outer gaps can be smaller
than the negation of the workspace specific inner gaps.
2018-11-07 22:44:11 -05:00
Brian Ashworth 6a42643784 gaps: remove duplicate inner gaps 2018-11-07 22:42:18 -05:00
Connor E 4a21981855 Add focus_follows_mouse always. (#3081)
* Add focus_follows_mouse_mode.

* Fail if focus_follows_mouse is invalid.

* Fix indentation.
2018-11-06 21:58:08 +01:00
Ryan Walklin 5032acb7a5 Add relative output transform
This commit enhances the output transform
command with options for a relative transform,
i.e. the provided transform will be applied as
an offset to the current transform. Append
`clockwise` to rotate clockwise from the current
rotation, or `anticlockwise` to rotate in the
opposite direction.

For example, if the output LVDS-1 is rotated
90 degrees clockwise, the command
`output LVDS-1 transform 90 clockwise`
will rotate the display to 180 degrees.
All transform options are supported,
including flipped transforms.

Relative transforms can only be applied to
a single output and cannot be used with
a wildcard (*) output specifier.
2018-11-05 22:58:27 +00:00
Drew DeVault 25bea8f6a5
Merge branch 'master' into effective-damage 2018-11-05 21:21:47 +01:00
Rouven Czerwinski f54287eaf3 config: mention that reload message is also printed on validation 2018-11-05 21:06:28 +01:00
Rouven Czerwinski 5fdffea99a commands/exec_always: defer command on config validation
The exec_always command was executed twice, since it was not checking for the
config->validating variable.
Fix this by defering the command if the configuration is validating.

Fixes #3072
2018-11-05 20:32:45 +01:00
Brian Ashworth c8c1ecaf25 Fix focus_wrapping yes
It appears that the focus code that handles `focus_wrapping yes` was
removed during the conversion to type safety. This re-implements the
focus code for when `focus_wrapping` is set to `yes` (default). Neither
the `no` or `force` options appear to be effected and should be working.
2018-11-05 12:39:44 -05:00
emersion d0bb450681
Merge pull request #3066 from mwenzkowski/fix-gaps
Improvements to the runtime only part of the gaps command
2018-11-05 15:33:40 +01:00
emersion 0e85b92250
Use wlr_surface_get_effective_damage 2018-11-04 23:21:37 +01:00
mwenzkowski 67866dc378 gaps: Improve error reporting
Always raise an error if the runtime only gaps command is found in the
config file.
2018-11-04 20:40:14 +01:00
mwenzkowski 60df5cc9f8 Correct manpage regarding gaps command
The command 'gaps inner|outer all|current set|plus|minus <amount>'
is not valid in the configuration file, hence list it accordingly.
2018-11-04 20:10:41 +01:00
madblobfish 7d8ed7a3a7 added space after table in sway.5 manpage 2018-11-04 17:38:35 +01:00
madblobfish 417a10f477 removed unneeded code fragment 2018-11-04 17:38:13 +01:00
Cole Mickens ef888321ba ipc: move refresh from output to output->current_mode 2018-11-03 15:09:34 -07:00
Cole Mickens 71686ed0e7 fix: restore refresh to the modes_array 2018-11-03 15:09:34 -07:00
Drew DeVault c18cd9dd03
Merge pull request #3021 from Snaipe/singlekey-binding-trigger
binding: match single-key bindings if no multi-key binding matched
2018-11-03 17:57:59 +01:00
Cole Mickens d05aeb77a0 sway-ipc: includes current_mode for each output 2018-11-03 04:30:49 -07:00
emersion f90ff1210b
Teardown compositor when failing to drop permissions 2018-11-01 18:50:06 +01:00
emersion 9dae68eba5
Make it clear that being able to restore root is a failure 2018-11-01 18:49:42 +01:00
mwenzkowski cd0bae80b6 Fix #2992
Move a function call, such that data it depends on is initialized before.
2018-11-01 08:15:03 -04:00
Ryan Dwyer 9fc736f4e1 Move view marks properties to container struct
Like border properties, this will be needed to implement layout saving
and restoring.
2018-11-01 18:09:51 +10:00
Drew DeVault 480b03b734
Merge pull request #3040 from RyanDwyer/border-props-to-container
Move view border properties to container struct
2018-11-01 01:03:41 +01:00
Ryan Dwyer bf19f63a79 Wrap to fartherest output when running focus output
Also moves the `opposite_direction` function into `util.c` as it's used
in two places now.
2018-11-01 08:29:45 +10:00
Ryan Dwyer 528c7495bb Move view border properties to container struct
This will be needed to implement layout saving and restoring, as we need
to be able to configure borders on a placeholder container which has no
view.
2018-10-31 23:56:20 +10:00
Drew DeVault e21a23348b
Merge pull request #3031 from atomnuker/master
Restore previous tabbed layout behavior
2018-10-31 14:51:04 +01:00
Ryan Dwyer 7be309710d Remove enum movement_direction
There's no point having both movement_direction and wlr_direction. This
replaces the former with the latter.

As movement_direction also contained MOVE_PARENT and MOVE_CHILD items,
these are now checked specifically in the focus command and handled in
separate functions, just like the other focus variants.
2018-10-30 23:27:49 +10:00
Rostislav Pehlivanov b0fb2846fe Revert "Respect border settings when rendering lone tabbed/stacked child"
This reverts commit 65328ef60c.
2018-10-30 11:42:44 +00:00
Rostislav Pehlivanov a67e1b5873 Revert "tree/view.c: fix uninitialized variables warning"
This reverts commit 6414b5d288.
2018-10-30 11:42:37 +00:00
Franklin "Snaipe" Mathieu f8e83ee20a binding: match single-key bindings if no multi-key binding matched
This makes bindings more snappy when the user is typing faster than
his keycaps are releasing.

Signed-off-by: Franklin "Snaipe" Mathieu <me@snai.pe>
2018-10-29 13:04:19 +00:00
mwenzkowski 66ae58d62a cursor: fix uninitialized pointer in cursor_rebase 2018-10-28 17:33:27 +01:00