summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <Sam@XPS-SUSE.site>2009-01-12 23:05:16 +0900
committerSam Spilsbury <Sam@XPS-SUSE.site>2009-01-12 23:05:16 +0900
commit3c62e25d9280d735b22b58a976d88689fbb08795 (patch)
treead0f32583b5a5845499ca9b8b6f0d294637142b5
parente0af19a79e7d2196cd4ccdf80484ac7183137156 (diff)
downloadlazypointer-3c62e25d9280d735b22b58a976d88689fbb08795.tar.gz
lazypointer-3c62e25d9280d735b22b58a976d88689fbb08795.tar.bz2
Implement a missing focus function. Damn c++ is a pain to debug :/
-rw-r--r--lazypointer.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/lazypointer.cpp b/lazypointer.cpp
index 0439fc1..90d2719 100644
--- a/lazypointer.cpp
+++ b/lazypointer.cpp
@@ -148,6 +148,37 @@ LPWindow::activate ()
}
bool
+LPWindow::focus ()
+{
+ LP_SCREEN (screen);
+
+ int cX = (window->x () - window->input ().left) + ((window->width () + window->input ().right + window->input ().left) / 2);
+ int cY = (window->y () - window->input ().top) + ((window->height () + window->input ().top + window->input ().bottom) / 2);
+ Window root, child;
+ int rx, ry, winx, winy;
+ unsigned int mask;
+ Bool ret;
+
+ ret = XQueryPointer(screen->dpy (), screen->root (),
+ &root, &child,
+ &rx, &ry, &winx, &winy, &mask);
+
+ if (ret && ls->optionGetCentreOnActivate ())
+ {
+ ls->initialX = rx;
+ ls->initialY = ry;
+
+ ls->destX = cX;
+ ls->destY = cY;
+ ls->needsWarp = TRUE;
+ ls->cScreen->damageScreen ();
+ }
+
+ ret = window->focus ();
+ return ret;
+}
+
+bool
LPScreen::winInitiate (CompAction *action,
CompAction::State state,
CompOption::Vector &options)