From 30163849680c534008da06818754441b3a024929 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 17 Aug 2024 08:25:31 -0400 Subject: [PATCH 01/16] monitor: Don't forbid scales < 1 With fractional scaling, people try out things like 0.75 scaling, and there's no reason for us to prohibit that from working. Fixes: #6928 --- gdk/gdkmonitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdk/gdkmonitor.c b/gdk/gdkmonitor.c index 685a5ad62f..0b9d8ebe6f 100644 --- a/gdk/gdkmonitor.c +++ b/gdk/gdkmonitor.c @@ -649,7 +649,7 @@ void gdk_monitor_set_scale (GdkMonitor *monitor, double scale) { - g_return_if_fail (scale >= 1.); + g_return_if_fail (scale > 0.); monitor->scale_set = TRUE; From cf2461df7ea7d0f93f06c77c396d2b7cda00ba3e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Aug 2024 11:30:20 -0400 Subject: [PATCH 02/16] a11y: More text interface fixes The old bytes-vs-chars problem exists in more places. Fixes: #6951 --- gtk/gtktext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 27262db91f..f896baa93a 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -6468,7 +6468,7 @@ gtk_text_drag_drop (GtkDropTarget *dest, gtk_editable_insert_text (GTK_EDITABLE (self), str, length, &drop_position); gtk_accessible_text_update_contents (GTK_ACCESSIBLE_TEXT (self), GTK_ACCESSIBLE_TEXT_CONTENT_CHANGE_INSERT, - drop_position, drop_position + length); + drop_position, drop_position + g_utf8_strlen (str, length)); } else { @@ -6480,7 +6480,7 @@ gtk_text_drag_drop (GtkDropTarget *dest, gtk_editable_insert_text (GTK_EDITABLE (self), str, length, &pos); gtk_accessible_text_update_contents (GTK_ACCESSIBLE_TEXT (self), GTK_ACCESSIBLE_TEXT_CONTENT_CHANGE_INSERT, - pos, pos + length); + pos, pos + g_utf8_strlen (str, length)); end_change (self); } @@ -7058,7 +7058,7 @@ emoji_picked (GtkEmojiChooser *chooser, gtk_editable_insert_text (GTK_EDITABLE (self), text, -1, &pos); gtk_accessible_text_update_contents (GTK_ACCESSIBLE_TEXT (self), GTK_ACCESSIBLE_TEXT_CONTENT_CHANGE_INSERT, - pos, pos + 1); + pos, pos + g_utf8_strlen (text, -1)); gtk_text_set_selection_bounds (self, pos, pos); end_change (self); } @@ -7388,7 +7388,7 @@ gtk_text_history_insert_cb (gpointer funcs_data, gtk_editable_insert_text (GTK_EDITABLE (text), str, len, &location); gtk_accessible_text_update_contents (GTK_ACCESSIBLE_TEXT (text), GTK_ACCESSIBLE_TEXT_CONTENT_CHANGE_INSERT, - location, location + len); + location, location + g_utf8_strlen (str, len)); } static void From db16a56ee55d4b514fd8a727a4952e3921dd9dad Mon Sep 17 00:00:00 2001 From: Arjan Molenaar Date: Sun, 25 Aug 2024 11:59:31 +0200 Subject: [PATCH 03/16] macos: Revert "macos: fix window transparency" This reverts commit 84847e46fa94ace7fe4a137656d2a64b06f10f6d. It breaks maximizing windows. --- gdk/macos/GdkMacosWindow.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gdk/macos/GdkMacosWindow.c b/gdk/macos/GdkMacosWindow.c index 04b1dab4ca..0b98b71fa9 100644 --- a/gdk/macos/GdkMacosWindow.c +++ b/gdk/macos/GdkMacosWindow.c @@ -785,13 +785,20 @@ typedef NSString *CALayerContentsGravity; if (decorated) { - style_mask |= NSWindowStyleMaskTitled; + style_mask &= ~NSWindowStyleMaskFullSizeContentView; + [self setTitleVisibility:NSWindowTitleVisible]; } else { - style_mask &= ~NSWindowStyleMaskTitled; + style_mask |= NSWindowStyleMaskFullSizeContentView; + [self setTitleVisibility:NSWindowTitleHidden]; } + [self setTitlebarAppearsTransparent:!decorated]; + [[self standardWindowButton:NSWindowCloseButton] setHidden:!decorated]; + [[self standardWindowButton:NSWindowMiniaturizeButton] setHidden:!decorated]; + [[self standardWindowButton:NSWindowZoomButton] setHidden:!decorated]; + [self setStyleMask:style_mask]; } From 280ffac939bd911ad5241d54927c6492fb40d2f6 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 27 Aug 2024 16:34:32 -0400 Subject: [PATCH 04/16] wayland: Fix an ordering problem When setting an event queue on a proxy, we should not destroy the queue before the proxy. May fix: #6965 --- gdk/wayland/gdksubsurface-wayland.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdk/wayland/gdksubsurface-wayland.c b/gdk/wayland/gdksubsurface-wayland.c index 92f09f17bd..d17ab29918 100644 --- a/gdk/wayland/gdksubsurface-wayland.c +++ b/gdk/wayland/gdksubsurface-wayland.c @@ -134,8 +134,8 @@ get_wl_buffer (GdkWaylandSubsurface *self, while (!cd.done) gdk_wayland_display_dispatch_queue (GDK_DISPLAY (display), event_queue); - wl_event_queue_destroy (event_queue); zwp_linux_buffer_params_v1_destroy (params); + wl_event_queue_destroy (event_queue); buffer = cd.buffer; From 4f4b4549c42655a6ff3eedb97683d8dc5daef370 Mon Sep 17 00:00:00 2001 From: Marek Kasik Date: Wed, 31 Jul 2024 16:37:59 +0200 Subject: [PATCH 05/16] printeroptionwidget: Update on combo-entry change Connect to "changed" signal of the entry displayed with combobox for some options (e.g. watermark text or passcode). This ensures that the strings are propagated to the printer backend. Fixes #6782 --- gtk/print/gtkprinteroptionwidget.c | 32 +++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/gtk/print/gtkprinteroptionwidget.c b/gtk/print/gtkprinteroptionwidget.c index 634a7dea30..51a8a0089f 100644 --- a/gtk/print/gtkprinteroptionwidget.c +++ b/gtk/print/gtkprinteroptionwidget.c @@ -44,6 +44,7 @@ struct GtkPrinterOptionWidgetPrivate { GtkPrinterOption *source; gulong source_changed_handler; + gulong comboentry_changed_handler_id; GtkWidget *check; GtkWidget *combo; @@ -765,9 +766,7 @@ filter_numeric (const char *val, } static void -combo_changed_cb (GtkWidget *combo, - GParamSpec *pspec, - GtkPrinterOptionWidget *widget) +handle_combo_entry_change (GtkPrinterOptionWidget *widget) { GtkPrinterOptionWidgetPrivate *priv = widget->priv; char *value; @@ -813,7 +812,9 @@ combo_changed_cb (GtkWidget *combo, if (changed) { GtkWidget *entry = gtk_widget_get_first_child (priv->combo); + g_signal_handler_block (entry, priv->comboentry_changed_handler_id); gtk_editable_set_text (GTK_EDITABLE (entry), filtered_val); + g_signal_handler_unblock (entry, priv->comboentry_changed_handler_id); } value = filtered_val; } @@ -825,6 +826,21 @@ combo_changed_cb (GtkWidget *combo, emit_changed (widget); } +static void +combo_changed_cb (GtkWidget *combo, + GParamSpec *pspec, + GtkPrinterOptionWidget *widget) +{ + handle_combo_entry_change (widget); +} + +static void +comboentry_changed_cb (GtkEditable *editable, + GtkPrinterOptionWidget *widget) +{ + handle_combo_entry_change (widget); +} + static void entry_changed_cb (GtkWidget *entry, GtkPrinterOptionWidget *widget) @@ -958,9 +974,15 @@ construct_widgets (GtkPrinterOptionWidget *widget) source->choices[i]); gtk_box_append (GTK_BOX (widget), priv->combo); if (GTK_IS_DROP_DOWN (priv->combo)) - g_signal_connect (priv->combo, "notify::selected", G_CALLBACK (combo_changed_cb),widget); + { + g_signal_connect (priv->combo, "notify::selected", G_CALLBACK (combo_changed_cb),widget); + } else - g_signal_connect (gtk_widget_get_last_child (priv->combo), "notify::selected",G_CALLBACK (combo_changed_cb), widget); + { + g_signal_connect (gtk_widget_get_last_child (priv->combo), "notify::selected", G_CALLBACK (combo_changed_cb), widget); + priv->comboentry_changed_handler_id = g_signal_connect (gtk_widget_get_first_child (priv->combo), "changed", G_CALLBACK (comboentry_changed_cb), widget); + } + text = g_strdup_printf ("%s:", source->display_text); priv->label = gtk_label_new_with_mnemonic (text); From 8c3b0ceca9edf34c3ccc6ad981b4357200987747 Mon Sep 17 00:00:00 2001 From: Marek Kasik Date: Wed, 7 Aug 2024 20:25:31 +0200 Subject: [PATCH 06/16] printeroptionwidget: Maintain cursor position in combo-entry Maintain cursor position even if the text in the entry has been filtered. This is achieved by maintaining the same position with respect to the end of the text buffer as we suppose that the text after the cursor hasn't changed. This is measured in characters not bytes. Fixes #6782 --- gtk/print/gtkprinteroptionwidget.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gtk/print/gtkprinteroptionwidget.c b/gtk/print/gtkprinteroptionwidget.c index 51a8a0089f..ecafe3439d 100644 --- a/gtk/print/gtkprinteroptionwidget.c +++ b/gtk/print/gtkprinteroptionwidget.c @@ -812,9 +812,21 @@ handle_combo_entry_change (GtkPrinterOptionWidget *widget) if (changed) { GtkWidget *entry = gtk_widget_get_first_child (priv->combo); + gssize buffer_length, filtered_buffer_length; + gint position; + + position = gtk_editable_get_position (GTK_EDITABLE (entry)); + buffer_length = gtk_entry_buffer_get_length (gtk_entry_get_buffer (GTK_ENTRY (entry))); + g_signal_handler_block (entry, priv->comboentry_changed_handler_id); gtk_editable_set_text (GTK_EDITABLE (entry), filtered_val); g_signal_handler_unblock (entry, priv->comboentry_changed_handler_id); + + filtered_buffer_length = gtk_entry_buffer_get_length (gtk_entry_get_buffer (GTK_ENTRY (entry))); + + /* Maintain position of the cursor with respect to the end of the buffer. */ + if (position > 0 && filtered_buffer_length < buffer_length) + gtk_editable_set_position (GTK_EDITABLE (entry), position - (buffer_length - filtered_buffer_length)); } value = filtered_val; } From 676aa65042c373d8714c67bd8378aff6ce1a44c0 Mon Sep 17 00:00:00 2001 From: Arjan Molenaar Date: Sun, 25 Aug 2024 12:00:02 +0200 Subject: [PATCH 07/16] macos: Set transparent background for toplevel window Toplevel window background is almost transparent. For fully transparent windows the (macOS) shadow calculatation becomes really slow. --- gdk/macos/GdkMacosWindow.c | 15 --------------- gdk/macos/gdkmacostoplevelsurface.c | 8 ++++++++ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/gdk/macos/GdkMacosWindow.c b/gdk/macos/GdkMacosWindow.c index 0b98b71fa9..a1a8aab99b 100644 --- a/gdk/macos/GdkMacosWindow.c +++ b/gdk/macos/GdkMacosWindow.c @@ -692,24 +692,9 @@ typedef NSString *CALayerContentsGravity; -(void)setStyleMask:(NSWindowStyleMask)styleMask { - gboolean was_opaque; - gboolean is_opaque; - - was_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0); - [super setStyleMask:styleMask]; - is_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0); - _gdk_macos_surface_update_fullscreen_state (gdk_surface); - - if (was_opaque != is_opaque) - { - [self setOpaque:is_opaque]; - - if (!is_opaque) - [self setBackgroundColor:[NSColor clearColor]]; - } } -(NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen diff --git a/gdk/macos/gdkmacostoplevelsurface.c b/gdk/macos/gdkmacostoplevelsurface.c index e454c977af..7c637c2308 100644 --- a/gdk/macos/gdkmacostoplevelsurface.c +++ b/gdk/macos/gdkmacostoplevelsurface.c @@ -617,6 +617,14 @@ _gdk_macos_toplevel_surface_constructed (GObject *object) _gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window); + [window setOpaque:NO]; + + /* Workaround: if we use full transparency, window rendering becomes slow, + * because macOS tries to dynamically calculate the shadow. + * Instead provide a tiny bit of alpha, so shadows are drawn around the window. + */ + [window setBackgroundColor:[[NSColor blackColor] colorWithAlphaComponent:0.00001]]; + /* Allow NSWindow to go fullscreen */ [window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; From d9986e8773058b95ad8eabe20277a3f97709dfda Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 31 Aug 2024 11:28:10 -0400 Subject: [PATCH 08/16] x11: Cosmetics Don't return FALSE from a function returning a pointer. --- gdk/x11/gdkdisplay-x11.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index c82bb28591..6fce54476f 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -1472,7 +1472,7 @@ gdk_x11_display_open (const char *display_name) } #endif - /* initialize the display's screens */ + /* initialize the display's screens */ display_x11->screen = _gdk_x11_screen_new (display, DefaultScreen (display_x11->xdisplay)); /* If GL is available we want to pick better default/rgba visuals, @@ -3021,7 +3021,7 @@ gdk_x11_display_init_gl (GdkDisplay *display, GdkX11Display *self = GDK_X11_DISPLAY (display); if (!gdk_x11_display_init_gl_backend (self, &self->window_visual, &self->window_depth, error)) - return FALSE; + return NULL; gdk_x11_display_init_leader_surface (self); From d7da3ecb67af36ee28f70f4fe206d125c83483cf Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 31 Aug 2024 11:26:11 -0400 Subject: [PATCH 09/16] x11: Fix initialization mess When prepare_gl fails in the right way (or the wrong way?), we end up creating the leader window twice, and as a side effect, creating two instances of the "Virtual core pointer" device, which is bad news for grabs. Fixes: #6840 --- gdk/x11/gdkdisplay-x11.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 6fce54476f..b1bed6b7c6 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -1484,8 +1484,11 @@ gdk_x11_display_open (const char *display_name) */ if (!gdk_display_prepare_gl (display, NULL)) { - gdk_x11_display_query_default_visual (display_x11, &display_x11->window_visual, &display_x11->window_depth); - gdk_x11_display_init_leader_surface (display_x11); + if (!display_x11->leader_gdk_surface) + { + gdk_x11_display_query_default_visual (display_x11, &display_x11->window_visual, &display_x11->window_depth); + gdk_x11_display_init_leader_surface (display_x11); + } } #ifdef HAVE_XFIXES From 68822dbc1bd3ac28ead58ad6bc66d48e2757e686 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 31 Aug 2024 16:24:52 -0400 Subject: [PATCH 10/16] emojichooser: Avoid extra work When selecting an emoji in the recent section, there is no need to add it to the recent section again. This avoids a sequence of unfortunate events, where we reconstruct the entire recent section, thereby removing the focus child, causing the focus to revert to the entry, causing the entry to select the entire text. In the case of Ctrl-clicking to select multiple Emoji, the effect is that the section Emoji will replace the entire entry text, which is suprising and unintended. Fixes: #6336 --- gtk/gtkemojichooser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c index c7b167f85f..088c0fa7c9 100644 --- a/gtk/gtkemojichooser.c +++ b/gtk/gtkemojichooser.c @@ -439,7 +439,8 @@ emoji_activated (GtkFlowBox *box, item = (GVariant*) g_object_get_data (G_OBJECT (child), "emoji-data"); modifier = (gunichar) GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (child), "modifier")); - add_recent_item (chooser, item, modifier); + if ((GtkWidget *) box != chooser->recent.box) + add_recent_item (chooser, item, modifier); g_signal_emit (data, signals[EMOJI_PICKED], 0, text); g_free (text); From c242357aceddddcd4be1afefe2bc4dca61ef9fa1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 31 Aug 2024 18:23:49 -0400 Subject: [PATCH 11/16] spinbutton: No emoji for numeric input Continuing from cfc871f031d5, when a spin button is in numeric mode, set the no-emoji input hint, since Emoji aren't useful in numeric input. --- gtk/gtkspinbutton.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index f668e5a7b0..7000317df1 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -2290,6 +2290,9 @@ gtk_spin_button_set_numeric (GtkSpinButton *spin_button, spin_button->numeric = numeric; gtk_text_set_input_purpose (GTK_TEXT (spin_button->entry), numeric ? GTK_INPUT_PURPOSE_NUMBER: GTK_INPUT_PURPOSE_FREE_FORM); + gtk_text_set_input_hints (GTK_TEXT (spin_button->entry), + numeric ? GTK_INPUT_HINT_NO_EMOJI : GTK_INPUT_HINT_NONE); + g_object_notify_by_pspec (G_OBJECT (spin_button), spinbutton_props[PROP_NUMERIC]); } } From 3e6f1871fb6f7c07fc697c4c04128f0cd842fd03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tyrychtr?= Date: Sun, 1 Sep 2024 11:59:47 +0000 Subject: [PATCH 12/16] a11y: Set expanded states properly when switching to a submenu --- gtk/gtkmodelbutton.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c index aaf8739078..49b5f379af 100644 --- a/gtk/gtkmodelbutton.c +++ b/gtk/gtkmodelbutton.c @@ -1067,10 +1067,29 @@ switch_menu (GtkModelButton *button) stack = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK); if (stack != NULL) { + if (button->role == GTK_BUTTON_ROLE_NORMAL) + { + GtkWidget *title_button = gtk_widget_get_first_child (gtk_stack_get_child_by_name (GTK_STACK (stack), button->menu_name)); + gtk_accessible_update_state (GTK_ACCESSIBLE (button), + GTK_ACCESSIBLE_STATE_EXPANDED, TRUE, + -1); + gtk_accessible_update_state (GTK_ACCESSIBLE (title_button), + GTK_ACCESSIBLE_STATE_EXPANDED, TRUE, + -1); + g_object_set_data (G_OBJECT (title_button), "-gtk-model-button-parent", button); + } + else if (button->role == GTK_BUTTON_ROLE_TITLE) + { + GtkWidget *parent_button = g_object_get_data (G_OBJECT (button), "-gtk-model-button-parent"); + gtk_accessible_update_state (GTK_ACCESSIBLE (parent_button), + GTK_ACCESSIBLE_STATE_EXPANDED, FALSE, + -1); + gtk_accessible_update_state (GTK_ACCESSIBLE (button), + GTK_ACCESSIBLE_STATE_EXPANDED, FALSE, + -1); + g_object_set_data (G_OBJECT (button), "-gtk-model-button-parent", NULL); + } gtk_stack_set_visible_child_name (GTK_STACK (stack), button->menu_name); - gtk_accessible_update_state (GTK_ACCESSIBLE (button), - GTK_ACCESSIBLE_STATE_EXPANDED, TRUE, - -1); } } From 4d05fbe5e37721e7e76cb0e7ba6b69442f1edea8 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 3 Sep 2024 16:50:10 +0100 Subject: [PATCH 13/16] gsk: Add autoptr cleanup function for GskStroke It appeared to be missing, while other GSK types already have cleanup functions defined. Signed-off-by: Philip Withnall --- gsk/gskstroke.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gsk/gskstroke.h b/gsk/gskstroke.h index cf8b82a1ac..83f98251e8 100644 --- a/gsk/gskstroke.h +++ b/gsk/gskstroke.h @@ -83,5 +83,6 @@ GDK_AVAILABLE_IN_4_14 void gsk_stroke_to_cairo (const GskStroke *self, cairo_t *cr); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GskStroke, gsk_stroke_free) G_END_DECLS From 86c8ad70f7a963c47ff96489e185f3e0d6f6d78c Mon Sep 17 00:00:00 2001 From: Arjan Molenaar Date: Mon, 26 Aug 2024 13:06:12 +0200 Subject: [PATCH 14/16] macos: Only allow keyboard focus on toplevel windows This avoids the focus to move to a popup or popover window. The red/yellow/green buttons remain colored. --- gdk/macos/GdkMacosWindow.c | 3 +-- gtk/gtkimcontextquartz.c | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gdk/macos/GdkMacosWindow.c b/gdk/macos/GdkMacosWindow.c index a1a8aab99b..1b350303b2 100644 --- a/gdk/macos/GdkMacosWindow.c +++ b/gdk/macos/GdkMacosWindow.c @@ -250,8 +250,7 @@ typedef NSString *CALayerContentsGravity; -(BOOL)canBecomeKeyWindow { - return GDK_IS_TOPLEVEL (gdk_surface) || - (GDK_IS_POPUP (gdk_surface) && GDK_SURFACE (gdk_surface)->input_region != NULL); + return GDK_IS_TOPLEVEL (gdk_surface); } -(void)showAndMakeKey:(BOOL)makeKey diff --git a/gtk/gtkimcontextquartz.c b/gtk/gtkimcontextquartz.c index e0e068c3ee..dcbb64794c 100644 --- a/gtk/gtkimcontextquartz.c +++ b/gtk/gtkimcontextquartz.c @@ -273,7 +273,8 @@ quartz_set_client_surface (GtkIMContext *context, if (widget != NULL) { - GtkNative *native = gtk_widget_get_native (widget); + GtkRoot *root = gtk_widget_get_root (widget); + GtkNative *native = gtk_widget_get_native (GTK_WIDGET (root)); if (native != NULL) qc->client_surface = gtk_native_get_surface (native); From 62723f9f9b89e5ad53ac0be665209fabac2ad706 Mon Sep 17 00:00:00 2001 From: Arjan Molenaar Date: Tue, 3 Sep 2024 22:42:23 +0200 Subject: [PATCH 15/16] macos: Fix input source popup placement in popovers --- gtk/gtkimcontextquartz.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtkimcontextquartz.c b/gtk/gtkimcontextquartz.c index dcbb64794c..736f11dc2c 100644 --- a/gtk/gtkimcontextquartz.c +++ b/gtk/gtkimcontextquartz.c @@ -318,7 +318,7 @@ quartz_set_cursor_location (GtkIMContext *context, GdkRectangle *area) if (!qc->focused) return; - surface_widget = GTK_WIDGET (gdk_surface_get_widget (qc->client_surface)); + surface_widget = GTK_WIDGET (gtk_widget_get_native (qc->client_widget)); if (!surface_widget) return; From 4294bca0762506af7132a842702640df53030484 Mon Sep 17 00:00:00 2001 From: Mat Date: Fri, 6 Sep 2024 16:12:56 +0000 Subject: [PATCH 16/16] macos: simplify access to native widget. --- gtk/gtkimcontextquartz.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gtk/gtkimcontextquartz.c b/gtk/gtkimcontextquartz.c index 736f11dc2c..cd99e6aae8 100644 --- a/gtk/gtkimcontextquartz.c +++ b/gtk/gtkimcontextquartz.c @@ -273,8 +273,7 @@ quartz_set_client_surface (GtkIMContext *context, if (widget != NULL) { - GtkRoot *root = gtk_widget_get_root (widget); - GtkNative *native = gtk_widget_get_native (GTK_WIDGET (root)); + GtkNative *native = GTK_NATIVE (gtk_widget_get_root (widget)); if (native != NULL) qc->client_surface = gtk_native_get_surface (native);