106 G4warn <<
"G4RTXScanner::Initialize(): cannot get display."
111 int screen_num = DefaultScreen(
display);
114 int xOffset = 0, yOffset = 0;
115 XSizeHints* size_hints = XAllocSizeHints();
116 unsigned int width, height;
118 if (!XGeometryString.empty()) {
119 G4int geometryResultMask = XParseGeometry
120 ((
char*)XGeometryString.c_str(),
121 &xOffset, &yOffset, &width, &height);
122 if (geometryResultMask & (WidthValue | HeightValue)) {
123 if (geometryResultMask & XValue) {
124 if (geometryResultMask & XNegative) {
125 xOffset = DisplayWidth(
display, screen_num) + xOffset - width;
127 size_hints->flags |= PPosition;
128 size_hints->x = xOffset;
130 if (geometryResultMask & YValue) {
131 if (geometryResultMask & YNegative) {
132 yOffset = DisplayHeight(
display, screen_num) + yOffset - height;
134 size_hints->flags |= PPosition;
135 size_hints->y = yOffset;
138 G4warn <<
"ERROR: Geometry string \""
140 <<
"\" invalid. Using \"600x600\"."
146 G4warn <<
"ERROR: Geometry string \""
148 <<
"\" is empty. Using \"600x600\"."
153 size_hints->width = width;
154 size_hints->height = height;
155 size_hints->flags |= PSize;
157 win = XCreateSimpleWindow
159 xOffset, yOffset, width, height,
161 WhitePixel(
display, screen_num),
162 BlackPixel(
display, screen_num));
168 Status status = XGetRGBColormaps
170 &
scmap, &nMaps, XA_RGB_BEST_MAP);
172 system(
"xstdcmap -best");
173 status = XGetRGBColormaps
175 &
scmap, &nMaps, XA_RGB_BEST_MAP);
178 "G4RTXScanner::Initialize(): cannot get color map."
179 "\n Perhaps your system does not support XA_RGB_BEST_MAP."
184 if (!
scmap->colormap) {
185 G4warn <<
"G4RTXScanner::Initialize(): color map empty."
190 XWMHints* wm_hints = XAllocWMHints();
191 XClassHint* class_hint = XAllocClassHint();
192 const char* window_name = name.c_str();
193 XTextProperty windowName;
194 XStringListToTextProperty((
char**)&window_name, 1, &windowName);
196 XSetWMProperties(
display,
win, &windowName, &windowName,
197 0, 0, size_hints, wm_hints, class_hint);
202 XSelectInput(
display,
win, StructureNotifyMask);