1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

xinerama stuff for solaris

This commit is contained in:
kojima
2003-06-04 18:57:03 +00:00
parent 479ccbda82
commit 5dbb770aa4
8 changed files with 108 additions and 67 deletions

View File

@@ -84,7 +84,7 @@ Changes since version 0.80.2:
- Updated single-click contrib patch (steve lion <steve.lion@verizon.net> - Updated single-click contrib patch (steve lion <steve.lion@verizon.net>
and vlaad) and vlaad)
- Updated French translations (Antoine Hulin <antoine@origan.fdn.org>) - Updated French translations (Antoine Hulin <antoine@origan.fdn.org>)
- Xinerama support for Solaris
Changes since version 0.80.1: Changes since version 0.80.1:
............................. .............................

View File

@@ -532,8 +532,15 @@ AC_ARG_ENABLE(xinerama,
xinerama=$enableval, xinerama=no) 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,
AC_DEFINE(XINERAMA, 1, [define if you want support for the XINERAMA extension (set by configure)])], [XLIBS="-lXinerama $XLIBS"
AC_DEFINE(XINERAMA, 1, [define if you want support for the XINERAMA extension (XFree86 version/set by configure)])
xinerama=yes],
xinerama=no, $XLFLAGS $XLIBS)
AC_CHECK_LIB(Xext, XineramaGetInfo,
[AC_DEFINE(SOLARIS_XINERAMA, 1, [define if you want support for the XINERAMA extension (Solaris version/set by configure)])
xinerama=yes],
xinerama=no, $XLFLAGS $XLIBS) xinerama=no, $XLFLAGS $XLIBS)
fi fi

View File

