diff options
Diffstat (limited to 'src/wall.cpp')
-rw-r--r-- | src/wall.cpp | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/src/wall.cpp b/src/wall.cpp index 7300f99..fb2f66c 100644 --- a/src/wall.cpp +++ b/src/wall.cpp @@ -518,6 +518,13 @@ WallScreen::handleEvent (XEvent *event) else if (event->xfocus.mode == NotifyUngrab) poller.stop (); break; + + case ConfigureNotify: + + if (event->xconfigure.window == screen->root ()) + updateScreenEdgeRegions (); + + break; } screen->handleEvent (event); @@ -526,20 +533,15 @@ WallScreen::handleEvent (XEvent *event) /* * Borrowed this from PrivateScreen::updateScreenEdges * - * FIXME: This is really expensive - * */ #define SCREEN_EDGE_NUM 8 void -WallScreen::positionUpdate (const CompPoint &pos) +WallScreen::updateScreenEdgeRegions () { - CompRegion noEdgeRegion (0, 0, screen->width (), screen->height ()); - CompRegion allEdgeRegion (0, 0, screen->width (), screen->height ()); - - if (edgeDrag) - return; + edgeRegion = CompRegion (0, 0, screen->width (), screen->height ()); + noEdgeRegion = CompRegion (0, 0, screen->width (), screen->height ()); struct screenEdgeGeometry { int xw, x0; @@ -559,21 +561,30 @@ WallScreen::positionUpdate (const CompPoint &pos) for (unsigned int i = 0; i < SCREEN_EDGE_NUM; i++) { - CompRegion edgeRegion (geometry[i].xw * screen->width () + - geometry[i].x0, - geometry[i].yh * screen->height () + - geometry[i].y0, - geometry[i].ww * screen->width () + - geometry[i].w0, - geometry[i].hh * screen->height () + - geometry[i].h0); + CompRegion edge (geometry[i].xw * screen->width () + + geometry[i].x0, + geometry[i].yh * screen->height () + + geometry[i].y0, + geometry[i].ww * screen->width () + + geometry[i].w0, + geometry[i].hh * screen->height () + + geometry[i].h0); noEdgeRegion -= edgeRegion; } - allEdgeRegion -= noEdgeRegion; + edgeRegion -= noEdgeRegion; +} - if (allEdgeRegion.contains (pos)) +#undef SCREEN_EDGE_NUM + +void +WallScreen::positionUpdate (const CompPoint &pos) +{ + if (edgeDrag) + return; + + if (edgeRegion.contains (pos)) toggleEdges (false); else if (noEdgeRegion.contains (pos)) { @@ -583,8 +594,6 @@ WallScreen::positionUpdate (const CompPoint &pos) } } -#undef SCREEN_EDGE_NUM - void WallWindow::activate () { @@ -1695,6 +1704,8 @@ WallScreen::WallScreen (CompScreen *screen) : setNotify (NoSlideMatch); setNotify (EdgeflipPointer); + updateScreenEdgeRegions (); + poller.setCallback (boost::bind (&WallScreen::positionUpdate, this, _1)); } |