active window in xfwm4
Andre Lerche
a.lerche at gmx.net
Sat Jan 31 17:27:24 CET 2004
Hi!
Currently I try to add a few new features to the showdesktop plugin and
was facing the problem, that the wrong window was focussed after I had
unminimized some windows within the plugin and set the previous active
window to active again.
I thought that I made some mistakes in my plugin, wrote a testprog
(it's attached, compile it with...
gcc -Wall -g test.c -o xfcetest `pkg-config --libs xfce4-panel-1.0` \
`pkg-config --cflags xfce4-panel-1.0`
...) to investigate the problem but with this prog I see the same strange
things.
If one starts the test, after a short delay all unsticky windows become
minimized and after a second short delay they become unminimized again.
That's not a problem and works. The problem is, that if all windows are
unminimized again, the previous active window should be activated again.
That works, too (at least the output from the script says that), but
sometimes this active window has not the focus after the check has finished.
This is an example output:
** Message: found window / (Thumbs)
** Message: found window / (Thumbs)
** Message: found window mutt-medusa-26242-1 + (/tmp) - VIM
** Message: found window / (Thumbs)
** Message: found window andre at medusa:~/Projects/test/test
** Message: minimizing window / (Thumbs) ...
** Message: minimizing window / (Thumbs) ...
** Message: minimizing window mutt-medusa-26242-1 + (/tmp) - VIM...
** Message: minimizing window / (Thumbs) ...
** Message: minimizing window andre at medusa:~/Projects/test/test...
** Message: active window is: andre at medusa:~/Projects/test/test
** Message: unminimizing window / (Thumbs) ...
** Message: unminimizing window / (Thumbs) ...
** Message: unminimizing window mutt-medusa-26242-1 + (/tmp) - VIM...
** Message: unminimizing window / (Thumbs) ...
** Message: unminimizing window andre at medusa:~/Projects/test/test...
** Message: activate window: andre at medusa:~/Projects/test/test
** Message: active window is: andre at medusa:~/Projects/test/test
The last line says that the terminal was activated and should have the focus,
but one of the Rox windows (/ (Thumbs)) has the focus in this case. That
does not happen in all cases, only sometimes...
Any ideas or is it me or a bug somewhere? All versions are from a fresh cvs checkout.
Andre
-------------- next part --------------
#include <libxfcegui4/netk-screen.h>
#include <libxfcegui4/netk-workspace.h>
#include <libxfcegui4/netk-window.h>
#include <unistd.h>
#include <gtk/gtk.h>
int
main (int argc, char **argv)
{
GList *tmpwindows = NULL;
GList *windows = NULL;
GList *wins = NULL;
NetkWorkspace *ws;
NetkScreen *sc;
NetkWindow *win;
NetkWindow *w;
int x = 0;
gboolean minimize = TRUE;
gtk_init (&argc, &argv);
sleep (5);
sc = netk_screen_get_default ();
netk_screen_force_update (sc);
ws = netk_screen_get_active_workspace (sc);
win = netk_screen_get_active_window (sc);
tmpwindows = netk_screen_get_windows_stacked (sc);
while (tmpwindows != NULL) {
w = tmpwindows->data;
if (!netk_window_is_sticky(w) && ws == netk_window_get_workspace (w)) {
g_message ("found window %s", netk_window_get_name(w));
wins = g_list_append (wins, w);
}
tmpwindows = tmpwindows->next;
}
while (x < 2) {
windows = wins;
while (windows != NULL) {
w = windows->data;
if (minimize) {
netk_window_minimize (w);
g_message ("minimizing window %s...", netk_window_get_name (w));
} else {
netk_window_unminimize (w);
g_message ("unminimizing window %s...", netk_window_get_name (w));
}
windows = windows->next;
}
if (!minimize) {
netk_window_activate (win);
g_message ("activate window: %s", netk_window_get_name(win));
}
minimize = FALSE;
sleep (3);
g_message ("active window is: %s", netk_window_get_name(netk_screen_get_active_window (sc)));
x++;
}
return 0;
}
More information about the Xfce4-dev
mailing list