Commit Graph

147 Commits

Author SHA1 Message Date
Setadokalo 1d9ec3caa3 Fix freeze when requesting clipboard image from our own window 2023-10-25 18:32:40 -05:00
Brayden Harlon 085255bd0e Improved X11 screen_get_refresh_rate performance 2023-10-24 11:25:51 -07:00
Rémi Verschelde 2f33c2b20e
Merge pull request #81439 from Setadokalo/clipboard_image
Implement `clipboard_get`/`has_image` for X11
2023-10-20 15:06:42 +02:00
Setadokalo 3b5a9e31bb Implement clipboard_get/has_image for X11 2023-10-20 02:59:10 -05:00
Kacper Gibas 8eb32f9aad Fix unused variables warning when `touch` is disabled 2023-10-13 16:04:08 +02:00
A Thousand Ships f18aa00e85 Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-10-08 17:23:33 +02:00
kobewi 09b30be86d Add vararg call() method to C++ Callable 2023-10-05 11:35:29 +02:00
bruvzg af00c4a54a
[X11] Add support for using EGL/GLES instead of GLX. 2023-10-04 14:15:36 +03:00
Rémi Verschelde 31dbbc2c5a
Merge pull request #80952 from bruvzg/nfdlg_refocus
[Native File Dialogs] Refocus last focused window on close.
2023-10-03 17:13:58 +02:00
bruvzg 1887a9df19
[macOS/Windows] Add optional ANGLE backed OpenGL renderer support. Add EGL_ANDROID_blob_cache caching.
Co-authored-by: Riteo <riteo@posteo.net>
2023-09-21 14:21:00 +03:00
A Thousand Ships 3565d1bf7e [Drivers,Platform] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-12 20:13:32 +02:00
bruvzg 2e1f48ff6e
[Native File Dialogs] Refocus last focused window on close. 2023-08-24 09:34:58 +03:00
Rémi Verschelde c72b851dfb
Merge pull request #80104 from bruvzg/freedesktop_native_file_dialog
[Linux/Freedesktop] Implement native file selection dialog support.
2023-08-17 11:23:00 +02:00
Rémi Verschelde 9a48b14a2d
Merge pull request #80036 from PorkrollPosadist/fix-wayland-window-behavior
Use EWMH for `DisplayServerX11::_window_minimize_check()` implementation
2023-08-17 11:22:36 +02:00
bruvzg 6cc314e0fa
[Linux/Freedesktop] Implement native file selection dialog support. 2023-08-17 10:56:16 +03:00
Rémi Verschelde 49f0d8cee3
Merge pull request #80279 from Sauermann/fix-x11-mouse-window-event-crash
Track hovered `Window` in `DisplayServerX11`
2023-08-10 00:43:00 +02:00
Markus Sauermann a7c5849f98 Track hovered `Window` in `DisplayServerX11`
Send mouse-entered/exited window-events only when necessary
2023-08-09 12:20:23 +02:00
Rémi Verschelde 6a0410bbc2
Merge pull request #80240 from bruvzg/x11_ext_checks
[X11] Do not fail DisplayServer init if non-essential extensions are missing.
2023-08-07 14:50:47 +02:00
bruvzg e26a6c36c8 Fix native popups auto-closing when interacting with non-client area. 2023-08-07 10:01:48 +03:00
bruvzg acff87ffda
[X11] Do not fail DisplayServer init if non-essential extensions are missing. 2023-08-04 10:58:14 +03:00
Markus Sauermann 8c1ce404d7 Fix crash on Windows when closing `Window`
Send `WINDOW_EVENT_MOUSE_EXIT` when a window is destroyed.

Ensure, that on Windows, the event_callback is still valid during
destroying the `Window`.
2023-08-02 00:17:25 +02:00
PorkrollPosadist 5666656d42 Use EWMH for DisplayServerX11::_window_minimize_check() implementation 2023-07-31 16:35:18 -04:00
Hendrik Brucker 7e21eb7e00 Extract and reorganize texture resource classes 2023-07-14 20:04:21 +02:00
Yuri Sizov ff689003a5 Merge pull request #77993 from bruvzg/key_lbl_from_p
Implement DisplayServer.keyboard_get_label_from_physical method.
2023-07-12 21:02:37 +02:00
Yuri Sizov 2b47f6715e Merge pull request #78437 from bruvzg/set_icon
Add error checks and harmonize behavior of the `set_icon` method.
2023-07-12 15:09:14 +02:00
Rémi Verschelde dcd16a5750
Linux: Fix build with `use_sowrap=no` and various warnings/errors 2023-07-10 14:34:01 +02:00
bruvzg 9c5a0c6c10
Add error checks and harmonize behavior of the set_icon method. 2023-07-03 13:48:28 +03:00
Rémi Verschelde 356a602186
Merge pull request #74511 from AThousandShips/win_cursor_fix
Fix clearing custom cursor
2023-06-20 00:00:57 +02:00
bruvzg 28db3c7158 [DisplayServer] Add method to check if native window is focused. 2023-06-16 10:27:52 +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
bruvzg 08e8ff371d
Implement keyboard_get_label_from_physical method. 2023-06-08 10:13:31 +03:00
Rémi Verschelde 2ae5a0704a
X11: Fix vformat ambiguous int types for GCC 10 (again) 2023-06-07 14:57:51 +02:00
Rémi Verschelde 0010b34a37
Merge pull request #75099 from mxnemu/add-default-x11-error-handler
[Linux/X11] Add a default error handler for X11 to avoid crashes.
2023-06-05 18:04:49 +02:00
nee b13c82e964 [Linux/X11] Add a default error handler for X11 to avoid crashes.
The default behaviour for X11 is to crash even on non-fatal errors
when there is no error handler set. This change allows the window to
stay open and may enable users to save their work when things go
wrong.

This acts as a workaround for #65425 and #68471
2023-06-05 17:28:21 +02:00
Rémi Verschelde 9dc286967f
X11: Fix vformat ambiguous int types for GCC 10
The build would fail with GCC 10 from our Linux SDK used for official builds.
2023-05-23 11:27:28 +02:00
bruvzg 5b9984b5a2
Add `audio/general/text_to_speech` project setting to enable/disable TTS. 2023-05-18 20:16:03 +03:00
Rémi Verschelde 265c70a369
Merge pull request #75142 from bruvzg/scr
[DisplayServer] Implement screen_get_image method for LinuxBSD/X11, macOS and Windows.
2023-05-16 10:48:16 +02:00
Ninni Pipping 71ee65dc57 Enable shadow warnings and fix raised errors 2023-05-11 16:00:59 +02:00
Bram Stolk 7a2e350d2b x11: Do not use uninitialized timestamps.
Fixes #76922
2023-05-10 11:27:14 -07:00
Christopher Foo e4d052e284
Ensure WindowData minimized/maximized are mutually exclusive
The window manager can break the assumption that
fullscreen/maximized/minimized values are mutually exclusive.
2023-05-08 20:23:45 -04:00
Hugo Locurcio 303bf247de
Add support for VRAM-compressed custom mouse cursor images
No memory is actually saved when using this, so lossless modes are
still recommended as they look better and load faster.
2023-04-21 18:01:47 +02:00
bruvzg 520a8d8ed2
Add project manager / editor initial screen settings, implement DisplayServer.get_keyboard_focus_screen method. 2023-04-19 08:54:53 +03:00
Rémi Verschelde 63d17df83e
Merge pull request #74978 from bruvzg/linux_version_check
[Linux/BSD] Add dynamically loaded library version checks.
2023-04-18 23:38:51 +02:00
Yuri Sizov f5f796b0b7
Merge pull request #76040 from MightiestGoat/fix-sliding-window-linux-via-tracking-parent
Fix the sliding window problem in linux occur due to reparenting of the window due to decoration.
2023-04-14 13:11:36 +02:00
mightygoat 932afc3bf5 Fix the sliding window problem in linux occur due to reparenting of the window during the decoration via tracking the parent of the window 2023-04-14 00:45:34 +05:30
Kvel2D 41f0a523db Fix custom cursor using atlas texture
Remove image.is_valid() check
There is already a fail condition and image is not used before that
Move up texture_is_valid() check
2023-04-11 19:16:24 +02:00
Sabrehull d4b7466266
[X11] Fix layout bug in `keyboard_get_keycode_from_physical` 2023-03-29 15:18:31 +02:00
bruvzg ab94024ce1
[DisplayServer] Implement screen_get_image method for LinuxBSD/X11, macOS and Windows. 2023-03-20 14:58:21 +02:00
bruvzg 09465f3fe6
Remove (or make verbose only) various debug prints. 2023-03-20 08:14:18 +02:00
bruvzg bed46f723c
[Linux/BSD] Add dynamically loaded library version checks. 2023-03-20 08:10:56 +02:00
Ninni Pipping a419325753 Fix clearing custom cursor 2023-03-10 11:59:49 +01:00
Hugo Locurcio ddc9cc3e49
Tweak command syntax in Vulkan renderer failure message
This quotes the executable name so that copying it always works
(even if the path contains spaces).

The command is also indented from the rest of the text and is
no longer single-quoted, as that can prevent the command from
running if the line is copied in its entirety (with the quotes).
2023-03-08 22:28:23 +01:00
Rémi Verschelde 8325320192
Merge pull request #74563 from clayjohn/X11-context
Propogate errors when creating an OpenGL context fails in X11
2023-03-08 08:58:35 +01:00
clayjohn e7ea3ef531 Propogate errors when creating an OpenGL context fails in X11 2023-03-07 11:12:21 -08:00
Rindbee 91e460d500 Fix broken shortcut key input 2023-03-07 16:06:38 +08:00
Rémi Verschelde 5f2137a050
Merge pull request #74087 from bruvzg/get_screen_px
[DisplayServer] Implement screen_get_pixel method for LinuxBSD/X11, macOS and Windows.
2023-03-06 21:58:58 +01:00
bruvzg 8a675f3824 [Linux/X11] Check if required xkb functions exist before using it. 2023-03-02 10:25:50 +02:00
bruvzg e7647b5ee5
[DisplayServer] Implement screen_get_pixel method for LinuxBSD/X11, macOS and Windows. 2023-03-01 09:32:23 +02:00
Rémi Verschelde f84479fe5a
Merge pull request #72877 from bruvzg/x11_on_top
[X11] Fix initial "on top" window state.
2023-02-17 16:21:13 +01:00
bruvzg 853f0eae58
[X11] Fix initial "on top" window state. 2023-02-17 16:08:26 +02:00
Rémi Verschelde 4574b97752
Fix crash with bogus shape index to DisplayServer.cursor_set_custom_image()
Fixes #66605.
2023-02-17 14:17:37 +01:00
bruvzg dd068794c3
[Linux] Make SO wrapper usage optional. 2023-02-16 16:38:47 +02:00
Thomas ten Cate 8a17f94ab2 Some fixes for initial window position and size
- X11: set main window position and size hints correctly
- All platforms: update minimum and maximum size of main window at
  startup

Fixes #70984
2023-02-14 12:15:14 +01:00
bruvzg 80dc7713f9
[X11] Do not suppress structure/focus events on popup close to correctly return focus. 2023-02-07 12:13:34 +02:00
bruvzg 103f671ada
[X11] Fix IME window focus events. 2023-02-06 09:18:16 +02:00
Rémi Verschelde 707ccc09ab
Merge pull request #72104 from bruvzg/popup-non-popups
Extend special popup window handling to any non-popup child of a popup.
2023-02-01 11:07:39 +01:00
bruvzg 9f42649823
[X11] Fix IME subwindow in the popup not getting input focus. 2023-02-01 11:10:10 +02:00
bruvzg 4c50ac3921
[X11] Add support for dead keys without active IME. Fix IME focus and cleanup. 2023-01-30 13:31:48 +02:00
bruvzg 700d85bd19
Extend special popup window handling to any non-popup child of a popup. 2023-01-26 12:38:53 +02:00
bruvzg 912c937921
[X11] Fix IME focus return. 2023-01-26 10:13:51 +02:00
Rémi Verschelde 67961d8ebf
Merge pull request #72029 from bruvzg/x11_keycode
[X11] Fix incorrect keycodes from non-QWERTY layouts.
2023-01-25 12:17:41 +01:00
bruvzg 1bb7e357a0
[X11] Fix incorrect keycodes from non-QWERTY layouts. 2023-01-25 13:04:02 +02:00
bruvzg 5ebb60e0cf
[X11] Make IME focus window input only. 2023-01-25 12:31:42 +02:00
bruvzg b713cfdccd
[X11] Prevent IME activation from entering infinite loop. 2023-01-25 10:21:27 +02:00
bruvzg daad4aed62
Cleanup and unify keyboard input.
- Unify keycode values (secondary label printed on a key), remove unused hardcoded Latin-1 codes.
- Unify IME behaviour, add inline composition string display on Windows and X11.
- Add key_label (localized label printed on a key) value to the key events, and allow mapping actions to the unshifted Unicode events.
- Add support for physical keyboard (Bluetooth or Sidecar) handling on iOS.
- Add support for media key handling on macOS.

Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-01-23 15:08:12 +02:00
Rémi Verschelde 68d71f88f5
Improve DisplayServer message for video card drivers failure
And remove leftover duplicated message on Android.
2023-01-17 15:41:54 +01:00
bruvzg 60e0043012
Fix X11 input region size. 2023-01-17 07:54:54 +02:00
bruvzg 34b34b104c
Add `WINDOW_FLAG_MOUSE_PASSTHROUGH` flag and enabled it for tooltips. Expose `window_set_mouse_passthrough` to `Window`. 2023-01-16 11:42:49 +02:00
Juan Linietsky 2b815df3c1 Use BitField<> in core type masks
* All core types masks are now correctly marked as bitfields.
* The enum hacks in MouseButtonMask and many other types are gone. This ensures that binders to other languages non C++ can actually implement type safe bitmasks.
* Most bitmask operations replaced by functions in BitField<>
* Key is still a problem because its enum and mask at the same time. While it kind of works in C++, this most likely can't be implemented safely in other languages and will have to be changed at some point. Mostly left as-is.
* Documentation and API dump updated to reflect bitfields in core types.
2023-01-08 22:17:40 +01:00
bruvzg 2718a7b7d3
Add support for the custom initial screen for the main window, fix primary screen detection. 2023-01-07 11:14:35 +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
bruvzg f7955633de
Improve `window_set_current_screen` and fix secondary window initial mode and positions. 2022-12-29 09:43:39 +02:00
Rémi Verschelde f8f496ec3b
Merge pull request #69678 from Sauermann/fix-slider-button-up
Fix colorpicker slider bug with mouse-up outside of popup
2022-12-16 13:47:53 +01:00
Rémi Verschelde 0a3f66471e
Merge pull request #69712 from bruvzg/real_size
Rename `window_get_real_size`, add position counterpart.
2022-12-07 14:29:46 +01:00
bruvzg edf13eb5a6
Rename `window_get_real_size` to `window_get_size_with_decorations`, add `window_get_position_with_decorations`. 2022-12-07 11:07:30 +02:00
bruvzg ad0f6ff85b
[Linux/X11] Split fullscreen mode into `WINDOW_MODE_EXCLUSIVE_FULLSCREEN` and `WINDOW_MODE_FULLSCREEN` to improve multi-window handling. 2022-12-07 09:54:02 +02:00
Markus Sauermann b44e6bb42b Fix colorpicker slider bug with mouse-up outside of popup
When releasing the mouse button outside of the popup while dragging
a slider, the slider still gets adjusted by mouse-move events.

The reason for this bug is that the mouse-up event is sent to the
focused window (main editor window) instead of the colorpicker
popup window.

This PR adjusts the linuxbsd X11 DisplayServer to send the event to the
correct expected window.
2022-12-06 19:30:13 +01:00
Markus Sauermann ada4761181 Fix that mouse-button-up event is parsed twice for drag-and-drop
Currently Input::get_singleton()->parse_input_event(mb); is
called twice for mouse-button-up events when dropping in a different
window on linuxbsd.
2022-12-05 19:31:22 +01:00
Riteo 2dd5a792bb Load X11 dynamically
The loaders have been generated through hpvb's dynload-wrapper, although
they had to be heavily handpatched to workaround some already reported
issues with it. I added a note to each generated file to account for
that.

As GLAD uses X11 stuff directly, I had to define the GLAD_GLX_NO_X11
macro to not let do it that, and handle myself the display loading and
screen handling part myself, which wasn't that hard but it's still
something worth saying.

I plan to improve greatly the X11 backend (including this aspect) but,
as the release isn't that far and I'm also working on the Wayland
backend, this will do for now, I hope.
2022-12-03 19:23:43 +01:00
clayjohn 58a9cfee80 Set vsync on window creation when using GLES3.
Add vsync to Windows platform
2022-11-15 14:14:21 -08:00
Markus Sauermann ed5c9a07d7 Fix gl_manager nullptr crash
Add a nullptr-check, before accessing gl_manager
2022-11-13 00:48:45 +01:00
Markus Sauermann 52d75c9b35 Fix unsent WINDOW_EVENT_MOUSE_ENTER event on mouse_mode-change
coauthor: @bruvzg

On linuxbsd and macOS the WINDOW_EVENT_MOUSE_ENTER was not sent,
when the mouse became visible again after a mouse_mode-change.
2022-11-11 07:52:16 +01:00
David Snopek 23603e409c Add support for OpenGL to OpenXR 2022-11-08 18:47:11 -06:00
Rémi Verschelde 879aac9db4
Merge pull request #67695 from Sauermann/fix-filedrop-space
Do not strip spaces at the end of file names of dropped files
2022-11-03 12:08:08 +01:00
Markus Sauermann 5d0aade322 Do not strip spaces at the end of file names of dropped files on linuxbsd 2022-11-03 11:38:42 +01:00
Markus Sauermann 8fb4b5998e Fix unwanted popup closing by mouse-move while holding mouse-button 2022-11-03 11:36:58 +01:00
Riteo 593c571d6a linuxbsd: move all X11 stuff in its own directory
This allows implementing `DisplayServer`s like Wayland without making a
mess in the source tree.
2022-11-02 20:48:46 +01:00