From dd1ccd2fd68dcfa22417136634660bf4e76c10e3 Mon Sep 17 00:00:00 2001 From: dan Date: Sun, 1 Dec 2002 05:49:13 +0000 Subject: [PATCH] - enabled the use of SHAPE extension in the color panel. without it the magnifying glass captured image was shifted and unusable - removed some comments left in the code for later reviewal --- WINGs/wcolorpanel.c | 5 +++-- WINGs/wfont.c | 57 +++++++++++++++++++++++++++-------------------------- src/defaults.c | 2 +- 3 files changed, 33 insertions(+), 31 deletions(-) diff --git a/WINGs/wcolorpanel.c b/WINGs/wcolorpanel.c index 09380246..48167269 100644 --- a/WINGs/wcolorpanel.c +++ b/WINGs/wcolorpanel.c @@ -36,7 +36,8 @@ #include /* BUG There's something fishy with shaped windows */ -#if 1 +/* Whithout shape extension the magnified image is completely broken -Dan */ +#if 0 #ifdef SHAPE #define SHAPE_WAS_DEFINED #undef SHAPE @@ -1708,7 +1709,7 @@ magnifyCreatePixmap(WMColorPanel *panel) /* Copy the magnified pixmap, with the clip mask, to background pixmap */ XCopyArea(scr->display, panel->magnifyGlass->magPix, pixmap, - scr->clipGC, 0, 0, Cursor_mask_width, Cursor_mask_height, 0, 0); + scr->clipGC, 0, 0, Cursor_mask_width, Cursor_mask_height, 0, 0); /* (2,2) puts center pixel on center of glass */ return pixmap; diff --git a/WINGs/wfont.c b/WINGs/wfont.c index 9d51b579..d7d72824 100644 --- a/WINGs/wfont.c +++ b/WINGs/wfont.c @@ -306,18 +306,20 @@ WMCreateAntialiasedFont(WMScreen *scrPtr, char *fontName) font->screen = scrPtr; -#if 0 - /* // Xft sux. Loading a font that doesn't exist will load the default - * defined in XftConfig without any warning or error */ - font->font.normal = XLoadQueryFont(display, fname); - if (!font->font.normal) { - wfree(font); - wfree(fname); - return NULL; - } - XFreeFont(display, font->font.normal); -#endif - + /* Xft sux. Loading a font with an invalid XLFD will give strange results + * sometimes without returning any warning or error. + * However Xft's idea of what font is invalid is quite strange: + * 1. If the XLFD doesn't have all its fields present will fail and + * return NULL. + * 2. If all fields are present, but hold invalid values then it will: + * a. If family is invalid, will load a default font without warning. + * b. If the font size is invalid (non-numerical) it will fail and + * return NULL. + * c. If other fields are invalid, will load the font specified by + * the valid family name, ignoring any invalid fields. It will + * use a default medium weight and a default roman slant if they + * are invalid. + */ font->font.xft = XftFontOpenXlfd(display, scrPtr->screen, fname); if (!font->font.xft) { wfree(font); @@ -353,7 +355,6 @@ WMCreateAntialiasedFontSet(WMScreen *scrPtr, char *fontName) fontName = xlfdFromFontName(fontName, True); - // use the second in list if available, instead of first? if ((ptr = strchr(fontName, ','))) { fname = wmalloc(ptr - fontName + 1); strncpy(fname, fontName, ptr - fontName); @@ -379,18 +380,20 @@ WMCreateAntialiasedFontSet(WMScreen *scrPtr, char *fontName) font->screen = scrPtr; -#if 0 - /* // Xft sux. Loading a font that doesn't exist will load the default - * defined in XftConfig without any warning or error */ - font->font.normal = XLoadQueryFont(display, fname); - if (!font->font.normal) { - wfree(font); - wfree(fname); - return NULL; - } - XFreeFont(display, font->font.normal); -#endif - + /* Xft sux. Loading a font with an invalid XLFD will give strange results + * sometimes without returning any warning or error. + * However Xft's idea of what font is invalid is quite strange: + * 1. If the XLFD doesn't have all its fields present will fail and + * return NULL. + * 2. If all fields are present, but hold invalid values then it will: + * a. If family is invalid, will load a default font without warning. + * b. If the font size is invalid (non-numerical) it will fail and + * return NULL. + * c. If other fields are invalid, will load the font specified by + * the valid family name, ignoring any invalid fields. It will + * use a default medium weight and a default roman slant if they + * are invalid. + */ font->font.xft = XftFontOpenXlfd(display, scrPtr->screen, fname); if (!font->font.xft) { wfree(font); @@ -917,7 +920,7 @@ changeFontProp(char *buf, char *newprop, int position) int count; if (buf[0]!='-') { - // remove warning later. or maybe not + /* // remove warning later. or maybe not */ wwarning(_("Invalid font specification: '%s'\n"), buf); return; } @@ -1025,7 +1028,6 @@ WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font, if (totalProps == 0) { /* No options with fallback alternatives at all */ WMFreeBag(props); - //printf("try: '%s'\n '%s'\n", font->name, fname); return WMCreateFontWithFlags(scrPtr, fname, fFlags); } @@ -1040,7 +1042,6 @@ WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font, } } result = WMCreateFontWithFlags(scrPtr, fname, fFlags); - //printf("try: '%s'\n '%s'\n", font->name, fname); if (result) { WMFreeBag(props); return result; diff --git a/src/defaults.c b/src/defaults.c index a6961f12..79b59741 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -3121,7 +3121,7 @@ setIconTitleBack(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo) if (scr->icon_title_texture) { wTextureDestroy(scr, (WTexture*)scr->icon_title_texture); } - // ?? why is this necessary? color was already parsed and alloced + // ?? why is this necessary? color was already parsed and alloc'ed XQueryColor (dpy, scr->w_colormap, color); scr->icon_title_texture = wTextureMakeSolid(scr, color); -- 2.11.4.GIT