+Window ivac_win,icon_win;
+GC my_gc;
+MiniRGB rgb1,rgb2;
+
+
+void open_window(char *name,char *ivac_mask) {
+
+ /* local variables */
+ int screen,width,height;
+ Window root_win;
+ XSizeHints my_size_hints;
+ XClassHint my_class_hints;
+ Pixel black,white;
+ XGCValues my_gc_val;
+ Pixmap pixmap_mask;
+ XWMHints my_wm_hints;
+
+
+ screen=DefaultScreen(display);
+ root_win=DefaultRootWindow(display);
+
+ width=XBM_WIDTH; /* DisplayWidth(display,screen)/5; */
+ height=XBM_HEIGHT; /* DisplayHeight(diplay,screen)/5; */
+ my_size_hints.flags=USSize;
+ my_size_hints.width=width;
+ my_size_hints.height=height;
+
+ my_class_hints.res_name=name;
+ my_class_hints.res_class=name;
+
+ black=BlackPixel(display,screen);
+ white=WhitePixel(display,screen);
+
+ /* create window */
+ ivac_win=XCreateSimpleWindow(display,root_win,0,0,
+ my_size_hints.width,
+ my_size_hints.height,
+ 1,black,white);
+ icon_win=XCreateSimpleWindow(display,ivac_win,0,0,
+ my_size_hints.width,
+ my_size_hints.height,
+ 1,black,white);
+
+ /* set wm and class hints */
+ XSetWMNormalHints(display,ivac_win,&my_size_hints);
+ XSetClassHint(display,ivac_win,&my_class_hints);
+
+ /* select event input - what are we listening to? */
+ XSelectInput(display,ivac_win,
+ ExposureMask | ButtonPressMask | ButtonReleaseMask |
+ StructureNotifyMask);
+ XSelectInput(display,icon_win,
+ ExposureMask | ButtonPressMask | ButtonReleaseMask |
+ StructureNotifyMask);
+
+ /* set names for windows */
+ XStoreName(display,ivac_win,name);
+ XSetIconName(display,ivac_win,name);
+
+ /* graphics context values */
+ my_gc_val.foreground=black;
+ my_gc_val.background=white;
+ my_gc_val.graphics_exposures=False;
+
+ /* set graphics context */
+ my_gc=XCreateGC(display,ivac_win,
+ GCForeground | GCBackground | GCGraphicsExposures,
+ &my_gc_val);
+
+ /* create pixmap mask and shape windows */
+ pixmap_mask=XCreateBitmapFromData(display,ivac_win,ivac_mask,
+ XBM_WIDTH,XBM_HEIGHT);
+ XShapeCombineMask(display,ivac_win,ShapeBounding,0,0,pixmap_mask,ShapeSet);
+ XShapeCombineMask(display,icon_win,ShapeBounding,0,0,pixmap_mask,ShapeSet);
+
+ /* define and set wmhints */
+ my_wm_hints.initial_state=WithdrawnState;
+ my_wm_hints.flags=StateHint;
+ my_wm_hints.icon_window=icon_win;
+ my_wm_hints.icon_x=my_size_hints.x;
+ my_wm_hints.icon_y=my_size_hints.y;
+ my_wm_hints.window_group=ivac_win;
+ my_wm_hints.flags =
+ StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
+ // XSetWMHints(display,ivac_win,&my_wm_hints);
+
+ /* finaly ... map that stuff ;) */
+ XMapWindow(display,ivac_win);
+
+}
+