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:
@@ -84,7 +84,7 @@ Changes since version 0.80.2:
|
||||
- Updated single-click contrib patch (steve lion <steve.lion@verizon.net>
|
||||
and vlaad)
|
||||
- Updated French translations (Antoine Hulin <antoine@origan.fdn.org>)
|
||||
|
||||
- Xinerama support for Solaris
|
||||
|
||||
Changes since version 0.80.1:
|
||||
.............................
|
||||
|
||||
11
configure.ac
11
configure.ac
@@ -532,8 +532,15 @@ AC_ARG_ENABLE(xinerama,
|
||||
xinerama=$enableval, xinerama=no)
|
||||
|
||||
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)])],
|
||||
AC_CHECK_LIB(Xinerama, XineramaQueryScreens,
|
||||
[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)
|
||||
fi
|
||||
|
||||
|
||||
@@ -420,7 +420,7 @@ wMaximizeWindow(WWindow *wwin, int directions)
|
||||
totalArea.x2 = wwin->screen_ptr->scr_width;
|
||||
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)) {
|
||||
WScreen *scr = wwin->screen_ptr;
|
||||
WMRect rect;
|
||||
|
||||
@@ -125,7 +125,7 @@ moveGeometryDisplayCentered(WScreen *scr, int x, int y)
|
||||
y -= h / 2;
|
||||
|
||||
/* dead area check */
|
||||
if (scr->xine_count) {
|
||||
if (scr->xine_info.count) {
|
||||
WMRect rect;
|
||||
int head, flags;
|
||||
|
||||
|
||||
19
src/screen.h
19
src/screen.h
@@ -28,10 +28,6 @@
|
||||
|
||||
#include <WINGs/WUtil.h>
|
||||
|
||||
#ifdef XINERAMA
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define WTB_LEFT 0
|
||||
#define WTB_RIGHT 1
|
||||
@@ -42,6 +38,15 @@
|
||||
#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 */
|
||||
typedef struct WReservedArea {
|
||||
WArea area;
|
||||
@@ -93,11 +98,7 @@ typedef struct _WScreen {
|
||||
int w_depth;
|
||||
Colormap w_colormap; /* our colormap */
|
||||
|
||||
#ifdef XINERAMA
|
||||
XineramaScreenInfo *xine_screens;
|
||||
#endif
|
||||
int xine_count; /* 0 means not active */
|
||||
int xine_primary_head; /* main working screen */
|
||||
WXineramaInfo xine_info;
|
||||
|
||||
Window no_focus_win; /* window to get focus when nobody
|
||||
* else can do it */
|
||||
|
||||
@@ -1135,7 +1135,7 @@ wManageWindow(WScreen *scr, Window window)
|
||||
if (wPreferences.window_placement == WPM_MANUAL)
|
||||
dontBring = True;
|
||||
}
|
||||
else if (scr->xine_count &&
|
||||
else if (scr->xine_info.count &&
|
||||
wwin->normal_hints->flags & PPosition) {
|
||||
int head, flags;
|
||||
WMRect rect;
|
||||
|
||||
134
src/xinerama.c
134
src/xinerama.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -32,18 +32,62 @@
|
||||
#include "funcs.h"
|
||||
|
||||
#ifdef XINERAMA
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
# ifdef SOLARIS_XINERAMA /* sucks */
|
||||
# define <X11/extensions/xinerama.h>
|
||||
# else
|
||||
# include <X11/extensions/Xinerama.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void
|
||||
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
|
||||
scr->xine_screens = XineramaQueryScreens(dpy, &scr->xine_count);
|
||||
#else
|
||||
scr->xine_count = 0;
|
||||
#endif
|
||||
# ifdef SOLARIS_XINERAMA
|
||||
if (XineramaGetState(dpy, scr->screen)) {
|
||||
WXineramaInfo *info = &scr->xine_info;
|
||||
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;
|
||||
|
||||
if (scr->xine_count <= 1) {
|
||||
if (scr->xine_info.count <= 1) {
|
||||
unsigned long a;
|
||||
|
||||
a = calcIntersectionArea(rx, ry, rw, rh,
|
||||
@@ -78,18 +122,17 @@ wGetRectPlacementInfo(WScreen *scr, WMRect rect, int *flags)
|
||||
*flags |= XFLAG_PARTIAL;
|
||||
}
|
||||
|
||||
return scr->xine_primary_head;
|
||||
return scr->xine_info.primary_head;
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
for (i = 0; i < scr->xine_count; i++) {
|
||||
for (i = 0; i < scr->xine_info.count; i++) {
|
||||
unsigned long a;
|
||||
|
||||
a = calcIntersectionArea(rx, ry, rw, rh,
|
||||
scr->xine_screens[i].x_org,
|
||||
scr->xine_screens[i].y_org,
|
||||
scr->xine_screens[i].width,
|
||||
scr->xine_screens[i].height);
|
||||
scr->xine_info.screens[i].pos.x,
|
||||
scr->xine_info.screens[i].pos.y,
|
||||
scr->xine_info.screens[i].size.width,
|
||||
scr->xine_info.screens[i].size.height);
|
||||
|
||||
totalArea += a;
|
||||
if (a > area) {
|
||||
@@ -107,7 +150,6 @@ wGetRectPlacementInfo(WScreen *scr, WMRect rect, int *flags)
|
||||
*flags |= XFLAG_PARTIAL;
|
||||
|
||||
return best;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +158,6 @@ wGetRectPlacementInfo(WScreen *scr, WMRect rect, int *flags)
|
||||
int
|
||||
wGetHeadForRect(WScreen *scr, WMRect rect)
|
||||
{
|
||||
#ifdef XINERAMA
|
||||
int best;
|
||||
unsigned long area;
|
||||
int i;
|
||||
@@ -125,20 +166,20 @@ wGetHeadForRect(WScreen *scr, WMRect rect)
|
||||
int rw = rect.size.width;
|
||||
int rh = rect.size.height;
|
||||
|
||||
if (!scr->xine_count)
|
||||
return scr->xine_primary_head;
|
||||
if (!scr->xine_info.count)
|
||||
return scr->xine_info.primary_head;
|
||||
|
||||
best = -1;
|
||||
area = 0;
|
||||
|
||||
for (i = 0; i < scr->xine_count; i++) {
|
||||
for (i = 0; i < scr->xine_info.count; i++) {
|
||||
unsigned long a;
|
||||
|
||||
a = calcIntersectionArea(rx, ry, rw, rh,
|
||||
scr->xine_screens[i].x_org,
|
||||
scr->xine_screens[i].y_org,
|
||||
scr->xine_screens[i].width,
|
||||
scr->xine_screens[i].height);
|
||||
scr->xine_info.screens[i].pos.x,
|
||||
scr->xine_info.screens[i].pos.y,
|
||||
scr->xine_info.screens[i].size.width,
|
||||
scr->xine_info.screens[i].size.height);
|
||||
|
||||
if (a > area) {
|
||||
area = a;
|
||||
@@ -153,9 +194,6 @@ wGetHeadForRect(WScreen *scr, WMRect rect)
|
||||
best = wGetHeadForPointerLocation(scr);
|
||||
|
||||
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;
|
||||
|
||||
for (i = 0; i < scr->xine_count; i++) {
|
||||
for (i = 0; i < scr->xine_info.count; i++) {
|
||||
#if 0
|
||||
int yy, xx;
|
||||
|
||||
xx = scr->xine_screens[i].x_org + scr->xine_screens[i].width;
|
||||
yy = scr->xine_screens[i].y_org + scr->xine_screens[i].height;
|
||||
if (point.x >= scr->xine_screens[i].x_org &&
|
||||
point.y >= scr->xine_screens[i].y_org &&
|
||||
xx = scr->xine_info.screens[i].pos.x + scr->xine_info.screens[i].size.width;
|
||||
yy = scr->xine_info.screens[i].pos.y + scr->xine_info.screens[i].size.height;
|
||||
if (point.x >= scr->xine_info.screens[i].pos.x &&
|
||||
point.y >= scr->xine_info.screens[i].pos.y &&
|
||||
point.x < xx && point.y < yy) {
|
||||
return i;
|
||||
}
|
||||
#else
|
||||
XineramaScreenInfo *xsi = &scr->xine_screens[i];
|
||||
XineramaScreenInfo *xsi = &scr->xine_info.screens[i];
|
||||
|
||||
if ((unsigned)(point.x - xsi->x_org) < xsi->width &&
|
||||
(unsigned)(point.y - xsi->y_org) < xsi->height)
|
||||
@@ -216,18 +254,16 @@ int wGetHeadForPoint(WScreen *scr, WMPoint point, int *flags)
|
||||
int
|
||||
wGetHeadForPoint(WScreen *scr, WMPoint point)
|
||||
{
|
||||
#ifdef XINERAMA
|
||||
int i;
|
||||
|
||||
for (i = 0; i < scr->xine_count; i++) {
|
||||
XineramaScreenInfo *xsi = &scr->xine_screens[i];
|
||||
for (i = 0; i < scr->xine_info.count; i++) {
|
||||
WMRect *rect = &scr->xine_info.screens[i];
|
||||
|
||||
if ((unsigned)(point.x - xsi->x_org) < xsi->width &&
|
||||
(unsigned)(point.y - xsi->y_org) < xsi->height)
|
||||
if ((unsigned)(point.x - rect->pos.x) < rect->size.width &&
|
||||
(unsigned)(point.y - rect->pos.y) < rect->size.height)
|
||||
return i;
|
||||
}
|
||||
#endif /* XINERAMA */
|
||||
return scr->xine_primary_head;
|
||||
return scr->xine_info.primary_head;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,14 +275,14 @@ wGetHeadForPointerLocation(WScreen *scr)
|
||||
int ble;
|
||||
unsigned int blo;
|
||||
|
||||
if (!scr->xine_count)
|
||||
return scr->xine_primary_head;
|
||||
if (!scr->xine_info.count)
|
||||
return scr->xine_info.primary_head;
|
||||
|
||||
if (!XQueryPointer(dpy, scr->root_win, &bla, &bla,
|
||||
&point.x, &point.y,
|
||||
&ble, &ble,
|
||||
&blo))
|
||||
return scr->xine_primary_head;
|
||||
return scr->xine_info.primary_head;
|
||||
|
||||
return wGetHeadForPoint(scr, point);
|
||||
}
|
||||
@@ -257,14 +293,12 @@ wGetRectForHead(WScreen *scr, int head)
|
||||
{
|
||||
WMRect rect;
|
||||
|
||||
#ifdef XINERAMA
|
||||
if (head < scr->xine_count) {
|
||||
rect.pos.x = scr->xine_screens[head].x_org;
|
||||
rect.pos.y = scr->xine_screens[head].y_org;
|
||||
rect.size.width = scr->xine_screens[head].width;
|
||||
rect.size.height = scr->xine_screens[head].height;
|
||||
if (head < scr->xine_info.count) {
|
||||
rect.pos.x = scr->xine_info.screens[head].pos.x;
|
||||
rect.pos.y = scr->xine_info.screens[head].pos.y;
|
||||
rect.size.width = scr->xine_info.screens[head].size.width;
|
||||
rect.size.height = scr->xine_info.screens[head].size.height;
|
||||
} else
|
||||
#endif /* XINERAMA */
|
||||
{
|
||||
rect.pos.x = 0;
|
||||
rect.pos.y = 0;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Window Maker window manager
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user