Commit Graph

322 Commits

Author SHA1 Message Date
norepro 800223a043 Release X11 pressed events on true focus loss
There are two "focus lost" signals in the Godot X11 display server:

1. `FocusOut` - native X11 signal

2. `NOTIFICATION_APPLICATION_FOCUS_OUT` - Godot signal after 250ms of
no other window getting focus.

When focus is lost, the intent is to clear any input pressed events so
that, when focus returns, we have a clean slate.

The bug is that the pressed events are (attempted to be) cleared on the
first signal, X11's `FocusOut`. This is always a no-op because it
returns early if the application still has focus. Godot's X11 server
only sets that flag after the second signal, not the first.

Move the pressed event clearing from the first signal handler to the
second. This makes clearing pressed events do what it says.

This does not affect Wayland because it does not have the 250ms grace
period.

Simple repro is to load any 3D scene, hold 'W' and, while 'W' is held,
click on any non-Godot window. Release 'W', click back to Godot, and
hold RMB. It will zoom forward as if 'W' is still pressed.

After the fix, the same test has RMB look around as expected when no
other keys are pressed.

Fixes #118897
2026-05-08 00:41:20 -07:00
norepro 3ffec30d51 Fix some X11 BadWindow errors not being ignored
Godot suppresses X11 BadWindow errors during some operations because
they can occur with normal usage.

X11 errors are asynchronous. Sometimes, when a BadWindow error is sent,
it is dequeued after the original non-BadWindow-suppressing error
handler has been restored. This results in an error callstack being
shown to the user.

Call `XSync` before restoring the original error handler. This ensures
that any queued BadWindow errors go to the suppressing handler.

Fixes #117814
2026-05-06 22:55:31 -07:00
Thaddeus Crews 50cc2823d5 Merge pull request #118404 from Rindbee/set-ime_active-to-false-when-the-IME-stops
Set `ime_active` to `false` when the IME stops on X11
2026-04-13 11:46:10 -05:00
风青山 52e79da660 Warn only once when the input method stops on X11
An input method is not required for the application to run.

However, it is still assumed that the user requires an input method
for text input; therefore, in order to avoid generating spam, a warning
is issued only once whenever the input method becomes inactive.
2026-04-13 17:05:19 +08:00
风青山 045c16b596 Set ime_active to false when the IME stops 2026-04-11 14:44:56 +08:00
Thaddeus Crews 0f51ed6099 Merge pull request #113543 from bruvzg/win_icons
[DisplayServer] Add per window icon support.
2026-03-30 13:35:47 -05:00
Pāvels Nadtočajevs 5fc9f6b3d9 [macOS/Windows] Remove dynamically linked ANGLE support, add flag to enable/disable ANGLE.
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2026-03-23 13:01:25 +02:00
Pāvels Nadtočajevs d47b8d7a64 [DisplayServer] Add per window icon support. 2026-03-23 11:27:09 +02:00
Rémi Verschelde 4336184ea4 Style: Tweak ordering of thirdparty includes with angle brackets 2026-03-18 10:41:59 +01:00
Rémi Verschelde 98868393cc Style: Enforce #include validation hook 2026-03-18 10:41:59 +01:00
Rémi Verschelde e33e98a26f Style: Apply clang-format grouping rules 2026-03-17 20:11:01 +01:00
DSOE1024 980639ff6e Fix preprocessor directive for X11 and GLES3 2026-03-17 17:26:24 +08:00
Rémi Verschelde 0d7bd115da Remove unused includes in drivers with clangd-tidy 2026-03-14 22:38:02 +01:00
Rémi Verschelde d9b81615e5 Remove unused includes in platform with clangd-tidy
Handled Linux, Windows, Android, and (partially) Web.
2026-03-14 22:37:05 +01:00
Rémi Verschelde e015e8bde4 Remove unused includes in core with clangd-tidy 2026-03-11 06:41:36 +01:00
Rémi Verschelde eabb9a63d4 Rename callable_method_pointer.h to callable_mp.h and include it explicitly
This allows removing it from `class_db.h`, significantly reducing the amount of files
that include it transitively.

