/* * This file is autogenerated with bcop: * The Compiz option code generator * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include #include #include #include #define _WORKAROUNDS_OPTIONS_INTERNAL #include "workarounds_options.h" static int displayPrivateIndex; static CompMetadata workaroundsOptionsMetadata; static CompPluginVTable *workaroundsPluginVTable = NULL; CompPluginVTable workaroundsOptionsVTable; #define GET_WORKAROUNDS_OPTIONS_DISPLAY(d) \ ((WorkaroundsOptionsDisplay *) (d)->privates[displayPrivateIndex].ptr) #define WORKAROUNDS_OPTIONS_DISPLAY(d) \ WorkaroundsOptionsDisplay *od = GET_WORKAROUNDS_OPTIONS_DISPLAY (d) #define GET_WORKAROUNDS_OPTIONS_SCREEN(s, od) \ ((WorkaroundsOptionsScreen *) (s)->privates[(od)->screenPrivateIndex].ptr) #define WORKAROUNDS_OPTIONS_SCREEN(s) \ WorkaroundsOptionsScreen *os = GET_WORKAROUNDS_OPTIONS_SCREEN (s, GET_WORKAROUNDS_OPTIONS_DISPLAY (s->display)) typedef struct _WorkaroundsOptionsDisplay { int screenPrivateIndex; CompOption opt[WorkaroundsDisplayOptionNum]; workaroundsDisplayOptionChangeNotifyProc notify[WorkaroundsDisplayOptionNum]; } WorkaroundsOptionsDisplay; typedef struct _WorkaroundsOptionsScreen { } WorkaroundsOptionsScreen; Bool workaroundsGetLegacyFullscreen (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return od->opt[WorkaroundsDisplayOptionLegacyFullscreen].value.b; } CompOption * workaroundsGetLegacyFullscreenOption (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return &od->opt[WorkaroundsDisplayOptionLegacyFullscreen]; } void workaroundsSetLegacyFullscreenNotify (CompDisplay *d, workaroundsDisplayOptionChangeNotifyProc notify) { WORKAROUNDS_OPTIONS_DISPLAY(d); od->notify[WorkaroundsDisplayOptionLegacyFullscreen] = notify; } Bool workaroundsGetFirefoxMenuFix (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return od->opt[WorkaroundsDisplayOptionFirefoxMenuFix].value.b; } CompOption * workaroundsGetFirefoxMenuFixOption (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return &od->opt[WorkaroundsDisplayOptionFirefoxMenuFix]; } void workaroundsSetFirefoxMenuFixNotify (CompDisplay *d, workaroundsDisplayOptionChangeNotifyProc notify) { WORKAROUNDS_OPTIONS_DISPLAY(d); od->notify[WorkaroundsDisplayOptionFirefoxMenuFix] = notify; } Bool workaroundsGetNotificationDaemonFix (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return od->opt[WorkaroundsDisplayOptionNotificationDaemonFix].value.b; } CompOption * workaroundsGetNotificationDaemonFixOption (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return &od->opt[WorkaroundsDisplayOptionNotificationDaemonFix]; } void workaroundsSetNotificationDaemonFixNotify (CompDisplay *d, workaroundsDisplayOptionChangeNotifyProc notify) { WORKAROUNDS_OPTIONS_DISPLAY(d); od->notify[WorkaroundsDisplayOptionNotificationDaemonFix] = notify; } Bool workaroundsGetJavaFix (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return od->opt[WorkaroundsDisplayOptionJavaFix].value.b; } CompOption * workaroundsGetJavaFixOption (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return &od->opt[WorkaroundsDisplayOptionJavaFix]; } void workaroundsSetJavaFixNotify (CompDisplay *d, workaroundsDisplayOptionChangeNotifyProc notify) { WORKAROUNDS_OPTIONS_DISPLAY(d); od->notify[WorkaroundsDisplayOptionJavaFix] = notify; } Bool workaroundsGetQtFix (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return od->opt[WorkaroundsDisplayOptionQtFix].value.b; } CompOption * workaroundsGetQtFixOption (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return &od->opt[WorkaroundsDisplayOptionQtFix]; } void workaroundsSetQtFixNotify (CompDisplay *d, workaroundsDisplayOptionChangeNotifyProc notify) { WORKAROUNDS_OPTIONS_DISPLAY(d); od->notify[WorkaroundsDisplayOptionQtFix] = notify; } Bool workaroundsGetStickyAlldesktops (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return od->opt[WorkaroundsDisplayOptionStickyAlldesktops].value.b; } CompOption * workaroundsGetStickyAlldesktopsOption (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return &od->opt[WorkaroundsDisplayOptionStickyAlldesktops]; } void workaroundsSetStickyAlldesktopsNotify (CompDisplay *d, workaroundsDisplayOptionChangeNotifyProc notify) { WORKAROUNDS_OPTIONS_DISPLAY(d); od->notify[WorkaroundsDisplayOptionStickyAlldesktops] = notify; } CompMatch * workaroundsGetAlldesktopStickyMatch (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return &od->opt[WorkaroundsDisplayOptionAlldesktopStickyMatch].value.match; } CompOption * workaroundsGetAlldesktopStickyMatchOption (CompDisplay *d) { WORKAROUNDS_OPTIONS_DISPLAY(d); return &od->opt[WorkaroundsDisplayOptionAlldesktopStickyMatch]; } void workaroundsSetAlldesktopStickyMatchNotify (CompDisplay *d, workaroundsDisplayOptionChangeNotifyProc notify) { WORKAROUNDS_OPTIONS_DISPLAY(d); od->notify[WorkaroundsDisplayOptionAlldesktopStickyMatch] = notify; } CompOption * workaroundsGetDisplayOption (CompDisplay *d, WorkaroundsDisplayOptions num) { WORKAROUNDS_OPTIONS_DISPLAY(d); return &od->opt[num]; } static const CompMetadataOptionInfo workaroundsOptionsDisplayOptionInfo[] = { { "legacy_fullscreen", "bool", 0, 0, 0 }, { "firefox_menu_fix", "bool", 0, 0, 0 }, { "notification_daemon_fix", "bool", 0, 0, 0 }, { "java_fix", "bool", 0, 0, 0 }, { "qt_fix", "bool", 0, 0, 0 }, { "sticky_alldesktops", "bool", 0, 0, 0 }, { "alldesktop_sticky_match", "match", 0, 0, 0 }, }; static Bool workaroundsOptionsSetDisplayOption (CompPlugin *plugin, CompDisplay *d, char *name, CompOptionValue *value) { WORKAROUNDS_OPTIONS_DISPLAY(d); CompOption *o; int index; o = compFindOption (od->opt, WorkaroundsDisplayOptionNum, name, &index); if (!o) return FALSE; switch (index) { case WorkaroundsDisplayOptionLegacyFullscreen: if (compSetDisplayOption (d, o, value)) { if (od->notify[WorkaroundsDisplayOptionLegacyFullscreen]) (*od->notify[WorkaroundsDisplayOptionLegacyFullscreen]) (d, o, WorkaroundsDisplayOptionLegacyFullscreen); return TRUE; } break; case WorkaroundsDisplayOptionFirefoxMenuFix: if (compSetDisplayOption (d, o, value)) { if (od->notify[WorkaroundsDisplayOptionFirefoxMenuFix]) (*od->notify[WorkaroundsDisplayOptionFirefoxMenuFix]) (d, o, WorkaroundsDisplayOptionFirefoxMenuFix); return TRUE; } break; case WorkaroundsDisplayOptionNotificationDaemonFix: if (compSetDisplayOption (d, o, value)) { if (od->notify[WorkaroundsDisplayOptionNotificationDaemonFix]) (*od->notify[WorkaroundsDisplayOptionNotificationDaemonFix]) (d, o, WorkaroundsDisplayOptionNotificationDaemonFix); return TRUE; } break; case WorkaroundsDisplayOptionJavaFix: if (compSetDisplayOption (d, o, value)) { if (od->notify[WorkaroundsDisplayOptionJavaFix]) (*od->notify[WorkaroundsDisplayOptionJavaFix]) (d, o, WorkaroundsDisplayOptionJavaFix); return TRUE; } break; case WorkaroundsDisplayOptionQtFix: if (compSetDisplayOption (d, o, value)) { if (od->notify[WorkaroundsDisplayOptionQtFix]) (*od->notify[WorkaroundsDisplayOptionQtFix]) (d, o, WorkaroundsDisplayOptionQtFix); return TRUE; } break; case WorkaroundsDisplayOptionStickyAlldesktops: if (compSetDisplayOption (d, o, value)) { if (od->notify[WorkaroundsDisplayOptionStickyAlldesktops]) (*od->notify[WorkaroundsDisplayOptionStickyAlldesktops]) (d, o, WorkaroundsDisplayOptionStickyAlldesktops); return TRUE; } break; case WorkaroundsDisplayOptionAlldesktopStickyMatch: if (compSetDisplayOption (d, o, value)) { if (od->notify[WorkaroundsDisplayOptionAlldesktopStickyMatch]) (*od->notify[WorkaroundsDisplayOptionAlldesktopStickyMatch]) (d, o, WorkaroundsDisplayOptionAlldesktopStickyMatch); return TRUE; } break; default: break; } return FALSE; } static CompOption * workaroundsOptionsGetDisplayOptions (CompPlugin *plugin, CompDisplay *d, int *count) { WORKAROUNDS_OPTIONS_DISPLAY(d); *count = WorkaroundsDisplayOptionNum; return od->opt; } static Bool workaroundsOptionsInitScreen (CompPlugin *p, CompScreen *s) { WorkaroundsOptionsScreen *os; WORKAROUNDS_OPTIONS_DISPLAY (s->display); os = calloc (1, sizeof(WorkaroundsOptionsScreen)); if (!os) return FALSE; s->privates[od->screenPrivateIndex].ptr = os; if (workaroundsPluginVTable && workaroundsPluginVTable->initScreen) return workaroundsPluginVTable->initScreen (p, s); return TRUE; } static void workaroundsOptionsFiniScreen (CompPlugin *p, CompScreen *s) { if (workaroundsPluginVTable && workaroundsPluginVTable->finiScreen) return workaroundsPluginVTable->finiScreen (p, s); WORKAROUNDS_OPTIONS_SCREEN (s); free (os); } static Bool workaroundsOptionsInitDisplay (CompPlugin *p, CompDisplay *d) { WorkaroundsOptionsDisplay *od; od = calloc (1, sizeof(WorkaroundsOptionsDisplay)); if (!od) return FALSE; od->screenPrivateIndex = allocateScreenPrivateIndex(d); if (od->screenPrivateIndex < 0) { free(od); return FALSE; } d->privates[displayPrivateIndex].ptr = od; if (!compInitDisplayOptionsFromMetadata (d, &workaroundsOptionsMetadata, workaroundsOptionsDisplayOptionInfo, od->opt, WorkaroundsDisplayOptionNum)) { free (od); return FALSE; } if (workaroundsPluginVTable && workaroundsPluginVTable->initDisplay) return workaroundsPluginVTable->initDisplay (p, d); return TRUE; } static void workaroundsOptionsFiniDisplay (CompPlugin *p, CompDisplay *d) { if (workaroundsPluginVTable && workaroundsPluginVTable->finiDisplay) return workaroundsPluginVTable->finiDisplay (p, d); WORKAROUNDS_OPTIONS_DISPLAY (d); freeScreenPrivateIndex(d, od->screenPrivateIndex); compFiniDisplayOptions (d, od->opt, WorkaroundsDisplayOptionNum); free (od); } static Bool workaroundsOptionsInit (CompPlugin *p) { displayPrivateIndex = allocateDisplayPrivateIndex(); if (displayPrivateIndex < 0) return FALSE; if (!compInitPluginMetadataFromInfo (&workaroundsOptionsMetadata, "workarounds",workaroundsOptionsDisplayOptionInfo, WorkaroundsDisplayOptionNum, 0, 0)) return FALSE; compAddMetadataFromFile (&workaroundsOptionsMetadata, "workarounds"); if (workaroundsPluginVTable && workaroundsPluginVTable->init) return workaroundsPluginVTable->init (p); return TRUE; } static void workaroundsOptionsFini (CompPlugin *p) { if (workaroundsPluginVTable && workaroundsPluginVTable->fini) return workaroundsPluginVTable->fini (p); if (displayPrivateIndex >= 0) freeDisplayPrivateIndex(displayPrivateIndex); compFiniMetadata (&workaroundsOptionsMetadata); } static CompMetadata * workaroundsOptionsGetMetadata (CompPlugin *plugin) { return &workaroundsOptionsMetadata; } CompPluginVTable *getCompPluginInfo (void) { if (!workaroundsPluginVTable) { workaroundsPluginVTable = workaroundsOptionsGetCompPluginInfo (); memcpy(&workaroundsOptionsVTable, workaroundsPluginVTable, sizeof(CompPluginVTable)); workaroundsOptionsVTable.getMetadata = workaroundsOptionsGetMetadata; workaroundsOptionsVTable.init = workaroundsOptionsInit; workaroundsOptionsVTable.fini = workaroundsOptionsFini; workaroundsOptionsVTable.initDisplay = workaroundsOptionsInitDisplay; workaroundsOptionsVTable.finiDisplay = workaroundsOptionsFiniDisplay; workaroundsOptionsVTable.initScreen = workaroundsOptionsInitScreen; workaroundsOptionsVTable.finiScreen = workaroundsOptionsFiniScreen; workaroundsOptionsVTable.getDisplayOptions = workaroundsOptionsGetDisplayOptions; workaroundsOptionsVTable.setDisplayOption = workaroundsOptionsSetDisplayOption; } return &workaroundsOptionsVTable; }