Bool XDoesSaveUnders(Screen *s) { return (DoesSaveUnders(s)); }
/*###################### dir_expose_handler_line() ######################*/ void dir_expose_handler_line(Widget w, XtPointer client_data, XmDrawingAreaCallbackStruct *call_data) { static int ft_exposure_line = 0; /* first time exposure line. */ /* * To ensure that widgets are realized before calling XtAppAddTimeOut() * we wait for the widget to get its first expose event. This should * take care of the nasty BadDrawable error on slow connections. */ if (ft_exposure_line == 0) { int bs_attribute, i; Dimension height; Screen *c_screen = ScreenOfDisplay(display, DefaultScreen(display)); XFillRectangle(display, line_pixmap, default_bg_gc, 0, 0, window_width, (line_height * no_of_rows)); for (i = 0; i < no_of_dirs; i++) { draw_dir_line_status(i, 1); } (void)XtAppAddTimeOut(app, redraw_time_line, (XtTimerCallbackProc)check_dir_status, w); ft_exposure_line = 1; if ((bs_attribute = DoesBackingStore(c_screen)) != NotUseful) { XSetWindowAttributes attr; attr.backing_store = bs_attribute; attr.save_under = DoesSaveUnders(c_screen); XChangeWindowAttributes(display, line_window, CWBackingStore | CWSaveUnder, &attr); XChangeWindowAttributes(display, label_window, CWBackingStore, &attr); if (no_input == False) { XChangeWindowAttributes(display, XtWindow(mw[DIR_W]), CWBackingStore, &attr); if ((dcp.show_slog != NO_PERMISSION) || (dcp.show_rlog != NO_PERMISSION) || (dcp.show_tlog != NO_PERMISSION) || (dcp.show_ilog != NO_PERMISSION) || (dcp.show_olog != NO_PERMISSION) || (dcp.show_elog != NO_PERMISSION) || (dcp.info != NO_PERMISSION)) { XChangeWindowAttributes(display, XtWindow(mw[LOG_W]), CWBackingStore, &attr); } XChangeWindowAttributes(display, XtWindow(mw[CONFIG_W]), CWBackingStore, &attr); #ifdef _WITH_HELP_PULLDOWN XChangeWindowAttributes(display, XtWindow(mw[HELP_W]), CWBackingStore, &attr); #endif } /* if (no_input == False) */ } /* * Calculate the magic unkown height factor we need to add to the * height of the widget when it is being resized. */ XtVaGetValues(appshell, XmNheight, &height, NULL); magic_value = height - (window_height + line_height + glyph_height); } else { XEvent *p_event = call_data->event; XCopyArea(display, line_pixmap, line_window, color_letter_gc, p_event->xexpose.x, p_event->xexpose.y, p_event->xexpose.width, p_event->xexpose.height, p_event->xexpose.x, p_event->xexpose.y); } XFlush(display); return; }
Menu::Menu(WindowManager *manager, XEvent *e) : m_items(0), m_nItems(0), m_nHidden(0), m_hasSubmenus(False), m_windowManager(manager), m_event(e) { if (!m_initialised) { XGCValues *values; XSetWindowAttributes *attr; m_menuGC = (GC *) malloc(m_windowManager->screensTotal() * sizeof(GC)); m_window = (Window *) malloc(m_windowManager->screensTotal() * sizeof(Window)); #ifdef CONFIG_USE_XFT char *fi = strdup(CONFIG_MENU_FONT); char *ffi = fi, *tokstr = fi; while ((fi = strtok(tokstr, ","))) { fprintf(stderr, "fi = \"%s\"\n", fi); tokstr = 0; FcPattern *pattern = FcPatternCreate(); FcPatternAddString(pattern, FC_FAMILY, (FcChar8 *)fi); FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); #ifndef FC_WEIGHT_REGULAR #define FC_WEIGHT_REGULAR FC_WEIGHT_MEDIUM #endif FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_REGULAR); FcPatternAddInteger(pattern, FC_PIXEL_SIZE, CONFIG_MENU_FONT_SIZE); FcConfigSubstitute(FcConfigGetCurrent(), pattern, FcMatchPattern); FcResult result = FcResultMatch; FcPattern *match = FcFontMatch(FcConfigGetCurrent(), pattern, &result); FcPatternDestroy(pattern); if (!match || result != FcResultMatch) { if (match) FcPatternDestroy(match); continue; } m_font = XftFontOpenPattern(display(), match); if (m_font) break; FcPatternDestroy(match); } free(ffi); if (!m_font) { m_windowManager->fatal("couldn't load menu Xft font"); } m_xftColour = (XftColor *) malloc(m_windowManager->screensTotal() * sizeof(XftColor)); m_xftDraw = (XftDraw **) malloc(m_windowManager->screensTotal() * sizeof(XftDraw *)); #else m_font = (XFontStruct **) malloc(m_windowManager->screensTotal() * sizeof(XFontStruct *)); #endif values = (XGCValues *) malloc(m_windowManager->screensTotal() * sizeof(XGCValues)); attr = (XSetWindowAttributes *) malloc(m_windowManager->screensTotal() * sizeof(XSetWindowAttributes)); for (int i = 0; i < m_windowManager->screensTotal(); i++) { m_foreground = m_windowManager->allocateColour (i, CONFIG_MENU_FOREGROUND, "menu foreground"); m_background = m_windowManager->allocateColour (i, CONFIG_MENU_BACKGROUND, "menu background"); m_border = m_windowManager->allocateColour (i, CONFIG_MENU_BORDERS, "menu border"); #ifndef CONFIG_USE_XFT char **ml; int mc; char *ds; m_fontset = XCreateFontSet(display(), CONFIG_NICE_MENU_FONT, &ml, &mc, &ds); if (!m_fontset) m_fontset = XCreateFontSet(display(), CONFIG_NASTY_FONT, &ml, &mc, &ds); if (m_fontset) { XFontStruct **fs_list; XFontsOfFontSet(m_fontset, &fs_list, &ml); m_font[i] = fs_list[0]; } else { m_font[i] = NULL; } #define XDrawString(t,u,v,w,x,y,z) XmbDrawString(t,u,m_fontset,v,w,x,y,z) if (!m_font[i]) m_windowManager->fatal("couldn't load menu font\n"); #endif values[i].background = m_background; values[i].foreground = m_foreground ^ m_background; values[i].function = GXxor; values[i].line_width = 0; values[i].subwindow_mode = IncludeInferiors; #ifndef CONFIG_USE_XFT values[i].font = m_font[i]->fid; #endif m_menuGC[i] = XCreateGC (display(), m_windowManager->mroot(i), GCForeground | GCBackground | GCFunction | GCLineWidth | GCSubwindowMode, &values[i]); #ifndef CONFIG_USE_XFT XChangeGC(display(), Border::drawGC(m_windowManager, i), GCFont, &values[i]); #endif m_window[i] = XCreateSimpleWindow (display(), m_windowManager->mroot(i), 0, 0, 1, 1, 1, m_border, m_background); #if ( CONFIG_USE_PIXMAPS != False ) && ( CONFIG_USE_PIXMAP_MENUS != False ) attr[i].background_pixmap = Border::backgroundPixmap(manager); #endif attr[i].save_under = (DoesSaveUnders(ScreenOfDisplay(display(), i)) ? True : False); #if ( CONFIG_USE_PIXMAPS != False ) && ( CONFIG_USE_PIXMAP_MENUS != False ) XChangeWindowAttributes (display(), m_window[i], CWBackPixmap, &attr[i]); #endif XChangeWindowAttributes (display(), m_window[i], CWSaveUnder, &attr[i]); #ifdef CONFIG_USE_XFT XftColorAllocName (display(), XDefaultVisual(display(), i), XDefaultColormap(display(), i), CONFIG_MENU_FOREGROUND, &m_xftColour[i]); m_xftDraw[i] = XftDrawCreate(display(), m_window[i], XDefaultVisual(display(), i), XDefaultColormap(display(), i)); #endif } m_initialised = True; } }