comparison dep/animia/src/win/wayland.cc @ 219:2f6d27fcdf7d

dep/animia: wayland: fixup wlroots code
author Paper <paper@paper.us.eu.org>
date Sun, 07 Jan 2024 13:37:50 -0500
parents 8a482049b968
children 53211cb1e7f5
comparison
equal deleted inserted replaced
218:c39ad2a8587d 219:2f6d27fcdf7d
134 static void registry_handle_global(void* data, struct wl_registry* registry, uint32_t name, const char* interface, 134 static void registry_handle_global(void* data, struct wl_registry* registry, uint32_t name, const char* interface,
135 uint32_t version) { 135 uint32_t version) {
136 struct global_data* global = reinterpret_cast<struct global_data*>(data); 136 struct global_data* global = reinterpret_cast<struct global_data*>(data);
137 137
138 if (!std::strcmp(interface, ext_foreign_toplevel_list_v1_interface.name)) { 138 if (!std::strcmp(interface, ext_foreign_toplevel_list_v1_interface.name)) {
139 if (!global->zwlr_toplevel_mgr || version < 3) 139 if (global->zwlr_toplevel_mgr)
140 return; // we don't need this then 140 return; // we don't need this then
141 141
142 global->ext_toplevel_list = reinterpret_cast<struct ext_foreign_toplevel_list_v1*>( 142 global->ext_toplevel_list = reinterpret_cast<struct ext_foreign_toplevel_list_v1*>(
143 wl_registry_bind(registry, name, &ext_foreign_toplevel_list_v1_interface, 1)); 143 wl_registry_bind(registry, name, &ext_foreign_toplevel_list_v1_interface, 1));
144 144
145 ext_foreign_toplevel_list_v1_add_listener(global->ext_toplevel_list, &ext_toplevel_list_listener, 145 ext_foreign_toplevel_list_v1_add_listener(global->ext_toplevel_list, &ext_toplevel_list_listener,
146 &global->windows); 146 &global->windows);
147 } else if (!std::strcmp(interface, zwlr_foreign_toplevel_manager_v1_interface.name)) { 147 } else if (!std::strcmp(interface, zwlr_foreign_toplevel_manager_v1_interface.name)) {
148 if (!global->ext_toplevel_list) 148 if (global->ext_toplevel_list || version < 3)
149 return; // we don't need this then 149 return; // we don't need this then
150 150
151 global->zwlr_toplevel_mgr = reinterpret_cast<struct zwlr_foreign_toplevel_manager_v1*>( 151 global->zwlr_toplevel_mgr = reinterpret_cast<struct zwlr_foreign_toplevel_manager_v1*>(
152 wl_registry_bind(registry, name, &zwlr_foreign_toplevel_manager_v1_interface, 1)); 152 wl_registry_bind(registry, name, &zwlr_foreign_toplevel_manager_v1_interface, 1));
153 153
183 183
184 wl_callback_destroy(callback); 184 wl_callback_destroy(callback);
185 sync->callback = nullptr; 185 sync->callback = nullptr;
186 186
187 if (sync->sync == 0) { 187 if (sync->sync == 0) {
188 if (!sync->global.ext_toplevel_list || !sync->global.zwlr_toplevel_mgr) { 188 if (!sync->global.ext_toplevel_list && !sync->global.zwlr_toplevel_mgr) {
189 std::cerr << "animia/wayland: Wayland server doesn't support ext-foreign-toplevel-list-v1 nor " 189 std::cerr << "animia/wayland: Wayland server doesn't support ext-foreign-toplevel-list-v1 nor "
190 "wlr-foreign-toplevel-management-unstable-v1!" 190 "wlr-foreign-toplevel-management-unstable-v1!"
191 << std::endl; 191 << std::endl;
192 sync->loop = false; 192 sync->loop = false;
193 return; 193 return;