/* name: stk_init.cc info: initialization of stk - implementation author: Dusan Halicky (dvh.tosomja@post.sk) licence: GNU GPL history: 2005-09-27 - start of developement todo: - finish and release this bugs: - notes: - */ // system header files #include #include // local header files #include "stk_constants.h" #include "stk_colors.h" #include "stk_display.h" #include "stk_font.h" #include "stk_bitmap.h" // this file header #include "stk_init.h" // debugging #ifdef STK_DEBUG #define STK_INIT_DEBUG #endif // implementation // atoms Atom WM_PROTOCOLS; Atom WM_DELETE_WINDOW; // some MOTIF wm hints currently supported by QVWM Atom MOTIF_WM_HINTS; /*Atom XA_MOTIF_WM_HINTS; Atom MWM_HINTS_DECORATIONS; Atom MWM_DECOR_ALL; Atom MWM_DECOR_TITLE; Atom MWM_DECOR_BORDER; Atom MWM_DECOR_MENU; Atom MWM_DECOR_MINIMIZE; Atom MWM_DECOR_MAXIMIZE;*/ //Atom STK_MESSAGE; //Atom STK_MESSAGE_SET_FOCUS; Window stkmessage_window; Atom stkmessage_atom; Atom stkmessage_state; GC stkgc, stkgc_focus, stkgc_dash; // default GCs bool stkmessage_quit = false; // auxiliary variable void stk_init_atoms(Display *display) { // this initialize some atoms // next atoms is required for properly window close WM_PROTOCOLS = XInternAtom (display, "WM_PROTOCOLS", false); WM_DELETE_WINDOW = XInternAtom (display, "WM_DELETE_WINDOW", false); MOTIF_WM_HINTS = XInternAtom (display, "MOTIF_WM_HINTS", false); /* XA_MOTIF_WM_HINTS = XInternAtom (display, "XA_MOTIF_WM_HINTS", false); MWM_HINTS_DECORATIONS = XInternAtom (display, "MWM_HINTS_DECORATIONS", false); MWM_DECOR_ALL = XInternAtom (display, "MWM_DECOR_ALL", false); MWM_DECOR_TITLE = XInternAtom (display, "MWM_DECOR_TITLE", false); MWM_DECOR_BORDER = XInternAtom (display, "MWM_DECOR_BORDER", false); MWM_DECOR_MENU = XInternAtom (display, "MWM_DECOR_MENU", false); MWM_DECOR_MINIMIZE = XInternAtom (display, "MWM_DECOR_MINIMIZE", false); MWM_DECOR_MAXIMIZE = XInternAtom (display, "MWM_DECOR_MAXIMIZE", false);*/ // STK_MESSAGE = XInternAtom (display, "STK_MESSAGE", false); // STK_MESSAGE_SET_FOCUS = XInternAtom (display, "STK_MESSAGE_SET_FOCUS", false); #ifdef STK_INIT_DEBUG printf("stk_init: atom WM_PROTOCOLS = 0x%X\n",(int)WM_PROTOCOLS); printf("stk_init: atom WM_DELETE_WINDOW = 0x%X\n",(int)WM_DELETE_WINDOW); // printf("stk_init: atom _NET_WM_WINDOW_TYPE = 0x%X\n",(int)_NET_WM_WINDOW_TYPE); // printf("stk_init: atom _NET_WM_WINDOW_TYPE_DIALOG = 0x%X\n",(int)_NET_WM_WINDOW_TYPE_DIALOG); // printf("stk_init: atom STK_MESSAGE = 0x%X\n",(int)STK_MESSAGE); // printf("stk_init: atom STK_MESSAGE_SET_FOCUS = 0x%X\n",(int)STK_MESSAGE_SET_FOCUS); #endif } void stk_init_gc() { // this initialize two default GC - one for fast focus rectangles, one for dashed lines // default gc stkgc = XCreateGC(stkdisplay, stkdisplay_root, 0, 0); // focus gc - xored and dashed XGCValues gcv; unsigned long gcm; char dash[] = {1, 1}; gcv.function = GXxor; gcv.line_width = 1; gcv.foreground = stkcolors[STK_COLOR_GRAY].pixel; // gcv.subwindow_mode = IncludeInferiors; gcm = GCFunction | GCLineWidth | GCForeground ; // | GCSubwindowMode; stkgc_focus = XCreateGC(stkdisplay, stkdisplay_root, gcm, &gcv); XSetDashes(stkdisplay, stkgc_focus, 0, dash, 2); XSetLineAttributes(stkdisplay, stkgc_focus, 0, LineOnOffDash, CapButt, JoinMiter); // dash stkgc_dash = XCreateGC(stkdisplay, stkdisplay_root, 0, 0); XSetDashes(stkdisplay, stkgc_dash, 0, dash, 2); XSetLineAttributes(stkdisplay, stkgc_dash, 0, LineOnOffDash, CapButt, JoinMiter); } void stk_init(void) { // initialize STK parts stk_display_init(); stk_init_atoms(stkdisplay); stk_colors_init(); stk_init_gc(); // stk_event_init(); stk_font_init(); stk_bitmap_init(); } void stk_done(void) { // release STK parts stk_colors_done(); stk_display_done(); // stk_event_done(); stk_font_done(); stk_bitmap_done(); } // end of file