summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/trailfocus2.c
diff options
context:
space:
mode:
authormaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-18 13:40:00 +0000
committermaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-18 13:40:00 +0000
commitee478ed718c644c23f56c6ce359120abda787aa6 (patch)
tree884980cee3f5aca11d0e2fbaf5ddafc8c658e90a /beryl-plugins/src/trailfocus2.c
parent4bdc44fdd31333fc2b85b20eb1c125745664a699 (diff)
downloadmarex-dev-ee478ed718c644c23f56c6ce359120abda787aa6.tar.gz
marex-dev-ee478ed718c644c23f56c6ce359120abda787aa6.tar.bz2
trailfocus plugin: fix focus events getting lost if they occured while a screen grab was active
git-svn-id: file:///beryl/trunk@2835 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/trailfocus2.c')
-rw-r--r--beryl-plugins/src/trailfocus2.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/beryl-plugins/src/trailfocus2.c b/beryl-plugins/src/trailfocus2.c
index e0d0503..89c3ee1 100644
--- a/beryl-plugins/src/trailfocus2.c
+++ b/beryl-plugins/src/trailfocus2.c
@@ -90,7 +90,9 @@ typedef struct _TrailfocusScreen
Window *win;
int win_max;
TfAttrib *inc;
+ Bool needStackUpdate;
CompOption opt[SOPT_NUM];
+ PreparePaintScreenProc preparePaintScreen;
} TrailfocusScreen;
/* Core trailfocus functions. These do the real work. ---------------*/
@@ -293,8 +295,16 @@ static void trailfocusHandleEvent(CompDisplay * d, XEvent * event)
{
case FocusIn:
s = push_window(d, event->xfocus.window);
- if (s && !otherScreenGrabExist(s,0))
- set_windows(s);
+ if (s)
+ {
+ if (otherScreenGrabExist(s,0))
+ {
+ TRAILFOCUS_SCREEN(s);
+ ts->needStackUpdate = TRUE;
+ }
+ else
+ set_windows(s);
+ }
break;
default:
break;
@@ -347,6 +357,24 @@ static void recalculate_attributes(TrailfocusScreen * ts)
// ts->inc[i+start] = min;
}
+/* check if we need to do a set_windows because the last one was blocked
+ by a screen grab
+ */
+static void trailfocusPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
+{
+ TRAILFOCUS_SCREEN(s);
+
+ UNWRAP(ts, s, preparePaintScreen);
+ (*s->preparePaintScreen) (s, msSinceLastPaint);
+ WRAP(ts, s, preparePaintScreen, trailfocusPreparePaintScreen);
+
+ if (ts->needStackUpdate && !otherScreenGrabExist(s, 0))
+ {
+ set_windows(s);
+ ts->needStackUpdate = FALSE;
+ }
+}
+
/* Unlike the traditional setScreenOptions, we return on failure in the
* switch, so we can execute a couple of common functions at the end.
*/
@@ -404,6 +432,9 @@ static void trailfocusFiniScreen(CompPlugin * p, CompScreen * s)
{
TRAILFOCUS_SCREEN(s);
bail_out_tf(s);
+
+ UNWRAP(ts, s, preparePaintScreen);
+
if (ts->win)
free(ts->win);
if (ts->inc)
@@ -593,9 +624,13 @@ static Bool trailfocusInitScreen(CompPlugin * p, CompScreen * s)
(TrailfocusScreen *) calloc(1, sizeof(TrailfocusScreen));
s->privates[td->screenPrivateIndex].ptr = ts;
trailfocusScreenInitOptions(ts);
+
+ WRAP(ts, s, preparePaintScreen, trailfocusPreparePaintScreen);
+
ts->wMask =
compWindowTypeMaskFromStringList(&ts->opt[SOPT_WINDOW_TYPE].
value);
+ ts->needStackUpdate = FALSE;
recalculate_attributes(ts);
push_window(s->display, s->display->activeWindow);
set_windows(s);