diff --git a/configure.ac b/configure.ac index 4d71729..f77fa52 100644 --- a/configure.ac +++ b/configure.ac @@ -83,12 +83,28 @@ AC_SUBST(plugindir) imagedir=$datadir/compiz AC_SUBST(imagedir) +compiling_on_solaris=no +case "$host" in + *-*-solaris*) + AC_MSG_CHECKING(if compiling on Solaris) + compiling_on_solaris=yes + use_xinerama= + AC_MSG_RESULT($compiling_on_solaris) + AC_DEFINE(SOLARIS, 1, [Compiling on Solaris enabled]) + ;; + *) + use_xinerama="xinerama" + AC_DEFINE(HAVE_XORG_XINERAMA, 1, [Compiling with Xinerama enabled]) + ;; +esac + + COMPIZ_REQUIRES="libpng \ + $use_xinerama \ xcomposite \ xfixes \ xdamage \ xrandr \ - xinerama \ ice \ sm \ libstartup-notification-1.0 >= 0.7" diff --git a/include/compiz.h b/include/compiz.h index 3ae7c52..5132e5c 100644 --- a/include/compiz.h +++ b/include/compiz.h @@ -35,7 +35,9 @@ #include #include #include +#ifdef HAVE_XORG_XINERAMA #include +#endif #include #include #include @@ -714,12 +716,15 @@ struct _CompDisplay { Bool xkbExtension; int xkbEvent, xkbError; +#ifdef HAVE_XORG_XINERAMA Bool xineramaExtension; int xineramaEvent, xineramaError; XineramaScreenInfo *screenInfo; +#endif int nScreenInfo; + SnDisplay *snDisplay; Atom supportedAtom; diff --git a/plugins/decoration.c b/plugins/decoration.c index 0a77ae5..4455ce1 100644 --- a/plugins/decoration.c +++ b/plugins/decoration.c @@ -32,12 +32,12 @@ #include #include #include +#include +#include #include #include -#include -#include typedef struct _Vector { int dx; diff --git a/src/cursor.c b/src/cursor.c index a1975b2..1ef8194 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -26,6 +26,7 @@ #include #include +#include "../config.h" static void setCursorMatrix (CompCursor *c) @@ -53,7 +54,10 @@ addCursor (CompScreen *s) updateCursor (c, 0, 0, 0); +#ifdef SOLARIS +#else XFixesHideCursor (s->display->display, s->root); +#endif } } diff --git a/src/display.c b/src/display.c index 9dcf0a1..d354ee4 100644 --- a/src/display.c +++ b/src/display.c @@ -34,6 +34,10 @@ #include #include #include +#ifdef SOLARIS +#include +#include +#endif #define XK_MISCELLANY #include @@ -741,6 +745,57 @@ shade (CompDisplay *d, return TRUE; } +#ifdef SOLARIS +int asprintf(char **out, const char *fmt, ...) +{ + va_list ap; + int ret_status = EOF; + char dir_name[2001]; + char file_name[2000]; + FILE *fp = NULL; + char *work = NULL; + + va_start(ap, fmt); + + /* Warning: tmpfile() does not work well on Windows (MinGW) + * if user does not have write access on the drive where + * working dir is? */ +#ifdef __MINGW32__ + /* file_name = G_tempfile(); */ + GetTempPath ( 2000, dir_name ); + GetTempFileName ( dir_name, "asprintf", 0, file_name ); + fp = fopen ( file_name, "w+" ); +#else + fp = tmpfile(); +#endif /* __MINGW32__ */ + + if ( fp ) { + int count; + + count = vfprintf(fp, fmt, ap); + if (count >= 0) { + work = calloc(count + 1, sizeof(char)); + if (work != NULL) { + rewind(fp); + ret_status = fread(work, sizeof(char), count, fp); + if (ret_status != count) { + ret_status = EOF; + free(work); + work = NULL; + } + } + } + fclose(fp); +#ifdef __MINGW32__ + unlink ( file_name ); +#endif /* __MINGW32__ */ + } + va_end(ap); + *out = work; + + return ret_status; +} +#endif static void compDisplayInitOptions (CompDisplay *display, @@ -2853,6 +2908,8 @@ addDisplay (char *name, d->xkbEvent = d->xkbError = -1; } + d->nScreenInfo = 0; +#ifdef HAVE_XORG_XINERAMA d->xineramaExtension = XineramaQueryExtension (dpy, &d->xineramaEvent, &d->xineramaError); @@ -2865,6 +2922,7 @@ addDisplay (char *name, d->screenInfo = NULL; d->nScreenInfo = 0; } +#endif compDisplays = d; diff --git a/src/option.c b/src/option.c index b9ef8e8..ce4fb29 100644 --- a/src/option.c +++ b/src/option.c @@ -30,6 +30,7 @@ #include #include #include +#include "../config.h" #include @@ -548,6 +549,29 @@ buttonBindingToString (CompDisplay return binding; } +#ifdef SOLARIS +#include +char * +strcasestr (char *haystack, char *needle) +{ + char *p, *startn = 0, *np = 0; + + for (p = haystack; *p; p++) { + if (np) { + if (toupper(*p) == toupper(*np)) { + if (!*++np) + return startn; + } else + np = 0; + } else if (toupper(*p) == toupper(*needle)) { + np = needle + 1; + startn = p; + } + } + + return 0; +} +#endif static unsigned int stringToModifiers (CompDisplay *d, diff --git a/src/screen.c b/src/screen.c index 32f18a9..d40178a 100644 --- a/src/screen.c +++ b/src/screen.c @@ -346,6 +346,7 @@ updateOutputDevices (CompScreen *s) if (s->display->nScreenInfo) { +#ifdef HAVE_XORG_XINERAMA for (i = 0; i < s->display->nScreenInfo; i++) { r.extents.x1 = s->display->screenInfo[i].x_org; @@ -355,6 +356,7 @@ updateOutputDevices (CompScreen *s) XUnionRegion (region, &r, region); } +#endif } else { @@ -399,6 +401,7 @@ detectOutputDevices (CompScreen *s) if (!value.list.value) return; +#ifdef HAVE_XORG_XINERAMA for (i = 0; i < n; i++) { snprintf (output, size, "%dx%d+%d+%d", @@ -409,6 +412,7 @@ detectOutputDevices (CompScreen *s) value.list.value[i].s = strdup (output); } +#endif } else { diff --git a/src/window.c b/src/window.c index 9021477..61297d2 100644 --- a/src/window.c +++ b/src/window.c @@ -1662,6 +1662,7 @@ updateWindowStruts (CompWindow *w) int x1, y1, x2, y2; int i; +#ifdef HAVE_XORG_XINERAMA /* applications expect us to clip struts to xinerama edges */ for (i = 0; i < w->screen->display->nScreenInfo; i++) { @@ -1706,6 +1707,7 @@ updateWindowStruts (CompWindow *w) new.bottom.height = y2 - strutY1; } } +#endif } if (hasOld != hasNew || (hasNew && hasOld &&