summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErkin Bahceci <erkinbah@gmail.com>2009-07-08 09:53:23 -0500
committerErkin Bahceci <erkinbah@gmail.com>2009-07-08 09:53:23 -0500
commit179f94a43e2316a3d69baf5768893505f8830027 (patch)
treeaeed3c31a2e94145c5cb2830ccbdc179d62fe790 /src
parent700b18bffb6924b484464093d999349c010c4595 (diff)
downloadzcomp-179f94a43e2316a3d69baf5768893505f8830027.tar.gz
zcomp-179f94a43e2316a3d69baf5768893505f8830027.tar.bz2
Move hide/show to PrivateWindow, add wrapper hide/show.
The new hide/show are used by switcher, so that it doesn't call minimize/unminimize.
Diffstat (limited to 'src')
-rw-r--r--src/privatewindow.h4
-rw-r--r--src/screen.cpp10
-rw-r--r--src/window.cpp117
3 files changed, 74 insertions, 57 deletions
diff --git a/src/privatewindow.h b/src/privatewindow.h
index 1f2c600..92f8b0f 100644
--- a/src/privatewindow.h
+++ b/src/privatewindow.h
@@ -133,6 +133,10 @@ class PrivateWindow {
bool reparent ();
void unreparent ();
+ void hide ();
+
+ void show ();
+
bool handlePingTimeout (unsigned int lastPing);
void handlePing (int lastPing);
diff --git a/src/screen.cpp b/src/screen.cpp
index 05945ff..4f4a5de 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -2249,7 +2249,7 @@ CompScreen::enterShowDesktopMode ()
w->managed () && w->focus ())
{
w->setShowDesktopMode (true);
- w->hide ();
+ w->priv->hide ();
}
}
@@ -2282,7 +2282,7 @@ CompScreen::leaveShowDesktopMode (CompWindow *window)
return;
window->setShowDesktopMode (false);
- window->show ();
+ window->priv->show ();
/* return if some other window is still in show desktop mode */
foreach (CompWindow *w, priv->windows)
@@ -2301,7 +2301,7 @@ CompScreen::leaveShowDesktopMode (CompWindow *window)
continue;
w->setShowDesktopMode (false);
- w->show ();
+ w->priv->show ();
}
/* focus default window - most likely this will be the window
@@ -3487,9 +3487,9 @@ PrivateScreen::setCurrentDesktop (unsigned int desktop)
continue;
if (w->desktop () == desktop)
- w->show ();
+ w->priv->show ();
else
- w->hide ();
+ w->priv->hide ();
}
data = desktop;
diff --git a/src/window.cpp b/src/window.cpp
index 4a4cbbd..467bc2f 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -3075,13 +3075,13 @@ CompWindow::updateAttributes (CompStackingUpdateMode stackingMode)
{
windowNotify (CompWindowNotifyShade);
- hide ();
+ priv->hide ();
}
else if (priv->shaded)
{
windowNotify (CompWindowNotifyUnshade);
- show ();
+ priv->show ();
}
if (stackingMode != CompStackingUpdateModeNone)
@@ -3229,7 +3229,7 @@ CompWindow::activate ()
{
priv->state &= ~CompWindowStateShadedMask;
if (priv->shaded)
- show ();
+ priv->show ();
}
if (priv->state & CompWindowStateHiddenMask)
@@ -3401,17 +3401,31 @@ CompWindow::constrainNewWindowSize (int width,
void
CompWindow::hide ()
{
- bool onDesktop = onCurrentDesktop ();
+ priv->hidden = true;
+ priv->hide ();
+}
- if (!priv->managed)
+void
+CompWindow::show ()
+{
+ priv->hidden = false;
+ priv->show ();
+}
+
+void
+PrivateWindow::hide ()
+{
+ bool onDesktop = window->onCurrentDesktop ();
+
+ if (!managed)
return;
- if (!priv->minimized && !priv->inShowDesktopMode &&
- !priv->hidden && onDesktop)
+ if (!minimized && !inShowDesktopMode &&
+ !hidden && onDesktop)
{
- if (priv->state & CompWindowStateShadedMask)
+ if (state & CompWindowStateShadedMask)
{
- priv->shaded = true;
+ shaded = true;
}
else
{
@@ -3420,84 +3434,83 @@ CompWindow::hide ()
}
else
{
- priv->shaded = false;
+ shaded = false;
- if ((priv->state & CompWindowStateShadedMask) && priv->frame)
- XUnmapWindow (screen->dpy (), priv->frame);
+ if ((state & CompWindowStateShadedMask) && frame)
+ XUnmapWindow (screen->dpy (), frame);
}
- if (!priv->pendingMaps && !isViewable ())
+ if (!pendingMaps && !window->isViewable ())
return;
- windowNotify (CompWindowNotifyHide);
+ window->windowNotify (CompWindowNotifyHide);
- priv->pendingUnmaps++;
+ pendingUnmaps++;
- if (priv->frame && !priv->shaded)
- XUnmapWindow (screen->dpy (), priv->frame);
+ if (frame && !shaded)
+ XUnmapWindow (screen->dpy (), frame);
- XUnmapWindow (screen->dpy (), priv->id);
+ XUnmapWindow (screen->dpy (), id);
- if (priv->minimized || priv->inShowDesktopMode ||
- priv->hidden || priv->shaded)
- changeState (priv->state | CompWindowStateHiddenMask);
+ if (minimized || inShowDesktopMode || hidden || shaded)
+ window->changeState (state | CompWindowStateHiddenMask);
- if (priv->shaded && priv->id == screen->activeWindow ())
- moveInputFocusTo ();
+ if (shaded && id == screen->activeWindow ())
+ window->moveInputFocusTo ();
}
void
-CompWindow::show ()
+PrivateWindow::show ()
{
- Bool onDesktop = onCurrentDesktop ();
+ Bool onDesktop = window->onCurrentDesktop ();
- if (!priv->managed)
+ if (!managed)
return;
- if (priv->minimized || priv->inShowDesktopMode ||
- priv->hidden || !onDesktop)
+ if (minimized || inShowDesktopMode ||
+ hidden || !onDesktop)
{
/* no longer hidden but not on current desktop */
- if (!priv->minimized && !priv->inShowDesktopMode && !priv->hidden)
- changeState (priv->state & ~CompWindowStateHiddenMask);
+ if (!minimized && !inShowDesktopMode && !hidden)
+ window->changeState (state & ~CompWindowStateHiddenMask);
return;
}
/* transition from minimized to shaded */
- if (priv->state & CompWindowStateShadedMask)
+ if (state & CompWindowStateShadedMask)
{
- priv->shaded = true;
+ shaded = true;
- if (priv->frame)
- XMapWindow (screen->dpy (), priv->frame);
+ if (frame)
+ XMapWindow (screen->dpy (), frame);
- if (priv->height)
- resize (priv->attrib.x, priv->attrib.y,
- priv->attrib.width, ++priv->attrib.height - 1,
- priv->attrib.border_width);
+ if (height)
+ window->resize (attrib.x, attrib.y,
+ attrib.width, ++attrib.height - 1,
+ attrib.border_width);
return;
}
else
{
- priv->shaded = false;
+ shaded = false;
}
- windowNotify (CompWindowNotifyShow);
+ window->windowNotify (CompWindowNotifyShow);
- priv->pendingMaps++;
+ pendingMaps++;
- if (priv->frame)
+ if (frame)
{
- XMapWindow (screen->dpy (), priv->frame);
- XMapWindow (screen->dpy (), priv->wrapper);
+ XMapWindow (screen->dpy (), frame);
+ XMapWindow (screen->dpy (), wrapper);
}
- XMapWindow (screen->dpy (), priv->id);
+ XMapWindow (screen->dpy (), id);
- changeState (priv->state & ~CompWindowStateHiddenMask);
- screen->priv->setWindowState (priv->state, priv->id);
+ window->changeState (state & ~CompWindowStateHiddenMask);
+ screen->priv->setWindowState (state, id);
}
void
@@ -3526,7 +3539,7 @@ CompWindow::minimize ()
screen->forEachWindow (
boost::bind (PrivateWindow::minimizeTransients, _1, this));
- hide ();
+ priv->hide ();
}
}
@@ -3548,7 +3561,7 @@ CompWindow::unminimize ()
priv->minimized = false;
- show ();
+ priv->show ();
screen->forEachWindow (
boost::bind (PrivateWindow::unminimizeTransients, _1, this));
@@ -4048,9 +4061,9 @@ CompWindow::setDesktop (unsigned int desktop)
priv->desktop = desktop;
if (desktop == 0xffffffff || desktop == screen->currentDesktop ())
- show ();
+ priv->show ();
else
- hide ();
+ priv->hide ();
screen->setWindowProp (priv->id, Atoms::winDesktop, priv->desktop);
}
@@ -4412,7 +4425,7 @@ PrivateWindow::processMap ()
screen->priv->setCurrentDesktop (priv->desktop);
if (!(priv->state & CompWindowStateHiddenMask))
- window->show ();
+ show ();
if (allowFocus)
window->moveInputFocusTo ();