115 G4warn <<
"G4RTXScanner::Initialize(): cannot get display."
120 int screen_num = DefaultScreen(
display);
123 int xOffset = 0, yOffset = 0;
124 XSizeHints* size_hints = XAllocSizeHints();
125 unsigned int width, height;
127 if (!XGeometryString.empty()) {
128 G4int geometryResultMask = XParseGeometry
129 ((
char*)XGeometryString.c_str(),
130 &xOffset, &yOffset, &width, &height);
131 if (geometryResultMask & (WidthValue | HeightValue)) {
132 if (geometryResultMask & XValue) {
133 if (geometryResultMask & XNegative) {
134 xOffset = DisplayWidth(
display, screen_num) + xOffset - width;
136 size_hints->flags |= PPosition;
137 size_hints->x = xOffset;
139 if (geometryResultMask & YValue) {
140 if (geometryResultMask & YNegative) {
141 yOffset = DisplayHeight(
display, screen_num) + yOffset - height;
143 size_hints->flags |= PPosition;
144 size_hints->y = yOffset;
147 G4warn <<
"ERROR: Geometry string \""
149 <<
"\" invalid. Using \"600x600\"."
155 G4warn <<
"ERROR: Geometry string \""
157 <<
"\" is empty. Using \"600x600\"."
162 size_hints->width = width;
163 size_hints->height = height;
164 size_hints->flags |= PSize;
166 win = XCreateSimpleWindow
168 xOffset, yOffset, width, height,
170 WhitePixel(
display, screen_num),
171 BlackPixel(
display, screen_num));
177 Status status = XGetRGBColormaps
179 &
scmap, &nMaps, XA_RGB_BEST_MAP);
181 system(
"xstdcmap -best");
182 status = XGetRGBColormaps
184 &
scmap, &nMaps, XA_RGB_BEST_MAP);
187 "G4RTXScanner::Initialize(): cannot get color map."
188 "\n Perhaps your system does not support XA_RGB_BEST_MAP."
193 if (!
scmap->colormap) {
194 G4warn <<
"G4RTXScanner::Initialize(): color map empty."
199 XWMHints* wm_hints = XAllocWMHints();
200 XClassHint* class_hint = XAllocClassHint();
201 const char* window_name = name.c_str();
202 XTextProperty windowName;
203 XStringListToTextProperty((
char**)&window_name, 1, &windowName);
205 XSetWMProperties(
display,
win, &windowName, &windowName,
206 0, 0, size_hints, wm_hints, class_hint);
211 XSelectInput(
display,
win, StructureNotifyMask);