Commit Graph

1341 Commits

Author SHA1 Message Date
Simon Ser 471f9a3f6a output-management-v1: use wlr_output.description
Unfortunately, the description isn't mutable yet for this protocol [1].

[1]: https://github.com/swaywm/wlr-protocols/issues/67
2019-12-29 12:35:22 -05:00
Simon Ser 1f799c1cbd xdg-output-v1: use wlr_output.description
Since [1], the xdg-output description is mutable. Listen to output
description changes and send the new output description when updated.

[1]: 048102f21a
2019-12-29 12:35:22 -05:00
Simon Ser 4da4a15d6b output: add description
wlr_output.description is a string containing a human-readable string
identifying the output. Compositors can customise it via
wlr_output_set_description, for instance to make the name more
user-friendly.

References: https://github.com/swaywm/wlroots/issues/1623
2019-12-29 12:35:22 -05:00
Scott Anderson cff1c2f740 meson: Various improvements
Bumps minimum version to 0.51.0

- Remove all intermediate static libraries.
  They serve no purpose and are just add a bunch of boilerplate for
  managing dependencies and options. It's now managed as a list of
  files which are compiled into libwlroots directly.

- Use install_subdir instead of installing headers individually.
  I've changed my mind since I did that. Listing them out is annoying as
  hell, and it's easy to forget to do it.

- Add not_found_message for all of our optional dependencies that have a
  meson option. It gives some hints about what option to pass and what
  the optional dependency is for.

- Move all backend subdirectories into their own meson.build. This
keeps some of the backend-specific build logic (especially rdp and
session) more neatly separated off.

- Don't overlink example clients with code they're not using.
  This was done by merging the protocol dictionaries and setting some
  variables containing the code and client header file.
  Example clients now explicitly mention what extension protocols they
  want to link to.

- Split compositor example logic from client example logic.

- Minor formatting changes
2019-12-23 07:48:29 -05:00
myfreeweb 774548696c Send tablet tool frame on proximity_out
Fixes GTK application crashes
2019-12-18 13:23:07 -05:00
Simon Ser 98cd11c019 output: fix wlr_output_preferred_mode fallback
`mode` points to an invalid pointer (head of the list) when the loop
stops.

Closes: https://github.com/swaywm/sway/issues/4717
2019-12-16 01:24:28 +00:00
Simon Ser 7fc58e704a surface: don't unref the current buffer on failure
If wlr_buffer_create fails, keep the previous buffer.
2019-12-14 09:19:44 -05:00
Simon Ser 96e8e9b098 buffer: improve error handling
In case the texture can't be imported, release the buffer so that the
client can submit another one. In case the allocation fails, disconnect
the client.
2019-12-14 09:19:44 -05:00
Manuel Stoeckl 8a5e4768e1 output: fix cursor wl_surface.{enter,leave} tracking
This change ensures that wl_surface.leave is sent when a surface
associated with the cursor is disassociated (when the cursor is
reset).
2019-12-09 15:58:18 +01:00
Simon Ser 16f22940d9 keyboard: emit key events without keymap
Sometimes compositors don't need an XKB keymap at all, they just handle
raw keycodes. Emit key events even if no keymap is set.
2019-12-01 10:25:50 -05:00
Simon Ser dc6ef658b6 Revert "output: add block_idle_frame"
This reverts commit cbb2781fed.

In [1], we found issues with block_idle_frame and replaced it with
frame_pending. block_idle_frame is now unused.

[1]: https://github.com/swaywm/sway/pull/4772
2019-12-01 10:25:34 -05:00
Dorota Czaplejewicz fadd4706ed virtual_keyboard: Accept keycode 0 2019-11-27 16:49:12 +01:00
Simon Ser 5cde35923c Simplify globals implementation by removing destructors
Some globals are static and it doesn't make sense to destroy them before
the wl_display. For instance, wl_compositor should be created before the
display is started and shouldn't be destroyed.

For these globals, we can simplify the code by removing the destructor
and stop keeping track of wl_resources (these will be destroyed with the
wl_display by libwayland).
2019-11-25 09:01:46 -05:00
Timidger 6bd7a62c09 Use layer shell v2 2019-11-23 17:52:00 -05:00
Simon Ser 2122e49bea presentation-time: add helper for common case
Most of the time, compositors just display the surface's current buffer
on an output. Add an helper to make it easy to support presentation-time
in this case.
2019-11-21 11:03:43 -05:00
Simon Ser 533ea6d7ef presentation-time: make API more flexible
The wlr_presentation_feedback struct now tracks presentation feedback
for multiple resources (but still a single surface content update). This
allows the compositor to properly send presentation events even when
there is more than one frame of latency or when it references a
surface's buffer.
2019-11-21 11:03:43 -05:00
Simon Ser 3084cee7bc output: fix off-by-one wlr_output_event_present.commit_seq
Backends not supporting presentation feedback call
wlr_output_send_present with a NULL event in their commit handler. Since
the commit hasn't been applied yet, commit_seq still has its old value.
We need to increment it.

