summaryrefslogtreecommitdiff
path: root/workarounds.c
diff options
context:
space:
mode:
Diffstat (limited to 'workarounds.c')
-rw-r--r--workarounds.c113
1 files changed, 61 insertions, 52 deletions
diff --git a/workarounds.c b/workarounds.c
index 123e848..db17be4 100644
--- a/workarounds.c
+++ b/workarounds.c
@@ -29,12 +29,18 @@
static int displayPrivateIndex;
+typedef struct _WorkaroundsManagedFsWindow {
+ Window id;
+ struct _WorkaroundsManagedFsWindow *next;
+} WorkaroundsManagedFsWindow;
+
typedef struct _WorkaroundsDisplay {
int screenPrivateIndex;
HandleEventProc handleEvent;
- Atom roleAtom;
+ Atom roleAtom;
+ WorkaroundsManagedFsWindow *mfwList;
} WorkaroundsDisplay;
typedef void (*GLProgramParameter4dvProc) (GLenum target,
@@ -61,16 +67,6 @@ typedef struct _WorkaroundsWindow {
Bool isFullscreen;
} WorkaroundsWindow;
-struct _WorkaroundsManagedFsWindow {
- Window id;
- struct _WorkaroundsManagedFsWindow *next;
-};
-
-typedef struct _WorkaroundsManagedFsWindow WorkaroundsManagedFsWindow;
-
-WorkaroundsManagedFsWindow *mfwList = NULL;
-
-
#define GET_WORKAROUNDS_DISPLAY(d) \
((WorkaroundsDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
@@ -239,6 +235,7 @@ workaroundsFixupFullscreen (CompWindow *w)
BoxPtr box;
WORKAROUNDS_WINDOW (w);
+ WORKAROUNDS_DISPLAY (w->screen->display);
if (w->wmType & CompWindowTypeDesktopMask)
{
@@ -286,53 +283,55 @@ workaroundsFixupFullscreen (CompWindow *w)
/*keep track of windows that we interact with*/
- if(mfwList == NULL)
+ if (wd->mfwList == NULL)
{
- mfwList = (WorkaroundsManagedFsWindow*)malloc(sizeof(WorkaroundsManagedFsWindow));
- mfwList->id = w->id;
- mfwList->next = NULL;
+ wd->mfwList = malloc (sizeof (WorkaroundsManagedFsWindow));
+ if (wd->mfwList)
+ {
+ wd->mfwList->id = w->id;
+ wd->mfwList->next = NULL;
+ }
}
else
{
WorkaroundsManagedFsWindow *mfw;
- for(mfw = mfwList; mfw->next != NULL; mfw = mfw->next);
- mfw->next = (WorkaroundsManagedFsWindow*)malloc(sizeof(WorkaroundsManagedFsWindow));
+
+ for (mfw = wd->mfwList; mfw->next; mfw = mfw->next);
+ mfw->next = malloc (sizeof (WorkaroundsManagedFsWindow));
mfw = mfw->next;
mfw->id = w->id;
mfw->next = NULL;
}
-
}
}
- else if(!isFullSize && (w->state & CompWindowStateFullscreenMask) && mfwList) {
- /*did we set the flag?*/
+ else if (!isFullSize && wd->mfwList &&
+ (w->state & CompWindowStateFullscreenMask))
+ {
+ /* did we set the flag? */
WorkaroundsManagedFsWindow *mfw;
- for(mfw = mfwList; mfw->next != NULL; mfw = mfw->next)
+ for (mfw = wd->mfwList; mfw->next; mfw = mfw->next)
{
- if(mfw->id == w->id)
- {
- unsigned int state = w->state & ~CompWindowStateFullscreenMask;
+ if (mfw->id == w->id)
+ {
+ unsigned int state = w->state & ~CompWindowStateFullscreenMask;
- if (isFullSize)
- state |= CompWindowStateFullscreenMask;
+ if (isFullSize)
+ state |= CompWindowStateFullscreenMask;
- ww->madeFullscreen = isFullSize;
+ ww->madeFullscreen = isFullSize;
- if (state != w->state)
- {
- changeWindowState (w, state);
- recalcWindowType (w);
- recalcWindowActions (w);
- updateWindowAttributes (w, CompStackingUpdateModeNormal);
- }
- break;
+ if (state != w->state)
+ {
+ changeWindowState (w, state);
+ recalcWindowType (w);
+ recalcWindowActions (w);
+ updateWindowAttributes (w, CompStackingUpdateModeNormal);
}
-
+ break;
+ }
}
}
-
-
}
static void
@@ -501,23 +500,32 @@ workaroundsHandleEvent (CompDisplay *d,
break;
case DestroyNotify:
w = findWindowAtDisplay (d, event->xdestroywindow.window);
- WorkaroundsManagedFsWindow *mfw, *mfwPrev;
- if(mfwList == NULL) break;
- if(mfwList->id == w->id ) {
- mfw = mfwList;
- mfwList = mfwList->next;
- free(mfw);
- break;
- }
- mfwPrev = mfwList;
- for(mfw = mfwList; mfw->next != NULL; mfw = mfw->next)
+ if (w)
{
- if(mfw->id == w->id)
+ WorkaroundsManagedFsWindow *mfw, *mfwPrev;
+ WORKAROUNDS_DISPLAY (d);
+
+ if (!wd->mfwList)
+ break;
+
+ if (wd->mfwList->id == w->id)
{
- mfwPrev->next=mfw->next;
- free(mfw);
+ mfw = wd->mfwList;
+ wd->mfwList = wd->mfwList->next;
+ free (mfw);
+ break;
+ }
+
+ mfwPrev = wd->mfwList;
+ for (mfw = wd->mfwList; mfw->next; mfw = mfw->next)
+ {
+ if (mfw->id == w->id)
+ {
+ mfwPrev->next = mfw->next;
+ free (mfw);
+ }
+ mfwPrev = mfw;
}
- mfwPrev = mfw;
}
break;
}
@@ -593,6 +601,7 @@ workaroundsInitDisplay (CompPlugin *plugin, CompDisplay *d)
}
wd->roleAtom = XInternAtom (d->display, "WM_WINDOW_ROLE", 0);
+ wd->mfwList = NULL;
workaroundsSetStickyAlldesktopsNotify (d, workaroundsDisplayOptionChanged);
workaroundsSetAlldesktopStickyMatchNotify (d,