Compare commits

...

2 commits

Author SHA1 Message Date
Johan Malm
df8e3d819c docs/: remove XML declarations in .xml files
...because we don't like them anymore and libxml2 does not consider them
mandatory.
2025-10-21 12:30:32 +09:00
John Lindgren
28cd504067 desktop: work around client-side rounding issues at right/bottom pixel
This also avoids a similar server-side rounding issue with some
combinations of wlroots and libwayland versions. See:

- https://gitlab.freedesktop.org/wayland/wayland/-/issues/555
- https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5159

Tested with qmpanel (similar to lxqt-panel) at 1x and 2x output scale.
Does not help if scaling is done client-side, e.g. QT_SCALE_FACTOR=2.

Fixes: #2379
Fixes: #3099
2025-10-20 20:11:08 +01:00
4 changed files with 35 additions and 6 deletions

View file

@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu>
<!-- Note: for localization support of menu items "client-menu" has to be removed here -->
<menu id="client-menu">

View file

@ -1,5 +1,3 @@
<?xml version="1.0"?>
<!--
This is a very simple config file with many options missing. For a complete
set of options with comments, see docs/rc.xml.all

View file

@ -1,5 +1,3 @@
<?xml version="1.0"?>
<!--
This file contains all supported config elements & attributes with
default values.

View file

@ -242,6 +242,39 @@ desktop_update_top_layer_visibility(struct server *server)
}
}
/*
* Work around rounding issues in some clients (notably Qt apps) where
* cursor coordinates in the rightmost or bottom pixel are incorrectly
* rounded up, putting them outside the surface bounds. The effect is
* especially noticeable in right/bottom desktop panels, since driving
* the cursor to the edge of the screen no longer works.
*
* Under X11, such rounding issues went unnoticed since cursor positions
* were always integers (i.e. whole pixel boundaries) anyway. Until more
* clients/toolkits are fractional-pixel clean, limit surface cursor
* coordinates to (w - 1, h - 1) as a workaround.
*/
static void
avoid_edge_rounding_issues(struct cursor_context *ctx)
{
if (!ctx->surface) {
return;
}
int w = ctx->surface->current.width;
int h = ctx->surface->current.height;
/*
* The cursor isn't expected to be outside the surface bounds
* here, but check (sx < w, sy < h) just in case.
*/
if (ctx->sx > w - 1 && ctx->sx < w) {
ctx->sx = w - 1;
}
if (ctx->sy > h - 1 && ctx->sy < h) {
ctx->sy = h - 1;
}
}
/* TODO: make this less big and scary */
struct cursor_context
get_cursor_context(struct server *server)
@ -269,6 +302,8 @@ get_cursor_context(struct server *server)
ret.node = node;
ret.surface = lab_wlr_surface_from_node(node);
avoid_edge_rounding_issues(&ret);
#if HAVE_XWAYLAND
/* TODO: attach LAB_NODE_UNMANAGED node-descriptor to unmanaged surfaces */
if (node->type == WLR_SCENE_NODE_BUFFER) {