Lines Matching refs:wl
169 struct wl_shm_pool* pool = wl_shm_create_pool(_glfw.wl.shm, fd, length);
203 edge->surface = wl_compositor_create_surface(_glfw.wl.compositor);
205 wl_proxy_set_tag((struct wl_proxy*) edge->surface, &_glfw.wl.tag);
206 edge->subsurface = wl_subcompositor_get_subsurface(_glfw.wl.subcompositor,
209 edge->viewport = wp_viewporter_get_viewport(_glfw.wl.viewporter,
214 struct wl_region* region = wl_compositor_create_region(_glfw.wl.compositor);
226 if (!_glfw.wl.viewporter)
229 if (!window->wl.fallback.buffer)
230 window->wl.fallback.buffer = createShmBuffer(&image);
231 if (!window->wl.fallback.buffer)
234 createFallbackEdge(window, &window->wl.fallback.top, window->wl.surface,
235 window->wl.fallback.buffer,
237 window->wl.width, GLFW_CAPTION_HEIGHT);
238 createFallbackEdge(window, &window->wl.fallback.left, window->wl.surface,
239 window->wl.fallback.buffer,
241 GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
242 createFallbackEdge(window, &window->wl.fallback.right, window->wl.surface,
243 window->wl.fallback.buffer,
244 window->wl.width, -GLFW_CAPTION_HEIGHT,
245 GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
246 createFallbackEdge(window, &window->wl.fallback.bottom, window->wl.surface,
247 window->wl.fallback.buffer,
248 -GLFW_BORDER_SIZE, window->wl.height,
249 window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE);
251 window->wl.fallback.decorations = GLFW_TRUE;
270 window->wl.fallback.decorations = GLFW_FALSE;
272 destroyFallbackEdge(&window->wl.fallback.top);
273 destroyFallbackEdge(&window->wl.fallback.left);
274 destroyFallbackEdge(&window->wl.fallback.right);
275 destroyFallbackEdge(&window->wl.fallback.bottom);
284 window->wl.xdg.decorationMode = mode;
305 region = wl_compositor_create_region(_glfw.wl.compositor);
309 wl_region_add(region, 0, 0, window->wl.width, window->wl.height);
310 wl_surface_set_opaque_region(window->wl.surface, region);
316 if (window->wl.fractionalScale)
318 window->wl.fbWidth = (window->wl.width * window->wl.scalingNumerator) / 120;
319 window->wl.fbHeight = (window->wl.height * window->wl.scalingNumerator) / 120;
323 window->wl.fbWidth = window->wl.width * window->wl.bufferScale;
324 window->wl.fbHeight = window->wl.height * window->wl.bufferScale;
327 if (window->wl.egl.window)
329 wl_egl_window_resize(window->wl.egl.window,
330 window->wl.fbWidth,
331 window->wl.fbHeight,
335 if (!window->wl.transparent)
338 _glfwInputFramebufferSize(window, window->wl.fbWidth, window->wl.fbHeight);
346 if (width == window->wl.width && height == window->wl.height)
349 window->wl.width = width;
350 window->wl.height = height;
354 if (window->wl.scalingViewport)
356 wp_viewport_set_destination(window->wl.scalingViewport,
357 window->wl.width,
358 window->wl.height);
361 if (window->wl.fallback.decorations)
363 wp_viewport_set_destination(window->wl.fallback.top.viewport,
364 window->wl.width,
366 wl_surface_commit(window->wl.fallback.top.surface);
368 wp_viewport_set_destination(window->wl.fallback.left.viewport,
370 window->wl.height + GLFW_CAPTION_HEIGHT);
371 wl_surface_commit(window->wl.fallback.left.surface);
373 wl_subsurface_set_position(window->wl.fallback.right.subsurface,
374 window->wl.width, -GLFW_CAPTION_HEIGHT);
375 wp_viewport_set_destination(window->wl.fallback.right.viewport,
377 window->wl.height + GLFW_CAPTION_HEIGHT);
378 wl_surface_commit(window->wl.fallback.right.surface);
380 wl_subsurface_set_position(window->wl.fallback.bottom.subsurface,
381 -GLFW_BORDER_SIZE, window->wl.height);
382 wp_viewport_set_destination(window->wl.fallback.bottom.viewport,
383 window->wl.width + GLFW_BORDER_SIZE * 2,
385 wl_surface_commit(window->wl.fallback.bottom.surface);
393 if (wl_compositor_get_version(_glfw.wl.compositor) <
399 if (!window->wl.scaleFramebuffer)
403 if (window->wl.fractionalScale)
409 for (size_t i = 0; i < window->wl.outputScaleCount; i++)
410 maxScale = _glfw_max(window->wl.outputScales[i].factor, maxScale);
413 if (window->wl.bufferScale != maxScale)
415 window->wl.bufferScale = maxScale;
416 wl_surface_set_buffer_scale(window->wl.surface, maxScale);
420 if (window->wl.visible)
429 if (wl_proxy_get_tag((struct wl_proxy*) output) != &_glfw.wl.tag)
437 if (window->wl.outputScaleCount + 1 > window->wl.outputScaleSize)
439 window->wl.outputScaleSize++;
440 window->wl.outputScales =
441 _glfw_realloc(window->wl.outputScales,
442 window->wl.outputScaleSize * sizeof(_GLFWscaleWayland));
445 window->wl.outputScaleCount++;
446 window->wl.outputScales[window->wl.outputScaleCount - 1] =
447 (_GLFWscaleWayland) { output, monitor->wl.scale };
456 if (wl_proxy_get_tag((struct wl_proxy*) output) != &_glfw.wl.tag)
461 for (size_t i = 0; i < window->wl.outputScaleCount; i++)
463 if (window->wl.outputScales[i].output == output)
465 window->wl.outputScales[i] =
466 window->wl.outputScales[window->wl.outputScaleCount - 1];
467 window->wl.outputScaleCount--;
483 if (enable && !window->wl.idleInhibitor && _glfw.wl.idleInhibitManager)
485 window->wl.idleInhibitor =
487 _glfw.wl.idleInhibitManager, window->wl.surface);
488 if (!window->wl.idleInhibitor)
492 else if (!enable && window->wl.idleInhibitor)
494 zwp_idle_inhibitor_v1_destroy(window->wl.idleInhibitor);
495 window->wl.idleInhibitor = NULL;
503 if (window->wl.libdecor.frame)
505 libdecor_frame_set_fullscreen(window->wl.libdecor.frame,
506 window->monitor->wl.output);
508 else if (window->wl.xdg.toplevel)
510 xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel,
511 window->monitor->wl.output);
516 if (window->wl.fallback.decorations)
524 if (window->wl.libdecor.frame)
525 libdecor_frame_unset_fullscreen(window->wl.libdecor.frame);
526 else if (window->wl.xdg.toplevel)
527 xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel);
531 if (!window->wl.libdecor.frame &&
532 window->wl.xdg.decorationMode != ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE)
545 window->wl.scalingNumerator = numerator;
549 if (window->wl.visible)
567 window->wl.pending.activated = GLFW_FALSE;
568 window->wl.pending.maximized = GLFW_FALSE;
569 window->wl.pending.fullscreen = GLFW_FALSE;
576 window->wl.pending.maximized = GLFW_TRUE;
579 window->wl.pending.fullscreen = GLFW_TRUE;
584 window->wl.pending.activated = GLFW_TRUE;
591 if (window->wl.fallback.decorations)
593 window->wl.pending.width = _glfw_max(0, width - GLFW_BORDER_SIZE * 2);
594 window->wl.pending.height =
599 window->wl.pending.width = width;
600 window->wl.pending.height = height;
605 window->wl.pending.width = window->wl.width;
606 window->wl.pending.height = window->wl.height;
631 if (window->wl.activated != window->wl.pending.activated)
633 window->wl.activated = window->wl.pending.activated;
634 if (!window->wl.activated)
637 xdg_toplevel_set_minimized(window->wl.xdg.toplevel);
641 if (window->wl.maximized != window->wl.pending.maximized)
643 window->wl.maximized = window->wl.pending.maximized;
644 _glfwInputWindowMaximize(window, window->wl.maximized);
647 window->wl.fullscreen = window->wl.pending.fullscreen;
649 int width = window->wl.pending.width;
650 int height = window->wl.pending.height;
652 if (!window->wl.maximized && !window->wl.fullscreen)
667 _glfwInputWindowSize(window, window->wl.width, window->wl.height);
669 if (window->wl.visible)
673 if (!window->wl.visible)
677 if (!window->wl.xdg.decoration || window->wl.xdg.decorationMode)
679 window->wl.visible = GLFW_TRUE;
708 fullscreen = window->wl.fullscreen;
709 activated = window->wl.activated;
710 maximized = window->wl.maximized;
715 width = window->wl.width;
716 height = window->wl.height;
736 if (window->wl.activated != activated)
738 window->wl.activated = activated;
739 if (!window->wl.activated)
742 libdecor_frame_set_minimized(window->wl.libdecor.frame);
746 if (window->wl.maximized != maximized)
748 window->wl.maximized = maximized;
749 _glfwInputWindowMaximize(window, window->wl.maximized);
752 window->wl.fullscreen = fullscreen;
756 if (!window->wl.visible)
758 window->wl.visible = GLFW_TRUE;
764 _glfwInputWindowSize(window, window->wl.width, window->wl.height);
771 wl_surface_commit(window->wl.surface);
783 wl_surface_commit(window->wl.surface);
803 while (!_glfw.wl.libdecor.ready)
806 window->wl.libdecor.frame = libdecor_decorate(_glfw.wl.libdecor.context,
807 window->wl.surface,
810 if (!window->wl.libdecor.frame)
818 libdecor_state_new(window->wl.width, window->wl.height);
819 libdecor_frame_commit(window->wl.libdecor.frame, frameState, NULL);
822 if (strlen(window->wl.appId))
823 libdecor_frame_set_app_id(window->wl.libdecor.frame, window->wl.appId);
825 libdecor_frame_set_title(window->wl.libdecor.frame, window->title);
830 libdecor_frame_set_min_content_size(window->wl.libdecor.frame,
838 libdecor_frame_set_max_content_size(window->wl.libdecor.frame,
845 libdecor_frame_unset_capabilities(window->wl.libdecor.frame,
851 libdecor_frame_set_fullscreen(window->wl.libdecor.frame,
852 window->monitor->wl.output);
857 if (window->wl.maximized)
858 libdecor_frame_set_maximized(window->wl.libdecor.frame);
861 libdecor_frame_set_visibility(window->wl.libdecor.frame, false);
866 libdecor_frame_map(window->wl.libdecor.frame);
867 wl_display_roundtrip(_glfw.wl.display);
884 if (window->wl.fallback.decorations)
898 if (window->wl.fallback.decorations)
907 minwidth = maxwidth = window->wl.width;
908 minheight = maxheight = window->wl.height;
911 xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight);
912 xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight);
917 window->wl.xdg.surface = xdg_wm_base_get_xdg_surface(_glfw.wl.wmBase,
918 window->wl.surface);
919 if (!window->wl.xdg.surface)
926 xdg_surface_add_listener(window->wl.xdg.surface, &xdgSurfaceListener, window);
928 window->wl.xdg.toplevel = xdg_surface_get_toplevel(window->wl.xdg.surface);
929 if (!window->wl.xdg.toplevel)
936 xdg_toplevel_add_listener(window->wl.xdg.toplevel, &xdgToplevelListener, window);
938 if (window->wl.appId)
939 xdg_toplevel_set_app_id(window->wl.xdg.toplevel, window->wl.appId);
941 xdg_toplevel_set_title(window->wl.xdg.toplevel, window->title);
945 xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel, window->monitor->wl.output);
950 if (window->wl.maximized)
951 xdg_toplevel_set_maximized(window->wl.xdg.toplevel);
956 if (_glfw.wl.decorationManager)
958 window->wl.xdg.decoration =
960 _glfw.wl.decorationManager, window->wl.xdg.toplevel);
961 zxdg_toplevel_decoration_v1_add_listener(window->wl.xdg.decoration,
972 zxdg_toplevel_decoration_v1_set_mode(window->wl.xdg.decoration, mode);
982 wl_surface_commit(window->wl.surface);
983 wl_display_roundtrip(_glfw.wl.display);
989 if (_glfw.wl.libdecor.context)
1002 if (window->wl.libdecor.frame)
1003 libdecor_frame_unref(window->wl.libdecor.frame);
1005 if (window->wl.xdg.decoration)
1006 zxdg_toplevel_decoration_v1_destroy(window->wl.xdg.decoration);
1008 if (window->wl.xdg.toplevel)
1009 xdg_toplevel_destroy(window->wl.xdg.toplevel);
1011 if (window->wl.xdg.surface)
1012 xdg_surface_destroy(window->wl.xdg.surface);
1014 window->wl.libdecor.frame = NULL;
1015 window->wl.xdg.decoration = NULL;
1016 window->wl.xdg.decorationMode = 0;
1017 window->wl.xdg.toplevel = NULL;
1018 window->wl.xdg.surface = NULL;
1025 window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor);
1026 if (!window->wl.surface)
1032 wl_proxy_set_tag((struct wl_proxy*) window->wl.surface, &_glfw.wl.tag);
1033 wl_surface_add_listener(window->wl.surface,
1037 window->wl.width = wndconfig->width;
1038 window->wl.height = wndconfig->height;
1039 window->wl.fbWidth = wndconfig->width;
1040 window->wl.fbHeight = wndconfig->height;
1041 window->wl.appId = _glfw_strdup(wndconfig->wl.appId);
1043 window->wl.bufferScale = 1;
1044 window->wl.scalingNumerator = 120;
1045 window->wl.scaleFramebuffer = wndconfig->scaleFramebuffer;
1047 window->wl.maximized = wndconfig->maximized;
1049 window->wl.transparent = fbconfig->transparent;
1050 if (!window->wl.transparent)
1053 if (_glfw.wl.fractionalScaleManager)
1055 if (window->wl.scaleFramebuffer)
1057 window->wl.scalingViewport =
1058 wp_viewporter_get_viewport(_glfw.wl.viewporter, window->wl.surface);
1060 wp_viewport_set_destination(window->wl.scalingViewport,
1061 window->wl.width,
1062 window->wl.height);
1064 window->wl.fractionalScale =
1066 _glfw.wl.fractionalScaleManager,
1067 window->wl.surface);
1069 wp_fractional_scale_v1_add_listener(window->wl.fractionalScale,
1085 struct wl_surface* surface = _glfw.wl.cursorSurface;
1092 if (window->wl.bufferScale > 1 && cursorWayland->cursorHiDPI)
1105 timerfd_settime(_glfw.wl.cursorTimerfd, 0, &timer, NULL);
1113 wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
1128 if (!window || !window->wl.hovered)
1131 cursor = window->wl.currentCursor;
1132 if (cursor && cursor->wl.cursor)
1134 cursor->wl.currentImage += 1;
1135 cursor->wl.currentImage %= cursor->wl.cursor->image_count;
1136 setCursorImage(window, &cursor->wl);
1142 while (wl_display_flush(_glfw.wl.display) == -1)
1147 struct pollfd fd = { wl_display_get_fd(_glfw.wl.display), POLLOUT };
1161 if (scancode < sizeof(_glfw.wl.keycodes) / sizeof(_glfw.wl.keycodes[0]))
1162 return _glfw.wl.keycodes[scancode];
1169 if (sym == XKB_KEY_NoSymbol || !_glfw.wl.xkb.composeState)
1171 if (xkb_compose_state_feed(_glfw.wl.xkb.composeState, sym)
1174 switch (xkb_compose_state_get_status(_glfw.wl.xkb.composeState))
1177 return xkb_compose_state_get_one_sym(_glfw.wl.xkb.composeState);
1192 if (xkb_state_key_get_syms(_glfw.wl.xkb.state, keycode, &keysyms) == 1)
1198 const int mods = _glfw.wl.xkb.modifiers;
1216 [DISPLAY_FD] = { wl_display_get_fd(_glfw.wl.display), POLLIN },
1217 [KEYREPEAT_FD] = { _glfw.wl.keyRepeatTimerfd, POLLIN },
1218 [CURSOR_FD] = { _glfw.wl.cursorTimerfd, POLLIN },
1222 if (_glfw.wl.libdecor.context)
1223 fds[LIBDECOR_FD].fd = libdecor_get_fd(_glfw.wl.libdecor.context);
1227 while (wl_display_prepare_read(_glfw.wl.display) != 0)
1229 if (wl_display_dispatch_pending(_glfw.wl.display) > 0)
1237 wl_display_cancel_read(_glfw.wl.display);
1251 wl_display_cancel_read(_glfw.wl.display);
1257 wl_display_read_events(_glfw.wl.display);
1258 if (wl_display_dispatch_pending(_glfw.wl.display) > 0)
1262 wl_display_cancel_read(_glfw.wl.display);
1268 if (read(_glfw.wl.keyRepeatTimerfd, &repeats, sizeof(repeats)) == 8)
1272 _glfwInputKey(_glfw.wl.keyboardFocus,
1273 translateKey(_glfw.wl.keyRepeatScancode),
1274 _glfw.wl.keyRepeatScancode,
1276 _glfw.wl.xkb.modifiers);
1277 inputText(_glfw.wl.keyboardFocus, _glfw.wl.keyRepeatScancode);
1288 if (read(_glfw.wl.cursorTimerfd, &repeats, sizeof(repeats)) == 8)
1289 incrementCursorImage(_glfw.wl.pointerFocus);
1294 if (libdecor_dispatch(_glfw.wl.libdecor.context, 0) > 0)
1375 if (wl_proxy_get_tag((struct wl_proxy*) surface) != &_glfw.wl.tag)
1380 _glfw.wl.serial = serial;
1381 _glfw.wl.pointerEnterSerial = serial;
1382 _glfw.wl.pointerFocus = window;
1384 if (surface == window->wl.surface)
1386 window->wl.hovered = GLFW_TRUE;
1387 _glfwSetCursorWayland(window, window->wl.currentCursor);
1392 if (window->wl.fallback.decorations)
1393 window->wl.fallback.focus = surface;
1405 if (wl_proxy_get_tag((struct wl_proxy*) surface) != &_glfw.wl.tag)
1408 _GLFWwindow* window = _glfw.wl.pointerFocus;
1412 _glfw.wl.serial = serial;
1413 _glfw.wl.pointerFocus = NULL;
1414 _glfw.wl.cursorPreviousName = NULL;
1416 if (window->wl.hovered)
1418 window->wl.hovered = GLFW_FALSE;
1423 if (window->wl.fallback.decorations)
1424 window->wl.fallback.focus = NULL;
1434 _GLFWwindow* window = _glfw.wl.pointerFocus;
1443 window->wl.cursorPosX = xpos;
1444 window->wl.cursorPosY = ypos;
1446 if (window->wl.hovered)
1448 _glfw.wl.cursorPreviousName = NULL;
1453 if (window->wl.fallback.decorations)
1459 if (window->wl.fallback.focus == window->wl.fallback.top.surface)
1464 else if (window->wl.fallback.focus == window->wl.fallback.left.surface)
1471 else if (window->wl.fallback.focus == window->wl.fallback.right.surface)
1478 else if (window->wl.fallback.focus == window->wl.fallback.bottom.surface)
1482 else if (xpos > window->wl.width + GLFW_BORDER_SIZE)
1489 if (_glfw.wl.cursorPreviousName != cursorName)
1491 struct wl_surface* surface = _glfw.wl.cursorSurface;
1492 struct wl_cursor_theme* theme = _glfw.wl.cursorTheme;
1495 if (window->wl.bufferScale > 1 && _glfw.wl.cursorThemeHiDPI)
1500 theme = _glfw.wl.cursorThemeHiDPI;
1516 wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
1525 _glfw.wl.cursorPreviousName = cursorName;
1537 _GLFWwindow* window = _glfw.wl.pointerFocus;
1541 if (window->wl.hovered)
1543 _glfw.wl.serial = serial;
1548 _glfw.wl.xkb.modifiers);
1552 if (window->wl.fallback.decorations)
1558 if (window->wl.fallback.focus == window->wl.fallback.top.surface)
1560 if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
1563 xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
1565 else if (window->wl.fallback.focus == window->wl.fallback.left.surface)
1567 if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
1572 else if (window->wl.fallback.focus == window->wl.fallback.right.surface)
1574 if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
1579 else if (window->wl.fallback.focus == window->wl.fallback.bottom.surface)
1581 if (window->wl.cursorPosX < GLFW_BORDER_SIZE)
1583 else if (window->wl.cursorPosX > window->wl.width + GLFW_BORDER_SIZE)
1591 xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat,
1597 if (window->wl.xdg.toplevel)
1599 xdg_toplevel_show_window_menu(window->wl.xdg.toplevel,
1600 _glfw.wl.seat, serial,
1601 window->wl.cursorPosX,
1602 window->wl.cursorPosY);
1614 _GLFWwindow* window = _glfw.wl.pointerFocus;
1660 keymap = xkb_keymap_new_from_string(_glfw.wl.xkb.context,
1693 xkb_compose_table_new_from_locale(_glfw.wl.xkb.context, locale,
1701 _glfw.wl.xkb.composeState = composeState;
1712 xkb_keymap_unref(_glfw.wl.xkb.keymap);
1713 xkb_state_unref(_glfw.wl.xkb.state);
1714 _glfw.wl.xkb.keymap = keymap;
1715 _glfw.wl.xkb.state = state;
1717 _glfw.wl.xkb.controlIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Control");
1718 _glfw.wl.xkb.altIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod1");
1719 _glfw.wl.xkb.shiftIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Shift");
1720 _glfw.wl.xkb.superIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod4");
1721 _glfw.wl.xkb.capsLockIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Lock");
1722 _glfw.wl.xkb.numLockIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod2");
1735 if (wl_proxy_get_tag((struct wl_proxy*) surface) != &_glfw.wl.tag)
1739 if (surface != window->wl.surface)
1742 _glfw.wl.serial = serial;
1743 _glfw.wl.keyboardFocus = window;
1752 _GLFWwindow* window = _glfw.wl.keyboardFocus;
1758 timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
1760 _glfw.wl.serial = serial;
1761 _glfw.wl.keyboardFocus = NULL;
1772 _GLFWwindow* window = _glfw.wl.keyboardFocus;
1780 _glfw.wl.serial = serial;
1788 if (xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, keycode) &&
1789 _glfw.wl.keyRepeatRate > 0)
1791 _glfw.wl.keyRepeatScancode = scancode;
1792 if (_glfw.wl.keyRepeatRate > 1)
1793 timer.it_interval.tv_nsec = 1000000000 / _glfw.wl.keyRepeatRate;
1797 timer.it_value.tv_sec = _glfw.wl.keyRepeatDelay / 1000;
1798 timer.it_value.tv_nsec = (_glfw.wl.keyRepeatDelay % 1000) * 1000000;
1802 timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
1804 _glfwInputKey(window, key, scancode, action, _glfw.wl.xkb.modifiers);
1818 _glfw.wl.serial = serial;
1820 if (!_glfw.wl.xkb.keymap)
1823 xkb_state_update_mask(_glfw.wl.xkb.state,
1831 _glfw.wl.xkb.modifiers = 0;
1839 { _glfw.wl.xkb.controlIndex, GLFW_MOD_CONTROL },
1840 { _glfw.wl.xkb.altIndex, GLFW_MOD_ALT },
1841 { _glfw.wl.xkb.shiftIndex, GLFW_MOD_SHIFT },
1842 { _glfw.wl.xkb.superIndex, GLFW_MOD_SUPER },
1843 { _glfw.wl.xkb.capsLockIndex, GLFW_MOD_CAPS_LOCK },
1844 { _glfw.wl.xkb.numLockIndex, GLFW_MOD_NUM_LOCK }
1849 if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state,
1853 _glfw.wl.xkb.modifiers |= modifiers[i].bit;
1863 if (keyboard != _glfw.wl.keyboard)
1866 _glfw.wl.keyRepeatRate = rate;
1867 _glfw.wl.keyRepeatDelay = delay;
1884 if ((caps & WL_SEAT_CAPABILITY_POINTER) && !_glfw.wl.pointer)
1886 _glfw.wl.pointer = wl_seat_get_pointer(seat);
1887 wl_pointer_add_listener(_glfw.wl.pointer, &pointerListener, NULL);
1889 else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && _glfw.wl.pointer)
1891 wl_pointer_destroy(_glfw.wl.pointer);
1892 _glfw.wl.pointer = NULL;
1895 if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !_glfw.wl.keyboard)
1897 _glfw.wl.keyboard = wl_seat_get_keyboard(seat);
1898 wl_keyboard_add_listener(_glfw.wl.keyboard, &keyboardListener, NULL);
1900 else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && _glfw.wl.keyboard)
1902 wl_keyboard_destroy(_glfw.wl.keyboard);
1903 _glfw.wl.keyboard = NULL;
1923 for (unsigned int i = 0; i < _glfw.wl.offerCount; i++)
1925 if (_glfw.wl.offers[i].offer == offer)
1928 _glfw.wl.offers[i].text_plain_utf8 = GLFW_TRUE;
1930 _glfw.wl.offers[i].text_uri_list = GLFW_TRUE;
1947 _glfw_realloc(_glfw.wl.offers,
1948 sizeof(_GLFWofferWayland) * (_glfw.wl.offerCount + 1));
1955 _glfw.wl.offers = offers;
1956 _glfw.wl.offerCount++;
1958 _glfw.wl.offers[_glfw.wl.offerCount - 1] = (_GLFWofferWayland) { offer };
1970 if (_glfw.wl.dragOffer)
1972 wl_data_offer_destroy(_glfw.wl.dragOffer);
1973 _glfw.wl.dragOffer = NULL;
1974 _glfw.wl.dragFocus = NULL;
1979 for (i = 0; i < _glfw.wl.offerCount; i++)
1981 if (_glfw.wl.offers[i].offer == offer)
1985 if (i == _glfw.wl.offerCount)
1988 if (surface && wl_proxy_get_tag((struct wl_proxy*) surface) == &_glfw.wl.tag)
1991 if (window->wl.surface == surface)
1993 if (_glfw.wl.offers[i].text_uri_list)
1995 _glfw.wl.dragOffer = offer;
1996 _glfw.wl.dragFocus = window;
1997 _glfw.wl.dragSerial = serial;
2004 if (!_glfw.wl.dragOffer)
2010 _glfw.wl.offers[i] = _glfw.wl.offers[_glfw.wl.offerCount - 1];
2011 _glfw.wl.offerCount--;
2017 if (_glfw.wl.dragOffer)
2019 wl_data_offer_destroy(_glfw.wl.dragOffer);
2020 _glfw.wl.dragOffer = NULL;
2021 _glfw.wl.dragFocus = NULL;
2036 if (!_glfw.wl.dragOffer)
2039 char* string = readDataOfferAsString(_glfw.wl.dragOffer, "text/uri-list");
2046 _glfwInputDrop(_glfw.wl.dragFocus, count, (const char**) paths);
2062 if (_glfw.wl.selectionOffer)
2064 wl_data_offer_destroy(_glfw.wl.selectionOffer);
2065 _glfw.wl.selectionOffer = NULL;
2068 for (unsigned int i = 0; i < _glfw.wl.offerCount; i++)
2070 if (_glfw.wl.offers[i].offer == offer)
2072 if (_glfw.wl.offers[i].text_plain_utf8)
2073 _glfw.wl.selectionOffer = offer;
2077 _glfw.wl.offers[i] = _glfw.wl.offers[_glfw.wl.offerCount - 1];
2078 _glfw.wl.offerCount--;
2100 if (activationToken != window->wl.activationToken)
2103 xdg_activation_v1_activate(_glfw.wl.activationManager, token, window->wl.surface);
2104 xdg_activation_token_v1_destroy(window->wl.activationToken);
2105 window->wl.activationToken = NULL;
2141 window->wl.egl.window = wl_egl_window_create(window->wl.surface,
2142 window->wl.fbWidth,
2143 window->wl.fbHeight);
2144 if (!window->wl.egl.window)
2182 if (window == _glfw.wl.pointerFocus)
2183 _glfw.wl.pointerFocus = NULL;
2185 if (window == _glfw.wl.keyboardFocus)
2186 _glfw.wl.keyboardFocus = NULL;
2188 if (window->wl.fractionalScale)
2189 wp_fractional_scale_v1_destroy(window->wl.fractionalScale);
2191 if (window->wl.scalingViewport)
2192 wp_viewport_destroy(window->wl.scalingViewport);
2194 if (window->wl.activationToken)
2195 xdg_activation_token_v1_destroy(window->wl.activationToken);
2197 if (window->wl.idleInhibitor)
2198 zwp_idle_inhibitor_v1_destroy(window->wl.idleInhibitor);
2200 if (window->wl.relativePointer)
2201 zwp_relative_pointer_v1_destroy(window->wl.relativePointer);
2203 if (window->wl.lockedPointer)
2204 zwp_locked_pointer_v1_destroy(window->wl.lockedPointer);
2206 if (window->wl.confinedPointer)
2207 zwp_confined_pointer_v1_destroy(window->wl.confinedPointer);
2214 if (window->wl.fallback.buffer)
2215 wl_buffer_destroy(window->wl.fallback.buffer);
2217 if (window->wl.egl.window)
2218 wl_egl_window_destroy(window->wl.egl.window);
2220 if (window->wl.surface)
2221 wl_surface_destroy(window->wl.surface);
2223 _glfw_free(window->wl.appId);
2224 _glfw_free(window->wl.outputScales);
2229 if (window->wl.libdecor.frame)
2230 libdecor_frame_set_title(window->wl.libdecor.frame, title);
2231 else if (window->wl.xdg.toplevel)
2232 xdg_toplevel_set_title(window->wl.xdg.toplevel, title);
2262 *width = window->wl.width;
2264 *height = window->wl.height;
2278 if (window->wl.libdecor.frame)
2281 libdecor_state_new(window->wl.width, window->wl.height);
2282 libdecor_frame_commit(window->wl.libdecor.frame, frameState, NULL);
2286 if (window->wl.visible)
2295 if (window->wl.libdecor.frame)
2303 libdecor_frame_set_min_content_size(window->wl.libdecor.frame,
2305 libdecor_frame_set_max_content_size(window->wl.libdecor.frame,
2308 else if (window->wl.xdg.toplevel)
2314 if (window->wl.maximized || window->wl.fullscreen)
2317 int width = window->wl.width, height = window->wl.height;
2331 if (window->wl.libdecor.frame)
2334 libdecor_state_new(window->wl.width, window->wl.height);
2335 libdecor_frame_commit(window->wl.libdecor.frame, frameState, NULL);
2339 _glfwInputWindowSize(window, window->wl.width, window->wl.height);
2341 if (window->wl.visible)
2349 *width = window->wl.fbWidth;
2351 *height = window->wl.fbHeight;
2358 if (window->wl.fallback.decorations)
2374 if (window->wl.fractionalScale)
2377 *xscale = (float) window->wl.scalingNumerator / 120.f;
2379 *yscale = (float) window->wl.scalingNumerator / 120.f;
2384 *xscale = (float) window->wl.bufferScale;
2386 *yscale = (float) window->wl.bufferScale;
2392 if (window->wl.libdecor.frame)
2393 libdecor_frame_set_minimized(window->wl.libdecor.frame);
2394 else if (window->wl.xdg.toplevel)
2395 xdg_toplevel_set_minimized(window->wl.xdg.toplevel);
2409 if (window->wl.maximized)
2411 if (window->wl.libdecor.frame)
2412 libdecor_frame_unset_maximized(window->wl.libdecor.frame);
2413 else if (window->wl.xdg.toplevel)
2414 xdg_toplevel_unset_maximized(window->wl.xdg.toplevel);
2416 window->wl.maximized = GLFW_FALSE;
2423 if (window->wl.libdecor.frame)
2424 libdecor_frame_set_maximized(window->wl.libdecor.frame);
2425 else if (window->wl.xdg.toplevel)
2426 xdg_toplevel_set_maximized(window->wl.xdg.toplevel);
2428 window->wl.maximized = GLFW_TRUE;
2433 if (!window->wl.libdecor.frame && !window->wl.xdg.toplevel)
2443 if (window->wl.visible)
2445 window->wl.visible = GLFW_FALSE;
2448 wl_surface_attach(window->wl.surface, NULL, 0, 0);
2449 wl_surface_commit(window->wl.surface);
2455 if (!_glfw.wl.activationManager)
2459 if (window->wl.activationToken)
2460 xdg_activation_token_v1_destroy(window->wl.activationToken);
2462 window->wl.activationToken =
2463 xdg_activation_v1_get_activation_token(_glfw.wl.activationManager);
2464 xdg_activation_token_v1_add_listener(window->wl.activationToken,
2468 xdg_activation_token_v1_commit(window->wl.activationToken);
2473 if (!_glfw.wl.activationManager)
2476 if (window->wl.activationToken)
2477 xdg_activation_token_v1_destroy(window->wl.activationToken);
2479 window->wl.activationToken =
2480 xdg_activation_v1_get_activation_token(_glfw.wl.activationManager);
2481 xdg_activation_token_v1_add_listener(window->wl.activationToken,
2485 xdg_activation_token_v1_set_serial(window->wl.activationToken,
2486 _glfw.wl.serial,
2487 _glfw.wl.seat);
2489 _GLFWwindow* requester = _glfw.wl.keyboardFocus;
2492 xdg_activation_token_v1_set_surface(window->wl.activationToken,
2493 requester->wl.surface);
2495 if (requester->wl.appId)
2497 xdg_activation_token_v1_set_app_id(window->wl.activationToken,
2498 requester->wl.appId);
2502 xdg_activation_token_v1_commit(window->wl.activationToken);
2532 return _glfw.wl.keyboardFocus == window;
2544 return window->wl.visible;
2549 return window->wl.maximized;
2554 return window->wl.hovered;
2559 return window->wl.transparent;
2564 if (window->wl.libdecor.frame)
2568 libdecor_frame_set_capabilities(window->wl.libdecor.frame,
2573 libdecor_frame_unset_capabilities(window->wl.libdecor.frame,
2577 else if (window->wl.xdg.toplevel)
2583 if (window->wl.libdecor.frame)
2585 libdecor_frame_set_visibility(window->wl.libdecor.frame, enabled);
2587 else if (window->wl.xdg.decoration)
2596 zxdg_toplevel_decoration_v1_set_mode(window->wl.xdg.decoration, mode);
2598 else if (window->wl.xdg.toplevel)
2617 struct wl_region* region = wl_compositor_create_region(_glfw.wl.compositor);
2618 wl_surface_set_input_region(window->wl.surface, region);
2622 wl_surface_set_input_region(window->wl.surface, NULL);
2664 wl_display_sync(_glfw.wl.display);
2671 *xpos = window->wl.cursorPosX;
2673 *ypos = window->wl.cursorPosY;
2684 _glfwSetCursorWayland(window, window->wl.currentCursor);
2697 const int key = _glfw.wl.keycodes[scancode];
2703 xkb_state_key_get_layout(_glfw.wl.xkb.state, keycode);
2712 xkb_keymap_key_get_syms_by_level(_glfw.wl.xkb.keymap,
2732 const size_t count = _glfwEncodeUTF8(_glfw.wl.keynames[key], codepoint);
2740 _glfw.wl.keynames[key][count] = '\0';
2741 return _glfw.wl.keynames[key];
2746 return _glfw.wl.scancodes[key];
2753 cursor->wl.buffer = createShmBuffer(image);
2754 if (!cursor->wl.buffer)
2757 cursor->wl.width = image->width;
2758 cursor->wl.height = image->height;
2759 cursor->wl.xhot = xhot;
2760 cursor->wl.yhot = yhot;
2803 cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name);
2805 if (_glfw.wl.cursorThemeHiDPI)
2807 cursor->wl.cursorHiDPI =
2808 wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, name);
2811 if (!cursor->wl.cursor)
2843 cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name);
2844 if (!cursor->wl.cursor)
2852 if (_glfw.wl.cursorThemeHiDPI)
2854 if (!cursor->wl.cursorHiDPI)
2856 cursor->wl.cursorHiDPI =
2857 wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, name);
2868 if (cursor->wl.cursor)
2871 if (cursor->wl.buffer)
2872 wl_buffer_destroy(cursor->wl.buffer);
2928 if (!_glfw.wl.relativePointerManager)
2935 window->wl.relativePointer =
2937 _glfw.wl.relativePointerManager,
2938 _glfw.wl.pointer);
2939 zwp_relative_pointer_v1_add_listener(window->wl.relativePointer,
2943 window->wl.lockedPointer =
2945 _glfw.wl.pointerConstraints,
2946 window->wl.surface,
2947 _glfw.wl.pointer,
2950 zwp_locked_pointer_v1_add_listener(window->wl.lockedPointer,
2957 zwp_relative_pointer_v1_destroy(window->wl.relativePointer);
2958 window->wl.relativePointer = NULL;
2960 zwp_locked_pointer_v1_destroy(window->wl.lockedPointer);
2961 window->wl.lockedPointer = NULL;
2982 window->wl.confinedPointer =
2984 _glfw.wl.pointerConstraints,
2985 window->wl.surface,
2986 _glfw.wl.pointer,
2990 zwp_confined_pointer_v1_add_listener(window->wl.confinedPointer,
2997 zwp_confined_pointer_v1_destroy(window->wl.confinedPointer);
2998 window->wl.confinedPointer = NULL;
3003 if (!_glfw.wl.pointer)
3006 window->wl.currentCursor = cursor;
3010 if (!window->wl.hovered)
3016 if (window->wl.confinedPointer)
3018 if (!window->wl.lockedPointer)
3023 if (window->wl.lockedPointer)
3025 if (!window->wl.confinedPointer)
3031 if (window->wl.lockedPointer)
3033 else if (window->wl.confinedPointer)
3041 setCursorImage(window, &cursor->wl);
3045 wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, "left_ptr");
3054 if (_glfw.wl.cursorThemeHiDPI)
3057 wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, "left_ptr");
3076 wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, NULL, 0, 0);
3084 if (_glfw.wl.selectionSource != source)
3098 if (_glfw.wl.selectionSource != source ||
3105 char* string = _glfw.wl.clipboardString;
3134 if (_glfw.wl.selectionSource != source)
3137 _glfw.wl.selectionSource = NULL;
3149 if (_glfw.wl.selectionSource)
3151 wl_data_source_destroy(_glfw.wl.selectionSource);
3152 _glfw.wl.selectionSource = NULL;
3162 _glfw_free(_glfw.wl.clipboardString);
3163 _glfw.wl.clipboardString = copy;
3165 _glfw.wl.selectionSource =
3166 wl_data_device_manager_create_data_source(_glfw.wl.dataDeviceManager);
3167 if (!_glfw.wl.selectionSource)
3173 wl_data_source_add_listener(_glfw.wl.selectionSource,
3176 wl_data_source_offer(_glfw.wl.selectionSource, "text/plain;charset=utf-8");
3177 wl_data_device_set_selection(_glfw.wl.dataDevice,
3178 _glfw.wl.selectionSource,
3179 _glfw.wl.serial);
3184 if (!_glfw.wl.selectionOffer)
3191 if (_glfw.wl.selectionSource)
3192 return _glfw.wl.clipboardString;
3194 _glfw_free(_glfw.wl.clipboardString);
3195 _glfw.wl.clipboardString =
3196 readDataOfferAsString(_glfw.wl.selectionOffer, "text/plain;charset=utf-8");
3197 return _glfw.wl.clipboardString;
3210 return _glfw.wl.display;
3215 return window->wl.egl.window;
3244 _glfw.wl.display);
3267 sci.display = _glfw.wl.display;
3268 sci.surface = window->wl.surface;
3297 return _glfw.wl.display;
3314 return window->wl.surface;