Commit Graph

9709 Commits

Author SHA1 Message Date
Jonas Ådahl
475c07e935 gdk/surface: Make pending schedule a phase enum
Scheduling an update when frozen would reschedule when unfrozen; change
this to a generic pending phase enum, and use this for resrcheduling
paint and compute-size.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
0c8d97e3f7 gtk/root: Validate css node after update
It should happen before layout, but after the animation tick, thus after
the update.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
8d4f8f0cfc wayland: Concentrate size computation to 'compute-size' phase
This includes computing the surface size, including shadow margin,
setting the surface size, during the 'compute-size' clock phase.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
289b50785b wayland/surface: Don't save uninitialized size
GdkSurface's are initialized to have the size 1x1, as otherwise we'd
receive an X11 error, would a corresponding X11 window be created.

This confuses the "saved size" mechanisms in the Wayland backend, as
treats 0 as uninitialized, and not 1.

Fix this simply not saving size that if it's smaller or equal than 1.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
68c14242b2 gdk/surface: Add API to request 'compute-size' clock phase 2020-12-07 09:46:39 +01:00
Jonas Ådahl
4af54fb410 gdk/surface: Use helper to emit 'size-changed' signal 2020-12-07 09:46:39 +01:00
Jonas Ådahl
13b4a4b24c gdk/toplevelsize: Add way to set margin
Will be used to communicate the shadow margin, instead of using
gdk_surface_set_shadow_width().

Also set these values in gtkwindow.c.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
e07fde5c81 frame-clock: Add 'compute-size' phase
This will be handled between 'update' (which may trigger animation
ticks, CSS update, etc) and 'layout' which will allocate the widget
tree. It's meant to perform surface size computation, and is done
between these two phases in order to have an up to date state, and
letting the layout phase have an up to date size to layout in.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
8f27b3fcf6 gtk/window: Let the backend handle toplevel freezing 2020-12-07 09:46:39 +01:00
Jonas Ådahl
251bd15597 wayland: Apply new surface state at the beginning of a frame
Concentrate state application to the start of a frame; this is to avoid
having GTK going back and forth between different state if so would
happen between two frames.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
dd738d2787 surface: Only keep state 'withdrawn' after hiding
A hidden surface should start from a clean slate when showing again, so
clear any now out of date state.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
18d92c3f16 wayland: Keep pending initial state separate
Queue it, and then wait for it to actually take effect, i.e. be
confirmed via a configure event from the compositor, before setting the
actual GdkSurface::state value.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
f4c36fe1ce gdk/surface: Add API to queue and apply state changes
This will be used to compress state changes and apply as part of a frame
clock dispatch.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
23d7392eb9 gdk/surface: Removed unused struct field
The 'old_state' wasn't used anywhere, lets remove it.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
641915974b gdk/toplevel: Make gdk_toplevel_present() async
The plan is to concencrate size computations as part of the frame clock
dispatch, meaning we shouldn't do it synchronously in the present()
function.

Still, in Wayland, and maybe elsewhere, it is done in the present()
function, e.g. when no state change was made, but this will eventually
be changed.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
528ec4dded wayland: Only set mapped state when mapped
Mapping a surface under Wayland is an asynchronous process, where one
creates a surface and commits an initial state without having drawn
anything, then waiting for a configuration, which then is acknowledged
and content is painted and committed. Not until having received this
configuration is a surface actually mapped, so wait with setting the
mappedness until this.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
366b946f5b wayland/popup: Use maybe_notify_mapped() helper 2020-12-07 09:46:38 +01:00
Jonas Ådahl
9e6a55a086 wayland: Decouple mapped state from surface creation 2020-12-07 09:46:38 +01:00
Emmanuele Bassi
f1ff8f9aad Merge branch 'wip/chergert/macos-decelerate' into 'master'
macos: fix typo when creating scroll events

Closes #3418

See merge request GNOME/gtk!2916
2020-12-03 22:54:46 +00:00
Christian Hergert
115ea624d9 macos: fix typo when creating scroll events
This fixes an issue where we would ignore events with Y delta
and no X delta while scrolling due to a typo when checking for
any delta.

This fixes deceleration of kinetic scrolling on the macOS backend.

Fixes #3418
2020-12-03 13:46:47 -08:00
Christian Hergert
92f0216605 macos: ensure element is part of queue
We don't want to risk decrementing length field unless this is actually
part of the queue.
2020-12-02 19:44:02 -08:00
Christian Hergert
e317b9be00 macos: maintain GList element consistency
We need to keep this consistent so that we can look things up
faster in other places. Therefore, just take the hit here and clear
the entire list ensuring prev/next poniters are cleared.
2020-12-02 19:44:01 -08:00
Christian Hergert
2e52386be5 macos: send focus-out event to windowing 2020-12-02 19:44:01 -08:00
Christian Hergert
9431c70a6a macos: freeze updates until surface is mapped
This more closely matches the X11 backend in terms of freezing
updates on the surface initially until we get mapped.
2020-12-02 19:44:01 -08:00
Matthias Clasen
61b40c47f9 Merge branch 'fix/keyboard-input' into 'master'
Gdk4/Win32: Correct calls to gdk_key_event_new()

