summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2008-01-07 07:17:16 +0100
committerDanny Baumann <dannybaumann@web.de>2008-01-07 07:17:16 +0100
commitbe6a8e1d85c5e7f35cdf592e66f17714148faeb4 (patch)
tree40103b67548ca90ccee22708035aacddae9d6346
parent023edd46578b63aee7955cea4df56d275175aa4c (diff)
downloadworkarounds-be6a8e1d85c5e7f35cdf592e66f17714148faeb4.tar.gz
workarounds-be6a8e1d85c5e7f35cdf592e66f17714148faeb4.tar.bz2
Restructure fullscreen window list code.
-rw-r--r--workarounds.c114
1 files changed, 62 insertions, 52 deletions
diff --git a/workarounds.c b/workarounds.c
index 4a95c25..b41a004 100644
--- a/workarounds.c
+++ b/workarounds.c
@@ -88,6 +88,63 @@ typedef struct _WorkaroundsWindow {
GET_WORKAROUNDS_DISPLAY (w->screen->display)))
static void
+workaroundsAddToFullscreenList (CompWindow *w)
+{
+ WorkaroundsManagedFsWindow *mfw, *nmfw;
+
+ WORKAROUNDS_DISPLAY (w->screen->display);
+
+ nmfw = malloc (sizeof (WorkaroundsManagedFsWindow));
+ if (!nmfw)
+ return;
+
+ nmfw->id = w->id;
+ nmfw->next = NULL;
+
+ if (!wd->mfwList)
+ wd->mfwList = nmfw;
+ else
+ {
+ for (mfw = wd->mfwList; mfw->next; mfw = mfw->next)
+ if (mfw->id == w->id)
+ {
+ free (nmfw);
+ return;
+ }
+
+ mfw->next = nmfw;
+ }
+}
+
+static void
+workaroundsRemoveFromFullscreenList (CompWindow *w)
+{
+ WorkaroundsManagedFsWindow *mfw;
+
+ WORKAROUNDS_DISPLAY (w->screen->display);
+
+ if (!wd->mfwList)
+ return;
+
+ if (wd->mfwList->id == w->id)
+ {
+ mfw = wd->mfwList;
+ wd->mfwList = wd->mfwList->next;
+ free (mfw);
+ return;
+ }
+
+ for (mfw = wd->mfwList; mfw->next; mfw = mfw->next)
+ {
+ if (mfw->next->id == w->id)
+ {
+ mfw->next = mfw->next->next;
+ free (mfw->next);
+ }
+ }
+}
+
+static void
workaroundsProgramEnvParameter4f (GLenum target,
GLuint index,
GLfloat x,
@@ -281,27 +338,8 @@ workaroundsFixupFullscreen (CompWindow *w)
recalcWindowActions (w);
updateWindowAttributes (w, CompStackingUpdateModeNormal);
- /*keep track of windows that we interact with*/
-
- if (wd->mfwList == NULL)
- {
- wd->mfwList = malloc (sizeof (WorkaroundsManagedFsWindow));
- if (wd->mfwList)
- {
- wd->mfwList->id = w->id;
- wd->mfwList->next = NULL;
- }
- }
- else
- {
- WorkaroundsManagedFsWindow *mfw;
-
- for (mfw = wd->mfwList; mfw->next; mfw = mfw->next);
- mfw->next = malloc (sizeof (WorkaroundsManagedFsWindow));
- mfw = mfw->next;
- mfw->id = w->id;
- mfw->next = NULL;
- }
+ /* keep track of windows that we interact with */
+ workaroundsAddToFullscreenList (w);
}
}
else if (!isFullSize && wd->mfwList &&
@@ -329,12 +367,9 @@ workaroundsFixupFullscreen (CompWindow *w)
updateWindowAttributes (w, CompStackingUpdateModeNormal);
}
- mfwPrev->next = mfw->next;
- free (mfw);
-
+ workaroundsRemoveFromFullscreenList (w);
break;
}
- mfwPrev = mfw;
}
}
}
@@ -506,32 +541,7 @@ workaroundsHandleEvent (CompDisplay *d,
case DestroyNotify:
w = findWindowAtDisplay (d, event->xdestroywindow.window);
if (w)
- {
- WorkaroundsManagedFsWindow *mfw, *mfwPrev;
- WORKAROUNDS_DISPLAY (d);
-
- if (!wd->mfwList)
- break;
-
- if (wd->mfwList->id == w->id)
- {
- 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;
- }
- }
+ workaroundsRemoveFromFullscreenList (w);
break;
}
@@ -598,7 +608,7 @@ workaroundsInitDisplay (CompPlugin *plugin, CompDisplay *d)
if (!wd)
return FALSE;
- wd->screenPrivateIndex = allocateScreenPrivateIndex( d );
+ wd->screenPrivateIndex = allocateScreenPrivateIndex (d);
if (wd->screenPrivateIndex < 0)
{
free (wd);