summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2010-11-12 19:47:48 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2010-11-12 19:47:48 +0800
commit1e79952a8d573e211ca194712f7f52fa3df89fb9 (patch)
tree43aab4ed139c4504f6aecfd205d90e27df258bb1 /src
parent70e344e57c37d9e20b77e89dc013e411c24c3f50 (diff)
parent868eeabb474b29776077d4cfdc8608469ae1ce09 (diff)
downloadcompiz-with-glib-mainloop-1e79952a8d573e211ca194712f7f52fa3df89fb9.tar.gz
compiz-with-glib-mainloop-1e79952a8d573e211ca194712f7f52fa3df89fb9.tar.bz2
Merge branch 'master' of git://git.compiz.org/compiz/core
Diffstat (limited to 'src')
-rw-r--r--src/event.cpp6
-rw-r--r--src/option.cpp50
-rw-r--r--src/privatescreen.h6
-rw-r--r--src/screen.cpp7
4 files changed, 44 insertions, 25 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/option.cpp b/src/option.cpp
index 78fdc0f..36ad066 100644
--- a/src/option.cpp
+++ b/src/option.cpp
@@ -406,12 +406,38 @@ CompOption::Value::operator!= (const CompOption::Value &val)
return !(*this == val);
}
+static void
+finiOptionValue (CompOption::Value &v,
+ CompOption::Type type)
+{
+ switch (type) {
+ case CompOption::TypeAction:
+ case CompOption::TypeKey:
+ case CompOption::TypeButton:
+ case CompOption::TypeEdge:
+ case CompOption::TypeBell:
+ if (v.action ().state () & CompAction::StateAutoGrab && screen)
+ screen->removeAction (&v.action ());
+ break;
+
+ case CompOption::TypeList:
+ foreach (CompOption::Value &val, v.list ())
+ finiOptionValue (val, v.listType ());
+ break;
+
+ default:
+ break;
+ }
+}
+
CompOption::Value &
CompOption::Value::operator= (const CompOption::Value &val)
{
if (this == &val)
return *this;
+ finiOptionValue (*this, priv->type);
+
delete priv;
priv = new PrivateValue (*val.priv);
@@ -661,30 +687,6 @@ finiScreenOptionValue (CompScreen *s,
}
}
-static void
-finiOptionValue (CompOption::Value &v,
- CompOption::Type type)
-{
- switch (type) {
- case CompOption::TypeAction:
- case CompOption::TypeKey:
- case CompOption::TypeButton:
- case CompOption::TypeEdge:
- case CompOption::TypeBell:
- if (v.action ().state () & CompAction::StateAutoGrab && screen)
- screen->removeAction (&v.action ());
- break;
-
- case CompOption::TypeList:
- foreach (CompOption::Value &val, v.list ())
- finiOptionValue (val, v.listType ());
- break;
-
- default:
- break;
- }
-}
-
CompOption::~CompOption ()
{
finiOptionValue (priv->value, priv->type);
diff --git a/src/privatescreen.h b/src/privatescreen.h
index db2ca91..79b5442 100644
--- a/src/privatescreen.h
+++ b/src/privatescreen.h
@@ -296,7 +296,7 @@ class PrivateScreen : public CoreOptions {
void disableEdge (int edge);
void addScreenActions ();
-
+
CompWindow *
focusTopMostWindow ();
@@ -423,6 +423,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 937e31b..2b987d5 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -2830,6 +2830,12 @@ CompScreen::grabExist (const char *grab)
return false;
}
+bool
+CompScreen::grabbed ()
+{
+ return priv->grabbed;
+}
+
void
PrivateScreen::grabUngrabOneKey (unsigned int modifiers,
int keycode,
@@ -4609,6 +4615,7 @@ PrivateScreen::PrivateScreen (CompScreen *screen) :
buttonGrabs (0),
keyGrabs (0),
grabs (0),
+ grabbed (false),
pendingDestroys (0),
showingDesktopMask (0),
desktopHintData (0),