Commit Graph

10600 Commits

Author SHA1 Message Date
Pablo Correa Gómez
d4f8a80f2a
glcontext-win32-wgl: Respect user required version, use display as minimum
By setting and then getting the required version in a context, the code
was not respecting user requirements. Instead, simply get the requested
version by the user clipped by the requirements (display version)
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez
8d175801d7
glcontext: Add internal get_clipped_version function
It is useful for backends to get user set preferences while
ensuring the correctness of the result, which will be always
greater or equal than the minimum version provided
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez
6bc3ecbe56
glcontext: Improve get_version documentation 2022-06-04 20:48:29 +02:00
Pablo Correa Gómez
826fdc4a80
glcontext: Improve documentation on get_use_es api 2022-05-30 20:48:47 +02:00
Pablo Correa Gómez
0f21f6c273 glcontext: Make the creation of EGL context more obvious
By splitting it into its own function it becomes more that the
EGL code is a shared implementation.
2022-05-10 12:29:08 +02:00
Jonas Ådahl
f1551a87f6 x11: Trap errors happening when getting output properties
This is to avoid getting X11 errors (thus aborting/exiting with a
failure) during rapid hotplugs, which may happen during e.g. CI testing.
2022-05-02 17:28:36 +02:00
Luca Bacci
cb0c1b3f08 GdkWin32: Generate crossing event after button release
Fixes #4813
2022-04-06 20:27:46 +02:00
Luca Bacci
91f200167e GdkWin32: Correct generation of crossing events when holding an implicit grab
Fixes #4722
2022-04-06 20:27:32 +02:00
Luca Bacci
2b6fb005a8 GdkWin32: Report serial for events 2022-04-06 19:45:50 +02:00
Hemidark
0c44851848 gdk: always populate GDK_AXIS_{X,Y} in merged event history
Since GdkTimeCoord stores only axis values, prior to this change,
if a device didn't report GDK_AXIS_X or GDK_AXIS_Y, the history
attached to merged motion events wouldn't contain any positional
information.

Commit 6012276093 already addressed
this issue for devices without tools by storing the event position
in GdkTimeCoord using GDK_AXIS_X and GDK_AXIS_Y and augmenting the
GdkTimeCoord's axis bitmask accordingly.

This change generalizes that workaround to all devices. Note that
if a device DOES report values for GDK_AXIS_X and GDK_AXIS_Y, those
values won't be overwritten.

Closes #4809
2022-04-05 15:35:12 -07:00
Christian Hergert
d75147db0a Merge branch 'sumibi-yakitori/fix-minimize-window-macos' into 'main'
macos: Fix problem that window cannot be minimized by user operation

Closes #4811

See merge request GNOME/gtk!4613
2022-04-04 18:53:19 +00:00
sumibi-yakitori
d3cf7088b3 macos: Skip running showAndMakeKey when a window is minimized by user action
When a window is minimized by user action, the `showAndMakeKey` method is not executed when idle. This prevents the window from being un-minimized immediately.
And allow programmatic minimization of a window by un-minimizing them in `_gdk_macos_toplevel_surface_present`

Closes #4811
2022-04-05 01:06:44 +09:00
sumibi-yakitori
146bb70c2e macos: prohibit fullscreen transition if in transtion
This prevents performing additional fullscreen transitions while
a transition is already in progress.
2022-04-03 22:14:52 +00:00
Matthias Clasen
a3cedb0163 Merge branch 'clipboard-seg' into 'main'
x11: Check return of gdk_x11_get_xatom_name_for_display

See merge request GNOME/gtk!4607
2022-04-01 00:56:32 +00:00
Matthias Clasen
97bab27d82 Merge branch 'fix-win32-empty-clipboard' into 'main'
gdkclipboard-win32.c: Fix call to gdk_clipboard_claim_remote() (check GdkContentFormat is not NULL

Closes #4796

See merge request GNOME/gtk!4604
2022-04-01 00:56:02 +00:00
Xavier Claessens
bcd0704511 Remove #ifdef ENABLE_NLS
libintl API is guaranteed to always be available, glib will fallback to
proxy-libintl in case gettext is not found.
2022-03-31 11:41:34 -04:00
Dr. David Alan Gilbert
506566b6a4 x11: Check return of gdk_x11_get_xatom_name_for_display
When given an invalid atom, gdk_x11_get_xatom_name_for_display can
return NULL and trigger a seg in gdk_x11_clipboard_formats_from_atoms.
Check for NULL.

Why I'm seeing a bad atom there is probably a separate question.
https://bugzilla.redhat.com/show_bug.cgi?id=2037786
2022-03-31 15:56:09 +01:00
Chun-wei Fan
8519ab56f5 gdkclipboard-win32.c: Fix call to gdk_clipboard_claim_remote()
The call to gdk_win32_clipboard_request_contentformats() can return NULL even
without an error condition being hit (such as when the system clipboard is
empty), so check whether the returned GdkContentFormat pointer is not NULL
before calling gdk_clipboard_claim_remote(), which expects it to be not NULL,
otherwise we face a warning from that funtion and the subsequent
g_object_unref().

This at least partially fixes issue #4796.
2022-03-31 10:55:39 +08:00
Christian Hergert
e706e14fd9 gdk/gl: handle GL_RGBA/GL_UNSIGNED_NORMALIZED
WebKit's GTK 4 port can give us textures with an internal format of
GL_RGBA with GL_UNSIGNED_NORMALIZED and a bit-depth of 8. This fixes
warnings for every GdkGLTexture created/delivered to the GskGLRenderer.

The format is essentially the same as GL_RGBA8 since it is normalized
between 0.0..1.0 for 8-bit components.

Fixes #4783
2022-03-24 18:05:11 -07:00
Sebastian Keller
cc02076b75 surface: Use correct display when destroying a surface for depth switch
When surface depth switches from non-high-depth to high-depth (or vice
versa) the current surface has to be destroyed before a new one can be
created for this window. eglDestroySurface however was getting passed a
GdkDisplay, rather than the EGLDisplay it expects. As a result the old
surface did not get destroyed and the new surface could not be created
causing rendering to freeze.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4773
2022-03-22 08:18:26 +01:00
panoplie
3873861b27 macos: fix scroll-unit build 2022-03-19 02:55:02 +01:00
panoplie
fb4927827b gdk: Add enum to indicate the unit of scroll deltas
Add a new GdkScrollUnit enum that represent the
unit of scroll deltas provided by GdkScrollEvent.
The unit is accessible through
gdk_scroll_event_get_unit().
2022-03-19 00:41:26 +01:00
Matthias Clasen
8186cb8bee Merge branch 'wip/chergert/for-main' into 'main'
macos: fit'n'finish fixes for main

See merge request GNOME/gtk!4564
2022-03-12 19:07:41 +00:00
Christian Hergert
166444f115 macos: exclude popups from window list
This probably only matters if you do window list integration for the global
menu on macOS.
2022-03-11 22:36:26 -08:00
Christian Hergert
3cd68c5de5 macos: pass events to foreign windows 2022-03-11 18:25:47 -08:00
Christian Hergert
bd0c68f641 macos: dont steal key window from NSPanel
Or we risk making it really difficult to use native file choosers.
2022-03-11 18:07:34 -08:00
Christian Hergert
c3a7d79154 macos: fix window level for popups
This comment isn't really accurate anymore it seems, so we can start
setting the proper stacking order for popups now.
2022-03-11 18:01:05 -08:00
Christian Hergert
25624083dd macos: fix attachment of popups to parents
We had code to do it and it never actually got used correctly. This ensures
that the popup services are attached to the parents so that they get proper
stacking orders when displayed. Additionally, it fixes popups from being
shown as their own windows in Exposé.
2022-03-11 17:53:42 -08:00
Christian Hergert
407b5246a6 macos: fix window activation during shadow click-through
If we are clicking through the shadow of a window, we need to take special
care to not raise the old window on mouseUp. This is normally done by the
display server for us, so we need to use the proper API that is public to
handle this (rather than CGSSetWindowTags()). Doing so requires us to
dispatch the event to the NSView and then cancel the activcation from
the mouseDown: event there.
2022-03-11 14:44:07 -08:00
Christian Hergert
6bedcf22bc macos: select new key window after processing events
If we closed a key window in response to events, we need to denote another
window as the new key window. This is easiest to do from an idle so that
we don't clobber notification pairs of "did resign"/"did become" key
window.

We have a sorted set of surfaces by display server stacking, so we can
take the first one we come across that is already mapped and re-show it
to become key/main.
2022-03-11 14:44:06 -08:00
Christian Hergert
eeb9d6c398 macos: request layout with server-side decoration
If we have server-side decorations we might need to request a layout in
response to the resize notification. We don't need to do this in other
cases because we already handle that in the process of doing the resize
(and that code is that way because of delayed delivery of NSNotification).
2022-03-11 14:44:06 -08:00
Christian Hergert
cf8d2374c5 macos: fix resize when using server-side decorations
If we are using NSWindow titled windows, we don't end up waking up the
frame clock when the window is resized on the display server. This ensures
that we do that after getting a notification of resize.
2022-03-11 14:44:06 -08:00
Christian Hergert
9fa5378d83 macos: set main window in addition to key
If we are showing the window, we might also want to make it the main
window for the application when shown.
2022-03-11 14:44:06 -08:00
Matthias Clasen
9f7c9ce6ad Merge branch 'better-format-conversions' into 'main'
gdk: Clean up the optimised premultiply conversion function

See merge request GNOME/gtk!4550
2022-03-10 19:26:25 +00:00
Christian Hergert
84014e3414 macos: make transient-for key window when hiding surface
This only handled the popover case before and not the transient-for case.
2022-03-10 08:04:14 -08:00
Christian Hergert
4ced1c90f1 macos: actually drop unnecessary momentum events
These would get passed along to the NSApplication which we don't really
need to have happen. Denote it as such.
2022-03-10 03:21:12 -08:00
Christian Hergert
54c3b947fc macos: queue all pending events
Rather than process these a single event at a time, queue all of the
outstanding events from the NSEvent queue.
2022-03-10 03:20:07 -08:00
Christian Hergert
ea59d174a0 macos: drop enter/exit when in manual drag/resize
If we are in a manual resize/drag then we don't want to generate crossing
events as they can just confuse things.
2022-03-09 13:20:53 -08:00
Christian Hergert
32935d9fb0 macos: allow dropping NSEvent without propagation
There are cases we might want to consume a NSEvent without creating a
GdkEvent or passing it along to the NSApplication for processing. This
creates a new value we can use and check against to propagate that without
having to do out parameters at the slightly odd invalid pointer value for
a GdkEvent (similar to how MMAP_FAILED is done).
2022-03-09 13:19:22 -08:00
Christian Hergert
b390e1da4f macos: do not focus new window when resigning main
This can get in the way of how we track changes while events are actively
processing. Instead, we may want to delay this until the next main loop
idle and then check to see if we have a main window as the NSNotification
may have come in right after this.
2022-03-09 12:33:46 -08:00
Christian Hergert
f5098e4fc5 macos: fix cursor blink time
The value from settings is for the duration of the blink period, not the
timeout. This fixes the blink lasting longer than 10 seconds.
2022-03-05 12:01:53 -08:00
Christian Hergert
28607f082c macos: require input region to become key
Some things cannot become key windows (like tooltips). We can use the
input_region existence to determine if we should allow it as a key window.
2022-03-05 11:58:43 -08:00
Emmanuel Gil Peyrot
588076d166 gdk: Add a rgb8 → rgba8 conversion macro
This one can be used for both premultiplied and non-premultiplied alpha
formats, since alpha is always 255.  It is useful for opaque PNG upload
on both cairo and GL renderers.
2022-03-03 16:05:52 +01:00
Emmanuel Gil Peyrot
3a98b28ab7 gdk: Make the optimized premultiply function a macro
That way, all permutations are possible.  Previously it was only useful
in the cairo renderer, which required rgba8 → premultiplied bgra8, while
the GL renderer required rgba8 → premultiplied rgba8.  Now both are
available.
2022-03-03 16:04:45 +01:00
Emmanuel Gil Peyrot
cfeedcc321 gdk: Remove pixel format conversion ARM intrinsics
This was only useful when building for AArch32 without -mfpu=neon, on
AArch64 or with -mfpu=neon gcc is smart enough to do the auto-
vectorisation, leading to code almost as good as what I wrote in
1fdf5b7cf8.
2022-03-03 16:04:45 +01:00
Christian Hergert
5316eb0c35 gdk: use EGL_KHR_swap_buffers_with_damage
It appears that NVIDIA does not implement EGL_EXT_swap_buffers_with_damage
on their EGL implementation, but does implement the KHR variant of it.
This checks for a suitable implementation and stores a pointer to the
compatible implementation within the GdkGLContextPrivate struct.
2022-03-03 01:22:01 -08:00
Matthias Clasen
eaf0353205 Merge branch 'wip/chergert/for-main' into 'main'
macos: various fixes

See merge request GNOME/gtk!4543
2022-03-02 13:37:06 +00:00
Carlos Garnacho
f9f9bd3f5b Merge branch 'xdg-activation-no-surface' into 'main'
wayland: xdg-activation: Don't assume there's a focus surface

See merge request GNOME/gtk!4366
2022-03-02 12:44:52 +00:00
Christian Hergert
ca79688f52 macos: clear window stack before requesting motion
We want to ensure that we recalculate the sort order of windows before
processing the motion. Generally this would be done in response from the
display server in GdkMacosWindow, but I've seen it possible to race there.
2022-03-02 01:04:53 -08:00
Christian Hergert
efa8f903c2 macos: invalidate surface contents when mapping 2022-03-02 00:48:06 -08:00