mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Wayland: Rename window frame size constants
(cherry picked from commit 24cdc5afda
)
This commit is contained in:
parent
941744a59a
commit
4ba1208239
@ -146,11 +146,6 @@ typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_st
|
|||||||
#define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status
|
#define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status
|
||||||
#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym
|
#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym
|
||||||
|
|
||||||
#define _GLFW_DECORATION_WIDTH 4
|
|
||||||
#define _GLFW_DECORATION_TOP 24
|
|
||||||
#define _GLFW_DECORATION_VERTICAL (_GLFW_DECORATION_TOP + _GLFW_DECORATION_WIDTH)
|
|
||||||
#define _GLFW_DECORATION_HORIZONTAL (2 * _GLFW_DECORATION_WIDTH)
|
|
||||||
|
|
||||||
typedef enum _GLFWdecorationSideWayland
|
typedef enum _GLFWdecorationSideWayland
|
||||||
{
|
{
|
||||||
mainWindow,
|
mainWindow,
|
||||||
|
@ -43,6 +43,9 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#define GLFW_BORDER_SIZE 4
|
||||||
|
#define GLFW_CAPTION_HEIGHT 24
|
||||||
|
|
||||||
static int createTmpfileCloexec(char* tmpname)
|
static int createTmpfileCloexec(char* tmpname)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
@ -269,20 +272,20 @@ static void createDecorations(_GLFWwindow* window)
|
|||||||
|
|
||||||
createDecoration(&window->wl.decorations.top, window->wl.surface,
|
createDecoration(&window->wl.decorations.top, window->wl.surface,
|
||||||
window->wl.decorations.buffer,
|
window->wl.decorations.buffer,
|
||||||
0, -_GLFW_DECORATION_TOP,
|
0, -GLFW_CAPTION_HEIGHT,
|
||||||
window->wl.width, _GLFW_DECORATION_TOP);
|
window->wl.width, GLFW_CAPTION_HEIGHT);
|
||||||
createDecoration(&window->wl.decorations.left, window->wl.surface,
|
createDecoration(&window->wl.decorations.left, window->wl.surface,
|
||||||
window->wl.decorations.buffer,
|
window->wl.decorations.buffer,
|
||||||
-_GLFW_DECORATION_WIDTH, -_GLFW_DECORATION_TOP,
|
-GLFW_BORDER_SIZE, -GLFW_CAPTION_HEIGHT,
|
||||||
_GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP);
|
GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
|
||||||
createDecoration(&window->wl.decorations.right, window->wl.surface,
|
createDecoration(&window->wl.decorations.right, window->wl.surface,
|
||||||
window->wl.decorations.buffer,
|
window->wl.decorations.buffer,
|
||||||
window->wl.width, -_GLFW_DECORATION_TOP,
|
window->wl.width, -GLFW_CAPTION_HEIGHT,
|
||||||
_GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP);
|
GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
|
||||||
createDecoration(&window->wl.decorations.bottom, window->wl.surface,
|
createDecoration(&window->wl.decorations.bottom, window->wl.surface,
|
||||||
window->wl.decorations.buffer,
|
window->wl.decorations.buffer,
|
||||||
-_GLFW_DECORATION_WIDTH, window->wl.height,
|
-GLFW_BORDER_SIZE, window->wl.height,
|
||||||
window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH);
|
window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroyDecoration(_GLFWdecorationWayland* decoration)
|
static void destroyDecoration(_GLFWdecorationWayland* decoration)
|
||||||
@ -353,23 +356,23 @@ static void resizeWindow(_GLFWwindow* window)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
wp_viewport_set_destination(window->wl.decorations.top.viewport,
|
wp_viewport_set_destination(window->wl.decorations.top.viewport,
|
||||||
window->wl.width, _GLFW_DECORATION_TOP);
|
window->wl.width, GLFW_CAPTION_HEIGHT);
|
||||||
wl_surface_commit(window->wl.decorations.top.surface);
|
wl_surface_commit(window->wl.decorations.top.surface);
|
||||||
|
|
||||||
wp_viewport_set_destination(window->wl.decorations.left.viewport,
|
wp_viewport_set_destination(window->wl.decorations.left.viewport,
|
||||||
_GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP);
|
GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
|
||||||
wl_surface_commit(window->wl.decorations.left.surface);
|
wl_surface_commit(window->wl.decorations.left.surface);
|
||||||
|
|
||||||
wl_subsurface_set_position(window->wl.decorations.right.subsurface,
|
wl_subsurface_set_position(window->wl.decorations.right.subsurface,
|
||||||
window->wl.width, -_GLFW_DECORATION_TOP);
|
window->wl.width, -GLFW_CAPTION_HEIGHT);
|
||||||
wp_viewport_set_destination(window->wl.decorations.right.viewport,
|
wp_viewport_set_destination(window->wl.decorations.right.viewport,
|
||||||
_GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP);
|
GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
|
||||||
wl_surface_commit(window->wl.decorations.right.surface);
|
wl_surface_commit(window->wl.decorations.right.surface);
|
||||||
|
|
||||||
wl_subsurface_set_position(window->wl.decorations.bottom.subsurface,
|
wl_subsurface_set_position(window->wl.decorations.bottom.subsurface,
|
||||||
-_GLFW_DECORATION_WIDTH, window->wl.height);
|
-GLFW_BORDER_SIZE, window->wl.height);
|
||||||
wp_viewport_set_destination(window->wl.decorations.bottom.viewport,
|
wp_viewport_set_destination(window->wl.decorations.bottom.viewport,
|
||||||
window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH);
|
window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE);
|
||||||
wl_surface_commit(window->wl.decorations.bottom.surface);
|
wl_surface_commit(window->wl.decorations.bottom.surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1099,27 +1102,27 @@ static void pointerHandleMotion(void* userData,
|
|||||||
_glfw.wl.cursorPreviousName = NULL;
|
_glfw.wl.cursorPreviousName = NULL;
|
||||||
return;
|
return;
|
||||||
case topDecoration:
|
case topDecoration:
|
||||||
if (y < _GLFW_DECORATION_WIDTH)
|
if (y < GLFW_BORDER_SIZE)
|
||||||
cursorName = "n-resize";
|
cursorName = "n-resize";
|
||||||
else
|
else
|
||||||
cursorName = "left_ptr";
|
cursorName = "left_ptr";
|
||||||
break;
|
break;
|
||||||
case leftDecoration:
|
case leftDecoration:
|
||||||
if (y < _GLFW_DECORATION_WIDTH)
|
if (y < GLFW_BORDER_SIZE)
|
||||||
cursorName = "nw-resize";
|
cursorName = "nw-resize";
|
||||||
else
|
else
|
||||||
cursorName = "w-resize";
|
cursorName = "w-resize";
|
||||||
break;
|
break;
|
||||||
case rightDecoration:
|
case rightDecoration:
|
||||||
if (y < _GLFW_DECORATION_WIDTH)
|
if (y < GLFW_BORDER_SIZE)
|
||||||
cursorName = "ne-resize";
|
cursorName = "ne-resize";
|
||||||
else
|
else
|
||||||
cursorName = "e-resize";
|
cursorName = "e-resize";
|
||||||
break;
|
break;
|
||||||
case bottomDecoration:
|
case bottomDecoration:
|
||||||
if (x < _GLFW_DECORATION_WIDTH)
|
if (x < GLFW_BORDER_SIZE)
|
||||||
cursorName = "sw-resize";
|
cursorName = "sw-resize";
|
||||||
else if (x > window->wl.width + _GLFW_DECORATION_WIDTH)
|
else if (x > window->wl.width + GLFW_BORDER_SIZE)
|
||||||
cursorName = "se-resize";
|
cursorName = "se-resize";
|
||||||
else
|
else
|
||||||
cursorName = "s-resize";
|
cursorName = "s-resize";
|
||||||
@ -1152,7 +1155,7 @@ static void pointerHandleButton(void* userData,
|
|||||||
case mainWindow:
|
case mainWindow:
|
||||||
break;
|
break;
|
||||||
case topDecoration:
|
case topDecoration:
|
||||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
|
||||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1160,21 +1163,21 @@ static void pointerHandleButton(void* userData,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case leftDecoration:
|
case leftDecoration:
|
||||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
|
||||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT;
|
||||||
else
|
else
|
||||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_LEFT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_LEFT;
|
||||||
break;
|
break;
|
||||||
case rightDecoration:
|
case rightDecoration:
|
||||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
|
||||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT;
|
||||||
else
|
else
|
||||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_RIGHT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_RIGHT;
|
||||||
break;
|
break;
|
||||||
case bottomDecoration:
|
case bottomDecoration:
|
||||||
if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH)
|
if (window->wl.cursorPosX < GLFW_BORDER_SIZE)
|
||||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT;
|
||||||
else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH)
|
else if (window->wl.cursorPosX > window->wl.width + GLFW_BORDER_SIZE)
|
||||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT;
|
||||||
else
|
else
|
||||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM;
|
||||||
@ -1961,13 +1964,13 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
|
|||||||
if (window->decorated && !window->monitor && !window->wl.decorations.serverSide)
|
if (window->decorated && !window->monitor && !window->wl.decorations.serverSide)
|
||||||
{
|
{
|
||||||
if (top)
|
if (top)
|
||||||
*top = _GLFW_DECORATION_TOP;
|
*top = GLFW_CAPTION_HEIGHT;
|
||||||
if (left)
|
if (left)
|
||||||
*left = _GLFW_DECORATION_WIDTH;
|
*left = GLFW_BORDER_SIZE;
|
||||||
if (right)
|
if (right)
|
||||||
*right = _GLFW_DECORATION_WIDTH;
|
*right = GLFW_BORDER_SIZE;
|
||||||
if (bottom)
|
if (bottom)
|
||||||
*bottom = _GLFW_DECORATION_WIDTH;
|
*bottom = GLFW_BORDER_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user