Commit graph

4501 commits

Author SHA1 Message Date
Tudor Brindus
a145430afa
input/pointer: add wlr_seat_pointer_wrap
It allows a compositor to do things like skip motion events on pointer
constraint unlock.

References: https://github.com/swaywm/sway/pull/5431
2020-07-15 19:31:13 +02:00
Andri Yngvason
6ef5d18757 render: egl: Use current display to restore NULL context
eglGetCurrentDisplay() returns EGL_NO_DISPLAY when there is no context current
and eglMakeCurrent() needs a display argument.

Fixes #2327
2020-07-14 19:55:20 +02:00
xdavidwu
842df2bd6c examples/input-method-keyboard-grab: new example 2020-07-08 11:21:57 +02:00
xdavidwu
595f324f8b input-method: implement keyboard grabs 2020-07-08 11:21:57 +02:00
xdavidwu
61e2ebac90 virtual-keyboard: add wlr_input_device_get_virtual_keyboard 2020-07-08 11:21:57 +02:00
Simon Ser
b6377b59ff backend/drm: check drm_surface_make_current return value
drm_connector_set_cursor wasn't checking the return value of the
drm_surface_make_current call. On failure, this results in a failed
assertion in wlr_renderer_begin (because no rendering context is
current).
2020-07-07 11:18:07 -06:00
Simon Ser
cccca368c5
backend/drm: fix typo in drm_surface_make_current arg 2020-07-07 17:36:51 +02:00
Isaac Freund
92c85858a9 layer-shell: remove unused surface list
This was rendered useless in 5cde359.
2020-07-07 12:11:31 +02:00
j-n-f
b61a98c417 examples: fix improper use of free
Closes #2303
2020-07-06 00:40:14 +02:00
Greg V
b2bd536308 xdg-shell: check for existing role before setting xdg_popup_surface_role
Hopefully fixes #2056
2020-07-04 12:11:19 +02:00
John Chadwick
58bcec9d94 xwm: end transfers when the requestor is destroyed
This improves the failure cases when incremental transfers fail to
complete successfully for one reason or another.
2020-07-03 09:42:36 +02:00
Simon Ser
f82a27f55a backend/drm: fix DPMS on legacy interface
This mirrors what the atomic code does in create_mode_blob.

Closes: https://github.com/swaywm/wlroots/issues/2312
2020-07-02 09:39:41 -06:00
Andri Yngvason
a54ed85881 examples: screencopy-dmabuf: Fix y-inversion 2020-07-01 11:43:02 +02:00
Andri Yngvason
1d835f2035 screencopy: Use correct dmabuf to get y-inversion flag
Because wlr_renderer_blit_dmabuf() undoes y-inversion on the source
buffer, it is incorrect to pass the y-inversion flag of the source
buffer to the user.
2020-07-01 11:43:02 +02:00
Andri Yngvason
e05a85327f render: gles2: Fix y-inversion in gles2_blit_dmabuf() 2020-07-01 11:43:02 +02:00
Scott Moreau
b1a47245a1 xwm: Destroy xwm on hangup or error
If Xwayland is restarted, the ready handler assumes there is no xwm instance.
This means all of xwm was leaked on Xwayland restart. This caused compositors
to consume all cpu resources, where time is spent dispatching. Now we destroy
xwm if we get an event mask containing WL_EVENT_HANGUP or WL_EVENT_ERROR.
2020-06-30 21:21:25 +02:00
Scott Moreau
84d2f30faa xwayland: Don't discard ready signals
The xwayland ready signals are used to do initial setup like starting xwm.
Discarding the signals means that the handler functions will not be called
in the case that Xwayland is restarted and thus, xwm managed clients fail.

Fixes #2174."
2020-06-30 21:21:25 +02:00
Simon Ser
c611a8f7e7 output: add backend docs 2020-06-30 08:03:58 -06:00
Isaac Freund
45c0877e34 layer-shell: upgrade to v3, implement destructor 2020-06-30 13:33:15 +02:00
Kenny Levinsen
d2ca220fda wlr_drag: Destroy drag after releasing grabs
wlr_drag sets up keyboard, pointer and touch grabs, which block 'enter'
events (and thus focus changes). For the compositor to be able to update
focus (e.g. to focus the drop target) from the destroy handler, the
grabs must be released before the destroy event is signalled.
2020-06-30 11:11:52 +02:00
Kirill Chibisov
6c8f66ff59 xcursor: add xorg-x11 and cursors path to XCURSORPATH
This should match default XCURSORPATH, which is used by libwayland-cursor
and other xcursor loading libraries more closely.
2020-06-26 11:20:52 +02:00
Isaac Freund
a7f48aab69 xdg-decoration: free old configure structs 2020-06-25 10:33:58 +02:00
Isaac Freund
86e20f48c6 xdg-shell: handle serial wrapping overflow 2020-06-25 10:33:58 +02:00
Isaac Freund
b937c7b05e layer-shell: handle serial wrapping overflow 2020-06-25 10:33:58 +02:00
Simon Zeni
4a4da256dd render/gles2: use glGetAttribLocation instead of hardcoded indices 2020-06-24 20:01:19 +02:00
Simon Ser
d5530b26d7 examples/pointer: fix wlr_renderer_end call order
Calling wlr_renderer_end after wlr_output_commit would make an
assertion fail.
2020-06-20 11:05:54 -06:00
Simon Ser
c930160286 backend/noop: add missing rollback_render output impl
3c5dbfd97c ("output: make rollback_render mandatory") makes a no-op
output init fail without this function.
2020-06-19 13:07:24 -06:00
Simon Ser
155d57b01d output: fix dangling renderer context after wlr_output_preferred_read_format
attach_render was called without un-setting the current rendering
context afterwards.

