| 1196 | } |
| 1197 | |
| 1198 | static void pointerHandleButton(void* userData, |
| 1199 | struct wl_pointer* pointer, |
| 1200 | uint32_t serial, |
| 1201 | uint32_t time, |
| 1202 | uint32_t button, |
| 1203 | uint32_t state) |
| 1204 | { |
| 1205 | _GLFWwindow* window = _glfw.wl.pointerFocus; |
| 1206 | int glfwButton; |
| 1207 | |
| 1208 | uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE; |
| 1209 | |
| 1210 | if (!window) |
| 1211 | return; |
| 1212 | if (button == BTN_LEFT) |
| 1213 | { |
| 1214 | switch (window->wl.decorations.focus) |
| 1215 | { |
| 1216 | case mainWindow: |
| 1217 | break; |
| 1218 | case topDecoration: |
| 1219 | if (window->wl.cursorPosY < GLFW_BORDER_SIZE) |
| 1220 | edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP; |
| 1221 | else |
| 1222 | { |
| 1223 | xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial); |
| 1224 | } |
| 1225 | break; |
| 1226 | case leftDecoration: |
| 1227 | if (window->wl.cursorPosY < GLFW_BORDER_SIZE) |
| 1228 | edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT; |
| 1229 | else |
| 1230 | edges = XDG_TOPLEVEL_RESIZE_EDGE_LEFT; |
| 1231 | break; |
| 1232 | case rightDecoration: |
| 1233 | if (window->wl.cursorPosY < GLFW_BORDER_SIZE) |
| 1234 | edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT; |
| 1235 | else |
| 1236 | edges = XDG_TOPLEVEL_RESIZE_EDGE_RIGHT; |
| 1237 | break; |
| 1238 | case bottomDecoration: |
| 1239 | if (window->wl.cursorPosX < GLFW_BORDER_SIZE) |
| 1240 | edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT; |
| 1241 | else if (window->wl.cursorPosX > window->wl.width + GLFW_BORDER_SIZE) |
| 1242 | edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT; |
| 1243 | else |
| 1244 | edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM; |
| 1245 | break; |
| 1246 | default: |
| 1247 | assert(0); |
| 1248 | } |
| 1249 | if (edges != XDG_TOPLEVEL_RESIZE_EDGE_NONE) |
| 1250 | { |
| 1251 | xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat, |
| 1252 | serial, edges); |
| 1253 | return; |
| 1254 | } |
| 1255 | } |
nothing calls this directly
no test coverage detected