mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-26 20:28:49 -05:00
Wayland: Rename window frame size constants
This commit is contained in:
parent
75295f4878
commit
24cdc5afda
|
@ -198,11 +198,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,
|
||||||
|
|
|
@ -49,6 +49,8 @@
|
||||||
#include "wayland-pointer-constraints-unstable-v1-client-protocol.h"
|
#include "wayland-pointer-constraints-unstable-v1-client-protocol.h"
|
||||||
#include "wayland-idle-inhibit-unstable-v1-client-protocol.h"
|
#include "wayland-idle-inhibit-unstable-v1-client-protocol.h"
|
||||||
|
|
||||||
|
#define GLFW_BORDER_SIZE 4
|
||||||
|
#define GLFW_CAPTION_HEIGHT 24
|
||||||
|
|
||||||
static int createTmpfileCloexec(char* tmpname)
|
static int createTmpfileCloexec(char* tmpname)
|
||||||
{
|
{
|
||||||
|
@ -228,20 +230,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)
|
||||||
|
@ -312,23 +314,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1057,27 +1059,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";
|
||||||
|
@ -1109,27 +1111,27 @@ 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
|
||||||
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
|
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
|
||||||
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;
|
||||||
|
@ -1898,13 +1900,13 @@ void _glfwGetWindowFrameSizeWayland(_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