summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorRoman Gilg <subdiff@gmail.com>2020-01-03 17:12:14 +0100
committerHans de Goede <hdegoede@redhat.com>2020-02-23 18:04:49 +0100
commit948e02872feb641a176b3af82b6ef1201c97bb16 (patch)
tree933331d5662d161186ff99dda468ce38acb7b74c /hw
parentded89300c1dd541f59fe6e93c5c69d7fe7088244 (diff)
xwayland: Reuse viewport instead of recreating
When a viewport is already created we can reuse this object instead of destroying it and getting a new one for updating the source rectangle and destination size. Signed-off-by: Roman Gilg <subdiff@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Olivier Fourdan <ofourdan@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/xwayland/xwayland-window.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index 89106d0a3..787e863b1 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -217,17 +217,13 @@ xwl_window_enable_viewport(struct xwl_window *xwl_window,
struct xwl_output *xwl_output,
struct xwl_emulated_mode *emulated_mode)
{
- /* If necessary disable old viewport to apply new settings */
- if (xwl_window_has_viewport_enabled(xwl_window))
- xwl_window_disable_viewport(xwl_window);
-
- DebugF("XWAYLAND: enabling viewport %dx%d -> %dx%d\n",
- emulated_mode->width, emulated_mode->height,
- xwl_output->width, xwl_output->height);
-
- xwl_window->viewport =
- wp_viewporter_get_viewport(xwl_window->xwl_screen->viewporter,
- xwl_window->surface);
+ if (!xwl_window_has_viewport_enabled(xwl_window)) {
+ DebugF("XWAYLAND: enabling viewport %dx%d -> %dx%d\n",
+ emulated_mode->width, emulated_mode->height,
+ xwl_output->width, xwl_output->height);
+ xwl_window->viewport = wp_viewporter_get_viewport(xwl_window->xwl_screen->viewporter,
+ xwl_window->surface);
+ }
wp_viewport_set_source(xwl_window->viewport,
wl_fixed_from_int(0),