mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-22 18:28:52 -05:00
Wayland: Rename fallback decoration functions
We are soon going to have three kinds of decorations; XDG, libdecor and our last resort fallback ones.
This commit is contained in:
parent
0cd1916de3
commit
eb9c3bee71
|
@ -192,11 +192,11 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image)
|
|||
return buffer;
|
||||
}
|
||||
|
||||
static void createDecoration(_GLFWdecorationWayland* decoration,
|
||||
struct wl_surface* parent,
|
||||
struct wl_buffer* buffer,
|
||||
int x, int y,
|
||||
int width, int height)
|
||||
static void createFallbackDecoration(_GLFWdecorationWayland* decoration,
|
||||
struct wl_surface* parent,
|
||||
struct wl_buffer* buffer,
|
||||
int x, int y,
|
||||
int width, int height)
|
||||
{
|
||||
decoration->surface = wl_compositor_create_surface(_glfw.wl.compositor);
|
||||
decoration->subsurface =
|
||||
|
@ -215,7 +215,7 @@ static void createDecoration(_GLFWdecorationWayland* decoration,
|
|||
wl_region_destroy(region);
|
||||
}
|
||||
|
||||
static void createDecorations(_GLFWwindow* window)
|
||||
static void createFallbackDecorations(_GLFWwindow* window)
|
||||
{
|
||||
unsigned char data[] = { 224, 224, 224, 255 };
|
||||
const GLFWimage image = { 1, 1, data };
|
||||
|
@ -228,25 +228,25 @@ static void createDecorations(_GLFWwindow* window)
|
|||
if (!window->wl.decorations.buffer)
|
||||
return;
|
||||
|
||||
createDecoration(&window->wl.decorations.top, window->wl.surface,
|
||||
window->wl.decorations.buffer,
|
||||
0, -GLFW_CAPTION_HEIGHT,
|
||||
window->wl.width, GLFW_CAPTION_HEIGHT);
|
||||
createDecoration(&window->wl.decorations.left, window->wl.surface,
|
||||
window->wl.decorations.buffer,
|
||||
-GLFW_BORDER_SIZE, -GLFW_CAPTION_HEIGHT,
|
||||
GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
|
||||
createDecoration(&window->wl.decorations.right, window->wl.surface,
|
||||
window->wl.decorations.buffer,
|
||||
window->wl.width, -GLFW_CAPTION_HEIGHT,
|
||||
GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
|
||||
createDecoration(&window->wl.decorations.bottom, window->wl.surface,
|
||||
window->wl.decorations.buffer,
|
||||
-GLFW_BORDER_SIZE, window->wl.height,
|
||||
window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE);
|
||||
createFallbackDecoration(&window->wl.decorations.top, window->wl.surface,
|
||||
window->wl.decorations.buffer,
|
||||
0, -GLFW_CAPTION_HEIGHT,
|
||||
window->wl.width, GLFW_CAPTION_HEIGHT);
|
||||
createFallbackDecoration(&window->wl.decorations.left, window->wl.surface,
|
||||
window->wl.decorations.buffer,
|
||||
-GLFW_BORDER_SIZE, -GLFW_CAPTION_HEIGHT,
|
||||
GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
|
||||
createFallbackDecoration(&window->wl.decorations.right, window->wl.surface,
|
||||
window->wl.decorations.buffer,
|
||||
window->wl.width, -GLFW_CAPTION_HEIGHT,
|
||||
GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
|
||||
createFallbackDecoration(&window->wl.decorations.bottom, window->wl.surface,
|
||||
window->wl.decorations.buffer,
|
||||
-GLFW_BORDER_SIZE, window->wl.height,
|
||||
window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE);
|
||||
}
|
||||
|
||||
static void destroyDecoration(_GLFWdecorationWayland* decoration)
|
||||
static void destroyFallbackDecoration(_GLFWdecorationWayland* decoration)
|
||||
{
|
||||
if (decoration->subsurface)
|
||||
wl_subsurface_destroy(decoration->subsurface);
|
||||
|
@ -259,12 +259,12 @@ static void destroyDecoration(_GLFWdecorationWayland* decoration)
|
|||
decoration->viewport = NULL;
|
||||
}
|
||||
|
||||
static void destroyDecorations(_GLFWwindow* window)
|
||||
static void destroyFallbackDecorations(_GLFWwindow* window)
|
||||
{
|
||||
destroyDecoration(&window->wl.decorations.top);
|
||||
destroyDecoration(&window->wl.decorations.left);
|
||||
destroyDecoration(&window->wl.decorations.right);
|
||||
destroyDecoration(&window->wl.decorations.bottom);
|
||||
destroyFallbackDecoration(&window->wl.decorations.top);
|
||||
destroyFallbackDecoration(&window->wl.decorations.left);
|
||||
destroyFallbackDecoration(&window->wl.decorations.right);
|
||||
destroyFallbackDecoration(&window->wl.decorations.bottom);
|
||||
}
|
||||
|
||||
static void xdgDecorationHandleConfigure(void* userData,
|
||||
|
@ -276,7 +276,7 @@ static void xdgDecorationHandleConfigure(void* userData,
|
|||
window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
|
||||
|
||||
if (!window->wl.decorations.serverSide)
|
||||
createDecorations(window);
|
||||
createFallbackDecorations(window);
|
||||
}
|
||||
|
||||
static const struct zxdg_toplevel_decoration_v1_listener xdgDecorationListener =
|
||||
|
@ -432,7 +432,7 @@ static void acquireMonitor(_GLFWwindow* window)
|
|||
setIdleInhibitor(window, GLFW_TRUE);
|
||||
|
||||
if (!window->wl.decorations.serverSide)
|
||||
destroyDecorations(window);
|
||||
destroyFallbackDecorations(window);
|
||||
}
|
||||
|
||||
// Remove the window and restore the original video mode
|
||||
|
@ -445,7 +445,7 @@ static void releaseMonitor(_GLFWwindow* window)
|
|||
setIdleInhibitor(window, GLFW_FALSE);
|
||||
|
||||
if (!_glfw.wl.decorationManager)
|
||||
createDecorations(window);
|
||||
createFallbackDecorations(window);
|
||||
}
|
||||
|
||||
static void xdgToplevelHandleConfigure(void* userData,
|
||||
|
@ -629,7 +629,7 @@ static GLFWbool createXdgSurface(_GLFWwindow* window)
|
|||
else
|
||||
{
|
||||
window->wl.decorations.serverSide = GLFW_FALSE;
|
||||
createDecorations(window);
|
||||
createFallbackDecorations(window);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1818,7 +1818,7 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window)
|
|||
if (window->context.destroy)
|
||||
window->context.destroy(window);
|
||||
|
||||
destroyDecorations(window);
|
||||
destroyFallbackDecorations(window);
|
||||
if (window->wl.xdg.decoration)
|
||||
zxdg_toplevel_decoration_v1_destroy(window->wl.xdg.decoration);
|
||||
|
||||
|
@ -2136,9 +2136,9 @@ void _glfwSetWindowDecoratedWayland(_GLFWwindow* window, GLFWbool enabled)
|
|||
else
|
||||
{
|
||||
if (enabled)
|
||||
createDecorations(window);
|
||||
createFallbackDecorations(window);
|
||||
else
|
||||
destroyDecorations(window);
|
||||
destroyFallbackDecorations(window);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user