Commit Graph

75799 Commits

Author SHA1 Message Date
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