19#ifdef WITH_OPENGL_BACKEND
22#ifdef WITH_VULKAN_BACKEND
26#include <wayland-client-protocol.h>
28#ifdef WITH_OPENGL_BACKEND
29# ifdef WITH_GHOST_WAYLAND_DYNLOAD
32# include <wayland-egl.h>
38#include <color-management-v1-client-protocol.h>
39#include <fractional-scale-v1-client-protocol.h>
40#include <viewporter-client-protocol.h>
41#include <xdg-activation-v1-client-protocol.h>
42#include <xdg-decoration-unstable-v1-client-protocol.h>
43#include <xdg-shell-client-protocol.h>
70# define USE_CURSOR_IMMEDIATE_DISPATCH
81 int csd_elems_num = 0;
98 wl_subsurface *margin_subsurface =
nullptr;
99 wp_viewport *margin_viewport =
nullptr;
100 wl_buffer *margin_buffer =
nullptr;
108 int32_t margin_window_size_local[2] = {0, 0};
117 enum zxdg_toplevel_decoration_v1_mode
mode = (
enum zxdg_toplevel_decoration_v1_mode)0;
141 xdg_toplevel_destroy(decor->
toplevel);
142 xdg_surface_destroy(decor->
surface);
152 GHOST_ASSERT(round_value > 0,
"Invalid rounding value!");
153 *value_p = (*value_p / round_value) * round_value;
158 GHOST_ASSERT(round_value > 0,
"Invalid rounding value!");
159 value_p[0] = (value_p[0] / round_value) * round_value;
160 value_p[1] = (value_p[1] / round_value) * round_value;
168 return value == ((value / round_value) * round_value);
193 return value * scale_params.
scale;
201 return value / scale_params.
scale;
215 return ((
x + d) - 1) / d;
219 const int logical_size,
227 *r_buffer_scale = buffer_scale;
228 return logical_size * buffer_scale;
244 if (*cg ==
nullptr) {
260#ifdef USE_EVENT_BACKGROUND_THREAD
283#ifdef USE_EVENT_BACKGROUND_THREAD
320# define PENDING_NUM (PENDING_WINDOW_CURSOR_SHAPE_REFRESH + 1)
377#ifdef WITH_OPENGL_BACKEND
378 wl_egl_window *egl_window =
nullptr;
380#ifdef WITH_VULKAN_BACKEND
402 GWL_WindowCSD *xdg_csd =
nullptr;
408 uint32_t wm_capabilities_mask = ~uint32_t(0);
418#ifdef USE_EVENT_BACKGROUND_THREAD
441#ifdef USE_EVENT_BACKGROUND_THREAD
452#ifdef WITH_OPENGL_BACKEND
460#ifdef WITH_VULKAN_BACKEND
466 win->
backend.vulkan_window_info->size[0] =
size[0];
467 win->
backend.vulkan_window_info->size[1] =
size[1];
475 xdg_toplevel_set_title(decor.
toplevel, title);
497 switch (state_current) {
499 xdg_toplevel_unset_maximized(toplevel);
503 xdg_toplevel_unset_fullscreen(toplevel);
514 xdg_toplevel_unset_fullscreen(toplevel);
516 xdg_toplevel_set_maximized(toplevel);
520 xdg_toplevel_set_minimized(toplevel);
526 xdg_toplevel_unset_maximized(toplevel);
528 xdg_toplevel_set_fullscreen(toplevel,
nullptr);
603 bool *r_surface_needs_commit,
604 bool *r_surface_needs_buffer_scale)
606 if (win->
wp.viewport !=
nullptr) {
610 if (viewporter ==
nullptr) {
613 win->
wp.viewport = wp_viewporter_get_viewport(viewporter, win->
wl.surface);
614 if (win->
wp.viewport ==
nullptr) {
622 if (r_surface_needs_buffer_scale) {
623 *r_surface_needs_buffer_scale =
true;
629 if (r_surface_needs_commit) {
630 *r_surface_needs_commit =
true;
633 wl_surface_commit(win->
wl.surface);
641 bool *r_surface_needs_commit,
642 bool *r_surface_needs_buffer_scale)
644 if (win->
wp.viewport ==
nullptr) {
648 wp_viewport_destroy(win->
wp.viewport);
649 win->
wp.viewport =
nullptr;
655 if (r_surface_needs_buffer_scale) {
656 *r_surface_needs_buffer_scale =
true;
662 if (r_surface_needs_commit) {
663 *r_surface_needs_commit =
true;
666 wl_surface_commit(win->
wl.surface);
674 if (win->
wp.viewport ==
nullptr) {
681 wp_viewport_set_destination(
704 if (activation_manager ==
nullptr) [[unlikely]] {
708 if (win->
xdg.activation_token) {
710 xdg_activation_token_v1_destroy(win->
xdg.activation_token);
712 win->
xdg.activation_token = xdg_activation_v1_get_activation_token(activation_manager);
714 xdg_activation_token_v1_add_listener(
717 xdg_activation_token_v1_set_app_id(win->
xdg.activation_token,
725 xdg_activation_token_v1_set_serial(win->
xdg.activation_token, serial, seat);
733 if (ghost_window_active) {
736 xdg_activation_token_v1_set_surface(win->
xdg.activation_token, surface);
741 xdg_activation_token_v1_commit(win->
xdg.activation_token);
751 GWL_Window *win,
bool *r_surface_needs_commit,
bool *r_surface_needs_buffer_scale)
759 if (win->
wp.viewport) {
764 if (r_surface_needs_buffer_scale) {
765 *r_surface_needs_buffer_scale =
true;
770 if (r_surface_needs_commit) {
771 *r_surface_needs_commit =
true;
774 wl_surface_commit(win->
wl.surface);
781 bool *r_surface_needs_commit,
782 bool *r_surface_needs_buffer_scale)
790 win, r_surface_needs_commit, r_surface_needs_buffer_scale);
794 bool *r_surface_needs_commit,
795 bool *r_surface_needs_resize_for_backend,
796 bool *r_surface_needs_buffer_scale)
809 win, r_surface_needs_commit, r_surface_needs_buffer_scale);
815 if (r_surface_needs_resize_for_backend) {
816 *r_surface_needs_resize_for_backend =
true;
830#ifdef USE_EVENT_BACKGROUND_THREAD
846 for (
size_t i = 0; i <
ARRAY_SIZE(actions); i++) {
863 wl_surface_commit(win->
wl.surface);
876static void gwl_window_csd_elems_update(
GWL_Window *win)
878 GWL_WindowCSD *xdg_csd = win->xdg_csd;
883 const int32_t fractional_scale[2] = {
898static void gwl_window_csd_layout_apply(
GWL_Window *win)
900 const uint32_t type_mask = win->wm_capabilities_mask;
905 for (
int src = 0; src < layout_base.
buttons_num; src++) {
907 if (type_mask & (1 << type)) {
923static void gwl_window_csd_geometry_update(
GWL_Window *win)
931 gwl_window_physical_to_surface_local(win, win->
frame.
size[0]),
932 gwl_window_physical_to_surface_local(win, win->
frame.
size[1]));
941static void gwl_window_csd_margin_update(
GWL_Window *win)
943 GWL_WindowCSD *xdg_csd = win->xdg_csd;
954 margin_local = gwl_window_physical_to_surface_local(win, margin_physical);
957 if (margin_local <= 0) {
958 if (xdg_csd->margin_surface) {
960 wl_surface_attach(xdg_csd->margin_surface,
nullptr, 0, 0);
961 wl_surface_commit(xdg_csd->margin_surface);
966 if (xdg_csd->margin_surface ==
nullptr) {
969 if (subcompositor ==
nullptr || viewporter ==
nullptr) {
977 if (xdg_csd->margin_buffer ==
nullptr) [[unlikely]] {
981 xdg_csd->margin_surface = wl_compositor_create_surface(system->
wl_compositor_get());
982 ghost_wl_surface_tag_csd_margin(xdg_csd->margin_surface);
983 wl_surface_set_user_data(xdg_csd->margin_surface, win->
ghost_window);
985 xdg_csd->margin_subsurface = wl_subcompositor_get_subsurface(
986 subcompositor, xdg_csd->margin_surface, win->
wl.surface);
991 wl_subsurface_set_desync(xdg_csd->margin_subsurface);
992 wl_subsurface_place_below(xdg_csd->margin_subsurface, win->
wl.surface);
994 xdg_csd->margin_viewport = wp_viewporter_get_viewport(viewporter, xdg_csd->margin_surface);
997 const int32_t window_size_local[2] = {
998 gwl_window_physical_to_surface_local(win, win->
frame.
size[0]),
999 gwl_window_physical_to_surface_local(win, win->
frame.
size[1]),
1002 xdg_csd->margin_size_local = margin_local;
1003 xdg_csd->margin_window_size_local[0] = window_size_local[0];
1004 xdg_csd->margin_window_size_local[1] = window_size_local[1];
1006 wl_surface_attach(xdg_csd->margin_surface, xdg_csd->margin_buffer, 0, 0);
1007 wl_subsurface_set_position(xdg_csd->margin_subsurface, -margin_local, -margin_local);
1008 wp_viewport_set_destination(xdg_csd->margin_viewport,
1009 window_size_local[0] + (margin_local * 2),
1010 window_size_local[1] + (margin_local * 2));
1011 wl_surface_commit(xdg_csd->margin_surface);
1021static void gwl_window_csd_opaque_region_update(
GWL_Window *win)
1025 const int32_t size_local[2] = {
1026 gwl_window_physical_to_surface_local(win, win->
frame.
size[0]),
1027 gwl_window_physical_to_surface_local(win, win->
frame.
size[1]),
1029 if (size_local[0] <= 0 || size_local[1] <= 0) [[unlikely]] {
1041 radius_local = gwl_window_physical_to_surface_local(win, radius_physical);
1045 if (region ==
nullptr) [[unlikely]] {
1049 wl_region_add(region, 0, 0,
UNPACK2(size_local));
1051 if (radius_local > 0) {
1065 {size_local[0] - radius_local, 0},
1069 {0, size_local[1] - radius_local},
1073 {size_local[0] - radius_local, size_local[1] - radius_local},
1077 for (
const auto &corner : corners) {
1078 if (tiled & corner.edges) {
1081 wl_region_subtract(region,
UNPACK2(corner.xy), radius_local, radius_local);
1085 wl_surface_set_opaque_region(win->
wl.surface, region);
1087 wl_region_destroy(region);
1097#ifdef USE_EVENT_BACKGROUND_THREAD
1099 "Only from main thread!");
1103#ifdef WITH_GHOST_CSD
1110 const bool scale_changed = dpi_changed ||
1112 bool surface_needs_commit =
false;
1113 bool surface_needs_resize_for_backend =
false;
1114 bool surface_needs_buffer_scale =
false;
1121 &surface_needs_commit,
1122 &surface_needs_resize_for_backend,
1123 &surface_needs_buffer_scale);
1129 win, &surface_needs_commit, &surface_needs_buffer_scale);
1134 surface_needs_buffer_scale =
true;
1138 if (surface_needs_resize_for_backend) {
1142 if (surface_needs_buffer_scale) {
1148 if (decor.
pending.ack_configure) {
1149 xdg_surface_ack_configure(decor.
surface, decor.
pending.ack_configure_serial);
1151 surface_needs_commit =
true;
1153 decor.
pending.ack_configure =
false;
1154 decor.
pending.ack_configure_serial = 0;
1160 if (surface_needs_commit) {
1161#ifdef USE_EVENT_BACKGROUND_THREAD
1165 wl_surface_commit(win->
wl.surface);
1171 system->
pushEvent(std::make_unique<GHOST_Event>(
1189 "GHOST internal active state does not match WAYLAND!");
1217#ifdef WITH_GHOST_CSD
1218 if (GWL_WindowCSD *xdg_csd = win->xdg_csd) {
1221 xdg_csd->csd_elems_num = 0;
1224 gwl_window_csd_elems_update(win);
1226 if (state_changed) {
1240 if (state_changed) {
1246 gwl_window_csd_geometry_update(win);
1247 gwl_window_csd_margin_update(win);
1248 gwl_window_csd_opaque_region_update(win);
1255#ifdef USE_EVENT_BACKGROUND_THREAD
1285 if (scale_fractional_a < scale_fractional_b) {
1288 if (scale_fractional_a > scale_fractional_b) {
1297 int *r_scale_fractional)
1300 for (
const GWL_Output *reg_output : outputs) {
1302 output_max = reg_output;
1307 if (r_scale_fractional) {
1312 return output_max->
scale;
1314 if (r_scale_fractional) {
1317 return scale_default;
1322 int *r_scale_fractional)
1325 for (
const GWL_Output *reg_output : outputs) {
1326 if (!output_uniform) {
1327 output_uniform = reg_output;
1331 output_uniform =
nullptr;
1336 if (output_uniform) {
1337 if (r_scale_fractional) {
1342 return output_uniform->
scale;
1344 if (r_scale_fractional) {
1347 return scale_default;
1357#define LOG (&LOG_WL_XDG_TOPLEVEL)
1366 CLOG_DEBUG(
LOG,
"configure (size=[%d, %d])", width, height);
1370#ifdef USE_EVENT_BACKGROUND_THREAD
1375 for (
int i = 0; i < 2; i++) {
1390 enum xdg_toplevel_state *
state;
1393 case XDG_TOPLEVEL_STATE_MAXIMIZED:
1396 case XDG_TOPLEVEL_STATE_FULLSCREEN:
1399 case XDG_TOPLEVEL_STATE_ACTIVATED:
1403 case XDG_TOPLEVEL_STATE_TILED_LEFT:
1406 case XDG_TOPLEVEL_STATE_TILED_RIGHT:
1409 case XDG_TOPLEVEL_STATE_TILED_TOP:
1412 case XDG_TOPLEVEL_STATE_TILED_BOTTOM:
1437 CLOG_DEBUG(
LOG,
"configure_bounds (size=[%d, %d])", width, height);
1449 wl_array *capabilities)
1454#ifdef WITH_GHOST_CSD
1460 case XDG_TOPLEVEL_WM_CAPABILITIES_WINDOW_MENU:
1463 case XDG_TOPLEVEL_WM_CAPABILITIES_MAXIMIZE:
1466 case XDG_TOPLEVEL_WM_CAPABILITIES_MINIMIZE:
1473 win->wm_capabilities_mask = type_mask;
1475 gwl_window_csd_layout_apply(win);
1507 xdg_activation_token_v1 *xdg_activation_token_v1,
1511 if (xdg_activation_token_v1 != win->
xdg.activation_token) {
1517 xdg_activation_v1_activate(activation_manager, token, win->
wl.surface);
1518 xdg_activation_token_v1_destroy(win->
xdg.activation_token);
1519 win->
xdg.activation_token =
nullptr;
1540#define LOG (&LOG_WL_FRACTIONAL_SCALE)
1543 void *data, wp_fractional_scale_v1 * , uint preferred_scale)
1545#ifdef USE_EVENT_BACKGROUND_THREAD
1546 std::lock_guard lock_frame_guard{
static_cast<GWL_Window *
>(data)->frame_pending_mutex};
1549 "preferred_scale (preferred_scale=%.6f)",
1573#define LOG (&LOG_WL_IMAGE_DESCRIPTION)
1581 wp_image_description_v1 * ,
1585 CLOG_WARN(
LOG,
"failed (cause=%u): %s", cause, msg ? msg :
"");
1590 wp_image_description_v1 * ,
1599#ifdef WP_IMAGE_DESCRIPTION_V1_READY2_SINCE_VERSION
1600static void image_description_handle_ready2(
void *data,
1601 wp_image_description_v1 * ,
1602 uint32_t identity_lo,
1603 uint32_t identity_hi)
1605 CLOG_INFO(
LOG,
"ready2 (identity_lo=%u, identity_hi=%u)", identity_lo, identity_hi);
1615#ifdef WP_IMAGE_DESCRIPTION_V1_READY2_SINCE_VERSION
1616 image_description_handle_ready2,
1629#define LOG (&LOG_WL_XDG_TOPLEVEL_DECORATION)
1632 void *data, zxdg_toplevel_decoration_v1 * ,
const uint32_t mode)
1638 win->
xdg_decor->
mode = (zxdg_toplevel_decoration_v1_mode)mode;
1654#define LOG (&LOG_WL_XDG_SURFACE)
1657 xdg_surface *xdg_surface,
1658 const uint32_t serial)
1668#ifdef USE_EVENT_BACKGROUND_THREAD
1669 std::lock_guard lock_frame_guard{
static_cast<GWL_Window *
>(data)->frame_pending_mutex};
1674#ifdef USE_EVENT_BACKGROUND_THREAD
1676 const bool is_main_thread = system->
main_thread_id == std::this_thread::get_id();
1677 if (!is_main_thread) {
1702#define LOG (&LOG_WL_SURFACE)
1734#if defined(WL_SURFACE_PREFERRED_BUFFER_SCALE_SINCE_VERSION) && \
1735 defined(WL_SURFACE_PREFERRED_BUFFER_TRANSFORM_SINCE_VERSION)
1736static void surface_handle_preferred_buffer_scale(
void * ,
1741 CLOG_DEBUG(
LOG,
"handle_preferred_buffer_scale (factor=%d)", factor);
1744static void surface_handle_preferred_buffer_transform(
void * ,
1757#if defined(WL_SURFACE_PREFERRED_BUFFER_SCALE_SINCE_VERSION) && \
1758 defined(WL_SURFACE_PREFERRED_BUFFER_TRANSFORM_SINCE_VERSION)
1759 surface_handle_preferred_buffer_scale,
1760 surface_handle_preferred_buffer_transform,
1778 const uint32_t width,
1779 const uint32_t height,
1783 const bool is_dialog,
1785 const bool exclusive,
1790 preferred_device_(preferred_device)
1792#ifdef USE_EVENT_BACKGROUND_THREAD
1793 std::lock_guard lock_server_guard{*system->
server_mutex};
1796 window_->ghost_window =
this;
1797 window_->ghost_system = system;
1798 window_->ghost_context_type = type;
1819 int scale_fractional_from_output;
1821 system_->outputs_get(), 0, &scale_fractional_from_output);
1823 window_->frame.size[0] =
int32_t(width);
1824 window_->frame.size[1] =
int32_t(height);
1826 window_->is_dialog = is_dialog;
1829 window_->wl.surface = wl_compositor_create_surface(system_->wl_compositor_get());
1834 wp_fractional_scale_manager_v1 *fractional_scale_manager =
1836 if (fractional_scale_manager) {
1837 window_->wp.fractional_scale_handle = wp_fractional_scale_manager_v1_get_fractional_scale(
1838 fractional_scale_manager, window_->wl.surface);
1839 wp_fractional_scale_v1_add_listener(
1847 const int32_t size_min[2] = {320, 240};
1854 decor.
surface = xdg_wm_base_get_xdg_surface(system_->xdg_decor_shell_get(),
1855 window_->wl.surface);
1859 xdg_toplevel_set_app_id(decor.
toplevel, xdg_app_id);
1864 if (parent_window && is_dialog) {
1873 wl_surface_set_user_data(window_->wl.surface,
this);
1877 const auto wayland_dispatch_until_configure_seen_or_error_fn = [&]() {
1900 if (system_->xdg_decor_manager_get()) {
1901 const bool use_window_frame = system_->use_window_frame_get();
1902 decor.
toplevel_decor = zxdg_decoration_manager_v1_get_toplevel_decoration(
1903 system_->xdg_decor_manager_get(), decor.
toplevel);
1904 zxdg_toplevel_decoration_v1_add_listener(
1908 const uint32_t mode = (use_window_frame && system_->use_window_frame_csd_get() ==
false) ?
1909 ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE :
1910 ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
1911 zxdg_toplevel_decoration_v1_set_mode(decor.
toplevel_decor, mode);
1914 if (!configure_deferred) {
1915 wl_surface_commit(window_->wl.surface);
1917 wayland_dispatch_until_configure_seen_or_error_fn();
1920#ifdef WITH_GHOST_CSD
1921 if (window_->xdg_decor && system_->use_window_frame_csd_get()) {
1922 window_->xdg_csd =
new GWL_WindowCSD;
1924 gwl_window_csd_layout_apply(window_);
1932 int early_buffer_scale = 0;
1933 int early_fractional_scale = 0;
1935 if (
const int test_fractional_scale =
1936 fractional_scale_manager ? (window_->frame_pending.fractional_scale_preferred ?
1937 window_->frame_pending.fractional_scale_preferred :
1938 scale_fractional_from_output) :
1942 early_fractional_scale = test_fractional_scale;
1947 early_fractional_scale = 0;
1950 else if (buffer_scale_from_output) {
1951 early_buffer_scale = buffer_scale_from_output;
1954 if (early_fractional_scale != 0) {
1957 window_->frame.fractional_scale_preferred = early_fractional_scale;
1958 window_->frame.fractional_scale = early_fractional_scale;
1959 window_->frame.buffer_scale = 1;
1961 window_->frame_pending.fractional_scale_preferred = early_fractional_scale;
1962 window_->frame_pending.fractional_scale = early_fractional_scale;
1963 window_->frame_pending.buffer_scale = 1;
1966 window_->frame_pending.is_scale_init =
true;
1969 bool surface_needs_commit_dummy =
false, surface_needs_buffer_scale_dummy =
false;
1971 window_, &surface_needs_commit_dummy, &surface_needs_buffer_scale_dummy);
1973 else if (early_buffer_scale != 0) {
1977 window_->frame.buffer_scale = early_buffer_scale;
1978 window_->frame_pending.buffer_scale = early_buffer_scale;
1981 window_->frame_pending.is_scale_init =
true;
1989 window_->frame.buffer_scale = 1;
1990 window_->frame_pending.buffer_scale = 1;
1991 GHOST_ASSERT(window_->frame_pending.is_scale_init ==
false,
1992 "An initialized scale is not expected");
1995 if (window_->frame_pending.is_scale_init) {
1998 "Fractional scale was not properly initialized");
2001 wl_surface_set_buffer_scale(window_->wl.surface, window_->frame.buffer_scale);
2004 if (window_->xdg_decor) {
2005 system_->xdg_toplevel_icon_update(
this, window_->xdg_decor->toplevel);
2013 window_->frame.size[0] = std::min(window_->frame.size[0],
2015 window_->frame.size[1] = std::min(window_->frame.size[1],
2022 if (configure_deferred) {
2024 wl_surface_commit(window_->wl.surface);
2026 wayland_dispatch_until_configure_seen_or_error_fn();
2033#ifdef WITH_OPENGL_BACKEND
2034 if (type == GHOST_kDrawingContextTypeOpenGL) {
2036 window_->wl.surface,
int(window_->frame.size[0]),
int(window_->frame.size[1]));
2039#ifdef WITH_VULKAN_BACKEND
2040 if (type == GHOST_kDrawingContextTypeVulkan) {
2042 window_->backend.vulkan_window_info->
size[0] = window_->frame.size[0];
2043 window_->backend.vulkan_window_info->size[1] = window_->frame.size[1];
2051 GHOST_PRINT(
"Failed to create drawing context" << std::endl);
2054 window_->is_valid_setup =
true;
2057 if (window_->is_valid_setup ==
false) {
2066 wp_color_manager_v1 *color_manager =
nullptr;
2067#ifdef WITH_VULKAN_BACKEND
2068 if (type == GHOST_kDrawingContextTypeVulkan &&
2069 GHOST_ContextVK::supportsWaylandColorManagement() ==
GHOST_kSuccess)
2074 if (color_manager) {
2075 wp_image_description_v1 *image_description =
nullptr;
2078 wp_image_description_creator_params_v1 *image_creator_params =
2079 wp_color_manager_v1_create_parametric_creator(color_manager);
2080 wp_image_description_creator_params_v1_set_tf_named(
2081 image_creator_params, WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR);
2082 wp_image_description_creator_params_v1_set_primaries_named(
2083 image_creator_params, WP_COLOR_MANAGER_V1_PRIMARIES_SRGB);
2085 image_description = wp_image_description_creator_params_v1_create(image_creator_params);
2109 image_description = wp_color_manager_v1_create_windows_scrgb(color_manager);
2115 if (image_description) {
2124 while (!wait.
done) {
2131 window_->wp.color_management_surface = wp_color_manager_v1_get_surface(
2132 color_manager, window_->wl.surface);
2133 wp_color_management_surface_v1_set_image_description(
2134 window_->wp.color_management_surface,
2136 WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL);
2143 wp_image_description_v1_destroy(image_description);
2147#ifdef WITH_GHOST_CSD
2148 if (window_->xdg_csd) {
2152 gwl_window_csd_opaque_region_update(window_);
2159 wl_surface_commit(window_->wl.surface);
2161#ifdef WITH_OPENGL_BACKEND
2162 if (type == GHOST_kDrawingContextTypeOpenGL) {
2174 window_->is_init =
true;
2179#ifdef USE_EVENT_BACKGROUND_THREAD
2180 std::lock_guard lock_server_guard{*system_->server_mutex};
2185#ifdef WITH_OPENGL_BACKEND
2186 if (window_->ghost_context_type == GHOST_kDrawingContextTypeOpenGL) {
2190#ifdef WITH_VULKAN_BACKEND
2191 if (window_->ghost_context_type == GHOST_kDrawingContextTypeVulkan) {
2192 delete window_->backend.vulkan_window_info;
2198 if (window_->xdg.activation_token) {
2199 xdg_activation_token_v1_destroy(window_->xdg.activation_token);
2200 window_->xdg.activation_token =
nullptr;
2203 if (window_->wp.fractional_scale_handle) {
2204 wp_fractional_scale_v1_destroy(window_->wp.fractional_scale_handle);
2205 window_->wp.fractional_scale_handle =
nullptr;
2208 if (window_->wp.viewport) {
2209 wp_viewport_destroy(window_->wp.viewport);
2210 window_->wp.viewport =
nullptr;
2213 if (window_->wp.color_management_surface) {
2214 wp_color_management_surface_v1_destroy(window_->wp.color_management_surface);
2215 window_->wp.color_management_surface =
nullptr;
2222#ifdef WITH_GHOST_CSD
2223 if (window_->xdg_csd) {
2224 GWL_WindowCSD &xdg_csd = *window_->xdg_csd;
2225 if (xdg_csd.margin_buffer) {
2226 wl_buffer_destroy(xdg_csd.margin_buffer);
2228 if (xdg_csd.margin_viewport) {
2229 wp_viewport_destroy(xdg_csd.margin_viewport);
2231 if (xdg_csd.margin_subsurface) {
2232 wl_subsurface_destroy(xdg_csd.margin_subsurface);
2234 if (xdg_csd.margin_surface) {
2235 system_->window_surface_unref(xdg_csd.margin_surface);
2236 wl_surface_destroy(xdg_csd.margin_surface);
2238 delete window_->xdg_csd;
2239 window_->xdg_csd =
nullptr;
2245 system_->window_surface_unref(window_->wl.surface);
2247 wl_surface_destroy(window_->wl.surface);
2254 if (window_->cursor_generator) {
2261#ifdef USE_EVENT_BACKGROUND_THREAD
2264 GHOST_ASSERT(system_->main_thread_id == std::this_thread::get_id(),
"Only from main thread!");
2271 return system_->cursor_shape_check(cursor_shape);
2276#ifdef USE_EVENT_BACKGROUND_THREAD
2277 std::lock_guard lock_server_guard{*system_->server_mutex};
2286 bounds = &bounds_buf;
2289 if (system_->window_cursor_grab_set(mode,
2294 window_->wl.surface,
2295 this->scale_params_get(),
2296 this->window_->ghost_context_type))
2305#ifdef USE_EVENT_BACKGROUND_THREAD
2306 std::lock_guard lock_server_guard{*system_->server_mutex};
2310 system_->getWindowManager()->getActiveWindow());
2324 wl_display *display = system_->wl_display_get();
2325#ifdef USE_CURSOR_IMMEDIATE_DISPATCH
2339 ok = system_->cursor_shape_check(shape);
2349#ifdef USE_EVENT_BACKGROUND_THREAD
2350 std::lock_guard lock_server_guard{*system_->server_mutex};
2352 return system_->cursor_grab_use_software_display_get(
cursor_grab_);
2359#ifdef USE_EVENT_BACKGROUND_THREAD
2360 std::lock_guard lock_server_guard{*system_->server_mutex};
2363 if (window_->cursor_generator) {
2366 window_->cursor_generator = cursor_generator;
2372 wl_display *display = system_->wl_display_get();
2375#ifdef USE_CURSOR_IMMEDIATE_DISPATCH
2383 const uint8_t *
mask,
2385 const int hot_spot[2],
2386 const bool can_invert_color)
2394 (void)can_invert_color;
2401#ifdef USE_EVENT_BACKGROUND_THREAD
2402 std::lock_guard lock_server_guard{*system_->server_mutex};
2404 return system_->cursor_bitmap_get(bitmap);
2414#ifdef USE_EVENT_BACKGROUND_THREAD
2415 std::lock_guard lock_server_guard{*system_->server_mutex};
2423 return window_->title.empty() ?
"untitled" : window_->title;
2434 bounds.
set(0, 0,
UNPACK2(window_->frame.size));
2439 return setClientSize(width, uint32_t(window_->frame.size[1]));
2444 return setClientSize(uint32_t(window_->frame.size[0]), height);
2449#ifdef USE_EVENT_BACKGROUND_THREAD
2450 std::lock_guard lock_server_guard{*system_->server_mutex};
2451 std::lock_guard lock_frame_guard{window_->frame_pending_mutex};
2456 frame_pending.
size[0] = width;
2457 frame_pending.
size[1] = height;
2485 return window_->frame.tiled_edges;
2491 if (!system_->native_pixel_) {
2498 if (window_->frame.fractional_scale) {
2502 return window_->frame.buffer_scale *
base_dpi;
2507#ifdef USE_EVENT_BACKGROUND_THREAD
2508 std::lock_guard lock_server_guard{*system_->server_mutex};
2510 const GHOST_TSuccess ok = system_->cursor_visibility_set(visible);
2512 wl_display *display = system_->wl_display_get();
2515#ifdef USE_CURSOR_IMMEDIATE_DISPATCH
2524#ifdef USE_EVENT_BACKGROUND_THREAD
2525 std::lock_guard lock_server_guard{*system_->server_mutex};
2532#ifdef USE_EVENT_BACKGROUND_THREAD
2533 std::lock_guard lock_server_guard{*system_->server_mutex};
2558 return window_->is_dialog;
2569#ifdef WITH_VULKAN_BACKEND
2570 case GHOST_kDrawingContextTypeVulkan: {
2572 GHOST_kVulkanPlatformWayland,
2575 window_->wl.surface,
2576 system_->wl_display_get(),
2577 window_->backend.vulkan_window_info,
2582 if (
context->initializeDrawingContext()) {
2590#ifdef WITH_OPENGL_BACKEND
2591 case GHOST_kDrawingContextTypeOpenGL: {
2592 for (
int minor = 6; minor >= 3; --minor) {
2596 EGLNativeWindowType(window_->backend.egl_window),
2597 EGLNativeDisplayType(system_->wl_display_get()),
2598 EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
2606 if (
context->initializeDrawingContext()) {
2621#ifdef WITH_INPUT_IME
2623void GHOST_WindowWayland::beginIME(
2627 system_->ime_begin(
this,
x,
y - h,
w, h, completed);
2630void GHOST_WindowWayland::endIME()
2632 system_->ime_end(
this);
2647 return window_->frame.buffer_scale;
2653 wl_buffer_destroy(icon.
buffer);
2661 return window_->xdg_icon;
2669 scale_params->
is_fractional = (window_->frame.fractional_scale != 0);
2670 scale_params->
scale = scale_params->
is_fractional ? window_->frame.fractional_scale :
2671 window_->frame.buffer_scale;
2672 return *scale_params;
2677 if (window_->frame.fractional_scale) {
2680 return value / window_->frame.buffer_scale;
2685 if (window_->frame.fractional_scale) {
2688 return value * window_->frame.buffer_scale;
2693 return window_->wl.surface;
2698 return window_->outputs;
2711 return system_->pushEvent_maybe_pending(
2719#ifdef USE_EVENT_BACKGROUND_THREAD
2720 const bool is_main_thread = system_->main_thread_id == std::this_thread::get_id();
2726 if (window_->is_init) {
2727 if (system_->getWindowManager()->setActiveWindow(
this) ==
GHOST_kFailure) {
2741#ifdef USE_EVENT_BACKGROUND_THREAD
2742 const bool is_main_thread = system_->main_thread_id == std::this_thread::get_id();
2747 if (window_->is_init) {
2748 system_->getWindowManager()->setWindowInactive(
this);
2751 const GHOST_TSuccess success = system_->pushEvent_maybe_pending(std::make_unique<GHOST_Event>(
2758 return system_->pushEvent_maybe_pending(
2766 return system_->pushEvent_maybe_pending(std::make_unique<GHOST_Event>(
2780#ifdef USE_EVENT_BACKGROUND_THREAD
2781 if (system_->main_thread_id != std::this_thread::get_id()) {
2791#ifdef USE_EVENT_BACKGROUND_THREAD
2805 if (!system_->native_pixel_) {
2809#ifdef USE_EVENT_BACKGROUND_THREAD
2810 if (system_->main_thread_id != std::this_thread::get_id()) {
2815 int fractional_scale_next = -1;
2816 int fractional_scale_from_output = 0;
2820 if (scale_next == 0) [[unlikely]] {
2824#ifdef USE_EVENT_BACKGROUND_THREAD
2825 std::lock_guard lock_frame_guard{window_->frame_pending_mutex};
2828 if (window_->wp.fractional_scale_handle) {
2831 if (window_->frame_pending.fractional_scale_preferred != 0) {
2832 fractional_scale_next = window_->frame_pending.fractional_scale_preferred;
2837 if (fractional_scale_next == -1) {
2838 fractional_scale_next = fractional_scale_from_output;
2842 bool changed =
false;
2844 const bool is_fractional_prev = window_->frame.fractional_scale != 0;
2848 window_->frame_pending.fractional_scale = is_fractional_next ? fractional_scale_next : 0;
2849 window_->frame_pending.buffer_scale = is_fractional_next ?
2853 const int fractional_scale_prev = window_->frame.fractional_scale ?
2854 window_->frame.fractional_scale :
2859 bool do_frame_resize =
false;
2860 bool do_frame_update =
false;
2862 if (window_->frame_pending.is_scale_init ==
false) {
2863 window_->frame_pending.is_scale_init =
true;
2873 do_frame_resize =
false;
2874 do_frame_update =
true;
2883 if (window_->frame_pending.buffer_scale != window_->frame.buffer_scale) {
2884 do_frame_resize =
true;
2889 if ((fractional_scale_prev != fractional_scale_next) ||
2890 (window_->frame_pending.buffer_scale != window_->frame.buffer_scale))
2892 do_frame_resize =
true;
2896 if (do_frame_resize) {
2903 for (
size_t i = 0; i <
ARRAY_SIZE(window_->frame_pending.size); i++) {
2904 const int value = window_->frame_pending.size[i] ? window_->frame_pending.size[i] :
2905 window_->frame.size[i];
2906 if (is_fractional_prev || is_fractional_next) {
2907 window_->frame_pending.size[i] = lroundf((value *
double(fractional_scale_next)) /
2908 double(fractional_scale_prev));
2911 window_->frame_pending.size[i] = (value * scale_next) / scale_prev;
2913 if (window_->frame_pending.buffer_scale > 1) {
2914 gwl_round_int_by(&window_->frame_pending.size[i], window_->frame_pending.buffer_scale);
2917 do_frame_update =
true;
2920 if (do_frame_update) {
2930 std::vector<GWL_Output *> &outputs = window_->outputs;
2931 if (std::ranges::find(outputs,
output) != outputs.end()) {
2934 outputs.push_back(
output);
2940 return std::erase(window_->outputs,
output) > 0;
2943#ifdef USE_EVENT_BACKGROUND_THREAD
2951 "Run from main thread!");
2958#ifdef WITH_GHOST_CSD
2960xdg_toplevel *GHOST_WindowWayland::xdg_toplevel_get()
2977 GHOST_ASSERT(this->system_->use_window_frame_csd_get(),
"caller must ensure");
2978 return window_->xdg_csd->active_type;
2980void GHOST_WindowWayland::csd_elem_active_type_set(
GHOST_TCSD_Type type)
2982 GHOST_ASSERT(this->system_->use_window_frame_csd_get(),
"caller must ensure");
2983 window_->xdg_csd->active_type = type;
2987 GHOST_ASSERT(this->system_->use_window_frame_csd_get(),
"caller must ensure");
2988 *r_num = window_->xdg_csd->csd_elems_num;
2989 return window_->xdg_csd->csd_elems;
2992void GHOST_WindowWayland::csd_layout_refresh()
2994 if (!window_->xdg_csd) {
2997 gwl_window_csd_layout_apply(window_);
2999 gwl_window_csd_elems_update(window_);
3006 GHOST_ASSERT(this->system_->use_window_frame_csd_get(),
"caller must ensure");
3007 return window_->xdg_csd->event_state;
3010void GHOST_WindowWayland::csd_margin_geometry_get(
int32_t &r_margin_size,
3011 int32_t r_window_size[2])
const
3013 GHOST_ASSERT(this->system_->use_window_frame_csd_get(),
"caller must ensure");
3014 const GWL_WindowCSD *xdg_csd = window_->xdg_csd;
3015 r_margin_size = xdg_csd->margin_size_local;
3016 r_window_size[0] = xdg_csd->margin_window_size_local[0];
3017 r_window_size[1] = xdg_csd->margin_window_size_local[1];
#define CLOG_DEBUG(clg_ref,...)
#define CLOG_WARN(clg_ref,...)
#define CLOG_INFO(clg_ref,...)
#define GHOST_OPENGL_EGL_CONTEXT_FLAGS
#define GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY
#define GHOST_ASSERT(x, info)
GWL_Output * ghost_wl_output_user_data(wl_output *wl_output)
void ghost_wl_surface_tag(wl_surface *wl_surface)
bool ghost_wl_display_report_error_if_set(wl_display *display)
bool ghost_wl_output_own(const wl_output *wl_output)
wl_buffer * ghost_wl_buffer_create_transparent_pixel(wl_shm *shm)
wl_fixed_t gwl_window_scale_wl_fixed_to(const GWL_WindowScaleParams &scale_params, wl_fixed_t value)
wl_fixed_t gwl_window_scale_wl_fixed_from(const GWL_WindowScaleParams &scale_params, wl_fixed_t value)
int gwl_window_scale_int_to(const GWL_WindowScaleParams &scale_params, int value)
#define FRACTIONAL_DENOMINATOR
int gwl_window_scale_buffer_size_to(const GWL_WindowScaleParams &scale_params, int logical_size, int *r_buffer_scale)
int gwl_window_scale_int_from(const GWL_WindowScaleParams &scale_params, int value)
#define GHOST_CSD_DPI_FRACTIONAL_BASE
@ GHOST_kWindowStateMinimized
@ GHOST_kWindowStateMaximized
@ GHOST_kWindowStateNormal
@ GHOST_kWindowStateFullScreen
@ GHOST_kStandardCursorCustom
@ GHOST_kStandardCursorDefault
@ GHOST_kEventWindowClose
@ GHOST_kEventWindowActivate
@ GHOST_kEventWindowUpdateDecor
@ GHOST_kEventWindowDeactivate
@ GHOST_kEventWindowDPIHintChanged
@ GHOST_kCSDTypeButtonClose
@ GHOST_kCSDTypeButtonMinimize
@ GHOST_kCSDTypeButtonMaximize
@ GHOST_kCSDTypeButtonMenu
GHOST_TDrawingContextType
@ GHOST_kDrawingContextTypeNone
#define GHOST_kCSDType_NUM
@ GHOST_kWindowTiledRight
@ GHOST_kWindowTiledBottom
#define WL_ARRAY_FOR_EACH(pos, array)
static void wp_fractional_scale_handle_preferred_scale(void *data, wp_fractional_scale_v1 *, uint preferred_scale)
static bool gwl_round_int_test(const int value, const int round_value)
static GHOST_TSuccess gwl_window_cursor_shape_refresh(GHOST_TStandardCursor shape, const GHOST_CursorGenerator *cg, GHOST_SystemWayland *system)
eGWL_PendingWindowActions
@ PENDING_WINDOW_FRAME_CONFIGURE
@ PENDING_OUTPUT_SCALE_UPDATE_DEFERRED
@ PENDING_WINDOW_CURSOR_SHAPE_REFRESH
@ PENDING_WINDOW_SURFACE_COMMIT
@ PENDING_OUTPUT_SCALE_UPDATE
static CLG_LogRef LOG_WL_IMAGE_DESCRIPTION
void gwl_xdg_window_icon_free(GWL_XDG_WindowIcon &icon)
static void gwl_window_cursor_custom_clear(GHOST_CursorGenerator **cg)
static void gwl_round_int2_by(int value_p[2], const int round_value)
static uint divide_ceil_uint(const uint x, const uint d)
static void surface_handle_leave(void *data, wl_surface *, wl_output *wl_output)
static void gwl_window_frame_pending_fractional_scale_set_notest(GWL_Window *win, bool *r_surface_needs_commit, bool *r_surface_needs_buffer_scale)
static CLG_LogRef LOG_WL_XDG_TOPLEVEL_DECORATION
static void gwl_window_frame_update_from_pending_no_lock(GWL_Window *win)
static int gwl_window_fractional_from_viewport(const GWL_WindowFrame &frame, const int value)
static bool gwl_window_viewport_unset(GWL_Window *win, bool *r_surface_needs_commit, bool *r_surface_needs_buffer_scale)
static int outputs_uniform_scale_or_default(const std::span< GWL_Output *const > outputs, const int32_t scale_default, int *r_scale_fractional)
static GHOST_TWindowState gwl_window_state_get(const GWL_Window *win)
static const wp_image_description_v1_listener image_description_listener
static void xdg_toplevel_handle_configure(void *data, xdg_toplevel *, const int32_t width, const int32_t height, wl_array *states)
static CLG_LogRef LOG_WL_XDG_SURFACE
static void gwl_window_frame_pending_fractional_scale_set(GWL_Window *win, bool *r_surface_needs_commit, bool *r_surface_needs_buffer_scale)
static void xdg_surface_handle_configure(void *data, xdg_surface *xdg_surface, const uint32_t serial)
static int gwl_window_fractional_to_viewport_round(const GWL_WindowFrame &frame, const int value)
static void gwl_window_frame_update_from_pending(GWL_Window *win)
static const wp_fractional_scale_v1_listener wp_fractional_scale_listener
static CLG_LogRef LOG_WL_SURFACE
static const xdg_toplevel_listener xdg_toplevel_listener
static const zxdg_toplevel_decoration_v1_listener xdg_toplevel_decoration_v1_listener
static GHOST_TSuccess gwl_window_cursor_custom_load(const GHOST_CursorGenerator &cg, GHOST_SystemWayland *system)
static bool gwl_window_state_set(GWL_Window *win, const GHOST_TWindowState state)
static void image_description_handle_ready(void *data, wp_image_description_v1 *, uint32_t identity)
static void gwl_window_frame_pending_size_set(GWL_Window *win, bool *r_surface_needs_commit, bool *r_surface_needs_resize_for_backend, bool *r_surface_needs_buffer_scale)
static bool gwl_window_state_set_for_xdg(xdg_toplevel *toplevel, const GHOST_TWindowState state, const GHOST_TWindowState state_current)
static void gwl_xdg_decor_window_destroy(GWL_XDG_Decor_Window *decor)
static void xdg_toplevel_handle_wm_capabilities(void *data, xdg_toplevel *, wl_array *capabilities)
static CLG_LogRef LOG_WL_FRACTIONAL_SCALE
static void gwl_window_activate(GWL_Window *win)
static void gwl_window_resize_for_backend(GWL_Window *win, const int32_t size[2])
static constexpr size_t base_dpi
static void gwl_window_pending_actions_handle(GWL_Window *win)
static int outputs_max_scale_or_default(const std::span< GWL_Output *const > outputs, const int32_t scale_default, int *r_scale_fractional)
static const xdg_surface_listener xdg_surface_listener
static int gwl_window_fractional_from_viewport_round(const GWL_WindowFrame &frame, const int value)
static int output_scale_cmp(const GWL_Output *output_a, const GWL_Output *output_b)
static void image_description_handle_failed(void *data, wp_image_description_v1 *, uint32_t cause, const char *msg)
static void gwl_round_int_by(int *value_p, const int round_value)
static CLG_LogRef LOG_WL_XDG_TOPLEVEL
static bool gwl_window_viewport_size_update(GWL_Window *win)
static void xdg_toplevel_handle_configure_bounds(void *data, xdg_toplevel *, const int32_t width, const int32_t height)
static void xdg_activation_handle_done(void *data, xdg_activation_token_v1 *xdg_activation_token_v1, const char *token)
static const xdg_activation_token_v1_listener xdg_activation_listener
static void gwl_window_pending_actions_tag(GWL_Window *win, enum eGWL_PendingWindowActions type)
static void surface_handle_enter(void *data, wl_surface *, wl_output *wl_output)
static int gwl_window_fractional_to_viewport(const GWL_WindowFrame &frame, const int value)
static bool gwl_window_viewport_set(GWL_Window *win, bool *r_surface_needs_commit, bool *r_surface_needs_buffer_scale)
static void gwl_window_cursor_custom_free(GHOST_CursorGenerator *cg)
static void gwl_window_title_set(GWL_Window *win, const char *title)
static void xdg_toplevel_decoration_handle_configure(void *data, zxdg_toplevel_decoration_v1 *, const uint32_t mode)
static const xdg_activation_token_v1_listener * xdg_activation_listener_get()
static const wl_surface_listener wl_surface_listener
static void xdg_toplevel_handle_close(void *data, xdg_toplevel *)
void gwl_xdg_window_icon_free(GWL_XDG_WindowIcon &icon)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
GHOST_ContextEGL(const GHOST_System *const system, const GHOST_ContextParams &context_params, EGLNativeWindowType nativeWindow, EGLNativeDisplayType nativeDisplay, EGLint contextProfileMask, EGLint contextMajorVersion, EGLint contextMinorVersion, EGLint contextFlags, EGLint contextResetNotificationStrategy, EGLenum api)
GHOST_ContextNone(const GHOST_ContextParams &context_params)
GHOST_ContextVK(const GHOST_ContextParams &context_params, GHOST_TVulkanPlatformType platform, Window window, Display *display, wl_surface *wayland_surface, wl_display *wayland_display, const GHOST_ContextVK_WindowInfo *wayland_window_info, int contextMajorVersion, int contextMinorVersion, const GHOST_GPUDevice &preferred_device, const GHOST_WindowHDRInfo *hdr_info_=nullptr)
virtual void set(int32_t l, int32_t t, int32_t r, int32_t b)
static const char * xdg_app_id_get()
bool supports_color_manager_extended_srgb_linear() const
struct wl_event_queue * wp_color_manager_queue_get()
void xdg_toplevel_icon_update(GHOST_WindowWayland *window, struct xdg_toplevel *toplevel)
bool supports_color_manager_feature_windows_scrgb() const
uint64_t getMilliSeconds() const override
std::thread::id main_thread_id
struct wl_display * wl_display_get()
struct wl_compositor * wl_compositor_get()
struct wp_fractional_scale_manager_v1 * wp_fractional_scale_manager_get()
struct wl_subcompositor * wl_subcompositor_get()
struct wl_shm * wl_shm_get() const
GHOST_TSuccess cursor_shape_set(GHOST_TStandardCursor shape)
struct wp_viewporter * wp_viewporter_get()
struct wl_seat * wl_seat_active_get_with_input_serial(uint32_t &serial)
GHOST_TSuccess cursor_shape_custom_set(const GHOST_CursorGenerator &cg)
struct wp_color_manager_v1 * wp_color_manager_get()
std::atomic< bool > has_pending_actions_for_window
std::mutex * server_mutex
struct xdg_activation_v1 * xdg_activation_manager_get()
GHOST_WindowManager * getWindowManager() const
const GHOST_CSD_Params & getWindowCSD() const
const GHOST_CSD_Layout & getWindowCSD_Layout() const override
GHOST_TSuccess pushEvent(std::unique_ptr< const GHOST_IEvent > event)
void setWindowCSD_Layout(const GHOST_CSD_Layout &csd_layout)
GHOST_IWindow * getActiveWindow() const
const struct GWL_WindowScaleParams & scale_params_get() const
GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override
bool outputs_leave(GWL_Output *output)
GHOST_TSuccess setClientWidth(uint32_t width) override
wl_fixed_t wl_fixed_to_window(wl_fixed_t value) const
GHOST_TSuccess setOrder(GHOST_TWindowOrder order) override
GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) override
GHOST_TSuccess notify_size()
GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor cursor_shape) override
void outputs_changed_update_scale_tag()
GHOST_TSuccess setState(GHOST_TWindowState state) override
GHOST_TSuccess setWindowCursorVisibility(bool visible) override
GHOST_WindowWayland(GHOST_SystemWayland *system, const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, const GHOST_IWindow *parent_window, GHOST_TDrawingContextType type, const bool is_dialog, const GHOST_ContextParams &context_params, const bool exclusive, const GHOST_GPUDevice &preferred_device)
void pending_actions_handle()
GHOST_TWindowState getState() const override
bool getCursorGrabUseSoftwareDisplay() override
bool isDialog() const override
struct wl_surface * wl_surface_get() const
GHOST_TSuccess notify_decor_redraw()
bool getValid() const override
wl_fixed_t wl_fixed_from_window(wl_fixed_t value) const
std::string getTitle() const override
GHOST_TSuccess deactivate()
bool outputs_changed_update_scale()
void getClientBounds(GHOST_Rect &bounds) const override
const std::span< GWL_Output *const > outputs_get() const
GHOST_TSuccess activate()
uint16_t getDPIHint() override
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
GHOST_TSuccess swapBufferRelease() override
GHOST_TSuccess setClientHeight(uint32_t height) override
GHOST_TSuccess cursor_shape_refresh()
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
bool outputs_enter(GWL_Output *output)
GHOST_TSuccess setWindowCustomCursorShape(const uint8_t *bitmap, const uint8_t *mask, const int size[2], const int hot_spot[2], bool can_invert_color) override
~GHOST_WindowWayland() override
GHOST_TSuccess invalidate() override
GWL_XDG_WindowIcon & gwl_xdg_icon_get()
GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape) override
GHOST_TSuccess setWindowCustomCursorGenerator(GHOST_CursorGenerator *cursor_generator) override
void setTitle(const char *title) override
void getWindowBounds(GHOST_Rect &bounds) const override
GHOST_TWindowTiledFlag getTiledEdges() const override
GHOST_TSuccess getCursorBitmap(GHOST_CursorBitmapRef *bitmap) override
virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect &bounds) const
GHOST_ContextParams want_context_params_
GHOST_TSuccess swapBufferRelease() override
GHOST_TStandardCursor cursor_shape_
GHOST_TAxisFlag cursor_grab_axis_
GHOST_TStandardCursor getCursorShape() const override
GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type) override
int32_t cursor_grab_init_pos_[2]
GHOST_TSuccess setSwapInterval(int interval) override
GHOST_TSuccess releaseNativeHandles()
bool getValid() const override
GHOST_Window(uint32_t width, uint32_t height, GHOST_TWindowState state, const GHOST_ContextParams &context_params, const bool exclusive=false)
GHOST_WindowHDRInfo hdr_info_
GHOST_TGrabCursorMode cursor_grab_
bool hasAlpha() const override
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
std::array< VecBase< T, 3 >, 8 > corners(const Bounds< VecBase< T, 3 > > &bounds)
int context(const bContext *C, const char *member, bContextDataResult *result)
BMesh const char void * data
GHOST_TCSD_Type buttons[5]
int32_t(*) layout_callback(const int32_t window_size[2], const int32_t fractional_scale[2], GHOST_TWindowState windowstate, const struct GHOST_CSD_Layout *csd_layout, GHOST_CSD_Elem *csd_elems)
void(*) free_fn(struct GHOST_CursorGenerator *cursor_generator)
bool has_scale_fractional
GHOST_TWindowTiledFlag tiled_edges
int fractional_scale_preferred
wp_color_management_surface_v1 * color_management_surface
wp_fractional_scale_v1 * fractional_scale_handle
xdg_activation_token_v1 * activation_token
GHOST_SystemWayland * ghost_system
std::atomic< bool > pending_actions[PENDING_NUM]
GWL_XDG_Decor_Window * xdg_decor
GWL_WindowScaleParams scale_params
struct GWL_Window::@042130253023266106323023200262152144123366214227 xdg
struct GWL_Window::@063046005070270072365331175015153324252156224275 wp
std::mutex frame_pending_mutex
struct GWL_Window::@301133305237256027042255364215230134332217040376 backend
GWL_WindowFrame frame_pending
GWL_XDG_WindowIcon xdg_icon
struct GWL_Window::@136307353141236064335106064300222257023101227000 wl
GHOST_WindowWayland * ghost_window
GHOST_CursorGenerator * cursor_generator
std::vector< GWL_Output * > outputs
GHOST_TDrawingContextType ghost_context_type
uint32_t ack_configure_serial
zxdg_toplevel_decoration_v1 * toplevel_decor
struct GWL_XDG_Decor_Window::@016247100160304020072271262017253272164041351323 pending
enum zxdg_toplevel_decoration_v1_mode mode
bool initial_configure_seen
struct wl_buffer * buffer
#define wl_display_dispatch_queue(...)
#define wl_display_dispatch_pending(...)
#define wl_display_dispatch(...)
#define wl_display_flush(...)
#define wl_proxy_set_queue(...)
#define wl_egl_window_resize(...)
#define wl_egl_window_create(...)
#define wl_egl_window_destroy(...)