@@ -420,7 +420,7 @@ wMaximizeWindow(WWindow *wwin, int directions)
totalArea.x2 = wwin->screen_ptr->scr_width; totalArea.x2 = wwin->screen_ptr->scr_width;
totalArea.y2 = wwin->screen_ptr->scr_height; totalArea.y2 = wwin->screen_ptr->scr_height;
if (wwin->screen_ptr->xine_count > 0 if (wwin->screen_ptr->xine_info.count > 0
&& !(directions & MAX_IGNORE_XINERAMA)) { && !(directions & MAX_IGNORE_XINERAMA)) {
WScreen *scr = wwin->screen_ptr; WScreen *scr = wwin->screen_ptr;
WMRect rect; WMRect rect;

View File

@@ -125,7 +125,7 @@ moveGeometryDisplayCentered(WScreen *scr, int x, int y)
y -= h / 2; y -= h / 2;
/* dead area check */ /* dead area check */
if (scr->xine_count) { if (scr->xine_info.count) {
WMRect rect; WMRect rect;
int head, flags; int head, flags;

View File

@@ -28,10 +28,6 @@
#include <WINGs/WUtil.h> #include <WINGs/WUtil.h>
#ifdef XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
#define WTB_LEFT 0 #define WTB_LEFT 0
#define WTB_RIGHT 1 #define WTB_RIGHT 1
@@ -42,6 +38,15 @@
#define WTB_MENU 6 #define WTB_MENU 6
typedef struct {
WMRect *screens;
int count; /* screen count, 0 = inactive */
int primary_head; /* main working screen */
} WXineramaInfo;
/* an area of the screen reserved by some window */ /* an area of the screen reserved by some window */
typedef struct WReservedArea { typedef struct WReservedArea {
WArea area; WArea area;
@@ -92,12 +97,8 @@ typedef struct _WScreen {
Visual *w_visual; Visual *w_visual;
int w_depth; int w_depth;
Colormap w_colormap; /* our colormap */ Colormap w_colormap; /* our colormap */
#ifdef XINERAMA WXineramaInfo xine_info;
XineramaScreenInfo *xine_screens;
#endif
int xine_count; /* 0 means not active */
int xine_primary_head; /* main working screen */
Window no_focus_win; /* window to get focus when nobody Window no_focus_win; /* window to get focus when nobody
* else can do it */ * else can do it */

View File

@@ -1135,7 +1135,7 @@ wManageWindow(WScreen *scr, Window window)
if (wPreferences.window_placement == WPM_MANUAL) if (wPreferences.window_placement == WPM_MANUAL)
dontBring = True; dontBring = True;
} }
else if (scr->xine_count && else if (scr->xine_info.count &&
wwin->normal_hints->flags & PPosition) { wwin->normal_hints->flags & PPosition) {
int head, flags; int head, flags;
WMRect rect; WMRect rect;

View File

@@ -1,7 +1,7 @@
/* /*
* Window Maker window manager * Window Maker window manager
* *
* Copyright (c) 1997-2001 Alfredo K. Kojima * Copyright (c) 1997-2003 Alfredo K. Kojima
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -32,18 +32,62 @@
#include "funcs.h" #include "funcs.h"
#ifdef XINERAMA #ifdef XINERAMA
#include <X11/extensions/Xinerama.h> # ifdef SOLARIS_XINERAMA /* sucks */
# define <X11/extensions/xinerama.h>
# else
# include <X11/extensions/Xinerama.h>
# endif
#endif #endif
void void
wInitXinerama(WScreen *scr) wInitXinerama(WScreen *scr)
{ {
scr->xine_primary_head = 0; scr->xine_info.primary_head = 0;
scr->xine_info.screens = NULL;
scr->xine_info.count = 0;
#ifdef XINERAMA #ifdef XINERAMA
scr->xine_screens = XineramaQueryScreens(dpy, &scr->xine_count); # ifdef SOLARIS_XINERAMA
#else if (XineramaGetState(dpy, scr->screen)) {
scr->xine_count = 0; WXineramaInfo *info = &scr->xine_info;
#endif XRectangle header[MAXFRAMEBUFFERS];
unsigned char hints[MAXFRAMEBUFFERS];
int i;
if (XineramaGetInfo(dpy, scr->screen, header, hints,
&info->count)) {
info->screens = wmalloc(sizeof(WMRect)*(info->count+1));
for (i=0; i<info->count; i++) {
info->screens[i].pos.x = head[i].x;
info->screens[i].pos.y = head[i].y;
info->screens[i].size.width = head[i].width;
info->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, &info->count);
info->screens = wmalloc(sizeof(WMRect)*(info->count+1));
for (i=0; i<info->count; i++) {
info->screens[i].pos.x = info->screens[i].x_org;
info->screens[i].pos.y = info->screens[i].y_org;
info->screens[i].size.width = info->screens[i].width;
info->screens[i].size.height = info->screens[i].height;
}
XFree(xine_screens);
}
# endif /* !SOLARIS_XINERAMA */
#endif /* XINERAMA */
} }
@@ -66,7 +110,7 @@ wGetRectPlacementInfo(WScreen *scr, WMRect rect, int *flags)
*flags = XFLAG_NONE; *flags = XFLAG_NONE;
if (scr->xine_count <= 1) { if (scr->xine_info.count <= 1) {
unsigned long a; unsigned long a;
a = calcIntersectionArea(rx, ry, rw, rh, a = calcIntersectionArea(rx, ry, rw, rh,
@@ -78,18 +122,17 @@ wGetRectPlacementInfo(WScreen *scr, WMRect rect, int *flags)
*flags |= XFLAG_PARTIAL; *flags |= XFLAG_PARTIAL;
} }
return scr->xine_primary_head; return scr->xine_info.primary_head;
} }
#ifdef XINERAMA for (i = 0; i < scr->xine_info.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_info.screens[i].pos.x,
scr->xine_screens[i].y_org, scr->xine_info.screens[i].pos.y,
scr->xine_screens[i].width, scr->xine_info.screens[i].size.width,
scr->xine_screens[i].height); scr->xine_info.screens[i].size.height);
totalArea += a; totalArea += a;
if (a > area) { if (a > area) {
@@ -107,7 +150,6 @@ wGetRectPlacementInfo(WScreen *scr, WMRect rect, int *flags)
*flags |= XFLAG_PARTIAL; *flags |= XFLAG_PARTIAL;
return best; return best;
#endif
} }
@@ -116,7 +158,6 @@ wGetRectPlacementInfo(WScreen *scr, WMRect rect, int *flags)
int int
wGetHeadForRect(WScreen *scr, WMRect rect) wGetHeadForRect(WScreen *scr, WMRect rect)
{ {
#ifdef XINERAMA
int best; int best;
unsigned long area; unsigned long area;
int i; int i;
@@ -125,20 +166,20 @@ wGetHeadForRect(WScreen *scr, WMRect rect)
int rw = rect.size.width; int rw = rect.size.width;
int rh = rect.size.height; int rh = rect.size.height;
if (!scr->xine_count) if (!scr->xine_info.count)
return scr->xine_primary_head; return scr->xine_info.primary_head;
best = -1; best = -1;
area = 0; area = 0;
for (i = 0; i < scr->xine_count; i++) { for (i = 0; i < scr->xine_info.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_info.screens[i].pos.x,
scr->xine_screens[i].y_org, scr->xine_info.screens[i].pos.y,
scr->xine_screens[i].width, scr->xine_info.screens[i].size.width,
scr->xine_screens[i].height); scr->xine_info.screens[i].size.height);
if (a > area) { if (a > area) {
area = a; area = a;
@@ -153,9 +194,6 @@ wGetHeadForRect(WScreen *scr, WMRect rect)
best = wGetHeadForPointerLocation(scr); best = wGetHeadForPointerLocation(scr);
return best; return best;
#else /* !XINERAMA */
return scr->xine_primary_head;
#endif /* !XINERAMA */
} }
@@ -185,19 +223,19 @@ int wGetHeadForPoint(WScreen *scr, WMPoint point, int *flags)
} }
*flags = XFLAG_NONE; *flags = XFLAG_NONE;
for (i = 0; i < scr->xine_count; i++) { for (i = 0; i < scr->xine_info.count; i++) {
#if 0 #if 0
int yy, xx; int yy, xx;
xx = scr->xine_screens[i].x_org + scr->xine_screens[i].width; xx = scr->xine_info.screens[i].pos.x + scr->xine_info.screens[i].size.width;
yy = scr->xine_screens[i].y_org + scr->xine_screens[i].height; yy = scr->xine_info.screens[i].pos.y + scr->xine_info.screens[i].size.height;
if (point.x >= scr->xine_screens[i].x_org && if (point.x >= scr->xine_info.screens[i].pos.x &&
point.y >= scr->xine_screens[i].y_org && point.y >= scr->xine_info.screens[i].pos.y &&
point.x < xx && point.y < yy) { point.x < xx && point.y < yy) {
return i; return i;
} }
#else #else
XineramaScreenInfo *xsi = &scr->xine_screens[i]; XineramaScreenInfo *xsi = &scr->xine_info.screens[i];
if ((unsigned)(point.x - xsi->x_org) < xsi->width && if ((unsigned)(point.x - xsi->x_org) < xsi->width &&
(unsigned)(point.y - xsi->y_org) < xsi->height) (unsigned)(point.y - xsi->y_org) < xsi->height)
@@ -216,18 +254,16 @@ int wGetHeadForPoint(WScreen *scr, WMPoint point, int *flags)
int int
wGetHeadForPoint(WScreen *scr, WMPoint point) wGetHeadForPoint(WScreen *scr, WMPoint point)
{ {
#ifdef XINERAMA
int i; int i;
for (i = 0; i < scr->xine_count; i++) { for (i = 0; i < scr->xine_info.count; i++) {
XineramaScreenInfo *xsi = &scr->xine_screens[i]; WMRect *rect = &scr->xine_info.screens[i];
if ((unsigned)(point.x - xsi->x_org) < xsi->width && if ((unsigned)(point.x - rect->pos.x) < rect->size.width &&
(unsigned)(point.y - xsi->y_org) < xsi->height) (unsigned)(point.y - rect->pos.y) < rect->size.height)
return i; return i;
} }
#endif /* XINERAMA */ return scr->xine_info.primary_head;
return scr->xine_primary_head;
} }
@@ -239,14 +275,14 @@ wGetHeadForPointerLocation(WScreen *scr)
int ble; int ble;
unsigned int blo; unsigned int blo;
if (!scr->xine_count) if (!scr->xine_info.count)
return scr->xine_primary_head; return scr->xine_info.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,
&blo)) &blo))
return scr->xine_primary_head; return scr->xine_info.primary_head;
return wGetHeadForPoint(scr, point); return wGetHeadForPoint(scr, point);
} }
@@ -257,14 +293,12 @@ wGetRectForHead(WScreen *scr, int head)
{ {
WMRect rect; WMRect rect;
#ifdef XINERAMA if (head < scr->xine_info.count) {
if (head < scr->xine_count) { rect.pos.x = scr->xine_info.screens[head].pos.x;
rect.pos.x = scr->xine_screens[head].x_org; rect.pos.y = scr->xine_info.screens[head].pos.y;
rect.pos.y = scr->xine_screens[head].y_org; rect.size.width = scr->xine_info.screens[head].size.width;
rect.size.width = scr->xine_screens[head].width; rect.size.height = scr->xine_info.screens[head].size.height;
rect.size.height = scr->xine_screens[head].height;
} else } else
#endif /* XINERAMA */
{ {
rect.pos.x = 0; rect.pos.x = 0;
rect.pos.y = 0; rect.pos.y = 0;

View File

@@ -1,4 +1,3 @@
/* /*
* Window Maker window manager * Window Maker window manager
* *