1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Implement DisplayServer.beep.

This commit is contained in:
Pāvels Nadtočajevs
2024-11-17 22:40:39 +02:00
parent 0f20e67d8d
commit 84650f2018
17 changed files with 146 additions and 0 deletions

View File

@@ -497,6 +497,12 @@ void WaylandThread::_wl_registry_on_global(void *data, struct wl_registry *wl_re
return;
}
if (strcmp(interface, xdg_system_bell_v1_interface.name) == 0) {
registry->xdg_system_bell = (struct xdg_system_bell_v1 *)wl_registry_bind(wl_registry, name, &xdg_system_bell_v1_interface, 1);
registry->xdg_system_bell_name = name;
return;
}
if (strcmp(interface, xdg_activation_v1_interface.name) == 0) {
registry->xdg_activation = (struct xdg_activation_v1 *)wl_registry_bind(wl_registry, name, &xdg_activation_v1_interface, 1);
registry->xdg_activation_name = name;
@@ -692,6 +698,17 @@ void WaylandThread::_wl_registry_on_global_remove(void *data, struct wl_registry
return;
}
if (name == registry->xdg_system_bell_name) {
if (registry->xdg_system_bell) {
xdg_system_bell_v1_destroy(registry->xdg_system_bell);
registry->xdg_system_bell = nullptr;
}
registry->xdg_system_bell_name = 0;
return;
}
if (name == registry->xdg_activation_name) {
if (registry->xdg_activation) {
xdg_activation_v1_destroy(registry->xdg_activation);
@@ -3282,6 +3299,12 @@ struct wl_surface *WaylandThread::window_get_wl_surface(DisplayServer::WindowID
return ws.wl_surface;
}
void WaylandThread::beep() const {
if (registry.xdg_system_bell) {
xdg_system_bell_v1_ring(registry.xdg_system_bell, nullptr);
}
}
void WaylandThread::window_set_max_size(DisplayServer::WindowID p_window_id, const Size2i &p_size) {
// TODO: Use window IDs for multiwindow support.
WindowState &ws = main_window;
@@ -4364,6 +4387,10 @@ void WaylandThread::destroy() {
xdg_activation_v1_destroy(registry.xdg_activation);
}
if (registry.xdg_system_bell) {
xdg_system_bell_v1_destroy(registry.xdg_system_bell);
}
if (registry.xdg_decoration_manager) {
zxdg_decoration_manager_v1_destroy(registry.xdg_decoration_manager);
}