summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Riedi <andrewriedi@gmail.com>2007-06-14 00:56:26 -0700
committerAndrew Riedi <andrewriedi@gmail.com>2007-06-14 00:56:26 -0700
commite1a3aa272420d01cbfc0ff4e0c047360dbfa5d5e (patch)
tree51a4e84b4881ffd6eac584c2a4783c51602c7ce4
parentd862a1873c8d7193eb7b826e2934548cf86595af (diff)
downloadworkarounds-e1a3aa272420d01cbfc0ff4e0c047360dbfa5d5e.tar.gz
workarounds-e1a3aa272420d01cbfc0ff4e0c047360dbfa5d5e.tar.bz2
Add a possible fix for the old OpenOffice.org fullscreen problem.
-rw-r--r--workarounds.c130
1 files changed, 126 insertions, 4 deletions
diff --git a/workarounds.c b/workarounds.c
index 0d972af..d528b71 100644
--- a/workarounds.c
+++ b/workarounds.c
@@ -24,6 +24,128 @@
static CompMetadata workaroundsMetadata;
static int displayPrivateIndex;
+typedef struct _WorkaroundsDisplay {
+ int screenPrivateIndex;
+} WorkaroundsDisplay;
+
+typedef struct _WorkaroundsScreen {
+ int windowPrivateIndex;
+
+ WindowResizeNotifyProc windowResizeNotify;
+} WorkaroundsScreen;
+
+typedef struct _WorkaroundsWindow {
+} WorkaroundsWindow;
+
+#define GET_WORKAROUNDS_DISPLAY(d) \
+ ((WorkaroundsDisplay *) (d)->privates[displayPrivateIndex].ptr)
+
+#define WORKAROUNDS_DISPLAY(d) \
+ WorkaroundsDisplay *wd = GET_WORKAROUNDS_DISPLAY (d)
+
+#define GET_WORKAROUNDS_SCREEN(s, wd) \
+ ((WorkaroundsScreen *) (s)->privates[(wd)->screenPrivateIndex].ptr)
+
+#define WORKAROUNDS_SCREEN(s) \
+ WorkaroundsScreen *ws = GET_WORKAROUNDS_SCREEN (s, \
+ GET_WORKAROUNDS_DISPLAY (s->display))
+
+#define GET_WORKAROUNDS_WINDOW(w, ws) \
+ ((WorkaroundsWindow *) (w)->privates[(ws)->windowPrivateIndex].ptr)
+
+#define WORKAROUNDS_WINDOW(w) \
+ WorkaroundsWindow *ww = GET_WORKAROUNDS_WINDOW (w, \
+ GET_WORKAROUNDS_SCREEN (w->screen, \
+ GET_WORKAROUNDS_DISPLAY (w->screen->display)))
+
+
+static void workaroundsWindowResizeNotify( CompWindow *w, int dx, int dy,
+ int dwidth, int dheight )
+{
+ WORKAROUNDS_SCREEN( w->screen );
+
+ if ( workaroundsGetLegacyApps( w->screen->display ) )
+ {
+ unsigned int type;
+
+ type = w->wmType;
+
+ /* Fix up the window mask if the size of the window changed. */
+ if ((w->width != w->screen->width || w->height != w->screen->height) &&
+ (w->type & CompWindowTypeFullscreenMask) &&
+ !(type & CompWindowTypeDesktopMask))
+ type &= ~CompWindowTypeFullscreenMask;
+
+ w->type = type;
+ }
+
+ UNWRAP( ws, w->screen, windowResizeNotify );
+ (*w->screen->windowResizeNotify) ( w, dx, dy, dwidth, dheight );
+ WRAP( ws, w->screen, windowResizeNotify, workaroundsWindowResizeNotify );
+}
+
+static Bool workaroundsInitDisplay( CompPlugin *plugin, CompDisplay *d )
+{
+ WorkaroundsDisplay *wd;
+
+ wd = malloc( sizeof( WorkaroundsDisplay) );
+ if (!wd)
+ return FALSE;
+
+ wd->screenPrivateIndex = allocateScreenPrivateIndex( d );
+ if ( wd->screenPrivateIndex < 0 )
+ {
+ free (wd);
+ return FALSE;
+ }
+
+ d->privates[displayPrivateIndex].ptr = wd;
+
+ return TRUE;
+}
+
+static void workaroundsFiniDisplay( CompPlugin *plugin, CompDisplay *d )
+{
+ WORKAROUNDS_DISPLAY( d );
+
+ freeScreenPrivateIndex( d, wd->screenPrivateIndex );
+
+ free( wd );
+}
+
+static Bool workaroundsInitScreen( CompPlugin *plugin, CompScreen *s )
+{
+ WorkaroundsScreen *ws;
+
+ WORKAROUNDS_DISPLAY( s->display );
+
+ ws = malloc( sizeof( WorkaroundsScreen ) );
+ if (!ws)
+ return FALSE;
+
+ ws->windowPrivateIndex = allocateWindowPrivateIndex( s );
+ if ( ws->windowPrivateIndex < 0 )
+ {
+ free (ws);
+ return FALSE;
+ }
+
+ WRAP( ws, s, windowResizeNotify, workaroundsWindowResizeNotify );
+
+ s->privates[wd->screenPrivateIndex].ptr = ws;
+
+ return TRUE;
+}
+
+static void workaroundsFiniScreen( CompPlugin *plugin, CompScreen *s )
+{
+ WORKAROUNDS_SCREEN( s );
+
+ UNWRAP( ws, s, windowResizeNotify );
+
+ free( ws );
+}
+
static Bool workaroundsInitWindow( CompPlugin *plugin, CompWindow *w )
{
if ( workaroundsGetLegacyApps( w->screen->display ) )
@@ -89,10 +211,10 @@ CompPluginVTable workaroundsVTable =
workaroundsGetMetadata,
workaroundsInit,
workaroundsFini,
- 0, /* InitDisplay */
- 0, /* FiniDisplay */
- 0, /* InitScreen */
- 0, /* FiniScreen */
+ workaroundsInitDisplay,
+ workaroundsFiniDisplay,
+ workaroundsInitScreen,
+ workaroundsFiniScreen,
workaroundsInitWindow,
workaroundsFiniWindow,
0, /* GetDisplayOptions */