diff options
author | kristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3> | 2007-02-07 14:29:38 +0000 |
---|---|---|
committer | kristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3> | 2007-02-07 14:29:38 +0000 |
commit | 819f8bbc2b69059b65dcc0607b080a75291220ad (patch) | |
tree | 5127f2305e8850d3c2741ef31a87eddafd505b3b | |
parent | 77eaf0af54c49f338daa4f57d55d8e0524021321 (diff) | |
download | marex-dev-819f8bbc2b69059b65dcc0607b080a75291220ad.tar.gz marex-dev-819f8bbc2b69059b65dcc0607b080a75291220ad.tar.bz2 |
core+plugins: Modify focusDefaultWindow() to take a screen argument.
Properly maintains focus on the same screen when rotating or closing
a window.
git-svn-id: file:///beryl/trunk@3768 d7aaf104-2d23-0410-ae22-9d23157bf5a3
-rw-r--r-- | beryl-core/include/beryl.h | 4 | ||||
-rw-r--r-- | beryl-core/src/display.c | 55 | ||||
-rw-r--r-- | beryl-core/src/event.c | 6 | ||||
-rw-r--r-- | beryl-plugins/src/put.c | 2 | ||||
-rw-r--r-- | beryl-plugins/src/rotate.c | 2 |
5 files changed, 36 insertions, 33 deletions
diff --git a/beryl-core/include/beryl.h b/beryl-core/include/beryl.h index e0229db..077ae02 100644 --- a/beryl-core/include/beryl.h +++ b/beryl-core/include/beryl.h @@ -26,7 +26,7 @@ #ifndef _BERYL_H #define _BERYL_H -#define BERYL_VERSION 51 +#define BERYL_VERSION 52 #define BERYL_ABI_INFO \ BERYL_VERSION, \ @@ -926,7 +926,7 @@ Time getCurrentTimeFromDisplay (CompDisplay *d); void -focusDefaultWindow (CompDisplay *d); +focusDefaultWindow (CompScreen *s); void forEachWindowOnDisplay (CompDisplay *display, diff --git a/beryl-core/src/display.c b/beryl-core/src/display.c index 63c1ae5..193d8b2 100644 --- a/beryl-core/src/display.c +++ b/beryl-core/src/display.c @@ -2948,7 +2948,7 @@ Bool addDisplay(char *name, int screenNum, char **plugin, int nPlugin) if (focus == None || focus == PointerRoot) { - focusDefaultWindow(d); + focusDefaultWindow(d->screens); } else { @@ -2960,7 +2960,7 @@ Bool addDisplay(char *name, int screenNum, char **plugin, int nPlugin) moveInputFocusToWindow(w); } else - focusDefaultWindow(d); + focusDefaultWindow(d->screens); } d->pingHandle = compAddTimeout(PING_DELAY, pingTimeout, d); @@ -3019,39 +3019,42 @@ Time getCurrentTimeFromDisplay(CompDisplay * d) return event.xproperty.time; } -void focusDefaultWindow(CompDisplay * d) +/* Focuses a default window on the screen, typically the last one + * with focus. Used on viewport switch. + * FIXME: Possibly focus a window on a diffrent screen if this screen + * has no windows that can receive focus. + * Also, this might belong in screen.c + */ +void focusDefaultWindow(CompScreen * s) { - CompScreen *s; + CompDisplay *d = s->display; CompWindow *w; CompWindow *focus = NULL; - for (s = d->screens; s; s = s->next) + for (w = s->reverseWindows; w; w = w->prev) { - for (w = s->reverseWindows; w; w = w->prev) - { - if ((w->type & CompWindowTypeDockMask) || - (w->state & CompWindowStateNoFocusMask)) - continue; + if ((w->type & CompWindowTypeDockMask) || + (w->state & CompWindowStateNoFocusMask)) + continue; - if ((*s->focusWindow) (w)) + if ((*s->focusWindow) (w)) + { + if (focus) { - if (focus) + if (w-> + type & + (CompWindowTypeNormalMask | + CompWindowTypeDialogMask | + CompWindowTypeModalDialogMask)) { - if (w-> - type & - (CompWindowTypeNormalMask | - CompWindowTypeDialogMask | - CompWindowTypeModalDialogMask)) - { - if (w->activeNum > - focus->activeNum - && !w->state & CompWindowStateStickyMask) - focus = w; - } + if (w->activeNum > + focus->activeNum + && !w->state & CompWindowStateStickyMask) + focus = w; } - else - focus = w; } + else + focus = w; } } @@ -3062,7 +3065,7 @@ void focusDefaultWindow(CompDisplay * d) } else { - XSetInputFocus(d->display, d->screens->root, + XSetInputFocus(d->display, s->root, RevertToPointerRoot, CurrentTime); } } diff --git a/beryl-core/src/event.c b/beryl-core/src/event.c index b4844fa..cf28984 100644 --- a/beryl-core/src/event.c +++ b/beryl-core/src/event.c @@ -152,7 +152,7 @@ static void moveInputFocusToOtherWindow(CompWindow * w) moveInputFocusToWindow(ancestor); } else - focusDefaultWindow(display); + focusDefaultWindow(w->screen); } else if (w->type & (CompWindowTypeDialogMask | CompWindowTypeModalDialogMask)) @@ -192,10 +192,10 @@ static void moveInputFocusToOtherWindow(CompWindow * w) moveInputFocusToWindow(focus); } else - focusDefaultWindow(display); + focusDefaultWindow(w->screen); } else - focusDefaultWindow(display); + focusDefaultWindow(w->screen); } } diff --git a/beryl-plugins/src/put.c b/beryl-plugins/src/put.c index 57cc94b..d86f441 100644 --- a/beryl-plugins/src/put.c +++ b/beryl-plugins/src/put.c @@ -549,7 +549,7 @@ static void putPreparePaintScreen(CompScreen * s, int msSinceLastPaint) { /* unfocus moved window if enabled */ if (ps->unfocusWindow) - focusDefaultWindow(s->display); + focusDefaultWindow(s); break; } } diff --git a/beryl-plugins/src/rotate.c b/beryl-plugins/src/rotate.c index e523960..0bb7b33 100644 --- a/beryl-plugins/src/rotate.c +++ b/beryl-plugins/src/rotate.c @@ -791,7 +791,7 @@ static void rotatePreparePaintScreen(CompScreen * s, int msSinceLastPaint) } } else - focusDefaultWindow(s->display); + focusDefaultWindow(s); rs->moveWindow = 0; } |