From 6b5baefd75a5ba72217bbf41ec7a147f021a8d50 Mon Sep 17 00:00:00 2001 From: Alexander Mikhaylenko Date: Thu, 9 Jun 2022 22:42:45 +0400 Subject: 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 --- demos/gtk-demo/listbox_controls.ui | 398 +++++++------ gtk/gtklistbox.c | 5 +- gtk/inspector/clipboard.ui | 157 +++-- gtk/inspector/general.c | 6 +- gtk/inspector/general.ui | 1128 ++++++++++++++++++------------------ gtk/inspector/misc-info.ui | 1071 ++++++++++++++++------------------ gtk/inspector/visual.ui | 1065 +++++++++++++++++----------------- gtk/theme/Default/_common.scss | 32 + 8 files changed, 1877 insertions(+), 1985 deletions(-) diff --git a/demos/gtk-demo/listbox_controls.ui b/demos/gtk-demo/listbox_controls.ui index c2c8a1f1cf..ab4419e54d 100644 --- a/demos/gtk-demo/listbox_controls.ui +++ b/demos/gtk-demo/listbox_controls.ui @@ -30,90 +30,86 @@ - - - - none - 1 - - + + none + + + + - + + + + Switch + 0 + start + center + 1 + + - - - - Switch - 0 - start - center - 1 - - - - - end - center - - + + end + center + + + + - + + + + Check + 0 + start + center + 1 + + - - - - Check - 0 - start - center - 1 - - - - - end - center - 10 - 10 - 1 - - + + end + center + 10 + 10 + 1 + + + + - + + + + Click here! + 0 + start + center + 1 + + - - - - Click here! - 0 - start - center - 1 - - - - - object-select-symbolic - end - center - 10 - 10 - 0 - - + + object-select-symbolic + end + center + 10 + 10 + 0 @@ -134,146 +130,142 @@ - - - - - none - 1 - + + + none + - - - 0 - - - - - Scale - 0 - start - center - 1 - - - - - end - center - 0 - 150 - - - 100 - 50 - 1 - 10 - - - - - - - - + + + 0 + + + + + Scale + 0 + start + center + 1 + + + + + end + center + 0 + 150 + + + 100 + 50 + 1 + 10 + + + + + + + + - - - 0 - - - - - Spinbutton - 0 - start - center - 1 - - - - - end - center - - - 100 - 50 - 1 - 10 - - - - - - - - - - - 0 - - - - - Dropdown - 0 - start - center - 1 - - - - - end - center - - - - Choice 1 - Choice 2 - Choice 3 - Choice 4 - - - - - - - - - + + + 0 + + + + + Spinbutton + 0 + start + center + 1 + + + + + end + center + + + 100 + 50 + 1 + 10 + + + + + + + + + + + 0 + + + + + Dropdown + 0 + start + center + 1 + + + + + end + center + + + + Choice 1 + Choice 2 + Choice 3 + Choice 4 + + + + + + + + + - - - 0 - - - - - Entry - 0 - start - center - 1 - - - - - end - center - Type here… - - - - - - + + + 0 + + + + + Entry + 0 + start + center + 1 + + + + + end + center + Type here… + + + + + + - - diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c index 7a2888df01..b449051f1b 100644 --- a/gtk/gtklistbox.c +++ b/gtk/gtklistbox.c @@ -72,7 +72,7 @@ * # CSS nodes * * |[ - * list[.separators][.rich-list][.navigation-sidebar] + * list[.separators][.rich-list][.navigation-sidebar][.boxed-list] * ╰── row[.activatable] * ]| * @@ -81,6 +81,9 @@ * Each `GtkListBoxRow` uses a single CSS node named row. The row nodes get the * .activatable style class added when appropriate. * + * It may also carry the .boxed-list style class. In this case, the list will be + * automatically surrounded by a frame and have separators. + * * The main list node may also carry style classes to select * the style of [list presentation](section-list-widget.html#list-styles): * .rich-list, .navigation-sidebar or .data-table. diff --git a/gtk/inspector/clipboard.ui b/gtk/inspector/clipboard.ui index bc9647f0bf..d5a1f53b62 100644 --- a/gtk/inspector/clipboard.ui +++ b/gtk/inspector/clipboard.ui @@ -13,80 +13,74 @@ 60 10 - + + none + - - none - + + 0 - - 0 + + 40 - - 40 - - - Drag and hold here - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + Drag and hold here + start + baseline + 0.0 - - + + 1 + end + baseline + end + 1 + + + + + - + + none + - - none - + + 0 - - 0 + + 40 - - 40 - - - Clipboard - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + Clipboard + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 @@ -96,36 +90,33 @@ - + + none + - - none - + + 0 - - 0 + + 40 + + + Primary + start + baseline + 0.0 + + - - 40 - - - Primary - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 1 + end + baseline + end + 1 diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c index 569622108a..7593e278e6 100644 --- a/gtk/inspector/general.c +++ b/gtk/inspector/general.c @@ -97,7 +97,7 @@ struct _GtkInspectorGeneral GtkWidget *vk_device; GtkWidget *vk_api_version; GtkWidget *vk_driver_version; - GtkWidget *app_id_frame; + GtkWidget *app_id_box; GtkWidget *app_id; GtkWidget *resource_path; GtkWidget *prefix; @@ -185,7 +185,7 @@ init_app_id (GtkInspectorGeneral *gen) app = g_application_get_default (); if (!app) { - gtk_widget_set_visible (gen->app_id_frame, FALSE); + gtk_widget_set_visible (gen->app_id_box, FALSE); return; } @@ -1137,7 +1137,7 @@ gtk_inspector_general_class_init (GtkInspectorGeneralClass *klass) gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, vk_device); gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, vk_api_version); gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, vk_driver_version); - gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, app_id_frame); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, app_id_box); gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, app_id); gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, resource_path); gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, prefix); diff --git a/gtk/inspector/general.ui b/gtk/inspector/general.ui index a75e532c3d..a313a9e22c 100644 --- a/gtk/inspector/general.ui +++ b/gtk/inspector/general.ui @@ -13,166 +13,163 @@ 60 10 - + + none center + - - none - + + 0 - - 0 - - - 40 - - - GTK Version - start - baseline - 0.0 - - - - - 1 - end - baseline - 1 - - + + 40 + + + GTK Version + start + baseline + 0.0 + + + + + 1 + end + baseline + 1 + + + + + 0 - - 0 - - - 40 - - - GDK Backend - start - baseline - 0.0 - - - - - 1 - end - baseline - 1 - - + + 40 + + + GDK Backend + start + baseline + 0.0 + + + + + 1 + end + baseline + 1 + + + + + 0 - - 0 - - - 40 - - - GSK Renderer - start - baseline - 0.0 - - - - - 1 - end - baseline - 1 - - + + 40 + + + GSK Renderer + start + baseline + 0.0 + + + + + 1 + end + baseline + 1 + + + + + 0 - - 0 - - - 40 - - - Pango Fontmap - start - baseline - 0.0 - - - - - 1 - end - baseline - 1 - - + + 40 + + + Pango Fontmap + start + baseline + 0.0 + + + + + 1 + end + baseline + 1 + + + + + 0 - - 0 - - - 40 - - - Media Backend - start - baseline - 0.0 - - - - - 1 - end - baseline - 1 - - + + 40 + + + Media Backend + start + baseline + 0.0 + + + + + 1 + end + baseline + 1 + + + + + 0 - - 0 - - - 40 - - - Input Method - start - baseline - 0.0 - - - - - 1 - end - baseline - 1 - - + + 40 + + + Input Method + start + baseline + 0.0 + + + + + 1 + end + baseline + 1 @@ -183,62 +180,59 @@ - + + none center + - - none - + + 0 - - 0 - - - 40 - - - Application ID - start - baseline - 0.0 - - - - - 1 - end - baseline - 1 - - + + 40 + + + Application ID + start + baseline + 0.0 + + + + + 1 + end + baseline + 1 + + + + + 0 - - 0 - - - 40 - - - Resource Path - start - baseline - 0.0 - - - - - 1 - end - baseline - 1 - - + + 40 + + + Resource Path + start + baseline + 0.0 + + + + + 1 + end + baseline + 1 @@ -249,199 +243,196 @@ - + + none center + - - none - + + 0 - - 0 - - - 40 - - - Prefix - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 40 + + + Prefix + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 + + + + + 0 - - 0 - - - 40 - - - XDG_DATA_HOME - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 40 + + + XDG_DATA_HOME + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 + + + + + 0 - - 0 - - - 40 - - - XDG_DATA_DIRS - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 40 + + + XDG_DATA_DIRS + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 + + + + + 0 - - 0 - - - 40 - - - GTK_PATH - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 40 + + + GTK_PATH + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 + + + + + 0 - - 0 - - - 40 - - - GTK_EXE_PREFIX - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 40 + + + GTK_EXE_PREFIX + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 + + + + + 0 - - 0 - - - 40 - - - GTK_DATA_PREFIX - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 40 + + + GTK_DATA_PREFIX + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 + + + + + 0 - - 0 - - - 40 - - - GSETTINGS_SCHEMA_DIR - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 40 + + + GSETTINGS_SCHEMA_DIR + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 @@ -451,89 +442,86 @@ - + + none center + - - none - + + 0 - - 0 - - - 40 - - - Display - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 40 + + + Display + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 + + + + + 0 - - 0 - - - 40 - - - RGBA Visual - start - baseline - 0.0 - - - - - end - baseline - object-select-symbolic - 1 - - + + 40 + + + RGBA Visual + start + baseline + 0.0 + + + + + end + baseline + object-select-symbolic + 1 + + + + + 0 - - 0 - - - 40 - - - Composited - start - baseline - 0.0 - - - - - end - baseline - object-select-symbolic - 1 - - + + 40 + + + Composited + start + baseline + 0.0 + + + + + end + baseline + object-select-symbolic + 1 @@ -543,100 +531,94 @@ - + + none center - - - none - - - + - + + none center + - - none - + + 0 - - 0 - - - 40 - - - GL Version - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 40 + + + GL Version + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 + + + + + 0 + 0 - - 0 - 0 - - - 40 - - - 1 - end - baseline - end - 1 - - - + + 40 + + + 1 + end + baseline + end + 1 + + + + + + 0 - - 0 - - - 40 - - - GL Vendor - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 40 + + + GL Vendor + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 @@ -646,91 +628,88 @@ - + + none center + - - none - + + 0 - - 0 - - - 40 - - - Vulkan Device - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 40 + + + Vulkan Device + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 + + + + + 0 - - 0 - - - 40 - - - Vulkan API version - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 40 + + + Vulkan API version + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 + + + + + 0 - - 0 - - - 40 - - - Vulkan driver version - start - baseline - 0.0 - - - - - 1 - end - baseline - end - 1 - - + + 40 + + + Vulkan driver version + start + baseline + 0.0 + + + + + 1 + end + baseline + end + 1 @@ -740,16 +719,13 @@ - + + none center - - - none - - - + @@ -785,14 +761,14 @@ - - - - - - - - + + + + + + + + diff --git a/gtk/inspector/misc-info.ui b/gtk/inspector/misc-info.ui index efe9bccce8..3a7696b7a4 100644 --- a/gtk/inspector/misc-info.ui +++ b/gtk/inspector/misc-info.ui @@ -12,696 +12,609 @@ 60 10 - + + none center + False + - - none + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Address - start - baseline - 0.0 - 1 - - - - - 1 - end - baseline - - + + 40 + + + Address + start + baseline + 0.0 + 1 + + + + + 1 + end + baseline + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Type - start - baseline - 0.0 - 1 - - - - - end - baseline - - + + 40 + + + Type + start + baseline + 0.0 + 1 + + + + + end + baseline + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Reference Count - start - baseline - 0.0 - 1 - - - - - 1 - end - baseline - - + + 40 + + + Reference Count + start + baseline + 0.0 + 1 + + + + + 1 + end + baseline + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - State - start - baseline - 0.0 - 1 - - - - - 1 - end - baseline - - + + 40 + + + State + start + baseline + 0.0 + 1 + + + + + 1 + end + baseline + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Direction - start - baseline - 0.0 - 1 - - - - - 1 - end - baseline - - + + 40 + + + Direction + start + baseline + 0.0 + 1 + + + + + 1 + end + baseline + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Buildable ID - start - baseline - 0.0 - 1 - - - - - 1 - end - baseline - - + + 40 + + + Buildable ID + start + baseline + 0.0 + 1 + + + + + 1 + end + baseline + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Mnemonic Label - start - baseline - 0.0 - 1 - - - - - 10 - end - - + + 40 + + + Mnemonic Label + start + baseline + 0.0 + 1 + + + + + 10 + end + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Request Mode - start - baseline - 0 - 1 - - - - - end - baseline - - + + 40 + + + Request Mode + start + baseline + 0 + 1 + + + + + end + baseline + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Measure map - start - baseline - 0 - 1 - - - - - Show - end - baseline - - - - - - - Expand - end - baseline - - - + + 40 + + + Measure map + start + baseline + 0 + 1 + + + + + Show + end + baseline + + + + + + + Expand + end + baseline + + + + + + 0 + - - 0 - - - - 10 - 10 - 10 - 10 - 40 + + 40 + + + + + + 0 + 1 - - - - - 0 - 1 - - - - - + + + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Allocation - start - baseline - 0 - 1 - - - - - end - baseline - - + + 40 + + + Allocation + start + baseline + 0 + 1 + + + + + end + baseline + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Baseline - start - baseline - 0 - 1 - - - - - end - baseline - - + + 40 + + + Baseline + start + baseline + 0 + 1 + + + + + end + baseline + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Surface - start - baseline - 0.0 - 1 - - - - - 1 - end - baseline - end - - - - - end - baseline - Properties - - - + + 40 + + + Surface + start + baseline + 0.0 + 1 + + + + + 1 + end + baseline + end + + + + + end + baseline + Properties + + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Renderer - start - baseline - 0.0 - 1 - - - - - 1 - end - baseline - end - - - - - end - baseline - Properties - - - + + 40 + + + Renderer + start + baseline + 0.0 + 1 + + + + + 1 + end + baseline + end + + + + + end + baseline + Properties + + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Frame Clock - start - baseline - 0.0 - 1 - - - - - 1 - end - baseline - end - - - - - end - baseline - Properties - - - + + 40 + + + Frame Clock + start + baseline + 0.0 + 1 + + + + + 1 + end + baseline + end + + + + + end + baseline + Properties + + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Tick Callback - start - baseline - 0 - 1 - - - - - end - baseline - object-select-symbolic - - + + 40 + + + Tick Callback + start + baseline + 0 + 1 + + + + + end + baseline + object-select-symbolic + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Frame Count - start - baseline - 0 - 1 - - - - - end - baseline - - + + 40 + + + Frame Count + start + baseline + 0 + 1 + + + + + end + baseline + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Frame Rate - start - baseline - 0 - 1 - - - - - end - baseline - - + + 40 + + + Frame Rate + start + baseline + 0 + 1 + + + + + end + baseline + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Mapped - start - baseline - 0 - 1 - - - - - end - baseline - object-select-symbolic - - + + 40 + + + Mapped + start + baseline + 0 + 1 + + + + + end + baseline + object-select-symbolic + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Realized - start - baseline - 0 - 1 - - - - - end - baseline - object-select-symbolic - - + + 40 + + + Realized + start + baseline + 0 + 1 + + + + + end + baseline + object-select-symbolic + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Is Toplevel - start - baseline - 0 - 1 - - - - - end - baseline - object-select-symbolic - - + + 40 + + + Is Toplevel + start + baseline + 0 + 1 + + + + + end + baseline + object-select-symbolic + + + + + 0 - - 0 - - - 10 - 10 - 10 - 10 - 40 - - - Child Visible - start - baseline - 0 - 1 - - - - - end - baseline - object-select-symbolic - - + + 40 + + + Child Visible + start + baseline + 0 + 1 + + + + + end + baseline + object-select-symbolic diff --git a/gtk/inspector/visual.ui b/gtk/inspector/visual.ui index e125449bab..310d8ce2d1 100644 --- a/gtk/inspector/visual.ui +++ b/gtk/inspector/visual.ui @@ -16,352 +16,349 @@ 60 10 - + + none center + - - none - + + 0 - - 0 + + 40 - - 40 - - - GTK Theme - start - baseline - 0.0 - - - - - end - baseline - 1 - - + + GTK Theme + start + baseline + 0.0 + + + + + end + baseline + 1 + + + + - + + 40 - - 40 - - - Dark Variant - start - baseline - 0.0 - - - - - end - center - 1 - - + + Dark Variant + start + baseline + 0.0 + + + + + end + center + 1 + + + + + 0 - - 0 + + 40 - - 40 - - - Cursor Theme - start - baseline - 0.0 - - - - - end - baseline - 1 - - + + Cursor Theme + start + baseline + 0.0 + + + + + end + baseline + 1 + + + + + 0 - - 0 + + 40 - - 40 - - - Cursor Size - start - baseline - 0.0 - - - - - end - baseline - 2 - 2 - - - 16 - 128 - 8 - 8 - - - 1 - 1 - - + + Cursor Size + start + baseline + 0.0 + + + + + end + baseline + 2 + 2 + + + 16 + 128 + 8 + 8 + + + 1 + 1 + + + + + 0 - - 0 + + 40 - - 40 - - - Icon Theme - start - baseline - 0.0 - - - - - end - baseline - 1 - - + + Icon Theme + start + baseline + 0.0 + + + + + end + baseline + 1 + + + + + 0 - - 0 + + 40 - - 40 - - - Font - start - baseline - 0.0 - - - - - end - baseline - 1 - - + + Font + start + baseline + 0.0 + + + + + end + baseline + 1 + + + + + 0 - - 0 + + 20 - - 20 - - - Font Scale - start - baseline - 0.0 - - - - - baseline - - - 0.5 - 2 - 0.01 - 0.01 - - - 0 - 1 - - - - - - - - end - baseline - 4 - 4 - number - - + + Font Scale + start + baseline + 0.0 + + + + + baseline + + + 0.5 + 2 + 0.01 + 0.01 + + + 0 + 1 + + + + + + + + end + baseline + 4 + 4 + number + + + + + 0 - - 0 + + 40 - - 40 - - - Text Direction - start - baseline - 0.0 - - - - - end - baseline - 1 - - - - - Left-to-Right - Right-to-Left - - - - - + + Text Direction + start + baseline + 0.0 + + + + + end + baseline + 1 + + + + + Left-to-Right + Right-to-Left + + + + + + + + 0 - - 0 + + 40 - - 40 - - - Window Scaling - start - baseline - 0.0 - - - - - end - baseline - - - 1 - 3 - 1 - 1 - - - 1 - 1 - - + + Window Scaling + start + baseline + 0.0 + + + + + end + baseline + + + 1 + 3 + 1 + 1 + + + 1 + 1 + + + + - + + 40 - - 40 - - - Animations - start - baseline - 0.0 - - - - - end - center - 1 - - + + Animations + start + baseline + 0.0 + + + + + end + center + 1 + + + + + 0 - - 0 + + 20 - - 20 - - - Slowdown - start - baseline - 0.0 - - - - - - - -3 - 3 - 1 - 1 - - - baseline - 0 - 1 - - - - - - - - end - baseline - 4 - 4 - number - - + + Slowdown + start + baseline + 0.0 + + + + + + + -3 + 3 + 1 + 1 + + + baseline + 0 + 1 + + + + + + + + end + baseline + 4 + 4 + number @@ -371,261 +368,257 @@ - + + none center + - - none - 1 - + - + + 40 - - 40 - - - Show fps overlay - start - baseline - 0.0 - - - - - end - center - 1 - - - + + Show fps overlay + start + baseline + 0.0 + + + + + end + center + 1 + + + + + - + + 40 - - 40 - - - Show Graphic Updates - start - baseline - 0.0 - - - - - end - center - 1 - - - + + Show Graphic Updates + start + baseline + 0.0 + + + + + end + center + 1 + + + + + - + + 40 - - 40 - - - Show Fallback Rendering - start - baseline - 0.0 - - - - - end - center - 1 - - - + + Show Fallback Rendering + start + baseline + 0.0 + + + + + end + center + 1 + + + + + - + + 40 - - 40 - - - Show Baselines - start - baseline - 0.0 - - - - - end - center - 1 - - - + + Show Baselines + start + baseline + 0.0 + + + + + end + center + 1 + + + + + - + + 40 - - 40 + + 6 - - 6 - - - Show Layout Borders - start - baseline - 0.0 - - - - - dialog-question-symbolic - - + + Show Layout Borders + start + baseline + 0.0 + + + + + dialog-question-symbolic + + + + + 10 + 10 + 10 + 10 + 4 + 4 + + + css-padding-color + + 0 + 0 + + + + + + css-border-color + + 0 + 1 + + + + + + css-margin-color + + 0 + 2 + + + + + + widget-margin-color + + 0 + 3 + + + + + + CSS Padding + 0 + + 1 + 0 + + + + + + CSS Border + 0 + + 1 + 1 + + + + + + CSS Margin + 0 + + 1 + 2 + + + - - 10 - 10 - 10 - 10 - 4 - 4 - - - css-padding-color - - 0 - 0 - - - - - - css-border-color - - 0 - 1 - - - - - - css-margin-color - - 0 - 2 - - - - - - widget-margin-color - - 0 - 3 - - - - - - CSS Padding - 0 - - 1 - 0 - - - - - - CSS Border - 0 - - 1 - 1 - - - - - - CSS Margin - 0 - - 1 - 2 - - - - - - Widget Margin - 0 - - 1 - 3 - - - + + Widget Margin + 0 + + 1 + 3 + - + - - - - - - end - center - 1 - + + + + end + center + 1 + + + + + + + - + + 40 - - 40 - - - Show Focus - start - baseline - 0.0 - - - - - end - center - 1 - - - + + Show Focus + start + baseline + 0.0 + + + + + end + center + 1 + @@ -635,35 +628,31 @@ - + + none center + - - none - 1 - + - + + 40 - - 40 - - - Simulate Touchscreen - start - baseline - 0.0 - - - - - end - center - 1 - - + + Simulate Touchscreen + start + baseline + 0.0 + + + + + end + center + 1 @@ -673,25 +662,21 @@ - + + none center + - - none - 1 - + - - - - Inspect Inspector - center - center - - - + + Inspect Inspector + center + center + @@ -741,10 +726,10 @@ - - - - + + + + diff --git a/gtk/theme/Default/_common.scss b/gtk/theme/Default/_common.scss index fd25bfc0d6..6e8aa4e503 100644 --- a/gtk/theme/Default/_common.scss +++ b/gtk/theme/Default/_common.scss @@ -3401,6 +3401,38 @@ columnview.complex { } } + +/********************************************************************** + * Boxed Lists * + * Lists inside a rounded frame. Can be used together with .rich-list * * + **********************************************************************/ + +.boxed-list { + border-radius: $window_radius; + border: 1px solid $borders_color; + + > row { + @include focus-ring($offset: -1px); + + border-bottom: 1px solid transparentize($borders_color, 0.5); + + &:backdrop { + border-bottom-color: transparentize($backdrop_borders_color, 0.5); + } + + &:first-child { + border-top-left-radius: $window_radius; + border-top-right-radius: $window_radius; + } + + &:last-child { + border-bottom-left-radius: $window_radius; + border-bottom-right-radius: $window_radius; + border-bottom: none; + } + } +} + /********************* * App Notifications * *********************/ -- cgit v1.2.1 From 6a797f6b1a52a68eebd29521f9e020101774c86e Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 16 Mar 2023 12:09:55 +0000 Subject: 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 --- gtk/gtklinkbutton.c | 57 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c index 25ed3d2333..d92991b799 100644 --- a/gtk/gtklinkbutton.c +++ b/gtk/gtklinkbutton.c @@ -57,9 +57,9 @@ #include "gtklinkbutton.h" #include "gtkdragsource.h" +#include "gtkfilelauncher.h" #include "gtkgestureclick.h" #include "gtkgesturesingle.h" -#include #include "gtklabel.h" #include "gtkmain.h" #include "gtkmarshalers.h" @@ -71,6 +71,7 @@ #include "gtkwidgetprivate.h" #include +#include typedef struct _GtkLinkButtonClass GtkLinkButtonClass; @@ -230,7 +231,7 @@ gtk_link_button_class_init (GtkLinkButtonClass *klass) /** * GtkLinkButton|menu.popup: * - * Opens the context menu. + * Opens the context menu. */ gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_link_button_popup_menu); @@ -303,7 +304,7 @@ gtk_link_content_get_value (GdkContentProvider *provider, content->link != NULL) { char *uri; - + uri = g_strdup_printf ("%s\r\n", content->link->uri); g_value_set_string (value, uri); g_free (uri); @@ -381,7 +382,7 @@ gtk_link_button_get_property (GObject *object, GParamSpec *pspec) { GtkLinkButton *link_button = GTK_LINK_BUTTON (object); - + switch (prop_id) { case PROP_URI: @@ -403,7 +404,7 @@ gtk_link_button_set_property (GObject *object, GParamSpec *pspec) { GtkLinkButton *link_button = GTK_LINK_BUTTON (object); - + switch (prop_id) { case PROP_URI: @@ -479,13 +480,31 @@ static gboolean gtk_link_button_activate_link (GtkLinkButton *link_button) { GtkWidget *toplevel; - GtkUriLauncher *launcher; + const char *uri_scheme; toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (link_button))); - launcher = gtk_uri_launcher_new (link_button->uri); - gtk_uri_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL); - g_object_unref (launcher); + uri_scheme = g_uri_peek_scheme (link_button->uri); + if (g_strcmp0 (uri_scheme, "file") == 0) + { + GFile *file = g_file_new_for_uri (link_button->uri); + GtkFileLauncher *launcher; + + launcher = gtk_file_launcher_new (file); + + gtk_file_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL); + + g_object_unref (launcher); + g_object_unref (file); + } + else + { + GtkUriLauncher *launcher = gtk_uri_launcher_new (link_button->uri); + + gtk_uri_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL); + + g_object_unref (launcher); + } gtk_link_button_set_visited (link_button, TRUE); @@ -521,9 +540,9 @@ gtk_link_button_new (const char *uri) { char *utf8_uri = NULL; GtkWidget *retval; - + g_return_val_if_fail (uri != NULL, NULL); - + if (g_utf8_validate (uri, -1, NULL)) { utf8_uri = g_strdup (uri); @@ -531,7 +550,7 @@ gtk_link_button_new (const char *uri) else { GError *conv_err = NULL; - + utf8_uri = g_locale_to_utf8 (uri, -1, NULL, NULL, &conv_err); if (conv_err) { @@ -540,18 +559,18 @@ gtk_link_button_new (const char *uri) uri, conv_err->message); g_error_free (conv_err); - + utf8_uri = g_strdup (_("Invalid URI")); } } - + retval = g_object_new (GTK_TYPE_LINK_BUTTON, "label", utf8_uri, "uri", uri, NULL); - + g_free (utf8_uri); - + return retval; } @@ -569,9 +588,9 @@ gtk_link_button_new_with_label (const char *uri, const char *label) { GtkWidget *retval; - + g_return_val_if_fail (uri != NULL, NULL); - + if (!label) return gtk_link_button_new (uri); @@ -583,7 +602,7 @@ gtk_link_button_new_with_label (const char *uri, return retval; } -static gboolean +static gboolean gtk_link_button_query_tooltip_cb (GtkWidget *widget, int x, int y, -- cgit v1.2.1 From 28e56d0dde37679db6372408fa6e71e3f8c7f190 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 16 Mar 2023 16:06:49 -0400 Subject: 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 de3c1d0c73987225869908, for GtkLabel. Fixes: #5671 --- gtk/gtklabel.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 19a8b8f027..49908566dc 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -29,10 +29,10 @@ #include "gtkbuildable.h" #include "gtkeventcontrollermotion.h" #include "gtkeventcontrollerfocus.h" +#include "gtkfilelauncher.h" #include "gtkgesturedrag.h" #include "gtkgestureclick.h" #include "gtkgesturesingle.h" -#include #include "gtkmarshalers.h" #include "gtknotebook.h" #include "gtkpangoprivate.h" @@ -59,6 +59,7 @@ #include #include #include +#include /** * GtkLabel: @@ -2102,14 +2103,31 @@ gtk_label_activate_link (GtkLabel *self, { GtkWidget *widget = GTK_WIDGET (self); GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); - GtkUriLauncher *launcher; + const char *uri_scheme; if (!GTK_IS_WINDOW (toplevel)) return FALSE; - launcher = gtk_uri_launcher_new (uri); - gtk_uri_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL); - g_object_unref (launcher); + uri_scheme = g_uri_peek_scheme (uri); + if (g_strcmp0 (uri_scheme, "file") == 0) + { + GFile *file; + GtkFileLauncher *launcher; + + file = g_file_new_for_uri (uri); + launcher = gtk_file_launcher_new (file); + gtk_file_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL); + g_object_unref (launcher); + g_object_unref (file); + } + else + { + GtkUriLauncher *launcher; + + launcher = gtk_uri_launcher_new (uri); + gtk_uri_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL); + g_object_unref (launcher); + } return TRUE; } -- cgit v1.2.1 From 53655c10415abd2f21f5973d39977d5168cf71b3 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 16 Mar 2023 23:36:00 +0100 Subject: 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. --- gsk/gl/gskgldriver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c index 727ce079bb..da2bfb51bb 100644 --- a/gsk/gl/gskgldriver.c +++ b/gsk/gl/gskgldriver.c @@ -733,7 +733,7 @@ gsk_gl_driver_load_texture (GskGLDriver *self, format = GL_RGBA8; - if (GDK_IS_GL_TEXTURE (texture)) + if (GDK_IS_GL_TEXTURE (texture) && min_filter == GL_LINEAR && mag_filter == GL_LINEAR) { GdkGLTexture *gl_texture = (GdkGLTexture *) texture; GdkGLContext *texture_context = gdk_gl_texture_get_context (gl_texture); -- cgit v1.2.1 From dd8bd8ad15e2364af54beb482ae0f59b3dd29680 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 17 Mar 2023 08:56:23 -0400 Subject: docs: Update broadway docs Using Broadway without broadwayd hasn't worked since 2013... Fixes: #5662 --- docs/reference/gtk/broadway.md | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/docs/reference/gtk/broadway.md b/docs/reference/gtk/broadway.md index 99987845cf..6877dd0c02 100644 --- a/docs/reference/gtk/broadway.md +++ b/docs/reference/gtk/broadway.md @@ -6,22 +6,15 @@ Slug: broadway The GDK Broadway backend provides support for displaying GTK applications in a web browser, using HTML5 and web sockets. -To run your application in this way, select the Broadway backend by setting -`GDK_BACKEND=broadway`. Then you can make your application appear in a web -browser by pointing it at `http://127.0.0.1:8080`. Note that you need to -enable web sockets in your web browser. - -You can choose a different port from the default 8080 by setting the -`BROADWAY_DISPLAY` environment variable to the port that you want to use. - -It is also possible to use multiple GTK applications in the same web browser -window, by using the Broadway server, `gtk4-broadwayd`, that ships with GTK. -To start the Broadway server use: +To run your application in this way, first run the broadway server, +`gtk-broadwayd`, that ships with GTK: ``` gtk4-broadwayd :5 ``` +The server expects the colon-prefixed display number as a commandline argument. + Then point your web browser at `http://127.0.0.1:8085`. Once the Broadway server is running, you can start your applications like @@ -31,6 +24,8 @@ this: GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo ``` +Multiple applications can be presented in the same web browser window. + ## Broadway-specific environment variables ### `BROADWAY_DISPLAY` -- cgit v1.2.1 From ee22a3ea36cf4aebd3a98190343fb5f1b22b2ebf Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 17 Mar 2023 10:59:05 -0400 Subject: 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. --- gdk/broadway/broadway-server.c | 8 ++++---- gdk/broadway/broadway-server.h | 3 ++- gdk/broadway/broadwayd.c | 5 ++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gdk/broadway/broadway-server.c b/gdk/broadway/broadway-server.c index f48ff0157d..6f6d6667bb 100644 --- a/gdk/broadway/broadway-server.c +++ b/gdk/broadway/broadway-server.c @@ -1574,7 +1574,8 @@ broadway_server_query_mouse (BroadwayServer *server, void broadway_server_destroy_surface (BroadwayServer *server, - int id) + int id, + gboolean disconnected) { BroadwaySurface *surface; gint32 transient_for = -1; @@ -1589,8 +1590,7 @@ broadway_server_destroy_surface (BroadwayServer *server, server->pointer_grab_surface_id = -1; if (server->output) - broadway_output_destroy_surface (server->output, - id); + broadway_output_destroy_surface (server->output, id); surface = broadway_server_lookup_surface (server, id); if (surface != NULL) @@ -1604,7 +1604,7 @@ broadway_server_destroy_surface (BroadwayServer *server, broadway_surface_free (server, surface); } - if (transient_for != -1) + if (transient_for != -1 && !disconnected) { surface = broadway_server_lookup_surface (server, transient_for); if (surface != NULL) diff --git a/gdk/broadway/broadway-server.h b/gdk/broadway/broadway-server.h index 1f7faad7ea..dc562b7056 100644 --- a/gdk/broadway/broadway-server.h +++ b/gdk/broadway/broadway-server.h @@ -93,7 +93,8 @@ guint32 broadway_server_new_surface (BroadwayServer * int width, int height); void broadway_server_destroy_surface (BroadwayServer *server, - int id); + int id, + gboolean disconnected); gboolean broadway_server_surface_show (BroadwayServer *server, int id); gboolean broadway_server_surface_hide (BroadwayServer *server, diff --git a/gdk/broadway/broadwayd.c b/gdk/broadway/broadwayd.c index 2d1b4c1865..4ca99b4a10 100644 --- a/gdk/broadway/broadwayd.c +++ b/gdk/broadway/broadwayd.c @@ -101,8 +101,7 @@ client_disconnected (BroadwayClient *client) } for (l = client->surfaces; l != NULL; l = l->next) - broadway_server_destroy_surface (server, - GPOINTER_TO_UINT (l->data)); + broadway_server_destroy_surface (server, GPOINTER_TO_UINT (l->data), TRUE); g_list_free (client->surfaces); client->surfaces = NULL; @@ -268,7 +267,7 @@ client_handle_request (BroadwayClient *client, client->surfaces = g_list_remove (client->surfaces, GUINT_TO_POINTER (request->destroy_surface.id)); - broadway_server_destroy_surface (server, request->destroy_surface.id); + broadway_server_destroy_surface (server, request->destroy_surface.id, FALSE); break; case BROADWAY_REQUEST_SHOW_SURFACE: broadway_server_surface_show (server, request->show_surface.id); -- cgit v1.2.1 From 9ca65eb78706f5a8bfc1ba81ace0275bc5f04d09 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 17 Mar 2023 11:48:44 -0400 Subject: gtk-demo: Reset properties when the image changes --- demos/gtk-demo/demo3widget.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/demos/gtk-demo/demo3widget.c b/demos/gtk-demo/demo3widget.c index 147ccf571d..e2ddf744e1 100644 --- a/demos/gtk-demo/demo3widget.c +++ b/demos/gtk-demo/demo3widget.c @@ -224,7 +224,14 @@ demo3_widget_set_property (GObject *object, 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: -- cgit v1.2.1 From 806639d974a1ce90ff6bc3f46845aff4490ea50b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 17 Mar 2023 23:35:45 -0400 Subject: Stop binding textdomain for -properties We don't have these translations anymore. --- gtk/gtkmain.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 33109a0bc8..ad41fa5749 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -510,10 +510,8 @@ gettext_initialization (void) setlocale_initialization (); bindtextdomain (GETTEXT_PACKAGE, _gtk_get_localedir ()); - bindtextdomain (GETTEXT_PACKAGE "-properties", _gtk_get_localedir ()); #ifdef HAVE_BIND_TEXTDOMAIN_CODESET bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - bind_textdomain_codeset (GETTEXT_PACKAGE "-properties", "UTF-8"); #endif } -- cgit v1.2.1 From 370b72c674362de9a3db1a655e1cbf2742a83fac Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 19 Apr 2023 08:13:55 +0200 Subject: 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. --- gsk/gl/gskglrenderjob.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gsk/gl/gskglrenderjob.c b/gsk/gl/gskglrenderjob.c index 30d7c9cc51..ec3e612f30 100644 --- a/gsk/gl/gskglrenderjob.c +++ b/gsk/gl/gskglrenderjob.c @@ -272,6 +272,7 @@ node_supports_2d_transform (const GskRenderNode *node) case GSK_CAIRO_NODE: case GSK_BLEND_NODE: case GSK_BLUR_NODE: + case GSK_MASK_NODE: return TRUE; case GSK_SHADOW_NODE: -- cgit v1.2.1 From 24f615cad13be5cc2f5f6672ae3728178092e7cc Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 19 Apr 2023 09:19:12 +0200 Subject: gsk: Use explicit switches This makes it harder to forget to add new node types here. --- gsk/gl/gskglrenderjob.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/gsk/gl/gskglrenderjob.c b/gsk/gl/gskglrenderjob.c index ec3e612f30..9aa5123cdc 100644 --- a/gsk/gl/gskglrenderjob.c +++ b/gsk/gl/gskglrenderjob.c @@ -254,7 +254,7 @@ gsk_rounded_rect_shrink_to_minimum (GskRoundedRect *self) static inline gboolean G_GNUC_PURE node_supports_2d_transform (const GskRenderNode *node) { - switch ((int)gsk_render_node_get_node_type (node)) + switch (gsk_render_node_get_node_type (node)) { case GSK_COLOR_NODE: case GSK_OPACITY_NODE: @@ -289,8 +289,18 @@ node_supports_2d_transform (const GskRenderNode *node) } return TRUE; - default: + case GSK_BORDER_NODE: + case GSK_INSET_SHADOW_NODE: + case GSK_OUTSET_SHADOW_NODE: + case GSK_REPEAT_NODE: + case GSK_CLIP_NODE: + case GSK_ROUNDED_CLIP_NODE: + case GSK_GL_SHADER_NODE: return FALSE; + + case GSK_NOT_A_RENDER_NODE: + default: + g_assert_not_reached (); } } @@ -304,7 +314,7 @@ node_supports_transform (const GskRenderNode *node) * opacity or color matrix. */ - switch ((int)gsk_render_node_get_node_type (node)) + switch (gsk_render_node_get_node_type (node)) { case GSK_COLOR_NODE: case GSK_OPACITY_NODE: @@ -325,8 +335,25 @@ node_supports_transform (const GskRenderNode *node) case GSK_TRANSFORM_NODE: return node_supports_transform (gsk_transform_node_get_child (node)); - default: + case GSK_CONTAINER_NODE: + case GSK_LINEAR_GRADIENT_NODE: + case GSK_REPEATING_LINEAR_GRADIENT_NODE: + case GSK_RADIAL_GRADIENT_NODE: + case GSK_REPEATING_RADIAL_GRADIENT_NODE: + case GSK_CONIC_GRADIENT_NODE: + case GSK_BORDER_NODE: + case GSK_INSET_SHADOW_NODE: + case GSK_OUTSET_SHADOW_NODE: + case GSK_REPEAT_NODE: + case GSK_CLIP_NODE: + case GSK_ROUNDED_CLIP_NODE: + case GSK_GL_SHADER_NODE: + case GSK_TEXTURE_SCALE_NODE: return FALSE; + + case GSK_NOT_A_RENDER_NODE: + default: + g_assert_not_reached (); } } -- cgit v1.2.1 From b4d33c0810857ad821418f3bbfc3709353dfdd7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 20 Mar 2023 23:38:35 +0100 Subject: 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 --- gtk/theme/Default/_common.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtk/theme/Default/_common.scss b/gtk/theme/Default/_common.scss index 6e8aa4e503..7135eba9ac 100644 --- a/gtk/theme/Default/_common.scss +++ b/gtk/theme/Default/_common.scss @@ -43,6 +43,10 @@ image:disabled { -gtk-icon-filter: opacity(0.5); } +picture:disabled { + opacity: 0.5; +} + .view, %view { color: $text_color; -- cgit v1.2.1 From 243f4b0729df95e10d969a2a9fd6aea715669336 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 Mar 2023 14:06:33 +0100 Subject: 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. --- gtk/gtkcheckbutton.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index 7b45cdf91f..a4a24fa8be 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -481,16 +481,15 @@ gtk_check_button_focus (GtkWidget *widget, } } + g_ptr_array_free (child_array, TRUE); - if (new_focus) + if (new_focus && new_focus != widget) { gtk_widget_grab_focus (new_focus); gtk_widget_activate (new_focus); + return TRUE; } - - g_ptr_array_free (child_array, TRUE); - - return TRUE; + return FALSE; } else { -- cgit v1.2.1 From 7cf72976d9453bb266d27cf1604ef7f33eac373d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 21 Mar 2023 15:04:12 +0000 Subject: fix crash with gtk_accessible_role_to_name and GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON presumably since: commit de80f503e4db282a7343aa16d2803967d4179739 Date: Thu Feb 23 14:22:20 2023 +0100 a11y: Introduce a dedicated role for toggle buttons --- gtk/gtkaccessible.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c index dad85e2e00..4cba3b637f 100644 --- a/gtk/gtkaccessible.c +++ b/gtk/gtkaccessible.c @@ -830,6 +830,7 @@ static const char *role_names[] = { [GTK_ACCESSIBLE_ROLE_TREE_ITEM] = NC_("accessibility", "tree item"), [GTK_ACCESSIBLE_ROLE_WIDGET] = NC_("accessibility", "widget"), [GTK_ACCESSIBLE_ROLE_WINDOW] = NC_("accessibility", "window"), + [GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON] = NC_("accessibility", "toggle button"), }; /*< private > -- cgit v1.2.1 From 354ceb57781b7906c1c7d3adbc0c3439ae8b51d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 24 Mar 2023 03:29:53 +0100 Subject: 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 --- gtk/gtkwidget.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 123bf17745..2f510650a0 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -10635,7 +10635,11 @@ gtk_widget_set_has_focus (GtkWidget *widget, gboolean gtk_widget_in_destruction (GtkWidget *widget) { - GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); + GtkWidgetPrivate *priv; + + g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); + + priv = gtk_widget_get_instance_private (widget); return priv->in_destruction; } -- cgit v1.2.1 From 40fdf4aa9fa10615bc3d1be64206c443a27544a1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 24 Mar 2023 08:56:06 -0400 Subject: docs: Some updates Fix some links ot point to docs.gtk.org. --- docs/reference/gtk/question_index.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/reference/gtk/question_index.md b/docs/reference/gtk/question_index.md index 44a65f8800..8355613780 100644 --- a/docs/reference/gtk/question_index.md +++ b/docs/reference/gtk/question_index.md @@ -263,10 +263,13 @@ the question you have, this list is a good place to start. * How do I load an image or animation from a file? To load an image file straight into a display widget, use - [ctor@Gtk.Picture.new_for_file] or [ctor@GTk.Picture.new_for_filename]. + [ctor@Gtk.Picture.new_for_file] or [ctor@Gtk.Picture.new_for_filename]. To load an image for another purpose, use [ctor@Gdk.Texture.new_from_file]. To load a video from a file, use [ctor@Gtk.MediaFile.new_for_file]. + Note that [class@Gtk.Image] is meant for fixed-size icons. For arbitrary + image files, you should use [class@Gtk.Picture]. + * How do I draw text? If you just want to put text into your user interface somewhere, it is @@ -283,8 +286,8 @@ the question you have, this list is a good place to start. pango_font_description_free (fontdesc); g_object_unref (layout); - See also the [Cairo Rendering](https://developer.gnome.org/pango/stable/pango-Cairo-Rendering.html) - section of the [Pango documentation](https://developer.gnome.org/pango/stable/). + See also the [Cairo Rendering](https://docs.gtk.org/PangoCairo/pango_cairo.html) + section of the [Pango documentation](https://docs.gtk.org/Pango/). To draw a piece of text in a widget [vfunc@Gtk.Widget.snapshot] implementation, use [method@Gtk.Snapshot.append_layout]. @@ -301,8 +304,8 @@ the question you have, this list is a good place to start. pango_font_description_free (fontdesc); g_object_unref (layout); - See also the [Layout Objects](https://developer.gnome.org/pango/stable/pango-Layout-Objects.html) - section of the [Pango documentation](https://developer.gnome.org/pango/stable/). + See also the [Layout Objects](https://docs.gtk.org/Pango/class.Layout.html) + section of the [Pango documentation](https://docs.gtk.org/Pango/). * Why are types not registered if I use their `GTK_TYPE_BLAH` macro? -- cgit v1.2.1 From 4897ff02781acf1ec9964ccbf9945e6956e57e2a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 24 Mar 2023 09:42:25 -0400 Subject: docs: Improve markup for keys Consistently use x to render keys in the docs and use + for key combinations. --- docs/reference/gtk/input-handling.md | 6 +++--- gtk/gtkbutton.c | 6 +++++- gtk/gtkcheckbutton.c | 3 +++ gtk/gtklabel.c | 15 ++++++++------ gtk/gtktext.c | 24 +++++++++++----------- gtk/gtktextview.c | 40 +++++++++++++++++++----------------- gtk/gtkwidget.c | 5 +++++ 7 files changed, 58 insertions(+), 41 deletions(-) diff --git a/docs/reference/gtk/input-handling.md b/docs/reference/gtk/input-handling.md index bc40e5d12d..59983f092d 100644 --- a/docs/reference/gtk/input-handling.md +++ b/docs/reference/gtk/input-handling.md @@ -103,14 +103,14 @@ fields, but e.g. buttons can take the focus too. Input widgets can be given the focus by clicking on them, but focus can also be moved around with certain key events (this is known as -“keyboard navigation”). GTK reserves the Tab key to move the focus -to the next location, and Shift-Tab to move it back to the previous +“keyboard navigation”). GTK reserves the Tab key to move the focus +to the next location, and Shift+Tab to move it back to the previous one. In addition many containers allow “directional navigation” with the arrow keys. Many widgets can be “activated” to trigger and action. E.g., you can activate a button or switch by clicking on them, but you can also -activate them with the keyboard, by using the Enter or Space keys. +activate them with the keyboard, by using the Enter or keys. Apart from keyboard navigation, activation and directly typing into entries or text views, GTK widgets can use key events for activating diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 318f68f308..d85586c82e 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -288,6 +288,9 @@ gtk_button_class_init (GtkButtonClass *klass) * * This is an action signal. Applications should never connect * to this signal, but use the [signal@Gtk.Button::clicked] signal. + * + * The default bindings for this signal are all forms of the + * and Enter keys. */ button_signals[ACTIVATE] = g_signal_new (I_("activate"), @@ -669,7 +672,8 @@ gtk_button_new_from_icon_name (const char *icon_name) * If characters in @label are preceded by an underscore, they are underlined. * If you need a literal underscore character in a label, use “__” (two * underscores). The first underlined character represents a keyboard - * accelerator called a mnemonic. Pressing Alt and that key activates the button. + * accelerator called a mnemonic. Pressing Alt and that key + * activates the button. * * Returns: a new `GtkButton` */ diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index a4a24fa8be..b639f78faa 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -672,6 +672,9 @@ gtk_check_button_class_init (GtkCheckButtonClass *class) * Applications should never connect to this signal, but use the * [signal@Gtk.CheckButton::toggled] signal. * + * The default bindings for this signal are all forms of the + * and Enter keys. + * * Since: 4.2 */ signals[ACTIVATE] = diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 49908566dc..3df6d2683e 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -2237,9 +2237,11 @@ gtk_label_class_init (GtkLabelClass *class) * the variant with the Shift modifier extends the selection, * the variant without the Shift modifier does not. * There are too many key combinations to list them all here. - * - Arrow keys move by individual characters/lines - * - Ctrl-arrow key combinations move by words/paragraphs - * - Home/End keys move to the ends of the buffer + * + * - , , , + * move by individual characters/lines + * - Ctrl+, etc. move by words/paragraphs + * - Home and End move to the ends of the buffer */ signals[MOVE_CURSOR] = g_signal_new (I_("move-cursor"), @@ -2261,7 +2263,7 @@ gtk_label_class_init (GtkLabelClass *class) * * The ::copy-clipboard signal is a [keybinding signal](class.SignalAction.html). * - * The default binding for this signal is Ctrl-c. + * The default binding for this signal is Ctrl+c. */ signals[COPY_CLIPBOARD] = g_signal_new (I_("copy-clipboard"), @@ -2283,7 +2285,7 @@ gtk_label_class_init (GtkLabelClass *class) * Applications may also emit the signal with g_signal_emit_by_name() * if they need to control activation of URIs programmatically. * - * The default bindings for this signal are all forms of the Enter key. + * The default bindings for this signal are all forms of the Enter key. */ signals[ACTIVATE_CURRENT_LINK] = g_signal_new_class_handler (I_("activate-current-link"), @@ -2361,7 +2363,8 @@ gtk_label_class_init (GtkLabelClass *class) /** * GtkLabel:use-underline: (attributes org.gtk.Property.get=gtk_label_get_use_underline org.gtk.Property.set=gtk_label_set_use_underline) * - * %TRUE if the text of the label indicates a mnemonic with _. + * %TRUE if the text of the label indicates a mnemonic with an _ + * before the mnemonic character. */ label_props[PROP_USE_UNDERLINE] = g_param_spec_boolean ("use-underline", NULL, NULL, diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 53335ced05..98733b0f36 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -982,7 +982,7 @@ gtk_text_class_init (GtkTextClass *class) * GtkText::activate: * @self: The widget on which the signal is emitted * - * Emitted when the user hits the Enter key. + * Emitted when the user hits the Enter key. * * The default bindings for this signal are all forms * of the Enter key. @@ -1021,8 +1021,8 @@ gtk_text_class_init (GtkTextClass *class) * * - , , , * move by individual characters/lines - * - Ctrl-, etc. move by words/paragraphs - * - Home, End move to the ends of the buffer + * - Ctrl+, etc. move by words/paragraphs + * - Home and End move to the ends of the buffer */ signals[MOVE_CURSOR] = g_signal_new (I_("move-cursor"), @@ -1073,7 +1073,7 @@ gtk_text_class_init (GtkTextClass *class) * of characters. * * The default bindings for this signal are Delete - * for deleting a character and Ctrl-Delete + * for deleting a character and Ctrl+Delete * for deleting a word. */ signals[DELETE_FROM_CURSOR] = @@ -1096,7 +1096,7 @@ gtk_text_class_init (GtkTextClass *class) * This is a [keybinding signal](class.SignalAction.html). * * The default bindings for this signal are - * Backspace and Shift-Backspace. + * Backspace and Shift+Backspace. */ signals[BACKSPACE] = g_signal_new (I_("backspace"), @@ -1116,8 +1116,8 @@ gtk_text_class_init (GtkTextClass *class) * This is a [keybinding signal](class.SignalAction.html). * * The default bindings for this signal are - * Ctrl-x and - * Shift-Delete. + * Ctrl+x and + * Shift+Delete. */ signals[CUT_CLIPBOARD] = g_signal_new (I_("cut-clipboard"), @@ -1137,8 +1137,8 @@ gtk_text_class_init (GtkTextClass *class) * This is a [keybinding signal](class.SignalAction.html). * * The default bindings for this signal are - * Ctrl-c and - * Ctrl-Insert. + * Ctrl+c and + * Ctrl+Insert. */ signals[COPY_CLIPBOARD] = g_signal_new (I_("copy-clipboard"), @@ -1158,7 +1158,7 @@ gtk_text_class_init (GtkTextClass *class) * This is a [keybinding signal](class.SignalAction.html). * * The default bindings for this signal are - * Ctrl-v and Shift-Insert. + * Ctrl+v and Shift+Insert. */ signals[PASTE_CLIPBOARD] = g_signal_new (I_("paste-clipboard"), @@ -1218,8 +1218,8 @@ gtk_text_class_init (GtkTextClass *class) * This is a [keybinding signal](class.SignalAction.html). * * The default bindings for this signal are - * Ctrl-. and - * Ctrl-; + * Ctrl+. and + * Ctrl+; */ signals[INSERT_EMOJI] = g_signal_new (I_("insert-emoji"), diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 65b4816bff..465e5cd25b 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -1171,10 +1171,10 @@ gtk_text_view_class_init (GtkTextViewClass *klass) * * - , , , * move by individual characters/lines - * - Ctrl-, etc. move by words/paragraphs - * - Home, End move to the ends of the buffer - * - PgUp, PgDn move vertically by pages - * - Ctrl-PgUp, Ctrl-PgDn + * - Ctrl+, etc. move by words/paragraphs + * - Home and End move to the ends of the buffer + * - PgUp and PgDn move vertically by pages + * - Ctrl+PgUp and Ctrl+PgDn * move horizontally by pages */ signals[MOVE_CURSOR] = @@ -1280,8 +1280,8 @@ gtk_text_view_class_init (GtkTextViewClass *klass) * of characters. * * The default bindings for this signal are Delete for - * deleting a character, Ctrl-Delete for - * deleting a word and Ctrl-Backspace for + * deleting a character, Ctrl+Delete for + * deleting a word and Ctrl+Backspace for * deleting a word backwards. */ signals[DELETE_FROM_CURSOR] = @@ -1307,7 +1307,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass) * The ::backspace signal is a [keybinding signal](class.SignalAction.html). * * The default bindings for this signal are - * Backspace and Shift-Backspace. + * Backspace and Shift+Backspace. */ signals[BACKSPACE] = g_signal_new (I_("backspace"), @@ -1327,8 +1327,8 @@ gtk_text_view_class_init (GtkTextViewClass *klass) * The ::cut-clipboard signal is a [keybinding signal](class.SignalAction.html). * * The default bindings for this signal are - * Ctrl-x and - * Shift-Delete. + * Ctrl+x and + * Shift+Delete. */ signals[CUT_CLIPBOARD] = g_signal_new (I_("cut-clipboard"), @@ -1348,8 +1348,8 @@ gtk_text_view_class_init (GtkTextViewClass *klass) * The ::copy-clipboard signal is a [keybinding signal](class.SignalAction.html). * * The default bindings for this signal are - * Ctrl-c and - * Ctrl-Insert. + * Ctrl+c and + * Ctrl+Insert. */ signals[COPY_CLIPBOARD] = g_signal_new (I_("copy-clipboard"), @@ -1370,8 +1370,8 @@ gtk_text_view_class_init (GtkTextViewClass *klass) * The ::paste-clipboard signal is a [keybinding signal](class.SignalAction.html). * * The default bindings for this signal are - * Ctrl-v and - * Shift-Insert. + * Ctrl+v and + * Shift+Insert. */ signals[PASTE_CLIPBOARD] = g_signal_new (I_("paste-clipboard"), @@ -1411,10 +1411,10 @@ gtk_text_view_class_init (GtkTextViewClass *klass) * The ::select-all signal is a [keybinding signal](class.SignalAction.html). * * The default bindings for this signal are - * Ctrl-a and - * Ctrl-/ for selecting and - * Shift-Ctrl-a and - * Ctrl-\ for unselecting. + * Ctrl+a and + * Ctrl+/ for selecting and + * Shift+Ctrl+a and + * Ctrl+\ for unselecting. */ signals[SELECT_ALL] = g_signal_new_class_handler (I_("select-all"), @@ -1507,8 +1507,8 @@ gtk_text_view_class_init (GtkTextViewClass *klass) * The ::insert-emoji signal is a [keybinding signal](class.SignalAction.html). * * The default bindings for this signal are - * Ctrl-. and - * Ctrl-; + * Ctrl+. and + * Ctrl+; */ signals[INSERT_EMOJI] = g_signal_new (I_("insert-emoji"), @@ -7173,6 +7173,8 @@ gtk_text_view_set_overwrite (GtkTextView *text_view, * If @accepts_tab is %TRUE, a tab character is inserted. If @accepts_tab * is %FALSE the keyboard focus is moved to the next widget in the focus * chain. + * + * Focus can always be moved using Ctrl+Tab. */ void gtk_text_view_set_accepts_tab (GtkTextView *text_view, diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 2f510650a0..162beee68c 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -1837,6 +1837,11 @@ gtk_widget_class_init (GtkWidgetClass *klass) * @direction: the direction of the focus move * * Emitted when the focus is moved. + * + * The ::move-focus signal is a [keybinding signal](class.SignalAction.html). + * + * The default bindings for this signal are Tab to move forward, + * and Shift+Tab to move backward. */ widget_signals[MOVE_FOCUS] = g_signal_new (I_("move-focus"), -- cgit v1.2.1 From bb48a02a77c6c7501898d4e11f57cdab2031bbfb Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 24 Mar 2023 14:47:27 -0400 Subject: 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 --- gtk/gtkpopover.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index 78dc4034c2..e60f9ea4df 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -443,17 +443,39 @@ create_popup_layout (GtkPopover *popover) GtkWidget *parent; GtkCssStyle *style; GtkBorder shadow_width; + GtkNative *native; + double nx, ny; + graphene_rect_t bounds; parent = gtk_widget_get_parent (GTK_WIDGET (popover)); - gtk_widget_get_surface_allocation (parent, &rect); + native = gtk_widget_get_native (parent); + if (priv->has_pointing_to) { - rect.x += priv->pointing_to.x; - rect.y += priv->pointing_to.y; - rect.width = priv->pointing_to.width; - rect.height = priv->pointing_to.height; + graphene_matrix_t transform; + graphene_rect_t pointing_to = GRAPHENE_RECT_INIT (priv->pointing_to.x, + priv->pointing_to.y, + priv->pointing_to.width, + priv->pointing_to.height); + + if (!gtk_widget_compute_transform (parent, GTK_WIDGET (native), &transform)) + graphene_matrix_init_identity (&transform); + + graphene_matrix_transform_bounds (&transform, &pointing_to, &bounds); + } + else + { + if (!gtk_widget_compute_bounds (parent, GTK_WIDGET (native), &bounds)) + g_warning ("Failed to compute bounds"); } + gtk_native_get_surface_transform (native, &nx, &ny); + + rect.x = (int) floor (bounds.origin.x + nx); + rect.y = (int) floor (bounds.origin.y + ny); + rect.width = (int) ceilf (bounds.size.width); + rect.width = (int) ceilf (bounds.size.height); + style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (priv->contents_widget))); gtk_css_shadow_value_get_extents (style->background->box_shadow, &shadow_width); -- cgit v1.2.1 From b02ade43c302be5a17a7f0d502d5386ff22bd2b4 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 24 Mar 2023 14:49:18 -0400 Subject: 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. --- gtk/gtktexthandle.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c index a373c6527c..40e6c9c191 100644 --- a/gtk/gtktexthandle.c +++ b/gtk/gtktexthandle.c @@ -131,15 +131,26 @@ gtk_text_handle_present_surface (GtkTextHandle *handle) GdkRectangle rect; GtkRequisition req; GtkWidget *parent; + GtkNative *native; + graphene_point_t point = GRAPHENE_POINT_INIT (handle->pointing_to.x, handle->pointing_to.y); + graphene_point_t transformed; + double nx, ny; gtk_widget_get_preferred_size (widget, NULL, &req); gtk_text_handle_get_padding (handle, &handle->border); parent = gtk_widget_get_parent (widget); - gtk_widget_get_surface_allocation (parent, &rect); - rect.x += handle->pointing_to.x; - rect.y += handle->pointing_to.y + handle->pointing_to.height - handle->border.top; + native = gtk_widget_get_native (parent); + gtk_native_get_surface_transform (native, &nx, &ny); + + if (!gtk_widget_compute_point (parent, GTK_WIDGET (native), + &point, &transformed)) + transformed = point; + + rect.x = (int)(transformed.x + nx); + rect.y = (int)(transformed.y + ny) + handle->pointing_to.height - handle->border.top; + rect.width = req.width - handle->border.left - handle->border.right; rect.height = 1; -- cgit v1.2.1 From 1b2ae02b2616b4e570492276809e946be6af1960 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 24 Mar 2023 15:30:27 -0400 Subject: 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. --- gtk/gtkmagnifier.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/gtk/gtkmagnifier.c b/gtk/gtkmagnifier.c index 04db746c44..e606ae23e8 100644 --- a/gtk/gtkmagnifier.c +++ b/gtk/gtkmagnifier.c @@ -20,6 +20,7 @@ #include "gtkmagnifierprivate.h" #include "gtkwidgetprivate.h" #include "gtksnapshot.h" +#include "gtkcssboxesprivate.h" enum { PROP_INSPECTED = 1, @@ -105,10 +106,23 @@ gtk_magnifier_snapshot (GtkWidget *widget, { GtkMagnifier *magnifier = GTK_MAGNIFIER (widget); double width, height, paintable_width, paintable_height; - - if (gtk_widget_paintable_get_widget (GTK_WIDGET_PAINTABLE (magnifier->paintable)) == NULL) + GtkWidget *inspected; + GtkCssBoxes boxes; + const graphene_rect_t *content_rect; + const graphene_rect_t *border_rect; + graphene_point_t offset; + + inspected = gtk_widget_paintable_get_widget (GTK_WIDGET_PAINTABLE (magnifier->paintable)); + if (inspected == NULL) return; + gtk_css_boxes_init (&boxes, inspected); + content_rect = gtk_css_boxes_get_content_rect (&boxes); + border_rect = gtk_css_boxes_get_border_rect (&boxes); + + offset.x = content_rect->origin.x - border_rect->origin.x; + offset.y = content_rect->origin.y - border_rect->origin.y; + width = gtk_widget_get_width (widget); height = gtk_widget_get_height (widget); paintable_width = gdk_paintable_get_intrinsic_width (magnifier->paintable); @@ -121,8 +135,8 @@ gtk_magnifier_snapshot (GtkWidget *widget, gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (width / 2, height / 2)); gtk_snapshot_scale (snapshot, magnifier->magnification, magnifier->magnification); gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT ( - - CLAMP (magnifier->x, 0, paintable_width), - - CLAMP (magnifier->y, 0, paintable_height))); + - CLAMP (magnifier->x + offset.x, 0, paintable_width), + - CLAMP (magnifier->y + offset.y, 0, paintable_height))); gdk_paintable_snapshot (magnifier->paintable, snapshot, paintable_width, paintable_height); gtk_snapshot_restore (snapshot); -- cgit v1.2.1 From 47e90f1de659b0ca5d056b139894dcaa91841fe4 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Sun, 26 Mar 2023 15:48:44 +0100 Subject: 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. --- gdk/gdktoplevel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gdk/gdktoplevel.c b/gdk/gdktoplevel.c index a7e4e42fcf..5a5c9e4d0f 100644 --- a/gdk/gdktoplevel.c +++ b/gdk/gdktoplevel.c @@ -261,15 +261,16 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface) /** * GdkToplevel::compute-size: * @toplevel: a `GdkToplevel` - * @size: (type Gdk.ToplevelSize) (out caller-allocates): a `GdkToplevelSize` + * @size: (type Gdk.ToplevelSize): a `GdkToplevelSize` * * Emitted when the size for the surface needs to be computed, when * it is present. * - * It will normally be emitted during or after [method@Gdk.Toplevel.present], - * depending on the configuration received by the windowing system. - * It may also be emitted at any other point in time, in response - * to the windowing system spontaneously changing the configuration. + * This signal will normally be emitted during or after a call to + * [method@Gdk.Toplevel.present], depending on the configuration + * received by the windowing system. It may also be emitted at any + * other point in time, in response to the windowing system + * spontaneously changing the configuration of the toplevel surface. * * It is the responsibility of the toplevel user to handle this signal * and compute the desired size of the toplevel, given the information -- cgit v1.2.1 From 1b07d02671c9586ed5a143d462362032f643ac35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tyrychtr?= Date: Tue, 28 Mar 2023 15:07:03 +0200 Subject: 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 --- gtk/a11y/gtkatspicontext.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c index e9339a7387..aa5e7a4a98 100644 --- a/gtk/a11y/gtkatspicontext.c +++ b/gtk/a11y/gtkatspicontext.c @@ -142,10 +142,10 @@ collect_states (GtkAtSpiContext *self, accessible = gtk_at_context_get_accessible (ctx); set_atspi_state (&states, ATSPI_STATE_VISIBLE); + set_atspi_state (&states, ATSPI_STATE_SHOWING); if (ctx->accessible_role == GTK_ACCESSIBLE_ROLE_WINDOW) { - set_atspi_state (&states, ATSPI_STATE_SHOWING); if (gtk_accessible_get_platform_state (accessible, GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE)) set_atspi_state (&states, ATSPI_STATE_ACTIVE); } @@ -918,6 +918,7 @@ gtk_at_spi_context_state_change (GtkATContext *ctx, { gtk_at_spi_root_child_changed (self->root, change, accessible); emit_state_changed (self, "showing", gtk_boolean_accessible_value_get (value)); + emit_state_changed (self, "visible", gtk_boolean_accessible_value_get (value)); } else { -- cgit v1.2.1 From 6a566648d29f5298ac86e26100e22486a3f621a9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 30 Mar 2023 14:12:54 -0400 Subject: listitem: Fix a notification problem We were notifying ::item when ::child is changed. Oops --- gtk/gtklistitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c index 28614b62f8..f8a9e36036 100644 --- a/gtk/gtklistitem.c +++ b/gtk/gtklistitem.c @@ -323,7 +323,7 @@ gtk_list_item_set_child (GtkListItem *self, gtk_list_item_widget_add_child (self->owner, child); } - g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ITEM]); + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CHILD]); } /** -- cgit v1.2.1 From 67d8b4c97664ebca9cbed5ee74f1870b29017ffd Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Sat, 1 Apr 2023 12:06:11 +0000 Subject: docs: Improve GtkLabel rendering By adding some missing links & avoid the browser from rendering the entities as their equivalent symbols --- gtk/gtklabel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 3df6d2683e..5342ac7833 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -175,11 +175,11 @@ * (See the Pango manual for complete documentation] of available * tags, [func@Pango.parse_markup]) * - * The markup passed to gtk_label_set_markup() must be valid; for example, - * literal <, > and & characters must be escaped as <, >, and &. + * The markup passed to [method@Gtk.Label.set_markup] must be valid; for example, + * literal `<`, `>` and `&` characters must be escaped as `<`, `>`, and `&`. * If you pass text obtained from the user, file, or a network to * [method@Gtk.Label.set_markup], you’ll want to escape it with - * g_markup_escape_text() or g_markup_printf_escaped(). + * [func@GLib.markup_escape_text] or [func@GLib.markup_printf_escaped]. * * Markup strings are just a convenient way to set the [struct@Pango.AttrList] * on a label; [method@Gtk.Label.set_attributes] may be a simpler way to set -- cgit v1.2.1 From a14ac90229e17862feb269e9c7b2c10303d13f3d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 1 Apr 2023 09:45:58 -0400 Subject: 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. --- gtk/inspector/general.ui | 7 ------- 1 file changed, 7 deletions(-) diff --git a/gtk/inspector/general.ui b/gtk/inspector/general.ui index a313a9e22c..2fc389c635 100644 --- a/gtk/inspector/general.ui +++ b/gtk/inspector/general.ui @@ -747,13 +747,6 @@ - - - - - - - -- cgit v1.2.1 From e09a5bc2dd05e90595e3aff0e09731a9d993f1a1 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sat, 1 Apr 2023 11:38:22 -0300 Subject: gsk/gl/renderjob: Decompose matrix for 3D transforms While this can be more expensive, it's also correct. --- gsk/gl/gskglrenderjob.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/gsk/gl/gskglrenderjob.c b/gsk/gl/gskglrenderjob.c index 9aa5123cdc..863d1efd31 100644 --- a/gsk/gl/gskglrenderjob.c +++ b/gsk/gl/gskglrenderjob.c @@ -563,23 +563,21 @@ extract_matrix_metadata (GskGLRenderModelview *modelview) case GSK_TRANSFORM_CATEGORY_ANY: case GSK_TRANSFORM_CATEGORY_3D: { - graphene_vec3_t col1; - graphene_vec3_t col2; - - /* TODO: 90% sure this is incorrect. But we should never hit this code - * path anyway. */ - graphene_vec3_init (&col1, - graphene_matrix_get_value (&modelview->matrix, 0, 0), - graphene_matrix_get_value (&modelview->matrix, 1, 0), - graphene_matrix_get_value (&modelview->matrix, 2, 0)); - - graphene_vec3_init (&col2, - graphene_matrix_get_value (&modelview->matrix, 0, 1), - graphene_matrix_get_value (&modelview->matrix, 1, 1), - graphene_matrix_get_value (&modelview->matrix, 2, 1)); - - modelview->scale_x = graphene_vec3_length (&col1); - modelview->scale_y = graphene_vec3_length (&col2); + graphene_quaternion_t rotation; + graphene_vec4_t perspective; + graphene_vec3_t translation; + graphene_vec3_t scale; + graphene_vec3_t shear; + + graphene_matrix_decompose (&modelview->matrix, + &translation, + &scale, + &rotation, + &shear, + &perspective); + + modelview->scale_x = graphene_vec3_get_x (&scale); + modelview->scale_y = graphene_vec3_get_y (&scale); modelview->dx = 0; modelview->dy = 0; } -- cgit v1.2.1 From 67310c875395f233c1fa6b8a9faa7c05dfee0d61 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 1 Apr 2023 14:18:27 -0400 Subject: inspector: Update some misc info rows --- gtk/inspector/misc-info.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c index 1f9c13d9f5..a9a061927e 100644 --- a/gtk/inspector/misc-info.c +++ b/gtk/inspector/misc-info.c @@ -32,6 +32,7 @@ #include "gtkmenubutton.h" #include "gtkwidgetprivate.h" #include "gtkbinlayout.h" +#include "gtkwidgetprivate.h" struct _GtkInspectorMiscInfo @@ -370,6 +371,10 @@ update_info (gpointer data) g_list_free (list); gtk_widget_set_visible (sl->tick_callback, gtk_widget_has_tick_callback (GTK_WIDGET (sl->object))); + gtk_widget_set_visible (sl->realized, gtk_widget_get_realized (GTK_WIDGET (sl->object))); + gtk_widget_set_visible (sl->mapped, gtk_widget_get_mapped (GTK_WIDGET (sl->object))); + gtk_widget_set_visible (sl->is_toplevel, GTK_IS_NATIVE (sl->object)); + gtk_widget_set_visible (sl->child_visible, _gtk_widget_get_child_visible (GTK_WIDGET (sl->object))); } update_surface (sl); @@ -497,6 +502,7 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl, gtk_widget_set_visible (sl->mapped_row, GTK_IS_WIDGET (object)); gtk_widget_set_visible (sl->realized_row, GTK_IS_WIDGET (object)); gtk_widget_set_visible (sl->is_toplevel_row, GTK_IS_WIDGET (object)); + gtk_widget_set_visible (sl->child_visible_row, GTK_IS_WIDGET (object)); gtk_widget_set_visible (sl->frame_clock_row, GTK_IS_WIDGET (object)); gtk_widget_set_visible (sl->buildable_id_row, GTK_IS_BUILDABLE (object)); gtk_widget_set_visible (sl->framecount_row, GDK_IS_FRAME_CLOCK (object)); -- cgit v1.2.1 From 9782158a9eeaf3f4f31015104c276b5999720368 Mon Sep 17 00:00:00 2001 From: Cam Cook Date: Sun, 2 Apr 2023 12:51:29 -0400 Subject: 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]" | --- gtk/gtktextiter.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c index 9ffbf581a3..b071e261eb 100644 --- a/gtk/gtktextiter.c +++ b/gtk/gtktextiter.c @@ -592,7 +592,7 @@ _gtk_text_iter_get_btree (const GtkTextIter *iter) * * Each character in a `GtkTextBuffer` has an offset, * starting with 0 for the first character in the buffer. - * Use [method@Gtk,TextBuffer.get_iter_at_offset] to convert + * Use [method@Gtk.TextBuffer.get_iter_at_offset] to convert * an offset back into an iterator. * * Returns: a character offset @@ -1198,7 +1198,7 @@ gtk_text_iter_get_toggled_tags (const GtkTextIter *iter, * @iter is at the beginning of the tagged range, and that the * character at @iter is inside the tagged range. In other * words, unlike [method@Gtk.TextIter.ends_tag], if - * this function returns %TRUE, [method@Gtk.TextIter.has_tag + * this function returns %TRUE, [method@Gtk.TextIter.has_tag] * will also return %TRUE for the same parameters. * * Returns: whether @iter is the start of a range tagged with @tag @@ -1661,7 +1661,7 @@ gtk_text_iter_ends_line (const GtkTextIter *iter) * Returns %TRUE if @iter is the end iterator. * * This means it is one past the last dereferenceable iterator - * in the buffer. gtk_text_iter_is_end() is the most efficient + * in the buffer. [method@Gtk.TextBuffer.is_end] is the most efficient * way to check whether an iterator is the end iterator. * * Returns: whether @iter is the end iterator @@ -3324,7 +3324,7 @@ gtk_text_iter_backward_word_start (GtkTextIter *iter) * @iter: a `GtkTextIter` * @count: number of times to move * - * Calls gtk_text_iter_forward_word_end() up to @count times. + * Calls [method@Gtk.TextIter.forward_word_end] up to @count times. * * Returns: %TRUE if @iter moved and is not the end iterator */ @@ -3342,7 +3342,7 @@ gtk_text_iter_forward_word_ends (GtkTextIter *iter, * @iter: a `GtkTextIter` * @count: number of times to move * - * Calls gtk_text_iter_backward_word_start() up to @count times. + * Calls [method@Gtk.TextIter.backward_word_start] up to @count times. * * Returns: %TRUE if @iter moved and is not the end iterator */ @@ -3400,7 +3400,7 @@ gtk_text_iter_backward_visible_word_start (GtkTextIter *iter) * @iter: a `GtkTextIter` * @count: number of times to move * - * Calls gtk_text_iter_forward_visible_word_end() up to @count times. + * Calls [method@Gtk.TextIter.forward_visible_word_end] up to @count times. * * Returns: %TRUE if @iter moved and is not the end iterator */ @@ -3418,7 +3418,7 @@ gtk_text_iter_forward_visible_word_ends (GtkTextIter *iter, * @iter: a `GtkTextIter` * @count: number of times to move * - * Calls gtk_text_iter_backward_visible_word_start() up to @count times. + * Calls [method@Gtk.TextIter.backward_visible_word_start] up to @count times. * * Returns: %TRUE if @iter moved and is not the end iterator */ @@ -3588,7 +3588,7 @@ gtk_text_iter_backward_sentence_start (GtkTextIter *iter) * @iter: a `GtkTextIter` * @count: number of sentences to move * - * Calls gtk_text_iter_forward_sentence_end() @count times. + * Calls [method@Gtk.TextIter.forward_sentence_end] @count times. * * If @count is negative, moves backward instead of forward. * @@ -3608,7 +3608,7 @@ gtk_text_iter_forward_sentence_ends (GtkTextIter *iter, * @iter: a `GtkTextIter` * @count: number of sentences to move * - * Calls gtk_text_iter_backward_sentence_start() up to @count times. + * Calls [method@Gtk.TextIter.backward_sentence_start] up to @count times. * * If @count is negative, moves forward instead of backward. * @@ -3712,7 +3712,7 @@ gtk_text_iter_forward_cursor_position (GtkTextIter *iter) * gtk_text_iter_backward_cursor_position: * @iter: a `GtkTextIter` * - * Like gtk_text_iter_forward_cursor_position(), but moves backward. + * Like [method@Gtk.TextIter.forward_cursor_position], but moves backward. * * Returns: %TRUE if we moved */ @@ -3782,7 +3782,7 @@ gtk_text_iter_forward_visible_cursor_position (GtkTextIter *iter) * gtk_text_iter_backward_visible_cursor_position: * @iter: a `GtkTextIter` * - * Moves @iter forward to the previous visible cursor position. + * Moves @iter backward to the previous visible cursor position. * * See [method@Gtk.TextIter.backward_cursor_position] for details. * @@ -3897,7 +3897,7 @@ gtk_text_iter_set_line_offset (GtkTextIter *iter, * @iter: a `GtkTextIter` * @byte_on_line: a byte index relative to the start of @iter’s current line * - * Same as gtk_text_iter_set_line_offset(), but works with a + * Same as [method@Gtk.TextBuffer.set_line_offset], but works with a * byte index. The given byte index must be at * the start of a character, it can’t be in the middle of a UTF-8 * encoded character. @@ -3943,7 +3943,7 @@ gtk_text_iter_set_line_index (GtkTextIter *iter, * @iter: a `GtkTextIter` * @char_on_line: a character offset * - * Like gtk_text_iter_set_line_offset(), but the offset is in visible + * Like [method@Gtk.TextBuffer.set_line_offset], but the offset is in visible * characters, i.e. text with a tag making it invisible is not * counted in the offset. */ @@ -3984,7 +3984,7 @@ gtk_text_iter_set_visible_line_offset (GtkTextIter *iter, * @iter: a `GtkTextIter` * @byte_on_line: a byte index * - * Like gtk_text_iter_set_line_index(), but the index is in visible + * Like [method@Gtk.TextBuffer.set_line_index], but the index is in visible * bytes, i.e. text with a tag making it invisible is not counted * in the index. */ @@ -4128,7 +4128,7 @@ gtk_text_iter_set_offset (GtkTextIter *iter, * Moves @iter forward to the “end iterator”, which points * one past the last valid character in the buffer. * - * gtk_text_iter_get_char() called on the end iterator + * [method@Gtk.TextIter.get_char] called on the end iterator * returns 0, which is convenient for writing loops. */ void @@ -4480,7 +4480,7 @@ gtk_text_iter_forward_find_char (GtkTextIter *iter, * @user_data: (closure): user data for @pred * @limit: (nullable): search limit * - * Same as gtk_text_iter_forward_find_char(), + * Same as [method@Gtk.TextIter.forward_find_char], * but goes backward from @iter. * * Returns: whether a match was found @@ -5292,7 +5292,7 @@ lines_window_free (LinesWindow *win) * @match_end: (out caller-allocates) (optional): return location for end of match * @limit: (nullable): location of last possible @match_start, or %NULL for start of buffer * - * Same as gtk_text_iter_forward_search(), but moves backward. + * Same as [method@Gtk.TextIter.forward_search], but moves backward. * * @match_end will never be set to a `GtkTextIter` located after @iter, * even if there is a possible @match_start before or at @iter. -- cgit v1.2.1 From fcec5a817e040209028aabeb8b58c47ec1da01c2 Mon Sep 17 00:00:00 2001 From: Cam Cook Date: Sun, 2 Apr 2023 13:12:21 -0400 Subject: 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]" | --- gtk/gtktextiter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c index b071e261eb..faadaacb58 100644 --- a/gtk/gtktextiter.c +++ b/gtk/gtktextiter.c @@ -1661,7 +1661,7 @@ gtk_text_iter_ends_line (const GtkTextIter *iter) * Returns %TRUE if @iter is the end iterator. * * This means it is one past the last dereferenceable iterator - * in the buffer. [method@Gtk.TextBuffer.is_end] is the most efficient + * in the buffer. [method@Gtk.TextIter.is_end] is the most efficient * way to check whether an iterator is the end iterator. * * Returns: whether @iter is the end iterator @@ -3897,7 +3897,7 @@ gtk_text_iter_set_line_offset (GtkTextIter *iter, * @iter: a `GtkTextIter` * @byte_on_line: a byte index relative to the start of @iter’s current line * - * Same as [method@Gtk.TextBuffer.set_line_offset], but works with a + * Same as [method@Gtk.TextIter.set_line_offset], but works with a * byte index. The given byte index must be at * the start of a character, it can’t be in the middle of a UTF-8 * encoded character. @@ -3943,7 +3943,7 @@ gtk_text_iter_set_line_index (GtkTextIter *iter, * @iter: a `GtkTextIter` * @char_on_line: a character offset * - * Like [method@Gtk.TextBuffer.set_line_offset], but the offset is in visible + * Like [method@Gtk.TextIter.set_line_offset], but the offset is in visible * characters, i.e. text with a tag making it invisible is not * counted in the offset. */ @@ -3984,7 +3984,7 @@ gtk_text_iter_set_visible_line_offset (GtkTextIter *iter, * @iter: a `GtkTextIter` * @byte_on_line: a byte index * - * Like [method@Gtk.TextBuffer.set_line_index], but the index is in visible + * Like [method@Gtk.TextIter.set_line_index], but the index is in visible * bytes, i.e. text with a tag making it invisible is not counted * in the index. */ -- cgit v1.2.1 From 5f0a9a60e9d516e30daa911e2643e8ed3f9237a4 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 2 Apr 2023 14:06:11 +0200 Subject: tooltipwindow: Cast the correct object the tooltipwindow is in the userdata. --- gtk/gtktooltipwindow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtktooltipwindow.c b/gtk/gtktooltipwindow.c index a24bcb4157..341a606cf6 100644 --- a/gtk/gtktooltipwindow.c +++ b/gtk/gtktooltipwindow.c @@ -258,7 +258,7 @@ surface_transform_changed_cb (GtkWidget *widget, const graphene_matrix_t *transform, gpointer user_data) { - GtkTooltipWindow *window = GTK_TOOLTIP_WINDOW (widget); + GtkTooltipWindow *window = GTK_TOOLTIP_WINDOW (user_data); gtk_tooltip_window_relayout (window); -- cgit v1.2.1 From a1ad1fc9dbfb69abd485ff53538f5e0d64654390 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 3 Apr 2023 22:32:31 -0400 Subject: node-editor: Improve the scaling We only want to scale the main rendering, not whats shown in the sidebar. Also, make the scale logarithmic. --- demos/node-editor/node-editor-window.c | 31 ++++++++++++++++++++++++------- demos/node-editor/node-editor-window.ui | 6 +++--- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/demos/node-editor/node-editor-window.c b/demos/node-editor/node-editor-window.c index 3fe3d818c7..9eb5fcfac6 100644 --- a/demos/node-editor/node-editor-window.c +++ b/demos/node-editor/node-editor-window.c @@ -174,6 +174,7 @@ text_changed (GtkTextBuffer *buffer, GtkTextIter iter; GtkTextIter start, end; float scale; + GskRenderNode *big_node; g_array_remove_range (self->errors, 0, self->errors->len); text = get_current_text (self->text_buffer); @@ -186,13 +187,18 @@ text_changed (GtkTextBuffer *buffer, self->node = gsk_render_node_deserialize (bytes, deserialize_error_func, self); scale = gtk_scale_button_get_value (GTK_SCALE_BUTTON (self->scale_scale)); - if (self->node && scale != 1.0) + if (self->node && scale != 0.) { - GskRenderNode *node; - - node = gsk_transform_node_new (self->node, gsk_transform_scale (NULL, scale, scale)); - gsk_render_node_unref (self->node); - self->node = node; + scale = pow (2., scale); + big_node = gsk_transform_node_new (self->node, gsk_transform_scale (NULL, scale, scale)); + } + else if (self->node) + { + big_node = gsk_render_node_ref (self->node); + } + else + { + big_node = NULL; } g_bytes_unref (bytes); @@ -204,18 +210,27 @@ text_changed (GtkTextBuffer *buffer, graphene_rect_t bounds; guint i; + snapshot = gtk_snapshot_new (); + gsk_render_node_get_bounds (big_node, &bounds); + gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- bounds.origin.x, - bounds.origin.y)); + gtk_snapshot_append_node (snapshot, big_node); + paintable = gtk_snapshot_free_to_paintable (snapshot, &bounds.size); + gtk_picture_set_paintable (GTK_PICTURE (self->picture), paintable); + g_clear_object (&paintable); + snapshot = gtk_snapshot_new (); gsk_render_node_get_bounds (self->node, &bounds); gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- bounds.origin.x, - bounds.origin.y)); gtk_snapshot_append_node (snapshot, self->node); paintable = gtk_snapshot_free_to_paintable (snapshot, &bounds.size); - gtk_picture_set_paintable (GTK_PICTURE (self->picture), paintable); + for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->renderers)); i++) { gpointer item = g_list_model_get_item (G_LIST_MODEL (self->renderers), i); gtk_renderer_paintable_set_paintable (item, paintable); g_object_unref (item); } + g_clear_object (&paintable); } else @@ -223,6 +238,8 @@ text_changed (GtkTextBuffer *buffer, gtk_picture_set_paintable (GTK_PICTURE (self->picture), NULL); } + g_clear_pointer (&big_node, gsk_render_node_unref); + gtk_text_buffer_get_start_iter (self->text_buffer, &iter); while (!gtk_text_iter_is_end (&iter)) diff --git a/demos/node-editor/node-editor-window.ui b/demos/node-editor/node-editor-window.ui index 34d4452a4a..45a37cd952 100644 --- a/demos/node-editor/node-editor-window.ui +++ b/demos/node-editor/node-editor-window.ui @@ -163,9 +163,9 @@ center - 1 - 1 - 10 + -4 + 0 + 4 0.1 0.5 -- cgit v1.2.1 From cad7247f2d68734523a405e2bcb9b8a37368ca4e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 3 Apr 2023 22:19:39 -0400 Subject: rendernodepaintable: Preserve aspect ratio in snapshot() This is the better fix. --- gtk/gtkrendernodepaintable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtk/gtkrendernodepaintable.c b/gtk/gtkrendernodepaintable.c index 87bb1ca19a..f7987bdd63 100644 --- a/gtk/gtkrendernodepaintable.c +++ b/gtk/gtkrendernodepaintable.c @@ -52,8 +52,8 @@ gtk_render_node_paintable_paintable_snapshot (GdkPaintable *paintable, gtk_snapshot_save (snapshot); gtk_snapshot_scale (snapshot, - width / (self->bounds.size.width), - height / (self->bounds.size.height)); + width / ceilf (self->bounds.size.width), + height / ceilf (self->bounds.size.height)); gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (-self->bounds.origin.x, -self->bounds.origin.y)); gtk_snapshot_push_clip (snapshot, &self->bounds); -- cgit v1.2.1 From a058a382d456433b5063863f8c802860ffd3a498 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 3 Apr 2023 19:33:31 -0400 Subject: expander: Fix the css docs The docs were not matching reality since the css node names were changed in 6d20fe0b. Fixes: #5723 --- gtk/gtkexpander.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index 6b233ebe59..f4e7532332 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -98,16 +98,16 @@ * # CSS nodes * * ``` - * expander + * expander-widget * ╰── box * ├── title - * │ ├── arrow + * │ ├── expander * │ ╰── diff --git a/po/POTFILES.in b/po/POTFILES.in index c0719e6fa5..7b3cf70e2d 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -398,6 +398,7 @@ gtk/ui/gtkfilechooserwidget.ui gtk/ui/gtkfontchooserdialog.ui gtk/ui/gtkfontchooserwidget.ui gtk/ui/gtklockbutton.ui +gtk/ui/gtkmediacontrols.ui gtk/ui/gtkmessagedialog.ui gtk/ui/gtkpagesetupunixdialog.ui gtk/ui/gtkplacesviewrow.ui -- cgit v1.2.1 From fa4af025317fde20217c9d2bc5fbfadbe06961fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nelson=20Ben=C3=ADtez=20Le=C3=B3n?= Date: Thu, 6 Apr 2023 18:45:59 -0400 Subject: 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 --- gtk/inspector/actions.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/gtk/inspector/actions.c b/gtk/inspector/actions.c index eeac0a188e..eb979bfd0c 100644 --- a/gtk/inspector/actions.c +++ b/gtk/inspector/actions.c @@ -172,10 +172,9 @@ bind_parameter_cb (GtkSignalListItemFactory *factory, name = action_holder_get_name (ACTION_HOLDER (item)); if (G_IS_ACTION_GROUP (owner)) parameter = (const char *)g_action_group_get_action_parameter_type (G_ACTION_GROUP (owner), name); - else if (GTK_IS_ACTION_MUXER (owner)) - gtk_action_muxer_query_action (GTK_ACTION_MUXER (owner), name, - NULL, (const GVariantType **)¶meter, NULL, NULL, NULL); - else + else if (!GTK_IS_ACTION_MUXER (owner) || + !gtk_action_muxer_query_action (GTK_ACTION_MUXER (owner), name, + NULL, (const GVariantType **)¶meter, NULL, NULL, NULL)) parameter = "(Unknown)"; gtk_label_set_label (GTK_LABEL (label), parameter); @@ -212,10 +211,9 @@ bind_state_cb (GtkSignalListItemFactory *factory, name = action_holder_get_name (ACTION_HOLDER (item)); if (G_IS_ACTION_GROUP (owner)) state = g_action_group_get_action_state (G_ACTION_GROUP (owner), name); - else if (GTK_IS_ACTION_MUXER (owner)) - gtk_action_muxer_query_action (GTK_ACTION_MUXER (owner), name, - NULL, NULL, NULL, NULL, &state); - else + else if (!GTK_IS_ACTION_MUXER (owner) || + !gtk_action_muxer_query_action (GTK_ACTION_MUXER (owner), name, + NULL, NULL, NULL, NULL, &state)) state = NULL; if (state) -- cgit v1.2.1 From 9f50647ddb1044454213ff686d29748283ad81fb Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 7 Apr 2023 07:56:16 -0400 Subject: textview: Handle a return value --- gtk/gtktextview.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 465e5cd25b..c384002f76 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -9231,7 +9231,8 @@ append_bubble_item (GtkTextView *text_view, muxer = _gtk_widget_get_action_muxer (GTK_WIDGET (text_view), FALSE); if (muxer) { - gtk_action_muxer_query_action (muxer, action_name, &enabled, ¶m_type, &state_type, NULL, NULL); + if (!gtk_action_muxer_query_action (muxer, action_name, &enabled, ¶m_type, &state_type, NULL, NULL)) + return; if (!enabled) return; -- cgit v1.2.1 From 9be7e170b86d4d0529681b48949175fee00b2d6b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 7 Apr 2023 08:02:44 -0400 Subject: 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). --- gtk/gtkactionmuxerprivate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtkactionmuxerprivate.h b/gtk/gtkactionmuxerprivate.h index db69cabc9d..a3e3cf3fc5 100644 --- a/gtk/gtkactionmuxerprivate.h +++ b/gtk/gtkactionmuxerprivate.h @@ -74,7 +74,7 @@ gboolean gtk_action_muxer_query_action (GtkActi const GVariantType **parameter_type, const GVariantType **state_type, GVariant **state_hint, - GVariant **state); + GVariant **state) G_GNUC_WARN_UNUSED_RESULT; void gtk_action_muxer_activate_action (GtkActionMuxer *muxer, const char *action_name, GVariant *parameter); -- cgit v1.2.1 From 3287199f379419b7326645b7c5e40008ae90af27 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 7 Apr 2023 08:52:51 -0400 Subject: 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. --- gtk/inspector/action-editor.c | 34 ++++++++++++++++++++++++++-------- gtk/inspector/actions.c | 7 ++++--- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/gtk/inspector/action-editor.c b/gtk/inspector/action-editor.c index 616a592096..29cdec122f 100644 --- a/gtk/inspector/action-editor.c +++ b/gtk/inspector/action-editor.c @@ -185,18 +185,36 @@ action_state_changed_cb (GActionGroup *group, static void update_widgets (GtkInspectorActionEditor *r) { - GVariant *state = NULL; + GVariant *state; if (G_IS_ACTION_GROUP (r->owner)) - g_action_group_query_action (G_ACTION_GROUP (r->owner), r->name, - &r->enabled, &r->parameter_type, NULL, NULL, - &state); + { + if (!g_action_group_query_action (G_ACTION_GROUP (r->owner), r->name, + &r->enabled, &r->parameter_type, NULL, NULL, + &state)) + { + r->enabled = FALSE; + r->parameter_type = NULL; + state = NULL; + } + } else if (GTK_IS_ACTION_MUXER (r->owner)) - gtk_action_muxer_query_action (GTK_ACTION_MUXER (r->owner), r->name, - &r->enabled, &r->parameter_type, NULL, NULL, - &state); + { + if (!gtk_action_muxer_query_action (GTK_ACTION_MUXER (r->owner), r->name, + &r->enabled, &r->parameter_type, NULL, NULL, + &state)) + { + r->enabled = FALSE; + r->parameter_type = NULL; + state = NULL; + } + } else - state = NULL; + { + r->enabled = FALSE; + r->parameter_type = NULL; + state = NULL; + } gtk_widget_set_sensitive (r->activate_button, r->enabled); gtk_widget_set_sensitive (r->parameter_entry, r->enabled); diff --git a/gtk/inspector/actions.c b/gtk/inspector/actions.c index eb979bfd0c..a5d06fa7a2 100644 --- a/gtk/inspector/actions.c +++ b/gtk/inspector/actions.c @@ -136,9 +136,10 @@ bind_enabled_cb (GtkSignalListItemFactory *factory, name = action_holder_get_name (ACTION_HOLDER (item)); if (G_IS_ACTION_GROUP (owner)) enabled = g_action_group_get_action_enabled (G_ACTION_GROUP (owner), name); - else if (GTK_IS_ACTION_MUXER (owner)) - gtk_action_muxer_query_action (GTK_ACTION_MUXER (owner), name, - &enabled, NULL, NULL, NULL, NULL); + else if (!GTK_IS_ACTION_MUXER (owner) || + !gtk_action_muxer_query_action (GTK_ACTION_MUXER (owner), name, + &enabled, NULL, NULL, NULL, NULL)) + enabled = FALSE; gtk_label_set_label (GTK_LABEL (label), enabled ? "+" : "-"); } -- cgit v1.2.1 From 60ea12759280ea65f56947c83fedda3479ea89e2 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 7 Apr 2023 08:55:40 -0400 Subject: inspector: Plug a memory leak --- gtk/inspector/action-editor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gtk/inspector/action-editor.c b/gtk/inspector/action-editor.c index 29cdec122f..666ff0e18d 100644 --- a/gtk/inspector/action-editor.c +++ b/gtk/inspector/action-editor.c @@ -229,6 +229,8 @@ update_widgets (GtkInspectorActionEditor *r) g_variant_type_free (r->state_type); r->state_type = g_variant_type_copy (g_variant_get_type (state)); gtk_inspector_variant_editor_set_value (r->state_entry, state); + + g_variant_unref (state); } if (G_IS_ACTION_GROUP (r->owner)) -- cgit v1.2.1 From 7e1a4b5b7cd0fdb74ef6c3003715c2a807b456eb Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 7 Apr 2023 09:16:21 -0400 Subject: inspector: Be more careful Tweak the variant-editor code to handle some cases more explicitly. --- gtk/inspector/variant-editor.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gtk/inspector/variant-editor.c b/gtk/inspector/variant-editor.c index cf8a16a3fc..e81131256b 100644 --- a/gtk/inspector/variant-editor.c +++ b/gtk/inspector/variant-editor.c @@ -66,10 +66,11 @@ dispose (GObject *object) GtkInspectorVariantEditor *self = GTK_INSPECTOR_VARIANT_EDITOR (object); if (self->editor) - { + { g_signal_handlers_disconnect_by_func (self->editor, variant_editor_changed_cb, self->data); gtk_widget_unparent (self->editor); + self->editor = NULL; } G_OBJECT_CLASS (gtk_inspector_variant_editor_parent_class)->dispose (object); @@ -94,6 +95,8 @@ ensure_editor (GtkInspectorVariantEditor *self, g_variant_type_equal (self->type, type)) return; + self->type = type; + if (g_variant_type_equal (type, G_VARIANT_TYPE_BOOLEAN)) { if (self->editor) @@ -102,6 +105,8 @@ ensure_editor (GtkInspectorVariantEditor *self, self->editor = gtk_toggle_button_new_with_label ("FALSE"); g_signal_connect (self->editor, "notify::active", G_CALLBACK (variant_editor_changed_cb), self); + + gtk_widget_set_parent (self->editor, GTK_WIDGET (self)); } else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING)) { @@ -112,6 +117,8 @@ ensure_editor (GtkInspectorVariantEditor *self, gtk_editable_set_width_chars (GTK_EDITABLE (self->editor), 10); g_signal_connect (self->editor, "notify::text", G_CALLBACK (variant_editor_changed_cb), self); + + gtk_widget_set_parent (self->editor, GTK_WIDGET (self)); } else if (!GTK_IS_BOX (self->editor)) { @@ -128,10 +135,9 @@ ensure_editor (GtkInspectorVariantEditor *self, gtk_box_append (GTK_BOX (self->editor), label); g_signal_connect (entry, "notify::text", G_CALLBACK (variant_editor_changed_cb), self); - } - self->type = type; - gtk_widget_set_parent (self->editor, GTK_WIDGET (self)); + gtk_widget_set_parent (self->editor, GTK_WIDGET (self)); + } } GtkWidget * -- cgit v1.2.1 From 18720031a3286d8142a11d794dfa88fc65c77b45 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 7 Apr 2023 12:53:57 -0400 Subject: actionmuxer: Add a precondition This helps with debugging the inspectors action handling. --- gtk/gtkactionmuxer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gtk/gtkactionmuxer.c b/gtk/gtkactionmuxer.c index 7af7bb413b..760f796354 100644 --- a/gtk/gtkactionmuxer.c +++ b/gtk/gtkactionmuxer.c @@ -232,6 +232,8 @@ gtk_action_muxer_list_actions (GtkActionMuxer *muxer, GHashTable *actions; char **keys; + g_return_val_if_fail (GTK_IS_ACTION_MUXER (muxer), NULL); + actions = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); for ( ; muxer != NULL; muxer = muxer->parent) -- cgit v1.2.1 From c6fc895b6dfc3f52bce96e64b794b12d35e192de Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 7 Apr 2023 13:15:34 -0400 Subject: inspector: Cosmetics Make the variant editor use a checkbutton instead of a togglebutton. --- gtk/inspector/variant-editor.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/gtk/inspector/variant-editor.c b/gtk/inspector/variant-editor.c index e81131256b..52c99f05ce 100644 --- a/gtk/inspector/variant-editor.c +++ b/gtk/inspector/variant-editor.c @@ -21,7 +21,7 @@ #include "variant-editor.h" #include "gtksizegroup.h" -#include "gtktogglebutton.h" +#include "gtkcheckbutton.h" #include "gtkentry.h" #include "gtklabel.h" #include "gtkbox.h" @@ -102,7 +102,7 @@ ensure_editor (GtkInspectorVariantEditor *self, if (self->editor) gtk_widget_unparent (self->editor); - self->editor = gtk_toggle_button_new_with_label ("FALSE"); + self->editor = gtk_check_button_new (); g_signal_connect (self->editor, "notify::active", G_CALLBACK (variant_editor_changed_cb), self); @@ -175,18 +175,14 @@ gtk_inspector_variant_editor_set_value (GtkWidget *editor, ensure_editor (self, g_variant_get_type (value)); - g_signal_handlers_block_by_func (self->editor, variant_editor_changed_cb, self->data); + g_signal_handlers_block_by_func (self->editor, variant_editor_changed_cb, self); if (g_variant_type_equal (self->type, G_VARIANT_TYPE_BOOLEAN)) { - GtkToggleButton *tb = GTK_TOGGLE_BUTTON (self->editor); - - if (gtk_toggle_button_get_active (tb) != g_variant_get_boolean (value)) - { - gtk_toggle_button_set_active (tb, g_variant_get_boolean (value)); - gtk_button_set_label (GTK_BUTTON (tb), - g_variant_get_boolean (value) ? "TRUE" : "FALSE"); - } + GtkCheckButton *b = GTK_CHECK_BUTTON (self->editor); + + if (gtk_check_button_get_active (b) != g_variant_get_boolean (value)) + gtk_check_button_set_active (b, g_variant_get_boolean (value)); } else if (g_variant_type_equal (self->type, G_VARIANT_TYPE_STRING)) { @@ -207,7 +203,7 @@ gtk_inspector_variant_editor_set_value (GtkWidget *editor, g_free (text); } - g_signal_handlers_unblock_by_func (self->editor, variant_editor_changed_cb, self->data); + g_signal_handlers_unblock_by_func (self->editor, variant_editor_changed_cb, self); } GVariant * @@ -221,8 +217,8 @@ gtk_inspector_variant_editor_get_value (GtkWidget *editor) if (g_variant_type_equal (self->type, G_VARIANT_TYPE_BOOLEAN)) { - GtkToggleButton *tb = GTK_TOGGLE_BUTTON (self->editor); - value = g_variant_new_boolean (gtk_toggle_button_get_active (tb)); + GtkCheckButton *b = GTK_CHECK_BUTTON (self->editor); + value = g_variant_new_boolean (gtk_check_button_get_active (b)); } else if (g_variant_type_equal (self->type, G_VARIANT_TYPE_STRING)) { -- cgit v1.2.1 From 3f1a083cfaa0a16776de55d600b64473713a5201 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 7 Apr 2023 13:14:07 -0400 Subject: inspector: Add ActionHolder::changed We will use this signal to communicate action changes to the action list widgetry. --- gtk/inspector/action-holder.c | 17 +++++++++++++++++ gtk/inspector/action-holder.h | 1 + 2 files changed, 18 insertions(+) diff --git a/gtk/inspector/action-holder.c b/gtk/inspector/action-holder.c index 199741e3d2..4c3c43b9e5 100644 --- a/gtk/inspector/action-holder.c +++ b/gtk/inspector/action-holder.c @@ -8,6 +8,8 @@ struct _ActionHolder { char *name; }; +static guint changed_signal; + G_DEFINE_TYPE (ActionHolder, action_holder, G_TYPE_OBJECT) static void @@ -32,6 +34,15 @@ action_holder_class_init (ActionHolderClass *class) GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->finalize = action_holder_finalize; + + changed_signal = + g_signal_new ("changed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + NULL, + G_TYPE_NONE, 0); } ActionHolder * @@ -59,3 +70,9 @@ action_holder_get_name (ActionHolder *holder) { return holder->name; } + +void +action_holder_changed (ActionHolder *holder) +{ + g_signal_emit (holder, changed_signal, 0); +} diff --git a/gtk/inspector/action-holder.h b/gtk/inspector/action-holder.h index a3294e835d..e4cfeb9176 100644 --- a/gtk/inspector/action-holder.h +++ b/gtk/inspector/action-holder.h @@ -13,5 +13,6 @@ ActionHolder * action_holder_new (GObject *owner, GObject *action_holder_get_owner (ActionHolder *holder); const char *action_holder_get_name (ActionHolder *holder); +void action_holder_changed (ActionHolder *holder); #endif /* __ACTION_HOLDER_H__ */ -- cgit v1.2.1 From 1ab18855401f256507fe7d45e0907e1804983701 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 7 Apr 2023 12:58:10 -0400 Subject: inspector: Simplify the action editor No need to listen for changes, the actions list code will do so and tell us to update. --- gtk/inspector/action-editor.c | 99 +++++++++---------------------------------- gtk/inspector/action-editor.h | 4 +- 2 files changed, 22 insertions(+), 81 deletions(-) diff --git a/gtk/inspector/action-editor.c b/gtk/inspector/action-editor.c index 666ff0e18d..ba838fbaf7 100644 --- a/gtk/inspector/action-editor.c +++ b/gtk/inspector/action-editor.c @@ -53,8 +53,7 @@ enum { PROP_0, PROP_OWNER, - PROP_NAME, - PROP_SIZEGROUP + PROP_NAME }; G_DEFINE_TYPE (GtkInspectorActionEditor, gtk_inspector_action_editor, GTK_TYPE_WIDGET) @@ -73,6 +72,7 @@ activate_action (GtkWidget *button, g_action_group_activate_action (G_ACTION_GROUP (r->owner), r->name, parameter); else if (GTK_IS_ACTION_MUXER (r->owner)) gtk_action_muxer_activate_action (GTK_ACTION_MUXER (r->owner), r->name, parameter); + update_widgets (r); } @@ -97,13 +97,17 @@ state_changed (GtkWidget *editor, GVariant *value; value = gtk_inspector_variant_editor_get_value (editor); - if (value) - { - if (G_IS_ACTION_GROUP (r->owner)) - g_action_group_change_action_state (G_ACTION_GROUP (r->owner), r->name, value); - else if (GTK_IS_ACTION_MUXER (r->owner)) - gtk_action_muxer_change_action_state (GTK_ACTION_MUXER (r->owner), r->name, value); - } + if (!value) + return; + + g_variant_ref_sink (value); + + if (G_IS_ACTION_GROUP (r->owner)) + g_action_group_change_action_state (G_ACTION_GROUP (r->owner), r->name, value); + else if (GTK_IS_ACTION_MUXER (r->owner)) + gtk_action_muxer_change_action_state (GTK_ACTION_MUXER (r->owner), r->name, value); + + g_variant_unref (value); } static void @@ -140,48 +144,6 @@ gtk_inspector_action_editor_init (GtkInspectorActionEditor *r) gtk_widget_set_visible (r->state_editor, FALSE); } -static void -update_enabled (GtkInspectorActionEditor *r, - gboolean enabled) -{ - r->enabled = enabled; - if (r->parameter_entry) - { - gtk_widget_set_sensitive (r->parameter_entry, enabled); - parameter_changed (r->parameter_entry, r); - } - if (r->activate_button) - gtk_widget_set_sensitive (r->activate_button, enabled); -} - -static void -action_enabled_changed_cb (GActionGroup *group, - const char *action_name, - gboolean enabled, - GtkInspectorActionEditor *r) -{ - if (g_str_equal (action_name, r->name)) - update_enabled (r, enabled); -} - -static void -update_state (GtkInspectorActionEditor *r, - GVariant *state) -{ - if (r->state_entry) - gtk_inspector_variant_editor_set_value (r->state_entry, state); -} - -static void -action_state_changed_cb (GActionGroup *group, - const char *action_name, - GVariant *state, - GtkInspectorActionEditor *r) -{ - if (g_str_equal (action_name, r->name)) - update_state (r, state); -} - static void update_widgets (GtkInspectorActionEditor *r) { @@ -232,14 +194,6 @@ update_widgets (GtkInspectorActionEditor *r) g_variant_unref (state); } - - if (G_IS_ACTION_GROUP (r->owner)) - { - g_signal_connect (r->owner, "action-enabled-changed", - G_CALLBACK (action_enabled_changed_cb), r); - g_signal_connect (r->owner, "action-state-changed", - G_CALLBACK (action_state_changed_cb), r); - } } static void @@ -248,18 +202,12 @@ dispose (GObject *object) GtkInspectorActionEditor *r = GTK_INSPECTOR_ACTION_EDITOR (object); GtkWidget *child; - g_free (r->name); - if (r->state_type) - g_variant_type_free (r->state_type); - if (r->owner) - { - g_signal_handlers_disconnect_by_func (r->owner, action_enabled_changed_cb, r); - g_signal_handlers_disconnect_by_func (r->owner, action_state_changed_cb, r); - } - while ((child = gtk_widget_get_first_child (GTK_WIDGET (r)))) gtk_widget_unparent (child); + g_clear_pointer (&r->name, g_free); + g_clear_pointer (&r->state_type, g_variant_type_free); + G_OBJECT_CLASS (gtk_inspector_action_editor_parent_class)->dispose (object); } @@ -298,12 +246,10 @@ set_property (GObject *object, switch (param_id) { case PROP_OWNER: - if (r->owner) - { - g_signal_handlers_disconnect_by_func (r->owner, action_enabled_changed_cb, r); - g_signal_handlers_disconnect_by_func (r->owner, action_state_changed_cb, r); - } r->owner = g_value_get_object (value); + g_assert (r->owner == NULL || + G_IS_ACTION_GROUP (r->owner) || + GTK_IS_ACTION_MUXER (r->owner)); break; case PROP_NAME: @@ -354,10 +300,7 @@ gtk_inspector_action_editor_set (GtkInspectorActionEditor *self, } void -gtk_inspector_action_editor_update (GtkInspectorActionEditor *r, - gboolean enabled, - GVariant *state) +gtk_inspector_action_editor_update (GtkInspectorActionEditor *self) { - update_enabled (r, enabled); - update_state (r, state); + update_widgets (self); } diff --git a/gtk/inspector/action-editor.h b/gtk/inspector/action-editor.h index c918a9a55c..14bf3ce9f8 100644 --- a/gtk/inspector/action-editor.h +++ b/gtk/inspector/action-editor.h @@ -37,9 +37,7 @@ GtkWidget *gtk_inspector_action_editor_new (void); void gtk_inspector_action_editor_set (GtkInspectorActionEditor *self, GObject *owner, const char *name); -void gtk_inspector_action_editor_update (GtkInspectorActionEditor *self, - gboolean enabled, - GVariant *state); +void gtk_inspector_action_editor_update (GtkInspectorActionEditor *self); G_END_DECLS -- cgit v1.2.1 From dd6ea529f8ff86734c0d36b0b54e4a1c7e66fbc0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 7 Apr 2023 13:14:51 -0400 Subject: inspector: Redo the actions list Make the actions list implement GtkActionObserver for the muxer case, and make updates work. --- gtk/inspector/actions.c | 283 ++++++++++++++++++++++++++++++++++++++++------- gtk/inspector/actions.ui | 3 + 2 files changed, 249 insertions(+), 37 deletions(-) diff --git a/gtk/inspector/actions.c b/gtk/inspector/actions.c index a5d06fa7a2..3f2a2183a2 100644 --- a/gtk/inspector/actions.c +++ b/gtk/inspector/actions.c @@ -26,6 +26,8 @@ #include "gtkapplicationwindow.h" #include "gtkwidgetprivate.h" #include "gtkactionmuxerprivate.h" +#include "gtkactionobserverprivate.h" +#include "gtkactionobservableprivate.h" #include "gtkpopover.h" #include "gtklabel.h" #include "gtkstack.h" @@ -59,7 +61,10 @@ enum { PROP_BUTTON }; -G_DEFINE_TYPE (GtkInspectorActions, gtk_inspector_actions, GTK_TYPE_WIDGET) +static void gtk_inspector_actions_observer_iface_init (GtkActionObserverInterface *iface); + +G_DEFINE_TYPE_WITH_CODE (GtkInspectorActions, gtk_inspector_actions, GTK_TYPE_WIDGET, + G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTION_OBSERVER, gtk_inspector_actions_observer_iface_init)) static void gtk_inspector_actions_init (GtkInspectorActions *sl) @@ -120,20 +125,13 @@ setup_enabled_cb (GtkSignalListItemFactory *factory, } static void -bind_enabled_cb (GtkSignalListItemFactory *factory, - GtkListItem *list_item) +update_enabled (ActionHolder *holder, + GtkLabel *label) { - gpointer item; - GtkWidget *label; - GObject *owner; - const char *name; + GObject *owner = action_holder_get_owner (holder); + const char *name = action_holder_get_name (holder); gboolean enabled = FALSE; - item = gtk_list_item_get_item (list_item); - label = gtk_list_item_get_child (list_item); - - owner = action_holder_get_owner (ACTION_HOLDER (item)); - name = action_holder_get_name (ACTION_HOLDER (item)); if (G_IS_ACTION_GROUP (owner)) enabled = g_action_group_get_action_enabled (G_ACTION_GROUP (owner), name); else if (!GTK_IS_ACTION_MUXER (owner) || @@ -141,7 +139,29 @@ bind_enabled_cb (GtkSignalListItemFactory *factory, &enabled, NULL, NULL, NULL, NULL)) enabled = FALSE; - gtk_label_set_label (GTK_LABEL (label), enabled ? "+" : "-"); + gtk_label_set_label (label, enabled ? "+" : "-"); +} + +static void +bind_enabled_cb (GtkSignalListItemFactory *factory, + GtkListItem *list_item) +{ + gpointer item = gtk_list_item_get_item (list_item); + GtkWidget *label = gtk_list_item_get_child (list_item); + + g_signal_connect (item, "changed", G_CALLBACK (update_enabled), label); + + update_enabled (ACTION_HOLDER (item), GTK_LABEL (label)); +} + +static void +unbind_enabled_cb (GtkSignalListItemFactory *factory, + GtkListItem *list_item) +{ + gpointer item = gtk_list_item_get_item (list_item); + GtkWidget *label = gtk_list_item_get_child (list_item); + + g_signal_handlers_disconnect_by_func (item, update_enabled, label); } static void @@ -196,20 +216,13 @@ setup_state_cb (GtkSignalListItemFactory *factory, } static void -bind_state_cb (GtkSignalListItemFactory *factory, - GtkListItem *list_item) +update_state (ActionHolder *h, + GtkLabel *label) { - gpointer item; - GtkWidget *label; - GObject *owner; - const char *name; + GObject *owner = action_holder_get_owner (h); + const char *name = action_holder_get_name (h); GVariant *state; - item = gtk_list_item_get_item (list_item); - label = gtk_list_item_get_child (list_item); - - owner = action_holder_get_owner (ACTION_HOLDER (item)); - name = action_holder_get_name (ACTION_HOLDER (item)); if (G_IS_ACTION_GROUP (owner)) state = g_action_group_get_action_state (G_ACTION_GROUP (owner), name); else if (!GTK_IS_ACTION_MUXER (owner) || @@ -222,12 +235,34 @@ bind_state_cb (GtkSignalListItemFactory *factory, char *state_string; state_string = g_variant_print (state, FALSE); - gtk_label_set_label (GTK_LABEL (label), state_string); + gtk_label_set_label (label, state_string); g_free (state_string); g_variant_unref (state); } else - gtk_label_set_label (GTK_LABEL (label), ""); + gtk_label_set_label (label, ""); +} + +static void +bind_state_cb (GtkSignalListItemFactory *factory, + GtkListItem *list_item) +{ + gpointer item = gtk_list_item_get_item (list_item); + GtkWidget *label = gtk_list_item_get_child (list_item); + + g_signal_connect (item, "changed", G_CALLBACK (update_state), label); + + update_state (ACTION_HOLDER (item), GTK_LABEL (label)); +} + +static void +unbind_state_cb (GtkSignalListItemFactory *factory, + GtkListItem *list_item) +{ + gpointer item = gtk_list_item_get_item (list_item); + GtkWidget *label = gtk_list_item_get_child (list_item); + + g_signal_handlers_disconnect_by_func (item, update_state, label); } static void @@ -241,24 +276,35 @@ setup_changes_cb (GtkSignalListItemFactory *factory, gtk_list_item_set_child (list_item, editor); } +static void +update_changes (ActionHolder *h, + GtkInspectorActionEditor *editor) +{ + gtk_inspector_action_editor_update (editor); +} + static void bind_changes_cb (GtkSignalListItemFactory *factory, GtkListItem *list_item) { - gpointer item; - GObject *owner; - const char *name; - GtkWidget *editor; + gpointer item = gtk_list_item_get_item (list_item); + GtkWidget *editor = gtk_list_item_get_child (list_item); + GObject *owner = action_holder_get_owner (ACTION_HOLDER (item)); + const char *name = action_holder_get_name (ACTION_HOLDER (item)); - item = gtk_list_item_get_item (list_item); - editor = gtk_list_item_get_child (list_item); + gtk_inspector_action_editor_set (GTK_INSPECTOR_ACTION_EDITOR (editor), owner, name); - owner = action_holder_get_owner (ACTION_HOLDER (item)); - name = action_holder_get_name (ACTION_HOLDER (item)); + g_signal_connect (item, "changed", G_CALLBACK (update_changes), editor); +} + +static void +unbind_changes_cb (GtkSignalListItemFactory *factory, + GtkListItem *list_item) +{ + gpointer item = gtk_list_item_get_item (list_item); + GtkWidget *editor = gtk_list_item_get_child (list_item); - gtk_inspector_action_editor_set (GTK_INSPECTOR_ACTION_EDITOR (editor), - owner, - name); + g_signal_handlers_disconnect_by_func (item, update_changes, editor); } static void @@ -323,6 +369,157 @@ refresh_all (GtkInspectorActions *sl) reload (sl); } +static void +action_changed (GtkInspectorActions *sl, + const char *name) +{ + unsigned int n_actions; + + n_actions = g_list_model_get_n_items (G_LIST_MODEL (sl->actions)); + for (unsigned int i = 0; i < n_actions; i++) + { + ActionHolder *h = ACTION_HOLDER (g_list_model_get_item (G_LIST_MODEL (sl->actions), i)); + + if (g_str_equal (action_holder_get_name (h), name)) + { + action_holder_changed (h); + g_object_unref (h); + break; + } + + g_object_unref (h); + } +} + +static void +action_enabled_changed (GActionGroup *group, + const char *action_name, + gboolean enabled, + GtkInspectorActions *sl) +{ + action_changed (sl, action_name); +} + +static void +action_state_changed (GActionGroup *group, + const char *action_name, + GVariant *state, + GtkInspectorActions *sl) +{ + action_changed (sl, action_name); +} + +static void +observer_action_added (GtkActionObserver *observer, + GtkActionObservable *observable, + const char *action_name, + const GVariantType *parameter_type, + gboolean enabled, + GVariant *state) +{ +} + +static void +observer_action_removed (GtkActionObserver *observer, + GtkActionObservable *observable, + const char *action_name) +{ +} + +static void +observer_action_enabled_changed (GtkActionObserver *observer, + GtkActionObservable *observable, + const char *action_name, + gboolean enabled) +{ + action_changed (GTK_INSPECTOR_ACTIONS (observer), action_name); +} + +static void +observer_action_state_changed (GtkActionObserver *observer, + GtkActionObservable *observable, + const char *action_name, + GVariant *state) +{ + action_changed (GTK_INSPECTOR_ACTIONS (observer), action_name); +} + +static void +observer_primary_accel_changed (GtkActionObserver *observer, + GtkActionObservable *observable, + const char *action_name, + const char *action_and_target) +{ +} + +static void +gtk_inspector_actions_observer_iface_init (GtkActionObserverInterface *iface) +{ + iface->action_added = observer_action_added; + iface->action_removed = observer_action_removed; + iface->action_enabled_changed = observer_action_enabled_changed; + iface->action_state_changed = observer_action_state_changed; + iface->primary_accel_changed = observer_primary_accel_changed; +} + +static void +connect (GtkInspectorActions *sl) +{ + if (G_IS_ACTION_GROUP (sl->object)) + { + g_signal_connect (sl->object, "action-enabled-changed", + G_CALLBACK (action_enabled_changed), sl); + g_signal_connect (sl->object, "action-state-changed", + G_CALLBACK (action_state_changed), sl); + } + else if (GTK_IS_WIDGET (sl->object)) + { + GtkActionMuxer *muxer; + + muxer = _gtk_widget_get_action_muxer (GTK_WIDGET (sl->object), FALSE); + + if (muxer) + { + int i; + char **names; + + names = gtk_action_muxer_list_actions (muxer, FALSE); + for (i = 0; names[i]; i++) + { + gtk_action_observable_register_observer (GTK_ACTION_OBSERVABLE (muxer), names[i], GTK_ACTION_OBSERVER (sl)); + } + g_strfreev (names); + } + } +} + +static void +disconnect (GtkInspectorActions *sl) +{ + if (G_IS_ACTION_GROUP (sl->object)) + { + g_signal_handlers_disconnect_by_func (sl->object, action_enabled_changed, sl); + g_signal_handlers_disconnect_by_func (sl->object, action_state_changed, sl); + } + else if (GTK_IS_WIDGET (sl->object)) + { + GtkActionMuxer *muxer; + + muxer = _gtk_widget_get_action_muxer (GTK_WIDGET (sl->object), FALSE); + + if (muxer) + { + int i; + char **names; + + names = gtk_action_muxer_list_actions (muxer, FALSE); + for (i = 0; names[i]; i++) + gtk_action_observable_unregister_observer (GTK_ACTION_OBSERVABLE (muxer), names[i], GTK_ACTION_OBSERVER (sl)); + g_strfreev (names); + } + } +} + void gtk_inspector_actions_set_object (GtkInspectorActions *sl, GObject *object) @@ -335,11 +532,17 @@ gtk_inspector_actions_set_object (GtkInspectorActions *sl, page = gtk_stack_get_page (GTK_STACK (stack), GTK_WIDGET (sl)); gtk_stack_page_set_visible (page, FALSE); + if (sl->object) + disconnect (sl); + g_set_object (&sl->object, object); gtk_column_view_sort_by_column (GTK_COLUMN_VIEW (sl->list), sl->name, GTK_SORT_ASCENDING); loaded = reload (sl); gtk_stack_page_set_visible (page, loaded); + + if (sl->object) + connect (sl); } static void @@ -419,6 +622,9 @@ dispose (GObject *object) { GtkInspectorActions *sl = GTK_INSPECTOR_ACTIONS (object); + if (sl->object) + disconnect (sl); + g_clear_object (&sl->sorted); g_clear_object (&sl->actions); g_clear_object (&sl->object); @@ -451,12 +657,15 @@ gtk_inspector_actions_class_init (GtkInspectorActionsClass *klass) gtk_widget_class_bind_template_callback (widget_class, bind_name_cb); gtk_widget_class_bind_template_callback (widget_class, setup_enabled_cb); gtk_widget_class_bind_template_callback (widget_class, bind_enabled_cb); + gtk_widget_class_bind_template_callback (widget_class, unbind_enabled_cb); gtk_widget_class_bind_template_callback (widget_class, setup_parameter_cb); gtk_widget_class_bind_template_callback (widget_class, bind_parameter_cb); gtk_widget_class_bind_template_callback (widget_class, setup_state_cb); gtk_widget_class_bind_template_callback (widget_class, bind_state_cb); + gtk_widget_class_bind_template_callback (widget_class, unbind_state_cb); gtk_widget_class_bind_template_callback (widget_class, setup_changes_cb); gtk_widget_class_bind_template_callback (widget_class, bind_changes_cb); + gtk_widget_class_bind_template_callback (widget_class, unbind_changes_cb); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); } diff --git a/gtk/inspector/actions.ui b/gtk/inspector/actions.ui index a48b0ba638..55c3007f36 100644 --- a/gtk/inspector/actions.ui +++ b/gtk/inspector/actions.ui @@ -32,6 +32,7 @@ + @@ -54,6 +55,7 @@ + @@ -66,6 +68,7 @@ + -- cgit v1.2.1 From 126b847fdd0607d90887443c75e8f3a81177b248 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 7 Apr 2023 21:42:10 +0200 Subject: 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 --- gtk/gtkpopover.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index e60f9ea4df..f7fe4e4d82 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -1078,20 +1078,12 @@ gtk_popover_show (GtkWidget *widget) { if (!gtk_widget_get_focus_child (widget)) gtk_widget_child_focus (widget, GTK_DIR_TAB_FORWARD); - - gtk_grab_add (widget); } } static void gtk_popover_hide (GtkWidget *widget) { - GtkPopover *popover = GTK_POPOVER (widget); - GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover); - - if (priv->autohide) - gtk_grab_remove (widget); - gtk_popover_set_mnemonics_visible (GTK_POPOVER (widget), FALSE); _gtk_widget_set_visible_flag (widget, FALSE); gtk_widget_unmap (widget); @@ -1138,6 +1130,9 @@ gtk_popover_map (GtkWidget *widget) unset_surface_transform_changed_cb); GTK_WIDGET_CLASS (gtk_popover_parent_class)->map (widget); + + if (priv->autohide) + gtk_grab_add (widget); } static void @@ -1147,6 +1142,9 @@ gtk_popover_unmap (GtkWidget *widget) GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover); GtkWidget *parent; + if (priv->autohide) + gtk_grab_remove (widget); + parent = gtk_widget_get_parent (widget); gtk_widget_remove_surface_transform_changed_callback (parent, priv->surface_transform_changed_cb); -- cgit v1.2.1 From 8415c5f37593af9b36ef4ba3c978e1d699dd8459 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 6 Apr 2023 15:31:03 -0400 Subject: 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 --- gtk/gtkgestureclick.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gtk/gtkgestureclick.c b/gtk/gtkgestureclick.c index cc5fec25af..0b07b992ac 100644 --- a/gtk/gtkgestureclick.c +++ b/gtk/gtkgestureclick.c @@ -220,7 +220,8 @@ gtk_gesture_click_begin (GtkGesture *gesture, _gtk_gesture_click_update_timeout (click); gtk_gesture_get_point (gesture, current, &x, &y); - if (!_gtk_gesture_click_check_within_threshold (click, x, y)) + if (gdk_device_get_source (priv->current_device) == GDK_SOURCE_MOUSE && + !_gtk_gesture_click_check_within_threshold (click, x, y)) _gtk_gesture_click_stop (click); /* Increment later the real counter, just if the gesture is @@ -243,14 +244,17 @@ gtk_gesture_click_update (GtkGesture *gesture, GdkEventSequence *sequence) { GtkGestureClick *click; + GtkGestureClickPrivate *priv; GdkEventSequence *current; double x, y; click = GTK_GESTURE_CLICK (gesture); + priv = gtk_gesture_click_get_instance_private (click); current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture)); gtk_gesture_get_point (gesture, current, &x, &y); - if (!_gtk_gesture_click_check_within_threshold (click, x, y)) + if (gdk_device_get_source (priv->current_device) == GDK_SOURCE_MOUSE && + !_gtk_gesture_click_check_within_threshold (click, x, y)) _gtk_gesture_click_stop (click); } -- cgit v1.2.1 From 22cf3e9269fa0849b53a31ce26424cce9aca46f0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 7 Apr 2023 17:44:27 -0400 Subject: gestureclick: Use drag threshold for updates --- gtk/gtkgestureclick.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/gtk/gtkgestureclick.c b/gtk/gtkgestureclick.c index 0b07b992ac..795e8ec02c 100644 --- a/gtk/gtkgestureclick.c +++ b/gtk/gtkgestureclick.c @@ -150,6 +150,7 @@ _gtk_gesture_click_update_timeout (GtkGestureClick *gesture) static gboolean _gtk_gesture_click_check_within_threshold (GtkGestureClick *gesture, + const char *setting, double x, double y) { @@ -165,9 +166,7 @@ _gtk_gesture_click_check_within_threshold (GtkGestureClick *gesture, widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)); settings = gtk_widget_get_settings (widget); - g_object_get (settings, - "gtk-double-click-distance", &double_click_distance, - NULL); + g_object_get (settings, setting, &double_click_distance, NULL); if (ABS (priv->initial_press_x - x) < double_click_distance && ABS (priv->initial_press_y - y) < double_click_distance) @@ -221,7 +220,7 @@ gtk_gesture_click_begin (GtkGesture *gesture, gtk_gesture_get_point (gesture, current, &x, &y); if (gdk_device_get_source (priv->current_device) == GDK_SOURCE_MOUSE && - !_gtk_gesture_click_check_within_threshold (click, x, y)) + !_gtk_gesture_click_check_within_threshold (click, "gtk-double-click-distance", x, y)) _gtk_gesture_click_stop (click); /* Increment later the real counter, just if the gesture is @@ -244,17 +243,14 @@ gtk_gesture_click_update (GtkGesture *gesture, GdkEventSequence *sequence) { GtkGestureClick *click; - GtkGestureClickPrivate *priv; GdkEventSequence *current; double x, y; click = GTK_GESTURE_CLICK (gesture); - priv = gtk_gesture_click_get_instance_private (click); current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture)); gtk_gesture_get_point (gesture, current, &x, &y); - if (gdk_device_get_source (priv->current_device) == GDK_SOURCE_MOUSE && - !_gtk_gesture_click_check_within_threshold (click, x, y)) + if (!_gtk_gesture_click_check_within_threshold (click, "gtk-dnd-drag-threshold", x, y)) _gtk_gesture_click_stop (click); } -- cgit v1.2.1 From ada1e212f1f626276cce845cfc03f4167343ed73 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 8 Apr 2023 19:50:16 -0400 Subject: range: Fix a copy-paste error This was showing up as the alpha popup in the color editor not being positioned correctly. --- gtk/gtkrange.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index ebe4cb706b..87a78508a7 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -1010,7 +1010,7 @@ gtk_range_get_slider_range (GtkRange *range, else { if (slider_start) - *slider_start = slider_bounds.origin.y; + *slider_start = slider_bounds.origin.x; if (slider_end) *slider_end = slider_bounds.origin.x + slider_bounds.size.width; } -- cgit v1.2.1 From 7d634f8671e379e6de958a1e6fb6b77cd3fa8289 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 9 Apr 2023 08:13:46 -0400 Subject: gtk-demo: Test stylus-only mode Add a checkbutton to toggle the stylus-only mode of GtkGestureStylus, so we can test this. --- demos/gtk-demo/paint.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/demos/gtk-demo/paint.c b/demos/gtk-demo/paint.c index 1696ca8e99..59561ed7b4 100644 --- a/demos/gtk-demo/paint.c +++ b/demos/gtk-demo/paint.c @@ -24,6 +24,7 @@ typedef struct GdkRGBA draw_color; GtkPadController *pad_controller; double brush_size; + GtkGesture *gesture; } DrawingArea; typedef struct @@ -343,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 * @@ -381,6 +384,12 @@ drawing_area_color_set (DrawingArea *area, gtk_color_dialog_button_set_rgba (button, color); } +static GtkGesture * +drawing_area_get_gesture (DrawingArea *area) +{ + return area->gesture; +} + GtkWidget * do_paint (GtkWidget *toplevel) { @@ -388,7 +397,7 @@ do_paint (GtkWidget *toplevel) if (!window) { - GtkWidget *draw_area, *headerbar, *colorbutton; + GtkWidget *draw_area, *headerbar, *button; window = gtk_window_new (); @@ -397,15 +406,22 @@ do_paint (GtkWidget *toplevel) headerbar = gtk_header_bar_new (); - colorbutton = gtk_color_dialog_button_new (gtk_color_dialog_new ()); - g_signal_connect (colorbutton, "notify::rgba", + 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_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (colorbutton), + 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), colorbutton); + 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_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); -- cgit v1.2.1 From 4e340afce07097b4459b6ee16934cce76201c14b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 9 Apr 2023 08:28:26 -0400 Subject: 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. --- demos/gtk-demo/paint.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/demos/gtk-demo/paint.c b/demos/gtk-demo/paint.c index 59561ed7b4..b9fb350215 100644 --- a/demos/gtk-demo/paint.c +++ b/demos/gtk-demo/paint.c @@ -263,7 +263,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); @@ -314,7 +314,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); -- cgit v1.2.1 From ec9b0ec8b4d87e85ba9580809dd544ddbc3a9667 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 9 Apr 2023 08:33:15 -0400 Subject: 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. --- gtk/gtkgesturestylus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtkgesturestylus.c b/gtk/gtkgesturestylus.c index bc3da9351d..d2e2248e99 100644 --- a/gtk/gtkgesturestylus.c +++ b/gtk/gtkgesturestylus.c @@ -103,7 +103,7 @@ gtk_gesture_stylus_handle_event (GtkEventController *controller, priv = gtk_gesture_stylus_get_instance_private (GTK_GESTURE_STYLUS (controller)); GTK_EVENT_CONTROLLER_CLASS (gtk_gesture_stylus_parent_class)->handle_event (controller, event, x, y); - if (!(priv->stylus_only || gdk_event_get_device_tool (event))) + if (priv->stylus_only && !gdk_event_get_device_tool (event)) return FALSE; switch ((guint) gdk_event_get_event_type (event)) -- cgit v1.2.1 From 9a10d16f691ed7c1a80bbc11380a8e2be3e383e8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 9 Apr 2023 07:32:25 -0400 Subject: gtk-demo: Add a keyword Make the demo using the 'bluroverlay' come up when you type 'blur'. --- demos/gtk-demo/transparent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/gtk-demo/transparent.c b/demos/gtk-demo/transparent.c index 10d9e81da0..626ef2c43d 100644 --- a/demos/gtk-demo/transparent.c +++ b/demos/gtk-demo/transparent.c @@ -1,5 +1,5 @@ /* Overlay/Transparency - * #Keywords: GtkOverlay, GtkSnapshot + * #Keywords: GtkOverlay, GtkSnapshot, blur * * Blur the background behind an overlay. */ -- cgit v1.2.1 From 51f6129578342687f96b9f2a4c886853568203ee Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 10 Apr 2023 00:22:20 -0400 Subject: 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. --- gtk/gtkscrolledwindow.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index be3ab0d4fc..126cf7f30e 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -4194,9 +4194,7 @@ gtk_scrolled_window_set_child (GtkScrolledWindow *scrolled_window, if (priv->child) { if (priv->auto_added_viewport) - { - gtk_viewport_set_child (GTK_VIEWPORT (priv->child), NULL); - } + gtk_viewport_set_child (GTK_VIEWPORT (priv->child), NULL); g_object_set (priv->child, "hadjustment", NULL, @@ -4204,6 +4202,7 @@ gtk_scrolled_window_set_child (GtkScrolledWindow *scrolled_window, NULL); g_clear_pointer (&priv->child, gtk_widget_unparent); + priv->auto_added_viewport = FALSE; } if (child) -- cgit v1.2.1 From d11ac6d83e22f2d9de134a10ca33662f27ecd195 Mon Sep 17 00:00:00 2001 From: "G.Willems" Date: Tue, 11 Apr 2023 22:06:09 +0200 Subject: scalebutton: fix CSS name in documentation --- gtk/gtkscalebutton.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c index 7b2c2a11a0..2742864841 100644 --- a/gtk/gtkscalebutton.c +++ b/gtk/gtkscalebutton.c @@ -71,8 +71,14 @@ * * # CSS nodes * - * `GtkScaleButton` has a single CSS node with name button. To differentiate - * it from a plain `GtkButton`, it gets the .scale style class. + * ``` + * scalebutton.scale + * ╰── button.toggle + * ╰── + * ``` + * + * `GtkScaleButton` has a single CSS node with name scalebutton and `.scale` + * style class, and contains a `button` node with a `.toggle` style class. */ -- cgit v1.2.1 From 353cec50c837902f93a3cb06483095fcc0176e78 Mon Sep 17 00:00:00 2001 From: "G.Willems" Date: Tue, 11 Apr 2023 23:53:35 +0200 Subject: scalebutton: fix orientation not applied to scale --- gtk/gtkscalebutton.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c index 2742864841..f64f122bed 100644 --- a/gtk/gtkscalebutton.c +++ b/gtk/gtkscalebutton.c @@ -816,6 +816,40 @@ gtk_scale_button_get_active (GtkScaleButton *button) return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button)); } +static void +apply_orientation (GtkScaleButton *button, + GtkOrientation orientation) +{ + GtkScaleButtonPrivate *priv = gtk_scale_button_get_instance_private (button); + + if (priv->applied_orientation != orientation) + { + priv->applied_orientation = orientation; + + gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->box), orientation); + gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->scale), orientation); + + if (orientation == GTK_ORIENTATION_VERTICAL) + { + gtk_box_reorder_child_after (GTK_BOX (priv->box), priv->scale, + priv->plus_button); + gtk_box_reorder_child_after (GTK_BOX (priv->box), priv->minus_button, + priv->scale); + gtk_widget_set_size_request (GTK_WIDGET (priv->scale), -1, SCALE_SIZE); + gtk_range_set_inverted (GTK_RANGE (priv->scale), TRUE); + } + else + { + gtk_box_reorder_child_after (GTK_BOX (priv->box), priv->scale, + priv->minus_button); + gtk_box_reorder_child_after (GTK_BOX (priv->box), priv->plus_button, + priv->scale); + gtk_widget_set_size_request (GTK_WIDGET (priv->scale), SCALE_SIZE, -1); + gtk_range_set_inverted (GTK_RANGE (priv->scale), FALSE); + } + } +} + static void gtk_scale_button_set_orientation_private (GtkScaleButton *button, GtkOrientation orientation) @@ -825,6 +859,9 @@ gtk_scale_button_set_orientation_private (GtkScaleButton *button, if (priv->orientation != orientation) { priv->orientation = orientation; + + apply_orientation (button, priv->orientation); + g_object_notify (G_OBJECT (button), "orientation"); } } @@ -861,6 +898,8 @@ gtk_scale_popup (GtkWidget *widget) GtkScaleButton *button = GTK_SCALE_BUTTON (widget); GtkScaleButtonPrivate *priv = gtk_scale_button_get_instance_private (button); + apply_orientation (button, priv->orientation); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button), TRUE); } -- cgit v1.2.1 From 2ac3d0a59dce1656f6a46781797e270e54f88531 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 12 Apr 2023 11:24:46 +0200 Subject: 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. --- gtk/gtktextview.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index c384002f76..04924ca829 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -5640,6 +5640,26 @@ gtk_text_view_click_gesture_pressed (GtkGestureClick *gesture, if (state & GDK_SHIFT_MASK) extends = TRUE; + if (n_press > 1) + { + GtkTextBuffer *buffer; + GtkTextIter cur, ins; + + buffer = get_buffer (text_view); + get_iter_from_gesture (text_view, GTK_GESTURE (gesture), + &cur, NULL, NULL); + gtk_text_buffer_get_iter_at_mark (buffer, &ins, + gtk_text_buffer_get_insert (buffer)); + + /* Reset count if double/triple clicking on a different line */ + if (gtk_text_iter_get_line (&cur) != + gtk_text_iter_get_line (&ins)) + { + gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture)); + n_press = 1; + } + } + switch (n_press) { case 1: -- cgit v1.2.1 From ca12226e7cfb5e9049850eb1f7c18a961be9e815 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 12 Apr 2023 12:07:30 +0200 Subject: 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 --- gtk/gtkfilechooserentry.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c index 4f3d2f8c7f..6c50524adb 100644 --- a/gtk/gtkfilechooserentry.c +++ b/gtk/gtkfilechooserentry.c @@ -193,28 +193,30 @@ match_func (GtkEntryCompletion *compl, gpointer user_data) { GtkFileChooserEntry *chooser_entry = user_data; + GFileInfo *info; + + gtk_tree_model_get (GTK_TREE_MODEL (chooser_entry->completion_store), + iter, + FILE_INFO_COLUMN, &info, + -1); + + g_assert (info != NULL); + g_object_unref (info); + + if (g_file_info_get_attribute_boolean (info, "filechooser::filtered-out")) + return FALSE; /* If we arrive here, the GtkFileSystemModel's GtkFileFilter already filtered out all * files that don't start with the current prefix, so we manually apply the GtkFileChooser's - * current file filter (e.g. just jpg files) here. */ + * current file filter (e.g. just jpg files) here. + */ if (chooser_entry->current_filter != NULL) { - GFileInfo *info; - - gtk_tree_model_get (GTK_TREE_MODEL (chooser_entry->completion_store), - iter, - FILE_INFO_COLUMN, &info, - -1); - - g_assert (info != NULL); - g_object_unref (info); - /* We always allow navigating into subfolders, so don't ever filter directories */ if (g_file_info_get_file_type (info) != G_FILE_TYPE_REGULAR) return TRUE; g_assert (g_file_info_has_attribute (info, "standard::file")); - return gtk_filter_match (GTK_FILTER (chooser_entry->current_filter), info); } -- cgit v1.2.1 From f66b6e5059b987ea2af09c188436fdaa78b65cf1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 12 Apr 2023 12:08:14 +0200 Subject: filechooserentry: Plug a memory leak --- gtk/gtkfilechooserentry.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c index 6c50524adb..e10ad94890 100644 --- a/gtk/gtkfilechooserentry.c +++ b/gtk/gtkfilechooserentry.c @@ -600,6 +600,9 @@ model_items_changed_cb (GListModel *model, DISPLAY_NAME_COLUMN, display_name, -1); + g_free (display_name); + g_free (full_path); + g_clear_object (&info); position++; -- cgit v1.2.1 From e63a066ced2afce06402c48467a150acb284d13b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 12 Apr 2023 00:41:20 +0200 Subject: 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 --- gtk/gtkalertdialog.c | 3 +++ gtk/gtkcolordialog.c | 3 +++ gtk/gtkfiledialog.c | 15 +++++++++++++++ gtk/gtkfontdialog.c | 11 +++++++++++ 4 files changed, 32 insertions(+) diff --git a/gtk/gtkalertdialog.c b/gtk/gtkalertdialog.c index 33ccac37d9..efb4ed4a64 100644 --- a/gtk/gtkalertdialog.c +++ b/gtk/gtkalertdialog.c @@ -747,6 +747,9 @@ gtk_alert_dialog_choose_finish (GtkAlertDialog *self, g_return_val_if_fail (g_task_is_valid (result, self), -1); g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_alert_dialog_choose, -1); + /* Destroy the dialog window not to be bound to GTask lifecycle */ + g_task_set_task_data (G_TASK (result), NULL, NULL); + return (int) g_task_propagate_int (G_TASK (result), error); } diff --git a/gtk/gtkcolordialog.c b/gtk/gtkcolordialog.c index d93c68ad3f..a6e69be7e9 100644 --- a/gtk/gtkcolordialog.c +++ b/gtk/gtkcolordialog.c @@ -492,6 +492,9 @@ gtk_color_dialog_choose_rgba_finish (GtkColorDialog *self, g_return_val_if_fail (g_task_is_valid (result, self), NULL); g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_color_dialog_choose_rgba, NULL); + /* Destroy the dialog window not to be bound to GTask lifecycle */ + g_task_set_task_data (G_TASK (result), NULL, NULL); + return g_task_propagate_pointer (G_TASK (result), error); } diff --git a/gtk/gtkfiledialog.c b/gtk/gtkfiledialog.c index 8b9fc21a6a..b267e2d239 100644 --- a/gtk/gtkfiledialog.c +++ b/gtk/gtkfiledialog.c @@ -976,6 +976,9 @@ gtk_file_dialog_open_finish (GtkFileDialog *self, g_return_val_if_fail (g_task_is_valid (result, self), NULL); g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_file_dialog_open, NULL); + /* Destroy the dialog window not to be bound to GTask lifecycle */ + g_task_set_task_data (G_TASK (result), NULL, NULL); + return finish_file_op (self, G_TASK (result), error); } @@ -1050,6 +1053,9 @@ gtk_file_dialog_select_folder_finish (GtkFileDialog *self, g_return_val_if_fail (g_task_is_valid (result, self), NULL); g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_file_dialog_select_folder, NULL); + /* Destroy the dialog window not to be bound to GTask lifecycle */ + g_task_set_task_data (G_TASK (result), NULL, NULL); + return finish_file_op (self, G_TASK (result), error); } @@ -1120,6 +1126,9 @@ gtk_file_dialog_save_finish (GtkFileDialog *self, g_return_val_if_fail (g_task_is_valid (result, self), NULL); g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_file_dialog_save, NULL); + /* Destroy the dialog window not to be bound to GTask lifecycle */ + g_task_set_task_data (G_TASK (result), NULL, NULL); + return finish_file_op (self, G_TASK (result), error); } @@ -1194,6 +1203,9 @@ gtk_file_dialog_open_multiple_finish (GtkFileDialog *self, g_return_val_if_fail (g_task_is_valid (result, self), NULL); g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_file_dialog_open_multiple, NULL); + /* Destroy the dialog window not to be bound to GTask lifecycle */ + g_task_set_task_data (G_TASK (result), NULL, NULL); + return finish_multiple_files_op (self, G_TASK (result), error); } @@ -1268,6 +1280,9 @@ gtk_file_dialog_select_multiple_folders_finish (GtkFileDialog *self, g_return_val_if_fail (g_task_is_valid (result, self), NULL); g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_file_dialog_select_multiple_folders, NULL); + /* Destroy the dialog window not to be bound to GTask lifecycle */ + g_task_set_task_data (G_TASK (result), NULL, NULL); + return finish_multiple_files_op (self, G_TASK (result), error); } diff --git a/gtk/gtkfontdialog.c b/gtk/gtkfontdialog.c index 878456d94d..c533dac2cc 100644 --- a/gtk/gtkfontdialog.c +++ b/gtk/gtkfontdialog.c @@ -697,6 +697,9 @@ gtk_font_dialog_choose_family_finish (GtkFontDialog *self, g_return_val_if_fail (g_task_is_valid (result, self), NULL); g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_font_dialog_choose_family, NULL); + /* Destroy the dialog window not to be bound to GTask lifecycle */ + g_task_set_task_data (G_TASK (result), NULL, NULL); + return g_task_propagate_pointer (G_TASK (result), error); } @@ -777,6 +780,9 @@ gtk_font_dialog_choose_face_finish (GtkFontDialog *self, g_return_val_if_fail (g_task_is_valid (result, self), NULL); g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_font_dialog_choose_face, NULL); + /* Destroy the dialog window not to be bound to GTask lifecycle */ + g_task_set_task_data (G_TASK (result), NULL, NULL); + return g_task_propagate_pointer (G_TASK (result), error); } @@ -855,6 +861,9 @@ gtk_font_dialog_choose_font_finish (GtkFontDialog *self, g_return_val_if_fail (g_task_is_valid (result, self), NULL); g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_font_dialog_choose_font, NULL); + /* Destroy the dialog window not to be bound to GTask lifecycle */ + g_task_set_task_data (G_TASK (result), NULL, NULL); + return g_task_propagate_pointer (G_TASK (result), error); } @@ -944,6 +953,8 @@ gtk_font_dialog_choose_font_and_features_finish (GtkFontDialog *self, g_return_val_if_fail (g_task_is_valid (result, self), FALSE); g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_font_dialog_choose_font_and_features, FALSE); + /* Destroy the dialog window not to be bound to GTask lifecycle */ + g_task_set_task_data (G_TASK (result), NULL, NULL); font_result = g_task_propagate_pointer (G_TASK (result), error); if (font_result) -- cgit v1.2.1 From 439dec9a54a1a73f67e7d76fbda7b813eb694b86 Mon Sep 17 00:00:00 2001 From: Alexander Mikhaylenko Date: Wed, 12 Apr 2023 21:05:23 +0400 Subject: 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. --- gtk/ui/gtkprintunixdialog.ui | 3 --- 1 file changed, 3 deletions(-) diff --git a/gtk/ui/gtkprintunixdialog.ui b/gtk/ui/gtkprintunixdialog.ui index bc04e45fe9..d27c585ea2 100644 --- a/gtk/ui/gtkprintunixdialog.ui +++ b/gtk/ui/gtkprintunixdialog.ui @@ -19,9 +19,6 @@ 1 2 - 1 -- cgit v1.2.1 From d9fbcdb82e0df23e7a613f3739b4ea7e66aa9ad8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 13 Apr 2023 07:23:06 +0200 Subject: 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 --- gtk/gtkopenuriportal.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gtk/gtkopenuriportal.c b/gtk/gtkopenuriportal.c index 10001cacf4..1bec7a1cb0 100644 --- a/gtk/gtkopenuriportal.c +++ b/gtk/gtkopenuriportal.c @@ -67,6 +67,12 @@ init_openuri_portal (void) g_error_free (error); } + if (gtk_xdp_open_uri_get_version (openuri) < 3) + { + g_warning ("Not a supported version of the OpenURI portal: %u", gtk_xdp_open_uri_get_version (openuri)); + g_clear_object (&openuri); + } + g_object_unref (connection); } else -- cgit v1.2.1 From 8c1e61d54cbc13c7b784c9e11e12f2e4994b5809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 14 Apr 2023 18:05:21 +0200 Subject: gtk: Improve documentation on returned nodes for snapshot Closes: #5747 --- gtk/gskpango.c | 3 +++ gtk/gtksnapshot.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gtk/gskpango.c b/gtk/gskpango.c index 41a4b1a7bc..c83f97f537 100644 --- a/gtk/gskpango.c +++ b/gtk/gskpango.c @@ -460,6 +460,9 @@ 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. + * + * Note that if the layout does not produce any visible output, then nodes + * may not be added to the @snapshot. **/ void gtk_snapshot_append_layout (GtkSnapshot *snapshot, diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c index 76005769d8..44123e9bae 100644 --- a/gtk/gtksnapshot.c +++ b/gtk/gtksnapshot.c @@ -300,6 +300,8 @@ gtk_snapshot_new (void) * Returns the node that was constructed by @snapshot * and frees @snapshot. * + * See also [method@Gtk.Snapshot.to_node]. + * * Returns: (transfer full) (nullable): a newly-created [class@Gsk.RenderNode] */ GskRenderNode * @@ -1569,11 +1571,16 @@ gtk_snapshot_pop_collect (GtkSnapshot *snapshot) * Returns the render node that was constructed * by @snapshot. * + * Note that this function may return %NULL if nothing has been + * added to the snapshot or if its content does not produce pixels + * to be rendered. + * * After calling this function, it is no longer possible to * add more nodes to @snapshot. The only function that should * be called after this is [method@GObject.Object.unref]. * - * Returns: (transfer full) (nullable): the constructed `GskRenderNode` + * Returns: (transfer full) (nullable): the constructed `GskRenderNode` or + * %NULL if there are no nodes to render. */ GskRenderNode * gtk_snapshot_to_node (GtkSnapshot *snapshot) -- cgit v1.2.1 From 47070e56630f34a81f6c38a54afa129a492070c1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 15 Apr 2023 14:58:57 +0200 Subject: 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. --- gtk/gtkwindow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index dced97168b..cf0fd50e3c 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -2023,7 +2023,7 @@ gtk_window_root_set_focus (GtkRoot *root, synthesize_focus_change_events (self, old_focus, focus, GTK_CROSSING_FOCUS); if (focus) - gtk_widget_set_has_focus (focus, TRUE); + gtk_widget_set_has_focus (focus, priv->is_active); g_set_object (&priv->focus_widget, focus); -- cgit v1.2.1 From 56503cd6230007671d99cc64c2ca809b82ee84db Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 15 Apr 2023 15:00:53 +0200 Subject: wayland: Improve logging for primary selection --- gdk/wayland/gdkprimary-wayland.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gdk/wayland/gdkprimary-wayland.c b/gdk/wayland/gdkprimary-wayland.c index b501deb66b..9a9640d852 100644 --- a/gdk/wayland/gdkprimary-wayland.c +++ b/gdk/wayland/gdkprimary-wayland.c @@ -99,7 +99,7 @@ gdk_wayland_primary_claim_remote (GdkWaylandPrimary *cb, if (cb->source) { - GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, "%p: Ignoring clipboard offer for self", cb); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, "%p: Ignoring primary offer for self", cb); gdk_content_formats_unref (formats); g_clear_pointer (&offer, zwp_primary_selection_offer_v1_destroy); return; @@ -111,7 +111,7 @@ gdk_wayland_primary_claim_remote (GdkWaylandPrimary *cb, if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD)) { char *s = gdk_content_formats_to_string (formats); - gdk_debug_message ("%p: remote clipboard claim for %s", cb, s); + gdk_debug_message ("%p: remote primary claim for %s", cb, s); g_free (s); } #endif @@ -119,8 +119,7 @@ gdk_wayland_primary_claim_remote (GdkWaylandPrimary *cb, cb->offer_formats = formats; cb->offer = offer; - gdk_clipboard_claim_remote (GDK_CLIPBOARD (cb), - cb->offer_formats); + gdk_clipboard_claim_remote (GDK_CLIPBOARD (cb), cb->offer_formats); } static void @@ -271,6 +270,14 @@ gdk_wayland_primary_claim (GdkClipboard *clipboard, { GdkWaylandPrimary *cb = GDK_WAYLAND_PRIMARY (clipboard); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (clipboard), CLIPBOARD)) + { + char *s = gdk_content_formats_to_string (formats); + gdk_debug_message ("%p: claim primary (%s) for %s", cb, local ? "local" : "remote", s); + g_free (s); + } +#endif if (local) { GdkWaylandDisplay *wdisplay = GDK_WAYLAND_DISPLAY (gdk_clipboard_get_display (clipboard)); -- cgit v1.2.1 From 2634e2b74bd0465d6649b5a8c29cb6ba65c1b347 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 15 Apr 2023 15:02:09 +0200 Subject: text: Only claim primary when focused It does not make sense otherwise, and has unfortunate side-effects on Wayland. --- gtk/gtktext.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 98733b0f36..7b7d2eb4a5 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -3260,6 +3260,7 @@ gtk_text_focus_changed (GtkEventControllerFocus *controller, gtk_text_im_set_focus_in (self); gtk_text_reset_blink_time (self); gtk_text_check_cursor_blink (self); + gtk_text_update_primary_selection (self); } else /* Focus out */ { @@ -5364,6 +5365,9 @@ gtk_text_update_primary_selection (GtkText *self) if (!gtk_widget_get_realized (GTK_WIDGET (self))) return; + if (!gtk_widget_has_focus (GTK_WIDGET (self))) + return; + clipboard = gtk_widget_get_primary_clipboard (GTK_WIDGET (self)); if (priv->selection_bound != priv->current_pos) -- cgit v1.2.1 From 8b8f493bbab756151b2936ad5eb4ee2b7839cd02 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 15 Apr 2023 17:50:18 +0200 Subject: 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. --- gsk/gl/gskglcommandqueue.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gsk/gl/gskglcommandqueue.c b/gsk/gl/gskglcommandqueue.c index 8fee49fd15..a8624642f0 100644 --- a/gsk/gl/gskglcommandqueue.c +++ b/gsk/gl/gskglcommandqueue.c @@ -1002,8 +1002,11 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self, glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation (GL_FUNC_ADD); - glGenVertexArrays (1, &vao_id); - glBindVertexArray (vao_id); + if (!gdk_gl_context_get_use_es (self->context)) + { + glGenVertexArrays (1, &vao_id); + glBindVertexArray (vao_id); + } vbo_id = gsk_gl_buffer_submit (&self->vertices); @@ -1159,7 +1162,8 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self, } glDeleteBuffers (1, &vbo_id); - glDeleteVertexArrays (1, &vao_id); + if (!gdk_gl_context_get_use_es (self->context)) + glDeleteVertexArrays (1, &vao_id); gdk_profiler_set_int_counter (self->metrics.n_binds, n_binds); gdk_profiler_set_int_counter (self->metrics.n_uniforms, n_uniforms); -- cgit v1.2.1 From f9810d76ae6972b8968dba42ba43e2b5ba6db5b6 Mon Sep 17 00:00:00 2001 From: Cam Cook Date: Sat, 15 Apr 2023 12:41:13 -0400 Subject: | 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" | --- gtk/gtkentry.c | 2 +- gtk/gtkflowbox.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 1c0798ff97..e269b17f4e 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -2098,7 +2098,7 @@ gtk_entry_get_visibility (GtkEntry *entry) } /** - * gtk_entry_set_invisible_char: (attributes org.gtk.Method.sets_property=invisible-char) + * gtk_entry_set_invisible_char: (attributes org.gtk.Method.set_property=invisible-char) * @entry: a `GtkEntry` * @ch: a Unicode character * diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c index 5b6c8088a1..123559ea24 100644 --- a/gtk/gtkflowbox.c +++ b/gtk/gtkflowbox.c @@ -538,7 +538,7 @@ gtk_flow_box_child_class_init (GtkFlowBoxChildClass *class) * * Emitted when the user activates a child widget in a `GtkFlowBox`. * - * This can be happen either by clicking or double-clicking, + * This can happen either by clicking or double-clicking, * or via a keybinding. * * This is a [keybinding signal](class.SignalAction.html), -- cgit v1.2.1 From 116324e21cb6f2020765069f3d1a168c7f048889 Mon Sep 17 00:00:00 2001 From: Cam Cook Date: Sat, 15 Apr 2023 21:48:27 -0400 Subject: | 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 --- gtk/gtklabel.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 5342ac7833..3e646ababa 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -3235,10 +3235,10 @@ gtk_label_set_attributes (GtkLabel *self, * * This is the [struct@Pango.AttrList] that was set on the label using * [method@Gtk.Label.set_attributes], if any. This function does not - * reflect attributes that come from the labels markup (see + * reflect attributes that come from the label's markup (see * [method@Gtk.Label.set_markup]). If you want to get the effective * attributes for the label, use - * `pango_layout_get_attribute (gtk_label_get_layout (self))`. + * `pango_layout_get_attributes (gtk_label_get_layout (self))`. * * Returns: (nullable) (transfer none): the attribute list */ @@ -3888,7 +3888,7 @@ gtk_label_get_justify (GtkLabel *self) * @self: a `GtkLabel` * @mode: a `PangoEllipsizeMode` * - * Sets the mode used to ellipsizei the text. + * Sets the mode used to ellipsize the text. * * The text will be ellipsized if there is not enough space * to render the entire string. @@ -5893,7 +5893,7 @@ gtk_label_get_xalign (GtkLabel *self) } /** - * gtk_label_set_yalign: (attributes org.gtk.Method.get_property=yalign) + * gtk_label_set_yalign: (attributes org.gtk.Method.set_property=yalign) * @self: a `GtkLabel` * @yalign: the new yalign value, between 0 and 1 * @@ -5919,7 +5919,7 @@ gtk_label_set_yalign (GtkLabel *self, } /** - * gtk_label_get_yalign: (attributes org.gtk.Method.set_property=yalign) + * gtk_label_get_yalign: (attributes org.gtk.Method.get_property=yalign) * @self: a `GtkLabel` * * Gets the `yalign` of the label. -- cgit v1.2.1 From 22ff7bceff9f4bf273c2c117dd9f6542c8ef4004 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 16 Apr 2023 08:49:20 +0200 Subject: 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. --- gtk/gtktext.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 7b7d2eb4a5..c7316478e7 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -320,6 +320,8 @@ static void gtk_text_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void gtk_text_notify (GObject *object, + GParamSpec *pspec); static void gtk_text_finalize (GObject *object); static void gtk_text_dispose (GObject *object); @@ -738,6 +740,7 @@ gtk_text_class_init (GtkTextClass *class) gobject_class->finalize = gtk_text_finalize; gobject_class->set_property = gtk_text_set_property; gobject_class->get_property = gtk_text_get_property; + gobject_class->notify = gtk_text_notify; widget_class->map = gtk_text_map; widget_class->unmap = gtk_text_unmap; @@ -1815,6 +1818,17 @@ gtk_text_get_property (GObject *object, } } +static void +gtk_text_notify (GObject *object, + GParamSpec *pspec) +{ + if (pspec->name == I_("has-focus")) + gtk_text_check_cursor_blink (GTK_TEXT (object)); + + if (G_OBJECT_CLASS (gtk_text_parent_class)->notify) + G_OBJECT_CLASS (gtk_text_parent_class)->notify (object, pspec); +} + static void gtk_text_ensure_text_handles (GtkText *self) { @@ -6455,8 +6469,11 @@ static gboolean cursor_blinks (GtkText *self) { GtkTextPrivate *priv = gtk_text_get_instance_private (self); + GtkRoot *root = gtk_widget_get_root (GTK_WIDGET (self)); - if (gtk_event_controller_focus_is_focus (GTK_EVENT_CONTROLLER_FOCUS (priv->focus_controller)) && + if (gtk_widget_get_mapped (GTK_WIDGET (self)) && + gtk_window_is_active (GTK_WINDOW (root)) && + gtk_event_controller_focus_is_focus (GTK_EVENT_CONTROLLER_FOCUS (priv->focus_controller)) && priv->editable && priv->selection_bound == priv->current_pos) { -- cgit v1.2.1 From f492e37354da2b04b45c5f82d937b56afde09070 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 16 Apr 2023 08:50:35 +0200 Subject: tests: Check is-focus instead of has-focus We are not presenting windows here. --- testsuite/gtk/builder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/gtk/builder.c b/testsuite/gtk/builder.c index 090d89378d..7ffb8455a8 100644 --- a/testsuite/gtk/builder.c +++ b/testsuite/gtk/builder.c @@ -1641,7 +1641,7 @@ test_widget (void) builder = builder_new_from_string (buffer, -1, NULL); button1 = gtk_builder_get_object (builder, "button1"); - g_assert_true (gtk_widget_has_focus (GTK_WIDGET (button1))); + g_assert_true (gtk_widget_is_focus (GTK_WIDGET (button1))); window1 = gtk_builder_get_object (builder, "window1"); gtk_window_destroy (GTK_WINDOW (window1)); -- cgit v1.2.1 From 7417d30a1fb6f737834a0d0accbbec95e32dbc03 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 16 Apr 2023 09:11:24 +0200 Subject: testsuite: Actually wait for focus We were failing to properly iterate the main context here. Oops. --- testsuite/gtk/test-focus-chain.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/testsuite/gtk/test-focus-chain.c b/testsuite/gtk/test-focus-chain.c index 3846ac525d..0ab28caee9 100644 --- a/testsuite/gtk/test-focus-chain.c +++ b/testsuite/gtk/test-focus-chain.c @@ -208,14 +208,14 @@ load_ui_file (GFile *ui_file, timeout_handle_id = g_timeout_add (2000, quit_iteration_loop, &keep_running); - while (keep_running) - { - if (!g_main_context_iteration (NULL, FALSE)) - break; - } + while (keep_running && !gtk_window_is_active (GTK_WINDOW (window))) + g_main_context_iteration (NULL, TRUE); + if (keep_running) g_source_remove (timeout_handle_id); + g_assert (gtk_window_is_active (GTK_WINDOW (window))); + if (ext) { int i; -- cgit v1.2.1 From 79d8220908c209a4268f29883db121c949b75b1a Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 16 Apr 2023 04:36:12 +0200 Subject: 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 7fafa5133b5. Luckily, we leak all surfaces, so this problem never occured. --- gdk/wayland/gdksurface-wayland.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index a76a2c7247..40b136cb98 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -632,7 +632,7 @@ gdk_wayland_surface_dispose (GObject *object) GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)); display_wayland->event_queues = - g_list_remove (display_wayland->event_queues, surface); + g_list_remove (display_wayland->event_queues, impl->event_queue); g_clear_pointer (&impl->event_queue, wl_event_queue_destroy); } -- cgit v1.2.1 From 555c7e9ee2398320d138b2e8178418e2b399778f Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 21 Apr 2023 09:26:23 +0200 Subject: 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 590f3dfa1fcb. --- gdk/wayland/gdksurface-wayland.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 40b136cb98..4ded693385 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -520,8 +520,6 @@ _gdk_wayland_display_create_surface (GdkDisplay *display, surface->width = width; surface->height = height; - g_object_ref (surface); - /* More likely to be right than just assuming 1 */ if (display_wayland->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE) { -- cgit v1.2.1 From 8178465c1a2adc81513c35d5d0419f092421c174 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 16 Apr 2023 16:57:48 +0200 Subject: 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. --- testsuite/gtk/shortcuts.c | 1 - 1 file changed, 1 deletion(-) diff --git a/testsuite/gtk/shortcuts.c b/testsuite/gtk/shortcuts.c index 10a7913faa..f4895c5d2e 100644 --- a/testsuite/gtk/shortcuts.c +++ b/testsuite/gtk/shortcuts.c @@ -360,7 +360,6 @@ test_trigger_trigger (void) } gdk_surface_destroy (surface); - g_object_unref (surface); g_object_unref (trigger[0]); g_object_unref (trigger[1]); -- cgit v1.2.1 From f0560c8cdb9bf9f38469a7d6eb7ef566b970cf49 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 16 Apr 2023 20:07:13 +0200 Subject: 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. --- testsuite/gtk/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build index 73dd1369c3..a5811561e7 100644 --- a/testsuite/gtk/meson.build +++ b/testsuite/gtk/meson.build @@ -261,6 +261,7 @@ foreach test : focus_chain_tests join_paths(meson.current_source_dir(), 'focus-chain', test[0] + '.ui'), join_paths(meson.current_source_dir(), 'focus-chain', test[0] + '.' + test[1]), ], + is_parallel: false, env: test_env, suite: [ 'gtk', 'focus' ], ) -- cgit v1.2.1 From 91ca51222ae2d5d70d2e68747216ce487eabcf17 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 16 Apr 2023 20:58:26 +0200 Subject: 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. --- testsuite/gtk/test-focus-chain.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/testsuite/gtk/test-focus-chain.c b/testsuite/gtk/test-focus-chain.c index 0ab28caee9..63484ee1a5 100644 --- a/testsuite/gtk/test-focus-chain.c +++ b/testsuite/gtk/test-focus-chain.c @@ -214,7 +214,11 @@ load_ui_file (GFile *ui_file, if (keep_running) g_source_remove (timeout_handle_id); - g_assert (gtk_window_is_active (GTK_WINDOW (window))); + if (!gtk_window_is_active (GTK_WINDOW (window))) + { + g_print ("Skipping focus tests because window did not get focus. Headless display?"); + exit (77); + } if (ext) { -- cgit v1.2.1 From fe9096a95971e6f87e25806d691175ab4537f85a Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 17 Apr 2023 05:41:34 +0200 Subject: glrenderer: Don't try to use float framebuffers on GLES2 GLES doesn't know what that is. --- gsk/gl/gskglrenderer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index 9ed6a655bc..91973c2ba9 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -372,7 +372,11 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer, return texture; } - format = gsk_render_node_prefers_high_depth (root) ? GL_RGBA32F : GL_RGBA8; + if (gsk_render_node_prefers_high_depth (root) && + gdk_gl_context_check_version (self->context, 3, 0, 3, 0)) + format = GL_RGBA32F; + else + format = GL_RGBA8; gdk_gl_context_make_current (self->context); -- cgit v1.2.1 From d55d3fc3fe655ecc6f52cedd428beca9e62f1d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Sat, 15 Apr 2023 14:35:04 +0400 Subject: gdk: drop unused vertex_array_object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- gdk/gdkglcontextprivate.h | 1 - 1 file changed, 1 deletion(-) diff --git a/gdk/gdkglcontextprivate.h b/gdk/gdkglcontextprivate.h index 2ed799d6f7..81432a2e99 100644 --- a/gdk/gdkglcontextprivate.h +++ b/gdk/gdkglcontextprivate.h @@ -101,7 +101,6 @@ typedef struct { } GdkGLContextProgram; typedef struct { - guint vertex_array_object; guint tmp_framebuffer; guint tmp_vertex_buffer; -- cgit v1.2.1 From 3f29f65396f3be7cdfc4899075aef79d2f61215c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 13 Apr 2023 19:22:21 +0400 Subject: gdk: use GLES when on win32/ANGLE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- gdk/win32/gdkdisplay-win32.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index 5c53f247c2..d07a1c09cb 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -1207,6 +1207,7 @@ gdk_win32_display_init_gl (GdkDisplay *display, { return g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_EGL, "display", display, + "allowed-apis", GDK_GL_API_GLES, NULL); } else -- cgit v1.2.1 From 4e305e215b5acab9fc913135f267f1550941c453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Sat, 15 Apr 2023 14:33:20 +0400 Subject: gdk: drop libangle GLES minimum version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- gdk/gdkdisplay.c | 2 -- gdk/gdkdisplayprivate.h | 1 - gdk/gdkglcontext.c | 14 ++------------ gdk/gdkglcontextprivate.h | 6 +----- gdk/x11/gdkglcontext-glx.c | 2 +- 5 files changed, 4 insertions(+), 21 deletions(-) diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index bebe26f38c..4f6fc60d2b 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -1723,8 +1723,6 @@ gdk_display_init_egl (GdkDisplay *self, epoxy_has_egl_extension (priv->egl_display, "EGL_KHR_no_config_context"); self->have_egl_pixel_format_float = epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_pixel_format_float"); - self->have_egl_win32_libangle = - epoxy_has_egl_extension (priv->egl_display, "EGL_ANGLE_d3d_share_handle_client_buffer"); if (self->have_egl_no_config_context) priv->egl_config_high_depth = gdk_display_create_egl_config (self, diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h index df88bec6ac..2d09708bd4 100644 --- a/gdk/gdkdisplayprivate.h +++ b/gdk/gdkdisplayprivate.h @@ -109,7 +109,6 @@ struct _GdkDisplay guint have_egl_buffer_age : 1; guint have_egl_no_config_context : 1; guint have_egl_pixel_format_float : 1; - guint have_egl_win32_libangle : 1; }; struct _GdkDisplayClass diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index a46ffdb9d9..284db68e20 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -295,7 +295,6 @@ gdk_gl_context_create_egl_context (GdkGLContext *context, /* We will use the default version matching the context status * unless the user requested a version which makes sense */ gdk_gl_context_get_matching_version (api, legacy, - display->have_egl_win32_libangle, &min_major, &min_minor); gdk_gl_context_get_clipped_version (context, min_major, min_minor, @@ -968,7 +967,6 @@ gdk_gl_context_get_forward_compatible (GdkGLContext *context) void gdk_gl_context_get_matching_version (GdkGLAPI api, gboolean legacy, - gboolean win32_libangle, int *major, int *minor) { @@ -989,16 +987,8 @@ gdk_gl_context_get_matching_version (GdkGLAPI api, } else { - if (win32_libangle) - { - maj = GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MAJOR; - min = GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MINOR; - } - else - { - maj = GDK_GL_MIN_GLES_VERSION_MAJOR; - min = GDK_GL_MIN_GLES_VERSION_MINOR; - } + maj = GDK_GL_MIN_GLES_VERSION_MAJOR; + min = GDK_GL_MIN_GLES_VERSION_MINOR; } if (major != NULL) diff --git a/gdk/gdkglcontextprivate.h b/gdk/gdkglcontextprivate.h index 81432a2e99..d9860b11ef 100644 --- a/gdk/gdkglcontextprivate.h +++ b/gdk/gdkglcontextprivate.h @@ -37,8 +37,7 @@ G_BEGIN_DECLS * Backends should make sure to never create a context of a previous version. * * The macros refer to OpenGL; OpenGL with OPENGL_COMPATIBILITY_PROFILE_BIT as - * OPENGL_PROFILE_MASK; OpenGL ES; and OpenGL ES win32 Angle implementation, - * respectively + * OPENGL_PROFILE_MASK; and OpenGL ES respectively */ #define GDK_GL_MIN_GL_VERSION_MAJOR (3) #define GDK_GL_MIN_GL_VERSION_MINOR (2) @@ -46,8 +45,6 @@ G_BEGIN_DECLS #define GDK_GL_MIN_GL_LEGACY_VERSION_MINOR (0) #define GDK_GL_MIN_GLES_VERSION_MAJOR (2) #define GDK_GL_MIN_GLES_VERSION_MINOR (0) -#define GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MAJOR (3) -#define GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MINOR (0) typedef enum { GDK_GL_NONE = 0, @@ -140,7 +137,6 @@ void gdk_gl_context_get_clipped_version (GdkGLContext int *minor); void gdk_gl_context_get_matching_version (GdkGLAPI api, gboolean legacy, - gboolean win32_libangle, int *major, int *minor); diff --git a/gdk/x11/gdkglcontext-glx.c b/gdk/x11/gdkglcontext-glx.c index db3040442c..bdcd3042cc 100644 --- a/gdk/x11/gdkglcontext-glx.c +++ b/gdk/x11/gdkglcontext-glx.c @@ -488,7 +488,7 @@ gdk_x11_context_create_glx_context (GdkGLContext *context, /* We will use the default version matching the context status * unless the user requested a version which makes sense */ - gdk_gl_context_get_matching_version (api, legacy, 0, + gdk_gl_context_get_matching_version (api, legacy, &min_major, &min_minor); gdk_gl_context_get_clipped_version (context, min_major, min_minor, &major, &minor); -- cgit v1.2.1 From b03f21193bfea6d88ceea64d019edaeb071259a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Sun, 16 Apr 2023 21:23:49 +0400 Subject: gdk/win32: drop some unused variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- gdk/win32/gdkglcontext-win32-egl.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/gdk/win32/gdkglcontext-win32-egl.c b/gdk/win32/gdkglcontext-win32-egl.c index 0e8854de49..82019d6e6c 100644 --- a/gdk/win32/gdkglcontext-win32-egl.c +++ b/gdk/win32/gdkglcontext-win32-egl.c @@ -83,20 +83,13 @@ gdk_win32_gl_context_egl_end_frame (GdkDrawContext *draw_context, cairo_region_t *painted) { GdkGLContext *context = GDK_GL_CONTEXT (draw_context); - GdkWin32GLContextEGL *context_egl = GDK_WIN32_GL_CONTEXT_EGL (context); GdkSurface *surface = gdk_gl_context_get_surface (context); GdkDisplay *display = gdk_gl_context_get_display (context); - cairo_rectangle_int_t whole_window; EGLSurface egl_surface; GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->end_frame (draw_context, painted); gdk_gl_context_make_current (context); - whole_window = - (GdkRectangle) { 0, 0, - gdk_surface_get_width (surface), - gdk_surface_get_height (surface) - }; egl_surface = gdk_surface_get_egl_surface (surface); -- cgit v1.2.1