screens.c

来自「安装DDD之前」· C语言 代码 · 共 1,482 行 · 第 1/4 页

C
1,482
字号
	scr->components[MWM_ICON].bottom_shadow_pixmap != XmUNSPECIFIED_PIXMAP)    {	gcm = GCTile | GCFillStyle;	gcv.tile = scr->components[MWM_ICON].bottom_shadow_pixmap;	gcv.fill_style = FillTiled;    }    else    {	gcm = GCForeground | GCBackground;	gcv.foreground = scr->components[MWM_ICON].bottom_shadow_color;	gcv.background = scr->components[MWM_ICON].background;    }    gcm |= GCLineWidth | GCLineStyle | GCCapStyle |	GCGraphicsExposures;    gcv.line_width = 0;    gcv.line_style = LineSolid;    gcv.cap_style = CapButt;    gcv.graphics_exposures = False;    scr->components[MWM_ICON].bot_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);    gcm = GCFunction | GCPlaneMask | GCGraphicsExposures | GCLineWidth |	GCForeground | GCBackground | GCFont;    gcv.line_width = 0;    gcv.function = GXcopy;    gcv.plane_mask = AllPlanes;    gcv.font = scr->components[MWM_ICON].font->fid;    /*     * Prevent GraphicsExpose and NoExpose events.  We'd only get NoExpose     * events anyway;  they cause BadWindow errors from XGetWindowAttributes     * call in FindScreenInfo (events.c) (since drawable is a pixmap).     */    gcv.graphics_exposures = False;    gcv.foreground = scr->components[MWM_ICON].active_foreground;    gcv.background = scr->components[MWM_ICON].active_background;    scr->components[MWM_ICON].active_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);    if (scr->components[MWM_ICON].active_top_shadow_pixmap != None &&    scr->components[MWM_ICON].active_top_shadow_pixmap != XmUNSPECIFIED_PIXMAP)    {	gcm = GCTile | GCFillStyle;	gcv.tile = scr->components[MWM_ICON].active_top_shadow_pixmap;	gcv.fill_style = FillTiled;    }    else    {	gcm = GCForeground | GCBackground;	gcv.foreground = scr->components[MWM_ICON].active_top_shadow_color;	gcv.background = scr->components[MWM_ICON].active_background;    }    gcm |= GCLineWidth | GCLineStyle | GCCapStyle |	GCGraphicsExposures;    gcv.line_width = 0;    gcv.line_style = LineSolid;    gcv.cap_style = CapButt;    gcv.graphics_exposures = False;    scr->components[MWM_ICON].active_top_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);    if (scr->components[MWM_ICON].active_bottom_shadow_pixmap != None &&	scr->components[MWM_ICON].active_bottom_shadow_pixmap != XmUNSPECIFIED_PIXMAP)    {	gcm = GCTile | GCFillStyle;	gcv.tile = scr->components[MWM_ICON].active_bottom_shadow_pixmap;	gcv.fill_style = FillTiled;    }    else    {	gcm = GCForeground | GCBackground;	gcv.foreground = scr->components[MWM_ICON].active_bottom_shadow_color;	gcv.background = scr->components[MWM_ICON].active_background;    }    gcm |= GCLineWidth | GCLineStyle | GCCapStyle |	GCGraphicsExposures;    gcv.line_width = 0;    gcv.line_style = LineSolid;    gcv.cap_style = CapButt;    gcv.graphics_exposures = False;    scr->components[MWM_ICON].active_bot_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);}/* * create the GC's for the title_area */static voidcreate_title_gcs(ScreenInfo *scr){    XGCValues gcv;    unsigned long gcm;    gcm = GCFunction | GCPlaneMask | GCGraphicsExposures | GCLineWidth |	GCForeground | GCBackground | GCFont;    gcv.line_width = 0;    gcv.function = GXcopy;    gcv.plane_mask = AllPlanes;    if (scr->components[MWM_TITLE_A].font_list == NULL)	scr->components[MWM_TITLE_A].font_list = _XmFontListCreateDefault(dpy);    _XmFontListGetDefaultFont(scr->components[MWM_TITLE_A].font_list,                    &scr->components[MWM_TITLE_A].font);    gcv.font = scr->components[MWM_TITLE_A].font->fid;    if (scr->components[MWM_TITLE_A].font)    {	scr->components[MWM_TITLE_A].f_height =	    scr->components[MWM_TITLE_A].font->ascent +	    scr->components[MWM_TITLE_A].font->descent;	scr->components[MWM_TITLE_A].f_y =	    scr->components[MWM_TITLE_A].font->ascent;    }    /*     * Prevent GraphicsExpose and NoExpose events.  We'd only get NoExpose     * events anyway;  they cause BadWindow errors from XGetWindowAttributes     * call in FindScreenInfo (events.c) (since drawable is a pixmap).     */    gcv.graphics_exposures = False;    gcv.foreground = scr->components[MWM_TITLE_A].foreground;    gcv.background = scr->components[MWM_TITLE_A].background;    scr->components[MWM_TITLE_A].normal_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);    scr->components[MWM_TITLE_A].grayed_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);    XSetFillStyle(dpy, scr->components[MWM_TITLE_A].grayed_GC, FillOpaqueStippled);    if (scr->components[MWM_TITLE_A].top_shadow_pixmap != None &&	scr->components[MWM_TITLE_A].top_shadow_pixmap != XmUNSPECIFIED_PIXMAP)    {	gcm = GCTile | GCFillStyle;	gcv.tile = scr->components[MWM_TITLE_A].top_shadow_pixmap;	gcv.fill_style = FillTiled;    }    else    {	gcm = GCForeground | GCBackground;	gcv.foreground = scr->components[MWM_TITLE_A].top_shadow_color;	gcv.background = scr->components[MWM_TITLE_A].background;    }    gcm |= GCLineWidth | GCLineStyle | GCCapStyle |	GCGraphicsExposures;    gcv.line_width = 0;    gcv.line_style = LineSolid;    gcv.cap_style = CapButt;    gcv.graphics_exposures = False;    scr->components[MWM_TITLE_A].top_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);    if (scr->components[MWM_TITLE_A].bottom_shadow_pixmap != None &&     scr->components[MWM_TITLE_A].bottom_shadow_pixmap != XmUNSPECIFIED_PIXMAP)    {	gcm = GCTile | GCFillStyle;	gcv.tile = scr->components[MWM_TITLE_A].bottom_shadow_pixmap;	gcv.fill_style = FillTiled;    }    else    {	gcm = GCForeground | GCBackground;	gcv.foreground = scr->components[MWM_TITLE_A].bottom_shadow_color;	gcv.background = scr->components[MWM_TITLE_A].background;    }    gcm |= GCLineWidth | GCLineStyle | GCCapStyle |	GCGraphicsExposures;    gcv.line_width = 0;    gcv.line_style = LineSolid;    gcv.cap_style = CapButt;    gcv.graphics_exposures = False;    scr->components[MWM_TITLE_A].bot_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);    gcm = GCFunction | GCPlaneMask | GCGraphicsExposures | GCLineWidth |	GCForeground | GCBackground | GCFont;    gcv.line_width = 0;    gcv.function = GXcopy;    gcv.plane_mask = AllPlanes;    gcv.font = scr->components[MWM_TITLE_A].font->fid;    /*     * Prevent GraphicsExpose and NoExpose events.  We'd only get NoExpose     * events anyway;  they cause BadWindow errors from XGetWindowAttributes     * call in FindScreenInfo (events.c) (since drawable is a pixmap).     */    gcv.graphics_exposures = False;    gcv.foreground = scr->components[MWM_TITLE_A].active_foreground;    gcv.background = scr->components[MWM_TITLE_A].active_background;    scr->components[MWM_TITLE_A].active_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);    if (scr->components[MWM_TITLE_A].active_top_shadow_pixmap != None &&	scr->components[MWM_TITLE_A].active_top_shadow_pixmap != XmUNSPECIFIED_PIXMAP)    {	gcm = GCTile | GCFillStyle;	gcv.tile = scr->components[MWM_TITLE_A].active_top_shadow_pixmap;	gcv.fill_style = FillTiled;    }    else    {	gcm = GCForeground | GCBackground;	gcv.foreground = scr->components[MWM_TITLE_A].active_top_shadow_color;	gcv.background = scr->components[MWM_TITLE_A].active_background;    }    gcm |= GCLineWidth | GCLineStyle | GCCapStyle |	GCGraphicsExposures;    gcv.line_width = 0;    gcv.line_style = LineSolid;    gcv.cap_style = CapButt;    gcv.graphics_exposures = False;    scr->components[MWM_TITLE_A].active_top_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);    if (scr->components[MWM_TITLE_A].active_bottom_shadow_pixmap != None &&	scr->components[MWM_TITLE_A].active_bottom_shadow_pixmap != XmUNSPECIFIED_PIXMAP)    {	gcm = GCTile | GCFillStyle;	gcv.tile = scr->components[MWM_TITLE_A].active_bottom_shadow_pixmap;	gcv.fill_style = FillTiled;    }    else    {	gcm = GCForeground | GCBackground;	gcv.foreground = scr->components[MWM_TITLE_A].active_bottom_shadow_color;	gcv.background = scr->components[MWM_TITLE_A].active_background;    }    gcm |= GCLineWidth | GCLineStyle | GCCapStyle |	GCGraphicsExposures;    gcv.line_width = 0;    gcv.line_style = LineSolid;    gcv.cap_style = CapButt;    gcv.graphics_exposures = False;    scr->components[MWM_TITLE_A].active_bot_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);}/* * create the GC's for the resize handles */static voidcreate_resize_h_gcs(ScreenInfo *scr){    XGCValues gcv;    unsigned long gcm;    if (scr->components[MWM_RESIZE_H].top_shadow_pixmap != None &&	scr->components[MWM_RESIZE_H].top_shadow_pixmap != XmUNSPECIFIED_PIXMAP)    {	gcm = GCTile | GCFillStyle;	gcv.tile = scr->components[MWM_RESIZE_H].top_shadow_pixmap;	gcv.fill_style = FillTiled;    }    else    {	gcm = GCForeground | GCBackground;	gcv.foreground = scr->components[MWM_RESIZE_H].top_shadow_color;	gcv.background = scr->components[MWM_RESIZE_H].background;    }    gcm |= GCLineWidth | GCLineStyle | GCCapStyle |	GCGraphicsExposures;    gcv.line_width = 0;    gcv.line_style = LineSolid;    gcv.cap_style = CapButt;    gcv.graphics_exposures = False;    scr->components[MWM_RESIZE_H].top_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);    if (scr->components[MWM_RESIZE_H].bottom_shadow_pixmap != None &&    scr->components[MWM_RESIZE_H].bottom_shadow_pixmap != XmUNSPECIFIED_PIXMAP)    {	gcm = GCTile | GCFillStyle;	gcv.tile = scr->components[MWM_RESIZE_H].bottom_shadow_pixmap;	gcv.fill_style = FillTiled;    }    else    {	gcm = GCForeground | GCBackground;	gcv.foreground = scr->components[MWM_RESIZE_H].bottom_shadow_color;	gcv.background = scr->components[MWM_RESIZE_H].background;    }    gcm |= GCLineWidth | GCLineStyle | GCCapStyle |	GCGraphicsExposures;    gcv.line_width = 0;    gcv.line_style = LineSolid;    gcv.cap_style = CapButt;    gcv.graphics_exposures = False;    scr->components[MWM_RESIZE_H].bot_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);    if (scr->components[MWM_RESIZE_H].active_top_shadow_pixmap != None &&	scr->components[MWM_RESIZE_H].active_top_shadow_pixmap != XmUNSPECIFIED_PIXMAP)    {	gcm = GCTile | GCFillStyle;	gcv.tile = scr->components[MWM_RESIZE_H].active_top_shadow_pixmap;	gcv.fill_style = FillTiled;    }    else    {	gcm = GCForeground | GCBackground;	gcv.foreground = scr->components[MWM_RESIZE_H].active_top_shadow_color;	gcv.background = scr->components[MWM_RESIZE_H].active_background;    }    gcm |= GCLineWidth | GCLineStyle | GCCapStyle |	GCGraphicsExposures;    gcv.line_width = 0;    gcv.line_style = LineSolid;    gcv.cap_style = CapButt;    gcv.graphics_exposures = False;    scr->components[MWM_RESIZE_H].active_top_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);    if (scr->components[MWM_RESIZE_H].active_bottom_shadow_pixmap != None &&	scr->components[MWM_RESIZE_H].active_bottom_shadow_pixmap != XmUNSPECIFIED_PIXMAP)    {	gcm = GCTile | GCFillStyle;	gcv.tile = scr->components[MWM_RESIZE_H].active_bottom_shadow_pixmap;	gcv.fill_style = FillTiled;    }    else    {	gcm = GCForeground | GCBackground;	gcv.foreground = scr->components[MWM_RESIZE_H].active_bottom_shadow_color;	gcv.background = scr->components[MWM_RESIZE_H].active_background;    }    gcm |= GCLineWidth | GCLineStyle | GCCapStyle |	GCGraphicsExposures;    gcv.line_width = 0;    gcv.line_style = LineSolid;    gcv.cap_style = CapButt;    gcv.graphics_exposures = False;    scr->components[MWM_RESIZE_H].active_bot_GC =	XCreateGC(dpy, scr->root_win, gcm, &gcv);}/* * create the GC's for the border */static voidcreate_border_gcs(ScreenInfo *scr){    XGCValues gcv;    unsigned long gcm;    if (scr->components[MWM_BORDER].top_shadow_pixmap != None &&	scr->components[MWM_BORDER].top_shadow_pixmap != XmUNSPECIFIED_PIXMAP)    {

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?