diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-05-20 04:47:50 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-05-28 20:25:16 +0000 |
commit | 7447abb52b80395c3aa7bd5b788953dbbbf0f78e (patch) | |
tree | d157e693f31a496b642761bd56712ee714a93901 | |
parent | f728295e8c5faae8f870fd5bdd7183e935a86714 (diff) | |
download | gtk+-7447abb52b80395c3aa7bd5b788953dbbbf0f78e.tar.gz |
Stop using gtk_widget_get_toplevel
All uses of it can be replaced by gtk_widget_get_root.
56 files changed, 98 insertions, 98 deletions
diff --git a/demos/gtk-demo/expander.c b/demos/gtk-demo/expander.c index c54f9feec2..9ea3125511 100644 --- a/demos/gtk-demo/expander.c +++ b/demos/gtk-demo/expander.c @@ -38,7 +38,7 @@ do_expander (GtkWidget *do_widget) if (!window) { - toplevel = gtk_widget_get_toplevel (do_widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (do_widget)); window = gtk_message_dialog_new_with_markup (GTK_WINDOW (toplevel), 0, GTK_MESSAGE_ERROR, diff --git a/demos/gtk-demo/fishbowl.c b/demos/gtk-demo/fishbowl.c index 6a1ad923a0..e716a07658 100644 --- a/demos/gtk-demo/fishbowl.c +++ b/demos/gtk-demo/fishbowl.c @@ -212,7 +212,7 @@ set_widget_type (GtkFishbowl *fishbowl, gtk_fishbowl_set_creation_func (fishbowl, widget_types[selected_widget_type].create_func); - window = gtk_widget_get_toplevel (GTK_WIDGET (fishbowl)); + window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (fishbowl))); headerbar = gtk_window_get_titlebar (GTK_WINDOW (window)); gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar), widget_types[selected_widget_type].name); diff --git a/demos/gtk-demo/infobar.c b/demos/gtk-demo/infobar.c index cdcd819d38..82d6b7c8b1 100644 --- a/demos/gtk-demo/infobar.c +++ b/demos/gtk-demo/infobar.c @@ -20,7 +20,7 @@ on_bar_response (GtkInfoBar *info_bar, return; } - window = gtk_widget_get_toplevel (GTK_WIDGET (info_bar)); + window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (info_bar))); dialog = gtk_message_dialog_new (GTK_WINDOW (window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, diff --git a/demos/gtk-demo/links.c b/demos/gtk-demo/links.c index 49edf896ce..0629ebfe84 100644 --- a/demos/gtk-demo/links.c +++ b/demos/gtk-demo/links.c @@ -25,7 +25,7 @@ activate_link (GtkWidget *label, GtkWidget *dialog; GtkWidget *parent; - parent = gtk_widget_get_toplevel (label); + parent = GTK_WIDGET (gtk_widget_get_root (label)); dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (parent), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c index 73c0a748a0..6b997f5810 100644 --- a/demos/gtk-demo/main.c +++ b/demos/gtk-demo/main.c @@ -991,7 +991,7 @@ row_activated_cb (GtkWidget *tree_view, GtkWidget *window; GtkTreeModel *model; - window = gtk_widget_get_toplevel (tree_view); + window = GTK_WIDGET (gtk_widget_get_root (tree_view)); model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)); gtk_tree_model_get_iter (model, &iter, path); diff --git a/demos/gtk-demo/paint.c b/demos/gtk-demo/paint.c index 7a1ceed12d..c783bee904 100644 --- a/demos/gtk-demo/paint.c +++ b/demos/gtk-demo/paint.c @@ -176,7 +176,7 @@ drawing_area_unroot (GtkWidget *widget) DrawingArea *area = (DrawingArea *) widget; GtkWidget *toplevel; - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); if (area->pad_controller) { @@ -198,7 +198,7 @@ drawing_area_root (GtkWidget *widget) GTK_WIDGET_CLASS (drawing_area_parent_class)->root (widget); - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (area)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (area))); action_group = g_simple_action_group_new (); area->pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (action_group), NULL); diff --git a/demos/gtk-demo/video_player.c b/demos/gtk-demo/video_player.c index cf9b42f23d..73e659d6a9 100644 --- a/demos/gtk-demo/video_player.c +++ b/demos/gtk-demo/video_player.c @@ -33,7 +33,7 @@ open_clicked_cb (GtkWidget *button, GtkWidget *dialog; dialog = gtk_file_chooser_dialog_new ("Select a video", - GTK_WINDOW (gtk_widget_get_toplevel (button)), + GTK_WINDOW (gtk_widget_get_root (button)), GTK_FILE_CHOOSER_ACTION_OPEN, "_Cancel", GTK_RESPONSE_CANCEL, "_Open", GTK_RESPONSE_ACCEPT, @@ -48,7 +48,7 @@ static void fullscreen_clicked_cb (GtkWidget *button, gpointer unused) { - GtkWidget *window = gtk_widget_get_toplevel (button); + GtkWidget *window = GTK_WIDGET (gtk_widget_get_root (button)); gtk_window_fullscreen (GTK_WINDOW (window)); } diff --git a/demos/node-editor/node-editor-window.c b/demos/node-editor/node-editor-window.c index 21b985de46..c1a50c18ff 100644 --- a/demos/node-editor/node-editor-window.c +++ b/demos/node-editor/node-editor-window.c @@ -406,7 +406,7 @@ save_response_cb (GtkWidget *dialog, { GtkWidget *dialog; - dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))), + dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))), GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, @@ -430,7 +430,7 @@ save_cb (GtkWidget *button, GtkWidget *dialog; dialog = gtk_file_chooser_dialog_new ("Save node", - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))), + GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))), GTK_FILE_CHOOSER_ACTION_SAVE, "_Cancel", GTK_RESPONSE_CANCEL, "_Save", GTK_RESPONSE_ACCEPT, @@ -514,7 +514,7 @@ export_image_cb (GtkWidget *button, return; dialog = gtk_file_chooser_dialog_new ("", - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))), + GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))), GTK_FILE_CHOOSER_ACTION_SAVE, "_Cancel", GTK_RESPONSE_CANCEL, "_Save", GTK_RESPONSE_ACCEPT, diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c index 0ca0caab03..2e7a67fb7f 100644 --- a/gtk/a11y/gtktreeviewaccessible.c +++ b/gtk/a11y/gtktreeviewaccessible.c @@ -1158,7 +1158,7 @@ gtk_tree_view_accessible_grab_cell_focus (GtkCellAccessibleParent *parent, gtk_tree_path_free (path); gtk_widget_grab_focus (widget); - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); if (GTK_IS_WINDOW (toplevel)) { G_GNUC_BEGIN_IGNORE_DEPRECATIONS diff --git a/gtk/a11y/gtkwidgetaccessible.c b/gtk/a11y/gtkwidgetaccessible.c index 5e681aa190..0a07f47fe2 100644 --- a/gtk/a11y/gtkwidgetaccessible.c +++ b/gtk/a11y/gtkwidgetaccessible.c @@ -584,7 +584,7 @@ gtk_widget_accessible_grab_focus (AtkComponent *component) return FALSE; gtk_widget_grab_focus (widget); - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); if (GTK_IS_WINDOW (toplevel)) { G_GNUC_BEGIN_IGNORE_DEPRECATIONS diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c index 9d47b546b9..48c746585c 100644 --- a/gtk/gtkcolorbutton.c +++ b/gtk/gtkcolorbutton.c @@ -517,7 +517,7 @@ ensure_dialog (GtkColorButton *button) if (priv->cs_dialog != NULL) return; - parent = gtk_widget_get_toplevel (GTK_WIDGET (button)); + parent = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (button))); priv->cs_dialog = dialog = gtk_color_chooser_dialog_new (priv->title, NULL); gtk_window_set_hide_on_close (GTK_WINDOW (dialog), TRUE); diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index 7e00f122c6..59c08c6330 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -720,9 +720,9 @@ gtk_expander_resize_toplevel (GtkExpander *expander) if (child && priv->resize_toplevel && gtk_widget_get_realized (GTK_WIDGET (expander))) { - GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (expander)); + GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (expander))); - if (toplevel && GTK_IS_WINDOW (toplevel) && + if (GTK_IS_WINDOW (toplevel) && gtk_widget_get_realized (toplevel)) { int toplevel_width, toplevel_height; diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index 7ba461d6ac..73b6910299 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -2600,7 +2600,7 @@ open_dialog (GtkFileChooserButton *button) GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button); GtkWidget *toplevel; - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (button))); /* Setup the dialog parent to be chooser button's toplevel, and be modal as needed. */ diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index b89d0dbcd8..1e357596fe 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -712,7 +712,7 @@ get_toplevel (GtkWidget *widget) { GtkWidget *toplevel; - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); if (GTK_IS_WINDOW (toplevel)) return GTK_WINDOW (toplevel); else @@ -1676,7 +1676,7 @@ open_folder_cb (GSimpleAction *action, gpointer data) { GtkFileChooserWidget *impl = data; - GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (impl)); + GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (impl))); GSList *files; files = get_selected_files (impl); @@ -3523,7 +3523,7 @@ gtk_file_chooser_widget_root (GtkWidget *widget) GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->root (widget); - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); g_assert (priv->toplevel_set_focus_id == 0); priv->toplevel_set_focus_id = g_signal_connect (toplevel, "notify::focus-widget", @@ -3539,7 +3539,7 @@ gtk_file_chooser_widget_unroot (GtkWidget *widget) GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl); GtkWidget *toplevel; - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); if (toplevel && priv->toplevel_set_focus_id != 0) { g_signal_handler_disconnect (toplevel, priv->toplevel_set_focus_id); @@ -5220,7 +5220,7 @@ update_current_folder_get_info_cb (GCancellable *cancellable, GtkWidget *toplevel; g_object_unref (cancellable); - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (impl)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (impl))); mount_operation = gtk_mount_operation_new (GTK_WINDOW (toplevel)); @@ -6575,7 +6575,7 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed) GtkWidget *current_focus; gboolean retval; - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (impl)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (impl))); g_assert (GTK_IS_WINDOW (toplevel)); retval = FALSE; diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c index 029a56a3c3..a8fb2deb18 100644 --- a/gtk/gtkfontbutton.c +++ b/gtk/gtkfontbutton.c @@ -948,7 +948,7 @@ gtk_font_button_clicked (GtkButton *button, { GtkWidget *parent; - parent = gtk_widget_get_toplevel (GTK_WIDGET (font_button)); + parent = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (font_button))); priv->font_dialog = gtk_font_chooser_dialog_new (priv->title, NULL); gtk_window_set_hide_on_close (GTK_WINDOW (priv->font_dialog), TRUE); diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c index 37a453c8ad..cdf46c8034 100644 --- a/gtk/gtkfontchooserwidget.c +++ b/gtk/gtkfontchooserwidget.c @@ -642,7 +642,7 @@ update_key_capture (GtkWidget *chooser) GtkWidget *toplevel; GtkWidget *focus; - toplevel = gtk_widget_get_toplevel (chooser); + toplevel = GTK_WIDGET (gtk_widget_get_root (chooser)); focus = gtk_root_get_focus (GTK_ROOT (toplevel)); if (GTK_IS_EDITABLE (focus) && focus != priv->search_entry) diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c index 4f9bb122c8..41bc434189 100644 --- a/gtk/gtkheaderbar.c +++ b/gtk/gtkheaderbar.c @@ -290,7 +290,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar) gboolean shown_by_shell; gboolean is_sovereign_window; - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); if (!GTK_IS_WINDOW (toplevel)) return; diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index a3654634de..5bebc6a999 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -3693,7 +3693,7 @@ gtk_icon_view_move_cursor_up_down (GtkIconView *icon_view, { if (!gtk_widget_keynav_failed (GTK_WIDGET (icon_view), direction)) { - GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (icon_view)); + GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (icon_view))); if (toplevel) gtk_widget_child_focus (toplevel, direction == GTK_DIR_UP ? @@ -3845,7 +3845,7 @@ gtk_icon_view_move_cursor_left_right (GtkIconView *icon_view, { if (!gtk_widget_keynav_failed (GTK_WIDGET (icon_view), direction)) { - GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (icon_view)); + GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (icon_view))); if (toplevel) gtk_widget_child_focus (toplevel, direction == GTK_DIR_LEFT ? diff --git a/gtk/gtkimcontextwayland.c b/gtk/gtkimcontextwayland.c index adf1722035..1955cc17e3 100644 --- a/gtk/gtkimcontextwayland.c +++ b/gtk/gtkimcontextwayland.c @@ -361,7 +361,7 @@ notify_cursor_location (GtkIMContextWayland *context) rect = context->cursor_rect; gtk_widget_translate_coordinates (context->widget, - gtk_widget_get_toplevel (context->widget), + GTK_WIDGET (gtk_widget_get_root (context->widget)), rect.x, rect.y, &rect.x, &rect.y); diff --git a/gtk/gtkimcontextxim.c b/gtk/gtkimcontextxim.c index 3da45d8f7f..6cfec9f271 100644 --- a/gtk/gtkimcontextxim.c +++ b/gtk/gtkimcontextxim.c @@ -1456,7 +1456,7 @@ claim_status_window (GtkIMContextXIM *context_xim) { if (!context_xim->status_window && context_xim->client_widget) { - GtkWidget *toplevel = gtk_widget_get_toplevel (context_xim->client_widget); + GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (context_xim->client_widget)); if (toplevel) { StatusWindow *status_window = status_window_get (toplevel); @@ -1489,7 +1489,7 @@ update_in_toplevel (GtkIMContextXIM *context_xim) { if (context_xim->client_widget) { - GtkWidget *toplevel = gtk_widget_get_toplevel (context_xim->client_widget); + GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (context_xim->client_widget)); context_xim->in_toplevel = toplevel != NULL; } diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 2b97b93c03..332eb13838 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -1844,7 +1844,7 @@ gtk_label_root (GtkWidget *widget) GTK_WIDGET_CLASS (gtk_label_parent_class)->root (widget); - gtk_label_setup_mnemonic (label, gtk_widget_get_toplevel (widget), priv->mnemonic_keyval); + gtk_label_setup_mnemonic (label, GTK_WIDGET (gtk_widget_get_root (widget)), priv->mnemonic_keyval); /* The PangoContext is replaced when the display changes, so clear the layouts */ gtk_label_clear_layout (GTK_LABEL (widget)); @@ -2134,7 +2134,7 @@ gtk_label_recalculate (GtkLabel *label) if (keyval != priv->mnemonic_keyval) { - gtk_label_setup_mnemonic (label, gtk_widget_get_toplevel (GTK_WIDGET (label)), keyval); + gtk_label_setup_mnemonic (label, GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (label))), keyval); g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_MNEMONIC_KEYVAL]); } @@ -6142,7 +6142,7 @@ gtk_label_activate_link (GtkLabel *label, const gchar *uri) { GtkWidget *widget = GTK_WIDGET (label); - GtkWidget *toplevel = gtk_widget_get_toplevel (widget); + GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); guint32 timestamp = gtk_get_current_event_time (); GError *error = NULL; diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c index f9802d077a..b116cdc586 100644 --- a/gtk/gtklinkbutton.c +++ b/gtk/gtklinkbutton.c @@ -415,7 +415,7 @@ gtk_link_button_activate_link (GtkLinkButton *link_button) GtkWidget *toplevel; GError *error; - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (link_button)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (link_button))); error = NULL; gtk_show_uri_on_window (GTK_WINDOW (toplevel), priv->uri, GDK_CURRENT_TIME, &error); diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c index c0c477e733..e916c73938 100644 --- a/gtk/gtklistbox.c +++ b/gtk/gtklistbox.c @@ -2863,7 +2863,7 @@ gtk_list_box_move_cursor (GtkListBox *box, if (!gtk_widget_keynav_failed (GTK_WIDGET (box), direction)) { - GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (box)); + GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (box))); if (toplevel) gtk_widget_child_focus (toplevel, diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 64ad80b6bd..71b1dce79b 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -2066,7 +2066,7 @@ gtk_main_get_window_group (GtkWidget *widget) GtkWidget *toplevel = NULL; if (widget) - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); if (GTK_IS_WINDOW (toplevel)) return gtk_window_get_group (GTK_WINDOW (toplevel)); diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index f99126c864..e36803ff0f 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -1445,12 +1445,12 @@ gtk_menu_popup_internal (GtkMenu *menu, parent_toplevel = NULL; if (parent_menu_shell) - parent_toplevel = gtk_widget_get_toplevel (parent_menu_shell); + parent_toplevel = GTK_WIDGET (gtk_widget_get_root (parent_menu_shell)); else { GtkWidget *attach_widget = gtk_menu_get_attach_widget (menu); if (attach_widget) - parent_toplevel = gtk_widget_get_toplevel (attach_widget); + parent_toplevel = GTK_WIDGET (gtk_widget_get_root (attach_widget)); } /* Set transient for to get the right window group and parent */ @@ -3919,7 +3919,7 @@ gtk_menu_grab_notify (GtkWidget *widget, !gtk_widget_device_is_shadowed (widget, pointer)) return; - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); if (!GTK_IS_WINDOW (toplevel)) return; diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c index 5af9e0cab5..1245974ed8 100644 --- a/gtk/gtkmenubar.c +++ b/gtk/gtkmenubar.c @@ -366,7 +366,7 @@ gtk_menu_bar_root (GtkWidget *widget) GTK_WIDGET_CLASS (gtk_menu_bar_parent_class)->root (widget); - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); add_to_window (GTK_WINDOW (toplevel), menubar); } @@ -376,7 +376,7 @@ gtk_menu_bar_unroot (GtkWidget *widget) GtkMenuBar *menubar = GTK_MENU_BAR (widget); GtkWidget *toplevel; - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); remove_from_window (GTK_WINDOW (toplevel), menubar); GTK_WIDGET_CLASS (gtk_menu_bar_parent_class)->unroot (widget); @@ -393,7 +393,7 @@ void _gtk_menu_bar_cycle_focus (GtkMenuBar *menubar, GtkDirectionType dir) { - GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menubar)); + GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (menubar))); GtkMenuItem *to_activate = NULL; if (GTK_IS_WINDOW (toplevel)) diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index 3daa0c2dd0..018420c9c5 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -878,12 +878,12 @@ gtk_menu_item_buildable_custom_finished (GtkBuildable *buildable, (attach = gtk_menu_get_attach_widget (GTK_MENU (menu_shell))) != NULL) menu_shell = GTK_MENU_SHELL (gtk_widget_get_parent (attach)); - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menu_shell)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (menu_shell))); } else { /* Fall back to something ... */ - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (buildable)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (buildable))); g_warning ("found a GtkMenuItem '%s' without a parent GtkMenuShell, assigned accelerators wont work.", gtk_buildable_get_name (buildable)); diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c index bbaf78bc5e..a543c37ac8 100644 --- a/gtk/gtkmenushell.c +++ b/gtk/gtkmenushell.c @@ -880,7 +880,7 @@ _gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell) while (target) { GtkMenuShellPrivate *priv = target->priv; - GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (target)); + GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (target))); /* The idea with keyboard mode is that once you start using * the keyboard to navigate the menus, we show mnemonics diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index a2f2fd7d24..0a984ccf63 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -1535,7 +1535,7 @@ gtk_notebook_move_focus_out (GtkNotebook *notebook, /* At this point, we know we should be focusing out of the notebook entirely. We * do this by setting a flag, then propagating the focus motion to the notebook. */ - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (notebook)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (notebook))); if (!GTK_IS_ROOT (toplevel)) return; @@ -3807,7 +3807,7 @@ gtk_notebook_set_focus_child (GtkContainer *container, * for future use if we switch to the page with a mnemonic. */ - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (container))); if (GTK_IS_WINDOW (toplevel)) { page_child = gtk_window_get_focus (GTK_WINDOW (toplevel)); diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index 6b755ea1b3..1bf644fa8f 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -1846,7 +1846,7 @@ paned_get_focus_widget (GtkPaned *paned) { GtkWidget *toplevel; - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (paned)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (paned))); if (GTK_IS_WINDOW (toplevel)) return gtk_window_get_focus (GTK_WINDOW (toplevel)); diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index 8a6cdae7cd..2ef34b0780 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -2897,7 +2897,7 @@ get_mount_operation (GtkPlacesSidebar *sidebar) { GMountOperation *mount_op; - mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar)))); + mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (sidebar)))); emit_mount_operation (sidebar, mount_op); @@ -2909,7 +2909,7 @@ get_unmount_operation (GtkPlacesSidebar *sidebar) { GMountOperation *mount_op; - mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar)))); + mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (sidebar)))); emit_unmount_operation (sidebar, mount_op); diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c index e12a5b5871..356bf18aa5 100644 --- a/gtk/gtkplacesview.c +++ b/gtk/gtkplacesview.c @@ -311,7 +311,7 @@ get_toplevel (GtkWidget *widget) { GtkWidget *toplevel; - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); if (GTK_IS_WINDOW (toplevel)) return GTK_WINDOW (toplevel); else @@ -1404,7 +1404,7 @@ unmount_mount (GtkPlacesView *view, GtkWidget *toplevel; priv = gtk_places_view_get_instance_private (view); - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (view))); g_cancellable_cancel (priv->cancellable); g_clear_object (&priv->cancellable); @@ -1442,7 +1442,7 @@ mount_server (GtkPlacesView *view, return; priv->cancellable = g_cancellable_new (); - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (view))); operation = gtk_mount_operation_new (GTK_WINDOW (toplevel)); priv->should_pulse_entry = TRUE; @@ -1481,7 +1481,7 @@ mount_volume (GtkPlacesView *view, GtkWidget *toplevel; priv = gtk_places_view_get_instance_private (view); - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (view))); operation = gtk_mount_operation_new (GTK_WINDOW (toplevel)); g_cancellable_cancel (priv->cancellable); diff --git a/gtk/gtkprinteroptionwidget.c b/gtk/gtkprinteroptionwidget.c index 40d69638e7..50621f3531 100644 --- a/gtk/gtkprinteroptionwidget.c +++ b/gtk/gtkprinteroptionwidget.c @@ -538,7 +538,7 @@ filesave_choose_cb (GtkWidget *button, /* this will be unblocked in the dialog_response_callback function */ g_signal_handler_block (priv->source, priv->source_changed_handler); - toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (widget))); + toplevel = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (widget))); dialog = gtk_file_chooser_dialog_new (_("Select a filename"), toplevel, GTK_FILE_CHOOSER_ACTION_SAVE, diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c index c9d695d276..c1917999eb 100644 --- a/gtk/gtkprintunixdialog.c +++ b/gtk/gtkprintunixdialog.c @@ -580,7 +580,7 @@ get_toplevel (GtkWidget *widget) { GtkWidget *toplevel = NULL; - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); if (GTK_IS_WINDOW (toplevel)) return GTK_WINDOW (toplevel); else diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c index 1f6dc9b772..ac373f922d 100644 --- a/gtk/gtkscalebutton.c +++ b/gtk/gtkscalebutton.c @@ -805,7 +805,7 @@ gtk_scale_popup (GtkWidget *widget) gtk_popover_popup (GTK_POPOVER (priv->dock)); - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); _gtk_window_get_shadow_width (GTK_WINDOW (toplevel), &border); w = gtk_widget_get_allocated_width (toplevel) - border.left - border.right; h = gtk_widget_get_allocated_height (toplevel) - border.top - border.bottom; diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 27d53b3019..44a65b01e4 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -2903,7 +2903,7 @@ gtk_scrolled_window_move_focus_out (GtkScrolledWindow *scrolled_window, /* Focus out of the scrolled window entirely. We do this by setting * a flag, then propagating the focus motion to the notebook. */ - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (scrolled_window)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (scrolled_window))); if (!GTK_IS_ROOT (toplevel)) return; diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 6c2519c8ee..ec2c38fe98 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -3487,7 +3487,7 @@ gtk_text_move_cursor (GtkText *self, count > 0 ? GTK_DIR_RIGHT : GTK_DIR_LEFT)) { - GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self)); + GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (self))); if (toplevel) gtk_widget_child_focus (toplevel, diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c index b82a03e04b..59625f831d 100644 --- a/gtk/gtktooltip.c +++ b/gtk/gtktooltip.c @@ -398,7 +398,7 @@ gtk_tooltip_trigger_tooltip_query (GtkWidget *widget) if (!surface) return; - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); if (gtk_native_get_surface (GTK_NATIVE (toplevel)) != surface) return; @@ -503,7 +503,7 @@ gtk_tooltip_set_last_surface (GtkTooltip *tooltip, window_widget = gtk_native_get_for_surface (surface); if (window_widget) - window_widget = gtk_widget_get_toplevel (window_widget); + window_widget = GTK_WIDGET (gtk_widget_get_root (window_widget)); if (window_widget && window_widget != tooltip->window && @@ -584,7 +584,7 @@ gtk_tooltip_position (GtkTooltip *tooltip, tooltip->tooltip_widget = new_tooltip_widget; - toplevel = _gtk_widget_get_toplevel (new_tooltip_widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (new_tooltip_widget)); if (gtk_widget_compute_bounds (new_tooltip_widget, toplevel, &anchor_bounds)) { anchor_rect = (GdkRectangle) { diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index b72794c521..7e1bada280 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -9517,7 +9517,7 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view, count < 0 ? GTK_DIR_UP : GTK_DIR_DOWN)) { - GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (tree_view)); + GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (tree_view))); if (toplevel) gtk_widget_child_focus (toplevel, @@ -10089,7 +10089,7 @@ gtk_tree_view_ensure_interactive_directory (GtkTreeView *tree_view) if (tree_view->priv->search_custom_entry_set) return; - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (tree_view)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (tree_view))); display = gtk_widget_get_display (GTK_WIDGET (tree_view)); if (tree_view->priv->search_window != NULL) diff --git a/gtk/gtkwindowgroup.c b/gtk/gtkwindowgroup.c index da1ddc92fc..b81c407362 100644 --- a/gtk/gtkwindowgroup.c +++ b/gtk/gtkwindowgroup.c @@ -107,7 +107,7 @@ window_group_cleanup_grabs (GtkWindowGroup *group, tmp_list = priv->grabs; while (tmp_list) { - if (gtk_widget_get_toplevel (tmp_list->data) == (GtkWidget*) window) + if (gtk_widget_get_root (tmp_list->data) == (GtkRoot*) window) to_remove = g_slist_prepend (to_remove, g_object_ref (tmp_list->data)); tmp_list = tmp_list->next; } @@ -125,7 +125,7 @@ window_group_cleanup_grabs (GtkWindowGroup *group, { info = tmp_list->data; - if (gtk_widget_get_toplevel (info->widget) == (GtkWidget *) window) + if (gtk_widget_get_root (info->widget) == (GtkRoot *) window) to_remove = g_slist_prepend (to_remove, info); tmp_list = tmp_list->next; diff --git a/gtk/inspector/css-editor.c b/gtk/inspector/css-editor.c index 4f253d91ca..16b156a4e5 100644 --- a/gtk/inspector/css-editor.c +++ b/gtk/inspector/css-editor.c @@ -191,7 +191,7 @@ save_to_file (GtkInspectorCssEditor *ce, { GtkWidget *dialog; - dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (ce))), + dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (ce))), GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, @@ -232,7 +232,7 @@ save_clicked (GtkButton *button, GtkWidget *dialog; dialog = gtk_file_chooser_dialog_new ("", - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (ce))), + GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (ce))), GTK_FILE_CHOOSER_ACTION_SAVE, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Save"), GTK_RESPONSE_ACCEPT, diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c index e7538e8d10..6fe5c74fc0 100644 --- a/gtk/inspector/inspect-button.c +++ b/gtk/inspector/inspect-button.c @@ -124,7 +124,7 @@ on_highlight_widget (GtkWidget *button, return; } - if (gtk_widget_get_toplevel (widget) == GTK_WIDGET (iw)) + if (gtk_widget_get_root (widget) == GTK_ROOT (iw)) { /* Don't hilight things in the inspector window */ return; diff --git a/gtk/inspector/logs.c b/gtk/inspector/logs.c index 96add7e292..2d4da696c8 100644 --- a/gtk/inspector/logs.c +++ b/gtk/inspector/logs.c @@ -143,7 +143,7 @@ flag_toggled (GtkWidget *button, GtkWidget *toplevel = l->data; GskRenderer *renderer; - if (toplevel == gtk_widget_get_toplevel (button)) /* skip the inspector */ + if ((GtkRoot *)toplevel == gtk_widget_get_root (button)) /* skip the inspector */ continue; renderer = gtk_native_get_renderer (GTK_NATIVE (toplevel)); diff --git a/gtk/inspector/object-tree.c b/gtk/inspector/object-tree.c index f977096d69..add00197b3 100644 --- a/gtk/inspector/object-tree.c +++ b/gtk/inspector/object-tree.c @@ -823,7 +823,7 @@ map (GtkWidget *widget) GTK_WIDGET_CLASS (gtk_inspector_object_tree_parent_class)->map (widget); - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); controller = gtk_event_controller_key_new (); g_object_set_data_full (G_OBJECT (toplevel), "object-controller", controller, (GDestroyNotify)destroy_controller); @@ -838,7 +838,7 @@ unmap (GtkWidget *widget) { GtkWidget *toplevel; - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); g_object_set_data (G_OBJECT (toplevel), "object-controller", NULL); GTK_WIDGET_CLASS (gtk_inspector_object_tree_parent_class)->unmap (widget); diff --git a/gtk/inspector/prop-list.c b/gtk/inspector/prop-list.c index 70543d1eb9..0e0236c0eb 100644 --- a/gtk/inspector/prop-list.c +++ b/gtk/inspector/prop-list.c @@ -299,7 +299,7 @@ update_key_capture (GtkInspectorPropList *pl) GtkWidget *toplevel; GtkWidget *focus; - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (pl)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (pl))); focus = gtk_root_get_focus (GTK_ROOT (toplevel)); if (GTK_IS_EDITABLE (focus) && diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c index 0eda397f44..862154dc69 100644 --- a/gtk/inspector/recorder.c +++ b/gtk/inspector/recorder.c @@ -1021,7 +1021,7 @@ render_node_save (GtkButton *button, return; dialog = gtk_file_chooser_dialog_new ("", - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (recorder))), + GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (recorder))), GTK_FILE_CHOOSER_ACTION_SAVE, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Save"), GTK_RESPONSE_ACCEPT, diff --git a/gtk/inspector/resource-list.c b/gtk/inspector/resource-list.c index 7b9d297ad2..9f413d0ef1 100644 --- a/gtk/inspector/resource-list.c +++ b/gtk/inspector/resource-list.c @@ -484,7 +484,7 @@ root (GtkWidget *widget) GTK_WIDGET_CLASS (gtk_inspector_resource_list_parent_class)->root (widget); - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); controller = gtk_event_controller_key_new (); g_object_set_data_full (G_OBJECT (toplevel), "resource-controller", controller, (GDestroyNotify)destroy_controller); @@ -499,7 +499,7 @@ unroot (GtkWidget *widget) { GtkWidget *toplevel; - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); g_object_set_data (G_OBJECT (toplevel), "resource-controller", NULL); GTK_WIDGET_CLASS (gtk_inspector_resource_list_parent_class)->unroot (widget); diff --git a/gtk/inspector/size-groups.c b/gtk/inspector/size-groups.c index 6cd583699b..d45da94956 100644 --- a/gtk/inspector/size-groups.c +++ b/gtk/inspector/size-groups.c @@ -144,7 +144,7 @@ size_group_state_flags_changed (GtkWidget *widget, state = gtk_widget_get_state_flags (widget); if ((state & GTK_STATE_FLAG_PRELIGHT) != (old_state & GTK_STATE_FLAG_PRELIGHT)) { - GtkInspectorWindow *iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_toplevel (widget)); + GtkInspectorWindow *iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_root (widget)); if (state & GTK_STATE_FLAG_PRELIGHT) { diff --git a/gtk/inspector/statistics.c b/gtk/inspector/statistics.c index 864694687c..fd552092fe 100644 --- a/gtk/inspector/statistics.c +++ b/gtk/inspector/statistics.c @@ -335,7 +335,7 @@ root (GtkWidget *widget) GTK_WIDGET_CLASS (gtk_inspector_statistics_parent_class)->root (widget); - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); controller = gtk_event_controller_key_new (); g_object_set_data_full (G_OBJECT (toplevel), "statistics-controller", controller, (GDestroyNotify)destroy_controller); @@ -350,7 +350,7 @@ unroot (GtkWidget *widget) { GtkWidget *toplevel; - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); g_object_set_data (G_OBJECT (toplevel), "statistics-controller", NULL); GTK_WIDGET_CLASS (gtk_inspector_statistics_parent_class)->unroot (widget); diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c index ce8f1dbe73..000c7673a0 100644 --- a/gtk/inspector/visual.c +++ b/gtk/inspector/visual.c @@ -123,7 +123,7 @@ direction_changed (GtkComboBox *combo) GtkWidget *iw; const gchar *direction; - iw = gtk_widget_get_toplevel (GTK_WIDGET (combo)); + iw = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (combo))); fix_direction (iw); direction = gtk_combo_box_get_active_id (combo); @@ -240,7 +240,7 @@ fps_activate (GtkSwitch *sw, gboolean fps; fps = gtk_switch_get_active (sw); - iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (vis))); + iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_root (GTK_WIDGET (vis))); if (iw == NULL) return; @@ -275,7 +275,7 @@ updates_activate (GtkSwitch *sw, gboolean updates; updates = gtk_switch_get_active (sw); - iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (vis))); + iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_root (GTK_WIDGET (vis))); if (iw == NULL) return; @@ -326,7 +326,7 @@ layout_activate (GtkSwitch *sw, gboolean draw_layout; draw_layout = gtk_switch_get_active (sw); - iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (vis))); + iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_root (GTK_WIDGET (vis))); if (iw == NULL) return; @@ -976,7 +976,7 @@ static void gtk_inspector_visual_finalize (GObject *object) { GtkInspectorVisual *vis = GTK_INSPECTOR_VISUAL (object); - GtkInspectorWindow *iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (vis))); + GtkInspectorWindow *iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_root (GTK_WIDGET (vis))); if (vis->priv->layout_overlay) gtk_inspector_window_remove_overlay (iw, vis->priv->layout_overlay); diff --git a/tests/testbox.c b/tests/testbox.c index d8510c84ac..106986d45b 100644 --- a/tests/testbox.c +++ b/tests/testbox.c @@ -14,7 +14,7 @@ edit_widget (GtkWidget *button) if (!dialog) { dialog = gtk_dialog_new_with_buttons ("", - GTK_WINDOW (gtk_widget_get_toplevel (button)), + GTK_WINDOW (gtk_widget_get_root (button)), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_USE_HEADER_BAR, NULL, NULL); diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c index ef0ffc6197..d7a3562ae3 100644 --- a/tests/testfilechooser.c +++ b/tests/testfilechooser.c @@ -475,7 +475,7 @@ confirm_overwrite_cb (GtkFileChooser *chooser, int response; GtkFileChooserConfirmation conf; - dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (chooser))), + dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (chooser))), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, diff --git a/tests/testfilechooserbutton.c b/tests/testfilechooserbutton.c index e4b03d5e01..1df31b9a04 100644 --- a/tests/testfilechooserbutton.c +++ b/tests/testfilechooserbutton.c @@ -115,7 +115,7 @@ tests_button_clicked_cb (GtkButton *real_button, gtk_window_set_title (GTK_WINDOW (tests), "Tests - TestFileChooserButton"); gtk_window_set_transient_for (GTK_WINDOW (tests), - GTK_WINDOW (gtk_widget_get_toplevel (user_data))); + GTK_WINDOW (gtk_widget_get_root (user_data))); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (tests), box); diff --git a/tests/testgtk.c b/tests/testgtk.c index 4e0146718a..7f0e6a0e8d 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -175,7 +175,7 @@ on_composited_changed (GdkDisplay *display, gtk_label_set_text (label, "Not composited"); /* We draw a different background on the GdkSurface */ - gtk_widget_queue_draw (gtk_widget_get_toplevel (GTK_WIDGET (label))); + gtk_widget_queue_draw (GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (label)))); } void @@ -192,7 +192,7 @@ create_alpha_window (GtkWidget *widget) GtkCssProvider *provider; window = gtk_dialog_new_with_buttons ("Alpha Window", - GTK_WINDOW (gtk_widget_get_toplevel (widget)), 0, + GTK_WINDOW (gtk_widget_get_root (widget)), 0, "_Close", 0, NULL); provider = gtk_css_provider_new (); @@ -899,7 +899,7 @@ activate_link (GtkWidget *label, const gchar *uri, gpointer data) { GtkWidget *dialog; - dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (gtk_widget_get_toplevel (label)), + dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (gtk_widget_get_root (label)), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, @@ -1164,7 +1164,7 @@ create_rotated_text (GtkWidget *widget) GdkPixbuf *tile_pixbuf; window = gtk_dialog_new_with_buttons ("Rotated Text", - GTK_WINDOW (gtk_widget_get_toplevel (widget)), 0, + GTK_WINDOW (gtk_widget_get_root (widget)), 0, "_Close", GTK_RESPONSE_CLOSE, NULL); @@ -3435,7 +3435,7 @@ flipping_orientation_toggled_cb (GtkWidget *widget, gpointer data) GtkWidget *content_area; GtkWidget *toplevel; - toplevel = gtk_widget_get_toplevel (widget); + toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); content_area = gtk_dialog_get_content_area (GTK_DIALOG (toplevel)); orientable_toggle_orientation (GTK_ORIENTABLE (content_area)); } @@ -3676,7 +3676,7 @@ screen_display_check (GtkWidget *widget, ScreenDisplaySelection *data) if (!display) { - dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (widget)), + dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (widget)), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, @@ -3771,7 +3771,7 @@ create_display_screen (GtkWidget *widget) scr_dpy_data = g_new0 (ScreenDisplaySelection, 1); scr_dpy_data->entry = gtk_bin_get_child (GTK_BIN (combo_dpy)); - scr_dpy_data->toplevel = gtk_widget_get_toplevel (widget); + scr_dpy_data->toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); scr_dpy_data->dialog_window = window; g_signal_connect (cancelb, "clicked", diff --git a/tests/testlogout.c b/tests/testlogout.c index 4c13518fdb..78236e82ff 100644 --- a/tests/testlogout.c +++ b/tests/testlogout.c @@ -30,7 +30,7 @@ inhibitor_toggled (GtkToggleButton *button, GtkApplication *app) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (inhibit_idle))) flags |= GTK_APPLICATION_INHIBIT_IDLE; - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button)); + toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (button))); if (active) { diff --git a/tests/testtoolbar.c b/tests/testtoolbar.c index 12160c8115..19e4694ca0 100644 --- a/tests/testtoolbar.c +++ b/tests/testtoolbar.c @@ -343,7 +343,7 @@ popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button_number) GtkWindow *window; GtkWidget *widget; - window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (toolbar))); + window = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (toolbar))); widget = gtk_root_get_focus (GTK_ROOT (window)); if (!widget) widget = GTK_WIDGET (toolbar); |