Path: utzoo!utgpu!watmath!clyde!att!rutgers!mailrus!wasatch!cs.utexas.edu!milano!titan!janssen@titan.sw.mcc.com From: janssen@titan.sw.mcc.com (Bill Janssen) Newsgroups: comp.windows.x Subject: Re: Multiple Virtual Monochrome Screens for Sun CG2 Message-ID: <1648@titan.sw.mcc.com> Date: 1 Dec 88 21:02:15 GMT References: <8811302337.AA08445@cleo.sw.mcc.com> Sender: janssen@titan.sw.mcc.com Reply-To: janssen@titan.sw.mcc.com (Bill Janssen) Organization: MCC Software Technology Lines: 73 In-reply-to: peterson@SW.MCC.COM (James Peterson) Another way to move to a desired screen when running Jim Peterson's virtual screen variation of X11 is to simply warp the mouse to the desired X screen. The following is a simple program which takes a single integer argument, the number of the screen to be selected, and warps the mouse to it. It can be called as a shell function from twm or rtl, allowing them to work with the virtual screen system. #include#define TRUE 1 #define FALSE 0 typedef int Boolean; #define AND && #define OR || #define NOT ! #include #include #include /* for isdigit */ main (ac, av, envp) int ac; char **av; char **envp; { Window root, child; int root_x, root_y, win_x, win_y; unsigned int mask; int newscreen; Display *disp; freopen ("/dev/console", "a", stderr); if (ac < 2 OR NOT(isdigit(*av[1]))) { fprintf (stderr, "Usage: warptoscreen \n"); return 1; } newscreen = atoi(av[1]); disp = XOpenDisplay (NULL); if (disp == NULL) { fprintf (stderr, "Usage: can't access X11 display\n"); return 1; } if (newscreen >= ScreenCount(disp)) { fprintf (stderr, "Can't warp to screen %d; only %d screens\n", newscreen, ScreenCount(disp)); return 1; } /* get current mouse position */ XQueryPointer (disp, DefaultRootWindow(disp), &root, &child, &root_x, &root_y, &win_x, &win_y, &mask); XWarpPointer (disp, None, RootWindow(disp, newscreen), 0, 0, 0, 0, root_x, root_y); XCloseDisplay (disp); return 0; } --