Hi,
I just had a first stab at implementing a Xinerama module as outlined in
Tuomo's 2007-01-17 post[0], see attached mod_xinerama.c.
I get my two screens well enough, but whenever I switch from one to the
other, the non-focused screen "goes blank", ie all windows are unmapped
from it. I take it that this is the standard behaviour for switching
inside an mplex, but couldn't figure out how to prevent it.
Hints?
[0] <http://www.mail-archive.com/[email protected]/msg01581.html>
ciao,
--
[*Thomas Themel*] "As the world's richest, most powerful software company,
[extended contact] Microsoft is number one. And you, the millions of
[info provided in] consumers who use our products, are the zeroes."
[*message header*] <http://www.theonion.com/content/node/29130>
/*
* Ion xinerama module
*/
#include <limits.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xinerama.h>
#include <libtu/rb.h>
#include <ioncore/common.h>
#include <ioncore/eventh.h>
#include <ioncore/global.h>
#include <ioncore/event.h>
#include <ioncore/mplex.h>
#include <ioncore/xwindow.h>
#include <ioncore/group-ws.h>
#include <ioncore/sizepolicy.h>
#include <ioncore/../version.h>
#include <stdio.h>
char mod_xinerama_ion_api_version[]=ION_API_VERSION;
static int xinerama_event_base;
static int xinerama_error_base;
bool mod_xinerama_init()
{
WRootWin* rootWin = ioncore_g.rootwins;
Display* dpy = ioncore_g.dpy;
int scrNum,nScreens;
XineramaScreenInfo* sInfo;
WScreen* new;
int nRects;
int i;
if(XineramaQueryExtension(dpy,&xinerama_event_base, &xinerama_error_base))
{
XineramaScreenInfo* sInfo;
sInfo = XineramaQueryScreens(dpy, &nRects);
if(!sInfo)
{
return FALSE ;
}
for(i = 0 ; i < nRects ; ++i)
{
WFitParams fp;
WMPlexAttachParams par = MPLEXATTACHPARAMS_INIT;
WScreen* newScreen;
WRegion* reg=NULL;
printf("Rectangle #%d: x=%d y=%d width=%u height=%u\n",
i+1, sInfo[i].x_org, sInfo[i].y_org, sInfo[i].width,
sInfo[i].height);
fp.g.x = sInfo[i].x_org;
fp.g.y = sInfo[i].y_org;
fp.g.w = sInfo[i].width;
fp.g.h = sInfo[i].height;
fp.mode = REGION_FIT_EXACT;
par.flags = MPLEX_ATTACH_GEOM|MPLEX_ATTACH_SIZEPOLICY ;
par.geom = fp.g;
par.szplcy = SIZEPOLICY_FULL_EXACT;
newScreen = mplex_do_attach_new(&rootWin->scr.mplex, &par,
(WRegionCreateFn*)create_screen, NULL);
if(newScreen == NULL) {
warn(TR("Unable to create Xinerama workspace %d."), i);
XFree(sInfo);
return FALSE;
}
newScreen->id = i ;
}
XFree(sInfo);
rootWin->scr.id = -1;
}
return TRUE;
}
bool mod_xinerama_deinit()
{
return TRUE;
}