gdk: Remove GdkSurface::size-changed

It's not emitted, and everyone should use the GdkSurface::layout signal
from now on.
This commit is contained in:
Jonas Ådahl 2020-12-02 17:08:07 +01:00
parent b8fa892b70
commit b738054344
5 changed files with 19 additions and 50 deletions

View File

@ -165,7 +165,7 @@ for this change.
| ::key-release-event | #GtkEventControllerKey | | ::key-release-event | #GtkEventControllerKey |
| ::enter-notify-event | #GtkEventControllerMotion | | ::enter-notify-event | #GtkEventControllerMotion |
| ::leave-notify-event | #GtkEventControllerMotion | | ::leave-notify-event | #GtkEventControllerMotion |
| ::configure-event | replaced by #GdkSurface::size-changed | | ::configure-event | replaced by #GdkSurface::layout |
| ::focus-in-event | #GtkEventControllerFocus | | ::focus-in-event | #GtkEventControllerFocus |
| ::focus-out-event | #GtkEventControllerFocus | | ::focus-out-event | #GtkEventControllerFocus |
| ::map-event | replaced by #GdkSurface:mapped | | ::map-event | replaced by #GdkSurface:mapped |

View File

@ -76,7 +76,6 @@
*/ */
enum { enum {
SIZE_CHANGED,
LAYOUT, LAYOUT,
RENDER, RENDER,
EVENT, EVENT,
@ -551,30 +550,6 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
g_object_class_install_properties (object_class, LAST_PROP, properties); g_object_class_install_properties (object_class, LAST_PROP, properties);
/**
* GdkSurface::size-changed:
* @surface: the #GdkSurface
* @width: the new width
* @height: the new height
*
* Emitted when the size of @surface is changed.
*
* Surface size is reported in application pixels, not
* device pixels (see gdk_surface_get_scale_factor()).
*/
signals[SIZE_CHANGED] =
g_signal_new (g_intern_static_string ("size-changed"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0,
NULL,
NULL,
NULL,
G_TYPE_NONE,
2,
G_TYPE_INT,
G_TYPE_INT);
/** /**
* GdkSurface::layout: * GdkSurface::layout:
* @surface: the #GdkSurface * @surface: the #GdkSurface
@ -1306,14 +1281,6 @@ gdk_surface_schedule_update (GdkSurface *surface)
GDK_FRAME_CLOCK_PHASE_PAINT); GDK_FRAME_CLOCK_PHASE_PAINT);
} }
void
gdk_surface_emit_size_changed (GdkSurface *surface,
int width,
int height)
{
g_signal_emit (surface, signals[SIZE_CHANGED], 0, width, height);
}
static void static void
gdk_surface_process_updates_internal (GdkSurface *surface) gdk_surface_process_updates_internal (GdkSurface *surface)
{ {

View File

@ -748,13 +748,6 @@ surface_mapped_changed (GtkWidget *widget)
gtk_widget_set_visible (widget, gdk_surface_get_mapped (priv->surface)); gtk_widget_set_visible (widget, gdk_surface_get_mapped (priv->surface));
} }
static void
surface_size_changed (GtkWidget *widget,
guint width,
guint height)
{
}
static gboolean static gboolean
surface_render (GdkSurface *surface, surface_render (GdkSurface *surface,
cairo_region_t *region, cairo_region_t *region,
@ -899,7 +892,6 @@ gtk_popover_realize (GtkWidget *widget)
gdk_surface_set_widget (priv->surface, widget); gdk_surface_set_widget (priv->surface, widget);
g_signal_connect_swapped (priv->surface, "notify::mapped", G_CALLBACK (surface_mapped_changed), widget); g_signal_connect_swapped (priv->surface, "notify::mapped", G_CALLBACK (surface_mapped_changed), widget);
g_signal_connect_swapped (priv->surface, "size-changed", G_CALLBACK (surface_size_changed), widget);
g_signal_connect (priv->surface, "render", G_CALLBACK (surface_render), widget); g_signal_connect (priv->surface, "render", G_CALLBACK (surface_render), widget);
g_signal_connect (priv->surface, "event", G_CALLBACK (surface_event), widget); g_signal_connect (priv->surface, "event", G_CALLBACK (surface_event), widget);
g_signal_connect (priv->surface, "popup-layout-changed", G_CALLBACK (popup_layout_changed), widget); g_signal_connect (priv->surface, "popup-layout-changed", G_CALLBACK (popup_layout_changed), widget);
@ -925,7 +917,6 @@ gtk_popover_unrealize (GtkWidget *widget)
g_clear_object (&priv->renderer); g_clear_object (&priv->renderer);
g_signal_handlers_disconnect_by_func (priv->surface, surface_mapped_changed, widget); g_signal_handlers_disconnect_by_func (priv->surface, surface_mapped_changed, widget);
g_signal_handlers_disconnect_by_func (priv->surface, surface_size_changed, widget);
g_signal_handlers_disconnect_by_func (priv->surface, surface_render, widget); g_signal_handlers_disconnect_by_func (priv->surface, surface_render, widget);
g_signal_handlers_disconnect_by_func (priv->surface, surface_event, widget); g_signal_handlers_disconnect_by_func (priv->surface, surface_event, widget);
g_signal_handlers_disconnect_by_func (priv->surface, popup_layout_changed, widget); g_signal_handlers_disconnect_by_func (priv->surface, popup_layout_changed, widget);

View File

@ -4368,7 +4368,6 @@ gtk_window_realize (GtkWidget *widget)
priv->renderer = gsk_renderer_new_for_surface (surface); priv->renderer = gsk_renderer_new_for_surface (surface);
g_signal_connect_swapped (surface, "notify::state", G_CALLBACK (surface_state_changed), widget); g_signal_connect_swapped (surface, "notify::state", G_CALLBACK (surface_state_changed), widget);
g_signal_connect_swapped (surface, "size-changed", G_CALLBACK (surface_size_changed), widget);
g_signal_connect (surface, "render", G_CALLBACK (surface_render), widget); g_signal_connect (surface, "render", G_CALLBACK (surface_render), widget);
g_signal_connect (surface, "event", G_CALLBACK (surface_event), widget); g_signal_connect (surface, "event", G_CALLBACK (surface_event), widget);
g_signal_connect (surface, "compute-size", G_CALLBACK (toplevel_compute_size), widget); g_signal_connect (surface, "compute-size", G_CALLBACK (toplevel_compute_size), widget);
@ -4476,7 +4475,6 @@ gtk_window_unrealize (GtkWidget *widget)
surface = priv->surface; surface = priv->surface;
g_signal_handlers_disconnect_by_func (surface, surface_state_changed, widget); 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_render, widget);
g_signal_handlers_disconnect_by_func (surface, surface_event, widget); g_signal_handlers_disconnect_by_func (surface, surface_event, widget);

View File

@ -8,14 +8,27 @@ static GtkWidget *default_width_spin;
static GtkWidget *default_height_spin; static GtkWidget *default_height_spin;
static GtkWidget *resizable_check; static GtkWidget *resizable_check;
static void static gboolean
size_changed_cb (GdkSurface *surface, int width, int height, GtkLabel *label) set_label_idle (gpointer user_data)
{ {
GtkLabel *label = user_data;
GtkNative *native = gtk_widget_get_native (GTK_WIDGET (label));
GdkSurface *surface = gtk_native_get_surface (native);
char *str; char *str;
str = g_strdup_printf ("%d x %d", width, height); str = g_strdup_printf ("%d x %d",
gdk_surface_get_width (surface),
gdk_surface_get_height (surface));
gtk_label_set_label (label, str); gtk_label_set_label (label, str);
g_free (str); g_free (str);
return G_SOURCE_REMOVE;
}
static void
layout_cb (GdkSurface *surface, int width, int height, GtkLabel *label)
{
g_idle_add (set_label_idle, label);
} }
static void static void
@ -63,8 +76,8 @@ show_dialog (void)
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), label, GTK_RESPONSE_HELP); gtk_dialog_add_action_widget (GTK_DIALOG (dialog), label, GTK_RESPONSE_HELP);
gtk_widget_realize (dialog); gtk_widget_realize (dialog);
g_signal_connect (gtk_native_get_surface (GTK_NATIVE (dialog)), "size-changed", g_signal_connect (gtk_native_get_surface (GTK_NATIVE (dialog)), "layout",
G_CALLBACK (size_changed_cb), label); G_CALLBACK (layout_cb), label);
g_signal_connect (dialog, "response", g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), G_CALLBACK (gtk_window_destroy),
NULL); NULL);