Remove gtk_widget_get/set_has_surface

These serve no purpose anymore - widgets don't
have surfaces, unless they're a GtkNative.
This commit is contained in:
Matthias Clasen 2019-05-17 21:08:38 +00:00
parent db855e092d
commit 18788c2a86
82 changed files with 14 additions and 214 deletions

View File

@ -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 *

View File

@ -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 ("");

View File

@ -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 ();

View File

@ -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;
}

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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));
}

View File

@ -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;

View File

@ -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);

View File

@ -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 *

View File

@ -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

View File

@ -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;

View File

@ -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));

View File

@ -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));

View File

@ -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 ();

View File

@ -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);
}
/**

View File

@ -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));

View File

@ -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;

View File

@ -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 ();

View File

@ -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;

View File

@ -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));

View File

@ -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;

View File

@ -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"));

View File

@ -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);

View File

@ -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 *

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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));
}

View File

@ -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 ("");

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -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);
}
/**

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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));
}

View File

@ -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);

View File

@ -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));

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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",

View File

@ -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;

View File

@ -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);
}

View File

@ -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);

View File

@ -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

View File

@ -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));

View File

@ -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));
}

View File

@ -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

View File

@ -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,

View File

@ -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;

View File

@ -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);
}
/**

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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 ();

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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);
}
/**

View File

@ -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;

View File

@ -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 its 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);

View File

@ -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

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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");

View File

@ -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;
}