From 0ce9f26dc543655761166686275b3da3b2f44174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 8 Feb 2017 13:55:11 +0100 Subject: [PATCH] window: Remove has-toplevel-focus property Since embedded toplevels don't exist anymore, :has-toplevel-focus is equivalent to :active. --- docs/reference/gtk/gtk4-sections.txt | 1 - gtk/a11y/gtkaccessibility.c | 2 +- gtk/a11y/gtkwindowaccessible.c | 2 +- gtk/gtkwindow.c | 66 +--------------------------- gtk/gtkwindow.h | 2 - gtk/gtkwindowprivate.h | 2 - 6 files changed, 3 insertions(+), 72 deletions(-) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 9f5532eb3d..5cedb69d50 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -4752,7 +4752,6 @@ gtk_window_set_screen gtk_window_get_screen gtk_window_is_active gtk_window_is_maximized -gtk_window_has_toplevel_focus gtk_window_list_toplevels gtk_window_add_mnemonic gtk_window_remove_mnemonic diff --git a/gtk/a11y/gtkaccessibility.c b/gtk/a11y/gtkaccessibility.c index 021f828566..bad3cd5133 100644 --- a/gtk/a11y/gtkaccessibility.c +++ b/gtk/a11y/gtkaccessibility.c @@ -935,7 +935,7 @@ window_removed (AtkObject *atk_obj, * Deactivate window if it is still focused and we are removing it. This * can happen when a dialog displayed by gok is removed. */ - if (gtk_window_is_active (window) && gtk_window_has_toplevel_focus (window)) + if (gtk_window_is_active (window)) g_signal_emit_by_name (child, "deactivate"); g_signal_handlers_disconnect_by_func (widget, (gpointer) window_focus, NULL); diff --git a/gtk/a11y/gtkwindowaccessible.c b/gtk/a11y/gtkwindowaccessible.c index 017f130d56..3941b38072 100644 --- a/gtk/a11y/gtkwindowaccessible.c +++ b/gtk/a11y/gtkwindowaccessible.c @@ -251,7 +251,7 @@ gtk_window_accessible_ref_state_set (AtkObject *accessible) window = GTK_WINDOW (widget); - if (gtk_window_has_toplevel_focus (window) && gtk_window_is_active (window)) + if (gtk_window_is_active (window)) atk_state_set_add_state (state_set, ATK_STATE_ACTIVE); gdk_window = gtk_widget_get_window (widget); diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index da5c9be3a5..7131884bc4 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -238,7 +238,6 @@ struct _GtkWindowPrivate guint fullscreen_initially : 1; guint has_focus : 1; guint has_user_ref_count : 1; - guint has_toplevel_focus : 1; guint hide_titlebar_when_maximized : 1; guint iconify_initially : 1; /* gtk_window_iconify() called before realization */ guint is_active : 1; @@ -324,7 +323,6 @@ enum { PROP_APPLICATION, /* Readonly properties */ PROP_IS_ACTIVE, - PROP_HAS_TOPLEVEL_FOCUS, /* Writeonly properties */ PROP_STARTUP_ID, @@ -954,13 +952,6 @@ gtk_window_class_init (GtkWindowClass *klass) FALSE, GTK_PARAM_READABLE); - window_props[PROP_HAS_TOPLEVEL_FOCUS] = - g_param_spec_boolean ("has-toplevel-focus", - P_("Focus in Toplevel"), - P_("Whether the input focus is within this GtkWindow"), - FALSE, - GTK_PARAM_READABLE); - window_props[PROP_TYPE_HINT] = g_param_spec_enum ("type-hint", P_("Type hint"), @@ -1914,9 +1905,6 @@ gtk_window_get_property (GObject *object, case PROP_IS_ACTIVE: g_value_set_boolean (value, priv->is_active); break; - case PROP_HAS_TOPLEVEL_FOCUS: - g_value_set_boolean (value, priv->has_toplevel_focus); - break; case PROP_TYPE_HINT: g_value_set_enum (value, priv->type_hint); break; @@ -7855,7 +7843,6 @@ gtk_window_focus_in_event (GtkWidget *widget, */ if (gtk_widget_get_visible (widget)) { - _gtk_window_set_has_toplevel_focus (window, TRUE); _gtk_window_set_is_active (window, TRUE); if (gtk_window_has_mnemonic_modifier_pressed (window)) @@ -7871,7 +7858,6 @@ gtk_window_focus_out_event (GtkWidget *widget, { GtkWindow *window = GTK_WINDOW (widget); - _gtk_window_set_has_toplevel_focus (window, FALSE); _gtk_window_set_is_active (window, FALSE); /* set the mnemonic-visible property to false */ @@ -10260,7 +10246,6 @@ _gtk_window_get_screen (GtkWindow *window) * The return value is %TRUE if the window is active toplevel itself. * You might use this function if you wanted to draw a widget * differently in an active window from a widget in an inactive window. - * See gtk_window_has_toplevel_focus() * * Returns: %TRUE if the window part of the current active window. * @@ -10274,26 +10259,6 @@ gtk_window_is_active (GtkWindow *window) return window->priv->is_active; } -/** - * gtk_window_has_toplevel_focus: - * @window: a #GtkWindow - * - * Returns whether the input focus is within this GtkWindow. - * For real toplevel windows, this is identical to gtk_window_is_active(), - * but for embedded windows, like #GtkPlug, the results will differ. - * - * Returns: %TRUE if the input focus is within this GtkWindow - * - * Since: 2.4 - **/ -gboolean -gtk_window_has_toplevel_focus (GtkWindow *window) -{ - g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE); - - return window->priv->has_toplevel_focus; -} - /** * gtk_window_get_group: * @window: (allow-none): a #GtkWindow, or %NULL @@ -10661,7 +10626,7 @@ window_update_has_focus (GtkWindow *window) { GtkWindowPrivate *priv = window->priv; GtkWidget *widget = GTK_WIDGET (window); - gboolean has_focus = priv->has_toplevel_focus && priv->is_active; + gboolean has_focus = priv->is_active; if (has_focus != priv->has_focus) { @@ -10786,35 +10751,6 @@ _gtk_window_set_is_toplevel (GtkWindow *window, gtk_window_update_debugging (); } -/** - * _gtk_window_set_has_toplevel_focus: - * @window: a #GtkWindow - * @has_toplevel_focus: %TRUE if the in - * - * Internal function that sets whether the keyboard focus for the - * toplevel window (taking into account inter-process embedding.) - **/ -void -_gtk_window_set_has_toplevel_focus (GtkWindow *window, - gboolean has_toplevel_focus) -{ - GtkWindowPrivate *priv; - - g_return_if_fail (GTK_IS_WINDOW (window)); - - priv = window->priv; - - has_toplevel_focus = has_toplevel_focus != FALSE; - - if (has_toplevel_focus != priv->has_toplevel_focus) - { - priv->has_toplevel_focus = has_toplevel_focus; - window_update_has_focus (window); - - g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_HAS_TOPLEVEL_FOCUS]); - } -} - /** * gtk_window_set_auto_startup_notification: * @setting: %TRUE to automatically do startup notification diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h index c13eb6acdc..771feeeb05 100644 --- a/gtk/gtkwindow.h +++ b/gtk/gtkwindow.h @@ -263,8 +263,6 @@ GdkScreen* gtk_window_get_screen (GtkWindow *window); GDK_AVAILABLE_IN_ALL gboolean gtk_window_is_active (GtkWindow *window); -GDK_AVAILABLE_IN_ALL -gboolean gtk_window_has_toplevel_focus (GtkWindow *window); GDK_AVAILABLE_IN_ALL void gtk_window_set_decorated (GtkWindow *window, diff --git a/gtk/gtkwindowprivate.h b/gtk/gtkwindowprivate.h index 4d53ee4372..ce1383b173 100644 --- a/gtk/gtkwindowprivate.h +++ b/gtk/gtkwindowprivate.h @@ -46,8 +46,6 @@ gboolean _gtk_window_group_widget_is_blocked_for_device (GtkWindowGroup * GtkWidget *widget, GdkDevice *device); -void _gtk_window_set_has_toplevel_focus (GtkWindow *window, - gboolean has_toplevel_focus); void _gtk_window_unset_focus_and_default (GtkWindow *window, GtkWidget *widget);