mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 19:30:10 +00:00
Work toward dropping widget->surface
Drop special-casing of GtkNative in most widget vfuncs. GtkNative implementations need to override these anyway.
This commit is contained in:
parent
18788c2a86
commit
0047492bf9
@ -586,7 +586,7 @@ gtk_popover_unrealize (GtkWidget *widget)
|
||||
g_signal_handlers_disconnect_by_func (priv->surface, surface_event, widget);
|
||||
g_signal_handlers_disconnect_by_func (priv->surface, surface_moved_to_rect, widget);
|
||||
gdk_surface_set_widget (priv->surface, NULL);
|
||||
|
||||
gdk_surface_destroy (priv->surface);
|
||||
g_clear_object (&priv->surface);
|
||||
}
|
||||
|
||||
@ -683,7 +683,6 @@ gtk_popover_unmap (GtkWidget *widget)
|
||||
priv->surface_transform_changed_cb = 0;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_popover_parent_class)->unmap (widget);
|
||||
|
||||
gdk_surface_hide (priv->surface);
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||
|
@ -3265,8 +3265,7 @@ gtk_widget_map (GtkWidget *widget)
|
||||
|
||||
update_cursor_on_state_change (widget);
|
||||
|
||||
if (!GTK_IS_NATIVE (widget))
|
||||
gtk_widget_queue_draw (widget);
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
gtk_widget_pop_verify_invariants (widget);
|
||||
}
|
||||
@ -4016,9 +4015,8 @@ gtk_widget_queue_draw (GtkWidget *widget)
|
||||
|
||||
priv->draw_needed = TRUE;
|
||||
g_clear_pointer (&priv->render_node, gsk_render_node_unref);
|
||||
if (GTK_IS_NATIVE (widget) &&
|
||||
_gtk_widget_get_realized (widget))
|
||||
gdk_surface_queue_expose (gtk_widget_get_surface (widget));
|
||||
if (GTK_IS_NATIVE (widget) && _gtk_widget_get_realized (widget))
|
||||
gdk_surface_queue_expose (gtk_native_get_surface (GTK_NATIVE (widget)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -4176,17 +4174,7 @@ gtk_widget_get_frame_clock (GtkWidget *widget)
|
||||
|
||||
if (priv->realized)
|
||||
{
|
||||
/* We use gtk_widget_get_root() here to make it explicit that
|
||||
* the frame clock is a property of the toplevel that a widget
|
||||
* is anchored to; gdk_surface_get_toplevel() will go up the
|
||||
* hierarchy anyways, but should squash any funny business with
|
||||
* reparenting windows and widgets.
|
||||
*/
|
||||
GtkRoot *root = _gtk_widget_get_root (widget);
|
||||
GdkSurface *surface = _gtk_widget_get_surface (GTK_WIDGET (root));
|
||||
g_assert (surface != NULL);
|
||||
|
||||
return gdk_surface_get_frame_clock (surface);
|
||||
return gdk_surface_get_frame_clock (priv->surface);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -8165,9 +8153,6 @@ gtk_widget_real_map (GtkWidget *widget)
|
||||
GtkWidget *p;
|
||||
priv->mapped = TRUE;
|
||||
|
||||
if (GTK_IS_NATIVE (widget))
|
||||
gdk_surface_show (priv->surface);
|
||||
|
||||
for (p = gtk_widget_get_first_child (widget);
|
||||
p != NULL;
|
||||
p = gtk_widget_get_next_sibling (p))
|
||||
@ -8198,9 +8183,6 @@ gtk_widget_real_unmap (GtkWidget *widget)
|
||||
GtkWidget *child;
|
||||
priv->mapped = FALSE;
|
||||
|
||||
if (GTK_IS_NATIVE (widget))
|
||||
gdk_surface_hide (priv->surface);
|
||||
|
||||
for (child = gtk_widget_get_first_child (widget);
|
||||
child != NULL;
|
||||
child = gtk_widget_get_next_sibling (child))
|
||||
@ -8232,6 +8214,8 @@ gtk_widget_real_realize (GtkWidget *widget)
|
||||
if (GTK_IS_NATIVE (widget))
|
||||
{
|
||||
g_assert (priv->surface != NULL);
|
||||
priv->surface = gtk_native_get_surface (GTK_NATIVE (widget));
|
||||
g_object_ref (priv->surface);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -8272,16 +8256,7 @@ gtk_widget_real_unrealize (GtkWidget *widget)
|
||||
|
||||
priv->realized = FALSE;
|
||||
|
||||
if (GTK_IS_NATIVE (widget))
|
||||
{
|
||||
gdk_surface_destroy (priv->surface);
|
||||
priv->surface = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_object_unref (priv->surface);
|
||||
priv->surface = NULL;
|
||||
}
|
||||
g_clear_object (&priv->surface);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -5046,7 +5046,7 @@ gtk_window_map (GtkWidget *widget)
|
||||
gtk_widget_get_child_visible (priv->title_box))
|
||||
gtk_widget_map (priv->title_box);
|
||||
|
||||
surface = _gtk_widget_get_surface (widget);
|
||||
surface = priv->surface;
|
||||
|
||||
if (priv->maximize_initially)
|
||||
gdk_surface_maximize (surface);
|
||||
@ -5137,7 +5137,7 @@ gtk_window_unmap (GtkWidget *widget)
|
||||
return;
|
||||
}
|
||||
|
||||
surface = _gtk_widget_get_surface (widget);
|
||||
surface = priv->surface;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_window_parent_class)->unmap (widget);
|
||||
gdk_surface_hide (surface);
|
||||
@ -5197,16 +5197,17 @@ gtk_window_guess_default_size (GtkWindow *window,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
GtkWidget *widget;
|
||||
GdkDisplay *display;
|
||||
GdkSurface *surface;
|
||||
GdkDisplay *display;
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle workarea;
|
||||
int minimum, natural;
|
||||
|
||||
widget = GTK_WIDGET (window);
|
||||
display = gtk_widget_get_display (widget);
|
||||
surface = _gtk_widget_get_surface (widget);
|
||||
surface = priv->surface;
|
||||
|
||||
if (surface)
|
||||
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
||||
@ -5831,13 +5832,15 @@ gtk_window_unrealize (GtkWidget *widget)
|
||||
gsk_renderer_unrealize (priv->renderer);
|
||||
g_clear_object (&priv->renderer);
|
||||
|
||||
surface = _gtk_widget_get_surface (widget);
|
||||
surface = priv->surface;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (surface, surface_state_changed, widget);
|
||||
g_signal_handlers_disconnect_by_func (surface, surface_size_changed, widget);
|
||||
g_signal_handlers_disconnect_by_func (surface, surface_render, widget);
|
||||
g_signal_handlers_disconnect_by_func (surface, surface_event, widget);
|
||||
gdk_surface_set_widget (surface, NULL);
|
||||
gdk_surface_destroy (surface);
|
||||
g_clear_object (&priv->surface);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_window_parent_class)->unrealize (widget);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user