window: Remove has-toplevel-focus property

Since embedded toplevels don't exist anymore, :has-toplevel-focus is
equivalent to :active.
This commit is contained in:
Timm Bäder 2017-02-08 13:55:11 +01:00
parent ebdbb6873a
commit 0ce9f26dc5
6 changed files with 3 additions and 72 deletions

View File

@ -4752,7 +4752,6 @@ gtk_window_set_screen
gtk_window_get_screen gtk_window_get_screen
gtk_window_is_active gtk_window_is_active
gtk_window_is_maximized gtk_window_is_maximized
gtk_window_has_toplevel_focus
gtk_window_list_toplevels gtk_window_list_toplevels
gtk_window_add_mnemonic gtk_window_add_mnemonic
gtk_window_remove_mnemonic gtk_window_remove_mnemonic

View File

@ -935,7 +935,7 @@ window_removed (AtkObject *atk_obj,
* Deactivate window if it is still focused and we are removing it. This * Deactivate window if it is still focused and we are removing it. This
* can happen when a dialog displayed by gok is removed. * 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_emit_by_name (child, "deactivate");
g_signal_handlers_disconnect_by_func (widget, (gpointer) window_focus, NULL); g_signal_handlers_disconnect_by_func (widget, (gpointer) window_focus, NULL);

View File

@ -251,7 +251,7 @@ gtk_window_accessible_ref_state_set (AtkObject *accessible)
window = GTK_WINDOW (widget); 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); atk_state_set_add_state (state_set, ATK_STATE_ACTIVE);
gdk_window = gtk_widget_get_window (widget); gdk_window = gtk_widget_get_window (widget);

View File

@ -238,7 +238,6 @@ struct _GtkWindowPrivate
guint fullscreen_initially : 1; guint fullscreen_initially : 1;
guint has_focus : 1; guint has_focus : 1;
guint has_user_ref_count : 1; guint has_user_ref_count : 1;
guint has_toplevel_focus : 1;
guint hide_titlebar_when_maximized : 1; guint hide_titlebar_when_maximized : 1;
guint iconify_initially : 1; /* gtk_window_iconify() called before realization */ guint iconify_initially : 1; /* gtk_window_iconify() called before realization */
guint is_active : 1; guint is_active : 1;
@ -324,7 +323,6 @@ enum {
PROP_APPLICATION, PROP_APPLICATION,
/* Readonly properties */ /* Readonly properties */
PROP_IS_ACTIVE, PROP_IS_ACTIVE,
PROP_HAS_TOPLEVEL_FOCUS,
/* Writeonly properties */ /* Writeonly properties */
PROP_STARTUP_ID, PROP_STARTUP_ID,
@ -954,13 +952,6 @@ gtk_window_class_init (GtkWindowClass *klass)
FALSE, FALSE,
GTK_PARAM_READABLE); 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] = window_props[PROP_TYPE_HINT] =
g_param_spec_enum ("type-hint", g_param_spec_enum ("type-hint",
P_("Type hint"), P_("Type hint"),
@ -1914,9 +1905,6 @@ gtk_window_get_property (GObject *object,
case PROP_IS_ACTIVE: case PROP_IS_ACTIVE:
g_value_set_boolean (value, priv->is_active); g_value_set_boolean (value, priv->is_active);
break; break;
case PROP_HAS_TOPLEVEL_FOCUS:
g_value_set_boolean (value, priv->has_toplevel_focus);
break;
case PROP_TYPE_HINT: case PROP_TYPE_HINT:
g_value_set_enum (value, priv->type_hint); g_value_set_enum (value, priv->type_hint);
break; break;
@ -7855,7 +7843,6 @@ gtk_window_focus_in_event (GtkWidget *widget,
*/ */
if (gtk_widget_get_visible (widget)) if (gtk_widget_get_visible (widget))
{ {
_gtk_window_set_has_toplevel_focus (window, TRUE);
_gtk_window_set_is_active (window, TRUE); _gtk_window_set_is_active (window, TRUE);
if (gtk_window_has_mnemonic_modifier_pressed (window)) if (gtk_window_has_mnemonic_modifier_pressed (window))
@ -7871,7 +7858,6 @@ gtk_window_focus_out_event (GtkWidget *widget,
{ {
GtkWindow *window = GTK_WINDOW (widget); GtkWindow *window = GTK_WINDOW (widget);
_gtk_window_set_has_toplevel_focus (window, FALSE);
_gtk_window_set_is_active (window, FALSE); _gtk_window_set_is_active (window, FALSE);
/* set the mnemonic-visible property to 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. * The return value is %TRUE if the window is active toplevel itself.
* You might use this function if you wanted to draw a widget * You might use this function if you wanted to draw a widget
* differently in an active window from a widget in an inactive window. * 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. * 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; 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: * gtk_window_get_group:
* @window: (allow-none): a #GtkWindow, or %NULL * @window: (allow-none): a #GtkWindow, or %NULL
@ -10661,7 +10626,7 @@ window_update_has_focus (GtkWindow *window)
{ {
GtkWindowPrivate *priv = window->priv; GtkWindowPrivate *priv = window->priv;
GtkWidget *widget = GTK_WIDGET (window); 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) if (has_focus != priv->has_focus)
{ {
@ -10786,35 +10751,6 @@ _gtk_window_set_is_toplevel (GtkWindow *window,
gtk_window_update_debugging (); 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: * gtk_window_set_auto_startup_notification:
* @setting: %TRUE to automatically do startup notification * @setting: %TRUE to automatically do startup notification

View File

@ -263,8 +263,6 @@ GdkScreen* gtk_window_get_screen (GtkWindow *window);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
gboolean gtk_window_is_active (GtkWindow *window); gboolean gtk_window_is_active (GtkWindow *window);
GDK_AVAILABLE_IN_ALL
gboolean gtk_window_has_toplevel_focus (GtkWindow *window);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
void gtk_window_set_decorated (GtkWindow *window, void gtk_window_set_decorated (GtkWindow *window,

View File

@ -46,8 +46,6 @@ gboolean _gtk_window_group_widget_is_blocked_for_device (GtkWindowGroup *
GtkWidget *widget, GtkWidget *widget,
GdkDevice *device); GdkDevice *device);
void _gtk_window_set_has_toplevel_focus (GtkWindow *window,
gboolean has_toplevel_focus);
void _gtk_window_unset_focus_and_default (GtkWindow *window, void _gtk_window_unset_focus_and_default (GtkWindow *window,
GtkWidget *widget); GtkWidget *widget);