summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2020-12-04 09:20:50 +0100
committerJonas Ådahl <jadahl@gmail.com>2020-12-07 20:37:29 +0100
commit2cddec77983c02a711ad3920b0d3dba825be617b (patch)
treee9614611cd132d97611d9658b7234c09f64fd3e2 /gtk
parentf7fceab40b1d39fc7f8f2f1ac648a3ac3fad0cd1 (diff)
downloadgtk+-2cddec77983c02a711ad3920b0d3dba825be617b.tar.gz
gtk/popover: Use gtk_popover_present() instead of going via GtkNative
This makes it more explicit that managers of popovers make it "present".
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkcolorswatch.c2
-rw-r--r--gtk/gtkcolumnviewtitle.c2
-rw-r--r--gtk/gtkcombobox.c2
-rw-r--r--gtk/gtkdropdown.c2
-rw-r--r--gtk/gtkemojichooser.c2
-rw-r--r--gtk/gtkentrycompletion.c3
-rw-r--r--gtk/gtkfilechooserwidget.c5
-rw-r--r--gtk/gtklabel.c2
-rw-r--r--gtk/gtklayoutmanager.c5
-rw-r--r--gtk/gtkmenubutton.c2
-rw-r--r--gtk/gtkplacessidebar.c4
-rw-r--r--gtk/gtkplacesviewrow.c3
-rw-r--r--gtk/gtkpopover.c10
-rw-r--r--gtk/gtkpopover.h3
-rw-r--r--gtk/gtkpopovermenubar.c2
-rw-r--r--gtk/gtkscalebutton.c2
-rw-r--r--gtk/gtktext.c10
-rw-r--r--gtk/gtktextview.c8
-rw-r--r--gtk/gtktreeview.c2
19 files changed, 42 insertions, 29 deletions
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index 7addf913d3..a451fd827f 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -322,7 +322,7 @@ swatch_size_allocate (GtkWidget *widget,
}, -1);
if (swatch->popover)
- gtk_native_check_resize (GTK_NATIVE (swatch->popover));
+ gtk_popover_present (GTK_POPOVER (swatch->popover));
}
static void
diff --git a/gtk/gtkcolumnviewtitle.c b/gtk/gtkcolumnviewtitle.c
index c76c8a9a8b..160b1b7604 100644
--- a/gtk/gtkcolumnviewtitle.c
+++ b/gtk/gtkcolumnviewtitle.c
@@ -144,7 +144,7 @@ gtk_column_view_title_size_allocate (GtkWidget *widget,
}
if (self->popup_menu)
- gtk_native_check_resize (GTK_NATIVE (self->popup_menu));
+ gtk_popover_present (GTK_POPOVER (self->popup_menu));
}
static void
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 30b4693078..0b2801e633 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -376,7 +376,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
gtk_widget_set_size_request (priv->popup_widget,
MAX (width, menu_width), -1);
- gtk_native_check_resize (GTK_NATIVE (priv->popup_widget));
+ gtk_popover_present (GTK_POPOVER (priv->popup_widget));
}
static void
diff --git a/gtk/gtkdropdown.c b/gtk/gtkdropdown.c
index 32e5c21c08..669305d539 100644
--- a/gtk/gtkdropdown.c
+++ b/gtk/gtkdropdown.c
@@ -383,7 +383,7 @@ gtk_drop_down_size_allocate (GtkWidget *widget,
gtk_widget_set_size_request (self->popup, width, -1);
gtk_widget_queue_resize (self->popup);
- gtk_native_check_resize (GTK_NATIVE (self->popup));
+ gtk_popover_present (GTK_POPOVER (self->popup));
}
static gboolean
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c
index a41c4b49d5..11bf196e0a 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -113,7 +113,7 @@ gtk_emoji_chooser_child_size_allocate (GtkWidget *widget,
GTK_WIDGET_CLASS (gtk_emoji_chooser_child_parent_class)->size_allocate (widget, width, height, baseline);
if (child->variations)
- gtk_native_check_resize (GTK_NATIVE (child->variations));
+ gtk_popover_present (GTK_POPOVER (child->variations));
}
static gboolean
diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c
index 6c197a4572..6092e036c5 100644
--- a/gtk/gtkentrycompletion.c
+++ b/gtk/gtkentrycompletion.c
@@ -1150,7 +1150,8 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
NULL, FALSE, 0.0, 0.0);
gtk_tree_path_free (path);
}
- gtk_native_check_resize (GTK_NATIVE (completion->popup_window));
+
+ gtk_popover_present (GTK_POPOVER (completion->popup_window));
}
static void
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index dd1cb284cf..18d4033892 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -7225,10 +7225,11 @@ gtk_file_chooser_widget_size_allocate (GtkWidget *widget,
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (widget);
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->size_allocate (widget, width, height, baseline);
+
if (impl->browse_files_popover)
- gtk_native_check_resize (GTK_NATIVE (impl->browse_files_popover));
+ gtk_popover_present (GTK_POPOVER (impl->browse_files_popover));
if (impl->rename_file_popover)
- gtk_native_check_resize (GTK_NATIVE (impl->rename_file_popover));
+ gtk_popover_present (GTK_POPOVER (impl->rename_file_popover));
}
static void
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 58c7431814..61fd639a1f 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3276,7 +3276,7 @@ gtk_label_size_allocate (GtkWidget *widget,
}
if (self->popup_menu)
- gtk_native_check_resize (GTK_NATIVE (self->popup_menu));
+ gtk_popover_present (GTK_POPOVER (self->popup_menu));
}
static void
diff --git a/gtk/gtklayoutmanager.c b/gtk/gtklayoutmanager.c
index d0e4037b2f..483d92ce93 100644
--- a/gtk/gtklayoutmanager.c
+++ b/gtk/gtklayoutmanager.c
@@ -77,6 +77,7 @@
#include "gtklayoutchild.h"
#include "gtkwidgetprivate.h"
#include "gtknative.h"
+#include "gtkpopover.h"
#ifdef G_ENABLE_DEBUG
#define LAYOUT_MANAGER_WARN_NOT_IMPLEMENTED(m,method) G_STMT_START { \
@@ -363,7 +364,9 @@ allocate_native_children (GtkWidget *widget)
child != NULL;
child = _gtk_widget_get_next_sibling (child))
{
- if (GTK_IS_NATIVE (child))
+ if (GTK_IS_POPOVER (child))
+ gtk_popover_present (GTK_POPOVER (child));
+ else if (GTK_IS_NATIVE (child))
gtk_native_check_resize (GTK_NATIVE (child));
}
}
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index 93376641c0..d37ee47fc1 100644
--- a/gtk/gtkmenubutton.c
+++ b/gtk/gtkmenubutton.c
@@ -319,7 +319,7 @@ gtk_menu_button_size_allocate (GtkWidget *widget,
&(GtkAllocation) { 0, 0, width, height },
baseline);
if (self->popover)
- gtk_native_check_resize (GTK_NATIVE (self->popover));
+ gtk_popover_present (GTK_POPOVER (self->popover));
}
static gboolean
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index b90b748b85..41df790cc6 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -4076,10 +4076,10 @@ gtk_places_sidebar_size_allocate (GtkWidget *widget,
baseline);
if (sidebar->popover)
- gtk_native_check_resize (GTK_NATIVE (sidebar->popover));
+ gtk_popover_present (GTK_POPOVER (sidebar->popover));
if (sidebar->rename_popover)
- gtk_native_check_resize (GTK_NATIVE (sidebar->rename_popover));
+ gtk_popover_present (GTK_POPOVER (sidebar->rename_popover));
}
static void
diff --git a/gtk/gtkplacesviewrow.c b/gtk/gtkplacesviewrow.c
index 8d8611bc1c..51af16c465 100644
--- a/gtk/gtkplacesviewrow.c
+++ b/gtk/gtkplacesviewrow.c
@@ -36,6 +36,7 @@
#include "gtkstack.h"
#include "gtktypebuiltins.h"
#include "gtknative.h"
+#include "gtkpopover.h"
#else
#include <gtk/gtk.h>
#endif
@@ -319,7 +320,7 @@ gtk_places_view_row_size_allocate (GtkWidget *widget,
GTK_WIDGET_CLASS (gtk_places_view_row_parent_class)->size_allocate (widget, width, height, baseline);
if (menu)
- gtk_native_check_resize (GTK_NATIVE (menu));
+ gtk_popover_present (GTK_POPOVER (menu));
}
static void
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 0aff55995d..5d923645df 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -577,10 +577,9 @@ present_popup (GtkPopover *popover)
return FALSE;
}
-static void
-gtk_popover_native_check_resize (GtkNative *native)
+void
+gtk_popover_present (GtkPopover *popover)
{
- GtkPopover *popover = GTK_POPOVER (native);
GtkWidget *widget = GTK_WIDGET (popover);
if (!_gtk_widget_get_alloc_needed (widget))
@@ -590,6 +589,11 @@ gtk_popover_native_check_resize (GtkNative *native)
}
static void
+gtk_popover_native_check_resize (GtkNative *native)
+{
+}
+
+static void
maybe_request_motion_event (GtkPopover *popover)
{
GtkWidget *widget = GTK_WIDGET (popover);
diff --git a/gtk/gtkpopover.h b/gtk/gtkpopover.h
index 9cb1208761..1ecb8e57c3 100644
--- a/gtk/gtkpopover.h
+++ b/gtk/gtkpopover.h
@@ -121,6 +121,9 @@ GDK_AVAILABLE_IN_ALL
void gtk_popover_set_default_widget (GtkPopover *popover,
GtkWidget *widget);
+GDK_AVAILABLE_IN_ALL
+void gtk_popover_present (GtkPopover *popover);
+
G_END_DECLS
diff --git a/gtk/gtkpopovermenubar.c b/gtk/gtkpopovermenubar.c
index 447dc5fa65..b98489e8ce 100644
--- a/gtk/gtkpopovermenubar.c
+++ b/gtk/gtkpopovermenubar.c
@@ -320,7 +320,7 @@ gtk_popover_menu_bar_item_size_allocate (GtkWidget *widget,
&(GtkAllocation) { 0, 0, width, height },
baseline);
- gtk_native_check_resize (GTK_NATIVE (item->popover));
+ gtk_popover_present (GTK_POPOVER (item->popover));
}
static void
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index bb39e7f19b..67c6044fc2 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -1001,5 +1001,5 @@ gtk_scale_button_size_allocate (GtkWidget *widget,
&(GtkAllocation) { 0, 0, width, height },
baseline);
- gtk_native_check_resize (GTK_NATIVE (priv->dock));
+ gtk_popover_present (GTK_POPOVER (priv->dock));
}
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 8452344f60..427bb9a891 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -2448,21 +2448,21 @@ gtk_text_size_allocate (GtkWidget *widget,
chooser = g_object_get_data (G_OBJECT (self), "gtk-emoji-chooser");
if (chooser)
- gtk_native_check_resize (GTK_NATIVE (chooser));
+ gtk_popover_present (GTK_POPOVER (chooser));
gtk_text_update_handles (self);
if (priv->emoji_completion)
- gtk_native_check_resize (GTK_NATIVE (priv->emoji_completion));
+ gtk_popover_present (GTK_POPOVER (priv->emoji_completion));
if (priv->magnifier_popover)
- gtk_native_check_resize (GTK_NATIVE (priv->magnifier_popover));
+ gtk_popover_present (GTK_POPOVER (priv->magnifier_popover));
if (priv->popup_menu)
- gtk_native_check_resize (GTK_NATIVE (priv->popup_menu));
+ gtk_popover_present (GTK_POPOVER (priv->popup_menu));
if (priv->selection_bubble)
- gtk_native_check_resize (GTK_NATIVE (priv->selection_bubble));
+ gtk_popover_present (GTK_POPOVER (priv->selection_bubble));
if (priv->text_handles[TEXT_HANDLE_CURSOR])
gtk_native_check_resize (GTK_NATIVE (priv->text_handles[TEXT_HANDLE_CURSOR]));
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 4816bef439..5e26378748 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -4528,13 +4528,13 @@ gtk_text_view_size_allocate (GtkWidget *widget,
chooser = g_object_get_data (G_OBJECT (text_view), "gtk-emoji-chooser");
if (chooser)
- gtk_native_check_resize (GTK_NATIVE (chooser));
+ gtk_popover_present (GTK_POPOVER (chooser));
if (priv->magnifier_popover)
- gtk_native_check_resize (GTK_NATIVE (priv->magnifier_popover));
+ gtk_popover_present (GTK_POPOVER (priv->magnifier_popover));
if (priv->popup_menu)
- gtk_native_check_resize (GTK_NATIVE (priv->popup_menu));
+ gtk_popover_present (GTK_POPOVER (priv->popup_menu));
if (priv->text_handles[TEXT_HANDLE_CURSOR])
gtk_native_check_resize (GTK_NATIVE (priv->text_handles[TEXT_HANDLE_CURSOR]));
@@ -4543,7 +4543,7 @@ gtk_text_view_size_allocate (GtkWidget *widget,
gtk_native_check_resize (GTK_NATIVE (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]));
if (priv->selection_bubble)
- gtk_native_check_resize (GTK_NATIVE (priv->selection_bubble));
+ gtk_popover_present (GTK_POPOVER (priv->selection_bubble));
}
static void
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index def80e5776..dda21f82aa 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -2654,7 +2654,7 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
}
if (priv->search_popover)
- gtk_native_check_resize (GTK_NATIVE (priv->search_popover));
+ gtk_popover_present (GTK_POPOVER (priv->search_popover));
}
/* Grabs the focus and unsets the GTK_TREE_VIEW_DRAW_KEYFOCUS flag */