You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-20 14:45:44 +00:00
Detect KDE/LXQt and swap OK/Cancel buttons to Windows style.
This commit is contained in:
@@ -1142,6 +1142,10 @@ void DisplayServerWayland::cursor_set_custom_image(const Ref<Resource> &p_cursor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DisplayServerWayland::get_swap_cancel_ok() {
|
||||||
|
return swap_cancel_ok;
|
||||||
|
}
|
||||||
|
|
||||||
int DisplayServerWayland::keyboard_get_layout_count() const {
|
int DisplayServerWayland::keyboard_get_layout_count() const {
|
||||||
MutexLock mutex_lock(wayland_thread.mutex);
|
MutexLock mutex_lock(wayland_thread.mutex);
|
||||||
|
|
||||||
@@ -1450,6 +1454,10 @@ DisplayServerWayland::DisplayServerWayland(const String &p_rendering_driver, Win
|
|||||||
r_error = ERR_UNAVAILABLE;
|
r_error = ERR_UNAVAILABLE;
|
||||||
context = p_context;
|
context = p_context;
|
||||||
|
|
||||||
|
String current_desk = OS::get_singleton()->get_environment("XDG_CURRENT_DESKTOP").to_lower();
|
||||||
|
String session_desk = OS::get_singleton()->get_environment("XDG_SESSION_DESKTOP").to_lower();
|
||||||
|
swap_cancel_ok = (current_desk.contains("kde") || session_desk.contains("kde") || current_desk.contains("lxqt") || session_desk.contains("lxqt"));
|
||||||
|
|
||||||
Error thread_err = wayland_thread.init();
|
Error thread_err = wayland_thread.init();
|
||||||
|
|
||||||
if (thread_err != OK) {
|
if (thread_err != OK) {
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ class DisplayServerWayland : public DisplayServer {
|
|||||||
WaylandThread wayland_thread;
|
WaylandThread wayland_thread;
|
||||||
|
|
||||||
Context context;
|
Context context;
|
||||||
|
bool swap_cancel_ok = false;
|
||||||
|
|
||||||
String ime_text;
|
String ime_text;
|
||||||
Vector2i ime_selection;
|
Vector2i ime_selection;
|
||||||
@@ -295,6 +296,8 @@ public:
|
|||||||
virtual CursorShape cursor_get_shape() const override;
|
virtual CursorShape cursor_get_shape() const override;
|
||||||
virtual void cursor_set_custom_image(const Ref<Resource> &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 bool get_swap_cancel_ok() override;
|
||||||
|
|
||||||
virtual int keyboard_get_layout_count() const override;
|
virtual int keyboard_get_layout_count() const override;
|
||||||
virtual int keyboard_get_current_layout() const override;
|
virtual int keyboard_get_current_layout() const override;
|
||||||
virtual void keyboard_set_current_layout(int p_index) override;
|
virtual void keyboard_set_current_layout(int p_index) override;
|
||||||
|
|||||||
@@ -3395,6 +3395,10 @@ void DisplayServerX11::cursor_set_custom_image(const Ref<Resource> &p_cursor, Cu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DisplayServerX11::get_swap_cancel_ok() {
|
||||||
|
return swap_cancel_ok;
|
||||||
|
}
|
||||||
|
|
||||||
int DisplayServerX11::keyboard_get_layout_count() const {
|
int DisplayServerX11::keyboard_get_layout_count() const {
|
||||||
int _group_count = 0;
|
int _group_count = 0;
|
||||||
XkbDescRec *kbd = XkbAllocKeyboard();
|
XkbDescRec *kbd = XkbAllocKeyboard();
|
||||||
@@ -6515,8 +6519,12 @@ static ::XIMStyle _get_best_xim_style(const ::XIMStyle &p_style_a, const ::XIMSt
|
|||||||
DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, int64_t p_parent_window, Error &r_error) {
|
DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, int64_t p_parent_window, Error &r_error) {
|
||||||
KeyMappingX11::initialize();
|
KeyMappingX11::initialize();
|
||||||
|
|
||||||
|
String current_desk = OS::get_singleton()->get_environment("XDG_CURRENT_DESKTOP").to_lower();
|
||||||
|
String session_desk = OS::get_singleton()->get_environment("XDG_SESSION_DESKTOP").to_lower();
|
||||||
|
swap_cancel_ok = (current_desk.contains("kde") || session_desk.contains("kde") || current_desk.contains("lxqt") || session_desk.contains("lxqt"));
|
||||||
|
|
||||||
xwayland = OS::get_singleton()->get_environment("XDG_SESSION_TYPE").to_lower() == "wayland";
|
xwayland = OS::get_singleton()->get_environment("XDG_SESSION_TYPE").to_lower() == "wayland";
|
||||||
kde5_embed_workaround = OS::get_singleton()->get_environment("XDG_CURRENT_DESKTOP").to_lower() == "kde" && OS::get_singleton()->get_environment("KDE_SESSION_VERSION") == "5";
|
kde5_embed_workaround = current_desk == "kde" && OS::get_singleton()->get_environment("KDE_SESSION_VERSION") == "5";
|
||||||
|
|
||||||
native_menu = memnew(NativeMenu);
|
native_menu = memnew(NativeMenu);
|
||||||
context = p_context;
|
context = p_context;
|
||||||
|
|||||||
@@ -359,6 +359,7 @@ class DisplayServerX11 : public DisplayServer {
|
|||||||
void _update_context(WindowData &wd);
|
void _update_context(WindowData &wd);
|
||||||
|
|
||||||
Context context = CONTEXT_ENGINE;
|
Context context = CONTEXT_ENGINE;
|
||||||
|
bool swap_cancel_ok = false;
|
||||||
|
|
||||||
WindowID _get_focused_window_or_popup() const;
|
WindowID _get_focused_window_or_popup() const;
|
||||||
bool _window_focus_check();
|
bool _window_focus_check();
|
||||||
@@ -550,6 +551,8 @@ public:
|
|||||||
virtual CursorShape cursor_get_shape() const override;
|
virtual CursorShape cursor_get_shape() const override;
|
||||||
virtual void cursor_set_custom_image(const Ref<Resource> &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 bool get_swap_cancel_ok() override;
|
||||||
|
|
||||||
virtual int keyboard_get_layout_count() const override;
|
virtual int keyboard_get_layout_count() const override;
|
||||||
virtual int keyboard_get_current_layout() const override;
|
virtual int keyboard_get_current_layout() const override;
|
||||||
virtual void keyboard_set_current_layout(int p_index) override;
|
virtual void keyboard_set_current_layout(int p_index) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user