Closes: https://github.com/swaywm/wlroots/issues/2164
2020-06-19 11:50:42 -06:00
Simon Ser
3c5dbfd97c output: make rollback_render mandatory
If the output backend provides attach_render, assert it also provides a
way to revert it via rollback_render.
2020-06-19 11:50:42 -06:00
Simon Ser
bf93d2e67c output: rename impl->rollback to rollback_render
The output backend API is now mostly state-less thanks to the atomic
hooks (commit and test). There is one exception though: attach_render.
This function makes the rendering context current. However sometimes the
compositor might decide not to render after attach_render (e.g. when
there's nothing new to render to the back buffer). Thus
wlr_output_rollback has been introduced to revert the pending state.

Because the output backend API is mostly state-less, the only thing
wlr_output_impl.rollback needs to do is revert the current rendering
context. Rename the function to rollback_render to make this clear. Add
a check in the common wlr_output code to only call rollback_render when
attach_buffer has been previously called.

On the long term, we'll be able to remove attach_render and
rollback_render together.
2020-06-19 11:50:42 -06:00
Simon Ser
58df3eda9f render/egl: print error name
Allows for easier debugging.
2020-06-18 07:56:05 -06:00
Simon Ser
d177abecae surface: ignore viewport src rect on NULL buffer
According to the viewporter protocol:

> If the wl_buffer is NULL, the surface has no content and therefore no size.
2020-06-18 07:55:33 -06:00
Rouven Czerwinski
c18c419b56 surface: don't unset width and height in finalize
During surface finalization we may not have received a new buffer,
resetting width and height in this case is wrong since we display the
old buffer in this case.
2020-06-18 09:54:15 +02:00
Tudor Brindus
c768309ab4 input/keyboard: send modifiers on first keyboard enter
Will fix Firefox bug
https://bugzilla.mozilla.org/show_bug.cgi?id=1643991.

Fixes swaywm/sway#5462.
2020-06-17 18:54:38 +02:00
Simon Ser
9e68ed2159 viewporter: new protocol implementation
Closes: https://github.com/swaywm/wlroots/issues/633
2020-06-17 09:10:54 -06:00
Simon Ser
c618a76540 surface: introduce wlr_surface_get_buffer_source_box
This helper allows compositors to retrieve the buffer source box in
buffer-local coordinates.
2020-06-17 09:10:54 -06:00
Simon Ser
eb22ae97b0 surface: add wlr_surface_state.viewport
This field contains the viewport source and destination parameters. It's
intended to be updated by a third-party protocol, for instance
viewporter.
2020-06-17 09:10:54 -06:00
Simon Ser
315bf08733 render: add wlr_render_subtexture_with_matrix
This renders only a subset of the texture, instead of the full texture.
2020-06-17 09:10:54 -06:00
Simon Ser
00ccb89288 util/region: add wlr_region_scale_xy 2020-06-17 09:10:54 -06:00
Simon Ser
9814213a91 box: add wlr_fbox
Same as wlr_box, but for floating-point numbers.
2020-06-17 09:10:54 -06:00
Simon Ser
5118189a2b render/gles2: use .x/.y instead of .s/.t
texcoord is a vector of coordinates, with the first member being the X
axis value and the second member being the Y axis value. It makes more
sense to use the accessors with the same names.
2020-06-17 09:10:54 -06:00
Rouven Czerwinski
d3d1bac1c2 render: assert sane values for box functions
Width and height should always be > 0 for render functions which take a
wlr_box.

References https://github.com/swaywm/wlroots/issues/2281
2020-06-16 15:16:02 +02:00
Andri Yngvason
cae533cad2 screencopy: Use correct constant for y-inversion 2020-06-13 15:39:49 +02:00
Andri Yngvason
a6a5a19356 backend: drm: Fix dmabuf resource leak 2020-06-13 15:39:49 +02:00
Simon Ser
3c13527ead examples/fullscreen-shell: stop advertising linux-dmabuf unconditonally
Remove the wlr_linux_dmabuf_v1_create call. wlr_renderer_init_wl_display
will take care of creating the linux-dmabuf global if the OpenGL
implementation supports it.
2020-06-11 11:50:17 -06:00
Simon Ser
4615ce9099 examples/screencopy-dmabuf: call strncpy with maxlen - 1
The original code wasn't wrong since we were manually writing a null
byte anyway, but this makes GCC happy.

Closes: https://github.com/swaywm/wlroots/issues/2273
2020-06-11 07:34:55 -06:00
Simon Ser
7f9bbaaa17 render/egl: explicit client extension handling
Prior to this commit, wlr_egl_init seemed to assume the extension string
queried via EGL_NO_DISPLAY was a subset of the extension string queried
via an initialized display. This isn't correct.

EGL_EXT_client_extensions [1] defines two types of extensions: client
extensions and display extensions. The set of supported client and
display extensions are disjoint (ie. an extension is either a client or
a display extension, not both). Client extensions are queried via
EGL_NO_DISPLAY, display extensions are queried via an initialized
display.

Rename the variables to make this clear. Remove the misleading comment.
Log both client and display extensions.

[1]: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_client_extensions.txt
2020-06-10 14:55:29 +02:00
Simon Ser
79e03c7d45 output: document wlr_output_export_dmabuf 2020-06-09 07:12:43 -06:00
Simon Ser
a8a4a12c4b buffer: document wlr_buffer_get_dmabuf DMA-BUF lifetime 2020-06-09 07:12:43 -06:00
Andri Yngvason
78d6eed6b3 render: Fix blit_dmabuf() breakage due to API change 2020-06-08 21:37:32 +02:00