Commit graph

6010 commits

Author SHA1 Message Date
Antonin Décimo 813e120979 Remove redundant checks 2019-08-12 09:42:11 +09:00
Antonin Décimo 3af52d86f7 Fix memory leaks 2019-08-12 09:42:11 +09:00
Antonin Décimo 0570eb19e5 view_update_size: fix surface_width/height mismatch 2019-08-12 09:42:11 +09:00
Antonin Décimo 9be76e6b12 input: check pointer against nullptr 2019-08-12 09:42:11 +09:00
Antonin Décimo 1d6d26cdec ipc-client: remove useless free for failed malloc 2019-08-12 09:42:11 +09:00
Sebastian Krzyszkowiak dac9c9c72b layer_shell: Guard against negative exclusive zone
This can happen with surfaces that set negative margins.
2019-08-12 09:33:30 +09:00
Drew DeVault 6200ecbc1d Remove rootston from build manifests 2019-08-09 09:59:44 +09:00
Rouven Czerwinski 724926ea6a Revert "Add support for wlr_output's atomic API"
This reverts commit 6e0565e9de.

This is required for the revert on swaywm/wlroots#1781
2019-08-07 16:25:37 +09:00
Brian Ashworth dc5d76cf3b sway.5: explain how to enable pango markup in font
This clarifies the syntax to use for the font command to enable pango
markup support.
2019-08-07 14:05:11 +09:00
Brian Ashworth 19d05d3ae0 config/output: rebase cursors after config applied
When applying an output config, an output may transform or be altered
in some way that effects the cursor. In order for the cursor images to
be updated properly, all cursors need to be rebased after applying
output configs.
2019-08-07 13:50:07 +09:00
Brian Ashworth f59b665792 cmd_mode: make modes case sensitive
This mirrors a change in i3 4.17 that makes binding modes case
sensitive
2019-08-06 11:32:26 +09:00
Brian Ashworth a8a239e2f1 swaymsg: return 2 for sway errors
This mirrors a change in i3 4.17 that returns 2 for errors from sway,
including invalid command, command failed, and invalid subscription
requests
2019-08-06 11:31:39 +09:00
Brian Ashworth 56b5ad777c input/cursor: do not hide when buttons are pressed
This just adds a small quality of life improvement to the cursor hiding
functionality. The cursor will no longer be hidden unless all buttons
are released.
2019-08-06 11:31:12 +09:00
Brian Ashworth a9e31d925f cmd_swap: add floating support
For feature parity with i3 4.17, this just adds floating container
support to the swap command
2019-08-06 11:30:17 +09:00
Jeff Peeler 140ce785fe cmd_opacity: add relative opacity changes
This enhances the opacity command to support relative assignment as well
as the currently implemented absolute assignment. The syntax is copied
from the same format that gaps uses for relative and absolute setting.
An example usage in a sway config looks like:

// relative change (this feature)
bindsym button4 opacity plus .1
bindsym button5 opacity minus .1

// absolute change (this feature)
bindsym button4 opacity set 1
bindsym button5 opacity set .3

// old way, still supported
bindsym button4 opacity 1
bindsym button5 opacity .3
2019-08-05 22:10:36 -04:00
Brian Ashworth 90d8a4df32 input/libinput: typo fixes (get -> get_default)
This just fixes some typos in the reset functions that were using
the get calls instead of get_default
2019-08-03 15:46:05 +02:00
Antonin Décimo c1a5f61622 Remove unused variable 2019-08-02 20:55:49 +03:00
Antonin Décimo 7e5c2d7afa Allocator sizeof operand mismatch
Result of 'calloc' is converted to a pointer of type 'char *', which
is incompatible with sizeof operand type 'char **'
2019-08-02 20:55:49 +03:00
Simon Ser 6e0565e9de Add support for wlr_output's atomic API
See https://github.com/swaywm/wlroots/pull/1762
2019-08-02 10:01:50 -04:00
Brian Ashworth 8ee054b1b9 bindsym/code: add group support
This adds support for specifying a binding for a specific group. Any
binding without a group listed will be available in all groups. The
priority for matching bindings is as follows: input device, group, and
locked state.

For full compatibility with i3, this also adds Mode_switch as an alias
for Group2. Since i3 only supports this for backwards compatibility
with older versions of i3, it is implemented here, but not documented.
2019-08-01 18:54:58 +03:00
Brian Ashworth 14562fdbee input/keyboard: don't reset layout for same keymap
In sway_keyboard_config, do not change the keymap when the new keymap
is unchanged, unless this is during a config reload. The reasoning for
this is to prevent the effective layout from being reset to index 0 for
input config changes unrelated to the keymap.
2019-08-01 18:27:01 +03:00
Paul Ouellette f567a40d59 Fix typo in sway(5) manpage 2019-07-31 21:45:52 -04:00
Brian Ashworth 75de31d36e libinput: fix set_send_events
This just fixes the check in set_send_events for whether the mode has
changed. LIBINPUT_CONFIG_SEND_EVENTS_ENABLED is 0 so the bitmask check
cannot be fixed, but Sway doesn't allow multiple modes to be set anyway
(not really sure why you would need to) so a basic equality check works
2019-07-31 22:32:13 +03:00
Brian Ashworth fc955716d4 input/libinput: fix typo in set_middle_emulation
This fixes a typo in set_middle_emulation where it would set left
handed instead of middle emulation.
2019-07-28 09:19:59 -04:00
Pedro Côrte-Real cefc608cb9 Fix resize sibling amount calculations
Sibling amounts were being calculated after the original fraction had
been altered. This led to broken resize amounts. Fix that by calculating
things upfront before adjusting values which also makes the code
cleaner.

