From 18788c2a860f4779757633a4d44babd2cc4f9e2c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 17 May 2019 21:08:38 +0000 Subject: [PATCH] Remove gtk_widget_get/set_has_surface These serve no purpose anymore - widgets don't have surfaces, unless they're a GtkNative. --- demos/gtk-demo/bluroverlay.c | 1 - demos/gtk-demo/demotaggedentry.c | 4 -- demos/gtk-demo/fontplane.c | 1 - demos/gtk-demo/gtkfishbowl.c | 2 - demos/gtk-demo/paint.c | 2 - docs/reference/gtk/gtk4-sections.txt | 2 - gtk/gtkaccellabel.c | 2 - gtk/gtkactionbar.c | 2 - gtk/gtkappchooserbutton.c | 1 - gtk/gtkappchooserwidget.c | 2 - gtk/gtkbin.c | 1 - gtk/gtkbox.c | 2 - gtk/gtkbutton.c | 1 - gtk/gtkcalendar.c | 1 - gtk/gtkcellrendereraccel.c | 2 - gtk/gtkcellview.c | 2 - gtk/gtkcenterbox.c | 2 - gtk/gtkcolorbutton.c | 2 - gtk/gtkcolorplane.c | 1 - gtk/gtkcolorswatch.c | 1 - gtk/gtkdrawingarea.c | 1 - gtk/gtkentry.c | 2 - gtk/gtkexpander.c | 1 - gtk/gtkfilechooserbutton.c | 2 - gtk/gtkfilechooserwidget.c | 1 - gtk/gtkfixed.c | 1 - gtk/gtkflowbox.c | 2 - gtk/gtkfontbutton.c | 2 - gtk/gtkfontchooserwidget.c | 2 - gtk/gtkgizmo.c | 1 - gtk/gtkglarea.c | 2 - gtk/gtkgrid.c | 2 - gtk/gtkheaderbar.c | 2 - gtk/gtkicon.c | 1 - gtk/gtkiconview.c | 1 - gtk/gtkimage.c | 1 - gtk/gtklabel.c | 2 - gtk/gtklevelbar.c | 2 - gtk/gtklistbox.c | 1 - gtk/gtkmagnifier.c | 1 - gtk/gtkmediacontrols.c | 1 - gtk/gtkmenubutton.c | 2 - gtk/gtkmenuitem.c | 2 - gtk/gtkmenushell.c | 2 - gtk/gtknotebook.c | 1 - gtk/gtkoverlay.c | 2 - gtk/gtkpaned.c | 1 - gtk/gtkpasswordentry.c | 2 - gtk/gtkpathbar.c | 2 - gtk/gtkpicture.c | 2 - gtk/gtkpopover.c | 2 - gtk/gtkprintunixdialog.c | 3 -- gtk/gtkprogressbar.c | 2 - gtk/gtkrange.c | 2 - gtk/gtkrevealer.c | 1 - gtk/gtkscrollbar.c | 2 - gtk/gtkscrolledwindow.c | 1 - gtk/gtksearchentry.c | 2 - gtk/gtkseparator.c | 2 - gtk/gtkseparatortoolitem.c | 5 -- gtk/gtkshortcutsshortcut.c | 2 - gtk/gtkspinbutton.c | 2 - gtk/gtkspinner.c | 1 - gtk/gtkstack.c | 2 - gtk/gtkstackswitcher.c | 2 - gtk/gtkstatusbar.c | 2 - gtk/gtkswitch.c | 1 - gtk/gtktext.c | 1 - gtk/gtktextview.c | 1 - gtk/gtktoolbar.c | 1 - gtk/gtktreeview.c | 2 - gtk/gtkvideo.c | 1 - gtk/gtkviewport.c | 1 - gtk/gtkwidget.c | 74 ++++------------------------ gtk/gtkwidget.h | 6 --- gtk/gtkwidgetfocus.c | 9 ++-- gtk/gtkwidgetprivate.h | 8 --- gtk/gtkwindow.c | 2 - tests/showrendernode.c | 1 - tests/testtexture.c | 1 - tests/testwidgetfocus.c | 2 - tests/testwidgettransforms.c | 3 -- 82 files changed, 14 insertions(+), 214 deletions(-) diff --git a/demos/gtk-demo/bluroverlay.c b/demos/gtk-demo/bluroverlay.c index f6e268c6e6..e7054bc621 100644 --- a/demos/gtk-demo/bluroverlay.c +++ b/demos/gtk-demo/bluroverlay.c @@ -458,7 +458,6 @@ blur_overlay_class_init (BlurOverlayClass *klass) static void blur_overlay_init (BlurOverlay *overlay) { - gtk_widget_set_has_surface (GTK_WIDGET (overlay), FALSE); } GtkWidget * diff --git a/demos/gtk-demo/demotaggedentry.c b/demos/gtk-demo/demotaggedentry.c index 3f9f63a437..fe7c02b58a 100644 --- a/demos/gtk-demo/demotaggedentry.c +++ b/demos/gtk-demo/demotaggedentry.c @@ -41,8 +41,6 @@ demo_tagged_entry_init (DemoTaggedEntry *entry) { DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry); - gtk_widget_set_has_surface (GTK_WIDGET (entry), FALSE); - priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_parent (priv->box, GTK_WIDGET (entry)); @@ -267,8 +265,6 @@ demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag) GtkGesture *gesture; GtkCssProvider *provider; - gtk_widget_set_has_surface (GTK_WIDGET (tag), FALSE); - tag->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_parent (tag->box, GTK_WIDGET (tag)); tag->label = gtk_label_new (""); diff --git a/demos/gtk-demo/fontplane.c b/demos/gtk-demo/fontplane.c index 987dedcebf..26f301d4fc 100644 --- a/demos/gtk-demo/fontplane.c +++ b/demos/gtk-demo/fontplane.c @@ -209,7 +209,6 @@ gtk_font_plane_init (GtkFontPlane *plane) { GtkGesture *gesture; - gtk_widget_set_has_surface (GTK_WIDGET (plane), FALSE); gtk_widget_set_can_focus (GTK_WIDGET (plane), TRUE); gesture = gtk_gesture_drag_new (); diff --git a/demos/gtk-demo/gtkfishbowl.c b/demos/gtk-demo/gtkfishbowl.c index 1711d91376..0d9f85f124 100644 --- a/demos/gtk-demo/gtkfishbowl.c +++ b/demos/gtk-demo/gtkfishbowl.c @@ -67,8 +67,6 @@ gtk_fishbowl_init (GtkFishbowl *fishbowl) { GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl); - gtk_widget_set_has_surface (GTK_WIDGET (fishbowl), FALSE); - priv->update_delay = G_USEC_PER_SEC; } diff --git a/demos/gtk-demo/paint.c b/demos/gtk-demo/paint.c index 3b8a531a36..7a1ceed12d 100644 --- a/demos/gtk-demo/paint.c +++ b/demos/gtk-demo/paint.c @@ -330,8 +330,6 @@ drawing_area_init (DrawingArea *area) { GtkGesture *gesture; - gtk_widget_set_has_surface (GTK_WIDGET (area), FALSE); - gesture = gtk_gesture_stylus_new (); g_signal_connect (gesture, "down", G_CALLBACK (stylus_gesture_down), area); diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 4158a6f50a..6c11578676 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -4515,8 +4515,6 @@ gtk_widget_set_focus_on_click gtk_widget_set_focus_child gtk_widget_get_can_target gtk_widget_set_can_target -gtk_widget_get_has_surface -gtk_widget_set_has_surface gtk_widget_get_sensitive gtk_widget_is_sensitive gtk_widget_get_visible diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c index 2b12fcc779..938602c840 100644 --- a/gtk/gtkaccellabel.c +++ b/gtk/gtkaccellabel.c @@ -307,8 +307,6 @@ gtk_accel_label_init (GtkAccelLabel *accel_label) { GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (accel_label); - gtk_widget_set_has_surface (GTK_WIDGET (accel_label), FALSE); - priv->accel_widget = NULL; priv->accel_closure = NULL; priv->accel_group = NULL; diff --git a/gtk/gtkactionbar.c b/gtk/gtkactionbar.c index 9dad0cb367..d8ad859778 100644 --- a/gtk/gtkactionbar.c +++ b/gtk/gtkactionbar.c @@ -278,8 +278,6 @@ gtk_action_bar_init (GtkActionBar *action_bar) GtkWidget *widget = GTK_WIDGET (action_bar); GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (action_bar); - gtk_widget_set_has_surface (widget, FALSE); - priv->revealer = gtk_revealer_new (); gtk_widget_set_parent (priv->revealer, widget); diff --git a/gtk/gtkappchooserbutton.c b/gtk/gtkappchooserbutton.c index 680a20b0b6..faafa1c73b 100644 --- a/gtk/gtkappchooserbutton.c +++ b/gtk/gtkappchooserbutton.c @@ -749,7 +749,6 @@ static void gtk_app_chooser_button_init (GtkAppChooserButton *self) { GtkAppChooserButtonPrivate *priv = gtk_app_chooser_button_get_instance_private (self); - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); priv->custom_item_names = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); priv->store = gtk_list_store_new (NUM_COLUMNS, diff --git a/gtk/gtkappchooserwidget.c b/gtk/gtkappchooserwidget.c index 9d613a3f06..16815ed1db 100644 --- a/gtk/gtkappchooserwidget.c +++ b/gtk/gtkappchooserwidget.c @@ -1181,8 +1181,6 @@ gtk_app_chooser_widget_init (GtkAppChooserWidget *self) GtkTreeModel *sort; GtkGesture *gesture; - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); - gtk_widget_init_template (GTK_WIDGET (self)); /* Various parts of the GtkTreeView code need custom code to setup, mostly diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c index 10b010f2d7..386ac55fd8 100644 --- a/gtk/gtkbin.c +++ b/gtk/gtkbin.c @@ -98,7 +98,6 @@ gtk_bin_class_init (GtkBinClass *class) static void gtk_bin_init (GtkBin *bin) { - gtk_widget_set_has_surface (GTK_WIDGET (bin), FALSE); } static GType diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 616b7d6e44..bd016c98c7 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -346,8 +346,6 @@ gtk_box_init (GtkBox *box) { GtkBoxPrivate *priv = gtk_box_get_instance_private (box); - gtk_widget_set_has_surface (GTK_WIDGET (box), FALSE); - priv->orientation = GTK_ORIENTATION_HORIZONTAL; _gtk_orientable_set_style_classes (GTK_ORIENTABLE (box)); } diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index f58517656e..402ebdfa28 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -413,7 +413,6 @@ gtk_button_init (GtkButton *button) gtk_widget_set_can_focus (GTK_WIDGET (button), TRUE); gtk_widget_set_receives_default (GTK_WIDGET (button), TRUE); - gtk_widget_set_has_surface (GTK_WIDGET (button), FALSE); priv->in_button = FALSE; priv->button_down = FALSE; diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index 31c385f01d..ffabd022bc 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -677,7 +677,6 @@ gtk_calendar_init (GtkCalendar *calendar) #endif gtk_widget_set_can_focus (widget, TRUE); - gtk_widget_set_has_surface (widget, FALSE); gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (calendar)), GTK_STYLE_CLASS_VIEW); diff --git a/gtk/gtkcellrendereraccel.c b/gtk/gtkcellrendereraccel.c index 428acf044e..e2c50df40d 100644 --- a/gtk/gtkcellrendereraccel.c +++ b/gtk/gtkcellrendereraccel.c @@ -788,8 +788,6 @@ gtk_cell_editable_widget_init (GtkCellEditableWidget *box) g_signal_connect (controller, "modifiers", G_CALLBACK (key_controller_modifiers), box); gtk_widget_add_controller (widget, controller); - - gtk_widget_set_has_surface (widget, FALSE); } static GtkWidget * diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c index f2ec397360..3d1059ebb9 100644 --- a/gtk/gtkcellview.c +++ b/gtk/gtkcellview.c @@ -445,8 +445,6 @@ gtk_cell_view_init (GtkCellView *cellview) GtkCellViewPrivate *priv = gtk_cell_view_get_instance_private (cellview); priv->orientation = GTK_ORIENTATION_HORIZONTAL; - - gtk_widget_set_has_surface (GTK_WIDGET (cellview), FALSE); } static void diff --git a/gtk/gtkcenterbox.c b/gtk/gtkcenterbox.c index 07bb9cc807..b808cababc 100644 --- a/gtk/gtkcenterbox.c +++ b/gtk/gtkcenterbox.c @@ -661,8 +661,6 @@ gtk_center_box_class_init (GtkCenterBoxClass *klass) static void gtk_center_box_init (GtkCenterBox *self) { - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); - self->start_widget = NULL; self->center_widget = NULL; self->end_widget = NULL; diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c index 8fa3e2dd51..9d47b546b9 100644 --- a/gtk/gtkcolorbutton.c +++ b/gtk/gtkcolorbutton.c @@ -374,8 +374,6 @@ gtk_color_button_init (GtkColorButton *button) GtkStyleContext *context; GdkContentFormats *targets; - gtk_widget_set_has_surface (GTK_WIDGET (button), FALSE); - priv->button = gtk_button_new (); g_signal_connect (priv->button, "clicked", G_CALLBACK (gtk_color_button_clicked), button); gtk_widget_set_parent (priv->button, GTK_WIDGET (button)); diff --git a/gtk/gtkcolorplane.c b/gtk/gtkcolorplane.c index 8cf817eb1a..f6eaf311a0 100644 --- a/gtk/gtkcolorplane.c +++ b/gtk/gtkcolorplane.c @@ -400,7 +400,6 @@ gtk_color_plane_init (GtkColorPlane *plane) plane->priv = gtk_color_plane_get_instance_private (plane); - gtk_widget_set_has_surface (GTK_WIDGET (plane), FALSE); gtk_widget_set_can_focus (GTK_WIDGET (plane), TRUE); atk_obj = gtk_widget_get_accessible (GTK_WIDGET (plane)); diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c index 0fa499b429..dd3b780fa3 100644 --- a/gtk/gtkcolorswatch.c +++ b/gtk/gtkcolorswatch.c @@ -571,7 +571,6 @@ gtk_color_swatch_init (GtkColorSwatch *swatch) priv->has_menu = TRUE; gtk_widget_set_can_focus (GTK_WIDGET (swatch), TRUE); - gtk_widget_set_has_surface (GTK_WIDGET (swatch), FALSE); gtk_widget_set_overflow (GTK_WIDGET (swatch), GTK_OVERFLOW_HIDDEN); gesture = gtk_gesture_long_press_new (); diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c index a4d405de91..9afd4e3cc8 100644 --- a/gtk/gtkdrawingarea.c +++ b/gtk/gtkdrawingarea.c @@ -296,7 +296,6 @@ gtk_drawing_area_class_init (GtkDrawingAreaClass *class) static void gtk_drawing_area_init (GtkDrawingArea *darea) { - gtk_widget_set_has_surface (GTK_WIDGET (darea), FALSE); } /** diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 67c986acff..94b97e952c 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -1270,8 +1270,6 @@ gtk_entry_init (GtkEntry *entry) { GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry); - gtk_widget_set_has_surface (GTK_WIDGET (entry), FALSE); - priv->text = gtk_text_new (); gtk_widget_set_parent (priv->text, GTK_WIDGET (entry)); gtk_editable_init_delegate (GTK_EDITABLE (entry)); diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index 43b48ce9e4..7e00f122c6 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -352,7 +352,6 @@ gtk_expander_init (GtkExpander *expander) GtkGesture *gesture; gtk_widget_set_can_focus (GTK_WIDGET (expander), TRUE); - gtk_widget_set_has_surface (GTK_WIDGET (expander), FALSE); priv->label_widget = NULL; priv->child = NULL; diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index 9c56d46510..00e6fe8479 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -448,8 +448,6 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button) GtkWidget *icon; GdkContentFormats *target_list; - gtk_widget_set_has_surface (GTK_WIDGET (button), FALSE); - priv->button = gtk_button_new (); g_signal_connect (priv->button, "clicked", G_CALLBACK (button_clicked_cb), button); priv->image = gtk_image_new (); diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 8b5cc443a9..6ad760ec53 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -8441,7 +8441,6 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl) #ifdef PROFILE_FILE_CHOOSER access ("MARK: *** CREATE FILE CHOOSER", F_OK); #endif - gtk_widget_set_has_surface (GTK_WIDGET (impl), FALSE); priv->local_only = FALSE; priv->preview_widget_active = TRUE; diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c index 24af3fd513..2251c0bce1 100644 --- a/gtk/gtkfixed.c +++ b/gtk/gtkfixed.c @@ -117,7 +117,6 @@ gtk_fixed_init (GtkFixed *self) { GtkFixedPrivate *priv = gtk_fixed_get_instance_private (self); - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); gtk_widget_set_overflow (GTK_WIDGET (self), GTK_OVERFLOW_HIDDEN); priv->layout = gtk_widget_get_layout_manager (GTK_WIDGET (self)); diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c index e4bfb813fc..c24658313b 100644 --- a/gtk/gtkflowbox.c +++ b/gtk/gtkflowbox.c @@ -3694,8 +3694,6 @@ gtk_flow_box_init (GtkFlowBox *box) GtkEventController *controller; GtkGesture *gesture; - gtk_widget_set_has_surface (GTK_WIDGET (box), FALSE); - priv->orientation = GTK_ORIENTATION_HORIZONTAL; priv->selection_mode = GTK_SELECTION_SINGLE; priv->max_children_per_line = DEFAULT_MAX_CHILDREN_PER_LINE; diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c index d984a8661c..1e3a9d073b 100644 --- a/gtk/gtkfontbutton.c +++ b/gtk/gtkfontbutton.c @@ -606,8 +606,6 @@ gtk_font_button_init (GtkFontButton *font_button) GtkFontButtonPrivate *priv = gtk_font_button_get_instance_private (font_button); GtkWidget *box; - gtk_widget_set_has_surface (GTK_WIDGET (font_button), FALSE); - priv->button = gtk_button_new (); g_signal_connect (priv->button, "clicked", G_CALLBACK (gtk_font_button_clicked), font_button); priv->font_label = gtk_label_new (_("Font")); diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c index 1330ac6a81..37a453c8ad 100644 --- a/gtk/gtkfontchooserwidget.c +++ b/gtk/gtkfontchooserwidget.c @@ -915,8 +915,6 @@ gtk_font_chooser_widget_init (GtkFontChooserWidget *fontchooser) { GtkFontChooserWidgetPrivate *priv = gtk_font_chooser_widget_get_instance_private (fontchooser); - gtk_widget_set_has_surface (GTK_WIDGET (fontchooser), FALSE); - gtk_widget_init_template (GTK_WIDGET (fontchooser)); priv->axes = g_hash_table_new_full (axis_hash, axis_equal, NULL, axis_free); diff --git a/gtk/gtkgizmo.c b/gtk/gtkgizmo.c index a3ef5d1f23..e885020e89 100644 --- a/gtk/gtkgizmo.c +++ b/gtk/gtkgizmo.c @@ -95,7 +95,6 @@ gtk_gizmo_class_init (GtkGizmoClass *klass) static void gtk_gizmo_init (GtkGizmo *self) { - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); } GtkWidget * diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c index 3c1965f674..3d5e47d6d9 100644 --- a/gtk/gtkglarea.c +++ b/gtk/gtkglarea.c @@ -957,8 +957,6 @@ gtk_gl_area_init (GtkGLArea *area) { GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area); - gtk_widget_set_has_surface (GTK_WIDGET (area), FALSE); - priv->auto_render = TRUE; priv->needs_render = TRUE; priv->required_gl_version = 0; diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c index 18d005280b..a0c3ac107e 100644 --- a/gtk/gtkgrid.c +++ b/gtk/gtkgrid.c @@ -389,8 +389,6 @@ gtk_grid_init (GtkGrid *grid) { GtkGridPrivate *priv = gtk_grid_get_instance_private (grid); - gtk_widget_set_has_surface (GTK_WIDGET (grid), FALSE); - priv->layout_manager = gtk_widget_get_layout_manager (GTK_WIDGET (grid)); priv->orientation = GTK_ORIENTATION_HORIZONTAL; diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c index b2dcdf0ae0..0a01a1ee1a 100644 --- a/gtk/gtkheaderbar.c +++ b/gtk/gtkheaderbar.c @@ -1867,8 +1867,6 @@ gtk_header_bar_init (GtkHeaderBar *bar) priv = gtk_header_bar_get_instance_private (bar); - gtk_widget_set_has_surface (GTK_WIDGET (bar), FALSE); - priv->title = NULL; priv->subtitle = NULL; priv->custom_title = NULL; diff --git a/gtk/gtkicon.c b/gtk/gtkicon.c index b6225fe0e9..f11421f68d 100644 --- a/gtk/gtkicon.c +++ b/gtk/gtkicon.c @@ -87,7 +87,6 @@ gtk_icon_class_init (GtkIconClass *klass) static void gtk_icon_init (GtkIcon *self) { - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); self->image = GTK_CSS_IMAGE_BUILTIN_NONE; } diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index 06d1240fb4..a3654634de 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -936,7 +936,6 @@ gtk_icon_view_init (GtkIconView *icon_view) icon_view->priv->mouse_x = -1; icon_view->priv->mouse_y = -1; - gtk_widget_set_has_surface (GTK_WIDGET (icon_view), FALSE); gtk_widget_set_can_focus (GTK_WIDGET (icon_view), TRUE); gtk_widget_set_overflow (GTK_WIDGET (icon_view), GTK_OVERFLOW_HIDDEN); diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 215797a931..751ae9de23 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -272,7 +272,6 @@ gtk_image_init (GtkImage *image) GtkCssNode *widget_node; widget_node = gtk_widget_get_css_node (GTK_WIDGET (image)); - gtk_widget_set_has_surface (GTK_WIDGET (image), FALSE); priv->icon_helper = gtk_icon_helper_new (widget_node, GTK_WIDGET (image)); } diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 693293627d..25b314337a 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -1273,8 +1273,6 @@ gtk_label_init (GtkLabel *label) { GtkLabelPrivate *priv = gtk_label_get_instance_private (label); - gtk_widget_set_has_surface (GTK_WIDGET (label), FALSE); - priv->width_chars = -1; priv->max_width_chars = -1; priv->label = g_strdup (""); diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c index 401ae32da7..ceab78a36c 100644 --- a/gtk/gtklevelbar.c +++ b/gtk/gtklevelbar.c @@ -1083,8 +1083,6 @@ gtk_level_bar_init (GtkLevelBar *self) priv->inverted = FALSE; - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); - priv->trough_widget = gtk_gizmo_new ("trough", gtk_level_bar_measure_trough, gtk_level_bar_allocate_trough, diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c index 5ad3d5950f..c0c477e733 100644 --- a/gtk/gtklistbox.c +++ b/gtk/gtklistbox.c @@ -627,7 +627,6 @@ gtk_list_box_init (GtkListBox *box) GtkWidget *widget = GTK_WIDGET (box); GtkGesture *gesture; - gtk_widget_set_has_surface (widget, FALSE); priv->selection_mode = GTK_SELECTION_SINGLE; priv->activate_single_click = TRUE; diff --git a/gtk/gtkmagnifier.c b/gtk/gtkmagnifier.c index 9d99898b3a..c653367919 100644 --- a/gtk/gtkmagnifier.c +++ b/gtk/gtkmagnifier.c @@ -208,7 +208,6 @@ gtk_magnifier_init (GtkMagnifier *self) GtkMagnifierPrivate *priv = gtk_magnifier_get_instance_private (self); GtkWidget *widget = GTK_WIDGET (self); - gtk_widget_set_has_surface (widget, FALSE); gtk_widget_set_overflow (widget, GTK_OVERFLOW_HIDDEN); priv->magnification = 1; diff --git a/gtk/gtkmediacontrols.c b/gtk/gtkmediacontrols.c index 146d21eaf7..a350e6c366 100644 --- a/gtk/gtkmediacontrols.c +++ b/gtk/gtkmediacontrols.c @@ -299,7 +299,6 @@ static void gtk_media_controls_init (GtkMediaControls *controls) { gtk_widget_init_template (GTK_WIDGET (controls)); - gtk_widget_set_has_surface (GTK_WIDGET (controls), FALSE); } /** diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c index c35565e777..d1b0618406 100644 --- a/gtk/gtkmenubutton.c +++ b/gtk/gtkmenubutton.c @@ -694,8 +694,6 @@ gtk_menu_button_init (GtkMenuButton *menu_button) GtkMenuButtonPrivate *priv = gtk_menu_button_get_instance_private (menu_button); GtkStyleContext *context; - gtk_widget_set_has_surface (GTK_WIDGET (menu_button), FALSE); - priv->arrow_type = GTK_ARROW_DOWN; priv->use_popover = TRUE; diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index 3093164add..07f9dea4ff 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -658,8 +658,6 @@ gtk_menu_item_init (GtkMenuItem *menu_item) priv = gtk_menu_item_get_instance_private (menu_item); menu_item->priv = priv; - gtk_widget_set_has_surface (GTK_WIDGET (menu_item), FALSE); - g_signal_connect (menu_item, "notify::parent", G_CALLBACK (gtk_menu_item_parent_cb), NULL); priv->submenu = NULL; diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c index 6b1201c171..bbaf78bc5e 100644 --- a/gtk/gtkmenushell.c +++ b/gtk/gtkmenushell.c @@ -428,8 +428,6 @@ gtk_menu_shell_init (GtkMenuShell *menu_shell) G_CALLBACK (gtk_menu_shell_key_press), widget); gtk_widget_add_controller (widget, controller); - gtk_widget_set_has_surface (widget, FALSE); - controller = GTK_EVENT_CONTROLLER (gtk_gesture_multi_press_new ()); gtk_event_controller_set_propagation_limit (controller, GTK_LIMIT_NONE); gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), 0); diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 05b5b5ad89..16c033a553 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -1241,7 +1241,6 @@ gtk_notebook_init (GtkNotebook *notebook) GtkGesture *gesture; gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE); - gtk_widget_set_has_surface (GTK_WIDGET (notebook), FALSE); notebook->priv = gtk_notebook_get_instance_private (notebook); priv = notebook->priv; diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c index 874f41cd5a..6ce6ad3f67 100644 --- a/gtk/gtkoverlay.c +++ b/gtk/gtkoverlay.c @@ -327,8 +327,6 @@ gtk_overlay_init (GtkOverlay *overlay) { GtkOverlayPrivate *priv = gtk_overlay_get_instance_private (overlay); - gtk_widget_set_has_surface (GTK_WIDGET (overlay), FALSE); - priv->layout = gtk_widget_get_layout_manager (GTK_WIDGET (overlay)); } diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index 128e9ab91d..78f127d101 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -1350,7 +1350,6 @@ gtk_paned_init (GtkPaned *paned) GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned); GtkGesture *gesture; - gtk_widget_set_has_surface (GTK_WIDGET (paned), FALSE); gtk_widget_set_can_focus (GTK_WIDGET (paned), TRUE); gtk_widget_set_overflow (GTK_WIDGET (paned), GTK_OVERFLOW_HIDDEN); diff --git a/gtk/gtkpasswordentry.c b/gtk/gtkpasswordentry.c index 0bcda0aaec..cc74bc167e 100644 --- a/gtk/gtkpasswordentry.c +++ b/gtk/gtkpasswordentry.c @@ -151,8 +151,6 @@ gtk_password_entry_init (GtkPasswordEntry *entry) { GtkPasswordEntryPrivate *priv = gtk_password_entry_get_instance_private (entry); - gtk_widget_set_has_surface (GTK_WIDGET (entry), FALSE); - priv->entry = gtk_text_new (); gtk_text_set_visibility (GTK_TEXT (priv->entry), FALSE); gtk_widget_set_parent (priv->entry, GTK_WIDGET (entry)); diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index 1200e01596..5bc9906888 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -239,8 +239,6 @@ gtk_path_bar_init (GtkPathBar *path_bar) g_signal_connect_swapped (priv->down_slider_button, "clicked", G_CALLBACK (gtk_path_bar_scroll_down), path_bar); - gtk_widget_set_has_surface (GTK_WIDGET (path_bar), FALSE); - context = gtk_widget_get_style_context (GTK_WIDGET (path_bar)); gtk_style_context_add_class (context, "path-bar"); gtk_style_context_add_class (context, GTK_STYLE_CLASS_LINKED); diff --git a/gtk/gtkpicture.c b/gtk/gtkpicture.c index b6ecd2f696..1ae70f7cde 100644 --- a/gtk/gtkpicture.c +++ b/gtk/gtkpicture.c @@ -370,8 +370,6 @@ gtk_picture_class_init (GtkPictureClass *class) static void gtk_picture_init (GtkPicture *self) { - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); - self->can_shrink = TRUE; self->keep_aspect_ratio = TRUE; } diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index f684ca809c..20eced8ce6 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -509,8 +509,6 @@ gtk_popover_init (GtkPopover *popover) GtkEventController *controller; GtkStyleContext *context; - gtk_widget_set_has_surface (GTK_WIDGET (popover), TRUE); - priv->position = GTK_POS_TOP; priv->final_position = GTK_POS_TOP; priv->modal = TRUE; diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c index 519668665a..4dfd03b03d 100644 --- a/gtk/gtkprintunixdialog.c +++ b/gtk/gtkprintunixdialog.c @@ -792,9 +792,6 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog) priv->paper_size_renderer, page_name_func, NULL, NULL); - /* Preview drawing area has no window */ - gtk_widget_set_has_surface (priv->page_layout_preview, FALSE); - /* Load backends */ load_print_backends (dialog); diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c index 520933177f..3fc53ff35b 100644 --- a/gtk/gtkprogressbar.c +++ b/gtk/gtkprogressbar.c @@ -487,8 +487,6 @@ gtk_progress_bar_init (GtkProgressBar *pbar) priv->text = NULL; priv->fraction = 0.0; - gtk_widget_set_has_surface (GTK_WIDGET (pbar), FALSE); - _gtk_orientable_set_style_classes (GTK_ORIENTABLE (pbar)); priv->trough_widget = gtk_gizmo_new ("trough", diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 55ad3c37ee..13c384ac5b 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -533,8 +533,6 @@ gtk_range_init (GtkRange *range) GtkGesture *gesture; GtkEventController *controller; - gtk_widget_set_has_surface (GTK_WIDGET (range), FALSE); - priv->orientation = GTK_ORIENTATION_HORIZONTAL; priv->adjustment = NULL; priv->inverted = FALSE; diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c index c3e1d0bbf7..065d1ab1ff 100644 --- a/gtk/gtkrevealer.c +++ b/gtk/gtkrevealer.c @@ -137,7 +137,6 @@ gtk_revealer_init (GtkRevealer *revealer) priv->current_pos = 0.0; priv->target_pos = 0.0; - gtk_widget_set_has_surface (GTK_WIDGET (revealer), FALSE); gtk_widget_set_overflow (GTK_WIDGET (revealer), GTK_OVERFLOW_HIDDEN); } diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c index 82b3d7959e..f57362c771 100644 --- a/gtk/gtkscrollbar.c +++ b/gtk/gtkscrollbar.c @@ -260,8 +260,6 @@ gtk_scrollbar_init (GtkScrollbar *self) { GtkScrollbarPrivate *priv = gtk_scrollbar_get_instance_private (self); - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); - priv->orientation = GTK_ORIENTATION_HORIZONTAL; priv->box = gtk_box_new (priv->orientation, 0); diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 2ba312e741..0309ee4479 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -1887,7 +1887,6 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window) }; gint i; - gtk_widget_set_has_surface (widget, FALSE); gtk_widget_set_can_focus (widget, TRUE); /* Instantiated by gtk_scrolled_window_set_[hv]adjustment diff --git a/gtk/gtksearchentry.c b/gtk/gtksearchentry.c index 8e8e0887cd..c3d86ad8f5 100644 --- a/gtk/gtksearchentry.c +++ b/gtk/gtksearchentry.c @@ -581,8 +581,6 @@ gtk_search_entry_init (GtkSearchEntry *entry) GtkSearchEntryPrivate *priv = gtk_search_entry_get_instance_private (entry); GtkGesture *press; - gtk_widget_set_has_surface (GTK_WIDGET (entry), FALSE); - priv->entry = gtk_text_new (); gtk_widget_set_parent (priv->entry, GTK_WIDGET (entry)); gtk_editable_init_delegate (GTK_EDITABLE (entry)); diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c index 16cde5d510..97050fa653 100644 --- a/gtk/gtkseparator.c +++ b/gtk/gtkseparator.c @@ -129,8 +129,6 @@ gtk_separator_init (GtkSeparator *separator) priv->orientation = GTK_ORIENTATION_HORIZONTAL; - gtk_widget_set_has_surface (GTK_WIDGET (separator), FALSE); - _gtk_orientable_set_style_classes (GTK_ORIENTABLE (separator)); } diff --git a/gtk/gtkseparatortoolitem.c b/gtk/gtkseparatortoolitem.c index efbec418ab..5fc9ce9618 100644 --- a/gtk/gtkseparatortoolitem.c +++ b/gtk/gtkseparatortoolitem.c @@ -117,11 +117,6 @@ gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class) static void gtk_separator_tool_item_init (GtkSeparatorToolItem *separator_item) { - GtkWidget *widget; - - widget = GTK_WIDGET (separator_item); - - gtk_widget_set_has_surface (widget, FALSE); } static void diff --git a/gtk/gtkshortcutsshortcut.c b/gtk/gtkshortcutsshortcut.c index 1cbd8e0bf8..ca12da0d16 100644 --- a/gtk/gtkshortcutsshortcut.c +++ b/gtk/gtkshortcutsshortcut.c @@ -725,8 +725,6 @@ gtk_shortcuts_shortcut_class_init (GtkShortcutsShortcutClass *klass) static void gtk_shortcuts_shortcut_init (GtkShortcutsShortcut *self) { - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); - self->box = g_object_new (GTK_TYPE_BOX, "orientation", GTK_ORIENTATION_HORIZONTAL, "spacing", 12, diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index edad0b3a61..427552c6e9 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -873,8 +873,6 @@ gtk_spin_button_init (GtkSpinButton *spin_button) GtkEventController *controller; GtkGesture *gesture; - gtk_widget_set_has_surface (GTK_WIDGET (spin_button), FALSE); - priv->adjustment = NULL; priv->timer = 0; priv->climb_rate = 0.0; diff --git a/gtk/gtkspinner.c b/gtk/gtkspinner.c index d8840d9957..929fbaa7c7 100644 --- a/gtk/gtkspinner.c +++ b/gtk/gtkspinner.c @@ -216,7 +216,6 @@ gtk_spinner_class_init (GtkSpinnerClass *klass) static void gtk_spinner_init (GtkSpinner *spinner) { - gtk_widget_set_has_surface (GTK_WIDGET (spinner), FALSE); } /** diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c index d329d7b6e3..0affae37cc 100644 --- a/gtk/gtkstack.c +++ b/gtk/gtkstack.c @@ -2544,8 +2544,6 @@ gtk_stack_init (GtkStack *stack) { GtkStackPrivate *priv = gtk_stack_get_instance_private (stack); - gtk_widget_set_has_surface (GTK_WIDGET (stack), FALSE); - priv->vhomogeneous = TRUE; priv->hhomogeneous = TRUE; priv->transition_duration = 200; diff --git a/gtk/gtkstackswitcher.c b/gtk/gtkstackswitcher.c index c7803de6dc..21969f156b 100644 --- a/gtk/gtkstackswitcher.c +++ b/gtk/gtkstackswitcher.c @@ -101,8 +101,6 @@ gtk_stack_switcher_init (GtkStackSwitcher *switcher) GtkStyleContext *context; GtkStackSwitcherPrivate *priv; - gtk_widget_set_has_surface (GTK_WIDGET (switcher), FALSE); - priv = gtk_stack_switcher_get_instance_private (switcher); priv->buttons = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL); diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c index ef557fd21d..c214015a73 100644 --- a/gtk/gtkstatusbar.c +++ b/gtk/gtkstatusbar.c @@ -244,8 +244,6 @@ gtk_statusbar_init (GtkStatusbar *statusbar) { GtkStatusbarPrivate *priv = gtk_statusbar_get_instance_private (statusbar); - gtk_widget_set_has_surface (GTK_WIDGET (statusbar), FALSE); - priv->seq_context_id = 1; priv->seq_message_id = 1; priv->messages = NULL; diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c index 71f97024e1..09f6d235d2 100644 --- a/gtk/gtkswitch.c +++ b/gtk/gtkswitch.c @@ -637,7 +637,6 @@ gtk_switch_init (GtkSwitch *self) GtkLayoutManager *layout; GtkGesture *gesture; - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE); gesture = gtk_gesture_multi_press_new (); diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 531fb52285..f177a8fd50 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -1665,7 +1665,6 @@ gtk_text_init (GtkText *self) int i; gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE); - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); gtk_widget_set_overflow (GTK_WIDGET (self), GTK_OVERFLOW_HIDDEN); priv->editable = TRUE; diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index aaf90471cb..4a7cb14b7d 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -1619,7 +1619,6 @@ gtk_text_view_init (GtkTextView *text_view) text_view->priv = gtk_text_view_get_instance_private (text_view); priv = text_view->priv; - gtk_widget_set_has_surface (widget, FALSE); gtk_widget_set_can_focus (widget, TRUE); gtk_widget_set_overflow (widget, GTK_OVERFLOW_HIDDEN); diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index b1e59b06d2..e0f51c1b6b 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -522,7 +522,6 @@ gtk_toolbar_init (GtkToolbar *toolbar) priv = toolbar->priv; gtk_widget_set_can_focus (widget, FALSE); - gtk_widget_set_has_surface (widget, FALSE); priv->orientation = GTK_ORIENTATION_HORIZONTAL; priv->style = DEFAULT_TOOLBAR_STYLE; diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 077101e579..53902a36d3 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -1700,8 +1700,6 @@ gtk_tree_view_init (GtkTreeView *tree_view) priv->event_last_x = -10000; priv->event_last_y = -10000; - gtk_widget_set_has_surface (GTK_WIDGET (tree_view), FALSE); - gtk_tree_view_do_set_vadjustment (tree_view, NULL); gtk_tree_view_do_set_hadjustment (tree_view, NULL); diff --git a/gtk/gtkvideo.c b/gtk/gtkvideo.c index 3e46b4ec6d..3543d458a4 100644 --- a/gtk/gtkvideo.c +++ b/gtk/gtkvideo.c @@ -345,7 +345,6 @@ static void gtk_video_init (GtkVideo *self) { gtk_widget_init_template (GTK_WIDGET (self)); - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); } /** diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index 360dd76a4a..1a6d17deb4 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -348,7 +348,6 @@ gtk_viewport_init (GtkViewport *viewport) widget = GTK_WIDGET (viewport); - gtk_widget_set_has_surface (widget, FALSE); gtk_widget_set_overflow (widget, GTK_OVERFLOW_HIDDEN); priv->shadow_type = GTK_SHADOW_IN; diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 8ce28fc715..5f38d59646 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -3265,7 +3265,7 @@ gtk_widget_map (GtkWidget *widget) update_cursor_on_state_change (widget); - if (!_gtk_widget_get_has_surface (widget)) + if (!GTK_IS_NATIVE (widget)) gtk_widget_queue_draw (widget); gtk_widget_pop_verify_invariants (widget); @@ -3940,7 +3940,7 @@ gtk_widget_get_surface_allocation (GtkWidget *widget, /* Don't consider the parent == widget case here. */ parent = _gtk_widget_get_parent (widget); - while (parent && !_gtk_widget_get_has_surface (parent)) + while (parent && !GTK_IS_NATIVE (parent)) parent = _gtk_widget_get_parent (parent); g_assert (GTK_IS_WINDOW (parent) || GTK_IS_POPOVER (parent)); @@ -4016,7 +4016,7 @@ gtk_widget_queue_draw (GtkWidget *widget) priv->draw_needed = TRUE; g_clear_pointer (&priv->render_node, gsk_render_node_unref); - if (_gtk_widget_get_has_surface (widget) && + if (GTK_IS_NATIVE (widget) && _gtk_widget_get_realized (widget)) gdk_surface_queue_expose (gtk_widget_get_surface (widget)); } @@ -4402,7 +4402,7 @@ gtk_widget_allocate (GtkWidget *widget, adjusted.height = 0; } - if (G_UNLIKELY (_gtk_widget_get_has_surface (widget))) + if (G_UNLIKELY (GTK_IS_NATIVE (widget))) { adjusted.width = MAX (1, adjusted.width); adjusted.height = MAX (1, adjusted.height); @@ -6198,57 +6198,6 @@ gtk_widget_is_visible (GtkWidget *widget) return TRUE; } -/** - * gtk_widget_set_has_surface: - * @widget: a #GtkWidget - * @has_surface: whether or not @widget has a surface. - * - * Specifies whether @widget has a #GdkSurface of its own. Note that - * all realized widgets have a non-%NULL “window” pointer - * (gtk_widget_get_surface() never returns a %NULL surface when a widget - * is realized), but for many of them it’s actually the #GdkSurface of - * one of its parent widgets. Widgets that do not create a %window for - * themselves in #GtkWidget::realize must announce this by - * calling this function with @has_surface = %FALSE. - * - * This function should only be called by widget implementations, - * and they should call it in their init() function. - **/ -void -gtk_widget_set_has_surface (GtkWidget *widget, - gboolean has_surface) -{ - GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); - - g_return_if_fail (GTK_IS_WIDGET (widget)); - - priv->no_surface = !has_surface; - priv->no_surface_set = TRUE; - - /* GdkSurface has a min size of 1×1 */ - priv->width = 1; - priv->height = 1; -} - -/** - * gtk_widget_get_has_surface: - * @widget: a #GtkWidget - * - * Determines whether @widget has a #GdkSurface of its own. See - * gtk_widget_set_has_surface(). - * - * Returns: %TRUE if @widget has a surface, %FALSE otherwise - **/ -gboolean -gtk_widget_get_has_surface (GtkWidget *widget) -{ - GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); - - g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); - - return !priv->no_surface; -} - /** * gtk_widget_is_toplevel: * @widget: a #GtkWidget @@ -7913,11 +7862,6 @@ gtk_widget_constructed (GObject *object) g_object_set_qdata (object, quark_widget_path, NULL); G_OBJECT_CLASS (gtk_widget_parent_class)->constructed (object); - - if (!priv->no_surface_set) - { - g_warning ("%s does not call gtk_widget_set_has_surface() in its init function", G_OBJECT_TYPE_NAME (widget)); - } } static void @@ -8221,7 +8165,7 @@ gtk_widget_real_map (GtkWidget *widget) GtkWidget *p; priv->mapped = TRUE; - if (_gtk_widget_get_has_surface (widget)) + if (GTK_IS_NATIVE (widget)) gdk_surface_show (priv->surface); for (p = gtk_widget_get_first_child (widget); @@ -8254,7 +8198,7 @@ gtk_widget_real_unmap (GtkWidget *widget) GtkWidget *child; priv->mapped = FALSE; - if (_gtk_widget_get_has_surface (widget)) + if (GTK_IS_NATIVE (widget)) gdk_surface_hide (priv->surface); for (child = gtk_widget_get_first_child (widget); @@ -8285,7 +8229,7 @@ gtk_widget_real_realize (GtkWidget *widget) { GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); - if (_gtk_widget_get_has_surface (widget)) + if (GTK_IS_NATIVE (widget)) { g_assert (priv->surface != NULL); } @@ -8328,7 +8272,7 @@ gtk_widget_real_unrealize (GtkWidget *widget) priv->realized = FALSE; - if (_gtk_widget_get_has_surface (widget)) + if (GTK_IS_NATIVE (widget)) { gdk_surface_destroy (priv->surface); priv->surface = NULL; @@ -8729,7 +8673,7 @@ gtk_widget_input_shape_combine_region (GtkWidget *widget, { g_return_if_fail (GTK_IS_WIDGET (widget)); /* set_shape doesn't work on widgets without GDK surface */ - g_return_if_fail (_gtk_widget_get_has_surface (widget)); + g_return_if_fail (GTK_IS_NATIVE (widget)); if (region == NULL) g_object_set_qdata (G_OBJECT (widget), quark_input_shape_info, NULL); diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 170e5dd90c..831773e7a0 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -525,12 +525,6 @@ gboolean gtk_widget_get_visible (GtkWidget *widget); GDK_AVAILABLE_IN_ALL gboolean gtk_widget_is_visible (GtkWidget *widget); -GDK_AVAILABLE_IN_ALL -void gtk_widget_set_has_surface (GtkWidget *widget, - gboolean has_surface); -GDK_AVAILABLE_IN_ALL -gboolean gtk_widget_get_has_surface (GtkWidget *widget); - GDK_AVAILABLE_IN_ALL gboolean gtk_widget_is_toplevel (GtkWidget *widget); GDK_AVAILABLE_IN_ALL diff --git a/gtk/gtkwidgetfocus.c b/gtk/gtkwidgetfocus.c index 26f7f8ae24..a8da390adc 100644 --- a/gtk/gtkwidgetfocus.c +++ b/gtk/gtkwidgetfocus.c @@ -16,6 +16,7 @@ */ #include "gtkwidgetprivate.h" +#include "gtknative.h" typedef struct _CompareInfo CompareInfo; @@ -285,13 +286,13 @@ focus_sort_left_right (GtkWidget *widget, } else { - if (!_gtk_widget_get_has_surface (widget)) + if (!GTK_IS_NATIVE (widget)) compare_info.y = bounds.origin.y + bounds.size.height; else compare_info.y = bounds.size.height / 2.0f; } - if (!_gtk_widget_get_has_surface (widget)) + if (!GTK_IS_NATIVE (widget)) compare_info.x = (direction == GTK_DIR_RIGHT) ? bounds.origin.x : bounds.origin.x + bounds.size.width; else compare_info.x = (direction == GTK_DIR_RIGHT) ? 0 : bounds.size.width; @@ -387,13 +388,13 @@ focus_sort_up_down (GtkWidget *widget, } else { - if (!_gtk_widget_get_has_surface (widget)) + if (!GTK_IS_NATIVE (widget)) compare_info.x = bounds.origin.x + (bounds.size.width / 2.0f); else compare_info.x = bounds.size.width / 2.0f; } - if (!_gtk_widget_get_has_surface (widget)) + if (!GTK_IS_NATIVE (widget)) compare_info.y = (direction == GTK_DIR_DOWN) ? bounds.origin.y : bounds.origin.y + bounds.size.height; else compare_info.y = (direction == GTK_DIR_DOWN) ? 0 : + bounds.size.height; diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h index bf4b22b2f1..3bd7277357 100644 --- a/gtk/gtkwidgetprivate.h +++ b/gtk/gtkwidgetprivate.h @@ -72,8 +72,6 @@ struct _GtkWidgetPrivate #endif guint in_destruction : 1; - guint no_surface : 1; - guint no_surface_set : 1; guint realized : 1; guint mapped : 1; guint visible : 1; @@ -402,12 +400,6 @@ _gtk_widget_is_drawable (GtkWidget *widget) return widget->priv->visible && widget->priv->mapped; } -static inline gboolean -_gtk_widget_get_has_surface (GtkWidget *widget) -{ - return !widget->priv->no_surface; -} - static inline gboolean _gtk_widget_get_realized (GtkWidget *widget) { diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index af33165a5a..a3f7621a18 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -1832,8 +1832,6 @@ gtk_window_init (GtkWindow *window) widget = GTK_WIDGET (window); - gtk_widget_set_has_surface (widget, TRUE); - priv->title = NULL; priv->geometry_info = NULL; priv->type = GTK_WINDOW_TOPLEVEL; diff --git a/tests/showrendernode.c b/tests/showrendernode.c index c05988c07d..6ea4ba1d5d 100644 --- a/tests/showrendernode.c +++ b/tests/showrendernode.c @@ -93,7 +93,6 @@ gtk_node_view_finalize (GObject *object) static void gtk_node_view_init (GtkNodeView *self) { - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); } static void diff --git a/tests/testtexture.c b/tests/testtexture.c index be8400d978..3fe7dc358f 100644 --- a/tests/testtexture.c +++ b/tests/testtexture.c @@ -86,7 +86,6 @@ gtk_texture_view_finalize (GObject *object) static void gtk_texture_view_init (GtkTextureView *self) { - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); } static void diff --git a/tests/testwidgetfocus.c b/tests/testwidgetfocus.c index 323050e461..0ee9e7903c 100644 --- a/tests/testwidgetfocus.c +++ b/tests/testwidgetfocus.c @@ -232,8 +232,6 @@ gtk_focus_widget_init (GtkFocusWidget *self) { GtkEventController *controller; - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); - self->child1 = gtk_button_new_with_label ("1"); gtk_widget_set_parent (self->child1, GTK_WIDGET (self)); self->child2 = gtk_button_new_with_label ("2"); diff --git a/tests/testwidgettransforms.c b/tests/testwidgettransforms.c index 91ac1d0d15..62c99b994a 100644 --- a/tests/testwidgettransforms.c +++ b/tests/testwidgettransforms.c @@ -50,7 +50,6 @@ G_DEFINE_TYPE (GtkMatrixChooser, gtk_matrix_chooser, GTK_TYPE_WIDGET) static void gtk_matrix_chooser_init (GtkMatrixChooser *self) { - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); } static void @@ -237,8 +236,6 @@ gtk_transform_tester_snapshot (GtkWidget *widget, static void gtk_transform_tester_init (GtkTransformTester *self) { - gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); - self->pick_increase = 4; }