Compare commits

...

1840 Commits

Author SHA1 Message Date
Matthias Clasen
39c5c5a561 gsk: Only use fences when supported 2023-04-26 12:03:41 +02:00
Matthias Clasen
69a0d4c7d7 glarea: Only use fences when supported 2023-04-26 12:03:29 +02:00
Matthias Clasen
7fe48792ee glcontext: Add a way to check for fence sync 2023-04-26 11:59:51 +02:00
Matthias Clasen
57a75f760d glarea: Delete the sync object too
This is the responsibility of the destroy function
passed to the gl texture builder.
2023-04-26 09:26:25 +02:00
Matthias Clasen
bc618470bf Improve the documentation 2023-04-26 09:26:25 +02:00
Matthias Clasen
f56ba41893 gldriver: Add a sync when creating textures 2023-04-25 11:54:34 +02:00
Matthias Clasen
854591a5f9 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.
2023-04-25 11:54:34 +02:00
Matthias Clasen
c9e02edfc3 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.
2023-04-25 11:54:34 +02:00
Matthias Clasen
12ed685013 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.
2023-04-25 11:54:34 +02:00
Matthias Clasen
ac991483f2 gltexture: Synchronize when downloading
If the GL texture has a sync object, wait
on it before downloading the data.
2023-04-25 11:54:34 +02:00
Matthias Clasen
f3d84fd513 gltexture: Optionally take a sync object
Add a new (private, for now) constructor takes
a GLsync together with a texture id, for synchronization.
2023-04-25 11:03:51 +02:00
Benjamin Otte
318faf7b0d gltexture: Deprecate gdk_gl_texture_new()
Use GdkGLTextureBuilder instead.
2023-04-24 23:14:48 +02:00
Benjamin Otte
fdc72775ab glrenderer: Port to GdkGLTextureBuilder 2023-04-24 23:14:48 +02:00
Benjamin Otte
b9684c6036 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.
2023-04-24 23:14:48 +02:00
Benjamin Otte
408ea049de testsuite: Use GLTextureBuilder 2023-04-24 23:14:48 +02:00
Benjamin Otte
1bd13c819b glarea: Port to GdkGLTextureBuilder 2023-04-24 23:14:48 +02:00
Benjamin Otte
6559e34cac 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.
2023-04-24 23:14:48 +02:00
Benjamin Otte
ef4d3f172d texturebuilder: Add ::format and ::has-mipmap
We were trying to deduce that previously. Now we have explicit API
2023-04-24 21:27:53 +02:00
Benjamin Otte
8d3593af55 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.
2023-04-24 14:39:03 +02:00
Benjamin Otte
72016341c6 Merge branch 'wip/otte/for-main' into 'main'
surface: Clean up drawing code

See merge request GNOME/gtk!5861
2023-04-22 15:10:02 +00:00
Benjamin Otte
104b5ef157 surface: reformat function
Make the function follow usual coding conventions.

And while doing that, remove duplicate functionality.
2023-04-22 16:35:16 +02:00
Benjamin Otte
893862a51a surface: Refactor code
Move the early exit conditions to the top and turn them into early exits
instead of nesting if statements.
2023-04-22 16:33:35 +02:00
Benjamin Otte
823eb4c6d9 surface: Fold function into its only caller
No other changes
2023-04-22 16:29:58 +02:00
Benjamin Otte
be0ed15b40 surface: Stop maintaining an unused linked list
wat?
2023-04-22 16:27:27 +02:00
Benjamin Otte
040af44b00 surface: Remove in_update tracking
It's 2023, we use frame clocks now and don't have nested surface drawing
anymore.
2023-04-22 16:24:16 +02:00
Benjamin Otte
4154f87418 surface: Stop tracking the active update area
It's unused.
2023-04-22 16:10:24 +02:00
Aleksandr Melman
27e3ac5fc5 Update Russian translation 2023-04-22 12:03:07 +00:00
Piotr Drąg
eaaddd2647 Update Polish translation 2023-04-22 11:16:24 +02:00
Matthias Clasen
6d0659a83a Merge branch 'gtkfilesystemmodel-emit-items-changed-on-modifying-attributes' into 'main'
filesystemmodel: Emit items-changed when modifying attributes

Closes #5758

See merge request GNOME/gtk!5853
2023-04-22 05:54:58 +00:00
Olivier Crête
0ce6bc677e filesystemmodel: Emit items-changed when modifying attributes 2023-04-22 05:54:57 +00:00
Matthias Clasen
b579a39a47 Merge branch 'wip/corey/file-chooser-signal' into 'main'
Port filechooserwidget to GtkSignalListItemFactory

See merge request GNOME/gtk!5858
2023-04-22 05:26:43 +00:00
Corey Berla
aeaaead2bd filechoosercell: Drop show-time property
Now that we are using GtkSignalListItemFactory, the convoluted show-time
property is no longer necessary.
2023-04-21 08:14:32 -07:00
Corey Berla
056237fc04 filechooserwidget: Port to GtkSignalListItemFactory
BuilderListItemFactory isn't quite suited for our purposes, primarily
because you can't pass user data to BuilderListItemFactory.  Because
we can't get the data we are using a workaround to get the
GtkFileChooserWidget ancestory, which used to work, but with the
recent list view changes no longer doesn't.  Use GtkSignalListItemFactory
with the GtkFileChooserWidget as the user data.
2023-04-21 08:14:32 -07:00
Corey Berla
1a7e808c27 Revert "filechooser: Set date and time after cell is a child of filechooserwidget"
This reverts commit 2a70093a30.

This fix was incomplete, the actual fix	is to use signal factory.
2023-04-21 08:14:24 -07:00
Corey Berla
3de47fa5c6 Revert "filechoosercell: Store type_format in filechoosercell"
This reverts commit dd407dab00.

This fix was incomplete, the actual fix is to use signal factory.
2023-04-21 08:14:14 -07:00
Hugo Carvalho
9f7c8f7d42 Update Portuguese translation
(cherry picked from commit 5bc3284dd8)
2023-04-21 14:30:55 +00:00
Yosef Or Boczko
feb3254a6a Update Hebrew translation 2023-04-21 09:10:12 +00:00
Benjamin Otte
03b71a9759 Merge branch 'wip/otte/for-main' into 'main'
testsuite: Be less verbose in accessor-apis test

Closes #5763

See merge request GNOME/gtk!5851
2023-04-20 21:50:44 +00:00
Benjamin Otte
f393f70ee2 listbase: Don't warn on scroll in empty list
Empty lists can still be scrolled if the scroll happens in the same
frame as the emptying of the list.

Related: #5763
2023-04-20 23:33:28 +02:00
Benjamin Otte
75c47755e3 adjustment: sanity-check values when setting them
It's not enough to sanitize values when starting an animation, as the
adjustment can reconfigure itself while the animation runs.
So as a simple way to handle this, we sanitize every value right before
setting it, too.

In the future we might also want to look at sanitizing start/end values
of the animation.

Fixes #5763
2023-04-20 23:33:28 +02:00
Benjamin Otte
e47c076048 adjustment: Split out a function 2023-04-20 23:33:28 +02:00
Matthias Clasen
6ecd57eba8 Merge branch 'dark_theme_fix_hover_toolbar_buttons' into 'main'
theme: fix 'hover' and 'check' colors for buttons under .toolbar

See merge request GNOME/gtk!5844
2023-04-20 20:08:31 +00:00
Matthias Clasen
8b3831d43a Merge branch 'dark_theme_increase_selection_color' into 'main'
Increase contrast for text entry selection color on dark theme

See merge request GNOME/gtk!5843
2023-04-20 20:08:01 +00:00
Benjamin Otte
39583e40ef testsuite: Allow accessors in interfaces
There are a lot of cases where properties are implemented in classes but
the getters for these exist in an interface that class implements.

A common Example is g_list_model_get_n_items() being the getter for
GtkWhateverListModel::n-items.
But also property implementations that don't use override_property()
(usually because they have a different default) are handled by this.
2023-04-20 17:47:54 +02:00
Benjamin Otte
be5f225022 testsuite: Be less verbose in accessor-apis test
Only print the tried names when --verbose is passed to the test.
2023-04-20 17:47:54 +02:00
Emin Tufan Çetin
427ed50759 Update Turkish translation 2023-04-19 13:22:31 +00:00
Matthias Clasen
9892243df6 Merge branch 'mask-node-transforms' into 'main'
Fix a comment

See merge request GNOME/gtk!5848
2023-04-19 07:44:45 +00:00
Matthias Clasen
83091c4f15 gsk: Use explicit switches
This makes it harder to forget to add new
node types here.
2023-04-19 09:19:12 +02:00
Matthias Clasen
503a5de7d1 gsk: Mask nodes support 2d transforms
When adding mask nodes, I overlooked that
we have two separate functions for determining
what transforms a node supports without offlines.

Since we claim that mask nodes support general
transform, they must certainly support 2d transforms
as well.
2023-04-19 08:13:55 +02:00
Matthias Clasen
d7d75f0b26 Fix a comment
I tried to improve things in d67101d46e,
but I made it worse. The original note was meant
to be removed. Pointed out be Sebastian Bacher.
2023-04-19 07:49:36 +02:00
Benjamin Otte
40ac37245d Merge branch 'angle-gles' into 'main'
gdk: prefer GLES when on win32/ANGLE

See merge request GNOME/gtk!5829
2023-04-17 11:56:03 +00:00
Marc-André Lureau
250414d6b3 gdk/win32: drop some unused variables
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-17 04:50:17 +00:00
Marc-André Lureau
d69cdf6c05 gdk: drop libangle GLES minimum version
GLES 2.0 version is fine now with current gtk according to B. Otte.
Let's use the same minimum requirement for all implementations.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-17 04:50:17 +00:00
Marc-André Lureau
9532657fa2 gdk: use GLES when on win32/ANGLE
When using GDK_DEBUG=gl-egl, we end up using GL, but that is not well supported:

Creating EGL context version 3.0 (debug:no, forward:no, legacy:yes, es:no)
Created EGL context[0000000000000004]
OpenGL version: 0.0 (legacy)
* GLSL version: (NULL)
* Max texture size: -1059701680
* Extensions checked:
 - GL_KHR_debug: no
 - GL_EXT_unpack_subimage: yes
 - OES_vertex_half_float: no

** (gtk4-demo.exe:14324): WARNING **: 19:16:41.468: Compile failure in
vertex shader:
ERROR: 0:7: 'gl_Position' : undeclared identifier
---8<---

Use GLES when EGL implementation is ANGLE.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-17 04:50:17 +00:00
Marc-André Lureau
3cb2115212 gdk: drop unused vertex_array_object
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-17 04:50:17 +00:00
Benjamin Otte
dd7c85adc3 Merge branch 'wip/otte/for-main' into 'main'
glrenderer: Don't try to use float framebuffers on GLES2

See merge request GNOME/gtk!5845
2023-04-17 04:49:59 +00:00
Benjamin Otte
8965d6c7f8 gl: Only allow RGB(A)8 on GLES2
GLES2 has no idea what 16bit textures even are, let alone floating point.
2023-04-17 05:57:44 +02:00
Benjamin Otte
d7309a009c glrenderer: Don't try to use float framebuffers on GLES2
GLES doesn't know what that is.
2023-04-17 05:57:44 +02:00
Nelson Benítez León
bd9b117517 theme: more contrast for text entry selection color on dark theme
Part of #5725
2023-04-16 16:33:54 -04:00
Nelson Benítez León
a309a56acf theme: fix 'hover' and 'check' colors for buttons under .toolbar
Buttons under .toolbar were using for their 'hover', 'active'
and 'check' colors the default ones from %button_basic_flat
which are very dimmed, so we explicitly darken them.

Part of #5725
2023-04-16 16:16:10 -04:00
Matthias Clasen
b6fac448d7 Merge branch 'matthiasc/for-main' into 'main'
Try harder to fix focus tests

See merge request GNOME/gtk!5842
2023-04-16 20:00:46 +00:00
Matthias Clasen
765f55dfbe testsuite: Skip focus tests when necessary
If our window does not get focus, we can't reliably
test things that depend on widgets being focused.
2023-04-16 20:58:26 +02:00
Matthias Clasen
bebaad3e1f Merge branch 'ccook/doc-changes' into 'main'
Two corrections that show up in docs

See merge request GNOME/gtk!5838
2023-04-16 18:16:36 +00:00
Matthias Clasen
db6a116d49 Try harder to fix focus tests
The focus test now asserts that its window is active.
So we should not run them in parallel with other tests,
since those might steal the focus.
2023-04-16 20:08:03 +02:00
Benjamin Otte
a299656c60 Merge branch 'wip/otte/alt.wl_surface.die.die.die' into 'main'
wayland: Don't leak all surfaces

See merge request GNOME/gtk!5840
2023-04-16 18:02:33 +00:00
Benjamin Otte
27fd0b907d testsuite: Fix broken test to not unref surfaces twice
The test doesn't hold 2 references, it holds only one.

The reason one unref can cause a leak is that some backends - like X11 -
only destroy the surface once the DestroyNotify event from the X server
has come in.
2023-04-16 19:28:21 +02:00
Benjamin Otte
62951c7277 wayland: Don't leak all surfaces
X11 does add an extra reference to surfaces that gets released when the
DestroyNotify event arrives.
Wayland doesn't ave such an event, so that reference never gets
released.

This fixes a copy/paste error introduced in commit 590f3dfa1f.
2023-04-16 19:28:21 +02:00
Benjamin Otte
8e00f6e5e5 wayland: Don't insta-crash when a surface gets disposed
We want to remove the event queue from the list of event queues, not the
surface.
Otherwise the freed queue stays in the list and the next time an event
comes in, we access invalid memory.

Fixes thinko introduced in commit 7fafa5133b.

Luckily, we leak all surfaces, so this problem never occured.
2023-04-16 19:28:21 +02:00
Matthias Clasen
ff141a1ed4 Merge branch 'ccook/gtklabel-doc-changes' into 'main'
GtkLabel doc corrections

See merge request GNOME/gtk!5839
2023-04-16 17:07:49 +00:00
Matthias Clasen
25a10f502e Merge branch 'focus-testsuite-fixes' into 'main'
text: Fix fallout from focus changes

See merge request GNOME/gtk!5841
2023-04-16 07:36:11 +00:00
Matthias Clasen
585fb497c1 testsuite: Actually wait for focus
We were failing to properly iterate the main
context here. Oops.
2023-04-16 09:11:24 +02:00
Matthias Clasen
c57e5811f1 tests: Check is-focus instead of has-focus
We are not presenting windows here.
2023-04-16 08:50:35 +02:00
Matthias Clasen
940a2b6923 text: Fix fallout from focus changes
We don't get proper notification for when the toplevel
is-active property changes, so monitor has-focus, and
update cursor blinking.
2023-04-16 08:49:20 +02:00
Cam Cook
3277e2ee3e | method | current | suggestion |
|---------------------------------------------------------------------------------------|-----------------------------------------------------------------|----------------------------------------------------------------------|
| [get_attributes](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L3242) | "use`pango_layout_get_attribute (gtk_label_get_layout (self))`" | "use`pango_layout_get_attributes (gtk_label_get_layout (self))`" [1] |
| [set_yalign](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L5897)     | "(attributes org.gtk.Method.get_property=yalign)"               | "(attributes org.gtk.Method.set_property=yalign)"                    |
| [get_yalign](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L5923)     | "(attributes org.gtk.Method.set_property=yalign)"               | "(attributes org.gtk.Method.get_property=yalign)"                    |
| [set_ellipsize](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L3892)  | "to ellipsizei"                                                 | "to ellipsize"                                                       |
| [get_attributes](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L3239) | "from the labels markup"                                        | "from the label's markup"                                            |

[1] https://docs.gtk.org/Pango/method.Layout.get_attributes.html
2023-04-15 21:48:27 -04:00
Cam Cook
3e8489fea5 | method | current | suggestion |
|-------------------------------------------------------------------------------------------------|------------------------------------------------------------|-----------------------------------------------------------|
| [Entry/set_invisible_char](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L2101) | "(attributes org.gtk.Method.sets_property=invisible-char)" | "(attributes org.gtk.Method.set_property=invisible-char)" |
| [FlowBox::activate](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkflowbox.c#L541)       | "This can be happen either by"                             | "This can happen either by"                               |
2023-04-15 12:41:13 -04:00
Cam Cook
1035640020 Revert "Two corrections and added method linking that show up in docs"
This reverts commit c7f30ecdfd.
2023-04-15 12:40:22 -04:00
Matthias Clasen
6cee73d100 Merge branch 'wip/otte/gles-fixes' into 'main'
GLES 2 fixes

See merge request GNOME/gtk!5837
2023-04-15 16:27:16 +00:00
Matthias Clasen
e4c43901c1 Merge branch 'matthiasc/for-main' into 'main'
window: Don't mark widget prematurely as has-focus

See merge request GNOME/gtk!5836
2023-04-15 16:09:32 +00:00
Cam Cook
c7f30ecdfd Two corrections and added method linking that show up in docs
| method                                                                                          | current                                                    | suggestion                                                |
|-------------------------------------------------------------------------------------------------|------------------------------------------------------------|-----------------------------------------------------------|
| [Entry/set_invisible_char](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L2101) | "(attributes org.gtk.Method.sets_property=invisible-char)" | "(attributes org.gtk.Method.set_property=invisible-char)" |
| [FlowBox::activate](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkflowbox.c#L541)       | "This can be happen either by"                             | "This can happen either by"                               |

| method                                                                                                    | current                                                | suggestion                                                   |
|-----------------------------------------------------------------------------------------------------------|--------------------------------------------------------|--------------------------------------------------------------|
| [Box/get_baseline_position](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkbox.c#L461)             | "value set by gtk_box_set_baseline_position()."        | "value set by [method@Gtk.Box.set_baseline_position]."       |
| [Box/get_spacing](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkbox.c#L412)                       | "value set by gtk_box_set_spacing()."                  | "value set by [method@Gtk.Box.set_spacing]."                 |
| [CenterBox/get_baseline_position](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkcenterbox.c#L528) | "value set by gtk_center_box_set_baseline_position()." | "value set by [method@Gtk.CenterBox.set_baseline_position]." |
| [Entry/get_activates_default](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L2296)        | "value set by gtk_entry_set_activates_default()."      | "value set by [method@Gtk.Entry.set_activates_default]."     |
| [Entry/get_alignment](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L2380)                | "value set by gtk_entry_set_alignment()."              | "value set by [method@Gtk.Entry.set_alignment]."             |
| [Entry/get_extra_menu](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L3727)               | "set with gtk_entry_set_extra_menu()."                 | "set with [method@Gtk.Entry.set_extra_menu]."                |
| [Entry/get_has_frame](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L2340)                | "value set by gtk_entry_set_has_frame()."              | "value set by [method@Gtk.Entry.set_has_frame]."             |
| [Entry/get_progress_pulse_step](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L3372)      | "set with gtk_entry_set_progress_pulse_step()."        | "set with [method@Gtk.Entry.set_progress_pulse_step]."       |
| [Fixed/get_child_transform](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkfixed.c#L314)           | "set using gtk_fixed_set_child_transform()."           | "set using [method@Gtk.Fixed.set_child_transform]."          |
2023-04-15 12:08:46 -04:00
Benjamin Otte
b64f7050ba testsuite: Make GLES testsuite run use GLES 2
We want to support GLES 2, so make sure we test that support.

Also force-disable common extensions we don't explicitly check for and
don't want to accidentally use.
2023-04-15 17:55:20 +02:00
Benjamin Otte
d37b9619e2 gles: Don't use vertex array objects
They're not needed and GLES doesn't technically support them, even
though GTK had been using them via epoxy sneakily using the
GL_OES_vertex_array_object extension behind our back.
2023-04-15 17:55:20 +02:00
Matthias Clasen
4a22e681b3 text: Only claim primary when focused
It does not make sense otherwise, and has unfortunate
side-effects on Wayland.
2023-04-15 15:02:52 +02:00
Matthias Clasen
189aced844 wayland: Improve logging for primary selection 2023-04-15 15:02:52 +02:00
Matthias Clasen
d90cb02570 window: Don't mark widget prematurely as has-focus
has-focus is defined is-focus && toplevel::is-active.
We were forgetting to look at is_active when handling
focus widget changes.
2023-04-15 14:58:57 +02:00
Matthias Clasen
4246c7bafd Merge branch 'better-snapshot-nodes-docs' into 'main'
gtk: Improve documentation on returned nodes for snapshot

Closes #5747

See merge request GNOME/gtk!5831
2023-04-15 10:51:39 +00:00
Matthias Clasen
d67101d46e Tweak the wording 2023-04-15 10:35:12 +00:00
Benjamin Otte
60f3cc398a Merge branch 'wip/otte/for-main' into 'main'
inspector: Don't randomly emit application signals

See merge request GNOME/gtk!5834
2023-04-15 03:40:00 +00:00
Benjamin Otte
e010cd242c listlistmodel: Add a cache
Cache the last looked up item and use it for looking up the next item if
it's closest. This massively speeds up iteration over the model, because
each call to get_item() will be adjacent to the previous one.

Improves performance of the inspector quite a bit.
2023-04-15 05:27:47 +02:00
Benjamin Otte
41454b63b4 testsuite: Add some more exhaustive testing to listlistmodel 2023-04-15 05:27:47 +02:00
Benjamin Otte
f458951745 inspector: Don't randomly emit application signals
When the variant-editor emits a callback, it might not actually have
edited the value in question. Try to detect that by only emitting
signals if the value changed.
2023-04-15 05:27:47 +02:00
Benjamin Otte
ef3793ec37 Merge branch 'gbsneto/vulkan-buffer-release' into 'main'
gsk/vulkan/render: Download image before reset

See merge request GNOME/gtk!5832
2023-04-14 23:28:55 +00:00
Georges Basile Stavracas Neto
94b1a78378 gsk/vulkan/render: Download image before reset
gsk_vulkan_render_download_target() currently resets the uploader
objects before downloading the image that it produces. This is
problematic because there might be unreleased buffers and images
in the command queue.

In particular, this can make validation layers complain about the
glyph atlas - of all things! - upload buffer being released while
still being used by the command queue.

Fix that by resetting the uploader after downloading the image.
2023-04-14 16:43:04 -03:00
Marco Trevisan (Treviño)
584fd36a5f gtk: Improve documentation on returned nodes for snapshot
Closes: #5747
2023-04-14 18:05:21 +02:00
Matthias Clasen
64a1969293 Merge branch 'fix_scalebutton_orientation' into 'main'
ScaleButton: fix CSS name in documentation, fix orientation doing nothing

See merge request GNOME/gtk!5819
2023-04-13 20:44:23 +00:00
Matthias Clasen
2baab9732c Merge branch 'check-openuri-portal-version' into 'main'
openuriportal: Detect if the interface isn't there

Closes #5733

See merge request GNOME/gtk!5826
2023-04-13 20:44:03 +00:00
Georges Basile Stavracas Neto
8134daf843 Merge branch 'gbsneto/vulkan-mailbox' into 'main'
gdk/vulkancontext: Use more appropriate present mode

See merge request GNOME/gtk!5828
2023-04-13 17:07:59 +00:00
Georges Basile Stavracas Neto
9c013d40c1 gdk/vulkancontext: Use more appropriate present mode
Check if the driver supports MAILBOX and prefer using it; in its
absense, checkif the driver supports IMMEDIATE and prefer using
it; finally, if neither of them are supported, use the guaranteed
to be supported FIFO mode.
2023-04-13 13:54:45 -03:00
Benjamin Otte
d798372a53 Merge branch 'wip/otte/for-main' into 'main'
x11: Remove commented outdated code

See merge request GNOME/gtk!5827
2023-04-13 15:34:48 +00:00
Benjamin Otte
cfaf1b3e71 x11: Remove commented outdated code
... and it's copy/paste into the win32 backend
2023-04-13 17:15:35 +02:00
Benjamin Otte
9763d83a9d gdk: Remove unused vfunc 2023-04-13 17:15:35 +02:00
Benjamin Otte
5f82a496cb Merge branch 'wip/otte/wl-gloria-gaynor' into 'main'
wayland: Make wl_surface survive until surface is desstroyed

See merge request GNOME/gtk!5825
2023-04-13 15:12:07 +00:00
Matthias Clasen
0c35015c44 Merge branch 'wip/exalm/print-dialog' into 'main'
printunixdialog: Remove a redundant style class

See merge request GNOME/gtk!5823
2023-04-13 05:39:08 +00:00
Matthias Clasen
3da0572078 openuriportal: Detect if the interface isn't there
Check the portal version number before trying to use
it. Most importantly, this will detect the case where
the interface isn't supported at all, since the proxy
will report a version of 0 in that case.

Fixes: #5733
2023-04-13 07:24:38 +02:00
Matthias Clasen
c649d8a4ec Merge branch 'bilelmoussaoui/g-i' into 'main'
g-i: Fix GtkGLArea type name

See merge request GNOME/gtk!5824
2023-04-13 04:37:45 +00:00
Benjamin Otte
75bea01a86 wayland: Keep EGL window around when hidden
See previous commit:

We want to keep resources around as long as the surface exists.
2023-04-13 05:19:18 +02:00
Benjamin Otte
5d3cec5441 wayland: Don't destroy the wl_surface on hide()
We want to keep the wl_surface around, because surfaces create their
resources on construct and keep them until destroyed. See the HWND ond
Windows and the XWindow on X11.

This is relevant for graphics resources, where we want to have access
to the VkSurface and eglSurface while the GdkSurface is hidden.
We also want these surfaces to be permanent and not change during the
lifetime of the GdkSurface.

What we can - and must - destroy however are the xdg surfaces, because
those handle visibility on screen.
And we also need to ensure no buffer is attached, so that during the
next creation of the xdg surface we don't get a protocol error.
2023-04-13 04:23:35 +02:00
Benjamin Otte
891242920e wayland: Split out a function
We have a create_wl_surface(), create a matching destroy_wl_surface().
2023-04-13 02:56:12 +02:00
Benjamin Otte
b375f17f09 wayland: Remove useless function
gdk_wayland_surface_maybe_resize() just calls
gdk_wayland_surface_update_size(), so make all callers call that one
instead.

The check that it does is done by the other function again.
2023-04-13 02:48:47 +02:00
Benjamin Otte
ec69990126 wayland: Remove an old workaround
This workaround - were it ever to trigger - is broken today. It destroys
the wl_surface and all associated structs but does not recreate the
xdg_popup or xdg_toplevel struct, so it would cause a hidden window.

The workaround looked a lot different when it was introduced in commit
83b54bab57, too - both in what it did and
in what the vfuncs did that it called.
2023-04-13 02:44:05 +02:00
Bilal Elmoussaoui
aec5a5739e g-i: Fix GtkGLArea type name 2023-04-12 18:12:40 +00:00
Alexander Mikhaylenko
ac9e0039b8 printunixdialog: Remove a redundant style class
.view does absolutely nothing in Default style since the whole box is
covered with a GtkNotebook which has its own background, and adds an
unwanted background onto the tab strip in Adwaita.
2023-04-12 21:09:25 +04:00
Matthias Clasen
4574b21fd6 Merge branch 'dialogs-force-window-destruction' into 'main'
gtk/dialogs: Destroy the window promptly on finish async function

Closes #5741

See merge request GNOME/gtk!5820
2023-04-12 13:54:13 +00:00
Marco Trevisan (Treviño)
31c5961c4f gtk/dialogs: Destroy the window promptly on finish async function
Some bindings (GJS!) could add temporary references to the GAsyncResult
argument that we return, and thus to the GTask, which may cause the
dialog not to close when the finish function is called (but at garbage
collection instead!).

To prevent this, just manually destroy the window (by removing the task
data), so that we are not bound to the GTask lifetime anymore.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5741
2023-04-12 15:39:39 +02:00
Matthias Clasen
8fc3f06155 Merge branch 'filechooserentry-fixes' into 'main'
filechooserentry: Make filtering work again

Closes #5743

See merge request GNOME/gtk!5822
2023-04-12 10:38:04 +00:00
Matthias Clasen
5327203201 Merge branch 'wip/carlosg/multi-click-text-view' into 'main'
textview: Reset press counter if double/triple clicking on a different line

See merge request GNOME/gtk!5821
2023-04-12 10:11:16 +00:00
Matthias Clasen
8442fce962 Merge branch 'touch-no-double-click-threshold' into 'main'
gestureclick: Don't use threshold for touch

Closes #5580

See merge request GNOME/gtk!5798
2023-04-12 10:10:31 +00:00
Matthias Clasen
d8b46c16cc Merge branch 'stylus-fixes' into 'main'
gtk-demo: Test stylus-only mode

See merge request GNOME/gtk!5804
2023-04-12 10:10:11 +00:00
Matthias Clasen
4df7273266 filechooserentry: Plug a memory leak 2023-04-12 12:09:02 +02:00
Matthias Clasen
2b8fd89fd5 filechooserentry: Make filtering work again
We need to look at the filchooser::filtered-out
attribute to know which files the filesystem model
has filtered away.

Fixes: #5743
2023-04-12 12:08:43 +02:00
Carlos Garnacho
5b9a7863cf textview: Reset press counter if double/triple clicking on a different line
If we click close enough between lines, and with the maximum distances applied
by GtkGestureClick we could jump between lines when handling double/triple
click for word/line selection.

Ensure that the whole operation stays in the same line and reset the
gesture/counter if we do move between lines, so we start from scratch in the
new line.
2023-04-12 11:27:41 +02:00
G.Willems
d625ff8106 scalebutton: fix orientation not applied to scale 2023-04-11 23:54:06 +02:00
G.Willems
5ecd8a1c10 scalebutton: fix CSS name in documentation 2023-04-11 22:06:54 +02:00
Matthias Clasen
e9f7a9b8e6 Merge branch 'matthiasc/for-main' into 'main'
filechooser: Fix the gridview

See merge request GNOME/gtk!5817
2023-04-11 06:10:56 +00:00
Matthias Clasen
93b1130c07 filechooser: Fix the gridview
2a70093a30 was a bit overeager in its porting
to GtkColumnViewCell. The gridview needs to keep its
list items.
2023-04-11 07:41:09 +02:00
Matthias Clasen
db48cd6467 Merge branch 'wip/corey/file-chooser-widget' into 'main'
More fixes to filechooserwidget

See merge request GNOME/gtk!5815
2023-04-11 05:32:38 +00:00
Matthias Clasen
ba43a126b9 Merge branch 'wip/corey/filesystemmodel' into 'main'
filesystemmodel: Notify correct position removed in remove_file()

See merge request GNOME/gtk!5814
2023-04-11 05:27:24 +00:00
Corey Berla
2a70093a30 filechooser: Set date and time after cell is a child of filechooserwidget
The date/time column relies on the filechooserwidget to format the date
properly.  During bind, the filechoosercell, get the filechooserwidget
ancestor, but now due to changes in the listview, the cell isn't a
child of the filechooserwidget at that point.  Since this is deeply
ingrained into the filechooserwidget, let's keep the same behavior,
but move it to filechoosercell in realize.  Alternatively, we could have
used a signal factory (with the file chooser widget as the user data),
but that would have been a major overhaul.
2023-04-10 18:02:35 -07:00
Corey Berla
dd407dab00 filechoosercell: Store type_format in filechoosercell
The format of the type column depends on the the type_format, which
is stored in the filechooserwidget.  We get that setting by looking
for the filechooserwidget ancestor, which no longer works after recent
changes to the list views (it was fragile to begin with).  At one point,
the setting appears to have been dynamic, but now it is only loading
from GSettings, so let's simply do the same within FileChooserCell.
2023-04-10 18:02:35 -07:00
Corey Berla
ccae75022b filechooserwidget: Finish port to GtkColumnViewCell
Some missing updates from f5dea9a3c2
2023-04-10 18:02:24 -07:00
Corey Berla
faac2f7894 filesystemmodel: Notify correct position removed in remove_file()
32247bc50e made several changes to account for the
fact that we no longer have a NULL editable at the beginning of the list
model.  The commit mistakenly left out one change in remove_file(),
which causes the wrong file to be removed.
2023-04-10 12:56:08 -07:00
Matthias Clasen
d00b78d283 Merge branch 'matthiasc/for-main' into 'main'
node-editor: Typo fixes

See merge request GNOME/gtk!5812
2023-04-10 14:28:38 +00:00
Matthias Clasen
3eee1c0724 node-editor: Typo fixes
Fix some typos in the node format documentation.
2023-04-10 16:04:17 +02:00
Matthias Clasen
5e6bc681a3 Merge branch 'scrolled-window-critical' into 'main'
scrolledwindow: Avoid a critical

See merge request GNOME/gtk!5809
2023-04-10 05:50:20 +00:00
Matthias Clasen
87e16f3ad9 testsuite: Check widget properties better
Check that setting a property after resetting
it works. An instance of this was fixed in the
previous commit.
2023-04-10 00:24:57 -04:00
Matthias Clasen
aa9e83876d scrolledwindow: Avoid a critical
When setting the child property to NULL, we also need
to unset auto_added_viewport, to avoid triggering a
critical when setting it again.
2023-04-10 00:22:20 -04:00
Matthias Clasen
d8796b3075 Merge branch 'warn-show-destoyed-window' into 'main'
Show a warning when a destroyed window is shown

See merge request GNOME/gtk!5122
2023-04-09 20:16:52 +00:00
Matthias Clasen
cefd720789 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Add a keyword

See merge request GNOME/gtk!5805
2023-04-09 13:02:55 +00:00
Matthias Clasen
d4a34b1a0b gtk-demo: Stop using gtk_widget_get_allocation 2023-04-09 08:38:14 -04:00
Matthias Clasen
b7f48b7763 gtk-demo: Add a keyword
Make the demo using the 'bluroverlay' come up when you type 'blur'.
2023-04-09 08:38:14 -04:00
Matthias Clasen
61a0d06310 Merge branch 'matthiasc/for-main' into 'main'
range: Fix a copy-paste error

See merge request GNOME/gtk!5803
2023-04-09 12:37:44 +00:00
Matthias Clasen
e12669e230 gesture stylus: Fix condition
Now that the paint demo lets us test this, it has
become apparent that this condition is wrong, and
we don't get the expected events if stylus-only is
FALSE.
2023-04-09 08:35:03 -04:00
Matthias Clasen
7f906bef06 gtk-demo: Work without stylus
In the paint demo, don't assume that the event
backlog contains pressure. It won't, if we are
working with a plain old mouse.
2023-04-09 08:35:03 -04:00
Matthias Clasen
5970a14217 gtk-demo: Test stylus-only mode
Add a checkbutton to toggle the stylus-only
mode of GtkGestureStylus, so we can test this.
2023-04-09 08:35:03 -04:00
Matthias Clasen
34b6d46276 placessidebar: Stop using gtk_widget_get_allocation 2023-04-09 06:48:27 -04:00
Matthias Clasen
8957d4cb4f coloreditor: Stop using gtk_widget_get_allocation 2023-04-09 06:48:27 -04:00
Matthias Clasen
95f5c7beb6 range: Fix a copy-paste error
This was showing up as the alpha popup in
the color editor not being positioned correctly.
2023-04-09 06:48:27 -04:00
Benjamin Otte
3907711a49 Merge branch 'gbsneto/vulkan-glyph-fixes' into 'main'
Vulkan glyph fixes

See merge request GNOME/gtk!5802
2023-04-09 00:07:16 +00:00
Georges Basile Stavracas Neto
496c8f4a11 gsk/vulkan/glyphcache: Rework glyphs
The current implementation of the glyph cache deals with atlases by
padding them with 1 pixel at the beginning, at the end, and between
each glyph.

That's cool and all, however, there's a very subtle problem with
this approach: the contents of the atlas are garbage, so this padding
is filled with garbage memory!

Rework the Vulkan glyph cache to draw each and every glyph in a
surface that has 1 pixel border of padding around it. Ensure the
surface is completely black by drawing a rectangle before handing
it to Pango to draw the glyph. Update tx and ty to pick the texture
position adjusted to the 1 pixel padding. The atlas now starts at
position (0, 0), since each glyph individually contains its own padding.

To improve legibility, add a PADDING define and use it everywhere.
2023-04-08 20:13:13 -03:00
Georges Basile Stavracas Neto
8b6f69946c gsk/vulkan/pipeline: Simplify pipeline creation
Nothing uses gsk_vulkan_pipeline_new_full() anymore.
2023-04-08 20:13:13 -03:00
Georges Basile Stavracas Neto
48129298f0 gsk/vulkan: Use default blend factors
Vulkan renders text using VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA and
VK_BLEND_FACTOR_SRC_ALPHA, but that implies per-channel alpha
blending, which currently produces the wrong results when blending
glyphs with the images beneath them.

Use the default pipeline constructors, which implies using the
ONE and ONE_MINUS_SRC_ALPHA.
2023-04-08 20:13:13 -03:00
Georges Basile Stavracas Neto
c77c8d6309 gsk/vulkan: Cosmetics
Reorder code to match the order used in shaders.
2023-04-08 20:13:13 -03:00
Matthias Clasen
2c3f82fd01 Tweak the wording of the message. 2023-04-08 16:14:52 +00:00
Matthias Clasen
5f4a6210c2 gestureclick: Use drag threshold for updates 2023-04-07 17:57:14 -04:00
Matthias Clasen
c0fa9e80aa gestureclick: Don't use threshold for touch
When determining double-clicks, don't use the distance
threshold for touch events. It is very hard to double
touch reliably within a few pixels of the same position.

Fixes: #5580
2023-04-07 17:57:14 -04:00
Matthias Clasen
99251c0c8f Merge branch 'wip/carlosg/popover-ungrab-on-unmap' into 'main'
gtkpopover: Move GTK grabs to map/unmap

Closes #5730

See merge request GNOME/gtk!5801
2023-04-07 20:24:24 +00:00
Carlos Garnacho
1709538756 gtkpopover: Move GTK grabs to map/unmap
Typically, a popover gets mapped when shown and unmapped when
hidden. A situation there that breaks is where the popover gets
recursively unmapped/unrealized when its root is destroyed.

In that situation, the popover does however unmap (without being
hidden first), moving the GTK grab from show/hide to map/unmap
will handle the previous situations, plus this one.

Fixes things being unclickable if e.g. a modal dialog got a
popover popped up, then got closed via Alt-F4.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5730
2023-04-07 22:12:41 +02:00
Matthias Clasen
da5433e140 Merge branch 'inspector-action-fixes' into 'main'
actionmuxer: Make the compiler warn

See merge request GNOME/gtk!5800
2023-04-07 18:05:19 +00:00
Matthias Clasen
36c1003328 inspector: Redo the actions list
Make the actions list implement GtkActionObserver
for the muxer case, and make updates work.
2023-04-07 13:45:45 -04:00
Matthias Clasen
3eabcde868 inspector: Simplify the action editor
No need to listen for changes, the actions list
code will do so and tell us to update.
2023-04-07 13:45:12 -04:00
Matthias Clasen
7664048779 inspector: Add ActionHolder::changed
We will use this signal to communicate
action changes to the action list widgetry.
2023-04-07 13:17:22 -04:00
Matthias Clasen
8648ecf889 inspector: Cosmetics
Make the variant editor use a checkbutton
instead of a togglebutton.
2023-04-07 13:17:22 -04:00
Matthias Clasen
f1a01fb973 actionmuxer: Add a precondition
This helps with debugging the inspectors action
handling.
2023-04-07 12:53:57 -04:00
Alexander Shopov
b549a52f54 Update Bulgarian translation
(cherry picked from commit f15aa82eaf)
2023-04-07 16:27:04 +00:00
Matthias Clasen
6c97667be1 inspector: Be more careful
Tweak the variant-editor code to handle some
cases more explicitly.
2023-04-07 09:16:21 -04:00
Matthias Clasen
ce597cf034 inspector: Plug a memory leak 2023-04-07 08:55:40 -04:00
Matthias Clasen
cdcb55da58 inspector: Be safer when handling actions
Those query apis are serious about not ignoring
their return value, and may not set their our
arguments to anything if they return FALSE.
2023-04-07 08:52:51 -04:00
Matthias Clasen
b8d02c9398 actionmuxer: Make the compiler warn
Warn when the boolean return isn't used, since we
may not initialize the out arguments in the FALSE
case (see the previous commits).
2023-04-07 08:03:46 -04:00
Matthias Clasen
d97514ec67 textview: Handle a return value 2023-04-07 08:03:46 -04:00
Matthias Clasen
a96df553e0 Merge branch '5729_fix_inspector_crash' into 'main'
inspector: fix crash caused by uninitialized GVariant

Closes #5729

See merge request GNOME/gtk!5799
2023-04-07 12:01:22 +00:00
Nelson Benítez León
ed8148bd07 inspector: fix crash caused by uninitialized GVariant
we were not checking the return gboolean of
gtk_action_muxer_query_action() which was
returning FALSE for the crash case, meaning
it didn't set the passed in GVariant, but
we were still using it as it was non-null.

Fixes #5729
2023-04-06 20:05:53 -04:00
Matthias Clasen
e0dbc6a0ee Merge branch 'media-controls' into 'main'
mediacontrols: Add tooltip text to play button

See merge request GNOME/gtk!5794
2023-04-06 17:59:54 +00:00
Matthias Clasen
fb91418edd Merge branch 'alert_dialog_role_mapping_fix' into 'main'
a11y: Map GTK_ACCESSIBLE_ROLE_ALERT_DIALOG to ATSPI_ROLE_ALERT

See merge request GNOME/gtk!5796
2023-04-06 17:59:05 +00:00
Matthias Clasen
154ff6fe03 Merge branch 'matthiasc/for-main' into 'main'
glarea: Fix property notification

See merge request GNOME/gtk!5797
2023-04-06 15:06:26 +00:00
Matthias Clasen
a65dc036b1 glarea: Fix property notification
This was broken in 9c26262e3e.
2023-04-06 10:37:58 -04:00
Maximiliano Sandoval R
62865bc52d mediacontrols: Add tooltip text to play button
This makes the button accessible.
2023-04-06 16:16:41 +02:00
Lukáš Tyrychtr
19b280be4c a11y: Map GTK_ACCESSIBLE_ROLE_ALERT_DIALOG to ATSPI_ROLE_ALERT
By doing this, alert dialogs will be read automatically, or at least
they should be, because a screen reader know that these are special.
2023-04-06 13:55:16 +02:00
Matthias Clasen
9608e4e503 Merge branch 'wip/exalm/centerlayout-shrink' into 'main'
centerlayout/box: Add :shrink-center-last

See merge request GNOME/gtk!5790
2023-04-05 22:23:19 +00:00
Matthias Clasen
1859193c5d Merge branch 'wip/exalm/shortcuts' into 'main'
Add style classes to standard dialogs

See merge request GNOME/gtk!5791
2023-04-05 22:05:33 +00:00
Alexander Mikhaylenko
9138d91c1c pagesetupunixdialog: Add "pagesetup" style class 2023-04-06 00:58:38 +04:00
Alexander Mikhaylenko
f1dff40391 fontchooserdialog: Add "fontchooser" style class 2023-04-06 00:58:38 +04:00
Alexander Mikhaylenko
fff98d94f9 filechooserdialog: Add "filechooser" style class 2023-04-06 00:58:38 +04:00
Alexander Mikhaylenko
1d0f0d4229 colorchooserdialog: Add "colorchooser" style class 2023-04-06 00:58:38 +04:00
Alexander Mikhaylenko
80a11b1a1c appchooserdialog: Add "appchooser" style class 2023-04-06 00:58:38 +04:00
Alexander Mikhaylenko
399ee3db3f shortcutswindow: Add "shortcuts" style class 2023-04-06 00:58:38 +04:00
Alexander Mikhaylenko
c40fa8db98 centerbox: Expose GtkCenterLayout:shrink-center-last 2023-04-05 16:15:49 +04:00
Alexander Mikhaylenko
8fd9de23bb centerlayout: Add :shrink-center-last
Allow to prioritize start and end children and have them keep their natural
size instead of center child if possible.

See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5552#note_1708864
2023-04-05 16:15:49 +04:00
Matthias Clasen
450490bcf6 Merge branch 'ebassi/listbox-dispose' into 'main'
listbox: Unbind the model before removing children

See merge request GNOME/gtk!5789
2023-04-05 02:35:20 +00:00
Emmanuele Bassi
fb3f817f69 listbox: Unbind the model before removing children
Calling gtk_list_box_remove_all() is a no-op with a bound model; after
the introduction of the remove_all() method in 49e56fc7, we were left
with row widgets after the dispose() call chained up.

We could restore the explicit unparenting inside dispose() instead of
calling remove_all(), but since the bound list model is provided by the
user of GtkListBox, it's more appropriate to unbind it in the dispose()
implementation, to avoid any potential reference cycle (especially in
higher level languages that have no explicit reference acquisition).

We clean up the bound model, and its associated state, if any; and then
we remove all the row widgets that are left.
2023-04-04 13:47:36 +01:00
Matthias Clasen
6a2f715250 Merge branch 'glarea-allowed-apis' into 'main'
glarea: Add GtkGLArea::allowed-apis

Closes #5330

See merge request GNOME/gtk!5786
2023-04-04 03:14:21 +00:00
Matthias Clasen
b1f0ca7dc4 gtk-demo: Update the GLArea examples 2023-04-03 23:05:38 -04:00
Matthias Clasen
9c26262e3e glarea: Add GtkGLArea::allowed-apis
Add api that mirrors the new GdkGLContext api
for selecting OpenGL variants, and deprecate
the old use_es api.

Fixes: #5330
2023-04-03 23:05:38 -04:00
Matthias Clasen
7723045e9a Merge branch 'matthiasc/for-main' into 'main'
expander: Fix the css docs

Closes #5723

See merge request GNOME/gtk!5787
2023-04-04 02:50:08 +00:00
Matthias Clasen
a9a6371ceb Merge branch 'node-editor-things' into 'main'
Revert "rendernodepaintable: Provide accurate aspect ratio"

See merge request GNOME/gtk!5788
2023-04-04 02:47:39 +00:00
Matthias Clasen
6182f4a332 node-editor: Improve the scaling
We only want to scale the main rendering, not whats
shown in the sidebar. Also, make the scale logarithmic.
2023-04-03 22:33:34 -04:00
Matthias Clasen
9ccde8b913 rendernodepaintable: Preserve aspect ratio in snapshot()
This is the better fix.
2023-04-03 22:33:34 -04:00
Matthias Clasen
70e56f0dea Revert "rendernodepaintable: Provide accurate aspect ratio"
This reverts commit 52a8492887.

It turned out to be the wrong fix.
2023-04-03 22:33:34 -04:00
Matthias Clasen
8785391238 expander: Fix the css docs
The docs were not matching reality since the
css node names were changed in 6d20fe0b.

Fixes: #5723
2023-04-03 19:33:31 -04:00
Benjamin Otte
231b12124e Merge branch 'wip/otte/for-main' into 'main'
rendernode: Remove instance_init() function

See merge request GNOME/gtk!5785
2023-04-03 18:14:51 +00:00
Matthias Clasen
409c6556ec Merge branch 'bilelmoussaoui/return-fix' into 'main'
gtk: Fix *_get_tab_behaviour return type

See merge request GNOME/gtk!5784
2023-04-03 18:04:08 +00:00
Benjamin Otte
4d86954fb5 rendernode: Cosmetics
Simplify a function.
2023-04-03 19:27:58 +02:00
Benjamin Otte
6e8c3fc3ff rendernode: Get rid of GskRenderNodeTypeInfo
Instead, use class_init functions.
2023-04-03 19:27:58 +02:00
Benjamin Otte
0d139a81c7 rendernode: Remove instance_init() function
It's not used.
2023-04-03 19:27:58 +02:00
Bilal Elmoussaoui
d56815e98e gtk: Fix *_get_tab_behaviour return type 2023-04-03 18:55:04 +02:00
Matthias Clasen
9752395a1d Post-release version bump 2023-04-03 10:54:11 -04:00
Matthias Clasen
7467701818 4.11.1 2023-04-03 10:40:16 -04:00
Matthias Clasen
d82559345a NEWS: Updates 2023-04-03 10:36:40 -04:00
Matthias Clasen
ac61376c32 Add comment on versions
Some versions are specfied in multiple places.
Add a reminder to update all places.
2023-04-03 10:35:36 -04:00
Benjamin Otte
362bdaa852 Merge branch 'gbsneto/vulkan-layout-fixes' into 'main'
Vulkan fractional scale support, image layout and clip region fixes, cleanups

See merge request GNOME/gtk!5783
2023-04-03 14:27:24 +00:00
Georges Basile Stavracas Neto
5c27a0dd2b vulkan: Support fractional scaling
Basically what GL does, but without any debug or feature flag
to gatekeep it, since the Vulkan backend itself is experimental
already.

Ceil surface sizes, and floor coordinates, to the fractional scale
value.
2023-04-03 11:10:27 -03:00
Georges Basile Stavracas Neto
db1d278100 gsk/vulkan/renderpass: Don't scale scissor and render area
The rects passed to the clip region are in buffer coordinates, and
must not be scaled. Consider the following scenario: Wayland, with
a 1024x768@2 window. That gives us a 2048x1536 raw image. To setup
the Vulkan render pass code, we'd scale 2048x1536 *again*, to an
unreasonable 4196x3072, which is (1) incorrect and (2) really
incorrect and (3) can lead to crashes at best, full GPU resets
at worst - and a GPU reset is incredibly not fun!

Now that we pass the right clip regions at the right coordinates
at all times, remove the extra scaling from the render pass.
2023-04-03 10:59:45 -03:00
Georges Basile Stavracas Neto
dde029c3d1 gsk/vulkan: Cosmetics
No functional changes. Use a variable that already exists instead
of calling gdk_draw_context_get_surface() again. Cleanup some
newlines.
2023-04-03 10:59:45 -03:00
Georges Basile Stavracas Neto
a2a05acc6b gsk/vulkan/renderer: Pass appropriate clip region
This part of the Vulkan renderer is almost exactly equal to the GL
renderer, and the GL renderer already does that since at least
2a38cecd33. Copy that into the Vulkan renderer.

A nice side effect from this commit is that resizing a window now
actually works again.

Sneak in a trivial cleanup by using a variable to hold the draw
index.
2023-04-03 10:59:45 -03:00
Georges Basile Stavracas Neto
840c72d74d gsk/vulkan/buffer: Pass aligned memory value
This was a tricky one to figure out, but it's pretty simple to
understand (I hope!).

So, this AMD card I'm using requires buffer memory sizes to be
aligned to 16 bytes. Intel is aligned to 4 bytes I think, but
AMD - or at least this AMD model in particular - uses 16 bytes
for alignment.

When creating a a particular texture (I did not determin which one
specifically!) a buffer of size 1276 bytes is requested.

1276 / 16 = 79.75, which is clearly not aligned to the required
16 bytes.

We request Vulkan to create a buffer of 1276 bytes for us, it
figures out that it's not aligned, and creates a buffer of 1280
bytes, which is aligned. The extra 4 bytes are wasted, but that's
okay. We immediately query this buffer for this exact information,
using vkGetBufferMemoryRequirements(), and proceed to create actual
memory to back this buffer up.

The buffer tells us we must use 1280 bytes, so we pass 1280 bytes
and everyone is happy, right? Of course not. We pass 1276 bytes,
and Vulkan is subtly unhappy at us.

Fix that by passing the value that Vulkan asks us to use, i.e.,
the size returned by vkGetBufferMemoryRequirements().
2023-04-03 10:59:45 -03:00
Georges Basile Stavracas Neto
56c643306a gsk/vulkan/glyphcache: Ceil glyph surface size
This is what GL does, and for a reason: it can lead to width or
height for very small glyphs. Also, switch to dividing by a float
(1024.0) instead of an integer (1024).
2023-04-03 10:59:45 -03:00
Georges Basile Stavracas Neto
57587c00b4 gsk/vulkanimage: Set buffer row length and height
This doesn't make any difference now, but will allow us to copy
subregions more easily. This is not obvious, but here's a quick
explanation:

Leaving 'bufferRowLength' and 'bufferImageHeight' implies that
Vulkan will assume the size passed in the 'imageExtent' field.
Right now, this assumption is correct - the only user of this
function is the glyph cache, and it only copies and uploads
exact rects. Next commits will change that assumption, so we
must pass 'buffer*' fields, and tell Vulkan, "this part of the
buffer represents an image of width x height, and I want the
subregion (x, y, smallerWidth, smallerHeight) of this image".
2023-04-03 10:59:45 -03:00
Georges Basile Stavracas Neto
724d07ef8a gsk/vulkan/image: Use UNDEFINED for initial layout
When creating an image using gsk_vulkan_image_new_for_framebuffer(),
it passes VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL.

However, this is a mistake. The spec demands that the initial
layout must be either VK_IMAGE_LAYOUT_UNDEFINED or
VK_IMAGE_LAYOUT_PREINITIALIZED.

Apparently this was an oversight from commit b97fb75146, since the
commit message even documents that, and all other calls pass either
VK_IMAGE_LAYOUT_UNDEFINED or VK_IMAGE_LAYOUT_PREINITIALIZED.

Create framebuffer images using VK_IMAGE_LAYOUT_UNDEFINED, which is
what was originally expected.
2023-04-03 10:59:45 -03:00
Matthias Clasen
79b0e594cd Merge branch 'listbox-remove-all' into 'main'
gtklistbox: Add remove_all()

See merge request GNOME/gtk!5779
2023-04-03 10:29:13 +00:00
Matthias Clasen
6ef3d77b9a Merge branch 'zbrown/bump-protocols' into 'main'
build: We need wayland-protocols 1.31

See merge request GNOME/gtk!5780
2023-04-03 10:28:44 +00:00
Aleksandr Melman
26b36e68f4 Update Russian translation 2023-04-03 07:29:46 +00:00
Zander Brown
405c703aa0 build: We need wayland-protocols 1.31
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5767
2023-04-03 01:12:54 +00:00
Christopher Davis
b34625363a gtkflowbox: Add remove_all()
Removing all items from containers is a common use case.
Without this applications needed to implement this manually.
It makes senses to handle it here.
2023-04-02 20:17:46 -04:00
Christopher Davis
49e56fc7b3 gtklistbox: Add remove_all()
Adds a function to remove all children from
a GtkListBox. This way app developers don't need to
implement this themselves.
2023-04-02 19:46:02 -04:00
Georges Basile Stavracas Neto
a33ddd54ac gsk/vulkan/image: Cosmetics 2023-04-02 19:29:55 -03:00
Benjamin Otte
39863d1a15 Merge branch 'wip/otte/for-main' into 'main'
tooltipwindow: Cast the correct object

See merge request GNOME/gtk!5774
2023-04-02 19:14:05 +00:00
Matthias Clasen
f7554f3a97 Merge branch 'docs-updates' into 'main'
docs: Document new environment variables

See merge request GNOME/gtk!5777
2023-04-02 18:43:55 +00:00
Benjamin Otte
8054f33fa4 tooltipwindow: Cast the correct object
the tooltipwindow is in the userdata.
2023-04-02 20:29:52 +02:00
Matthias Clasen
def6a78c88 Merge branch 'scale-factor-cleanup' into 'main'
wayland: Be more careful about scale-factor

See merge request GNOME/gtk!5775
2023-04-02 18:09:26 +00:00
Matthias Clasen
9b2a49b7b5 NEWS: Updates 2023-04-02 13:54:42 -04:00
Matthias Clasen
e84ebfbf29 docs: Document new environment variables
Add GSK_MAX_TEXTURE_SIZE and GDK_DEBUG=gl-fractional
to the docs.
2023-04-02 13:52:56 -04:00
Matthias Clasen
80ccfd2138 Merge branch 'ccook/gtkiter-doc-changes' into 'main'
Documentation corrections for GtkTextIter

See merge request GNOME/gtk!5776
2023-04-02 17:43:03 +00:00
Matthias Clasen
5e95c22844 wayland: Be more careful about scale-factor
Only emit notify::scale-factor if it actually
changes. This potentially avoids a lot of work
in GTK (reloading icons, etc).
2023-04-02 13:23:19 -04:00
Matthias Clasen
70269a5aee docs: Add some details 2023-04-02 13:18:51 -04:00
Cam Cook
0b861ac7a5 Documentation corrections for GtkTextIter
| method                                                                                                     | current                                                       | suggestion                                                      |
|------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|-----------------------------------------------------------------|
| [backward_visible_cursor_position](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3785) | "Moves @iter forward to the previous visible cursor position" | "Moves @iter backward to the previous visible cursor position." |
| [get_offset](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L595)                        | "Use [method@Gtk,TextBuffer.get_iter_at_offset]"              | "Use [method@Gtk.TextBuffer.get_iter_at_offset]"                |
| [starts_tag](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L1201)                       | "returns %TRUE, [method@Gtk.TextIter.has_tag"                 | "returns %TRUE, [method@Gtk.TextIter.has_tag] "                 |

| method                                                                                                 | current                                             | suggestion                                                |
|--------------------------------------------------------------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------------|
| [backward_cursor_position](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3715)     | "Like gtk_text_iter_forward_cursor_position()"      | "Like [method@Gtk.TextIter.forward_cursor_position]"      |
| [backward_find_char](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L4483)           | "Same as gtk_text_iter_forward_find_char()"         | "Same as [method@Gtk.TextIter.forward_find_char]"         |
| [backward_search](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L5295)              | "Same as gtk_text_iter_forward_search()"            | "Same as [method@Gtk.TextIter.forward_search]"            |
| [backward_sentence_starts](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3611)     | "Calls gtk_text_iter_backward_sentence_start()"     | "Calls [method@Gtk.TextIter.backward_sentence_start]"     |
| [backward_visible_word_starts](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3421) | "Calls gtk_text_iter_backward_visible_word_start()" | "Calls [method@Gtk.TextIter.backward_visible_word_start]" |
| [backward_word_starts](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3345)         | "Calls gtk_text_iter_backward_word_start()"         | "Calls [method@Gtk.TextIter.backward_word_start]"         |
| [forward_sentence_ends](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3591)        | "Calls gtk_text_iter_forward_sentence_end()"        | "Calls [method@Gtk.TextIter.forward_sentence_end]"        |
| [forward_to_end](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L4131)               | "gtk_text_iter_get_char() called on"                | "[method@Gtk.TextIter.get_char] called on"                |
| [forward_visible_word_ends](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3403)    | "Calls gtk_text_iter_forward_visible_word_end()"    | "Calls [method@Gtk.TextIter.forward_visible_word_end]"    |
| [forward_word_ends](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3327)            | "Calls gtk_text_iter_forward_word_end()"            | " Calls [method@Gtk.TextIter.forward_word_end]"           |
| [is_end](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L1664)                       | "gtk_text_iter_is_end() is the most efficient"      | "[method@Gtk.TextIter.is_end] is the most efficient"    |
| [set_line_index](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3900)               | "Same as gtk_text_iter_set_line_offset()"           | "Same as [method@Gtk.TextIter.set_line_offset]"         |
| [set_visible_line_index](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3987)       | "Like gtk_text_iter_set_line_index()"               | "Like [method@Gtk.TextIter.set_line_index]"             |
| [set_visible_line_offset](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3946)      | "Like gtk_text_iter_set_line_offset()"              | "Like [method@Gtk.TextIter.set_line_offset]"            |
2023-04-02 13:12:21 -04:00
Matthias Clasen
1a1f71f394 NEWS: Updates 2023-04-02 13:05:34 -04:00
Benjamin Otte
461e562ec9 Merge branch 'dropdown-inertness' into 'main'
dropdown: Fix to work with recent listview changes

See merge request GNOME/gtk!5773
2023-04-02 16:59:10 +00:00
Cam Cook
9d5330336b Documentation corrections for GtkTextIter
| method                                                                                                     | current                                                       | suggestion                                                      |
|------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|-----------------------------------------------------------------|
| [backward_visible_cursor_position](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3785) | "Moves @iter forward to the previous visible cursor position" | "Moves @iter backward to the previous visible cursor position." |
| [get_offset](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L595)                        | "Use [method@Gtk,TextBuffer.get_iter_at_offset]"              | "Use [method@Gtk.TextBuffer.get_iter_at_offset]"                |
| [starts_tag](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L1201)                       | "returns %TRUE, [method@Gtk.TextIter.has_tag"                 | "returns %TRUE, [method@Gtk.TextIter.has_tag] "                 |

| method                                                                                                 | current                                             | suggestion                                                |
|--------------------------------------------------------------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------------|
| [backward_cursor_position](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3715)     | "Like gtk_text_iter_forward_cursor_position()"      | "Like [method@Gtk.TextIter.forward_cursor_position]"      |
| [backward_find_char](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L4483)           | "Same as gtk_text_iter_forward_find_char()"         | "Same as [method@Gtk.TextIter.forward_find_char]"         |
| [backward_search](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L5295)              | "Same as gtk_text_iter_forward_search()"            | "Same as [method@Gtk.TextIter.forward_search]"            |
| [backward_sentence_starts](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3611)     | "Calls gtk_text_iter_backward_sentence_start()"     | "Calls [method@Gtk.TextIter.backward_sentence_start]"     |
| [backward_visible_word_starts](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3421) | "Calls gtk_text_iter_backward_visible_word_start()" | "Calls [method@Gtk.TextIter.backward_visible_word_start]" |
| [backward_word_starts](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3345)         | "Calls gtk_text_iter_backward_word_start()"         | "Calls [method@Gtk.TextIter.backward_word_start]"         |
| [forward_sentence_ends](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3591)        | "Calls gtk_text_iter_forward_sentence_end()"        | "Calls [method@Gtk.TextIter.forward_sentence_end]"        |
| [forward_to_end](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L4131)               | "gtk_text_iter_get_char() called on"                | "[method@Gtk.TextIter.get_char] called on"                |
| [forward_visible_word_ends](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3403)    | "Calls gtk_text_iter_forward_visible_word_end()"    | "Calls [method@Gtk.TextIter.forward_visible_word_end]"    |
| [forward_word_ends](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3327)            | "Calls gtk_text_iter_forward_word_end()"            | " Calls [method@Gtk.TextIter.forward_word_end]"           |
| [is_end](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L1664)                       | "gtk_text_iter_is_end() is the most efficient"      | "[method@Gtk.TextBuffer.is_end] is the most efficient"    |
| [set_line_index](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3900)               | "Same as gtk_text_iter_set_line_offset()"           | "Same as [method@Gtk.TextBuffer.set_line_offset]"         |
| [set_visible_line_index](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3987)       | "Like gtk_text_iter_set_line_index()"               | "Like [method@Gtk.TextBuffer.set_line_index]"             |
| [set_visible_line_offset](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3946)      | "Like gtk_text_iter_set_line_offset()"              | "Like [method@Gtk.TextBuffer.set_line_offset]"            |
2023-04-02 12:51:29 -04:00
Matthias Clasen
1068808742 dropdown: Fix to work with recent listview changes
Introduce our own 'inertness' for the list item widget
that shows the selected value inside the button.
2023-04-02 12:36:03 -04:00
Matthias Clasen
d6a27a41c2 Merge branch 'gl-fractional-scale' into 'main'
Make fractional scaling work with the GL renderer

See merge request GNOME/gtk!5770
2023-04-02 15:29:32 +00:00
Matthias Clasen
4746ffc4eb Make fractional scaling for GL opt-in
Fractional scaling with the GL renderer is
experimental for now, so we disable it unless
GDK_DEBUG=gl-fractional is set.

This will give us time to work out the kinks.
2023-04-02 11:05:57 -04:00
Matthias Clasen
493055d6b2 Merge branch 'matthiasc/for-main' into 'main'
examples: Update for deprecations

See merge request GNOME/gtk!5772
2023-04-02 15:02:24 +00:00
Matthias Clasen
fa58dd9256 Use fractional scale for the GL renderer
This commit combines changes in the Wayland backend,
the GL context frontend, and the GL renderer to switch
them all to use the fractional scale.

In the Wayland backend, we now use the fractional scale
to size the EGL window.

In the GL frontend code, we use the fractional scale to
scale the damage region and surface in begin/end_frame.

And in the GL renderer, we replace gdk_surface_get_scale_factor()
with gdk_surface_get_scale().
2023-04-02 09:22:56 -04:00
Matthias Clasen
519cde95f0 gsk: Cosmetics
Rename scale_factor to scale in various places,
now that it is no longer an int but a float.
2023-04-02 09:06:56 -04:00
Matthias Clasen
01108d4148 gsk: Pass scale as float to the command queue 2023-04-02 09:06:56 -04:00
Matthias Clasen
7d4c757c58 examples: Update for deprecations
Stop using gdk_surface_create_similar_surface here.
2023-04-02 09:06:02 -04:00
Matthias Clasen
33b1624a9f Merge branch 'deprecate-similar-surface' into 'main'
popover: Stop using gdk_surface_create_similar_surface

See merge request GNOME/gtk!5771
2023-04-02 10:55:15 +00:00
Yuri Chornoivan
f20e6a81d2 Update Ukrainian translation 2023-04-02 06:19:55 +00:00
Matthias Clasen
76ac91512b Deprecate gdk_surface_create_similar_surface
This function is part of the cairo drawing API and
we are moving away from that. Update all callers.
2023-04-01 23:09:19 -04:00
Matthias Clasen
afed6f92ef popover: Stop using gdk_surface_create_similar_surface
Just create the cairo image surface ourselves.
2023-04-01 23:08:36 -04:00
Matthias Clasen
b02729a58e Merge branch 'inspector-fractional-scale' into 'main'
Add gdk_surface_get_scale

See merge request GNOME/gtk!5769
2023-04-01 23:31:39 +00:00
Matthias Clasen
ed9f0c0eb8 inspector: Show surface scale
For Wayland surfaces, show the fractional scale
if we have it.
2023-04-01 19:11:00 -04:00
Matthias Clasen
075bea788b Add gdk_surface_get_scale
Add a scale property to GdkSurface and use the
fractional scale for it on Wayland.
2023-04-01 19:09:16 -04:00
Benjamin Otte
378df6556b Merge branch 'wip/otte/listitem-focus' into 'main'
GtkColumnView factories and focus rework

See merge request GNOME/gtk!5728
2023-04-01 19:33:00 +00:00
Matthias Clasen
d10e228ae0 inspector: Show the viewporter too 2023-04-01 14:53:12 -04:00
Benjamin Otte
4086913795 gtk-demo: Port to GtkColumnViewCell 2023-04-01 20:49:40 +02:00
Benjamin Otte
f5dea9a3c2 filechooserwidget: Port to ColumnViewCell 2023-04-01 20:49:40 +02:00
Benjamin Otte
5af3c2b2ec testcolumnview: Port to GtkColumnViewCell 2023-04-01 20:49:40 +02:00
Benjamin Otte
7a4ad81ed6 columnview: Add GtkColumnViewCell
This splits GtkListItem into 2 objects.

It is fully backwards compatible.

Using GtkListItem for GtkColumnView is now de-facto deprecated.
2023-04-01 20:49:40 +02:00
Benjamin Otte
e76d615d5f builderlistitemfactory: Allow subclasses
It's going to be used with the new GtkColumnViewCell objects, so that
it's backwards compatible with ui file factories that use GtkListItem.
2023-04-01 20:49:40 +02:00
Benjamin Otte
beba8be6b5 builder: Allow template parsing to be used with subclasses
Whenn setting gtk_builder_set_allow_template_parents(), the builder
instance will accept
  <template class="GtkWidget">
for a GtkBox instance.

It's going to be used with the new GtkColumnViewCell objects, so that
it's backwards compatible with ui file factories that use GtkListItem.
2023-04-01 20:49:40 +02:00
Benjamin Otte
170d49f067 columnviewcell: Ignore ::activatable and ::selectable for cells
This is a row property, not a cell property.
2023-04-01 20:49:40 +02:00
Benjamin Otte
c74ab7aaec columnviewcellwidget: Untangle from GtkListItemWidget
This is step 1 in switching cells to their own ListItem subclass.
2023-04-01 20:49:40 +02:00
Benjamin Otte
00cb4c66cf testdatatable: Add a --pages option
That way, local scrolling is available and the scrolling isn't random.

Recycling should now involve reordering the recycled widgets instead of
just keeping their order because all of them got recycled.
2023-04-01 20:49:40 +02:00
Benjamin Otte
708e067617 columnviewcellwidget: Ensure for_size is large enough
When clipping, we still need to do proper size requests.
2023-04-01 20:49:40 +02:00
Benjamin Otte
a29cf74e05 columnviewcellwidget: Rewrite width unadjusting
Use GtkCssBoxes for that purpose. No more scary CSS math necessary in
the widget.
2023-04-01 20:49:40 +02:00
Benjamin Otte
c760131f6f filechooser: Set a row-factory
This way, we can toggle per-row selectability and ensure files are not
selectable in select-folder mode.
2023-04-01 20:49:40 +02:00
Benjamin Otte
880aea513f columnview: Add gtk_column_view_add_row_factory()
This allows setting a factory to toggle per-row properties.

Implemented are selectable, focusable and activatable.
These are meant to supercede the per-cell selectable and activatable
properties, which make no sense individually.

The focus property makes it possible to focus rows instead of cells,
which is the default behavior.
2023-04-01 20:49:40 +02:00
Benjamin Otte
d1bc552b5f columnview: Implement inertness
This properly implements the same behavior as
62e9d1e470 and avoids randomly losing
factories.

Oops.
2023-04-01 20:49:40 +02:00
Benjamin Otte
e8f0aa6ef8 columnviewrowwidget: Don't discard items in unroot()
Follows 3411b0306ee3b88038abdc736adf60bd004c7b7a and
3fb10ff2d8.
2023-04-01 20:49:40 +02:00
Benjamin Otte
1a6afebbda columnview: Rename to GtkColumnViewCellWidget
Just like with Row/RowWidget, I want to use Cell/CellWidget.
2023-04-01 20:49:40 +02:00
Benjamin Otte
7cfab4edf2 columnview: Add GtkColumnViewRow
There is no way to set it yet, this is just to prove that it works.

It also changes the focus behavior of rows. They are now always
focusable - unless turned off by the factory once that is possible.
2023-04-01 20:49:40 +02:00
Benjamin Otte
04c049ee54 listitem: Add a backwards compatibility workaround
I want to avoid turning the :focusable property into a tristate at all
costs, but that third state is what we had before the property.
2023-04-01 20:49:40 +02:00
Benjamin Otte
5f1b8a31c2 treeexpander: Add docs note about setting GtkListItem::focusable 2023-04-01 20:49:40 +02:00
Benjamin Otte
87059d53a6 columnviewcell: Cells should not be focusable by default 2023-04-01 20:49:40 +02:00
Benjamin Otte
ce531ce280 listview: Add GtkListItem::focusable property
This makes the question if a listitem can be focused or not an explicit
decision by application developers.

Previously an item could be focused if it was selectable and no child or
grandchild was focusable - so if you put a label and icon into it, the
item was focusable, but if you put a GtkTreeExpander or a GtkButton into
it, the item wasn't. This needs to be decided explicitly now.

Technically this is an API break, because the previous behavior does not
exist anymore.
But I really don't want to make this a tristate (focusable, not
focusable, automatic), because then binding it to other things gets
hard, and because all the other focusable proeprties are booleans, too,
and working with them gets a lot harder.

Related: #3910
2023-04-01 20:49:40 +02:00
Benjamin Otte
eb0541c9d1 columnviewcell: Cells aren't selectable or activatable
Rows are.
2023-04-01 20:49:40 +02:00
Benjamin Otte
3048100617 listitem: Use GDK_DECLARE_INTERNAL_TYPE 2023-04-01 20:49:40 +02:00
Matthias Clasen
60921db76f Merge branch 'matthiasc/for-main' into 'main'
inspector: Update some misc info rows

See merge request GNOME/gtk!5768
2023-04-01 18:36:39 +00:00
Matthias Clasen
f7600a62e4 Merge branch 'wip/otte/fractional-cairo' into 'main'
wayland: Enable fractional scaling with the Cairo renderer

See merge request GNOME/gtk!5767
2023-04-01 18:35:33 +00:00
Georges Basile Stavracas Neto
70e6bcce16 Merge branch 'gbsneto/mildly-mid-vulkan-fixes' into 'main'
Vulkan transform / scale fixes

See merge request GNOME/gtk!5757
2023-04-01 18:23:12 +00:00
Matthias Clasen
a4dc0a74fd inspector: Update some misc info rows 2023-04-01 14:21:41 -04:00
Benjamin Otte
6d4d9af14e wayland: Use fractional scaling with the Cairo renderer
Cairo can do that, so just enable it:

 * Create surfaces with the correct fractionally scaled size.
 * Set the Cairo surface's device scale to that number.
2023-04-01 20:05:06 +02:00
Benjamin Otte
84b235aac1 wayland: Allow creating fractional Cairo surfaces
We don't do that yet, because the buffer scale code can't deal with it,
but we can do it now.
2023-04-01 20:05:05 +02:00
Benjamin Otte
ea82f50d13 build: Bump wayland-protocols requirement
The new fractional-scale support requires v1.31
2023-04-01 20:05:05 +02:00
Benjamin Otte
1a71e82fc5 wayland: Use wp_viewport to set buffer scale
Instead of setting the buffer scale via the buffer-scale command, set it
via the viewport.

This technically allows setting fractional scales, but we're not doing
that.
2023-04-01 20:05:01 +02:00
Georges Basile Stavracas Neto
f3b8bd8a98 gsk/gl/renderjob: Decompose matrix for 3D transforms
While this can be more expensive, it's also correct.
2023-04-01 14:47:29 -03:00
Georges Basile Stavracas Neto
ee1730dd49 gsk/vulkan/renderpass: Update scales from transform node
Retrieve the scale from the transform node, and store it as long
as the transform node is being visited. This applies the proper
scale to text nodes.
2023-04-01 14:47:29 -03:00
Georges Basile Stavracas Neto
e0aaf9bc83 gsk/vulkan/renderpass: Refactor scale
Instead of tracking a single scale, track x and y scales separately.
Factor out gsk_vulkan_render_pass_new() into a private function that
receives both scales, and pass 'scale_factor' for both.
2023-04-01 14:46:56 -03:00
Matthias Clasen
63318dcd66 NEWS: Updates 2023-04-01 12:38:38 -04:00
Benjamin Otte
8dd5d649b8 wayland: Use GdkFractionalScale for surface scale
We still always round it to integers when we read it, but we store it as a fraction.

So we could now use it for fractional scaling.
2023-04-01 18:23:38 +02:00
Benjamin Otte
40ac6f22a3 wayland: Introduce GdkFractionalScale type
We want to use it later for various things, this just adds the
infrastructure we will need.
2023-04-01 18:23:38 +02:00
Matthias Clasen
1262477e17 Merge branch 'always_expose_showing' into 'main'
a11y: Set ATSPI_STATE_SHOWING for all widgets, not only for windows

Closes #5194

See merge request GNOME/gtk!5738
2023-04-01 14:41:42 +00:00
Matthias Clasen
afe3f0ef0c Merge branch 'matthiasc/for-main' into 'main'
inspector: Improve display of paths

See merge request GNOME/gtk!5766
2023-04-01 14:14:31 +00:00
Matthias Clasen
258fb091dc inspector: Improve display of paths
The values in the path section are long and generally
ellipsized. It does not make sense to reserve extra
space that the labels don't need.
2023-04-01 09:52:31 -04:00
Matthias Clasen
7aca807b15 Merge branch 'wayland-details' into 'main'
inspector: Show Wayland protocols

See merge request GNOME/gtk!5765
2023-04-01 13:51:40 +00:00
Matthias Clasen
ffdbb9077c wayland: Some debug spew tweaks 2023-04-01 09:31:12 -04:00
Matthias Clasen
23268e84b3 inspector: Show Wayland protocols
This could be useful for somebody.
2023-04-01 09:31:12 -04:00
Matthias Clasen
16c1acc539 Merge branch 'bilelmoussaoui-main-patch-24659' into 'main'
docs: Improve GtkLabel rendering

See merge request GNOME/gtk!5764
2023-04-01 12:48:19 +00:00
Nathan Follens
3393813949 Update Dutch translation 2023-04-01 12:29:11 +00:00
Bilal Elmoussaoui
e95c50ca4e docs: Improve GtkLabel rendering
By adding some missing links & avoid the browser
from rendering the entities as their equivalent symbols
2023-04-01 12:06:11 +00:00
Benjamin Otte
a3f216be00 Merge branch 'wip/otte/fractional-scale' into 'main'
wayland: Add support for the fractional scale protocol

See merge request GNOME/gtk!5763
2023-04-01 11:39:32 +00:00
Benjamin Otte
54e8bd898a wayland: Add support for the fractional scale protocol
April fools!

No, really.
The fractional scale protocol is just a way to track the surface scale,
but not a way to draw fractional content.
This commit uses it for that, so tht we don't rely on tracking outputs.

This also allows magnifiers etc to send us a larger (integer) scale if
they would like that, that is not represented by the outputs.
2023-04-01 12:57:03 +02:00
Benjamin Otte
2fb11765c7 Merge branch 'wip/otte/wayland-versions' into 'main'
wayland: Use proper get_version() functions

See merge request GNOME/gtk!5761
2023-04-01 00:52:11 +00:00
Benjamin Otte
b4492a97bf wayland: Use wl_seat_get_version() 2023-04-01 02:22:21 +02:00
Benjamin Otte
6f93f52b56 wayland: Use zwp_pointer_gestures_v1_get_version() 2023-04-01 02:22:21 +02:00
Benjamin Otte
68b8c5cd99 wayland: Use gtk_shell1_get_version()
... or correct gtk_surface1_get_version() alternative.
2023-04-01 02:22:21 +02:00
Benjamin Otte
9d99259cbd wayland: Use wl_data_device_manager_get_version() 2023-04-01 02:22:21 +02:00
Benjamin Otte
55b5c847f7 wayland: Use zxdg_output_manager_v1_get_version() 2023-04-01 02:22:21 +02:00
Benjamin Otte
3d3d22e844 wayland: Remove unused variable
Also, Wayland has get_version() functions, so if we ever need it, we can
use that.
2023-04-01 02:22:21 +02:00
Benjamin Otte
ae2c28af89 wayland: Check correct interface
buffer scale is a surface property, so check the version of the surface
interface, not the compositor one.
2023-04-01 02:22:21 +02:00
Benjamin Otte
c7499a33fd wayland: Use wl_compositor_get_version()
Wayland has functions to check versions, so use those.
2023-04-01 02:22:21 +02:00
Benjamin Otte
c97b489316 wayland: Use proper macro
Wayland has macros to check required versions. Use those instead of
custom ones.
2023-04-01 02:22:21 +02:00
Matthias Clasen
ce86ec5599 CODING-STYLE: Updates
We switched to using #pragma once in headers,
document that.
2023-03-31 20:17:12 -04:00
Matthias Clasen
27230ccb01 Merge branch 'pragma-once' into 'main'
Convert headers to #pragma once

See merge request GNOME/gtk!5759
2023-03-31 23:52:01 +00:00
Matthias Clasen
a1c5a806b3 Convert headers to #pragma once
The conversion was done by guard2one.
2023-03-31 15:11:10 -04:00
Georges Basile Stavracas Neto
b1a8c0e686 gsk/vulkan/renderpass: Factor out node implementations
This is mostly a cosmetic change, and the goal is twofold:

 1. Make it easier to spot unimplemented render node types; and
 2. Prepare for a small rework

The implementation for each node now lives in specific functions,
like the GL renderer; unlike the GL renderer, however, we use a
node type vtable to map GskRenderNodeType → implementation. Render
node without an implementation map to NULL, and use the fallback
implementation. Render nodes that fail any check and return FALSE
also use fallback implementation.
2023-03-31 14:00:33 -03:00
Benjamin Otte
515f39f161 Merge branch 'wip/otte/for-main' into 'main'
various fixes

See merge request GNOME/gtk!5756
2023-03-31 15:58:03 +00:00
Benjamin Otte
dbff49b5a7 listbase: Clear any newly set adjustments
The scrolling code assumes the adjustment values are up to date or
it crashes and before we've run size_allocate() we haven't update them.

Fixes a crash in the gtk-demo scrollinfo that would set the adjustments
with random values (via ScrolledWindow.set_child()) and then scroll in a
tick callback right before the (first) size_allocate().
2023-03-31 17:35:48 +02:00
Benjamin Otte
6f4175345f widget: Shortcut widget not repositioning
If a widget doesn't move positions during gtk_widget_reposition(),
detect it early.

This is especially beneficial in the inspector.
2023-03-31 17:35:48 +02:00
Matthias Clasen
bd29bed785 Merge branch 'gbsneto/easy-vulkan-fixes' into 'main'
Easy Vulkan cleanups and fixes

See merge request GNOME/gtk!5753
2023-03-31 13:25:30 +00:00
Alexander Shopov
cf2c955b12 Update Bulgarian translation
(cherry picked from commit 3458ebf8c9)
2023-03-31 10:04:32 +00:00
Matthias Clasen
ad8684431e Merge branch 'more-property-notification' into 'main'
filedialog: Make filters nullable

See merge request GNOME/gtk!5755
2023-03-31 01:54:52 +00:00
Matthias Clasen
4e17900b9a testsuite: Check more property notification
Handle more value types.
2023-03-30 21:39:55 -04:00
Matthias Clasen
fdce10fb96 Make adjustment setters behave 2023-03-30 21:39:55 -04:00
Matthias Clasen
3b96b053ad models: Fix up property notifications
We were emitting redundant notifications
for the ::model property.
2023-03-30 20:18:19 -04:00
Matthias Clasen
82b188c8fb filedialog: Make filters nullable
It should be possible to reset a property
to its default value.
2023-03-30 20:17:28 -04:00
Matthias Clasen
ef45004d14 Merge branch 'more-notify-tests' into 'main'
testsuite: Clean up some exclusions

See merge request GNOME/gtk!5752
2023-03-30 23:34:48 +00:00
Benjamin Otte
8566622748 Merge branch 'gbsneto/wayland-buffer-scale-creation' into 'main'
gdk/wayland/surface: Track and apply buffer scale

See merge request GNOME/gtk!5751
2023-03-30 21:59:45 +00:00
Matthias Clasen
577195a243 Make widget property setters behave
We want to allow setting a property to its
current value, while still having a precondition
for widget->parent being NULL otherwise.
2023-03-30 17:32:38 -04:00
Georges Basile Stavracas Neto
6e80c8b07e gdk/vulkancontext: Accept Khronos validation layers
The Lunarg validation layers seem to have been deprecated in favour
of the Khronos ones. There's no reason not to have both, to accept
loading both - simultaneously, even.
2023-03-30 17:13:35 -03:00
Georges Basile Stavracas Neto
c85599e2e8 gsk/vulkanglyphcache: Cleanup maths
A trivial cleanup to match what the GL renderer does
2023-03-30 17:13:35 -03:00
Georges Basile Stavracas Neto
981e94505c vulkan/glyphcache: Add padding around ink rect
This is what the GL renderer does, and it gets rid of the cutout
characters.
2023-03-30 17:13:35 -03:00
Georges Basile Stavracas Neto
c0449e3245 gdk/vulkancontext: Pass all painted rects
Instead of passing a single, potentially massive rectangle that is
just the extents of the damage rect, collect and pass all damage
rects individually.
2023-03-30 17:13:35 -03:00
Georges Basile Stavracas Neto
8217b6e484 gdk/wayland/surface: Track and apply buffer scale
Add a new flag to track whether buffer scale is dirty or not,
and centralize calling wl_surface_set_buffer_scale() in a single
place: gdk_wayland_surface_sync_buffer_scale().

gdk_wayland_surface_sync_buffer_scale() is only called by
gdk_wayland_surface_sync(), which itself is called by the GL,
Vulkan, and Cairo contexts, right before submitting a frame.
This ensure that each frame has an up-to-date buffer scale.

This mimics how opaque and input regions are tracked.
2023-03-30 16:32:50 -03:00
Matthias Clasen
2650c4e974 testsuite: Check more property notification
We can easily check some object types
such as widgets.
2023-03-30 14:13:19 -04:00
Matthias Clasen
87f9e8a4c1 testsuite: Clean up some exclusions
Drop some exclusions from the notify test.
The tests work fine for these objects.
2023-03-30 14:13:19 -04:00
Matthias Clasen
54b895341c listitem: Fix a notification problem
We were notifying ::item when ::child is
changed. Oops
2023-03-30 14:13:19 -04:00
Lukáš Tyrychtr
878b80806e a11y: Set ATSPI_STATE_SHOWING for all widgets, not only for windows
According to the at-spi2 docs, for a widget to be considered visible,
it needs both the showing and visible states. Many applications rely on that,
for example the flat review functionality of Orca.

this fixes #5194
2023-03-30 10:07:36 +02:00
Matthias Clasen
5ee0e19568 Merge branch 'matthiasc/for-main' into 'main'
emojichooser: Stop using gtk_widget_get_allocation

See merge request GNOME/gtk!5749
2023-03-30 02:45:56 +00:00
Matthias Clasen
fc573491b2 emojichooser: Stop using gtk_widget_get_allocation
Replace all uses with gtk_widget_compute_bounds.
2023-03-29 21:14:24 -04:00
Matthias Clasen
5e9405887e Merge branch 'fix-popover-positioning' into 'main'
wayland: Fix corner cases in positioning

See merge request GNOME/gtk!5741
2023-03-29 20:12:29 +00:00
Matthias Clasen
49778fda3e Merge branch 'matthiasc/for-main' into 'main'
Add some more keysyms tests

See merge request GNOME/gtk!5745
2023-03-29 12:05:58 +00:00
Matthias Clasen
dbefc330bd Add some more keysyms tests
Spot-check a few keypad symbols.
2023-03-29 07:35:24 -04:00
Matthias Clasen
31ebe42d2e testsuite: Update a test
cacecd2fb5 changed a warning message that
some tests check for. Oops.
2023-03-29 07:34:27 -04:00
Benjamin Otte
8fd526a194 Merge branch 'wip/otte/filechooser-fixes' into 'main'
filechooser fixes

See merge request GNOME/gtk!5746
2023-03-29 11:28:28 +00:00
Benjamin Otte
1449e487d3 Merge branch 'wip/otte/node-naming' into 'main'
node format: Allow naming textures and nodes

See merge request GNOME/gtk!5740
2023-03-29 11:28:15 +00:00
Benjamin Otte
889870546f filechoosercell: Remove position property
Instead, query the position from the listitem
2023-03-29 10:42:49 +02:00
Benjamin Otte
82e308b635 filechoosercell: Remove selected property
Instead, query the selected state from the listitem.
2023-03-29 10:42:49 +02:00
Benjamin Otte
0834dc50aa filechooser: Select via action
Don't fudge around poking through the listview, trying to get a model
and selecting it directly. Instead, use the proper way and activate the
"listitem.select" action.
2023-03-29 10:42:49 +02:00
Benjamin Otte
cbef6a9258 listbase: Select via action
Instead of directly calling select_item(), trigger the select-item
action of the focused child.

We do this convoluted calling into the widget because that way
GtkListItem::selectable gets respected, which is what one would expect.

Plus, this code is usually triggered via keybindings, and this way the
ListBase keybindings work identical to the ListItem keybindings.
2023-03-29 10:42:49 +02:00
Matthias Clasen
c5a53f235a Merge branch 'wip/otte/trelistmodel-fixage' into 'main'
treelistmodel: Don't add items in reverse

Closes #5707

See merge request GNOME/gtk!5744
2023-03-29 02:23:46 +00:00
Benjamin Otte
47ba29bc14 docs: Document additions to the node format 2023-03-29 03:53:52 +02:00
Benjamin Otte
9dd050ff30 testsuite: Add parsing tests for node and texture naming 2023-03-29 03:53:52 +02:00
Benjamin Otte
0d6a6a5997 rendernodeparser: Detect duplicates and print them by name
If we encounter a node or texture the 1st time and they are going
to be used again, give them a name.

Then, when encountering them again, print them by name instead
of duplicating them.
2023-03-29 03:53:52 +02:00
Benjamin Otte
5a0c4de07f rendernodeparser: Add support for reusing nodes
We extend the syntax for nodes from:
  <node-type> { ... }
to
  <node-type> { ... }
  <node-type> <string> { ... }
  <string>;
where the first is the same as before, the 2nd defines a named node and
the last references a previously defined node.
Or to give an example:
  color "node" {
    bounds: 0 0 10 10;
    color: red;
  }
  transform {
    bounds: 20 0 10 10;
    child: "node";
  }
This will draw the red box twice, once at (0,0) and once at
(20,0).

The intended use for this is both shortening generated node files as
well as allowing to write tests that reuse nodes, in particular when
dealing with caches.
2023-03-29 03:53:52 +02:00
Benjamin Otte
348a68599a rendernodeparser: Add support for reusing textures
We extend the syntax for textures from just:
  <url>
to
  [<string>] <url>
  <string>
where the first defines a named texture while the second references a
texture.
Or to give an example:
  texture {
    bounds: 0 0 10 10;
    texture: "foo" url("foo.png");
  }
  texture {
    bounds: 20 0 10 10;
    texture: "foo";
  }
This will draw the texture "foo.png" twice, once at (0,0) and once at
(20,0).

The intended use for this is both shortening generated node files as
well as allowing to write tests that reuse textures, in particular when
mixing them in texture and texture-scale nodes.
2023-03-29 03:53:52 +02:00
Benjamin Otte
8590b1ef11 rendernodeparser: Add a Context object
... and pass it through all the parsing functions.

So far it's unused, this is just the plumbing.
2023-03-29 03:53:52 +02:00
Benjamin Otte
d1f27c281d rendernodeparser: Split out a function
This code was copy/pasted, so unify it.
2023-03-29 03:53:52 +02:00
Benjamin Otte
76ff2f5410 rendernodeparser: Emit error when failing to resolve URL 2023-03-29 03:53:52 +02:00
Benjamin Otte
1605b07ff5 rendernodeparser: Failing to parse a string is an error
Testcase included.
2023-03-29 03:53:52 +02:00
Benjamin Otte
cc9de42e70 testsuite: Fix broken test
The test was referencing a nonexisting image.

Plus, node parsing cannot reference relative URLs.
2023-03-29 03:53:52 +02:00
Kévin Commaille
cd860beb38 Add a test for splicing treelistmodel 2023-03-29 03:32:51 +02:00
Benjamin Otte
1718db144e treelistmodel: Don't add items in reverse
This was broken since commit bf55685000
where we started to track items.

Fixes #5707
2023-03-29 03:32:48 +02:00
Matthias Clasen
65dc4cac86 wayland: Fix corner cases in positioning
We were not handling some cases correctly.
This was making the dropdown in the gtk-demo
image-scaling demo appear in the top left
corner.
2023-03-28 20:37:54 -04:00
Matthias Clasen
ea572227f0 Merge branch 'wayland-popup-anchor' into 'main'
wayland: Comply with protocol requirements

See merge request GNOME/gtk!5723
2023-03-28 15:36:34 +00:00
Alexandre Franke
ac96384260 Update French translation 2023-03-28 10:25:01 +00:00
Matthias Clasen
db9883584d Merge branch 'matthiasc/for-main' into 'main'
gdk: Improve logging for backends

Closes #5704

See merge request GNOME/gtk!5737
2023-03-28 10:19:31 +00:00
Matthias Clasen
435bc70886 Merge branch 'sumibi-yakitori/fix-texture-filter' into 'main'
glrenderer: Fix to prevent creation of GL_TEXTURE_MAG_FILTER filters with incorrect values

See merge request GNOME/gtk!5729
2023-03-28 02:17:39 +00:00
Matthias Clasen
a8d8724a02 gdk: Avoid a pointless indirection
Don't use g_fprintf if GLib is using system printf
anyway.
2023-03-27 21:56:41 -04:00
Matthias Clasen
a2d20a5dc0 docs: Some tweaks 2023-03-27 21:55:36 -04:00
Matthias Clasen
cacecd2fb5 Improve an error message
We were producing a misleading error message
when gtk_init() fails.

Fixes: #5704
2023-03-27 21:44:56 -04:00
Matthias Clasen
321877e94b gdk: Improve logging for backends
Log more when trying backends.
2023-03-27 21:42:10 -04:00
Benjamin Otte
ffb5d129f9 Merge branch 'wip/otte/for-main' into 'main'
clenaup

See merge request GNOME/gtk!5736
2023-03-27 22:28:07 +00:00
Benjamin Otte
51e3a1c7d2 columnviewcell: Remove root/unroot stuff
Instead, do that work on creation/dispose.

This is a followup to 3fb10ff2d8.
2023-03-27 23:37:01 +02:00
Benjamin Otte
706e1c2f6f columnviewcell: Remove "visible" property setting
Since 7ad693f865 we only create cells for
visible rows and don't just toggle visibility.

This is a leftover from that change.
2023-03-27 23:37:01 +02:00
Benjamin Otte
a44847e81e enums: Move G_END_DECLS to the end of the file 2023-03-27 23:37:01 +02:00
Matthias Clasen
68d629f84d Merge branch 'bilelmoussaoui/gi-docs' into 'main'
docs: Fix various broken links

See merge request GNOME/gtk!5734
2023-03-27 19:53:33 +00:00
Matthias Clasen
f002e23a37 Merge branch 'wip/reset-repositioned-after-handling' into 'main'
wayland/popup: Handle late received reposition feedback

See merge request GNOME/gtk!5735
2023-03-27 19:51:47 +00:00
Bilal Elmoussaoui
d1c43b94ef docs: Fix various broken links 2023-03-27 21:29:08 +02:00
Jonas Ådahl
c88f2caa04 wayland/popup: Handle late received reposition feedback
If we map, reposition, unmap, remap, the reposition feedback from the
last time a popup was mapped might be received while we're dealing with
the new version of the popup. At this point, the old reposition token
has no meating, so lets drop it. Also reset the reposition tokens when
creating new protocol objects, so that the reposition token are as if
we're in the initial state.

This fixes an issue where we'd get stuck if repeatedly smashing a button
that'd create popups that'd immediately get dismissed by the compositor.
2023-03-27 21:27:44 +02:00
Emmanuele Bassi
506206e1bd Merge branch 'ebassi/compute-size-annotation' into 'main'
Remove wrong annotation for GdkToplevel::compute-size

See merge request GNOME/gtk!5725
2023-03-27 11:43:34 +00:00
Matthias Clasen
cb298fbe23 Merge branch 'wayland_display' into 'main'
wayland: Try to open the display even if XDG_RUNTIME_DIR is unset

See merge request GNOME/gtk!5732
2023-03-27 11:38:14 +00:00
Ludovico de Nittis
d2672db648 wayland: Try to open the display even if XDG_RUNTIME_DIR is unset
Since Wayland 1.15, it is now possible to use absolute paths in
"WAYLAND_DISPLAY".
In that scenario, having a valid "XDG_RUNTIME_DIR" is not a requirement
anymore.

For this reason we remove the "XDG_RUNTIME_DIR" check and we let
`wl_display_connect()` decide if our environment is correct.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2023-03-27 11:53:57 +02:00
Benjamin Otte
3008f4babc Merge branch 'wip/otte/listview-inert' into 'main'
listview: Add concept of inertness

See merge request GNOME/gtk!5731
2023-03-27 05:48:12 +00:00
Benjamin Otte
aba1be6faf gridview: Add concept of inertness
An inert gridview is a gridview that does not use the factory. This
allows faster updates because no calls into user code need to happen.

A gridview is inert when either:
 - It is not rooted.
 - It is not visible.
 - No factory is set (that one is obvious)

The gridview does not need to be inert without a model, as that case is
handled by the item manager.

This should allow Nautilus to keep both the gridview and the columnview
around, and just gtk_widget_hide() the unused widget.

The code for now does not disable the item manager, as some
functionality of the item manager is required to allow setting scroll
positions and such.
But that is a place where more gains could be found if profiling showed
that was useful to do.
2023-03-27 07:08:44 +02:00
Benjamin Otte
62e9d1e470 listview: Add concept of inertness
An inert listview is a listview that does not use the factory. This
allows faster updates because no calls into user code need to happen.

A listview is inert when either:
 - It is not rooted.
 - It is not visible.
 - No factory is set (that one is obvious)

The listview does not need to be inert without a model, as that case is
handled by the item manager.

This should allow Nautilus to keep both the gridview and the columnview
around, and just gtk_widget_hide() the unused widget.

The code for now does not disable the item manager, as some
functionality of the item manager is required to allow setting scroll
positions and such.
But that is a place where more gains could be found if profiling showed
that was useful to do.
2023-03-27 07:08:44 +02:00
Benjamin Otte
3fb10ff2d8 listfactorywidget: Stop trying to be smart
The widget would teardown the factory on unroot to avoid unnecessary
work when it isn't shown.

However, recycling may reposition widgets, and repositioning widgets
does a unroot/root.

We don't want to recycle widgets then.
2023-03-27 07:08:44 +02:00
Benjamin Otte
924fd195ab gtk-demo: Set tab behavior for settings demo 2023-03-27 07:08:44 +02:00
Benjamin Otte
66cb79f62e magnifier: Don't check for visibility
gtk_widget_queue_draw() already does that.
2023-03-27 07:08:44 +02:00
sumibi-yakitori
cf9c49dcb1 glrenderer: Fix to prevent creation of GL_TEXTURE_MAG_FILTER filters with incorrect values 2023-03-27 04:53:04 +09:00
Benjamin Otte
8cf3a95d8c Merge branch 'wip/otte/tab-behavior' into 'main'
listview: Add ::tab-behavior to list widgets

See merge request GNOME/gtk!5710
2023-03-26 19:10:29 +00:00
Benjamin Otte
0f55defe56 columnview: Add GtkColumnView::tab-behavior
Also make sure that GTK_LIST_TAB_CELL works by implementing support for
it in the row widget.
2023-03-26 20:29:47 +02:00
Benjamin Otte
8b0731b34f gridview: Add GtkGridView::tab-behavior 2023-03-26 20:29:47 +02:00
Benjamin Otte
c0ca71e9f4 listview: Add GtkListView::tab-behavior
The implementation lives (as always) in GtkListBase.

This is a feature request from the Nautilus developers, who currently do
some hacks to emulate that behavior and it apparently only breaks
sometimes.
2023-03-26 20:29:47 +02:00
Matthias Clasen
c86cf6340e Merge branch 'scrolled-window-signal-disconnnect' into 'main'
scrolledwindow: Disconnect the right handler

Closes #5684

See merge request GNOME/gtk!5726
2023-03-26 15:15:49 +00:00
Matthias Clasen
844a4bab8d scrolledwindow: Disconnect the right handler
We connect gtk_scrolled_window_update_use_indicators
as signal handler in realize(), but we were disconnecting
gtk_scrolled_window_sync_use_indicators in unrealize.

Spotted by Milan Crha.

Fixes: #5684
2023-03-26 10:57:01 -04:00
Emmanuele Bassi
8dddddfe8c Remove wrong annotation from GdkDragSurface::compute-size
Just like GdkToplevel::compute-size, the size argument of the signal is
given to the handlers by GDK; it's not an out argument meant to be
allocated by the caller.
2023-03-26 15:50:22 +01:00
Emmanuele Bassi
a08c31e71f Remove wrong annotation for GdkToplevel::compute-size
The size argument is passed to the signal by the GDK surface machinery,
as is: it's not going to be allocated by the caller (since it's a
signal), and it's not an out argument.
2023-03-26 15:48:44 +01:00
Matthias Clasen
3cdb639210 Merge branch 'wayland-startup-notification-crash' into 'main'
wayland: Don't crash without xdg_activation_v1

Closes #5701

See merge request GNOME/gtk!5724
2023-03-26 14:36:57 +00:00
Matthias Clasen
3a5282abe1 wayland: Don't crash without xdg_activation_v1
If the compositor does not support this protocol,
we can't use it.

Fixes: #5701
2023-03-26 10:11:14 -04:00
Matthias Clasen
b81f9d3f94 wayland: Comply with protocol requirements
If you send a bad anchor rect to mutter, it crashes.
Thats not great, so lets not do that.
2023-03-26 09:47:46 -04:00
Matthias Clasen
a70b85ef76 Merge branch 'wayland-cursor-size' into 'main'
wayland: Don't crash on cursor size 0

Closes #5700

See merge request GNOME/gtk!5721
2023-03-26 01:01:04 +00:00
Benjamin Otte
e27b3f1eae Merge branch 'wip/otte/for-main' into 'main'
popover: Fix typo

See merge request GNOME/gtk!5720
2023-03-26 00:26:31 +00:00
Matthias Clasen
7adbbe6f35 wayland: Don't crash on cursor size 0
The cursor-theme-size setting is documented as
'0 means the default size'. Make it so by using
size 24 if we see a 0. Its better than crashing.

Fixes: #5700
2023-03-25 20:25:51 -04:00
Benjamin Otte
5973df22aa gtk-demo: Rename dropdown demo
It's the listview selections demo, so use that name.
2023-03-26 01:06:18 +01:00
Benjamin Otte
32ff37f070 gtk-demo: Rename image scaling demo to image_scaling
This just means renaming the C file, but it makes --run=image_scaling
actually do what I'd expect.
2023-03-26 01:02:17 +01:00
Benjamin Otte
da9b19804d popover: Fix typo
The typo causs gnome-shell to crah, which is somewhat suboptimal.

It was introduced in 1a9c7a4b1f.
2023-03-26 01:02:17 +01:00
Matthias Clasen
13b0ed08a3 Merge branch 'coordinate-docs' into 'main'
docs: Add some cross references

See merge request GNOME/gtk!5719
2023-03-25 21:21:00 +00:00
Matthias Clasen
a9e37c6f2c Incorporate review feedback 2023-03-25 16:22:45 -04:00
Matthias Clasen
3d35b848d1 docs: Use our own box model illustration
This one has a dark mode too.
2023-03-25 16:16:34 -04:00
Matthias Clasen
de3b37d80c Tweak 2023-03-25 15:29:55 -04:00
Matthias Clasen
1e5dd5db71 Tweak 2023-03-25 15:27:23 -04:00
Matthias Clasen
7bd0fbb47e More review feedback 2023-03-25 15:26:33 -04:00
Matthias Clasen
0efd6cd23e docs: Add another cross reference
Refer to the new coordinate system overview
from the GdkEvent docs.
2023-03-25 15:06:19 -04:00
Matthias Clasen
2e26932925 docs: Apply review feedback
Clarify some points in the coordinate overview.
2023-03-25 15:05:28 -04:00
Matthias Clasen
0b3c979719 Docs: Cosmetics
Align section heading better. Now they all follow
the "Using GTK..." pattern.
2023-03-25 12:17:20 -04:00
Matthias Clasen
653749e4ae docs: Add some cross references
Refer to the new coordinate system overview
from a couple of places where it is useful.
2023-03-25 12:16:51 -04:00
Matthias Clasen
63ed2a13bf docs: Add a section about coordinate systems 2023-03-25 12:10:58 -04:00
Matthias Clasen
3f93a51146 Merge branch 'deprecate-translate-coordinates' into 'main'
Deprecate gtk_widget_translate_coordinates

Closes #5697

See merge request GNOME/gtk!5717
2023-03-25 14:33:14 +00:00
Matthias Clasen
78c8e58ee8 Drop gtk_widget_get_surface_allocation
This private api is confusing, and no longer used.
2023-03-25 10:14:35 -04:00
Matthias Clasen
cf03552b04 entrycompletion: Stop using gtk_widget_get_surface_allocation
We only need the width of the widgets' bounds
here anyway, so just use gtk_widget_compute_bounds.
2023-03-25 10:14:35 -04:00
Matthias Clasen
1a9c7a4b1f popover: Stop using gtk_widget_get_surface_allocation
The function is going away, and the computation
here was wrong anyway. Instead, add a helper that
properly computes the pointing-to rect in surface
coordinates and use it everywhere.
2023-03-25 10:14:35 -04:00
Matthias Clasen
b23ac5c8da Deprecate gtk_widget_translate_coordinates
Update all (non-deprecated) callers to use
gtk_widget_compute_point instead.

Fixes: #5697
2023-03-25 10:14:35 -04:00
Matthias Clasen
1ba5ea60cb Merge branch 'matthiasc/for-main' into 'main'
testsuite: Add some GL texture tests

See merge request GNOME/gtk!5715
2023-03-25 13:59:06 +00:00
Matthias Clasen
81e61b9abf Merge branch 'popover-bounds-trouble' into 'main'
textview: Give the magnifier correct coordinates

Closes #5695

See merge request GNOME/gtk!5716
2023-03-24 22:59:05 +00:00
Matthias Clasen
d2693ba66e magnifier: Correct position of area
The widget paintable uses the widgets bounds
as intrinsic size, so we need to offset from
that to the allocation, which is what the
coordinates are relative to.
2023-03-24 16:05:32 -04:00
Matthias Clasen
9db08c7a86 texthandle: Correct placement of handles
Text handles had the same problem as popovers.
They were interpreting their pointing-to rectangle
relative to the widgets bounds, when it is meant
to be relative to the widgtets allocation.

While we touch this code, rewrite it to use
gtk_widget_compute_point.
2023-03-24 16:05:05 -04:00
Matthias Clasen
fb3fe7a353 popover: Correct placement of popovers
When we don't have a pointing-to rectangle, we want to place
the popover wrt to the parents bounds. But if we have a
pointing-to rectangle, it is relative to the widgets allocation,
which is different from the bounds.

We were not handling the second case correctly, leading to context
menus in the text view being mispositioned by the widgets CSS padding.

While we are touching this code, rewrite it to handle transforms.

Fixes: #5695
2023-03-24 15:57:17 -04:00
Matthias Clasen
644b8a4214 testsuite: Add some GL texture tests
Tests creation and upload/download of GL
textures in various contexts.
2023-03-24 13:57:16 -04:00
Matthias Clasen
a8b92935d9 testsuite: Cosmetics 2023-03-24 13:57:16 -04:00
Matthias Clasen
c51387d62b Merge branch 'matthiasc/for-main' into 'main'
Fix up criticals from GdkGLTexture

See merge request GNOME/gtk!5712
2023-03-24 15:53:55 +00:00
Chun-wei Fan
d209f55677 Merge branch 'alternative-fix-5685' into 'main'
GDK/Win32: Use wgl* functions directly as needed (fix #5685)

Closes #5685

See merge request GNOME/gtk!5702
2023-03-24 15:30:01 +00:00
Matthias Clasen
5c558c0091 Fix up criticals from GdkGLTexture
I broke this in 4291f27b56.
I overlooked that there may not be a current context.
2023-03-24 11:29:38 -04:00
Matthias Clasen
a83f36f4f6 Merge branch 'matthiasc/for-main' into 'main'
docs: Some updates

See merge request GNOME/gtk!5711
2023-03-24 14:45:35 +00:00
Matthias Clasen
f0a2d77e0f docs: Improve markup for keys
Consistently use <kbd>x</kbd> to render keys in the docs
and use + for key combinations.
2023-03-24 10:30:07 -04:00
Matthias Clasen
ce983c9495 docs: Some updates
Fix some links ot point to docs.gtk.org.
2023-03-24 08:56:06 -04:00
Matthias Clasen
91b19854c4 inspector: Cosmetics 2023-03-24 08:17:51 -04:00
Chun-wei Fan
b5ebe270c3 gtkgstsink.c: Drop workarounds needed for Windows
Since we are making GdkGLContext call the core wgl*() functions directly
instead of via libepoxy, drop the workarounds that we needed for notifying
libepoxy that wglMakeCurrent() outside of GDK/GTK was called.

This way, we clean up the code, and as a result, we can use the GstGL
APIs like the other platforms to query what GL api that is to be used.

For ensuring that things work between different threads, we now call
gdk_gl_context_clear_current() in place of calling wglMakeCurrent(xxx,
NULL), so that we make sure that there is no current GL context on a
thread outside of GstGL's thread, which Windows does not like.
2023-03-24 18:50:49 +08:00
Chun-wei Fan
627ee674e5 GDK-Win32: Add wrapper functions for calling core wgl* functions
We might be dealing with GL contexts from different threads, which have more
gotchas when we are using libepoxy, so in case the function pointers for
these are invalidated by wglMakeCurrent() calls outside of GTK/GDK, such as
in GstGL, we want to use these functions that are directly linked to
opengl32.dll provided by the system/ICD, by linking to opengl32.lib.

This will ensure that we will indeed call the "correct" wgl* functions that
we need.

This should help fix issue #5685.
2023-03-24 18:43:23 +08:00
Benjamin Otte
a8b211ff15 Merge branch 'wip/otte/for-main' into 'main'
listview: Activatable means activate

See merge request GNOME/gtk!5709
2023-03-24 05:18:08 +00:00
Benjamin Otte
8c0152a1af columnview: Don't infloop when a cell is grab_focus()ed
Whoopsie.

Broken since 30d4629043.
2023-03-24 05:43:13 +01:00
Benjamin Otte
bbfaebd1cd listview: Activatable means activate
Fix a typo that prevented activatable widgets from activating since the
refactoring in 608be08b0d.
2023-03-24 05:43:13 +01:00
Matthias Clasen
65acf8500f Merge branch 'mipmap-tracking' into 'main'
gsk: Avoid copying GL texture in more cases

See merge request GNOME/gtk!5704
2023-03-24 03:43:21 +00:00
Matthias Clasen
22ea1af569 gsk: Avoid copying GL texture in more cases
When the GL texture already has a mipmap, we don't
have to download and reupload it to generate one.

We differentiate the handling for texture scale nodes,
where we do want to force the mipmap creation even if
it requires us to reupload the GL texture, and plain
texture nodes, where we just take advantage of a
preexisting mipmap to allow trilinear filtering for
downscaling, or create one if we have to upload the
texture anyway.
2023-03-23 23:17:54 -04:00
Matthias Clasen
7cb7e0ab35 gl: Add a private way to query mipmap status
Make GdkGLTexture determine if the texture has
a mipmap, and provide private API to query this
information.

This check is done in gdkgltexture.c instead of
gskgldriver.c, since we're already binding the
texture here for other reasons, so it is easy
to query a few more things.
2023-03-23 23:16:54 -04:00
Matthias Clasen
48491c6a04 Merge branch 'check-widget-on-destruction' into 'main'
gtkwidget: Do a type-check in gtk_widget_in_destruction()

See merge request GNOME/gtk!5708
2023-03-24 03:03:31 +00:00
Matthias Clasen
4291f27b56 gltexture: Try harder to determine the format
We can query these things as long as the texture ID
is valid in the current context.
2023-03-23 22:56:06 -04:00
Marco Trevisan (Treviño)
07197a299f gtkwidget: Do a type-check in gtk_widget_in_destruction()
Given it can be called during a widget destruction, it's safer to do a
type-check before crashing.

See: https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1727
2023-03-24 03:31:07 +01:00
Boyuan Yang
3dc0ee7483 Update Chinese (China) translation 2023-03-23 18:46:30 +00:00
Emmanuele Bassi
9f4013c5b4 Merge branch 'fix-a11y-leak2' into 'main'
Don't leak all AT contexts

Closes #5690

See merge request GNOME/gtk!5700
2023-03-23 11:07:18 +00:00
Benjamin Otte
4e9369585d Merge branch 'wip/otte/listview-cleanups' into 'main'
listview refactoring and new stuff

See merge request GNOME/gtk!5701
2023-03-23 05:38:29 +00:00
Benjamin Otte
30d4629043 columnview: Handle focus movement properly
- grab_focus() on a row (happens with scroll_to()) keeps the focus
  column intact if possible.
- <Tab> and <Shift-Tab> move through the cells in order, and move
  to the next row when at the end.
- <Up> an <Down> move to the next/prev row, keeping the same column
  focused.
- <Left> and <Right> move to the prev/next cell, if one is available.
  If not, they stay where they are.
2023-03-23 04:51:50 +01:00
Benjamin Otte
78e72ad1de columnview: add a (private) focus-column
Make setting the focus column scroll to it, too.
2023-03-23 04:51:20 +01:00
Benjamin Otte
8e17abb8fe columnviewrowwidget: Handle left/right arrow keys
Make it move focus just like GtkWindow would.

Otherwise the listview will (try to) handle it and move focus between
cells - which doesn't do anything for lists and only works with grids.
2023-03-23 04:45:03 +01:00
Benjamin Otte
fa7a5773d4 listbase: Only grab_focus() if the cursor moved
If there is no movement, grab_focus() on the already focused widget
just causes weird inconsistencies and we don't want those.
2023-03-23 04:45:03 +01:00
Benjamin Otte
7285830dfb columnviewrow: Handle focus movement properly
Handle backwards tab properly and deal with left right arrows.
2023-03-23 04:45:03 +01:00
Benjamin Otte
817732ded9 listitemwidget: Only take a single child 2023-03-23 04:45:03 +01:00
Benjamin Otte
3a6bfe9e9d columnviewrowwidget: Drop unneeded stuff
Also remove the GtkColumnListItemFactory and GtkColumnViewLayout
objects by folding them into GtkColumnViewRowWidget.
2023-03-23 04:45:03 +01:00
Benjamin Otte
bea7d5d318 columnview: Add GtkColumnViewRowWidget
This is a copy/paste of GtkListItemWidget for now.

Modifications will happen in future commits.
2023-03-23 04:45:03 +01:00
Benjamin Otte
608be08b0d listview: Add private GtkListFactoryWidget
This is a split of GtkListItemWidget into the generic parts of factory
using widgets.

On top of it there's GtkListItemWidget, which takes care of GtkListItem.
2023-03-23 04:45:03 +01:00
Benjamin Otte
107133ec6d listview: Move ::factory out of the item manager
It's a listitemwidget property, and the item manager manages the items,
not the widgets.
2023-03-23 04:45:03 +01:00
Benjamin Otte
4ecda13fbd listview: Move ::single-click-activate out of the item manager
It's a listitemwidget property, and the item manager manages the items,
not the widgets.
2023-03-23 04:45:03 +01:00
Benjamin Otte
ccacf80f47 listitemmanager: Create widgets via vfunc
We now have listitemmanager just create GtkListItemBase objects via
vfunc and use them.
2023-03-23 04:45:03 +01:00
Benjamin Otte
1f3a2734eb listitemwidget: split out GtkListItemBase
There's 2 reasons for this:

1. Adding a custom widget for columnview rows
2. Using this as base class for sections
2023-03-23 04:45:03 +01:00
Benjamin Otte
a18760a094 itemmananger: Remove the user data
Use the widget instead. They're the same anyway.
2023-03-23 04:45:03 +01:00
Benjamin Otte
e85270b051 listbase: Privatize 2 functions
They're not used outside of GtkListBase, so no use to have them in the
header.

Requires moving one function up in the source now that the forward
declaration is missing.
2023-03-23 04:45:03 +01:00
Benjamin Otte
27c01cfa49 listitemmanager: Clean up header
Remove all unused functions and an unused macro.
2023-03-23 04:45:03 +01:00
Matthias Clasen
7b22983be5 Don't leak all AT contexts
create_at_context was confused - it stored a reference
to the newly created context in priv->context, but then
also returned a reference, and the caller stored that
in priv->context again.

Change it to only return a reference.

Fixes: #5690
2023-03-22 23:41:40 -04:00
Matthias Clasen
57ec758d81 Merge branch 'texture-scale-test' into 'main'
gsk: Add a test for scaled textures

See merge request GNOME/gtk!5686
2023-03-23 02:42:28 +00:00
Bruce Cowan
2ab3610df8 Update British English translation
(cherry picked from commit d80cecec06)
2023-03-22 15:46:23 +00:00
Matthias Clasen
724ecf3b51 Merge branch 'ebassi/ensure-file-chooser-types' into 'main'
Ensure GtkFileChooserCell's type

See merge request GNOME/gtk!5696
2023-03-22 10:48:55 +00:00
Emmanuele Bassi
b2e8158c7a Ensure GtkFileChooserCell's type
Otherwise anything that dlopen()'s GTK will have a bad day.

See: https://discourse.gnome.org/t/strange-filechooserdialog-behaviour-in-gtk-4-10/14435
2023-03-22 10:29:57 +00:00
Matthias Clasen
9dcc1943b3 gsk: Improve slice handling
Upload slices in chunks, instead of copying
enormous amounts of memory.
2023-03-22 00:15:32 -04:00
Matthias Clasen
c3ee8d2699 gsk: Add more flexible texture upload
Add a command queue function to create a
GL texture by uploading several GdkTextures
at given positions.
This lets us 'piece together' textures.
2023-03-22 00:15:04 -04:00
Matthias Clasen
24720307bb gsk: Tweak one test to pass
Clip away the problematic corners in this
artificial texture scaling test. The GL renderer
has problems getting them perfect.
2023-03-22 00:15:04 -04:00
Matthias Clasen
50969d7923 gsk: Drop debug code 2023-03-22 00:15:04 -04:00
Matthias Clasen
5de8e9ec6e gsk: Drop some unused arguments
All callers of the slice apis pass 0 for
min_rows and min_cols. So just drop these.
2023-03-22 00:14:43 -04:00
Matthias Clasen
d1fc44d3a6 gsk: Use overlapping slices
Store texture coordinates for each slice
instead of assuming 0,0,1,1, and generate
overlapping slices to allow for proper mipmaps.

This almost fixes trilinear filtering with
sliced textures.
2023-03-22 00:14:43 -04:00
Matthias Clasen
61b9be1c1a gsk: Add a test for scaled textures
GL and cairo disagree on this one, and have forever.
Whee!
2023-03-22 00:14:16 -04:00
Matthias Clasen
8f73a7c690 gsk: Cosmetics 2023-03-22 00:14:16 -04:00
Matthias Clasen
c237957ef0 Merge branch 'matthiasc/for-main' into 'main'
a11y: Add a test for gtk_accessible_role_to_name

See merge request GNOME/gtk!5694
2023-03-22 00:24:52 +00:00
Matthias Clasen
d04690d05c a11y: Add a test for gtk_accessible_role_to_name
This should prevent !5693 from happening again
in the future.
2023-03-21 20:06:37 -04:00
Matthias Clasen
f8bfb5fec2 Merge branch 'fix_gtk_accessible_role_to_name_crash' into 'main'
fix crash with gtk_accessible_role_to_name and GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON

See merge request GNOME/gtk!5693
2023-03-21 18:05:50 +00:00
Caolán McNamara
2a78734aef fix crash with gtk_accessible_role_to_name and GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON
presumably since:

commit de80f503e4
Date:   Thu Feb 23 14:22:20 2023 +0100

    a11y: Introduce a dedicated role for toggle buttons
2023-03-21 15:04:12 +00:00
Benjamin Otte
ee6aae93d5 Merge branch 'wip/otte/for-main' into 'main'
checkbutton: Only andle arrow focus if we're in a group

See merge request GNOME/gtk!5692
2023-03-21 13:26:09 +00:00
Benjamin Otte
fb2a17a972 testsuite: Add a treelistmodel test
This one exhaustively tests reusing the same model as a child model for
many nodes.
This tracks that multiple items-changed signals emitted at the same time
(or multiple handlers for one such signal) doesn't put the treelistmodel
in an inconsistent state while it is handling all of them.

I'm not sure this (ab)use of treelistmodel should be officially
supported, but it works today, so let's test it to see if we can keep it
working.
2023-03-21 14:10:17 +01:00
Benjamin Otte
1c64438b12 checkbutton: Only andle arrow focus if we're in a group
If there is no other widget in the group that we can focus, don't focus
and activate ourselves.

Otherwise the arrow keys on checkbuttons toggle the checkbutton.
2023-03-21 14:10:17 +01:00
Matthias Clasen
634bea777f Merge branch 'disabled-picture-opacity-fix' into 'main'
theme: Use 0.5 opacity for disabled pictures

Closes #5683

See merge request GNOME/gtk!5689
2023-03-20 23:06:44 +00:00
Marco Trevisan (Treviño)
a2076dd537 theme: Use 0.5 opacity for disabled pictures
If a GtkImage is using an icon we use a gtk-icon-filter to se the icon
opacity when in insensitive state, however when using other kinds of
pictures we do not apply the same style leading to an inconsistent
result.

Closes: #5683
2023-03-20 23:46:08 +01:00
Matthias Clasen
75f9379cd5 Merge branch 'alatiera/fedora-bump' into 'main'
ci: Use Fedora 38 as the base

See merge request GNOME/gtk!5688
2023-03-20 14:39:15 +00:00
Jordan Petridis
f9b2d3104a vulkan: Update error codes enum 2023-03-20 16:16:30 +02:00
Jordan Petridis
679657cc0f ci: Use Fedora 38 as the base 2023-03-20 16:16:24 +02:00
Matthias Clasen
d712bdcd6d Merge branch 'bilelmoussaoui-main-patch-49195' into 'main'
g-i: Add since annotation to GdkSurfaceSize

See merge request GNOME/gtk!5687
2023-03-20 11:23:21 +00:00
Bilal Elmoussaoui
aa0cd3a553 g-i: Add since annotation to GdkSurfaceSize 2023-03-20 08:14:25 +00:00
Matthias Clasen
244d36d3f4 Merge branch 'mipmap-more' into 'main'
gsk: Use mipmaps when it is beneficial

See merge request GNOME/gtk!5685
2023-03-20 02:04:21 +00:00
Matthias Clasen
a19cf02b16 gsk: Use mipmaps when it is beneficial
If a texture node ends up getting scaled
down a lot, it helps to use trilinear filtering.
2023-03-19 21:45:30 -04:00
Benjamin Otte
56b904f1e6 Merge branch 'wip/otte/for-main' into 'main'
treelistmodel: Clear item in right place

Closes #5681

See merge request GNOME/gtk!5682
2023-03-19 17:07:53 +00:00
Benjamin Otte
dd1e76e601 treelistmodel: Clear item in right place
Items should be cleared when the node is discarded, not when the node's
children are discarded - which can also happen when a node is collapsed.

Fixes an error introduced in 9048e391b6

Fixes #5681
2023-03-19 17:38:38 +01:00
Matthias Clasen
e850dc81ba Merge branch 'texture-scale-tests' into 'main'
node-editor: Embed textures in testcases

See merge request GNOME/gtk!5681
2023-03-19 14:54:34 +00:00
Matthias Clasen
942c8eec73 ci: Make reports for all setups 2023-03-19 10:21:19 -04:00
Matthias Clasen
e7bb7785fa testsuite: Improve setup name consistency
Rename the 'waylandgles' test setup to 'wayland_gles'.
2023-03-19 10:19:00 -04:00
Matthias Clasen
9705ccbe2f ci: Run tests with small textures 2023-03-19 10:16:19 -04:00
Matthias Clasen
ace2122d45 testsuite: Add a test setup for slicing
Add a 'wayland_smalltexture' test setup that forces
the max texture size to be 1024, which lets us test
the texture slicing codepaths.
2023-03-19 10:15:22 -04:00
Matthias Clasen
80730a4014 testsuite: Add some texture tests
In constrast to our other tests, these use
textures that are big enough to force slicing
with setting GSK_MAX_TEXTURE_SIZE, which we
will use in the following commits to improve
test coverage.
2023-03-19 10:05:52 -04:00
Matthias Clasen
0a3eceb15d node-editor: Embed textures in testcases
It is useless to have node files with references
to external files in the testsuite, so turn such
textures into data urls by doing a serialization
roundtrip.
2023-03-19 10:04:46 -04:00
Benjamin Otte
f211a2177f Merge branch 'wip/otte/for-main' into 'main'
Fix inspector doing weird stuff

Closes #5646

See merge request GNOME/gtk!5678
2023-03-19 06:23:46 +00:00
Benjamin Otte
c463685286 treelistmodel: Clarify docs
No user knows that we have an internal function called
gtk_tree_list_row_destroy() that gets called when a row gets removed
from the treelistmodel.

So everyone was probably just making stuff up about what "destroy"
means.

Related: #5646
2023-03-19 06:55:05 +01:00
Benjamin Otte
bf55685000 treelistmodel: Track the item in the row
That way, we can return the item even after the row is removed. This is
particularly relevant in ListItemFactory::unbind callbacks because they
often use gtk_tree_list_row_get_item() and user code never tracks
changes to this property.

A side effect of this is that the item will survive until the row gets
destroyed, but that's what users expect anyway, so we can live with it.

Related: #5646
2023-03-19 06:55:05 +01:00
Benjamin Otte
9048e391b6 treelistmodel: Cache the item
This is a good idea to avoid reentrancy problems when any child model
(or potentially more than one child model) has started emitting
items-changed but the emission hasn't arrived in this model yet.

At tat point, we'd get_item() the wrong item from those models.

We want to avoid such cases of reentrancy.

Related: #5646
2023-03-19 06:55:05 +01:00
Benjamin Otte
f4be5c80c6 cssnode: Refer the correct previous item
We disconnect from old_previous, not from the new previous.

Related: #5646
2023-03-19 06:55:01 +01:00
Matthias Clasen
e8ea1b3c8b Merge branch 'wip/matthiasc/samplers' into 'main'
glrenderer: Handle filters differently

See merge request GNOME/gtk!5676
2023-03-19 01:54:57 +00:00
Benjamin Otte
17c877659c glrenderer: Support GL without samplers
We cheat and just set the texture parameters instead and hope nothing
explodes.
So far it didn't.

This is only needed to support GLES 2.0 so it's quite a limited set of
hardware these days.
2023-03-18 21:33:17 -04:00
Benjamin Otte
b5345b7f25 glrenderer: Handle filters differently
Instead of uploading a texture once per filter, ensure textures are
uploaded as little as possible and use samplers instead to switch
different filters.

Sometimes we have to reupload a texture unfortunately, when it is an
external one and we want to create mipmaps.
2023-03-18 21:33:17 -04:00
Matthias Clasen
b59d45c5c7 Merge branch 'docs-tweaks' into 'main'
dropdown: tweak the docs

See merge request GNOME/gtk!5677
2023-03-18 22:56:22 +00:00
Matthias Clasen
0fb5331c31 docs: Cosmetics 2023-03-18 10:25:58 -04:00
Matthias Clasen
9a7bf66ed4 docs: Tweaks
Tweak the wording in the list widget overview to
fix some typos and make things read more smoothly.
2023-03-18 10:25:58 -04:00
Matthias Clasen
628157e44e dropdown: tweak the docs
Add a link to the list widget overview.
2023-03-18 10:25:58 -04:00
Piotr Drąg
3f5e1589e2 Update POTFILES.in and POTFILES.skip 2023-03-18 12:32:00 +01:00
Matthias Clasen
be8a77171d Merge branch 'matthiasc/for-main' into 'main'
gsk: Drop texture subsetting

See merge request GNOME/gtk!5675
2023-03-18 04:25:25 +00:00
Matthias Clasen
d31ba5f551 gsk: Drop texture subsetting
We don't do this for unfiltered textures either,
and with working slicing, it isn't needed.
2023-03-18 00:10:38 -04:00
Matthias Clasen
fb6e432afb Merge branch 'matthiasc/for-main' into 'main'
Stop binding textdomain for -properties

See merge request GNOME/gtk!5674
2023-03-18 03:55:56 +00:00
Matthias Clasen
ee7c0ed1e8 Stop binding textdomain for -properties
We don't have these translations anymore.
2023-03-17 23:35:45 -04:00
Matthias Clasen
376f1053ec Merge branch 'fix-excessive-texture-uploads' into 'main'
gsk: Avoid reuploading textures too much

See merge request GNOME/gtk!5673
2023-03-18 02:47:04 +00:00
Matthias Clasen
8aa095c4d7 gsk: Avoid reuploading textures too much
When filtering changes for an already-cached
texture, we need to clear the render data
before setting the new one, otherwise it
does not take and we end up reuploading
the texture every frame.
2023-03-17 22:31:10 -04:00
Matthias Clasen
f96d041246 Merge branch 'matthiasc/for-main' into 'main'
gtk4-builder-tool: Localization fixes

See merge request GNOME/gtk!5672
2023-03-18 02:22:43 +00:00
Matthias Clasen
2dc17aeca9 gtk4-builder-tool: Localization fixes
Be consistent about marking strings for
translation. And make locatization actually
work by including gi18n-lib.h instead of gi18n.h.
2023-03-17 22:04:25 -04:00
Danial Behzadi
fda2010a9e Update Persian translation
(cherry picked from commit f55cbf5643)
2023-03-18 01:10:52 +00:00
Matthias Clasen
ac799542ee Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Reset properties when the image changes

See merge request GNOME/gtk!5671
2023-03-17 16:32:28 +00:00
Matthias Clasen
060ab606a2 gtk-demo: Reset properties when the image changes 2023-03-17 11:49:57 -04:00
Matthias Clasen
a1c02161ba Merge branch 'texture-scale-slicing' into 'main'
gsk: Be more careful when slicing

Closes #5664

See merge request GNOME/gtk!5667
2023-03-17 15:44:07 +00:00
Matthias Clasen
3877a2e533 gsk: Drop texture subsetting
We don't do this for unfiltered textures either,
and with working slicing, it isn't needed.
2023-03-17 11:25:38 -04:00
Matthias Clasen
158facc2ca Merge branch 'broadway-disconnect-fix' into 'main'
broadway: Don't cause traffic when disconnecting

See merge request GNOME/gtk!5670
2023-03-17 15:14:44 +00:00
Matthias Clasen
88dd6e630e broadway: Don't cause traffic when disconnecting
The recently added transient-for support was causing
roundtrips when a client with transients disconnects,
leading to assertion failures. Avoid that.
2023-03-17 11:00:35 -04:00
Matthias Clasen
8d839c96d9 Merge branch 'fix-broadway-docs' into 'main'
docs: Update broadway docs

Closes #5662

See merge request GNOME/gtk!5669
2023-03-17 13:17:19 +00:00
Matthias Clasen
31ec095ec7 docs: Update broadway docs
Using Broadway without broadwayd hasn't worked since 2013...

Fixes: #5662
2023-03-17 09:00:10 -04:00
Matthias Clasen
b14a134a46 gsk: Add slicing to texture scale nodes
This makes it possible to use large textures
with filtering.

Fixes: #5664
2023-03-17 00:51:05 -04:00
Matthias Clasen
f3b0aa27ea gsk: Be more careful when slicing
We can only reuse existing slices if they
have the right filtering.
2023-03-17 00:50:01 -04:00
Benjamin Otte
fe2b6dd246 Merge branch 'wip/otte/for-main' into 'main'
Various fixes

Closes #5669

See merge request GNOME/gtk!5665
2023-03-17 00:37:52 +00:00
Benjamin Otte
565c9aed94 Merge branch 'gridview-filler-tile-fix' into 'main'
gridview: Fix condition for adding filler tiles

See merge request GNOME/gtk!5664
2023-03-16 23:50:13 +00:00
Benjamin Otte
9a4decc30f gldriver: Quick workaround for filter mismatch
We should really use texture views or samplers to handle this case for
shared textures, but this at least makes NEAREST not break.
2023-03-17 00:43:21 +01:00
Benjamin Otte
036f5816ac listitem: Claim sequence when handling an event
See my rants on IRC for why we definitely need to claim gestures by
default in GTK5.

Fixes #5669
2023-03-16 22:45:11 +01:00
Алексей Шилин
65b6150e78 gridview: Fix condition for adding filler tiles
Code above ensures that i is always in [0, n_columns - 1] range, so
the condition was always true, which resulted in filler tile always
being added to the grid. As the result, an empty row appeared at the
end of the grid if the number of columns divided the number of items.

Only add filler tile if last row is not full, i.e. when i > 0.
2023-03-17 00:21:09 +03:00
Matthias Clasen
664e3b737a Merge branch 'fix_next_accessible_sibling_after_refcounts' into 'main'
a11y: Fix the logic in gtk_accessible_get_next_accessible_sibling which decided whether we will use the overridden sibling on the context.

See merge request GNOME/gtk!5659
2023-03-16 21:12:20 +00:00
Matthias Clasen
428a2707b5 Merge branch 'label-file-links' into 'main'
label: Use GtkFileLauncher for file URI

Closes #5671

See merge request GNOME/gtk!5661
2023-03-16 21:07:29 +00:00
Benjamin Otte
fbc8bfb303 Merge branch 'wip/otte/for-main' into 'main'
Various small fixes

Closes #5380

See merge request GNOME/gtk!5662
2023-03-16 20:59:17 +00:00
Benjamin Otte
a0382ef495 listview: Fix culling issues when using CSS padding
We were culling children based on the content box, but clipping via
overflow happens on the padding box, so we need to use that one instead.

Fixes issues with items not being visible / disappearing in Nautilus
when they are near the border.

Resolves #5380
2023-03-16 21:40:02 +01:00
Benjamin Otte
ef3c515cf1 rowstrides are gsize, not int
gdk-pixbuf got that wrong, don't repeat that mistake.
2023-03-16 21:40:02 +01:00
Benjamin Otte
707c63c6f9 win32: Fix rowstride math 2023-03-16 21:40:02 +01:00
Matthias Clasen
18f91df7d8 label: Use GtkFileLauncher for file URI
The GtkUriLauncher calls into the openuri portal, which distinguishes
between files, directories, and URI. The GtkFileLauncher contains logic
to deal with this, because it can already handle the file and folder
differences.

If we have a file:// URI it's easier to create a GFile out of it, and
use the GtkFileLauncher API, while leaving the GtkUriLauncher API for
every other URI scheme.

Same fix as de3c1d0c73, for GtkLabel.

Fixes: #5671
2023-03-16 16:06:49 -04:00
Matthias Clasen
cf332e2efa Merge branch 'ebassi/issue-5671' into 'main'
linkbutton: Use GtkFileLauncher for file URI

Closes #5671

See merge request GNOME/gtk!5658
2023-03-16 16:51:29 +00:00
Lukáš Tyrychtr
3addbe23f3 Always drop the reference of the ATContext 2023-03-16 17:15:08 +01:00
Lukáš Tyrychtr
771b7d6caa a11y: Fix the logic in gtk_accessible_get_next_accessible_sibling which
decided whether we will use the overridden sibling on the context.
2023-03-16 15:16:32 +01:00
Emmanuele Bassi
de3c1d0c73 linkbutton: Use GtkFileLauncher for file URI
The GtkUriLauncher calls into the openuri portal, which distinguishes
between files, directories, and URI. The GtkFileLauncher contains logic
to deal with this, because it can already handle the file and folder
differences.

If we have a file:// URI it's easier to create a GFile out of it, and
use the GtkFileLauncher API, while leaving the GtkUriLauncher API for
every other URI scheme.

Fixes: #5671
2023-03-16 12:22:21 +00:00
Guillaume Bernard
bb88f69b20 Update French translation
(cherry picked from commit 904e6a03a5)
2023-03-16 10:24:37 +00:00
Matthias Clasen
d72a6167ed Merge branch 'max-texture-size' into 'main'
gsk: Add a way to limit texture sizes

See merge request GNOME/gtk!5656
2023-03-16 03:03:41 +00:00
Benjamin Otte
fc83d263ab Merge branch 'drag-gl-wayland-hotspot-fix' into 'main'
wayland: Reset pending offset in GL path

See merge request GNOME/gtk!5657
2023-03-15 23:36:44 +00:00
Ivan Molodetskikh
54e36f6b73 wayland: Reset pending offset in GL path
Otherwise GL surfaces that redraw without changing the hotspot have it
applied on top every frame and quickly slide away.

The cairo path and the X11 backend do not have this bug.
2023-03-15 16:11:40 -07:00
Ivan Molodetskikh
8d96b12cc7 testdndresize: Add non-resizing redrawing GL surface
The GL Wayland drag surface code path has a bug where it does not reset
the hotspot, so if a GL-backed draw surface redraws without resizing or
resetting the hotspot, it moves away. The next commit will fix that, but
this commit adds a test for that.
2023-03-15 16:09:51 -07:00
Matthias Clasen
d1256648f4 gsk: Use linear filtering for sliced textures
We use linear for unsliced textures, so we need
to do the same for sliced ones.
2023-03-15 17:50:01 -04:00
Matthias Clasen
2322fecf3b gsk: Fix texture slicing
We were just returning NULL for slices
here, which wasn't the intention.
2023-03-15 15:45:01 -04:00
Matthias Clasen
2e2c41cef6 gsk: Fix handling of large textures
When the texture is too large, actually
shrink the size to max_texture_size.
2023-03-15 15:33:32 -04:00
Matthias Clasen
895d427c6a gsk: Add a way to limit texture sizes
Allow to set max texture size using the
GSK_MAX_TEXTURE_SIZE environment variable.

We only allow to lower the max (for obvious
reasons), and we don't allow values smaller
than 512 (since our atlases use that size).
2023-03-15 14:35:57 -04:00
Matthias Clasen
c2965aed35 Merge branch 'dragsurface-resize' into 'main'
Fix drag surfaces ignoring size updates on Wayland and X11

See merge request GNOME/gtk!5597
2023-03-15 02:59:19 +00:00
Ivan Molodetskikh
11d9bbfd6e x11/surface: Get current drag surface size with compute-size signal
Query and update size of drag surfaces, similarly to how it's done for
the Wayland backend in the previous commit.
2023-03-14 19:41:44 -07:00
Ivan Molodetskikh
f63fc91b0e wayland/dragsurface: Get current size with compute-size signal
GdkDragSurface-backed widgets are not parented to an existing widget,
unlike popovers, and like toplevels. This means that there's nobody to
actively call gdk_drag_surface_present() to update the size, and
GdkDragSurface should do it on its own, just like GdkToplevel.

This commit implements this for the Wayland backend.
2023-03-14 19:41:44 -07:00
Ivan Molodetskikh
e041646bfc dragicon: Handle compute-size
Compute our size when requested by the backend. This makes GtkDragIcons
actually recompute their size when it changes, instead of getting stuck
with the first size and potentially underallocating.
2023-03-14 19:41:44 -07:00
Ivan Molodetskikh
c3dde05d33 dragsurface: Add compute-size signal
Similarly to GdkToplevel, GdkDragSurface's compute-size should be called
by backends to query the current surface size, and should be connected
to by widget implementations (like GtkDragIcon) to report the current
size.

GdkDragSurface-backed widgets are not parented to an existing widget,
unlike popovers, and like toplevels. This means that there's nobody to
actively call gdk_drag_surface_present() to update the size, and
GdkDragSurface should do it on its own, just like GdkToplevel.
2023-03-14 19:41:44 -07:00
Matthias Clasen
45434d501c Add GdkDragSurfaceSize
This helper type will be used in the next commit for a new compute-size
request on GdkDragSurface. It is analogous in spirit to GdkToplevelSize.
2023-03-14 19:41:44 -07:00
Matthias Clasen
b74d483f01 Merge branch 'matthiasc/for-main' into 'main'
gl: Print max texture size in debug output

See merge request GNOME/gtk!5654
2023-03-15 02:32:37 +00:00
Ivan Molodetskikh
cd5af8c0d9 tests: Add resizing drag icon test
The test can verify that dynamic drag icon resizing and hotspot
adjustment work as intended.
2023-03-14 19:31:49 -07:00
Matthias Clasen
9a2cc79286 gl: Print max texture size in debug output
This is useful information.
2023-03-14 22:13:37 -04:00
Matthias Clasen
cc7d996a5c Merge branch 'add_visited_state' into 'main'
a11y: Add GTK_ACCESSIBLE_STATE_VISITED

See merge request GNOME/gtk!5616
2023-03-15 01:24:18 +00:00
Aleksandr Melman
79e7078949 Update Russian translation 2023-03-14 20:47:29 +00:00
Matthias Clasen
53cfbbbb65 Merge branch 'drop-gslice' into 'main'
Drop gslice

See merge request GNOME/gtk!5634
2023-03-14 19:22:28 +00:00
Matthias Clasen
bc592c92be inspector: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
6d380cdfb4 css: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
61d53b6402 tests: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
fe79c7db16 testsuite: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
bcb0882208 modules: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
a36123c802 gtk: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
9f88dba162 gsk: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
98ff6c0d4d gdk: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
15d73a1adb macos: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
6f93baf420 win32: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
5cca7488d4 x11: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
83d14bfa98 CODING-STYLE: Drop mention of g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
f0c076619d Merge branch 'wip/exalm/boxed-list' into 'main'
theme: Port .boxed-list style from libadwaita

See merge request GNOME/gtk!4806
2023-03-14 18:54:54 +00:00
Benjamin Otte
a05b73cb05 Merge branch 'wip/hadess/children-left-msg' into 'main'
gtk: Fix "children left" warning with fatal warnings

See merge request GNOME/gtk!5652
2023-03-14 16:31:44 +00:00
Alexander Mikhaylenko
b4dc7f29d4 theme: Port .boxed-list style from libadwaita
Consistently use it for boxed lists in inspector and gtk-demo.

Fixes issues like https://gitlab.gnome.org/GNOME/gtk/-/issues/3145
2023-03-14 20:16:51 +04:00
Bastien Nocera
4f1ea18c10 gtk: Fix "children left" warning with fatal warnings
When fatal warnings were turned on, the developer would never see which
widgets were left as children to the widget that triggered the warning as
those were printed in separate g_warning calls.

Print a single warning with all the info so runs with fatal warnings
aren't left without any info.
2023-03-14 16:45:59 +01:00
Matthias Clasen
7c60fb88b0 Merge branch 'matthiasc/for-main' into 'main'
Start 4.12 development

See merge request GNOME/gtk!5651
2023-03-14 15:33:20 +00:00
Matthias Clasen
93edb08094 Start 4.12 development 2023-03-14 11:16:30 -04:00
Martin
7a0e8f2b8b Update Slovenian translation 2023-03-14 12:43:31 +00:00
Matthias Clasen
7ed8c5b6c7 Post-release version bump 2023-03-14 08:16:30 -04:00
Matthias Clasen
d776ad789d 4.10.1 2023-03-14 07:50:49 -04:00
Daniel
86bbc13a61 Updated Spanish translation 2023-03-14 12:43:00 +01:00
Matthias Clasen
664ce48a4c Merge branch 'matthiasc/for-main' into 'main'
gsk: Mark mask nodes as 'supports transforms'

See merge request GNOME/gtk!5650
2023-03-14 05:30:17 +00:00
Matthias Clasen
42f1b623bf css: Small speedups 2023-03-14 01:14:57 -04:00
Matthias Clasen
6b7f0266ac icontheme: Silence a compiler warning 2023-03-14 01:14:57 -04:00
Matthias Clasen
ad84ee8352 tests: Add more tests for texture scale nodes 2023-03-14 01:14:57 -04:00
Matthias Clasen
c035384fc8 gsk: Mark mask nodes as 'supports transforms'
Just like blur nodes, the renderer can handle
these without creating an extra offscreen.
2023-03-14 01:14:57 -04:00
Matthias Clasen
7b1644b2d0 Merge branch 'fix-texture-scale-rotation' into 'main'
gtk4-demo: Polish the image scaling demo

See merge request GNOME/gtk!5649
2023-03-14 05:08:37 +00:00
Benjamin Otte
aaac380053 Merge branch 'bilelmoussaoui-main-patch-31679' into 'main'
GLTexture: Add GL_RGB format support

See merge request GNOME/gtk!5647
2023-03-14 05:03:13 +00:00
Matthias Clasen
dcc6cb8f1c gsk: Fix rotated texture scale nodes
This was causing us to render rotated texture scale
nodes to an unclipped offscreen, bringing 'giant
intermediate texture' problems back.
2023-03-14 05:36:08 +01:00
Matthias Clasen
0c1ec82a74 gtk4-demo: Add a tooltip to image scaling
Show some information about the values.
2023-03-14 05:36:08 +01:00
Matthias Clasen
3eb9afb0ca gtk4-demo: Polish the image scaling demo
Make the scale binding bidirectional again, fix up
the ranges and the sensitivity of the actions, and
add a mark for the unscaled position.
2023-03-14 05:36:08 +01:00
Jürgen Benvenuti
36037a2ee8 Update German translation 2023-03-13 18:30:32 +00:00
Bilal Elmoussaoui
23408f6dbf GLTexture: Add GL_RGB format support 2023-03-13 13:59:17 +00:00
Matthias Clasen
413abef01d Merge branch 'more-scaled-texture-fixes' into 'main'
Fix gtk_snapshot_append_scaled_texture

See merge request GNOME/gtk!5638
2023-03-13 08:58:58 +00:00
Matthias Clasen
4f8743a537 Merge branch 'matthiasc/for-main' into 'main'
gtk4-demo: Fix rotation handling in image scaling

See merge request GNOME/gtk!5643
2023-03-13 07:55:52 +00:00
Matthias Clasen
e24d4ba5db gtk4-demo: Use gtk_snapshot_append_scaled_texture 2023-03-13 08:54:13 +01:00
Matthias Clasen
118361a085 Fix gtk_snapshot_append_scaled_texture
This was doing the wrong thing with transforms.
2023-03-13 08:45:12 +01:00
Matthias Clasen
7bdb146473 docs: Details about texture scale nodes
Add some more details about filtering, to
clarify things a bit.
2023-03-13 08:38:58 +01:00
Matthias Clasen
517b4d584c gtk4-demo: Scale logarithmically in image scaling 2023-03-13 08:21:10 +01:00
Matthias Clasen
88d9244b98 gtk4-demo: Fix rotation handling in image scaling
We weren't sizing the widget correctly in rotated
cases.
2023-03-13 08:11:29 +01:00
Hugo Carvalho
fb4ae235a5 Update Portuguese translation 2023-03-13 00:06:26 +00:00
Fran Dieguez
b7c5c04c65 Update Galician translation 2023-03-12 23:19:49 +00:00
Aurimas Černius
bea38c1b4b Update Lithuanian translation 2023-03-12 20:01:39 +00:00
Alexander Shopov
d5a36a718f Update Bulgarian translation 2023-03-12 18:36:38 +00:00
Ask Hjorth Larsen
1c785f512f Updated Danish translation 2023-03-12 16:24:18 +01:00
Matthias Clasen
bc65b96e9c Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Add rotation to the scaling demo

Closes #5659

See merge request GNOME/gtk!5641
2023-03-12 10:20:04 +00:00
Asier Sarasua Garmendia
943851ab64 Update Basque translation 2023-03-12 09:35:14 +00:00
Matthias Clasen
352b8cb70e columnview: Be more defensive
I am not sure how we can have no listitem here,
but better to be safe than sorry.

Fixes: #5659
2023-03-12 08:25:58 +01:00
Matthias Clasen
dc50c790c5 gtk-demo: Add rotation to the scaling demo
Closing in on eog :)
2023-03-12 08:25:58 +01:00
Sabri Ünal
6dd273c3f1 Update Turkish translation 2023-03-11 16:03:32 +00:00
Anders Jonsson
bc397b047e Update Swedish translation 2023-03-11 15:47:38 +00:00
Piotr Drąg
80f3fe4031 Update Polish translation 2023-03-11 15:14:42 +01:00
Matthias Clasen
6f0976bace Merge branch 'matthiasc/for-main' into 'main'
inspector: Force a full redraw for debug nodes

See merge request GNOME/gtk!5640
2023-03-11 11:56:23 +00:00
Matthias Clasen
61ad0147bd inspector: Force a full redraw for debug nodes
Without this, debug nodes randomly are missing
in the tree, where we are reusing older render
nodes.
2023-03-11 12:43:38 +01:00
Matthias Clasen
582e74737c Merge branch 'matthiasc/for-main' into 'main'
themes: Avoid ':' in custom target names

Closes #5280

See merge request GNOME/gtk!5639
2023-03-11 10:21:13 +00:00
Matthias Clasen
aafe8f4b38 themes: Avoid ':' in custom target names
For whatever reason, meson decides to use custom
target names in the file system, and on Windows,
the ':' is causing trouble here. So avoid it.

Fixes: #5280
2023-03-11 11:03:43 +01:00
Marek Černocký
2d695b6dcc Update Czech translation 2023-03-11 08:52:49 +00:00
Ekaterine Papava
3a423749e2 Update Georgian translation 2023-03-11 05:39:09 +00:00
Benjamin Otte
97d53b1e86 Merge branch 'wip/otte/rendernode-export' into 'main'
rendernode: Register SVG serializer

See merge request GNOME/gtk!5637
2023-03-11 00:26:18 +00:00
Balázs Úr
50d7727881 Update Hungarian translation 2023-03-10 23:47:38 +00:00
Matthias Clasen
d564549f65 Merge branch 'wip/x11-create-destroy-without-show-show-hide' into 'main'
x11/surface: Clear compute_size idle source also when destroying

See merge request GNOME/gtk!5636
2023-03-10 23:40:50 +00:00
Matthias Clasen
bf1a5d99cf Merge branch 'cache-scaled-texture' into 'main'
gsk: Cache scaled texture

Closes #5642

See merge request GNOME/gtk!5633
2023-03-10 23:38:50 +00:00
Benjamin Otte
7c96003471 node-editor: Add more export options
Auto-detect tiff and svg and if those are chosen, save to that format.
2023-03-11 00:08:44 +01:00
Benjamin Otte
fc74eed425 rendernode: Register PNG serializer
This allows dropping or copy/pasting rendernodes into apps that accept
images.
2023-03-11 00:08:44 +01:00
Matthias Clasen
89d131de56 gtk4-demo: Add tooltips to the menu demo
Not great UI, but better than nothing.
2023-03-11 00:07:07 +01:00
Matthias Clasen
a35dc8dda6 Rename the menu demo
At this point, the Menu demo is more about scaling images
than about menus, so rename it to Image Scaling.
2023-03-11 00:03:05 +01:00
Benjamin Otte
0db9677b3a rendernode: Register SVG serializer
This allows dropping or copy/pasting rendernodes into apps that accept
SVGs.

Not sure how useful this is because we advertise text/plain from
rendernodes already and we prefer that.
2023-03-10 23:53:50 +01:00
Matthias Clasen
f00659d97f gtk-demo: Add a file chooser to the menu demo
So we can try this with bigger images.
2023-03-10 23:51:17 +01:00
Jonas Ådahl
f2a0a8b8be x11/surface: Clear compute_size idle source also when destroying
Doing it on hide() is not enough, since in some edge cases we didn't
ever actually map, we just attempted to compute the size, e.g. in
response to a ConfigureNotify event, then the window was destroyed.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2678
2023-03-10 23:34:50 +01:00
Matthias Clasen
0f02040292 gsk: Cache scaled texture
Keep the texture we create for texture scale nodes.

Fixes: #5642
2023-03-10 21:09:27 +01:00
Yuri Chornoivan
4014e956cd Update Ukrainian translation 2023-03-10 19:24:32 +00:00
Benjamin Otte
6029c006b3 Merge branch 'wip/otte/filefilter-name' into 'main'
filefilter: If not given a name, deduce one

See merge request GNOME/gtk!5630
2023-03-10 17:11:25 +00:00
Jiri Grönroos
9ca2289547 Update Finnish translation 2023-03-10 17:03:35 +00:00
Matthias Clasen
72454a7113 Merge branch 'reverse-file-chooser-recent-files-sort-order' into 'main'
filerchooser: Show Recent files in inverse order

See merge request GNOME/gtk!5625
2023-03-10 16:40:50 +00:00
Matthias Clasen
e3dc282cc1 Merge branch 'wip/otte/listview-border-spacing' into 'main'
Implement CSS border-spacing support for listview and gridview

See merge request GNOME/gtk!5626
2023-03-10 16:39:05 +00:00
Matthias Clasen
5f24218123 Merge branch 'file-chooser-selectability2' into 'main'
file system model: Store selectability

See merge request GNOME/gtk!5582
2023-03-10 16:37:41 +00:00
Matthias Clasen
feebd68dd3 Merge branch 'notify_after_value_change' into 'main'
a11y: Notify assistive technologies when a GTK_ACCESSIBLE_PROPERTY_VALUE_NOW changes on a widget

See merge request GNOME/gtk!5624
2023-03-10 16:36:41 +00:00
Lukáš Tyrychtr
acf3f6beda a11y: Notify assistive technologies when a GTK_ACCESSIBLE_PROPERTY_VALUE_NOW changes on a widget
This fixes silent sliders and similar controls when their value is changed.
2023-03-10 16:36:39 +00:00
Benjamin Otte
5c9fb3a636 filefilter: If not given a name, deduce one
Otherwise we end up with a critical when cosntructing the GVariant and
the portal claims our filter is for "[Invalid UTF-8]".

Test included
2023-03-10 17:10:30 +01:00
Benjamin Otte
6a874e6887 gridview: Add border-spacing support
omg, this is complicated code.
2023-03-10 17:03:33 +01:00
Benjamin Otte
4b73be18c7 gridview: Introduce column size functions
This is in preparation for border-spacing integration.
2023-03-10 17:03:33 +01:00
Benjamin Otte
670cf6201d gridview: Use gtk_list_item_manager_get_nearest_tile()
Simplifies gtk_grid_view_get_position_from_allocation() a bit because we
can omit the bounds shenanigan.
2023-03-10 17:03:33 +01:00
Benjamin Otte
196372f124 listview: Support CSS border-spacing
Hopefully the code can deal with gaps between the tiles.

We use gtk_list_item_manager_get_nearest_tile() when necessary.
2023-03-10 17:03:21 +01:00
Matthias Clasen
310662516b filechooser: Set selectability for list items
We propagate this from the list items to the
GtkListItems. Twisty!
2023-03-10 15:40:43 +01:00
Matthias Clasen
70b430edff filechooser: Dim non-selectable items 2023-03-10 15:40:43 +01:00
Matthias Clasen
c8a720aaa5 columview: Propagate activatable and selectable
When any of the cells is not activatable or selectable,
make the row not have those properties either.
2023-03-10 15:40:43 +01:00
Matthias Clasen
85d6f39ac7 filechooser: Inform the model about selectability
In folder modes, we don't want to select files.
2023-03-10 15:40:43 +01:00
Matthias Clasen
a916e00dac filesystemmodel: Store selectability
This will be used later on.
2023-03-10 15:40:40 +01:00
Matthias Clasen
913798b1d0 Merge branch 'file-chooser-selection' into 'main'
filechooser: Don't automatically select a file

See merge request GNOME/gtk!5572
2023-03-10 14:25:36 +00:00
Fabio Tomat
70fe37cf1b Update Friulian translation 2023-03-10 07:49:25 +00:00
Benjamin Otte
5583fa60c1 listitemmanager: Add gtk_list_item_manager_get_nearest_tile()
... and make the tile finding code use distance.

This also changes how gtk_list_item_manager_get_tile_at() finds the
right tile, so this is a custom commit for bisectability.

gtk_list_item_manager_get_nearest_tile() isn't used yet.
2023-03-10 05:35:17 +01:00
Benjamin Otte
97e3c65251 listview: Move bounds check into base class
This way, listview and gridview don't need to check if the rect is out
of bounds and nothing is selected, a quick rectangle_intersect() does
the job for them.
2023-03-10 05:26:28 +01:00
Benjamin Otte
334ca12d78 listview: Return an allocation for unallcoated items
Just get the position right and give them a height of 0px, that should
be good enough.

If we don't do that, code will think the item doesn't exist, which is
not what we want.
2023-03-10 05:26:28 +01:00
Ray Strode
442fa8d972 filerchooser: Show Recent files in inverse order
When looking at Recent files in the file chooser, it makes more
sense to show the recent files on top.

This commit flips the sort order for that case.
2023-03-09 15:42:16 -05:00
Matthias Clasen
12858114a2 Merge branch 'more-size-allocation-fixes' into 'main'
widget: Skip popovers in allocation

See merge request GNOME/gtk!5615
2023-03-08 22:26:51 +00:00
Matthias Clasen
4f6133e00a Merge branch 'wip/chergert/fix-const-preserving-text-iter-order' into 'main'
textlinedisplaycache: fix const-preserving gtk_text_iter_order()

See merge request GNOME/gtk!5620
2023-03-08 22:06:04 +00:00
Matthias Clasen
9ca3a52bf0 Merge branch 'file_chooser_stuff' into 'main'
filechooser: two small changes

See merge request GNOME/gtk!5619
2023-03-08 21:57:13 +00:00
Christian Hergert
40d99839d6 textlinedisplaycache: fix const-preserving gtk_text_iter_order() 2023-03-08 13:00:08 -08:00
Barnabás Pőcze
111e8d2808 filechooser: Do not look up parents of directories
If the `GtkRecentInfo` represents a directory, simply use it, and
do not try to find its parent in `_gtk_file_chooser_extract_recent_folders()`.

For example, there is an entry in my recently-used database
from the Amberol music player about the folder I have opened
with it, but the folder is not listed on the "Recent" tab of
the file chooser widget, only its parent. After this change,
the directory itself is shown.
2023-03-08 20:46:17 +01:00
Barnabás Pőcze
9b0b3029a6 filechooser: Use gtk_recent_info_is_local() for filtering
There is already a function for determining if URI
has the "file" scheme, so use that.
2023-03-08 20:04:41 +01:00
Matthias Clasen
f743b95161 Merge branch 'ebassi/issue-5650' into 'main'
Filter recently used files in the file chooser

Closes #5650

See merge request GNOME/gtk!5618
2023-03-08 18:45:10 +00:00
Matthias Clasen
bdd35c1695 Merge branch 'fix-msvc-older-glib' into 'main'
modules/media: Fix Visual Studio builds with older GLib (<= 2.74.x)

See merge request GNOME/gtk!5605
2023-03-08 18:44:46 +00:00
Matthias Clasen
2f273ba76a widget: Skip popovers in allocation
Native widgets get allocated via their surface,
so can skip them here. This avoids criticals when
re-mapping a popover for the second time, as can
be seen e.g. in the 'Selections' demo in gtk4-demo.
2023-03-08 13:40:51 -05:00
Matthias Clasen
a2d14632de widget: Stop propagating alloc_needed beyond popovers
This should not be necessary, since popovers get
their new size from present_popup via the compositor.
2023-03-08 13:40:48 -05:00
Benjamin Otte
7a3e130efd widget: Remove goto usage in widget_allocate() 2023-03-08 13:40:37 -05:00
Benjamin Otte
c8d356a250 widget: Split out gtk_widget_ensure_allocate_on_children()
allocate() should not be calling into ensure_allocate(), they do a similar job.
In the end, the code does the same work, but it should be easier to follow now.
2023-03-08 13:40:31 -05:00
Matthias Clasen
ffb7177c2e widget: Simplify size allocation
Don't call ensure_allocate if we've just
done size_allocate. This makes criticals
from reshowing popovers go away.
2023-03-08 13:39:54 -05:00
Emmanuele Bassi
8b2202cd56 Filter recently used files in the file chooser
Since it's a file selection widget, we should only list recently used
files that point to a file.

Fixes: #5650
2023-03-08 18:08:24 +00:00
Matthias Clasen
14a5c78d80 Merge branch 'wip/carlosg/reuse-search-engine' into 'main'
gtkfilechooser: Keep GtkSearchEngine around for longer

See merge request GNOME/gtk!5617
2023-03-08 12:58:43 +00:00
Carlos Garnacho
5fd2a6c8f3 gtkfilechooser: Keep GtkSearchEngine around for longer
Currently the GtkSearchEngine is torn down every time the search
is stopped, which also means between typed characters. This
prevents any of the optimizations that the GtkSearchEngine can
do in the long run.

Let the GtkSearchEngine stay around for longer, and only be
disposed after search is cancelled, the filechooser moves
onto a different mode than search, or is otherwise unmapped/disposed.

While at it, remove an unused struct field.
2023-03-08 13:23:56 +01:00
Matthias Clasen
6cb6f4a50f Merge branch 'wip/carlosg/recursive-file-search' into 'main'
searchengine: Improve performance for recursive search

Closes #4133

See merge request GNOME/gtk!5611
2023-03-08 11:56:41 +00:00
Carlos Garnacho
7b909fb310 searchengine: Do not fight filechooser search mode sorting
Provide the hits in an order that is more easily consumed by the
filechooser, and less jarring when populating.
2023-03-08 11:33:10 +01:00
Carlos Garnacho
d12bea03d2 searchengine: Bail out on the first character
Again on massive filesystems, the very first character
is likely to bring a likewise massive amount of search
results that we need to maybe query info for, then create
icons and widgets for. While it's impressive we can do
that, it's also expensive and likely pointless, for the
first character.

Typing a second character is however very likely to
considerably reduce the amount of items to categorize and
show. So start actually searching from there.

Testing on a filesystem with 1434099 files indexed, trying 5
semi-random 1 character searches (n, h, t, i, o) returns on
average 168K items (min. 78771, max. 331471), trying 5
semi-random 2 character searches (no, he, th, in, on)
returns on average 34K items (min. 11133, max. 94961),
which is a more approachable set.

Doing this is enough that typing on a filechooser search
entry feels completely fluid.
2023-03-08 11:33:10 +01:00
Carlos Garnacho
deacc63d54 searchengine: Ensure some GFileInfo fields
The search provider should make it sure there are some
specific GFileInfo fields set. Fix the mimetype extraction
from the query, and use that to fill in the missing gaps
the best we can.
2023-03-08 11:33:10 +01:00
Carlos Garnacho
ead121a3c1 searchengine: Drop non-recursive search
Recursive search seems to be the hardcoded default, go with it.
2023-03-08 11:33:10 +01:00
Carlos Garnacho
de4725dbd5 searchengine: Populate filesystem model in an idle
When starting a search over a very populated filesystem, it
is possible that typing the first chars will return a too
high number of results. Even though iterating through the
cursor is in itself very fast, extracting the GIO information
from those many files at once is not going to be as fast.

In order to increase interactivity (i.e. not make things
possibly sluggish) iterate the cursor in an idle function
and add search results to the filechooser model little by little.

If the user keeps typing (as it is likely will happen), there
will be better chances to cancel and proceed to the next
query timely. If not, the results will be there soon enough.
2023-03-08 11:32:44 +01:00
Lukáš Tyrychtr
662f35562b GtkLinkButton: Set the visited state when appropriate 2023-03-08 09:24:35 +01:00
Lukáš Tyrychtr
9517d3d135 a11y: Add GTK_ACCESSIBLE_STATE_VISITED
This state is used for visited link-like widgets.
It has no ARIA equivalent, e. g. can not be set programmatically, but it
exists in the browser environment as well.
2023-03-08 09:24:08 +01:00
Matthias Clasen
7f5504523f Merge branch 'check_null_gfile_location' into 'main'
filechooser: Fix memory leaks

See merge request GNOME/gtk!5610
2023-03-08 03:19:00 +00:00
Matthias Clasen
40b154bf28 Merge branch 'matthiasc/for-main' into 'main'
build: Handle introspection a bit better

See merge request GNOME/gtk!5614
2023-03-08 03:02:16 +00:00
Barnabás Pőcze
f0e4293b83 filechooser: Fix memory leaks
The returned strings from `file_chooser_get_location()` were never freed.
2023-03-08 03:59:10 +01:00
Matthias Clasen
87f820287a build: Handle introspection a bit better
Error out if introspection is requested,
but g-ir-scanner isn't found.

And if introspection isn't explicitly disabled
but is required for building the docs, build it.
2023-03-07 21:49:24 -05:00
Matthias Clasen
30586d75ac Merge branch 'matthiasc/for-main' into 'main'
filechooser: Handle pathless files

See merge request GNOME/gtk!5613
2023-03-08 02:31:19 +00:00
Matthias Clasen
7a1573a381 Merge branch 'expose_checkable_state' into 'main'
a11y: When an accessible has GTK_STATE_CHECKED, set its ATSPI_STATE_CHECKABLE as well

See merge request GNOME/gtk!5602
2023-03-08 02:07:39 +00:00
Matthias Clasen
bc42955a13 filechooser: Handle pathless files
g_file_get_path() can return NULL. Make our
getter for file locations handle that case.

Related: !5610
2023-03-07 20:54:31 -05:00
Matthias Clasen
cdc008763b Merge branch 'matthiasc/for-main' into 'main'
wayland: Don't crash during DND with Cairo renderer

See merge request GNOME/gtk!5612
2023-03-08 01:46:43 +00:00
Benjamin Otte
7fff188557 wayland: Don't crash during DND with Cairo renderer
Attaching buffers with offsets is forbidden now and nobody
checked the Cairo renderer.
2023-03-07 20:16:59 -05:00
Benjamin Otte
69238c1197 text: Don't crash when somebody drops NULL 2023-03-07 20:16:59 -05:00
Emmanuele Bassi
574380c744 Merge branch 'wroy-main-patch-03255' into 'main'
MSBuild: Fix gnome.compile_resources current source directory

See merge request GNOME/gtk!5609
2023-03-07 23:48:25 +00:00
Emmanuele Bassi
d1fc1adae7 Apply suggestion to use '/' over join_paths 2023-03-07 22:40:17 +00:00
Carlos Garnacho
64697ea95b searchengine: Improve performance for recursive search
As fancy as property paths are, recursive resolution of files
to a location increases the big O complexity enough that it's
not a great option on large homedirs with many indexed files.

Ensure the files are from the right location through a URI
prefix match, which does hits an index. This may dramatically
improve performance on large indexed trees.

Testing this query in an isolated testcase with a total
1434099 indexed files shows that it can run more than 1500 times
per second in this computer (an average of 15200 queries in
several 10 second runs), which presumably is a tad faster than
anyone can type.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4133
2023-03-07 23:18:46 +01:00
William Roy
aaeec84d75 Fix compile_resources present source directory
In certain scenarios, address the issue where gnome.compile_resources 
fails to transmit the present source directory. This is most notably 
visible with MSBuild.
2023-03-07 21:59:50 +00:00
Matthias Clasen
5822ba76d0 Merge branch 'unbreak-combobox' into 'main'
combobox: Avoid extra queue_resize()

Closes #5644

See merge request GNOME/gtk!5608
2023-03-07 19:10:51 +00:00
Ask Hjorth Larsen
a6ad8ebe0c Updated Danish translation 2023-03-07 20:02:40 +01:00
Ivan Molodetskikh
55faea1046 combobox: Avoid extra queue_resize()
width-request already ensures it's above the minimum width, so avoid an
extra queue_resize() when setting size request to (-1, -1).

This is the same way as GtkDropDown works. This also unbreaks
GtkComboBox after the recent allocation fix in
75a417e337.

Incidentally, this also makes GtkComboBox actually resize its popup as
intended (that was broken before).

I don't think this is ultimately the final fix, sometimes I still get
allocation warnings. But the proper fix will probably involve changing
some more allocation machinery around popovers. This is good enough for
now.
2023-03-07 09:55:30 -08:00
Matthias Clasen
21ee81823e Merge branch 'window-signals' into 'main'
window: Disconnect the ::compute-size handler

See merge request GNOME/gtk!5606
2023-03-07 13:15:21 +00:00
Matthias Clasen
9efd8ef201 window: Disconnect the ::compute-size handler
All the other signal handlers are connected in
realize and disconnected in unrealize, but the
::compute-size handler was forgotten.

This was notices in !5597.
2023-03-07 06:40:25 -05:00
Chun-wei Fan
432e8664e1 modules/media: Fix Visual Studio builds with older GLib
The current definitions of the g_io_module_*() symbols do not build on
Visual Studio when building against GLib earlier than 2.75.0 due to the
way how these symbols are decorated in the GLib headers, as Visual Studio
does not allow symbols that were previously marked with 'extern' (or so)
to be marked with anything that is symantically different later.

As a result, if we are using Visual Studio and glib-2.74.x or earlier,
override _GLIB_EXTERN as appropriate in the modules/media sources before
including the GIO headers.  This sadly, means that we need a
configure-time check as it would have been too late if we checked the
GLib version using G_VERSION_CHECK macro, as the GIO headers would have
been included already.

There are similar items in the print backends, but we will not attempt
to update these files as they are not meant to be built for Windows.
2023-03-07 15:36:42 +08:00
Matthias Clasen
6d2c5e51e0 Merge branch 'expose_landmark_role' into 'main'
a11y: Expose GTK_ACCESSIBLE_ROLE_LANDMARK to AtSPI2

See merge request GNOME/gtk!5601
2023-03-06 17:49:05 +00:00
Lukáš Tyrychtr
b669295fd8 a11y: When an accessible has GTK_STATE_CHECKED, set its ATSPI_STATE_CHECKABLE as well
This allows, for example, checkable list itemss.
2023-03-06 17:15:54 +01:00
Lukáš Tyrychtr
96e6332d28 a11y: Expose GTK_ACCESSIBLE_ROLE_LANDMARK to AtSPI2 2023-03-06 16:45:19 +01:00
Marek Černocký
59549d0665 Update Czech translation 2023-03-06 11:57:22 +00:00
Emmanuele Bassi
3e3158ce12 Merge branch 'wip/exalm/template' into 'main'
widget: Use the correct template in dispose_template()

See merge request GNOME/gtk!5600
2023-03-06 11:00:04 +00:00
Matthias Clasen
cfc2de4e3d Merge branch 'main' into 'main'
removed duplicate function call

See merge request GNOME/gtk!5545
2023-03-06 05:52:00 +00:00
Matthias Clasen
343852af7b Merge branch 'matthiasc/for-main' into 'main'
macos: Fix type func generation

See merge request GNOME/gtk!5596
2023-03-06 05:50:36 +00:00
Matthias Clasen
51902bbce8 Merge branch 'wip/fix-wl-destruct-order' into 'main'
wayland: Destroy xdg_surface after role

See merge request GNOME/gtk!5598
2023-03-06 05:08:44 +00:00
Alexander Mikhaylenko
9b3fb66bd4 widget: Use the correct template in dispose_template()
In derivable classes, the widget's class can be different from the one
dispose_template() was called for, which can lead to failing the
template != NULL check at best, undefined behavior at worst.

Since we already pass the correct GType into the function, just use that
instead.
2023-03-06 05:37:53 +04:00
Benjamin Otte
3ccf63b3c0 Merge branch 'wip/otte/for-main' into 'main'
inspector: Make really sure we don't inspect ourselves

See merge request GNOME/gtk!5599
2023-03-05 23:49:15 +00:00
Benjamin Otte
4655226907 inspector: Make really sure we don't inspect ourselves
The problem here is that new windows appear in the list before the
window's dispay gets set and we don't update the filter when the
display changes (would need watches support for the filtermodel).

So add this somewhat hacky method.
2023-03-06 00:13:53 +01:00
Jonas Ådahl
4500fa633b wayland: Destroy xdg_surface after role
The split-up of gdksurface-wayland.c introduced a protocol violation
when it didn't make sure xdg_surface was destroyed after the role
objects (xdg_popup / xdg_toplevel). Fix that.

Fixes: 2a463baed0 ("wayland: Rearrange the surface code")
2023-03-05 20:55:41 +01:00
Matthias Clasen
be11202538 macos: Fix type func generation
We were checking for gdk_quartz even though
the sysbols are now all called gdk_macos. Oops.
2023-03-05 10:17:52 -08:00
Benjamin Otte
0fa1e71ef0 Merge branch 'wip/otte/for-main' into 'main'
cssnode: Don't crash the inspector

See merge request GNOME/gtk!5595
2023-03-05 17:53:18 +00:00
Benjamin Otte
987b9cec3f testsuite: Add tests for the unknown enums
See commit 40e7a265a7
2023-03-05 18:35:02 +01:00
Benjamin Otte
a77beb39a1 testsuite: Add empty test for new node 2023-03-05 18:33:37 +01:00
Benjamin Otte
ac8e053ab6 cssnode: Don't crash the inspector
Don't misinform the observing listmodel that CSS nodes were removed that
weren't actually removed, but just moved. Otherwise the observer would
think it has run out of items when it really hasn't.
2023-03-05 18:33:37 +01:00
Matthias Clasen
986275239f Merge branch 'matthiasc/for-main' into 'main'
meson: Mention testsuite in summary

See merge request GNOME/gtk!5594
2023-03-05 16:51:23 +00:00
Matthias Clasen
2ee1273244 meson: Mention testsuite in summary
This was broken out from the 'tests' toggle,
so list it separately.
2023-03-05 08:10:12 -08:00
Matthias Clasen
248027a366 Merge branch 'expose_error_message_relation' into 'main'
a11y: Expose GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE to AtSPI2

See merge request GNOME/gtk!5588
2023-03-05 16:08:38 +00:00
Benjamin Otte
c823432eef Merge branch 'wip/otte/listview2' into 'main'
listview: GtkListTile

See merge request GNOME/gtk!5584
2023-03-05 15:53:43 +00:00
Matthias Clasen
98ac2de649 Merge branch 'matthiasc/for-main' into 'main'
ci: Disable the testsuite in flatpak builds

See merge request GNOME/gtk!5593
2023-03-05 15:46:13 +00:00
Matthias Clasen
1cee54009a ci: Disable the testsuite in flatpak builds
No need to build the testsuite when we are
just producing flatpaks.
2023-03-05 07:26:17 -08:00
Benjamin Otte
80b7c60150 listbase: Remove nonexisting function from header 2023-03-05 15:23:20 +00:00
Benjamin Otte
e8c5a771e5 gridview: Add a filler tile for empty space
That stupid space in the bottom right when n_items isn't a multiple of
n_columns needs its own tile, or we'll get errors about not finding a
tile.

So make one.
2023-03-05 15:23:20 +00:00
Benjamin Otte
882dcda53b columnview: Clear the sorter first thing in dispose
Otherwise, when removing the columns, each column will trigger a
sorter::changed signal emission.

And because sorters are often still connected to a sortlistmodel, we
can't skip that emission and need to do it.
But we only need to do it once.
2023-03-05 15:23:20 +00:00
Benjamin Otte
b488fae893 listview: Handle emptying of views
The previous check does not longer work.

When a model gets all items deleted, there will still be existing tiles
until the next time garbage collection is run.
So do that before checking if the list is empty.
2023-03-05 15:23:20 +00:00
Benjamin Otte
b962defc11 listview: Remove an unused member variable
It's only used in the allocate function, so make it a local varaible
there.
2023-03-05 15:23:20 +00:00
Benjamin Otte
9ee0696923 listview: Simplify a vfunc
Instead of making it 2 vfuncs for getting horizontal and vertical area,
make it one vfunc to get the area.

Also rewrite the implementations to use the tile's area instead of
trying to deduce things with fancy math.
2023-03-05 15:23:20 +00:00
Benjamin Otte
f3c53ae69d listview: Simplify allocation
With the Tile changes, a lot of stuff does no longer need to be
duplicated between listview and gridview. Move it to ListBase instead.
2023-03-05 15:23:20 +00:00
Benjamin Otte
8aea6fc1b5 gridview: Remove an unused member variable
It's only used during size_allocate(), so make it a local variable
there.
2023-03-05 15:23:20 +00:00
Benjamin Otte
d949afb80e listitemmanager: Add a split vfunc and use it
Instead of randomly changing tiles, the listitemmanager gains a split
vfunc that listview and gridview implement so they can keep their tile
areas intact. The listitemmanager will now conform to these rules:

1. Never delete a tile.
   This ensures that all areas stay intact.

2. Never change the n_items of a tile other than setting them to 0.
   This causes "empty" areas to appear, but listview/gridview can
   easily check for them by checking for tile->n_items == 0.
   gtk_list_tile_gc() will get rid of them.

3. Adding items always creates new tiles that are added with empty area.
   That way they don't interrupt any existing machinery until the next
   allocation.

4. Adding/removing widgets has no effect on areas
   This is useful in particular when scrolling where new widgets are
   moving between tiles. When the manager moves the widgets, it may
   split some areas, but will not remove any existing tiles, so the
   whole area stays intact and the list can deal with further scroll
   events before an allocation.

This improve the situation for #3334
2023-03-05 15:23:20 +00:00
Benjamin Otte
08c583b1b3 listview: Add gc'ing
This is in preparation for the following reorg of the listitemmanager,
it should not have any effect now.
2023-03-05 15:23:20 +00:00
Benjamin Otte
1c663cb340 listitemmanager: Remove unused functionality
Both ListView and GridView use GtkListTile now, so no need anymore for
custom machinery.
2023-03-05 15:23:20 +00:00
Benjamin Otte
776910d03d gridview: Redo tile management
Instead of the custom size property, use the new tile size.

Also introduce the ability to split tiles, so that gridview can split a
layout that would look like (question mark denoting cells without a
widget, which in this case would be a single tile)

█ █ █ ? ?
? ? ? ? ?
? ? ? ? ?
? ? ?

into 3 rectangular tiles like so:

█ █ █ A A
B B B B B
B B B B B
C C C

This of course also means we need to be able to merge those tiles again
when cells got added/deleted or the gridview was resized. For that job,
gtk_list_tile_gc() exists now, which removes tiles without items and
merges adjacent tiles without widgets.
2023-03-05 15:23:20 +00:00
Benjamin Otte
c82b2d86c0 listview: Get rid of ListRow and its height
Use the tiles' area instead.
2023-03-05 15:23:20 +00:00
Benjamin Otte
3ca4acdc1a list: Allow storing size in the ListTile
... and use it to handle ListView allocations.

Nothing spectacular, just proof of concept.

The code introduces the idea that every tile stores its area (others
would call it "allocation", but I avoided that because tiles aren't
widgets). This should allow moving lots of code into gtklistbase.c and
not require special handling inside ListView and GridView.

And that in turn hopefully makes it easier to add more features (like
sections and so on.)
2023-03-05 15:23:20 +00:00
Benjamin Otte
c705dba2ee list: Make GtkListTile more prominent
* Instead of using a gpointer to refer to it, use the GtkListTile type.

* Use gtk_list_tile_get_foo() instead of
  gtk_list_item_manager_get_tile_foo() naming.
2023-03-05 15:23:20 +00:00
Benjamin Otte
55ad241f43 list: Rename GtkListItemManagerItem => GtkListTile
That's a good description for what the job of those elements is:
They're a tile in the lists scrollable area.
2023-03-05 15:23:20 +00:00
Benjamin Otte
d3efd80b90 rendernodepaintable: Allow the node to be NULL
This can happen when creating paintables from GtkSnapshot when nothing
was drawn.
2023-03-05 15:23:20 +00:00
Jordi Mas
a899c0af6e Update Catalan translation 2023-03-05 09:44:49 +01:00
Matthias Clasen
f8fb30b555 Post-release version bump 2023-03-04 13:47:37 -08:00
Matthias Clasen
47aa0dcc7f 4.10.0 2023-03-04 08:28:12 -08:00
Emmanuele Bassi
32f0723bf0 Merge branch 'ebassi/file-info-attributes' into 'main'
Check for attributes being available before querying them

See merge request GNOME/gtk!5592
2023-03-04 16:04:04 +00:00
Matthias Clasen
90a3584c1d Merge branch 'wip/otte/dont-scale-or-it-breaks' into 'main'
Add a test for lots of texture scaling and fix the fallout

See merge request GNOME/gtk!5509
2023-03-04 15:57:49 +00:00
Emmanuele Bassi
891b6dc4a9 Check for attributes being available before querying them
GLib 2.75 started checking if a GFileInfo was created with the attribute
we're querying, instead of failing silently and leaving us in an
inconsistent state.

Turns out that GtkFileChooserWidget, GtkFileSystemModel, and GtkPathBar
trip the newly introduced check.
2023-03-04 15:28:53 +00:00
Emmanuele Bassi
c6ff7400a8 Merge branch 'wip/chergert/fix-action-activation-crash' into 'main'
inspector: be defensive against out parameters

See merge request GNOME/gtk!5591
2023-03-04 15:16:59 +00:00
Emmanuele Bassi
6620b7de92 Merge branch 'ebassi/stack-page-fix' into 'main'
a11y: Fix GtkStackPage first accessible child

See merge request GNOME/gtk!5590
2023-03-04 15:16:34 +00:00
Aleksandr Melman
d58071b4c1 Update Russian translation 2023-03-04 15:05:45 +00:00
Piotr Drąg
f38df62e2b Update Polish translation 2023-03-04 15:59:29 +01:00
Benjamin Otte
0581e38b09 testsuite: Add a test for stripes
The GL renderer was creating sripes for nodes that were scaled in
particular ways, probably due to rounding errors.

This testsuite focuses on one of those stripes to make sure they are
gone.
2023-03-04 02:50:38 +01:00
Emmanuele Bassi
74a00319dd a11y: Use weak references for GtkATContext cached accessibles
The accessible objects already own the GtkATContext, let's avoid a
reference cycle.
2023-03-03 22:07:09 +00:00
Matthias Clasen
611788fb53 stack: Don't recreate at contexts in dispose
This is the same protection we have in
GtkWidgetAccessible.
2023-03-03 22:07:09 +00:00
Emmanuele Bassi
500128d186 a11y: Plug reference leaks
The gtk_accessible_get_at_context() getter is now transfer full, which
means we need to drop the reference when getting the GtkATContext.
2023-03-03 22:07:09 +00:00
Christian Hergert
32cf104167 inspector: be defensive against out parameters
Set initial state to NULL so that we don't risk accessing an unset out
parameter.

Fixes a crash when activating certain actions.
2023-03-03 12:17:32 -08:00
Emmanuele Bassi
9b98426e71 a11y: Simplify bookkeeping while iterating accessible children 2023-03-03 18:02:22 +00:00
Emmanuele Bassi
9820d25cf9 a11y: Fix GtkStackPage first accessible child
The first accessible child is the child widget of the GtkStackPage, not
the first child of the widget.
2023-03-03 18:02:22 +00:00
Benjamin Otte
8bbf220fdf testsuite: Add a test for large scale nodes
This test fails if we naively create fullscale
intermediate offscreens. This was fixed in the
previous commits.

This tests the fixes in 22ba6b1f33 (for
cairo) and 3a0152b65f (for GL).
2023-03-03 11:33:57 -06:00
Matthias Clasen
3a0152b65f gl: Respect clip wehn drawing scale nodes
Use the same approach and only create an offscreen
that is big enough for the clipped part of the scaled
texture.

If the clipped part is still too large for a single
texture, we give up and just render the texture without
filters (using the regular texture rendering code path
which supports slicing).

The following commit will add the texture-scale-magnify-10000x
test which fails without this fix.
2023-03-03 11:32:08 -06:00
Benjamin Otte
22ba6b1f33 rendernode: Respect clip when drawing scale nodes
Scale nodes can use large scale factors and we don't want to create
insanely huge Cairo surfaces.

A subsequent commit will add the texture-scale-magnify-10000x
test which fails without this fix.
2023-03-03 11:31:31 -06:00
Benjamin Otte
718b5d5fe7 rendernode: Clarify some Cairo stuff
Split out a function to make it more obvious what's going on.
2023-03-03 11:24:46 -06:00
Benjamin Otte
88dd64551c rendernode: Don't do unnecessary stuff
Cairo surfaces are created transparent.

And even if they weren't, overdrawing with transparency wouldn't erase
what's in the surface because it's a no-op.

It would require CAIRO_OPERATOR_CLEAR or CAIRO_OPERATOR_SOURCE.
2023-03-03 11:24:46 -06:00
Benjamin Otte
98eac8ac83 Fixes for gdk_memory_texture_new_subtexture checks
There were several mistakes here.
2023-03-03 11:24:46 -06:00
Changwoo Ryu
dbb2cb22ca Update Korean translation 2023-03-03 15:36:03 +00:00
Lukáš Tyrychtr
71dbb5090e a11y: Expose GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE to AtSPI2
Also, update the AtSPI2 relations to match the 1.26 version of AtSPI2.
2023-03-03 15:15:59 +01:00
Matthias Clasen
4b46097748 Merge branch 'ebassi/accessible-transfer-full' into 'main'
Mark Accessible getters as transfer full

Closes #5615

See merge request GNOME/gtk!5586
2023-03-03 09:46:51 +00:00
Emmanuele Bassi
eb0f33d76b Mark Accessible getters as transfer full
GtkAccessible implementations in C can get away returning objects just
by shuffling pointers around, but higher level languages prefer using
full ownership transfer in virtual functions.

Fixes: #5615
2023-03-03 02:13:26 +00:00
Emmanuele Bassi
828f686fc9 Merge branch 'expose_details_relation' into 'main'
a11y: Expose GTK_ACCESSIBLE_RELATION_DETAILS to at-spi2

See merge request GNOME/gtk!5580
2023-03-03 01:55:48 +00:00
Emmanuele Bassi
681f8bed19 Merge branch 'fix_section_role' into 'main'
a11y: Fix mapping of GTK_ACCESSIBLE_ROLE_PRESENTATION

See merge request GNOME/gtk!5576
2023-03-03 01:54:51 +00:00
Matthias Clasen
5fe32a46a0 Merge branch 'ebassi/atcontext-dispose' into 'main'
a11y: Clear the accessible tree in GtkATContext

See merge request GNOME/gtk!5587
2023-03-03 01:54:38 +00:00
Emmanuele Bassi
e3548bb9ad Revert "stack: clear accessible parent when removing child"
This reverts commit 40d4441fd8.

The accessible parent of the child widget in a GtkStackPage is cleared
when the GtkATContext gets disposed, so we don't need to unset it
ourselves. This also avoids a temporary vivification of the GtkATContext
during dispose.
2023-03-03 01:39:24 +00:00
Emmanuele Bassi
61506648bf a11y: Clear the accessible tree in GtkATContext
We acquire a reference on the accessible objects, so we need to release
it when disposing the GtkATContext.
2023-03-03 01:38:27 +00:00
Balázs Úr
621b3b51ea Update Hungarian translation 2023-03-03 00:35:25 +00:00
Matthias Clasen
784ba8bf12 Merge branch 'matthiasc/for-main' into 'main'
impcontextsimple: Return from GTask

See merge request GNOME/gtk!5585
2023-03-03 00:19:38 +00:00
Matthias Clasen
d968659b43 impcontextsimple: Return from GTask
GLib complains about this now, so do it.
2023-03-02 16:18:45 -05:00
Emmanuele Bassi
48d3db8daa Merge branch 'leak-fix' into 'main'
gtkatspicontext: Fix a leak of a floating GVariant

See merge request GNOME/gtk!5583
2023-03-01 20:41:53 +00:00
Philip Withnall
ca702b4596 gtkatspicontext: Fix a leak of a floating GVariant
If the early return path in `emit_property_changed()` is taken, and
`value` is floating, it will be leaked. Fix that by sinking `value` on
entry to the function.

Spotted by asan:
```
Direct leak of 128 byte(s) in 2 object(s) allocated from:
    #0 0x7f44774ba6af in __interceptor_malloc (/lib64/libasan.so.8+0xba6af)
    #1 0x7f44764c941a in g_malloc ../../source/glib/glib/gmem.c:130
    #2 0x7f44764f6d8a in g_slice_alloc ../../source/glib/glib/gslice.c:252
    #3 0x7f447654655d in g_variant_alloc ../../source/glib/glib/gvariant-core.c:565
    #4 0x7f447654664c in g_variant_new_from_bytes ../../source/glib/glib/gvariant-core.c:608
    #5 0x7f4476536ed5 in g_variant_new_take_string ../../source/glib/glib/gvariant.c:1307
    #6 0x7f4475c75ada in gtk_at_spi_context_state_change ../../source/gtk4/gtk/a11y/gtkatspicontext.c:1112
    #7 0x7f44758ee194 in gtk_at_context_update ../../source/gtk4/gtk/gtkatcontext.c:694
    #8 0x7f44758dbfcf in gtk_accessible_update_property ../../source/gtk4/gtk/gtkaccessible.c:326
    #9 0x7f4475b5abe3 in gtk_widget_set_tooltip_text ../../source/gtk4/gtk/gtkwidget.c:9740
    #10 0x58439d in gs_updates_page_update_ui_state ../../source/gnome-software/src/gs-updates-page.c:302
    #11 0x5857dc in gs_updates_page_set_state ../../source/gnome-software/src/gs-updates-page.c:403
    #12 0x5879f1 in gs_updates_page_load ../../source/gnome-software/src/gs-updates-page.c:636
    #13 0x58822d in gs_updates_page_reload ../../source/gnome-software/src/gs-updates-page.c:678
    #14 0x50ff48 in gs_page_reload ../../source/gnome-software/src/gs-page.c:731
    #15 0x5491ce in gs_shell_reload_cb ../../source/gnome-software/src/gs-shell.c:830
    #16 0x7f4477363f54 in g_cclosure_marshal_VOID__VOID ../../source/glib/gobject/gmarshal.c:117
    #17 0x7f447735e0ad in g_closure_invoke ../../source/glib/gobject/gclosure.c:832
    #18 0x7f4477391f3f in signal_emit_unlocked_R ../../source/glib/gobject/gsignal.c:3802
    #19 0x7f4477390c13 in g_signal_emit_valist ../../source/glib/gobject/gsignal.c:3555
    #20 0x7f4477391324 in g_signal_emit ../../source/glib/gobject/gsignal.c:3612
    #21 0x7f447705b3c3 in gs_plugin_loader_reload_delay_cb ../../source/gnome-software/lib/gs-plugin-loader.c:1538
    #22 0x7f44764bd140 in g_timeout_dispatch ../../source/glib/glib/gmain.c:5054
    #23 0x7f44764b9eb1 in g_main_dispatch ../../source/glib/glib/gmain.c:3460
    #24 0x7f44764bb72c in g_main_context_dispatch ../../source/glib/glib/gmain.c:4200
    #25 0x7f44764bba15 in g_main_context_iterate ../../source/glib/glib/gmain.c:4276
    #26 0x7f44764bbbfa in g_main_context_iteration ../../source/glib/glib/gmain.c:4343
    #27 0x7f44769ef655 in g_application_run ../../source/glib/gio/gapplication.c:2589
    #28 0x4f2da5 in main ../../source/gnome-software/src/gs-main.c:49
    #29 0x7f4474e4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-01 19:42:33 +00:00
robxnano
5a5a36151a filechooser: Don't automatically select a file
When the folder changes, do not select the first item in the list,
so if the user enters a folder and then clicks the accept button,
the current folder is returned instead of the selected one.
To maintain consistency with the previous implementation, when a
folder in the path bar is clicked the previously-entered folder is
selected, and when the file chooser is in open file mode the first
item is always selected.

See #5438
2023-03-01 13:56:52 +00:00
Lukáš Tyrychtr
c91ba630a7 a11y: Expose GTK_ACCESSIBLE_RELATION_DETAILS to at-spi2
This particular relation was not exposed to at-spi2.
Exposing it required adding a missing at-spi2 relation variant, but it was introduced
in at-spi2-core 2.26, so that's likely safe as well.
2023-03-01 13:53:39 +01:00
Matthias Clasen
bc99ab38ce Merge branch 'matthiasc/for-main' into 'main'
inspector: Remove debug spew

See merge request GNOME/gtk!5579
2023-03-01 12:36:49 +00:00
Matthias Clasen
fe8c262351 inspector: Remove debug spew 2023-03-01 06:32:52 -05:00
Lukáš Tyrychtr
1b000b5586 a11y: Fix mapping of GTK_ACCESSIBLE_ROLE_PRESENTATION
It was, for some reason, mapped to ATSPI_ROLE_SECTION, and GTK_ACCESSIBLE_ROLE_SECTION was mapped to
ATSPI_ROLE_FILLER, so the mapping is reversed. So, reverse it and make it correct.
2023-03-01 11:07:09 +01:00
Benjamin Otte
1b4f240883 Merge branch 'wip/otte/default-size-docs' into 'main'
window: Clarify docs for default-size

See merge request GNOME/gtk!5569
2023-03-01 10:06:34 +00:00
Benjamin Otte
496f68376b window: Clarify docs for default-size 2023-03-01 10:06:32 +00:00
Matthias Clasen
f019ff5287 Merge branch 'textbuffer-foreground-property' into 'main'
textbuffer: Use correct foreground color property

See merge request GNOME/gtk!5574
2023-03-01 02:46:05 +00:00
Mat
c08e739996 textbuffer: Use correct foreground color property
The 'foreground-rgba' property should be used instead of 'foreground',
since the latter is not readable.
2023-03-01 04:14:19 +02:00
Emmanuele Bassi
8eb3c55709 Merge branch 'wip/chergert/fix-stack-page-leak' into 'main'
stack: clear accessible parent when removing child

Closes #5626

See merge request GNOME/gtk!5571
2023-02-28 23:24:57 +00:00
Christian Hergert
40d4441fd8 stack: clear accessible parent when removing child
Without this, the GtkStackPage may not reach a reference count of zero
and therefore will be leaked.

Fixes #5626
2023-02-28 15:08:20 -08:00
Benjamin Otte
471ebabd77 Merge branch 'gbsneto/filechooser-fixes' into 'main'
Fix GtkFileThumbnail thumbnail query

See merge request GNOME/gtk!5570
2023-02-28 18:04:40 +00:00
Georges Basile Stavracas Neto
d8b7c909ea filethumbnail: Set filechooser::queried after querying
Setting this attribute after querying, but before receiving the
results, can lead to inappropriate behaviour. This can be reproduced
by dragging the scrollbar very quickly in a large directory; after
going up and down a few times, some thumbnails will be wrong.

Without this branch, "wrong" means they'll show the completely wrong
icon or thumbnail, e.g. a folder icon in a video file. With previous
commit, "wrong" means they'll be empty even when there is a thumbnail
available.

The sequence of events that triggers this is as follows:

 1. GtkListItem receives a GFileInfo object and passes it to
    GtkFileThumbnail via expressions

 2. `get_thumbnail()` is called, doesn't find a thumbnail

 3. `filechooser::queried` is not set yet, so it is set to TRUE
      and we call `g_file_query_info_async()`

 4. **Before `thumbnail_queried_cb` is called**, a new GFileInfo
    is set, and we cancel the query initiated in the previous
    step

 5. We now have a GFileInfo with `filechooser::queried` set to
    TRUE, and no thumbnail!

This commit fixes that by only setting the `filechooser::queried`
attribute after the icon is queried. We need to set it in two
situations: when the query is successful, or when the error is
not G_IO_ERROR_CANCELLED. That's because the query was cancelled,
we didn't really perform it!
2023-02-28 14:18:30 -03:00
Georges Basile Stavracas Neto
158165f769 filethumbnail: Clear image on failure
Unset the image if we fail to find the appropriate icon, regardless
of the reason of the failure. Prevents the thumbnail to misrepresent
the GFileInfo it's supposed to represent.
2023-02-28 13:52:12 -03:00
Georges Basile Stavracas Neto
2d90031dab filethumbnail: Cosmetics
Remove an empty newline
2023-02-28 13:50:08 -03:00
Matthias Clasen
2a862c05a1 Merge branch 'matthiasc/for-main' into 'main'
inspector: Look for icon themes in system data dirs

See merge request GNOME/gtk!5567
2023-02-28 16:35:48 +00:00
Matthias Clasen
93b6c7863b Merge branch 'main' into 'main'
Update docs/reference/gtk/getting_started.md

See merge request GNOME/gtk!5558
2023-02-28 16:23:26 +00:00
Matthias Clasen
090f45a589 Merge branch 'wip/exalm/buildable' into 'main'
builderparser: Don't exit too early on nested custom tags

See merge request GNOME/gtk!5566
2023-02-28 16:21:19 +00:00
Alexander Mikhaylenko
ca737b1411 testsuite: Add a GtkBuildable custom tag test
Just test that it doesn't error out during parsing.
2023-02-28 17:51:38 +04:00
Matthias Clasen
b2af4006ba inspector: Look for icon themes in system data dirs
For some reason, these were not included, and they should.
2023-02-28 07:18:42 -05:00
Matthias Clasen
5d3942e5fa NEWS: Updates 2023-02-28 06:53:26 -05:00
Alexander Mikhaylenko
2bcc3cfb33 builderparser: Don't exit too early on nested custom tags
Currently nested custom tags work only as long as the element names differ
from the root one. If it's same, for example:

<condition type="any">
  <condition type="max-width">600</condition>
  <condition type="max-height">600</condition>
</condition>

then it will fail. Meanwhile the same tags wrapped into <conditions> would
work.

The problem is that custom tag parsing is considered finished as soon as we
encounter a closing tag with the same element name. So instead, track the
nesting level.
2023-02-28 14:46:14 +04:00
Matthias Clasen
a7a498e803 Merge branch 'alloc-needed-on-child-fix' into 'main'
widget: Reset alloc_needed_on_child before allocating children

See merge request GNOME/gtk!5564
2023-02-28 10:40:02 +00:00
Ivan Molodetskikh
75a417e337 widget: Reset alloc_needed_on_child before allocating children
Reset alloc_needed_on_child *before* allocating the children. This is
because some child's size_allocate() may call queue_allocate(), which
will bubble up alloc_needed_on_child. An example of this happening is
with GtkScrollable implementations, which are supposed to configure
their adjustments in size_allocate(), which will cause GtkScrollbar's
GtkRange to notice and queue_allocate() on itself.

If we reset alloc_needed_on_child after this happens, then our children
will have a lingering alloc_needed_on_child and will not receive an
allocation.

This commit fixes widgets occasionally losing an allocation when this
scenario happens.
2023-02-27 21:38:42 -08:00
Matthias Clasen
dbaaa59758 Merge branch 'fix-text-undo-disabling' into 'main'
text: Fix disabling of history

Closes #5622

See merge request GNOME/gtk!5565
2023-02-28 02:39:30 +00:00
Matthias Clasen
73ba043b02 text: Make editable API irreversible
Programmatic changes to the entry contents should
not become part of the undo history.

Sadly, the editable implementations are also used
in the code paths that we use for user-initiated changes,
so we have to be careful to only set them as
irreversible if we are not already in a user action.

Fixes: #5622
2023-02-27 19:43:11 -05:00
Matthias Clasen
61e4eadbce text: Fix disabling of history
Keep a separate boolean for enable-undo, and
disable the history if it is false, or the entry
is not using visible text, or isn't editable.

Related to: #5622
2023-02-27 19:17:08 -05:00
Matthias Clasen
0db2d0bc07 Merge branch 'expose_autocomplete' into 'main'
a11y: Expose GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE

See merge request GNOME/gtk!5563
2023-02-27 16:49:00 +00:00
Emmanuele Bassi
cd10e5dd1a Verbiage Change 2023-02-27 16:32:35 +00:00
Lukáš Tyrychtr
c57d6c5575 a11y: Expose GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE
Previously, it was not exposed at all, now it at least somewhat is.
2023-02-27 15:27:07 +01:00
Emmanuele Bassi
73057b267e Merge branch 'expose_has_popup' into 'main'
a11y: Expose GTK_ACCESSIBLE_PROPERTY_HAS_POPUP

See merge request GNOME/gtk!5562
2023-02-27 14:20:44 +00:00
Lukáš Tyrychtr
9d4bb77263 a11y: Expose GTK_ACCESSIBLE_PROPERTY_HAS_POPUP
This property was not exposed before, not it is.
2023-02-27 14:10:11 +01:00
Emmanuele Bassi
0d6cee9763 Merge branch 'expose_multi_selectable' into 'main'
a11y: Expose GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE to at-spi2

See merge request GNOME/gtk!5561
2023-02-27 12:41:11 +00:00
Lukáš Tyrychtr
b33bfe26fe a11y: Expose GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE to at-spi2
Previously, this property was not exposed to the a11y backend, now, it is.
2023-02-27 13:24:56 +01:00
Emmanuele Bassi
0cacaa08f5 Merge branch 'expose_required' into 'main'
a11y: Expose GTK_ACCESSIBLE_PROPERTY_REQUIRED to at-spi2

See merge request GNOME/gtk!5560
2023-02-27 11:30:59 +00:00
Lukáš Tyrychtr
cbf4a546b4 a11y: Expose GTK_ACCESSIBLE_PROPERTY_REQUIRED to at-spi2
Up until now, this property was silently not exposed to assistive technologies.
2023-02-27 12:17:58 +01:00
Emmanuele Bassi
03732c1d48 Merge branch 'fix_invalid_role_mapping' into 'main'
a11y: Map GTK_ACCESSIBLE_STATE_INVALID to ATSPI_STATE_INVALID_ENTRY

See merge request GNOME/gtk!5559
2023-02-27 11:02:40 +00:00
Lukáš Tyrychtr
568cf21486 a11y: Map GTK_ACCESSIBLE_STATE_INVALID to ATSPI_STATE_INVALID_ENTRY
Previously, it was mapped to ATSPI_STATE_INVALID. However, that state
is used for some internal errors, and not user errors, so use the correct
one for that purpose.
2023-02-27 11:40:46 +01:00
Bobby Neal
f11d647aa4 Update docs/reference/gtk/getting_started.md 2023-02-26 17:04:17 +00:00
Hugo Carvalho
49feaf465d Update Portuguese translation 2023-02-26 16:20:29 +00:00
Matthias Clasen
9b0afd8bff Merge branch 'pickers-demo-dnd' into 'main'
gtk4-demo: Accept file dnd in the pickers demo

See merge request GNOME/gtk!5556
2023-02-26 13:44:30 +00:00
Matthias Clasen
495ca72232 gtk4-demo: Accept file dnd in the pickers demo
Easy to add and expected of a file picker.
2023-02-26 08:28:38 -05:00
Alexander Shopov
e6f4464a3d Update Bulgarian translation 2023-02-26 08:48:06 +00:00
Anders Jonsson
cb0e4ee2be Update Swedish translation 2023-02-25 21:57:36 +00:00
Matthias Clasen
6f7b6ad61a Merge branch 'ebassi/button-no-check' into 'main'
Remove unused code in GtkButton

See merge request GNOME/gtk!5553
2023-02-25 13:41:52 +00:00
Emmanuele Bassi
1e599c9141 Remove unused code in GtkButton
GtkButton still has some code checking if the instance passed to
gtk_button_set_label() is a GtkCheckButton; GtkCheckButton is not a
GtkButton any more.
2023-02-24 14:38:39 +00:00
Yosef Or Boczko
4cf42eb19c Update Hebrew translation 2023-02-24 09:57:37 +00:00
Matthias Clasen
b0fc2f99ba Merge branch 'mcatanzaro/#5619' into 'main'
filesystemmodel: fix crash when file is removed

Closes #5619

See merge request GNOME/gtk!5550
2023-02-23 16:24:06 +00:00
Emmanuele Bassi
2b4dd182c1 Merge branch 'add_toggle_button_role' into 'main'
a11y: Introduce a dedicated role for toggle buttons

See merge request GNOME/gtk!5549
2023-02-23 15:22:16 +00:00
Michael Catanzaro
c141d0a70a filesystemmodel: fix crash when file is removed
In 32247bc50e node_get_for_file() was
changed to return GTK_INVALID_LIST_POSITION rather than 0 when the file
is untracked. Most call sites were updated accordingly, but this one was
missed.

Fixes #5619
2023-02-23 09:20:03 -06:00
Lukáš Tyrychtr
6fa8033c7c Use the correct role for GtkToggleButton 2023-02-23 15:02:29 +01:00
Lukáš Tyrychtr
de80f503e4 a11y: Introduce a dedicated role for toggle buttons
Up until now, toggle buttons were presented as regular push buttons.
That's the approach used by the ARIA specification, however, our platform
accessibility backend, at-spi2, can not represent accessibe states with values,
so we can not represent the design pattern precisely enough for screen readers.
If, in future, the a11y backends gain this capability, we might consider again
removing this role.
2023-02-23 14:22:20 +01:00
Matthias Clasen
41b67c4722 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Fix the shortcuts-window demo

See merge request GNOME/gtk!5548
2023-02-23 01:03:41 +00:00
Matthias Clasen
1eae87621d gtk-demo: Fix the shortcuts-window demo
Presenting the shortcutswindow got lost
in fb8e52f0c9. Oops.
2023-02-22 14:57:47 -05:00
Fran Dieguez
5f502601c8 Update Galician translation 2023-02-22 17:23:21 +00:00
Sabri Ünal
04d23c5cb9 Update Turkish translation 2023-02-22 11:41:36 +00:00
Philipp Kiemle
d9b6f814ad Update German translation 2023-02-22 10:34:50 +00:00
Matthias Clasen
871c46591a Merge branch 'improve_gtknotebook_a11y' into 'main'
GtkNotebook: Improve the labels of notebook pages for a11y

See merge request GNOME/gtk!5546
2023-02-21 16:48:28 +00:00
Lukáš Tyrychtr
d906b456a8 GtkNotebook: Improve the labels of notebook pages for a11y 2023-02-21 15:29:00 +01:00
Michael J. Baars
32bc7ce987 removed duplicate function call 2023-02-21 13:28:15 +01:00
Daniel
cad5771a66 Updated Spanish translation 2023-02-21 12:07:49 +01:00
Emmanuele Bassi
378f1421f0 Merge branch 'main' into 'main'
button: Remove nullable annotation for new_from_icon_name()

Closes #5606

See merge request GNOME/gtk!5544
2023-02-20 21:30:05 +00:00
Philipp Hörist
a209a73c69 button: Remove nullable annotation for new_from_icon_name()
This makes it more consistent with set_icon_name() which
does also not accept NULL.

Fixes #5606
2023-02-20 20:33:42 +01:00
Matthias Clasen
624458df9d Merge branch 'builder-tool-child-properties' into 'main'
gtk4-builder-tool: Prefer child properties

Closes #5609

See merge request GNOME/gtk!5543
2023-02-20 13:12:27 +00:00
Matthias Clasen
fbfbaa484d Merge branch 'matthiasc/for-main' into 'main'
filechooser: Fix paned limits

See merge request GNOME/gtk!5542
2023-02-20 13:04:33 +00:00
Matthias Clasen
3de10847b9 gtk4-builder-tool: Prefer child properties
Rewrite <child> elements to use child properties
where that is easily possible.

Fixes: #5609
2023-02-19 21:48:56 -05:00
Kukuh Syafaat
8be601da4f Update Indonesian translation 2023-02-20 01:20:48 +00:00
Matthias Clasen
07b9a6fb75 filechooser: Fix paned limits
The intention of the ui file was to not let
the paned shrink both children down to nothing,
but using <child> for the children effectively
overrides the setting of the shrink properties.
Fix that by using child properties instead of
<child>.
2023-02-19 19:12:30 -05:00
Matthias Clasen
5105d607de Merge branch 'builder-tool-template-parent' into 'main'
builder-tool: Try harder to find template parents

Closes #5232

See merge request GNOME/gtk!5541
2023-02-20 00:05:06 +00:00
Matthias Clasen
a9f03be588 builder-tool: Try harder to find template parents
This will make it work (in some cases) to add extra
libraries via LD_PRELOAD.

Based on work by Julian Sparber,
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5084

Fixes: #5232
2023-02-19 18:17:34 -05:00
Asier Sarasua Garmendia
d67bdb96ad Update Basque translation 2023-02-19 20:44:24 +00:00
Yuri Chornoivan
c8f4535ed2 Update Ukrainian translation 2023-02-19 20:23:35 +00:00
Aurimas Černius
21cbf98942 Update Lithuanian translation 2023-02-19 19:06:03 +00:00
Emmanuele Bassi
300540f6b8 Merge branch 'texturescalenode-type-annotations' into 'main'
Fix self-`(type)` annotations for `TextureScaleNode` methods

See merge request GNOME/gtk!5539
2023-02-19 17:18:01 +00:00
Sebastian Dröge
323ba14dde Fix self-(type) annotations for TextureScaleNode methods 2023-02-19 19:00:34 +02:00
Matthias Clasen
aaee1ee5bd Merge branch 'fix_custom_accessible_hierarchy' into 'main'
Allow setting accessible parent and next sibling

See merge request GNOME/gtk!5517
2023-02-19 16:15:49 +00:00
Matthias Clasen
70a711882c Fix the build 2023-02-19 15:26:27 +00:00
Matthias Clasen
5717b95cad Miscellaneous formatting and documentation fixes 2023-02-19 15:09:25 +00:00
Matthias Clasen
1b0f324be5 Merge branch 'missing-since-markers' into 'main'
Add two missing `Since` markers

See merge request GNOME/gtk!5537
2023-02-19 14:56:51 +00:00
Sebastian Dröge
ca93512106 Add two missing Since markers 2023-02-19 11:18:15 +02:00
Ekaterine Papava
fbd4f06ee2 Update Georgian translation 2023-02-19 05:48:04 +00:00
Benjamin Otte
d553f6941d Merge branch 'wip/otte/for-main' into 'main'
listview: Measure children only, not self

See merge request GNOME/gtk!5535
2023-02-19 05:33:59 +00:00
Matthias Clasen
2173b7ccaa Merge branch 'matthiasc/for-main' into 'main'
Drop some unnecessary includes

See merge request GNOME/gtk!5536
2023-02-19 05:01:53 +00:00
Matthias Clasen
ca6642deed Drop some unnecessary includes 2023-02-18 23:42:04 -05:00
Benjamin Otte
be6a4722c0 listview: Measure children only, not self
The previous code would include CSS padding/margin/border in the
measurement and that is wrong.

Until commit a96c75ff02 this was not actually visible, but afterwards
listitems were allocated 16px too wide.

Test included
2023-02-19 05:41:29 +01:00
Matthias Clasen
3b3b63062d Revert "Merge branch 'inscription-single-line' into 'main'"
This reverts commit 7ec90abf24, reversing
changes made to ec49a912aa.

We did not have agreement on this after all.
2023-02-18 19:04:00 -05:00
Matthias Clasen
7ec90abf24 Merge branch 'inscription-single-line' into 'main'
inscription: Add single-line-mode property

Closes #5444

See merge request GNOME/gtk!5504
2023-02-18 23:34:17 +00:00
Matthias Clasen
ec49a912aa Merge branch 'wip/carlosg/dnd-x11-keys' into 'main'
gdk/x11: Also grab keyboard during XDnD grabs

Closes #5604

See merge request GNOME/gtk!5533
2023-02-18 22:20:30 +00:00
Carlos Garnacho
ae94417f80 gdk/x11: Also grab keyboard during XDnD grabs
The drag source must handle events and messaging, this also
includes keyboard handling for accessibility and cancellation.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5604
2023-02-18 23:02:22 +01:00
Matthias Clasen
24a6803958 Merge branch 'matthiasc/for-main' into 'main'
gtksearchentry: Apply header capitalization to the "Clear entry" tooltip

See merge request GNOME/gtk!5532
2023-02-18 21:10:16 +00:00
Automeris naranja
4073371416 gtksearchentry: Apply header capitalization to the "Clear entry" tooltip
HIG advises to use header capitalization in tooltip texts.

https://developer.gnome.org/hig/patterns/feedback/tooltips.html
2023-02-18 15:53:54 -05:00
Matthias Clasen
e5a391c0b9 Merge branch 'matthiasc/for-main' into 'main'
securememory: use function checks

Closes #5070

See merge request GNOME/gtk!5531
2023-02-18 17:21:15 +00:00
Matthias Clasen
6cb612ac15 gtk-demo: Fix build without sincos
We are getting into trouble here if
sincos isn't detected but still present
in headers. Avoid that.

Also fix the other copy of gtkgears.c.
2023-02-18 10:41:02 -05:00
Matthias Clasen
9f64202a60 meson: Consolidate function checks
Put all the function checks in one place.
Remove functions we don't actually use,
and add ones that we have #ifdefs for in
in the code. Also add enough includes to
make these checks actually work.

Fixes: #5070
2023-02-18 09:37:36 -05:00
Matthias Clasen
19c362f638 securememory: use function checks
Checking for getpagesize in meson.build is
useless if we don't check the resulting define
in the code. So do that.
2023-02-18 09:34:50 -05:00
Matthias Clasen
e51fa8b65b Merge branch 'matthiasc/for-main' into 'main'
printing: Avoid getrandom

See merge request GNOME/gtk!5530
2023-02-17 22:39:04 +00:00
Matthias Clasen
06d3bbafaf printing: Avoid getrandom
GLib has perfectly serviceable random number
apis, and this breaks the macOs build.
2023-02-17 17:20:44 -05:00
Matthias Clasen
da8a1f4683 Merge branch 'scalebutton-active-since-marker' into 'main'
Add missing `Since` marker to `GtkScaleButton:active`

See merge request GNOME/gtk!5529
2023-02-17 19:54:03 +00:00
Sebastian Dröge
ad7d9bc409 Add missing Since marker to GtkScaleButton:active 2023-02-17 19:41:55 +02:00
Emmanuele Bassi
94cde8d702 Merge branch 'ebassi/ci-update-v41' into 'main'
ci: Update image

See merge request GNOME/gtk!5528
2023-02-17 12:55:50 +00:00
Emmanuele Bassi
ec7b1f7208 ci: Add no-cache option to run-docker.sh script
Use `run-docker.sh build --no-cache` to discard the cached layers if you
need to rebuild the image without modifying the Dockerfile.
2023-02-17 12:24:09 +00:00
Emmanuele Bassi
864fbf89cd ci: Update image
Refresh the Fedora base (still at 37), and add the Python packaging
module for gi-docgen.
2023-02-17 12:24:09 +00:00
Emmanuele Bassi
b8e928d703 Merge branch 'matthiasc/for-main' into 'main'
mask: Fix glsl

See merge request GNOME/gtk!5527
2023-02-17 12:23:36 +00:00
Matthias Clasen
0b4d41698b mask: Fix glsl 2023-02-17 06:26:42 -05:00
Matthias Clasen
a9eca60b84 Merge branch 'wip/fix-mask-modes-regression' into 'main'
wayland/glcontext: Don't call wl_surface.offset on old objects

See merge request GNOME/gtk!5526
2023-02-17 11:25:06 +00:00
Jonas Ådahl
53c3f497f1 wayland: Clean up some dead code 2023-02-17 12:03:58 +01:00
Jonas Ådahl
3183a21347 wayland/glcontext: Don't call wl_surface.offset on old objects
The availability of wl_surface.offset depends on the compositor, so we
can't call it unconditionally. Add a version check to so we only call
offset if we know we won't raise a protocol error.

Fixes: 0eb791eaaa ("Make mask nodes more versatile")
2023-02-17 12:03:27 +01:00
Matthias Clasen
07f090f947 Merge branch 'test-invisible-text' into 'main'
Add a test for invisible text navigation

See merge request GNOME/gtk!5525
2023-02-17 03:01:42 +00:00
Matthias Clasen
ad111087cc Add a test for invisible text navigation
This shows that (at least some) things
work as expected.

See: #1811
2023-02-16 14:27:44 -05:00
Jürgen Benvenuti
5092581be8 Update German translation 2023-02-16 17:18:16 +00:00
Matthias Clasen
b261f7f533 Merge branch 'nielsdg/set-action-enabled-doc-ref' into 'main'
widget: mention action_set_enabled in install_action

See merge request GNOME/gtk!5524
2023-02-16 11:24:15 +00:00
Niels De Graef
779f9e5071 widget: mention action_set_enabled in install_action
When looking at `gtk_widget_class_install_action()`, it isn't
immediately obvious how actions can be enabled or disabled. Add a
reference to the `gtk_widget_action_set_enabled()` method so people have
a quick link to that.
2023-02-16 08:47:06 +01:00
Matthias Clasen
b07d9d1912 Merge branch 'alatiera/flatpak-ci' into 'main'
ci: Build and publish aarch64 flatpaks

Closes #5594

See merge request GNOME/gtk!5523
2023-02-15 19:54:32 +00:00
Jordan Petridis
7b4692bcb0 ci: Add a simple auto-retry policy 2023-02-15 21:38:24 +02:00
Jordan Petridis
f0a2b6f165 ci: Build and publish aarch64 flatpaks
Close GNOME/gtk#5594
2023-02-15 21:19:56 +02:00
Jordan Petridis
2dc6efd9ce ci: Switch from only/except to rules: keyword
It's more flexible and allows us to combine the flatpak jobs
2023-02-15 21:10:40 +02:00
Emmanuele Bassi
1f4adb60bb Merge branch 'fix-annotations' into 'main'
Fix a couple incorrect annotations for optional parameters

See merge request GNOME/gtk!5503
2023-02-15 16:27:11 +00:00
Lukáš Tyrychtr
f507dd4962 Allow updating the next accessible sibling for a GtkAccessible 2023-02-15 12:29:16 +01:00
Matthias Clasen
1bdb368e8b Merge branch 'more-mask-modes' into 'main'
rendernodeparser: Fix mask mode handling

See merge request GNOME/gtk!5522
2023-02-15 03:54:01 +00:00
Matthias Clasen
aec4bfcf3b gsk: Add a node parser test for mask modes 2023-02-14 21:47:54 -05:00
Matthias Clasen
7e18c2849b gsk: Add a render test for mask modes 2023-02-14 21:47:54 -05:00
Matthias Clasen
351abadee7 Make make not fallback match GL
We were not handling the inverted-luminance
case the same way, and it caused a test to
fail. Yay for tests.
2023-02-14 21:47:54 -05:00
Matthias Clasen
951db28f71 rendernodeparser: Fix mask mode handling
I had forgotten inverted-luminance, and also
to print an error.
2023-02-14 21:01:12 -05:00
Benjamin Otte
40e7a265a7 rendernodeparser: Print an error when failing to parse an enum 2023-02-14 21:01:12 -05:00
Matthias Clasen
9a539cec57 Merge branch 'mask-modes' into 'main'
Make mask nodes more versatile

See merge request GNOME/gtk!5521
2023-02-15 00:57:17 +00:00
Matthias Clasen
724cf6bd70 Merge branch 'wip/cdavis/menubutton-active' into 'main'
menubutton: Add `active` property and getter/setter

See merge request GNOME/gtk!5506
2023-02-15 00:44:17 +00:00
Matthias Clasen
5e4b43dcce Merge branch 'wip/otte/downloader' into 'main'
Add GdkTextureDownloader

See merge request GNOME/gtk!5515
2023-02-15 00:41:26 +00:00
Matthias Clasen
fa43282695 Merge branch 'wip/otte/disable-style-check' into 'main'
CI: Don't run style-check-diff by default

See merge request GNOME/gtk!5520
2023-02-15 00:36:53 +00:00
Benjamin Otte
662c251cd0 demo: Spice up the mask demo
Also use all the mask modes, weeeee!
2023-02-14 19:07:01 -05:00
Matthias Clasen
0d97d03fc1 Document mask node parser format 2023-02-14 19:07:01 -05:00
Matthias Clasen
cb0aaf0b2c Add more mask node tests 2023-02-14 19:07:01 -05:00
Matthias Clasen
0eb791eaaa Make mask nodes more versatile
Add a GskMaskMode enumeration and implement it
in the GL and cairo renderers.
2023-02-14 19:07:01 -05:00
Benjamin Otte
073c836f96 CI: Don't run style-check-diff by default
We don't use it most of the time and it's also confusing to new contributors who think it's important to fix it.

Keep it for manual runs, so that interested people can just click a button to see the results. It also makes it easy to turn back on later.
2023-02-14 23:53:02 +00:00
Matthias Clasen
0a0a03d913 Merge branch 'fix_4258' into 'main'
Don't tell the screen reader that a button is related to an image which has no useful label

Closes #4258

See merge request GNOME/gtk!4665
2023-02-14 23:50:18 +00:00
Lukáš Tyrychtr
d43724f5fc Don't tell the screen reader that a button is related to an image which has no useful label 2023-02-14 23:50:18 +00:00
Matthias Clasen
abf3cdb187 Merge branch 'cpdb' into 'main'
Update dependencies for CPDB print backend

Closes #5589

See merge request GNOME/gtk!5518
2023-02-14 23:48:43 +00:00
Benjamin Otte
cca5de3c7f memorytexture: Export less private API
It's not needed anymore with GdkTextureDownloader now.
2023-02-15 00:39:18 +01:00
Benjamin Otte
774696011d glrenderer: Use GdkTexureDownloader 2023-02-15 00:39:18 +01:00
Benjamin Otte
c9f54ca371 texture: Export gdk_texture_get_format()
The API docs outline why quite well.

This should make it possible to do saving of textures to image files
without any private API with the same featureset that GTK uses.

Also remove the gsktextureprivate.h include where
gdk_texture_get_format() was the only reason for it.
2023-02-15 00:39:18 +01:00
Benjamin Otte
ce0123ea58 docs: Link from gdk_texture_download() to GdkTextureDownloader 2023-02-15 00:39:18 +01:00
Benjamin Otte
b30af72125 tiff: Use GdkTexureDownloader when saving 2023-02-15 00:39:18 +01:00
Benjamin Otte
eb45b8083a png: Use GdkTexureDownloader when saving 2023-02-15 00:39:18 +01:00
Benjamin Otte
f05d801e28 jpeg: Use GdkTexureDownloader when saving 2023-02-15 00:39:18 +01:00
Benjamin Otte
4afec951c7 pixbuf: Use GdkTextureDownloader when downloading pixbufs 2023-02-15 00:39:18 +01:00
Benjamin Otte
51ed1442a2 gdk: Add GdkTextureDownloader
It's the new object that allows more control about accessing texture
data.
2023-02-15 00:39:18 +01:00
Benjamin Otte
01ff6c1c22 memorytexture: Use right size for GBytes
The GBytes were created with the wrong size.

Nobody seems to have looked at it.
2023-02-14 23:42:17 +01:00
Fran Dieguez
73f3ea9511 Update Galician translation 2023-02-14 20:04:07 +00:00
Emmanuele Bassi
f1311dc053 Merge branch 'gsk-render-node-type-abi-breakage' into 'main'
gsk: Move new 4.10 `GskRenderNodeType`s to the end instead of inserting them in the middle

See merge request GNOME/gtk!5519
2023-02-14 19:28:36 +00:00
Sebastian Dröge
a252aadadf gsk: Move new 4.10 GskRenderNodeTypes to the end instead of inserting them in the middle 2023-02-14 21:04:41 +02:00
tinytrebuchet
300670dad4 Update dependencies for CPDB print backend
Require cpdb-frontend 2.x for building CPDB print backend.
2023-02-14 23:39:13 +05:30
Matthias Clasen
44c95d3c96 Merge branch 'kjellahl/clang' into 'main'
gskglrenderjob: Fix compilation with clang

See merge request GNOME/gtk!5516
2023-02-14 14:18:29 +00:00
Lukáš Tyrychtr
d566771262 Preserve the correct a11y tree in GtkStack
Now, when we can, ensure that the GtkStackPage is the parent of its widget.
2023-02-14 14:44:20 +01:00
Lukáš Tyrychtr
5f72b51105 Allow setting accessible parent and sibling explicitly
This allows to maintain the correct a11y hierarchy even when it contains
objects which are only GtkAccessibles.
2023-02-14 14:43:57 +01:00
Hugo Carvalho
e0afd22c84 Update Portuguese translation 2023-02-14 11:39:50 +00:00
Kjell Ahlstedt
869ab1cd1b gskglrenderjob: Fix compilation with clang 2023-02-14 10:29:25 +01:00
Matthias Clasen
730593fab5 Merge branch 'texttag_textview_documentation' into 'main'
Update TextTag and TextView indent Documentation

See merge request GNOME/gtk!5507
2023-02-14 00:08:39 +00:00
Matthias Clasen
d0798c9526 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Fix hotspot handling in dnd

See merge request GNOME/gtk!5513
2023-02-14 00:03:55 +00:00
Matthias Clasen
e6dfb8732a gtk-demo: Fix hotspot handling in dnd
We were not remembering the pointer coordinates.
2023-02-13 18:39:45 -05:00
Aurimas Černius
453ef8c7e1 Update Lithuanian translation 2023-02-13 21:07:37 +00:00
Sabri Ünal
819595d1a9 Update Turkish translation 2023-02-13 18:08:05 +00:00
Andre Klapper
306276b689 Fix invalid markup in Belarusian UI translation 2023-02-13 18:32:03 +01:00
Emmanuele Bassi
bb15a7ef46 Merge branch 'faq-updates' into 'main'
faq: Some updates

See merge request GNOME/gtk!5512
2023-02-13 14:50:35 +00:00
Matthias Clasen
cd0fe13dae faq: Add a question about parallel UIs 2023-02-13 08:54:36 -05:00
Matthias Clasen
3dcea74e85 faq: Don't number questions
The numbering makes it unnecessarily hard to add
and remove questions, and does not really seem
necessary. Just use bullets.
2023-02-13 08:52:04 -05:00
Matthias Clasen
537c2f6c7a faq: Some updates
Miscellaneous tweaks and changes, after reading
the whole thing.
2023-02-13 08:52:03 -05:00
Matthias Clasen
72379f64e9 Merge branch 'fix-font-chooser-filter' into 'main'
Fix an assertion in GtkFontChooserWidget when setting a filter.

See merge request GNOME/gtk!5511
2023-02-13 12:41:48 +00:00
Akira TAGOH
4532c3020b Fix an assertion in GtkFontChooserWidget when setting a filter. 2023-02-13 12:49:02 +09:00
Kukuh Syafaat
b60bd8a73d Update Indonesian translation 2023-02-13 02:47:33 +00:00
Matthias Clasen
37f12e4bf9 Post-release version bump 2023-02-12 21:04:15 -05:00
Matthias Clasen
8967b2da01 4.9.4 2023-02-12 20:36:13 -05:00
Matthias Clasen
dfb019509d docs: Document new build options 2023-02-12 20:36:13 -05:00
Matthias Clasen
a770b429ec Merge branch 'fix-gst-gl-use' into 'main'
gstreamer: Fix gl context use

Closes #5586

See merge request GNOME/gtk!5508
2023-02-13 00:41:51 +00:00
Matthias Clasen
7430bd7780 gstreamer: Fix gl context use
We were not activating the context in which
we want to wait for the fence. This caused
a stream of critical warnings.

Fixes: #5586
2023-02-12 19:29:04 -05:00
Jacob Mealey
272a40a01a Update TextTag and TextView indent Documentation
Change the documentation for both to be in line with Pango documentation
specifically regarding hanging indentation.
2023-02-12 23:12:51 +00:00
Matthias Clasen
f121f607ae Merge branch 'search_entry_placeholder' into 'main'
gtksearchentry: Add getter/setter for placeholder text

See merge request GNOME/gtk!4312
2023-02-12 22:06:36 +00:00
Christopher Davis
ff45145eac menubutton: Add active property and getter/setter
GtkMenuButton currently does not provide a way to tell
if it's open programmatically. The existing methods,
`popup()` and `popdown()`, do not expose any state
to callers. If someone wanted to know whether or not
a menubutton was open, they needed the popover. Given
that GtkMenuButton can manage the popovers itself,
that's not always an option for app developers.

This commit adds the `active` property and associated
methods, where `gtk_menu_button_set_active ()` replaces
both `gtk_menu_popup ()` and `gtk_menu_popdown ()`.
This addition also mirrors changes in other places,
Such as `GtkWidget:visible` vs `show()`/`hide()`.
2023-02-12 16:47:59 -05:00
Matthias Clasen
83c5f5ff0f Apply 4 suggestion(s) to 2 file(s) 2023-02-13 06:47:06 +09:00
Alexandros Theodotou
87d21dc5c9 gtksearchentry: Add getter/setter for placeholder text 2023-02-13 06:46:31 +09:00
Matthias Clasen
cef7e6b741 Merge branch 'mark-deprecations' into 'main'
docs: Mark various deprecations

See merge request GNOME/gtk!5502
2023-02-12 21:44:00 +00:00
Yuri Chornoivan
84b5e94ffd Update Ukrainian translation 2023-02-12 17:56:09 +00:00
Matthias Clasen
679d510059 Merge branch 'template-child-dispose-order' into 'main'
gtk: Set widget template children to NULL before destroy unref

See merge request GNOME/gtk!4611
2023-02-12 16:36:52 +00:00
Marco Melorio
d2755e0385 inscription: Add single-line-mode property
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5444.
2023-02-12 17:35:56 +01:00
Matthias Clasen
0c2b437643 Merge branch 'main' into 'main'
Add note about widgets implementing the interface adding the `horizontal`/`vertical` CSS classes

See merge request GNOME/gtk!5391
2023-02-12 16:28:12 +00:00
madmurphy
0764cf0c9c Add note about widgets implementing the interface adding the horizontal/vertical CSS classes 2023-02-12 16:28:12 +00:00
Marco Melorio
2504215459 docs: Mark everything in GtkVolumeButton as deprecated 2023-02-12 17:20:11 +01:00
Marco Melorio
d45db3a961 docs: Mark everything in GtkStatusBar as deprecated 2023-02-12 17:20:11 +01:00
Matthias Clasen
557a1ed879 Merge branch 'no-more-lpr' into 'main'
printing: Drop the lpr backend

See merge request GNOME/gtk!5500
2023-02-12 15:29:27 +00:00
Matthias Clasen
c28b6a3ee6 Merge branch 'texture-atlas-crash' into 'main'
gl: Avoid a crash in the texture library

Closes #5175

See merge request GNOME/gtk!5501
2023-02-12 15:28:06 +00:00
Marco Melorio
b34c139028 docs: Mark everything in GtkLockButton as deprecated 2023-02-12 16:12:17 +01:00
Matthias Clasen
dd22e2aea9 printing: Drop the lpr backend
We want to consolidate and get to fewer print
backends (ideally only one), and the future is cpdb.
2023-02-12 10:10:06 -05:00
Marco Melorio
6e6f2f652c docs: Mark everything in GtkCellAreaContext as deprecated 2023-02-12 16:09:39 +01:00
Marco Melorio
3aac70f245 docs: Mark everything in GtkAssistant as deprecated 2023-02-12 16:09:25 +01:00
Matthias Clasen
7f3ea15d80 Update POTFILES.in 2023-02-12 10:09:22 -05:00
Matthias Clasen
d3dfdd214f gl: Avoid a crash in the texture library
entry->texture can be NULL, so check before
using it.

Fixes: #5175
2023-02-12 10:01:11 -05:00
Matthias Clasen
b6c3cf4eee gl: Maintain state when truncating
When we truncate the command queue because it
is too big, we were messing up our state accounting
and running into criticals as a consequence.

This can be reproduced by opening a well-populated
fishbowl demo in the inspectors recorder.

Fixes: #5188
2023-02-12 09:56:32 -05:00
Matthias Clasen
157ef1d395 Deprecate GtkVolumeButton
Too specialized.
2023-02-12 09:48:49 -05:00
Matthias Clasen
d0263f563a NEWS: Updates 2023-02-12 09:21:38 -05:00
Matthias Clasen
83b48bb25f Merge branch 'mask-nodes-rebased' into 'main'
gsk: Introduce mask nodes

See merge request GNOME/gtk!5497
2023-02-12 14:11:47 +00:00
Matthias Clasen
81e9eca256 Merge branch 'nacho/scalebutton-active' into 'main'
gtkscalebutton: add active property

See merge request GNOME/gtk!5492
2023-02-12 14:01:27 +00:00
Ignacio Casal Quinteiro
44c2d585b8 gtkscalebutton: add active property 2023-02-12 14:01:26 +00:00
Matthias Clasen
348803af7d Add a mask node demo 2023-02-12 08:35:25 -05:00
Matthias Clasen
c8bfea7aa1 Add a test for mask nodes 2023-02-12 08:35:25 -05:00
Matthias Clasen
8f47e885f0 Add gtk_snapshot_push_mask 2023-02-12 08:35:25 -05:00
Matthias Clasen
a9f50f1f7a gl: Support mask nodes
Add a shader for masking.
2023-02-12 08:35:25 -05:00
Matthias Clasen
0d58e5365d gsk: Introduce mask nodes
Add GskMaskNode, and support it in the render node
parser, in the inspector and in GtkSnapshot.

The rendering is just fallback for now.

Based on old work by Timm Bäder.
2023-02-12 08:35:25 -05:00
Ekaterine Papava
d00d4c4475 Update Georgian translation 2023-02-12 12:30:05 +00:00
Piotr Drąg
a6e7c38236 Update POTFILES.in 2023-02-12 13:20:48 +01:00
Matthias Clasen
eee7e59265 Merge branch 'fix_editable_label' into 'main'
Remove timeout when disposing GtkEditableLabel

Closes #5584

See merge request GNOME/gtk!5499
2023-02-12 02:55:45 +00:00
Matthias Clasen
c2cb1ffe9e Merge branch 'wip/wl-dispatch-helper' into 'main'
wayland: Add event queue dispatch helper

See merge request GNOME/gtk!5498
2023-02-12 01:01:29 +00:00
Alexandros Theodotou
d918a77d34 Remove timeout when disposing GtkEditableLabel
Fixes: #5584
2023-02-12 09:45:07 +09:00
Matthias Clasen
2285ef3824 Merge branch 'scaled-textures' into 'main'
Scaled textures

See merge request GNOME/gtk!5488
2023-02-11 22:16:43 +00:00
Jonas Ådahl
b2a2bf819d wayland/launch-context: Use dispatch helper
Otherwise we risk a busy loop if e.g. the pipe broke.
2023-02-11 23:14:53 +01:00
Jonas Ådahl
dd9433b50e wayland: Add event queue dispatch helper
Dispatch failing should always fatal; use a helper to centralize the
error handling everywhere.
2023-02-11 23:13:39 +01:00
Matthias Clasen
67c53e46f9 Add gtk_snapshot_append_scaled_texture
This is the snapshot api corresponding to
gsk_texture_scale_node_new.
2023-02-11 15:09:38 -05:00
Matthias Clasen
238e7ec351 Add a test for scaled textures 2023-02-11 15:09:38 -05:00
Matthias Clasen
d916659781 gl: Handle GskTextureScaleNodes 2023-02-11 15:09:38 -05:00
Matthias Clasen
82c02574f1 gl: Make texture slicing more flexible
Allow to specify the filtering to use for the slices,
and allow forcing the number of slices. This will be
used in the next commit.
2023-02-11 15:09:38 -05:00
Matthias Clasen
26e6d2106b gl: Pass filters down from visit_texture_node
For now, we always pass GL_LINEAR.
2023-02-11 15:09:38 -05:00
Matthias Clasen
625ffa2d96 gtk-demo: Add filtering to the zoom demo 2023-02-11 15:09:38 -05:00
Matthias Clasen
dd3eedd510 gtk-demo: Rewrite the zoom demo slightly
Use a texture directly instead of a paintable.
This will be used in the following commit to
introduce filters.
2023-02-11 15:09:38 -05:00
Matthias Clasen
dc3a72cf38 nodeparser: Support texture-scale nodes 2023-02-11 15:09:38 -05:00
Matthias Clasen
b937c19dd4 gsk: Introduce GskTextureScaleNode 2023-02-11 15:09:38 -05:00
Matthias Clasen
04c3af537c Merge branch 'wip/handle-more-wl-dispatch-failures' into 'main'
wayland: Handle dispatch failing in a couple of more places

See merge request GNOME/gtk!5495
2023-02-11 19:56:45 +00:00
Matthias Clasen
cc43f5dcde gsk: Generate mipmaps when requested
If the min_filter requires it, call
glGenerateMipmap for our textures.
2023-02-11 09:29:03 -05:00
Matthias Clasen
c74d7afce5 gsk: Don't limit filters too much
GL does not allow mipmapping for mag filters,
but it doesn't have a problem with it for min
filters.
2023-02-11 09:29:03 -05:00
Matthias Clasen
52e18eb7fb Merge branch 'matthiasc/for-main' into 'main'
gdkevents.c: Fix up folding

See merge request GNOME/gtk!5496
2023-02-11 14:18:42 +00:00
Matthias Clasen
c0b5b4b8c1 gskrendernodeimpl.c: Use folding
Instead of homegrown markup.
2023-02-11 09:00:07 -05:00
Matthias Clasen
d497e721c9 gdkevents.c: Fix up folding
The modeline was lost at some point,
and superfluous spacing inserted.
2023-02-11 08:59:51 -05:00
Jonas Ådahl
a7fb9a6865 wayland: Handle dispatch failing in a couple of more places
Without doing this, we'll end up with risking GTK processes sitting
eating 100% CPU instead of just exit(1):ing.
2023-02-11 11:42:21 +01:00
Marek Kašík
2365d9be18 Merge branch 'cpdb' into 'main'
New CPDB print backend for GTK Print Dialog

See merge request GNOME/gtk!4930
2023-02-10 23:10:20 +00:00
tinytrebuchet
41b60bbd6c New CPDB print backend for GTK Print Dialog
The Common Print Dialog Backends (CPDB) concept has GUI-toolkit-independent
backends for each print technology (CUPS, Print to File, cloud printing
services, ...) and each print dialog (GTK, Qt, Chromium, ...) is supposed
to use this backend, so that changes in print technologies can be centrally
and quickly covered by changing the backends and everything new gets available
in all print dialogs.

This commit provides a GTK print dialog backend to add support for the CPDB
concept. It communicates with all installed CPDB backends and so gives support
for all these print technologies to the GTK print dialog.

To make use of CPDB the GTK print dialog is supposed to be installed with this
backend and the 'Print To File' backend, and not any others to prevent printer
duplication.
2023-02-11 01:13:48 +05:30
Emin Tufan Çetin
f0d3d011ea Update Turkish translation 2023-02-10 05:57:42 +00:00
Cameron White
0cb3555a65 Fix a couple incorrect annotations for optional parameters
The 'optional' annotation should be used in these cases rather than 'nullable'.
NULL can provided to ignore these output parameters, but the function is
not setting the output parameter to NULL.
2023-02-09 22:46:43 -05:00
Matthias Clasen
48e141a42c Merge branch 'avoid-criticals-tracker' into 'main'
searchengine: Avoid criticals when tracker init failed

See merge request GNOME/gtk!5489
2023-02-09 19:43:31 +00:00
Gaël Bonithon
6215b38e64 searchengine: Emit a simple warning when tracker init failed
Failure is allowed by nature of GInitable, and this avoids unnecessary
crashing of programs running with G_DEBUG=fatal-criticals.
2023-02-09 19:46:30 +01:00
Gaël Bonithon
41490f9624 searchengine: Add missing sanity check 2023-02-09 19:25:04 +01:00
Vasil Pupkin
45e6e9a7d1 Update Belarusian translation 2023-02-08 21:48:28 +00:00
Matthias Clasen
9991d6834d Merge branch 'stop-testing-pixbuf-formats' into 'main'
Drop pixbuf format tests

See merge request GNOME/gtk!5486
2023-02-07 18:48:39 +00:00
Matthias Clasen
ddf8c4dd1a Drop pixbuf format tests
We have our own loaders for the formats we
always want to support, so we don't need to
check for what gdk-pixbuf supports.
2023-02-07 07:54:22 -05:00
Matthias Clasen
970072ef65 Merge branch 'file-dialog-fixes' into 'main'
filedialog: Robustness fixes

See merge request GNOME/gtk!5485
2023-02-07 12:42:09 +00:00
Matthias Clasen
f8321029fc filedialog: Robustness fixes
This code was not working well.
2023-02-06 23:16:17 +01:00
Matthias Clasen
f83cab01ec filechooserportal: Fix an oversight 2023-02-06 20:28:35 +01:00
Sabri Ünal
8a74770ec1 Update Turkish translation 2023-02-06 09:19:35 +00:00
Matthias Clasen
39c503c108 Merge branch 'matthiasc/for-main' into 'main'
CONTRIBUTING: Updates

See merge request GNOME/gtk!5483
2023-02-06 06:53:14 +00:00
Matthias Clasen
fc32b8242b CONTRIBUTING: Updates
Mention matrix instead of irc, and ask
for display/graphics as essential info
in issues.
2023-02-06 07:35:11 +01:00
Piotr Drąg
7c2b4eb0e7 Update Polish translation 2023-02-05 15:22:00 +01:00
Matthias Clasen
d8b0aea6b7 Merge branch 'rename-openuri-portal' into 'main'
Use a Gtk prefix for dbus-generated code

Closes #5572

See merge request GNOME/gtk!5482
2023-02-05 08:27:09 +00:00
Matthias Clasen
190d8ef8ff Use a Gtk prefix for dbus-generated code
Copying this file from GIO without renaming it
was not the greatest idea in retrospect.

Fixes: #5572
2023-02-05 09:09:22 +01:00
Cheng-Chia Tseng
15e9194b59 Update Chinese (Taiwan) translation 2023-02-04 16:28:15 +00:00
Matthias Clasen
0257da6cc0 Post-release version bump 2023-02-04 17:01:51 +01:00
Matthias Clasen
907f878c9f make-release: Explicily enable introspection 2023-02-04 16:31:55 +01:00
Matthias Clasen
b2071cdeb5 4.9.3 2023-02-04 16:16:54 +01:00
Matthias Clasen
1a292bf8ab Merge branch 'wip/carlosg/scroll-fix' into 'main'
gdk/x11: Reset all scroll valuators on enter

Closes #4160

See merge request GNOME/gtk!5479
2023-02-04 13:14:02 +00:00
Matthias Clasen
7e07d63a6c Merge branch 'ebassi/stack-at-context' into 'main'
a11y: Clear the GtkATContext in a single step

See merge request GNOME/gtk!5477
2023-02-04 12:37:20 +00:00
Carlos Garnacho
824e983372 gdk/x11: Reset all scroll valuators on enter
We no longer need to make much distinction between multiple logical
devices, plus it breaks esp. with the Xwayland input device distribution.
Just iterate across all devices and reset their scroll valuators.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4160
2023-02-04 13:13:19 +01:00
Matthias Clasen
9e5417c6c7 Merge branch 'wip/carlosg/wayland-device-refactor' into 'main'
Refactor some wayland code

See merge request GNOME/gtk!5473
2023-02-04 07:48:33 +00:00
Matthias Clasen
e94dae8536 Merge branch 'rgba-free-checked' into 'main'
gtktextview: Avoid calling gdk_rgba_free for NULL values

See merge request GNOME/gtk!5474
2023-02-04 07:48:24 +00:00
Matthias Clasen
0dd163254d Merge branch 'ebassi/accessible-editable' into 'main'
a11y: Simplify GtkAccessible implementation for editables

See merge request GNOME/gtk!5475
2023-02-04 07:47:36 +00:00
Emmanuele Bassi
341ecab41a a11y: Clear the GtkATContext in a single step
There's no need to unrealize the GtkATContext inside dispose() and then
drop its reference inside finalize().
2023-02-03 17:11:22 +01:00
Marco Trevisan (Treviño)
9eac7ed8b9 gtktextview: Avoid calling gdk_rgba_free for NULL values
Related to glib#2908
2023-02-03 16:41:56 +01:00
Carlos Garnacho
4005eb8fe8 gdk/wayland: Rename gdkkeys-wayland.c file
Since it contains the GdkKeymap implementation, give it a more
obvious name.
2023-02-03 16:15:34 +01:00
Carlos Garnacho
1d4ceac2c5 gdk/wayland: "Split" GdkWaylandDevice implementation out
This is a bit spaghetti right now, since seats and devices were
heavily entangled there are a number of crossed private API calls that
should ideally not be there.

Let this be a first step, so more bits may move from the seat
implementation to devices.
2023-02-03 16:15:34 +01:00
Carlos Garnacho
a5246a6856 gdk/wayland: Split GdkDevicePad wayland implementation
This now lives in its own C file.
2023-02-03 16:08:07 +01:00
Lukáš Tyrychtr
11d235d165 a11y: Simplify GtkAccessible implementation for editables
This commit implements the idea brought up in #5032, and provides a
simple function for GtkEditable implementations using a delegate object.
The accessible state is proxied from the outher GtkEditable to the
delegate.
2023-02-03 16:08:06 +01:00
Carlos Garnacho
af00beb772 gdk/wayland: Move struct declarations to header
These will be used from outside the main file, after we are
done splitting it.
2023-02-03 16:00:01 +01:00
Carlos Garnacho
e5cd9354d5 gdk/wayland: Move GdkWaylandDevice data to private struct
Before splitting this object, avoid leaking details in its struct.
2023-02-03 15:58:11 +01:00
Carlos Garnacho
6426ab7466 gdk/wayland: Rename gdkdevice-wayland.c to gdkseat-wayland.c
This file, event though a clump of input-y objects, has more of
seats than anything else. Rename it so that we can start splitting
these objects out of it.
2023-02-03 15:58:11 +01:00
Matthias Clasen
b710df6f45 Merge branch 'file-chooser-context-menu' into 'main'
filechooser: Fix context menus

Closes #5554

See merge request GNOME/gtk!5472
2023-02-03 13:39:21 +00:00
Matthias Clasen
50998b0ee9 Merge branch 'drag-icon-robustness' into 'main'
dragicon: Handle files without info

See merge request GNOME/gtk!5460
2023-02-03 13:19:26 +00:00
Matthias Clasen
92c2c68c7b filechooser: Fix context menus
We only want to show the file list context menu
when we are over the file list.

Fixes: #5554
2023-02-03 14:17:34 +01:00
Matthias Clasen
c2f5b64b5d Merge branch 'ebassi/public-accessible' into 'main'
Make GtkAccessible public

Closes #4240

See merge request GNOME/gtk!5470
2023-02-03 11:31:06 +00:00
Matthias Clasen
460bf6d8b9 inspector: Show if accessibles aren't realized
This prevents confusion and makes it clear
what is going on.
2023-02-03 11:49:17 +01:00
Emmanuele Bassi
a0dff87c86 a11y: Documentation and code style fixes 2023-02-03 11:49:17 +01:00
Emmanuele Bassi
3015b9f120 a11y: Fix get_bounds() implementation
Don't allocate graphene_rect_t, and fix the size retrieval.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
01549e3c91 Take the widget transform into account when computing the bounds for a11y 2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
bc48bfc2b6 a11y: Use a DOM-like API for iterating accessible objects
The `get_child_at_index()` API model comes from AT-SPI, and it's not an
efficient design, especially when coupled with large widgets.

Replace `get_child_at_index()` with `get_first_accessible_child()` and
`get_next_accessible_sibling()`.

That allows efficiently retrieving all the children, simplifies the
implementation of GtkAccessible in GtkWidget and closely resembeles the
GtkWidget API.

Getting the last child and previous sibling for iterating backwards is
not a part of the interface at the moment, but they can be added at a
later date.

Note that this change required tracking the next stack page in
GtkStackPage.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
6100258ba2 a11y: Rename GtkAccessible.get_parent
Avoid a collision when the type implementing the GtkAccessible interface
already has a `get_parent()` method—like GtkWidget.
2023-02-03 11:49:17 +01:00
Emmanuele Bassi
e083bd7920 Apply trivial review suggestions 2023-02-03 11:49:17 +01:00
Emmanuele Bassi
e915546b44 Add versioned symbol annotations 2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
b6cfe35940 Style fixes
Documentation and coding style updates.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
4cd9fd9b15 stack: Use a pointer array for children
Reduce our dependency on linked lists; pointer arrays are better at
cache locality.

Additionally, we can avoid quadratic behaviors when finding a child at a
given index.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
6f8cab0e9d Style fix 2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
6eb9161906 Improve documentation 2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
d13695f586 a11y: Implement new GtkAccessible vfuncs in GtkStack
Implement the virtual a11y children for GtkStack.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
749919c551 Update API docs 2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
58980e0b4a Make GtkAccessible public
Out of tree classes need to be able to implement the GtkAccessible
interface, in order to implement custom accessible objects.

Fixes: #4240
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
5813a5cace a11y: Add bounds rectangle to GtkAccessible
Make the bounds calculation part of the accessible interface.

Bounds are used by ATs like Orca to implement features like Flat Review:

https://help.gnome.org/users/orca/stable/howto_flat_review.html.en

Or to determine the area of a non-presentational widget.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
f88b777fe5 widget: Implement new GtkAccessible vfuncs 2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
a80af681b8 a11y: Skip non-presentable objects
Don't get confused with non-presentable objects when iterating the list
of children.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
94695bb276 a11y: Use GtkAccessible for tree traversal
Remove the widget tree dependence from GtkAtSpiContext.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
be36113826 a11y: Implement the new GtkAccessible vfuncs
Implement the gtk_accessible functions and begin removing the old widget
based tree calls.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
5dfbaa53fc a11y: Add DOM-like API to GtkAccessible
Add get_parent and get_child_at_index to GtkAccessible so we can
decouple the a11y tree from the widget tree.
2023-02-03 11:49:17 +01:00
Matthias Clasen
a13ddcb67b Merge branch 'filechooser-sidebar' into 'main'
placessidebar: Make all rows ellipsize

Closes #4710

See merge request GNOME/gtk!5471
2023-02-03 09:41:21 +00:00
Carlos Garnacho
d228bae365 Merge branch 'drag-button-issue' into 'main'
Fix button mask calculation for Wayland

Closes #5561

See merge request GNOME/gtk!5468
2023-02-03 09:28:01 +00:00
Matthias Clasen
463f12a3bb placessidebar: Make all rows ellipsize
Otherwise, we end up with a single long row
pushing the content of all the other rows
off to the left, which is much worse than
ellipsizing.

Fixes: #4710
2023-02-03 10:00:03 +01:00
Matthias Clasen
3f87b130ba NEWS: Updates 2023-02-03 09:26:50 +01:00
Benjamin Otte
c17049c6d1 Merge branch 'wip/otte/gl-is-current' into 'main'
gdk: Add private GLContext::is_current() check

Closes #5392

See merge request GNOME/gtk!5463
2023-02-02 21:56:32 +00:00
Arjan Molenaar
f000baf0d6 wayland: Fix button mask for button 2 and 3
Wayland and GTK order mouse button 2 and 3 differently.

Fixes #5561.
2023-02-02 21:48:58 +01:00
Arjan Molenaar
aef4c50155 Allow all mouse buttons to be used for the drawingarea demo
So we can test if the drag gesture works with all mouse buttons.
2023-02-02 21:29:45 +01:00
Matthias Clasen
2a1e4b8621 Merge branch 'matthiasc/for-main' into 'main'
Matthiasc/for main

See merge request GNOME/gtk!5467
2023-02-02 17:36:44 +00:00
Matthias Clasen
cabd18fba0 textbtree: Fix a compiler warning 2023-02-02 17:15:28 +01:00
Matthias Clasen
1da4782262 gsk: Fix a compiler warning 2023-02-02 17:15:28 +01:00
Matthias Clasen
8911ed5d9b Merge branch 'monitor-description' into 'main'
Add GdkMonitor::description

See merge request GNOME/gtk!5466
2023-02-02 14:12:23 +00:00
Matthias Clasen
294b659dc1 Merge branch 'wip/carlosg/deprecations' into 'main'
Some deprecations and cleanups

See merge request GNOME/gtk!5465
2023-02-02 14:11:58 +00:00
Carlos Garnacho
7ad74ad6c3 gdk/wayland: Deprecate GdkDisplay windowing-specific for startup IDs
This is currently just used as a convenience storage of the startup ID
between the GtkApplication and the GtkWindow (after it's ready to notify
on it).

This could be untangled in the GTK layers so there is no involvement
from GDK in keeping the startup ID around, in the mean time just deprecate
these gdk_wayland* API calls.
2023-02-02 12:50:59 +01:00
Carlos Garnacho
bb777507ce gtkmodelbutton: Avoid gtk_gesture_set_sequence_state()
It is not necessary for this widget to know about the specific
sequence that is interacting.
2023-02-02 12:50:59 +01:00
Carlos Garnacho
1e1d79d4f7 gtktextview: Avoid gtk_gesture_set_sequence_state()
Use gtk_gesture_set_state() as this widget does not need specific
knowledge on the sequence being used for interaction.
2023-02-02 12:50:59 +01:00
Carlos Garnacho
a254a4529f gtkscrolledwindow: Clean up input handling a bit
These pieces were added in commit 8d2f81cca4, but are no longer
necessary since there's no capture_button_press special behavior
toggle.

This can be simplified again.
2023-02-02 12:50:59 +01:00
Matthias Clasen
e7bd691532 inspector: Show monitor descriptions 2023-02-02 12:32:28 +01:00
Matthias Clasen
4e62350232 wayland: Set up monitor descriptions
We get this information in the xdg_output protocol.
2023-02-02 12:32:28 +01:00
Matthias Clasen
2c883a70e2 Add GdkMonitor::description
This is the right string to when showing
monitors in the UI.
2023-02-02 12:32:28 +01:00
Matthias Clasen
3dfeb2fd37 monitor: Document connector names better 2023-02-02 12:32:28 +01:00
Carlos Garnacho
3ba3e8286f gtkwindowhandle: Refactor click handling a bit
Do not get a GdkEvent first and foremost, and only do that in the
parts where the GdkEvent is absolutely necessary (i.e. popping up
the WM menu for the window).
2023-02-02 11:21:22 +01:00
Carlos Garnacho
fbf4817ef5 gtkgesture: Deprecate gtk_gesture_set_sequence_state()
We can abstract widgets about the specific ongoing sequences that
are triggering a GtkGesture. This used to be more necessary in
GTK3 world where complex widgets might have required handling
different events in different areas, but in GTK4 world that would
be done with multiple widgets.

This is no longer necessary to carry forward.
2023-02-02 11:21:22 +01:00
Carlos Garnacho
db43e0669f gtkscrolledwindow: Avoid gtk_gesture_set_sequence_state()
This widget does not require special knowledge about the ongoing
event sequences, just make it use gtk_gesture_set_state() generically.
2023-02-02 11:21:22 +01:00
Carlos Garnacho
386c77b13d gtkwindowhandle: Avoid gtk_gesture_set_sequence_state()
It does not require special knowledge about the ongoing event
sequences, and it can instead trust the event controller. Make
it use gtk_gesture_set_state() generically.
2023-02-02 11:21:21 +01:00
Matthias Clasen
e6998dffe8 Merge branch 'small-gltexture-cleanup' into 'main'
gltexture: Small refactoring

See merge request GNOME/gtk!5464
2023-02-02 09:16:09 +00:00
Matthias Clasen
12057c8a30 gltexture: Small refactoring
We do this in two places, so factor out
the dropping of GL resources into a helper.
2023-02-02 10:01:36 +01:00
Matthias Clasen
b7c422cb98 ci: Stop running the asan build every time
It fails because of address sanitizer crashes,
and takes a long time. It is not that useful
in this shape.
2023-02-02 09:07:10 +01:00
Matthias Clasen
1c76f6586b Update po/POTFILES.in
Deprecations affect this file.
2023-02-02 09:05:31 +01:00
Matthias Clasen
d43968f7b6 Fix a deprecation warning 2023-02-02 09:03:26 +01:00
Matthias Clasen
26650787e1 main: Compiler warnin gfixes 2023-02-02 08:44:53 +01:00
Matthias Clasen
b4ef072188 icontheme: Compiler warning fixes 2023-02-02 08:44:28 +01:00
Matthias Clasen
3858c5282c Deprecate GtkAssistant
It is a dialog-like toplevel, and libadwaita has
replacement parts (like AdwCarousel).
2023-02-02 08:39:25 +01:00
Matthias Clasen
1ff8dad8ec Deprecate GtkLockButton
This is a very specialized widget, and should really just
live with the applications where it is used.
2023-02-02 08:39:25 +01:00
Matthias Clasen
d8cb11ec4a Deprecate GtkStatusbar
The design patterns using statusbar are no longer popular,
and it is pretty easy to make a statusbar yourself with boxes
and labels, if you need one. The only thing special about
GtkStatusbar was its window resize handle, but that has
been gone for a long time.
2023-02-02 08:39:24 +01:00
Matthias Clasen
8796950651 Deprecate more startup-notification API 2023-02-02 08:30:32 +01:00
Benjamin Otte
c6cef6db52 gdk: Add private GLContext::is_current() check
... and use this check in gdk_gl_context_make_current() and
gdk_gl_context_get_current() to make sure the context really is still
current.

The context no longer being current can happen when external GL
implementations make their own contexts current in the same threads GDK
contexts are used in.
And that can happen for example by WebKit.

Theoretically, this should also allow external EGL code to run in X11
applications when GDK chooses to use GLX, but I didn't try it.

Fixes #5392
2023-02-02 04:23:51 +01:00
Benjamin Otte
fdea27c04d win32: Remove unused variable 2023-02-02 04:23:51 +01:00
Fran Dieguez
a52f9d6def Update Galician translation 2023-02-01 19:12:29 +00:00
Benjamin Otte
ee272646c9 Merge branch 'fix-gltexture-confusion' into 'main'
gltexture: Use the right context

See merge request GNOME/gtk!5461
2023-02-01 18:47:28 +00:00
Matthias Clasen
6655177a0b Cosmetics 2023-02-01 18:38:22 +01:00
Daniel Mustieles
cb78f0d10a Update Spanish translation 2023-02-01 15:28:00 +00:00
Matthias Clasen
1cb621633c gltexture: Use the right context
When checking characteristics of the context
for downloading, we were using self->context,
even though we are using a possibly different
context for downloading.

Pass the right context along and use it.
2023-02-01 11:32:07 +01:00
Kukuh Syafaat
ce25efeee7 Update Indonesian translation 2023-02-01 03:14:46 +00:00
Matthias Clasen
375b554924 Merge branch 'fix-gst-sync' into 'main'
gst: Fix synchronization

See merge request GNOME/gtk!5459
2023-01-31 12:28:27 +00:00
Matthias Clasen
69eed999bb gst: Rename a field for clarity
gst_gdk_context is clearer than gst_app_context. Maybe
2023-01-30 15:01:31 -05:00
Matthias Clasen
cab5f2bd8d Merge branch 'file-chooser-dnd-crash' into 'main'
filechooserwidget: Fix file chooser crash when dropping empty file list

See merge request GNOME/gtk!5456
2023-01-30 19:28:24 +00:00
Fina Wilke
35e3c22832 filechooserwidget: Fix file chooser crash when dropping empty file list 2023-01-30 19:28:24 +00:00
Matthias Clasen
92612c2265 filetransfer: Be more careful around files
File may not have paths, and we should handle
that without incident. While we are at it, add
some logging so GDK_DEBUG=dnd gives us enough
output to see what is going on.
2023-01-30 14:03:13 -05:00
Matthias Clasen
4e1b46a7ec dragicon: Handle files without info
g_file_query_info can (and does) fail,
occasionally. Handle it.
2023-01-30 14:03:13 -05:00
Matthias Clasen
55f7f7d0ee gst: Fix synchronization
It does not make sense to sync and wait in the
same context, that is just a no-op. The intention
of this code clearly was to sync in the gst
context, and wait in the gdk one.

That also matches what the gtk sink implementation
in gstreamer does.
2023-01-30 12:04:49 -05:00
Matthias Clasen
442cd4a369 Merge branch 'password-entry-unrealize' into 'main'
passwordentry: Fix an asymmetry

Closes #5285

See merge request GNOME/gtk!5457
2023-01-30 12:29:33 +00:00
Matthias Clasen
53af41e2fa passwordentry: Fix an asymmetry
When connecting a signal in realize,
we should disconnect in unrealize.

Fixes: #5285
2023-01-29 22:39:28 -05:00
Matthias Clasen
c43e1f3d0a gsk: Quiet a compiler warning 2023-01-28 21:13:10 -05:00
Jürgen Benvenuti
32e855ad61 Update German translation 2023-01-28 19:59:19 +00:00
Benjamin Otte
034a8a5501 Merge branch 'tooltip-size-simplification' into 'main'
tooltip: Don't play games with max-width-chars

Closes #4470 and #5521

See merge request GNOME/gtk!5455
2023-01-28 18:26:00 +00:00
Matthias Clasen
1e9dbf2df0 tooltip: Prevent too-wide tooltip windows
Set the label to expand, so it actually fills
the width that we allocated for it, instead
of shrinking back to the minimum width for
its height.

Fixes: #5521
2023-01-28 13:07:26 -05:00
Matthias Clasen
dce21f06dd tooltip: Don't play games with max-width-chars
Setting max-width-chars to the number of characters
in the string works ok only as long as the average
char width we get from Pango matches reality. Sadly
that seems not always the case, and this code was
causing short Chinese tooltips to always be broken
into two lines.

Fixes: #4470
2023-01-28 13:06:30 -05:00
Piotr Drąg
56c1c4152f Update POTFILES.in 2023-01-28 14:05:01 +01:00
Matthias Clasen
a9d2fa296e Merge branch 'position-as-double' into 'main'
Boyscouting: fix position type in `gtk_drag_source_drag_begin()`

See merge request GNOME/gtk!5437
2023-01-28 03:24:19 +00:00
Carlos Garnacho
5bccb106c2 Merge branch 'work/zzag/activation-token-dbus' into 'main'
wayland: Fix handling of activation-token in org.freedesktop.Application requests

See merge request GNOME/gtk!5151
2023-01-28 00:44:25 +00:00
Yuri Chornoivan
45086487f1 Update Ukrainian translation 2023-01-27 19:23:39 +00:00
Vlad Zahorodnii
65f03121a4 wayland: Fix handling of activation-token in org.freedesktop.Application requests
At the moment, GTK applications search for "desktop-startup-id" in the
platform data on Wayland , but desktop environments such as plasma set
"activation-token" property instead as indicated in the spec:

    activation-token: This should be a string of the same value as would
    be stored in the XDG_ACTIVATION_TOKEN environment variable, as specified
    by the XDG Activation protocol for Wayland.

https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#dbus
2023-01-27 19:20:53 +00:00
Carlos Garnacho
09769193d7 Merge branch 'wip/carlosg/broadway-fix' into 'main'
gdk/broadway: Add deprecation guards around gdk_display_put_event()

See merge request GNOME/gtk!5450
2023-01-27 19:20:28 +00:00
Carlos Garnacho
7f8acf960b gdk/broadway: Add deprecation guards around gdk_display_put_event()
This went missing.
2023-01-27 19:59:36 +01:00
Matthias Clasen
ee0e026237 Merge branch 'fix_5551' into 'main'
object_tree.c: One gtk_list_item_get_child call is redundant

Closes #5551

See merge request GNOME/gtk!5449
2023-01-27 16:22:17 +00:00
Matthias Clasen
6bfd581a72 Merge branch 'wip/sophie-h/scrolled-window-propagate-event' into 'main'
scrolledWindow: Propagate event for no scrolling

See merge request GNOME/gtk!5447
2023-01-27 14:54:33 +00:00
Lukáš Tyrychtr
7b6f254e64 object_tree.c: One gtk_list_item_get_child call is redundant
Fixes #5551
2023-01-27 15:43:33 +01:00
Hugo Carvalho
47955cfe62 Update Portuguese translation 2023-01-27 14:26:32 +00:00
Sophie Herold
e62ca17f88 scrolledWindow: Propagate event for no scrolling 2023-01-26 20:12:10 +01:00
Matthias Clasen
c24ba58acb Merge branch 'broadway-modal-hint' into 'main'
[GTK4] gdk/broadway: Implements modal hint for Broadway surface

See merge request GNOME/gtk!4428
2023-01-26 02:44:54 +00:00
Matthias Clasen
30987168fb Merge branch 'fix_5543' into 'main'
GtkCssProvider: fix element type in docs

Closes #5543

See merge request GNOME/gtk!5441
2023-01-25 13:08:07 +00:00
Lukáš Tyrychtr
93a875bf20 Actually, the annotation is not needed in this case 2023-01-25 11:46:53 +01:00
Yosef Or Boczko
aac3bf581a Update Hebrew translation 2023-01-25 08:15:09 +00:00
Matthias Clasen
869f07521c Merge branch 'macos-fix-popups' into 'main'
macos: Fix popup event handling

Closes #5528

See merge request GNOME/gtk!5436
2023-01-24 16:37:23 +00:00
Matthias Clasen
7e392a1186 Merge branch 'wip/abono/gtk-switch-state-off' into 'main'
gtkswitch: Allow to set state FALSE while keeping active TRUE

See merge request GNOME/gtk!5442
2023-01-24 16:08:57 +00:00
Alessandro Bono
53d87e42a5 gtkswitch: Decouple set_state with set_active.
Allow the user to set a state that doesn't reflect the active property.
2023-01-24 14:55:16 +01:00
Arjan Molenaar
6757a1b409 macos: Propagate events for child surfaces
Before, popup windows did not respond to mouse clicks.
This change fixes that.

Fixes #5528.
2023-01-24 09:07:33 +01:00
Maxim Zakharov
115738dd2f remove unused variable 2023-01-24 11:41:27 +11:00
Matthias Clasen
5caa66ffb7 Merge branch 'macos-native-dnd' into 'main'
macos: DnD Drag support

Closes #3423

See merge request GNOME/gtk!5416
2023-01-23 22:01:30 +00:00
Emmanuele Bassi
7df73c4fd2 Use wording from a suggestion 2023-01-23 11:50:28 +00:00
Lukáš Tyrychtr
1ea5a08c8f GtkCssProvider: fix element type in docs
The method takes an array of char, which actually is UTF-8, so make the docs say so.
Fixes #5543
2023-01-23 12:12:00 +01:00
Matthias Clasen
9c669cbe90 Merge branch 'matthiasc/for-main' into 'main'
iconhelper: Handle GtkSymbolicPaintable

See merge request GNOME/gtk!5440
2023-01-22 18:36:11 +00:00
Matthias Clasen
1a5184bc85 iconhelper: Handle GtkSymbolicPaintable
If we are given a GtkSymbolicPaintable,
treat it as symbolic.
2023-01-22 13:18:18 -05:00
Jordi Mas
8f2ad8f154 Update Catalan translation 2023-01-21 16:58:51 +01:00
Arjan Molenaar
d6ef39b9a2 macos: remove dead code 2023-01-21 15:22:13 +01:00
Arjan Molenaar
52f6acd398 macos: Send dragging events directly to the display
Instead of adding events to the application event queue, dispatch
them directly to the right display. We know this when the event is
to be dispatched.

This is the same as used for the `sendEvent` method in `GdkMacosWindow`.

To achieve this I factored out the generic NSEvent to GdkEvent translation.
We can send an event directly, when we receive it in the GdkMacosWindow
directly from the OS.
2023-01-21 14:54:12 +01:00
Ekaterine Papava
2f894bb4ef Update Georgian translation 2023-01-20 16:04:31 +00:00
Matthias Clasen
2509fe0d17 Merge branch 'matthiasc/for-main' into 'main'
Cosmetics

See merge request GNOME/gtk!5434
2023-01-17 21:37:39 +00:00
Matthias Clasen
83a5611ce8 settings: Modernize the code
Drop some things that are no longer relevant,
and make this code look like modern GObject code.
2023-01-17 15:19:50 -05:00
Arjan Molenaar
136c1ccd2c macos: Update event source doc
Update the documentation with the interaction pattern we
need to support DnD.
2023-01-17 16:37:21 +01:00
Arjan Molenaar
16e23b3f9e macos: align functions in gdkmacosdrag-private.h 2023-01-17 16:12:57 +01:00
Matthias Clasen
af088d5e11 settings: Drop object_list
This code came from a time when we were installing
additional settings at runtime. We no longer do that,
so this code is unnecessary.
2023-01-17 08:30:37 -05:00
Matthias Clasen
a6e1c5c96a modules: Cosmetics
Use g_strv_length, instead of open-coding it.
2023-01-17 07:47:28 -05:00
Matthias Clasen
3c8c54ed15 stylecascade: Avoid some allocations 2023-01-17 07:39:51 -05:00
Arjan Molenaar
628aeda7ee macos: Provide the right drag action
We should use the drag action/operation provided by the
drag handlers, not rely on our internal bookkeeping.
2023-01-16 23:21:35 +01:00
Arjan Molenaar
2669dc269b macos: Default kCFRunLoopAllActivities
It's actually a mask, but we'll keep it in to
avoid compiler warnings.
2023-01-16 20:28:38 +01:00
Matthias Clasen
c4d3d72c57 Merge branch 'fix-hidpi-pictures' into 'main'
picture: Fix hi-dpi image handling

See merge request GNOME/gtk!5430
2023-01-16 14:32:01 +00:00
Matthias Clasen
cd79159420 picture: Fix hi-dpi image handling
The idea behind this code was to let scalable
images (i.e. mainly SVGs) provide twice as much
detail when the scale is 2. But we were also
using a scaler for pngs, causing them to be too
small on a hidpi screen. Fix that.

Note that there are cases where you want scaling
for pngs (when you display them scaled down, so
the image has 'hidden' detail). But we are not
attempting to handle that situation automatically.
2023-01-16 08:48:37 -05:00
Arjan Molenaar
1bc63eeadb macos: Queue events during drag
By passing the events during a (midal-ish) drag operation to the main loop,
we're able to keep up with what's happening. This allows the internal
drag state (GtkDragSource) to be updated and be done when the drag is
done.
2023-01-16 14:47:49 +01:00
Emin Tufan Çetin
071c6c60c0 Update Turkish translation 2023-01-15 22:47:27 +00:00
Matthias Clasen
fc24f401b7 Merge branch 'matthiasc/for-main' into 'main'
Use GtkUriLauncher where appropriate

See merge request GNOME/gtk!5432
2023-01-15 18:48:22 +00:00
Matthias Clasen
6c96e51b07 Use GtkUriLauncher where appropriate
GtkLabel, GtkLinkButton and GtkAboutDialog
all have a uri, not a file, so it makes more
sense to use a GtkUriLauncher.
2023-01-15 13:26:53 -05:00
Matthias Clasen
e703163bc4 Merge branch 'uri-launcher-demo' into 'main'
urilauncher: Fix finish function mismatch

See merge request GNOME/gtk!5431
2023-01-15 17:47:18 +00:00
Matthias Clasen
ad549cbded gtk-demo: Add a uri launcher demo 2023-01-15 11:58:43 -05:00
Matthias Clasen
673beef210 urilauncher: Fix finish function mismatch
We need to call the finish function that
matches the async function.
2023-01-15 11:58:09 -05:00
Matthias Clasen
55baa1f2e1 Merge branch 'docs-escape-xml-tag' into 'main'
Escape GtkBuilder XML tag in comment with backtick

Closes #5312

See merge request GNOME/gtk!5429
2023-01-15 15:12:28 +00:00
Arjan Molenaar
1d8a23e97b macos: Provide fallback pasteboard for gtype Dnd
The Drag data should pass through the macos pasteboard system.
We need to provide some pasteboard type. Let's make it a "URL",
which is a pretty generic type anyway.
2023-01-15 10:03:47 +01:00
Arjan Molenaar
422b4b6561 macos: No need to drag handle events
This is handled by the DraggingSource object.
2023-01-15 10:03:47 +01:00
Arjan Molenaar
27ee8b23fd macos: No need to grab a seat
The macOS DnD logic will take over anyway.
2023-01-15 10:03:47 +01:00
Arjan Molenaar
b9847795a7 macos: Support dragging from GdkMacosWindow
The handling is done similar to drag targets.
Note that dragging is a modal action on macos: no events
are sent to the main window. This could cause trouble when
we finish the drag, and not finish the gesture in GTK.
2023-01-15 10:01:56 +01:00
sunce
b13f05537b Escape GtkBuilder XML tag in comment with backtick
Escape XML tags in gi-docgen oriented comment e.g. from <child> to
`<child>`, so that they don't become HTML tag on the final webpage.
This fix includes everything from commit ff46ea64 and #5312.

Fixes #5312
2023-01-15 16:55:18 +08:00
Arjan Molenaar
757d1916ae Fix dx, dy position in gtk_drag_source_drag_begin
Coordinates are double. This change avoid an unneeded cast.
2023-01-15 09:52:43 +01:00
Matthias Clasen
0834dac6ee Merge branch 'matthiasc/for-main' into 'main'
widgetfactory: Load textures in threads

See merge request GNOME/gtk!5428
2023-01-15 04:12:47 +00:00
Matthias Clasen
3c31f72219 texture: Update docs
Document that we support TIFF as well.
2023-01-14 22:48:57 -05:00
Matthias Clasen
a0f63160d6 widgetfactory: Load textures in threads
It is useful to show how this is done, even
though the images here are not terribly large.
2023-01-14 22:38:20 -05:00
Matthias Clasen
c99d85954a Merge branch 'nielsdg/gtkwidgetactionactivatefunc-nullable-variant' into 'main'
Add missing nullable to GtkWidgetActionActivateFunc

See merge request GNOME/gtk!5424
2023-01-15 00:46:11 +00:00
Matthias Clasen
33f31d06f9 Merge branch 'uri-launcher' into 'main'
filelauncher: Plug a memory leak

See merge request GNOME/gtk!5425
2023-01-14 22:59:01 +00:00
Matthias Clasen
bf4b40f17e docs: Update deprecations for gtk_show_uri
We have a better replacement now.
2023-01-14 17:39:28 -05:00
Matthias Clasen
7aba9e3295 urilauncher: Add cross-references to the docs 2023-01-14 17:39:28 -05:00
Matthias Clasen
3080cb7acd Add GtkUriLauncher 2023-01-14 17:39:28 -05:00
Matthias Clasen
4b404f0dea Add g_openuri_portal_open_uri_async
This avoids a roundtrip through GFile and
thus works with random uri schemes.
2023-01-14 14:32:51 -05:00
Matthias Clasen
0c1c0524c7 openuri: Some reshuffling
This is in preparation of adding a method
that takes a uri instead of a GFile.
2023-01-14 14:32:51 -05:00
Matthias Clasen
b58ef290dc filelauncher: Plug a memory leak
Oops
2023-01-14 14:32:51 -05:00
Niels De Graef
1387fba7f8 Add missing nullable to GtkWidgetActionActivateFunc
The `GVariant` that is passed on to the `GtkWidgetActionActivateFunc`
can be `NULL` in case the parameter type is also `NULL`, so mark it
nullable.
2023-01-14 15:30:15 +01:00
Matthias Clasen
34b9ec5be2 Merge branch 'matthiasc/for-main' into 'main'
Fix a compiler warning

See merge request GNOME/gtk!5423
2023-01-14 05:30:10 +00:00
Matthias Clasen
cefdfbd894 icontheme: Streamline the suffix handling code 2023-01-14 00:14:43 -05:00
Matthias Clasen
3676ddbdff icontheme: Avoid some allocations
When loading icon themes, we can reuse memory
instead of allocating and freeing in a loop.
2023-01-14 00:14:43 -05:00
Matthias Clasen
7c1a0e0c15 icontheme: Keep a single string set
Instead of keeping a GtkStringSet per IconTheme,
just make one for the whole GtkIconTheme.

This avoids loops of the themes in some places, and
due to the overlap in icon names between the themes,
it reduces the amount of memory we use for the icon
names with Adwaita+hicolor from 5+4 chunks to 6 chunks.
2023-01-14 00:14:43 -05:00
Matthias Clasen
19bb043a85 testsuite: Fix various compiler warnings
These are mostly dead stores that clang
isn't happy with.
2023-01-14 00:14:43 -05:00
Matthias Clasen
fecc80b59c Fix a compiler warning
Clang things that timings can be NULL here,
and I think it might be right.
2023-01-14 00:14:41 -05:00
Matthias Clasen
1648dc36f8 Merge branch 'wip/corey/fix-docs' into 'main'
docs: Fix dependency names

See merge request GNOME/gtk!5422
2023-01-14 04:23:34 +00:00
Matthias Clasen
a27a2cbf40 Merge branch 'matthiasc/for-main' into 'main'
Silence a compiler warning

See merge request GNOME/gtk!5421
2023-01-14 00:18:50 +00:00
Corey Berla
e418656a04 docs: Fix dependency names
When gi-docgen added the "related" key, it also began checking
that the dependencies were actually dependencies otherwise they aren't
listed as dependencies.  The capitalization needs to match the
namespace.
2023-01-13 14:24:33 -08:00
Matthias Clasen
d4ec1afe44 Merge branch 'fix-spinner-stop' into 'main'
gtkcssanimatedstyle: Fix return of new_advance()

Closes #4426

See merge request GNOME/gtk!5420
2023-01-13 20:14:25 +00:00
Arjan Molenaar
420be8fb0f macos: run glib idle functions when in nested run loop
It looks like DnD starts a nested run loop. We still have to run our
GLib handlers, so animations work.
2023-01-13 20:03:55 +01:00
Christian Hergert
9c3629653f macos: abstract pasteboard for use in clipboard and drag
This will allow us to share a single NSPasteboardItem and data provider
implementation for both GdkClipboard and GdkDrag.
2023-01-13 20:03:55 +01:00
Christian Hergert
eb5cf831b1 macos: refactor pasteboard components into separate module
This will make it easier to reuse from drag integration so that we don't
require clipboards for everything.

We will need to subclass the pasteboard provider twice, however, both
for clipboard and dragging.
2023-01-13 20:03:55 +01:00
Matteo Percivaldi
374d97008b gtkcssanimatedstyle: Fix return of new_advance()
This was causing animation and transition to stop randomly and reset
their state to initial state.

This issue has existed since commit
7b68bdb831.

Closes #4426
2023-01-13 18:08:56 +01:00
Matthias Clasen
fecc923c2c Silence compiler warnings
Clang complains that these are dead stores.
They are, indeed.
2023-01-13 12:07:40 -05:00
Matthias Clasen
703ed608c0 Fix a compiler warning
Clang things that load_error might be NULL here.
It may be right.
2023-01-13 12:07:40 -05:00
Matthias Clasen
99f07c7c0a Fix a compiler warning
Clang things that timings can be NULL here,
and I think it might be right.
2023-01-13 12:07:40 -05:00
Matthias Clasen
51b4d70b8f gridview: Add a few assertions
Just to help static analysis out.

self->n_columns can't ever be 0, since
we clamp it between min_columns and
max_columns, with min_columns always
being at least one.
2023-01-13 12:07:40 -05:00
Matthias Clasen
746d12fc43 Silence a compiler warning
Clang was complaining that we never use the
value stored in mime_type. Just don't store it,
we are only interested in the side-effect
(interning the string).
2023-01-13 12:07:40 -05:00
Matthias Clasen
96ce9e10b8 Merge branch 'faster-ci' into 'main'
Add a build-testsuite option

See merge request GNOME/gtk!5419
2023-01-13 12:57:15 +00:00
Matthias Clasen
3090795351 ci: Try to speed up builds a bit
Don't build demos and tests, and only build
the testsuite where we want to run it.
2023-01-13 07:26:41 -05:00
Matthias Clasen
815b54f3df Update the build documentation 2023-01-13 07:15:15 -05:00
Matthias Clasen
9ad27e4371 Add a build-testsuite option
This will let us run the testsuite in ci without
having to build all the manual tests.
2023-01-13 07:14:33 -05:00
Matthias Clasen
a6e1804474 Merge branch 'macos-werror' into 'main'
CI: turn on -Werror for MacOS build

See merge request GNOME/gtk!5418
2023-01-13 03:08:36 +00:00
Benjamin Otte
7ae549e253 CI: turn on -Werror for MacOS build
The build is error-free and we want to keep it that way.

We'd also like to make Timm do real work instead of having to fix clang
warnings all the time and this build is a clang build.
2023-01-12 20:12:37 -05:00
Matthias Clasen
434d8ef0ea Merge branch 'wip/chergert/fix-macos-warnings' into 'main'
Fixes a few compilation warnings on macOS

See merge request GNOME/gtk!5415
2023-01-13 00:10:48 +00:00
Matthias Clasen
31a6d73635 Merge branch 'ebassi/pin-gi' into 'main'
Add gobject-introspection as a subproject

See merge request GNOME/gtk!5414
2023-01-12 23:35:23 +00:00
Christian Hergert
958ecf2855 gdk/macos: fix warning about _coreCursorType 2023-01-12 13:22:47 -08:00
Christian Hergert
fb12ad807a gsk/gl: fix warning when join_sources() is unused 2023-01-12 13:22:25 -08:00
Christian Hergert
965c52d369 gdk: fix warning when !HAVE_EGL 2023-01-12 13:22:02 -08:00
Emmanuele Bassi
474872563f Add gobject-introspection as a subproject
We pin GLib, so we must also pin g-i to the same version, otherwise
we'll get weird mismatches during development.
2023-01-12 17:56:37 +00:00
Matthias Clasen
b92e52bf0e Merge branch 'matthiasc/for-main' into 'main'
css: Avoid some allocations

See merge request GNOME/gtk!5413
2023-01-12 15:20:49 +00:00
Matthias Clasen
d226dc3812 iconcache: Be a bit less wasteful 2023-01-12 00:36:18 -05:00
Matthias Clasen
46e0fde606 css: Avoid more allocations for tokens
Make short string tokens static.
2023-01-12 00:12:09 -05:00
Matthias Clasen
1e7f525e0e css: Avoid some allocations
Avoid duplicating the function name just
for an error message.
2023-01-12 00:12:09 -05:00
Matthias Clasen
d43e0fb9a7 css: Avoid allocation for tokens
All valid dimensions are short, so store
the dimension inside the token.
2023-01-12 00:11:46 -05:00
Matthias Clasen
6fb6f47fc8 css: Avoid some allocations
Reuse the name_buffer for reading strings.
2023-01-12 00:11:11 -05:00
Matthias Clasen
0f7d8e04d8 css: Some inlining 2023-01-12 00:11:10 -05:00
Matthias Clasen
c9fca559dc Cosmetics 2023-01-12 00:11:10 -05:00
Matthias Clasen
b9d1b5d6a3 icontheme: Bit a bit less wasteful 2023-01-12 00:11:10 -05:00
Emin Tufan Çetin
5f75ba46a5 Update Turkish translation 2023-01-11 07:01:44 +00:00
Emin Tufan Çetin
2507301983 Update Turkish translation 2023-01-11 05:41:40 +00:00
Matthias Clasen
41aeff331d texthistory: Avoid g_autofree
msvc does not like it, unfortunately.
2023-01-10 22:20:57 -05:00
Matthias Clasen
3aab48ec16 Merge branch 'wip/chergert/fix-5506' into 'main'
istring: fix istring_prepend() on malloc transition

Closes #5506

See merge request GNOME/gtk!5411
2023-01-11 02:39:32 +00:00
Christian Hergert
ad0348b85e texthistory: add debugging helpers to print undo stack
This is helpful to have when tracking down issues like #5506.
2023-01-10 13:36:16 -08:00
Christian Hergert
6a134551b9 istring: fix istring_prepend() on malloc transition
When transitioning from internal to malloc, the strings were placed in
the wrong order to g_strconcat(). This fixes an issue with undo where
if you hit the boundary in just the right way, your undo stack will do
unexpected things.

Fixes #5506
2023-01-10 13:32:38 -08:00
Matthias Clasen
0e1ae6ad11 Merge branch 'matthiasc/for-main' into 'main'
Add some more text undo tests

See merge request GNOME/gtk!5410
2023-01-10 19:05:13 +00:00
Aleksandr Melman
5baf4b4b2e Update Russian translation 2023-01-10 12:57:03 +00:00
Matthias Clasen
63560061e8 Add some more text undo tests
Unsuccessfully trying to reproduce #5506.
2023-01-10 07:34:55 -05:00
Matthias Clasen
be721f5797 Merge branch 'matthiasc/for-main' into 'main'
Deprecate gdk_display_put_event

See merge request GNOME/gtk!5409
2023-01-09 21:15:08 +00:00
Matthias Clasen
0073bb79a7 Deprecate gdk_display_put_event
The documentation already tells you not to
use this function.

Ifdef the remaining users in the X11 backend.
2023-01-09 15:46:25 -05:00
Matthias Clasen
f59b506674 Merge branch 'macos-stable-dnd' into 'main'
macos: Drag and drop should not freeze applications

See merge request GNOME/gtk!5291
2023-01-09 11:52:50 +00:00
Matthias Clasen
88b4404296 Merge branch 'wip/corey/popover-accel' into 'main'
gtkmodelbutton: Ensure that accel label is always aligned to end

Closes #5504

See merge request GNOME/gtk!5407
2023-01-09 10:58:14 +00:00
Corey Berla
e20bc7723a gtkmodelbutton: Ensure that accel label is always aligned to end
When the model button just has a text label and accel text,
the button fills and the accel label is implicitly aigned to end.
When there's also a icon, even though it's not shown (because
icons are only shown if there's no text), the button doesn't fill
and the accel ends up not aligned (assuming one of the other buttons
is longer). Ensure that the accel label is aligned to the end.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5504
2023-01-08 22:32:22 -08:00
Emmanuele Bassi
7edf8841fb Merge branch 'a11y_check_null_path' into 'main'
a11y: Avoid crashing if GtkAtSpiContext::path is NULL

See merge request GNOME/gtk!5405
2023-01-09 00:14:21 +00:00
Emmanuele Bassi
6b5b7eab04 Merge branch 'doc-improvements' into 'main'
Two docs improvements

See merge request GNOME/gtk!5406
2023-01-08 22:16:49 +00:00
Marco Melorio
c775262e9d docs: Improve gtk_window_present description
Move most of the documentation from gtk_window_present_with_time and
also reword it a bit to make it more understandable.
2023-01-08 22:41:19 +01:00
Marco Melorio
553fde9761 docs: Don't mention deprecated API in gtk_widget_set_visible
That statement is true, but since that API is deprecated, it doesn't
need to be there anymore to avoid confusing people.
2023-01-08 21:49:28 +01:00
Barnabás Pőcze
f2593dec4b a11y: Use fallback logic when GApplication has no DBus object path
Use the fallback logic to generate the base path for the GtkAtSpiRoot
if the GApplication has no DBus object path to guarantee that
the base path will not stay NULL.
2023-01-08 19:58:54 +01:00
Barnabás Pőcze
ab5a6ed0f1 a11y: Check if path is NULL when removing from cache
`gtk_at_spi_cache_add_context()` checks if the GtkAtSpiContext's path
is NULL before inserting the context object into the hash table.
Do the same in `gtk_at_spi_cache_remove_context()` to avoid a NULL
pointer dereference in `g_str_hash()` during the hash table lookup
if a context with NULL path is removed. That can happen when the
GtkAtSpiRoot::base_path is NULL, which, in turn, can happen if
`g_application_get_dbus_object_path()` returns NULL.

  ==394047==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fd1966f8b84 bp 0x7fff11e3ded0 sp 0x7fff11e3de58 T0)
  ==394047==The signal is caused by a READ memory access.
  ==394047==Hint: address points to the zero page.
      #0 0x7fd1966f8b84 in g_str_hash (/usr/lib/libglib-2.0.so.0+0x37b84)
      #1 0x7fd1966f9c09 in g_hash_table_contains (/usr/lib/libglib-2.0.so.0+0x38c09)
      #2 0x7fd196062c10 in gtk_at_spi_cache_remove_context ../gtk/a11y/gtkatspicache.c:447
      #3 0x7fd19606e0a9 in gtk_at_spi_root_unregister ../gtk/a11y/gtkatspiroot.c:653
      #4 0x7fd196067f58 in gtk_at_spi_context_unrealize ../gtk/a11y/gtkatspicontext.c:1559
      #5 0x7fd195ced97f in gtk_at_context_unrealize ../gtk/gtkatcontext.c:668
      #6 0x7fd195f5576e in gtk_widget_unroot_at_context ../gtk/gtkwidget.c:2399
      #7 0x7fd195f55bd2 in gtk_widget_unroot ../gtk/gtkwidget.c:2499
      ...
2023-01-08 19:56:49 +01:00
Matthias Clasen
dd3cdc52f5 Fix code style 2023-01-08 14:41:11 +00:00
Matthias Clasen
5a3156a8b7 gdk: Update docs
Update the docs for gdk_display_get_monitor_at_surface.
2023-01-07 21:35:29 -05:00
Matthias Clasen
a4c2f19155 Merge branch 'gdk-display-get-monitor-is-nullable' into 'main'
gdkdisplay: Document get_monitor_at_surface can return NULL

Closes #5075

See merge request GNOME/gtk!4917
2023-01-07 20:39:04 +00:00
Matthias Clasen
be8fb1e9b8 Merge branch 'more-filesystemmodel-cleanups' into 'main'
filesystemmodel: Crop tree model cruft

See merge request GNOME/gtk!5402
2023-01-07 18:42:14 +00:00
Matthias Clasen
52c97dbf67 Merge branch 'win-file-ext' into 'main'
filechoosernativewin32: Set default extension

See merge request GNOME/gtk!5266
2023-01-07 18:14:37 +00:00
robxnano
57ebf26f15 filechoosernativewin32: Set default extension 2023-01-07 18:14:36 +00:00
Matthias Clasen
32247bc50e filesystemmodel: Drop tree model cruft
We no longer need the placeholder item for the
editable, so drop it.
2023-01-07 12:22:25 -05:00
Matthias Clasen
ad940bc892 filesystemmodel: Rename private header 2023-01-07 12:01:15 -05:00
Matthias Clasen
7d34e7e0f7 Merge branch 'filesystemmodel-cleanups' into 'main'
filesystemmodel: Cleanup unused defines

See merge request GNOME/gtk!5401
2023-01-07 14:36:20 +00:00
Georges Basile Stavracas Neto
b2f43076bd gtkfilesystemmodel: Use g_clear_* helpers
Saves some code.
2023-01-07 09:17:37 -05:00
Georges Basile Stavracas Neto
202e889577 filesystemmodel: Use G_DECLARE_FINAL_TYPE()
Clean up boilerplate. It's a private object anyway.
2023-01-07 09:17:37 -05:00
Georges Basile Stavracas Neto
a8690c84ab filesystemmodel: Cosmetics
Adjust code style, and shuffle some functions around. Remove
unhelpful doc comments.
2023-01-07 09:17:15 -05:00
Matthias Clasen
35244f4b59 filesystemmodel: Use g_set_object 2023-01-07 09:12:44 -05:00
Georges Basile Stavracas Neto
503c3ec04d filesystemmodel: Make function private to gtkfilesystemmodel.c
The _gtk_file_system_model_update_file() function is not used outside
GtkFileSystemModel, so no need to expose it in the header.

Shuffle it around in code, and remove it from the header.
2023-01-07 08:44:40 -05:00
Georges Basile Stavracas Neto
4a5a466975 filesystemmodel: Cleanup unused defines
They were made unused with the removal of GtkTreeModel interface
implementation.
2023-01-07 08:44:34 -05:00
Matthias Clasen
e694511da3 Merge branch 'werror-fixes' into 'main'
gtk-launch: Remove compile-time warning

See merge request GNOME/gtk!5400
2023-01-07 13:22:20 +00:00
Matthias Clasen
0a94827b9c Merge branch 'wip/corey/calendar' into 'main'
calendar: Fix marked days

See merge request GNOME/gtk!5399
2023-01-07 13:11:01 +00:00
Corey Berla
735cf301a4 calendar: Set marked days immediately
The marked days are set only as part of gtk_calendar_select_day().
This is insufficient, especially because the day-selected signal
is emitted after the marked days are set in gtk_calendar_select_day().
2023-01-06 20:37:54 -08:00
Corey Berla
e8a29f90d1 calendar: Only apply the marked_day to the current month
The marked day gets applied to the current month, and either the previous
or subsequent month if they are visible within the current month.
This doesn't make any sense and likely was an accidental regression
in a6f9052cf1.  Clarify the docs.
2023-01-06 20:21:35 -08:00
Corey Berla
182cc74834 calendar: Add css style for marked days
As part of a6f9052cf1, marked days lost
their style, essentially making that function worthless.  Previously,
they were simply bolded, but that doesn't give them proper justice.
2023-01-06 20:21:35 -08:00
Matthias Clasen
7801dd8944 Merge branch 'wip/phako/fix-activate-action-annotation' into 'main'
widget: Mark format as nullable in activate_action

See merge request GNOME/gtk!4653
2023-01-07 01:06:00 +00:00
Matthias Clasen
38e090f5c1 Merge branch 'main' into 'main'
Fix a typo

See merge request GNOME/gtk!5170
2023-01-07 00:59:32 +00:00
Benjamin Otte
998c382037 build: Turn off tautological-constant-out-of-range-compare warning
This issues a warning when an enum value is compared to a value that is
out of range for the enum.

We do this a lot, either when using -1 for undefined values or when
comparing array sizes to enum values like so:

  enum {
    ONE,
    TWO,
    THREE
  } some_enum_value;
  const char *names= { "one", "two", "three" };

  g_assert (some_enum_value < G_N_ELEMENTS (names));
2023-01-06 19:46:58 -05:00
Benjamin Otte
ac81e71f78 gtk-launch: Fix unused variable warning on macOS 2023-01-06 19:46:58 -05:00
Benjamin Otte
de271c9a30 ci: Disable -Werror on all subprojects
Would be nice if meson had a nicer way of doing this, but...
2023-01-06 19:46:58 -05:00
Benjamin Otte
bf3cf8bb29 glcontext: Avoid gcc warning on non-egl build 2023-01-06 19:46:58 -05:00
Benjamin Otte
63fa5b7f52 gtk-launch: Remove compile-time warning
This warning causes a -Werror build to fail.
2023-01-06 19:46:58 -05:00
Matthias Clasen
96add330f5 Merge branch 'wayland-surface-split3' into 'main'
Split gdksurface-wayland.c

See merge request GNOME/gtk!5217
2023-01-06 22:35:34 +00:00
Matthias Clasen
44aa6a891a Drop gdkpopup-wayland-private.h
It is empty now.
2023-01-06 17:02:03 -05:00
Matthias Clasen
7a30a21405 waylandsurface: Introduce a few vfuncs 2023-01-06 17:00:45 -05:00
Matthias Clasen
2b3eadcfa4 waylandpopup: Drop unused exports 2023-01-06 16:50:20 -05:00
Matthias Clasen
352443d5a5 waylandtoplevel: Drop unused exports 2023-01-06 16:50:20 -05:00
Matthias Clasen
3574fde770 More cleanups 2023-01-06 16:50:20 -05:00
Matthias Clasen
793689789c Misc cleanups
Detangle compute_size, among other things.
2023-01-06 16:50:19 -05:00
Matthias Clasen
120396fa40 wip: Split off GdkWaylandPopup
Like the GdkWaylandToplevel split-off, this needs some
more cleanup.
2023-01-06 16:50:19 -05:00
Matthias Clasen
d61ec38974 wip: Split off GdkWaylandToplevel
This still needs some more cleanup.
2023-01-06 16:50:19 -05:00
Matthias Clasen
2a463baed0 wayland: Rearrange the surface code 2023-01-06 16:50:19 -05:00
Matthias Clasen
348acde6bd wayland: Split public headers
Split gdkwaylandsurface.h into itself,
gdkwaylandtoplevel.h and gdkwaylandpopup.h.
This is in preparation for splitting the
types for real.
2023-01-06 13:47:34 -05:00
Matthias Clasen
5ba793842b wayland: Split display_server sub-structs
Move these to GdkWaylandToplevel and GdkWaylandPopup
as appropriate.
2023-01-06 13:47:34 -05:00
Matthias Clasen
149b608bfc wayland: Move next_layout into popup and toplevel
This is where it belongs.
2023-01-06 13:47:34 -05:00
Matthias Clasen
3348ea81f2 wayland: Move pending toplevel state to GdkWaylandToplevel
Another toplevel-only thing.
2023-01-06 13:47:34 -05:00
Matthias Clasen
63e69131bd wayland: Move input_grab_seat to GdkWaylandPopup
This is popup-only functionality.
2023-01-06 13:47:34 -05:00
Matthias Clasen
d42a34b0b3 wayland: Move reposition_token to GdkWaylandPopup
This is only used for popups, so move it there.
2023-01-06 13:47:34 -05:00
Matthias Clasen
5ee10fc669 wayland: Move shortcuts_inhibitors to GdkWaylandToplevel
Another toplevel-only feature.
2023-01-06 13:47:22 -05:00
Matthias Clasen
b0a4917ce4 wayland: Move imported_transient_for to GdkWaylandToplevel
Another toplevel-only thing.
2023-01-06 13:47:22 -05:00
Matthias Clasen
47e22d6301 wayland: Move geometry hints to GdkWaylandToplevel
Another toplevel-only thing.
2023-01-06 13:47:12 -05:00
Matthias Clasen
b970b60503 wayland: Move title to GdkWaylandToplevel
This is a toplevel property.
2023-01-06 13:47:06 -05:00
Matthias Clasen
7406f8165d wayland: Move drag surfaces to their own file 2023-01-06 13:46:58 -05:00
Matthias Clasen
9435e689c3 wayland: Drop create_dnd_surface
It is only used in one place.
2023-01-06 13:46:58 -05:00
Matthias Clasen
66c947b86b Merge branch 'swap-3-4' into 'main'
docs: Place example-{3,4} in numerical order

See merge request GNOME/gtk!5319
2023-01-06 18:06:55 +00:00
Matthias Clasen
ad1af87834 Merge branch 'gtk4-fix-xdg-activation-set-surface' into 'main'
gdk/wayland: set requesting surface to xdg-activation

See merge request GNOME/gtk!5293
2023-01-06 14:03:01 +00:00
Matthias Clasen
68700f8722 Merge branch 'drop-file-dialog-shortcuts' into 'main'
filedialog: Drop shortcut folders

See merge request GNOME/gtk!5396
2023-01-06 13:35:14 +00:00
Matthias Clasen
f76270167c Merge branch 'wip/otte/for-5496' into 'main'
filedialog: Never set the chooser's file

Closes #5496

See merge request GNOME/gtk!5393
2023-01-06 13:34:55 +00:00
Matthias Clasen
2a442c4fbb Merge branch 'macos-command-symbol' into 'main'
macos: Use Command key symbol in Keyboard shortcuts window

See merge request GNOME/gtk!5296
2023-01-06 13:17:36 +00:00
Matthias Clasen
9356dfc404 filedialog: Drop shortcut folders
The filechooser portal does not support this,
and we are defaulting to using the portal now.
Lets not offer a non-functional API.
2023-01-06 07:40:57 -05:00
Matthias Clasen
7eb8439047 Merge branch 'matthiasc/for-main' into 'main'
testfiledialog: Be more lenient

See merge request GNOME/gtk!5395
2023-01-06 12:34:10 +00:00
Matthias Clasen
0ccf9ad8fc testfiledialog: Be more lenient
Accept both open_multiple and open-multiple.
2023-01-06 07:12:36 -05:00
Arjan Molenaar
c52978dfa4 macos: Command should not come from gettext
Instead, just provide the right character.

See also
https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkaccelgroup.c#L916.
2023-01-06 12:08:55 +01:00
Matthias Clasen
52dfa54301 Merge branch 'test-file-dialog' into 'main'
Test file dialog

See merge request GNOME/gtk!5394
2023-01-06 04:28:28 +00:00
Matthias Clasen
b6f9e00a9e Add a test for GtkFileDialog 2023-01-05 23:13:58 -05:00
Matthias Clasen
8780aa02d7 filedialog: Cosmetics 2023-01-05 23:06:31 -05:00
Benjamin Otte
8d5a39d765 Merge branch 'wip/corey/dnd-use-cursor' into 'main'
Fix accidental DnD

See merge request GNOME/gtk!5275
2023-01-05 22:39:26 +00:00
Benjamin Otte
446e6a8d62 filedialog: Never set the chooser's file
Instead, get by with setting the name and hope the filechooser figures
things out by itself.

Fixes #5496
2023-01-05 21:30:15 +01:00
Matthias Clasen
9b1bee99b8 Merge branch 'openuri-activation-token' into 'main'
Pass an activation token to OpenURI

See merge request GNOME/gtk!5389
2023-01-05 14:06:14 +00:00
Matthias Clasen
77cf0f1719 Merge branch 'filechooser-multi-folder' into 'main'
filechooser: Don't assert for possible cases

Closes #5494

See merge request GNOME/gtk!5392
2023-01-05 14:01:35 +00:00
Matthias Clasen
fc1f1366b4 filechooser: Don't assert for possible cases
switch_to_selected_folder can be called when the
selection contains more than one item. Handle it
like it used to be handled: switch to the first
folder we find.

Fixes: #5494
2023-01-05 08:41:33 -05:00
Matthias Clasen
6efd1a9dad Pass an activation token to OpenURI
The OpenURI portal can take an activation_token
nowadays. So it give one.
2023-01-04 16:39:24 -05:00
Matthias Clasen
8349ae2bc4 x11: Make a call NULL-safe
Make it safe to call gdk_x11_app_launch_context_get_startup_notify_id
with a NULL info.
2023-01-04 16:37:31 -05:00
Matthias Clasen
7c5c843b5b Merge branch 'matthiasc/for-main' into 'main'
Drop gtkmain.c from POTFILES

See merge request GNOME/gtk!5390
2023-01-04 17:22:54 +00:00
Matthias Clasen
bc11bc4f8d Drop gtkmain.c from POTFILES
No longer any translations here.
2023-01-04 12:03:01 -05:00
Matthias Clasen
be24e4a1f7 Merge branch 'deprecate-toggled' into 'main'
Deprecate gtk_toggle_button_toggled

See merge request GNOME/gtk!5388
2023-01-04 12:57:32 +00:00
Matthias Clasen
918ff1d0f4 Deprecate gtk_toggle_button_toggled
The function is documented as useless.
2023-01-04 07:32:51 -05:00
Anders Jonsson
20723613bc Update Swedish translation 2023-01-04 12:32:38 +00:00
Matthias Clasen
604aafe15d Merge branch 'wip/carlosg/startup-vs-focus' into 'main'
Consider startup vs focus requests for the Wayland platform

See merge request GNOME/gtk!5386
2023-01-03 15:14:35 +00:00
Carlos Garnacho
4041ca0f69 gdkdisplay: Deprecate gdk_display_notify_startup_complete()
We have various layers where we store the startup ID for a request,
since this API does not have a GdkToplevel that we can refer about
for the Wayland platform, this is the most obvious candidate to
start untangling these various layers.

Deprecate this call, it is already unused in the gtk/ side.
2023-01-03 14:58:33 +01:00
Carlos Garnacho
3526d8b299 gtkapplication: Do not call gdk_display_notify_startup_complete()
This should do nothing worthwhile anymore, the X11/Wayland GtkApplication
implementations do already pass the startup ID from the platform_data
via windowing specific APIs, and the application handling the request
via show()/present() should trigger the activation request.
2023-01-03 14:58:33 +01:00
Carlos Garnacho
e8adfa2a88 gtkwindow: Shuffle gdk_toplevel_set_startup_id() calls
While this used to be tangential to windows showing or requesting
focus, the xdg-activation Wayland protocol does merge both concepts
together.

But also, for a correct interaction with the compositor, the
toolkit should ideally merge the activation request resulting from
both into the same one, so that the gdk_toplevel_focus() request
replies to the startup token that started the application and
correct focus-stealing prevention/etc happens, instead making up
one just in time for the focus request.

This kind of requires doing things in the right order, a show()
request on the GtkWindow should activate any pending activation
token on the toplevel, a present() request should additionally
create a new token if there was none pending. And
xdg_activation_v1_activate() should happen once on both.

Shuffle the gdk_toplevel_set_startup_id() calls so that this
happens in the right order for Wayland, while making X11 happy
too.
2023-01-03 14:58:33 +01:00
Carlos Garnacho
7fab1b85ad gdk/x11: Emit "remove" s-n message from gdk_toplevel_set_startup_id
In the way towards deprecating gdk_display_notify_startup_complete(),
make gdk_toplevel_set_startup_id() on X11 perform this piece of messaging
itself. It should be harmless that the message is emitted twice, if
callers do still use that API.
2023-01-03 14:58:25 +01:00
Carlos Garnacho
5aeabdb3d4 gdk/wayland: Perform xdg_activation on gdk_toplevel_set_startup_id
This call has everything to perform activation as specified by the
xdg_activation protocol, notably a surface to activate as opposed to
gdk_display_notify_startup_complete().

Make activation happen here, so that the surface gets activated when
its gets a startup ID assigned.
2023-01-03 14:57:49 +01:00
Carlos Garnacho
6f01f846dc gtkwindow: Minor refactor
Move the handling of the startup ID to a separate function, since
this will be called from several places.
2023-01-03 14:57:44 +01:00
Matthias Clasen
3c4f6144a0 Merge branch 'fix-introspection' into 'main'
meson.build: build introspection according to option only

See merge request GNOME/gtk!5382
2023-01-03 11:56:49 +00:00
Alexander Kanavin
ae71d338d7 meson.build: build introspection according to option only
The way the check is written, if the build is native, then the
introspection option has no effect.

Particularly yocto project does want to disable introspection in
native builds and enable it in cross builds (both via the option),
and without this patch the former is not possible.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
2023-01-03 08:26:07 +01:00
Matthias Clasen
8b469a2727 Merge branch 'nullable-gdk' into 'main'
gdk_display_open: Mark arg as nullable

See merge request GNOME/gtk!5380
2023-01-03 00:25:55 +00:00
Matthias Clasen
53813f24f0 Merge branch 'matthiasc/for-main' into 'main'
ci: Enable introspection for the docs build

See merge request GNOME/gtk!5383
2023-01-02 21:53:58 +00:00
Matthias Clasen
1fde83f12b Merge branch 'direction-from-language' into 'main'
Determine direction from language

See merge request GNOME/gtk!5385
2023-01-02 21:50:54 +00:00
Matthias Clasen
1f7783224b Determine direction from language
We can determine the direction to return here
without relying on translations, by using pango
and HarfBuzz apis to go
language -> script -> direction.
2023-01-02 16:30:27 -05:00
Matthias Clasen
0d04ceda76 Merge branch 'ccook/doc-changes-2' into 'main'
Various documentation suggests across a few domains.

See merge request GNOME/gtk!5384
2023-01-02 20:40:54 +00:00
Cam Cook
9396ccf9ff Various documentation suggests across a few domains.
| domain | current | suggestion |
|--------|---------|------------|
| [GtkSeparator](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkseparator.c#L39)    | "`![An example GtkSeparator](separators.png)`" | "`![An example GtkSeparator](separator.png)`" [1] |
| [GtkTextBuffer](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbuffer.c#L4885)  | "if there is an redoable action" | "if there is a redoable action" |
| [GtkTextBuffer/get_enable_undo](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbuffer.c#L5005) | (Renders `No description available.`) | "Returns: %TRUE if undoing and redoing changes to the buffer is allowed." [3] |
| [GtkTextBuffer/get_max_undo_levels](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbuffer.c#L5102) | (Renders `No description available.`)| "Returns: The max number of undo levels allowed (0 indicates unlimited)." |
| [GtkTextBuffer](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbuffer.c#L3874) | "with gtk_text_buffer_add_selection_clipboard()." | "with [method@Gtk.TextBuffer.add_selection_clipboard]" |
| [GtkTextBuffer](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbuffer.c#L3494) | "it will automatically toggled" | "it will automatically toggle" |

* [1] See : [separator.png](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gtk/images/separator.png), [gtk4.toml.in](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gtk/gtk4.toml.in#L218), [visual_index.md](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gtk/visual_index.md?plain=1#L16)
* [2] Taken from `enable-undo` [property description](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbuffer.c#L516)

* [GtkTextMark/gtk_text_mark_set_visible](https://docs.gtk.org/gtk4/method.TextMark.set_visible.html) is defined in [GtkTextMark's header](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextmark.h#L93), but implemented in [GtkTextBTree](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbtree.c#L3036).
  * Other than being kind of confusing, this causes `gtk_text_mark_set_visible()`'s doc to not render where it expects it to.
2023-01-02 13:47:55 -05:00
Matthias Clasen
5a68639788 ci: Enable introspection for the docs build
It is required, so lets not rely on defaults.
2023-01-02 11:27:22 -05:00
Matthias Clasen
85df554ec1 Fix compiler warnings 2023-01-02 11:18:54 -05:00
Matthias Clasen
8776ebfe90 Merge branch 'dependency-review' into 'main'
Dependency review

See merge request GNOME/gtk!5381
2023-01-02 16:14:24 +00:00
Matthias Clasen
83eee03b0f build: Use the current gdk-pixbuf as subproject
This commit has fixes for subproject use that we need,
and is not in a release yet.
2023-01-02 10:57:52 -05:00
Matthias Clasen
d7bba4ebac build: Use libcloudproviders 0.3.1 as subproject 2023-01-02 10:57:52 -05:00
Matthias Clasen
40e2b5b153 build Use current libepoxy as subproject
We need recent fixes for graphene subproject use,
so use the current HEAD of master until there is
a release with these fixes.
2023-01-02 10:57:52 -05:00
Matthias Clasen
f7a7313758 build: Use the current graphene as subproject
We need recent fixes for graphene subproject use,
so use the current HEAD of master until there is
a release with these fixes.
2023-01-02 10:57:52 -05:00
Matthias Clasen
2d9ce0357f build: Use wayland 1.21.0 as subproject 2023-01-02 10:57:52 -05:00
Matthias Clasen
0ea05896df build: Use wayland-protocols 1.25 as subproject 2023-01-02 10:57:52 -05:00
Matthias Clasen
8c638df147 build: Use pango 1.50.12 as subproject 2023-01-02 10:57:52 -05:00
Matthias Clasen
6605ded4c9 build: Use fribidi 1.0.12 as subproject 2023-01-02 10:57:52 -05:00
Matthias Clasen
ba1a9530c8 build: Use cairo 1.17.6 as subproject
We don't want to use cairo 1.16, since it is
too old, so use 1.17.6 for now until there
is a stable 1.18 release.
2023-01-02 10:57:52 -05:00
Matthias Clasen
a9fcea369e build: Use glib 2.74.4 as subproject
This is the latest stable release.
2023-01-02 10:57:44 -05:00
Matthias Clasen
ca2787fbba build: Pass gobject_types=true to graphene
This is required for graphene-gobject to be built.
2023-01-02 09:15:59 -05:00
Matthias Clasen
6d2c897dfc build: Bump introspection dep to 1.72
This should be kept in sync with glib.
2023-01-02 09:15:56 -05:00
Matthias Clasen
01f81b2d77 build: Bump graphene req to 1.10
So we don't require an unstable version.
2023-01-02 09:15:56 -05:00
Sabri Ünal
8a3c5c63e8 Update Turkish translation 2023-01-02 13:58:10 +00:00
Maximiliano Sandoval R
b688f47776 gdk_display_open: Mark arg as nullable 2023-01-02 11:49:06 +01:00
Matthias Clasen
e126110ae0 Merge branch 'wide-inspector' into 'main'
inspector: Avoid super-wide window

See merge request GNOME/gtk!5379
2022-12-31 20:07:45 +00:00
Matthias Clasen
f98406b080 Merge branch 'annotate-dialog-deprecation' into 'main'
docs: Annotate GtkDialog deprecation

See merge request GNOME/gtk!5376
2022-12-31 20:07:20 +00:00
Matthias Clasen
40a2910262 inspector: Avoid super-wide window
Ellipsize values that can get long, to avoid
forcing an excessively wide window.
2022-12-31 12:30:40 -05:00
Marco Melorio
ec84077486 docs: Annotate GtkDialog deprecations 2022-12-30 15:37:11 +01:00
Benjamin Otte
188f9269b7 Merge branch 'wip/corey/list-item-visible' into 'main'
listitemwidget: Setup factory only once the widget is visible

See merge request GNOME/gtk!5374
2022-12-29 22:21:43 +00:00
Corey Berla
7ad693f865 gtkcolumnviewcolumn: Only create cells when the column is visible
It's a big performance drag to create many cells (and their associated
widgets) for columns that may never be shown. Only create cells
is the column is visible, and subsequently create/remove cells
when in column_set_visible.
2022-12-29 11:11:40 -08:00
Yosef Or Boczko
913e3680f3 Update Hebrew translation 2022-12-27 21:46:52 +00:00
Matthias Clasen
f3ad6015c6 Merge branch 'wip/corey/notify-drop-value' into 'main'
gtkdroptarget: Notify value property on local drag

See merge request GNOME/gtk!5372
2022-12-27 16:45:16 +00:00
Corey Berla
4e694c1824 gtkdroptarget: Notify value property on local drag
The value property is only getting notified when it's unset
or when it's set from gdk_drop_real_value_async().  Make sure
to always notify :value when its changed
2022-12-27 08:11:53 -08:00
Matthias Clasen
0214cb5b1b Post-release version bump 2022-12-26 07:22:39 -05:00
Matthias Clasen
12bd668f4d 4.9.2 2022-12-26 06:41:21 -05:00
Matthias Clasen
f7fb069e2f Updates 2022-12-25 09:25:45 -05:00
Matthias Clasen
7213bf5b09 Merge branch 'wip/otte/for-main' into 'main'
GtkDialog: Various API changes

See merge request GNOME/gtk!5251
2022-12-24 15:14:17 +00:00
Matthias Clasen
5eb4a3af0d filedialog: Handle initial-folder being NULL
This showed up as test failure in ci.
2022-12-24 09:01:16 -05:00
Benjamin Otte
c4c747d2ad alertdialog: Rephrase docs for show() a bit
In particular, discuss what to do about cancellables.

Related: !5326
2022-12-24 07:56:57 -05:00
Benjamin Otte
671fad5f34 filedialog: Clarify interaction of :filters and :default-filter 2022-12-24 07:56:57 -05:00
Benjamin Otte
1b9c45b660 filedialog: Rename :current-filter to :default-filter
The last "current" removed from properties. None of these are current.
2022-12-24 07:56:57 -05:00
Benjamin Otte
e2f730c0bf filedialog: Add gtk_file_dialog_set_initial_file()
A shortcut for setting initial-folder and initial-name at the same time.

We can remove all arguments from the actual async calls this way.
2022-12-24 07:56:57 -05:00
Benjamin Otte
8a2d35b9fb filedialog: Add gtk_file_dialog_set_initial_name() 2022-12-24 07:56:57 -05:00
Benjamin Otte
26cec4a021 filedialog: Rename current-folder to initial-folder
It's not the current one - unlike in GtkFileChooser - because there are
no live updates. So we use a more descriptive name.
2022-12-24 07:56:57 -05:00
Benjamin Otte
8d8e83afa2 fontdialog: Handle Escape better
Closing the dialog by hitting Escape should
have the same effect as clicking the cancel
button. Make it so.
2022-12-24 07:56:57 -05:00
Benjamin Otte
381bb84f3d alertdialog: Bring the GError back
Make sure we have a GError, so that dismissing and cancelling can be
separated.
2022-12-24 07:56:57 -05:00
Benjamin Otte
977fedfdf1 dialog: GTK_DIALOG_ERROR_ABORTED => GTK_DIALOG_ERROR_CANCELLED
This is done via the GCancellable, so let's call it cancelling.
2022-12-24 07:56:57 -05:00
Benjamin Otte
8957302bd4 dialog: GTK_DIALOG_ERROR_CANCELLED => GTK_DIALOG_ERROR_DISMISSED
The term "cancelling" is used with GCancellable, a user clicking a close
button is not that.
User input is usually described as "dismissing", so we use that term.
2022-12-24 07:56:57 -05:00
Benjamin Otte
8a7f739f9f directorylist: Always add standard::name
glib can't figure out how to do that, so we need to do that ourselves.
2022-12-24 07:56:57 -05:00
Matthias Clasen
fce4810fb4 Merge branch 'ccook/doc-changes-1' into 'main'
Various spelling mistakes across a few domains that show up in documentation.

See merge request GNOME/gtk!5370
2022-12-24 12:52:19 +00:00
Matthias Clasen
d5ba76a82c Merge branch 'wip/carlosg/autohide-checks-on-x11' into 'main'
gdk/surface: Handle clicks outside client surfaces

See merge request GNOME/gtk!5369
2022-12-24 12:50:09 +00:00
Cam Cook
1cd44ec7b7 Make stylecheck happy 2022-12-23 11:21:18 -05:00
Cam Cook
424d56830a Merge remote-tracking branch 'upstream/main' into ccook/doc-changes-1 2022-12-23 11:02:18 -05:00
Cam Cook
7fc4d02851 Various spelling mistakes across a few domains that show up in documentation.
| domain | current | suggestion |
|--------|---------|------------|
| [GtkAspectFrame](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkaspectframe.c#L457)    | "requistion of the child" | "requisition of the child" |
| [GtkPaned](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkpaned.c#L2500)               | "(attributes org.gtk.Method.set_propery=wide-handle)" | "(attributes org.gtk.Method.set_property=wide-handle)"|
| [GtkPopover](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkpopover.c#L2484)           | "with gtk_popover_set_offset()." | "with [method@Gtk.Popover.set_offset()]." |
| [GtkPopoverMenu](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkpopovermenu.c#L859)    | "with gtk_popover_menu_add_child()" | "with [method@Gtk.PopoverMenu.add_child()]" |
| [GtkSelectionModel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkselectionmodel.c#L316) | "the queired range" | "the queried range" |
| [GtkScrolledWindow](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkscrolledwindow.c#L76) | "automatically removed hen" | "automatically removed when"|
| [GtkSearchBar](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtksearchbar.c#L425)         | "Connects the \`GtkEditable widget" | "Connects the `GtkEditable` widget" |
2022-12-23 11:01:07 -05:00
Carlos Garnacho
e7f798dcf5 gdk/surface: Handle clicks outside client surfaces
The owner_events=TRUE grab makes GDK on X11 see events happening
outside every client window as received on the grab window.
Additionally check that the pointer is inside the grab window
(i.e. it received GDK_CROSSING_NORMAL crossing events for the
core pointer) in order to handle clicks happening outside client
windows.

These new paths are expected to be a no-op on Wayland, and to
also work for touchscreen input on X11, due to emulated pointer
events.
2022-12-23 16:12:03 +01:00
Yuri Chornoivan
f6bd63c9ad Update Ukrainian translation 2022-12-23 13:49:23 +00:00
Matthias Clasen
99320f99c3 Merge branch 'wip/ignazp/clipboard_eol' into 'main'
clipboard: improve EOL conversion of plain text

See merge request GNOME/gtk!5367
2022-12-22 13:31:07 +00:00
Ignazio Pillai
8ecb624934 clipboard: improve EOL conversion of plain text
Handle the case of clipboard text with CR line endings
2022-12-22 12:55:30 +01:00
Matthias Clasen
123eebb93d Merge branch 'tweak-gtkfilechooser-button-tooltips' into 'main'
GtkFileChooser: Tweak Grid View & List View button tooltips

See merge request GNOME/gtk!5345
2022-12-21 12:39:53 +00:00
Emmanuele Bassi
b6596d5313 Merge branch 'remove_a11y_name_fallback' into 'main'
Don't present GTK class names to assistive technologies even as a fallback

Closes gnome-control-center#2244

See merge request GNOME/gtk!5365
2022-12-21 11:06:20 +00:00
Lukáš Tyrychtr
ffe333a21f Don't present GTK class names to assistive technologies even as a fallback
A screen reader user is not interested in GTK internals, for example,
he does not care whether a button is an image button or not,
and a screen reader will report the fact that it is a button anyway.
Same applies for GtkEntry widgets, for example.

This actually is sufficient to fix gnome-control-center#2244.
And, according to the discussion in #5145, it should be fine.
2022-12-21 11:35:46 +01:00
Matthias Clasen
257ca10eb1 Merge branch 'file-nullable' into 'main'
filelauncher: Make set_file argument nullable

See merge request GNOME/gtk!5357
2022-12-21 03:23:58 +00:00
Benjamin Otte
ae097d9674 Merge branch 'wip/antoniof/listbase-rubberband-better-fix' into 'main'
listbase: Cancel rubberband if not handling drag

See merge request GNOME/gtk!4831
2022-12-21 01:14:57 +00:00
Luca Bacci
1659c59410 Merge branch 'include-hicolor-index-theme-as-resource-rebased' into 'main'
Include hicolor index.theme as a resource (rebased)

Closes #5303

See merge request GNOME/gtk!5361
2022-12-20 16:08:11 +00:00
Luca Bacci
cf91e09d75 Include hicolor index.theme as a resource
index.theme file copied from upstream xdg/default-icon-theme
repository at tag 0.17:

https://gitlab.freedesktop.org/xdg/default-icon-theme/-/tree/0.17

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5303
2022-12-20 16:30:00 +01:00
Emmanuele Bassi
020636c49f Merge branch 'revert-09691ead' into 'main'
Revert "Merge branch 'include-hicolor-index-theme-as-resource' into 'main'"

See merge request GNOME/gtk!5360
2022-12-20 15:22:28 +00:00
Luca Bacci
59df956f4f Revert "Merge branch 'include-hicolor-index-theme-as-resource' into 'main'"
This reverts merge request !5341
2022-12-20 13:23:51 +00:00
Matthias Clasen
09691ead4c Merge branch 'include-hicolor-index-theme-as-resource' into 'main'
Include hicolor index.theme as a resource

Closes #5303

See merge request GNOME/gtk!5341
2022-12-20 12:24:25 +00:00
Maximiliano Sandoval R
18a7f715c4 filelauncher: Make set_file argument nullable 2022-12-20 11:08:47 +01:00
Aleksandr Melman
d1347bbf33 Update Russian translation 2022-12-20 09:33:25 +00:00
Matthias Clasen
1b816c91d0 Merge branch 'fix-asan-more' into 'main'
ci: Disable f16c for asan

See merge request GNOME/gtk!5356
2022-12-20 06:04:46 +00:00
Matthias Clasen
5df0cbfa69 ci: Disable f16c for asan
It appears that f16c crashes asan instantly.
2022-12-20 00:43:59 -05:00
Matthias Clasen
47b5d0d546 Merge branch 'no-more-installed-tests' into 'main'
build: Drop the install-tests option

See merge request GNOME/gtk!5352
2022-12-20 05:33:56 +00:00
Matthias Clasen
4f65c121b7 ci: More verbose output from asan 2022-12-20 00:32:51 -05:00
Matthias Clasen
a0de7884cd Merge branch 'another-flaky-reftest' into 'main'
ci: Declare a reftest as flaky

See merge request GNOME/gtk!5354
2022-12-20 05:07:51 +00:00
Matthias Clasen
b5b9cb189f Merge branch 'macos-ci-is-iffy' into 'main'
ci: Mark macos build as allow-fail

See merge request GNOME/gtk!5355
2022-12-20 05:02:25 +00:00
Matthias Clasen
ee2152ff5c ci: Mark macos build as allow-fail
It fails too often, and it never does us
any good.
2022-12-19 23:55:13 -05:00
Matthias Clasen
d8d5cace2a ci: Declare a reftest as flaky
fixed-widget-stacking is failing frequently due
to a blinking cursor showing up in one of the
windows in ci.
2022-12-19 23:52:51 -05:00
Matthias Clasen
21e9a508bd Merge branch 'fix-gtk_doc=true' into 'main'
meson: Require gi-docgen when gtk_doc is required

See merge request GNOME/gtk!5351
2022-12-20 04:17:22 +00:00
Matthias Clasen
3121f88265 build: Drop the install-tests option
We no longer use installed tests in CI,
so lets reap the benefit and simplify
our build setup for tests.
2022-12-19 23:12:47 -05:00
Matthias Clasen
b56224fc16 Merge branch 'fix-introspection-test-deps' into 'main'
build: Lift gir and build_gir to toplevel

See merge request GNOME/gtk!5350
2022-12-20 04:04:17 +00:00
Nirbheek Chauhan
4346a33a63 meson: Require gi-docgen when gtk_doc is required
Fixes build with only `-Dgtk_doc=true` without
`-Dintrospection=enabled`:

    Program gi-docgen found: NO
    Configuring gdk4.toml using configuration

    docs/reference/gdk/meson.build:13:2: ERROR: Tried to use not-found external program in "command"

`introspection` is `auto` by default.

The rest of the docs build is only contingent on
`if get_option('gtk_doc')` so we should use the same restriction here.

We check for `build_gir` below already, and the gi-docgen subproject
itself does not need gobject-introspection so it's fine to do it like
this.
2022-12-20 09:27:48 +05:30
Matthias Clasen
596f59f471 tests: Maybe skip introspection tests
If we don't find the python gi module,
skip the introspection test.
2022-12-19 22:38:38 -05:00
Matthias Clasen
d758754f20 build: Lift gir and build_gir to toplevel
build_gir is used in multiple subdirectories,
so it is a bit nasty that it is defined in
one too.
2022-12-19 22:38:38 -05:00
Emmanuele Bassi
e049b6992d Merge branch 'ebassi/ci-image-for-main' into 'main'
Various CI fixes

See merge request GNOME/gtk!5349
2022-12-20 03:37:43 +00:00
Emmanuele Bassi
ca0bae2196 ci: Don't cache subprojects
We're downloading them anyway.
2022-12-20 02:41:52 +00:00
Matthias Clasen
a920c0d2de Merge branch 'wip/gtk4-fix-delete-surrounding' into 'main'
gtkimcontextwayland: Convert byte based offset to char based offset in delete_surrounding_text

See merge request GNOME/gtk!5254
2022-12-20 02:40:14 +00:00
Emmanuele Bassi
0db3666d3c tests: Add shorthand-entry-border to the flaky suite
This test fairly consistently times out when running in a contended CI.
2022-12-20 02:18:25 +00:00
Emmanuele Bassi
2b808bf849 ci: Remove installed-tests job
Installed tests require access to the system prefix, and thus a
system-wide installation of Meson, which we don't have.

We're going to restore this job at a later date.
2022-12-20 01:56:28 +00:00
Emmanuele Bassi
737342ef23 ci: Don't use builddep to install Wayland build dependencies
We don't want to bring undefined dependencies into the image.

Additionally, Wayland depends on Meson, and we don't want to use
Fedora's version of Meson.
2022-12-20 01:54:57 +00:00
Emmanuele Bassi
cf709473f7 ci: Update the Fedora image 2022-12-20 01:54:57 +00:00
Alynx Zhou
ad83d616c4 gtkimcontextwayland: Convert byte based offset to char based offset in delete_surrounding_text
ClutterInputFocus/GtkIMContext uses char based offset for
delete_surrounding, however, text_input_v3 uses byte based offset for
it. Currently only GTK with mutter can work correctly via text_input_v3
because they both forget to convert between char based offset and byte
based offset.

This commit fixes it in GTK by converting byte based offset to char
based offset with the UTF-8 encoded surrounding text.

Fixes <https://gitlab.gnome.org/GNOME/gtk/-/issues/4566>.
2022-12-20 09:51:08 +08:00
Matthias Clasen
98bb14a849 Merge branch 'meson-subproject-usage-fixes' into 'main'
Various fixes for using gtk4 as a meson subproject

See merge request GNOME/gtk!5347
2022-12-20 01:50:47 +00:00
António Fernandes
efbd228940 listbase: Cancel rubberband if not handling drag
If the drag events are claimed by another gesture (e.g. a GtkDragSource
in an item widget), list base still commits a rubberband selection, for
a rubberband which wasn't even visible yet. This is a problem for the
GNOME Files application which needs both rubberbanding and drag-n-drop.

My previous fix[0] was enough for the case where the event sequence is
claimed right before the first GtkDragGesture::drag-update emission,
but it's useless if the event is claimed later (e.g. after the drag
treashold), because a rubberband already exists by that time.

Therefore, the complete solution requres checking whether the event
sequence is no longer being handled by our gesture, and commit the
selection changes only if it is, but otherwise cleanup the rubberband.

This is what GtkFlowBox does already, so let's do the same here.

[0] commit dc4540fae9
2022-12-18 21:31:31 -10:00
Nirbheek Chauhan
64c8da1bdd ci: Always update subprojects to latest revision
Otherwise we're not actually updating anything. `meson subprojects
download` will skip subprojects that already exist.
2022-12-19 09:08:28 +05:30
Nirbheek Chauhan
7242408d60 ci: Fix fedora-mingw64 job 2022-12-19 03:09:11 +05:30
Nirbheek Chauhan
9c6dd9b3b5 ci: Update meson version used for vs2017 job 2022-12-19 03:09:11 +05:30
Nirbheek Chauhan
cd77936265 meson: Fix find_program and subproject usage
Dummy dependencies are not required to execute a subproject
automatically for providing a program, nor do you need to explicitly
call subproject() to do that.

A `[provide]` section in the wrap file is enough.
2022-12-19 03:09:11 +05:30
Nirbheek Chauhan
53c37cfc17 meson: Stop using fallback: kwarg for deps that don't need it
Subprojects that use meson.override_dependency() do not require the
caller to provide the dependency variable name inside the subproject.

We also don't want to provide the *subproject* name, because the
subproject name can be `pango-1.50.12` instead of `pango` when using
wrap-file to download the tarball instead of using wrap-git. This
causes the pango subproject to be executed twice when using gtk as
a subproject inside gstreamer (which uses pango-1.50.12 as
a wrap-file).

All the dependencies we use can be switched in this way, but the
remaining ones need to be changed to use meson.override_dependency()
first.
2022-12-19 03:09:11 +05:30
Nirbheek Chauhan
1a1f92178e meson: Update gitlab.gnome.org SSH server names
Also switch the wrap file style to use spaces around `=` which is the
canonical style used by wrapdb now.
2022-12-18 21:42:03 +05:30
Nirbheek Chauhan
6b111a9fda meson: Remove redundant, duplicate, harfbuzz check 2022-12-18 21:42:03 +05:30
Nirbheek Chauhan
cc6b0c5750 meson: Always look for both cmake and pkgconfig names
The is_msvc_like change is wrong; it used a false correlation between
"compiler being used" and "dependency method" by saying that on
Windows, when building with MSVC, you will only use CMake to find png,
jpeg, tiff.

You can use pkgconfig to find these deps on Windows with MSVC -- when
the deps have been built with Autotools or Meson (with MSVC). You can
also find these deps using CMake on other platforms like macOS or
Linux.

The solution is simple: just search for both names on all platforms,
and just search for the pkgconfig name first.
2022-12-18 21:42:03 +05:30
Matthias Clasen
235f01952c Merge branch 'nirbheek/fix-build-with-latest-glib' into 'main'
gdk: Fix g_set_str version check

See merge request GNOME/gtk!5348
2022-12-18 16:07:11 +00:00
Nirbheek Chauhan
e2291259bb gdk: Fix g_set_str version check
The function was added to glib in 2.75.1. This fixes gtk's build with
the glib main branch.
2022-12-18 11:29:10 +05:30
sunflowerskater
6b71ccdb43 GtkFileChooser: Tweak Grid View & List View button tooltips
The tooltips from the Grid View & List View buttons are unnecessarily long and look different from the tooltips used in Nautilus.

This commit makes the tooltips to be consistent with Nautilus and, consequently, makes them shorter.
2022-12-17 18:21:10 -03:00
Matthias Clasen
c81a793f63 Merge branch 'wip/cdavis/file-dialog-accept-label' into 'main'
gtkfiledialog: Allow devs to set custom accept labels

Closes #5421

See merge request GNOME/gtk!5339
2022-12-16 17:04:00 +00:00
Christopher Davis
143229f829 gtkfiledialog: Allow devs to set custom accept labels
Accept labels can be used for additional context regarding
the purpose of a file. The old GtkFileChooser APIs allowed
developers to set it, but the initial FileDialog API was missing
this functionality.

This commit adds `gtk_file_dialog_set_accept_label ()` to
restore the missing functionality.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/5421
2022-12-16 10:16:52 -05:00
Christopher Davis
3e86bc65f5 gdkprivate: Add compatibility shim for g_set_str()
Allows us to make use of this API without depending
on bleeding-edge glib
2022-12-16 10:16:52 -05:00
Luca Bacci
b563736b66 Include hicolor index.theme as a resource
index.theme file copied from upstream xdg/default-icon-theme
repository at tag 0.17:

https://gitlab.freedesktop.org/xdg/default-icon-theme/-/tree/0.17

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5303
2022-12-16 14:58:59 +01:00
Matthias Clasen
2442ed87fe Merge branch 'matthiasc/for-main' into 'main'
Silence a compiler warning

See merge request GNOME/gtk!5340
2022-12-16 12:30:26 +00:00
Matthias Clasen
6cb5f20942 Silence a compiler warning 2022-12-16 00:12:44 -05:00
Matthias Clasen
aafc6279a3 Merge branch 'ebassi/ci-image-for-main' into 'main'
ci: Install Meson in the build jobs

See merge request GNOME/gtk!5335
2022-12-16 03:55:18 +00:00
Matthias Clasen
2154460139 Merge branch 'no-portals' into 'main'
Add GDK_DEBUG=no-portals

Closes #5441

See merge request GNOME/gtk!5336
2022-12-15 16:27:33 +00:00
Matthias Clasen
ef17a44876 Merge branch 'deprecate-show-hide' into 'main'
Deprecate gtk_widget_show/hide

See merge request GNOME/gtk!5278
2022-12-15 14:53:48 +00:00
Matthias Clasen
8eace1c385 Merge branch 'check-button-radio-docs' into 'main'
gtkcheckbutton: Document how to keep track of changes for radio buttons

See merge request GNOME/gtk!5328
2022-12-15 00:25:08 +00:00
Benjamin Otte
1f001a8f6a Merge branch 'wip/corey/listbase-focus' into 'main'
listbase: Use set_focus_child properly

Closes #5433 and #5432

See merge request GNOME/gtk!5169
2022-12-14 19:06:57 +00:00
Emmanuele Bassi
a2b00f7ea7 ci: Install tests in a separate prefix
Avoid using `sudo` in the installed-tests CI job, since we're installing
Meson as the current user.
2022-12-14 19:02:23 +00:00
Pablo Correa Gómez
42ba97eb5c gtkcheckbutton: Document how to keep track of changes for radio buttons 2022-12-14 20:02:07 +01:00
Matthias Clasen
e5560c1535 Add GDK_DEBUG=no-portals
Fixes: #5441
2022-12-14 13:50:20 -05:00
Emmanuele Bassi
7fca091371 ci: Redefine PATH 2022-12-14 18:39:34 +00:00
Corey Berla
93e591fdf1 listbase: Use set_focus_child properly
The EventControllerFocus on the list item, updates the list base focus
tracker and scrolled to position any time the list item enters focus.
This works when interacting within a single window, but has unexpected
results when changing focus between multiple windows.

Instead of using the focus controller workaround, just make
gtk_list_base_update_focus_tracker the set_focus_child vfunc

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5433
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5432
2022-12-14 07:56:57 -10:00
Corey Berla
7081bfc614 listbase: Split scroll_to_item for reuse 2022-12-14 07:51:34 -10:00
Emmanuele Bassi
cd7627ed02 ci: Consistently use meson subcommands
meson setup:
  configuration
meson compile:
  compilation
meson install
  installation

Do not use ninja directly, and do not use `meson` as a synonym for
`meson setup`.
2022-12-14 17:44:27 +00:00
Emmanuele Bassi
ce9069c85f build: Add known to be failing gsk comparison tests
The unaligned-offscreen and upside-down-label-3d tests are failing after
upgrading our CI images, seemingly because of some font rendering issue
that is hard to track. Let's use the "failing" testsuite mechanism that
we also use for the reftests.
2022-12-14 17:40:04 +00:00
Emmanuele Bassi
6e0def6474 ci: Install Meson in the build jobs
We use the latest 0.64 even if we depend on 0.60 because of fixes in the
subproject command.
2022-12-14 17:13:03 +00:00
Matthias Clasen
a471a8b57c Merge branch 'ebassi/gidocgen-update' into 'main'
ci: Update the gi-docgen dependencies

See merge request GNOME/gtk!5263
2022-12-14 16:24:48 +00:00
Georges Basile Stavracas Neto
b0f65ead84 Merge branch 'gbsneto/filechooser-grid-view' into 'main'
Add GtkGridView to the filechooser

Closes #233

See merge request GNOME/gtk!5163
2022-12-14 14:47:21 +00:00
Matthias Clasen
e3f805f169 Merge branch 'appdialog' into 'main'
Add GtkAppDialog

See merge request GNOME/gtk!5284
2022-12-14 13:24:20 +00:00
Luca Bacci
48bcae99af Merge branch 'gdk-win32-fix-native-decoration-resize' into 'main'
GdkWin32: Fix resizes with native decorations

Closes #5142, #5088, and #5090

See merge request GNOME/gtk!5096
2022-12-14 13:13:14 +00:00
Danial Behzadi
355b42b373 Update Persian translation
(cherry picked from commit aabae92482)
2022-12-14 12:33:20 +00:00
Luca Bacci
0bdf30dfbf Merge branch 'gdk-win32-modal-handling' into 'main'
GdkWin32: Do not use MA_NOACTIVATEANDEAT

Closes #5297 and #5326

See merge request GNOME/gtk!5208
2022-12-14 10:08:42 +00:00
Corey Berla
e8f70be2c1 Merge branch 'wip/otte/for-5422' into 'main'
contentserializer: Serialize to file:// if possible

Closes #5422

See merge request GNOME/gtk!5330
2022-12-14 01:56:04 +00:00
Benjamin Otte
ea056d261f contentserializer: Serialize to file:// if possible
Try to get a native file:// URI instead of any other GVFS
scheme, for interoperability with apps only handling file:// URIs.

This is what GTK3 Nautilus and Thunar do, so apps should be tuned
for this behavior.

See also https://bugzilla.xfce.org/show_bug.cgi?id=13845

Fixes: #5422
2022-12-14 02:33:45 +01:00
Matthias Clasen
c2c99a163a Merge branch 'stylanydev' into 'main'
Gtk.GestureStylus: implement `anydev` property

See merge request GNOME/gtk!4707
2022-12-13 19:34:12 +00:00
Matthias Clasen
eec8cf1309 Deprecate gtk_widget_show/hide
gtk_widget_set_visible does the same job.
2022-12-13 13:46:02 -05:00
Matthias Clasen
18e0eaa9d6 tests: Stop using gtk_widget_show/hide 2022-12-13 13:46:02 -05:00
Matthias Clasen
b8962fcba7 examples: Stop using gtk_widget_show/hide 2022-12-13 13:46:02 -05:00
Matthias Clasen
fba4cea2e8 testsuite: Stop using gtk_widget_show/hide 2022-12-13 13:46:02 -05:00
Georges Basile Stavracas Neto
8cf9810240 pathbar: Reimplement using GtkBox
The path bar does a lot of manual management of buttons, mostly to
be able to show navigation arrows when there's not enough space to
show the full path.

Since the GTK4 migration, this is slightly broken in some cases, due
to the 'need_sliders' variable being always set to TRUE. Furthermore,
after the introduction of the Recent button as a special cased fake
root, the allocation of the buttons is generating warnings.

Reimplement the path bar as a GtkBox, inside a GtkScrolledWindow.
This mimics what Nautilus does, and allows us to make navigation more
predictable, and remove most of the complexity from GtkPathBar. It
also prevents it from generating allocation warnings.

The path bar itself now doesn't override GtkWidget.measure nor
GtkWidget.allocate; instead, it delegates layout to the GtkBinLayout
layout manager.

CSS is adjusted to account for the changed hierarchy of buttons.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
f0a76f2ca8 filechooserwidget: Improve grid cell visuals
Use a GtkLabel instead of a GtkInscription to get filenames better
displayed within the available space.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
358d9d72d1 filechooserwidget: Don't check operation mode for tooltip
There's no way this could ever have been correct. We always want to
show the tooltip, and it's basically always available.
2022-12-13 14:45:15 -03:00
Sam Hewitt
aabb8dce91 filechooser: Add hover styles to the gridview children 2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
80736d782b filechooserwidget: Add toggle view button clone in search
It's positioned and looks exactly like the browse_toggle_view_button,
but due to the way things are organized, we cannot simply reuse that
button.

Add a clone of browse_toggle_view_button in the search entry page of
the toolbar stack. Make it toggle the same action as of the original
button, and bind the icon name and tooltip texts to it too.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
1464289710 filechooserwidget: Show pathbar in recent mode
As per design direction, show the pathbar in recent mode.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
72c676aecb pathbar: Special case recent button
Soon pathbar will be shown on the Recent mode, with a static
path pointing to, well, Recent, so special case it in the
GtkPathBar with a static icon.
2022-12-13 14:45:15 -03:00
Corey Berla
c717d10dda filechooserwidget: Hide ColumnView settings in GridView 2022-12-13 14:45:15 -03:00
Matthias Clasen
ee5324359d filechooser: Save and restore view type
With this, the filechooser comes up with the
same view (grid or list) that it had the last
time you used it.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
10338a5237 filechooserwidget: Rename callback
It's shared between both column and grid views now.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
1c5caf53b6 filechooserwidget: Implement 'keynav-failed' for grid view
It's exactly the same as of the column view. Since we're sharing
the callback now, rename it to browse_files_view_keynav_failed_cb.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
0bb6377a3a filechooserwidget: Use correct view in various places
Most of the pointer comparisons against 'browse_files_column_view'
should actually be performed against the current view widget. As
it turns out, it weren't that many places after all.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
ce12ab8307 style: Improve filechooser grid view slightly 2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
27613e3bc5 filechooserwidget: Add a grid view
Add a grid view outside of the widgetry tree. The grid view mimics
the column view using bindings, so we only need to manage the column
view.

Also add a button in the path bar section to toggle the view. This
is handled as a new 'toggle-view' action in the file chooser.

The way switching between views currently work is by setting either
the column or grid view as the child of the GtkScrolledWindow. This
has the benefit of unmapping the unused view, which is nice and can
avoid some tricky situations with thumbnails.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/233
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
a9be0be32b filethumbnail: Add 'icon-size' property
This will be used by future commits so that we can reuse this widget
in the file chooser grid view.
2022-12-13 14:45:15 -03:00
Matthias Clasen
6b83ded8f0 Merge branch 'harfbuzz-dep' into 'main'
build: Use a stable harfbuzz

See merge request GNOME/gtk!5327
2022-12-13 16:15:43 +00:00
Matthias Clasen
cc23ef6eae build: Use a stable harfbuzz
We don't need the latest harfbuzz.
Stick to 4.0 for now.
2022-12-13 09:29:16 -05:00
Arjan Molenaar
089d0caa5e macos: Fix freeze on drag
A Drag surface does not have a parent surface. Therefore, if we initialize
it with one, it's inheriting the frame clock from the parent, but the
drag surface is not linked to the parent. Once the drag surface is destroyed,
it's disposing the frame clock, which results in a "frozen" application.
2022-12-13 15:19:04 +01:00
Arjan Molenaar
d0c4413033 macos: Explicitly ungrab seat when drag is done or finalized
This is an extra safeguard that avoids grabbing resources longer than
nessecary. It also ensures the resource is removed from the drag,
so it is not freed again.
2022-12-13 15:19:04 +01:00
Arjan Molenaar
410fa9871f Remove old dragImage code
New code (macOS 10+ should support the NSDraggingSource protocol:
https://developer.apple.com/documentation/appkit/nsdraggingsource.
2022-12-13 15:19:04 +01:00
Matthias Clasen
eba9c4e4c3 gtk-demo: Update the pickers demo 2022-12-13 07:49:10 -05:00
Matthias Clasen
f94e9d26b5 gtk: Update all callers 2022-12-13 07:49:02 -05:00
Matthias Clasen
69cc4b42cf filelauncher: Add a file property 2022-12-13 07:48:35 -05:00
Matthias Clasen
66b4f2a9dd Merge branch 'docs/default-args' into 'main'
docs: Emphasize requirement to provide filenames as arguments

See merge request GNOME/gtk!5322
2022-12-13 12:17:07 +00:00
andy5995
99d6eb9cb4 docs: Emphasize requirement to give filenames as arguments
(related to #5430)
2022-12-12 23:40:07 -06:00
Matthias Clasen
631b0fa9fd Merge branch 'sunflowerskater-main-patch-64457' into 'main'
appchooser: Rename "application" to "app"

See merge request GNOME/gtk!5323
2022-12-12 16:48:56 +00:00
sunflowerskater
e319b14dc2 appchooserbutton: Rename "application" to "app"
This change is a part of an initiative to use the word "app" instead of "application" in the UI:

Teams/Design/initiatives#123
2022-12-11 19:20:12 -03:00
sunflowerskater
c96fefd7f5 appchooserwidget: Rename "application" to "app"
This change is a part of an initiative to use the word "app" instead of "application" in the UI:

https://gitlab.gnome.org/Teams/Design/initiatives/-/issues/123
2022-12-11 19:13:51 -03:00
sunflowerskater
b1a9afbdba appchooser: Rename "application" to "app"
This change is a part of an initiative to use the word "app" instead of "application" in the UI: https://gitlab.gnome.org/Teams/Design/initiatives/-/issues/123
2022-12-11 20:05:54 +00:00
Matthias Clasen
6bed0cfb5a Merge branch 'popover-present-docs' into 'main'
popover: Clarify docs

See merge request GNOME/gtk!5318
2022-12-11 04:03:10 +00:00
Matthias Clasen
973a8752ab Merge branch 'ebassi/image-dispose' into 'main'
Do not change the notification queue inside finalization

Closes #5420

See merge request GNOME/gtk!5321
2022-12-11 04:02:49 +00:00
Matthias Clasen
db3b216ad1 Merge branch 'builder-scope-note' into 'main'
builderscope: Add a note for implementors

See merge request GNOME/gtk!5317
2022-12-11 01:07:21 +00:00
Emmanuele Bassi
b3b5a5064e Do not change the notification queue inside finalization
Notifications are not going to be emitted during the finalization, and
GObject will warn if you try to acquire and release a reference to the
notification queue when the reference count of an object has reached
zero.

Fixes: #5420
2022-12-11 00:36:03 +00:00
andy5995
9fd4b215ee docs: Place example-{3,4} in numerical order 2022-12-10 17:39:09 -06:00
Matthias Clasen
5c70f2ae9b builderscope: Add a note for implementors
Recommend that scope implementations should fall
back to or derive from GtkBuilderCScope in order
to not lose GTK's type-guessing machinery.

Related: #5398
2022-12-10 17:12:02 -05:00
Matthias Clasen
5df9f4016e popover: Clarify docs
gtk_popover_present() is a misleadingly named
function, so at least give it clear docs that
tell people to use gtk_popover_popup() instead.
2022-12-10 16:36:00 -05:00
Matthias Clasen
6f7a4b67c2 Merge branch 'docs/deprecated-G_APPLICATION_FLAGS_NONE' into 'main'
docs: Update deprecated G_APPLICATION_FLAGS_NONE in examples

See merge request GNOME/gtk!5315
2022-12-10 20:53:09 +00:00
andy5995
6e7ecb02f1 docs: Update deprecated G_APPLICATION_FLAGS_NONE 2022-12-10 01:12:13 -06:00
Matthias Clasen
146cf0bdd4 Merge branch 'deprecate-keys-changed' into 'main'
treeview: Drop a few unused variables

See merge request GNOME/gtk!5314
2022-12-09 19:03:01 +00:00
Matthias Clasen
00bdad23b0 Deprecate gtk_show_uri
This API has been superseded by GtkFileLauncher.
2022-12-09 13:36:28 -05:00
Matthias Clasen
8ff3217712 gtk: Stop using gtk_show_uri
Replace all uses of gtk_show_uri
with GtkFileLauncher.
2022-12-09 13:36:28 -05:00
Matthias Clasen
7a50e31b8d gtk-demo: Add a GtkFileLauncher demo
Replace the deprecated app chooser button by a
button that calls gtk_file_launcher_launch.
2022-12-09 13:25:02 -05:00
Matthias Clasen
1d9ee050f4 Add GtkFileLauncher
This is a replacement for gtk_show_uri_full,
which can open a GFile in an application, or
open its containing folder in a file manager.
2022-12-09 13:25:02 -05:00
Matthias Clasen
40d54ad3eb window: Deprecate the ::keys-changed signal 2022-12-09 13:14:27 -05:00
Matthias Clasen
a9b387b37b tests: Silence a compiler warning 2022-12-09 13:13:24 -05:00
Matthias Clasen
12f9883599 treeview: Drop a few unused variables
Compilers get pickier every year...
2022-12-09 13:12:47 -05:00
Matthias Clasen
4e23fe896e composetable: Drop an unused variable 2022-12-09 13:09:34 -05:00
Olga Smirnova
0effe1fd07 Add Interlingue translation 2022-12-09 17:24:41 +00:00
Matthias Clasen
a07bf1a047 Merge branch 'dialog-fixes' into 'main'
filechooserwidget: Fixes

See merge request GNOME/gtk!5311
2022-12-09 16:22:00 +00:00
Matthias Clasen
42cd230d44 openuriportal: Better error handling
Nested async calls are always a challenge.

Hopefully, things are straightened out now,
and we report GTK_DIALOG_ERROR errors for
the cases we care about.
2022-12-09 11:05:48 -05:00
Matthias Clasen
bc8e19fcd0 openuriportal: Add a check function
Add private API to check whether the portal
is available.
2022-12-09 11:05:48 -05:00
Matthias Clasen
ae29fee903 openuriportal: Support OpenDirectory
This required an extra argument. Update all callers.
2022-12-09 11:05:48 -05:00
Matthias Clasen
7ad0bae12f openuriportal: Cosmetics
There were some copy-paste errors.
2022-12-09 11:05:48 -05:00
Matthias Clasen
3e11ea9ddf fontdialog: Improve docs
Be more specific about possible errors.
2022-12-09 11:05:48 -05:00
Matthias Clasen
5b6c98d589 colordialog: Improve the docs
Be more specific about possible errors.
2022-12-09 11:05:48 -05:00
Matthias Clasen
57082e2e40 fontdialog: Don't forget to propagate errors
Oops.
2022-12-09 11:05:48 -05:00
Matthias Clasen
45e3e1594f fontdialogbutton: Survive window closing
If the parent window of the button gets destroyed
while the dialog is open, we cancel the async op,
but we need to be a little more careful about not
stepping on glass.
2022-12-09 11:05:48 -05:00
Matthias Clasen
637ef84d04 colordialogbutton: Survive window closing
If the parent window of the button gets destroyed
while the dialog is open, we cancel the async op,
but we need to be a little more careful about not
stepping on glass.
2022-12-09 11:05:48 -05:00
Matthias Clasen
b297baed32 fontdialog: Unset check cancellable 2022-12-09 11:05:48 -05:00
Matthias Clasen
c45f172e79 colordialog: Unset check cancellable 2022-12-09 11:05:48 -05:00
Matthias Clasen
417382375b filedialog: Report cancellation propertly
Unless we prevent it, GTask will always report
cancellation as G_IO_ERROR_CANCELLED. But we
want GTK_DIALOG_ERROR_ABORTED for this case.
2022-12-09 11:05:48 -05:00
Matthias Clasen
2e90a752eb filechooserwidget: Fixes
Fix a memory leak in the file manager launch path.
2022-12-09 11:05:48 -05:00
Matthias Clasen
abe5181b10 Merge branch 'wip/corey/column-view-header' into 'main'
columnviewtitle: Prevent header clicks from propagating

Closes #5425

See merge request GNOME/gtk!5306
2022-12-09 15:28:58 +00:00
Matthias Clasen
585b6a3637 Merge branch 'matthiasc/node-editor-srcdir' into 'main'
node-editor: Redo saving location

Closes #5403

See merge request GNOME/gtk!5310
2022-12-09 15:22:00 +00:00
Matthias Clasen
3007b0fd7f Remove leftover debug spew 2022-12-09 10:04:42 -05:00
Matthias Clasen
96b9ac84f8 node-editor: Redo saving location
Determine the location to save testcases in dynamically,
trying first a GTK_SOURCE_DIR environment variable
and then the current directory as the GTK source dir,
ultimatively falling back to just saving in the current
directory.

This avoids leaking details of the build environment
into the produced artifacts and should make GTK builds
more reproducible.

Fixes: #5403
2022-12-09 09:35:32 -05:00
Matthias Clasen
860c2f8ddd Merge branch 'fix-file-dialog-title' into 'main'
filedialog: Use title if set

Closes #5415

See merge request GNOME/gtk!5308
2022-12-08 13:16:55 +00:00
Matthias Clasen
de83d57e14 filedialog: Use title if set
This broken when the code was reshuffled into
the switch.

Fixes: #5415
2022-12-08 07:57:16 -05:00
Matthias Clasen
9de963e8b4 Merge branch 'wip/carlosg/stale-timeout' into 'main'
gdk/x11: Clear all data in GdkSurfaceX11 finalization

See merge request GNOME/gtk!5303
2022-12-08 12:18:37 +00:00
Matthias Clasen
5e92c26b9a Merge branch 'macos-unused-vars' into 'main'
macos: remove unused variables from macos code

See merge request GNOME/gtk!5290
2022-12-08 12:17:13 +00:00
Matthias Clasen
8c7b9c30de Merge branch 'ccook/spelling-changes' into 'main'
Various spelling mistakes across a few domains that show up in documentation.

See merge request GNOME/gtk!5292
2022-12-08 12:16:22 +00:00
Cam Cook
6bfb35f047 Various spelling mistakes across a few domains that show up in documentation. 2022-12-08 12:16:22 +00:00
Matthias Clasen
53c3cce5e4 Merge branch 'emoji-recent-empty' into 'main'
emojichooser: Actually disable the recent section

See merge request GNOME/gtk!5305
2022-12-08 12:09:26 +00:00
Luca Bacci
acd7d739f5 GdkWin32: Fix resizes with native decorations
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5142
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5088
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5090
2022-12-08 11:41:05 +01:00
Corey Berla
33e7774743 columnviewtitle: Prevent header clicks from propagating
The header in GtkColumnView has multiple event handlers
there is a ::pressed handler in GtkColumnView for
resizing the columns in CAPTURE as well as a motion
and drag controller.  The ::release handler is in
GtkColumnViewTitle.   We can't claim the event in the
existing handlers because then the ::release handler will
never get called.  Currently, however, all clicks get propagated
to the ColumnView from the header which can be problematic.
Since we don't usually want the clicks from the header
handled on the view, claim it in the BUBBLE phase.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5425
2022-12-07 10:25:09 -10:00
Guido Günther
89c816a614 emojichooser: Actually disable the recent section
The loop sets empty = FALSE when there are emojis but for that
to work we need to initialize the value to TRUE initially.

Fixes: 7928532bc5
2022-12-07 19:33:59 +01:00
Carlos Garnacho
c24358cfbc gdk/x11: Clear all data in GdkSurfaceX11 finalization
Currently, the GdkSurfaceX11 implementation relies that the upper
layers hid the surface before destruction, and that no
GdkSurfaceClass.compute_resize happened between them. If these
circumstances happened, there would be a compute_size timeout left
dangling after the surface got destroyed, poking at incorrect data
later on. Something that looks like this was reported in the
recent mutter-x11-frames "SSD frames server":

    mutter-x11-frames:423016): GLib-GObject-WARNING **: 19:41:16.869: invalid unclassed pointer in cast to 'GtkWindow'

    Thread 1 "mutter-x11-fram" received signal SIGTRAP, Trace/breakpoint trap.
    g_logv (log_domain=0x7ffff7f7c4f8 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=<optimized out>) at ../../../glib/gmessages.c:1433
    1433	../../../glib/gmessages.c: No such file or directory.
    (gdb) bt
    #0  g_logv (log_domain=0x7ffff7f7c4f8 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=<optimized out>) at ../../../glib/gmessages.c:1433
    #1  0x00007ffff73470ff in g_log (log_domain=log_domain@entry=0x7ffff7f7c4f8 "GLib-GObject", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x7ffff7f84da8 "invalid unclassed pointer in cast to '%s'")
        at ../../../glib/gmessages.c:1471
    #2  0x00007ffff7f72892 in g_type_check_instance_cast (type_instance=type_instance@entry=0x5555558e04b0, iface_type=<optimized out>) at ../../../gobject/gtype.c:4144
    #3  0x00007ffff791e77d in toplevel_compute_size (toplevel=<optimized out>, size=0x7fffffffe170, widget=0x5555558e04b0) at ../../../gtk/gtkwindow.c:4227
    #4  0x00007ffff7f4f3b0 in g_closure_invoke (closure=0x555555898cc0, return_value=return_value@entry=0x0, n_param_values=2, param_values=param_values@entry=0x7fffffffdeb0, invocation_hint=invocation_hint@entry=0x7fffffffde30)
        at ../../../gobject/gclosure.c:832
    #5  0x00007ffff7f62076 in signal_emit_unlocked_R
        (node=node@entry=0x55555588feb0, detail=detail@entry=0, instance=instance@entry=0x55555560e990, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffdeb0)
        at ../../../gobject/gsignal.c:3796
    #6  0x00007ffff7f68bf5 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffffe050) at ../../../gobject/gsignal.c:3549
    #7  0x00007ffff7f68dbf in <emit signal ??? on instance 0x55555560e990 [GdkX11Toplevel]> (instance=<optimized out>, signal_id=<optimized out>, detail=detail@entry=0) at ../../../gobject/gsignal.c:3606
    #8  0x00007ffff7a8de96 in gdk_toplevel_notify_compute_size (toplevel=<optimized out>, size=size@entry=0x7fffffffe170) at ../../../gdk/gdktoplevel.c:112
    #9  0x00007ffff7a4b15a in compute_toplevel_size (surface=surface@entry=0x55555560e990 [GdkX11Toplevel], update_geometry=update_geometry@entry=1, width=width@entry=0x7fffffffe220, height=height@entry=0x7fffffffe224)
        at ../../../gdk/x11/gdksurface-x11.c:281
    #10 0x00007ffff7a4c3b2 in compute_size_idle (user_data=0x55555560e990) at ../../../gdk/x11/gdksurface-x11.c:356
    #11 0x00007ffff733f67f in g_main_dispatch (context=0x55555563f6e0) at ../../../glib/gmain.c:3444
    #12 g_main_context_dispatch (context=context@entry=0x55555563f6e0) at ../../../glib/gmain.c:4162
    #13 0x00007ffff733fa38 in g_main_context_iterate (context=0x55555563f6e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4238
    #14 0x00007ffff733fcef in g_main_loop_run (loop=loop@entry=0x5555560874a0) at ../../../glib/gmain.c:4438
    #15 0x0000555555557de0 in main (argc=<optimized out>, argv=<optimized out>) at ../src/frames/main.c:68

It perhaps makes sense to warn in these situations, but either way
it sounds like gdk_surface_x11_finalize() could enforce the correct
behavior by ensuring there is no dangling timeouts/data. This commit
does that.
2022-12-07 13:16:36 +01:00
Arjan Molenaar
19aaa8fee5 macos: Use Command key symbol for meta
Show the Apple Command symbol ⌘ as keyboard shortcut for the Meta key on macos,
similar to GtkAccelGroup.
2022-12-05 21:00:42 +01:00
Joan Bruguera
43c1a433aa gdk/wayland: set requesting surface to xdg-activation
The argument to xdg_activation_token_v1_set_surface is documented to be the
surface requesting the activation, not the surface to be activated, which is
given later when calling xdg_activation_v1_activate.
(c.f. 36cee4bdbc)

Use the same logic as in gdk_wayland_app_launch_context_get_startup_notify_id,
i.e. if we have a surface with focus, set that, otherwise set NULL.

This fixes requesting urgent/focus on wlroots (compositors like Sway, etc.),
which was blocked as the surface requesting the activation didn't have focus.

Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2022-12-04 23:33:34 +00:00
Arjan Molenaar
097d87e502 Cleanup: remove unused variables from macos code
Remove unused variables. In case if Cairo code it would
allocate memory, which would result in a memory leak.
2022-12-04 12:50:20 +01:00
Benjamin Otte
a9c9678e1f Merge branch 'workaround-glx-issue' into 'main'
GLX: Add extra glXMakeContextCurrent () call to work around a DRI issue

Closes #4499, #5387, and #5170

See merge request GNOME/gtk!5285
2022-12-02 15:32:22 +00:00
Luca Bacci
f788e994a9 GLX: Add extra glXMakeContextCurrent () call to work around a DRI issue
Reference: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7808

Fixes #4499, #5387, #5170
2022-12-02 14:20:43 +01:00
Benjamin Otte
c977f5cbb0 Merge branch 'wip/corey/tree-expander-bug' into 'main'
Improve treeexpanders

See merge request GNOME/gtk!5282
2022-11-30 19:06:12 +00:00
Corey Berla
c541de3e05 list: Remove active state handling in listitemwidget and treeexpander
Active state is handled by main now.  It appears that listitem and
treeexpander handled it manually (probably before main did).  This
is unnecessary now, so let's remove it.
2022-11-30 10:48:14 -08:00
Corey Berla
fdfd76774e treeexpander: Scroll to expanded item
If the anchor is below the expanded item, the expanded item will
go out of view if there are sufficient children items.  This is not
ideal, so make sure to scroll to the item to ensure it remains in
view.
2022-11-30 09:43:20 -08:00
Corey Berla
7eac27e5ee listitemwidget: Add listitem.scroll-to action
This is the matching action for list.scroll-to-item
2022-11-30 09:43:20 -08:00
Corey Berla
847b3261fc treeexpander: Toggle expand on release instead of pressed
With the introduction of the hide-expander property, I noticed that
the active state would persist in many cases because the release
signal was never emitted.  In gtk3 tree expanders, expanded
on release.  gtk4 expanded on press to match window explorer.
Per irc chat, the designers didn't have a strong preference
for press or release.  In order to keep consistency and
fix this bug, let's move back to release.
2022-11-30 09:41:18 -08:00
Corey Berla
63a655e345 treeexpander: Fix typo and GestureClick type
"canceled" should be "cancelled".  Also, "cancel" is a signal on
GtkGesture.
2022-11-29 20:52:46 -08:00
Corey Berla
ff8d88b097 dragsource: Add a timeout before starting a drag
No one wants a drag that happens in less than 100ms (if so, it's
probably accidental).
2022-11-29 20:06:21 -08:00
Emmanuele Bassi
75454adbe2 Merge branch 'ebassi/for-main' into 'main'
docs: Fix property cross-links in GtkTreeExpander

See merge request GNOME/gtk!5279
2022-11-29 14:08:13 +00:00
Emmanuele Bassi
9bce5f0462 docs: Fix property cross-links in GtkTreeExpander 2022-11-29 13:49:35 +00:00
Matthias Clasen
d2158e825b Merge branch 'matthiasc/for-main' into 'main'
testsuite: Skip tests that miss charset support

See merge request GNOME/gtk!5277
2022-11-29 12:09:33 +00:00
Matthias Clasen
36a4bb0341 Merge branch 'ccook/spelling-fixes' into 'main'
docfix: Various spelling errors that show up in docs

See merge request GNOME/gtk!5272
2022-11-29 08:57:48 +00:00
Matthias Clasen
be324cc665 testsuite: Skip tests that miss charset support
This came up when running the tests in a fresh
toolbox missing the glibc-gconv-extra package.
2022-11-29 03:52:27 -05:00
Matthias Clasen
d9f4bd5490 Merge branch 'wip/corey/at-spi-context' into 'main'
atspicontext: Cache empty atspi bus address

See merge request GNOME/gtk!5276
2022-11-29 07:51:23 +00:00
Matthias Clasen
23a3bf7a3c Merge branch 'show-hide-cleanup' into 'main'
gtk: Stop using gtk_widget_show/hide

See merge request GNOME/gtk!5273
2022-11-29 07:30:04 +00:00
Corey Berla
44e297488f atspicontext: Log more helpful warnings when the a11y bus doesn't exist 2022-11-28 17:02:18 -08:00
Corey Berla
8072d202e3 atspicontext: Cache empty atspi bus address
We are caching the bus address as data on the display object when it
exists, but fail to set the data when the bus address doesn't exist.
That causing excessive calls to GetAddress when the accesssbility
bus doesn't exist. Make sure to cache a non-existent accessibility
bus by setting the "" string.
2022-11-28 17:02:13 -08:00
Matthias Clasen
b82fa26373 Merge branch 'matthiasc/for-main' into 'main'
Revert "builder: Stop using GtkBuildable.get_id"

See merge request GNOME/gtk!5274
2022-11-28 23:08:58 +00:00
Matthias Clasen
f624897589 Merge branch 'wip/carlosg/osk-activation-in-widgets' into 'main'
Handle OSK activation in GtkText/GtkTextView widgets

See merge request GNOME/gtk!5269
2022-11-28 19:43:19 +00:00
Matthias Clasen
a46bee1285 Revert "builder: Stop using GtkBuildable.get_id"
This reverts commit 92edd4c476.

This commit changed behavior that GNOME Builder relies on.
2022-11-28 14:36:47 -05:00
Matthias Clasen
1ee39d7555 tools: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
1018b43724 constraint editor: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
c823ea4a70 icon browser: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
fb8e52f0c9 gtk-demo: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
352ace83bc widget-factory: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
f339cc276c gtk: Stop using gtk_widget_show/hide
gtk_widget_set_visible and gtk_window_present
are better alternatives, and calling gtk_widget_show
on newly created widgets is no longer necessary
anyway.
2022-11-28 14:34:55 -05:00
Cam Cook
5b45efb49b Merge remote-tracking branch 'origin' into ccook/spelling-fixes 2022-11-28 12:34:38 -05:00
Benjamin Otte
57ac4740b3 Merge branch 'wip/corey/tree-expander' into 'main'
treeexpander: Add hide-expander and indent-for-depth properties

Closes #4969

See merge request GNOME/gtk!5268
2022-11-28 15:53:17 +00:00
Carlos Garnacho
929a51addb imcontextwayland: Set up OSK activation gesture on non text widgets
With GtkText and GtkTextView (and in extension, all their subclasses)
handling OSK activation activation, this gesture is only useful for
all text input widgets that are not subclasses of these 2 widgets,
e.g. the VTEs and crosswords of the world.

These still do need a hand in handling OSK activation, so only
set up the gesture for such cases.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
6cbb7b848a gtktextview: Invoke OSK on button/touch taps that move/undo selection
If the ::release handler is invoked, the press/release happened without
drags in between. Additionally check that there is no selection at all.

This makes OSK invoked on taps that move the caret around, while tapping
in the selection invokes edition popup and text handles without bringing
in the OSK.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
ed81c265ac gtktextview: Claim drag gesture after an actual selection change
This way, the drag gesture lets the click gesture ::release handler
happen if there was no actual changes to the selected text (i.e.
too short drags). This matches the ::release handler behavior match
the situations in which the OSK was being invoked by the wayland
GtkIMContext.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
ee6d9478c8 gtktext: Invoke OSK on button/touch taps that move/undo selection
If the ::release handler is invoked, the press/release happened without
drags in between. Additionally check that the press did not happen within
the selection, and that there is no selection at all.

This makes OSK invoked on taps that move the caret around, while tapping
in the selection invokes edition popup and text handles without bringing
in the OSK.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
76d80f7544 gtktext: Claim drag gesture after an actual selection change
This way, the drag gesture lets the click gesture ::release handler
happen if there was no actual changes to the selected text (i.e.
too short drags). This matches the ::release handler behavior match
the situations in which the OSK was being invoked by the wayland
GtkIMContext.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
e3b0d57ce7 imcontextwayland: Implement activate_osk() vmethod
This method does explicitly what the builtin GtkClickGesture in
the IM context is doing implicitly. The gesture will be dropped
after porting is done.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
6d0f7a2d31 immulticontext: Implement activate_osk() vmethod
The multicontext lets this call go through to the active
underlying GtkIMContext.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
459583ba9e imcontext: Add private activate_osk() vmethod
This method is so far private for both external GtkIMContext
implementations and external GtkIMContext users, and is meant
to activate the OSK in the environments where this may happen.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
59af80ab8b Revert "gtktext: Claim gesture more selectively"
This reverts commit ae54374a51.
2022-11-28 15:46:41 +01:00
Matthias Clasen
005574b1b2 Merge branch 'bilelmoussaoui/gi-since' into 'main'
g-i: Add missing since annotations

See merge request GNOME/gtk!5271
2022-11-28 11:17:51 +00:00
Bilal Elmoussaoui
0919320086 g-i: Add missing since annotations 2022-11-28 07:54:48 +00:00
Corey Berla
72bc97fff5 treeexpander: Minor formatting changes 2022-11-27 19:39:20 -08:00
Corey Berla
648b38761c treeexpander: Add indent-for-depth property
When set to TRUE, indent-for-depth indents each level of
depth with an additional indent
2022-11-27 19:36:20 -08:00
Corey Berla
2b578a24e4 treeexpander: Add hide-expander property
When set to TRUE hide-expander hides the expander icon in a
GtkTreeListRow.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4969
2022-11-27 19:36:11 -08:00
Matthias Clasen
90c986e493 Merge branch 'wip/corey/spi-logging' into 'main'
atspicontext: Log failure to connect to a11y

See merge request GNOME/gtk!5270
2022-11-28 01:29:10 +00:00
Matthias Clasen
ed6798e94c Merge branch 'work/zzag/wl-output-release' into 'main'
gdk/wayland: Prefer wl_output_release() over wl_output_destroy()

See merge request GNOME/gtk!5243
2022-11-27 22:21:29 +00:00
Corey Berla
16fd72e606 atspicontext: Log failure to connect to a11y
GTK depends on the a11y infrastructure to be in place unless GTK_A11Y is
set to none.  It appears that despite that, users attempt to
get around the a11y requirement without setting GTK_A11Y.
This can cause, amongst other issues, performance problems
with gtk applications.  Log failure to connect to the a11y
bus.
2022-11-27 14:13:13 -08:00
Matthias Clasen
3dae22efdb Merge branch 'fix-keymap-notify' into 'main'
Don't emit ::notify from a getter

See merge request GNOME/gtk!5267
2022-11-27 19:04:13 +00:00
Cam Cook
b876b4f568 | domain | current | suggestion |
|--------|---------|------------|
| [GtkListBox](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklistbox.c#L1469)| (attributes org.gtk.Metthod.get_property=activate-on-single-click) | (attributes org.gtk.Method.get_property=activate-on-single-click) |
2022-11-27 07:42:12 -05:00
Cam Cook
dd780b3ce0 | domain | current | suggestion |
|--------|---------|------------|
| [GtkHeaderBar](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkheaderbar.c#L780) | "specifies a icon" | "specifies an icon" |
2022-11-27 06:49:40 -05:00
Cam Cook
0663758566 | domain | current | suggestion |
|--------|---------|------------|
| [GtkGridView](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkgridview.c#L1241)             | "Sets the imodel to use." | "Sets the model to use." |
2022-11-27 06:30:30 -05:00
Cam Cook
ccfe889ba9 Merge branch 'main' into ccook/spelling-fixes 2022-11-27 06:30:04 -05:00
Matthias Clasen
fe56f3413a Don't emit ::notify from a getter
GdkX11Keymap ddetermines the direction of the
keymap on demand, and was emitting notify::direction
2022-11-26 21:53:33 -05:00
Cam Cook
47bbc7e944 | domain | current | suggestion |
|--------|---------|------------|
| (GtkLevel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklevelbar.c#L1139)     | "between [property@Gtk.LevelBar:min-value[" | "between [property@Gtk.LevelBar:min-value]"|
2022-11-26 14:51:34 -05:00
Cam Cook
c89cdb680d | domain | current | suggestion |
|--------|---------|------------|
| [GtkLevel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklevelbar.c#L1104)     | "Returns the \`min-value of the \`GtkLevelBar\`." | "Returns the \`min-value\' of the \`GtkLevelBar\`."|
2022-11-26 14:35:40 -05:00
Cam Cook
d19426d399 | domain | current | suggestion |
|--------|---------|------------|
| [GtkLabel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L3142)        | "the [property@Gtk.Label:use-underline property]" | "the [property@Gtk.Label:use-underline] property" |
2022-11-26 13:32:27 -05:00
Matthias Clasen
3b9eba6d9a Merge branch 'wip/corey/demo-file-dialog' into 'main'
gtk-demo: Application demo use open_finish()

See merge request GNOME/gtk!5264
2022-11-26 18:11:41 +00:00
Corey Berla
586c3c3cbd gtk-demo: Application demo use open_finish() 2022-11-26 18:11:40 +00:00
Emmanuele Bassi
cc546d7af1 build: Add a check argument to run_command()
Silence a Meson warning.
2022-11-26 15:18:42 +00:00
Emmanuele Bassi
03db707f3c vulkan: Add missing enumeration
Check for VK_ERROR_COMPRESSION_EXHAUSTED_EXT.
2022-11-26 15:18:42 +00:00
Emmanuele Bassi
a8cd2750f7 ci: Download the subprojects
Updating the subprojects will apparently fail if they haven't been
downloaded.
2022-11-26 15:18:42 +00:00
Emmanuele Bassi
ffad21a9d6 ci: Use Fedora 37 as the base
New stable release means new CI failures.
2022-11-26 14:04:07 +00:00
Matthias Clasen
b5644c2596 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Cosmetics

See merge request GNOME/gtk!5265
2022-11-26 13:15:28 +00:00
Cam Cook
cb303895aa Various spelling mistakes (and one use of the wrong verb) across a few domains that show up in documentation.
| domain | current | suggestion |
|--------|---------|------------|
| [GtkBitset](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkbitset.c#L363)       | "Value to add" | "Value to remove" |
| [GtkEntry](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L3626)        | "\`GtkEntry"   | "\`GtkEntry\`"    |
| [GtkEntry](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L3566)        | "will be applies" | "will be applied" |
| [GtkEntry](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L2232)        | "is is in" | "is in" |
| [GtkInfoBar](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/deprecated/gtkinfobar.c#L772) | "in the info bars’s action area" | "in the info bar’s action area |
| [GtkLabel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L3210)        | "Gets the labels attribute list." | "Gets the label's attribute list."
2022-11-26 06:54:47 -05:00
Matthias Clasen
e5cf55bdb4 gtk-demo: Cosmetics 2022-11-26 06:40:47 -05:00
Emmanuele Bassi
5419f1f2f0 ci: Update the gi-docgen dependencies
The python3-toml package is deprecated, and replaced by python3-tomli.
At least, until we bump up the dependency to Fedora 37: then we can
depend on Python 3.11, and its TOML parser in the standard library.

See also: https://gitlab.gnome.org/GNOME/gi-docgen/-/merge_requests/168
2022-11-25 17:50:21 +00:00
Matthias Clasen
79a2e31635 Merge branch 'bilelmoussaoui/g-i' into 'main'
g-i: Add missing since annotation

See merge request GNOME/gtk!5259
2022-11-25 14:43:19 +00:00
Matthias Clasen
56dfc6c5ba Merge branch 'wip/smcv/xfail' into 'main'
testsuite: Avoid using should_fail

See merge request GNOME/gtk!5248
2022-11-25 14:40:33 +00:00
Bilal Elmoussaoui
5ede8dd1eb g-i: Add missing since annotation 2022-11-25 10:16:37 +00:00
Matthias Clasen
4fdeec118a Merge branch 'dialog-improvements' into 'main'
gtk-demo: Test cancellation support for file dialog

See merge request GNOME/gtk!5257
2022-11-25 03:48:04 +00:00
Matthias Clasen
e73f0f6974 file dialog: Handle Escape better
Closing the dialog by hitting Escape should
have the same effect as clicking the cancel
button. Make it so.
2022-11-24 10:29:43 -05:00
Matthias Clasen
ff14c51950 color dialog: Handle Escape better
Closing the dialog by hitting Escape should
have the same effect as clicking the cancel
button. Make it so.
2022-11-24 10:29:03 -05:00
Matthias Clasen
4fa53bd041 gtk-demo: Test cancellation support for file dialog
Add a timeout that closes the file dialog after
20 seconds, to test programmatic cancellation.
2022-11-24 10:26:43 -05:00
Simon McVittie
94b57a967c testsuite: Don't create .test files for flaky or failing tests
These tests can be run manually, but are not suitable for use as an
acceptance test, so let's not make frameworks like Debian's autopkgtest
run these when they run ginsttest-runner in the most obvious way.

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-11-24 13:46:33 +00:00
Simon McVittie
957dd49ef7 testsuite: Use separate setups for unstable tests instead of should_fail
There are two possible interpretations of "expected failure": either
the test *must* fail (exactly the inverse of an ordinary test, with
success becoming failure and failure becoming success), or the test
*may* fail (with success intended, but failure possible in some
environments). Autotools had the second interpretation, which seems
more useful in practice, but Meson has the first.

Instead of using should_fail, we can put the tests in one of two new
suites: "flaky" is intended for tests that succeed or fail unpredictably
according to the test environment or chance, while "failing" is for
tests that ought to succeed but currently never do as a result of a
bug or missing functionality. With a sufficiently new version of Meson,
the flaky and failing tests are not run by default, but can be requested
by running a setup that does not exclude them, with a command like:

    meson test --setup=x11_unstable --suite=flaky --suite=failing

As a bonus, now that we're setting up setups and their excluded suites
programmatically, the gsk-compare-broadway tests are also excluded by
default when running the test setup for a non-broadway backend.

When running the tests in CI, --suite=gtk overrides the default
exclude_suites, so we have to specify --no-suite=flaky and
--no-suite=failing explicitly.

This arrangement is inspired by GNOME/glib!2987, which was contributed
by Marco Trevisan.

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-11-24 13:46:33 +00:00
Matthias Clasen
5e534306e4 Merge branch 'deprecate-infobar' into 'main'
Deprecate GtkInfoBar

See merge request GNOME/gtk!5246
2022-11-24 03:43:11 +00:00
Matthias Clasen
d3fbe80510 Merge branch 'wip/carlosg/gsk-clipping' into 'main'
gsk: Extend the blur radius for outset shadow extents

See merge request GNOME/gtk!5247
2022-11-23 22:38:49 +00:00
Vlad Zahorodnii
433734de21 gdk/wayland: Improve readability of wl_output binding code
Provide OUTPUT_VERSION macro to indicate the implemented version of
wl_output in gtk rather than use a magical number.
2022-11-23 22:53:00 +02:00
Carlos Garnacho
b9448b06b4 gsk: Extend the blur radius for outset shadow extents
By dividing the blur radius to obtain the clip radius, we may end up
with halved values that result in an overshunk clip mask. Extend this
so that we ensure to cover the last pixel.

Fixes artifacts seen with the cairo renderer in X11 when resizing
windows horizontally, a black 1px high line would be seen in the
top of the window due to these outset bounds being used in clipping.

More mysteriously, also seems to fix resize lag in the GL renderer
(also X11), if e.g. the bottom-right corner of a window is resized
diagonally in bottom-left -> top-right direction, or
bottom-right -> top-left.

Related: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2175#note_1599335
2022-11-23 19:27:49 +01:00
Matthias Clasen
942f8d4b4b Deprecate GtkInfoBar
This widget has a dialog-like API, which is something
we want to get rid of in GTK 5, and libadwaita has
a replacement with AdwBanner incoming.
2022-11-23 13:00:09 -05:00
Carlos Garnacho
35744d87a2 gsk: Also ceil() top side when converting graphene to cairo rectangles
The outset border for all sides is ceil()ed, except for the top side.
Most often values are already nicely rounded here, but this seems an
oversight.
2022-11-23 18:56:45 +01:00
Florian "sp1rit"​
6dd939f13e improved docs of Gtk.GestureStylus 2022-11-23 09:09:50 +01:00
Florian "sp1rit"​
c85fbcea55 adjusted stylus-only code to fit gtk code conventions 2022-11-23 08:59:29 +01:00
Vlad Zahorodnii
261bcd40bd gdk/wayland: Prefer wl_output_release() over wl_output_destroy()
By using wl_output_release(), GDK lets the compositor to clean up the
output global more nicely.

For example, currently, most compositors remove the global and then
destroy it later after N seconds expire. With this, the compositor could
experiment with destroying the output global once all its resources are
destroyed.
2022-11-22 14:12:22 +02:00
Matthias Clasen
200f31f285 Merge branch 'work/zzag/wl-output-cleanup' into 'main'
gdk/wayland: Destroy zxdg_output_v1 upon GdkWaylandMonitor destruction

See merge request GNOME/gtk!5242
2022-11-22 12:01:43 +00:00
Vlad Zahorodnii
1d94aefe2b gdk/wayland: Clear GdkWaylandMonitor::output using g_clear_pointer()
Use g_clear_pointer() to make tear down code consistent.
2022-11-22 11:23:08 +02:00
Vlad Zahorodnii
e82e7823a8 gdk/wayland: Destroy zxdg_output_v1 upon GdkWaylandMonitor destruction
It prevents potentially leaking memory.
2022-11-22 11:18:32 +02:00
Florian "sp1rit"​
789778105d gtk: gtkgesturestylus: implemented stylus-only property
this allows setting a Gtk.GestureStylus to a state, where it can be
used to handle non-stylus devices (e.g. mice).
This might be useful for applications that handle stylus input, but
want to allow falling back to a mice, if the user is unable to provide
stylus input.
2022-11-22 09:13:35 +01:00
Florian "sp1rit"​
c36685bf60 gdk: gdkevents: added NULL check to gdk_event_get_axes
this is to prevent gdk from causing a segfault, when getting event axes
for events that don't have them (i.e. attempting to get pressure from a
mice input device).
2022-11-22 09:13:32 +01:00
Matthias Clasen
0de172f03d Merge branch 'file-filter-properties' into 'main'
filefilter: Add properties for the criteria

See merge request GNOME/gtk!5241
2022-11-22 04:00:40 +00:00
Matthias Clasen
d34ac99916 filefilter: Add properties for the criteria
Add construct-only properties for patterns,
suffixes and mime-types. This provides an
alternative way to specify these in ui files.

Related: #5350
2022-11-21 22:44:03 -05:00
Matthias Clasen
055f3e5d97 Merge branch 'color-picker-portal' into 'main'
colorpicker: Always try the portal first

See merge request GNOME/gtk!5240
2022-11-21 19:46:17 +00:00
Matthias Clasen
205b718fe5 colorpicker: Always try the portal first
It does not hurt., and going forward, we want to
prefer portals.
2022-11-21 14:26:29 -05:00
Matthias Clasen
01ae136a4c Merge branch 'bilelmoussaoui/g-i' into 'main'
g-i: add missing array annotation to AlertDialog.set_buttons

See merge request GNOME/gtk!5234
2022-11-21 10:49:05 +00:00
Matthias Clasen
74806ed324 Merge branch 'fix-upside-down-labels' into 'main'
gsk: Avoid a crash with negative scales

See merge request GNOME/gtk!5236
2022-11-21 10:48:29 +00:00
Matthias Clasen
83839cb219 Merge branch 'drop-buildable-get-id' into 'main'
builder: Stop using GtkBuildable.get_id

See merge request GNOME/gtk!5239
2022-11-21 10:35:16 +00:00
Matthias Clasen
f22db024a8 Merge branch 'stringlist-prop' into 'main'
stringlist: Add a construct-only strings property

See merge request GNOME/gtk!5238
2022-11-21 10:34:54 +00:00
Matthias Clasen
e357ff6055 Drop gtk_widget_buildable_parser_finished
No need to have this no-op implementation.
This was the only implementation of this vfunc
in GTK.
2022-11-20 14:36:35 -05:00
Matthias Clasen
92edd4c476 builder: Stop using GtkBuildable.get_id
Drop the only implementation of this vfunc,
and stop using it. It isn't needed, and the
only implementation did the same thing GtkBuilder
does anyway.
2022-11-20 14:35:36 -05:00
Matthias Clasen
f0aefe2f7f stringlist: Add a construct-only strings property
This enables creating string lists in ui files
without using custom markup.

Related: #5350
2022-11-20 14:07:45 -05:00
Matthias Clasen
8f24072354 Merge branch 'center-box-props' into 'main'
centerbox: Add properties for child widgets

See merge request GNOME/gtk!5237
2022-11-20 18:25:12 +00:00
Matthias Clasen
8dc89ba3d8 centerbox: Add properties for child widgets
This provides and alternative to add children
in ui files.

Related: #5350
2022-11-20 12:54:31 -05:00
Matthias Clasen
b441c684ab gsk: Avoid a crash with negative scales
Don't crash when both scale_x and scale_y are -1.

A test is included.
2022-11-20 12:13:02 -05:00
Bilal Elmoussaoui
97d76417fa g-i: add missing array annotation to AlertDialog.(s|g)et_buttons 2022-11-19 14:33:19 +01:00
Matthias Clasen
ab530b9e5a Merge branch 'builder-parse-attributes' into 'main'
builder: Parse PangoAttrList values

See merge request GNOME/gtk!5228
2022-11-19 02:49:23 +00:00
Matthias Clasen
21a69e7107 Merge branch 'wip/carlosg/osk-activation' into 'main'
gtktext: Claim gesture more selectively

Closes #5351

See merge request GNOME/gtk!5230
2022-11-18 19:33:55 +00:00
Matthias Clasen
d45155364e Merge branch 'kjellahl/menubar' into 'main'
gtk_popover_menu_bar_set_menu_model(): Accept model == NULL

See merge request GNOME/gtk!5232
2022-11-18 19:33:37 +00:00
Matthias Clasen
4a71957c1f Merge branch 'shorter-im-context-ids' into 'main'
immmodule: Warn if GTK_IM_MODULE is bad

See merge request GNOME/gtk!5229
2022-11-18 19:33:17 +00:00
Matthias Clasen
e53c9e4832 Merge branch 'wayland-foreign-v2' into 'main'
wayland: Also support the v2 of the importer

See merge request GNOME/gtk!5231
2022-11-18 18:00:42 +00:00
Matthias Clasen
b3821b19b5 wayland: Also support the v2 of the importer
Commit 0ba8e16e14 added support for the export
part of zxdg_foreign_v2, but neglected that the importer
has a v2 as well. Support it.
2022-11-18 12:10:56 -05:00
Kjell Ahlstedt
8911015549 gtkpopovermenubar: Make model nullable
The description of gtk_popover_menu_bar_new_from_model() and
gtk_popover_menu_bar_set_menu_model() says that model is nullable.
Make it so.
2022-11-18 18:09:42 +01:00
Carlos Garnacho
f1168c5012 gdksurface: Do not consider GDK_TOUCH_END/CANCEL as popup-dismiss worthy
GDK_TOUCH_END deserves the same treatment than GDK_BUTTON_RELEASE, since it's
subject to the same circumstances (popping up a menu on long press would be
immediately dismissed on release if we handled them there). Ideally, we would
want to match releases that we obtained a press for while grabbed, but as
the popup is also dismissed on GDK_BUTTON_PRESS/GDK_TOUCH_BEGIN, there's no
use for this tracking.

And GDK_TOUCH_CANCEL sounds weird as a reason to dismiss popups, just like
crossing events would.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2512
2022-11-18 17:56:14 +01:00
Carlos Garnacho
ae54374a51 gtktext: Claim gesture more selectively
Even though button 1 (or touch down) presses do most often have
an effect in one way or another (starting drag, moving focus,
starting selection, ...), there is one situation that they do
immediately nothing: When clicking on the entry does not move
the text caret around. Dragging might start a selection, but
the entry did not do anything just yet, and an immediate
button/touch release should remain at "did nothing".

And that is precisely the hint that the Wayland IM context's click
gesture takes, clicks that do not scroll nor move the caret around,
having the GtkText not claim the gesture in that situation makes
the IM gesture able to do its thing without in-fighting.

This is typically not a problem when the GtkText is embedded in
another GtkEditable implementation (e.g. GtkEntry), since the
IM gesture is inactive and capturing from the parent widget, so
gets a pass that it otherwise doesn't get when both gestures are
in the same widget. This makes it work regardless of GtkText not
being a child of a composite widget, like NautilusQueryEditor
and AdwRowEntry.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5351
2022-11-18 17:56:14 +01:00
Matthias Clasen
64b8a8740f Merge branch 'wip/fix-tiling-without-gtk-shell' into 'main'
wayland/surface: Set the tiling state from xdg-shell too

See merge request GNOME/gtk!5227
2022-11-18 16:33:25 +00:00
Matthias Clasen
1f97714293 immodule: Accept 'simple' and 'none'
Everybody (including myself) gets this wrong,
so accept 'simple' and 'none' as shorthands
for the official IDs 'gtk-im-context-simple'
and 'gtk-im-context-none'.
2022-11-18 11:18:48 -05:00
Matthias Clasen
9af8c6fb25 immmodule: Warn if GTK_IM_MODULE is bad
If we don't find an immodule matching the
ids in the GTK_IM_MODULE envvar, print a
warning.
2022-11-18 11:18:48 -05:00
Matthias Clasen
9682085e09 builder: Parse PangoAttrList values
Allow specifying PangoAttrList properties in the
serialized format supported by pango_attr_list_to_string().

Test included.
2022-11-18 10:42:50 -05:00
Jonas Ådahl
07a59da6e4 wayland/surface: Set the tiling state from xdg-shell too
We plumbed it from the gtk-shell configure event, but didn't for the
equivalent state passed via xdg_toplevel.configure.
2022-11-18 13:11:25 +01:00
Matthias Clasen
dfbaeefc64 Merge branch 'matthiasc/for-main' into 'main'
gsk: Add an assertion to help static analysis

See merge request GNOME/gtk!5224
2022-11-18 05:22:44 +00:00
Matthias Clasen
9cbfbbdf39 stringsorter: Fix one case of collation handling
When not ignoring case, and not collating, we were
returning sort keys that were already freed. Oops.

Pointed out by clang.
2022-11-18 00:04:23 -05:00
Matthias Clasen
8c1a041104 gdk: Fix possible memory errors
clang complained that we may end up jumping
to the cleanup code without initializing data
in the jpeg code. Always initialize data to
NULL to prevent that eventuality.
2022-11-18 00:04:23 -05:00
Matthias Clasen
95fc5109bb composetable: Fix a memory leak
Pointed out by clang.
2022-11-18 00:04:23 -05:00
Matthias Clasen
ce57150203 gsk: Add an assertion to help static analysis
clang gets wild ideas about negative radii otherwise.
2022-11-18 00:04:23 -05:00
Matthias Clasen
203685a46a Merge branch 'matthiasc/for-main' into 'main'
Fix spelling errors

See merge request GNOME/gtk!5223
2022-11-18 04:56:57 +00:00
Matthias Clasen
ebe6d52252 Drop redundant glib version checks
We require GLib 2.72 now.
2022-11-17 22:49:56 -05:00
Matthias Clasen
60aaf38f39 gdk: Clean up gdkprivate.h
Move apis to more specific headers.
2022-11-17 22:49:56 -05:00
Matthias Clasen
2bab8cca5f gdk: Rename GDK_SURFACE_TEMP
We use this value only for drag surfaces, so call it that.
2022-11-17 22:49:56 -05:00
Matthias Clasen
b12d31d189 Fix spelling errors
These were pointed out by codespell.
2022-11-17 22:49:45 -05:00
Matthias Clasen
0d2161ee40 Merge branch 'file-dialog-portals' into 'main'
file dialog: Use portals

See merge request GNOME/gtk!5221
2022-11-18 03:49:30 +00:00
Matthias Clasen
cda06f375e Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Add some keywords

See merge request GNOME/gtk!5220
2022-11-17 20:53:51 +00:00
Matthias Clasen
b0148972fd filedialog: Use portals
We want this new API to be portal-first.
Make it so.
2022-11-17 15:52:53 -05:00
Matthias Clasen
ea3c58f0ec gtk-demo: Add folders to the clipboard demo
This is handy for testing a case where folder
dnd does not work with the file transfer portal.

See #5348
2022-11-17 06:31:09 -05:00
Matthias Clasen
af8ad1efe8 gtk-demo: Add some keywords
Make sure that dnd and drag-and-drop yield the right
(and the same) set of demos.
2022-11-17 05:50:34 -05:00
Matthias Clasen
12a50735da Merge branch 'ccook/doc-spelling-fixes' into 'main'
doc fix: various spelling mistakes corrected

See merge request GNOME/gtk!5215
2022-11-17 10:28:38 +00:00
Luca Bacci
7c62eaa528 Merge branch 'win32-hotspot' into 'main'
gdk/win32: fix cursor hotspot

See merge request GNOME/gtk!5216
2022-11-17 09:06:55 +00:00
Cam Cook
2a14753739 Merge branch 'main' into ccook/doc-spelling-fixes 2022-11-16 23:23:42 -05:00
Cam Cook
4ccc3b53eb doc/spelling changes: gtkselectionmodel.c, 'call this when the* selection changes' 2022-11-16 23:20:50 -05:00
Matthias Clasen
793954055e Merge branch 'radioactiveman-main-patch-52462' into 'main'
label: Fix markup doc example

See merge request GNOME/gtk!5201
2022-11-17 03:46:43 +00:00
Thomas Lange
7adf720f08 label: Fix markup doc example 2022-11-17 03:46:01 +00:00
Emmanuele Bassi
dc168767b0 Merge branch 'ebassi/list-doc-links' into 'main'
docs: Add links to the list widgets table

See merge request GNOME/gtk!5210
2022-11-16 21:51:59 +00:00
Matthias Clasen
501577196a Merge branch 'matthiasc/for-main' into 'main'
Inspector: Add a missing event type

See merge request GNOME/gtk!5218
2022-11-16 19:24:54 +00:00
Matthias Clasen
69d59d9b8b Merge branch 'filechooser-set-choice-fix' into 'main'
filechooser: Fix gtk_file_chooser_set_choice again

Closes #5346

See merge request GNOME/gtk!5219
2022-11-16 19:23:05 +00:00
robxnano
adc0264dac filechooser: Fix gtk_file_chooser_set_choice again
If the choice was in the form of a GtkDropDown, the code failed to
find the widget and so the choice never got set. Fixes #5346.
2022-11-16 18:07:20 +00:00
Marc-André Lureau
437a359f1b gdk/win32: fix cursor hotspot
This seems to be a regression from commit c06b1cc103 "Win32: Re-work cursor handling".

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-11-16 11:50:56 +04:00
Matthias Clasen
4eb017904b Alertdialog: Cosmetics 2022-11-15 10:36:32 +00:00
Matthias Clasen
5aeb6c31c0 events: Drop an unused variable 2022-11-15 10:26:25 +00:00
Matthias Clasen
c9df9978d2 Inspector: Add a missing event type
We did not have a name for the new touchpad hold
events.

To prevent this from happening again in the future,
add a static assertion.
2022-11-15 07:18:41 +01:00
Cam Cook
d1bb927286 Documentation fix: Various spelling mistakes (and one use of the wrong verb) across a few domains that show up in documentation.
| domain | current | suggestion |
|--------|---------|------------|
| [GtkButton](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkbutton.c#L691)       | "Buttons can has a flat appearance" | "Buttons can have a flat appearance" |
| [GtkCenterBox](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkcenterbox.c#L275) | "pas %NULL" | "pass %NULL" |
| [GtkEditable](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkeditable.c#L466)   | "the text to append" | "the text to insert" |
| [GtkFlowbox](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkflowbox.c#L4921)    | "the are equal" | "they are equal" |
| [GtkSelectionModel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkselectionmodel.c#L550) | "Call this when a the selection changes" | "Call this when a selection changes" |
| [GtkWIndow](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkwindow.c#L5321)                | "(e.g. the user or the window manager" | "(e.g. the user or the window manager)" |
2022-11-13 11:55:05 -05:00
Emmanuele Bassi
bd66198b88 docs: Add more links to the list widgets description 2022-11-11 11:30:41 +00:00
Emmanuele Bassi
5193846787 docs: Add links to the list widgets table
Make it easier for readers to go to the appropriate replacement for the
old GtkTreeView-and-friends API.
2022-11-11 11:21:17 +00:00
Matthias Clasen
2daea9e459 Merge branch 'focus-no-parent' into 'main'
focus: fall back to old behaviour if we didn't focus anything

See merge request GNOME/gtk!5189
2022-11-11 10:29:00 +00:00
Matthias Clasen
2d48793641 Merge branch 'docs-update' into 'main'
docs: Update Common Questions section on list views

See merge request GNOME/gtk!5209
2022-11-11 10:28:11 +00:00
Arjan Molenaar
920f49e993 Fix typo in 4 to 5 migration page 2022-11-10 22:41:26 +01:00
Arjan Molenaar
29d7f93e38 Update Common Questions section on tree views
Point users to GtkListView instead of the
deprecated GtkTreeView.
2022-11-10 22:41:26 +01:00
Matthias Clasen
df5a13806d Merge branch 'gdkwaylandtoplevel' into 'main'
gdk/wayland/surface: Move more members to `GdkWaylandPopup` and `GdkWaylandToplevel`

See merge request GNOME/gtk!4227
2022-11-10 13:58:24 +00:00
Luca Bacci
aebbf7cc61 Merge branch 'win32-inhibit' into 'main'
gdk-win32: implement basic inhibit-system-shortcuts

See merge request GNOME/gtk!5206
2022-11-10 11:18:23 +00:00
Luca Bacci
26c524a578 GdkWin32: Do not use MA_NOACTIVATEANDEAT
GTK knows when a surface is modally blocked and automatically drops
button press and release events, so do not block input in advance
from WM_MOUSEACTIVATE.
2022-11-10 09:27:24 +01:00
Matthias Clasen
fc8ef02bb5 Merge branch 'export-handle-refactor' into 'main'
Refactor surface handle export

See merge request GNOME/gtk!5205
2022-11-10 08:00:07 +00:00
Marc-André Lureau
cf04a3c99d gdk-win32: implement basic inhibit-system-shortcuts
This is largely adapted from commit 83027c68f1 ("11: Implement
inhibit_system_shortcuts API"), with similar rationale:

    To implement the inhibit_system_shortcuts API on X11, we emulate the
    same behavior using grabs on the keyboard.

    To avoid keeping active grabs on the keyboard that would affect
    other X11 applications even when the surface isn't focused, the X11
    implementation takes care of releasing the grabs as soon as the
    toplevel loses focus.

Note that Windows has low-level keyboard hooks that could help achieve
the expected behaviour. This is implemented by spice-gtk & gtk-vnc for
example, but correctness isn't obvious. I left a TODO comment.

This patch helps implementing remote desktop widgets with GTK4, since
currently on win32 backend Alt-Tab and such are always left to the
system unless there is keyboard grab (which can't be requested by the
client API anymore, afaict).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-11-09 19:29:03 +04:00
Matthias Clasen
43d6682e45 wayland: Reimplement export_handle
Reimplement the backend API on top of the new async
calls.
2022-11-09 16:28:30 +01:00
Matthias Clasen
d1bdc36331 window: fixups 2022-11-09 16:28:30 +01:00
Matthias Clasen
dcc3b638aa wayland: fixups 2022-11-09 16:28:30 +01:00
Matthias Clasen
4b40aeb0c6 wayland: Support the v2 protocol in both places
The old api should better support both versions of the
foreign protocol too.
2022-11-09 16:28:29 +01:00
Matthias Clasen
0ba8e16e14 wayland: Add zxdg_foreign_v2 protocol support 2022-11-09 16:28:29 +01:00
Matthias Clasen
f9982a61e6 window: Use gdk_toplevel_export_handle 2022-11-09 16:28:29 +01:00
Matthias Clasen
1c99ed542a Add gdk_toplevel_export_handle
This code is backend-specific, and should not live
in gtkwindow.c.
2022-11-09 16:28:29 +01:00
Marc-André Lureau
a92aea4c0e gdk-win32: fix unused variable warnings
../gdk/win32/gdksurface-win32.c: In function 'gdk_win32_get_window_size_and_position_from_client_rect':
../gdk/win32/gdksurface-win32.c:3753:20: warning: unused variable 'impl' [-Wunused-variable]
 3753 |   GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
      |                    ^~~~
../gdk/win32/gdksurface-win32.c: In function 'gdk_win32_surface_get_queued_window_rect':
../gdk/win32/gdksurface-win32.c:5129:20: warning: unused variable 'impl' [-Wunused-variable]
 5129 |   GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-11-09 19:19:44 +04:00
Matthias Clasen
956100017c Merge branch 'wayland_display_geometry' into 'main'
wayland: calculate union of geometry of all monitors for toplevel bounds

See merge request GNOME/gtk!4790
2022-11-08 16:29:15 +00:00
Matthias Clasen
514ec8942d Merge branch 'cursor-size' into 'main'
GtkSettings: Provide settings in logical pixels also on X11

Closes #5223 and #5230

See merge request GNOME/gtk!5172
2022-11-08 16:27:06 +00:00
Matthias Clasen
7caa211d6a Merge branch 'wip/carlosg/back-forward-mask' into 'main'
gdk/wayland: Fix button mask calculation on button events

Closes #5301

See merge request GNOME/gtk!5191
2022-11-08 16:14:18 +00:00
Matthias Clasen
cb7b57635b Merge branch 'add-link-to-docs' into 'main'
Link the file mentioned as a reference for key values

See merge request GNOME/gtk!5198
2022-11-08 16:05:59 +00:00
Matthias Clasen
9e28a407df Merge branch 'ebassi/since-for-main' into 'main'
docs: Add deprecation notices for properties

See merge request GNOME/gtk!5204
2022-11-08 16:01:11 +00:00
Matthias Clasen
a5780beba7 Merge branch 'ccook/gtk_aspect_frame_doc_fix' into 'main'
doc/comment fix: @self misspelled as self@

See merge request GNOME/gtk!5200
2022-11-08 15:28:08 +00:00
Matthias Clasen
304f1e43af Merge branch 'matthiasc/for-main' into 'main'
Add new printf patterns to make-pot

See merge request GNOME/gtk!5188
2022-11-08 15:23:03 +00:00
Emmanuele Bassi
5a51cbe673 docs: Add deprecation notices for properties 2022-11-08 10:45:09 +00:00
Matthias Clasen
901c968b97 Merge branch 'fix-color-dialog-button-new' into 'main'
colordialogbutton: Actually accept NULL

Closes #5321

See merge request GNOME/gtk!5202
2022-11-07 14:51:34 +00:00
Matthias Clasen
2c6ac137a3 gtk-demo: Improve language handlng
In the font features demo, don't add a
item for the default language to the dropdown,
that does not make sense.
2022-11-07 15:42:38 +01:00
Matthias Clasen
5bd264d532 gtk-demo: Add a few mssing language names 2022-11-07 15:42:38 +01:00
Matthias Clasen
e908a117a9 gtk4-demo: Tweak the pickers demo
Redo the file picker a bit.
2022-11-07 15:42:38 +01:00
Matthias Clasen
14a97accf1 po: Match make-pot
We are not normally using the gtk40-pot target to
generate the gtk40.pot file. On the off chance that
somebody does, lets make sure we pass the same
arguments to xgettext here as in the make-pot script
that is used on damn lies.
2022-11-07 15:42:38 +01:00
Matthias Clasen
e619d45ddc Add a test for picker button constructors
This turns out to be hard enough that a test
is useful.
2022-11-07 15:32:51 +01:00
Matthias Clasen
e00b96053b colordialogbutton: Actually accept NULL
As pointed out in #5321, my previous fix was not
good enough.

Fixes: #5321
2022-11-07 15:24:13 +01:00
Colin Kinloch
293b91e515 wayland: calculate union of geometry of all monitors for toplevel bounds
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
2022-11-07 11:08:18 +00:00
Cam Cook
ed16946685 doc/comment fix: the ref to @self was misspelled as self@ for gtkaspectframe.h/gtk_aspect_frame_get_child
Noticed this while reviewing the gi-docgen docs for GtkAspectFrame while developing some java bindings.
It's my understanding that @self was intended; as it would cause gi-docgen to interpret it as a reference to
the the GtkAspectFrame pointer named 'self'.
2022-11-06 17:59:23 -05:00
Matthias Clasen
18ee4d97fc Merge branch 'fix-color-button-new' into 'main'
color/fontdialogbutton: Fix constructors

Closes #5321

See merge request GNOME/gtk!5199
2022-11-06 13:36:49 +00:00
Matthias Clasen
466db31aac color/fontdialogbutton: Fix constructors
The arguments were meant to be nullable.
Make it so!

Fixes: #5321
2022-11-06 14:12:02 +01:00
Pedro Sader Azevedo
32e138689e Link the file mentioned as a reference for key values 2022-11-06 01:54:38 +00:00
Balázs Úr
06409cf18f Update Hungarian translation 2022-11-05 22:21:06 +00:00
Goran Vidović
0041329f4d Update Croatian translation 2022-11-05 18:55:57 +00:00
Matthias Clasen
d1c943153c Merge branch 'make-pot-update' into 'main'
Add new printf patterns to make-pot

See merge request GNOME/gtk!5197
2022-11-05 10:50:51 +00:00
Matthias Clasen
baac6ef871 Add new printf patterns to make-pot
This script is used to extract our strings for translators
on damn lines, and passing these flags to xgettext makes
it put a hint into the pot file about strings that are
used as printf format strings.
2022-11-05 11:23:53 +01:00
Luca Bacci
b209e5117d Merge branch 'gdk-win32-settings-rework' into 'main'
GdkWin32 settings rework

See merge request GNOME/gtk!5193
2022-11-04 16:00:25 +00:00
Luca Bacci
440929daea GdkWin32: Add more GDK_NOTE calls for settings 2022-11-04 16:11:27 +01:00
Luca Bacci
1506de5669 GdkWin32: Set the "gtk-hint-font-metrics" property
Helps for https://gitlab.gnome.org/GNOME/gtk/-/issues/5257
2022-11-04 16:03:11 +01:00
Luca Bacci
41f9f1d623 GdkWin32: Set the "gtk-cursor-blink" setting 2022-11-04 15:57:25 +01:00
Luca Bacci
24047d7f61 GdkWin32: Set the "gtk-cursor-theme-size" setting
Note that we have to set the logical value, that's why
we use GetSystemMetrics and not GetSystemMetricsForDpi.
2022-11-04 15:56:20 +01:00
Luca Bacci
45681c4fe5 GdkWin32: Detect the high contrast setting
And set the theme name accordingly ("Default-hc")
2022-11-04 15:54:02 +01:00
Luca Bacci
95c121b6d6 GdkWin32: Fix leak of screen HDC 2022-11-04 15:41:11 +01:00
Luca Bacci
6b569afdfe GdkWin32: Remove special-casing for old Pango versions
We require Pango 1.50 now
2022-11-04 15:35:04 +01:00
Luca Bacci
429017ad16 GdkWin32: Remove old code 2022-11-04 15:31:40 +01:00
Luca Bacci
fe1d86f23c GdkWin32: Sort settings alphabetically 2022-11-04 15:30:12 +01:00
Adam Williamson
e07f8ef506 focus: fall back to old behaviour if we didn't focus anything
8455b9ac74 seems to have introduced a problem where we can wind
up focusing no widget at all if the `while (parent)` loop doesn't
find a widget it can successfully move the focus to. This 'fixes'
that by falling back to doing the previous thing if we make it
all the way through that loop without moving the focus. Thanks to
@coreyberla for a hint to improve the implementation.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2022-11-02 09:32:32 -07:00
Carlos Garnacho
ece28bea74 gdk/wayland: Fix button mask calculation on button events
There's 2 things broken here:
- The mask was calculated on top of the GDK button (i.e. skipping
  4-7 buttons), so GDK_BUTTON4_MASK and GDK_BUTTON5_MASK were not
  assigned. This is now calculated on the (continuous) BTN_ evcodes
  so it is guaranteed that the next 2 physical buttons (i.e.
  back/forward) get these two places in the mask assigned.
- Furthermore, these buttons would be pushed to places in the
  modifier mask that they didn't belong to. It is now checked hard
  that only the first 5 buttons enable a modifier flag.

Overall, this ensures that no event masks with bonkers values are
forwarded, and that no stale implicit grabs are left after additional
buttons are pressed.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5301
2022-11-02 17:17:43 +01:00
Sabri Ünal
a272887c34 Update Turkish translation 2022-11-02 06:06:38 +00:00
Nathan Follens
c4c9a44d7a Update Dutch translation
(cherry picked from commit 381c056070)
2022-11-01 23:10:53 +00:00
Luca Bacci
ac60bc6095 X11: Provide settings in logical pixels
This makes GtkSettings values on X11 match what we get on
other backends.

Reporting size settings in logical pixels (i.e for scale
== 1) is useful for properly supporting mixed-DPI setups.
As X11 doesn't support mixed-DPI setups anyway, XSettings
doesn't bother providing logical values. Thus we scale
from physical to logical values ourselves.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5223
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5230
2022-11-01 13:09:28 +01:00
Matthias Clasen
9c5ba5544e Post-release version bump 2022-10-31 22:22:06 -04:00
Matthias Clasen
0af8d7cf06 4.9.1 2022-10-31 22:07:15 -04:00
Matthias Clasen
fcf00391b4 Merge branch 'matthiasc/for-main' into 'main'
Revert "modules: Fix build on Visual Studio"

See merge request GNOME/gtk!5187
2022-11-01 01:09:51 +00:00
Matthias Clasen
16b95939f9 gdk: Bump the jpeg malloc limit
Bump the limit for memory use during jpeg loading
to 1GB, matching what gdk-pixbuf has for this.
2022-10-31 20:35:15 -04:00
Matthias Clasen
0a6f3944a0 Revert "modules: Fix build on Visual Studio"
This reverts commit acd9c12667.

This commit breaks the build with GLib main on all platforms,
and defining _GLIB_EXTERN arguably invades the GLib namespace.

A different fix for msvc will have to be found.
2022-10-31 20:20:32 -04:00
Matthias Clasen
1a8ff606f2 Merge branch 'matthiasc/for-main' into 'main'
Be consistent in preconditions for async API

See merge request GNOME/gtk!5186
2022-10-31 21:15:10 +00:00
Matthias Clasen
030e8c0bf9 Be consistent in preconditions for async API
Do the same checks in all our finish functions.
2022-10-31 16:40:54 -04:00
Aleksandr Melman
4b29972d31 Update Russian translation 2022-10-31 12:30:25 +00:00
Matthias Clasen
d1bff928f6 Merge branch 'ebassi/since-for-main' into 'main'
Ebassi/since for main

See merge request GNOME/gtk!5185
2022-10-30 23:22:19 +00:00
Emmanuele Bassi
d665b0e042 docs: Add missing Deprecated annotations 2022-10-30 20:08:39 +00:00
Emmanuele Bassi
37fadb20a9 docs: Add missing Since annotations 2022-10-30 20:08:21 +00:00
Matthias Clasen
1c3f179a20 Merge branch 'matthiasc/for-main' into 'main'
alertdialog: Small refactoring

See merge request GNOME/gtk!5184
2022-10-30 13:29:35 +00:00
Matthias Clasen
5cb84afaa9 Add a test for POTFILES.in
Add a test that runs make-pot. This will only pass
if you've updated po/POTFILES.in and .skip after
moving source files around.

Unfortunately, it won't catch new source files that
are missing.
2022-10-30 08:52:02 -04:00
Matthias Clasen
a36bf22134 alertdialog: Small refactoring
Move the deprecated code out into its own function.
2022-10-30 08:52:02 -04:00
Piotr Drąg
8ef8514036 Update POTFILES.in 2022-10-30 12:34:21 +01:00
Matthias Clasen
c1b1e96a9a Merge branch 'deprecate-gtkdialog2' into 'main'
Deprecate GtkDialog

See merge request GNOME/gtk!5182
2022-10-29 20:39:18 +00:00
Matthias Clasen
9948053cd7 Deprecate GtkDialog
GtkDialog is too flexible in terms of UI (headerbars vs action bar,
etc), and has archaic APIs. It is time to retire it.
2022-10-29 15:27:53 -04:00
Matthias Clasen
f1af8046d0 Merge branch 'matthiasc/for-main' into 'main'
Docs updates

See merge request GNOME/gtk!5180
2022-10-29 19:22:50 +00:00
Matthias Clasen
8324a93c73 Update docs
Mention new deprecations in the future migration guide.
2022-10-29 14:14:59 -04:00
Matthias Clasen
251dcc2f86 Merge branch 'async-dialog-api2' into 'main'
Add new async APIs to replace chooser dialogs

See merge request GNOME/gtk!5174
2022-10-29 17:52:13 +00:00
Matthias Clasen
2ca168d680 NEWS: Updates 2022-10-29 13:31:41 -04:00
Matthias Clasen
f54ab91ff3 Deprecate GtkFileChooser and implementations
These are being replaced by GtkFileDialog.

This commit only moves the headers for GtkFileChooserWidget and
GtkFileChooserDialog to deprecated/, and keeps the implementations
in gtk/, since they will eventually be salvaged into a private
GtkFileChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen
66b062a976 Deprecate GtkMessageDialog
It is getting replaced by GtkAlertDialog

This commit only moves the header to deprecated/,
and keeps the implementation in gtk/, since it will
eventually be salvaged into a private, dialog-free
widget.
2022-10-29 13:31:41 -04:00
Matthias Clasen
15572b0183 Deprecate GtkFontChooser and implementations
These are being replaced by GtkFontDialog
and GtkFontDialogButton

This commit only moves the headers for GtkFontChooserWidget and
GtkFontChooserDialog to deprecated/, and keeps the implementations
in gtk/, since they will eventually be salvaged into a private
GtkFontChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen
a51a6a3ee2 Deprecate GtkColorChooser and implementations
These are being replaced by GtkColorDialog
and GtkColorDialogButton.

This commit only moves the headers for GtkColorChooserWidget
and GtkColorChooserDialog to deprecated/, and keeps the
implementations in gtk/, since they will eventually be
salvaged into a private GtkColorChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen
8bee62dd36 examples: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
4248380538 print-editor: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
e7de4c1f99 node-editor: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
d620197ae1 constraint-editor: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
ad2552ee43 widget-factory: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
756888a53d gtk-demo: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
99e1643cdd gtk-demo: Rewrite the pickers demo
This needs some more work. For now, just have
very simple test cases for some of the new async
APIs.
2022-10-29 13:31:41 -04:00
Matthias Clasen
9839aca0bd inspector: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
9ab732ce2d gtk: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
6ed2d2b232 Add GtkFileDialog
Add an async API for picking a file, together with
a builder object for it. This is meant to replace direct
use of GtkFileChooserDialog.
2022-10-29 13:31:41 -04:00
Matthias Clasen
cccc74786f Add GtkAlertDialog
This is replacing GtkMessageDialog with an
async API for showing informational messages.
2022-10-29 13:31:41 -04:00
Matthias Clasen
aeacc8f3c5 Add GtkFontDialogButton
This is like GtkColorDialogButton, but for fonts.
2022-10-29 13:31:41 -04:00
Matthias Clasen
7d0ebe02db Add GtkFontDialog
This is similar to GtkColorDialog, but for fonts.
2022-10-29 13:31:41 -04:00
Matthias Clasen
655675e6a1 Add GtkColorDialogButton
This is a new color button implementation
built around GtkColorDialog.
2022-10-29 13:02:15 -04:00
Matthias Clasen
f877f33c19 Add GtkColorDialog
Add an async API for picking a color, together with
a builder object for it. This is meant to replace direct
use of GtkColorChooserDialog.
2022-10-29 10:18:37 -04:00
Matthias Clasen
2fce117d15 Add GtkDialogError
This error domain will be used by async apis
in future commits.
2022-10-29 10:18:37 -04:00
Matthias Clasen
bd5dedce12 fontchooser: Add a way to set a GtkFilter
We keep this private, since the chooser apis
are going away. This will be used in GtkFontDialog.
2022-10-29 10:18:37 -04:00
Matthias Clasen
bdc91c2339 messagedialog: Cosmetics 2022-10-28 22:23:04 -04:00
Matthias Clasen
8be7515610 Merge branch 'matthiasc/for-main' into 'main'
ci: Try to fix the macos build

See merge request GNOME/gtk!5179
2022-10-29 02:08:19 +00:00
Matthias Clasen
2cef677aef ci: Require macos to build again 2022-10-28 21:39:13 -04:00
Matthias Clasen
a2e2673809 ci: Try to fix the macos build
It seems that libjpeg-turbo first finds nasm,
and then doesn't find it. Turn off simd to keep
it from looking for it in the first place.
2022-10-28 21:07:58 -04:00
Matthias Clasen
2c844e961f Merge branch 'matthiasc/for-main' into 'main'
printeroptionwidget: Drop unused include

See merge request GNOME/gtk!5178
2022-10-28 23:41:03 +00:00
Matthias Clasen
5c9d68a550 printeroptionwidget: Drop unused include 2022-10-28 18:24:48 -04:00
Matthias Clasen
0248a7e43f Merge branch 'matthiasc/for-main' into 'main'
gtk4-demo: Avoid a critical from a11y code

See merge request GNOME/gtk!5177
2022-10-28 16:20:18 +00:00
Matthias Clasen
b972decf82 gtk4-demo: Avoid a critical from a11y code
Even though we want to be accessible,
we must not divide by zero.
2022-10-28 12:02:23 -04:00
Emmanuele Bassi
66ec091461 Merge branch 'bilelmoussaoui/file-chooser-gi' into 'main'
g-i: Add missing since annotation

See merge request GNOME/gtk!5175
2022-10-27 17:06:22 +00:00
Bilal Elmoussaoui
6ca33c639e g-i: Add missing since annotation 2022-10-27 15:38:14 +00:00
Matthias Clasen
a13a681910 Merge branch 'revert-9c919ffa462dd4511da0bfd19d36d2e15c51651b-main' into 'main'
Revert "treepopover: Do not propagate natural width of content"

See merge request GNOME/gtk!5171
2022-10-26 18:22:43 +00:00
Mat
f6eb84189f Revert "treepopover: Do not propagate natural width of content"
This reverts commit 9c919ffa46.
2022-10-26 13:58:10 +03:00
Hodong
30525835f3 Fix a typo 2022-10-25 19:40:30 +00:00
Matthias Clasen
114e2b607b Merge branch 'ebassi/glade-docs' into 'main'
docs: Remove mentions of Glade

See merge request GNOME/gtk!5168
2022-10-25 00:39:57 +00:00
Emmanuele Bassi
21bc2c5078 docs: Remove mentions of Glade
Glade does not support GTK4, so we should not link to it when discussing
developing GTK4 applications.
2022-10-24 20:11:50 +01:00
Aaron Erhardt
2fde4c9a5f Show a warning when a destroyed window is shown
Showing a destroyed window might cause an application to
behave in an unexpected manner. For example, showing a
dialog after it has been closed by the user might cause the
application to freeze. The warning will help developers to
track down the issue.

Signed-off-by: Aaron Erhardt <aaron.erhardt@t-online.de>
2022-10-16 14:24:27 +02:00
Ian Douglas Scott
dac7a4f6e7 gdk/wayland/surface: Remove SURFACE_IS_TOPLEVEL
Always defined to `TRUE`.
2022-09-26 14:26:18 -07:00
Ian Douglas Scott
3679207e09 gdk/wayland/surface: Move more members to GdkWaylandToplevel 2022-09-26 14:26:18 -07:00
Ian Douglas Scott
46d1d54f5a gdk/wayland/surface: Make gtk_surface related functions take toplevel
These are only used with `GdkWaylandToplevel`, so it should be a function
taking that, and ultimately move to that struct.
2022-09-26 14:26:18 -07:00
Ian Douglas Scott
3131c50b82 gdk/wayland/surface: Make some toplevel functions take GdkWaylandToplevel 2022-09-26 14:26:18 -07:00
Ian Douglas Scott
c2063a623a gdk/wayland/surface: Move some variables to GdkWaylandPopup 2022-09-26 14:26:16 -07:00
Ian Douglas Scott
3e267c3285 gdk/wayland/surface: Make popup functions take GdkWaylandPopup
This will allow them to use member variables from that struct.
Ultimately, `GdkWaylandPopup` should be moved to its own file.
2022-09-26 14:22:37 -07:00
Ian Douglas Scott
887da8f931 gdk/wayland/surface: Don't wrap gdk_wayland_surface_* for toplevel vfuncs
As far as I'm aware, these only exist with `gdk_wayland_surface_` names
for historical reasons, before these types were split.

This way, those functions will be able to access members of the
`GdkWaylandToplevel` struct. And it just saves a few lines of code.
2022-09-26 14:22:37 -07:00
Ondřej Míchal
818ca63d35 gdkdisplay: Document get_monitor_at_surface can return NULL
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5075
2022-08-01 12:54:13 +02:00
Maxim Zakharov
2290c2bb23 gdk/broadway: Implements modal hint for Broadway surface
Ensures modal window is raised above parent; does return focus to
parent window when transient child window is closed.

That solves problems with overlapped modal window and focus loss in
complex multi window UI.
2022-05-17 15:18:30 +10:00
Jason Francis
3fc7c97979 gtk: Set widget template children to NULL before destroy unref 2022-05-14 10:13:39 -04:00
Jens Georg
b9551a8952 Remove obsolete "or %NULL" documentation 2022-04-20 15:15:51 +02:00
Jens Georg
e600fcbcc5 widget: Mark format as nullable in activate_action
The doc and the code allow it to be NULL
2022-04-19 10:17:39 +02:00
1845 changed files with 107704 additions and 73657 deletions

View File

@@ -22,37 +22,50 @@ stages:
# Common variables
variables:
COMMON_MESON_FLAGS: "-Dwerror=true -Dglib:werror=false -Dpango:werror=false -Dgtk-doc:werror=false -Dwayland-protocols:werror=false -Dsysprof:werror=false -Dwayland:werror=false"
COMMON_MESON_FLAGS: "-Dwerror=true -Dcairo:werror=false -Dgi-docgen:werror=false -Dgraphene:werror=false -Dlibepoxy:werror=false -Dlibsass:werror=false -Dpango:werror=false -Dsassc:werror=false -Dgdk-pixbuf:werror=false -Dglib:werror=false -Dlibcloudproviders:werror=false -Dlibpng:werror=false -Dlibtiff:werror=false -Dsysprof:werror=false -Dwayland-protocols:werror=false -Dharfbuzz:werror=false -Dfreetype2:werror=false -Dfontconfig:werror=false -Dfribidi:werror=false -Dlibffi:werror=false -Dlibjpeg-turbo:werror=false -Dmutest:werror=false -Dpixman:werror=false -Dproxy-libintl:werror=false"
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Ddemos=false -Dbuild-examples=false -Dbuild-tests=false -Dbuild-testsuite=true"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v38"
FLATPAK_IMAGE: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v42"
.only-default:
only:
- branches
except:
- tags
workflow:
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
default:
retry:
max: 2
when:
- 'runner_system_failure'
- 'stuck_or_timeout_failure'
- 'scheduler_failure'
- 'api_failure'
interruptible: true
style-check-diff:
extends: .only-default
image: $FEDORA_IMAGE
stage: check
allow_failure: true
when: manual
script:
- .gitlab-ci/run-style-check-diff.sh
.build-fedora-default:
extends: .only-default
image: $FEDORA_IMAGE
artifacts:
when: always
reports:
junit:
- "${CI_PROJECT_DIR}/_build/report-x11.xml"
- "${CI_PROJECT_DIR}/_build/report-x11_unstable.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_unstable.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_gles.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_gles_unstable.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_smalltexture.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_smalltexture_unstable.xml"
- "${CI_PROJECT_DIR}/_build/report-broadway.xml"
- "${CI_PROJECT_DIR}/_build/report-broadway_unstable.xml"
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
@@ -68,11 +81,6 @@ style-check-diff:
key: "$CI_JOB_NAME"
paths:
- _ccache/
- subprojects/gdk-pixbuf/
- subprojects/glib/
- subprojects/graphene/
- subprojects/libepoxy/
- subprojects/pango/
fedora-x86_64:
extends: .build-fedora-default
@@ -82,10 +90,17 @@ fedora-x86_64:
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects update
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson subprojects download
- meson subprojects update --reset
- mkdir _install
- meson --prefix=${CI_PROJECT_DIR}/_install
${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
- meson setup
--prefix=${CI_PROJECT_DIR}/_install
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_build
- meson compile -C _build
- meson install -C _build
@@ -93,7 +108,8 @@ fedora-x86_64:
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
- .gitlab-ci/run-tests.sh _build x11
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build waylandgles
- .gitlab-ci/run-tests.sh _build wayland_gles
- .gitlab-ci/run-tests.sh _build wayland_smalltexture
- .gitlab-ci/run-tests.sh _build broadway
release-build:
@@ -104,10 +120,17 @@ release-build:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects update
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson subprojects download
- meson subprojects update --reset
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_build
- ninja -C _build
- meson compile -C _build
- .gitlab-ci/run-tests.sh _build x11
fedora-mingw64:
@@ -128,37 +151,26 @@ fedora-mingw64:
# mingw64-graphene (rawhide)
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects update
- mkdir _build && cd _build
- mingw64-meson -Dintrospection=disabled -Dgraphene:introspection=disabled
- ninja
installed-tests:
extends: .build-fedora-default
stage: build
needs: []
variables:
EXTRA_MESON_FLAGS: "--prefix=/usr --libdir=/usr/lib64 -Dinstall-tests=true"
G_TEST_ACCESSIBLE: 1
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects update
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
_build
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson subprojects download
- meson subprojects update --reset
# Test that mingw64-meson still fails. If it has stopped failing, the CI
# will fail and now you should remove the hack that follows this.
- FAILED=false
- mingw64-meson --version || FAILED=true
- test $FAILED = false && echo "mingw64-meson works now, remove the hack" && exit 1
# HACK: Running mingw64-meson directly fails on the CI with:
# /usr/bin/mingw64-meson: line 92: fg: no job control
# Because rpm is not evaluating %__meson and it gets interpreted as a job
# specifier. So we fix that and run it ourselves.
- rpm --eval "%{mingw64_meson}" > mingw64-meson.sh
- sed -i -e 's/%__meson/meson/' mingw64-meson.sh
- chmod +x mingw64-meson.sh
- ./mingw64-meson.sh -Dintrospection=disabled -Dgraphene:introspection=disabled _build
- ninja -C _build
- sudo ninja -C _build install
- dbus-run-session xvfb-run -a -s "-screen 0 1024x768x24"
gnome-desktop-testing-runner
--report-directory=_build/installed-tests-report/failed/
--parallel=0
gtk-4.0
artifacts:
paths:
- "_build/installed-tests-report/"
.mingw-defaults:
extends: .only-default
stage: build
tags:
- win32-ps
@@ -188,40 +200,45 @@ msys2-mingw64:
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
macos:
extends: .only-default
only:
- branches@GNOME/gtk
stage: build
# Sadly, this fails regularly, and its failure is never enlightening
allow_failure: true
rules:
- if: $CI_PROJECT_NAMESPACE == "GNOME"
stage: build
tags:
- macos
needs: []
before_script:
- bash .gitlab-ci/show-info-osx.sh
- pip3 install --user meson==0.60.3
- pip3 install --user meson~=0.64
- pip3 install --user ninja
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
- export MESON_FORCE_BACKTRACE=1
script:
- meson -Dx11-backend=false
- meson setup ${COMMON_MESON_FLAGS}
-Dx11-backend=false
-Dbroadway-backend=true
-Dmacos-backend=true
-Dmedia-gstreamer=disabled
-Dintrospection=disabled
-Dcpp_std=c++11
-Dpixman:tests=disabled
-Dlibjpeg-turbo:simd=disabled
-Ddemos=false
-Dbuild-tests=false
-Dbuild-examples=false
-Dbuild-testsuite=false
_build
- ninja -C _build
- meson compile -C _build
artifacts:
when: always
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
vs2017-x64:
extends: .only-default
# TODO: Uncomment this when ready to merge.
#only:
# - branches@GNOME/gtk
# rules:
# - if: $CI_PROJECT_NAMESPACE == "GNOME"
stage: build
tags:
- win32-ps
@@ -234,7 +251,7 @@ vs2017-x64:
- "${CI_PROJECT_DIR}/_build/meson-logs"
.flatpak-defaults:
image: $FLATPAK_IMAGE
image: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
stage: flatpak
allow_failure: true
tags:
@@ -244,65 +261,67 @@ vs2017-x64:
- "${APPID}-dev.flatpak"
- 'repo.tar'
expire_in: 1 day
rules:
# Only build Flatpak bundles automatically on main
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_BRANCH != "main"
when: "manual"
script:
- bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}"
# Manual jobs, for branches and MRs
.flatpak-manual:
extends: .flatpak-defaults
when: manual
# Only build Flatpak bundles automatically on main
.flatpak-main:
extends: .flatpak-defaults
only:
- main
flatpak-manual:demo:
extends: .flatpak-manual
flatpak:demo:
extends: '.flatpak-defaults'
needs: []
variables:
APPID: org.gtk.Demo4
flatpak-main:demo:
extends: .flatpak-main
flatpak:demo:aarch64:
extends: '.flatpak-defaults'
needs: []
tags:
- flatpak-aarch64
variables:
APPID: org.gtk.Demo4
flatpak-manual:widget-factory:
extends: .flatpak-manual
flatpak:widget-factory:
extends: '.flatpak-defaults'
needs: []
variables:
APPID: org.gtk.WidgetFactory4
flatpak-main:widget-factory:
extends: .flatpak-main
flatpak:widget-factory:aarch64:
extends: '.flatpak-defaults'
needs: []
tags:
- flatpak-aarch64
variables:
APPID: org.gtk.WidgetFactory4
flatpak-manual:icon-browser:
extends: .flatpak-manual
flatpak:icon-browser:
extends: '.flatpak-defaults'
needs: []
variables:
APPID: org.gtk.IconBrowser4
flatpak-main:icon-browser:
extends: .flatpak-main
flatpak:icon-browser:aarch64:
extends: '.flatpak-defaults'
needs: []
tags:
- flatpak-aarch64
variables:
APPID: org.gtk.IconBrowser4
flatpak-manual:node-editor:
extends: .flatpak-manual
flatpak:node-editor:
extends: '.flatpak-defaults'
needs: []
variables:
APPID: org.gtk.gtk4.NodeEditor
flatpak-main:node-editor:
extends: .flatpak-main
flatpak:node-editor:aarch64:
extends: '.flatpak-defaults'
needs: []
tags:
- flatpak-aarch64
variables:
APPID: org.gtk.gtk4.NodeEditor
@@ -311,23 +330,35 @@ flatpak-main:node-editor:
# https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/DevOps-with-Flatpak
nightly demo:
extends: '.publish_nightly'
dependencies: ['flatpak-main:demo']
needs: ['flatpak-main:demo']
needs: ['flatpak:demo']
nightly demo aarch64:
extends: '.publish_nightly'
needs: ['flatpak:demo:aarch64']
nightly factory:
extends: '.publish_nightly'
dependencies: ['flatpak-main:widget-factory']
needs: ['flatpak-main:widget-factory']
needs: ['flatpak:widget-factory']
nightly factory aarch64:
extends: '.publish_nightly'
needs: ['flatpak:widget-factory:aarch64']
nightly icon-browser:
extends: '.publish_nightly'
dependencies: ['flatpak-main:icon-browser']
needs: ['flatpak-main:icon-browser']
needs: ['flatpak:icon-browser']
nightly icon-browser aarch64:
extends: '.publish_nightly'
needs: ['flatpak:icon-browser:aarch64']
nightly node-editor:
extends: '.publish_nightly'
dependencies: ['flatpak-main:node-editor']
needs: ['flatpak-main:node-editor']
needs: ['flatpak:node-editor']
nightly node-editor aarch64:
extends: '.publish_nightly'
needs: ['flatpak:node-editor:aarch64']
static-scan:
image: $FEDORA_IMAGE
@@ -336,23 +367,31 @@ static-scan:
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug"
script:
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} _scan_build
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
_scan_build
- ninja -C _scan_build scan-build
artifacts:
paths:
- _scan_build/meson-logs
allow_failure: true
# Run tests with the address sanitizer. We need to turn off introspection,
# since it is incompatible with asan
# Run tests with the address sanitizer. We need to turn off introspection
# and f16c, since they are incompatible with asan
asan-build:
image: $FEDORA_IMAGE
tags: [ asan ]
stage: analysis
needs: []
when: manual
variables:
script:
- CC=clang meson --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=disabled _build
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- CC=clang meson setup --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=disabled -Df16c=disabled _build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build wayland
artifacts:
@@ -364,10 +403,22 @@ reference:
image: $FEDORA_IMAGE
stage: docs
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=release --force-fallback-for=gdk-pixbuf,pango"
script:
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} -Dgtk_doc=true -Dgdk-pixbuf:gtk_doc=true -Dpango:gtk_doc=true _build
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson setup
${COMMON_MESON_FLAGS}
--buildtype=release
--force-fallback-for=gdk-pixbuf,pango
-Dintrospection=enabled
-Dgtk_doc=true
-Dgdk-pixbuf:gtk_doc=true
-Dpango:gtk_doc=true
-Ddemos=false
-Dbuild-examples=false
-Dbuild-tests=false
-Dbuild-testsuite=false
_build
- meson compile -C _build
- mkdir -p _reference/
- mv _build/docs/reference/gdk/gdk4/ _reference/gdk4/
@@ -390,9 +441,9 @@ reference:
publish-docs:
image: fedora:latest
stage: publish
interruptible: false
needs: ['reference']
script:
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
only:
refs:
- main
rules:
- if: $CI_COMMIT_REF_NAME == "main"

View File

@@ -1,4 +1,4 @@
FROM fedora:36
FROM fedora:38
RUN dnf -y install \
adwaita-icon-theme \
@@ -18,7 +18,9 @@ RUN dnf -y install \
dejavu-sans-mono-fonts \
desktop-file-utils \
diffutils \
docbook-style-xsl \
elfutils-libelf-devel \
expat-devel \
fribidi-devel \
gcc \
gcc-c++ \
@@ -31,6 +33,7 @@ RUN dnf -y install \
glibc-devel \
glibc-headers \
gnome-desktop-testing \
gnupg2 \
gobject-introspection-devel \
graphene-devel \
graphviz \
@@ -70,7 +73,6 @@ RUN dnf -y install \
mesa-dri-drivers \
mesa-libEGL-devel \
mesa-libGLES-devel \
meson \
ninja-build \
pango-devel \
pcre-devel \
@@ -80,9 +82,9 @@ RUN dnf -y install \
python3-gobject \
python3-jinja2 \
python3-markdown \
python3-packaging \
python3-pip \
python3-pygments \
python3-toml \
python3-typogrify \
python3-wheel \
redhat-rpm-config \
@@ -94,8 +96,6 @@ RUN dnf -y install \
weston-libs \
which \
xorg-x11-server-Xvfb \
&& dnf install -y 'dnf-command(builddep)' \
&& dnf builddep -y wayland \
&& dnf clean all
# Enable sudo for wheel users

View File

@@ -20,6 +20,7 @@ flatpak build ${builddir} meson \
-Dx11-backend=true \
-Dwayland-backend=true \
-Dbuild-tests=false \
-Dbuild-testsuite=false \
-Dbuild-examples=false \
-Dintrospection=disabled \
-Ddemos=true \

View File

@@ -23,6 +23,7 @@ push=0
list=0
print_help=0
no_login=0
no_cache=0
while (($# > 0)); do
case "${1%%=*}" in
@@ -34,6 +35,7 @@ while (($# > 0)); do
--base|-b) read_arg base "$@" || shift;;
--version|-v) read_arg base_version "$@" || shift;;
--no-login) no_login=1;;
--no-cache) no_cache=1;;
*) echo -e "\e[1;31mERROR\e[0m: Unknown option '$1'"; exit 1;;
esac
shift
@@ -103,11 +105,21 @@ TAG="${REGISTRY}/gnome/gtk/${base}:${base_version}"
if [ $build == 1 ]; then
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
${CMD} build \
${format} \
--build-arg HOST_USER_ID="$UID" \
--tag "${TAG}" \
--file "${base}.Dockerfile" .
if [ $no_cache == 0 ]; then
${CMD} build \
${format} \
--build-arg HOST_USER_ID="$UID" \
--tag "${TAG}" \
--file "${base}.Dockerfile" .
else
${CMD} build \
${format} \
--no-cache \
--build-arg HOST_USER_ID="$UID" \
--tag "${TAG}" \
--file "${base}.Dockerfile" .
fi
exit $?
fi

View File

@@ -8,7 +8,7 @@ builddir=$1
backend=$2
# Ignore memory leaks lower in dependencies
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:verbosity=1:log_threads=1
export G_SLICE=always-malloc
case "${backend}" in
@@ -19,14 +19,24 @@ case "${backend}" in
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=failing \
--no-suite=flaky \
--no-suite=gsk-compare-broadway
# Store the exit code for the CI run, but always
# generate the reports
exit_code=$?
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
;;
wayland)
wayland*)
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
weston --backend=headless-backend.so --socket=wayland-5 --idle-time=0 &
@@ -38,27 +48,18 @@ case "${backend}" in
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=failing \
--no-suite=flaky \
--no-suite=gsk-compare-broadway
exit_code=$?
kill ${compositor}
;;
waylandgles)
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
weston --backend=headless-backend.so --socket=wayland-6 --idle-time=0 &
compositor=$!
export WAYLAND_DISPLAY=wayland-6
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=gsk-compare-broadway
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
exit_code=$?
kill ${compositor}
;;
@@ -74,10 +75,20 @@ case "${backend}" in
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=failing \
--no-suite=flaky \
--no-suite=gsk-compare-opengl
# don't let Broadway failures fail the run, for now
exit_code=0
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
kill ${server}
;;
@@ -90,18 +101,20 @@ esac
cd ${builddir}
$srcdir/.gitlab-ci/meson-junit-report.py \
--project-name=gtk \
--backend=${backend} \
--job-id="${CI_JOB_NAME}" \
--output=report-${backend}.xml \
meson-logs/testlog-${backend}.json
$srcdir/.gitlab-ci/meson-html-report.py \
--project-name=gtk \
--backend=${backend} \
--job-id="${CI_JOB_NAME}" \
--reftest-output-dir="testsuite/reftests/output/${backend}" \
--output=report-${backend}.html \
meson-logs/testlog-${backend}.json
for suffix in "" "_unstable"; do
$srcdir/.gitlab-ci/meson-junit-report.py \
--project-name=gtk \
--backend="${backend}${suffix}" \
--job-id="${CI_JOB_NAME}" \
--output="report-${backend}${suffix}.xml" \
"meson-logs/testlog-${backend}${suffix}.json"
$srcdir/.gitlab-ci/meson-html-report.py \
--project-name=gtk \
--backend="${backend}${suffix}" \
--job-id="${CI_JOB_NAME}" \
--reftest-output-dir="testsuite/reftests/output/${backend}${suffix}" \
--output="report-${backend}${suffix}.html" \
"meson-logs/testlog-${backend}${suffix}.json"
done
exit $exit_code

View File

@@ -5,7 +5,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
@echo on
:: FIXME: make warnings fatal
pip3 install --upgrade --user meson==0.60.3 || goto :error
pip3 install --upgrade --user meson~=0.64 || goto :error
meson -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
ninja -C _build || goto :error

View File

@@ -21,7 +21,7 @@ many things that we value:
Please, do not use the issue tracker for support questions. If you have
questions on how to use GTK effectively, you can use:
- the `#gtk` IRC channel on irc.gnome.org
- the `gtk` [room on matrix](https://matrix.to/#/#gtk:gnome.org)
- the [gtk tag on the GNOME Discourse instance](https://discourse.gnome.org/tag/gtk)
You can also look at the GTK tag on [Stack
@@ -44,6 +44,7 @@ If you're reporting a bug make sure to list:
0. which version of GTK are you using?
0. which operating system are you using?
0. what display and graphics driver are you using?
0. the necessary steps to reproduce the issue
0. the expected outcome
0. a description of the behavior; screenshots are also welcome

389
NEWS
View File

@@ -1,9 +1,372 @@
Overview of Changes in 4.9.1, dd-mm-yyyy
Overview of Changes in 4.11.2, xx-xx-xxxx
=========================================
Overview of Changes in 4.11.1, 03-04-2023
=========================================
* GtkLabel, GtkLinkButton:
- Make file:// uris work again
* GtkListView/GtkColumnView/GtkGridView:
- Fix clipping issues
- Handle focus movement better
- Introduce ::tab-behavior properties
- Introduce GtkListItem::focusable
- Introduce GtkColumnViewCell
- Introduce row factories in GtkColumnView
- Make list grid and column views inert when not rendering
* Drag-and-Drop:
- Support resizing drag surfaces, using the new
GdkDragSurface::compute-size signal
* Theme:
- Port .boxed-list style from Adwaita
- Make insensitive pictures appear grayed out
* Accessibility:
- Fix memory leaks
- Fix a crash
* GDK:
- Add gdk_surface_get_scale to get the fractional scale
- Use fractional scales on Wayland with cairo
- Use fractional scales on Wayland with GL if GDK_DEBUG=gl-fractional
is set. This support is still experimental
* GSK:
- Allow limiting texture sizes with GSK_MAX_TEXTURE_SIZE
- Use samplers for GL texture filtering
- Fix problems with texture slicing
- Avoid re-uploading textures when possible
- Use mipmaps when it is beneficial
* Wayland:
- Fix handling of Drag hotspots
- Fix a crash with cursor size 0
- Support absolute paths in WAYLAND_DISPLAY
- Use the fractional scale protocol
- Use a viewporter to set buffer scale
* Windows:
- Fix problems with WGL
* Vulkan:
- Some fixes to the experimental Vulkan renderer
- Support fractional scaling
* Debugging:
- Show more Wayland-specific information in the inspector
* Deprecations:
- gtk_widget_translate_coordinates
- gdk_surface_create_similar_surface
* Documentation:
- Add a section on coordinate systems
* Build:
- Require wayland-protocols 1.31
* Translation updates
- British English
- Bulgarian
- Chinese (China)
- Dutch
- French
- Persian
- Russian
Overview of Changes in 4.10.1, 14-03-2023
=========================================
* GtkFileChooser
- Improve search performance
- Be safe against pathless files
- Fix memory leaks
- Only show local files in recent files
- Show most recent files first
- Make files non-selectable in selet_folder mode
* GtkListView / GtkColumnView / GtkGridView
- Fix scrolling problems
- Support CSS border-spacing
* GtkComboBox
- Fix a size allocation problem
* gtk
- Size allocation fixes
* Accessibility
- Miscellaneous property fixes and improvements
* Wayland
- Fix an ordering problem in surface disposal
* Windows
- Fix Visual Studio build with older GLib
* Translation updates
Basque
Bulgarian
Catalan
Czech
Danish
Finnish
Friulian
Galician
Georgian
Hungarian
Lithuanian
Polish
Portuguese
Swedish
Turkish
Ukrainian
Overview of Changes in 4.10.0, 04-03-2023
=========================================
* GtkTextView
- Document hanging indentation
* GtkListView
- Fix a size allocation problem
* GtkFileChooser
- Fix paned behavior
- Fix a crash
* GtkText
- Fix various problems with undo
* Accessibility
- Make some getters transfer-full
- Allow setting accessible parents and siblings
- Add a role for toggle buttons
- Miscellaneous property fixes and improvements
* gtk
- Improve the handling resize-during-size-allocate
* gdk
- Introduce GdkTextureDownloader and use it
- Make gdk_texture_get_format public
* gsk
- Make mask nodes more versatile
- Improve the GL implementation for texture scale nodes
* X11
- Fix key handling during DND
* Tools
- gtk-builder-tool: Try harder to handle templates
- gtk-builder-tool: Prefer properties over <child>
* Translation updates
Basque
Belarusian
Bulgarian
Indonesian
Galician
Georgian
German
Hebrew
Lithuanian
Portuguese
Spanish
Swedish
Turkish
Ukrainian
Overview of Changes in 4.9.4, 12-02-2023
========================================
Note that deprecations are an early outlook
at changes that will appear in an eventual
GTK 5 release, which is still far away.
* Printing:
- Add a CPDB backend
- Drop the lpr backend
* GtkFileDialog:
- Robustness fixes
* GtkScaleButton:
- Add an 'active' property
* GtkSearchEntry:
- Add placeholder text
* Fix conflicting type names between gtk and gio
* Gsk:
- Settable filtering for scaled textures
- Add mask nodes
- Some robustness and crash fixes
* Wayland:
- Handle dispatch failing in more places
* Deprecations:
- GtkVolumeButton
* Translation updates:
Belarusian
Chinese (Taiwan)
Georgian
Turkish
Ukrainian
Overview of Changes in 4.9.3, 04-02-2023
========================================
* Add GtkUriLauncher, as replacement for gtk_show_uri
* Add GdkMonitor::description
* Fix problems with tooltip sizing
* Deprecations:
- GtkStatusbar
- GtkAssistant
- GtkLockButton
- gtk_gesture_set_sequence_state
* GtkColumnView:
- Only create widgets for visible columns
* GtkFileDialog:
- Drop shortcut folders API
* GtkCalendar:
- Make marked days work again
* GtkSwitch:
- Make state and active independently settable
* GtkFileChooser:
- Fix a crash with DND
- Fix excessively wide sidebar
- Make context menus work again
* Accessibility:
- Make GtkAccessible public, so it can be implemented outside GTK
- Support accessible implementation for editables
* CSS:
- Fix randomly stopping CSS animations
* GL:
- Fix synchronization with GStreamer
- Fix problems with 3rd party GL in the same thread
* Wayland:
- Fix startup notification with xdg_activation
* Broadway:
- Implement modal windows
* macOS:
- Make DND work
* Build:
- Require graphene 1.10
- Require gobject-introspection 1.72
* Translation updates
Catalan
Galician
German
Hebrew
Indonesian
Portuguese
Russian
Spanish
Swedish
Turkish
Ukrainian
Overview of Changes in 4.9.2, 26-12-2022
========================================
* GtkFileChooserWidget:
- Add a grid view
* GtkText, GtkTextView:
- Fix activation of the on-screen keyboard
- Prevent unexpected text direction changes
* GtkCenterBox:
- Add properties for children
* GtkTreeExpander:
- Add a hide-expander property
* GtkStringList:
- Add a construct-only strings property
* GtkBuilder:
- Support parsing Pango attributes in string form
* GtkGestureStylus:
- Add a stylus-only property
* GtkFileLauncher:
- New async-style api to replace gtk_show_uri
* GtkColorDialog, GtkFontDialog, GtkFileDialog,
GtkAlertDialog:
- APIs have seen some tweaks
- Prefer portals when available
- Fixes for cancellation
* Add GDK_DEBUG=no-portals
* Improve file DND with remote files
* GtkInfoBar has been deprecated
* gtk_widget_show/hide have been deprecated
* gtk_show_uri has been deprecated
* Wayland:
- Fix button mask handling
- Fix problems with cursor size on hi-dpi screens
- Support newer versions of some protocols
- Fix handling of surrounding text in input methods
* X11:
- Fix some ordering problems with surface destruction
* Windows:
- Improved system settings integration
- Fix window resizing work with native decorations
- Include a full hicolor index.theme file as a resource
* Translation updates
Croatian
Dutch
Hungarian
Interlingua
Persian
Turkish
Ukrainian
Overview of Changes in 4.9.1, 31-10-2022
========================================
Note that deprecations are an early outlook at changes
that will appear in an eventual GTK 5 release, which is
still far away. We are introducing deprecations in 4.10
as a way to give users time to adapt, and to provide
feedback on our plans.
* GtkTreeView, GtkIconView, GtkComboBox and
auxiliary classes have been deprecated
@@ -15,7 +378,21 @@ GTK 5 release, which is still far away.
* gtk_render_ and gtk_snapshot_render_ APIs
have been deprecated
* GtkAppChooser widgets hae been deprecated
* GtkAppChooser widgets have been deprecated
* GtkMessageDialog has been deprecated and
replaced by a new async dialog API
* GtkDialog has been deprecated
* GtkColorChooser, GtkFontChooser, GtkFileChooser
interfaces and their implementations have been
deprecated. A new family of async dialog APIs
has been introduced to replace them
* GtkColorDialog, GtkFontDialog, GtkFileDialog
and GtkAlertDialog are new dialog classes with
a consistent and well-bindable API
* GtkMountOperation:
- Fix the dialog to look reasonable
@@ -32,6 +409,8 @@ GTK 5 release, which is still far away.
- Make make debug options available in
non-debug builds
* Increase the memory limit for the jpeg loader to 1G
* Translation updates:
Abkhazian
Basque

View File

@@ -202,43 +202,36 @@ constraint_editor_window_load (ConstraintEditorWindow *self,
}
static void
open_response_cb (GtkNativeDialog *dialog,
int response,
ConstraintEditorWindow *self)
open_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
ConstraintEditorWindow *self = user_data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
constraint_editor_window_load (self, file);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
open_cb (GtkWidget *button,
ConstraintEditorWindow *self)
{
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
GFile *cwd;
dialog = gtk_file_chooser_native_new ("Open file",
GTK_WINDOW (self),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
GFile *cwd = g_file_new_for_path (".");
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Open file");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_initial_folder (dialog, cwd);
g_object_unref (cwd);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), self);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
gtk_file_dialog_open (dialog, GTK_WINDOW (self), NULL, open_response_cb, self);
g_object_unref (dialog);
}
static void
@@ -294,22 +287,23 @@ serialize_model (GListModel *list)
static void
save_response_cb (GtkNativeDialog *dialog,
int response,
ConstraintEditorWindow *self)
save_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
ConstraintEditorWindow *self = user_data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_save_finish (dialog, result, NULL);
if (file)
{
GListModel *model;
GFile *file;
char *text;
GError *error = NULL;
model = constraint_view_get_model (CONSTRAINT_VIEW (self->view));
text = serialize_model (model);
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
g_file_replace_contents (file, text, strlen (text),
NULL, FALSE,
G_FILE_CREATE_NONE,
@@ -318,46 +312,38 @@ save_response_cb (GtkNativeDialog *dialog,
&error);
if (error != NULL)
{
GtkWidget *message_dialog;
GtkAlertDialog *alert;
message_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Saving failed");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
"%s", error->message);
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
alert = gtk_alert_dialog_new ("Saving failed");
gtk_alert_dialog_set_detail (alert, error->message);
gtk_alert_dialog_show (alert,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))));
g_object_unref (alert);
g_error_free (error);
}
g_free (text);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
save_cb (GtkWidget *button,
ConstraintEditorWindow *self)
{
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
GFile *cwd;
dialog = gtk_file_chooser_native_new ("Save constraints",
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
GTK_FILE_CHOOSER_ACTION_SAVE,
"_Save",
"_Cancel");
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
GFile *cwd = g_file_new_for_path (".");
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Save constraints");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_initial_folder (dialog, cwd);
g_object_unref (cwd);
g_signal_connect (dialog, "response", G_CALLBACK (save_response_cb), self);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
gtk_file_dialog_save (dialog,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
NULL,
save_response_cb, self);
g_object_unref (dialog);
}
static void
@@ -440,7 +426,7 @@ edit_constraint (ConstraintEditorWindow *win,
g_signal_connect (editor, "done", G_CALLBACK (constraint_editor_done), win);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
}
static void
@@ -473,7 +459,7 @@ edit_guide (ConstraintEditorWindow *win,
gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (editor));
g_signal_connect (editor, "done", G_CALLBACK (guide_editor_done), win);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
}
static void

View File

@@ -9,7 +9,7 @@ constraint_editor_sources = [
constraint_editor_resources = gnome.compile_resources('constraint_editor_resources',
'constraint-editor.gresource.xml',
source_dir: '.',
source_dir: meson.current_source_dir(),
)
executable('gtk4-constraint-editor',

View File

@@ -2,6 +2,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
typedef GtkApplication DemoApplication;
typedef GtkApplicationClass DemoApplicationClass;
@@ -33,22 +35,12 @@ static void create_window (GApplication *app, const char *contents);
static void
show_action_dialog (GSimpleAction *action)
{
const char *name;
GtkWidget *dialog;
GtkAlertDialog *dialog;
name = g_action_get_name (G_ACTION (action));
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"You activated action: \"%s\"",
name);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
dialog = gtk_alert_dialog_new ("You activated action: \"%s\n",
g_action_get_name (G_ACTION (action)));
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
}
static void
@@ -67,7 +59,7 @@ show_action_infobar (GSimpleAction *action,
text = g_strdup_printf ("You activated radio action: \"%s\".\n"
"Current value: %s", name, value);
gtk_label_set_text (GTK_LABEL (window->message), text);
gtk_widget_show (window->infobar);
gtk_widget_set_visible (window->infobar, TRUE);
g_free (text);
}
@@ -90,43 +82,38 @@ activate_new (GSimpleAction *action,
}
static void
open_response_cb (GtkNativeDialog *dialog,
int response_id,
gpointer user_data)
open_response_cb (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
GtkFileChooserNative *native = user_data;
GApplication *app = g_object_get_data (G_OBJECT (native), "app");
GtkWidget *message_dialog;
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GApplication *app = G_APPLICATION (user_data);
GFile *file;
char *contents;
GError *error = NULL;
if (response_id == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, &error);
if (file)
{
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (native));
char *contents;
if (g_file_load_contents (file, NULL, &contents, NULL, NULL, &error))
{
create_window (app, contents);
g_free (contents);
}
else
{
message_dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error loading file: \"%s\"",
error->message);
g_signal_connect (message_dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
g_error_free (error);
}
}
gtk_native_dialog_destroy (GTK_NATIVE_DIALOG (native));
g_object_unref (native);
if (error)
{
GtkAlertDialog *alert;
alert = gtk_alert_dialog_new ("Error loading file: \"%s\"", error->message);
gtk_alert_dialog_show (alert, NULL);
g_object_unref (alert);
g_error_free (error);
}
g_object_unref (app);
}
@@ -136,21 +123,11 @@ activate_open (GSimpleAction *action,
gpointer user_data)
{
GApplication *app = user_data;
GtkFileChooserNative *native;
GtkFileDialog *dialog;
native = gtk_file_chooser_native_new ("Open File",
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Open",
"_Cancel");
g_object_set_data_full (G_OBJECT (native), "app", g_object_ref (app), g_object_unref);
g_signal_connect (native,
"response",
G_CALLBACK (open_response_cb),
native);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
dialog = gtk_file_dialog_new ();
gtk_file_dialog_open (dialog, NULL, NULL, open_response_cb, g_object_ref (app));
g_object_unref (dialog);
}
static void
@@ -320,7 +297,7 @@ static GActionEntry win_entries[] = {
static void
clicked_cb (GtkWidget *widget, DemoApplicationWindow *window)
{
gtk_widget_hide (window->infobar);
gtk_widget_set_visible (window->infobar, FALSE);
}
static void

View File

@@ -7,6 +7,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *progress_bar = NULL;
static gboolean
@@ -140,7 +142,6 @@ create_page3 (GtkWidget *assistant)
label = gtk_label_new ("This is a confirmation page, press 'Apply' to apply changes");
gtk_widget_show (label);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), label);
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label, GTK_ASSISTANT_PAGE_CONFIRM);
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label, TRUE);
@@ -157,7 +158,6 @@ create_page4 (GtkWidget *assistant)
gtk_widget_set_margin_start (progress_bar, 40);
gtk_widget_set_margin_end (progress_bar, 40);
gtk_widget_show (progress_bar);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), progress_bar);
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), progress_bar, GTK_ASSISTANT_PAGE_PROGRESS);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), progress_bar, "Applying changes");
@@ -199,7 +199,7 @@ do_assistant (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (assistant))
gtk_widget_show (assistant);
gtk_widget_set_visible (assistant, TRUE);
else
gtk_window_destroy (GTK_WINDOW (assistant));

View File

@@ -297,12 +297,13 @@ blur_overlay_snapshot (GtkWidget *widget,
GtkWidget *main_widget;
GskRenderNode *main_widget_node = NULL;
GtkWidget *child;
GtkAllocation main_alloc;
int width, height;
cairo_region_t *clip = NULL;
int i;
main_widget = BLUR_OVERLAY (widget)->main_widget;
gtk_widget_get_allocation (widget, &main_alloc);
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
@@ -315,7 +316,7 @@ blur_overlay_snapshot (GtkWidget *widget,
if (blur > 0)
{
GtkAllocation alloc;
cairo_rectangle_int_t rect;
graphene_rect_t bounds;
if (main_widget_node == NULL)
@@ -327,8 +328,8 @@ blur_overlay_snapshot (GtkWidget *widget,
main_widget_node = gtk_snapshot_free_to_node (child_snapshot);
}
gtk_widget_get_allocation (child, &alloc);
graphene_rect_init (&bounds, alloc.x, alloc.y, alloc.width, alloc.height);
if (!gtk_widget_compute_bounds (child, gtk_widget_get_parent (child), &bounds))
graphene_rect_init (&bounds, 0, 0, 0, 0);
gtk_snapshot_push_blur (snapshot, blur);
gtk_snapshot_push_clip (snapshot, &bounds);
gtk_snapshot_append_node (snapshot, main_widget_node);
@@ -337,13 +338,17 @@ blur_overlay_snapshot (GtkWidget *widget,
if (clip == NULL)
{
cairo_rectangle_int_t rect;
rect.x = rect.y = 0;
rect.width = main_alloc.width;
rect.height = main_alloc.height;
rect.width = width;
rect.height = height;
clip = cairo_region_create_rectangle (&rect);
}
cairo_region_subtract_rectangle (clip, (cairo_rectangle_int_t *)&alloc);
rect.x = floor (bounds.origin.x);
rect.y = floor (bounds.origin.y);
rect.width = ceil (bounds.origin.x + bounds.size.width - rect.x);
rect.height = ceil (bounds.origin.y + bounds.size.height - rect.y);
cairo_region_subtract_rectangle (clip, &rect);
}
}

View File

@@ -37,6 +37,8 @@ remove_timeout (gpointer data)
g_source_remove (id);
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static gboolean
pop_status (gpointer data)
{
@@ -57,6 +59,8 @@ status_message (GtkStatusbar *status,
g_object_set_data_full (G_OBJECT (status), "timeout", GUINT_TO_POINTER (id), remove_timeout);
}
G_GNUC_END_IGNORE_DEPRECATIONS
static void
help_activate (GSimpleAction *action,
GVariant *parameter,
@@ -168,7 +172,7 @@ do_builder (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -1,4 +1,5 @@
/* Clipboard
* #Keywords: drag-and-drop, dnd
*
* GdkClipboard is used for clipboard handling. This demo shows how to
* copy and paste text, images, colors or files to and from the clipboard.
@@ -50,10 +51,10 @@ copy_button_clicked (GtkStack *source_stack,
}
else if (strcmp (visible_child_name, "Color") == 0)
{
GdkRGBA color;
const GdkRGBA *color;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (visible_child), &color);
gdk_clipboard_set (clipboard, GDK_TYPE_RGBA, &color);
color = gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (visible_child));
gdk_clipboard_set (clipboard, GDK_TYPE_RGBA, color);
}
else if (strcmp (visible_child_name, "File") == 0)
{
@@ -215,37 +216,71 @@ file_button_set_file (GtkButton *button,
}
static void
file_chooser_response (GtkNativeDialog *dialog,
int response,
GtkButton *button)
file_chooser_response (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkButton *button = GTK_BUTTON (user_data);
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
file_button_set_file (button, file);
g_object_unref (file);
update_copy_button_sensitivity (gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK));
}
gtk_native_dialog_destroy (dialog);
}
static void
open_file_cb (GtkWidget *button)
{
GtkFileChooserNative *chooser;
GtkFileDialog *dialog;
chooser = gtk_file_chooser_native_new ("Choose a file",
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Open",
"_Cancel");
dialog = gtk_file_dialog_new ();
g_signal_connect (chooser, "response", G_CALLBACK (file_chooser_response), button);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
NULL,
file_chooser_response, button);
g_object_unref (dialog);
}
static void
folder_chooser_response (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkButton *button = GTK_BUTTON (user_data);
GFile *file;
file = gtk_file_dialog_select_folder_finish (dialog, result, NULL);
if (file)
{
file_button_set_file (button, file);
g_object_unref (file);
update_copy_button_sensitivity (gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK));
}
}
static void
open_folder_cb (GtkWidget *button)
{
GtkFileDialog *dialog;
dialog = gtk_file_dialog_new ();
gtk_file_dialog_select_folder (dialog,
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
NULL,
folder_chooser_response, button);
g_object_unref (dialog);
}
static void
@@ -346,6 +381,7 @@ do_clipboard (GtkWidget *do_widget)
gtk_builder_cscope_add_callback (scope, source_changed_cb);
gtk_builder_cscope_add_callback (scope, text_changed_cb);
gtk_builder_cscope_add_callback (scope, open_file_cb);
gtk_builder_cscope_add_callback (scope, open_folder_cb);
gtk_builder_cscope_add_callback (scope, on_drop);
gtk_builder_cscope_add_callback (scope, drag_prepare);
builder = gtk_builder_new ();
@@ -369,7 +405,7 @@ do_clipboard (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -32,6 +32,7 @@
<item>Color</item>
<item>Image</item>
<item>File</item>
<item>Folder</item>
</items>
</object>
</property>
@@ -64,7 +65,11 @@
<object class="GtkStackPage">
<property name="name">Color</property>
<property name="child">
<object class="GtkColorButton" id="source_color">
<object class="GtkColorDialogButton" id="source_color">
<property name="dialog">
<object class="GtkColorDialog">
</object>
</property>
<property name="valign">center</property>
<property name="rgba">purple</property>
</object>
@@ -162,6 +167,30 @@
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">Folder</property>
<property name="child">
<object class="GtkButton" id="source_folder">
<child>
<object class="GtkDragSource">
<property name="propagation-phase">capture</property>
<signal name="prepare" handler="drag_prepare"/>
</object>
</child>
<property name="valign">center</property>
<property name="child">
<object class="GtkLabel">
<property name="label">—</property>
<property name="xalign">0</property>
<property name="ellipsize">start</property>
</object>
</property>
<signal name="clicked" handler="open_folder_cb"/>
</object>
</property>
</object>
</child>
</object>
</child>
<child>

View File

@@ -449,7 +449,7 @@ do_combobox (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -277,7 +277,7 @@ do_constraints (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -66,7 +66,7 @@ do_constraints_builder (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -229,7 +229,7 @@ do_constraints_interactive (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -152,7 +152,7 @@ do_constraints_vfl (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -68,7 +68,7 @@ do_css_accordion (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -115,7 +115,7 @@ do_css_basics (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -139,7 +139,7 @@ do_css_blendmodes (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -155,7 +155,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -124,7 +124,7 @@ do_css_pixbufs (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -142,7 +142,7 @@ do_css_shadows (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -33,7 +33,7 @@ do_cursors (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -43,7 +43,7 @@
<file>cssview.css</file>
<file>reset.css</file>
</gresource>
<gresource prefix="/dropdown">
<gresource prefix="/listview_selections">
<file>suggestionentry.h</file>
<file>suggestionentry.c</file>
<file>suggestionentry.css</file>
@@ -215,6 +215,12 @@
<file>demo3widget.h</file>
<file>demo3widget.ui</file>
</gresource>
<gresource prefix="/mask">
<file>demo4widget.c</file>
<file>demo4widget.h</file>
<file>hsla.h</file>
<file>hsla.c</file>
</gresource>
<gresource prefix="/paintable_svg">
<file>svgpaintable.h</file>
<file>svgpaintable.c</file>
@@ -268,7 +274,6 @@
<file>cursors.c</file>
<file>dialog.c</file>
<file>drawingarea.c</file>
<file>dropdown.c</file>
<file>dnd.c</file>
<file>editable_cells.c</file>
<file>entry_completion.c</file>
@@ -292,6 +297,7 @@
<file>iconscroll.c</file>
<file>iconview.c</file>
<file>iconview_edit.c</file>
<file>image_scaling.c</file>
<file>images.c</file>
<file>infobar.c</file>
<file>layoutmanager.c</file>
@@ -304,6 +310,7 @@
<file>listview_clocks.c</file>
<file>listview_filebrowser.c</file>
<file>listview_minesweeper.c</file>
<file>listview_selections.c</file>
<file>listview_settings.c</file>
<file>listview_ucd.c</file>
<file>listview_weather.c</file>
@@ -311,7 +318,7 @@
<file>list_store.c</file>
<file>main.c</file>
<file>markup.c</file>
<file>menu.c</file>
<file>mask.c</file>
<file>overlay.c</file>
<file>overlay_decorative.c</file>
<file>paint.c</file>

View File

@@ -3,16 +3,20 @@
enum
{
PROP_PAINTABLE = 1,
PROP_SCALE
PROP_TEXTURE = 1,
PROP_FILTER,
PROP_SCALE,
PROP_ANGLE,
};
struct _Demo3Widget
{
GtkWidget parent_instance;
GdkPaintable *paintable;
GdkTexture *texture;
float scale;
float angle;
GskScalingFilter filter;
GtkWidget *menu;
};
@@ -24,10 +28,86 @@ struct _Demo3WidgetClass
G_DEFINE_TYPE (Demo3Widget, demo3_widget, GTK_TYPE_WIDGET)
static gboolean
query_tooltip (GtkWidget *widget,
int x,
int y,
gboolean keyboard_mode,
GtkTooltip *tooltip,
gpointer data)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
GtkWidget *grid;
GtkWidget *label;
char *s, *s2;
const char *filter[] = { "Linear", "Nearest", "Trilinear" };
int precision, l;
grid = gtk_grid_new ();
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
label = gtk_label_new ("Texture");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
s = g_strdup_printf ("%d\342\200\206\303\227\342\200\206%d",
gdk_texture_get_width (self->texture),
gdk_texture_get_height (self->texture));
label = gtk_label_new (s);
g_free (s);
gtk_label_set_xalign (GTK_LABEL (label), 1);
gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1);
label = gtk_label_new ("Rotation");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
s = g_strdup_printf ("%.1f", self->angle);
if (g_str_has_suffix (s, ".0"))
s[strlen (s) - 2] = '\0';
s2 = g_strconcat (s, "\302\260", NULL);
label = gtk_label_new (s2);
g_free (s2);
g_free (s);
gtk_label_set_xalign (GTK_LABEL (label), 1);
gtk_grid_attach (GTK_GRID (grid), label, 1, 1, 1, 1);
label = gtk_label_new ("Scale");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
precision = 1;
do {
s = g_strdup_printf ("%.*f", precision, self->scale);
l = strlen (s) - 1;
while (s[l] == '0')
l--;
if (s[l] == '.')
s[l] = '\0';
precision++;
} while (strcmp (s, "0") == 0);
label = gtk_label_new (s);
g_free (s);
gtk_label_set_xalign (GTK_LABEL (label), 1);
gtk_grid_attach (GTK_GRID (grid), label, 1, 2, 1, 1);
label = gtk_label_new ("Filter");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1);
label = gtk_label_new (filter[self->filter]);
gtk_label_set_xalign (GTK_LABEL (label), 1);
gtk_grid_attach (GTK_GRID (grid), label, 1, 3, 1, 1);
gtk_tooltip_set_custom (tooltip, grid);
return TRUE;
}
static void
demo3_widget_init (Demo3Widget *self)
{
self->scale = 1.f;
self->angle = 0.f;
self->filter = GSK_SCALING_FILTER_LINEAR;
gtk_widget_init_template (GTK_WIDGET (self));
}
@@ -36,7 +116,7 @@ demo3_widget_dispose (GObject *object)
{
Demo3Widget *self = DEMO3_WIDGET (object);
g_clear_object (&self->paintable);
g_clear_object (&self->texture);
gtk_widget_dispose_template (GTK_WIDGET (self), DEMO3_TYPE_WIDGET);
@@ -49,21 +129,35 @@ demo3_widget_snapshot (GtkWidget *widget,
{
Demo3Widget *self = DEMO3_WIDGET (widget);
int x, y, width, height;
double w, h;
double w, h, w2, h2;
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
w = self->scale * gdk_paintable_get_intrinsic_width (self->paintable);
h = self->scale * gdk_paintable_get_intrinsic_height (self->paintable);
w2 = w = self->scale * gdk_texture_get_width (self->texture);
h2 = h = self->scale * gdk_texture_get_height (self->texture);
x = MAX (0, (width - ceil (w)) / 2);
y = MAX (0, (height - ceil (h)) / 2);
if (G_APPROX_VALUE (self->angle, 90.f, FLT_EPSILON) ||
G_APPROX_VALUE (self->angle, 270.f, FLT_EPSILON))
{
double s = w2;
w2 = h2;
h2 = s;
}
x = (width - ceil (w2)) / 2;
y = (height - ceil (h2)) / 2;
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
gdk_paintable_snapshot (self->paintable, snapshot, w, h);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (w2 / 2, h2 / 2));
gtk_snapshot_rotate (snapshot, self->angle);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- w / 2, - h / 2));
gtk_snapshot_append_scaled_texture (snapshot,
self->texture,
self->filter,
&GRAPHENE_RECT_INIT (0, 0, w, h));
gtk_snapshot_restore (snapshot);
gtk_snapshot_pop (snapshot);
}
@@ -78,14 +172,26 @@ demo3_widget_measure (GtkWidget *widget,
int *natural_baseline)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
int width, height;
int size;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
size = gdk_paintable_get_intrinsic_width (self->paintable);
else
size = gdk_paintable_get_intrinsic_height (self->paintable);
width = gdk_texture_get_width (self->texture);
height = gdk_texture_get_height (self->texture);
*minimum = *natural = self->scale * size;
if (G_APPROX_VALUE (self->angle, 90.f, FLT_EPSILON) ||
G_APPROX_VALUE (self->angle, 270.f, FLT_EPSILON))
{
int s = width;
width = height;
height = s;
}
if (orientation == GTK_ORIENTATION_HORIZONTAL)
size = width;
else
size = height;
*minimum = *natural = (int) ceil (self->scale * size);
}
static void
@@ -103,6 +209,8 @@ demo3_widget_size_allocate (GtkWidget *widget,
gtk_popover_present (GTK_POPOVER (self->menu));
}
static void update_actions (Demo3Widget *self);
static void
demo3_widget_set_property (GObject *object,
guint prop_id,
@@ -113,14 +221,32 @@ demo3_widget_set_property (GObject *object,
switch (prop_id)
{
case PROP_PAINTABLE:
g_clear_object (&self->paintable);
self->paintable = g_value_dup_object (value);
case PROP_TEXTURE:
g_clear_object (&self->texture);
self->texture = g_value_dup_object (value);
self->scale = 1.f;
self->angle = 0.f;
self->filter = GSK_SCALING_FILTER_LINEAR;
update_actions (self);
gtk_widget_queue_resize (GTK_WIDGET (object));
g_object_notify (object, "scale");
g_object_notify (object, "angle");
g_object_notify (object, "filter");
break;
case PROP_SCALE:
self->scale = g_value_get_float (value);
update_actions (self);
gtk_widget_queue_resize (GTK_WIDGET (object));
break;
case PROP_ANGLE:
self->angle = fmodf (g_value_get_float (value), 360.f);
gtk_widget_queue_resize (GTK_WIDGET (object));
break;
case PROP_FILTER:
self->filter = g_value_get_enum (value);
gtk_widget_queue_resize (GTK_WIDGET (object));
break;
@@ -140,14 +266,22 @@ demo3_widget_get_property (GObject *object,
switch (prop_id)
{
case PROP_PAINTABLE:
g_value_set_object (value, self->paintable);
case PROP_TEXTURE:
g_value_set_object (value, self->texture);
break;
case PROP_SCALE:
g_value_set_float (value, self->scale);
break;
case PROP_ANGLE:
g_value_set_float (value, self->angle);
break;
case PROP_FILTER:
g_value_set_enum (value, self->filter);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -169,6 +303,14 @@ pressed_cb (GtkGestureClick *gesture,
gtk_popover_popup (GTK_POPOVER (self->menu));
}
static void
update_actions (Demo3Widget *self)
{
gtk_widget_action_set_enabled (GTK_WIDGET (self), "zoom.in", self->scale < 1024.);
gtk_widget_action_set_enabled (GTK_WIDGET (self), "zoom.out", self->scale > 1./1024.);
gtk_widget_action_set_enabled (GTK_WIDGET (self), "zoom.reset", self->scale != 1.);
}
static void
zoom_cb (GtkWidget *widget,
const char *action_name,
@@ -178,19 +320,30 @@ zoom_cb (GtkWidget *widget,
float scale;
if (g_str_equal (action_name, "zoom.in"))
scale = MIN (10, self->scale * M_SQRT2);
scale = MIN (1024., self->scale * M_SQRT2);
else if (g_str_equal (action_name, "zoom.out"))
scale = MAX (0.01, self->scale / M_SQRT2);
else
scale = MAX (1./1024., self->scale / M_SQRT2);
else if (g_str_equal (action_name, "zoom.reset"))
scale = 1.0;
gtk_widget_action_set_enabled (widget, "zoom.in", scale < 10);
gtk_widget_action_set_enabled (widget, "zoom.out", scale > 0.01);
gtk_widget_action_set_enabled (widget, "zoom.reset", scale != 1);
else
g_assert_not_reached ();
g_object_set (widget, "scale", scale, NULL);
}
static void
rotate_cb (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
int angle;
g_variant_get (parameter, "i", &angle);
g_object_set (widget, "angle", fmodf (self->angle + angle, 360.f), NULL);
}
static void
demo3_widget_class_init (Demo3WidgetClass *class)
{
@@ -205,20 +358,31 @@ demo3_widget_class_init (Demo3WidgetClass *class)
widget_class->measure = demo3_widget_measure;
widget_class->size_allocate = demo3_widget_size_allocate;
g_object_class_install_property (object_class, PROP_PAINTABLE,
g_param_spec_object ("paintable", "Paintable", "Paintable",
GDK_TYPE_PAINTABLE,
g_object_class_install_property (object_class, PROP_TEXTURE,
g_param_spec_object ("texture", NULL, NULL,
GDK_TYPE_TEXTURE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_SCALE,
g_param_spec_float ("scale", "Scale", "Scale",
0.0, 10.0, 1.0,
g_param_spec_float ("scale", NULL, NULL,
1./1024., 1024., 1.0,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_ANGLE,
g_param_spec_float ("angle", NULL, NULL,
0.0, 360.0, 0.0,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_FILTER,
g_param_spec_enum ("filter", NULL, NULL,
GSK_TYPE_SCALING_FILTER, GSK_SCALING_FILTER_LINEAR,
G_PARAM_READWRITE));
/* These are the actions that we are using in the menu */
gtk_widget_class_install_action (widget_class, "zoom.in", NULL, zoom_cb);
gtk_widget_class_install_action (widget_class, "zoom.out", NULL, zoom_cb);
gtk_widget_class_install_action (widget_class, "zoom.reset", NULL, zoom_cb);
gtk_widget_class_install_action (widget_class, "rotate", "i", rotate_cb);
gtk_widget_class_set_template_from_resource (widget_class, "/menu/demo3widget.ui");
gtk_widget_class_bind_template_child (widget_class, Demo3Widget, menu);
@@ -229,16 +393,18 @@ GtkWidget *
demo3_widget_new (const char *resource)
{
Demo3Widget *self;
GdkPixbuf *pixbuf;
GdkPaintable *paintable;
GdkTexture *texture;
pixbuf = gdk_pixbuf_new_from_resource (resource, NULL);
paintable = GDK_PAINTABLE (gdk_texture_new_for_pixbuf (pixbuf));
texture = gdk_texture_new_from_resource (resource);
self = g_object_new (DEMO3_TYPE_WIDGET, "paintable", paintable, NULL);
self = g_object_new (DEMO3_TYPE_WIDGET,
"texture", texture,
"has-tooltip", TRUE,
NULL);
g_object_unref (pixbuf);
g_object_unref (paintable);
g_signal_connect (self, "query-tooltip", G_CALLBACK (query_tooltip), NULL);
g_object_unref (texture);
return GTK_WIDGET (self);
}

View File

@@ -12,6 +12,11 @@
<attribute name="label">11</attribute>
<attribute name="action">zoom.reset</attribute>
</item>
<item>
<attribute name="label">Rotate</attribute>
<attribute name="action">rotate</attribute>
<attribute name="target" type="i">90</attribute>
</item>
</menu>
<template class="Demo3Widget">
<child>

View File

@@ -0,0 +1,226 @@
#include <math.h>
#include "demo4widget.h"
#include "hsla.h"
enum
{
PROP_0,
PROP_PROGRESS,
};
struct _Demo4Widget
{
GtkWidget parent_instance;
PangoLayout *layout;
GskColorStop stops[8];
gsize n_stops;
double progress;
guint tick;
};
struct _Demo4WidgetClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (Demo4Widget, demo4_widget, GTK_TYPE_WIDGET)
static void
rotate_color (GdkRGBA *rgba)
{
GdkHSLA hsla;
_gdk_hsla_init_from_rgba (&hsla, rgba);
hsla.hue -= 1;
_gdk_rgba_init_from_hsla (rgba, &hsla);
}
static gboolean
rotate_colors (GtkWidget *widget,
GdkFrameClock *clock,
gpointer user_data)
{
Demo4Widget *self = DEMO4_WIDGET (widget);
for (unsigned int i = 0; i < self->n_stops; i++)
rotate_color (&self->stops[i].color);
gtk_widget_queue_draw (widget);
return G_SOURCE_CONTINUE;
}
static void
demo4_widget_init (Demo4Widget *self)
{
PangoFontDescription *desc;
self->progress = 0.5;
self->n_stops = 8;
self->stops[0].offset = 0;
self->stops[0].color = (GdkRGBA) { 1, 0, 0, 1 };
for (unsigned int i = 1; i < self->n_stops; i++)
{
GdkHSLA hsla;
self->stops[i].offset = i / (double)(self->n_stops - 1);
_gdk_hsla_init_from_rgba (&hsla, &self->stops[i - 1].color);
hsla.hue += 360.0 / (double)(self->n_stops - 1);
_gdk_rgba_init_from_hsla (&self->stops[i].color, &hsla);
}
self->layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), "123");
desc = pango_font_description_from_string ("Cantarell Bold 210");
pango_layout_set_font_description (self->layout, desc);
pango_font_description_free (desc);
self->tick = gtk_widget_add_tick_callback (GTK_WIDGET (self), rotate_colors, NULL, NULL);
}
static void
demo4_widget_dispose (GObject *object)
{
Demo4Widget *self = DEMO4_WIDGET (object);
g_clear_object (&self->layout);
gtk_widget_remove_tick_callback (GTK_WIDGET (self), self->tick);
G_OBJECT_CLASS (demo4_widget_parent_class)->dispose (object);
}
static void
demo4_widget_snapshot_content (GtkWidget *widget,
GtkSnapshot *snapshot,
GskMaskMode mode)
{
Demo4Widget *self = DEMO4_WIDGET (widget);
int width, height, layout_width, layout_height;
double scale;
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
gtk_snapshot_push_mask (snapshot, mode);
pango_layout_get_pixel_size (self->layout, &layout_width, &layout_height);
scale = MIN ((double) width / layout_width, (double) height / layout_height);
gtk_snapshot_translate (snapshot,
&GRAPHENE_POINT_INIT ((width - scale * layout_width) / 2,
(height - scale * layout_height) / 2));
gtk_snapshot_scale (snapshot, scale, scale);
gtk_snapshot_append_layout (snapshot, self->layout, &(GdkRGBA) { 0, 0, 0, 1 });
gtk_snapshot_pop (snapshot);
gtk_snapshot_append_linear_gradient (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height),
&GRAPHENE_POINT_INIT (0, 0),
&GRAPHENE_POINT_INIT (width, height),
self->stops,
self->n_stops);
gtk_snapshot_pop (snapshot);
}
static void
demo4_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
Demo4Widget *self = DEMO4_WIDGET (widget);
int width, height;
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
gtk_snapshot_push_mask (snapshot, GSK_MASK_MODE_INVERTED_LUMINANCE);
gtk_snapshot_append_linear_gradient (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height),
&GRAPHENE_POINT_INIT (0, 0),
&GRAPHENE_POINT_INIT (width, 0),
(GskColorStop[2]) {
{ MAX (0.0, self->progress - 5.0 / width), { 1, 1, 1, 1 } },
{ MIN (1.0, self->progress + 5.0 / width), { 0, 0, 0, 1 } }
}, 2);
gtk_snapshot_pop (snapshot);
demo4_widget_snapshot_content (widget, snapshot, GSK_MASK_MODE_INVERTED_ALPHA);
gtk_snapshot_pop (snapshot);
gtk_snapshot_push_mask (snapshot, GSK_MASK_MODE_LUMINANCE);
gtk_snapshot_append_linear_gradient (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height),
&GRAPHENE_POINT_INIT (0, 0),
&GRAPHENE_POINT_INIT (width, 0),
(GskColorStop[2]) {
{ MAX (0.0, self->progress - 5.0 / width), { 1, 1, 1, 1 } },
{ MIN (1.0, self->progress + 5.0 / width), { 0, 0, 0, 1 } }
}, 2);
gtk_snapshot_pop (snapshot);
demo4_widget_snapshot_content (widget, snapshot, GSK_MASK_MODE_ALPHA);
gtk_snapshot_pop (snapshot);
}
static void
demo4_widget_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
Demo4Widget *self = DEMO4_WIDGET (object);
switch (prop_id)
{
case PROP_PROGRESS:
self->progress = g_value_get_double (value);
gtk_widget_queue_draw (GTK_WIDGET (object));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
demo4_widget_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
Demo4Widget *self = DEMO4_WIDGET (object);
switch (prop_id)
{
case PROP_PROGRESS:
g_value_set_double (value, self->progress);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
demo4_widget_class_init (Demo4WidgetClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = demo4_widget_dispose;
object_class->get_property = demo4_widget_get_property;
object_class->set_property = demo4_widget_set_property;
widget_class->snapshot = demo4_widget_snapshot;
g_object_class_install_property (object_class, PROP_PROGRESS,
g_param_spec_double ("progress", NULL, NULL,
0.0, 1.0, 0.5,
G_PARAM_READWRITE));
}
GtkWidget *
demo4_widget_new (void)
{
return g_object_new (DEMO4_TYPE_WIDGET, NULL);
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO4_TYPE_WIDGET (demo4_widget_get_type ())
G_DECLARE_FINAL_TYPE (Demo4Widget, demo4_widget, DEMO4, WIDGET, GtkWidget)
GtkWidget * demo4_widget_new (void);

View File

@@ -8,6 +8,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
static GtkWidget *entry1 = NULL;
static GtkWidget *entry2 = NULL;
@@ -27,7 +29,7 @@ message_dialog_clicked (GtkButton *button,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
ngettext ("Has been shown once", "Has been shown %d times", i), i);
g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
gtk_window_present (GTK_WINDOW (dialog));
i++;
}
@@ -114,7 +116,7 @@ interactive_dialog_clicked (GtkButton *button,
data, (GClosureNotify) g_free,
0);
gtk_widget_show (dialog);
gtk_window_present (GTK_WINDOW (dialog));
}
GtkWidget *
@@ -184,7 +186,7 @@ do_dialog (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -324,7 +324,7 @@ canvas_item_start_editing (CanvasItem *item)
GtkWidget *canvas = gtk_widget_get_parent (GTK_WIDGET (item));
GtkWidget *entry;
GtkWidget *scale;
double x, y;
graphene_point_t p;
if (item->editor)
return;
@@ -350,12 +350,17 @@ canvas_item_start_editing (CanvasItem *item)
gtk_box_append (GTK_BOX (item->editor), scale);
gtk_widget_translate_coordinates (GTK_WIDGET (item), canvas, 0, 0, &x, &y);
gtk_fixed_put (GTK_FIXED (canvas), item->editor, x, y + 2 * item->r);
if (!gtk_widget_compute_point (GTK_WIDGET (item), canvas, &GRAPHENE_POINT_INIT (0, 0), &p))
graphene_point_init (&p, 0, 0);
gtk_fixed_put (GTK_FIXED (canvas), item->editor, p.x, p.y + 2 * item->r);
gtk_widget_grab_focus (entry);
}
typedef struct {
double x, y;
} Hotspot;
static GdkContentProvider *
prepare (GtkDragSource *source,
double x,
@@ -363,6 +368,8 @@ prepare (GtkDragSource *source,
{
GtkWidget *canvas;
GtkWidget *item;
Hotspot *hotspot;
graphene_point_t p;
canvas = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
item = gtk_widget_pick (canvas, x, y, GTK_PICK_DEFAULT);
@@ -373,6 +380,13 @@ prepare (GtkDragSource *source,
g_object_set_data (G_OBJECT (canvas), "dragged-item", item);
hotspot = g_new (Hotspot, 1);
if (!gtk_widget_compute_point (canvas, item, &GRAPHENE_POINT_INIT (x, y), &p))
graphene_point_init (&p, x, y);
hotspot->x = p.x;
hotspot->y = p.y;
g_object_set_data_full (G_OBJECT (canvas), "hotspot", hotspot, g_free);
return gdk_content_provider_new_typed (GTK_TYPE_WIDGET, item);
}
@@ -383,12 +397,14 @@ drag_begin (GtkDragSource *source,
GtkWidget *canvas;
CanvasItem *item;
GdkPaintable *paintable;
Hotspot *hotspot;
canvas = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
item = CANVAS_ITEM (g_object_get_data (G_OBJECT (canvas), "dragged-item"));
hotspot = (Hotspot *) g_object_get_data (G_OBJECT (canvas), "hotspot");
paintable = canvas_item_get_drag_icon (item);
gtk_drag_source_set_icon (source, paintable, item->r, item->r);
gtk_drag_source_set_icon (source, paintable, hotspot->x, hotspot->y);
g_object_unref (paintable);
gtk_widget_set_opacity (GTK_WIDGET (item), 0.3);
@@ -726,7 +742,9 @@ do_dnd (GtkWidget *do_widget)
GtkCssProvider *provider;
GString *css;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
button = gtk_color_button_new ();
G_GNUC_END_IGNORE_DEPRECATIONS
g_object_unref (g_object_ref_sink (button));
provider = gtk_css_provider_new ();
@@ -800,7 +818,7 @@ do_dnd (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -362,7 +362,7 @@ do_drawingarea (GtkWidget *do_widget)
G_CALLBACK (scribble_resize), NULL);
drag = gtk_gesture_drag_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), 0);
gtk_widget_add_controller (da, GTK_EVENT_CONTROLLER (drag));
g_signal_connect (drag, "drag-begin", G_CALLBACK (drag_begin), da);
@@ -372,7 +372,7 @@ do_drawingarea (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -409,7 +409,7 @@ do_editable_cells (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -115,7 +115,7 @@ do_entry_completion (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -46,7 +46,7 @@ do_entry_undo (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -42,12 +42,12 @@ mode_switch_state_set (GtkSwitch *sw,
if (!state ||
(gtk_range_get_value (GTK_RANGE (scale)) > 50))
{
gtk_widget_hide (label);
gtk_widget_set_visible (label, FALSE);
gtk_switch_set_state (sw, state);
}
else
{
gtk_widget_show (label);
gtk_widget_set_visible (label, TRUE);
}
return TRUE;
@@ -65,7 +65,7 @@ level_scale_value_changed (GtkRange *range,
!gtk_switch_get_state (GTK_SWITCH (sw)) &&
(gtk_range_get_value (range) > 50))
{
gtk_widget_hide (label);
gtk_widget_set_visible (label, FALSE);
gtk_switch_set_state (GTK_SWITCH (sw), TRUE);
}
else if (gtk_switch_get_state (GTK_SWITCH (sw)) &&
@@ -113,7 +113,7 @@ do_errorstates (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -10,6 +10,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
static void
@@ -120,7 +122,7 @@ do_expander (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -199,7 +199,7 @@ do_filtermodel (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -68,11 +68,13 @@ create_blurred_button (void)
return w;
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *
create_font_button (void)
{
return gtk_font_button_new ();
}
G_GNUC_END_IGNORE_DEPRECATIONS
static GtkWidget *
create_level_bar (void)
@@ -327,7 +329,7 @@ do_fishbowl (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -160,7 +160,7 @@ do_fixed (GtkWidget *do_widget)
demo_window = create_demo_window (do_widget);
if (!gtk_widget_get_visible (demo_window))
gtk_widget_show (demo_window);
gtk_widget_set_visible (demo_window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (demo_window));

View File

@@ -742,7 +742,7 @@ do_flowbox (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -21,6 +21,8 @@
#include "script-names.h"
#include "language-names.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* {{{ ScriptLang object */
G_DECLARE_FINAL_TYPE (ScriptLang, script_lang, SCRIPT, LANG, GObject)
@@ -256,10 +258,10 @@ swap_colors (void)
GdkRGBA fg;
GdkRGBA bg;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->foreground), &fg);
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->background), &bg);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->foreground), &bg);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->background), &fg);
fg = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground));
bg = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background));
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground), &bg);
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background), &fg);
}
static void
@@ -268,8 +270,8 @@ font_features_reset_basic (void)
gtk_adjustment_set_value (demo->size_adjustment, 20);
gtk_adjustment_set_value (demo->letterspacing_adjustment, 0);
gtk_adjustment_set_value (demo->line_height_adjustment, 1);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->foreground), &(GdkRGBA){0.,0.,0.,1.});
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->background), &(GdkRGBA){1.,1.,1.,1.});
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground), &(GdkRGBA){0.,0.,0.,1.});
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background), &(GdkRGBA){1.,1.,1.,1.});
}
static void
@@ -277,7 +279,7 @@ update_basic (void)
{
PangoFontDescription *desc;
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
gtk_adjustment_set_value (demo->size_adjustment,
pango_font_description_get_size (desc) / (double) PANGO_SCALE);
@@ -588,7 +590,7 @@ update_display (void)
end = PANGO_ATTR_INDEX_TO_TEXT_END;
}
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
value = gtk_adjustment_get_value (demo->size_adjustment);
pango_font_description_set_size (desc, value * PANGO_SCALE);
@@ -679,7 +681,7 @@ update_display (void)
GdkRGBA rgba;
char *fg, *bg, *css;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->foreground), &rgba);
rgba = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground));
attr = pango_attr_foreground_new (65535 * rgba.red,
65535 * rgba.green,
65535 * rgba.blue);
@@ -692,7 +694,7 @@ update_display (void)
pango_attr_list_insert (attrs, attr);
fg = gdk_rgba_to_string (&rgba);
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->background), &rgba);
rgba = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background));
bg = gdk_rgba_to_string (&rgba);
css = g_strdup_printf (".font_features_background { caret-color: %s; background-color: %s; }", fg, bg);
gtk_css_provider_load_from_data (demo->provider, css, strlen (css));
@@ -767,7 +769,6 @@ update_display (void)
gtk_label_set_attributes (GTK_LABEL (demo->the_label), attrs);
g_free (font_desc);
pango_font_description_free (desc);
g_free (features);
pango_attr_list_unref (attrs);
g_free (text);
@@ -779,7 +780,7 @@ get_pango_font (void)
PangoFontDescription *desc;
PangoContext *context;
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
context = gtk_widget_get_pango_context (demo->font);
return pango_context_load_font (context, desc);
@@ -831,17 +832,17 @@ update_script_combo (void)
GHashTable *tags;
GHashTableIter iter;
TagPair *pair;
char *lang;
PangoLanguage *language;
const char *lang;
hb_tag_t active;
lang = gtk_font_chooser_get_language (GTK_FONT_CHOOSER (demo->font));
language = gtk_font_dialog_button_get_language (GTK_FONT_DIALOG_BUTTON (demo->font));
lang = pango_language_to_string (language);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
active = hb_ot_tag_from_language (hb_language_from_string (lang, -1));
G_GNUC_END_IGNORE_DEPRECATIONS
g_free (lang);
store = g_list_store_new (script_lang_get_type ());
pango_font = get_pango_font ();
@@ -854,11 +855,6 @@ update_script_combo (void)
pair->lang_tag = 0;
g_hash_table_add (tags, pair);
pair = g_new (TagPair, 1);
pair->script_tag = HB_OT_TAG_DEFAULT_SCRIPT;
pair->lang_tag = HB_OT_TAG_DEFAULT_LANGUAGE;
g_hash_table_add (tags, pair);
if (hb_font)
{
hb_tag_t tables[2] = { HB_OT_TAG_GSUB, HB_OT_TAG_GPOS };
@@ -970,9 +966,6 @@ update_features (void)
/* set feature presence checks from the font features */
if (gtk_drop_down_get_selected (GTK_DROP_DOWN (demo->script_lang)) == 0)
return;
selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (demo->script_lang));
if (selected->lang_tag == 0) /* None is selected */
@@ -980,8 +973,8 @@ update_features (void)
for (l = demo->feature_items; l; l = l->next)
{
FeatureItem *item = l->data;
gtk_widget_show (item->feat);
gtk_widget_show (gtk_widget_get_parent (item->feat));
gtk_widget_set_visible (item->feat, TRUE);
gtk_widget_set_visible (gtk_widget_get_parent (item->feat), TRUE);
if (strcmp (item->name, "xxxx") == 0)
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), TRUE);
}
@@ -992,8 +985,8 @@ update_features (void)
for (l = demo->feature_items; l; l = l->next)
{
FeatureItem *item = l->data;
gtk_widget_hide (item->feat);
gtk_widget_hide (gtk_widget_get_parent (item->feat));
gtk_widget_set_visible (item->feat, FALSE);
gtk_widget_set_visible (gtk_widget_get_parent (item->feat), FALSE);
if (strcmp (item->name, "xxxx") == 0)
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), TRUE);
}
@@ -1001,11 +994,13 @@ update_features (void)
pango_font = get_pango_font ();
hb_font = pango_font_get_hb_font (pango_font);
g_print ("language %s\n", selected->langname);
if (hb_font)
{
hb_tag_t tables[2] = { HB_OT_TAG_GSUB, HB_OT_TAG_GPOS };
hb_face_t *hb_face;
char *feat;
const char *feat;
hb_face = hb_font_get_face (hb_font);
@@ -1027,9 +1022,6 @@ update_features (void)
char buf[5];
hb_tag_to_string (features[j], buf);
buf[4] = 0;
#if 0
g_print ("%s present in %s\n", buf, i == 0 ? "GSUB" : "GPOS");
#endif
if (g_str_has_prefix (buf, "ss") || g_str_has_prefix (buf, "cv"))
{
@@ -1079,15 +1071,15 @@ update_features (void)
if (item->tag == features[j])
{
gtk_widget_show (item->feat);
gtk_widget_show (gtk_widget_get_parent (item->feat));
gtk_widget_set_visible (item->feat, TRUE);
gtk_widget_set_visible (gtk_widget_get_parent (item->feat), TRUE);
if (GTK_IS_CHECK_BUTTON (item->feat))
{
GtkWidget *def = GTK_WIDGET (g_object_get_data (G_OBJECT (item->feat), "default"));
if (def)
{
gtk_widget_show (def);
gtk_widget_show (gtk_widget_get_parent (def));
gtk_widget_set_visible (def, TRUE);
gtk_widget_set_visible (gtk_widget_get_parent (def), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (def), TRUE);
}
else
@@ -1098,7 +1090,7 @@ update_features (void)
}
}
feat = gtk_font_chooser_get_font_features (GTK_FONT_CHOOSER (demo->font));
feat = gtk_font_dialog_button_get_font_features (GTK_FONT_DIALOG_BUTTON (demo->font));
if (feat)
{
for (l = demo->feature_items; l; l = l->next)
@@ -1124,8 +1116,6 @@ update_features (void)
}
}
}
g_free (feat);
}
}
@@ -1423,10 +1413,7 @@ instance_changed (GtkDropDown *combo)
ikey.name = (char *) text;
instance = g_hash_table_lookup (demo->instances, &ikey);
if (!instance)
{
g_print ("did not find instance %s\n", text);
goto out;
}
goto out;
pango_font = get_pango_font ();
hb_font = pango_font_get_hb_font (pango_font);
@@ -1780,6 +1767,7 @@ do_font_features (GtkWidget *do_widget)
demo->description = GTK_WIDGET (gtk_builder_get_object (builder, "description"));
demo->font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
demo->script_lang = GTK_WIDGET (gtk_builder_get_object (builder, "script_lang"));
g_assert (GTK_IS_DROP_DOWN (demo->script_lang));
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, G_CALLBACK (script_lang_get_langname), NULL, NULL);
gtk_drop_down_set_expression (GTK_DROP_DOWN (demo->script_lang), expression);
gtk_expression_unref (expression);

View File

@@ -58,11 +58,14 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkFontButton" id="font">
<object class="GtkFontDialogButton" id="font">
<property name="dialog">
<object class="GtkFontDialog">
</object>
</property>
<property name="receives-default">1</property>
<property name="font">Sans 12</property>
<property name="level">family|style</property>
<signal name="font-set" handler="font_features_font_changed" swapped="no"/>
<property name="level">face</property>
<signal name="notify::font-desc" handler="font_features_font_changed" swapped="no"/>
</object>
</child>
<child>
@@ -192,7 +195,11 @@
</object>
</child>
<child>
<object class="GtkColorButton" id="foreground">
<object class="GtkColorDialogButton" id="foreground">
<property name="dialog">
<object class="GtkColorDialog">
</object>
</property>
<property name="valign">baseline</property>
<property name="rgba">black</property>
<signal name="notify::rgba" handler="color_set_cb"/>
@@ -214,7 +221,11 @@
</object>
</child>
<child>
<object class="GtkColorButton" id="background">
<object class="GtkColorDialogButton" id="background">
<property name="dialog">
<object class="GtkColorDialog">
</object>
</property>
<property name="valign">baseline</property>
<property name="rgba">white</property>
<signal name="notify::rgba" handler="color_set_cb"/>

View File

@@ -53,7 +53,7 @@ update_image (void)
context = gtk_widget_create_pango_context (image);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (font_button));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (font_button));
fopt = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
@@ -287,8 +287,6 @@ retry:
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
g_object_unref (pixbuf2);
pango_font_description_free (desc);
}
static gboolean fading = FALSE;
@@ -437,7 +435,7 @@ do_fontrendering (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -74,7 +74,11 @@
</object>
</child>
<child>
<object class="GtkFontButton" id="font_button">
<object class="GtkFontDialogButton" id="font_button">
<property name="dialog">
<object class="GtkFontDialog">
</object>
</property>
<layout>
<property name="column">2</property>
<property name="row">1</property>

View File

@@ -157,7 +157,7 @@ do_frames (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -54,7 +54,6 @@ create_axis_slider (GtkGears *gears,
label = gtk_label_new (text);
gtk_box_append (GTK_BOX (box), label);
gtk_widget_show (label);
adj = gtk_adjustment_new (gtk_gears_get_axis (gears, axis), 0.0, 360.0, 1.0, 12.0, 0.0);
g_object_set_data (G_OBJECT (adj), "axis", GINT_TO_POINTER (axis));
@@ -65,9 +64,6 @@ create_axis_slider (GtkGears *gears,
gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE);
gtk_box_append (GTK_BOX (box), slider);
gtk_widget_set_vexpand (slider, TRUE);
gtk_widget_show (slider);
gtk_widget_show (box);
return box;
}
@@ -129,7 +125,7 @@ do_gears (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -208,7 +208,7 @@ do_gestures (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -221,16 +221,13 @@ static void
realize (GtkWidget *widget)
{
const char *vertex_path, *fragment_path;
GdkGLContext *context;
gtk_gl_area_make_current (GTK_GL_AREA (widget));
if (gtk_gl_area_get_error (GTK_GL_AREA (widget)) != NULL)
return;
context = gtk_gl_area_get_context (GTK_GL_AREA (widget));
if (gdk_gl_context_get_use_es (context))
if (gtk_gl_area_get_api (GTK_GL_AREA (widget)) == GDK_GL_API_GLES)
{
vertex_path = "/glarea/glarea-gles.vs.glsl";
fragment_path = "/glarea/glarea-gles.fs.glsl";
@@ -355,7 +352,6 @@ create_axis_slider (int axis)
label = gtk_label_new (text);
gtk_box_append (GTK_BOX (box), label);
gtk_widget_show (label);
adj = gtk_adjustment_new (0.0, 0.0, 360.0, 1.0, 12.0, 0.0);
g_signal_connect (adj, "value-changed",
@@ -364,9 +360,6 @@ create_axis_slider (int axis)
slider = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adj);
gtk_box_append (GTK_BOX (box), slider);
gtk_widget_set_hexpand (slider, TRUE);
gtk_widget_show (slider);
gtk_widget_show (box);
return box;
}
@@ -440,7 +433,7 @@ do_glarea (GtkWidget *do_widget)
demo_window = create_glarea_window (do_widget);
if (!gtk_widget_get_visible (demo_window))
gtk_widget_show (demo_window);
gtk_widget_set_visible (demo_window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (demo_window));

View File

@@ -33,7 +33,7 @@ static void
text_changed (GtkTextBuffer *buffer,
GtkWidget *button)
{
gtk_widget_show (button);
gtk_widget_set_visible (button, TRUE);
}
static void
@@ -58,7 +58,7 @@ apply_text (GtkWidget *button,
g_object_unref (shader);
g_bytes_unref (bytes);
gtk_widget_hide (button);
gtk_widget_set_visible (button, FALSE);
}
static void
@@ -237,7 +237,7 @@ make_shader_stack (const char *name,
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
gtk_widget_add_css_class (button, "small");
gtk_widget_hide (button);
gtk_widget_set_visible (button, FALSE);
gtk_center_box_set_end_widget (GTK_CENTER_BOX (widget), button);
gtk_box_append (GTK_BOX (vbox), widget);
@@ -354,7 +354,7 @@ do_gltransition (GtkWidget *do_widget)
demo_window = create_gltransition_window (do_widget);
if (!gtk_widget_get_visible (demo_window))
gtk_widget_show (demo_window);
gtk_widget_set_visible (demo_window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (demo_window));

View File

@@ -48,14 +48,16 @@
#define VERTICES_PER_TOOTH 34
#define GEAR_VERTEX_STRIDE 6
#ifndef HAVE_SINCOS
static void
sincos (double x, double *_sin, double *_cos)
static inline void
_sincos (double x, double *_sin, double *_cos)
{
#ifdef HAVE_SINCOS
sincos (x, _sin, _cos);
#else
*_sin = sin (x);
*_cos = cos (x);
}
#endif
}
/**
* Struct describing the vertices in triangle strip
@@ -307,11 +309,11 @@ create_gear (GLfloat inner_radius,
struct point p[7];
/* Calculate needed sin/cos for various angles */
sincos(i * 2.0 * G_PI / teeth + da * 0, &s[0], &c[0]);
sincos(i * 2.0 * M_PI / teeth + da * 1, &s[1], &c[1]);
sincos(i * 2.0 * M_PI / teeth + da * 2, &s[2], &c[2]);
sincos(i * 2.0 * M_PI / teeth + da * 3, &s[3], &c[3]);
sincos(i * 2.0 * M_PI / teeth + da * 4, &s[4], &c[4]);
_sincos(i * 2.0 * G_PI / teeth + da * 0, &s[0], &c[0]);
_sincos(i * 2.0 * M_PI / teeth + da * 1, &s[1], &c[1]);
_sincos(i * 2.0 * M_PI / teeth + da * 2, &s[2], &c[2]);
_sincos(i * 2.0 * M_PI / teeth + da * 3, &s[3], &c[3]);
_sincos(i * 2.0 * M_PI / teeth + da * 4, &s[4], &c[4]);
GEAR_POINT(p[0], r2, 1);
GEAR_POINT(p[1], r2, 2);
@@ -520,7 +522,7 @@ void perspective(GLfloat *m, GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloa
identity(tmp);
deltaZ = zFar - zNear;
sincos(radians, &sine, &cosine);
_sincos(radians, &sine, &cosine);
if ((deltaZ == 0) || (sine == 0) || (aspect == 0))
return;
@@ -735,7 +737,6 @@ gtk_gears_realize (GtkWidget *widget)
GtkGLArea *glarea = GTK_GL_AREA (widget);
GtkGears *gears = GTK_GEARS (widget);
GtkGearsPrivate *priv = gtk_gears_get_instance_private (gears);
GdkGLContext *context;
GLuint vao, v, f, program;
const char *p;
char msg[512];
@@ -746,8 +747,6 @@ gtk_gears_realize (GtkWidget *widget)
if (gtk_gl_area_get_error (glarea) != NULL)
return;
context = gtk_gl_area_get_context (glarea);
glEnable (GL_CULL_FACE);
glEnable (GL_DEPTH_TEST);
@@ -757,7 +756,7 @@ gtk_gears_realize (GtkWidget *widget)
priv->vao = vao;
/* Compile the vertex shader */
if (gdk_gl_context_get_use_es (context))
if (gtk_gl_area_get_api (glarea) == GDK_GL_API_GLES)
p = vertex_shader_gles;
else
p = vertex_shader_gl;
@@ -768,7 +767,7 @@ gtk_gears_realize (GtkWidget *widget)
g_debug ("vertex shader info: %s\n", msg);
/* Compile the fragment shader */
if (gdk_gl_context_get_use_es (context))
if (gtk_gl_area_get_api (glarea) == GDK_GL_API_GLES)
p = fragment_shader_gles;
else
p = fragment_shader_gl;

View File

@@ -50,7 +50,7 @@ do_headerbar (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

146
demos/gtk-demo/hsla.c Normal file
View File

@@ -0,0 +1,146 @@
#include <gdk/gdk.h>
#include "hsla.h"
void
_gdk_hsla_init_from_rgba (GdkHSLA *hsla,
const GdkRGBA *rgba)
{
float min;
float max;
float red;
float green;
float blue;
float delta;
g_return_if_fail (hsla != NULL);
g_return_if_fail (rgba != NULL);
red = rgba->red;
green = rgba->green;
blue = rgba->blue;
if (red > green)
{
if (red > blue)
max = red;
else
max = blue;
if (green < blue)
min = green;
else
min = blue;
}
else
{
if (green > blue)
max = green;
else
max = blue;
if (red < blue)
min = red;
else
min = blue;
}
hsla->lightness = (max + min) / 2;
hsla->saturation = 0;
hsla->hue = 0;
hsla->alpha = rgba->alpha;
if (max != min)
{
if (hsla->lightness <= 0.5)
hsla->saturation = (max - min) / (max + min);
else
hsla->saturation = (max - min) / (2 - max - min);
delta = max -min;
if (red == max)
hsla->hue = (green - blue) / delta;
else if (green == max)
hsla->hue = 2 + (blue - red) / delta;
else if (blue == max)
hsla->hue = 4 + (red - green) / delta;
hsla->hue *= 60;
if (hsla->hue < 0.0)
hsla->hue += 360;
}
}
void
_gdk_rgba_init_from_hsla (GdkRGBA *rgba,
const GdkHSLA *hsla)
{
float hue;
float lightness;
float saturation;
float m1, m2;
lightness = hsla->lightness;
saturation = hsla->saturation;
if (lightness <= 0.5)
m2 = lightness * (1 + saturation);
else
m2 = lightness + saturation - lightness * saturation;
m1 = 2 * lightness - m2;
rgba->alpha = hsla->alpha;
if (saturation == 0)
{
rgba->red = lightness;
rgba->green = lightness;
rgba->blue = lightness;
}
else
{
hue = hsla->hue + 120;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
if (hue < 60)
rgba->red = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
rgba->red = m2;
else if (hue < 240)
rgba->red = m1 + (m2 - m1) * (240 - hue) / 60;
else
rgba->red = m1;
hue = hsla->hue;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
if (hue < 60)
rgba->green = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
rgba->green = m2;
else if (hue < 240)
rgba->green = m1 + (m2 - m1) * (240 - hue) / 60;
else
rgba->green = m1;
hue = hsla->hue - 120;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
if (hue < 60)
rgba->blue = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
rgba->blue = m2;
else if (hue < 240)
rgba->blue = m1 + (m2 - m1) * (240 - hue) / 60;
else
rgba->blue = m1;
}
}

15
demos/gtk-demo/hsla.h Normal file
View File

@@ -0,0 +1,15 @@
#pragma once
typedef struct _GdkHSLA GdkHSLA;
struct _GdkHSLA {
float hue;
float saturation;
float lightness;
float alpha;
};
void _gdk_hsla_init_from_rgba (GdkHSLA *hsla,
const GdkRGBA *rgba);
void _gdk_rgba_init_from_hsla (GdkRGBA *rgba,
const GdkHSLA *hsla);

View File

@@ -399,7 +399,7 @@ do_hypertext (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -378,7 +378,7 @@ do_iconscroll (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -320,7 +320,7 @@ do_iconview (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -1,4 +1,5 @@
/* Icon View/Editing and Drag-and-Drop
* #Keywords: dnd
*
* The GtkIconView widget supports Editing and Drag-and-Drop.
* This example also demonstrates using the generic GtkCellLayout
@@ -150,7 +151,7 @@ do_iconview_edit (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -0,0 +1,191 @@
/* Image Scaling
* #Keywords: zoom, scale, filter, action, menu
*
* The custom widget we create here is similar to a GtkPicture,
* but allows setting a zoom level and filtering mode for the
* displayed paintable.
*
* It also demonstrates how to add a context menu to a custom
* widget and connect it with widget actions.
*
* The context menu has items to change the zoom level.
*/
#include <gtk/gtk.h>
#include "demo3widget.h"
static void
file_opened (GObject *source,
GAsyncResult *result,
void *data)
{
GFile *file;
GError *error = NULL;
GdkTexture *texture;
file = gtk_file_dialog_open_finish (GTK_FILE_DIALOG (source), result, &error);
if (!file)
{
g_print ("%s\n", error->message);
g_error_free (error);
return;
}
texture = gdk_texture_new_from_file (file, &error);
g_object_unref (file);
if (!texture)
{
g_print ("%s\n", error->message);
g_error_free (error);
return;
}
g_object_set (G_OBJECT (data), "texture", texture, NULL);
g_object_unref (texture);
}
static void
open_file (GtkWidget *picker,
GtkWidget *demo)
{
GtkWindow *parent = GTK_WINDOW (gtk_widget_get_root (picker));
GtkFileDialog *dialog;
GtkFileFilter *filter;
GListStore *filters;
dialog = gtk_file_dialog_new ();
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, "Images");
gtk_file_filter_add_pixbuf_formats (filter);
filters = g_list_store_new (GTK_TYPE_FILE_FILTER);
g_list_store_append (filters, filter);
g_object_unref (filter);
gtk_file_dialog_set_filters (dialog, G_LIST_MODEL (filters));
g_object_unref (filters);
gtk_file_dialog_open (dialog, parent, NULL, file_opened, demo);
g_object_unref (dialog);
}
static void
rotate (GtkWidget *button,
GtkWidget *demo)
{
float angle;
g_object_get (demo, "angle", &angle, NULL);
angle = fmodf (angle + 90.f, 360.f);
g_object_set (demo, "angle", angle, NULL);
}
static gboolean
transform_to (GBinding *binding,
const GValue *src,
GValue *dest,
gpointer user_data)
{
double from;
float to;
from = g_value_get_double (src);
to = (float) pow (2., from);
g_value_set_float (dest, to);
return TRUE;
}
static gboolean
transform_from (GBinding *binding,
const GValue *src,
GValue *dest,
gpointer user_data)
{
float to;
double from;
to = g_value_get_float (src);
from = log2 (to);
g_value_set_double (dest, from);
return TRUE;
}
GtkWidget *
do_image_scaling (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *box;
GtkWidget *box2;
GtkWidget *sw;
GtkWidget *widget;
GtkWidget *scale;
GtkWidget *dropdown;
GtkWidget *button;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Image Scaling");
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child (GTK_WINDOW (window), box);
sw = gtk_scrolled_window_new ();
gtk_widget_set_vexpand (sw, TRUE);
gtk_box_append (GTK_BOX (box), sw);
widget = demo3_widget_new ("/transparent/portland-rose.jpg");
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), widget);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_append (GTK_BOX (box), box2);
button = gtk_button_new_from_icon_name ("document-open-symbolic");
gtk_widget_set_tooltip_text (button, "Open File");
g_signal_connect (button, "clicked", G_CALLBACK (open_file), widget);
gtk_box_append (GTK_BOX (box2), button);
button = gtk_button_new_from_icon_name ("object-rotate-right-symbolic");
gtk_widget_set_tooltip_text (button, "Rotate");
g_signal_connect (button, "clicked", G_CALLBACK (rotate), widget);
gtk_box_append (GTK_BOX (box2), button);
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, -10., 10., 0.1);
gtk_scale_add_mark (GTK_SCALE (scale), 0., GTK_POS_TOP, NULL);
gtk_widget_set_tooltip_text (scale, "Zoom");
gtk_range_set_value (GTK_RANGE (scale), 0.);
gtk_widget_set_hexpand (scale, TRUE);
gtk_box_append (GTK_BOX (box2), scale);
dropdown = gtk_drop_down_new (G_LIST_MODEL (gtk_string_list_new ((const char *[]){ "Linear", "Nearest", "Trilinear", NULL })), NULL);
gtk_widget_set_tooltip_text (dropdown, "Filter");
gtk_box_append (GTK_BOX (box2), dropdown);
g_object_bind_property (dropdown, "selected", widget, "filter", G_BINDING_DEFAULT);
g_object_bind_property_full (gtk_range_get_adjustment (GTK_RANGE (scale)), "value",
widget, "scale",
G_BINDING_BIDIRECTIONAL,
transform_to,
transform_from,
NULL, NULL);
}
if (!gtk_widget_get_visible (window))
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -83,24 +83,17 @@ progressive_timeout (gpointer data)
if (bytes_read < 0)
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failure reading image file 'alphatest.png': %s",
error->message);
dialog = gtk_alert_dialog_new ("Failure reading image file 'alphatest.png': %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
g_object_unref (image_stream);
image_stream = NULL;
gtk_widget_show (dialog);
load_timeout = 0;
return FALSE; /* uninstall the timeout */
@@ -110,25 +103,17 @@ progressive_timeout (gpointer data)
buf, bytes_read,
&error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
g_object_unref (image_stream);
image_stream = NULL;
gtk_widget_show (dialog);
load_timeout = 0;
return FALSE; /* uninstall the timeout */
@@ -143,22 +128,14 @@ progressive_timeout (gpointer data)
error = NULL;
if (!g_input_stream_close (image_stream, NULL, &error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
g_object_unref (image_stream);
image_stream = NULL;
g_object_unref (pixbuf_loader);
@@ -177,25 +154,16 @@ progressive_timeout (gpointer data)
* it was incomplete.
*/
error = NULL;
if (!gdk_pixbuf_loader_close (pixbuf_loader,
&error))
if (!gdk_pixbuf_loader_close (pixbuf_loader, &error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
g_object_unref (pixbuf_loader);
pixbuf_loader = NULL;
@@ -216,20 +184,14 @@ progressive_timeout (gpointer data)
if (image_stream == NULL)
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s", error->message);
dialog = gtk_alert_dialog_new ("%s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
load_timeout = 0;
return FALSE; /* uninstall the timeout */
@@ -460,7 +422,7 @@ do_images (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -7,13 +7,15 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
on_bar_response (GtkInfoBar *info_bar,
int response_id,
gpointer user_data)
{
GtkWidget *dialog;
GtkWidget *window;
GtkAlertDialog *dialog;
char *detail;
if (response_id == GTK_RESPONSE_CLOSE)
{
@@ -21,19 +23,12 @@ on_bar_response (GtkInfoBar *info_bar,
return;
}
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (info_bar)));
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"You clicked a button on an info bar");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"Your response has id %d", response_id);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_window_destroy), dialog);
gtk_widget_show (dialog);
dialog = gtk_alert_dialog_new ("You clicked a button on an info bar");
detail = g_strdup_printf ("Your response has been %d", response_id);
gtk_alert_dialog_set_detail (dialog, detail);
g_free (detail);
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (info_bar))));
g_object_unref (dialog);
}
GtkWidget *
@@ -145,7 +140,7 @@ do_infobar (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -311,5 +311,12 @@ get_language_name_for_tag (guint32 tag)
lang = hb_ot_tag_to_language (tag);
s = hb_language_to_string (lang);
if (strcmp (s, "und-fonipa") == 0)
return "International Phonetic Alphabet";
else if (strcmp (s, "und-fonnapa") == 0)
return "North-American Phonetic Alphabet";
else if (strcmp (s, "ro-md") == 0)
return "Moldavian";
return get_language_name (pango_language_from_string (s));
}

View File

@@ -54,7 +54,7 @@ do_layoutmanager (GtkWidget *parent)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -190,7 +190,7 @@ do_layoutmanager2 (GtkWidget *parent)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -7,38 +7,22 @@
#include <gtk/gtk.h>
static void
response_cb (GtkWidget *dialog,
int response_id,
gpointer data)
{
gtk_window_destroy (GTK_WINDOW (dialog));
}
static gboolean
activate_link (GtkWidget *label,
activate_link (GtkWidget *label,
const char *uri,
gpointer data)
gpointer data)
{
if (g_strcmp0 (uri, "keynav") == 0)
{
GtkWidget *dialog;
GtkWidget *parent;
GtkAlertDialog *dialog;
parent = GTK_WIDGET (gtk_widget_get_root (label));
dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (parent),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Keyboard navigation");
gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog),
"The term <i>keynav</i> is a shorthand for "
"keyboard navigation and refers to the process of using "
"a program (exclusively) via keyboard input.");
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_window_present (GTK_WINDOW (dialog));
g_signal_connect (dialog, "response", G_CALLBACK (response_cb), NULL);
dialog = gtk_alert_dialog_new ("Keyboard navigation");
gtk_alert_dialog_set_detail (dialog,
"The term keynav is a shorthand for "
"keyboard navigation and refers to the process of using "
"a program (exclusively) via keyboard input.");
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (label)));
g_object_unref (dialog);
return TRUE;
}
@@ -79,11 +63,10 @@ do_links (GtkWidget *do_widget)
gtk_widget_set_margin_top (label, 20);
gtk_widget_set_margin_bottom (label, 20);
gtk_window_set_child (GTK_WINDOW (window), label);
gtk_widget_show (label);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -300,7 +300,7 @@ do_list_store (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
{
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
if (timeout == 0) {
/* FIXME this should use the animation-duration instead */
timeout = g_timeout_add (80, spinner_timeout, NULL);

View File

@@ -380,7 +380,6 @@ do_listbox (GtkWidget *do_widget)
{
message = gtk_message_new (lines[i]);
row = gtk_message_row_new (message);
gtk_widget_show (GTK_WIDGET (row));
gtk_list_box_insert (GTK_LIST_BOX (listbox), GTK_WIDGET (row), -1);
}
@@ -389,7 +388,7 @@ do_listbox (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -62,7 +62,7 @@ do_listbox_controls (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -30,90 +30,86 @@
</object>
</child>
<child>
<object class="GtkFrame">
<object class="GtkListBox">
<property name="selection-mode">none</property>
<signal name="row-activated" handler="row_activated"/>
<style>
<class name="rich-list"/>
<class name="boxed-list"/>
</style>
<child>
<object class="GtkListBox">
<property name="selection-mode">none</property>
<property name="show-separators">1</property>
<signal name="row-activated" handler="row_activated"/>
<style>
<class name="rich-list"/>
</style>
<object class="GtkListBoxRow">
<child>
<object class="GtkListBoxRow">
<object class="GtkBox">
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="switch_label">
<property name="label" translatable="yes">Switch</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="switch">
<property name="halign">end</property>
<property name="valign">center</property>
</object>
</child>
<object class="GtkLabel" id="switch_label">
<property name="label" translatable="yes">Switch</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="switch">
<property name="halign">end</property>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<child>
<object class="GtkListBoxRow">
<object class="GtkBox">
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="check_label">
<property name="label" translatable="yes">Check</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkCheckButton" id="check">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="active">1</property>
</object>
</child>
<object class="GtkLabel" id="check_label">
<property name="label" translatable="yes">Check</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkCheckButton" id="check">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="active">1</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<child>
<object class="GtkListBoxRow">
<object class="GtkBox">
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="image_label">
<property name="label" translatable="yes">Click here!</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkImage" id="image">
<property name="icon-name">object-select-symbolic</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="opacity">0</property>
</object>
</child>
<object class="GtkLabel" id="image_label">
<property name="label" translatable="yes">Click here!</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkImage" id="image">
<property name="icon-name">object-select-symbolic</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="opacity">0</property>
</object>
</child>
</object>
@@ -134,146 +130,142 @@
</style>
</object>
</child>
<child>
<object class="GtkFrame">
<child>
<object class="GtkListBox">
<property name="selection-mode">none</property>
<property name="show-separators">1</property>
<style>
<class name="rich-list"/>
</style>
<child>
<object class="GtkListBox">
<property name="selection-mode">none</property>
<style>
<class name="rich-list"/>
<class name="boxed-list"/>
</style>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="scale_label">
<property name="label" translatable="yes">Scale</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkScale">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="draw-value">0</property>
<property name="width-request">150</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="upper">100</property>
<property name="value">50</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="scale_label">
<property name="label" translatable="yes">Scale</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkScale">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="draw-value">0</property>
<property name="width-request">150</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="upper">100</property>
<property name="value">50</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="spin_label">
<property name="label" translatable="yes">Spinbutton</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkSpinButton">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="upper">100</property>
<property name="value">50</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="dropdown_label">
<property name="label" translatable="yes">Dropdown</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkDropDown">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="model">
<object class="GtkStringList">
<items>
<item>Choice 1</item>
<item>Choice 2</item>
<item>Choice 3</item>
<item>Choice 4</item>
</items>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="spin_label">
<property name="label" translatable="yes">Spinbutton</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkSpinButton">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="upper">100</property>
<property name="value">50</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="dropdown_label">
<property name="label" translatable="yes">Dropdown</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkDropDown">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="model">
<object class="GtkStringList">
<items>
<item>Choice 1</item>
<item>Choice 2</item>
<item>Choice 3</item>
<item>Choice 4</item>
</items>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="entry_label">
<property name="label" translatable="yes">Entry</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkEntry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="placeholder-text">Type here…</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="entry_label">
<property name="label" translatable="yes">Entry</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkEntry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="placeholder-text">Type here…</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>

View File

@@ -117,19 +117,16 @@ activate_cb (GtkListView *list,
G_APP_LAUNCH_CONTEXT (context),
&error))
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
/* And because error handling is important, even a simple demo has it:
* We display an error dialog that something went wrong.
*/
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (list))),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Could not launch %s", g_app_info_get_display_name (app_info));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
dialog = gtk_alert_dialog_new ("Could not launch %s", g_app_info_get_display_name (app_info));
gtk_alert_dialog_set_detail (dialog, error->message);
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (list))));
g_object_unref (dialog);
g_clear_error (&error);
gtk_widget_show (dialog);
}
g_object_unref (context);
@@ -194,7 +191,7 @@ do_listview_applauncher (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -494,7 +494,7 @@ do_listview_clocks (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -1124,7 +1124,7 @@ do_listview_colors (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -275,7 +275,7 @@ do_listview_filebrowser (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -485,7 +485,7 @@ do_listview_minesweeper (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -164,14 +164,14 @@ strings_bind_item (GtkSignalListItemFactory *factory,
popup = gtk_widget_get_ancestor (title, GTK_TYPE_POPOVER);
if (popup && gtk_widget_is_ancestor (popup, GTK_WIDGET (dropdown)))
{
gtk_widget_show (checkmark);
gtk_widget_set_visible (checkmark, TRUE);
g_signal_connect (dropdown, "notify::selected-item",
G_CALLBACK (selected_item_changed), item);
selected_item_changed (dropdown, NULL, item);
}
else
{
gtk_widget_hide (checkmark);
gtk_widget_set_visible (checkmark, FALSE);
}
}
@@ -369,7 +369,7 @@ match_func (MatchObject *obj,
}
GtkWidget *
do_dropdown (GtkWidget *do_widget)
do_listview_selections (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *button, *box, *spin, *check, *hbox, *label, *entry;
@@ -563,7 +563,7 @@ do_dropdown (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -148,9 +148,9 @@ settings_key_new (GSettings *settings,
}
static void
item_value_changed (GtkEditableLabel *label,
GParamSpec *pspec,
GtkListItem *item)
item_value_changed (GtkEditableLabel *label,
GParamSpec *pspec,
GtkColumnViewCell *cell)
{
SettingsKey *self;
const char *text;
@@ -162,8 +162,7 @@ item_value_changed (GtkEditableLabel *label,
text = gtk_editable_get_text (GTK_EDITABLE (label));
g_object_get (item, "item", &self, NULL);
g_object_unref (self);
self = gtk_column_view_cell_get_item (cell);
type = g_settings_schema_key_get_value_type (self->key);
name = g_settings_schema_key_get_name (self->key);
@@ -430,7 +429,7 @@ do_listview_settings (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -20,6 +20,7 @@
<object class="GtkScrolledWindow">
<child>
<object class="GtkListView" id="listview">
<property name="tab-behavior">item</property>
<style>
<class name="navigation-sidebar"/>
</style>
@@ -76,6 +77,7 @@
<property name="vexpand">1</property>
<child>
<object class="GtkColumnView" id="columnview">
<property name="tab-behavior">cell</property>
<style>
<class name="data-table"/>
</style>
@@ -88,13 +90,13 @@
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<template class="GtkColumnViewCell">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="name" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
<lookup name="item">GtkColumnViewCell</lookup>
</lookup>
</binding>
</object>
@@ -116,12 +118,12 @@
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<template class="GtkColumnViewCell">
<property name="child">
<object class="GtkEditableLabel">
<binding name="text">
<lookup name="value" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
<lookup name="item">GtkColumnViewCell</lookup>
</lookup>
</binding>
<signal name="notify::label" handler="item_value_changed"/>
@@ -144,13 +146,13 @@
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<template class="GtkColumnViewCell">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="type" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
<lookup name="item">GtkColumnViewCell</lookup>
</lookup>
</binding>
</object>
@@ -173,13 +175,13 @@
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<template class="GtkColumnViewCell">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="default-value" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
<lookup name="item">GtkColumnViewCell</lookup>
</lookup>
</binding>
</object>
@@ -203,14 +205,14 @@
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<template class="GtkColumnViewCell">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<property name="wrap">1</property>
<binding name="label">
<lookup name="summary" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
<lookup name="item">GtkColumnViewCell</lookup>
</lookup>
</binding>
</object>
@@ -234,14 +236,14 @@
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<template class="GtkColumnViewCell">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<property name="wrap">1</property>
<binding name="label">
<lookup name="description" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
<lookup name="item">GtkColumnViewCell</lookup>
</lookup>
</binding>
</object>

View File

@@ -383,7 +383,7 @@ do_listview_ucd (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -317,7 +317,7 @@ do_listview_weather (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -42,7 +42,7 @@ update_title_cb (GtkFilterListModel *model)
title = g_strdup_printf ("%u lines", g_list_model_get_n_items (G_LIST_MODEL (model)));
gtk_widget_set_visible (progress, pending != 0);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), (total - pending) / (double) total);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), total > 0 ? (total - pending) / (double) total : 0.);
gtk_window_set_title (GTK_WINDOW (window), title);
g_free (title);
}
@@ -141,39 +141,34 @@ load_file (GtkStringList *list,
}
static void
open_response_cb (GtkNativeDialog *dialog,
int response,
GtkStringList *stringlist)
open_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkStringList *stringlist = GTK_STRING_LIST (user_data);
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
load_file (stringlist, file);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
file_open_cb (GtkWidget *button,
GtkStringList *stringlist)
{
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
dialog = gtk_file_chooser_native_new ("Open file",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), stringlist);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
dialog = gtk_file_dialog_new ();
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_root (button)),
NULL,
open_response_cb, stringlist);
g_object_unref (dialog);
}
GtkWidget *
@@ -253,7 +248,7 @@ do_listview_words (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="focusable">0</property>
<property name="child">
<object class="GtkTreeExpander" id="expander">
<binding name="list-row">

View File

@@ -463,7 +463,6 @@ add_data_tab (const char *demoname)
widget = display_nothing (resource_name);
label = gtk_label_new (label_string ? label_string : resources[i]);
gtk_widget_show (label);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
g_object_set (gtk_notebook_get_page (GTK_NOTEBOOK (notebook), widget),
"tab-expand", FALSE,

View File

@@ -62,7 +62,6 @@ do_markup (GtkWidget *do_widget)
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
stack = gtk_stack_new ();
gtk_widget_show (stack);
gtk_window_set_child (GTK_WINDOW (window), stack);
show_source = gtk_check_button_new_with_label ("Source");
@@ -118,12 +117,10 @@ do_markup (GtkWidget *do_widget)
gtk_text_buffer_end_irreversible_action (buffer);
g_bytes_unref (bytes);
gtk_widget_show (stack);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

53
demos/gtk-demo/mask.c Normal file
View File

@@ -0,0 +1,53 @@
/* Masking
*
* Demonstrates mask nodes.
*
* This demo uses a text node as mask for
* an animated linear gradient.
*/
#include <gtk/gtk.h>
#include "demo4widget.h"
GtkWidget *
do_mask (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *box;
GtkWidget *demo;
GtkWidget *scale;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Mask Nodes");
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child (GTK_WINDOW (window), box);
demo = demo4_widget_new ();
gtk_widget_set_hexpand (demo, TRUE);
gtk_widget_set_vexpand (demo, TRUE);
gtk_box_append (GTK_BOX (box), demo);
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 1, 0.1);
gtk_range_set_value (GTK_RANGE (scale), 0.5);
g_object_bind_property (gtk_range_get_adjustment (GTK_RANGE (scale)), "value", demo, "progress", 0);
gtk_box_append (GTK_BOX (box), scale);
}
if (!gtk_widget_get_visible (window))
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -1,61 +0,0 @@
/* Menu
* #Keywords: action, zoom
*
* Demonstrates how to add a context menu to a custom widget
* and connect it with widget actions.
*
* The custom widget we create here is similar to a GtkPicture,
* but allows setting a zoom level for the displayed paintable.
*
* Our context menu has items to change the zoom level.
*/
#include <gtk/gtk.h>
#include "demo3widget.h"
GtkWidget *
do_menu (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *box;
GtkWidget *sw;
GtkWidget *widget;
GtkWidget *scale;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Menu");
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child (GTK_WINDOW (window), box);
sw = gtk_scrolled_window_new ();
gtk_widget_set_vexpand (sw, TRUE);
gtk_box_append (GTK_BOX (box), sw);
widget = demo3_widget_new ("/transparent/portland-rose.jpg");
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), widget);
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0.01, 10.0, 0.1);
gtk_range_set_value (GTK_RANGE (scale), 1.0);
gtk_box_append (GTK_BOX (box), scale);
g_object_bind_property (gtk_range_get_adjustment (GTK_RANGE (scale)), "value",
widget, "scale",
G_BINDING_BIDIRECTIONAL);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -39,6 +39,7 @@ demos = files([
'iconscroll.c',
'iconview.c',
'iconview_edit.c',
'image_scaling.c',
'images.c',
'infobar.c',
'layoutmanager.c',
@@ -46,7 +47,7 @@ demos = files([
'links.c',
'listbox.c',
'listbox_controls.c',
'menu.c',
'mask.c',
'flowbox.c',
'list_store.c',
'listview_applauncher.c',
@@ -54,7 +55,7 @@ demos = files([
'listview_colors.c',
'listview_filebrowser.c',
'listview_minesweeper.c',
'dropdown.c',
'listview_selections.c',
'listview_settings.c',
'listview_ucd.c',
'listview_weather.c',
@@ -114,6 +115,7 @@ extra_demo_sources = files([
'gtkshadertoy.c',
'gtkshaderstack.c',
'gskshaderpaintable.c',
'hsla.c',
'puzzlepiece.c',
'bluroverlay.c',
'demoimage.c',
@@ -126,6 +128,7 @@ extra_demo_sources = files([
'four_point_transform.c',
'demo2widget.c',
'demo3widget.c',
'demo4widget.c',
'pixbufpaintable.c',
'script-names.c',
'unicode-names.c',
@@ -156,7 +159,7 @@ demos_h = custom_target('gtk4 demo header',
objcopy_supports_add_symbol = false
objcopy = find_program('objcopy', required : false)
if objcopy.found()
objcopy_supports_add_symbol = run_command(objcopy, '--help').stdout().contains('--add-symbol')
objcopy_supports_add_symbol = run_command(objcopy, '--help', check: false).stdout().contains('--add-symbol')
endif
ld = find_program('ld', required : false)
@@ -222,7 +225,7 @@ if not meson.is_cross_build() and build_machine.cpu_family() != 'arm' and build_
else
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
'demo.gresource.xml',
source_dir: '.',
source_dir: meson.current_source_dir()
)
endif

View File

@@ -84,7 +84,7 @@ do_overlay (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -94,7 +94,7 @@ do_overlay_decorative (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -28,7 +28,7 @@ do_pagesetup (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -7,6 +7,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum {
COLOR_SET,
N_SIGNALS
@@ -22,6 +24,7 @@ typedef struct
GdkRGBA draw_color;
GtkPadController *pad_controller;
double brush_size;
GtkGesture *gesture;
} DrawingArea;
typedef struct
@@ -51,8 +54,8 @@ static const char *pad_colors[] = {
static GType drawing_area_get_type (void);
G_DEFINE_TYPE (DrawingArea, drawing_area, GTK_TYPE_WIDGET)
static void drawing_area_set_color (DrawingArea *area,
GdkRGBA *color);
static void drawing_area_set_color (DrawingArea *area,
const GdkRGBA *color);
static void
drawing_area_ensure_surface (DrawingArea *area,
@@ -101,13 +104,11 @@ drawing_area_size_allocate (GtkWidget *widget,
static void
drawing_area_map (GtkWidget *widget)
{
GtkAllocation allocation;
GTK_WIDGET_CLASS (drawing_area_parent_class)->map (widget);
gtk_widget_get_allocation (widget, &allocation);
drawing_area_ensure_surface ((DrawingArea *) widget,
allocation.width, allocation.height);
gtk_widget_get_width (widget),
gtk_widget_get_height (widget));
}
static void
@@ -260,7 +261,7 @@ drawing_area_apply_stroke (DrawingArea *area,
double y,
double pressure)
{
if (gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER)
if (tool && gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER)
{
cairo_set_line_width (area->cr, 10 * pressure * area->brush_size);
cairo_set_operator (area->cr, CAIRO_OPERATOR_DEST_OUT);
@@ -311,7 +312,9 @@ stylus_gesture_motion (GtkGestureStylus *gesture,
drawing_area_apply_stroke (area, tool,
backlog[i].axes[GDK_AXIS_X],
backlog[i].axes[GDK_AXIS_Y],
backlog[i].axes[GDK_AXIS_PRESSURE]);
backlog[i].flags & GDK_AXIS_FLAG_PRESSURE
? backlog[i].axes[GDK_AXIS_PRESSURE]
: 1);
}
g_free (backlog);
@@ -341,6 +344,8 @@ drawing_area_init (DrawingArea *area)
area->draw_color = (GdkRGBA) { 0, 0, 0, 1 };
area->brush_size = 1;
area->gesture = gesture;
}
static GtkWidget *
@@ -350,8 +355,8 @@ drawing_area_new (void)
}
static void
drawing_area_set_color (DrawingArea *area,
GdkRGBA *color)
drawing_area_set_color (DrawingArea *area,
const GdkRGBA *color)
{
if (gdk_rgba_equal (&area->draw_color, color))
return;
@@ -361,21 +366,28 @@ drawing_area_set_color (DrawingArea *area,
}
static void
color_button_color_set (GtkColorButton *button,
DrawingArea *draw_area)
color_button_color_set (GtkColorDialogButton *button,
GParamSpec *pspec,
DrawingArea *draw_area)
{
GdkRGBA color;
const GdkRGBA *color;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color);
drawing_area_set_color (draw_area, &color);
color = gtk_color_dialog_button_get_rgba (button);
drawing_area_set_color (draw_area, color);
}
static void
drawing_area_color_set (DrawingArea *area,
GdkRGBA *color,
GtkColorButton *button)
drawing_area_color_set (DrawingArea *area,
GdkRGBA *color,
GtkColorDialogButton *button)
{
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (button), color);
gtk_color_dialog_button_set_rgba (button, color);
}
static GtkGesture *
drawing_area_get_gesture (DrawingArea *area)
{
return area->gesture;
}
GtkWidget *
@@ -385,7 +397,7 @@ do_paint (GtkWidget *toplevel)
if (!window)
{
GtkWidget *draw_area, *headerbar, *colorbutton;
GtkWidget *draw_area, *headerbar, *button;
window = gtk_window_new ();
@@ -394,22 +406,29 @@ do_paint (GtkWidget *toplevel)
headerbar = gtk_header_bar_new ();
colorbutton = gtk_color_button_new ();
g_signal_connect (colorbutton, "color-set",
button = gtk_color_dialog_button_new (gtk_color_dialog_new ());
g_signal_connect (button, "notify::rgba",
G_CALLBACK (color_button_color_set), draw_area);
g_signal_connect (draw_area, "color-set",
G_CALLBACK (drawing_area_color_set), colorbutton);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (colorbutton),
&(GdkRGBA) { 0, 0, 0, 1 });
G_CALLBACK (drawing_area_color_set), button);
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (button),
&(GdkRGBA) { 0, 0, 0, 1 });
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), button);
button = gtk_check_button_new_with_label ("Stylus only");
g_object_bind_property (button, "active",
drawing_area_get_gesture ((DrawingArea *)draw_area), "stylus-only",
G_BINDING_SYNC_CREATE);
gtk_header_bar_pack_start (GTK_HEADER_BAR (headerbar), button);
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), colorbutton);
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
gtk_window_set_title (GTK_WINDOW (window), "Paint");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -175,7 +175,7 @@ do_paintable (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -214,7 +214,7 @@ do_paintable_animated (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -177,7 +177,7 @@ do_paintable_emblem (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -307,7 +307,7 @@ do_paintable_mediastream (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -13,25 +13,24 @@
static void
open_response_cb (GtkNativeDialog *dialog,
int response,
GtkPicture *picture)
open_response_cb (GObject *source,
GAsyncResult *result,
void *data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkPicture *picture = data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file;
GdkPaintable *paintable;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
paintable = svg_paintable_new (file);
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
g_object_unref (paintable);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
@@ -39,20 +38,24 @@ show_file_open (GtkWidget *button,
GtkPicture *picture)
{
GtkFileFilter *filter;
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
GListStore *filters;
dialog = gtk_file_chooser_native_new ("Open node file",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Open node file");
filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), picture);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
filters = g_list_store_new (GTK_TYPE_FILE_FILTER);
g_list_store_append (filters, filter);
g_object_unref (filter);
gtk_file_dialog_set_filters (dialog, G_LIST_MODEL (filters));
g_object_unref (filters);
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_root (button)),
NULL,
open_response_cb, picture);
}
static GtkWidget *window;

View File

@@ -200,7 +200,7 @@ do_paintable_symbolic (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

Some files were not shown because too many files have changed in this diff Show More