summaryrefslogtreecommitdiff
path: root/platform/linuxbsd/display_server_x11.cpp
AgeCommit message (Collapse)Author
2021-04-05Style: Apply clang-tidy's `modernize-use-nullptr`Rémi Verschelde
2021-03-28Rename Texture.get_data() to get_image()Marcel Admiraal
2021-03-23Rename ButtonList enum and members to MouseButtonAaron Franke
2021-03-08Linux: Fix PRIME detection on SteamRémi Verschelde
To avoid trying to do PRIME detection on fake `libGL.so` as used by e.g. Renderdoc or Primus, we skip detection if there's a `libGL.so` in `LD_LIBRARY_PATH`... and our luck is that Steam defines it and includes system paths too, thus the actual system `libGL`... 🤦 So if we detect Steam, we skip this check. Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-28Fix out of bounds array access on DisplayServerX11 codePedro Rodrigues
The problem happened on methods `screen_get_position`, `screen_get_usable_rect` and `window_set_current_screen` when they were passed a negative screen value. Fixes: - #46184 - #46185 - #46186
2021-02-18Modernize atomicsPedro J. Estébanez
- Based on C++11's `atomic` - Reworked `SafeRefCount` (based on the rewrite by @hpvb) - Replaced free atomic functions by the new `SafeNumeric<T>` - Replaced wrong cases of `volatile bool` by the new `SafeFlag` - Platform-specific implementations no longer needed Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-01-31Merge pull request #45315 from RandomShaper/modernize_threadRémi Verschelde
Modernize Thread
2021-01-29Modernize ThreadPedro J. Estébanez
- Based on C++11's `thread` and `thread_local` - No more need to allocate-deallocate or check for null - No pointer anymore, just a member variable - Platform-specific implementations no longer needed (except for the few cases of non-portable functions) - Simpler for `NO_THREADS` - Thread ids are now the same across platforms (main is 1; others follow)
2021-01-28Unify URI encoding/decoding and add to C#Aaron Franke
http_escape and percent_encode have been unified into uri_encode, and http_unescape and percent_decode have been unified into uri_decode.
2021-01-09Split OS::execute into two methodsMarcel Admiraal
1. execute(): Executes a command and returns the results. 2. create_process(): Creates a new process and returns the new process' id.
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-12-28Rename empty() to is_empty()Marcel Admiraal
2020-12-16Fix named anonymous struct warningMarcel Admiraal
2020-12-04RenderingServer reorganizationreduz
2020-12-03Reorganize rendering server.reduz
-Made RenderingServerScene abstract, allowing reimplementation -RenderingServerRaster -> RenderingServerDefault, but this class is going away soon.
2020-12-02X11: Include limits.h for LONG_MAXRémi Verschelde
Fixes #44030.
2020-11-27Implement INCR mechanism for Linux clipboardPouleyKetchoupp
Allows pasting from x11 clipboard to receive data incrementally, which is required when handling data size > 256KB.
2020-11-26Merge pull request #42652 from nekomatata/x11-clipboard-save-targetsRémi Verschelde
Implement SAVE_TARGETS mechanism for Linux clipboard
2020-11-15Add XChangeProperty Atoms validity checks.bruvzg
2020-11-14Fixes crash if Vulkan presentation surface is not available.bruvzg
2020-11-12Add X11 Atom validity checks.bruvzg
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
2020-10-09Implement SAVE_TARGETS mechanism for Linux clipboardPouleyKetchoupp
Allows sending the clipboard content to the clipboard manager on exit to keep the content when using a clipboard manager that doesn't automatically makes a backup when copying. MULTIPLE selection mechanism also had to be implemented, because in this case, the clipboard manager might request multiple selection targets at once. Known use case: Ubuntu with XFCE4
2020-10-08Fix x11 display server crash when deleting popup window when unfocusedPouleyKetchoupp
On FocusOut events, the window could be destroyed while propagating WINDOW_EVENT_FOCUS_OUT event, which causes the WindowData to be invalidated, and still used for calls to XUnsetICFocus. This change moves calls to XUnsetICFocus, and also XSetICFocus in FocusIn events, before propagating the change of focus event to the engine, to be safe in any case. Also setting xic member to nullptr after all calls to XDestroyIC to keep things clean and consistent. Fixes #42645
2020-09-25Fix delay to process clipboard content from Godot in other programsPouleyKetchoupp
When pasting clipboard content from Godot to other applications, multiple SelectionRequest events are sent to Godot in order to access the data. It could take a long time before the data is ready for the other app because events were processed one by one on the main thread, especially when Godot is unfocused and runs at low frequency. With this change, SelectionRequest events are directly handled on the separate event polling thread to minimize this delay. This change also replaces clipboard_get() calls in SelectionRequest with a direct access to internal_clipboard, since in this case we know Godot is the owner of the clipboard content and it's not necessary to query the x server for it.
2020-09-24Fix general keyboard input lag on X11 display serverPouleyKetchoupp
This change makes keyboard inputs more responsive on Linux, especially when the FPS is lower on slower configurations. Polling events from the x server is done on a separate thread to avoid a frame delay with inputs, due to first sending the event to the input manager with XFilterEvent then processing the new event only on the next frame. Calls to Input Manager functions like XSetICFocus, XUnsetICFocus and XSetICValues use a mutex, because they are polling events internally and would otherwise interfere with our own thread process for polling events which can cause a deadlock in some cases. XUnsetICFocus is called instead of XSetICFocus on FocusOut events, so the input manager can be properly notified of focus changes. clipboard_get now uses a blocking call to poll for a specific event type when waiting for a SelectionNotify event, instead of polling all events and filtering them afterwards.
2020-09-18X11: Try to load libXrandr.so.3 if libXrandr.so.2 isn't foundRémi Verschelde
All Linux distros, and FreeBSD and OpenBSD seem to have libXrandr.so.2, but for some reason recent NetBSD versions seem to have libXrandr.so.3 now.
2020-09-17Add window click-through support.bruvzg
2020-09-03Fix drag and drop between windows in X11 display serverPouleyKetchoupp
Proper implementation for get_window_at_screen_position: Now getting the topmost last active window when overlapping. Mouse drag & release events: They are now propagated through the current focused window, in order to make it consistent with the engine expectations and the Windows display server implementation.
2020-08-26Fix menu popups delay and focus in X11 display serverPouleyKetchoupp
Now using override_redirect for menu & tooltip popups to prevent the WM from interfering with them, so we have more control over focus management and avoid a delay before they show up.
2020-08-22Re-apply "Fixes for windows in X11 tiling WMs"PouleyKetchoupp
From PR #38727 which was reverted in #41373 because of regressions in Ubuntu with Gnome. Co-authored-by: Lorenzo Cerqua <lorenzocerqua@tutanota.com>
2020-08-19Revert "Fixes for windows in X11 tiling WMs"Juan Linietsky
2020-08-13Remove obsolete GLES2 backend codeRémi Verschelde
This code currently isn't compiled (and cannot compile). We plan to re-add OpenGL ES-based renderer(s) in Godot 4.0 alongside Vulkan (probably ES 3.0, possibly also a low-end ES 2.0), but the code will be quite different so it's not relevant to keep this old Godot 3.2 code. The `drivers/gles2` code from the `3.2` branch can be used as a reference for a potential new implementation.
2020-07-31Fix losing X11 window normal size hint propertiesopl-
This was caused by `XSetWMNormalHints` being called multiple times, each time with different values. Calling the method replaces the old data completely, resulting in some of the settings being lost. Since the method was called 3 times before the window was mapped, this resulted in the position hint being lost and the window always getting opened at a position determined by the WM.
2020-07-23DisplayServer: separate window showing into another functionLorenzo Cerqua
When creating a window, Godot would first register it to the WM(show it) and then set its flags. This works fine on a floating WM, but on tiling WMs as soon as a window gets registered the WM immediately acts on the window by scaling it up and treating it as a generic window, being registered without any special flags. This commit separates the showing of the window into another function and calls it after the most important flags are set, making windows with special flags(eg. all popups) work again on tiling WMs. Fixes #37930
2020-07-21Fix spelling & grammar in comments, docs, and messagesAndy Maloney
2020-07-13Add error messages if Vulkan init failed, prevent Vulkan context freeing ↵bruvzg
uninitialized device and instance.
2020-07-04Merge pull request #40105 from Logharaa/masterRémi Verschelde
Stop looping as soon as the first window that has focus is found
2020-07-04Break loop when the first focused window is foundGaël
2020-07-03Improve the situation of DND on X11Juan Linietsky
2020-07-01Add a focus out timeout for X11 to less events of this type are receivedJuan Linietsky
2020-07-01Ensure embedded mode works againJuan Linietsky
Also implemented application in/out notifications in X11.
2020-06-29X11: Ensure XGetWindowProperty data gets freedRémi Verschelde
And cleanup includes a bit.
2020-06-13Add keyboard layout enumeration / set / get functions (macOS, Windows, ↵bruvzg
Linux/X11), remove latin variant function.
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-05-10Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde
Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
2020-05-03[Linux/Windows] Set pressure to 1.0f when primary button is pressed and ↵bruvzg
device is not pressure sensitive.
2020-05-03Merge pull request #37756 from madmiraal/fix-x11-pressure-tiltRémi Verschelde
Fix X11 pressure and tilt values.