Compare commits

...

46 Commits

Author SHA1 Message Date
Matthias Clasen
b51a3980f3 4.12.1 2023-08-25 09:18:10 -04:00
Anders Jonsson
77adacae8d Update Swedish translation 2023-08-24 15:38:43 +00:00
Matthias Clasen
e6ad258b06 Updates 2023-08-24 10:52:35 -04:00
Piotr Drąg
b9c88bd6c0 Update Polish translation 2023-08-24 16:47:45 +02:00
Matthias Clasen
8f1a2820b7 Revert "PopoverMenu: Make :flags a property for use in UI…"
This reverts commit acd874ec55.

This adds new API, therefore not suitable for 4.12.
2023-08-24 10:39:04 -04:00
Matthias Clasen
beb5ede18a menubutton: Don't assume the root is a window
The only thing this assumption does is cause
criticals, so remove it.

Fixes: #6055
2023-08-24 10:28:05 -04:00
Michael Catanzaro
2e2857df32 notebook: fix critical when switching page
It's expected that gtk_widget_get_root() will return NULL if the widget
tree does not contain a root widget. I don't know what that means or why
it happens, but it's true in gnome-control-center's network panel when
displaying the OpenVPN configuration dialog. We need to handle it.

Fixes #6056
2023-08-24 10:27:44 -04:00
Simon McVittie
8a4bde62da tests: Accept slightly different numeric results
FLT_EPSILON is the distance between 1.0 and the next distinct floating
point number, and doesn't necessarily have anything to do with the
precision we can expect from a series of floating-point calculations.
Experimentally, 1e-6 is achievable, even on platforms with unusual
floating point implementations like i387.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/6051
Bug-Debian: https://bugs.debian.org/1050076
Signed-off-by: Simon McVittie <smcv@debian.org>
2023-08-24 10:27:18 -04:00
Matthias Clasen
ff56029ccc wayland: Don't assume the shell protocol
The gtk_shell proxy will be NULL if the compositor
is not gnome-shell. Handle that without crashing.

Fixes: #6048
2023-08-24 10:27:02 -04:00
Bilal Elmoussaoui
0f67d61379 gi: Fix missing namespace 2023-08-24 10:26:40 -04:00
Georges Basile Stavracas Neto
8605a073ea ci: Limit parallel linking on Windows CI
Linking on Windows can easily run out of memory, and limiting it
to a single link operation (i.e. disabling parallelization) should
be enough to avoid this problem.
2023-08-24 10:26:23 -04:00
Khalid Abu Shawarib
c6302477c0 gdk/x11/clipboard: Fix Slist leak 2023-08-24 10:26:16 -04:00
Benjamin Otte
6cabd44a2b build: Add -Woverride-init
That's a gcc warning (clang has the equivalent -Winitializer-overrides,
but that one is included in -Wall) that complains about things like:

  VkOffset3D offset = { .x = pt.x, .x = pt.y, .y = 0 };

So you don't have to spend a few hours trying to understand what's going
on before realizing your copy/paste skills are substandard.
2023-08-24 10:25:59 -04:00
Benjamin Otte
012388da32 build: GSK doesn't depend on gdk-pixbuf 2023-08-24 10:25:36 -04:00
Benjamin Otte
004f061dca build: Don't use configure_file() when custom_target() works
These two files don't need to be built when configuring, they are only
needed during build.
2023-08-24 10:25:23 -04:00
Benjamin Otte
cf644739e4 widget: Remove unused headers from gtkwidget.h
... and put them back in places where they are needed.
2023-08-24 10:25:15 -04:00
Sergey Bugaev
cb89b3a9e7 paintable: Implement gdk_paintable_default_get_current_image ()
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-08-24 10:24:50 -04:00
G.Willems
c018af3023 gtktexthistory: restore 'modified' flag on redo
When redoing a history entry, its `is_modified` flag is not
reflected to the history state tracker. So GtkTextBuffers may
expose a modified=FALSE status, despite a change was actually
applied to the buffer.

For the undo case, an `is_modified_set` flag was set on the last
entry of the undo queue when a change of the modified state of
the history is requested. This commit does the same on the first
entry of the redo queue.

Closes #5777
2023-08-24 10:24:41 -04:00
Daniel Boles
acd874ec55 PopoverMenu: Make :flags a property for use in UI…
…files, or other cases other than calling new_from_model_full(), which
generally makes it far easier to experiment with the effect of flags,
including by changing the value of the property in the Inspector.

fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6030#note_1818229
2023-08-24 10:24:28 -04:00
Daniel Boles
70733d60f6 Popover: Fix & add to CSS nodes documentation
* The `.background` class gets put on `popover`, not `content`
* Use backticks to style node and class names with monospace
* Link to GtkPopoverMenu
* Add to PopoverMenu a bit outlining how items and sections look in CSS.
2023-08-24 10:24:06 -04:00
Matthias Clasen
e3d18ad7a1 build: Drop some unused variables
We are not using gtk_private_packages at all,
so drop it.
2023-08-24 10:23:54 -04:00
Alexandros Theodotou
3a55f750bc gsk: Update docs for gtk_snapshot_append_layout
Mention how to get the current theme's foreground color.
2023-08-24 10:23:31 -04:00
Sergey Bugaev
e069a8053f rendernode, snapshot: Slightly expand color matrix docs
Based on reverse engineering the color node and contrary to my
expectations, the matrix/offset is expressed in, and applied to,
unpremultiplied colors. The colors are being explicitly
unpremultiplied, transformed according to the matrix/offset, and
premultiplied back (see color_matrix.glsl). The matrix is getting
transposed.

Also, copy the same blurb to the corresponding GtkSnapshot function.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-08-24 10:23:23 -04:00
Sergey Bugaev
582d368653 snapshot: Fix merging color matrix nodes
The code was appliying the matrices in the wrong order: we have to apply
the inner node's matrix first, and the outer one second. Due to the
matrices being implicitly transposed, the matrix multiplication was done
in the right order, yet the wrong matrix was being mutliplied by the
wrong offset vector.

To make the code a little easier to follow, create explicit variables
for the resulting matrix and offset (instead of reusing matrix2 and
offset2), and fix & expand the comment to document how matrix
transposition factors into this.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-08-24 10:23:13 -04:00
Philip Chimento
294bc262cd introspection: Remove 'caller-allocates' from POD types
The (out caller-allocates) and (out callee-allocates) annotations are
meant for structured or pointer types. Plain old data types are just
regular out parameters and don't need the annotation about who allocates
them.

See glib!2005, gjs#570
2023-08-24 10:22:56 -04:00
Xavier Claessens
494b25388a meson: Add x11_dep to gtk4-x11 requires 2023-08-24 10:22:33 -04:00
Xavier Claessens
f87426f7eb meson: Add wayland-client to gtk4-wayland requires 2023-08-24 10:22:21 -04:00
Daniel Boles
1be06ea339 SignalListItemFactory: small doc grammar+sense fix
* "to to" => "to"
* "a object" => "an object"
* "its new prop is about to be unset" => "its prop is about to be unset"
2023-08-24 10:22:07 -04:00
Alice Mikhaylenko
05f39307b2 menubutton: Fix focus on the internal gizmo
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6025
2023-08-24 10:21:21 -04:00
Daniel Boles
0a50e1e663 Inspector: Fix ! flash on select widget @ obj tree
Widgets are flashed by the window when it receives Tree::object-selected
- but we were emitting said signal from select_object(), i.e. if we were
made to select by an external caller. We should also emit it if the user
interactively selects an item, so the window receives+flashes the widget

fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6022
2023-08-24 10:21:11 -04:00
Joshua Lee
0270c9e5a9 fontdialogbutton: Make activatable 2023-08-24 10:20:59 -04:00
Joshua Lee
c2c92b8335 colordialogbutton: Make activatable 2023-08-24 10:20:53 -04:00
Matthias Clasen
6acb8c4e9c text: Track user changes better
Make all the action signal handlers call
begin/end_change(), so we can rely on
change_count being >0 to check later if
an action is user-initiated or programmatic.

Fixes: #6018
2023-08-24 10:20:39 -04:00
Benjamin Otte
84204a0215 gl: Pass swizzle array directly
There's no need to pass pointers to arrays, as arrays are already
pointers.
2023-08-24 10:20:03 -04:00
Benjamin Otte
db545439c0 columnview: Fix refcounting woes
The new code did not deal with the GtkScrollInfo properly.

Related: #6002
2023-08-24 10:19:49 -04:00
Benjamin Otte
5f02d8fac5 gdkcontext: Make has_unpack_subimage() do the version check
Makes the code look simpler when we actually use that function.
2023-08-24 10:19:41 -04:00
Benjamin Otte
7dba2a021e treeviewcolumn: Set ascending class for ascending order
The alternative button order confused the code and so the "ascending"
class was set for descending order by default, not when alternate order
is set.
2023-08-24 10:19:23 -04:00
Qiu Wenbo
1394a82507 macos: use NSPopUpButton for filter selection in native filechooser
On macOS 14, NSComboBox can't popup the dropdown list of filters. That
makes native filechooser on macOS completed broken. And NSComboBox is
more complex since it is a widget focused on edit capability.
NSPopUpButton is more suitable for plain selectable dropdown list.

Fixes: 4986

Signed-off-by: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
2023-08-24 10:19:04 -04:00
Qiu Wenbo
0997d39a06 filefilter: fix UTI type conversion on macOS
GContentType on macOS switched to UTI since glib 2.51. We should not assume it as MIME type anymore.

Fixes: #4986

Signed-off-by: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
2023-08-24 10:18:55 -04:00
Daniel Boles
efb3477dc9 docs: Add/fix some links; avoid pluralisation
Appending `s` breaks the [type@NS.Object] notation, so fix that in
ListHeader. Add links to ListItem and Overlay, and avoid appending `s`
after `backtick`s just for consistency with the [type@NS.Object] issue.
2023-08-24 10:18:28 -04:00
Jeremy Bícha
23f055f7b0 print: Update printerprivate header location for cpdb backend
This fixes the print-cpdb build option
2023-08-24 10:18:10 -04:00
Jeremy Bícha
4d99dbc48d test-calendar: Update timezone name
Debian no longer provides the MET timezone
but instead provides geographical region and city name
2023-08-24 10:18:00 -04:00
Xi Ruoyao
6b8e098f34 print: Revert "Start sorting apart includes" change for gtkprinteroptionprivate.h
The print backends needs the functions in gtkprinteroptionprivate.h to
be exported.

Fixes #6003.
2023-08-24 10:17:32 -04:00
tszymanski
5844ed5b12 gtkgridview: return empty area for empty tiles during scroll 2023-08-24 10:16:48 -04:00
Hari Rana
44ef8db93a section-accessibility: Close tag 2023-08-24 10:16:32 -04:00
Matthias Clasen
9e4f2b16e0 Post-release version bump 2023-08-24 10:14:29 -04:00
51 changed files with 2870 additions and 1816 deletions

View File

@@ -6,7 +6,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
:: FIXME: make warnings fatal
pip3 install --upgrade --user meson~=0.64 || goto :error
meson -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
meson setup -Dbackend_max_links=1 -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
ninja -C _build || goto :error
goto :EOF

42
NEWS
View File

@@ -1,3 +1,45 @@
Overview of Changes in 4.12.1, 25-08-2023
=========================================
* GtkGridView:
- Fix a crash when scrolling
* GtkColumnView:
- Fix a refcounting issue in the new scroll_to api
* GtkTreeView
- Fix style classes for sort arrows
* GtkEntry:
- Improve tracking of user changes (for undo)
* GtkNotebook:
- Fix a critical when switching pages
* GtkColor/FontDialogButton:
- Make these widgets activatable
* GtkMenuButton:
- Fix problems with focus handling
- Fix problems with DND
* Printing
- Fix the cpdb backend build
* MacOS:
- Make file filters work again
* GSK:
- Fix issues with color matrix nodes
* Wayland:
- Fix a crash with compositors other than gnome-shell
* Translation updates:
Polish
Swedish
Overview of Changes in 4.12.0, 05-08-2023
=========================================

View File

