summaryrefslogtreecommitdiff
path: root/platform/linuxbsd/display_server_x11.h
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linuxbsd/display_server_x11.h')
-rw-r--r--platform/linuxbsd/display_server_x11.h85
1 files changed, 58 insertions, 27 deletions
diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h
index 2d07361deb..ee47d1a12c 100644
--- a/platform/linuxbsd/display_server_x11.h
+++ b/platform/linuxbsd/display_server_x11.h
@@ -46,6 +46,10 @@
#include "servers/rendering/renderer_compositor.h"
#include "servers/rendering_server.h"
+#if defined(SPEECHD_ENABLED)
+#include "tts_linux.h"
+#endif
+
#if defined(GLES3_ENABLED)
#include "gl_manager_x11.h"
#endif
@@ -96,8 +100,8 @@ class DisplayServerX11 : public DisplayServer {
Atom xdnd_finished;
Atom xdnd_selection;
Atom xdnd_aware;
- Atom requested;
- int xdnd_version;
+ Atom requested = None;
+ int xdnd_version = 5;
#if defined(GLES3_ENABLED)
GLManager_X11 *gl_manager = nullptr;
@@ -108,10 +112,14 @@ class DisplayServerX11 : public DisplayServer {
#endif
#if defined(DBUS_ENABLED)
- FreeDesktopScreenSaver *screensaver;
+ FreeDesktopScreenSaver *screensaver = nullptr;
bool keep_screen_on = false;
#endif
+#ifdef SPEECHD_ENABLED
+ TTS_Linux *tts = nullptr;
+#endif
+
struct WindowData {
Window x11_window;
::XIC xic;
@@ -133,7 +141,6 @@ class DisplayServerX11 : public DisplayServer {
ObjectID instance_id;
- bool menu_type = false;
bool no_focus = false;
//better to guess on the fly, given WM can change it
@@ -145,12 +152,21 @@ class DisplayServerX11 : public DisplayServer {
Vector2i last_position_before_fs;
bool focused = true;
bool minimized = false;
+ bool is_popup = false;
+
+ Rect2i parent_safe_rect;
unsigned int focus_order = 0;
};
Map<WindowID, WindowData> windows;
+ unsigned int last_mouse_monitor_mask = 0;
+ Vector2i last_mouse_monitor_pos;
+ uint64_t time_since_popup = 0;
+
+ List<WindowID> popup_list;
+
WindowID last_focused_window = INVALID_WINDOW_ID;
WindowID window_id_counter = MAIN_WINDOW_ID;
@@ -158,21 +174,21 @@ class DisplayServerX11 : public DisplayServer {
String internal_clipboard;
String internal_clipboard_primary;
- Window xdnd_source_window;
+ Window xdnd_source_window = 0;
::Display *x11_display;
- char *xmbstring;
- int xmblen;
- unsigned long last_timestamp;
- ::Time last_keyrelease_time;
+ char *xmbstring = nullptr;
+ int xmblen = 0;
+ unsigned long last_timestamp = 0;
+ ::Time last_keyrelease_time = 0;
::XIM xim;
::XIMStyle xim_style;
static void _xim_destroy_callback(::XIM im, ::XPointer client_data,
::XPointer call_data);
Point2i last_mouse_pos;
- bool last_mouse_pos_valid;
- Point2i last_click_pos;
- uint64_t last_click_ms;
+ bool last_mouse_pos_valid = false;
+ Point2i last_click_pos = Point2i(-100, -100);
+ uint64_t last_click_ms = 0;
MouseButton last_click_button_index = MouseButton::NONE;
MouseButton last_button_state = MouseButton::NONE;
bool app_focused = false;
@@ -205,7 +221,7 @@ class DisplayServerX11 : public DisplayServer {
void _get_key_modifier_state(unsigned int p_x11_state, Ref<InputEventWithModifiers> state);
void _flush_mouse_motion();
- MouseMode mouse_mode;
+ MouseMode mouse_mode = MOUSE_MODE_VISIBLE;
Point2i center;
void _handle_key_event(WindowID p_window, XKeyEvent *p_event, LocalVector<XEvent> &p_events, uint32_t &p_event_index, bool p_echo = false);
@@ -217,31 +233,27 @@ class DisplayServerX11 : public DisplayServer {
String _clipboard_get(Atom p_source, Window x11_window) const;
void _clipboard_transfer_ownership(Atom p_source, Window x11_window) const;
- //bool minimized;
- //bool window_has_focus;
- bool do_mouse_warp;
+ bool do_mouse_warp = false;
- const char *cursor_theme;
- int cursor_size;
+ const char *cursor_theme = nullptr;
+ int cursor_size = 0;
XcursorImage *img[CURSOR_MAX];
Cursor cursors[CURSOR_MAX];
Cursor null_cursor;
- CursorShape current_cursor;
+ CursorShape current_cursor = CURSOR_ARROW;
Map<CursorShape, Vector<Variant>> cursors_cache;
- bool layered_window;
+ bool layered_window = false;
String rendering_driver;
- //bool window_focused;
- //void set_wm_border(bool p_enabled);
void set_wm_fullscreen(bool p_enabled);
void set_wm_above(bool p_enabled);
typedef xrr_monitor_info *(*xrr_get_monitors_t)(Display *dpy, Window window, Bool get_active, int *nmonitors);
typedef void (*xrr_free_monitors_t)(xrr_monitor_info *monitors);
- xrr_get_monitors_t xrr_get_monitors;
- xrr_free_monitors_t xrr_free_monitors;
- void *xrandr_handle;
+ xrr_get_monitors_t xrr_get_monitors = nullptr;
+ xrr_free_monitors_t xrr_free_monitors = nullptr;
+ void *xrandr_handle = nullptr;
Bool xrandr_ext_ok;
struct Property {
@@ -283,13 +295,28 @@ protected:
void _window_changed(XEvent *event);
public:
+ void mouse_process_popups();
+ void popup_open(WindowID p_window);
+ void popup_close(WindowID p_window);
+
virtual bool has_feature(Feature p_feature) const override;
virtual String get_name() const override;
+#ifdef SPEECHD_ENABLED
+ virtual bool tts_is_speaking() const override;
+ virtual bool tts_is_paused() const override;
+ virtual Array tts_get_voices() const override;
+
+ virtual void tts_speak(const String &p_text, const String &p_voice, int p_volume = 50, float p_pitch = 1.f, float p_rate = 1.f, int p_utterance_id = 0, bool p_interrupt = false) override;
+ virtual void tts_pause() override;
+ virtual void tts_resume() override;
+ virtual void tts_stop() override;
+#endif
+
virtual void mouse_set_mode(MouseMode p_mode) override;
virtual MouseMode mouse_get_mode() const override;
- virtual void mouse_warp_to_position(const Point2i &p_to) override;
+ virtual void warp_mouse(const Point2i &p_position) override;
virtual Point2i mouse_get_position() const override;
virtual MouseButton mouse_get_button_state() const override;
@@ -317,6 +344,10 @@ public:
virtual void show_window(WindowID p_id) override;
virtual void delete_sub_window(WindowID p_id) override;
+ virtual WindowID window_get_active_popup() const override;
+ virtual void window_set_popup_safe_rect(WindowID p_window, const Rect2i &p_rect) override;
+ virtual Rect2i window_get_popup_safe_rect(WindowID p_window) const override;
+
virtual WindowID get_window_at_screen_position(const Point2i &p_position) const override;
virtual int64_t window_get_native_handle(HandleType p_handle_type, WindowID p_window = MAIN_WINDOW_ID) const override;
@@ -376,7 +407,7 @@ public:
virtual void cursor_set_shape(CursorShape p_shape) override;
virtual CursorShape cursor_get_shape() const override;
- virtual void cursor_set_custom_image(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) override;
+ virtual void cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) override;
virtual int keyboard_get_layout_count() const override;
virtual int keyboard_get_current_layout() const override;