summaryrefslogtreecommitdiff
path: root/src/workarounds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/workarounds.cpp')
-rw-r--r--src/workarounds.cpp84
1 files changed, 68 insertions, 16 deletions
diff --git a/src/workarounds.cpp b/src/workarounds.cpp
index 94b07d4..7282c46 100644
--- a/src/workarounds.cpp
+++ b/src/workarounds.cpp
@@ -169,6 +169,7 @@ WorkaroundsWindow::isGroupTransient (Window clientLeader)
return false;
}
+
void
WorkaroundsWindow::minimize ()
@@ -176,7 +177,7 @@ WorkaroundsWindow::minimize ()
if (!window->managed ())
return;
- if (!window->minimized ())
+ if (!isMinimized)
{
WORKAROUNDS_SCREEN (screen);
@@ -185,7 +186,10 @@ WorkaroundsWindow::minimize ()
CompOption::Vector propTemplate = ws->inputDisabledAtom.getReadTemplate ();
CompOption::Value enabled = CompOption::Value (true);
+ screen->handleCompizEventSetEnabled (ws, true);
+
window->windowNotify (CompWindowNotifyMinimize);
+ window->changeState (window->state () | CompWindowStateHiddenMask);
foreach (CompWindow *w, screen->windows ())
{
@@ -194,6 +198,8 @@ WorkaroundsWindow::minimize ()
w->unminimize ();
}
+ window->windowNotify (CompWindowNotifyHide);
+
setVisibility (false);
/* HACK ATTACK */
@@ -205,7 +211,6 @@ WorkaroundsWindow::minimize ()
Atoms::wmState, Atoms::wmState,
32, PropModeReplace, (unsigned char *) data, 2);
-
propTemplate.at (0).set (enabled);
ws->inputDisabledAtom.updateProperty (window->id (),
propTemplate,
@@ -218,7 +223,7 @@ WorkaroundsWindow::minimize ()
void
WorkaroundsWindow::unminimize ()
-{
+{
if (isMinimized)
{
WORKAROUNDS_SCREEN (screen);
@@ -229,9 +234,12 @@ WorkaroundsWindow::unminimize ()
CompOption::Value enabled = CompOption::Value (false);
window->windowNotify (CompWindowNotifyUnminimize);
+ window->changeState (window->state () & ~CompWindowStateHiddenMask);
isMinimized = false;
+ window->windowNotify (CompWindowNotifyShow);
+
setVisibility (true);
foreach (CompWindow *w, screen->windows ())
@@ -270,7 +278,20 @@ WorkaroundsWindow::glPaint (const GLWindowPaintAttrib &attrib,
unsigned int mask)
{
if (isMinimized)
- mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
+ {
+ WORKAROUNDS_SCREEN (screen);
+ bool doMask = true;
+
+ foreach (CompWindow *w, ws->minimizingWindows)
+ {
+ if (w->id () == window->id ())
+ doMask = false;
+ break;
+ }
+
+ if (doMask)
+ mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
+ }
return gWindow->glPaint (attrib, transform, region, mask);
}
@@ -311,24 +332,27 @@ WorkaroundsScreen::checkFunctions (bool checkWindow, bool checkScreen)
screen->handleEventSetEnabled (this, false);
}
- if (optionGetLegacyFullscreen () && checkWindow)
+ if (checkWindow)
{
+ bool legacyFullscreen = optionGetLegacyFullscreen ();
+ bool keepMinimized = optionGetKeepMinimizedWindows ();
+
foreach (CompWindow *w, screen->windows ())
{
WORKAROUNDS_WINDOW (w);
- ww->window->getAllowedActionsSetEnabled (ww, true);
- ww->window->resizeNotifySetEnabled (ww, true);
- }
- }
- else if (checkWindow)
- {
- foreach (CompWindow *w, screen->windows ())
- {
- WORKAROUNDS_WINDOW (w);
+ bool m = ww->window->minimized ();
+
+ ww->window->getAllowedActionsSetEnabled (ww, legacyFullscreen);
+ ww->window->resizeNotifySetEnabled (ww, legacyFullscreen);
- ww->window->getAllowedActionsSetEnabled (ww, false);
- ww->window->resizeNotifySetEnabled (ww, false);
+ if (m)
+ ww->window->unminimize ();
+ ww->window->minimizeSetEnabled (ww, keepMinimized);
+ ww->window->unminimizeSetEnabled (ww, keepMinimized);
+ ww->window->minimizedSetEnabled (ww, keepMinimized);
+ if (m)
+ ww->window->minimize ();
}
}
}
@@ -843,6 +867,34 @@ WorkaroundsScreen::optionChanged (CompOption *opt,
}
void
+WorkaroundsScreen::handleCompizEvent (const char *pluginName,
+ const char *eventName,
+ CompOption::Vector &o)
+{
+ if (strncmp (pluginName, "animation", 9) == 0 &&
+ strncmp (eventName, "window_animation", 16) == 0)
+ {
+ if (CompOption::getStringOptionNamed (o, "type", "") == "minimize")
+ {
+ CompWindow *w = screen->findWindow (CompOption::getIntOptionNamed (
+ o, "window", 0));
+ if (w)
+ {
+ if (CompOption::getBoolOptionNamed (o, "active", false))
+ minimizingWindows.push_back (w);
+ else
+ minimizingWindows.remove (w);
+ }
+ }
+ }
+
+ if (!CompOption::getBoolOptionNamed (o, "active", false))
+ screen->handleCompizEventSetEnabled (this, false);
+
+ screen->handleCompizEvent (pluginName, eventName, o);
+}
+
+void
WorkaroundsScreen::handleEvent (XEvent *event)
{
CompWindow *w;