13 |
|
#include "standard.h" |
14 |
|
#include "view.h" |
15 |
|
#include <X11/Xlib.h> |
16 |
– |
#include <X11/cursorfont.h> |
16 |
|
#include <X11/Xutil.h> |
17 |
|
|
18 |
|
#define NSEG 30 /* number of segments per circle */ |
60 |
|
init(name) /* set up vector drawing from pick */ |
61 |
|
char *name; |
62 |
|
{ |
63 |
+ |
extern Window xfindwind(); |
64 |
|
XWindowAttributes wa; |
65 |
– |
XEvent xev; |
65 |
|
XColor xc; |
66 |
|
XGCValues gcv; |
67 |
|
/* get the viewing parameters */ |
78 |
|
progname); |
79 |
|
exit(1); |
80 |
|
} |
82 |
– |
pickcursor = XCreateFontCursor(theDisplay, XC_target); |
81 |
|
/* find our window */ |
82 |
< |
while (XGrabPointer(theDisplay, rwind, True, ButtonPressMask, |
83 |
< |
GrabModeAsync, GrabModeAsync, None, pickcursor, |
84 |
< |
CurrentTime) != GrabSuccess) |
85 |
< |
sleep(2); |
88 |
< |
printf("%s: click mouse in \"%s\" display window\n", progname, name); |
89 |
< |
XNextEvent(theDisplay, &xev); |
90 |
< |
XUngrabPointer(theDisplay, CurrentTime); |
91 |
< |
if (((XButtonEvent *)&xev)->subwindow == None) { |
92 |
< |
fprintf(stderr, "%s: no window selected\n", progname); |
82 |
> |
gwind = xfindwind(theDisplay, rwind, name, 2); |
83 |
> |
if (gwind == None) { |
84 |
> |
fprintf(stderr, "%s: cannot find \"%s\" window\n", |
85 |
> |
progname, name); |
86 |
|
exit(1); |
87 |
|
} |
88 |
< |
gwind = ((XButtonEvent *)&xev)->subwindow; |
96 |
< |
XRaiseWindow(theDisplay, gwind); |
88 |
> |
XMapRaised(theDisplay, gwind); |
89 |
|
XGetWindowAttributes(theDisplay, gwind, &wa); |
90 |
|
sleep(4); |
91 |
|
if (wa.width != xres || wa.height != yres) { |