10bbfda8aSnia#include "ctwm.h" 2645f5050Syouri#include "screen.h" 30bbfda8aSnia#include "clicktofocus.h" 40bbfda8aSnia#include "win_ops.h" 5645f5050Syouri 60bbfda8aSniastatic TwmWindow *get_last_window(WorkSpace *current) 7645f5050Syouri{ 80bbfda8aSnia TwmWindow *t; 90bbfda8aSnia TwmWindow *first = NULL; 100bbfda8aSnia 110bbfda8aSnia if(! current) { 120bbfda8aSnia return NULL; 130bbfda8aSnia } 140bbfda8aSnia 150bbfda8aSnia for(t = Scr->FirstWindow; t != NULL; t = t->next) { 160bbfda8aSnia if(!first && !t->isiconmgr && OCCUPY(t, current) && t->mapped) { 170bbfda8aSnia first = t; 180bbfda8aSnia } 190bbfda8aSnia if(t->hasfocusvisible && OCCUPY(t, current)) { 200bbfda8aSnia return t; 210bbfda8aSnia } 220bbfda8aSnia } 230bbfda8aSnia 240bbfda8aSnia return first; 25645f5050Syouri} 26645f5050Syouri 27645f5050Syourivoid set_last_window(WorkSpace *current) 28645f5050Syouri{ 290bbfda8aSnia TwmWindow *t; 30645f5050Syouri 310bbfda8aSnia t = get_last_window(current); 32645f5050Syouri 330bbfda8aSnia SetFocus(t, CurrentTime); 34645f5050Syouri} 35