Commit Graph

67798 Commits

Author SHA1 Message Date
Jonas Ådahl
048a0172a0 gdk/wayland: Always configured size when resizing
GTK4 doesn't support arbitrary constraints when resizing a window (e.g.
steps, or aspect ratio), so we don't need to care about the result from
compute-size when doing interactive resizing.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
64f6118af4 gdk/toplevelsize: Don't complain if only shadow extends out of bounds 2020-12-07 09:46:39 +01:00
Jonas Ådahl
14b5a5a4c7 gtk/window: Remove gtk_window_resize()
Use gtk_window_set_default_size() or change the size of the widget
inside the window to get the same effect.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
4083f7e47f testsuite: Remove test for gtk_window_resize()
And use gtk_window_set_default_size() in the other place.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
2854d0339c tests/testgtk: Remove 'Resize' button
The gtk_window_resize() API is going away, so remove this test.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
98fffe6f23 tests/animated-resizing: Resize widget instead of window
This means the window needs to be marked as non-resizable, otherwise it
won't shrink.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
f083849ebb tests: Use gtk_window_set_default_size() when appropriate
Replace the usage of gtk_window_resize() with
gtk_window_set_default_size() where possible.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
deb58339b9 gtk/expander: Remove manual call to gtk_window_resize()
It happens implicitly for a non-resizeable window.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
65ad9d6d96 gdk/x11: Flush layout changes to the frame clack dispatch
This follows the trail of the Wayland backend in that GdkSurface changes
happen during the layout phase, and that a GDK_CONFIGURE no longer being
used to communicate the size changes of a surface; this now also uses
the layout signal on the GdkSurface.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
e0f13ecae7 gdk/surface: Try to reschedule pending phase until dispatched
If a surface scheduled a relayout, got frozen, and a layout phase
happened, then got unfrozen, it wouldn't see it's layout being
requested; avoid this race by remembering the pending phases until they
actually happened.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
880ceebae4 gdk/surface: Make backends aware of when layout is requested 2020-12-07 09:46:39 +01:00
Jonas Ådahl
8c014e63af x11: Remove handling of 'substructure' events
Reading the comment, it seems to be related being a window manager
decoration utility; this is not something GTK4 aims to handle, just drop
support for this.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
ecd40fa265 wayland: Layout drag icon from GdkSurface::layout 2020-12-07 09:46:39 +01:00
Jonas Ådahl
3b140a05a4 gtk/dragicon: Don't show until child is set
Showing before the child would result in bogus
gdk_drag_surface_present() with an "empty" (1x1) size. This can easily
be avoided by postponing showing until there is anything to show.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
d38f81999e wayland: Communicate popup layout changes via GdkSurface::layout
By moving popup layout emission to the layout phase, the current
GdkPopup::poup-layout-changed signal has no value on its own as it'd be
ignored by GtkPopover.

Make the Wayland backend communicate the popup layout changes via the
common signal; but leave the rest intact until other backends catch up.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
efcfd23652 wayland/surface: Restructure fields used for the next layout
Put them in a anonymous struct, and separate the toplevel specific ones
into another anonymous struct inside the first one. Later popup related
fields will be added.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
70b83c9a70 gdk/surface: Remove left-over signal enum value
The popup-layout-change signal was moved to GdkPopup, but the enum was
never removed from GdkSurface.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
4779e4e488 gdk/frame-clock: Remove the newly added 'compute-size' phase
What was previously done in the layout phase is now done in response to
a GdkSurface signal, which means size computation can happen on layout.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
13931463bd wayland/surface: Compute size on layout
Stop using the 'compute-size' phase of the frame clock, use the layout
phase instead, now that GTK isn't using the layout phase anymore.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
ecc861bf06 Pass the layout signal via GdkSurface to GtkRoot
Don't have GtkRoot listen directly to the layout signal on the frame
clock, but let it pass through GdkSurface. This will allow GdkSurface to
be more involved in the layout phase.
2020-12-07 09:46:39 +01:00
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
996eeec16c gtk/window: Don't gdk_toplevel_present() if not mapped
That would map the window too early.
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
Christian Hergert
285781724f macos: set opengl view as opaque in opaque windows
We don't need the OpenGL view to be transparent if the window itself
is not transparent. This has the potential to speed up the compositing
of the GL view onto the NSWindow.
2020-12-06 20:14:52 -08:00
Emmanuele Bassi
2d103cf80c Merge branch 'wayland-inhbit0' into 'master'
wayland: avoid referencing unallocated memory when uninhibiting

See merge request GNOME/gtk!2927
2020-12-07 00:26:50 +00:00
Michael Terry
c8d991e4de wayland: avoid referencing unallocated memory when uninhibiting 2020-12-06 18:37:40 -05:00
Zander Brown
a165bb9f46 Update British English translation 2020-12-06 22:08:30 +00:00
Timm Bäder
33ed42d985 gl renderer: Remove RESET_OPACITY flag
We always need to do that (and always passed the flag to
add_offscreen_ops() anyway).
2020-12-06 20:03:35 +01:00
Timm Bäder
1ee4f6138b gl renderer: Reset opacity when rendering blend node children
We render those on a texture, so we need to reset the opacity because
that will be applied when rendering the resulting texture.
2020-12-06 20:01:36 +01:00
Timm Bäder
7b61ef9e0f gl renderer: Initialize rounded rect early 2020-12-06 19:57:48 +01:00
Timm Bäder
b46d077b3a gl renderer: Fix rendering clipped blurred inset shadow nodes 2020-12-06 19:18:10 +01:00
Timm Bäder
e32331d002 gl renderer: Ignore crossfades between equal texture nodes 2020-12-06 19:18:10 +01:00
Timm Bäder
05928608ec gl renderer: Use scale_x and scale_y everywhere
Try to handle two different values for scale in horizontal and vertical
direction better.

Fixes #3431
2020-12-06 19:18:05 +01:00
Emmanuele Bassi
d8c9a67d20 docs: Clarify gtk_widget_activate()
We need to tell people what signal will be emitted when calling
gtk_widget_activate(), and that the shortcuts API might be more
appropriate to what they are looking for.
2020-12-06 15:13:57 +00:00