window-x11: Move take_focus to MetaWindowX11Private

https://gitlab.gnome.org/GNOME/mutter/merge_requests/421
This commit is contained in:
Marco Trevisan (Treviño) 2019-01-30 20:19:41 +01:00 committed by Marco Trevisan
parent 43633d6b2f
commit 6c3b0cfc36
6 changed files with 30 additions and 11 deletions

View File

@ -327,7 +327,6 @@ struct _MetaWindow
guint icon_geometry_set : 1;
/* These are the flags from WM_PROTOCOLS */
guint take_focus : 1;
guint delete_window : 1;
guint can_ping : 1;
/* Globally active / No input */
@ -699,11 +698,11 @@ gboolean meta_window_same_application (MetaWindow *window,
#define META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE(w) \
((w)->type != META_WINDOW_DOCK && (w)->type != META_WINDOW_DESKTOP)
#define META_WINDOW_IN_NORMAL_TAB_CHAIN(w) \
(((w)->input || (w)->take_focus ) && META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w) && (!(w)->skip_taskbar))
(meta_window_is_focusable (w) && META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w) && (!(w)->skip_taskbar))
#define META_WINDOW_IN_DOCK_TAB_CHAIN(w) \
(((w)->input || (w)->take_focus) && (! META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w) || (w)->skip_taskbar))
(meta_window_is_focusable (w) && (! META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w) || (w)->skip_taskbar))
#define META_WINDOW_IN_GROUP_TAB_CHAIN(w, g) \
(((w)->input || (w)->take_focus) && (!g || meta_window_get_group(w)==g))
(meta_window_is_focusable (w) && (!g || meta_window_get_group(w)==g))
void meta_window_free_delete_dialog (MetaWindow *window);

View File

@ -1079,7 +1079,6 @@ _meta_window_shared_new (MetaDisplay *display,
window->initial_timestamp_set = FALSE;
window->net_wm_user_time_set = FALSE;
window->user_time_window = None;
window->take_focus = FALSE;
window->delete_window = FALSE;
window->can_ping = FALSE;
window->input = TRUE;
@ -4689,8 +4688,8 @@ meta_window_focus (MetaWindow *window,
window->restore_focus_on_map = FALSE;
meta_topic (META_DEBUG_FOCUS,
"Setting input focus to window %s, input: %d take_focus: %d\n",
window->desc, window->input, window->take_focus);
"Setting input focus to window %s, input: %d focusable: %d\n",
window->desc, window->input, meta_window_is_focusable (window));
if (window->display->grab_window &&
window->display->grab_window != window &&

View File

@ -1531,9 +1531,9 @@ reload_wm_protocols (MetaWindow *window,
{
int i;
window->take_focus = FALSE;
window->delete_window = FALSE;
window->can_ping = FALSE;
meta_window_x11_set_wm_take_focus (window, FALSE);
if (value->type == META_PROP_VALUE_INVALID)
return;
@ -1543,7 +1543,7 @@ reload_wm_protocols (MetaWindow *window,
{
if (value->v.atom_list.atoms[i] ==
window->display->x11_display->atom_WM_TAKE_FOCUS)
window->take_focus = TRUE;
meta_window_x11_set_wm_take_focus (window, TRUE);
else if (value->v.atom_list.atoms[i] ==
window->display->x11_display->atom_WM_DELETE_WINDOW)
window->delete_window = TRUE;

View File

@ -47,6 +47,7 @@ struct _MetaWindowX11Private
/* TRUE if the client forced these on */
guint wm_state_skip_taskbar : 1;
guint wm_state_skip_pager : 1;
guint wm_take_focus : 1;
/* Weird "_NET_WM_STATE_MODAL" flag */
guint wm_state_modal : 1;

View File

@ -745,6 +745,9 @@ static void
meta_window_x11_focus (MetaWindow *window,
guint32 timestamp)
{
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv =
meta_window_x11_get_instance_private (window_x11);
/* For output-only or shaded windows, focus the frame.
* This seems to result in the client window getting key events
* though, so I don't know if it's icccm-compliant.
@ -774,7 +777,7 @@ meta_window_x11_focus (MetaWindow *window,
timestamp);
}
if (window->take_focus)
if (priv->wm_take_focus)
{
meta_topic (META_DEBUG_FOCUS,
"Sending WM_TAKE_FOCUS to %s since take_focus = true\n",
@ -1628,10 +1631,25 @@ meta_window_x11_shortcuts_inhibited (MetaWindow *window,
return FALSE;
}
void
meta_window_x11_set_wm_take_focus (MetaWindow *window,
gboolean take_focus)
{
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv =
meta_window_x11_get_instance_private (window_x11);
priv->wm_take_focus = take_focus;
}
static gboolean
meta_window_x11_is_focusable (MetaWindow *window)
{
return window->input || window->take_focus;
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv =
meta_window_x11_get_instance_private (window_x11);
return window->input || priv->wm_take_focus;
}
static gboolean

View File

@ -51,6 +51,8 @@ MetaWindow * meta_window_x11_new (MetaDisplay *display,
void meta_window_x11_set_net_wm_state (MetaWindow *window);
void meta_window_x11_set_wm_state (MetaWindow *window);
void meta_window_x11_set_wm_take_focus (MetaWindow *window,
gboolean take_focus);
void meta_window_x11_set_allowed_actions_hint (MetaWindow *window);
void meta_window_x11_create_sync_request_alarm (MetaWindow *window);