if X11
long gcflags;
XGCValues gcv;
gcv.foreground = 100000;
gcv.function = GXcopy;
gcv.subwindow_mode = IncludeInferiors;
gcflags = GCForeground | GCFunction | GCSubwindowMode;
//X11 GC
x11GC = XCreateGC(x11Disp, x11Rootw, gcflags, &gcv);
XColor fg;
fg.red = (int)((float)color.red() * 65535.0 / 255.0);
fg.green = (int)((float)color.green() * 65535.0 / 255.0);
fg.blue = (int)((float)color.blue() * 65535.0 / 255.0);
//X11 Colormap
XAllocColor(x11Disp, x11Colormap, &fg);
XSetForeground(x11Disp, x11GC, fg.pixel);
XDrawRectangle(x11Disp, x11Rootw, x11GC, x, y, w, h);
XFlush(x11Disp);
else if WIN32
m_currPen.setColor(color);
p.setPen(m_currPen);
p.drawRect(x, y, w, h);
if X11
x11Disp = QPaintDevice::x11AppDisplay();
x11Screen = QPaintDevice::x11AppScreen();
x11Rootw = QPaintDevice::x11AppRootWindow();
long gcflags;
XGCValues gcv;
gcv.foreground = 100000;
gcv.function = GXcopy;
gcv.subwindow_mode = IncludeInferiors;
gcflags = GCForeground | GCFunction | GCSubwindowMode;
//X11 GC
x11GC = XCreateGC(x11Disp, x11Rootw, gcflags, &gcv);
XColor fg;
fg.red = (int)((float)color.red() * 65535.0 / 255.0);
fg.green = (int)((float)color.green() * 65535.0 / 255.0);
fg.blue = (int)((float)color.blue() * 65535.0 / 255.0);
//X11 Colormap
x11Colormap = QPaintDevice::x11AppColormap(x11Screen);
XAllocColor(x11Disp, x11Colormap, &fg);
XSetForeground(x11Disp, x11GC, fg.pixel);
XDrawRectangle(x11Disp, x11Rootw, x11GC, x, y, w, h);
XFlush(x11Disp);
else if WIN32
QPainter p(QApplication::desktop());
m_currPen.setColor(color);
p.setPen(m_currPen);
p.drawRect(x, y, w, h);
To copy to clipboard, switch view to plain text mode
Bookmarks