Commit graph

790 commits

Author SHA1 Message Date
random human
8589ae19de Fix bugs listed by clang's static analyzer
A few pedantic changes and unused variables (1-4), and genuine bugs (5,
6).

The reports with the corresponding files and lines numbers are as
follows.

1. backend/libinput/tablet_pad.c@31,44,57
"Allocator sizeof operand mismatch"
"Result of 'calloc' is converted to a pointer of type 'unsigned int',
which is incompatible with sizeof operand type 'int'"

2. types/tablet_v2/wlr_tablet_v2_pad.c@371
"Allocator sizeof operand mismatch"
"Result of 'calloc' is converted to a pointer of type 'uint32_t', which
is incompatible with sizeof operand type 'int'"

3. types/wlr_cursor.c@335
"Dead initialization"
"Value stored to 'dx'/'dy' during its initialization is never read"

4. rootston/xdg_shell.c@510
"Dead initialization"
"Value stored to 'desktop' during its initialization is never read"

5. types/tablet_v2/wlr_tablet_v2_pad.c@475
"Dereference of null pointer"
"Access to field 'strips' results in a dereference of a null pointer
(loaded from field 'current_client')"

The boolean logic was incorrect (c.f. the check in the following
function).

6. examples/idle.c@163,174,182
"Uninitialized argument value"
"1st function call argument is an uninitialized value"

If close_timeout != 0, but simulate_activity_timeout >= close_timeout,
the program would segfault at pthread_cancel(t1).
2018-08-31 19:41:18 +02:00
Brian Ashworth
939a4ea60f
Merge pull request #1196 from dcz-purism/surface_move
rootston/surface_layers: fix clicking after surface moved
2018-08-28 22:15:50 -04:00
Scott Anderson
fd3fa760d3 Revert "Revert "Merge pull request #1194 from ascent12/meson_feature""
This reverts commit 9c886f20b9.
2018-08-24 19:35:02 +12:00
Drew DeVault
9c886f20b9 Revert "Merge pull request #1194 from ascent12/meson_feature"
This breaks wlroots when used as a meson subproject.

This reverts commit dea311992e, reversing
changes made to 6db9c4b746.
2018-08-23 21:00:58 -04:00
Dorota Czaplejewicz
f4ae9824f7 rootston/layer_shell: fix clicking after surface moved/resized
Layer surfaces are not notified of cursor position changes if the surface moves, only if the cursor moves. This workaround emits a cursor position event every time a cursor ends up over a newly resized layer surface to make sure the following clicks land in the right place.

This change doesn't address sending leave events when a cursor previously present over the surface becomes away.

There are 2 separate mechanisms in play, because a layer surface gets resized in 2 steps:

1. Layer surface resize & rearrange.
2. Underlying surface resize.

The first step may affect all layer surfaces. The cursor events are sent to cursors placed over all layer surfaces which have moved (not been resized). The second step affects any layer surface whose surface changed size. The cursor event is sent only to that surface.

Together, these events cover all surfaces: those which moves, and those which changed size, as long as each layer surface resize is accompanied by an immediate surface resize.
2018-08-23 11:29:03 +02:00
Scott Anderson
560e96aa57 Update rootston to use new option 2018-08-22 20:41:25 +12:00
Scott Anderson
784c20c82f Use new options for X11 backend and Xwayland 2018-08-22 20:27:37 +12:00
emersion
24212df830 rootston: fix again FreeBSD build
Had an outdated copy of wlroots, so missed that one.
2018-08-16 11:22:42 +01:00
emersion
d66d33f5a2
Merge pull request #1188 from emersion/freebsd-fixes
Fix build on FreeBSD
2018-08-16 11:02:21 +01:00
emersion
f86f1daf9a Fix build on FreeBSD 2018-08-16 10:54:45 +01:00
Ilia Bozhinov
4486b52aa8 move wlr_drm_connector_add_mode to wlr/backend/drm.h 2018-08-13 10:55:42 +03:00
Genki Sky
11d440972d rootston: Double fork for keyboard bindings
This avoids leaving around zombies, without having to setup SIGCHLD
handler (which interferes with other fork/waitpid calls).
2018-08-10 10:59:50 -04:00
emersion
9d0e37f768 rootston: add keybinding to toggle decoration mode 2018-08-06 08:35:14 +01:00
Markus Ongyerth
f64962ace8 tablet-v2 tool: Implement implicit grab
Implement the tablet-v2 tablet tool's implicit grab semantics for
buttons and tip.

