xwayland: pass the emulated mode by reference

When using xrandr emulation, the emulated mode is passed as a pointer to
the XRandR mode from the xwl_output associated with the X11 client.

In preparation for fullscreen mode, we want to be able to reuse that
code but use a separate emulated mode.

Simply change the internal API to pass a reference to the emulated mode.

This introduces no functional change.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Olivier Fourdan 2022-05-12 16:02:09 +02:00
parent f3e32cae51
commit 28e5faab28

View File

@ -270,7 +270,7 @@ window_get_client_toplevel(WindowPtr window)
static Bool static Bool
xwl_window_should_enable_viewport(struct xwl_window *xwl_window, xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
struct xwl_output **xwl_output_ret, struct xwl_output **xwl_output_ret,
struct xwl_emulated_mode **emulated_mode_ret) struct xwl_emulated_mode *emulated_mode_ret)
{ {
struct xwl_screen *xwl_screen = xwl_window->xwl_screen; struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
struct xwl_emulated_mode *emulated_mode; struct xwl_emulated_mode *emulated_mode;
@ -302,7 +302,7 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
drawable->width == emulated_mode->width && drawable->width == emulated_mode->width &&
drawable->height == emulated_mode->height) { drawable->height == emulated_mode->height) {
*emulated_mode_ret = emulated_mode; memcpy(emulated_mode_ret, emulated_mode, sizeof(struct xwl_emulated_mode));
*xwl_output_ret = xwl_output; *xwl_output_ret = xwl_output;
return TRUE; return TRUE;
} }
@ -320,7 +320,7 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
drawable->width == xwl_screen->width && drawable->width == xwl_screen->width &&
drawable->height == xwl_screen->height) { drawable->height == xwl_screen->height) {
*emulated_mode_ret = emulated_mode; memcpy(emulated_mode_ret, emulated_mode, sizeof(struct xwl_emulated_mode));
*xwl_output_ret = xwl_output; *xwl_output_ret = xwl_output;
return TRUE; return TRUE;
} }
@ -331,11 +331,11 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
void void
xwl_window_check_resolution_change_emulation(struct xwl_window *xwl_window) xwl_window_check_resolution_change_emulation(struct xwl_window *xwl_window)
{ {
struct xwl_emulated_mode *emulated_mode; struct xwl_emulated_mode emulated_mode;
struct xwl_output *xwl_output; struct xwl_output *xwl_output;
if (xwl_window_should_enable_viewport(xwl_window, &xwl_output, &emulated_mode)) if (xwl_window_should_enable_viewport(xwl_window, &xwl_output, &emulated_mode))
xwl_window_enable_viewport(xwl_window, xwl_output, emulated_mode); xwl_window_enable_viewport(xwl_window, xwl_output, &emulated_mode);
else if (xwl_window_has_viewport_enabled(xwl_window)) else if (xwl_window_has_viewport_enabled(xwl_window))
xwl_window_disable_viewport(xwl_window); xwl_window_disable_viewport(xwl_window);
} }