1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-28 16:07:14 +00:00
Commit Graph

41 Commits

Author SHA1 Message Date
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
风青山
5cb5eb59f9 Fix Chinese characters were not displayed correctly in DBusMessage
On OS with Chinese locale, you might receive the following message
when running an editor using the `--verbose` option:

```
ERROR: Error on D-Bus communication: æªæ	¾å°è¯·æ±ç
                                                         设置
   at: read_setting (platform/linuxbsd/freedesktop_portal_desktop.cpp:144)
```
2025-11-11 08:18:07 +08:00
Pāvels Nadtočajevs
0edb6bd4a0 [Linux/BSD] Initialize DBus only once. 2025-08-22 09:26:11 +03:00
Pāvels Nadtočajevs
1484771f26 Fix native file dialog crash with invalid filter. 2025-06-06 09:24:42 +03:00
A Thousand Ships
889410dcda Add String::replace_char(s) methods for performance and convenience 2025-04-10 13:08:45 +02:00
Thaddeus Crews
7a6c3b309f Merge pull request #105130 from bruvzg/uri_fix_plus
Add uri_file_decode to handle + in file names.
2025-04-09 18:11:56 -05:00
Pāvels Nadtočajevs
4310cb82b8 AccessKit integration for macOS, Linux, and Windows. 2025-04-08 20:25:47 +03:00
Pāvels Nadtočajevs
9abe2e5294 Add uri_file_decode to handle + in file names. 2025-04-07 23:49:17 +03:00
Thaddeus Crews
49fcd4ce46 Merge pull request #101546 from bruvzg/portal_color_picker
[Linux] Implement native color picker.
2025-03-17 10:52:29 -05:00
Pāvels Nadtočajevs
18f6c33d72 [DisplayServer] Implement get_accent_color on Linux. 2025-03-14 09:05:03 +02:00
A Thousand Ships
331a43a9d8 Add String::remove_char(s) methods for performance and convenience 2025-03-10 13:19:28 +01:00
A Thousand Ships
466590d0ec Use get_slicec instead of get_slice for single character splitters 2025-03-08 20:36:37 +01:00
Pāvels Nadtočajevs
05ca80632d [Linux] Implement native color picker. 2025-02-03 16:30:44 +02:00
Pāvels Nadtočajevs
86f56efbaa [FreeDesktop portal] Check for FileChooser and Settings interface availability instead of assuming it's always available. 2025-01-31 07:52:40 +02:00
Pāvels Nadtočajevs
e1f129cb52 Support MIME types in file dialog filters on macOS and Linux. 2025-01-04 22:05:35 +02:00
Rémi Verschelde
60e1490df1 Merge pull request #99644 from bruvzg/fd_all_name
Change file dialog all files filter name from `All Files (*)` to `All Files (*.*)`.
2024-12-02 17:20:23 +01:00
Rémi Verschelde
1fed9cf01f Merge pull request #99110 from bruvzg/gnome_fd
[Linux] Use safe IDs for native file dialog options. Show extensions in export dialog.
2024-12-02 15:51:07 +01:00
Pāvels Nadtočajevs
1d43fa9a64 Change file dialog all files filter name from All Files (*) to All Files(*.*). 2024-11-24 20:09:05 +02:00
Pāvels Nadtočajevs
f5fad7592f Use processed filter list for native dialogs. 2024-11-15 12:08:33 +02:00
Pāvels Nadtočajevs
ed7b4f5c4a [Linux] Use safe IDs for native file dialog options. 2024-11-15 08:45:33 +02:00
bruvzg
ace603bcb9 [Linux] Make file filters case insensitive. 2024-08-28 11:13:47 +03:00
bruvzg
7b4e3e021a [Linux] Fix "all files" filter in the native file dialog. 2024-08-28 10:14:01 +03:00
Rémi Verschelde
1dab521f2d Merge pull request #92208 from Calinou/linuxbsd-use-nanosleep
Use `OS::delay_usec()` to avoid using deprecated `usleep()` on Linux
2024-05-30 11:47:51 +02:00
bruvzg
714effdf07 [DisplayServer] Add error messages and descriptions to callbacks. 2024-05-28 17:36:54 +03:00
Hugo Locurcio
a008896f70 Use OS::delay_usec() to avoid using deprecated usleep() on Linux
usleep(3) was declared obsolete in POSIX.1-2001 and removed in POSIX.1-2008.
nanosleep(2) was recommended to be used instead.

`OS::delay_usec()` internally uses `nanosleep()`.

This also uses large number separators for improved readability.
2024-05-21 17:32:40 +02:00
bruvzg
67d6be30a0 [DBus] Process file dialog callback in the main event loop instead of using deferred call. 2024-04-23 19:32:35 +03:00
bruvzg
607cc27152 [Linux/Portal] Fix incorrect DBus connection usage. 2024-03-27 09:18:31 +02:00
bruvzg
ee53ae28df Add method to get "base" system UI color (macOS/Windows) and system theme change callback. 2024-02-13 18:38:53 +02:00
bruvzg
a8f521bcad [Native File Dialog] Add support for adding custom options to the dialogs.
Add support for adding custom options (checkboxes and optionboxes) to the dialogs (both native and built-in).
2024-01-24 15:00:31 +02:00
Wilson E. Alvarez
a3cb1b096f Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
Rémi Verschelde
15b8185c68 Don't use TTR/RTR for ERR/WARN prints
We don't translate those, only editor strings are translated.
2023-11-12 12:00:55 +01:00
bruvzg
b52826bf55 Add error messages to the native menu and file dialogs callback. 2023-10-14 18:10:39 +03:00
bruvzg
43e4708dff [Native File Dialogs] Improve filter list handling, add selected filter to the callback. 2023-10-03 19:26:16 +03:00
bruvzg
2e1f48ff6e [Native File Dialogs] Refocus last focused window on close. 2023-08-24 09:34:58 +03:00
bruvzg
6cc314e0fa [Linux/Freedesktop] Implement native file selection dialog support. 2023-08-17 10:56:16 +03:00
Rémi Verschelde
9e4315bb50 Style: Harmonize header includes in platform ports
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module should be included with relative
paths (relative to the root folder of the modular component, e.g.
`platform/linuxbsd/`), in their own section before Godot's "core" includes.

The `api` and `export` subfolders also need to be handled as self-contained
(and thus use relative paths for their "local" includes) as they are all
compiled for each editor platform, without necessarily having the api/export
matching platform folder in the include path.
E.g. the Linux editor build will compile `platform/android/{api,export}/*.cpp`
and those need to use relative includes for it to work.
2023-06-08 15:19:19 +02:00
Riteo
a7542070ae Check DBus loading status before attempting to detect its version
Fixes two related segfaults caused by running the DBus version check
unconditionally and potentially calling null function pointers.

This was clearly an oversight as all the other wrappers have proper
loading status checks.
2023-05-11 19:29:10 +02:00
bruvzg
bed46f723c [Linux/BSD] Add dynamically loaded library version checks. 2023-03-20 08:10:56 +02:00
bruvzg
dd068794c3 [Linux] Make SO wrapper usage optional. 2023-02-16 16:38:47 +02:00
Rémi Verschelde
d95794ec8a One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Raul Santos
471c9c2969 Add support for system dark mode (Linux)
- Use `org.freedesktop.appearance color-scheme` to support system dark mode.
2022-09-02 16:49:21 +02:00