clicktofocus.c revision 645f5050
1#include "clicktofocus.h"
2
3#include "twm.h"
4#include "util.h"
5#include "screen.h"
6
7TwmWindow * get_last_window(WorkSpace *current)
8{
9    TwmWindow		*t;
10    TwmWindow  *first = NULL;
11
12    if (! current) return NULL;
13
14    for (t = Scr->FirstWindow; t != NULL; t = t->next) {
15      if (!first && !t->iconmgr && OCCUPY (t, current) && t->mapped)
16	first = t;
17      if (t->hasfocusvisible && OCCUPY (t, current))
18	return t;
19    }
20
21    return first;
22}
23
24void set_last_window(WorkSpace *current)
25{
26  TwmWindow * t;
27
28  t = get_last_window(current);
29
30  SetFocus(t, CurrentTime);
31}
32