Also includes some include cleanup in `control.h` and `rich_text_label.h` done while
ensure they don't depend on `callable_mp`.
2026-03-04 16:23:23 +01:00
Rémi Verschelde 727b06a79f Move ProcessID typedef out of OS
This allows decoupling a number of files from `os.h`.
2026-03-04 15:00:45 +01:00
Rémi Verschelde f332faf46b Explicitly include core/os/os.h where used 2026-03-04 09:54:10 +01:00
Rémi Verschelde 8c0f175c94 Decouple RenderingServer from as much of the codebase as possible
Notably decouples it from:
- AccessibilityServer
- DisplayServer
- Viewport
- Window
2026-03-03 12:48:07 +01:00
Rémi Verschelde a447ac95ec Move DisplayServer enums and typedefs to DisplayServerEnums
This will allow decoupling `display_server.h` from a number of headers in the
codebase which only require those enums and not all the DisplayServer API.
2026-03-03 12:44:02 +01:00
Pāvels Nadtočajevs 1306221592 Move accessibility methods/enums from DisplayServer to the AccessibilityServer dedicated singleton. 2026-03-02 13:48:29 +02:00
StarryWorm 357fa00a4a rm class_db.h from resource.h 2026-02-27 19:08:29 -05:00
Lukas Tenbrink e9465cd380 Move variant pools to their own compile unit. 2026-02-21 13:24:17 +01:00
Rémi Verschelde ad4b910a10 Minimize include dependencies of display_server.h
- Removes `native_menu.h` dependency from `display_server.h`.
  It's now forward-declared in all DisplayServer implementations and should
  be included in the .cpp's.
- Removes some unused `rb_set.h` and `rb_map.h` dependencies, which leads to
  having to include them explicitly in half the scene and editor codebase...
  which shows how much we depend on `display_server.h`.
- Forward-declare `input_event.h`, so now we need only `keyboard.h`.
2026-02-17 19:45:31 +01:00
David Snopek 3f5c5d969f OpenXR: Fix OpenGL initialization with Monado on X11 2026-02-13 11:58:27 -06:00
Skyth 8fbf2f1e14 Reduce includes to rendering device.
Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
2026-02-10 16:58:50 +03:00
Thaddeus Crews 435e6c3830 CI: Enable Ruff preview options; bump version
• 1.14.7 → 1.15.0
2026-02-05 12:20:10 -06:00
Nintorch eb019511ed Optimize files that #include input.h header 2026-01-28 14:21:00 +05:00
Dario 542f8ddf22 Fix fallback to OpenGL3 from Vulkan initialization on Android. 2026-01-14 23:55:21 -03:00
AR cc71d5a2be X11: Allow moving a fullscreen/maximized window to another screen/display 2026-01-13 09:52:07 +01:00
Chestnut45 3be85a8614 Lower timeout in X11 event thread to fix input delay issue 2025-12-18 15:01:48 -04:00
Haoyu Qiu f694c64ac4 X11: Skip Motif function hints when borderless 2025-11-27 21:53:28 +08:00
Thaddeus Crews e1b3387513 Merge pull request #108704 from wjt/xdg-portal-inhibit
Support XDG Inhibit portal
2025-11-24 15:59:56 -06:00
Thaddeus Crews 2135cb1707 Merge pull request #103749 from Rindbee/fix-cannot-input-after-restarting-the-input-method-on-x11
Fix cannot input Chinese after restarting the input method on X11
2025-11-19 11:03:58 -06:00
Will Thompson 1a3a254e26 Support XDG Inhibit portal
Previously, on Linux and BSD, inhibiting the screensaver was handled
using the org.freedesktop.ScreenSaver D-Bus API. Unfortunately, this API
is not available in a Flatpak sandbox. (This is because there is a
desire to tie inhibit sessions to a specific app and visible window; but
the org.freedesktop.ScreenSaver API does not support this.)

