mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-09 07:18:05 +02:00
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:
parent
1a3c5e7827
commit
ce67045211
5 changed files with 43 additions and 43 deletions
|
|
@ -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 */
|
/* Apply the change from wl_output only if xdg-output is not supported */
|
||||||
if (!xwl_output->xdg_output) {
|
if (!xwl_output->xdg_output) {
|
||||||
xwl_output->x = x;
|
xwl_output->logical_x = x;
|
||||||
xwl_output->y = y;
|
xwl_output->logical_y = y;
|
||||||
}
|
}
|
||||||
xwl_output->rotation = wl_transform_to_xrandr(transform);
|
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 */
|
/* Apply the change from wl_output only if xdg-output is not supported */
|
||||||
if (!xwl_output->xdg_output) {
|
if (!xwl_output->xdg_output) {
|
||||||
xwl_output->width = width;
|
xwl_output->logical_w = width;
|
||||||
xwl_output->height = height;
|
xwl_output->logical_h = height;
|
||||||
}
|
}
|
||||||
xwl_output->refresh = refresh;
|
xwl_output->refresh = refresh;
|
||||||
}
|
}
|
||||||
|
|
@ -133,23 +133,23 @@ output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
|
||||||
static inline void
|
static inline void
|
||||||
output_get_new_size(struct xwl_output *xwl_output, int *width, int *height)
|
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. */
|
/* When we have xdg-output support the stored size is already rotated. */
|
||||||
if (xwl_output->xdg_output
|
if (xwl_output->xdg_output
|
||||||
|| (xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180))) {
|
|| (xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180))) {
|
||||||
output_width = xwl_output->width;
|
logical_width = xwl_output->logical_w;
|
||||||
output_height = xwl_output->height;
|
logical_height = xwl_output->logical_h;
|
||||||
} else {
|
} else {
|
||||||
output_width = xwl_output->height;
|
logical_width = xwl_output->logical_h;
|
||||||
output_height = xwl_output->width;
|
logical_height = xwl_output->logical_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*width < xwl_output->x + output_width)
|
if (*width < xwl_output->logical_x + logical_width)
|
||||||
*width = xwl_output->x + output_width;
|
*width = xwl_output->logical_x + logical_width;
|
||||||
|
|
||||||
if (*height < xwl_output->y + output_height)
|
if (*height < xwl_output->logical_y + logical_height)
|
||||||
*height = xwl_output->y + output_height;
|
*height = xwl_output->logical_y + logical_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -446,8 +446,8 @@ xwl_output_randr_emu_prop(struct xwl_screen *xwl_screen, ClientPtr client,
|
||||||
if (!emulated_mode)
|
if (!emulated_mode)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
prop->rects[index][0] = xwl_output->x;
|
prop->rects[index][0] = xwl_output->logical_x;
|
||||||
prop->rects[index][1] = xwl_output->y;
|
prop->rects[index][1] = xwl_output->logical_y;
|
||||||
prop->rects[index][2] = emulated_mode->width;
|
prop->rects[index][2] = emulated_mode->width;
|
||||||
prop->rects[index][3] = emulated_mode->height;
|
prop->rects[index][3] = emulated_mode->height;
|
||||||
index++;
|
index++;
|
||||||
|
|
@ -629,8 +629,7 @@ apply_output_change(struct xwl_output *xwl_output)
|
||||||
{
|
{
|
||||||
struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
|
struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
|
||||||
struct xwl_output *it;
|
struct xwl_output *it;
|
||||||
int mode_width, mode_height, count;
|
int logical_width, logical_height, count, has_this_output = 0;
|
||||||
int width = 0, height = 0, has_this_output = 0;
|
|
||||||
RRModePtr *randr_modes;
|
RRModePtr *randr_modes;
|
||||||
|
|
||||||
/* Clear out the "done" received flags */
|
/* Clear out the "done" received flags */
|
||||||
|
|
@ -642,18 +641,18 @@ apply_output_change(struct xwl_output *xwl_output)
|
||||||
*/
|
*/
|
||||||
if (xwl_output->xdg_output == NULL
|
if (xwl_output->xdg_output == NULL
|
||||||
|| xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180)) {
|
|| xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180)) {
|
||||||
mode_width = xwl_output->width;
|
logical_width = xwl_output->logical_w;
|
||||||
mode_height = xwl_output->height;
|
logical_height = xwl_output->logical_h;
|
||||||
} else {
|
} else {
|
||||||
mode_width = xwl_output->height;
|
logical_width = xwl_output->logical_h;
|
||||||
mode_height = xwl_output->width;
|
logical_height = xwl_output->logical_w;
|
||||||
}
|
}
|
||||||
if (xwl_output->randr_output) {
|
if (xwl_output->randr_output) {
|
||||||
/* Build a fresh modes array using the current refresh rate */
|
/* 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);
|
RROutputSetModes(xwl_output->randr_output, randr_modes, count, 1);
|
||||||
RRCrtcNotify(xwl_output->randr_crtc, randr_modes[0],
|
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);
|
xwl_output->rotation, NULL, 1, &xwl_output->randr_output);
|
||||||
/* RROutputSetModes takes ownership of the passed in modes, so we only
|
/* RROutputSetModes takes ownership of the passed in modes, so we only
|
||||||
* have to free the pointer array.
|
* have to free the pointer array.
|
||||||
|
|
@ -661,6 +660,7 @@ apply_output_change(struct xwl_output *xwl_output)
|
||||||
free(randr_modes);
|
free(randr_modes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logical_width = logical_height = 0;
|
||||||
xorg_list_for_each_entry(it, &xwl_screen->output_list, link) {
|
xorg_list_for_each_entry(it, &xwl_screen->output_list, link) {
|
||||||
/* output done event is sent even when some property
|
/* output done event is sent even when some property
|
||||||
* of output is changed. That means that we may already
|
* 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)
|
if (it == xwl_output)
|
||||||
has_this_output = 1;
|
has_this_output = 1;
|
||||||
|
|
||||||
output_get_new_size(it, &width, &height);
|
output_get_new_size(it, &logical_width, &logical_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_this_output) {
|
if (!has_this_output) {
|
||||||
xorg_list_append(&xwl_output->link, &xwl_screen->output_list);
|
xorg_list_append(&xwl_output->link, &xwl_screen->output_list);
|
||||||
|
|
||||||
/* we did not check this output for new screen size, do it now */
|
/* 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;
|
--xwl_screen->expecting_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xwl_screen->fixed_output == NULL)
|
if (xwl_screen->fixed_output == NULL)
|
||||||
update_screen_size(xwl_screen, width, height);
|
update_screen_size(xwl_screen, logical_width, logical_height);
|
||||||
else
|
else
|
||||||
RRTellChanged(xwl_screen->screen);
|
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;
|
struct xwl_output *xwl_output = data;
|
||||||
|
|
||||||
xwl_output->x = x;
|
xwl_output->logical_x = x;
|
||||||
xwl_output->y = y;
|
xwl_output->logical_y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
struct xwl_output *xwl_output = data;
|
||||||
|
|
||||||
xwl_output->width = width;
|
xwl_output->logical_w = width;
|
||||||
xwl_output->height = height;
|
xwl_output->logical_h = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,8 @@ struct xwl_output {
|
||||||
struct wl_output *output;
|
struct wl_output *output;
|
||||||
struct zxdg_output_v1 *xdg_output;
|
struct zxdg_output_v1 *xdg_output;
|
||||||
uint32_t server_output_id;
|
uint32_t server_output_id;
|
||||||
int32_t x, y, width, height, refresh, scale;
|
int32_t logical_x, logical_y, logical_w, logical_h;
|
||||||
int32_t mode_width, mode_height;
|
int32_t mode_width, mode_height, refresh, scale;
|
||||||
double xscale; /* Effective scale, can be fractional */
|
double xscale; /* Effective scale, can be fractional */
|
||||||
Rotation rotation;
|
Rotation rotation;
|
||||||
Bool wl_output_done;
|
Bool wl_output_done;
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ xwl_screen_get_first_output(struct xwl_screen *xwl_screen)
|
||||||
struct xwl_output *xwl_output;
|
struct xwl_output *xwl_output;
|
||||||
|
|
||||||
xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
|
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;
|
return xwl_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,7 @@ xwlVidModeSetViewPort(ScreenPtr pScreen, int x, int y)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Support only default viewport */
|
/* 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
|
static Bool
|
||||||
|
|
@ -321,8 +321,8 @@ xwlVidModeGetViewPort(ScreenPtr pScreen, int *x, int *y)
|
||||||
if (xwl_output == NULL)
|
if (xwl_output == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
*x = xwl_output->x;
|
*x = xwl_output->logical_x;
|
||||||
*y = xwl_output->y;
|
*y = xwl_output->logical_y;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -462,11 +462,11 @@ xwl_window_enable_viewport_for_output(struct xwl_window *xwl_window,
|
||||||
wl_fixed_from_int(width),
|
wl_fixed_from_int(width),
|
||||||
wl_fixed_from_int(height));
|
wl_fixed_from_int(height));
|
||||||
wp_viewport_set_destination(xwl_window->viewport,
|
wp_viewport_set_destination(xwl_window->viewport,
|
||||||
xwl_output->width,
|
xwl_output->logical_w,
|
||||||
xwl_output->height);
|
xwl_output->logical_h);
|
||||||
|
|
||||||
xwl_window->viewport_scale_x = (float) width / xwl_output->width;
|
xwl_window->viewport_scale_x = (float) width / xwl_output->logical_w;
|
||||||
xwl_window->viewport_scale_y = (float) height / xwl_output->height;
|
xwl_window->viewport_scale_y = (float) height / xwl_output->logical_h;
|
||||||
xwl_window_set_input_region(xwl_window, wInputShape(xwl_window->toplevel));
|
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)
|
if (xwl_output == NULL)
|
||||||
return FALSE;
|
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 FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -606,8 +606,8 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
|
||||||
if (!emulated_mode)
|
if (!emulated_mode)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (drawable->x == xwl_output->x &&
|
if (drawable->x == xwl_output->logical_x &&
|
||||||
drawable->y == xwl_output->y &&
|
drawable->y == xwl_output->logical_y &&
|
||||||
drawable->width == emulated_mode->width &&
|
drawable->width == emulated_mode->width &&
|
||||||
drawable->height == emulated_mode->height) {
|
drawable->height == emulated_mode->height) {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue