Commit Graph

496 Commits

Author SHA1 Message Date
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
Rémi Verschelde a0a633ae58
Merge pull request #72102 from Riteo/keymapx11-scope-goodness
Put KeyMappingX11 stuff inside its own scope
2023-01-27 10:30:20 +01:00
daviirodrig 240374c58f Fix split allow empty string in SSH export plugin 2023-01-27 05:09:30 -03: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
Riteo aa7cd71498 Put KeyMappingX11 stuff inside its own scope
This avoids collisions with other "concurrent" key mappers.
2023-01-26 03:19:36 +01: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
Rémi Verschelde 4368191a9f
Merge pull request #72018 from bruvzg/x11_ime_loop
[X11] Prevent IME activation from entering infinite loop.
2023-01-25 09:44:50 +01:00
bruvzg b713cfdccd
[X11] Prevent IME activation from entering infinite loop. 2023-01-25 10:21:27 +02:00
Riteo beaff2f5cb Move xkbcommon dynamic loading code into generic linuxbsd folder
Since Wayland uses it too, it only makes sense to have it in the parent
directory of both.
2023-01-25 03:28:13 +01:00
bruvzg 5c4fe6339b
[Linux/BSD] Include headers for dynamically loaded libraries to simplify build dependencies. 2023-01-23 16:37:43 +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 5b1df48c6c
Convert en_GB spelling to en_US with codespell 2023-01-23 11:02:20 +01:00
Rémi Verschelde 271920cc54
Merge pull request #71819 from Riteo/certified-musl-moment
Make PIE relocation detection glibc-only
2023-01-21 20:52:40 +01:00
Riteo 2a6ce37910 Make PIE relocation detection glibc-only
Musl doesn't compile with it, and by looking online I think that this is
a glibc only thing.
2023-01-21 17:59:52 +01:00
robfram 9faa92bda0 Exclude atomic lib under FreeBSD using LLVM 2023-01-20 20:52:19 +00: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
Rémi Verschelde 91a54cdbc1
Linux/BSD: Add LINUXBSD_ENABLED define for non X11-related checks 2023-01-16 17:01:35 +01: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
Rémi Verschelde 9711abe787
Merge pull request #71437 from vaartis/linux-backtrace
Alter linux debug stacktraces handling to support more environments
2023-01-15 13:09:31 +01:00
Ekaterina Vaartis 5e041eee11 Alter linux debug stacktraces handling to support more environments
- Use -gdwarf-4 to support both LLVM and GCC when calling addr2line
- Subtract position-independant execuable relocation when passing the
  address to addr2line
2023-01-15 02:48:33 +03:00
Yuri Sizov 4c1f11944e Update all outdated online documentation links 2023-01-14 19:38:00 +03:00
Rémi Verschelde 3dffe0b967
Merge pull request #63312 from bruvzg/one_click
[Export] Add one-click deploy over SSH for the desktop exports.
2023-01-13 18:00:18 +01: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
Rémi Verschelde 8791e333da
Merge pull request #70624 from bruvzg/cur_sc
Improve `window_set_current_screen` and fix secondary window initial mode and positions.
2023-01-03 15:56:05 +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
bruvzg cebefc9f5d
[Export] Add one-click deploy over SSH for the desktop exports.
Add one-click deploy over SSH for the desktop exports.
Add ZIP export option for Linux and Windows.
Change export plugin icons to SVG format.
2022-12-29 09:42:00 +02:00
Riteo 3960c6b8f9 Allow building X11 without Vulkan
This limit was likely introduced when Vulkan was the only option.
2022-12-27 21:47:26 +01: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
Haoyu Qiu 207e52c161 Fix String::word_wrap() for long words
- Changes `TextServer.string_get_word_breaks()`
  - Returns pairs of boundary start and end offsets
  - Accepts `chars_per_line` to return line breaks
- Removes `String::word_wrap()`

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2022-12-16 13:18:57 +08:00
Rémi Verschelde 346efd29e0
Fix typos with codespell 2022-12-15 12:24:08 +01:00
nikitalita 4fec34808d fix dbus and fontconfig links 2022-12-09 09:05:06 -08: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
Rémi Verschelde 14f23df1a3
Merge pull request #69563 from nyanpasu64/patch-1
Fix burning CPU with udev disabled on Flatpak
2022-12-05 18:07:02 +01:00
bruvzg 89db7f8e7c
[Linux/BSD] Fix build without fontconfig. 2022-12-05 07:56:44 +02:00
bruvzg ecec415988
Use system fonts as fallback and improve system font handling.
Add support for font weight and stretch selection when using system fonts.
Add function to get system fallback font from a font name, style, text, and language code.
Implement system font support for Android.
Use system fonts as a last resort fallback.
2022-12-04 18:44:20 +02:00
nyanpasu64 0cbd1c85a9
Fix burning CPU with udev disabled on Flatpak
Fixes #67355.
2022-12-03 20:10:48 -08: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
Rémi Verschelde 13280f1874
X11: Don't override glxSwapInterval function pointers loaded by GLAD
Fixes #68722.

Co-authored-by: alcomposer <alex.w.mitchell@gmail.com>
2022-11-16 10:05:52 +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
Riteo Siuga dc2919d57b Load GLX dynamically with GLAD
This is accomplished through the addition of a GLAD GLX loader in the
`thirdparty` directory.

This is another step towards a nice Wayland/X11 interoperation.
2022-11-15 13:55:30 +01:00
Rémi Verschelde 696740fe38
Merge pull request #68680 from bruvzg/fc_no_font_sub
[fontconfig] Reject font substitutes if non-alias name was used.
2022-11-15 11:56:31 +01:00
Rémi Verschelde dbf6ff0cb6
Merge pull request #68372 from Riteo/glad2
Regenerate GL loader code with GLAD 2
2022-11-15 11:56:16 +01:00
bruvzg 40832cc670
[fontconfig] Reject font substitutes if non-alias name was used. 2022-11-15 11:17:44 +02:00
Rémi Verschelde 98e0d59952
Merge pull request #68504 from dzil123/cache_system_dir_xdg2
Cache OS_LinuxBSD::get_system_dir
2022-11-15 00:18:09 +01:00
Riteo f6397bffb1 Regenerate GL loader code with GLAD 2
GLAD 1 creates unusable loaders for EGL, while the newly released GLAD 2
does not, so for consistency I thought that it would be a good idea to
uniform things beforehand. While it had some API changes some renames
were all that was needed and everything works like before, at least on
the Wayland branch.

I've kept the structure identical, although this new generator has quite
a few hefty features, such as a single header mode.

I've also added GLAD to `thirdparty/README.md`, but I haven't specified
that in the commit title because it's a very small "fix".
2022-11-14 21:48:01 +01:00
dzil123 d22ab7c85b Cache OS_LinuxBSD::get_system_dir(SYSTEM_DIR_DESKTOP) 2022-11-12 22:38:32 -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
Rémi Verschelde 29de658c29
Merge pull request #68345 from Abdul-AZ/master
Fix static object destructors being called on gpu selection with X11
2022-11-09 09:16:04 +01:00
David Snopek 23603e409c Add support for OpenGL to OpenXR 2022-11-08 18:47:11 -06:00
Abdulrahman Al Zeidi 5860f81c18 Fix static object destructors being called on gpu selection with X11 2022-11-07 12:08:52 +00: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
Rémi Verschelde 889868cbbc
Merge pull request #68182 from Riteo/x11-folder
linuxbsd: move all X11 stuff in its own directory
2022-11-03 00:32:30 +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
bruvzg 060d62e0dc
Load and use system emoji font in the editor. 2022-11-01 11:04:58 +02:00
Rémi Verschelde 9188bc7341
Merge pull request #67879 from bruvzg/fix_no_vlk
Fix build with Vulkan disabled and no Vulkan headers installed.
2022-10-31 14:29:05 +01:00
Rémi Verschelde 5947f22be9
Merge pull request #67578 from KoBeWi/GEDITOR
Unify usage of GLOBAL/EDITOR_GET
2022-10-31 13:15:58 +01:00
Clay John 04ac91f786
Merge pull request #67790 from kdada/fix-flash-window
Make creating window do not flicker when specify custom position
2022-10-28 13:02:58 -07:00
Max Hilbrunner 028db9f2b5
Merge pull request #67914 from Calinou/displayserverx11-no-native-icon
Fix `DisplayServer.has_feature()` claiming X11 has native icon support
2022-10-28 12:46:57 +02:00
zCubed3 e7091d07cd
Fix OS.get_video_adapter_driver_info crash 2022-10-27 15:45:21 -07:00
Clay John 9ffa86357d
Merge pull request #67421 from Sauermann/fix-failure-exit-code
Fix Godot exiting with unexpected failure code
2022-10-27 11:58:50 -07:00
Hugo Locurcio 82a575dff4
Fix `DisplayServer.has_feature()` claiming X11 has native icon support
Native icons are not supported by the X11 DisplayServer, unlike
Windows and macOS.
2022-10-26 20:39:31 +02:00
bruvzg 4dd8f68120
Fix build with Vulkan disabled and no Vulkan headers installed. 2022-10-26 08:55:05 +03:00
Wei Guo d7e39e313b Make window creation with custom position do not flash 2022-10-24 13:50:25 +08:00
clayjohn c4ba1565d0 Update the DisplayServer video driver error message
to be more accurate and friendly
2022-10-18 10:15:11 -07:00
kobewi e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
Markus Sauermann 7d59a14db8 Fix Godot exiting with unexpected failure code
The exit code is initialized as EXIT_FAILURE to indicate failures during
startup. Closing the Game window via the window manager does not
change the exit code, so the program exists with EXIT_FAILURE.

This PR set the exit code to EXIT_SUCCESS when initialization was
successful just before starting the main loop.
2022-10-15 03:17:40 +02:00
Rémi Verschelde 261b9da77f
Merge pull request #67281 from Nidjo123/x11-window-resize
Keep rendering context window size in sync when resizing
2022-10-12 22:53:49 +02:00
Nikola Bunjevac 882d40fa11 Keep rendering context window size in sync when resizing
On X11 we rely on ConfigureNotify event to update rendering context
window size, but we don't get such event when resizing
programmatically, only when done "manually" by resizing the window
etc.
2022-10-11 23:27:21 +02:00
Riteo a3b5353892 Actually set the execinfo flag on non-glibc systems 2022-10-11 21:45:29 +02:00
Rémi Verschelde 5aadc618b6 Merge pull request #66102 from MJacred/feature/getvideoadapterdriverinfo
Fetch video adapter driver name and version from OS
2022-10-11 13:59:53 +02:00
MJacred de768afbdc Fetch video adapter driver name and version from OS on Linux/*BSD and Windows 2022-10-11 12:39:41 +02:00
Rémi Verschelde 8017827144 SCons: Re-enable treating `#warning` as error with `werror`
Replace all TODO uses of `#warning` by proper TODO comments, and will open
matching bug reports to keep track of them.

We don't have a great track record fixing TODOs, but I'd wager we're even
worse for fixing these "TODO #warning" so we should prohibit this usage.
2022-10-10 16:12:26 +02:00
Rémi Verschelde 5b6ccf2fd2 Merge pull request #66720 from qarmin/unintialized_memory
Remove usage of unitialized variables
2022-10-05 11:42:47 +02:00
Rémi Verschelde 2c94470dd1 Merge pull request #63983 from Calinou/scons-linux-execinfo-musl
Automatically use execinfo for crash handler on *BSD and musl-based Linux
2022-10-05 08:29:59 +02:00
Hugo Locurcio 8e04bffbcf
Automatically use execinfo for crash handler on *BSD and musl-based Linux
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2022-10-04 19:40:19 +02:00
Rémi Verschelde 4eaa59d0ed Merge pull request #66773 from MladoniSzabi/numpad-no-numlock-bug-linux
Remapped the numpad keys on linux when numlock is off
2022-10-04 11:29:01 +02:00
MladoniSzabi cc0fd7e783 Remapped the numpad keys on linux when numlock is off
On Linux, when using the numpad while numlock is off doesn't do
anything. Made the numpad keys map to the correct control keys.

Resolves: #54814.
2022-10-03 12:53:42 +01:00
Rémi Verschelde f501e4f665 Unix: Remove now unnecessary I/O defines, cleanup
- `LIBC_FILEIO_ENABLED` wasn't defined anywhere, even in _other platforms_.
- `NO_NETWORK` is also never defined. It probably isn't enough anyway to
  disable network APIs in the current codebase.
- `UNIX_SOCKET_UNAVAILABLE` is never defined in this code but used by some
  other platforms, clarify that.
- `NO_STATVFS` can be removed as Android supports it since API level 19,
  which is our current min SDK level. It's also only used for
  `DirAccessUnix::get_space_left()` which is anyway overridden by
  `DirAccessJAndroid::get_space_left()` so it shouldn't make a difference.
  * Fixed documentation for `DirAccess.get_space_left()`.
- `NO_FCNTL` is likely also a remnant of early Android days, in current NDK
  r23 it seems to be available. Also cleaned up unused `fcntl.h` includes.
- `NO_ALLOCA` is never defined, and we use alloca in many places now.
2022-10-03 12:33:41 +02:00
Matthew Munro (mam552) 0f5b448a9c Fix inconsistent window state on X11.
Fixes #66413.
DisplayServerX11 tracks some internal state about whether the window is
fullscreen, minimized, maximized or none. This commit queries the
display server when the window changes, so that this internal state can
be correctly updated.
2022-10-01 16:01:28 -06:00
Rafał Mikrut 2233624152 Remove usage of unitialized variables 2022-10-01 21:09:22 +02:00
Rémi Verschelde ef8834a642 Merge pull request #64784 from yedpodtrzitko/yed/ci-add-mypy
ci: add Python static analysis check via mypy
2022-09-30 17:44:39 +02:00
Rémi Verschelde 166df0896c Fix typos with codespell
Using codespell 2.3-dev from current git.

And fix typo in `methods.py` for `vsproj=yes` option (still won't work
though).
2022-09-30 14:23:36 +02:00
Jiri Suchan c5bd2f9dce ci: add Python static analysis check via mypy 2022-09-30 19:03:17 +07:00
Rémi Verschelde 39facb35a0 SCons: Unify tools/target build type configuration
Implements https://github.com/godotengine/godot-proposals/issues/3371.

New `target` presets
====================

The `tools` option is removed and `target` changes to use three new presets,
which match the builds users are familiar with. These targets control the
default optimization level and enable editor-specific and debugging code:

- `editor`: Replaces `tools=yes target=release_debug`.
  * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_debug`: Replaces `tools=no target=release_debug`.
  * Defines: `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_release`: Replaces `tools=no target=release`.
  * Defines: `-O3`/`/O2`

New `dev_build` option
======================

The previous `target=debug` is now replaced by a separate `dev_build=yes`
option, which can be used in combination with either of the three targets,
and changes the following:

- `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`),
  enables generating debug symbols, does not define `NDEBUG` so `assert()`
  works in thirdparty libraries, adds a `.dev` suffix to the binary name.

Note: Unlike previously, `dev_build` defaults to off so that users who
compile Godot from source get an optimized and small build by default.
Engine contributors should now set `dev_build=yes` in their build scripts or
IDE configuration manually.

Changed binary names
====================

The name of generated binaries and object files are changed too, to follow
this format:

`godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]`

For example:
- `godot.linuxbsd.editor.dev.arm64`
- `godot.windows.template_release.double.x86_64.mono.exe`

Be sure to update your links/scripts/IDE config accordingly.

More flexible `optimize` and `debug_symbols` options
====================================================

The optimization level and whether to generate debug symbols can be further
specified with the `optimize` and `debug_symbols` options. So the default
values listed above for the various `target` and `dev_build` combinations
are indicative and can be replaced when compiling, e.g.:

`scons p=linuxbsd target=template_debug dev_build=yes optimize=debug`
will make a "debug" export template with dev-only code enabled, `-Og`
optimization level for GCC/Clang, and debug symbols. Perfect for debugging
complex crashes at runtime in an exported project.
2022-09-26 16:31:46 +02:00
Rémi Verschelde 49fcf4ffad Style: Cleanup header guards for consistency
Fix file names for {Static,Lightmap}RaycasterEmbree.
2022-09-26 13:51:17 +02:00
Rémi Verschelde 35a15e6191 SCons: Refactor handling of `production` flag and per-platform LTO defaults
Fixup to #63288.
See #65583 for the bug report.

Co-authored-by: Cyberrebell <chainsaw75@web.de>
2022-09-19 18:11:29 +02:00