1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-28 17:32:29 +01:00

- Fixed Window Maker to compile with xinerama disabled.

- Replaced --disable-xinerama with --enable-xinerama in configure
  (xinerama needs to be enabled when Window Maker is build because
   it's no longer enabled by default)
This commit is contained in:
dan
2002-12-02 03:44:10 +00:00
parent 00638fa5d3
commit 39d250888e
3 changed files with 115 additions and 100 deletions

View File

@@ -526,10 +526,10 @@ fi
dnl XINERAMA support dnl XINERAMA support
dnl ================ dnl ================
xinerama=yes xinerama=no
AC_ARG_ENABLE(xinerama, AC_ARG_ENABLE(xinerama,
[ --disable-xinerama disable XInerama extension support], [ --enable-xinerama enable Xinerama extension support],
xinerama=$enableval, xinerama=yes) xinerama=$enableval, xinerama=no)
if test "$xinerama" = yes; then if test "$xinerama" = yes; then
AC_CHECK_LIB(Xinerama, XineramaQueryScreens, [XLIBS="-lXinerama $XLIBS" AC_CHECK_LIB(Xinerama, XineramaQueryScreens, [XLIBS="-lXinerama $XLIBS"

View File

@@ -35,18 +35,20 @@
#include <X11/extensions/Xinerama.h> #include <X11/extensions/Xinerama.h>
#endif #endif
void wInitXinerama(WScreen *scr) void
wInitXinerama(WScreen *scr)
{ {
scr->xine_screens = 0; scr->xine_primary_head = 0;
scr->xine_count = 0;
#ifdef XINERAMA #ifdef XINERAMA
scr->xine_screens = XineramaQueryScreens(dpy, &scr->xine_count); scr->xine_screens = XineramaQueryScreens(dpy, &scr->xine_count);
#else
scr->xine_count = 0;
#endif #endif
scr->xine_primary_head = 0;
} }
int wGetRectPlacementInfo(WScreen *scr, WMRect rect, int *flags) int
wGetRectPlacementInfo(WScreen *scr, WMRect rect, int *flags)
{ {
int best; int best;
unsigned long area, totalArea; unsigned long area, totalArea;
@@ -57,7 +59,7 @@ int wGetRectPlacementInfo(WScreen *scr, WMRect rect, int *flags)
int rh = rect.size.height; int rh = rect.size.height;
wassertrv(flags!=NULL, 0); wassertrv(flags!=NULL, 0);
best = -1; best = -1;
area = 0; area = 0;
totalArea = 0; totalArea = 0;
@@ -82,13 +84,13 @@ int wGetRectPlacementInfo(WScreen *scr, WMRect rect, int *flags)
#ifdef XINERAMA #ifdef XINERAMA
for (i = 0; i < scr->xine_count; i++) { for (i = 0; i < scr->xine_count; i++) {
unsigned long a; unsigned long a;
a = calcIntersectionArea(rx, ry, rw, rh, a = calcIntersectionArea(rx, ry, rw, rh,
scr->xine_screens[i].x_org, scr->xine_screens[i].x_org,
scr->xine_screens[i].y_org, scr->xine_screens[i].y_org,
scr->xine_screens[i].width, scr->xine_screens[i].width,
scr->xine_screens[i].height); scr->xine_screens[i].height);
totalArea += a; totalArea += a;
if (a > area) { if (a > area) {
if ( best != -1) if ( best != -1)
@@ -111,8 +113,10 @@ int wGetRectPlacementInfo(WScreen *scr, WMRect rect, int *flags)
/* get the head that covers most of the rectangle */ /* get the head that covers most of the rectangle */
int wGetHeadForRect(WScreen *scr, WMRect rect) int
wGetHeadForRect(WScreen *scr, WMRect rect)
{ {
#ifdef XINERAMA
int best; int best;
unsigned long area; unsigned long area;
int i; int i;
@@ -126,17 +130,16 @@ int wGetHeadForRect(WScreen *scr, WMRect rect)
best = -1; best = -1;
area = 0; area = 0;
#ifdef XINERAMA
for (i = 0; i < scr->xine_count; i++) { for (i = 0; i < scr->xine_count; i++) {
unsigned long a; unsigned long a;
a = calcIntersectionArea(rx, ry, rw, rh, a = calcIntersectionArea(rx, ry, rw, rh,
scr->xine_screens[i].x_org, scr->xine_screens[i].x_org,
scr->xine_screens[i].y_org, scr->xine_screens[i].y_org,
scr->xine_screens[i].width, scr->xine_screens[i].width,
scr->xine_screens[i].height); scr->xine_screens[i].height);
if (a > area) { if (a > area) {
area = a; area = a;
best = i; best = i;
@@ -156,7 +159,8 @@ int wGetHeadForRect(WScreen *scr, WMRect rect)
} }
int wGetHeadForWindow(WWindow *wwin) int
wGetHeadForWindow(WWindow *wwin)
{ {
WMRect rect; WMRect rect;
@@ -209,7 +213,8 @@ int wGetHeadForPoint(WScreen *scr, WMPoint point, int *flags)
int wGetHeadForPoint(WScreen *scr, WMPoint point) int
wGetHeadForPoint(WScreen *scr, WMPoint point)
{ {
#ifdef XINERAMA #ifdef XINERAMA
int i; int i;
@@ -226,7 +231,8 @@ int wGetHeadForPoint(WScreen *scr, WMPoint point)
} }
int wGetHeadForPointerLocation(WScreen *scr) int
wGetHeadForPointerLocation(WScreen *scr)
{ {
WMPoint point; WMPoint point;
Window bla; Window bla;
@@ -235,7 +241,7 @@ int wGetHeadForPointerLocation(WScreen *scr)
if (!scr->xine_count) if (!scr->xine_count)
return scr->xine_primary_head; return scr->xine_primary_head;
if (!XQueryPointer(dpy, scr->root_win, &bla, &bla, if (!XQueryPointer(dpy, scr->root_win, &bla, &bla,
&point.x, &point.y, &point.x, &point.y,
&ble, &ble, &ble, &ble,
@@ -256,7 +262,7 @@ wGetRectForHead(WScreen *scr, int head)
rect.pos.x = scr->xine_screens[head].x_org; rect.pos.x = scr->xine_screens[head].x_org;
rect.pos.y = scr->xine_screens[head].y_org; rect.pos.y = scr->xine_screens[head].y_org;
rect.size.width = scr->xine_screens[head].width; rect.size.width = scr->xine_screens[head].width;
rect.size.height = scr->xine_screens[head].height; rect.size.height = scr->xine_screens[head].height;
} else } else
#endif /* XINERAMA */ #endif /* XINERAMA */
{ {
@@ -271,7 +277,8 @@ wGetRectForHead(WScreen *scr, int head)
WArea wGetUsableAreaForHead(WScreen *scr, int head, WArea *totalAreaPtr) WArea
wGetUsableAreaForHead(WScreen *scr, int head, WArea *totalAreaPtr)
{ {
WArea totalArea, usableArea = scr->totalUsableArea; WArea totalArea, usableArea = scr->totalUsableArea;
WMRect rect = wGetRectForHead(scr, head); WMRect rect = wGetRectForHead(scr, head);
@@ -292,7 +299,8 @@ WArea wGetUsableAreaForHead(WScreen *scr, int head, WArea *totalAreaPtr)
} }
WMPoint wGetPointToCenterRectInHead(WScreen *scr, int head, int width, int height) WMPoint
wGetPointToCenterRectInHead(WScreen *scr, int head, int width, int height)
{ {
WMPoint p; WMPoint p;
WMRect rect = wGetRectForHead(scr, head); WMRect rect = wGetRectForHead(scr, head);

View File

@@ -25,7 +25,6 @@
/* /*
* TODO: rewrite, too dirty * TODO: rewrite, too dirty
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@@ -70,7 +69,7 @@ int scrX, scrY;
#ifdef XINERAMA #ifdef XINERAMA
XineramaScreenInfo *xine_screens; XineramaScreenInfo *xine_screens;
int xine_count; int xine_count;
#endif #endif
Bool smooth = False; Bool smooth = False;
@@ -125,82 +124,86 @@ loadImage(RContext *rc, char *file)
} }
void applyImage( RContext * rc, BackgroundTexture *texture, RImage *image, char type, int x, int y, int width, int height) { static void
applyImage(RContext *rc, BackgroundTexture *texture, RImage *image, char type,
int x, int y, int width, int height)
{
int w, h; int w, h;
Bool fimage = False; Bool fimage = False;
switch( toupper(type)) { switch (toupper(type)) {
case 'S': case 'S':
case 'M': case 'M':
if ( type == 'S') { if (type == 'S') {
w = width; w = width;
h = height; h = height;
} else { } else {
if ( image->width*height > image->height*width) { if (image->width*height > image->height*width) {
w = width; w = width;
h = (width*image->height) / image->width; h = (width*image->height) / image->width;
} else { } else {
w = (height*image->width) / image->height; w = (height*image->width) / image->height;
h = height; h = height;
} }
} }
if ( w != image->width || h != image->height) { if (w != image->width || h != image->height) {
RImage * simage; RImage * simage;
if ( smooth) { if (smooth) {
simage = RSmoothScaleImage( image, w, h); simage = RSmoothScaleImage(image, w, h);
} else { } else {
simage = RScaleImage( image, w, h); simage = RScaleImage(image, w, h);
} }
if ( !simage) { if (!simage) {
wwarning( "could not scale image:%s", RMessageForError(RErrorCode)); wwarning("could not scale image:%s", RMessageForError(RErrorCode));
return; return;
} }
fimage = True; fimage = True;
image = simage; image = simage;
} }
/* fall through */ /* fall through */
case 'C': case 'C':
{ {
Pixmap pixmap; Pixmap pixmap;
if ( !RConvertImage(rc, image, &pixmap)) { if (!RConvertImage(rc, image, &pixmap)) {
wwarning( "could not convert texture:%s", RMessageForError(RErrorCode)); wwarning("could not convert texture:%s", RMessageForError(RErrorCode));
return; return;
} }
if ( image->width != width || image->height != height) { if (image->width != width || image->height != height) {
int sx, sy, w, h; int sx, sy, w, h;
if ( image->height < height) { if (image->height < height) {
h = image->height; h = image->height;
y += (height - h) / 2; y += (height - h) / 2;
sy = 0; sy = 0;
} else { } else {
sy = (image->height - height) / 2; sy = (image->height - height) / 2;
h = height; h = height;
} }
if ( image->width < width) { if (image->width < width) {
w = image->width; w = image->width;
x += (width - w) / 2; x += (width - w) / 2;
sx = 0; sx = 0;
} else { } else {
sx = (image->width - width) / 2; sx = (image->width - width) / 2;
w = width; w = width;
} }
XCopyArea(dpy, pixmap, texture->pixmap, DefaultGC(dpy, scr), sx, sy, w, h, x, y); XCopyArea(dpy, pixmap, texture->pixmap, DefaultGC(dpy, scr), sx, sy, w, h, x, y);
} else } else
XCopyArea(dpy, pixmap, texture->pixmap, DefaultGC(dpy, scr), 0, 0, width, height, x, y); XCopyArea(dpy, pixmap, texture->pixmap, DefaultGC(dpy, scr), 0, 0, width, height, x, y);
XFreePixmap(dpy, pixmap); XFreePixmap(dpy, pixmap);
if ( fimage) RReleaseImage( image); if (fimage) {
} RReleaseImage( image);
break; }
}
break;
} }
} }
@@ -588,18 +591,22 @@ parseTexture(RContext *rc, char *text)
texture->color = color; texture->color = color;
texture->width = scrWidth; texture->width = scrWidth;
texture->height = scrHeight; texture->height = scrHeight;
if ( xine_count) { #ifdef XINERAMA
int i; if (xine_count) {
for ( i=0; i<xine_count; ++i) { int i;
applyImage( rc, texture, image, type[0], for (i=0; i<xine_count; ++i) {
xine_screens[i].x_org, xine_screens[i].y_org, applyImage(rc, texture, image, type[0],
xine_screens[i].width, xine_screens[i].height); xine_screens[i].x_org, xine_screens[i].y_org,
xine_screens[i].width, xine_screens[i].height);
} }
} else { } else {
applyImage( rc, texture, image, type[0], 0, 0, scrWidth, scrHeight); applyImage(rc, texture, image, type[0], 0, 0, scrWidth, scrHeight);
} }
RReleaseImage( image); #else
applyImage(rc, texture, image, type[0], 0, 0, scrWidth, scrHeight);
#endif
RReleaseImage(image);
} }
break; break;
#endif #endif