mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Wayland: Remove fallback decoration edge enum
This commit is contained in:
parent
a268b4b3a4
commit
72164e6921
@ -323,14 +323,6 @@ typedef void (* PFN_libdecor_state_free)(struct libdecor_state*);
|
|||||||
#define libdecor_state_new _glfw.wl.libdecor.libdecor_state_new_
|
#define libdecor_state_new _glfw.wl.libdecor.libdecor_state_new_
|
||||||
#define libdecor_state_free _glfw.wl.libdecor.libdecor_state_free_
|
#define libdecor_state_free _glfw.wl.libdecor.libdecor_state_free_
|
||||||
|
|
||||||
typedef enum _GLFWdecorationSideWayland
|
|
||||||
{
|
|
||||||
GLFW_TOP_DECORATION,
|
|
||||||
GLFW_LEFT_DECORATION,
|
|
||||||
GLFW_RIGHT_DECORATION,
|
|
||||||
GLFW_BOTTOM_DECORATION
|
|
||||||
} _GLFWdecorationSideWayland;
|
|
||||||
|
|
||||||
typedef struct _GLFWdecorationWayland
|
typedef struct _GLFWdecorationWayland
|
||||||
{
|
{
|
||||||
struct wl_surface* surface;
|
struct wl_surface* surface;
|
||||||
@ -413,7 +405,7 @@ typedef struct _GLFWwindowWayland
|
|||||||
GLFWbool decorations;
|
GLFWbool decorations;
|
||||||
struct wl_buffer* buffer;
|
struct wl_buffer* buffer;
|
||||||
_GLFWdecorationWayland top, left, right, bottom;
|
_GLFWdecorationWayland top, left, right, bottom;
|
||||||
_GLFWdecorationSideWayland focus;
|
struct wl_surface* focus;
|
||||||
} fallback;
|
} fallback;
|
||||||
} _GLFWwindowWayland;
|
} _GLFWwindowWayland;
|
||||||
|
|
||||||
|
@ -1284,18 +1284,6 @@ static void pointerHandleEnter(void* userData,
|
|||||||
|
|
||||||
_GLFWwindow* window = wl_surface_get_user_data(surface);
|
_GLFWwindow* window = wl_surface_get_user_data(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;
|
|
||||||
else if (surface == window->wl.fallback.right.surface)
|
|
||||||
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.serial = serial;
|
||||||
_glfw.wl.pointerEnterSerial = serial;
|
_glfw.wl.pointerEnterSerial = serial;
|
||||||
_glfw.wl.pointerFocus = window;
|
_glfw.wl.pointerFocus = window;
|
||||||
@ -1306,6 +1294,11 @@ static void pointerHandleEnter(void* userData,
|
|||||||
_glfwSetCursorWayland(window, window->wl.currentCursor);
|
_glfwSetCursorWayland(window, window->wl.currentCursor);
|
||||||
_glfwInputCursorEnter(window, GLFW_TRUE);
|
_glfwInputCursorEnter(window, GLFW_TRUE);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (window->wl.fallback.decorations)
|
||||||
|
window->wl.fallback.focus = surface;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pointerHandleLeave(void* userData,
|
static void pointerHandleLeave(void* userData,
|
||||||
@ -1332,6 +1325,11 @@ static void pointerHandleLeave(void* userData,
|
|||||||
window->wl.hovered = GLFW_FALSE;
|
window->wl.hovered = GLFW_FALSE;
|
||||||
_glfwInputCursorEnter(window, GLFW_FALSE);
|
_glfwInputCursorEnter(window, GLFW_FALSE);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (window->wl.fallback.decorations)
|
||||||
|
window->wl.fallback.focus = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pointerHandleMotion(void* userData,
|
static void pointerHandleMotion(void* userData,
|
||||||
@ -1363,36 +1361,35 @@ static void pointerHandleMotion(void* userData,
|
|||||||
{
|
{
|
||||||
const char* cursorName = NULL;
|
const char* cursorName = NULL;
|
||||||
|
|
||||||
switch (window->wl.fallback.focus)
|
if (window->wl.fallback.focus == window->wl.fallback.top.surface)
|
||||||
{
|
{
|
||||||
case GLFW_TOP_DECORATION:
|
|
||||||
if (ypos < GLFW_BORDER_SIZE)
|
if (ypos < GLFW_BORDER_SIZE)
|
||||||
cursorName = "n-resize";
|
cursorName = "n-resize";
|
||||||
else
|
else
|
||||||
cursorName = "left_ptr";
|
cursorName = "left_ptr";
|
||||||
break;
|
}
|
||||||
case GLFW_LEFT_DECORATION:
|
else if (window->wl.fallback.focus == window->wl.fallback.left.surface)
|
||||||
|
{
|
||||||
if (ypos < GLFW_BORDER_SIZE)
|
if (ypos < GLFW_BORDER_SIZE)
|
||||||
cursorName = "nw-resize";
|
cursorName = "nw-resize";
|
||||||
else
|
else
|
||||||
cursorName = "w-resize";
|
cursorName = "w-resize";
|
||||||
break;
|
}
|
||||||
case GLFW_RIGHT_DECORATION:
|
else if (window->wl.fallback.focus == window->wl.fallback.right.surface)
|
||||||
|
{
|
||||||
if (ypos < GLFW_BORDER_SIZE)
|
if (ypos < GLFW_BORDER_SIZE)
|
||||||
cursorName = "ne-resize";
|
cursorName = "ne-resize";
|
||||||
else
|
else
|
||||||
cursorName = "e-resize";
|
cursorName = "e-resize";
|
||||||
break;
|
}
|
||||||
case GLFW_BOTTOM_DECORATION:
|
else if (window->wl.fallback.focus == window->wl.fallback.bottom.surface)
|
||||||
|
{
|
||||||
if (xpos < GLFW_BORDER_SIZE)
|
if (xpos < GLFW_BORDER_SIZE)
|
||||||
cursorName = "sw-resize";
|
cursorName = "sw-resize";
|
||||||
else if (xpos > window->wl.width + GLFW_BORDER_SIZE)
|
else if (xpos > window->wl.width + GLFW_BORDER_SIZE)
|
||||||
cursorName = "se-resize";
|
cursorName = "se-resize";
|
||||||
else
|
else
|
||||||
cursorName = "s-resize";
|
cursorName = "s-resize";
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.wl.cursorPreviousName != cursorName)
|
if (_glfw.wl.cursorPreviousName != cursorName)
|
||||||
@ -1464,35 +1461,37 @@ static void pointerHandleButton(void* userData,
|
|||||||
{
|
{
|
||||||
uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE;
|
uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE;
|
||||||
|
|
||||||
switch (window->wl.fallback.focus)
|
if (window->wl.fallback.focus == window->wl.fallback.top.surface)
|
||||||
{
|
{
|
||||||
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
|
||||||
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
|
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
|
||||||
break;
|
}
|
||||||
case GLFW_LEFT_DECORATION:
|
else if (window->wl.fallback.focus == window->wl.fallback.left.surface)
|
||||||
|
{
|
||||||
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;
|
}
|
||||||
case GLFW_RIGHT_DECORATION:
|
else if (window->wl.fallback.focus == window->wl.fallback.right.surface)
|
||||||
|
{
|
||||||
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;
|
}
|
||||||
case GLFW_BOTTOM_DECORATION:
|
else if (window->wl.fallback.focus == window->wl.fallback.bottom.surface)
|
||||||
|
{
|
||||||
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)
|
||||||
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;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (edges != XDG_TOPLEVEL_RESIZE_EDGE_NONE)
|
if (edges != XDG_TOPLEVEL_RESIZE_EDGE_NONE)
|
||||||
{
|
{
|
||||||
xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat,
|
xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat,
|
||||||
|
Loading…
Reference in New Issue
Block a user