xwayland: Use logical_ prefix for logical coordinate system values

Inspired by
https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/878 .

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2095>
This commit is contained in:
Michel Dänzer 2025-10-16 12:01:17 +02:00 committed by Marge Bot
parent 1a3c5e7827
commit ce67045211
5 changed files with 43 additions and 43 deletions

View file

@ -102,8 +102,8 @@ output_handle_geometry(void *data, struct wl_output *wl_output, int x, int y,
/* Apply the change from wl_output only if xdg-output is not supported */
if (!xwl_output->xdg_output) {
xwl_output->x = x;
xwl_output->y = y;
xwl_output->logical_x = x;
xwl_output->logical_y = y;
}
xwl_output->rotation = wl_transform_to_xrandr(transform);
}
@ -119,8 +119,8 @@ output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
/* Apply the change from wl_output only if xdg-output is not supported */
if (!xwl_output->xdg_output) {
xwl_output->width = width;
xwl_output->height = height;
xwl_output->logical_w = width;
xwl_output->logical_h = height;
}
xwl_output->refresh = refresh;
}
@ -133,23 +133,23 @@ output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
static inline void
output_get_new_size(struct xwl_output *xwl_output, int *width, int *height)
{
int output_width, output_height;
int logical_width, logical_height;
/* When we have xdg-output support the stored size is already rotated. */
if (xwl_output->xdg_output
|| (xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180))) {
output_width = xwl_output->width;
output_height = xwl_output->height;
logical_width = xwl_output->logical_w;
logical_height = xwl_output->logical_h;
} else {
output_width = xwl_output->height;
output_height = xwl_output->width;
logical_width = xwl_output->logical_h;
logical_height = xwl_output->logical_w;
}
if (*width < xwl_output->x + output_width)
*width = xwl_output->x + output_width;
if (*width < xwl_output->logical_x + logical_width)
*width = xwl_output->logical_x + logical_width;
if (*height < xwl_output->y + output_height)
*height = xwl_output->y + output_height;
if (*height < xwl_output->logical_y + logical_height)
*height = xwl_output->logical_y + logical_height;
}
static int
@ -446,8 +446,8 @@ xwl_output_randr_emu_prop(struct xwl_screen *xwl_screen, ClientPtr client,
if (!emulated_mode)
continue;
prop->rects[index][0] = xwl_output->x;
prop->rects[index][1] = xwl_output->y;
prop->rects[index][0] = xwl_output->logical_x;
prop->rects[index][1] = xwl_output->logical_y;
prop->rects[index][2] = emulated_mode->width;
prop->rects[index][3] = emulated_mode->height;
index++;
@ -629,8 +629,7 @@ apply_output_change(struct xwl_output *xwl_output)
{
struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
struct xwl_output *it;
int mode_width, mode_height, count;
int width = 0, height = 0, has_this_output = 0;
int logical_width, logical_height, count, has_this_output = 0;
RRModePtr *randr_modes;
/* Clear out the "done" received flags */
@ -642,18 +641,18 @@ apply_output_change(struct xwl_output *xwl_output)
*/
if (xwl_output->xdg_output == NULL
|| xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180)) {
mode_width = xwl_output->width;
mode_height = xwl_output->height;
logical_width = xwl_output->logical_w;
logical_height = xwl_output->logical_h;
} else {
mode_width = xwl_output->height;
mode_height = xwl_output->width;
logical_width = xwl_output->logical_h;
logical_height = xwl_output->logical_w;
}
if (xwl_output->randr_output) {
/* Build a fresh modes array using the current refresh rate */
randr_modes = output_get_rr_modes(xwl_output, mode_width, mode_height, &count);
randr_modes = output_get_rr_modes(xwl_output, logical_width, logical_height, &count);
RROutputSetModes(xwl_output->randr_output, randr_modes, count, 1);
RRCrtcNotify(xwl_output->randr_crtc, randr_modes[0],
xwl_output->x, xwl_output->y,
xwl_output->logical_x, xwl_output->logical_y,
xwl_output->rotation, NULL, 1, &xwl_output->randr_output);
/* RROutputSetModes takes ownership of the passed in modes, so we only
* have to free the pointer array.
@ -661,6 +660,7 @@ apply_output_change(struct xwl_output *xwl_output)
free(randr_modes);
}
logical_width = logical_height = 0;
xorg_list_for_each_entry(it, &xwl_screen->output_list, link) {
/* output done event is sent even when some property
* of output is changed. That means that we may already
@ -669,20 +669,20 @@ apply_output_change(struct xwl_output *xwl_output)
if (it == xwl_output)
has_this_output = 1;
output_get_new_size(it, &width, &height);
output_get_new_size(it, &logical_width, &logical_height);
}
if (!has_this_output) {
xorg_list_append(&xwl_output->link, &xwl_screen->output_list);
/* we did not check this output for new screen size, do it now */
output_get_new_size(xwl_output, &width, &height);
output_get_new_size(xwl_output, &logical_width, &logical_height);
--xwl_screen->expecting_event;
}
if (xwl_screen->fixed_output == NULL)
update_screen_size(xwl_screen, width, height);
update_screen_size(xwl_screen, logical_width, logical_height);
else
RRTellChanged(xwl_screen->screen);
@ -788,8 +788,8 @@ xdg_output_handle_logical_position(void *data, struct zxdg_output_v1 *xdg_output
{
struct xwl_output *xwl_output = data;
xwl_output->x = x;
xwl_output->y = y;
xwl_output->logical_x = x;
xwl_output->logical_y = y;
}
static void
@ -798,8 +798,8 @@ xdg_output_handle_logical_size(void *data, struct zxdg_output_v1 *xdg_output,
{
struct xwl_output *xwl_output = data;
xwl_output->width = width;
xwl_output->height = height;
xwl_output->logical_w = width;
xwl_output->logical_h = height;
}
static void

View file

@ -56,8 +56,8 @@ struct xwl_output {
struct wl_output *output;
struct zxdg_output_v1 *xdg_output;
uint32_t server_output_id;
int32_t x, y, width, height, refresh, scale;
int32_t mode_width, mode_height;
int32_t logical_x, logical_y, logical_w, logical_h;
int32_t mode_width, mode_height, refresh, scale;
double xscale; /* Effective scale, can be fractional */
Rotation rotation;
Bool wl_output_done;

View file

@ -134,7 +134,7 @@ xwl_screen_get_first_output(struct xwl_screen *xwl_screen)
struct xwl_output *xwl_output;
xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
if (xwl_output->x == 0 && xwl_output->y == 0)
if (xwl_output->logical_x == 0 && xwl_output->logical_y == 0)
return xwl_output;
}

View file

@ -308,7 +308,7 @@ xwlVidModeSetViewPort(ScreenPtr pScreen, int x, int y)
return FALSE;
/* Support only default viewport */
return (x == xwl_output->x && y == xwl_output->y);
return (x == xwl_output->logical_x && y == xwl_output->logical_y);
}
static Bool
@ -321,8 +321,8 @@ xwlVidModeGetViewPort(ScreenPtr pScreen, int *x, int *y)
if (xwl_output == NULL)
return FALSE;
*x = xwl_output->x;
*y = xwl_output->y;
*x = xwl_output->logical_x;
*y = xwl_output->logical_y;
return TRUE;
}

View file

@ -462,11 +462,11 @@ xwl_window_enable_viewport_for_output(struct xwl_window *xwl_window,
wl_fixed_from_int(width),
wl_fixed_from_int(height));
wp_viewport_set_destination(xwl_window->viewport,
xwl_output->width,
xwl_output->height);
xwl_output->logical_w,
xwl_output->logical_h);
xwl_window->viewport_scale_x = (float) width / xwl_output->width;
xwl_window->viewport_scale_y = (float) height / xwl_output->height;
xwl_window->viewport_scale_x = (float) width / xwl_output->logical_w;
xwl_window->viewport_scale_y = (float) height / xwl_output->logical_h;
xwl_window_set_input_region(xwl_window, wInputShape(xwl_window->toplevel));
}
@ -524,7 +524,7 @@ is_output_suitable_for_fullscreen(struct xwl_output *xwl_output)
if (xwl_output == NULL)
return FALSE;
if (xwl_output->width == 0 || xwl_output->height == 0)
if (xwl_output->logical_w == 0 || xwl_output->logical_h == 0)
return FALSE;
return TRUE;
@ -606,8 +606,8 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
if (!emulated_mode)
continue;
if (drawable->x == xwl_output->x &&
drawable->y == xwl_output->y &&
if (drawable->x == xwl_output->logical_x &&
drawable->y == xwl_output->logical_y &&
drawable->width == emulated_mode->width &&
drawable->height == emulated_mode->height) {