📄 screens.c
字号:
/* $Id: screens.c,v 1.1 2004/08/28 19:25:46 dannybackx Exp $ *//*****************************************************************************//** Copyright 1988 by Evans & Sutherland Computer Corporation, **//** Salt Lake City, Utah **//** Portions Copyright 1989 by the Massachusetts Institute of Technology **//** Cambridge, Massachusetts **//** **//** All Rights Reserved **//** **//** Permission to use, copy, modify, and distribute this software and **//** its documentation for any purpose and without fee is hereby **//** granted, provided that the above copyright notice appear in all **//** copies and that both that copyright notice and this permis- **//** sion notice appear in supporting documentation, and that the **//** names of Evans & Sutherland and M.I.T. not be used in advertising **//** in publicity pertaining to distribution of the software without **//** specific, written prior permission. **//** **//** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **//** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **//** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **//** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **//** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **//** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **//** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **//** OR PERFORMANCE OF THIS SOFTWARE. **//*****************************************************************************//**************************************************************************** * This module is based on Twm, but has been siginificantly modified * by Rob Nation ****************************************************************************//*********************************************************************** * The rest of it is all my fault -- MLM * mwm - "LessTif Window Manager" ***********************************************************************/#include <LTconfig.h>#include <stdio.h>#include <X11/keysym.h>#include <Xm/XmP.h>#include <Xm/MwmUtil.h>#include <XmI/XmI.h>#include "mwm.h"/* amai: Unfortunately X11 forgot about non-case-sensitive filesystems which may have problems to store both "X11/bitmaps/Stipple" and "X11/bitmaps/stipple". So we inline the few lines here instead. */#if 0#include <X11/bitmaps/stipple>#else#define stipple_width 16#define stipple_height 4static char stipple_bits[] = { 0x55, 0x55, 0xee, 0xee, 0x55, 0x55, 0xba, 0xbb};#endif /* #if 0 *//* * create the GC's for the menus */static voidcreate_menu_gcs(ScreenInfo *scr){ XGCValues gcv; unsigned long gcm; gcm = GCFunction | GCPlaneMask | GCGraphicsExposures | GCLineWidth | GCForeground | GCBackground | GCFont; gcv.line_width = 0; gcv.plane_mask = AllPlanes; gcv.function = GXcopy; if (scr->components[MWM_MENU].font_list == NULL) scr->components[MWM_MENU].font_list = _XmFontListCreateDefault(dpy); _XmFontListGetDefaultFont(scr->components[MWM_MENU].font_list, &scr->components[MWM_MENU].font); gcv.font = scr->components[MWM_MENU].font->fid; if (scr->components[MWM_MENU].font) { scr->components[MWM_MENU].f_height = scr->components[MWM_MENU].font->ascent + scr->components[MWM_MENU].font->descent; scr->components[MWM_MENU].f_y = scr->components[MWM_MENU].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_MENU].foreground; gcv.background = scr->components[MWM_MENU].background; scr->components[MWM_MENU].normal_GC = XCreateGC(dpy, scr->root_win, gcm, &gcv); /* FIXME - not a very good grayed out color */ scr->components[MWM_MENU].grayed_GC = XCreateGC(dpy, scr->root_win, gcm, &gcv); { Pixmap stipple = XCreateBitmapFromData(dpy, scr->root_win, stipple_bits, stipple_width, stipple_height); if (stipple) { XSetFillStyle(dpy, scr->components[MWM_MENU].grayed_GC, FillOpaqueStippled); XSetStipple(dpy, scr->components[MWM_MENU].grayed_GC, stipple); } } if (scr->components[MWM_MENU].top_shadow_pixmap != None && scr->components[MWM_MENU].top_shadow_pixmap != XmUNSPECIFIED_PIXMAP) { gcm = GCTile | GCFillStyle; gcv.tile = scr->components[MWM_MENU].top_shadow_pixmap; gcv.fill_style = FillTiled; } else { gcm = GCForeground | GCBackground; gcv.foreground = scr->components[MWM_MENU].top_shadow_color; gcv.background = scr->components[MWM_MENU].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_MENU].top_GC = XCreateGC(dpy, scr->root_win, gcm, &gcv); if (scr->components[MWM_MENU].bottom_shadow_pixmap != None && scr->components[MWM_MENU].bottom_shadow_pixmap != XmUNSPECIFIED_PIXMAP) { gcm = GCTile | GCFillStyle; gcv.tile = scr->components[MWM_MENU].bottom_shadow_pixmap; gcv.fill_style = FillTiled; } else { gcm = GCForeground | GCBackground; gcv.foreground = scr->components[MWM_MENU].bottom_shadow_color; gcv.background = scr->components[MWM_MENU].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_MENU].bot_GC = XCreateGC(dpy, scr->root_win, gcm, &gcv);}/* * create the GC's for the feedback */static voidcreate_feedback_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_FEEDBACK].font_list == NULL) scr->components[MWM_FEEDBACK].font_list = _XmFontListCreateDefault(dpy); _XmFontListGetDefaultFont(scr->components[MWM_FEEDBACK].font_list, &scr->components[MWM_FEEDBACK].font); gcv.font = scr->components[MWM_FEEDBACK].font->fid; if (scr->components[MWM_FEEDBACK].font) { scr->components[MWM_FEEDBACK].f_height = scr->components[MWM_FEEDBACK].font->ascent + scr->components[MWM_FEEDBACK].font->descent; scr->components[MWM_FEEDBACK].f_y = scr->components[MWM_FEEDBACK].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_FEEDBACK].foreground; gcv.background = scr->components[MWM_FEEDBACK].background; scr->components[MWM_FEEDBACK].normal_GC = XCreateGC(dpy, scr->root_win, gcm, &gcv); scr->components[MWM_FEEDBACK].grayed_GC = XCreateGC(dpy, scr->root_win, gcm, &gcv); XSetFillStyle(dpy, scr->components[MWM_FEEDBACK].grayed_GC, FillOpaqueStippled); if (scr->components[MWM_FEEDBACK].top_shadow_pixmap != None && scr->components[MWM_FEEDBACK].top_shadow_pixmap != XmUNSPECIFIED_PIXMAP) { gcm = GCTile | GCFillStyle; gcv.tile = scr->components[MWM_FEEDBACK].top_shadow_pixmap; gcv.fill_style = FillTiled; } else { gcm = GCForeground | GCBackground; gcv.foreground = scr->components[MWM_FEEDBACK].top_shadow_color; gcv.background = scr->components[MWM_FEEDBACK].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_FEEDBACK].top_GC = XCreateGC(dpy, scr->root_win, gcm, &gcv); if (scr->components[MWM_FEEDBACK].bottom_shadow_pixmap != None && scr->components[MWM_FEEDBACK].bottom_shadow_pixmap != XmUNSPECIFIED_PIXMAP) { gcm = GCTile | GCFillStyle; gcv.tile = scr->components[MWM_FEEDBACK].bottom_shadow_pixmap; gcv.fill_style = FillTiled; } else { gcm = GCForeground | GCBackground; gcv.foreground = scr->components[MWM_FEEDBACK].bottom_shadow_color; gcv.background = scr->components[MWM_FEEDBACK].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_FEEDBACK].bot_GC = XCreateGC(dpy, scr->root_win, gcm, &gcv);}static voidcreate_pager_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_PAGER].font_list == NULL) scr->components[MWM_PAGER].font_list = _XmFontListCreateDefault(dpy); _XmFontListGetDefaultFont(scr->components[MWM_PAGER].font_list, &scr->components[MWM_PAGER].font); gcv.font = scr->components[MWM_PAGER].font->fid; if (scr->components[MWM_PAGER].font) { scr->components[MWM_PAGER].f_height = scr->components[MWM_PAGER].font->ascent + scr->components[MWM_PAGER].font->descent; scr->components[MWM_PAGER].f_y = scr->components[MWM_PAGER].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_PAGER].foreground; gcv.background = scr->components[MWM_PAGER].background; scr->components[MWM_PAGER].normal_GC = XCreateGC(dpy, scr->root_win, gcm, &gcv); scr->components[MWM_PAGER].grayed_GC = XCreateGC(dpy, scr->root_win, gcm, &gcv); XSetFillStyle(dpy, scr->components[MWM_PAGER].grayed_GC, FillOpaqueStippled);}/* * create the GC's for the icons */static voidcreate_icon_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_ICON].font_list == NULL) scr->components[MWM_ICON].font_list = _XmFontListCreateDefault(dpy); _XmFontListGetDefaultFont(scr->components[MWM_ICON].font_list, &scr->components[MWM_ICON].font); gcv.font = scr->components[MWM_ICON].font->fid; if (scr->components[MWM_ICON].font) { scr->components[MWM_ICON].f_height = scr->components[MWM_ICON].font->ascent + scr->components[MWM_ICON].font->descent; scr->components[MWM_ICON].f_y = scr->components[MWM_ICON].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_ICON].foreground; gcv.background = scr->components[MWM_ICON].background; scr->components[MWM_ICON].normal_GC = XCreateGC(dpy, scr->root_win, gcm, &gcv); scr->components[MWM_ICON].grayed_GC = XCreateGC(dpy, scr->root_win, gcm, &gcv); XSetFillStyle(dpy, scr->components[MWM_ICON].grayed_GC, FillStippled); if (scr->components[MWM_ICON].top_shadow_pixmap != None && scr->components[MWM_ICON].top_shadow_pixmap != XmUNSPECIFIED_PIXMAP) { gcm = GCTile | GCFillStyle; gcv.tile = scr->components[MWM_ICON].top_shadow_pixmap; gcv.fill_style = FillTiled; } else { gcm = GCForeground | GCBackground; gcv.foreground = scr->components[MWM_ICON].top_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].top_GC = XCreateGC(dpy, scr->root_win, gcm, &gcv); if (scr->components[MWM_ICON].bottom_shadow_pixmap != None &&
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -