summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2010-11-11 11:37:54 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2010-11-11 11:37:54 +0800
commit4b25ba7968c9409ea2901605e931ecef3e19ca67 (patch)
treef7b068166f1749515e76dcdf377a7dbc06cf2974 /src
parent4badbcd457e420cc1aa580e877e3c1fcd6e31100 (diff)
downloadunity-window-decorator-4b25ba7968c9409ea2901605e931ecef3e19ca67.tar.gz
unity-window-decorator-4b25ba7968c9409ea2901605e931ecef3e19ca67.tar.bz2
Listen for FocusIn/FocusOut on NotifyGrab NotifyUngrab and set an internal bit that plugins can query
Diffstat (limited to 'src')
-rw-r--r--src/event.cpp6
-rw-r--r--src/privatescreen.h6
-rw-r--r--src/screen.cpp7
3 files changed, 18 insertions, 1 deletions
diff --git a/src/event.cpp b/src/event.cpp
index 34e3a34..6acf04f 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -1662,6 +1662,12 @@ CompScreen::handleEvent (XEvent *event)
w->changeState (state);
}
}
+ else
+ priv->grabbed = true;
+ break;
+ case FocusOut:
+ if (event->xfocus.mode == NotifyUngrab)
+ priv->grabbed = false;
break;
case EnterNotify:
if (event->xcrossing.root == priv->root)
diff --git a/src/privatescreen.h b/src/privatescreen.h
index 0f77294..fe19cff 100644
--- a/src/privatescreen.h
+++ b/src/privatescreen.h
@@ -287,7 +287,7 @@ class PrivateScreen : public CoreOptions {
void disableEdge (int edge);
void addScreenActions ();
-
+
CompWindow *
focusTopMostWindow ();
@@ -412,6 +412,10 @@ class PrivateScreen : public CoreOptions {
std::list<Grab *> grabs;
+ bool grabbed; /* true once we recieve a GrabNotify
+ on FocusOut and false on
+ UngrabNotify from FocusIn */
+
unsigned int pendingDestroys;
CompRect workArea;
diff --git a/src/screen.cpp b/src/screen.cpp
index c0e9bee..2a5fd74 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -2792,6 +2792,12 @@ CompScreen::grabExist (const char *grab)
return false;
}
+bool
+CompScreen::grabbed ()
+{
+ return priv->grabbed;
+}
+
void
PrivateScreen::grabUngrabOneKey (unsigned int modifiers,
int keycode,
@@ -4571,6 +4577,7 @@ PrivateScreen::PrivateScreen (CompScreen *screen) :
buttonGrabs (0),
keyGrabs (0),
grabs (0),
+ grabbed (false),
pendingDestroys (0),
showingDesktopMask (0),
desktopHintData (0),