An alternative would be to move commit_seq in wlr_output_state. This
would allow to have a pending and a current commit_seq.
wlr_output_send_present could take the pending commit_seq when called
with a NULL event.
2019-11-21 11:03:43 -05:00
Simon Ser 2d9661f189 output: set wlr_output.commit_seq before firing the commit event
This allows listeners to read the commit sequence number.
2019-11-21 11:03:43 -05:00
Simon Ser 16e5e9541b Add -Wmissing-prototypes
This requires functions without a prototype definition to be static.
This allows to detect dead code, export less symbols and put shared
functions in headers.
2019-11-20 02:05:03 +00:00
Simon Ser 6c649bab53 output: add wlr_output_event_present.commit_seq
This is set to the value of wlr_output.commit_seq when the frame has
been submitted. This allows tracking presentation with more then 1 full
frame of latency.

References: https://github.com/swaywm/wlroots/issues/1917
2019-11-17 00:12:59 +01:00
Alynx Zhou aa9ea95e1f Skip assign when sub_x or sub_y is NULL in wlr_surface_surface_at 2019-11-08 08:48:30 +01:00
Brian Ashworth f2d3b1000f Introduce wlr_keyboard_group
A wlr_keyboard_group allows for multiple keyboard devices to be
combined into one logical keyboard. Each keyboard device can only be
added to one keyboard group. This helps with the situation where one
physical keyboard is exposed as multiple keyboard devices. It is up to
the compositors on how they group keyboards together, if at all.

Since a wlr_keyboard_group is one logical keyboard, the keys are a set.
This means that if a key is pressed on multiple keyboard devices, the
key event will only be emitted once, but the internal state will count
the number of devices that the key is pressed on. Likewise, the key
release will not be emitted until the key is released from all devices.
If the compositor wants access to which keys are pressed and released
on each keyboard device, the events for those devices can be listened
to, as they currently are, in addition to the group keyboard's events.

Also, all keyboard devices in the group must share the same keymap. If
the keymap's differ, the keyboard device will not be able to be added
to the group. Once in the group, if the keymap or effective layout for
one keyboard device changes, it will be synced to all keyboard devices
in the group. The repeat info and keyboard modifiers are also synced
2019-11-05 20:05:49 +01:00
György Kurucz b81bb2ef30 Fix heap-use-after-free in wlr_send_tablet_v2_tablet_pad_leave
See swaywm/sway#4660
2019-10-27 19:01:16 +01:00
Simon Ser 9971db02ff output-management-v1: add assertion as a safety net
Makes it easier to figure out when the compositor submits an invalid
output state.

References: https://github.com/swaywm/sway/pull/4673
2019-10-27 10:49:53 -04:00
Andri Yngvason 61a6f2b928 screencopy: Implement damage reporting 2019-10-22 10:41:32 -04:00
Andri Yngvason 5d8bd4d343 output: Add commit sequence number
This allows synchronisation between different instances of commit/precommit
callbacks.
2019-10-22 10:41:32 -04:00
Timidger 1724261910 layer_shell: set layer of existing surface 2019-10-16 09:41:13 -04:00
Ivan Molodetskikh cbb2781fed output: add block_idle_frame 2019-10-16 09:35:07 -04:00
Ilia Bozhinov 480a31ea4e wlr_box: properly calculate closest point for non-positive area boxes
If box->width/height is <= 0, the box doesn't contain any points, and so
there is no closest point. wlr_box_closest_point should return NAN in this
case.

