Commit graph

3693 commits

Author SHA1 Message Date
Rouven Czerwinski df1a046875 xwayland: get_constraints using size hints
Previously, Xwayland windows did not have size_constraints implemented,
resulting in the window being resizable. This implements the constraints
through the X11 size hints supplied by the window itself.
2019-11-16 10:18:26 +01:00
Ronan Pigott 37afbc4dbc seatop_default: handle focus for unmanaged xwayland windows last
Fixes #4707
2019-11-08 19:06:00 -05:00
Simon Ser f576bcdb8c Use wlr_output_preferred_mode instead of the last mode
Instead of relying on the order of modes, use wlr_output_preferred_mode
to get the preferred mode.
2019-11-05 14:00:23 -05:00
Simon Ser 01b5350bdc Fix segfault in set_mode
best is NULL prior to being assigned to a mode.

Closes: https://github.com/swaywm/sway/issues/4705
Fixes: f33dcd4c60 ("Prefer higher refresh rate default modes")
2019-11-05 13:35:56 -05:00
Ronan Pigott f33dcd4c60 Prefer higher refresh rate default modes 2019-11-05 10:34:44 +01:00
Ronan Pigott 3975ca28c2 smart_borders: separate smartness from edge types 2019-11-04 21:16:27 -05:00
Simon Ser 38b37247ff Add --custom to output mode command
This forces to set the mode as a custom mode.
2019-11-04 19:40:47 -05:00
Ronan Pigott eaee087c17 seatop_default: handle focus for xwayland_unmanaged views 2019-11-04 23:56:27 +01:00
Ronan Pigott d159b98744 seatop_move_floating: make container respect pointer constraint 2019-11-04 23:53:30 +01:00
Ronan Pigott 1f469e1692 focus: do nothing on focus prev|next for workspaces 2019-11-04 23:48:39 +01:00
Sheena Artrip 7efb5d4673 Rename symbol set_cloexec to sway_set_cloexec, remove duplicates.
set_cloexec is defined by both sway and wlroots (and who-knows-else),
so rename the sway one for supporting static linkage. We also remove
the duplicate version of this in client/.

Fixes: https://github.com/swaywm/sway/issues/4677
2019-11-01 12:41:08 -04:00
lbonn cf95de9cae focus: add a NULL check in focus <direction>
container is checked for NULL in other conditions earlier, it's not
obvious that it can't be undefined here.
2019-11-01 12:18:09 -04:00
lbonn 30fa7d191e Fix potential NULL reference on cleanup
If allocation of bindings failed.

Found with clang-tidy
2019-11-01 12:18:09 -04:00
lbonn a6307aed00 Fix various memory leaks
Found with clang-tidy
2019-11-01 12:18:09 -04:00
lbonn 32caabc7a1 seat: simplify a strdup 2019-11-01 12:18:09 -04:00
Robert Günzler 354e705a7b Skip line continuation when it is a comment
Currently commented lines ending in the backslash character will be
concatenated with the following line.

```
 # with this comment \
exec swaynag -m 'will not run'
```

This change modifies `getline_with_cont` to stop reading when the
initial character is a '#'.
2019-10-31 23:05:06 +01:00
Simon Ser 1a253ca7ab Fix presentation feedback when scanning out fullscreen view
Closes: https://github.com/swaywm/sway/issues/4663
2019-10-27 11:07:48 -04:00
Simon Ser ad07886543 Handle layer changes for layer shell surfaces
Closes: https://github.com/swaywm/sway/issues/4644
References: 1982106c9b
2019-10-27 11:07:18 -04:00
Ronan Pigott 7c9b71f5c6 criteria: make literal comparison for __focused__ values 2019-10-27 11:06:05 -04:00
Ronan Pigott f5f12a69f6 focus: support focus prev|next [sibling] 2019-10-27 11:02:57 -04:00
Simon Ser ec14a00e8c Fix segfault in wlr_output_manager_v1_set_configuration
Calling wlr_output_manager_v1_set_configuration with an enabled output
and a NULL mode is incorrect if the output doesn't support modes.

