mirror of
https://github.com/glfw/glfw.git
synced 2024-11-14 06:23:50 +00:00
Wayland: Clean up enum value names
(cherry picked from commit 39f0e86228
)
This commit is contained in:
parent
e5d19c9fac
commit
95b35c43c2
@ -148,11 +148,11 @@ typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_st
|
|||||||
|
|
||||||
typedef enum _GLFWdecorationSideWayland
|
typedef enum _GLFWdecorationSideWayland
|
||||||
{
|
{
|
||||||
mainWindow,
|
GLFW_MAIN_WINDOW,
|
||||||
topDecoration,
|
GLFW_TOP_DECORATION,
|
||||||
leftDecoration,
|
GLFW_LEFT_DECORATION,
|
||||||
rightDecoration,
|
GLFW_RIGHT_DECORATION,
|
||||||
bottomDecoration,
|
GLFW_BOTTOM_DECORATION
|
||||||
} _GLFWdecorationSideWayland;
|
} _GLFWdecorationSideWayland;
|
||||||
|
|
||||||
typedef struct _GLFWdecorationWayland
|
typedef struct _GLFWdecorationWayland
|
||||||
|
@ -844,7 +844,7 @@ static void incrementCursorImage(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
_GLFWcursor* cursor;
|
_GLFWcursor* cursor;
|
||||||
|
|
||||||
if (!window || window->wl.decorations.focus != mainWindow)
|
if (!window || window->wl.decorations.focus != GLFW_MAIN_WINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cursor = window->wl.currentCursor;
|
cursor = window->wl.currentCursor;
|
||||||
@ -1075,22 +1075,22 @@ static _GLFWwindow* findWindowFromDecorationSurface(struct wl_surface* surface,
|
|||||||
{
|
{
|
||||||
if (surface == window->wl.decorations.top.surface)
|
if (surface == window->wl.decorations.top.surface)
|
||||||
{
|
{
|
||||||
*which = topDecoration;
|
*which = GLFW_TOP_DECORATION;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (surface == window->wl.decorations.left.surface)
|
if (surface == window->wl.decorations.left.surface)
|
||||||
{
|
{
|
||||||
*which = leftDecoration;
|
*which = GLFW_LEFT_DECORATION;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (surface == window->wl.decorations.right.surface)
|
if (surface == window->wl.decorations.right.surface)
|
||||||
{
|
{
|
||||||
*which = rightDecoration;
|
*which = GLFW_RIGHT_DECORATION;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (surface == window->wl.decorations.bottom.surface)
|
if (surface == window->wl.decorations.bottom.surface)
|
||||||
{
|
{
|
||||||
*which = bottomDecoration;
|
*which = GLFW_BOTTOM_DECORATION;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
window = window->next;
|
window = window->next;
|
||||||
@ -1112,7 +1112,7 @@ static void pointerHandleEnter(void* userData,
|
|||||||
if (wl_proxy_get_tag((struct wl_proxy*) surface) != &_glfw.wl.tag)
|
if (wl_proxy_get_tag((struct wl_proxy*) surface) != &_glfw.wl.tag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_GLFWdecorationSideWayland focus = mainWindow;
|
_GLFWdecorationSideWayland focus = GLFW_MAIN_WINDOW;
|
||||||
_GLFWwindow* window = wl_surface_get_user_data(surface);
|
_GLFWwindow* window = wl_surface_get_user_data(surface);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
@ -1222,29 +1222,29 @@ static void pointerHandleMotion(void* userData,
|
|||||||
|
|
||||||
switch (window->wl.decorations.focus)
|
switch (window->wl.decorations.focus)
|
||||||
{
|
{
|
||||||
case mainWindow:
|
case GLFW_MAIN_WINDOW:
|
||||||
_glfw.wl.cursorPreviousName = NULL;
|
_glfw.wl.cursorPreviousName = NULL;
|
||||||
_glfwInputCursorPos(window, x, y);
|
_glfwInputCursorPos(window, x, y);
|
||||||
return;
|
return;
|
||||||
case topDecoration:
|
case GLFW_TOP_DECORATION:
|
||||||
if (y < GLFW_BORDER_SIZE)
|
if (y < GLFW_BORDER_SIZE)
|
||||||
cursorName = "n-resize";
|
cursorName = "n-resize";
|
||||||
else
|
else
|
||||||
cursorName = "left_ptr";
|
cursorName = "left_ptr";
|
||||||
break;
|
break;
|
||||||
case leftDecoration:
|
case GLFW_LEFT_DECORATION:
|
||||||
if (y < GLFW_BORDER_SIZE)
|
if (y < GLFW_BORDER_SIZE)
|
||||||
cursorName = "nw-resize";
|
cursorName = "nw-resize";
|
||||||
else
|
else
|
||||||
cursorName = "w-resize";
|
cursorName = "w-resize";
|
||||||
break;
|
break;
|
||||||
case rightDecoration:
|
case GLFW_RIGHT_DECORATION:
|
||||||
if (y < GLFW_BORDER_SIZE)
|
if (y < GLFW_BORDER_SIZE)
|
||||||
cursorName = "ne-resize";
|
cursorName = "ne-resize";
|
||||||
else
|
else
|
||||||
cursorName = "e-resize";
|
cursorName = "e-resize";
|
||||||
break;
|
break;
|
||||||
case bottomDecoration:
|
case GLFW_BOTTOM_DECORATION:
|
||||||
if (x < GLFW_BORDER_SIZE)
|
if (x < GLFW_BORDER_SIZE)
|
||||||
cursorName = "sw-resize";
|
cursorName = "sw-resize";
|
||||||
else if (x > window->wl.width + GLFW_BORDER_SIZE)
|
else if (x > window->wl.width + GLFW_BORDER_SIZE)
|
||||||
@ -1277,9 +1277,9 @@ static void pointerHandleButton(void* userData,
|
|||||||
{
|
{
|
||||||
switch (window->wl.decorations.focus)
|
switch (window->wl.decorations.focus)
|
||||||
{
|
{
|
||||||
case mainWindow:
|
case GLFW_MAIN_WINDOW:
|
||||||
break;
|
break;
|
||||||
case topDecoration:
|
case GLFW_TOP_DECORATION:
|
||||||
if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
|
if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
|
||||||
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP;
|
||||||
else
|
else
|
||||||
@ -1287,19 +1287,19 @@ static void pointerHandleButton(void* userData,
|
|||||||
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 GLFW_LEFT_DECORATION:
|
||||||
if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
|
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 GLFW_RIGHT_DECORATION:
|
||||||
if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
|
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 GLFW_BOTTOM_DECORATION:
|
||||||
if (window->wl.cursorPosX < GLFW_BORDER_SIZE)
|
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_BORDER_SIZE)
|
else if (window->wl.cursorPosX > window->wl.width + GLFW_BORDER_SIZE)
|
||||||
@ -1319,7 +1319,8 @@ static void pointerHandleButton(void* userData,
|
|||||||
}
|
}
|
||||||
else if (button == BTN_RIGHT)
|
else if (button == BTN_RIGHT)
|
||||||
{
|
{
|
||||||
if (window->wl.decorations.focus != mainWindow && window->wl.xdg.toplevel)
|
if (window->wl.decorations.focus != GLFW_MAIN_WINDOW &&
|
||||||
|
window->wl.xdg.toplevel)
|
||||||
{
|
{
|
||||||
xdg_toplevel_show_window_menu(window->wl.xdg.toplevel,
|
xdg_toplevel_show_window_menu(window->wl.xdg.toplevel,
|
||||||
_glfw.wl.seat, serial,
|
_glfw.wl.seat, serial,
|
||||||
@ -1330,7 +1331,7 @@ static void pointerHandleButton(void* userData,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don’t pass the button to the user if it was related to a decoration.
|
// Don’t pass the button to the user if it was related to a decoration.
|
||||||
if (window->wl.decorations.focus != mainWindow)
|
if (window->wl.decorations.focus != GLFW_MAIN_WINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_glfw.wl.serial = serial;
|
_glfw.wl.serial = serial;
|
||||||
@ -2555,8 +2556,11 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
|||||||
|
|
||||||
// If we're not in the correct window just save the cursor
|
// If we're not in the correct window just save the cursor
|
||||||
// the next time the pointer enters the window the cursor will change
|
// the next time the pointer enters the window the cursor will change
|
||||||
if (window != _glfw.wl.pointerFocus || window->wl.decorations.focus != mainWindow)
|
if (window != _glfw.wl.pointerFocus ||
|
||||||
|
window->wl.decorations.focus != GLFW_MAIN_WINDOW)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Update pointer lock to match cursor mode
|
// Update pointer lock to match cursor mode
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
|
Loading…
Reference in New Issue
Block a user