This avoids losing focus (to other [sub]surfaces) when a button is held,
or the tip is down.
This should help when the device is used close to a surface's border and
would otherwise have to be very precise.
2018-08-06 08:45:41 +02:00
emersion
a5cab82a0f rootston: fire up wlr-gamma-control-unstable-v1 2018-08-02 23:33:59 +01:00
Drew DeVault
5642c5cc8f
Merge pull request #1053 from emersion/xdg-decoration
Add xdg-decoration-unstable-v1 support
2018-08-02 09:33:10 -04:00
Brian Ashworth
a3c33e93b8
Merge pull request #1167 from ammen99/master
rootston: focus newly-created surfaces
2018-07-29 22:03:53 -04:00
Ilia Bozhinov
2e6eb097b6 rootston: focus newly-created surfaces
Whenever a new surface is created, we have to update the cursor focus,
even if there's no input event. So, we generate one motion event, and
reuse the code to update the proper cursor focus. We need to do this
for all surface roles - toplevels, popups, subsurfaces.

Fixes #1162
2018-07-29 21:58:33 +03:00
Drew DeVault
e67cb8c07c
Merge pull request #1164 from emersion/fix-xwayland
Revert "rootston: Reap child processes"
2018-07-29 10:49:51 -04:00
Markus Ongyerth
81cc842f8f reintroduce xwayland is_unmanaged
153f37bdf5 (#1145) removed the
wlr_xwayland_is_unamanged function while fixing OR, because it was
belieived that it's supposed to work around the broken OR handling.

This was a misunderstanding. is_unmanaged is (while sort of a hack)
intended to work around inherent differences between "real" X sessions
and our Xwayland/wayland situation.

The main reason it exists is to support applications like rofi and dzen,
while not handing focus to other OR windows (which should *not* be
required).
Traditionally, these applications just grabbed input from X and didn't
need to be focused by any logic in the WM. Which of course doesn't work
in wayland compositors. So we have to give them focus in some way.
Giving *every* OR window focus, breaks other applications that don't
expect focus to change.

A testcase that was pointed out to me where wlr_xwayland_is_unamanged was
breaking things is https://github.com/swaywm/sway/issues/2128 (syncplay,
gitk, gitgui)
Supposedly it broke using keyboard to navigate the menus.
I can't reproduce this with this patch. The popups can be navigated as
long as the parent has focus.
2018-07-29 14:43:17 +02:00
emersion
067a496c8b Revert "rootston: Reap child processes"
This reverts commit b6ed1f29a4.

This commit breaks xwayland.
2018-07-29 09:19:26 +01:00
emersion
555721f714 Add xdg-decoration-unstable-v1 support 2018-07-28 22:48:07 +01:00
Genki Sky
b6ed1f29a4 rootston: Reap child processes
Just install a SIG_IGN handler, which is defined by POSIX.1-2001 to
reap the child.

To test, spawn any process (e.g. GUI application) with a keybinding,
close that process, verify it doesn't show up as a <defunct> zombie in
ps(1) output.
2018-07-24 08:22:35 -04:00
Markus Ongyerth
d5950255de tablet-v2 tablet_tool grab implementation
Implement the basic logic for tablet-v2 tablet_tool's grabs. And plug in
the default grab.
2018-07-23 10:08:10 +02:00
emersion
5dbf0fe7f2 linux-dmabuf: add v1 suffix
This prevents some future conflicts with the stable version.

Fixes #1133
2018-07-19 21:50:05 +01:00
Markus Ongyerth
454f2a84a8 tablet-v2 tablet_pad grab implementation
Implement the basic logic for tablet-v2 tablet_pad's grabs. And plug in
the default grab.
Features like "holding" the focus should be implemented via grabs, like
they are for pointer and keyboard.
2018-07-19 11:35:00 +02:00
emersion
153f37bdf5 xwayland: handle override_redirect flag changes
The override_redirect flag can change on configure notify and
on map notify. This adds an event to know when it changes.

This removes wlr_xwayland_surface_is_unmanaged which was wrongly
using the window type to decide whether the view should be
unmanaged.

A similar patch was proposed to Weston, but has never been
merged upstream [1].