When DPMS'ing an output, wlr_output_enable(output, false) is called.
This de-allocates the CRTC and sets wlr_output.current_mode to NULL.

Because we mark DPMS'ed outputs as enabled, we also need to provide a
correct output mode. Add a field to sway_output to hold the current
mode.

Closes: https://github.com/swaywm/wlroots/issues/1867
2019-10-27 10:51:02 -04:00
Simon Ser 58a40ce07b Fix apply_output_config return value when enabling output
apply_output_config would call output_enable and always return true,
even if the output couldn't be enabled.
2019-10-27 10:51:02 -04:00
Kirill Chibisov 43bd8dc437 Fix tiled containers resize with mouse
Fixes regression introduced in 2c1a11016c
2019-10-23 17:21:09 +02:00
Danilo Spinella a5b6f40937 Fix refresh rate scale of output
When applying config, value mode->refresh is mHz; convert it to Hz before
assigning it to the temporary output config. oc->refresh_rate will
be converted back to mHz in set_mode function.

Fix debug log printing GHz instead of Hz.
2019-10-21 14:22:20 +02:00
lbonn 3ee3a9ef60 focus: support focus_wrapping workspace
Following i3 support: https://github.com/i3/i3/pull/3407
2019-10-17 13:48:52 +03:00
A. M. Joseph 74c0e7921a xwayland.c handle_map(): NULL out xsurface->data() to prevent crashing.
When changing a surface from managed to unmanaged in handle_map(), the
call to handle_destroy(.., view) causes the sway_xwayland_view pointed
to by the untyped wlr_xwayland_surface.data field to become invalid
garbage, yet the untyped wlr_xwayland_surface.data continues to point
at it.  In particular: view_get_*(view_from_wlr_surface(..)), even
with appropriate NULL checking, will crash sway when this codepath is
exercised (reliable test case: drop-down menus in Google Earth).
2019-10-17 11:40:16 +03:00
Drew DeVault d19f4f7bf8 Updates per wlroots layer shell changes 2019-10-16 10:24:15 -04:00
Rouven Czerwinski 344c259ec0 sway(5): move workspace_layout to config only
According to the source files, workspace_layout is a configuration only
command, move it to the correct section within the man page.
2019-10-16 14:21:45 +03:00
Wieland Hoffmann f79f00dbfb sway(5): Highlight valid values in the description of tiling_drag 2019-10-09 23:32:08 +03:00
Wieland Hoffmann 42db4468a0 sway(5): Add a missing verb 2019-10-09 23:32:08 +03:00
Arkadiusz Hiler cf18bd8879 Fix syntax in examples in sway-output(5)
Some examples use comma to separate x and y for setting the output
position which is wrong.

Let's change it to spaces, as correctly demonstrated in the
`output <name> position|pos <X> <Y>` section.
2019-10-02 17:37:54 -04:00
Sebastian Krzyszkowiak edcd353a00 layer-shell: Fix damage tracking of nested popups
Popups are positioned relative to local surface coordinates of the
parent surface. There's no need to consider values set with
xdg_surface.set_window_geometry for parent surfaces.
2019-09-29 19:50:58 +03:00
Simon Ser 00c4c7e8cc Fix direct scan-out flickering
Sometimes when using direct scan-out, some flickering between the
fullscreen app and the regular desktop could be seen.

This happened because we called wlr_output_attach_render and then
wlr_output_attach_buffer for direct scan-out. wlr_output_attach_render
makes the OpenGL context current but also attaches the OpenGL buffer to
the primary plane apparently (all of this happens inside
eglMakeCurrent).

This patch moves the scan-out logic outside of output_render, before
wlr_output_attach_render. This lines it up with rootston's
implementation. This also makes more sense since no rendering is
involved when using direct scan-out.

