1 #include <../../nrnconf.h> 2 #if HAVE_IV // to end of file 4 #include <IV-X11/xcanvas.h> 5 #include <IV-X11/xwindow.h> 6 #include <IV-X11/xdisplay.h> 7 #include <InterViews/display.h> 8 #include <InterViews/session.h> 9 #include <InterViews/style.h> 17 void get_position(XDisplay* dpy, XWindow window,
int* rx,
int* ry);
19 static bool r_unbound;
21 if (c->rep()->copybuffer_ == CanvasRep::unbound) {
30 if (r_unbound ==
true) {
49 xplace(xleft(), xtop());
52 XWithdrawWindow(
display()->rep()->display_, w.xwindow_,
display()->rep()->screen_);
61 get_position(
display()->rep()->display_, w.xwindow_, &x, &y);
74 get_position(
display()->rep()->display_, w.xwindow_, &x, &y);
90 static int xoff = -999, yoff = -999;
95 Style*
q = Session::instance()->style();
96 Coord WMOffsetX, WMOffsetY;
98 if (xoff == -999 && yoff == -999) {
99 if (!q->find_attribute(
"window_manager_offset_x", WMOffsetX)) {
102 if (!q->find_attribute(
"window_manager_offset_y", WMOffsetY)) {
105 xoff = (
int)WMOffsetX;
106 yoff = (
int)WMOffsetY;
110 XMoveWindow(d.rep()->display_, w.xwindow_, left1+xoff, top+yoff);
113 static Bool WaitForEvent(XDisplay *dpy, XEvent *
event,
char *
type) {
114 return (Bool)(
event->type == (
int)type);
122 static int xoff = 0, yoff = 0;
124 get_position(d.rep()->display_, w.xwindow_, &
x, &
y);
126 for (
int i= 0; (left1 != x || top !=
y) &&
i < 10;
i++) {
127 XMoveWindow(d.rep()->display_, w.xwindow_,
128 left1+xoff, top+yoff);
129 XPeekIfEvent(d.rep()->display_, &
event, WaitForEvent,
130 (
char *)ConfigureNotify);
131 get_position(d.rep()->display_, w.xwindow_, &
x, &
y);
133 if (left1 != x || top != y) {
134 XIfEvent(d.rep()->display_, &
event, WaitForEvent,
135 (
char *)ConfigureNotify);
139 printf(
"x=%d y=%d, left1=%d top=%d xoff = %d yoff = %d\n",
140 x, y, left1, top, xoff, yoff);
147 const Display& d = *w.display_;
148 w.glyph_->request(w.shape_);
151 ((
OcGlyph*)glyph())->def_size(width, height);
153 w.canvas_->size(width, height);
156 w.left_ = d.to_coord(xleft_);
157 w.bottom_ = d.to_coord(d.pheight() - xtop_ - w.canvas_->pheight());
159 w.xpos_ = d.to_pixels(w.left_);
160 w.ypos_ = d.pheight() - d.to_pixels(w.bottom_) - w.canvas_->pheight();
162 w.xpos_ -= d.to_pixels(w.xalign_ * width);
163 w.ypos_ += d.to_pixels(w.yalign_ * height);
168 PixelCoord pw = d.to_pixels(width), ph = d.to_pixels(height);
169 l = (l < d.pwidth() - pw) ? l : d.pwidth() - pw;
170 b = (b < d.pheight() - ph) ? b : d.pheight() - ph;
180 #include <X11/Xlib.h> 181 #include <X11/Xutil.h> 182 #include <X11/Xatom.h> 184 #include <X11/extensions/shape.h> 185 #include <X11/Xmu/WinUtil.h> 189 void get_position(XDisplay* dpy, XWindow window,
int* rx,
int* ry)
191 XWindowAttributes win_attributes;
194 if (!XGetWindowAttributes(dpy, window, &win_attributes)) {
195 fprintf(stderr,
"Can't get window attributes.");
198 (
void) XTranslateCoordinates (dpy, window, win_attributes.root,
void xmove(int left, int top)
fprintf(stderr, "Don't know the location of params at %p\, pp)
const Event & event() const
void xplace(int left, int top)
void rubber_off(Canvas *)
virtual void default_geometry()