@@ -222,7 +222,7 @@ It is possible to set accessible attributes in UI files as well:
<accessibility>
<property name="label">Download</property>
<relation name="labelled-by">label1</relation>
/accessibility>
</accessibility>
</object>
```

View File

@@ -1528,7 +1528,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
if (gdk_gl_context_get_use_es (context))
{
priv->has_unpack_subimage = epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
priv->has_unpack_subimage = gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)) ||
epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug");
}
else

View File

@@ -153,7 +153,7 @@ gdk_gl_texture_find_format (gboolean use_es,
if (gdk_memory_format_alpha (format) != alpha)
continue;
if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type, &q_swizzle))
if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type, q_swizzle))
continue;
if (q_format != gl_format || q_type != gl_type)
@@ -188,7 +188,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
FALSE,
major, minor,
&gl_internal_format,
&gl_format, &gl_type, &gl_swizzle))
&gl_format, &gl_type, gl_swizzle))
{
if (download->stride == expected_stride &&
download->format == format)

View File

@@ -739,12 +739,12 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
guint *out_internal_format,
guint *out_format,
guint *out_type,
GLint (*out_swizzle)[4])
GLint out_swizzle[4])
{
*out_internal_format = memory_formats[format].gl.internal_format;
*out_format = memory_formats[format].gl.format;
*out_type = memory_formats[format].gl.type;
memcpy (out_swizzle, &memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
memcpy (out_swizzle, memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
if (gles)
{

View File

@@ -52,7 +52,7 @@ gboolean gdk_memory_format_gl_format (GdkMemoryFormat
guint *out_internal_format,
guint *out_format,
guint *out_type,
GLint (*out_gizzle)[4]);
GLint out_gizzle[4]);
void gdk_memory_convert (guchar *dest_data,
gsize dest_stride,

View File

@@ -25,10 +25,12 @@
#include "gdkprivate.h"
/* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
GdkSnapshot * gtk_snapshot_new (void);
void gtk_snapshot_push_debug (GdkSnapshot *snapshot,
const char *message,
...) G_GNUC_PRINTF (2, 3);
void gtk_snapshot_pop (GdkSnapshot *snapshot);
GdkPaintable * gtk_snapshot_free_to_paintable (GdkSnapshot *snapshot);
/**
* GdkPaintable:
@@ -102,9 +104,21 @@ gdk_paintable_default_snapshot (GdkPaintable *paintable,
static GdkPaintable *
gdk_paintable_default_get_current_image (GdkPaintable *paintable)
{
g_warning ("FIXME: implement by snapshotting at default size and returning a GskRendererNodePaintable");
int width, height;
GdkSnapshot *snapshot;
return paintable;
/* No need to check whether the paintable is static, as
* gdk_paintable_get_current_image () takes care of that already. */
width = gdk_paintable_get_intrinsic_width (paintable);
height = gdk_paintable_get_intrinsic_height (paintable);
if (width <= 0 || height <= 0)
return gdk_paintable_new_empty (width, height);
snapshot = gtk_snapshot_new ();
gdk_paintable_snapshot (paintable, snapshot, width, height);
return gtk_snapshot_free_to_paintable (snapshot);
}
static GdkPaintableFlags

View File

@@ -93,7 +93,8 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
id = app_launch_data.token;
wl_event_queue_destroy (event_queue);
}
else if (gtk_shell1_get_version (display->gtk_shell) >= GTK_SHELL1_NOTIFY_LAUNCH_SINCE_VERSION)
else if (display->gtk_shell &&
gtk_shell1_get_version (display->gtk_shell) >= GTK_SHELL1_NOTIFY_LAUNCH_SINCE_VERSION)
{
id = g_uuid_string_random ();
gtk_shell1_notify_launch (display->gtk_shell, id);

View File

@@ -127,3 +127,6 @@ libgdk_wayland = static_library('gdk-wayland',
link_with: [ libwayland_cursor, ],
dependencies: [ gdk_deps, gdk_wayland_deps ],
)
# Used to generate pkg-config Requires
wayland_public_deps = [wlclientdep]

View File

@@ -201,7 +201,7 @@ gdk_x11_clipboard_formats_to_targets (GdkContentFormats *formats)
continue;
if (g_str_equal (mime_types[i], special_targets[j].mime_type))
targets = g_slist_prepend (targets, (gpointer) g_intern_string (special_targets[j].x_target));
targets = g_slist_prepend (targets, (gpointer) g_intern_static_string (special_targets[j].x_target));
}
targets = g_slist_prepend (targets, (gpointer) mime_types[i]);
}
@@ -238,6 +238,8 @@ gdk_x11_clipboard_formats_to_atoms (GdkDisplay *display,
for (l = targets; l; l = l->next)
atoms[i++] = gdk_x11_get_xatom_by_name_for_display (display, l->data);
g_slist_free (targets);
return atoms;
}

View File

@@ -86,3 +86,5 @@ libgdk_x11 = static_library('gdk-x11',
] + common_cflags,
dependencies: [ gdk_deps, gdk_x11_deps, ],
)
x11_public_deps = [x11_dep]

View File

@@ -1456,7 +1456,7 @@ memory_format_gl_format (GdkMemoryFormat data_format,
guint *gl_internalformat,
guint *gl_format,
guint *gl_type,
GLint (*gl_swizzle)[4])
GLint gl_swizzle[4])
{
GdkMemoryDepth depth;
@@ -1577,7 +1577,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
&gl_internalformat,
&gl_format,
&gl_type,
&gl_swizzle);
gl_swizzle);
gdk_texture_downloader_init (&downloader, texture);
gdk_texture_downloader_set_format (&downloader, data_format);
@@ -1595,8 +1595,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
{
glTexSubImage2D (GL_TEXTURE_2D, 0, x, y, width, height, gl_format, gl_type, data);
}
else if (stride % bpp == 0 &&
(gdk_gl_context_check_version (self->context, NULL, "3.0") || gdk_gl_context_has_unpack_subimage (self->context)))
else if (stride % bpp == 0 && gdk_gl_context_has_unpack_subimage (self->context))
{
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / bpp);
@@ -1684,7 +1683,7 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self,
&gl_internalformat,
&gl_format,
&gl_type,
&gl_swizzle);
gl_swizzle);
glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, width, height, 0, gl_format, gl_type, NULL);

View File

@@ -3838,11 +3838,12 @@ gsk_color_matrix_node_class_init (gpointer g_class,
* Creates a `GskRenderNode` that will drawn the @child with
* @color_matrix.
*
* In particular, the node will transform the operation
* In particular, the node will transform colors by applying
*
* pixel = color_matrix * pixel + color_offset
* pixel = transpose(color_matrix) * pixel + color_offset
*
* for every pixel.
* for every pixel. The transformation operates on unpremultiplied
* colors, with color components ordered R, G, B, A.
*
* Returns: (transfer full) (type GskColorMatrixNode): A new `GskRenderNode`
*/

View File

@@ -97,10 +97,6 @@ if have_vulkan
endif
gsk_private_vulkan_shaders = []
# This is an odd split because we use configure_file() below to workaround
# a limitation in meson preventing using custom_target() with gnome.compile_resources()
# and that requires file paths, but we also need to have dependencies during development
# on constantly regenerated files.
gsk_private_vulkan_compiled_shaders = []
gsk_private_vulkan_compiled_shaders_deps = []
gsk_private_vulkan_shader_headers = []
@@ -148,7 +144,7 @@ if get_variable('broadway_enabled')
])
endif
gsk_resources_xml = configure_file(output: 'gsk.resources.xml',
gsk_resources_xml = custom_target(output: 'gsk.resources.xml',
input: 'gen-gsk-gresources-xml.py',
command: [
find_program('gen-gsk-gresources-xml.py'),
@@ -184,7 +180,6 @@ gsk_deps = [
pango_dep,
cairo_dep,
cairo_csi_dep,
pixbuf_dep,
libgdk_dep,
]

View File

@@ -93,12 +93,12 @@ foreach shader: gsk_private_vulkan_shaders
endforeach
foreach shader: gsk_private_vulkan_vertex_shaders
shader_header = configure_file(output: '@0@.h'.format(shader),
input: shader,
command: [
find_program('generate-header.py'),
'@INPUT@',
],
capture: true)
shader_header = custom_target(output: '@0@.h'.format(shader),
input: shader,
command: [
find_program('generate-header.py'),
'@INPUT@',
],
capture: true)
gsk_private_vulkan_shader_headers += shader_header
endforeach

View File

@@ -937,13 +937,13 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
if ((!alternative && priv->sort_order == GTK_SORT_ASCENDING) ||
(alternative && priv->sort_order == GTK_SORT_DESCENDING))
{
gtk_widget_remove_css_class (arrow, "descending");
gtk_widget_add_css_class (arrow, "ascending");
gtk_widget_remove_css_class (arrow, "ascending");
gtk_widget_add_css_class (arrow, "descending");
}
else
{
gtk_widget_remove_css_class (arrow, "ascending");
gtk_widget_add_css_class (arrow, "descending");
gtk_widget_remove_css_class (arrow, "descending");
gtk_widget_add_css_class (arrow, "ascending");
}
}

View File

@@ -459,7 +459,8 @@ gsk_pango_renderer_release (GskPangoRenderer *renderer)
*
* Creates render nodes for rendering @layout in the given foregound @color
* and appends them to the current node of @snapshot without changing the
* current node.
* current node. The current theme's foreground color for a widget can be
* obtained with [method@Gtk.Widget.get_color].
*
* Note that if the layout does not produce any visible output, then nodes
* may not be added to the @snapshot.

View File

@@ -45,6 +45,7 @@ static GdkContentProvider *
double x,
double y,
GtkColorDialogButton *self);
static void activated (GtkColorDialogButton *self);
static void button_clicked (GtkColorDialogButton *self);
static void update_button_sensitivity
(GtkColorDialogButton *self);
@@ -96,8 +97,17 @@ enum
NUM_PROPERTIES
};
/* Signals */
enum
{
SIGNAL_ACTIVATE = 1,
NUM_SIGNALS
};
static GParamSpec *properties[NUM_PROPERTIES];
static unsigned int color_dialog_button_signals[NUM_SIGNALS] = { 0 };
G_DEFINE_TYPE (GtkColorDialogButton, gtk_color_dialog_button, GTK_TYPE_WIDGET)
static void
@@ -108,6 +118,8 @@ gtk_color_dialog_button_init (GtkColorDialogButton *self)
GtkDragSource *source;
GtkDropTarget *dest;
g_signal_connect_swapped (self, "activate", G_CALLBACK (activated), self);
self->color = GDK_RGBA ("00000000");
self->button = gtk_button_new ();
@@ -278,6 +290,27 @@ gtk_color_dialog_button_class_init (GtkColorDialogButtonClass *class)
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
/**
* GtkColorDialogButton::activate:
* @widget: the object which received the signal
*
* Emitted when the color dialog button is activated.
*
* The `::activate` signal on `GtkColorDialogButton` is an action signal
* and emitting it causes the button to pop up its dialog.
*
* Since: 4.14
*/
color_dialog_button_signals[SIGNAL_ACTIVATE] =
g_signal_new (I_ ("activate"),
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
0,
NULL, NULL,
NULL,
G_TYPE_NONE, 0);
gtk_widget_class_set_activate_signal (widget_class, color_dialog_button_signals[SIGNAL_ACTIVATE]);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_set_css_name (widget_class, "colorbutton");
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_GROUP);
@@ -366,6 +399,12 @@ color_chosen (GObject *source,
update_button_sensitivity (self);
}
static void
activated (GtkColorDialogButton *self)
{
gtk_widget_activate (self->button);
}
static void
button_clicked (GtkColorDialogButton *self)
{

View File

@@ -1798,6 +1798,8 @@ gtk_column_view_scroll_to_column (GtkColumnView *self,
gtk_adjustment_get_page_size (self->hadjustment));
gtk_adjustment_set_value (self->hadjustment, new_value);
g_clear_pointer (&scroll_info, gtk_scroll_info_unref);
}
void
@@ -2214,9 +2216,14 @@ gtk_column_view_scroll_to (GtkColumnView *self,
if (column && (flags & GTK_LIST_SCROLL_FOCUS))
gtk_column_view_set_focus_column (self, column, FALSE);
gtk_list_view_scroll_to (self->listview, pos, flags, scroll);
gtk_list_view_scroll_to (self->listview,
pos,
flags,
scroll ? gtk_scroll_info_ref (scroll) : NULL);
if (column)
gtk_column_view_scroll_to_column (self, column, scroll);
else
g_clear_pointer (&scroll, gtk_scroll_info_unref);
}

View File

@@ -43,6 +43,8 @@
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
@class FilterComboBox;
typedef struct {
GtkFileChooserNative *self;
@@ -68,31 +70,33 @@ typedef struct {
NSMutableArray *filters;
NSMutableArray *filter_names;
NSComboBox *filter_combo_box;
FilterComboBox *filter_popup_button;
GSList *files;
int response;
} FileChooserQuartzData;
@interface FilterComboBox : NSObject<NSComboBoxDelegate>
@interface FilterComboBox : NSPopUpButton
{
FileChooserQuartzData *data;
}
- (id) initWithData:(FileChooserQuartzData *) quartz_data;
- (void)comboBoxSelectionDidChange:(NSNotification *)notification;
- (void) popUpButtonSelectionChanged:(id) sender;
@end
@implementation FilterComboBox
- (id) initWithData:(FileChooserQuartzData *) quartz_data
{
[super init];
[super initWithFrame:NSMakeRect(0, 0, 200, 24)];
[self setTarget:self];
[self setAction:@selector(popUpButtonSelectionChanged:)];
data = quartz_data;
return self;
}
- (void)comboBoxSelectionDidChange:(NSNotification *)notification
- (void)popUpButtonSelectionChanged:(id)sender
{
NSInteger selected_index = [data->filter_combo_box indexOfSelectedItem];
NSInteger selected_index = [data->filter_popup_button indexOfSelectedItem];
NSArray *filter = [data->filters objectAtIndex:selected_index];
// check for empty strings in filter -> indicates all filetypes should be allowed!
if ([filter containsObject:@""])
@@ -302,10 +306,8 @@ filechooser_quartz_launch (FileChooserQuartzData *data)
if (data->filters)
{
// when filters have been provided, a combobox needs to be added
data->filter_combo_box = [[NSComboBox alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)];
[data->filter_combo_box addItemsWithObjectValues:data->filter_names];
[data->filter_combo_box setEditable:NO];
[data->filter_combo_box setDelegate:[[FilterComboBox alloc] initWithData:data]];
data->filter_popup_button = [[FilterComboBox alloc] initWithData:data];
[data->filter_popup_button addItemsWithTitles:data->filter_names];
if (data->self->current_filter)
{
@@ -329,16 +331,18 @@ filechooser_quartz_launch (FileChooserQuartzData *data)
g_object_unref (filters);
if (current_filter_index != GTK_INVALID_LIST_POSITION)
[data->filter_combo_box selectItemAtIndex:current_filter_index];
[data->filter_popup_button selectItemAtIndex:current_filter_index];
else
[data->filter_combo_box selectItemAtIndex:0];
[data->filter_popup_button selectItemAtIndex:0];
}
else
{
[data->filter_combo_box selectItemAtIndex:0];
[data->filter_popup_button selectItemAtIndex:0];
}
[data->filter_combo_box setToolTip:[NSString stringWithUTF8String:_("Select which types of files are shown")]];
[data->panel setAccessoryView:data->filter_combo_box];
[data->filter_popup_button popUpButtonSelectionChanged:NULL];
[data->filter_popup_button setToolTip:[NSString stringWithUTF8String:_("Select which types of files are shown")]];
[data->panel setAccessoryView:data->filter_popup_button];
if ([data->panel isKindOfClass:[NSOpenPanel class]] && [data->panel respondsToSelector:@selector(setAccessoryViewDisclosed:)])
{
[(id<CanSetAccessoryViewDisclosed>) data->panel setAccessoryViewDisclosed:YES];
@@ -578,4 +582,3 @@ gtk_file_chooser_native_quartz_hide (GtkFileChooserNative *self)
}
data->panel = NULL;
}

View File

@@ -758,8 +758,6 @@ gtk_file_filter_get_attributes (GtkFileFilter *filter)
#ifdef GDK_WINDOWING_MACOS
#import <Foundation/Foundation.h>
NSArray * _gtk_file_filter_get_as_pattern_nsstrings (GtkFileFilter *filter)
{
NSMutableArray *array = [[NSMutableArray alloc] init];
@@ -773,9 +771,8 @@ NSArray * _gtk_file_filter_get_as_pattern_nsstrings (GtkFileFilter *filter)
{
case FILTER_RULE_MIME_TYPE:
{
// convert mime-types to UTI
NSString *mime_type_nsstring = [NSString stringWithUTF8String: rule->u.content_types[0]];
NSString *uti_nsstring = (NSString *) UTTypeCreatePreferredIdentifierForTag (kUTTagClassMIMEType, (CFStringRef) mime_type_nsstring, NULL);
// GContentType from GIO use UTI on macOS since glib version 2.51
NSString *uti_nsstring = [NSString stringWithUTF8String: rule->u.content_types[0]];
if (uti_nsstring == NULL)
{
[array release];

View File

@@ -32,7 +32,7 @@
#include "gtkwidgetprivate.h"
#include "gtktypebuiltins.h"
static void activated (GtkFontDialogButton *self);
static void button_clicked (GtkFontDialogButton *self);
static void update_button_sensitivity
(GtkFontDialogButton *self);
@@ -100,8 +100,17 @@ enum
NUM_PROPERTIES
};
/* Signals */
enum
{
SIGNAL_ACTIVATE = 1,
NUM_SIGNALS
};
static GParamSpec *properties[NUM_PROPERTIES];
static unsigned int font_dialog_button_signals[NUM_SIGNALS] = { 0 };
G_DEFINE_TYPE (GtkFontDialogButton, gtk_font_dialog_button, GTK_TYPE_WIDGET)
static void
@@ -110,6 +119,8 @@ gtk_font_dialog_button_init (GtkFontDialogButton *self)
GtkWidget *box;
PangoFontDescription *font_desc;
g_signal_connect_swapped (self, "activate", G_CALLBACK (activated), self);
self->button = gtk_button_new ();
g_signal_connect_swapped (self->button, "clicked", G_CALLBACK (button_clicked), self);
self->font_label = gtk_label_new (_("Font"));
@@ -383,6 +394,27 @@ gtk_font_dialog_button_class_init (GtkFontDialogButtonClass *class)
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
/**
* GtkFontDialogButton::activate:
* @widget: The object which received the signal
*
* Emitted when the font dialog button is activated.
*
* The `::activate` signal on `GtkFontDialogButton` is an action signal
* and emitting it causes the button to pop up its dialog.
*
* Since: 4.14
*/
font_dialog_button_signals[SIGNAL_ACTIVATE] =
g_signal_new (I_ ("activate"),
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
0,
NULL, NULL,
NULL,
G_TYPE_NONE, 0);
gtk_widget_class_set_activate_signal (widget_class, font_dialog_button_signals[SIGNAL_ACTIVATE]);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_set_css_name (widget_class, "fontbutton");
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_GROUP);
@@ -499,6 +531,12 @@ font_and_features_chosen (GObject *source,
update_button_sensitivity (self);
}
static void
activated (GtkFontDialogButton *self)
{
gtk_widget_activate (self->button);
}
static void
button_clicked (GtkFontDialogButton *self)
{

View File

@@ -411,7 +411,7 @@ gtk_grid_view_get_position_from_allocation (GtkListBase *base,
}
pos = gtk_list_tile_get_position (self->item_manager, tile);
if (tile->n_items > 1)
if (tile->n_items > 1 && tile->area.width > 0 && tile->area.height > 0)
{
int xspacing, yspacing;

View File

@@ -121,7 +121,7 @@ static GParamSpec *properties[N_PROPS] = { NULL, };
* @self: a `GtkListBase`
* @across: position in pixels in the direction cross to the list
* @along: position in pixels in the direction of the list
* @pos: (out caller-allocates): set to the looked up position
* @pos: (out): set to the looked up position
* @area: (out caller-allocates) (optional): set to the area occupied
* by the returned position
*
@@ -1519,7 +1519,7 @@ gtk_list_base_allocate_children (GtkListBase *self,
GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self);
GtkListTile *tile;
int dx, dy;
gtk_list_base_get_adjustment_values (self, OPPOSITE_ORIENTATION (priv->orientation), &dx, NULL, NULL);
gtk_list_base_get_adjustment_values (self, priv->orientation, &dy, NULL, NULL);

View File

@@ -27,9 +27,9 @@
* `GtkListHeader` is used by list widgets to represent the headers they
* display.
*
* The `GtkListHeader`s are managed just like [class@gtk.ListItem]s via
* their factory, but provide a different set of properties suitable for
* managing the header instead of individual items.
* `GtkListHeader` objects are managed just like [class@Gtk.ListItem]
* objects via their factory, but provide a different set of properties suitable
* for managing the header instead of individual items.
*
* Since: 4.12
*/

View File

@@ -27,13 +27,14 @@
/**
* GtkListItem:
*
* `GtkListItem` is used by list widgets to represent items in a `GListModel`.
* `GtkListItem` is used by list widgets to represent items in a
* [iface@Gio.ListModel].
*
* The `GtkListItem`s are managed by the list widget (with its factory)
* `GtkListItem` objects are managed by the list widget (with its factory)
* and cannot be created by applications, but they need to be populated
* by application code. This is done by calling [method@Gtk.ListItem.set_child].
*
* `GtkListItem`s exist in 2 stages:
* `GtkListItem` objects exist in 2 stages:
*
* 1. The unbound stage where the listitem is not currently connected to
* an item in the list. In that case, the [property@Gtk.ListItem:item]

View File

@@ -1353,35 +1353,35 @@ gtk_menu_button_get_use_underline (GtkMenuButton *menu_button)
}
static GList *
get_menu_bars (GtkWindow *window)
get_menu_bars (GtkWidget *toplevel)
{
return g_object_get_data (G_OBJECT (window), "gtk-menu-bar-list");
return g_object_get_data (G_OBJECT (toplevel), "gtk-menu-bar-list");
}
static void
set_menu_bars (GtkWindow *window,
set_menu_bars (GtkWidget *toplevel,
GList *menubars)
{
g_object_set_data (G_OBJECT (window), I_("gtk-menu-bar-list"), menubars);
g_object_set_data (G_OBJECT (toplevel), I_("gtk-menu-bar-list"), menubars);
}
static void
add_to_window (GtkWindow *window,
GtkMenuButton *button)
add_to_toplevel (GtkWidget *toplevel,
GtkMenuButton *button)
{
GList *menubars = get_menu_bars (window);
GList *menubars = get_menu_bars (toplevel);
set_menu_bars (window, g_list_prepend (menubars, button));
set_menu_bars (toplevel, g_list_prepend (menubars, button));
}
static void
remove_from_window (GtkWindow *window,
GtkMenuButton *button)
remove_from_toplevel (GtkWidget *toplevel,
GtkMenuButton *button)
{
GList *menubars = get_menu_bars (window);
GList *menubars = get_menu_bars (toplevel);
menubars = g_list_remove (menubars, button);
set_menu_bars (window, menubars);
set_menu_bars (toplevel, menubars);
}
static void
@@ -1394,7 +1394,7 @@ gtk_menu_button_root (GtkWidget *widget)
if (button->primary)
{
GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
add_to_window (GTK_WINDOW (toplevel), button);
add_to_toplevel (toplevel, button);
}
}
@@ -1404,7 +1404,7 @@ gtk_menu_button_unroot (GtkWidget *widget)
GtkWidget *toplevel;
toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
remove_from_window (GTK_WINDOW (toplevel), GTK_MENU_BUTTON (widget));
remove_from_toplevel (toplevel, GTK_MENU_BUTTON (widget));
GTK_WIDGET_CLASS (gtk_menu_button_parent_class)->unroot (widget);
}
@@ -1437,9 +1437,9 @@ gtk_menu_button_set_primary (GtkMenuButton *menu_button,
if (toplevel)
{
if (menu_button->primary)
add_to_window (GTK_WINDOW (toplevel), menu_button);
add_to_toplevel (GTK_WIDGET (toplevel), menu_button);
else
remove_from_window (GTK_WINDOW (toplevel), menu_button);
remove_from_toplevel (GTK_WIDGET (toplevel), menu_button);
}
g_object_notify_by_pspec (G_OBJECT (menu_button), menu_button_props[PROP_PRIMARY]);
@@ -1510,8 +1510,8 @@ gtk_menu_button_set_child (GtkMenuButton *menu_button,
NULL,
NULL,
NULL,
(GtkGizmoFocusFunc)gtk_widget_focus_self,
(GtkGizmoGrabFocusFunc)gtk_widget_grab_focus_self);
(GtkGizmoFocusFunc)gtk_widget_focus_child,
NULL);
gtk_widget_set_layout_manager (inner_widget, gtk_bin_layout_new ());
gtk_widget_set_hexpand (inner_widget, TRUE);

View File

@@ -5409,7 +5409,9 @@ gtk_notebook_real_switch_page (GtkNotebook *notebook,
if (notebook->cur_page)
{
GtkRoot *root = gtk_widget_get_root (GTK_WIDGET (notebook));
GtkWidget *focus = gtk_root_get_focus (root);
GtkWidget *focus = NULL;
if (root)
focus = gtk_root_get_focus (root);
if (focus)
child_has_focus = gtk_widget_is_ancestor (focus, notebook->cur_page->child);
gtk_widget_unset_state_flags (notebook->cur_page->tab_widget, GTK_STATE_FLAG_CHECKED);

View File

@@ -33,12 +33,12 @@
/**
* GtkOverlayLayout:
*
* `GtkOverlayLayout` is the layout manager used by `GtkOverlay`.
* `GtkOverlayLayout` is the layout manager used by [class@Gtk.Overlay].
*
* It places widgets as overlays on top of the main child.
*
* This is not a reusable layout manager, since it expects its widget
* to be a `GtkOverlay`. It only listed here so that its layout
* to be a `GtkOverlay`. It is only listed here so that its layout
* properties get documented.
*/

View File

@@ -70,30 +70,31 @@
* # CSS nodes
*
* ```
* popover[.menu]
* popover.background[.menu]
* ├── arrow
* ╰── contents.background
* ╰── contents
* ╰── <child>
* ```
*
* The contents child node always gets the .background style class
* and the popover itself gets the .menu style class if the popover
* is menu-like (i.e. `GtkPopoverMenu`).
* `GtkPopover` has a main node with name `popover`, an arrow with name `arrow`,
* and another node for the content named `contents`. The `popover` node always
* gets the `.background` style class. It also gets the `.menu` style class
* if the popover is menu-like, e.g. is a [class@Gtk.PopoverMenu].
*
* Particular uses of `GtkPopover`, such as touch selection popups or
* magnifiers in `GtkEntry` or `GtkTextView` get style classes like
* .touch-selection or .magnifier to differentiate from plain popovers.
* `.touch-selection` or `.magnifier` to differentiate from plain popovers.
*
* When styling a popover directly, the popover node should usually
* When styling a popover directly, the `popover` node should usually
* not have any background. The visible part of the popover can have
* a shadow. To specify it in CSS, set the box-shadow of the contents node.
* a shadow. To specify it in CSS, set the box-shadow of the `contents` node.
*
* Note that, in order to accomplish appropriate arrow visuals, `GtkPopover`
* uses custom drawing for the arrow node. This makes it possible for the
* uses custom drawing for the `arrow` node. This makes it possible for the
* arrow to change its shape dynamically, but it also limits the possibilities
* of styling it using CSS. In particular, the arrow gets drawn over the
* content node's border and shadow, so they look like one shape, which
* means that the border width of the content node and the arrow node should
* of styling it using CSS. In particular, the `arrow` gets drawn over the
* `content` node's border and shadow, so they look like one shape, which
* means that the border width of the `content` node and the `arrow` node should
* be the same. The arrow also does not support any border shape other than
* solid, no border-radius, only one border width (border-bottom-width is
* used) and no box-shadow.

View File

@@ -135,7 +135,14 @@
*
* `GtkPopoverMenu` is just a subclass of `GtkPopover` that adds custom content
* to it, therefore it has the same CSS nodes. It is one of the cases that add
* a .menu style class to the popover's main node.
* a `.menu` style class to the main `popover` node.
*
* Menu items have nodes with name `button` and class `.model`. If a section
* display-hint is set, the section gets a node `box` with class `horizontal`
* plus a class with the same text as the display hint. Note that said box may
* not be the direct ancestor of the item `button`s. Thus, for example, to style
* items in an `inline-buttons` section, select `.inline-buttons button.model`.
* Other things that may be of interest to style in menus include `label` nodes.
*
* # Accessibility
*

View File

@@ -29,6 +29,7 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkborder.h>
#include <gtk/gtkwidget.h>

View File

@@ -113,10 +113,9 @@ gtk_section_model_default_init (GtkSectionModelInterface *iface)
* gtk_section_model_get_section:
* @self: a `GtkSectionModel`
* @position: the position of the item to query
* @out_start: (out caller-allocates): the position of the first
* item in the section
* @out_end: (out caller-allocates): the position of the first
* item not part of the section anymore.
* @out_start: (out): the position of the first item in the section
* @out_end: (out): the position of the first item not part of the section
* anymore.
*
* Query the section that covers the given position. The number of
* items in the section can be computed by `out_end - out_start`.

View File

@@ -29,7 +29,7 @@
* GtkSignalListItemFactory:
*
* `GtkSignalListItemFactory` is a `GtkListItemFactory` that emits signals
* to to manage listitems.
* to manage listitems.
*
* Signals are emitted for every listitem in the same order:
*
@@ -216,9 +216,9 @@ gtk_signal_list_item_factory_class_init (GtkSignalListItemFactoryClass *klass)
* @self: The `GtkSignalListItemFactory`
* @object: The `GObject` to unbind
*
* Emitted when a object has been unbound from its item, for example when
* Emitted when an object has been unbound from its item, for example when
* a listitem was removed from use in a list widget
* and its new [property@Gtk.ListItem:item] is about to be unset.
* and its [property@Gtk.ListItem:item] is about to be unset.
*
* This signal is the opposite of the [signal@Gtk.SignalListItemFactory::bind]
* signal and should be used to undo everything done in that signal.

View File

@@ -558,29 +558,29 @@ merge_color_matrix_nodes (const graphene_matrix_t *matrix2,
const graphene_vec4_t *offset2,
GskRenderNode *child)
{
const graphene_matrix_t *mat1 = gsk_color_matrix_node_get_color_matrix (child);
const graphene_matrix_t *matrix1 = gsk_color_matrix_node_get_color_matrix (child);
const graphene_vec4_t *offset1 = gsk_color_matrix_node_get_color_offset (child);
graphene_matrix_t mat2 = *matrix2;
graphene_vec4_t off2 = *offset2;
graphene_matrix_t matrix;
graphene_vec4_t offset;
GskRenderNode *result;
g_assert (gsk_render_node_get_node_type (child) == GSK_COLOR_MATRIX_NODE);
/* color matrix node: color = mat * p + offset; for a pixel p.
* color = mat1 * (mat2 * p + offset2) + offset1;
* = mat1 * mat2 * p + offset2 * mat1 + offset1
* = (mat1 * mat2) * p + (offset2 * mat1 + offset1)
/* color matrix node: color = trans(mat) * p + offset; for a pixel p.
* color = trans(mat2) * (trans(mat1) * p + offset1) + offset2
* = trans(mat2) * trans(mat1) * p + trans(mat2) * offset1 + offset2
* = trans(mat1 * mat2) * p + (trans(mat2) * offset1 + offset2)
* Which this code does.
* mat1 and offset1 come from @child.
*/
graphene_matrix_transform_vec4 (mat1, offset2, &off2);
graphene_vec4_add (&off2, offset1, &off2);
graphene_matrix_transform_vec4 (matrix2, offset1, &offset);
graphene_vec4_add (&offset, offset2, &offset);
graphene_matrix_multiply (mat1, &mat2, &mat2);
graphene_matrix_multiply (matrix1, matrix2, &matrix);
result = gsk_color_matrix_node_new (gsk_color_matrix_node_get_child (child),
&mat2, &off2);
&matrix, &offset);
return result;
}
@@ -647,6 +647,13 @@ gtk_snapshot_collect_color_matrix (GtkSnapshot *snapshot,
* Modifies the colors of an image by applying an affine transformation
* in RGB space.
*
* In particular, the colors will be transformed by applying
*
* pixel = transpose(color_matrix) * pixel + color_offset
*
* for every pixel. The transformation operates on unpremultiplied
* colors, with color components ordered R, G, B, A.
*
* The image is recorded until the next call to [method@Gtk.Snapshot.pop].
*/
void

View File

@@ -3977,9 +3977,11 @@ gtk_text_insert_at_cursor (GtkText *self,
if (priv->editable)
{
begin_change (self);
gtk_text_reset_im_context (self);
gtk_editable_insert_text (GTK_EDITABLE (self), str, -1, &pos);
gtk_text_set_selection_bounds (self, pos, pos);
end_change (self);
}
}
@@ -3999,12 +4001,14 @@ gtk_text_delete_from_cursor (GtkText *self,
return;
}
begin_change (self);
if (priv->selection_bound != priv->current_pos)
{
gtk_text_delete_selection (self);
gtk_text_schedule_im_reset (self);
gtk_text_reset_im_context (self);
return;
goto done;
}
switch (type)
@@ -4074,6 +4078,8 @@ gtk_text_delete_from_cursor (GtkText *self,
gtk_text_reset_im_context (self);
}
done:
end_change (self);
gtk_text_pend_cursor_blink (self);
}
@@ -4089,12 +4095,14 @@ gtk_text_backspace (GtkText *self)
return;
}
begin_change (self);
if (priv->selection_bound != priv->current_pos)
{
gtk_text_delete_selection (self);
gtk_text_schedule_im_reset (self);
gtk_text_reset_im_context (self);
return;
goto done;
}
prev_pos = gtk_text_move_logically (self, priv->current_pos, -1);
@@ -4147,6 +4155,8 @@ gtk_text_backspace (GtkText *self)
gtk_widget_error_bell (GTK_WIDGET (self));
}
done:
end_change (self);
gtk_text_pend_cursor_blink (self);
}
@@ -4191,7 +4201,11 @@ gtk_text_cut_clipboard (GtkText *self)
if (priv->editable)
{
if (priv->selection_bound != priv->current_pos)
gtk_text_delete_selection (self);
{
begin_change (self);
gtk_text_delete_selection (self);
end_change (self);
}
}
else
{
@@ -4209,9 +4223,15 @@ gtk_text_paste_clipboard (GtkText *self)
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
if (priv->editable)
gtk_text_paste (self, gtk_widget_get_clipboard (GTK_WIDGET (self)));
{
begin_change (self);
gtk_text_paste (self, gtk_widget_get_clipboard (GTK_WIDGET (self)));
end_change (self);
}
else
gtk_widget_error_bell (GTK_WIDGET (self));
{
gtk_widget_error_bell (GTK_WIDGET (self));
}
gtk_text_update_handles (self);
}

View File

@@ -1100,6 +1100,18 @@ gtk_text_history_modified_changed (GtkTextHistory *self,
peek->is_modified_set = TRUE;
}
if ((peek = g_queue_peek_head (&self->redo_queue)))
{
if (peek->kind == ACTION_KIND_BARRIER)
{
if (!(peek = peek->link.next->data))
return;
}
peek->is_modified = TRUE;
peek->is_modified_set = TRUE;
}
self->is_modified = !!modified;
self->is_modified_set = TRUE;

View File

@@ -30,8 +30,7 @@
#include <gdk/gdk.h>
#include <gsk/gsk.h>
#include <gtk/gtkaccelgroup.h>
#include <gtk/gtkborder.h>
#include <gtk/gtkenums.h>
#include <gtk/gtkshortcut.h>
#include <gtk/gtkshortcutaction.h>
#include <gtk/gtktypes.h>

View File

@@ -28,6 +28,7 @@
#include "gtkactionmuxerprivate.h"
#include "gtkatcontextprivate.h"
#include "gtkborder.h"
#include "gtkcsstypesprivate.h"
#include "gtkeventcontrollerprivate.h"
#include "gtklistlistmodelprivate.h"

View File

@@ -1312,10 +1312,22 @@ gtk_inspector_object_tree_select_object (GtkInspectorObjectTree *wt,
GTK_LIST_SCROLL_SELECT | GTK_LIST_SCROLL_FOCUS,
NULL);
g_signal_emit (wt, signals[OBJECT_SELECTED], 0, object); // FIXME
g_signal_emit (wt, signals[OBJECT_SELECTED], 0, object);
g_object_unref (row_item);
}
static void
on_selected_item (GtkSingleSelection *selection,
GParamSpec *pspec,
GtkInspectorObjectTree *wt)
{
GObject *selected = gtk_single_selection_get_selected_item (selection);
GtkTreeListRow *row = GTK_TREE_LIST_ROW (selected);
GObject *object = gtk_tree_list_row_get_item (row);
g_signal_emit (wt, signals[OBJECT_SELECTED], 0, object);
g_object_unref (object);
}
void
gtk_inspector_object_tree_set_display (GtkInspectorObjectTree *wt,
GdkDisplay *display)
@@ -1329,4 +1341,5 @@ gtk_inspector_object_tree_set_display (GtkInspectorObjectTree *wt,
wt->priv->selection = gtk_single_selection_new (g_object_ref (G_LIST_MODEL (wt->priv->tree_model)));
gtk_column_view_set_model (GTK_COLUMN_VIEW (wt->priv->list),
GTK_SELECTION_MODEL (wt->priv->selection));
g_signal_connect (wt->priv->selection, "notify::selected-item", G_CALLBACK (on_selected_item), wt);
}

View File

@@ -1075,7 +1075,6 @@ endif
if macos_enabled
gtk_macos_frameworks = [
'AppKit',
'Foundation',
]
gtk_deps += [dependency('appleframeworks', modules: gtk_macos_frameworks)]
endif

View File

@@ -27,6 +27,7 @@
#endif
#include <glib-object.h>
#include <gdk/gdk.h>
G_BEGIN_DECLS
@@ -87,28 +88,39 @@ struct _GtkPrinterOptionClass
void (*_gtk_reserved4) (void);
};
GDK_AVAILABLE_IN_ALL
GType gtk_printer_option_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkPrinterOption *gtk_printer_option_new (const char *name,
const char *display_text,
GtkPrinterOptionType type);
GDK_AVAILABLE_IN_ALL
void gtk_printer_option_set (GtkPrinterOption *option,
const char *value);
GDK_AVAILABLE_IN_ALL
void gtk_printer_option_set_has_conflict (GtkPrinterOption *option,
gboolean has_conflict);
GDK_AVAILABLE_IN_ALL
void gtk_printer_option_clear_has_conflict (GtkPrinterOption *option);
GDK_AVAILABLE_IN_ALL
void gtk_printer_option_set_boolean (GtkPrinterOption *option,
gboolean value);
GDK_AVAILABLE_IN_ALL
void gtk_printer_option_allocate_choices (GtkPrinterOption *option,
int num);
GDK_AVAILABLE_IN_ALL
void gtk_printer_option_choices_from_array (GtkPrinterOption *option,
int num_choices,
const char **choices,
const char **choices_display);
GDK_AVAILABLE_IN_ALL
gboolean gtk_printer_option_has_choice (GtkPrinterOption *option,
const char *choice);
GDK_AVAILABLE_IN_ALL
void gtk_printer_option_set_activates_default (GtkPrinterOption *option,
gboolean activates);
GDK_AVAILABLE_IN_ALL
gboolean gtk_printer_option_get_activates_default (GtkPrinterOption *option);

View File

@@ -1,5 +1,5 @@
project('gtk', 'c',
version: '4.12.0',
version: '4.12.1',
default_options: [
'buildtype=debugoptimized',
'warning_level=1',
@@ -309,6 +309,7 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
'missing-declarations',
'missing-prototypes',
'nonnull',
'override-init',
'pointer-to-int-cast',
'redundant-decls',
'return-type',
@@ -817,28 +818,15 @@ endif
gsk_packages = [ 'graphene-gobject-1.0 @0@'.format(graphene_req) ]
gtk_packages = [ 'gio-2.0 @0@'.format(glib_req) ]
gio_pkgname = os_unix ? 'gio-unix-2.0' : 'gio-2.0'
gdk_private_packages = [
'@0@ @1@'.format(gio_pkgname, glib_req),
'epoxy @0@'.format(epoxy_req),
] + x11_pkgs + wayland_pkgs + cairo_backends
gsk_private_packages = [] # all already in gdk_private_packages
pangoft2_pkgs = (wayland_enabled or x11_enabled) ? ['pangoft2'] : []
gtk_private_packages = pangoft2_pkgs
pkgs = []
pkg_targets = []
display_backends = []
enabled_backends = []
foreach backend: [ 'broadway', 'macos', 'wayland', 'win32', 'x11', ]
if get_variable('@0@_enabled'.format(backend))
pkgs += ['gtk4-@0@'.format(backend)]
pkg_targets += backend
display_backends += [ backend ]
enabled_backends += backend
endif
endforeach
common_pc_variables = [
'targets=@0@'.format(' '.join(pkg_targets)),
'targets=@0@'.format(' '.join(enabled_backends)),
'gtk_binary_version=@0@'.format(gtk_binary_version),
'gtk_host=@0@-@1@'.format(host_machine.cpu_family(), host_machine.system()), # FIXME
]
@@ -853,13 +841,14 @@ pkg_config.generate(libgtk,
)
meson.override_dependency('gtk4', libgtk_dep)
foreach pkg: pkgs
foreach backend: enabled_backends
pkg = 'gtk4-@0@'.format(backend)
pkg_config.generate(
filebase: pkg,
unescaped_variables: common_pc_variables,
name: 'GTK',
description: 'GTK Graphical UI Library',
requires: 'gtk4',
requires: ['gtk4', get_variable('@0@_public_deps'.format(backend), [])],
)
meson.override_dependency(pkg, libgtk_dep)
endforeach
@@ -904,7 +893,7 @@ endif
#### Summary ####
summary('Display backends', display_backends, section: 'Components')
summary('Display backends', enabled_backends, section: 'Components')
summary('Print backends', print_backends, section: 'Components')
summary('Media backends', media_backends, section: 'Components')

View File

@@ -23,7 +23,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
#include "gtkprintbackendprivate.h"
#include "gtk/print/gtkprintbackendprivate.h"
G_BEGIN_DECLS

View File

@@ -21,7 +21,7 @@
#include <glib-object.h>
#include <cpdb/cpdb-frontend.h>
#include <gtk/gtkprinterprivate.h>
#include <gtk/print/gtkprinterprivate.h>
G_BEGIN_DECLS
@@ -43,4 +43,4 @@ void gtk_printer_cpdb_set_printer_obj (GtkPrinterCpdb
G_END_DECLS
#endif /* __GTK_PRINTER_CPDB_H__ */
#endif /* __GTK_PRINTER_CPDB_H__ */

1760
po/pl.po

File diff suppressed because it is too large Load Diff

2362
po/sv.po

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,7 @@ test_calendar_set_day (void)
cal = gtk_calendar_new ();
tz = g_time_zone_new_identifier ("MET");
tz = g_time_zone_new_identifier ("Europe/Brussels");
g_assert_nonnull (tz);
dt = g_date_time_new (tz, 1970, 3, 1, 0, 0, 0);
g_assert_nonnull (dt);

View File

@@ -30,6 +30,10 @@ struct {
{ 1, 0, 1, 5.0 / 6.0, 1, 1 },
};
/* Close enough for float precision to match, even with some
* rounding errors */
#define EPSILON 1e-6
static void
test_roundtrips (void)
{
@@ -40,13 +44,13 @@ test_roundtrips (void)
g_print ("color %u\n", i);
gtk_hsv_to_rgb (tests[i].h, tests[i].s, tests[i].v, &r, &g, &b);
g_assert_cmpfloat_with_epsilon (r, tests[i].r, FLT_EPSILON);
g_assert_cmpfloat_with_epsilon (g, tests[i].g, FLT_EPSILON);
g_assert_cmpfloat_with_epsilon (b, tests[i].b, FLT_EPSILON);
g_assert_cmpfloat_with_epsilon (r, tests[i].r, EPSILON);
g_assert_cmpfloat_with_epsilon (g, tests[i].g, EPSILON);
g_assert_cmpfloat_with_epsilon (b, tests[i].b, EPSILON);
gtk_rgb_to_hsv (tests[i].r, tests[i].g, tests[i].b, &h, &s, &v);
g_assert_cmpfloat_with_epsilon (h, tests[i].h, FLT_EPSILON);
g_assert_cmpfloat_with_epsilon (s, tests[i].s, FLT_EPSILON);
g_assert_cmpfloat_with_epsilon (v, tests[i].v, FLT_EPSILON);
g_assert_cmpfloat_with_epsilon (h, tests[i].h, EPSILON);
g_assert_cmpfloat_with_epsilon (s, tests[i].s, EPSILON);
g_assert_cmpfloat_with_epsilon (v, tests[i].v, EPSILON);
}
}

View File

@@ -635,6 +635,35 @@ test_issue_4575 (void)
run_test (commands, G_N_ELEMENTS (commands), 0);
}
static void
test_issue_5777 (void)
{
static const Command commands[] = {
{ MODIFIED, -1, -1, NULL, NULL, UNSET, UNSET, SET },
{ INSERT_SEQ, 0, -1, "this is a test\nmore", "this is a test\nmore", SET, UNSET, SET },
{ UNDO, -1, -1, NULL, "this is a test\n", SET, SET, SET },
{ UNMODIFIED, -1, -1, NULL, NULL, SET, SET, UNSET },
{ REDO, -1, -1, NULL, "this is a test\nmore", SET, UNSET, SET },
{ UNDO, -1, -1, NULL, "this is a test\n", SET, SET, UNSET },
{ REDO, -1, -1, NULL, "this is a test\nmore", SET, UNSET, SET },
{ UNDO, -1, -1, NULL, "this is a test\n", SET, SET, UNSET },
{ MODIFIED, -1, -1, NULL, NULL, SET, SET, SET },
{ REDO, -1, -1, NULL, "this is a test\nmore", SET, UNSET, SET },
{ UNMODIFIED, -1, -1, NULL, NULL, SET, UNSET, UNSET },
{ UNDO, -1, -1, NULL, "this is a test\n", SET, SET, SET },
{ REDO, -1, -1, NULL, "this is a test\nmore", SET, UNSET, UNSET },
{ UNDO, -1, -1, NULL, "this is a test\n", SET, SET, SET },
{ UNDO, -1, -1, NULL, "this is a test", SET, SET, SET },
{ UNMODIFIED, -1, -1, NULL, NULL, SET, SET, UNSET },
{ UNDO, -1, -1, NULL, "this is a", SET, SET, SET },
{ REDO, -1, -1, NULL, "this is a test", SET, SET, UNSET },
{ REDO, -1, -1, NULL, "this is a test\n", SET, SET, SET },
{ REDO, -1, -1, NULL, "this is a test\nmore", SET, UNSET, SET },
};
run_test (commands, G_N_ELEMENTS (commands), 4);
}
int
main (int argc,
char *argv[])
@@ -657,6 +686,7 @@ main (int argc,
g_test_add_func ("/Gtk/TextHistory/test14", test14);
g_test_add_func ("/Gtk/TextHistory/issue_4276", test_issue_4276);
g_test_add_func ("/Gtk/TextHistory/issue_4575", test_issue_4575);
g_test_add_func ("/Gtk/TextHistory/issue_5777", test_issue_5777);
return g_test_run ();
}