Sorry about that, I should've tested this with more clients. The new
code has been tested with mpv and a GLFW demo.
2019-09-26 10:36:18 -04:00
John Chadwick 7e420cb6e4 input: Add support for tablet protocol.
Sway has basic support for drawing tablets, but does not expose
properties such as pressure sensitivity. This implements the wlr tablet
v2 protocol, providing tablet events to Wayland clients.
2019-09-25 23:10:33 -04:00
Simon Ser 875edc9c2f Add support for fullscreen view direct scan-out 2019-09-25 23:00:08 -04:00
Ronan Pigott ec66bb987a view: create container before selecting workspace 2019-09-22 15:18:51 -04:00
Simon Ser c41c24d684 Error out on unknown debug flag
Otehrwise it's pretty easy to misremember a flag and think damage=rerender is
enabled when it's not.
2019-09-22 15:17:59 -04:00
Brian Ashworth da0ad4c39e view: always populate pid
If the view was mapped as fullscreen or the view was assigned either a
workspace or output, the pid was not being populated since it was
occurring as part of the pid mapping check in select_workspace. This
extracts the pid population and makes it so it is always executed
2019-09-20 20:47:59 +03:00
Ivan Molodetskikh fba248ed5e render: set surface as sampled for presentation 2019-09-19 19:47:24 +03:00
Martin Michlmayr c11c8a583f sway-output.5: fix variable name
__foo__ is verbatim in scdoc, but we want the variable foo in italic,
i.e. _foo_.
2019-09-11 15:34:11 +03:00
Brian Ashworth aa8ea2fa82 sway.5: clarify that a marks are unqiue
This just clarifies that a mark can only be set for a single window
since they are used as unique identifiers
2019-09-05 22:04:02 +03:00
Nils ANDRÉ-CHANG 21717d2ed2 Fix type (an -> and) 2019-09-05 22:02:33 +03:00
Versus Void 2c1a11016c Do not search for edges on subsurfaces, fix #4381
Subsurfaces (in most cases popups) aren't decorated by sway
and will never have any borders, but may be drawn beyond container
boundaries producing false positive when searching for edge.
So we want to skip edge search when handling mouse event on subsurface.
2019-09-05 17:41:23 +03:00
Brian Ashworth 1fd2c6ba49 swaybar: complete barconfig_update event handling
This adds complete support for the barconfig_update ipc event. This also
changes the bar command and subcommand handlers to correctly emit the
event. This makes it so all bar subcommands other than id and
swaybar_command are dynamically changeable at runtime. sway-bar.5 has
been updated accordingly
2019-09-04 16:48:50 -10:00
Brian Ashworth 187306640b seatop_default: only focus container on press
This matches i3's behavior of only focusing a container when pressed.
This allows for `bindsym button1 nop`, `bindsym BTN_LEFT nop`, or
`bindcode 272 nop` to be used to disable focusing when clicking on the
title (or with additional flags to bind{code,sym} other portions of
the container).

Without this additional condition, the user would need both
`bindsym button1 nop` and `bindsym --release button1 nop` to override
both the pressed and released behavior.
2019-09-04 16:48:34 -10:00
xPMo 42a7860dcf Fix bar_state_update docs 2019-09-03 22:22:25 -04:00
Ben Brown b46c53957f Fix typo for the force/immediate option in xwayland_mode enum 2019-09-02 17:06:38 +03:00
Simon Ser 1b396273bb man: document how to specify multiple xkb layouts and options
This isn't described in xkeyboard-config(7).
2019-09-02 08:39:25 +09:00
Simon Ser 53e01bf5c7 layer-shell: don't give focus to unmapped layer surfaces
Focused layers are not cleared when destroyed, they are cleared on unmap.
Giving focus to an unmapped layer surface is (1) incorrect and (2) triggers a
use-after-free.

Closes: https://github.com/swaywm/sway/issues/4517
2019-09-01 09:58:03 +09:00
Kenny Levinsen b2ee5bc05d Ensure that seat->focused_layer is cleared on unmap
The current seat may have changed between the last focus change and
this unmap, so we need to scan through all seats to find our layer.
2019-09-01 00:03:18 +03:00