From ed0d234d7f8b5b614c0fd6e5a36ddfd955403dea Mon Sep 17 00:00:00 2001 From: kojima Date: Wed, 4 Jun 2003 20:40:00 +0000 Subject: [PATCH] solaris xinerama fixes, wmsetbg updated for xinerama --- configure.ac | 24 +++++++++++---- src/xinerama.c | 6 ++-- util/wmsetbg.c | 81 ++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 90 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index 8af77209..9f81661d 100644 --- a/configure.ac +++ b/configure.ac @@ -534,13 +534,27 @@ AC_ARG_ENABLE(xinerama, if test "$xinerama" = yes; then AC_CHECK_LIB(Xinerama, XineramaQueryScreens, [XLIBS="-lXinerama $XLIBS" - AC_DEFINE(XINERAMA, 1, [define if you want support for the XINERAMA extension (set by configure)]) - xinerama=yes], - xinerama=no, $XLFLAGS $XLIBS) + xfxine=yes], + xfxine=no, $XLFLAGS $XLIBS) AC_CHECK_LIB(Xext, XineramaGetInfo, - [AC_DEFINE(SOLARIS_XINERAMA, 1, [define if you want support for the XINERAMA extension and are in Solaris (set by configure)]) - ], [], $XLFLAGS $XLIBS) + [sunxine=yes + ], sunxine=no, $XLFLAGS $XLIBS) + + if test "$xfxine" = yes; then + xine=1 + fi + + if test "$sunxine" = yes; then + xine=1 + AC_DEFINE(SOLARIS_XINERAMA, 1, + [define if you want support for the XINERAMA extension and are in Solaris (set by configure)]) + fi + + if test "$xine" = 1; then + AC_DEFINE(XINERAMA, 1, + [define if you want support for the XINERAMA extension (set by configure)]) + fi fi diff --git a/src/xinerama.c b/src/xinerama.c index 202576e5..13b4d29d 100644 --- a/src/xinerama.c +++ b/src/xinerama.c @@ -33,7 +33,7 @@ #ifdef XINERAMA # ifdef SOLARIS_XINERAMA /* sucks */ -# define +# include # else # include # endif @@ -51,11 +51,11 @@ wInitXinerama(WScreen *scr) # ifdef SOLARIS_XINERAMA if (XineramaGetState(dpy, scr->screen)) { WXineramaInfo *info = &scr->xine_info; - XRectangle header[MAXFRAMEBUFFERS]; + XRectangle head[MAXFRAMEBUFFERS]; unsigned char hints[MAXFRAMEBUFFERS]; int i; - if (XineramaGetInfo(dpy, scr->screen, header, hints, + if (XineramaGetInfo(dpy, scr->screen, head, hints, &info->count)) { info->screens = wmalloc(sizeof(WMRect)*(info->count+1)); diff --git a/util/wmsetbg.c b/util/wmsetbg.c index 3a5ed3fc..37efe03e 100644 --- a/util/wmsetbg.c +++ b/util/wmsetbg.c @@ -40,9 +40,14 @@ #include "../src/config.h" #ifdef XINERAMA -#include +# ifdef SOLARIS_XINERAMA /* sucks */ +# include +# else +# include +# endif #endif + #ifdef HAVE_DLFCN_H #include #endif @@ -53,7 +58,13 @@ #include -#define PROG_VERSION "wmsetbg (Window Maker) 2.7" +typedef struct { + WMRect *screens; + int count; /* screen count, 0 = inactive */ +} WXineramaInfo; + + +#define PROG_VERSION "wmsetbg (Window Maker) 2.8" #define WORKSPACE_COUNT (MAX_WORKSPACES+1) @@ -67,10 +78,8 @@ int scrWidth; int scrHeight; int scrX, scrY; -#ifdef XINERAMA -XineramaScreenInfo *xine_screens; -int xine_count; -#endif + +WXineramaInfo xineInfo; Bool smooth = False; @@ -97,6 +106,54 @@ typedef struct BackgroundTexture { +void +initXinerama() +{ + xineInfo.screens = NULL; + xineInfo.count = 0; +#ifdef XINERAMA +# ifdef SOLARIS_XINERAMA + if (XineramaGetState(dpy, scr)) { + XRectangle head[MAXFRAMEBUFFERS]; + unsigned char hints[MAXFRAMEBUFFERS]; + int i; + + if (XineramaGetInfo(dpy, scr, head, hints, + &xineInfo.count)) { + + xineInfo.screens = wmalloc(sizeof(WMRect)*(xineInfo.count+1)); + + for (i=0; ixine_info; + int i; + + xine_screens = XineramaQueryScreens(dpy, &xineInfo.count); + + xineInfo.screens = wmalloc(sizeof(WMRect)*(xineInfo.count+1)); + + for (i=0; iheight = scrHeight; #ifdef XINERAMA - if (xine_count) { + if (xineInfo.count) { int i; - for (i=0; i