Implement DisplayServer.beep.
This commit is contained in:
parent
0f20e67d8d
commit
84650f2018
17 changed files with 146 additions and 0 deletions
|
|
@ -172,11 +172,22 @@ env.WAYLAND_API_CODE(
|
|||
source="#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v1.xml",
|
||||
)
|
||||
|
||||
env.WAYLAND_API_HEADER(
|
||||
target="protocol/xdg_system_bell.gen.h",
|
||||
source="#thirdparty/wayland-protocols/staging/xdg-system-bell/xdg-system-bell-v1.xml",
|
||||
)
|
||||
|
||||
env.WAYLAND_API_CODE(
|
||||
target="protocol/xdg_system_bell.gen.c",
|
||||
source="#thirdparty/wayland-protocols/staging/xdg-system-bell/xdg-system-bell-v1.xml",
|
||||
)
|
||||
|
||||
source_files = [
|
||||
"protocol/wayland.gen.c",
|
||||
"protocol/viewporter.gen.c",
|
||||
"protocol/fractional_scale.gen.c",
|
||||
"protocol/xdg_shell.gen.c",
|
||||
"protocol/xdg_system_bell.gen.c",
|
||||
"protocol/xdg_foreign.gen.c",
|
||||
"protocol/xdg_decoration.gen.c",
|
||||
"protocol/xdg_activation.gen.c",
|
||||
|
|
|
|||
|
|
@ -319,6 +319,10 @@ Error DisplayServerWayland::file_dialog_with_options_show(const String &p_title,
|
|||
|
||||
#endif
|
||||
|
||||
void DisplayServerWayland::beep() const {
|
||||
wayland_thread.beep();
|
||||
}
|
||||
|
||||
void DisplayServerWayland::mouse_set_mode(MouseMode p_mode) {
|
||||
if (p_mode == mouse_mode) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -181,6 +181,8 @@ public:
|
|||
virtual Error file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback) override;
|
||||
#endif
|
||||
|
||||
virtual void beep() const override;
|
||||
|
||||
virtual void mouse_set_mode(MouseMode p_mode) override;
|
||||
virtual MouseMode mouse_get_mode() const override;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@
|
|||
#include "wayland/protocol/xdg_decoration.gen.h"
|
||||
#include "wayland/protocol/xdg_foreign.gen.h"
|
||||
#include "wayland/protocol/xdg_shell.gen.h"
|
||||
#include "wayland/protocol/xdg_system_bell.gen.h"
|
||||
|
||||
#ifdef LIBDECOR_ENABLED
|
||||
#ifdef SOWRAP_ENABLED
|
||||
|
|
@ -162,6 +163,9 @@ public:
|
|||
struct zxdg_decoration_manager_v1 *xdg_decoration_manager = nullptr;
|
||||
uint32_t xdg_decoration_manager_name = 0;
|
||||
|
||||
struct xdg_system_bell_v1 *xdg_system_bell = nullptr;
|
||||
uint32_t xdg_system_bell_name = 0;
|
||||
|
||||
struct xdg_activation_v1 *xdg_activation = nullptr;
|
||||
uint32_t xdg_activation_name = 0;
|
||||
|
||||
|
|
@ -926,6 +930,8 @@ public:
|
|||
bool has_message();
|
||||
Ref<Message> pop_message();
|
||||
|
||||
void beep() const;
|
||||
|
||||
void window_create(DisplayServer::WindowID p_window_id, int p_width, int p_height);
|
||||
|
||||
struct wl_surface *window_get_wl_surface(DisplayServer::WindowID p_window_id) const;
|
||||
|
|
|
|||
|
|
@ -400,6 +400,10 @@ Error DisplayServerX11::file_dialog_with_options_show(const String &p_title, con
|
|||
|
||||
#endif
|
||||
|
||||
void DisplayServerX11::beep() const {
|
||||
XBell(x11_display, 0);
|
||||
}
|
||||
|
||||
void DisplayServerX11::mouse_set_mode(MouseMode p_mode) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
|
|
|
|||
|
|
@ -406,6 +406,8 @@ public:
|
|||
virtual Error file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback) override;
|
||||
#endif
|
||||
|
||||
virtual void beep() const override;
|
||||
|
||||
virtual void mouse_set_mode(MouseMode p_mode) override;
|
||||
virtual MouseMode mouse_get_mode() const override;
|
||||
|
||||
|
|
|
|||
|
|
@ -298,6 +298,8 @@ public:
|
|||
virtual Error file_dialog_show(const String &p_title, const String &p_current_directory, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const Callable &p_callback) override;
|
||||
virtual Error file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback) override;
|
||||
|
||||
virtual void beep() const override;
|
||||
|
||||
virtual void mouse_set_mode(MouseMode p_mode) override;
|
||||
virtual MouseMode mouse_get_mode() const override;
|
||||
|
||||
|
|
|
|||
|
|
@ -1200,6 +1200,10 @@ Error DisplayServerMacOS::_file_dialog_with_options_show(const String &p_title,
|
|||
return OK;
|
||||
}
|
||||
|
||||
void DisplayServerMacOS::beep() const {
|
||||
NSBeep();
|
||||
}
|
||||
|
||||
Error DisplayServerMacOS::dialog_input_text(String p_title, String p_description, String p_partial, const Callable &p_callback) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
|
|
|
|||
|
|
@ -786,6 +786,10 @@ void DisplayServerWindows::process_file_dialog_callbacks() {
|
|||
}
|
||||
}
|
||||
|
||||
void DisplayServerWindows::beep() const {
|
||||
MessageBeep(MB_OK);
|
||||
}
|
||||
|
||||
void DisplayServerWindows::mouse_set_mode(MouseMode p_mode) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
|
|
|
|||
|
|
@ -689,6 +689,8 @@ public:
|
|||
virtual Error file_dialog_show(const String &p_title, const String &p_current_directory, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const Callable &p_callback) override;
|
||||
virtual Error file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback) override;
|
||||
|
||||
virtual void beep() const override;
|
||||
|
||||
virtual void mouse_set_mode(MouseMode p_mode) override;
|
||||
virtual MouseMode mouse_get_mode() const override;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue