Commit Graph

9788 Commits

Author SHA1 Message Date
Christian Hergert
f4f104c9f9 macos: fix typedef on older macOS
On older systems, we don't have a typedef for gravity. They are a NSString
pointer and we can provide that manually just fine.
2021-01-05 13:53:22 -08:00
Christian Hergert
28a6f0df05 macos: handle point conversion on older macOS
On older systems, the availability of some methods seem to be incorrect
based on Apple documentation. This works around the issue by using
the rect conversion on older systems.
2021-01-05 13:52:11 -08:00
Christian Hergert
9320148d71 macos: implement compute_size and request_layout
These functions were not implemented when the sizing changes
landed before GTK 4 was released. This fixes an issue with non-
resizeable windows not reacting to layout changes.

Fixes #3532
2021-01-01 13:17:47 -08:00
Christian Hergert
ad617a0e06 macos: avoid setHasShadow unless shadow changes 2021-01-01 13:17:47 -08:00
Christian Hergert
62af8365f6 macos: fix toplevel present function prototype
No need to return anything here.
2021-01-01 13:17:47 -08:00
Christian Hergert
d888402bf9 macos: ensure GdkMacosWindow in surface discovery
We want to ignore windows that are not related to those controlled
by the GDK backend.

Fixes #3533
2020-12-31 10:55:50 -08:00
Ignacio Casal Quinteiro
4ad5e77907 macos: do not crash in mojave
The localizedName property is not available in Mojave
so just ifdef in that case the code out.
2020-12-31 11:35:04 +01:00
Matthias Clasen
b5fe434fea Revert "Merge branch 'gtk_egl_wayland' into 'master'"
This reverts merge request !3011
2020-12-30 03:32:18 +00:00
Matthias Clasen
224c2674ab Merge branch 'gtk_egl_wayland' into 'master'
Expose gdk_wayland_surface_get_wl_egl_window()

See merge request GNOME/gtk!3011
2020-12-30 03:32:05 +00:00
Timm Bäder
6c09832b9b Merge branch 'xndcn/fix-shader' into 'master'
gl: Fix implicit leaking of shader object

See merge request GNOME/gtk!3013
2020-12-29 16:58:55 +00:00
Matthias Clasen
1758f88492 Merge branch 'ebassi/issue-3522' into 'master'
Fix the Vulkan header check for VK_RESULT_RANGE_SIZE

Closes #3522

See merge request GNOME/gtk!3009
2020-12-29 16:36:09 +00:00
xndcn
34ffdc6e3f gl: Fix implicit leaking of shader object
According to OpenGL spec, a shader object will only be flagged
for deletion unless it has been detached; when a program object
is deleted, those shader objects attached to it will be detached
but not deleted unless they have already been flagged for deletion.

So we shall detach a shader object before it is deleted, and delete
it before the program object is deleted best.
2020-12-29 23:50:45 +08:00
Timm Bäder
108933b655 Merge branch 'wip/chergert/volatile-fixes' into 'master'
types: fix various use of volatile in type registration

See merge request GNOME/gtk!2865
2020-12-29 07:49:12 +00:00
Vivek Kasireddy
3344bcaf92 gdk/wayland/surface: Expose gdk_wayland_surface_get_wl_egl_window()
Some GTK based applications such as Qemu UI create and manage
EGLSurfaces associated with the relevant GdkSurfaces. In order to create
an EGLSurface, there needs to be a way to pass the native window
object to eglCreateWindowSurface(). While running in an X environment,
the native window object can be obtained by calling
gdk_x11_surface_get_xid(). Likewise, the native window object can be
obtained by calling gdk_wayland_surface_get_wl_egl_window() while
running in a Wayland environment. Therefore, this API needs to be
exposed to apps.

Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
2020-12-28 18:20:04 -08:00
Emmanuele Bassi
f22ec063a1 Fix the Vulkan header check for VK_RESULT_RANGE_SIZE
The VK_RESULT_RANGE_SIZE enumeration value was removed in 1.2.140, not
1.2.142.

Fixes: #3522
2020-12-28 18:41:18 +00:00
Matthias Clasen
7e579bb59a Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2997
2020-12-24 07:13:22 +00:00
Benjamin Otte
96e1b85c2c gdkarray: Add a "stolen" boolean to splice()
If set to TRUE, does not call the free func for the removed items.

This can be used to move items between arrays without having to do the
refcounting dance.
2020-12-24 06:38:45 +01:00
Matthias Clasen
e854b90293 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!2990
2020-12-22 04:53:31 +00:00
Matthias Clasen
4310f24a4e Fix warnings with Vulkan < 162
Tiring to watch the Vulkan people stumble through
ABI and API compat, but what can you do.
2020-12-21 20:00:16 -05:00
Timm Bäder
e6f6d1e478 main: Add & use gdk_event_dup_axes()
The way this code is written trips up scan-build. Add
gdk_event_dup_axes() and use it in gtkmain.c.
2020-12-21 10:26:02 +01:00
Matthias Clasen
7533369695 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!2973
2020-12-18 05:06:35 +00:00
Emmanuele Bassi
62dbadd536 Merge branch 'fix-macos-compilation' into 'master'
macos: fix typo that breaks compilation

See merge request GNOME/gtk!2962
2020-12-16 20:18:27 +00:00
Matthias Clasen
0588db8a69 Merge branch 'wip/carlosg/for-master' into 'master'
gdk/x11: Transform XI_Motion based scroll into discrete

Closes #3459

See merge request GNOME/gtk!2959
2020-12-16 19:56:16 +00:00
Rico Tzschichholz
df70dbbae4 gdk: Use correct parameter name to fix g-ir-scanner warning
../gdk/gdktoplevellayout.c:217: Warning: Gdk: gdk_toplevel_layout_get_maximized:
  unknown parameter 'maximized' in documentation comment, should be 'maximize'
2020-12-16 20:19:05 +01:00
Tom Schoonjans
81c55b06d2 macos: fix typo that breaks compilation 2020-12-16 19:16:19 +00:00
Emmanuele Bassi
4fb55b3270 docs: Complete symbol coverage for GDK
100% symbol docs coverage.
833 symbols documented.
0 symbols incomplete.
0 not documented.

What's left are just type system macros and windowing system opaque
structures.
2020-12-16 16:28:58 +00:00
Carlos Garnacho
c95a32def8 gdk/x11: Transform XI_Motion based scroll into discrete
Depending on the input driver, we will get XI_Motion based scroll
events for regular mouse wheels. These are intended to be handled
as discrete scroll, so detect smooth scroll events that move by
exactly 1.0 in either direction.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3459
2020-12-16 14:26:44 +01:00
Jonas Ådahl
142f7862ed gdk/toplevellayout: Change API to be about intent, not full state
When being fullscreen, and wanting to unfullscreen but not caring about
whether to go unmaximized or maximized (as this information is lost), if
the GdkToplevelLayout represents the full intended state, we won't be
able to do the right thing.

To avoid this issue, make the GdkToplevelLayout API intend based, where
if one e.g. doesn't call gdk_toplevel_set_maximized() with anything, the
backend will not attempt to change the maximized state.

This means we can also remove the old 'initially_maximized' and
'initially_fullscreen' fields from the private GtkWindow struct, as we
only deal with intents now.
2020-12-16 14:16:08 +01:00
Timm Bäder
3c2484142d vulkancontext: Remove usage of VK_ERROR_INCOMPATIBLE_VERSION_KHR
According to
https://www.khronos.org/registry/vulkan/specs/1.0-wsi_extensions/html/chap46.html
this has been removed. It also breaks the build on my system
2020-12-16 08:26:46 +01:00
Matthias Clasen
338d3ffa13 Add a doc comment for gdk_surface_request_layout 2020-12-15 14:14:49 -05:00
Emmanuele Bassi
a6bd0c7eed Remove stray mentions of GdkConfigureEvent
The event was removed, but some traces of it linger.
2020-12-15 13:58:52 +00:00
Emmanuele Bassi
538aa6c200 Move private GdkX11 symbols out of a public header
This avoids private symbols showing up in the introspection data, as
well as in the undocumented symbols list when generating the GDK API
reference.
2020-12-15 13:46:50 +00:00
Emmanuele Bassi
99e0929d6c build: Use a consistent style for Meson files 2020-12-15 12:46:59 +00:00
Emmanuele Bassi
7975bbfcaa build: Remove linker flags from static libraries
We only need hardening linker flags on the libgtk shared library;
internal static libraries don't really need them.
2020-12-15 11:36:20 +00:00
Adrien Plazas
dc96542742 gdkpixbuf-drawable: Free the pixbuf on Cairo error
This avoids leaking the pixbuf.
2020-12-14 15:07:41 +01:00
Carlos Garnacho
8be0918d7e gdk/surface: Trigger motion check for next frame after thaw
This is a more reliable calling point than ::resume-events, and a
good one to schedule things so they happen on a frame clock in no
special phase (Thus still fixing the original issue at 80d4a08e30)

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3461
2020-12-12 02:14:02 +01:00
Matthias Clasen
c5dd34344f Merge branch 'wip/carlosg/for-master' into 'master'
Wip/carlosg/for master

Closes #3426 and #3264

See merge request GNOME/gtk!2933
2020-12-09 15:04:01 +00:00
Emmanuele Bassi
f4a0d57c07 Prepare version macros for 4.0
Remove the 3.9x version macros, and ensure that we handle 4.0 as the
backstop for the minimum required version.
2020-12-09 12:19:50 +00:00
Carlos Garnacho
80d4a08e30 gdk/surface: Delay gdk_surface_request_motion() requests internally
Those requests are received while dealing with the ::layout frame
clock phase, this has the unintended side effect of making the
frame clock "rewind" to handle ::flush-events again during this
frame, which delays everything and practically halves the frame
rate.

We do intend to make the motion events dispatches on the next frame,
so do this in an idle at a slightly lower priority than layout/draw,
so the ::flush-events phase is actually requested for the next frame.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3264
2020-12-08 23:27:03 +01:00
Christian Hergert
0236fe80c1 macos: fix macOS build breakage
Fixes breakages due to recent refactoring around sizing changes.
2020-12-08 11:29:31 -08:00
Matthias Clasen
1f141c1953 Merge branch 'wip/surface-state-rework' into 'master'
Rework surface state and geometry computation

See merge request GNOME/gtk!2885
2020-12-08 15:38:36 +00:00
Christian Hergert
6e0fffa0f8 macos: use CGLSetParameter and CGLEnable
We don't need to go through the NSOpenGLContext for these.
We can just use the C API directly. It's also clearer what is using
CGLEnable() vs CGLSetParameter().
2020-12-07 11:47:51 -08:00
Jonas Ådahl
d2c95a1b13 gdk: Replace 'WITHDRAWN' state with async 'is-mapped' boolean
It was used by all surfaces to track 'is-mapped', but still part of the
GdkToplevelState, and is now replaced with a separate boolean in the
GdkSurface structure.

It also caused issues when a widget was unmapped, and due to that
unmapped a popover which hid its corresponding surface. When this
surface was hidden, it emitted a state change event, which would then go
back into GTK and queue a resize on popover widget, which would travel
back down to the widget that was originally unmapped, causing confusino
when doing future allocations.

To summarize, one should not hide widgets during allocation, and to
avoid this, make this new is-mapped boolean asynchronous when hiding a
surface, meaning the notification event for the changed mapped state
will be emitted in an idle callback. This avoids the above described
reentry issue.
2020-12-07 20:37:30 +01:00
Matthias Clasen
59fd171515 popup: Documentation tweaks
Use proper syntax for referring to signals.
2020-12-07 20:37:30 +01:00
Jonas Ådahl
ac17217c69 wayland/toplevel: Don't alwyas skip changing xdg_toplevel state
We only called xdg_toplevel.(un)set_maximize() if the toplevel layout
changed, but this misses the case when the compositor had changed the
maximized state. Change it to call the xdg_toplevel request if either
the local layout changed, or if the layout differs from the current
state.

This fixes an issue where one couldn't unmaximize a window by double
clicking the titlebar that, had previously been maximized e.g. using a
keyboard binding.

Do the same for fullscreen.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
fd01723470 x11/surface: Avoid resizing if computed size didn't change
This fixes an issue where we'd resize to the previous window size during
interactive resize.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
994aa41ccc x11/surface: Move the scattered compute-size calls to helper
This simplifies things, and fixes issue where we'd resize the wrong
time, and miss resizing other times.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
c791185c20 x11/surface: Remember the toplevel layout 2020-12-07 20:37:29 +01:00
Jonas Ådahl
e7ddaf5ed1 x11/surface: Compute size after update too
This will sometimes mean a frame is skipped if a resize was requested
during the update phase of the frame dispatch. Not doing so can cause
trying to allocate a window smaller than the minimum size of the widget.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
2217cf8ea2 x11/surface: Remember when there is a pending ConfigureNotify
This will be used to decide whether to try to resize windows when .
2020-12-07 20:37:29 +01:00