1 #include <../../nrnconf.h>
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) {
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_, left1 + xoff, top + yoff);
128 XPeekIfEvent(d.rep()->display_, &event, WaitForEvent, (
char*) ConfigureNotify);
129 get_position(d.rep()->display_, w.xwindow_, &x, &y);
131 if (left1 != x || top != y) {
132 XIfEvent(d.rep()->display_, &event, WaitForEvent, (
char*) ConfigureNotify);
136 printf(
"x=%d y=%d, left1=%d top=%d xoff = %d yoff = %d\n", x, y, left1, top, xoff, yoff);
143 const Display& d = *w.display_;
144 w.glyph_->request(w.shape_);
149 w.canvas_->size(width, height);
152 w.left_ = d.to_coord(
xleft_);
153 w.bottom_ = d.to_coord(d.pheight() -
xtop_ - w.canvas_->pheight());
155 w.xpos_ = d.to_pixels(w.left_);
156 w.ypos_ = d.pheight() - d.to_pixels(w.bottom_) - w.canvas_->pheight();
158 w.xpos_ -= d.to_pixels(w.xalign_ * width);
159 w.ypos_ += d.to_pixels(w.yalign_ * height);
164 PixelCoord pw = d.to_pixels(width), ph = d.to_pixels(height);
165 l = (l < d.pwidth() - pw) ? l : d.pwidth() - pw;
166 b = (b < d.pheight() - ph) ? b : d.pheight() - ph;
176 #include <X11/Xlib.h>
177 #include <X11/Xutil.h>
178 #include <X11/Xatom.h>
180 #include <X11/extensions/shape.h>
181 #include <X11/Xmu/WinUtil.h>
185 void get_position(XDisplay* dpy, XWindow window,
int* rx,
int* ry) {
186 XWindowAttributes win_attributes;
189 if (!XGetWindowAttributes(dpy, window, &win_attributes)) {
190 fprintf(stderr,
"Can't get window attributes.");
193 (void) XTranslateCoordinates(
194 dpy, window, win_attributes.root, -win_attributes.x, -win_attributes.y, rx, ry, &junkwin);
virtual Glyph * glyph() const
virtual void default_geometry()
void xmove(int left, int top)
void xplace(int left, int top)
void rubber_off(Canvas *)