Commit Graph

177 Commits

Author SHA1 Message Date
bruvzg 99b0100a06
[X11] Use motion event button state instead of async state. 2024-08-01 10:07:07 +03:00
alvinhochun 24e02d56cb
Remove unneeded call in DisplayServerX11
X11 does not need setting exclusive flag (it is not implemented).

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2024-07-25 17:11:15 +08:00
Alvin Wong 97aa278edb Pass window exclusive and transient properties for subwindow creation
On Windows this allows to avoid having to change the owner of the window
after it has been created, which in rare circumstances may cause the
window to bug out.
2024-07-25 00:27:27 +08:00
Ronald Casili 3636d9dafc
Linux/X11: Fix memory leak from created screen images
Allocated XImages are improperly free'd with XFree.
The X11 documentation says that XImage should use
XDestroyImage to free both the image structure and
the data pointed to by the image structure.

Also fix a potential use-after-free bug.
2024-07-18 09:45:44 +02:00
Rémi Verschelde 25de53e147
X11: Fix creating RenderingDevice after #93706
The line was removed by mistake.
2024-06-29 14:03:29 +02:00
Pedro J. Estébanez 32d9c93af3 Improve handling of rendering startup errors 2024-06-28 19:31:50 +02:00
David Snopek 1289298b5e Fix text editor stealing focus from "Find in Files" dialog on X11 2024-06-27 17:27:21 -05:00
Hugo Locurcio 29348be0ca Tweak warning messages related to V-Sync on OpenGL
- Make warnings print only once per session.
- Tweak the message to be less confusing, and mention that the issue
  most likely stems from a graphics driver limitation.
2024-06-16 21:22:10 +02:00
bruvzg 3cabf51325
[X11] Detect XWayland and disable screen capture support. 2024-06-12 10:05:17 +03:00
Rémi Verschelde b80e591448
Merge pull request #92843 from anniryynanen/tooltip-in-popup
Stop color picker tooltip from stealing input events
2024-06-10 16:11:52 +02:00
Rémi Verschelde e52658643d
Merge pull request #92702 from kleonc/cursor_image_from_atlas_texture_fix
Fix creating cursor image from `AtlasTexture`
2024-06-07 23:29:57 +02:00
Anni Ryynänen ae1e2182ec
Stop color picker tooltip from stealing input events
Input events go to the tooltip because it's added to `popup_list` in
DisplayServer `popup_open`. I think there's no harm in tooltips being omitted
from the list, so this commit blocks non-popup windows from being added if they
have `FLAG_NO_FOCUS` and `FLAG_MOUSE_PASSTHROUGH`.

I'm not happy with this way of detecting tooltips. It'll also catch other
windows where this behavior may or may not be wanted.

I thought about adding `FLAG_TOOLTIP`, but went with the smaller change for
now.

Fixes #79500.
2024-06-06 20:00:05 +03:00
kleonc 91e995e704 Fix creating cursor image from AtlasTexture 2024-06-05 01:44:05 +02:00
bruvzg 5168647530
Use current mouse button state instead of saved values. 2024-05-31 15:50:14 +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
Rémi Verschelde c98fef08bf
Merge pull request #89033 from bruvzg/doc_end_err
[DisplayServer] Add error messages and descriptions to callbacks.
2024-05-28 17:48:42 +02:00
bruvzg 714effdf07
[DisplayServer] Add error messages and descriptions to callbacks. 2024-05-28 17:36:54 +03:00
bruvzg 1a40cda95e
[macOS, X11] Fix duplicate close requests. 2024-05-28 09:41:04 +03:00
bruvzg fc89a0c118
Fix build with `vuklan=no` and `d3d12=no` after #91505. 2024-05-25 21:08:50 +03:00
bruvzg 628c81d2d9
[DisplayServer] Add method to check if window transparency is supported and enabled. 2024-05-23 15:23:18 +03:00
Paulo Poiati a3769c0edc Properly set window class in Wayland 2024-05-22 10:42:12 -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 1f8e69ddec
[X11] Fallback to root window size, when Xinerama extension is available, but return zero screens. 2024-05-14 11:08:10 +03:00
Pedro J. Estébanez fc08eca524 DisplayServer: Avoid deadlocks while issuing input events and recursive main loop iterations 2024-05-08 17:41:40 +02:00
A Thousand Ships 308dbb8c63
[Core] Add scalar versions of `Vector*` `min/max/clamp/snap(ped)`
Convenience for a number of cases operating on single values
2024-05-02 10:31:13 +02:00
A Thousand Ships 31e7ee63f2
Fix unsafe uses of `Callable.is_null()`
`Callable.is_null()` is not equivalent to `!Callable.is_valid()` and
doesn't guarantee the call is valid.
2024-04-27 16:22:57 +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
Pedro J. Estébanez c28f5901c7 Polish interaction between windowing, input and rendering
- Adapt GL make/release API to the current architecture.
- Fix DisplayServer being locked while dispatching input (prevent deadlocks).
2024-04-10 18:47:42 +02:00
Rémi Verschelde 7092230df6
Merge pull request #89907 from bruvzg/nat_dlg_ftr_flags
[DisplayServer] Add separate feature flags for different native dialog types.
2024-03-28 10:47:15 +01:00
Rémi Verschelde d28fb26ab0
Merge pull request #89716 from theromis/master
[X11] Add more details to large icon size warning
2024-03-28 10:47:08 +01:00
bruvzg dc01658ee9
[DisplayServer] Add separate feature flags for different native dialog types. 2024-03-26 15:18:06 +02:00
Roman Vasilyev ece8685b3b Add icon source size to warning about "too large icon dimensions" to help faster find it 2024-03-22 12:53:57 -07:00
A Thousand Ships 79ba22a73f
Use `Vector*` component-wise `min/max/clamp` functions where applicable 2024-03-20 13:47:42 +01:00
Rémi Verschelde 058202e960
Merge pull request #86101 from GrammAcc/partial-fix-68305
[X11] Partial fix for Editor and Project Manager stealing focus on some window managers
2024-03-11 23:48:07 +01:00
bruvzg c65a667924
Move `global_menu_*` methods to a separate `NativeMenu` class. 2024-03-04 23:41:41 +02:00
kobewi 3aeb4a5542 Improve cursor_set_custom_image() method 2024-02-28 20:32:25 +01: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
Dario 73eff10c76 Finish splitting functionality of the Vulkan and D3D12 backends into RenderingDeviceDriver. 2024-02-12 10:02:18 -03:00
Rémi Verschelde 74b03edf1e
Merge pull request #82800 from Sauermann/fix-screen-mousemotion
Add screen-related attributes to mouse input events
2024-02-09 18:08:58 +01:00
Rémi Verschelde 4f478a55cc
Merge pull request #86843 from RandomShaper/fix_null_ptr
Avoid several null-dereferences of ApiContextRD
2024-02-07 10:58:01 +01:00
Pedro J. Estébanez d5a5dd52e8 Avoid several null-dereferences of ApiContextRD 2024-02-06 19:55:01 +01:00
Dalton Lang 8a2e4409e6 [X11] Partial Fix Godot Editor and Project Manager steals focus on a window manager on Linux
This is a workaround for the most critical portion of the WM focus bug
described in #68305. On some specific X11 WM configurations, the
editor's main window and any popups it creates will fight for focus,
which causes a total system lockup due to mouse and keyboard input being
stolen as well. Getting out of this infinite loop requires force
restarting the system.

It can be tested with the following shell script:

```bash
	!#/bin/sh

	godot4 &
	sleep 30
	pkill -x godot4
```

The workaround identified in #68305 is to remove the call to
XSetInputFocus in the ConfigureNotify event handler, so I have removed
the conditional block that calls this as well as the setup code above it
since there is no need to allocate the memory for the variables if they
won't be used in that call anymore.

This is just a hack and is not a complete fix for #68305. Multiple
developers are collaborating on a proper fix in the discussion in that
issue, but time is a valuable resource that no one has enough of, so I
am committing this workaround as a stop-gap to prevent the most critical
problem while we work on a full solution for the underlying cause.
2024-02-05 17:00:24 -06:00
Markus Sauermann 2235a1cbd0 Add screen-related attributes to mouse input events 2024-02-05 23:30:15 +01:00
Rémi Verschelde f220d46cdc
Merge pull request #80231 from romlok/input-key-location
Support detecting and mapping ctrl/alt/shift/meta by their left/right physical location
2024-01-29 13:15:42 +01:00
Mel Collins 8406e60522 Add InputEventKey.location to tell left from right
This adds a new enum `KeyLocation` and associated property
`InputEventKey.location`, which indicates the left/right location of key
events which may come from one of two physical keys, eg. Shift, Ctrl.

It also adds simulation of missing Shift KEYUP events for Windows.
When multiple Shifts are held down at the same time, Windows natively
only sends a KEYUP for the last one to be released.
2024-01-26 14:42:28 +01: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
David Snopek 64a52e08fe [X11] Don't re-set input focus if the given window already has it 2024-01-18 08:52:03 -06:00
Rémi Verschelde 4aff0ab5d5
Merge pull request #86441 from dsnopek/mequam-x11-focus-grab
[X11] Fix Godot stealing focus on alternative window managers
2024-01-18 09:34:18 +01:00
Rémi Verschelde 03767fbf3b
Merge pull request #86446 from reduz/transient-to-focused
Implement a `transient_to_focused` Window mode
2024-01-15 13:25:00 +01:00
Juan Linietsky 15144c24bd Implement a transient_to_focused mode
This intends to be the correct way to handle non-child windows becoming covered by the current window when becoming focused.
Enabling this property on select windows, they will become transient to the currently focused one when becoming visible.

This deprecates the "unparent_when_invisible" function introduced by #76025.
2024-01-14 18:51:44 +01:00