As a result, when using the Flatpak build of the Godot Editor (or a
Flatpak-ed build of a game) and using a controller to play a game, the
session will become idle after a few minutes.

The XDG desktop portal -- which is already used for color-picking, file
choosing, and querying the system theme -- has an Inhibit interface that
provides a superset of the functionality of the
org.freedesktop.ScreenSaver API, and is available to any sandboxed app.

Refactor code for making XDG portal requests that was previously
duplicated for the FileChooser and ColorPicker portal code. Check the
portal version to determine whether these portals can be used:

- FileChooser portal version 3 is required due to the use of the
  "directory" parameter.

- On the Settings portal, the only addition in version 2 is the
  ReadOne() method which is not used here, so version 1 suffices.

- On the Screenshot portal, the only addition in version 2 is the
  "interactive" parameter to the Screenshot() method; this code only
  uses the PickColor() method, so version 1 suffices.

Then, add support for the Inhibit portal. Use it if available and if
running in a sandbox. Prefer to use org.freedesktop.ScreenSaver if not
running in a sandbox, even if the portal is available, because (at least
in the GNOME 43 implementation of the portal) it does not work correctly
if the portal cannot map the request to a running app. This adds a small
amount of complexity to the implementation, but supporting both APIs is
necessary anyway (there are many systems in the wild that support
org.freedesktop.ScreenSaver but not the desktop portal).

Fixes https://github.com/godotengine/godot/issues/108634
2025-11-17 11:46:28 +01:00
Pāvels Nadtočajevs 281c74550a Make utterance_id 64-bit. 2025-11-07 10:21:20 +02:00
Haoyu Qiu 48575336e8 X11: Fix minimize/maximize buttons can't be hidden 2025-10-29 19:37:23 +08:00
Thaddeus Crews 685fa3281c Merge pull request #111580 from timothyqiu/x11-fullscreen
X11: Fix fullscreen exit behavior
2025-10-27 10:01:52 -05:00
Pāvels Nadtočajevs cf21565c77 [X11] Fix keyboard_get_label_from_physical errors when used on key without label. 2025-10-18 19:25:55 +03:00
Haoyu Qiu 66e5bce653 X11: Fix memory leak in screen_get_refresh_rate 2025-10-14 20:30:05 +08:00
Haoyu Qiu 0f81e8c7fe X11: Fix fullscreen exit behavior 2025-10-13 15:03:13 +08:00
Haoyu Qiu 7680190768 Revert "Fix the sliding window problem in linux occur due to reparenting of the window during the decoration via tracking the parent of the window"
This reverts commit 932afc3bf5.
2025-10-13 15:03:13 +08:00
Thaddeus Crews 4ea49aecaf Merge pull request #110990 from timothyqiu/x11-min-max
X11: Fix minimization of maximized windows
2025-10-10 10:26:02 -05:00
Ben Rog-Wilhelm 0a584250ae Fix: Libgodot build on Linux. 2025-10-10 04:31:14 -05:00
Thaddeus Crews 5935a32e32 Core: Cleanup headers in core/config
- `MainLoop` now forward-declared in `OS`
2025-10-06 09:20:56 -05:00
Thaddeus Crews d1d28c0bcf Merge pull request #111223 from Ivorforce/remove-iterator-include
Replace `std::size` usage with `std_size` to avoid `<iterator>` include.
2025-10-06 09:06:49 -05:00
chocola-mint ead282ff13 Remove file_access.h and script_backtrace.h includes from logger.h. 2025-10-05 17:49:23 +09:00
Lukas Tenbrink 1db0a60dc0 Replace std::size usage with std_size to avoid <iterator> include. 2025-10-05 00:26:11 +02:00
Aaron Franke 3d1c9fd5de Move server files into their subfolders 2025-09-30 19:39:39 -07:00
Haoyu Qiu 12f8c78231 X11: Fix minimization of maximized windows 2025-09-28 12:19:54 +08:00