This fixes the gap between menu items and the menu border in an output
with a fractional scale due to the semantic gap between cairo and
wlroots's position-independent scene renderer.
Using mouse emulation for a tablet tool mouse is just a practical
decision to let such a tool work more smootly, e.g. it avoids weird
menu issues in GTK applications. Since such a tool doesn't have
pen specifix axis like pressure or distance, no functionality is lost.
A solution fully in line with the protocol, which would pass the tool
mouse buttons to the client, would leave us with e.g. non-working
buttons in current GTK4 since they don't handle the buttons
reported from the tool mouse.
May be this changes in future. But for now, let's just be practical.
This prevents a crash observed by the scaled-icon-buffer listening
to the `view->events.set_icons` signal before it is initialized.
For this to happen, the application needs to use the kde decoration
protocol and set it on the xdg_surface before creating the xdg_toplevel.
Fixes: #2798
This patch fixes the issue that window icons become the fallback
one after Reconfigure, by setting scaled_icon_buffer->view_app_id (and
other properties) in scaled_icon_buffer_set_view().
The reason why the window icons were displayed before Reconfigure is that
applications usually enable decorations and then set app_id which fires
handle_view_set_icon().
This patch also changes the semantics of scaled_icon_buffer: rather than
calling scaled_icon_buffer_set_app_id() every time an app_id is set, we
can now call scaled_icon_buffer_set_view() just once so that multiple
scaled_icon_buffers bound to a window are automatically updated when an
app_id is set or new icon is set via xdg-toplevel-icon-v1.
In some cases, we would schedule a configure event but not record that
we had done so, leaving view->pending_configure_serial incorrect. This
caused incorrect handling of in-flight commits that had not yet taken
the new configure into account, such as assuming that the client had
ignored the configured size and incorrectly resetting view->pending.
Fixes: #2774
Adding -Wshadow will prevent unintentional variable overrides.
Also, wrapping switch cases with declarations with braces will make our
logic more robust by limiting lifetimes of variables.
For longer cases, factor out the logic to new functions.
For very short cases, just move the declaration before the switch.
v2: in one case, replace the switch with if/else.