For sanity checks also calculate the sibling amount with the
ceiling so we never go below the sanity check even by one pixel.

Fixes #4386
2019-07-27 23:36:16 -04:00
Simon Ser f984f21b6a Remove all wayland-server.h includes
The documentation for wayland-server.h says:

> Use of this header file is discouraged. Prefer including
> wayland-server-core.h instead, which does not include the server protocol
> header and as such only defines the library PI, excluding the deprecated API
> below.

Replacing wayland-server.h with wayland-server-core.h allows us to drop the
WL_HIDE_DEPRECATED declaration.

This commit si similar to wlroots' ca45f4490ccc ("Remove all wayland-server.h
includes").
2019-07-27 17:16:56 -04:00
Ashkan Kiani e4bba906b6 Avoid adding duplicate criteria for no_focus and command 2019-07-27 03:53:05 +03:00
Brian Ashworth 17c9a0e84f arrange: remove gaps for workspace location deltas
When arranging the workspace, prev_x and prev_y should be ignoring the
current gaps otherwise the workspace diff_x and diff_y location deltas
will be off. When the deltas are off, each arrangement of the workspace
would incorrectly move floaters an extra -workspace->current_gaps.left
along the x-axis and an extra -workspace->current_gaps.top along the
y-axis.
2019-07-26 18:13:27 +03:00
Brian Ashworth 1a16262903 ipc: add input::libinput_config event
This adds a libinput_config change type to the input event for when
the libinput config for a device changes

