Okay.  I don't know how many of you know this, but Solaris ships
an Xsun that has Xinerama support in it (as of the last dist.
of Solaris 7).  *But*, in typical Sun Microsystems style, there
is no Xinerama library, nor header file.

  So, in doing some research, it appears there are a few functions
in libXext, that while providing a totally different API, will
allow the needed access to the Xinerama extension in the server.

  So, I updated acconfig.h, configure.in, fvwm/fvwm.c (which
is an avoidable change, if you want to ignore it), and
libs/FScreen.c.

  Patch for the above is attached.  Should I gen diffs to
configure and config.h.in, or will those get taken care
of (either automatically, or by someone else with the "blessed"
autoconf installation)?

  Thanks...

                           - Chris


Index: acconfig.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/acconfig.h,v
retrieving revision 1.72
diff -u -u -r1.72 acconfig.h
--- acconfig.h  8 Jul 2004 10:08:09 -0000       1.72
+++ acconfig.h  13 Aug 2004 15:31:23 -0000
@@ -32,6 +32,9 @@
 /* Define if Xinerama library is used. */
 #undef HAVE_XINERAMA
 
+/* Define if Solaris' Xinerama calls are being used. */
+#undef HAVE_SOLARIS_XINERAMA
+
 /* Define if Xrender library is used. */
 #undef HAVE_XRENDER
 
Index: configure.in
===================================================================
RCS file: /home/cvs/fvwm/fvwm/configure.in,v
retrieving revision 1.294
diff -u -u -r1.294 configure.in
--- configure.in        23 May 2004 16:20:23 -0000      1.294
+++ configure.in        13 Aug 2004 15:31:23 -0000
@@ -298,9 +298,13 @@
   $UNSET ac_cv_lib_Xinerama_XineramaIsActive
   AC_CHECK_LIB(Xinerama, XineramaIsActive,
     with_xinerama=yes; Xinerama_LIBS=-lXinerama; AC_DEFINE(HAVE_XINERAMA),
+    AC_CHECK_LIB(Xext, XineramaGetState,
+    with_xinerama=yes; Xinerama_LIBS=-lXext; AC_DEFINE(HAVE_XINERAMA)
+    AC_DEFINE(HAVE_SOLARIS_XINERAMA)
+    problem_xinerama=" (Using Solaris Xinerama calls)",
     with_xinerama=no; Xinerama_LIBS=
     problem_xinerama=": Failed to detect libXinerama",
-    [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
+    [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS]))
 fi
 AC_SUBST(Xinerama_LIBS)
 AC_SUBST(Xinerama_CFLAGS)
Index: fvwm/fvwm.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/fvwm.c,v
retrieving revision 1.368
diff -u -u -r1.368 fvwm.c
--- fvwm/fvwm.c 15 Jul 2004 13:12:28 -0000      1.368
+++ fvwm/fvwm.c 13 Aug 2004 15:31:23 -0000
@@ -1312,6 +1312,9 @@
        strcat(support_str, " Bidi text,");
 #endif
 #ifdef HAVE_XINERAMA
+# ifdef HAVE_SOLARIS_XINERAMA
+       strcat(support_str, " [Solaris' odd-ball]");
+# endif
        strcat(support_str, " Xinerama,");
 #endif
 #ifdef HAVE_XRENDER
Index: libs/FScreen.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/libs/FScreen.c,v
retrieving revision 1.22
diff -u -u -r1.22 FScreen.c
--- libs/FScreen.c      17 Mar 2004 14:42:54 -0000      1.22
+++ libs/FScreen.c      13 Aug 2004 15:31:23 -0000
@@ -69,8 +69,54 @@
 #include "PictureBase.h"
 
 #ifdef HAVE_XINERAMA
-#define FScreenHaveXinerama 1
-#include <X11/extensions/Xinerama.h>
+# define FScreenHaveXinerama 1
+# ifdef HAVE_SOLARIS_XINERAMA
+#  include <X11/extensions/xinerama.h>
+typedef struct
+{
+       int   screen_number;
+       short x_org;
+       short y_org;
+       short width;
+       short height;
+} XineramaScreenInfo;
+#  define XineramaIsActive(d)          XineramaGetState((d),0)
+#  define XineramaQueryScreens(d,b)    solaris_XineramaQueryScreens((d),(b))
+#  define XineramaQueryExtension(d,b,c)        1       /* Lie, for now */
+static XineramaScreenInfo *
+solaris_XineramaQueryScreens(Display *d, int *xin_nscreens)
+{
+       XineramaScreenInfo *screens = NULL;
+       XRectangle monitors[MAXFRAMEBUFFERS];
+       unsigned char hints[16];
+
+       int result = XineramaGetInfo(d, DefaultScreen(d), monitors, hints,
+                                    xin_nscreens);
+       if (result)
+       {
+               int m;
+
+               screens = (XineramaScreenInfo 
*)malloc(sizeof(XineramaScreenInfo) * (*xin_nscreens));
+               for (m = 0; m < *xin_nscreens; ++m)
+               {
+                       screens[m].screen_number = m;
+                       screens[m].x_org = monitors[m].x;
+                       screens[m].y_org = monitors[m].y;
+                       screens[m].width = monitors[m].width;
+                       screens[m].height = monitors[m].height;
+               }
+       }
+       else
+       {
+           fprintf(stderr, "Error getting Xinerama information\n");
+           *xin_nscreens = 0;
+       }
+
+       return (screens);
+}
+# else /* Must be XFree86 Xinerama */
+#  include <X11/extensions/Xinerama.h>
+# endif
 #else
 #define FScreenHaveXinerama 0
 typedef struct

Reply via email to