[argyllcms] Re: Xinerama/MergedFB/TwinView

On Wednesday 16 August 2006 11:00, Frédéric wrote:

> As gqview works fine with my ATI in MergedFB mode (for example, I can
> choose the screen for fullscreen), I've looked in the gtk code to see
> how they handle Xinerama. I'm not a X11 guru, so I don't understand how
> it really works, but I found interesting things in the code. All seems
> to be in dir:

It also exists a little utility in the 'xscreensaver' package called 
test-xinerama. I attached the source. Here is the output on my config 

test-xinerama: 17:37:42: XineramaQueryExtension(dpy, ...) ==> 0, 0
test-xinerama: 17:37:42: XineramaIsActive(dpy) ==> True
test-xinerama: 17:37:42: XineramaQueryVersion(dpy, ...) ==> 1, 1
test-xinerama: 17:37:42: 2 Xinerama screens
test-xinerama: 17:37:42:   screen 0: 1600x1200+0+0
test-xinerama: 17:37:42:   screen 1: 1280x960+1600+0

So it is possible to retreive interesting informations about the second 

Milan, could you check what is the output with your NVidia/TwinView 
config ?


/* test-xinerama.c --- playing with the Xinerama extension.
 * xscreensaver, Copyright (c) 2003 Jamie Zawinski <jwz@xxxxxxx>
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation.  No representations are made about the suitability of this
 * software for any purpose.  It is provided "as is" without express or 
 * implied warranty.

# include "config.h"

#include <stdlib.h>
# include <unistd.h>

#include <stdio.h>
#include <time.h>
#include <sys/time.h>

#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Intrinsic.h>

#include <X11/Xproto.h>
#include <X11/extensions/Xinerama.h>

char *progname = 0;
char *progclass = "XScreenSaver";

static const char *
blurb (void)
  static char buf[255];
  time_t now = time ((time_t *) 0);
  char *ct = (char *) ctime (&now);
  int n = strlen(progname);
  if (n > 100) n = 99;
  strncpy(buf, progname, n);
  buf[n++] = ':';
  buf[n++] = ' ';
  strncpy(buf+n, ct+11, 8);
  strcpy(buf+n+9, ": ");
  return buf;

main (int argc, char **argv)
  int event_number, error_number;
  int major, minor;
  int nscreens = 0;
  XineramaScreenInfo *xsi;
  int i;

  XtAppContext app;
  Widget toplevel_shell = XtAppInitialize (&app, progclass, 0, 0,
                                           &argc, argv, 0, 0, 0);
  Display *dpy = XtDisplay (toplevel_shell);
  XtGetApplicationNameAndClass (dpy, &progname, &progclass);

  if (!XineramaQueryExtension(dpy, &event_number, &error_number))
      fprintf(stderr, "%s: XineramaQueryExtension(dpy, ...) ==> False\n",
      fprintf(stderr, "%s: server does not support the Xinerama extension.\n",
    fprintf(stderr, "%s: XineramaQueryExtension(dpy, ...) ==> %d, %d\n",
            blurb(), event_number, error_number);

  if (!XineramaIsActive(dpy))
      fprintf(stderr, "%s: XineramaIsActive(dpy) ==> False\n", blurb());
      fprintf(stderr, "%s: server says Xinerama is turned off.\n", blurb());
    fprintf(stderr, "%s: XineramaIsActive(dpy) ==> True\n", blurb());

  if (!XineramaQueryVersion(dpy, &major, &minor))
      fprintf(stderr, "%s: XineramaQueryVersion(dpy, ...) ==> False\n",
      fprintf(stderr, "%s: server didn't report Xinerama version numbers?\n",
    fprintf(stderr, "%s: XineramaQueryVersion(dpy, ...) ==> %d, %d\n", blurb(),
            major, minor);

  xsi = XineramaQueryScreens (dpy, &nscreens);
  fprintf(stderr, "%s: %d Xinerama screens\n", blurb(), nscreens);
  for (i = 0; i < nscreens; i++)
    fprintf (stderr, "%s:   screen %d: %dx%d+%d+%d\n",
             xsi[i].width, xsi[i].height,
             xsi[i].x_org, xsi[i].y_org);
  XFree (xsi);
  XSync (dpy, False);
  exit (0);

Other related posts: