1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-03 12:24:17 +01:00

solaris xinerama fixes, wmsetbg updated for xinerama

This commit is contained in:
kojima
2003-06-04 20:40:00 +00:00
parent 4d701d8306
commit ed0d234d7f
3 changed files with 90 additions and 21 deletions

View File

@@ -534,13 +534,27 @@ AC_ARG_ENABLE(xinerama,
if test "$xinerama" = yes; then if test "$xinerama" = yes; then
AC_CHECK_LIB(Xinerama, XineramaQueryScreens, AC_CHECK_LIB(Xinerama, XineramaQueryScreens,
[XLIBS="-lXinerama $XLIBS" [XLIBS="-lXinerama $XLIBS"
AC_DEFINE(XINERAMA, 1, [define if you want support for the XINERAMA extension (set by configure)]) xfxine=yes],
xinerama=yes], xfxine=no, $XLFLAGS $XLIBS)
xinerama=no, $XLFLAGS $XLIBS)
AC_CHECK_LIB(Xext, XineramaGetInfo, 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)]) [sunxine=yes
], [], $XLFLAGS $XLIBS) ], 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 fi

View File

@@ -33,7 +33,7 @@
#ifdef XINERAMA #ifdef XINERAMA
# ifdef SOLARIS_XINERAMA /* sucks */ # ifdef SOLARIS_XINERAMA /* sucks */
# define <X11/extensions/xinerama.h> # include <X11/extensions/xinerama.h>
# else # else
# include <X11/extensions/Xinerama.h> # include <X11/extensions/Xinerama.h>
# endif # endif
@@ -51,11 +51,11 @@ wInitXinerama(WScreen *scr)
# ifdef SOLARIS_XINERAMA # ifdef SOLARIS_XINERAMA
if (XineramaGetState(dpy, scr->screen)) { if (XineramaGetState(dpy, scr->screen)) {
WXineramaInfo *info = &scr->xine_info; WXineramaInfo *info = &scr->xine_info;
XRectangle header[MAXFRAMEBUFFERS]; XRectangle head[MAXFRAMEBUFFERS];
unsigned char hints[MAXFRAMEBUFFERS]; unsigned char hints[MAXFRAMEBUFFERS];
int i; int i;
if (XineramaGetInfo(dpy, scr->screen, header, hints, if (XineramaGetInfo(dpy, scr->screen, head, hints,
&info->count)) { &info->count)) {
info->screens = wmalloc(sizeof(WMRect)*(info->count+1)); info->screens = wmalloc(sizeof(WMRect)*(info->count+1));

View File

@@ -40,9 +40,14 @@
#include "../src/config.h" #include "../src/config.h"
#ifdef XINERAMA #ifdef XINERAMA
#include <X11/extensions/Xinerama.h> # ifdef SOLARIS_XINERAMA /* sucks */
# include <X11/extensions/xinerama.h>
# else
# include <X11/extensions/Xinerama.h>
# endif
#endif #endif
#ifdef HAVE_DLFCN_H #ifdef HAVE_DLFCN_H
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
@@ -53,7 +58,13 @@
#include <wraster.h> #include <wraster.h>
#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) #define WORKSPACE_COUNT (MAX_WORKSPACES+1)
@@ -67,10 +78,8 @@ int scrWidth;
int scrHeight; int scrHeight;
int scrX, scrY; int scrX, scrY;
#ifdef XINERAMA
XineramaScreenInfo *xine_screens; WXineramaInfo xineInfo;
int xine_count;
#endif
Bool smooth = False; 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; i<xineInfo.count; i++) {
xineInfo.screens[i].pos.x = head[i].x;
xineInfo.screens[i].pos.y = head[i].y;
xineInfo.screens[i].size.width = head[i].width;
xineInfo.screens[i].size.height = head[i].height;
}
}
}
# else /* !SOLARIS_XINERAMA */
if (XineramaIsActive(dpy)) {
XineramaInfo *xine_screens;
WXineramaInfo *info = &scr->xine_info;
int i;
xine_screens = XineramaQueryScreens(dpy, &xineInfo.count);
xineInfo.screens = wmalloc(sizeof(WMRect)*(xineInfo.count+1));
for (i=0; i<xineInfo.count; i++) {
xineInfo.screens[i].pos.x = xineInfo.screens[i].x_org;
xineInfo.screens[i].pos.y = xineInfo.screens[i].y_org;
xineInfo.screens[i].size.width = xineInfo.screens[i].width;
xineInfo.screens[i].size.height = xineInfo.screens[i].height;
}
XFree(xine_screens);
}
# endif /* !SOLARIS_XINERAMA */
#endif /* XINERAMA */
}
RImage* RImage*
loadImage(RContext *rc, char *file) loadImage(RContext *rc, char *file)
{ {
@@ -510,12 +567,12 @@ parseTexture(RContext *rc, char *text)
texture->height = scrHeight; texture->height = scrHeight;
#ifdef XINERAMA #ifdef XINERAMA
if (xine_count) { if (xineInfo.count) {
int i; int i;
for (i=0; i<xine_count; ++i) { for (i=0; i<xineInfo.count; ++i) {
applyImage(rc, texture, image, type[0], applyImage(rc, texture, image, type[0],
xine_screens[i].x_org, xine_screens[i].y_org, xineInfo.screens[i].pos.x, xineInfo.screens[i].pos.y,
xine_screens[i].width, xine_screens[i].height); xineInfo.screens[i].size.width, xineInfo.screens[i].size.height);
} }
} else { } else {
applyImage(rc, texture, image, type[0], 0, 0, scrWidth, scrHeight); applyImage(rc, texture, image, type[0], 0, 0, scrWidth, scrHeight);
@@ -1451,9 +1508,7 @@ main(int argc, char **argv)
scrHeight = HeightOfScreen(DefaultScreenOfDisplay(dpy)); scrHeight = HeightOfScreen(DefaultScreenOfDisplay(dpy));
scrX = scrY = 0; scrX = scrY = 0;
#ifdef XINERAMA initXinerama();
xine_screens = XineramaQueryScreens(dpy, &xine_count);
#endif
if (!obey_user && DefaultDepth(dpy, scr) <= 8) if (!obey_user && DefaultDepth(dpy, scr) <= 8)