summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2010-10-29 14:43:53 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-10-29 14:43:53 +0800
commit9201fd68d8e6e75ecb3eee170f070ea939606c03 (patch)
treeb533f251e7f06cae6cec2f7580b4bc7bafd267a8
parentb38bc3147c86db694c8c922d148d8dfd9c049584 (diff)
downloadstaticswitcher-9201fd68d8e6e75ecb3eee170f070ea939606c03.tar.gz
staticswitcher-9201fd68d8e6e75ecb3eee170f070ea939606c03.tar.bz2
Create the popup window just before we need to show it in order to not
confuse the decorators
-rw-r--r--src/staticswitcher.cpp116
-rw-r--r--src/staticswitcher.h3
2 files changed, 65 insertions, 54 deletions
diff --git a/src/staticswitcher.cpp b/src/staticswitcher.cpp
index 182cf4d..f7358d3 100644
--- a/src/staticswitcher.cpp
+++ b/src/staticswitcher.cpp
@@ -226,57 +226,10 @@ StaticSwitchScreen::handleSelectionChange (bool toNext, int nextIdx)
moreAdjust = true;
}
-bool
-StaticSwitchScreen::showPopup ()
-{
- CompWindow *w = ::screen->findWindow (popupWindow);
- if (w && (w->state () & CompWindowStateHiddenMask))
- w->show ();
- else
- XMapWindow (::screen->dpy (), popupWindow);
-
- cScreen->damageScreen ();
-
- popupDelayTimer.stop ();
-
- return false;
-}
-
-Cursor
-StaticSwitchScreen::getCursor (bool mouseSelectOn)
-{
- if (mouseSelectOn)
- return ::screen->normalCursor ();
-
- return ::screen->invisibleCursor ();
-}
-
void
-StaticSwitchScreen::initiate (SwitchWindowSelection selection,
- bool shouldShowPopup)
+StaticSwitchScreen::createPopup ()
{
- bool noSwitchWindows;
- bool newMouseSelect;
-
- if (::screen->otherGrabExist ("switcher", "scale", "cube", 0))
- return;
-
- this->selection = selection;
- selectedWindow = NULL;
-
- noSwitchWindows = true;
- foreach (CompWindow *w, ::screen->windows ())
- {
- if (StaticSwitchWindow::get (w)->isSwitchWin ())
- {
- noSwitchWindows = false;
- break;
- }
- }
- if (noSwitchWindows)
- return;
-
- if (!popupWindow && shouldShowPopup)
+ if (!popupWindow)
{
Display *dpy = ::screen->dpy ();
XWMHints xwmh;
@@ -329,7 +282,65 @@ StaticSwitchScreen::initiate (SwitchWindowSelection selection,
::screen->setWindowProp (popupWindow, Atoms::winDesktop, 0xffffffff);
setSelectedWindowHint ();
+
+ updatePopupWindow ();
+ }
+}
+
+bool
+StaticSwitchScreen::showPopup ()
+{
+ CompWindow *w;
+
+ /* Always checks for an existing popup */
+ createPopup ();
+
+ w = ::screen->findWindow (popupWindow);
+ if (w && (w->state () & CompWindowStateHiddenMask))
+ w->show ();
+ else
+ XMapWindow (::screen->dpy (), popupWindow);
+
+ cScreen->damageScreen ();
+
+ popupDelayTimer.stop ();
+
+ return false;
+}
+
+Cursor
+StaticSwitchScreen::getCursor (bool mouseSelectOn)
+{
+ if (mouseSelectOn)
+ return ::screen->normalCursor ();
+
+ return ::screen->invisibleCursor ();
+}
+
+void
+StaticSwitchScreen::initiate (SwitchWindowSelection selection,
+ bool shouldShowPopup)
+{
+ bool noSwitchWindows;
+ bool newMouseSelect;
+
+ if (::screen->otherGrabExist ("switcher", "scale", "cube", 0))
+ return;
+
+ this->selection = selection;
+ selectedWindow = NULL;
+
+ noSwitchWindows = true;
+ foreach (CompWindow *w, ::screen->windows ())
+ {
+ if (StaticSwitchWindow::get (w)->isSwitchWin ())
+ {
+ noSwitchWindows = false;
+ break;
+ }
}
+ if (noSwitchWindows)
+ return;
newMouseSelect = optionGetMouseSelect () &&
selection != Panels && shouldShowPopup;
@@ -349,7 +360,7 @@ StaticSwitchScreen::initiate (SwitchWindowSelection selection,
createWindowList ();
- if (popupWindow && shouldShowPopup)
+ if (shouldShowPopup)
{
unsigned int delay;
@@ -448,11 +459,11 @@ switchTerminate (CompAction *action,
::screen->handleEventSetEnabled (ss, false);
ss->selectedWindow = NULL;
-
+
if (screen->activeWindow () != ss->lastActiveWindow)
{
CompWindow *w = screen->findWindow (ss->lastActiveWindow);
-
+
if (w)
w->moveInputFocusTo ();
}
@@ -1152,7 +1163,6 @@ StaticSwitchWindow::glPaint (const GLWindowPaintAttrib &attrib,
float px, py, pos;
int count = sScreen->windows.size ();
-
CompWindow::Geometry &g = window->geometry ();
if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK ||
diff --git a/src/staticswitcher.h b/src/staticswitcher.h
index de0344c..df3f182 100644
--- a/src/staticswitcher.h
+++ b/src/staticswitcher.h
@@ -64,6 +64,7 @@ class StaticSwitchScreen :
int *opacity);
void doWindowDamage (CompWindow *w);
void handleSelectionChange (bool toNext, int nextIdx);
+ void createPopup ();
bool showPopup ();
Cursor getCursor (bool mouseSelectOn);
void initiate (SwitchWindowSelection selection,
@@ -89,7 +90,7 @@ class StaticSwitchScreen :
void getMinimizedAndMatch (bool &minimizedOption,
CompMatch *&match);
bool getMipmap ();
-
+
Window lastActiveWindow;
CompTimer popupDelayTimer;