window: add _NET_WM_STATE_FOCUSED hint to _NET_WM_STATE

This hint reflects whether a window appears focused.

https://bugzilla.gnome.org/show_bug.cgi?id=661427
This commit is contained in:
Rui Matos 2011-10-26 19:00:18 +01:00
parent 4fb2fab7f7
commit 6e47f0e846
2 changed files with 22 additions and 14 deletions

View File

@ -1897,7 +1897,7 @@ static void
set_net_wm_state (MetaWindow *window)
{
int i;
unsigned long data[12];
unsigned long data[13];
i = 0;
if (window->shaded)
@ -1960,6 +1960,11 @@ set_net_wm_state (MetaWindow *window)
data[i] = window->display->atom__NET_WM_STATE_STICKY;
++i;
}
if (meta_window_appears_focused (window))
{
data[i] = window->display->atom__NET_WM_STATE_FOCUSED;
++i;
}
meta_verbose ("Setting _NET_WM_STATE with %d atoms\n", i);
@ -6629,6 +6634,17 @@ meta_window_client_message (MetaWindow *window,
return FALSE;
}
static void
meta_window_appears_focused_changed (MetaWindow *window)
{
set_net_wm_state (window);
g_object_notify (G_OBJECT (window), "appears-focused");
if (window->frame)
meta_frame_queue_draw (window->frame);
}
/**
* meta_window_propagate_focus_appearance:
* @window: the window to start propagating from
@ -6674,9 +6690,7 @@ meta_window_propagate_focus_appearance (MetaWindow *window,
if (child_focus_state_changed && !parent->has_focus &&
parent != window->display->expected_focus_window)
{
g_object_notify (G_OBJECT (parent), "appears-focused");
if (parent->frame)
meta_frame_queue_draw (parent->frame);
meta_window_appears_focused_changed (parent);
}
child = parent;
@ -6830,11 +6844,8 @@ meta_window_notify_focus (MetaWindow *window,
g_object_notify (G_OBJECT (window->display), "focus-window");
if (!window->attached_focus_window)
{
g_object_notify (G_OBJECT (window), "appears-focused");
if (window->frame)
meta_frame_queue_draw (window->frame);
}
meta_window_appears_focused_changed (window);
meta_window_propagate_focus_appearance (window, TRUE);
}
}
@ -6867,11 +6878,7 @@ meta_window_notify_focus (MetaWindow *window,
window->has_focus = FALSE;
if (!window->attached_focus_window)
{
g_object_notify (G_OBJECT (window), "appears-focused");
if (window->frame)
meta_frame_queue_draw (window->frame);
}
meta_window_appears_focused_changed (window);
meta_error_trap_push (window->display);
XUninstallColormap (window->display->xdisplay,

View File

@ -164,6 +164,7 @@ item(_NET_WM_ACTION_ABOVE)
item(_NET_WM_ACTION_BELOW)
item(_NET_WM_STATE_STICKY)
item(_NET_WM_FULLSCREEN_MONITORS)
item(_NET_WM_STATE_FOCUSED)
#if 0
/* We apparently never use: */