Merge branch 'backports-for-4-16' into 'gtk-4-16'
Various backports See merge request GNOME/gtk!7923
This commit is contained in:
18
NEWS
18
NEWS
@@ -1,6 +1,24 @@
|
||||
Overview of Changes in 4.16.6, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
To prevent issues when using GTK under kwin, this release
|
||||
makes Wayland color management opt-in. To experiment with
|
||||
it, set GDK_DEBUG=color-mgmt.
|
||||
|
||||
* GtkText:
|
||||
- Don't select inserted Emoji
|
||||
|
||||
* GtkApplication:
|
||||
- Set the default window icon from the app ID
|
||||
|
||||
* GtkFontChooser:
|
||||
- Make the dialog more shrinkable
|
||||
|
||||
* Translation updates
|
||||
Icelandic
|
||||
Serbian
|
||||
Serbian (Latin)
|
||||
|
||||
|
||||
Overview of Changes in 4.16.5, 01-11-2024
|
||||
=========================================
|
||||
|
||||
@@ -579,6 +579,8 @@ released_cb (GtkGesture *gesture,
|
||||
|
||||
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
||||
child = gtk_widget_pick (widget, x, y, 0);
|
||||
if (!child)
|
||||
return;
|
||||
item = (CanvasItem *)gtk_widget_get_ancestor (child, canvas_item_get_type ());
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
@@ -12,11 +12,13 @@
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
static void
|
||||
response_cb (GtkDialog *dialog, int response_id)
|
||||
static gboolean
|
||||
close_request_cb (GtkWidget *win, gpointer user_data)
|
||||
{
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
g_assert (window == win);
|
||||
gtk_window_destroy ((GtkWindow *)window);
|
||||
window = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -117,7 +119,7 @@ do_expander (GtkWidget *do_widget)
|
||||
g_signal_connect (expander, "notify::expanded",
|
||||
G_CALLBACK (expander_cb), window);
|
||||
|
||||
g_signal_connect (window, "response", G_CALLBACK (response_cb), NULL);
|
||||
g_signal_connect (window, "close-request", G_CALLBACK (close_request_cb), NULL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -1068,8 +1068,6 @@ command_line (GApplication *app,
|
||||
|
||||
window = gtk_application_get_windows (GTK_APPLICATION (app))->data;
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (window), "org.gtk.Demo4");
|
||||
|
||||
if (name == NULL)
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<component xmlns="https://specifications.freedesktop.org/metainfo/1.0" type="desktop">
|
||||
<id>org.gtk.Demo4</id>
|
||||
<launchable type="desktop-id">org.gtk.Demo4.desktop</launchable>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
|
||||
@@ -219,8 +219,6 @@ node_editor_application_activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (win), "devel");
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (win), "org.gtk.gtk4.NodeEditor");
|
||||
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<component xmlns="https://specifications.freedesktop.org/metainfo/1.0" type="desktop">
|
||||
<id>org.gtk.gtk4.NodeEditor</id>
|
||||
<launchable type="desktop-id">org.gtk.gtk4.NodeEditor.desktop</launchable>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<component xmlns="https://specifications.freedesktop.org/metainfo/1.0" type="desktop">
|
||||
<id>org.gtk.PrintEditor4</id>
|
||||
<launchable type="desktop-id">org.gtk.PrintEditor4.desktop</launchable>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
|
||||
@@ -798,7 +798,6 @@ activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (main_window), "devel");
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (main_window), "org.gtk.PrintEditor4");
|
||||
gtk_window_set_default_size (GTK_WINDOW (main_window), 400, 600);
|
||||
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (main_window), TRUE);
|
||||
update_title (GTK_WINDOW (main_window));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<component xmlns="https://specifications.freedesktop.org/metainfo/1.0" type="desktop">
|
||||
<id>org.gtk.WidgetFactory4</id>
|
||||
<launchable type="desktop-id">org.gtk.WidgetFactory4.desktop</launchable>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
|
||||
@@ -2241,7 +2241,6 @@ activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (window), "devel");
|
||||
|
||||
gtk_window_set_icon_name (window, "org.gtk.WidgetFactory4");
|
||||
gtk_application_add_window (GTK_APPLICATION (app), window);
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (window),
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "gdkcicpparams.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GdkCicp GdkCicp;
|
||||
|
||||
struct _GdkCicp
|
||||
@@ -82,3 +84,5 @@ gdk_cicp_equivalent (const GdkCicp *p1,
|
||||
const GdkCicp * gdk_cicp_params_get_cicp (GdkCicpParams *params);
|
||||
|
||||
GdkCicpParams * gdk_cicp_params_new_for_cicp (const GdkCicp *cicp);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -119,3 +119,4 @@ guint gdk_parse_debug_var (const char *variable,
|
||||
const GdkDebugKey *keys,
|
||||
guint nkeys);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -2002,7 +2002,7 @@ init_settings (GdkDisplay *display)
|
||||
if (entry)
|
||||
{
|
||||
char *a = g_variant_print (v, FALSE);
|
||||
g_debug ("Using portal setting for %s %s: %s\n", schema_str, key, a);
|
||||
g_debug ("Using portal setting for %s %s: %s", schema_str, key, a);
|
||||
g_free (a);
|
||||
entry->valid = TRUE;
|
||||
apply_portal_setting (entry, v, display);
|
||||
|
||||
@@ -161,19 +161,25 @@ run (out vec2 pos)
|
||||
float
|
||||
bt709_eotf (float v)
|
||||
{
|
||||
if (abs (v) < 0.081)
|
||||
const float a = 1.099;
|
||||
const float d = 0.0812;
|
||||
|
||||
if (abs (v) < d)
|
||||
return v / 4.5;
|
||||
else
|
||||
return sign (v) * pow ((abs (v) + 0.099) / 1.099, 1.0/0.45);
|
||||
return sign (v) * pow ((abs (v) + (a - 1.0)) / a, 1.0 / 0.45);
|
||||
}
|
||||
|
||||
float
|
||||
bt709_oetf (float v)
|
||||
{
|
||||
if (abs (v) < 0.081)
|
||||
const float a = 1.099;
|
||||
const float b = 0.018;
|
||||
|
||||
if (abs (v) < b)
|
||||
return v * 4.5;
|
||||
else
|
||||
return 1.099 * sign (v) * (pow (abs (v), 0.45) - 0.099);
|
||||
return sign (v) * (a * pow (abs (v), 0.45) - (a - 1.0));
|
||||
}
|
||||
|
||||
float
|
||||
|
||||
@@ -88,6 +88,10 @@
|
||||
* displays the shortcuts window, associate the item with the action
|
||||
* `win.show-help-overlay`.
|
||||
*
|
||||
* `GtkApplication` will also automatically set the application id as the
|
||||
* default window icon. Use [func@Gtk.Window.set_default_icon_name] or
|
||||
* [property@Gtk.Window:icon-name] to override that behavior.
|
||||
*
|
||||
* ## A simple application
|
||||
*
|
||||
* [A simple example](https://gitlab.gnome.org/GNOME/gtk/tree/main/examples/bp/bloatpad.c)
|
||||
@@ -244,6 +248,23 @@ gtk_application_load_resources (GtkApplication *application)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_set_window_icon (GtkApplication *application)
|
||||
{
|
||||
GtkIconTheme *default_theme;
|
||||
const char *appid;
|
||||
|
||||
if (gtk_window_get_default_icon_name () != NULL)
|
||||
return;
|
||||
|
||||
default_theme = gtk_icon_theme_get_for_display (gdk_display_get_default ());
|
||||
appid = g_application_get_application_id (G_APPLICATION (application));
|
||||
|
||||
if (appid == NULL || !gtk_icon_theme_has_icon (default_theme, appid))
|
||||
return;
|
||||
|
||||
gtk_window_set_default_icon_name (appid);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_startup (GApplication *g_application)
|
||||
@@ -267,6 +288,7 @@ gtk_application_startup (GApplication *g_application)
|
||||
gtk_application_impl_startup (priv->impl, priv->register_session);
|
||||
|
||||
gtk_application_load_resources (application);
|
||||
gtk_application_set_window_icon (application);
|
||||
|
||||
gdk_profiler_end_mark (before, "Application startup", NULL);
|
||||
}
|
||||
|
||||
@@ -337,10 +337,9 @@ filechooser_win32_thread_data_free (FilechooserWin32ThreadData *data)
|
||||
g_array_free (data->choices_selections, TRUE);
|
||||
data->choices_selections = NULL;
|
||||
}
|
||||
g_object_unref (data->shortcut_files);
|
||||
g_clear_object (&data->shortcut_files);
|
||||
g_slist_free_full (data->files, g_object_unref);
|
||||
if (data->self)
|
||||
g_object_unref (data->self);
|
||||
g_clear_object (&data->self);
|
||||
g_free (data->accept_label);
|
||||
g_free (data->cancel_label);
|
||||
g_free (data->title);
|
||||
|
||||
@@ -2190,6 +2190,7 @@ update_feature_example (GtkFontChooserWidget *fontchooser,
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (item->example), text);
|
||||
gtk_label_set_attributes (GTK_LABEL (item->example), attrs);
|
||||
gtk_label_set_ellipsize (GTK_LABEL (item->example), PANGO_ELLIPSIZE_END);
|
||||
|
||||
g_free (text);
|
||||
pango_attr_list_unref (attrs);
|
||||
|
||||
@@ -291,6 +291,7 @@ struct _GtkTextPrivate
|
||||
guint propagate_text_width : 1;
|
||||
guint text_handles_enabled : 1;
|
||||
guint enable_undo : 1;
|
||||
guint emoji_chooser_open : 1;
|
||||
};
|
||||
|
||||
struct _GtkTextPasswordHint
|
||||
@@ -3459,7 +3460,7 @@ gtk_text_grab_focus (GtkWidget *widget)
|
||||
if (!GTK_WIDGET_CLASS (gtk_text_parent_class)->grab_focus (GTK_WIDGET (self)))
|
||||
return FALSE;
|
||||
|
||||
if (priv->editable && !priv->in_click && !prev_focus_was_child)
|
||||
if (priv->editable && !priv->in_click && !prev_focus_was_child && !priv->emoji_chooser_open)
|
||||
{
|
||||
g_object_get (gtk_widget_get_settings (widget),
|
||||
"gtk-entry-select-on-focus",
|
||||
@@ -7183,6 +7184,15 @@ gtk_text_get_tabs (GtkText *self)
|
||||
return priv->tabs;
|
||||
}
|
||||
|
||||
static void
|
||||
emoji_chooser_closed (GtkWidget *chooser,
|
||||
GtkText *text)
|
||||
{
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (text);
|
||||
|
||||
priv->emoji_chooser_open = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
emoji_picked (GtkEmojiChooser *chooser,
|
||||
const char *text,
|
||||
@@ -7208,6 +7218,7 @@ emoji_picked (GtkEmojiChooser *chooser,
|
||||
static void
|
||||
gtk_text_insert_emoji (GtkText *self)
|
||||
{
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
GtkWidget *chooser;
|
||||
|
||||
if (gtk_widget_get_ancestor (GTK_WIDGET (self), GTK_TYPE_EMOJI_CHOOSER) != NULL)
|
||||
@@ -7221,10 +7232,11 @@ gtk_text_insert_emoji (GtkText *self)
|
||||
|
||||
gtk_widget_set_parent (chooser, GTK_WIDGET (self));
|
||||
g_signal_connect (chooser, "emoji-picked", G_CALLBACK (emoji_picked), self);
|
||||
g_signal_connect_swapped (chooser, "hide", G_CALLBACK (gtk_text_grab_focus_without_selecting), self);
|
||||
g_signal_connect_swapped (chooser, "hide", G_CALLBACK (emoji_chooser_closed), self);
|
||||
}
|
||||
|
||||
gtk_popover_popup (GTK_POPOVER (chooser));
|
||||
priv->emoji_chooser_open = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -1090,7 +1090,7 @@ gtk_settings_schemas = [
|
||||
'org.gtk.gtk4.Settings.EmojiChooser.gschema.xml',
|
||||
'org.gtk.gtk4.Settings.Debug.gschema.xml',
|
||||
]
|
||||
install_data(gtk_settings_schemas, install_dir: gtk_schemasdir)
|
||||
install_data(gtk_settings_schemas, install_dir: gtk_schemasdir, install_tag: 'runtime')
|
||||
gnome.compile_schemas(depend_files: files(gtk_settings_schemas), build_by_default: true)
|
||||
gtk_schema_build_dir = meson.current_build_dir()
|
||||
|
||||
|
||||
@@ -972,6 +972,8 @@ devmode_from_settings (GtkPrintSettings *settings,
|
||||
const char *extras_base64;
|
||||
gsize extras_len;
|
||||
const char *val;
|
||||
gunichar2 *device_name;
|
||||
glong device_name_len;
|
||||
|
||||
/* If we already provided a valid hDevMode, don't initialize a new one; just lock the one we have */
|
||||
if (hDevMode)
|
||||
@@ -996,8 +998,9 @@ devmode_from_settings (GtkPrintSettings *settings,
|
||||
devmode->dmSpecVersion = DM_SPECVERSION;
|
||||
devmode->dmSize = sizeof (DEVMODEW);
|
||||
|
||||
gunichar2 *device_name = g_utf8_to_utf16 (gtk_print_settings_get (settings, "win32-devmode-name"), -1, NULL, NULL, NULL);
|
||||
memcpy (devmode->dmDeviceName, device_name, CCHDEVICENAME);
|
||||
device_name = g_utf8_to_utf16 (gtk_print_settings_get (settings, "win32-devmode-name"), -1, NULL, &device_name_len, NULL);
|
||||
if (device_name && device_name_len)
|
||||
memcpy (devmode->dmDeviceName, device_name, MIN (device_name_len, CCHDEVICENAME) * sizeof (gunichar2));
|
||||
g_free (device_name);
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<interface domain="gtk40">
|
||||
<template class="GtkFontChooserDialog" parent="GtkDialog">
|
||||
<property name="title" translatable="yes">Select Font</property>
|
||||
<property name="default-width">400</property>
|
||||
<property name="default-height">500</property>
|
||||
<style>
|
||||
<class name="fontchooser"/>
|
||||
</style>
|
||||
|
||||
@@ -144,8 +144,6 @@
|
||||
<property name="column-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="width-request">400</property>
|
||||
<property name="height-request">300</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="hscrollbar-policy">2</property>
|
||||
|
||||
@@ -219,7 +219,7 @@ gtk_gst_sink_get_caps (GstBaseSink *bsink,
|
||||
{
|
||||
GdkDmabufFormats *formats = gdk_display_get_dmabuf_formats (self->gdk_display);
|
||||
|
||||
if (formats)
|
||||
if (formats && gdk_dmabuf_formats_get_n_formats (formats) > 0)
|
||||
{
|
||||
tmp = gst_caps_from_string (DMABUF_TEXTURE_CAPS);
|
||||
add_drm_formats_and_modifiers (tmp, formats);
|
||||
@@ -415,6 +415,7 @@ gtk_gst_sink_texture_from_buffer (GtkGstSink *self,
|
||||
graphene_rect_t *viewport)
|
||||
{
|
||||
GstVideoFrame *frame = g_new (GstVideoFrame, 1);
|
||||
GstMemory *mem;
|
||||
GdkTexture *texture;
|
||||
|
||||
viewport->origin.x = 0;
|
||||
@@ -422,7 +423,9 @@ gtk_gst_sink_texture_from_buffer (GtkGstSink *self,
|
||||
viewport->size.width = GST_VIDEO_INFO_WIDTH (&self->v_info);
|
||||
viewport->size.height = GST_VIDEO_INFO_HEIGHT (&self->v_info);
|
||||
|
||||
if (gst_is_dmabuf_memory (gst_buffer_peek_memory (buffer, 0)))
|
||||
mem = gst_buffer_peek_memory (buffer, 0);
|
||||
|
||||
if (gst_is_dmabuf_memory (mem))
|
||||
{
|
||||
GdkDmabufTextureBuilder *builder = NULL;
|
||||
const GstVideoMeta *vmeta = gst_buffer_get_video_meta (buffer);
|
||||
@@ -446,7 +449,6 @@ gtk_gst_sink_texture_from_buffer (GtkGstSink *self,
|
||||
|
||||
for (i = 0; i < vmeta->n_planes; i++)
|
||||
{
|
||||
GstMemory *mem;
|
||||
guint mem_idx, length;
|
||||
gsize skip;
|
||||
|
||||
@@ -474,12 +476,15 @@ gtk_gst_sink_texture_from_buffer (GtkGstSink *self,
|
||||
&error);
|
||||
g_object_unref (builder);
|
||||
if (!texture)
|
||||
GST_ERROR_OBJECT (self, "Failed to create dmabuf texture: %s", error->message);
|
||||
{
|
||||
GST_ERROR_OBJECT (self, "Failed to create dmabuf texture: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
*pixel_aspect_ratio = ((double) GST_VIDEO_INFO_PAR_N (&self->v_info) /
|
||||
(double) GST_VIDEO_INFO_PAR_D (&self->v_info));
|
||||
}
|
||||
else if (self->gdk_context &&
|
||||
else if (gst_is_gl_memory (mem) &&
|
||||
gst_video_frame_map (frame, &self->v_info, buffer, GST_MAP_READ | GST_MAP_GL))
|
||||
{
|
||||
GstGLSyncMeta *sync_meta;
|
||||
|
||||
@@ -46,7 +46,7 @@ usage (void)
|
||||
" render Take a screenshot of the file\n"
|
||||
" screenshot Take a screenshot of the file\n"
|
||||
"\n"));
|
||||
exit (1);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
static GLogWriterOutput
|
||||
|
||||
@@ -45,7 +45,7 @@ usage (void)
|
||||
" relabel Change the color state of the image without conversion\n"
|
||||
" show Show the image\n"
|
||||
"\n"));
|
||||
exit (1);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
static GLogWriterOutput
|
||||
|
||||
@@ -45,7 +45,7 @@ usage (void)
|
||||
" render Render the path as an image\n"
|
||||
" info Print information about the path\n"
|
||||
"\n"));
|
||||
exit (1);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
static GLogWriterOutput
|
||||
|
||||
@@ -45,7 +45,7 @@ usage (void)
|
||||
" show Show the node\n"
|
||||
" render Take a screenshot of the node\n"
|
||||
"\n"));
|
||||
exit (1);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
static GLogWriterOutput
|
||||
|
||||
@@ -1708,6 +1708,7 @@ main (int argc, char **argv)
|
||||
g_option_context_add_main_entries (context, args, GETTEXT_PACKAGE);
|
||||
|
||||
g_option_context_parse (context, &argc, &argv, NULL);
|
||||
g_option_context_free (context);
|
||||
|
||||
path = argv[1];
|
||||
#ifdef G_OS_WIN32
|
||||
|
||||
Reference in New Issue
Block a user