Drop the GtkWidget::display-changed signal

Display changes now happen exclusively through
the ::root and ::unroot vfuncs. Third parties
can observe display changes by listening
for notify::root.
This commit is contained in:
Matthias Clasen 2019-05-02 00:11:55 +00:00
parent 965d0e04d1
commit bea8025fb5
2 changed files with 0 additions and 102 deletions

View File

@ -916,7 +916,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->drag_motion = NULL; klass->drag_motion = NULL;
klass->drag_drop = NULL; klass->drag_drop = NULL;
klass->drag_data_received = NULL; klass->drag_data_received = NULL;
klass->display_changed = NULL;
klass->can_activate_accel = gtk_widget_real_can_activate_accel; klass->can_activate_accel = gtk_widget_real_can_activate_accel;
klass->query_tooltip = gtk_widget_real_query_tooltip; klass->query_tooltip = gtk_widget_real_query_tooltip;
klass->style_updated = gtk_widget_real_style_updated; klass->style_updated = gtk_widget_real_style_updated;
@ -2075,25 +2074,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
/**
* GtkWidget::display-changed:
* @widget: the object on which the signal is emitted
* @previous_display: (allow-none): the previous screen, or %NULL if the
* widget was not associated with a screen before
*
* The ::display-changed signal gets emitted when the
* display of a widget has changed.
*/
widget_signals[DISPLAY_CHANGED] =
g_signal_new (I_("display-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkWidgetClass, display_changed),
NULL, NULL,
NULL,
G_TYPE_NONE, 1,
GDK_TYPE_DISPLAY);
/** /**
* GtkWidget::can-activate-accel: * GtkWidget::can-activate-accel:
* @widget: the object which received the signal * @widget: the object which received the signal
@ -6694,84 +6674,6 @@ gtk_widget_real_direction_changed (GtkWidget *widget,
gtk_widget_queue_resize (widget); gtk_widget_queue_resize (widget);
} }
typedef struct {
GtkWidget *previous_toplevel;
GdkDisplay *previous_display;
GdkDisplay *new_display;
} HierarchyChangedInfo;
static void
do_display_change (GtkWidget *widget,
GdkDisplay *old_display,
GdkDisplay *new_display)
{
if (old_display != new_display)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
if (old_display)
{
PangoContext *context = g_object_get_qdata (G_OBJECT (widget), quark_pango_context);
if (context)
g_object_set_qdata (G_OBJECT (widget), quark_pango_context, NULL);
}
_gtk_tooltip_hide (widget);
if (new_display && priv->context)
gtk_style_context_set_display (priv->context, new_display);
g_signal_emit (widget, widget_signals[DISPLAY_CHANGED], 0, old_display);
}
}
static void
gtk_widget_propagate_display_changed_recurse (GtkWidget *widget,
gpointer client_data)
{
HierarchyChangedInfo *info = client_data;
GtkWidget *child;
g_object_ref (widget);
do_display_change (widget, info->previous_display, info->new_display);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
gtk_widget_propagate_display_changed_recurse (child, client_data);
}
g_object_unref (widget);
}
/**
* _gtk_widget_propagate_display_changed:
* @widget: a #GtkWidget
* @previous_display: Previous display
*
* Propagates changes in the display for a widget to all
* children, emitting #GtkWidget::display-changed.
**/
void
_gtk_widget_propagate_display_changed (GtkWidget *widget,
GdkDisplay *previous_display)
{
HierarchyChangedInfo info;
info.previous_display = previous_display;
info.new_display = gtk_widget_get_display (widget);
if (previous_display)
g_object_ref (previous_display);
gtk_widget_propagate_display_changed_recurse (widget, &info);
if (previous_display)
g_object_unref (previous_display);
}
static void static void
reset_style_recurse (GtkWidget *widget, gpointer user_data) reset_style_recurse (GtkWidget *widget, gpointer user_data)
{ {

View File

@ -209,8 +209,6 @@ struct _GtkWidget
* context menu. * context menu.
* @get_accessible: Returns the accessible object that describes the * @get_accessible: Returns the accessible object that describes the
* widget to an assistive technology. * widget to an assistive technology.
* @display_changed: Signal emitted when the #GdkDisplay of a widget has
* changed.
* @can_activate_accel: Signal allows applications and derived widgets * @can_activate_accel: Signal allows applications and derived widgets
* to override the default GtkWidget handling for determining whether * to override the default GtkWidget handling for determining whether
* an accelerator can be activated. * an accelerator can be activated.
@ -314,8 +312,6 @@ struct _GtkWidgetClass
*/ */
AtkObject * (* get_accessible) (GtkWidget *widget); AtkObject * (* get_accessible) (GtkWidget *widget);
void (* display_changed) (GtkWidget *widget,
GdkDisplay *previous_display);
gboolean (* can_activate_accel) (GtkWidget *widget, gboolean (* can_activate_accel) (GtkWidget *widget,
guint signal_id); guint signal_id);