summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2010-10-26 22:43:27 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-10-26 22:43:27 +0800
commit966542d39240adc926b9259b1d26e92ef3229072 (patch)
treed8f8b6cbc1e62df42abbfc402354b722d8ff6c73
parent17312a304fd8bdd07ee97b59a08ab7ac20cca982 (diff)
downloadworkarounds-966542d39240adc926b9259b1d26e92ef3229072.tar.gz
workarounds-966542d39240adc926b9259b1d26e92ef3229072.tar.bz2
Don't unminimize transients when the window is being destroyed
Unminimizing the transients means that we have to loop the window list in the ::~WorkaroundsWindow stage, and we don't know which of our windows have already been destroyed (which is problematic for ::get ()). Since the transients of windows are likely to be destroyed along with the main window and and also during the entire plugin tear-down phase we are unminimizing each individual window, there is no need to also unminimize transients for each window. FIXME: We should really implement a ::fini stage where we can guaruntee that nothing has been destroyed
-rw-r--r--src/workarounds.cpp34
-rw-r--r--src/workarounds.h27
2 files changed, 43 insertions, 18 deletions
diff --git a/src/workarounds.cpp b/src/workarounds.cpp
index 2ef67f6..2e291f3 100644
--- a/src/workarounds.cpp
+++ b/src/workarounds.cpp
@@ -242,11 +242,14 @@ WorkaroundsWindow::unminimize ()
setVisibility (true);
- foreach (CompWindow *w, screen->windows ())
+ if (!ws->skipTransients)
{
- if (w->transientFor () == window->id () ||
- WorkaroundsWindow::get (w)->isGroupTransient (window->clientLeader ()))
- w->unminimize ();
+ foreach (CompWindow *w, screen->windows ())
+ {
+ if (w->transientFor () == window->id () ||
+ WorkaroundsWindow::get (w)->isGroupTransient (window->clientLeader ()))
+ w->unminimize ();
+ }
}
/* HACK ATTACK */
@@ -1009,7 +1012,8 @@ WorkaroundsScreen::WorkaroundsScreen (CompScreen *screen) :
PluginClassHandler <WorkaroundsScreen, CompScreen> (screen),
cScreen (CompositeScreen::get (screen)),
gScreen (GLScreen::get (screen)),
- roleAtom (XInternAtom (screen->dpy (), "WM_WINDOW_ROLE", 0))
+ roleAtom (XInternAtom (screen->dpy (), "WM_WINDOW_ROLE", 0)),
+ skipTransients (false)
{
CompOption::Vector propTemplate;
@@ -1111,6 +1115,24 @@ WorkaroundsWindow::WorkaroundsWindow (CompWindow *window) :
WorkaroundsWindow::~WorkaroundsWindow ()
{
+ WORKAROUNDS_SCREEN (screen);
+
+ /* It is not safe to loop the whole window list at this point
+ * to _also_ unminimize transient windows because this could
+ * be the plugin tear-down stage and other WorkaroundWindow
+ * structures could be destroyed.
+ *
+ * It is ok to skip transients in this case, since it is likely
+ * that we will be unminimizing every single window as
+ * WorkaroundsWindow is destroyed (in the case that the window
+ * itself has been destroyed while the plugin is enabled, this
+ * is not much of a problem since the transient windows go with
+ * the destroyed window in this case)
+ *
+ * FIXME: We need a ::fini stage before we do this!
+ */
+ ws->skipTransients = true;
+
if (isMinimized)
{
unminimize ();
@@ -1134,6 +1156,8 @@ WorkaroundsWindow::~WorkaroundsWindow ()
window->state () &= ~CompWindowStateStickyMask;
}
}
+
+ ws->skipTransients = false;
}
bool
diff --git a/src/workarounds.h b/src/workarounds.h
index 678b8c9..9665fc2 100644
--- a/src/workarounds.h
+++ b/src/workarounds.h
@@ -3,7 +3,7 @@
*
* Sticky window handling and OpenGL fixes:
* Copyright (c) 2007 Dennis Kasprzyk <onestone@opencompositing.org>
- *
+ *
* Ported to Compiz 0.9:
* Copyright (c) 2008 Sam Spilsbury <smspillaz@gmail.com>
*
@@ -61,7 +61,8 @@ class WorkaroundsScreen :
Atom roleAtom;
std::list <Window> mfwList;
CompWindowList minimizingWindows;
-
+ bool skipTransients;
+
PropertyWriter inputDisabledAtom;
GL::GLProgramParameter4fProc origProgramEnvParameter4f;
@@ -84,7 +85,7 @@ class WorkaroundsScreen :
const CompRegion &,
CompOutput *,
unsigned int );
-
+
void
handleCompizEvent (const char *pluginName,
const char *eventName,
@@ -124,19 +125,19 @@ class WorkaroundsWindow :
public GLWindowInterface
{
public:
-
+
typedef struct _HideInfo {
Window shapeWindow;
-
+
unsigned long skipState;
unsigned long shapeMask;
-
+
XRectangle *inputRects;
int nInputRects;
int inputRectOrdering;
-
+
} HideInfo;
-
+
public:
WorkaroundsWindow (CompWindow *);
@@ -154,24 +155,24 @@ class WorkaroundsWindow :
bool isMinimized;
HideInfo *windowHideInfo;
-
+
bool
isGroupTransient (Window);
-
+
void
resizeNotify (int, int, int, int);
void
getAllowedActions (unsigned int &,
unsigned int &);
-
+
void minimize ();
void unminimize ();
bool minimized ();
-
+
bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &,
const CompRegion &, unsigned int);
-
+
void setVisibility (bool);
void restoreInputShape (HideInfo *);
void clearInputShape (HideInfo *);