[1]: https://patchwork.freedesktop.org/patch/211161/
2018-07-18 18:51:03 +01:00
Markus Ongyerth
9313ac1068 propagate rename to rootston code 2018-07-14 09:51:26 +02:00
Markus Ongyerth
d9e978e1b3 rename wlr_tablet_tool to wlr_tablet
The previous naming was based on the input-device capability names from
libinput.
With code that uses the libinput_tablet_tool and mapping into tablet-v2,
this is confusing, so the name is changed to follow the names used in
the protocol.
2018-07-14 09:49:58 +02:00
Markus Ongyerth
b84288af16 Remove unused tablet_pad list from tools 2018-07-14 09:48:57 +02:00
Markus Ongyerth
101080a382 Another feedback pass 2018-07-14 09:48:57 +02:00
Markus Ongyerth
48e2cba9b6 Handle relative motion for mouse tools 2018-07-14 09:48:57 +02:00
Markus Ongyerth
2c12011472 Send all tablet tool axis events 2018-07-14 09:47:16 +02:00
Markus Ongyerth
6a40561e4c Fix clang build errors 2018-07-14 09:47:16 +02:00
Markus Ongyerth
b79d11395c Hook up set_cursor in rootston 2018-07-14 09:47:16 +02:00
Markus Ongyerth
31cec36b74 1st feedback pass
Rename make_ functions to _create
Implement set_cursor and set_feedback
2018-07-14 09:43:16 +02:00
Markus Ongyerth
15870ceb4b Fix segfaultiness 2018-07-14 09:40:39 +02:00
Markus Ongyerth
5c7a37f309 Add tool buttons 2018-07-14 09:40:39 +02:00
Markus Ongyerth
391eef6ea9 Propagate most axis events to clients 2018-07-14 09:40:39 +02:00
Markus Ongyerth
f375246657 Implement basic tablet_pad handling (bound to keyboard focus) 2018-07-14 09:40:39 +02:00
Markus Ongyerth
e235f7d336 Basic tablet_v2 object lifetime 2018-07-14 09:40:39 +02:00
emersion
7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
Drew DeVault
be54278207
Merge pull request #1095 from agx/output-add-mode
Allow to add additional modes to outputs
2018-07-07 08:58:17 -07:00
Guido Günther
60a83e99f4 rootston: use wl_list_empty instead of wl_list_length > 0 2018-07-07 17:31:42 +02:00
Guido Günther
709d7dd722 rootston: Handle modeline parameter
This allows to pass custom modes.
2018-07-07 17:31:42 +02:00
emersion
78555abba3
surface: move position and scale out of wlr_surface_state 2018-07-04 19:12:17 +01:00
emersion
233bfe2f4f
surface: do not monkey-patch state damage 2018-07-04 19:12:17 +01:00
emersion
3c0d672ebd
surface: make pending and current embedded structs 2018-07-04 19:12:17 +01:00
emersion
8c2b4244a1
Fix damage tracking debug mode 2018-07-04 15:37:04 +01:00
emersion
73755ad348
screencopy-v1: add basic implementation 2018-06-30 22:17:59 +01:00
Dominique Martinet
1e17f4deb6 rootston: fix leak in handle_layer_shell_surface
Found through static analysis
2018-06-30 11:38:21 +09:00
Tony Crisci
356e466d5a use seat function to end grab 2018-06-24 18:18:30 -04:00
Tony Crisci
e8c0996b93 Merge branch 'master' into cancel-grab-on-focus-change 2018-06-24 18:16:42 -04:00
emersion
57548b557a
Merge branch 'master' into screencontent 2018-06-17 14:49:18 +01:00
emersion
0378d143d9
surface: remove wlr_surface.texture
The texture is managed by the surface's wlr_buffer now. In
particular, the buffer can destroy the texture early if it becomes
invalid.
2018-06-13 19:38:10 +01:00
Genki Sky
28d718c0dd rootston: Cancel existing keyboard grab when changing focus
It's possible that a non-default keyboard grab exists when we are trying
to change focus. For example, say there is an XDG popup when we click on
a different window. This popup's keyboard grab will swallow any
keyboard_notify_enter(), meaning the newly-clicked window won't receive
keyboard input.

So, we cancel any existing grabs in roots_seat_set_focus(). Before this
fix, a window would have been set as active but not receive keyboard
entry.

Fixes #233.

Signed-off-by: Genki Sky <sky@genki.is>
2018-06-10 21:47:49 -04:00
emersion
3a81afed0e
rootston: destroy xwayland before all clients
Destroying all clients disconnects the xwayland client, and
xwayland automatically restarts when disconnected.
2018-06-08 09:29:55 +01:00
Tony Crisci
5d3e95f833 dont damage drag icon after update_position 2018-06-06 12:02:01 -04:00
Tony Crisci
7c888a39c6 update drag position at the right times 2018-06-05 23:45:03 -04:00
Tony Crisci
9333acd68e handle drag icon map in rootston 2018-06-05 23:01:43 -04:00
Tony Crisci
1c75d4e54a rename drag-icon map to unmap 2018-06-05 18:17:42 -04:00
Markus Ongyerth
3994762ae0 Add wlr_surface_get_geometry
This function defaults and clips the xdg-surface geometry to the
bounding box of the surface + its subsurfaces, as specified by the
protocol spec.
2018-06-01 15:21:18 +02:00
emersion
21928cbe61
Merge branch 'master' into screencontent 2018-05-31 12:33:27 +01:00
Genki Sky
32013abae6 rootston: xdg-shell*: Fix get_size() for newly-mapped views
The user-visible issue is that newly-mapped xdg-shell* windows would
sometimes start with their top-left-corner, rather than their center, in
the center of the screen. This is because get_size() would
conservatively fall back on (width, height) == (0, 0) if both
set_window_geometry() had not been called, and it found
view->wlr_surface to be NULL.