See merge request GNOME/gtk!2903
2020-12-02 22:14:27 +00:00
Matthew Jakeman
710d0620a4 Gdk4/Win32: Correct call to gdk_key_event_new()
The keycode and modifier (state) parameters are in the wrong order
for gdk_key_event_new() in the gdk win32 backend, which causes
key up/down events to be populated incorrectly.
2020-12-02 22:14:27 +00:00
Matthias Clasen
a482d870dd Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
Revert "macos: specify a window level for surfaces"

See merge request GNOME/gtk!2908
2020-12-02 20:15:51 +00:00
Christian Hergert
b38d0d7d9e macos: resign main/key when hiding window
This isn't done automatically for us, so we need to synthesize it in
our hide helper.

With this commit, we properly re-focus the new main/key window after
we have closed a transient-for window.
2020-12-02 11:36:38 -08:00
Christian Hergert
853a9c7a8c macos: disconnect frame clock when destroying surface 2020-12-02 11:35:02 -08:00
Christian Hergert
26b9254ac7 macos: track grab serial like other backends
This is what is done elsewhere, so copy that here too now that we actually
generate serials for events.
2020-12-02 11:34:31 -08:00
Christian Hergert
f11c23f407 Revert "macos: specify a window level for surfaces"
This reverts commit ca8b00e871.

This isn't needed and causes issues with other applications getting
stacked beneath our windows.
2020-12-02 11:15:57 -08:00
Emmanuele Bassi
3548350dfa docs: Add missing GdkDragSurfaceInterface gtk-doc annotation 2020-12-02 19:05:41 +00:00
Emmanuele Bassi
4caceb5dd4 Remove gtk-doc annotation from private symbols
Keep the documentation, just tweak it so that gtk-doc won't try to find
the declarations of these private symbols.
2020-12-02 19:05:41 +00:00
Christian Hergert
9b9fb4d7a3 macos: place above transient-for when presenting
We need to re-attach to the transient-for window whenever we present or
we risk getting placed behind the window by the display server. Apparently
that setting does not persist across a hide of the NSWindow.
2020-12-02 10:21:16 -08:00
Christian Hergert
ca8b00e871 macos: specify a window level for surfaces 2020-12-02 10:15:43 -08:00
Emmanuele Bassi
2fcd0e21bd Merge branch 'ebassi/for-master' into 'master'
Various documentation fixes

See merge request GNOME/gtk!2900
2020-12-02 13:40:25 +00:00
Christian Hergert
27b9a9e7ef macos: glFlush() when switching GL contexts
The Mac OpenGL programming guide suggests that you glFlush() before changing
contexts to ensure that the commands have been submitted.
2020-12-01 16:19:04 -08:00
Christian Hergert
a020c901ba macos: treat some toplevel NSWindow like document windows
This makes the window animate in by the window manager like other
application windows on macOS. Currently ignored for transient windows.
2020-12-01 16:19:04 -08:00
Emmanuele Bassi
b5313dbd4d docs: Annotate GdkDeviceTool 2020-12-01 15:51:52 +00:00
Emmanuele Bassi
b9a1827da7 docs: Annotate GdkGLTexture 2020-12-01 13:48:07 +00:00
Emmanuele Bassi
1057189ea2 docs: Annotate GdkMemoryTexture 2020-12-01 13:47:56 +00:00
Emmanuele Bassi
879b2845ad docs: Annotate GdkPaintable
The dummy typedef needs a gtk-doc stanza, and the interface
documentation needs to be slightly clarified.
2020-12-01 13:44:51 +00:00
Emmanuele Bassi
ecce3756d4 docs: Annotate GdkPopup 2020-12-01 13:42:07 +00:00
Emmanuele Bassi
6e4dd5811d docs: Annotate GdkSnapshot 2020-12-01 13:41:28 +00:00
Emmanuele Bassi
598e1304f6 docs: Annotate the GdkToplevel interface 2020-12-01 13:39:48 +00:00
Emmanuele Bassi
e3fbc0ee9c docs: Fix typo in the GdkTolevelLayout annotation 2020-12-01 13:38:33 +00:00
Emmanuele Bassi
4021734047 docs: Annotate the GdkContentProviderClass structure 2020-12-01 13:38:12 +00:00
Benjamin Beichler
8efde9c48c broadway: make header name parsing case-insensitve
since http RFC state that the header names should be processed case in-sensitive, broadway should not rely on the actual case. E.g. the go-language libraries tend to rewrite the header, which cause problems with e.g. Caddy

Fixes #3406
2020-11-27 12:05:51 +01:00
Volker Rümelin
7190a31b5f gdk/win32: fix integer overflow in monitor refresh rate calculation
In gdk/win32/gdkmonitor-win32.c in function
populate_monitor_devices_from_display_config() refresh->Numerator * 1000
overflows for refresh->Numerator > 4294976.

Cast the factor 1000 to UINT64 to prevent the overflow.

Fixes #3394
2020-11-23 21:42:58 +01:00
Christian Hergert
f32ae2964a macos: fix various compiler warnings 2020-11-18 20:16:37 -08:00