Matthias Clasen [Fri, 28 Apr 2023 22:55:42 +0000 (22:55 +0000)]
Merge branch 'harmonize-would_drop' into 'main'
Harmonize would_drop() replacement for g_log_writer_default_would_drop()
See merge request GNOME/gtk!4935
Matthias Clasen [Fri, 28 Apr 2023 22:49:42 +0000 (22:49 +0000)]
Merge branch 'deprecate-get-allocation' into 'main'
Deprecate get allocation
See merge request GNOME/gtk!5882
Matthias Clasen [Fri, 28 Apr 2023 21:29:08 +0000 (17:29 -0400)]
README: Updates
Drop the section that talked about main and how to update
local checkouts - its been 2 years, people should have gotten
around to it by now. Add some general git hints instead.
Benjamin Otte [Fri, 28 Apr 2023 21:22:12 +0000 (21:22 +0000)]
Merge branch 'wip/otte/for-main' into 'main'
Fix hangs on Wayland
Closes #5761
See merge request GNOME/gtk!5884
Benjamin Otte [Fri, 28 Apr 2023 20:40:39 +0000 (22:40 +0200)]
wayland: Set EGL swap interval to 0.
There's no need for EGL to do any timing, we do it in GTK already.
This fixes hangs in Mesa when we hide a surface after a SwapBuffers()
but before the frame callback arrives.
If we then reshow the surface and immediately render to it, Mesa would
still have a frame callback from before the hiding and forever poll()
waiting for the compositor to send the callback.
Fixes #5761
Benjamin Otte [Fri, 28 Apr 2023 20:21:42 +0000 (22:21 +0200)]
wayland: Disconnect the frame callback when hiding
Do not leave spurious frame callbacks around wen hiding surfaces.
Instead, store the callback and remove it.
Daniel Boles [Fri, 28 Apr 2023 20:11:12 +0000 (21:11 +0100)]
migrating-3to4: Don't mention removed Box method &
donʼt mention its renamed successor either, as that has its own section
later. We could have another sentence paragraph like ‘In the case of
GtkBox, the pack methods have been renamed to X and lost the trailing
arguments Y’, but that wonʼt help people prepare still on GTK3, which is
the point in the affected section… so just remove the misleading relic.
Matthias Clasen [Fri, 28 Apr 2023 20:09:17 +0000 (20:09 +0000)]
Merge branch 'matthiasc/for-main' into 'main'
Cosmetics
See merge request GNOME/gtk!5883
Matthias Clasen [Fri, 28 Apr 2023 20:02:18 +0000 (16:02 -0400)]
Updates
Matthias Clasen [Fri, 28 Apr 2023 19:36:37 +0000 (15:36 -0400)]
Cosmetics
Matthias Clasen [Fri, 28 Apr 2023 19:19:22 +0000 (15:19 -0400)]
Deprecate gtk_widget_get_allocated_baseline
Matthias Clasen [Fri, 28 Apr 2023 19:25:09 +0000 (15:25 -0400)]
Stop using gtk_widget_get_allocated_baseline
Use gtk_widget_get_baseline instead.
Matthias Clasen [Fri, 28 Apr 2023 19:18:13 +0000 (15:18 -0400)]
Add gtk_widget_get_baseline
This is just a renaming of gtk_widget_get_allocated_baseline
that fits better with gtk_widget_get_width/height.
Matthias Clasen [Fri, 28 Apr 2023 19:03:30 +0000 (15:03 -0400)]
Deprecate gtk_widget_get_allocation
Matthias Clasen [Fri, 28 Apr 2023 18:57:03 +0000 (14:57 -0400)]
flowbox: Use deprecation guards around get_allocation
Matthias Clasen [Fri, 28 Apr 2023 19:03:07 +0000 (15:03 -0400)]
inspector: Show bounds instead of allocation
Matthias Clasen [Fri, 28 Apr 2023 18:27:07 +0000 (14:27 -0400)]
scrolledwindow: Stop using gtk_widget_get_allocation
Matthias Clasen [Fri, 28 Apr 2023 18:16:32 +0000 (14:16 -0400)]
textutil: Stop using gtk_widget_get_allocation
Matthias Clasen [Fri, 28 Apr 2023 18:10:07 +0000 (14:10 -0400)]
tetview: Stop using gtk_widget_get_allocation
Matthias Clasen [Fri, 28 Apr 2023 17:29:15 +0000 (13:29 -0400)]
text: Stop using gtk_widget_get_allocation
Boyuan Yang [Fri, 28 Apr 2023 18:51:56 +0000 (18:51 +0000)]
Update Chinese (China) translation
Benjamin Otte [Fri, 28 Apr 2023 15:58:10 +0000 (15:58 +0000)]
Merge branch 'wip/otte/texturebuilder' into 'main'
Add GdkGLTextureBuilder
See merge request GNOME/gtk!5862
Matthias Clasen [Fri, 28 Apr 2023 14:40:57 +0000 (14:40 +0000)]
Merge branch 'baseline-fixes' into 'main'
boxlayout: Fix baselines a bit
See merge request GNOME/gtk!5879
Matthias Clasen [Fri, 28 Apr 2023 13:21:15 +0000 (09:21 -0400)]
More docs for BASELINE
Add some more details to the docs for GTK_ALIGN_BASELINE.
Matthias Clasen [Thu, 27 Apr 2023 20:19:24 +0000 (22:19 +0200)]
widget: Handle baseline better
When adjusting allocations, treat BASELINE more like CENTER
than like FILL. The results are better, in particular for
controls like entries or switches, which we never want to
scale up vertically, but still want to align to the baseline.
Matthias Clasen [Thu, 27 Apr 2023 20:19:01 +0000 (22:19 +0200)]
image: Simplify baseline handling
We guarantee that the out arguments of the measure
vfunc are non-NULL, no need to check.
Matthias Clasen [Thu, 27 Apr 2023 20:18:20 +0000 (22:18 +0200)]
switch: Fix up baseline handling
We need to report a baseline for baseline alignment
to work...
Matthias Clasen [Thu, 27 Apr 2023 18:24:49 +0000 (20:24 +0200)]
spinbutton: Use a grid layout
A grid layout lets us get the baseline right in
vertical orientation, by setting a baseline row.
It would be nice if the box layout supported this
as well, but currently it doesn't, and adding that
feature isn't trivial.
Matthias Clasen [Thu, 27 Apr 2023 16:14:49 +0000 (18:14 +0200)]
boxlayout: Fix baselines a bit
When we are not doing height-for-width, we still
need to line up baselines.
Matthias Clasen [Thu, 27 Apr 2023 15:56:12 +0000 (17:56 +0200)]
Add another baseline test client
Matthias Clasen [Tue, 25 Apr 2023 09:48:50 +0000 (11:48 +0200)]
gldriver: Add a sync when creating textures
Matthias Clasen [Tue, 25 Apr 2023 09:44:21 +0000 (11:44 +0200)]
gstreamer: Defer the sync
Don't sync right when we receive the buffer,
pass it along with the texture to be executed
later in the renderer.
Matthias Clasen [Sat, 28 Jan 2023 16:04:10 +0000 (11:04 -0500)]
glarea: Synchronize
Create a fence object and pass it along when
creating the GL texture, so that the GL renderer
can wait for the texture to be ready.
Matthias Clasen [Thu, 27 Apr 2023 06:46:25 +0000 (08:46 +0200)]
filechooser: Plug a memory leak
Matthias Clasen [Thu, 27 Apr 2023 06:33:03 +0000 (08:33 +0200)]
Add some more valgrind suppressions
Matthias Clasen [Thu, 27 Apr 2023 06:26:53 +0000 (08:26 +0200)]
columnview: Plug a memory leak
g_list_model_get_item strikes again.
Matthias Clasen [Thu, 27 Apr 2023 06:26:13 +0000 (08:26 +0200)]
filechooser: Plug a memory leak
We own references to the columns. Drop them.
Matthias Clasen [Thu, 27 Apr 2023 06:25:30 +0000 (08:25 +0200)]
filechoosernative: Plug a memory leak
Unref all the GVariants.
Matthias Clasen [Thu, 27 Apr 2023 05:22:38 +0000 (07:22 +0200)]
filedialog: Plug a memory leak
We own a reference to the native dialog,
and we need to drop it when we're done.
Matthias Clasen [Thu, 27 Apr 2023 04:51:30 +0000 (06:51 +0200)]
node-editor: Plug a memory leak
Matthias Clasen [Thu, 27 Apr 2023 11:41:16 +0000 (13:41 +0200)]
notebook: Drop an unused variable
Matthias Clasen [Thu, 27 Apr 2023 04:46:36 +0000 (06:46 +0200)]
Fix various bitfield warnings
clang rightly complains about using gboolean
as type for bitfields, since it is signed.
Avoid that.
Matthias Clasen [Sat, 28 Jan 2023 20:20:26 +0000 (15:20 -0500)]
gsk: Synchronize when using textures
Pass the GLsync object from texture into our
command queue, and when executing the queue,
wait on the sync object the first time we
use its associated texture.
Matthias Clasen [Mon, 30 Jan 2023 13:35:43 +0000 (08:35 -0500)]
gltexture: Synchronize when downloading
If the GL texture has a sync object, wait
on it before downloading the data.
Matthias Clasen [Tue, 25 Apr 2023 09:03:51 +0000 (11:03 +0200)]
gltexture: Optionally take a sync object
Add a new function to TextureBuilder that takes a GLsync that
requires internal code to wait on before using the texture.
Somewhat sneakily, we don't take the sync if syncs are not supported by
the current GL context.
As public API has no code to query the sync for the destroy notify, this
is fine and it means we don't have to do the check every time we want to
call gdk_texture_get_sync() internally.
Matthias Clasen [Wed, 26 Apr 2023 09:59:51 +0000 (11:59 +0200)]
glcontext: Add a way to check for GLsync
Benjamin Otte [Mon, 24 Apr 2023 20:44:01 +0000 (22:44 +0200)]
gltexture: Deprecate gdk_gl_texture_new()
Use GdkGLTextureBuilder instead.
Benjamin Otte [Mon, 24 Apr 2023 20:36:42 +0000 (22:36 +0200)]
glrenderer: Port to GdkGLTextureBuilder
Benjamin Otte [Mon, 24 Apr 2023 20:22:07 +0000 (22:22 +0200)]
media-gstreamer: Port to GdkGLTextureBuilder
This is a rudimentary port that does not take advantage of all the cool
new formats that we could support now.
Benjamin Otte [Mon, 24 Apr 2023 20:10:06 +0000 (22:10 +0200)]
testsuite: Use GLTextureBuilder
Benjamin Otte [Mon, 24 Apr 2023 20:02:10 +0000 (22:02 +0200)]
glarea: Port to GdkGLTextureBuilder
Benjamin Otte [Mon, 24 Apr 2023 19:56:49 +0000 (21:56 +0200)]
texturebuilder: Pass the destroy notify to the build() function
This is more compatible with bindings that want to create per-object
callbacks and not have their callbacks reused over different build()
calls.
Benjamin Otte [Mon, 24 Apr 2023 12:36:38 +0000 (14:36 +0200)]
texturebuilder: Add ::format and ::has-mipmap
We were trying to deduce that previously. Now we have explicit API
Benjamin Otte [Mon, 24 Apr 2023 04:04:26 +0000 (06:04 +0200)]
gdk: Add GdkGLTextureBuilder
Building GL textures is complicated, so create an object to make them.
So far, this object just contains the functionality of
gdk_gl_texture_new(), but that will change in the future.
Matthias Clasen [Thu, 27 Apr 2023 04:37:12 +0000 (04:37 +0000)]
Merge branch 'matthiasc/for-main' into 'main'
Fix the build with clang
See merge request GNOME/gtk!5876
Benjamin Otte [Thu, 27 Apr 2023 00:39:19 +0000 (00:39 +0000)]
Merge branch 'wip/otte/gl-version' into 'main'
Make sure highest possible version GLContext is created
See merge request GNOME/gtk!5870
Benjamin Otte [Wed, 26 Apr 2023 16:08:59 +0000 (18:08 +0200)]
wgl: Improve error messages when GL init fails
In particular, we want to get the GL version, when the Windows box/VM
has an unsuitable GL implementation.
This is somewhat helpful in analyzing failures to bring up GL on
machines where users claim GL does work.
Benjamin Otte [Wed, 26 Apr 2023 04:16:37 +0000 (06:16 +0200)]
wgl: Create context during WGL initialization
This way, we can realize it and either print success information about
it or return NULL if that fails.
This makes it more likely that we fail early, which means we can then
initialize EGL.
Benjamin Otte [Wed, 26 Apr 2023 03:54:45 +0000 (05:54 +0200)]
win32: Get rid of display->gl_version
We can just query the display's GL context.
And it's not used otherwise anymore.
Benjamin Otte [Wed, 26 Apr 2023 02:17:32 +0000 (04:17 +0200)]
win32: Refactor context creation
This refactor achieves the following:
* check GL version against proper matching context version
In particular, for legacy contexts, we now actually check
* make sure the actual version is set, even for legacy contexts
* make sure set_is_legacy() is set properly
Benjamin Otte [Tue, 25 Apr 2023 21:18:36 +0000 (23:18 +0200)]
gdk: Add workaround for Visual Studio
apparently casting something to itself makes it not constant.
Benjamin Otte [Tue, 25 Apr 2023 20:50:00 +0000 (22:50 +0200)]
mac: Properly set GLContext.is_legacy()
Benjamin Otte [Tue, 25 Apr 2023 20:45:34 +0000 (22:45 +0200)]
glcontext: assert all contexts set the version on realize()
Now that all contexts do that, insist that they keep doing it.
And because they keep doing it, we can support querying the GL version
from gdk_gl_context_get_version() without requiring the context to be
made current.
Benjamin Otte [Tue, 25 Apr 2023 20:16:27 +0000 (22:16 +0200)]
mac: Try all different OpenGL profiles
.. and pick the best one that is supported.
Also make sure that the resulting context has at least the desired
version, otherwise bail.
Benjamin Otte [Tue, 25 Apr 2023 19:45:31 +0000 (21:45 +0200)]
glcontext: Compute matching version the simple way
Do it all in one function instead of requiring two different ones.
Benjamin Otte [Tue, 25 Apr 2023 19:55:16 +0000 (21:55 +0200)]
win32: Make sure highest possible GL version is created
Mirror EGL here.
Benjamin Otte [Tue, 25 Apr 2023 19:30:32 +0000 (21:30 +0200)]
win32: Pass the version properly through the creation stack
We were using major/minor instead of GdkGLVersion.
And we were resetting back to 0 and ignoring the required min version
which we should not do.
Benjamin Otte [Tue, 25 Apr 2023 19:24:04 +0000 (21:24 +0200)]
glx: Make sure highest possible GL version is created
Mirror EGL here.
Benjamin Otte [Tue, 25 Apr 2023 18:08:33 +0000 (20:08 +0200)]
egl: Make sure highest possible GL version is created
The EGL spec states:
The context returned must be the specified version, or a later
version which is backwards compatible with that version.
Even if a later version is returned, the specified version
must correspond to a defined version of the client API.
GTK has so far been relying on EGL implementations returning a
later version, because that is what Mesa does.
But ANGLE does not do that and only provides the minimum version, which
means Windows EGL has been forced to use a lower EGL version for no
reason.
So fix this and try versions in order from highest to lowest.
Benjamin Otte [Tue, 25 Apr 2023 18:04:13 +0000 (20:04 +0200)]
gdk: Move GdkGLAPI enum into gdkenums.h
Benjamin Otte [Tue, 25 Apr 2023 17:32:12 +0000 (19:32 +0200)]
glcontext: Use GdkGLVersion elsewhere
... and add a convenience API to generate GL versions from strings to
make the gdk_gl_context_check() API nicer.
Benjamin Otte [Tue, 25 Apr 2023 17:17:07 +0000 (19:17 +0200)]
gdk: Introduce GdkGLVersion
... and use it.
Makes the code simpler.
Benjamin Otte [Tue, 25 Apr 2023 20:40:59 +0000 (22:40 +0200)]
win32: Remove an outdated check
We require GL 3.0, so checking for less than 2.0 makes no sense anymore.
Matthias Clasen [Wed, 26 Apr 2023 22:09:18 +0000 (00:09 +0200)]
Fix a crash
Fix an oversight from
c87b193d2abe1.
Benjamin Otte [Wed, 26 Apr 2023 22:06:40 +0000 (22:06 +0000)]
Merge branch 'wip/otte/treelistmodel-madness' into 'main'
treelistmodel: Be safer during collapsing
See merge request GNOME/gtk!5875
Matthias Clasen [Wed, 26 Apr 2023 21:54:43 +0000 (23:54 +0200)]
Fix the build with clang
This broke our macos ci.
Benjamin Otte [Wed, 26 Apr 2023 21:40:56 +0000 (23:40 +0200)]
treelistmodel: Delay notifies from TreeListRow
Don't notify during destruction, notify afterwards.
This way we don't call into user code from a half-destructed node.
Note that this changes the order in which those notifies happen when
collapsing a large tree: From parent node before child nodes to child
nodes before parent node.
No actual use case for this, just thought it would be safer.
Benjamin Otte [Wed, 26 Apr 2023 21:30:37 +0000 (23:30 +0200)]
treelistmodel: Be safer during collapsing
While we are collapsing a subtree, some signal handlers may not be
disconnected while we are doing this. By adding this check and not
giving those nodes no longer access to the model, we can stop it from
modifying it while we are trying to collapse stuff.
Fixes some crashes in gnome-builder.
Benjamin Otte [Wed, 26 Apr 2023 21:03:24 +0000 (21:03 +0000)]
Merge branch 'wip/otte/surface-surgery' into 'main'
refactor internal surface API
See merge request GNOME/gtk!5846
Daniel Boles [Wed, 26 Apr 2023 20:30:10 +0000 (21:30 +0100)]
3to4: Fix we said we replace doubles with doubles,
when what we are replacing are ints!
Benjamin Otte [Fri, 21 Apr 2023 03:41:48 +0000 (05:41 +0200)]
display: Remove ::create_surface() vfunc
Instead, have a toplevel_type and popup_type in GdkDisplay and
call g_object_new() with those types.
Benjamin Otte [Fri, 21 Apr 2023 20:10:00 +0000 (22:10 +0200)]
wayland: Set default title in toplevel_init()
Benjamin Otte [Fri, 21 Apr 2023 19:59:31 +0000 (21:59 +0200)]
macos: Add surface from ::constructed()
Benjamin Otte [Fri, 21 Apr 2023 19:47:53 +0000 (21:47 +0200)]
gdk: Remove GDK_SURFACE_DRAG enum member
I want to remove the whole enum, but this value was used all over the
place. So removing it first ensures I didn't forget anything.
Benjamin Otte [Fri, 21 Apr 2023 19:44:55 +0000 (21:44 +0200)]
wayland: Create drag surface directly
... instead of going through create_surface().
Benjamin Otte [Fri, 21 Apr 2023 18:54:25 +0000 (20:54 +0200)]
wayland: Remove struct member
It's unused.
Benjamin Otte [Fri, 21 Apr 2023 18:52:58 +0000 (20:52 +0200)]
x11: Add private gdk_x11_drag_surface_new()
... and use it.
Benjamin Otte [Fri, 21 Apr 2023 18:43:54 +0000 (20:43 +0200)]
x11: Set frame clock in ::constructed
Benjamin Otte [Fri, 21 Apr 2023 18:36:07 +0000 (20:36 +0200)]
x11: Move window construction to ::constructed()
Benjamin Otte [Fri, 21 Apr 2023 03:40:19 +0000 (05:40 +0200)]
broadway: Create gdk_broadway_drag_surface_new()
... and use it.
Benjamin Otte [Fri, 21 Apr 2023 03:37:49 +0000 (05:37 +0200)]
win32: Create gdk_win32_draw_surface_new()
... and use it.
Benjamin Otte [Fri, 21 Apr 2023 03:35:45 +0000 (05:35 +0200)]
macos: Set frame clock in ::constructed
Benjamin Otte [Fri, 21 Apr 2023 03:29:05 +0000 (05:29 +0200)]
broadway: Set frame clock in ::constructed
... instead of passing it to g_object_new().
Benjamin Otte [Fri, 21 Apr 2023 03:21:43 +0000 (05:21 +0200)]
broadway: Move surface init code into ::constructed()
Benjamin Otte [Fri, 21 Apr 2023 02:59:48 +0000 (04:59 +0200)]
win32: Set frame clock in constructed()
... instead of passing it as construct argument.
Benjamin Otte [Thu, 20 Apr 2023 21:29:17 +0000 (23:29 +0200)]
wayland: Construct the frame clock in the surface
... instead of passing it to g_object_new().
Benjamin Otte [Thu, 20 Apr 2023 21:26:49 +0000 (23:26 +0200)]
surface: Make gdk_surface_set_frame_clock() available
... to backends.
That way, frame clocks can be constructed by the backends' surface
implementations and dont need to be passed in as construct arguments.
Also add an assertion that they are indeed constructed.
Benjamin Otte [Thu, 20 Apr 2023 15:38:57 +0000 (17:38 +0200)]
macos: Move native window creation to ::constructed()
That way, it doesn't need a specific init function.
Also chain up last, so that the generic initialization code in
GdkSurface::constructed can access a fully initialized macos surface.
Benjamin Otte [Tue, 18 Apr 2023 14:41:05 +0000 (16:41 +0200)]
macos: Don't pass sizes to macos_surface_new()
They're 0, 0, 100, 100 always, so just use those values everywhere.
Benjamin Otte [Tue, 18 Apr 2023 14:38:57 +0000 (16:38 +0200)]
macos: Create drag surface directly
Do not go via macos_surface_new().