- Removes `native_menu.h` dependency from `display_server.h`.
It's now forward-declared in all DisplayServer implementations and should
be included in the .cpp's.
- Removes some unused `rb_set.h` and `rb_map.h` dependencies, which leads to
having to include them explicitly in half the scene and editor codebase...
which shows how much we depend on `display_server.h`.
- Forward-declare `input_event.h`, so now we need only `keyboard.h`.
`DisplayServer::window_set_size` is called lots of times in the code,
with the assumption (I suppose) that it's going to be idempotent.
We had checks in _update_window_rect but we still called
`WaylandThread::window_set_size`, which did a lot of stuff. In
particular, this caused issues with HiDPI as it "overrode" the window
size before it had a time to figure out its scale.
They were bound in reverse. No idea how I originally chose which was
which.
This patch also orders the switch cases by their underlying codes: left,
right, middle, side, extra.
Some compositors (e.g. COSMIC) can report *all* supported output modes,
not just the current mode. This is valid, albeit deprecated, so let's
add a check and ignore any non-current output events.
Freshly deleted objects are temporarily "inert" until their destruction
is acknowledged by the compositor.
Inert objects are ignored. By doing so, we mistakenly returned too
early and missed some FD cleanup logic. This patch ensures that any
outstanding FDs are always closed by moving its logic outside of the
message handling routine.
The spec tells us to ignore certain events if we didn't get an `enter`
event first. Certainly we need to at least acknowledge the `enter` event
itself 😅
Despite what I thought in the past, it is allowed, as long as we follow
certain limitations depending on the toplevel's state.
As usual I peppered the code with comments expaining what those
limitations are.
Regarding popups, AFAICT there are no major limitations, although we
should eventually use the new `reposition` method, which autoadjusts the
popup to follow the screen's borders and whatnot. I didn't do that in
this patch as it requires some elbow grease, especially if we want to do
it synchronously.
Libdecor has some quirks and depending on the setup it might be useful
to switch to the xdg-shell branch. Recompiling the whole engine without
libdecor is not an acceptable way to do that.
Makes it more consistent with the rest of the `WaylandThread` methods
(so that we can silently check for the window's existence).
Fixes errors when trying to capture the pointer when no surface has been
pointed yet (its logic assumed that this method was silent).
We double-check everywhere anyway but I added it in some places where we
can't either guarantee that it'll check (to avoid segfaults) or that
would be useful to report directly.
The spec says "After leave event, compositor must ignore requests from
any text input instances until next enter event."
Fixes an error on jay, which at least on 1.11.0 sends
`zwp_text_input_v3::done` after `zwp_text_input_v3::leave`, which we
didn't ignore, leading to a commit without a valid window id.