But, view->wlr_surface is only set to non-NULL in view_map(). We call
get_size() before this. Fortunately, the wlr_surface in question is
accessible via view->xdg_shell{,_v6}->surface, so always fall back on
that. We can assert its presence instead of further falling back on
(width, height) == (0, 0).

Signed-off-by: Genki Sky <sky@genki.is>
2018-05-30 20:21:19 -04:00
emersion
f9ad63c5cb
rootston: use wl_display_destroy_clients 2018-05-29 22:50:26 +01:00
emersion
7901740f94
rootston: enable export-dmabuf 2018-05-29 18:47:17 +01:00
emersion
e1f56538a8
Merge pull request #999 from dcz-purism/virtual-keyboard
Support virtual keyboard protocol
2018-05-29 18:22:44 +01:00
Dorota Czaplejewicz
5334ee8bfd virtual-keyboard: add support for the virtual-keyboard-v1 protocol 2018-05-28 10:05:55 +02:00
emersion
6eb4b5b54d
Merge pull request #993 from emersion/bind-wl-drm-in-renderer
render: bind wl_drm in renderer
2018-05-25 13:54:16 +01:00
Ilia Bozhinov
24cf70ae96 backends: implement custom EGL and renderer initialization
Compositors now have more control over how the backend creates its
renderer. Currently all backends create an EGL/GLES2 renderer, so
the necessary attributes for creating the context are passed to a
user-provided callback function. It is responsible for initializing
provided wlr_egl and to return a renderer. On fail, return 0.

Fixes #987
2018-05-25 14:56:52 +03:00
Dorota Czaplejewicz
a94c56a828 rootston: Keep focus unchanged when non-focusable element clicked
Before this change, a view would lose focus after clicking something that's not keyboard-interactive. This would lead to edge cases with layer-shell windows like input methods, which are pointer-only-interactive, but are not intended to change the state of any focus.
2018-05-24 16:10:29 +02:00
Dorota Czaplejewicz
fa13493ad5 rootston: Disable keyboard focus on inactive views
After clicking on something non-interactive, the current view was getting deactivated, but still received keyboard events. roots_seat_set_focus now changes both together in this case.
2018-05-24 16:05:12 +02:00
emersion
41130fe54b
render: bind wl_drm in renderer 2018-05-21 19:07:08 +01:00
emersion
e849a68e6e
output: correctly clear screen when fullscreened 2018-05-20 13:44:18 +01:00
emersion
db84379242
Send axis source event 2018-05-12 13:53:21 +01:00
emersion
0b58579564
Add support for discrete axis values 2018-05-12 13:34:58 +01:00
emersion
8e831cd416
Merge pull request #959 from VincentVanlaer/xwayland-lazy
Add the option to start Xwayland only when a client connects
2018-05-08 23:04:26 +01:00
Vincent Vanlaer
6936be984f Document xwayland rootston config changes 2018-05-08 22:54:45 +02:00
Vincent Vanlaer
ef1a24430a Make lazy xwayland start default in rootston 2018-05-08 22:43:31 +02:00
emersion
6436ce6300
rootston: remove outdated comment 2018-05-08 15:51:21 +01:00
Markus Ongyerth
8931452e1d add wlr_layer_surface_surface_at
Adds wlr_layer_surface_surface_at, this is consistent with the other
shell implementations, and simplifies handling in compositors.
2018-05-08 16:03:10 +02:00
Vincent Vanlaer
dbf4f9a231 Make startup command no longer wait for xwayland 2018-05-06 23:41:29 +02:00
Vincent Vanlaer
31861b3a7a Add option to rootston to start xwayland lazy 2018-05-06 23:41:29 +02:00
Vincent Vanlaer
c80bf1591e Allow xwayland to start lazily
Makes the xwayland startup process two phased.
The first phase just initialises the X11 sockets.
The second phase starts the Xwayland server itself.
When starting xwayland lazily the second phase will be postponed until
a client has connected to the X11 socket.

