[gtk/matthiasc/for-master: 11/21] textview: Ensure popup menu is properly inserted
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 11/21] textview: Ensure popup menu is properly inserted
- Date: Sun, 10 May 2020 20:28:35 +0000 (UTC)
commit 10921aa23734524e7d4ff04ff31a6c10bb261c26
Author: Matthias Clasen <mclasen redhat com>
Date: Sun May 10 09:16:32 2020 -0400
textview: Ensure popup menu is properly inserted
In the presence of attached children, the css tree and the
widget tree are not in sync, so we need to explicitly set
the parent of the css node before inserting the widget, or
else we end up with critical warnings and a non-working
menu.
This can be seen in testtextview.
gtk/gtktextview.c | 3 +++
1 file changed, 3 insertions(+)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index b6ec008b14..d711ce5498 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -8638,6 +8638,9 @@ gtk_text_view_do_popup (GtkTextView *text_view,
model = gtk_text_view_get_menu_model (text_view);
priv->popup_menu = gtk_popover_menu_new_from_model (model);
+ gtk_css_node_insert_after (gtk_widget_get_css_node (GTK_WIDGET (text_view)),
+ gtk_widget_get_css_node (priv->popup_menu),
+ priv->text_window->css_node);
gtk_widget_set_parent (priv->popup_menu, GTK_WIDGET (text_view));
gtk_popover_set_position (GTK_POPOVER (priv->popup_menu), GTK_POS_BOTTOM);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]