<div dir="ltr"><br><br><div class="gmail_quote">On Thu, Sep 15, 2011 at 3:04 PM, <span dir="ltr"><<a href="mailto:chris@ccburton.com">chris@ccburton.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br><tt><font size="2"><a href="mailto:freenx-knx-bounces@kde.org" target="_blank">freenx-knx-bounces@kde.org</a> wrote on 14/09/2011 13:43:32:<br>
<br>
[SNIP]</font></tt>
<br><div class="im"><tt><font size="2"> <br>
> When clicking on the window, it does get the focus - only alt-tab
<br>
> doesn't work.</font></tt>
<br><tt><font size="2">> Alt-tab is working between 2 local windows. When
current window or <br>
> previous window is nx window - the focus doesn't change and it stays<br>
> where it was before the alt-tab.</font></tt>
<br><tt><font size="2">> <br>
> And when I looked at the debug prints, I saw the user_time property
<br>
> of the nx windows is completely in another range comparing to local
windows.</font></tt>
<br>
<br></div><tt><font size="2">I don't think keynav focus uses _NET_WM_USER_TIME
</font></tt>
<br>
<br><tt><font size="2">Try it with a full NX desktop on mutter and see if
you</font></tt>
<br><tt><font size="2">can Alt-Tab OK . . .</font></tt>
<br></blockquote><div>Alt-tab calls activate_window (in /usr/share/gnome-shell/js/ui/altTab.js).</div><div>this calls shell_app_activate_window() (from gnome-shell/src/shell-app.c)</div><div>and there they check the user_time before switching to window:</div>
<div><br></div><div><div><font class="Apple-style-span" face="'courier new', monospace">void</font></div><div><font class="Apple-style-span" face="'courier new', monospace">shell_app_activate_window (ShellApp *app,</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> MetaWindow *window,</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> guint32 timestamp)</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">{</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> GSList *windows;</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br>
</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> if (shell_app_get_state (app) != SHELL_APP_STATE_RUNNING)</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> return;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> windows = shell_app_get_windows (app);</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> if (window == NULL && windows)</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> window = windows->data;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> if (!g_slist_find (windows, window))</font></div><div>
<font class="Apple-style-span" face="'courier new', monospace"> return;</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> else</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> {</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> GSList *iter;</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> ShellGlobal *global = shell_global_get ();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> MetaScreen *screen = shell_global_get_screen (global);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> MetaDisplay *display = meta_screen_get_display (screen);</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> MetaWorkspace *active = meta_screen_get_active_workspace (screen);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> MetaWorkspace *workspace = meta_window_get_workspace (window);</font></div>
<div><font class="Apple-style-span" style="background-color: rgb(255, 255, 255);" face="'courier new', monospace"><b> guint32 last_user_timestamp = meta_display_get_last_user_time (display);</b></font></div><div>
<font class="Apple-style-span" face="'courier new', monospace"> MetaWindow *most_recent_transient;</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div>
<b><font class="Apple-style-span" face="'courier new', monospace"> if (meta_display_xserver_time_is_before (display, timestamp, last_user_timestamp))</font></b></div><div><font class="Apple-style-span" face="'courier new', monospace"> {</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> meta_window_set_demands_attention (window);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> return;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> }</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> /* Now raise all the other windows for the app that are on</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> * the same workspace, in reverse order to preserve the stacking.</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> */</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> for (iter = windows; iter; iter = iter->next)</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> {</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> MetaWindow *other_window = iter->data;</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> if (other_window != window)</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> meta_window_raise (other_window);</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> }</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> /* If we have a transient that the user's interacted with more recently than</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> * the window, pick that.</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> */</font></div><div>
<font class="Apple-style-span" face="'courier new', monospace"> most_recent_transient = find_most_recent_transient_on_same_workspace (display, window);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> if (most_recent_transient</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> && meta_display_xserver_time_is_before (display,</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> meta_window_get_user_time (window),</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> meta_window_get_user_time (most_recent_transient)))</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> window = most_recent_transient;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> if (!shell_window_tracker_is_window_interesting (window))</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> {</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> /* We won't get notify::user-time signals for uninteresting windows,</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> * which means that an app's last_user_time won't get updated.</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> * Update it here instead.</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> */</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> app->running_state->last_user_time = timestamp;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> }</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> if (active != workspace)</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> meta_workspace_activate_with_focus (workspace, window, timestamp);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> else</font></div>
<div><b><font class="Apple-style-span" face="'courier new', monospace"> meta_window_activate (window, timestamp);</font></b></div><div><font class="Apple-style-span" face="'courier new', monospace"> }</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">}</font></div></div><div><br></div><div><br></div><div><br></div><div>and as you can see they do refer to the user_time there in many places.</div>
<div><br></div><div>- Amir</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br><tt><font size="2"> <br>
> - Amir<br><font class="Apple-style-span" face="arial"><br></font></font></tt></blockquote></div></div>