xwayland: Return struct xwl_window * from ensure_surface_for_window
Preparation for later commits, no functional change intended. v2: * Leave register_damage call unchanged in this commit. (Olivier Fourdan) Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
This commit is contained in:
parent
972d5af537
commit
a562d01a18
|
@ -1225,7 +1225,7 @@ err_surf:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static struct xwl_window *
|
||||||
ensure_surface_for_window(WindowPtr window)
|
ensure_surface_for_window(WindowPtr window)
|
||||||
{
|
{
|
||||||
ScreenPtr screen = window->drawable.pScreen;
|
ScreenPtr screen = window->drawable.pScreen;
|
||||||
|
@ -1233,23 +1233,24 @@ ensure_surface_for_window(WindowPtr window)
|
||||||
struct xwl_window *xwl_window;
|
struct xwl_window *xwl_window;
|
||||||
WindowPtr toplevel;
|
WindowPtr toplevel;
|
||||||
|
|
||||||
if (xwl_window_from_window(window))
|
xwl_window = xwl_window_from_window(window);
|
||||||
return TRUE;
|
if (xwl_window)
|
||||||
|
return xwl_window;
|
||||||
|
|
||||||
xwl_screen = xwl_screen_get(screen);
|
xwl_screen = xwl_screen_get(screen);
|
||||||
|
|
||||||
if (xwl_screen->rootless) {
|
if (xwl_screen->rootless) {
|
||||||
if (window->redirectDraw != RedirectDrawManual)
|
if (window->redirectDraw != RedirectDrawManual)
|
||||||
return TRUE;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (window->parent)
|
if (window->parent)
|
||||||
return TRUE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
xwl_window = calloc(1, sizeof *xwl_window);
|
xwl_window = calloc(1, sizeof *xwl_window);
|
||||||
if (xwl_window == NULL)
|
if (xwl_window == NULL)
|
||||||
return FALSE;
|
return NULL;
|
||||||
|
|
||||||
xwl_window->xwl_screen = xwl_screen;
|
xwl_window->xwl_screen = xwl_screen;
|
||||||
xwl_window->toplevel = window;
|
xwl_window->toplevel = window;
|
||||||
|
@ -1312,11 +1313,11 @@ ensure_surface_for_window(WindowPtr window)
|
||||||
xwl_screen->tearing_control_manager, xwl_window->surface);
|
xwl_screen->tearing_control_manager, xwl_window->surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return xwl_window;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
free(xwl_window);
|
free(xwl_window);
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
@ -1325,6 +1326,7 @@ xwl_realize_window(WindowPtr window)
|
||||||
ScreenPtr screen = window->drawable.pScreen;
|
ScreenPtr screen = window->drawable.pScreen;
|
||||||
CompScreenPtr comp_screen = GetCompScreen(screen);
|
CompScreenPtr comp_screen = GetCompScreen(screen);
|
||||||
struct xwl_screen *xwl_screen;
|
struct xwl_screen *xwl_screen;
|
||||||
|
struct xwl_window *xwl_window;
|
||||||
Bool ret;
|
Bool ret;
|
||||||
|
|
||||||
xwl_screen = xwl_screen_get(screen);
|
xwl_screen = xwl_screen_get(screen);
|
||||||
|
@ -1366,7 +1368,11 @@ xwl_realize_window(WindowPtr window)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ensure_surface_for_window(window);
|
xwl_window = ensure_surface_for_window(window);
|
||||||
|
if (!xwl_window)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1539,15 +1545,14 @@ xwl_window_set_window_pixmap(WindowPtr window,
|
||||||
if (!RegionNotEmpty(&window->winSize))
|
if (!RegionNotEmpty(&window->winSize))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ensure_surface_for_window(window);
|
xwl_window = ensure_surface_for_window(window);
|
||||||
|
|
||||||
if (old_pixmap->drawable.width == pixmap->drawable.width &&
|
if (!xwl_window ||
|
||||||
old_pixmap->drawable.height == pixmap->drawable.height)
|
(old_pixmap->drawable.width == pixmap->drawable.width &&
|
||||||
|
old_pixmap->drawable.height == pixmap->drawable.height))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xwl_window = xwl_window_get(window);
|
xwl_window_buffers_dispose(xwl_window);
|
||||||
if (xwl_window)
|
|
||||||
xwl_window_buffers_dispose(xwl_window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
|
Loading…
Reference in New Issue