summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/crash_handler_x11.cpp2
-rw-r--r--platform/x11/detect.py14
-rw-r--r--platform/x11/os_x11.cpp8
-rw-r--r--platform/x11/os_x11.h2
-rw-r--r--platform/x11/pck_embed.ld4
-rw-r--r--platform/x11/pck_embed.legacy.ld10
6 files changed, 33 insertions, 7 deletions
diff --git a/platform/x11/crash_handler_x11.cpp b/platform/x11/crash_handler_x11.cpp
index 3a91c62546..19c8f71d0e 100644
--- a/platform/x11/crash_handler_x11.cpp
+++ b/platform/x11/crash_handler_x11.cpp
@@ -107,7 +107,7 @@ static void handle_crash(int sig) {
output.erase(output.length() - 1, 1);
}
- fprintf(stderr, "[%ld] %s (%ls)\n", i, fname, output.c_str());
+ fprintf(stderr, "[%ld] %s (%ls)\n", (long int)i, fname, output.c_str());
}
free(strings);
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index b8ff97279d..957779ee83 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -171,7 +171,7 @@ def configure(env):
else:
env.Append(CCFLAGS=['-flto'])
env.Append(LINKFLAGS=['-flto'])
-
+
if not env['use_llvm']:
env['RANLIB'] = 'gcc-ranlib'
env['AR'] = 'gcc-ar'
@@ -232,7 +232,7 @@ def configure(env):
if not env['builtin_enet']:
env.ParseConfig('pkg-config libenet --cflags --libs')
- if not env['builtin_squish'] and env['tools']:
+ if not env['builtin_squish']:
env.ParseConfig('pkg-config libsquish --cflags --libs')
if not env['builtin_zstd']:
@@ -329,9 +329,15 @@ def configure(env):
if env["execinfo"]:
env.Append(LIBS=['execinfo'])
-
+
if not env['tools']:
- env.Append(LINKFLAGS=['-T', 'platform/x11/pck_embed.ld'])
+ import subprocess
+ import re
+ binutils_version = re.search('\s(\d+\.\d+)', str(subprocess.check_output(['ld', '-v']))).group(1)
+ if float(binutils_version) >= 2.30:
+ env.Append(LINKFLAGS=['-T', 'platform/x11/pck_embed.ld'])
+ else:
+ env.Append(LINKFLAGS=['-T', 'platform/x11/pck_embed.legacy.ld'])
## Cross-compilation
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index b9cfd6f386..2f0d49e6dd 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1684,6 +1684,10 @@ bool OS_X11::is_window_always_on_top() const {
return current_videomode.always_on_top;
}
+bool OS_X11::is_window_focused() const {
+ return window_focused;
+}
+
void OS_X11::set_borderless_window(bool p_borderless) {
if (get_borderless_window() == p_borderless)
@@ -2276,6 +2280,8 @@ void OS_X11::process_xevents() {
minimized = false;
window_has_focus = true;
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
+ window_focused = true;
+
if (mouse_mode_grab) {
// Show and update the cursor if confined and the window regained focus.
if (mouse_mode == MOUSE_MODE_CONFINED)
@@ -2303,6 +2309,7 @@ void OS_X11::process_xevents() {
window_has_focus = false;
input->release_pressed_events();
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
+ window_focused = false;
if (mouse_mode_grab) {
//dear X11, I try, I really try, but you never work, you do whathever you want.
@@ -3497,6 +3504,7 @@ OS_X11::OS_X11() {
xi.last_relative_time = 0;
layered_window = false;
minimized = false;
+ window_focused = true;
xim_style = 0L;
mouse_mode = MOUSE_MODE_VISIBLE;
}
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 35c55aab54..01e5aac3df 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -195,6 +195,7 @@ class OS_X11 : public OS_Unix {
int video_driver_index;
bool maximized;
+ bool window_focused;
//void set_wm_border(bool p_enabled);
void set_wm_fullscreen(bool p_enabled);
void set_wm_above(bool p_enabled);
@@ -284,6 +285,7 @@ public:
virtual bool is_window_maximized() const;
virtual void set_window_always_on_top(bool p_enabled);
virtual bool is_window_always_on_top() const;
+ virtual bool is_window_focused() const;
virtual void request_attention();
virtual void set_borderless_window(bool p_borderless);
diff --git a/platform/x11/pck_embed.ld b/platform/x11/pck_embed.ld
index fe09144d88..57a1994043 100644
--- a/platform/x11/pck_embed.ld
+++ b/platform/x11/pck_embed.ld
@@ -1,9 +1,9 @@
SECTIONS
{
/* Add a zero-sized section; the exporter will patch it to enclose the data appended to the executable (embedded PCK) */
- pck 0 (NOLOAD) :
+ pck 0 (INFO) :
{
- /* Just some content to avoid the linker discarding the section */
+ /* binutils >= 2.30 allow it being zero-sized, but needs something between the braces to keep the section */
. = ALIGN(8);
}
}
diff --git a/platform/x11/pck_embed.legacy.ld b/platform/x11/pck_embed.legacy.ld
new file mode 100644
index 0000000000..a23013ba7a
--- /dev/null
+++ b/platform/x11/pck_embed.legacy.ld
@@ -0,0 +1,10 @@
+SECTIONS
+{
+ /* The exporter will patch this section to enclose the data appended to the executable (embedded PCK) */
+ pck 0 (INFO) : AT ( ADDR (.rodata) + SIZEOF (.rodata) )
+ {
+ /* binutils < 2.30 need some actual content for the linker not to discard the section */
+ BYTE(0);
+ }
+}
+INSERT AFTER .rodata;