mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-01 19:42:32 +01:00
- Fixed userdefaults in WINGs not to synchronize on exit a domain that is
marked not to be synchronized. - WMGLOBAL options can now be set in the WindowMaker configuration files to overwrite values in WMGLOBAL. - You can now pass "SystemFont", "BoldSystemFont", "SystemFont-##" or "BoldSystemFont-##", with ## being the font size to any font creating function to create a font with the (bold) system font font specification. - Replaced AA with Anitialiased in WINGs font creation function names - Added WMCreateFontWithFlags(), WMHasAntialiasingSupport() and WMIsAntialiasingEnabled() - Created a separate font cacahe for antialiased fonts - Added test at startup if Xft supports rendering antialiased fonts (in case the application was compiled with Xft support, but is run on an X server without support for xft rendering (RENDER extension missing). If no Xft support antialiasing will be disabled even if it is enabled in the configuration file. - Finished the Info Panel to work with antialiased fonts. - Code cleanup in dialog.c. Remade part of Info Panel drawing the Window Maker logo. - Fixed technical style drawing of window resizing.
This commit is contained in:
107
src/dialog.c
107
src/dialog.c
@@ -62,6 +62,8 @@
|
||||
#include "defaults.h"
|
||||
#include "xinerama.h"
|
||||
|
||||
|
||||
|
||||
extern WPreferences wPreferences;
|
||||
|
||||
|
||||
@@ -844,6 +846,7 @@ typedef struct {
|
||||
|
||||
WMLabel *logoL;
|
||||
WMLabel *name1L;
|
||||
WMFrame *lineF;
|
||||
WMLabel *name2L;
|
||||
|
||||
WMLabel *versionL;
|
||||
@@ -906,53 +909,6 @@ destroyInfoPanel(WCoreWindow *foo, void *data, XEvent *event)
|
||||
}
|
||||
|
||||
|
||||
WMPixmap*
|
||||
renderText(WMScreen *scr, char *text, char *font, RColor *from, RColor *to)
|
||||
{
|
||||
WMPixmap *wpix = NULL;
|
||||
Pixmap grad = None;
|
||||
Pixmap mask = None;
|
||||
RContext *rc = WMScreenRContext(scr);
|
||||
XFontStruct *f = NULL;
|
||||
int w, h;
|
||||
GC gc = None;
|
||||
|
||||
f = XLoadQueryFont(dpy, font);
|
||||
if (!f)
|
||||
return NULL;
|
||||
|
||||
w = XTextWidth(f, text, strlen(text));
|
||||
h = f->ascent+f->descent;
|
||||
|
||||
mask = XCreatePixmap(dpy, rc->drawable, w, h, 1);
|
||||
gc = XCreateGC(dpy, mask, 0, NULL);
|
||||
XSetForeground(dpy, gc, 0);
|
||||
XSetFont(dpy, gc, f->fid);
|
||||
XFillRectangle(dpy, mask, gc, 0, 0, w, h);
|
||||
|
||||
XSetForeground(dpy, gc, 1);
|
||||
XDrawString(dpy, mask, gc, 0, f->ascent, text, strlen(text));
|
||||
XSetLineAttributes(dpy, gc, 3, LineSolid, CapRound, JoinMiter);
|
||||
XDrawLine(dpy, mask, gc, 0, h-2, w, h-2);
|
||||
|
||||
grad = XCreatePixmap(dpy, rc->drawable, w, h, rc->depth);
|
||||
{
|
||||
WMColor *color;
|
||||
|
||||
color = WMBlackColor(scr);
|
||||
XFillRectangle(dpy, grad, WMColorGC(color), 0, 0, w, h);
|
||||
WMReleaseColor(color);
|
||||
}
|
||||
|
||||
wpix = WMCreatePixmapFromXPixmaps(scr, grad, mask, w, h, rc->depth);
|
||||
|
||||
if (gc)
|
||||
XFreeGC(dpy, gc);
|
||||
XFreeFont(dpy, f);
|
||||
|
||||
return wpix;
|
||||
}
|
||||
|
||||
#ifdef SILLYNESS
|
||||
|
||||
extern WMPixmap *DoXThing();
|
||||
@@ -1221,7 +1177,7 @@ handleLogoPush(XEvent *event, void *data)
|
||||
/* Alternatively we can draw text in a pixmap and scroll it smoothly */
|
||||
if ((panel->oldFont = WMGetLabelFont(panel->versionL))!=NULL)
|
||||
WMRetainFont(panel->oldFont);
|
||||
font = WMCreateFont(WMWidgetScreen(panel->versionL), "-*-fixed-*-*-*-*-14-*-*-*-*-*-*-*");
|
||||
font = WMCreateFont(WMWidgetScreen(panel->versionL), "-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*");
|
||||
if (font) {
|
||||
WMSetLabelFont(panel->versionL, font);
|
||||
WMReleaseFont(font);
|
||||
@@ -1269,9 +1225,8 @@ wShowInfoPanel(WScreen *scr)
|
||||
char buffer[256];
|
||||
Window parent;
|
||||
WWindow *wwin;
|
||||
RColor color1, color2;
|
||||
char **strl;
|
||||
int i;
|
||||
int i, width, sepWidth;
|
||||
char *visuals[] = {
|
||||
"StaticGray",
|
||||
"GrayScale",
|
||||
@@ -1296,7 +1251,7 @@ wShowInfoPanel(WScreen *scr)
|
||||
panel->scr = scr;
|
||||
|
||||
panel->win = WMCreateWindow(scr->wmscreen, "info");
|
||||
WMResizeWidget(panel->win, 382, 230);
|
||||
WMResizeWidget(panel->win, 390, 230);
|
||||
|
||||
logo = WMCreateApplicationIconBlendedPixmap(scr->wmscreen, (RColor*)NULL);
|
||||
if (!logo) {
|
||||
@@ -1316,30 +1271,31 @@ wShowInfoPanel(WScreen *scr)
|
||||
WMReleasePixmap(logo);
|
||||
}
|
||||
|
||||
sepWidth = 3;
|
||||
panel->name1L = WMCreateLabel(panel->win);
|
||||
WMResizeWidget(panel->name1L, 240, 30);
|
||||
WMResizeWidget(panel->name1L, 240, 30 - sepWidth);
|
||||
WMMoveWidget(panel->name1L, 100, 30);
|
||||
color1.red = 0;
|
||||
color1.green = 0;
|
||||
color1.blue = 0;
|
||||
color2.red = 0x50;
|
||||
color2.green = 0x50;
|
||||
color2.blue = 0x70;
|
||||
logo = renderText(scr->wmscreen, "Window Maker",
|
||||
"-*-utopia-*-r-*-*-25-*", &color1, &color2);
|
||||
if (logo) {
|
||||
WMSetLabelImagePosition(panel->name1L, WIPImageOnly);
|
||||
WMSetLabelImage(panel->name1L, logo);
|
||||
WMReleasePixmap(logo);
|
||||
|
||||
if (WMIsAntialiasingEnabled(scr->wmscreen)) {
|
||||
font = WMBoldSystemFontOfSize(scr->wmscreen, 24);
|
||||
} else {
|
||||
font = WMBoldSystemFontOfSize(scr->wmscreen, 20);
|
||||
if (font) {
|
||||
WMSetLabelFont(panel->name1L, font);
|
||||
WMReleaseFont(font);
|
||||
}
|
||||
WMSetLabelTextAlignment(panel->name1L, WACenter);
|
||||
WMSetLabelText(panel->name1L, "Window Maker");
|
||||
font = WMCreateFont(scr->wmscreen, "-*-utopia-*-r-*-*-25-*");
|
||||
font = font ? font : WMBoldSystemFontOfSize(scr->wmscreen, 24);
|
||||
}
|
||||
strbuf = "Window Maker";
|
||||
if (font) {
|
||||
width = WMWidthOfString(font, strbuf, strlen(strbuf));
|
||||
WMSetLabelFont(panel->name1L, font);
|
||||
WMReleaseFont(font);
|
||||
}
|
||||
WMSetLabelTextAlignment(panel->name1L, WACenter);
|
||||
WMSetLabelText(panel->name1L, strbuf);
|
||||
|
||||
panel->lineF = WMCreateFrame(panel->win);
|
||||
WMResizeWidget(panel->lineF, width, sepWidth);
|
||||
WMMoveWidget(panel->lineF, 100+(240-width)/2, 60 - sepWidth);
|
||||
WMSetFrameRelief(panel->lineF, WRSimple);
|
||||
WMSetWidgetBackgroundColor(panel->lineF, scr->black);
|
||||
|
||||
panel->name2L = WMCreateLabel(panel->win);
|
||||
WMResizeWidget(panel->name2L, 240, 24);
|
||||
@@ -1353,7 +1309,6 @@ wShowInfoPanel(WScreen *scr)
|
||||
WMSetLabelTextAlignment(panel->name2L, WACenter);
|
||||
WMSetLabelText(panel->name2L, _("Window Manager for X"));
|
||||
|
||||
|
||||
snprintf(buffer, sizeof(buffer), _("Version %s"), VERSION);
|
||||
panel->versionL = WMCreateLabel(panel->win);
|
||||
WMResizeWidget(panel->versionL, 310, 16);
|
||||
@@ -1363,12 +1318,12 @@ wShowInfoPanel(WScreen *scr)
|
||||
WMSetLabelWraps(panel->versionL, False);
|
||||
|
||||
panel->copyrL = WMCreateLabel(panel->win);
|
||||
WMResizeWidget(panel->copyrL, 340, 40);
|
||||
WMResizeWidget(panel->copyrL, 360, 40);
|
||||
WMMoveWidget(panel->copyrL, 15, 185);
|
||||
WMSetLabelTextAlignment(panel->copyrL, WALeft);
|
||||
WMSetLabelText(panel->copyrL, COPYRIGHT_TEXT);
|
||||
/* we want the (c) character in the helvetica font */
|
||||
font = WMCreateNormalFont(scr->wmscreen, HELVETICA10_FONT);
|
||||
/* we want the (c) character in the font, so don't use a FontSet here */
|
||||
font = WMCreateFontWithFlags(scr->wmscreen, "SystemFont-11", WFNormalFont);
|
||||
if (font) {
|
||||
WMSetLabelFont(panel->copyrL, font);
|
||||
WMReleaseFont(font);
|
||||
@@ -1461,7 +1416,7 @@ wShowInfoPanel(WScreen *scr)
|
||||
WMResizeWidget(panel->infoL, 350, 75);
|
||||
WMMoveWidget(panel->infoL, 15, 115);
|
||||
WMSetLabelText(panel->infoL, strbuf);
|
||||
font = WMCreateFont(scr->wmscreen, HELVETICA10_FONT);
|
||||
font = WMSystemFontOfSize(scr->wmscreen, 11);
|
||||
if (font) {
|
||||
WMSetLabelFont(panel->infoL, font);
|
||||
WMReleaseFont(font);
|
||||
|
||||
@@ -226,10 +226,11 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
||||
|
||||
ty = y1 + wwin->frame->top_width;
|
||||
by = y2 - wwin->frame->bottom_width;
|
||||
fw = WMWidthOfString(scr->info_text_font, "8888", 4);
|
||||
fh = WMFontHeight(scr->info_text_font);
|
||||
|
||||
if (wPreferences.size_display == WDIS_NEW) {
|
||||
fw = WMWidthOfString(scr->tech_draw_font, "8888", 4);
|
||||
fh = WMFontHeight(scr->tech_draw_font);
|
||||
|
||||
XSetForeground(dpy, gc, scr->line_pixel);
|
||||
|
||||
/* vertical geometry */
|
||||
@@ -280,7 +281,7 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
||||
|
||||
snprintf(num, sizeof(num), "%i", (by - ty - wwin->normal_hints->base_height) /
|
||||
wwin->normal_hints->height_inc);
|
||||
fw = WMWidthOfString(scr->info_text_font, num, strlen(num));
|
||||
fw = WMWidthOfString(scr->tech_draw_font, num, strlen(num));
|
||||
|
||||
/* XSetForeground(dpy, gc, WMColorPixel(scr->window_title_color[WS_UNFOCUSED])); */
|
||||
|
||||
@@ -293,7 +294,7 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
||||
/* // ugly hack */
|
||||
color->color.pixel = scr->line_pixel;
|
||||
scr->wmscreen->drawStringGC = gc;
|
||||
WMDrawString(scr->wmscreen, root, color, scr->info_text_font,
|
||||
WMDrawString(scr->wmscreen, root, color, scr->tech_draw_font,
|
||||
x - s + 3 - fw/2, my - fh/2 + 1, num, strlen(num));
|
||||
scr->wmscreen->drawStringGC = saveGC;
|
||||
color->color.pixel = pixel;
|
||||
@@ -310,7 +311,7 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
||||
mx = x1 + (x2 - x1)/2;
|
||||
snprintf(num, sizeof(num), "%i", (x2 - x1 - wwin->normal_hints->base_width) /
|
||||
wwin->normal_hints->width_inc);
|
||||
fw = WMWidthOfString(scr->info_text_font, num, strlen(num));
|
||||
fw = WMWidthOfString(scr->tech_draw_font, num, strlen(num));
|
||||
|
||||
/* left arrow */
|
||||
/* end bar */
|
||||
@@ -354,7 +355,7 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
||||
/* // ugly hack */
|
||||
color->color.pixel = scr->line_pixel;
|
||||
scr->wmscreen->drawStringGC = gc;
|
||||
WMDrawString(scr->wmscreen, root, color, scr->info_text_font,
|
||||
WMDrawString(scr->wmscreen, root, color, scr->tech_draw_font,
|
||||
mx - fw/2 + 1, y - s - fh/2 + 1, num, strlen(num));
|
||||
scr->wmscreen->drawStringGC = saveGC;
|
||||
color->color.pixel = pixel;
|
||||
|
||||
@@ -818,6 +818,9 @@ wScreenInit(int screen_number)
|
||||
|
||||
scr->info_text_font = WMBoldSystemFontOfSize(scr->wmscreen, 12);
|
||||
|
||||
scr->tech_draw_font = WMCreateFontWithFlags(scr->wmscreen,
|
||||
"BoldSystemFont-12",
|
||||
WFNotAntialiased);
|
||||
|
||||
scr->gview = WCreateGeometryView(scr->wmscreen);
|
||||
WMRealizeWidget(scr->gview);
|
||||
|
||||
@@ -161,6 +161,8 @@ typedef struct _WScreen {
|
||||
WMFont *clip_title_font; /* for clip titles */
|
||||
WMFont *info_text_font; /* text on things like geometry
|
||||
* hint boxes */
|
||||
WMFont *tech_draw_font;
|
||||
|
||||
WMFont *workspace_name_font;
|
||||
|
||||
WMColor *select_color;
|
||||
|
||||
@@ -295,8 +295,6 @@
|
||||
#define DEF_WORKSPACE_NAME_FONT "\"-*-lucida-bold-r-*-*-24-*-*-*-*-*-*-*\""
|
||||
#endif /* !I18N */
|
||||
|
||||
#define HELVETICA10_FONT "-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*"
|
||||
|
||||
#define DEF_FRAME_THICKNESS 1 /* linewidth of the move/resize frame */
|
||||
|
||||
#define DEF_WINDOW_TITLE_EXTEND_SPACE "0"
|
||||
|
||||
Reference in New Issue
Block a user