Commit graph

3269 commits

Author SHA1 Message Date
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
Drew DeVault 09f3f7b75f
Merge pull request #3011 from Emantor/fix/2922
output: initialize layers before usage in apply_config
2018-10-28 12:42:27 +01:00
Drew DeVault aa21d1b867
Merge pull request #3010 from Emantor/fix/cursor_warping_view_map
input-manager: consider cursor warping on input_manager_set_focus
2018-10-28 12:40:26 +01:00
Rouven Czerwinski e4df675840 output: initialize layers and signal before using functions
The previous pull request #2993 tried to fix this by moving the function which
used the layers after the initilization.
Since this initialization is done unconditionally only depending on the struct
definition, move the layer initialization to the beginning of the function.
Also move the signal initialization of the destroy event.

Fixes #2992
2018-10-28 11:06:15 +01:00
Rouven Czerwinski 6f87d0c2cf input-manager: consider cursor warping on input_manager_set_focus
input_manager_set_focus is used to set the focus after mapping the view in
view_map. This needs to consider to warp the cursor as well, since for
WARP_CONTAINER, the cursor should warp to the newly created view.
2018-10-28 10:29:10 +01:00
Drew DeVault 2ccf511cba
Merge pull request #3006 from Snaipe/remove-class
ipc: make json for view match i3's output more closely
2018-10-28 02:20:10 +02:00
emersion e3a0e3322b
Merge pull request #3000 from Robinhuett/workspace_address_output_by_name
Use output identifier for workspace config
2018-10-27 21:26:19 +02:00
Konstantin Kharlamov cd3c2f4553 seat: don't traverse the list to check if it's empty
Found by introspection.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2018-10-27 21:10:10 +03:00
Franklin "Snaipe" Mathieu 03ca8596d6 ipc: make class, instance, and title window properties optional
i3 seems to make all window properties, with the exception of
transient_for, optional[1].

[1]: 315ff17563/src/ipc.c (L435-L450)

Signed-off-by: Franklin "Snaipe" Mathieu <snaipe@diacritic.io>
2018-10-27 18:41:26 +01:00
Franklin "Snaipe" Mathieu 259fe1e76f ipc: remove class key from view json
It turns out that i3 does not have a `class` key in the json description
of a view, but provides it through `window_properties.class`. Since
`window_properties` has been added by 8fc9328, we can remove `class`
altogether.

Signed-off-by: Franklin "Snaipe" Mathieu <snaipe@diacritic.io>
2018-10-27 18:39:17 +01:00
Robinhuett 0a4cf4748d Use output identifier for workspace config 2018-10-27 15:56:06 +02:00
Drew DeVault 5a98dfee02 Revert "Fix #2992"
This reverts commit 94985146ea.
2018-10-27 08:55:45 -04:00
Ryan Dwyer d0dca7f35e Don't reset cursor during mouse operations 2018-10-27 19:12:55 +10:00
Cole Mickens 6414b5d288 tree/view.c: fix uninitialized variables warning 2018-10-26 22:25:11 -07:00
Ryan Dwyer 65328ef60c Respect border settings when rendering lone tabbed/stacked child
In i3, when a child of a tabbed or stacked container has no siblings,
its border settings are respected.

This patch achieves the same effect by rendering a lone tabbed/stacked
child as if it's a linear container. This makes the border settings be
respected.

Over in view_autoconfigure, we compensate for this by only adjusting
`y_offset` if there's multiple children.
2018-10-27 11:23:02 +10:00
mwenzkowski 94985146ea Fix #2992
Move a function call, such that data it depends on is initialized before.
2018-10-26 23:31:57 +02:00
Ryan Dwyer 63d076dc2a Fix focus after a non-visible workspace's last container is destroyed
The code being changed is responsible for updating the focus stack when
a container is destroyed in a different part of the tree to where the
real focus is. It's attempting to set focus_inactive to a sibling (or
parent if no siblings) of the container that is being destroyed, then
put our real focus back on the end of the focus stack.

The problem occurs when the container being destroyed is in a different
workspace. For example:

* Have a focused view on workspace 1
* Have workspace 2 not visible with a single view that is unmapping
* The first call to seat_set_raw_focus sets focus to workspace 2 because
it's the parent
* Prior to this patch, the second call to seat_set_raw_focus would set
focus to the view on workspace 1
* Later, when using output_get_active_workspace, this function would
return workspace 2 because it's the first workspace it finds in the
focus stack.

To fix this, workspace 1 must be placed on the focus stack between
workspace 2 and the focused view. That's what this patch does.

Lastly, it also uses seat_get_focus_inactive to choose the focus. This
fixes a crash when a view unmaps while a non-container is focused (eg.
swaylock), because focus is NULL.
2018-10-26 19:15:12 +10:00
Drew DeVault b29beb1aa0
Merge pull request #2985 from mihaicmn/fix-retiling
Fix re-tiling for floating containers
2018-10-26 03:20:17 +02:00
Mihai Coman 5323551a7f Fix re-tiling for floating containers
When a floating container is tiled (e.g.: 'floating toggle' or
'floating disable'), it should be placed after/below the inactive
focused container from the tiling layout.
2018-10-25 23:20:38 +03:00
Ferdinand Bachmann 6409a109f6 sway-ipc: don't log errno if unneeded and add more descriptive errors 2018-10-25 22:17:03 +02:00
Tom Warnke 1670eafd7b protect newline 2018-10-25 21:48:39 +02:00
ppascher 2123dfa15f
Update workspace.c
re-added missing output check after config load
2018-10-25 19:48:45 +02:00
ppascher db61d581a3
Update workspace.c
Remove output requirement for workspace command
2018-10-25 19:24:01 +02:00
Drew DeVault 51ad2676d0
Merge pull request #2975 from RyanDwyer/deny-commands-when-no-outputs
Deny several commands when there's no outputs connected
2018-10-25 17:10:36 +02:00
Ryan Dwyer 885963f11f Deny several commands when there's no outputs connected 2018-10-26 00:03:44 +10:00
Ryan Dwyer 60a1d79de7 Rebase the cursor after applying transactions
This approaches cursor rebasing from a different angle. Rather than
littering the codebase with cursor_rebase calls and using transaction
callbacks, this just runs cursor_rebase after applying every transaction
- but only if there's outputs connected, because otherwise it causes a
crash during shutdown.

There is one known case where we still need to call cursor_rebase
directly, and that's when running `seat seat0 cursor move ...`. This
command doesn't set anything as dirty so no transaction occurs.
2018-10-25 23:37:40 +10:00
Drew DeVault ea2497d35c
Merge pull request #2950 from emersion/presentation-time
Implement the presentation-time protocol
2018-10-25 15:31:47 +02:00
emersion b1c49038a6
Merge pull request #2971 from RyanDwyer/document-output-identifiers
Document how to identify outputs by make, model and serial
2018-10-25 10:27:08 +02:00
Ryan Dwyer ea097631af Document how to identify outputs by make, model and serial 2018-10-25 18:08:29 +10:00
Ryan Dwyer f7aed5c7e5 Fix containers not being resized when entering scratchpad
This fixes a regression introduced by
662466e8db. When adding a container to the
scratchpad, setting container->scratchpad = true before
container_set_floating made container_set_floating believe that the
container was already floating. This fixes it by setting the property
afterwards instead.
2018-10-25 17:32:16 +10:00