|
|
|
@ -247,6 +247,8 @@ static void createFallbackDecorations(_GLFWwindow* window) |
|
|
|
|
window->wl.fallback.buffer, |
|
|
|
|
-GLFW_BORDER_SIZE, window->wl.height, |
|
|
|
|
window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE); |
|
|
|
|
|
|
|
|
|
window->wl.fallback.decorations = GLFW_TRUE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void destroyFallbackDecoration(_GLFWdecorationWayland* decoration) |
|
|
|
@ -264,6 +266,8 @@ static void destroyFallbackDecoration(_GLFWdecorationWayland* decoration) |
|
|
|
|
|
|
|
|
|
static void destroyFallbackDecorations(_GLFWwindow* window) |
|
|
|
|
{ |
|
|
|
|
window->wl.fallback.decorations = GLFW_FALSE; |
|
|
|
|
|
|
|
|
|
destroyFallbackDecoration(&window->wl.fallback.top); |
|
|
|
|
destroyFallbackDecoration(&window->wl.fallback.left); |
|
|
|
|
destroyFallbackDecoration(&window->wl.fallback.right); |
|
|
|
@ -325,29 +329,33 @@ static void resizeWindow(_GLFWwindow* window) |
|
|
|
|
{ |
|
|
|
|
resizeFramebuffer(window); |
|
|
|
|
|
|
|
|
|
if (!window->wl.fallback.top.surface) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
if (window->wl.fallback.decorations) |
|
|
|
|
{ |
|
|
|
|
wp_viewport_set_destination(window->wl.fallback.top.viewport, |
|
|
|
|
window->wl.width, GLFW_CAPTION_HEIGHT); |
|
|
|
|
window->wl.width, |
|
|
|
|
GLFW_CAPTION_HEIGHT); |
|
|
|
|
wl_surface_commit(window->wl.fallback.top.surface); |
|
|
|
|
|
|
|
|
|
wp_viewport_set_destination(window->wl.fallback.left.viewport, |
|
|
|
|
GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); |
|
|
|
|
GLFW_BORDER_SIZE, |
|
|
|
|
window->wl.height + GLFW_CAPTION_HEIGHT); |
|
|
|
|
wl_surface_commit(window->wl.fallback.left.surface); |
|
|
|
|
|
|
|
|
|
wl_subsurface_set_position(window->wl.fallback.right.subsurface, |
|
|
|
|
window->wl.width, -GLFW_CAPTION_HEIGHT); |
|
|
|
|
wp_viewport_set_destination(window->wl.fallback.right.viewport, |
|
|
|
|
GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); |
|
|
|
|
GLFW_BORDER_SIZE, |
|
|
|
|
window->wl.height + GLFW_CAPTION_HEIGHT); |
|
|
|
|
wl_surface_commit(window->wl.fallback.right.surface); |
|
|
|
|
|
|
|
|
|
wl_subsurface_set_position(window->wl.fallback.bottom.subsurface, |
|
|
|
|
-GLFW_BORDER_SIZE, window->wl.height); |
|
|
|
|
wp_viewport_set_destination(window->wl.fallback.bottom.viewport, |
|
|
|
|
window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE); |
|
|
|
|
window->wl.width + GLFW_BORDER_SIZE * 2, |
|
|
|
|
GLFW_BORDER_SIZE); |
|
|
|
|
wl_surface_commit(window->wl.fallback.bottom.surface); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void _glfwUpdateContentScaleWayland(_GLFWwindow* window) |
|
|
|
|
{ |
|
|
|
@ -466,7 +474,7 @@ static void acquireMonitor(_GLFWwindow* window) |
|
|
|
|
|
|
|
|
|
setIdleInhibitor(window, GLFW_TRUE); |
|
|
|
|
|
|
|
|
|
if (window->wl.fallback.top.surface) |
|
|
|
|
if (window->wl.fallback.decorations) |
|
|
|
|
destroyFallbackDecorations(window); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -522,7 +530,7 @@ static void xdgToplevelHandleConfigure(void* userData, |
|
|
|
|
|
|
|
|
|
if (width && height) |
|
|
|
|
{ |
|
|
|
|
if (window->wl.fallback.top.surface) |
|
|
|
|
if (window->wl.fallback.decorations) |
|
|
|
|
{ |
|
|
|
|
window->wl.pending.width = _glfw_max(0, width - GLFW_BORDER_SIZE * 2); |
|
|
|
|
window->wl.pending.height = |
|
|
|
@ -882,7 +890,7 @@ static GLFWbool createXdgShellObjects(_GLFWwindow* window) |
|
|
|
|
int minwidth = window->minwidth; |
|
|
|
|
int minheight = window->minheight; |
|
|
|
|
|
|
|
|
|
if (window->wl.fallback.top.surface) |
|
|
|
|
if (window->wl.fallback.decorations) |
|
|
|
|
{ |
|
|
|
|
minwidth += GLFW_BORDER_SIZE * 2; |
|
|
|
|
minheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE; |
|
|
|
@ -896,7 +904,7 @@ static GLFWbool createXdgShellObjects(_GLFWwindow* window) |
|
|
|
|
int maxwidth = window->maxwidth; |
|
|
|
|
int maxheight = window->maxheight; |
|
|
|
|
|
|
|
|
|
if (window->wl.fallback.top.surface) |
|
|
|
|
if (window->wl.fallback.decorations) |
|
|
|
|
{ |
|
|
|
|
maxwidth += GLFW_BORDER_SIZE * 2; |
|
|
|
|
maxheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE; |
|
|
|
@ -1276,9 +1284,9 @@ static void pointerHandleEnter(void* userData, |
|
|
|
|
|
|
|
|
|
_GLFWwindow* window = wl_surface_get_user_data(surface); |
|
|
|
|
|
|
|
|
|
if (surface == window->wl.surface) |
|
|
|
|
window->wl.hovered = GLFW_TRUE; |
|
|
|
|
else if (surface == window->wl.fallback.top.surface) |
|
|
|
|
if (window->wl.fallback.decorations) |
|
|
|
|
{ |
|
|
|
|
if (surface == window->wl.fallback.top.surface) |
|
|
|
|
window->wl.fallback.focus = GLFW_TOP_DECORATION; |
|
|
|
|
else if (surface == window->wl.fallback.left.surface) |
|
|
|
|
window->wl.fallback.focus = GLFW_LEFT_DECORATION; |
|
|
|
@ -1286,13 +1294,15 @@ static void pointerHandleEnter(void* userData, |
|
|
|
|
window->wl.fallback.focus = GLFW_RIGHT_DECORATION; |
|
|
|
|
else if (surface == window->wl.fallback.bottom.surface) |
|
|
|
|
window->wl.fallback.focus = GLFW_BOTTOM_DECORATION; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_glfw.wl.serial = serial; |
|
|
|
|
_glfw.wl.pointerEnterSerial = serial; |
|
|
|
|
_glfw.wl.pointerFocus = window; |
|
|
|
|
|
|
|
|
|
if (window->wl.hovered) |
|
|
|
|
if (surface == window->wl.surface) |
|
|
|
|
{ |
|
|
|
|
window->wl.hovered = GLFW_TRUE; |
|
|
|
|
_glfwSetCursorWayland(window, window->wl.currentCursor); |
|
|
|
|
_glfwInputCursorEnter(window, GLFW_TRUE); |
|
|
|
|
} |
|
|
|
@ -1349,6 +1359,8 @@ static void pointerHandleMotion(void* userData, |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (window->wl.fallback.decorations) |
|
|
|
|
{ |
|
|
|
|
const char* cursorName = NULL; |
|
|
|
|
|
|
|
|
|
switch (window->wl.fallback.focus) |
|
|
|
@ -1422,6 +1434,7 @@ static void pointerHandleMotion(void* userData, |
|
|
|
|
_glfw.wl.cursorPreviousName = cursorName; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void pointerHandleButton(void* userData, |
|
|
|
|
struct wl_pointer* pointer, |
|
|
|
@ -1445,6 +1458,8 @@ static void pointerHandleButton(void* userData, |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (window->wl.fallback.decorations) |
|
|
|
|
{ |
|
|
|
|
if (button == BTN_LEFT) |
|
|
|
|
{ |
|
|
|
|
uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE; |
|
|
|
@ -1495,6 +1510,7 @@ static void pointerHandleButton(void* userData, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void pointerHandleAxis(void* userData, |
|
|
|
|
struct wl_pointer* pointer, |
|
|
|
@ -2199,7 +2215,7 @@ void _glfwSetWindowSizeLimitsWayland(_GLFWwindow* window, |
|
|
|
|
minwidth = minheight = 0; |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (window->wl.fallback.top.surface) |
|
|
|
|
if (window->wl.fallback.decorations) |
|
|
|
|
{ |
|
|
|
|
minwidth += GLFW_BORDER_SIZE * 2; |
|
|
|
|
minheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE; |
|
|
|
@ -2210,7 +2226,7 @@ void _glfwSetWindowSizeLimitsWayland(_GLFWwindow* window, |
|
|
|
|
maxwidth = maxheight = 0; |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (window->wl.fallback.top.surface) |
|
|
|
|
if (window->wl.fallback.decorations) |
|
|
|
|
{ |
|
|
|
|
maxwidth += GLFW_BORDER_SIZE * 2; |
|
|
|
|
maxheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE; |
|
|
|
@ -2273,7 +2289,7 @@ void _glfwGetWindowFrameSizeWayland(_GLFWwindow* window, |
|
|
|
|
int* left, int* top, |
|
|
|
|
int* right, int* bottom) |
|
|
|
|
{ |
|
|
|
|
if (window->wl.fallback.top.surface) |
|
|
|
|
if (window->wl.fallback.decorations) |
|
|
|
|
{ |
|
|
|
|
if (top) |
|
|
|
|
*top = GLFW_CAPTION_HEIGHT; |
|
|
|
|