Changes in behaviour:
The DISPLAY environment is now set immediately after the X11 sockets
are created.
When the Xwayland server is killed or crashes, the sockets will not be
recreated, but reused.

Fixes #849: Start up Xwayland lazily
2018-05-06 23:41:25 +02:00
emersion
393f7aaeff
Fix a rootston crash when a client creates non-topmost popups 2018-05-04 09:27:55 +01:00
Ilia Bozhinov
54bf3a36ca rootston: remove mode and transform signals when output is destroyed 2018-05-03 11:57:54 +03:00
emersion
9e7a997433
rootston: map input devices with wlr_input_device.output_name 2018-04-29 14:30:13 +01:00
emersion
6e7c0b57f6
cursor: use NAN for unspecified axes, refactor absolute warping code 2018-04-28 09:24:38 +01:00
Guido Günther
b1bd0e2557 layer-shell: Fix crash when cursor is intially outside any output
On the X11 backend the cursor position might be outside the output
window so no output is returned leading to the assert to trigger. Use
sane fallback instead of crashing.
2018-04-26 14:08:30 +02:00
Guido Günther
24fa07565d layer-shell: use output_damage_{whole,from}_local_surface on map/unmap
These handle rotation and scaling
2018-04-24 13:11:42 +02:00
Guido Günther
c4dff67e00 layer-shell: use output_damage_{whole,from}_local_surface for popups
Reuse what already handles rotation and scaling. This unbreaks popups
on rotated or scaled outputs.
2018-04-24 13:11:42 +02:00
Guido Günther
57cc4c319d rootston: Send frame_done for popups too
Thanks @emersion
2018-04-23 11:24:31 +02:00
Guido Günther
ad22e02310 rootston: Damage layer-shell popups 2018-04-23 11:24:31 +02:00
Guido Günther
d4cb33c9fc rootston: Let layer_surface_at look at popups
This allows them to receive input as well.
2018-04-23 11:24:31 +02:00
Drew DeVault
0a0627f5d0 Finish forward-porting @acrisci's positioner work 2018-04-23 11:24:06 +02:00
Drew DeVault
278aa84619 Basic layer popup rendering 2018-04-23 11:24:06 +02:00
Drew DeVault
edbf4a2f60 Implement output auto-selection in rootston 2018-04-22 19:15:49 +02:00
emersion
fa84b267e0
Remove wlr_surface::subsurface 2018-04-21 18:40:25 +01:00
emersion
70d820be25
Add wlr_renderer_init_wl_shm to advertize supported renderer formats 2018-04-20 23:58:30 +01:00
Guido Günther
47e1eda669 rootston: don't crash on shutdown
When e.g. running rootston under X11 it would otherwise crash when
closing rootston like:

    #0  0x00007f0197da7327 in wl_list_remove () at /usr/lib/x86_64-linux-gnu/libwayland-server.so.0
    #1  0x000056306fcee7fb in handle_destroy (listener=0x5630723a2948, data=0x5630723a5d20) at ../rootston/layer_shell.c:273
    #2  0x00007f019800a552 in wlr_signal_emit_safe (signal=0x5630723a5e30, data=0x5630723a5d20) at ../util/signal.c:29
    #3  0x00007f0197fef808 in layer_surface_destroy (surface=0x5630723a5d20) at ../types/wlr_layer_shell.c:169
    #4  0x00007f0197ff0001 in client_handle_destroy (resource=0x56307229c4c0) at ../types/wlr_layer_shell.c:371
    #5  0x00007f0197da2f30 in  () at /usr/lib/x86_64-linux-gnu/libwayland-server.so.0
    #6  0x00007f0197da77f9 in  () at /usr/lib/x86_64-linux-gnu/libwayland-server.so.0
    #7  0x00007f0197da301d in wl_client_destroy () at /usr/lib/x86_64-linux-gnu/libwayland-server.so.0
    #8  0x00007f0197da30d8 in  () at /usr/lib/x86_64-linux-gnu/libwayland-server.so.0
    #9  0x00007f0197da4c12 in wl_event_loop_dispatch () at /usr/lib/x86_64-linux-gnu/libwayland-server.so.0
    #10 0x00007f0197da344a in wl_display_run () at /usr/lib/x86_64-linux-gnu/libwayland-server.so.0
    #11 0x000056306fcef069 in main (argc=3, argv=0x7ffd22032528) at ../rootston/main.c:83

since the output_destroy got already removed in handle_output_destroy.
2018-04-16 15:51:03 +02:00