In addition, we need to handle empty boxes in a few other
output-layout-related places, because outputs can have size 0x0 when
they are created or destroyed.
2019-10-11 23:43:13 +03:00
amingin b1b93c2c7e Fixes crash of compositor when unvalidated keycode 0 is passed (#1833)
* Fixes crash of compositor when unvalidated keycode 0 is passed from virtual keyboard

* Style fix
2019-09-27 13:11:30 +03:00
Markus Ongyerth 57babd2e13 Move initialization of wlr_tablet_pad into types/wlr_tablet_pad 2019-09-26 19:41:19 +03:00
Ivan Molodetskikh 020a33e057 presentation_feedback: add the sampled state 2019-09-19 19:44:19 +03:00
Simon Ser c808613287 compositor: disconnect client on OOM in create_surface 2019-09-18 11:28:15 +12:00
Versus Void 2ecfc46b93 xdg-output: send wl_output.done after xdg_output created
xdg-output version 3 requires to send wl_output.done
"after all xdg_output properties have been sent when the object is created"
2019-09-17 15:30:20 +03:00
Sebastian Krzyszkowiak a14d650864 wlr_seat_touch: Destroy the touchpoint on client destroy
Since e26217c51e3a5e1d7dfc95a8a76299e056497981, touchpoints can outlive
surfaces. This works fine as long as the client stays around, but fails
horribly otherwise; therefore we have to make sure that touchpoints don't
outlive their clients.

Fixes #1788
2019-09-14 16:19:07 +03:00
Ilia Bozhinov 8b0f1bc850 layer-shell: ignore ack_configure() on closed surfaces
When the surface is closed, we destroy all pending serials waiting to be
accepted. This means we need to ignore any future ack events, because we
can have the following events:

1. -> configure()
2. -> close()
3. <- ack_configure()

At point 3, wlroots will error the client because of invalid serial,
however the client hasn't processed close() yet.
2019-09-13 13:58:58 +03:00
Sebastian Krzyszkowiak cdfe836b03 Revert "wlr_xdg_popup: don't treat all surfaces of grabbing client as grabbing surfaces"
This reverts commit 52037d13f7.

Fixes #1801
2019-08-27 11:12:09 +09:00
Brian Ashworth fa477c77c4 wlr-layer-shell-v1: destroy xdg popups on unmap
This destroys the xdg popups associated with a layer surface when the
layer surface is unmapped. It does not make sense to keep the popups
open when unmapped.
2019-08-24 13:39:38 +09:00
Brian Ashworth 9914784594 wlr_xdg_toplevel: reparent on parent unmap
From the xdg-shell specification:
	If the parent is unmapped then its children are managed as
	though the parent of the now-unmapped parent has become the
	parent of this surface. If no parent exists for the now-unmapped
	parent then the children are managed as though they have no
	parent surface.
2019-08-15 11:19:06 +03:00
Antonin Décimo 217cf18a4b Avoid loss of a fractional part 2019-08-12 09:37:21 +09:00
Antonin Décimo 0695324de7 xdg_shell: remove variable self-assignment 2019-08-12 09:37:21 +09:00
Antonin Décimo 8f3d73e3a3 wlr_surface: condition is always false 2019-08-12 09:37:21 +09:00
Antonin Décimo 3fc977d7da Fix memory leak 2019-08-12 09:37:21 +09:00
Sebastian Krzyszkowiak 52037d13f7 wlr_xdg_popup: don't treat all surfaces of grabbing client as grabbing surfaces
Fixes #897
2019-08-12 09:31:49 +09:00
Sebastian Krzyszkowiak 78d96009e4 wlr_xdg_popup: grab touch events alongside pointer and keyboard
Fixes #933
2019-08-12 09:31:49 +09:00
Sebastian Krzyszkowiak 40d17c1305 wlr_seat_touch: add a way for a grab to ignore a touch point 2019-08-12 09:31:49 +09:00
Drew DeVault 94f65e354d Add libinput-1.14 support
This libinput version adds a new tablet tool type.
2019-08-11 19:39:47 +09:00
Sebastian Krzyszkowiak 913cac1835 wlr_input_method_v2: Remove input method's resource from the list on destroy
It's added to manager->input_methods list in manager_get_input_method, but
wasn't removed anywhere, leading to possible use-after-free in
wlr_input_method_manager_v2_destroy.
2019-08-09 08:05:55 +09:00
Rouven Czerwinski 01f903874b Revert "output: atomic mode"
This reverts commit ee5f98ad49.

This intoduced problems where outputs could not be turned off because
they had flips pending.
2019-08-07 16:22:11 +09:00
Simon Ser 6396710976 xdg-output: add support for xdg-output-unstable-v1 version 3
This adds support for xdg-output-unstable-v1 version 3, added in [1].

The xdg_output.done event is now deprecated and is replaced with
wl_output.done.

[1]: 962dd53537
2019-08-02 10:02:33 -04:00