In order for this to be possible to track, the libinput config code
had to be refactored. It is now extracted into a separate file to
isolate it from the rest of the input management code.
2019-07-23 20:45:46 +03:00
Brian Ashworth 6effca7b61 ipc: add an input event
This adds an ipc event related to input devices. Currently the
following changes are supported:
- added: when an input device becomes available
- removed: when an input device is no longer available
- xkb_keymap_changed: (keyboards only) the keymap changed
- xkb_layout_changed: (keyboards only) the effective layout changed
2019-07-23 20:45:46 +03:00
Brian Ashworth 36aa67e549 input_cmd_xkb_switch_layout: support input types
This just adds input type config support to input_cmd_xkb_switch_layout
so that `input type:keyboard xkb_switch_layout <idx>` will work
2019-07-18 08:20:54 +03:00
Brian Ashworth 92b22ee9ea cmd_output: support current output alias
Similar to seat command, this provides an alias for the current output.
Instead of the output name or identifier, `-` can be used to operate on
the focused output by name and `--` can be used to operate on the
focused output by its identifier. This will prevent operating on the
no-op output when using either alias.
2019-07-17 21:25:09 -04:00
Ed Younis 37308f6549 input_cmd_xkb_*: cleanup includes 2019-07-17 19:26:58 -04:00
Ed Younis eb770e88b7 Implement input_cmd_xkb_file (#3999)
Adds a new commend "xkb_file", which constructs the internal
xkb_keymap from a xkb file rather than an RMLVO configuration.
This allows greater flexibility when specifying xkb configurations.
An xkb file can be dumped with the xkbcomp program.
2019-07-17 19:26:58 -04:00
rpigott 3716c53d35 Add missing description for focus_on_window_activation command in docs. 2019-07-17 18:31:02 -04:00
jasperro 1e66fa0d23 Added Dutch translation of README 2019-07-17 12:36:52 -04:00
Josef Gajdusek ac87df23ea Update output manager on layout change
The output manager config was not properly updated if the position
of the output got changed.
2019-07-17 19:36:15 +03:00
Sauyon Lee 9af0b4d2ea Make fullscreen check for fullscreen parents
This ensures that a child of a fullscreen container cannot
be fullscreened.
2019-07-17 09:25:36 -04:00
Pedro Côrte-Real 95c444de33 Sanity check gaps on the outside of the workspace
Avoid gaps that are too large around the workspace that you end up
without any usable space for children.

Fixes #4308
2019-07-15 23:46:27 -04:00
Pedro Côrte-Real 99192a92f9 Avoid negative outer gaps
Make sure we never let the gaps around the workspace go negative.

Fixes #4304
2019-07-15 23:46:27 -04:00
Pedro Côrte-Real 44c2fafa4f Sanity check gaps between tiled containers
When the gaps become too large for the space available gracefully
reduced them all the way to 0 if needed.

Fixes #4294
2019-07-15 23:46:27 -04:00
Pedro Côrte-Real d0233af3b3 Rework gaps code to be simpler and correct
Instead of tracking gaps per child apply gaps in two logical places:

1. In tiled containers use the layout code to add the gaps between
windows. This is much simpler and guarantees that the sizing of children
is correct.
2. In the workspace itself apply all the gaps around the edge. Here
we're in the correct position to size inner and outer gaps correctly and
decide on smart gaps in a single location.

Fixes #4296
2019-07-15 23:46:27 -04:00
Manuel Stoeckl 2dc4978d8a Use -fmacro-prefix-map to strip build path
Because meson does not provide a simple way to get the relative build
path, it is computed with a pair of foreach loops. As meson does not
have a simple way to compute string length (except via underscorify
and 63 split operations), the build script uses a shell command
instead.

If the compiler does not suppot -fmacro-prefix-map, then fall back
to passing in the relative path prefix, and use its length to offset
the uses of __FILE__ in log messages so that the build path is at
least still not included in the logs. This is significantly more
efficient than calling _sway_strip_path.
2019-07-15 16:35:50 -04:00
Pedro Côrte-Real e3a3917d3a Layout tiled using a width/height fraction
Instead of using container->width/height as both the input and output
of the layout calculation have container->width_fraction/height_fraction
as the share of the parent this container occupies and calculate the
layout based on that. That way the container arrangement can always be
recalculated even if width/height have been altered by things like
fullscreen.

To do this several parts are reworked:

- The vertical and horizontal arrangement code is ajusted to work with
  fractions instead of directly with width/height
- The resize code is then changed to manipulate the fractions when
  working on tiled containers.
- Finally the places that manipulated width/height are adjusted to
  match. The adjusted parts are container split, swap, and the input
  seat code.

It's possible that some parts of the code are now adjusting width and
height only for those to be immediately recalculated. That's harmless
and since non-tiled containers are still sized with width/height
directly it may avoid breaking other corner cases.

Fixes #3547
Fixes #4297
2019-07-14 11:13:55 -04:00
Pedro Côrte-Real 1312b5bb9f Layout correctly with several new windows
If there is more than one new window layout correctly by calculating the
default size of the new windows using the information of how many of
them there are in total.

This helps with issue #3547 but doesn't fix it in all situations. Things
now work correctly if the first layout of new windows happens after
leaving fullscreen. But if for some reason an arrange_container() gets
called while we are fullscreen the windows will still be incorrectly
sized after saved_width/saved_height get used to restore the first
window's size before going fullscreen.
2019-07-14 11:13:55 -04:00
Brian Ashworth c312a10cc7 cmd_split: fix toggle split for non-split layouts
Previously, `layout toggle` and `layout toggle split` would set L_VERT
when layout was L_HORIZ, otherwise it would set L_HORIZ. This meant
that when the layout was L_TABBED or L_STACKED, it would always be
L_HORIZ. This extends #4315 (which corrects the handling when multiple
layouts are given) to try prev_split_layout,
config->default_orientation, and then falling back to L_VERT when the
output is taller than wide and L_HORIZ when wider than tall.
2019-07-11 10:46:56 -04:00
Brian Ashworth 5ffcea4c28 cmd_layout: toggle split for tabbed/stack default
This fixes the logic of split for layout toggle when the default
layout is L_TABBED or L_STACKED. When the default layout is L_TABBED
or L_STACKED, the container/workspace may not have a prev_split_layout.
This was causing L_NONE to be returned by get_layout_toggle, which was
being handled as a syntax error. This adds logic to try
config->default_orientation when prev_split_layout is L_NONE. If that
is also L_NONE, then L_VERT is used when the output is taller than
wide, otherwise, L_HORIZ is used.
2019-07-10 15:29:38 -04:00
Brian Ashworth 6096d31eed config/output: correctly set width/height in apply
In apply_output_config, this sets output->{width,height} using the
values in the output box. Previously, they were being set using
wlr_output_transformed_resolution, which takes the width and height
from the wlr_output and just checks whether they should be swapped
based on the transform. This did not take into account the output's
scale. wlr_output_effective_resolution could be used instead, which
handles both transform and scale. However, the values in the output box
have already been processed by wlr_output_effective_resolution so they
can just be used directly
2019-07-10 14:03:15 -04:00
Brian Ashworth 32265d9136 input/libinput: only reset supported options
This adds checks to the input_manager_libinput_reset_* functions to
only attempt resetting supported options on reload. This should have no
functional difference to the user, but will remove several `Failed to
apply libinput config: Unsupported configuration option` lines from the
log that can be noisy and potential red herrings.
2019-07-09 11:50:02 -04:00
Brian Ashworth 152e30c374 cmd_bindswitch: add option to execute on reload
This adds a --reload flag to cmd_bindswitch that allows for the binding
to be executed on reload. One possible use case for this is to  allow
users to disable outputs when the lid closes and enable them when the
lid opens without having to open and re-close the lid after a reload.
2019-07-09 10:00:57 +03:00