summaryrefslogtreecommitdiff
path: root/lazypointer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lazypointer.cpp')
-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)