1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-06 16:25:50 +01:00

- API change in WINGs for WMDraw*String().

WMDrawString() and WMDrawImageString() now take WMColor instead of GC as
  arguments. WMDrawImageString() receives 2 colors (text & background).
  This is to allow easy extension for Xft/Xrender and hide X low level details
- Added alpha channel to WMColor. 2 new functions also:
  WMCreateRGBAColor() and WMSetColorAlpha()
- Miscelaneous code cleanups in wtext.c
- Removed obsoleted acconfig.h and implemented its functionality using
  AC_DEFINE and AC_DEFINE_UNQUOTED as autoconf 2.5x recommends.
  This will definitely enforce the need to use autoconf 2.5x
This commit is contained in:
dan
2002-10-08 08:26:06 +00:00
parent e98da5a628
commit a2b404b5b3
58 changed files with 554 additions and 601 deletions

View File

@@ -1329,11 +1329,11 @@ paintListItem(WMList *lPtr, int index, Drawable d, char *text, int state,
else if (titem->selectedFor)
WMDrawPixmap(panel->offLed, d, x + TEXPREV_WIDTH + 10, y + 6);
WMDrawString(scr, d, WMColorGC(black), panel->boldFont,
WMDrawString(scr, d, black, panel->boldFont,
x + TEXPREV_WIDTH + 22, y + 2, titem->title,
strlen(titem->title));
WMDrawString(scr, d, WMColorGC(black), panel->smallFont,
WMDrawString(scr, d, black, panel->smallFont,
x + TEXPREV_WIDTH + 14, y + 18, titem->texture,
strlen(titem->texture));
@@ -1512,8 +1512,8 @@ paintText(WMScreen *scr, Drawable d, WMColor *color, WMFont *font,
x += (w - WMWidthOfString(font, text, l))/2;
break;
}
WMDrawString(scr, d, WMColorGC(color), font, x,
y + (h - WMFontHeight(font))/2, text, l);
WMDrawString(scr, d, color, font, x, y + (h - WMFontHeight(font))/2,
text, l);
}

View File

@@ -85,26 +85,30 @@ static WMPropList *DefaultDisplayFont = NULL;
static void
drawMenuItem(WMScreen *scr, Display *dpy, Drawable d,
int x, int y, int w, int h,
GC light, GC dark, GC black, GC white,
WMFont *font, int fh, char *text)
drawMenuItem(Panel *panel, int x, int y, int w, int h, char *text)
{
XFillRectangle(dpy, d, light, x, y, w, h);
XDrawLine(dpy, d, black, x, y, x, y+h);
XDrawLine(dpy, d, black, x+w, y, x+w, y+h);
XDrawLine(dpy, d, white, x+1, y, x+1, y+h-1);
XDrawLine(dpy, d, white, x+1, y, x+w-1, y);
XDrawLine(dpy, d, dark, x+w-1, y+1, x+w-1, y+h-3);
XDrawLine(dpy, d, dark, x+1, y+h-2, x+w-1, y+h-2);
XDrawLine(dpy, d, black, x, y+h-1, x+w, y+h-1);
WMScreen *scr = WMWidgetScreen(panel->parent);
Display *dpy = WMScreenDisplay(scr);
GC black = WMColorGC(panel->black);
GC white = WMColorGC(panel->white);
GC dark = WMColorGC(panel->dark);
int fh = WMFontHeight(panel->menuItemFont);
WMDrawString(scr, d, black, font, x + 5, y+(h-fh)/2,
text, strlen(text));
XFillRectangle(dpy, panel->preview, WMColorGC(panel->light), x, y, w, h);
XDrawLine(dpy, panel->preview, black, x, y, x, y+h);
XDrawLine(dpy, panel->preview, black, x+w, y, x+w, y+h);
XDrawLine(dpy, panel->preview, white, x+1, y, x+1, y+h-1);
XDrawLine(dpy, panel->preview, white, x+1, y, x+w-1, y);
XDrawLine(dpy, panel->preview, dark, x+w-1, y+1, x+w-1, y+h-3);
XDrawLine(dpy, panel->preview, dark, x+1, y+h-2, x+w-1, y+h-2);
XDrawLine(dpy, panel->preview, black, x, y+h-1, x+w, y+h-1);
WMDrawString(scr, panel->preview, panel->black, panel->menuItemFont,
x + 5, y+(h-fh)/2, text, strlen(text));
}
@@ -156,7 +160,7 @@ paintPreviewBox(Panel *panel)
XDrawLine(dpy, panel->preview, dark,
220, 20, 220, 20+h);
WMDrawString(scr, panel->preview, white, panel->windowTitleFont,
WMDrawString(scr, panel->preview, panel->white, panel->windowTitleFont,
20+(200-WMWidthOfString(panel->windowTitleFont, "Window Titlebar", 15))/2,
20+(h-fh)/2, "Window Titlebar", 15);
}
@@ -186,7 +190,7 @@ paintPreviewBox(Panel *panel)
XDrawLine(dpy, panel->preview, dark,
mx+mw, my, mx+mw, my+h);
WMDrawString(scr, panel->preview, white, panel->menuTitleFont,
WMDrawString(scr, panel->preview, panel->white, panel->menuTitleFont,
mx+5, my+(h-fh)/2, "Menu Title", 10);
fh2 = WMFontHeight(panel->menuItemFont);
@@ -194,11 +198,7 @@ paintPreviewBox(Panel *panel)
/* menu items */
for (i = 0; i < 4; i++) {
drawMenuItem(scr, dpy, panel->preview,
mx-1, my+2+h+i*h2, mw+2, h2,
light, dark, black, white,
panel->menuItemFont, fh2,
"Menu Item");
drawMenuItem(panel, mx-1, my+2+h+i*h2, mw+2, h2, "Menu Item");
}
}

View File

@@ -453,8 +453,7 @@ paintItem(WMList *lPtr, int index, Drawable d, char *text, int state,
WMReleasePixmap(pix);
}
WMDrawString(scr, d, WMColorGC(panel->black), panel->font, x+20, y,
text, strlen(text));
WMDrawString(scr, d, panel->black, panel->font, x+20, y, text, strlen(text));
}

View File

@@ -200,11 +200,9 @@ paintItem(WMList *lPtr, int index, Drawable d, char *text, int state,
XClearArea(dpy, d, x, y, width, height, False);
if (state & 1) {
WMDrawString(scr, d, WMColorGC(panel->red), panel->font, x+4, y,
text, strlen(text));
WMDrawString(scr, d, panel->red, panel->font, x+4, y, text, strlen(text));
} else {
WMDrawString(scr, d, WMColorGC(panel->black), panel->font, x+4, y,
text, strlen(text));
WMDrawString(scr, d, panel->black, panel->font, x+4, y, text, strlen(text));
}
}

View File

@@ -327,13 +327,13 @@ updateSVSlider(WMSlider *sPtr, Bool saturation, WMFont *font, RHSVColor *hsv)
if (hsv->value < 128 || !saturation) {
WMColor *col = WMWhiteColor(scr);
WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(col), font, 2,
WMDrawString(scr, WMGetPixmapXID(pixmap), col, font, 2,
(16 - WMFontHeight(font))/2 - 1, buffer, strlen(buffer));
WMReleaseColor(col);
} else {
WMColor *col = WMBlackColor(scr);
WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(col), font, 2,
WMDrawString(scr, WMGetPixmapXID(pixmap), col, font, 2,
(16 - WMFontHeight(font))/2 - 1, buffer, strlen(buffer));
WMReleaseColor(col);
}
@@ -368,14 +368,14 @@ updateHueSlider(WMSlider *sPtr, WMFont *font, RHSVColor *hsv)
if (hsv->value < 128) {
WMColor *col = WMWhiteColor(scr);
WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(col), font, 2,
WMDrawString(scr, WMGetPixmapXID(pixmap), col, font, 2,
(16 - WMFontHeight(font))/2 - 1,
_("Hue"), strlen(_("Hue")));
WMReleaseColor(col);
} else {
WMColor *col = WMBlackColor(scr);
WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(col), font, 2,
WMDrawString(scr, WMGetPixmapXID(pixmap), col, font, 2,
(16 - WMFontHeight(font))/2 - 1,
_("Hue"), strlen(_("Hue")));
WMReleaseColor(col);
@@ -489,8 +489,8 @@ paintGradListItem(WMList *lPtr, int index, Drawable d, char *text, int state,
XCopyArea(WMScreenDisplay(scr), panel->gimage, d, WMColorGC(white),
0, height*index, 30, height, x + 5, y);
}
WMDrawString(scr, d, WMColorGC(black), panel->listFont,
x + 40, y + 1, text, strlen(text));
WMDrawString(scr, d, black, panel->listFont, x + 40, y + 1,
text, strlen(text));
WMReleaseColor(white);
WMReleaseColor(black);
@@ -1333,7 +1333,7 @@ CreateTexturePanel(WMWindow *keyWindow)
WMColorGC(color), 0, 0, 130, 16);
WMReleaseColor(color);
color = WMWhiteColor(color);
WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(color),
WMDrawString(scr, WMGetPixmapXID(pixmap), color,
panel->listFont, 2,
(16 - WMFontHeight(panel->listFont))/2 - 1,
"Brightness", 10);
@@ -1357,7 +1357,7 @@ CreateTexturePanel(WMWindow *keyWindow)
WMColorGC(color), 0, 0, 130, 16);
WMReleaseColor(color);
color = WMWhiteColor(scr);
WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(color),
WMDrawString(scr, WMGetPixmapXID(pixmap), color,
panel->listFont, 2,
(16 - WMFontHeight(panel->listFont))/2 - 1,
"Contrast", 8);
@@ -1463,9 +1463,8 @@ CreateTexturePanel(WMWindow *keyWindow)
WMReleaseColor(color);
color = WMWhiteColor(scr);
WMDrawString(scr, p, WMColorGC(color), panel->listFont,
2, 1, "0%", 2);
WMDrawString(scr, p, WMColorGC(color), panel->listFont,
WMDrawString(scr, p, color, panel->listFont, 2, 1, "0%", 2);
WMDrawString(scr, p, color, panel->listFont,
153 - WMWidthOfString(panel->listFont, "100%", 4), 1,
"100%", 4);
WMReleaseColor(color);

View File

@@ -712,10 +712,11 @@ Initialize(WMScreen *scr)
InitMouseSettings(scr, WPrefs.banner);
InitAppearance(scr, WPrefs.banner);
#ifdef akk
InitFont(scr, WPrefs.banner);
#endif
#ifdef not_yet_fully_implemented
InitThemes(scr, WPrefs.banner);
#endif

View File

@@ -113,7 +113,7 @@ paintDoubleTest(_DoubleTest *dPtr)
y = (dPtr->view->size.height-scr->normalFont->height)/2;
W_PaintText(dPtr->view, dPtr->view->window, scr->normalFont,
dPtr->on, dPtr->on+y, dPtr->view->size.width, WACenter,
WMColorGC(scr->black), False, dPtr->text, strlen(dPtr->text));
scr->black, False, dPtr->text, strlen(dPtr->text));
}
}

View File

@@ -219,9 +219,8 @@ paintEditMenuItem(WEditMenuItem *iPtr)
W_DrawRelief(scr, win, 0, 0, w+1, h, WRRaised);
WMDrawString(scr, win, WMColorGC(color), font, 5, 3, iPtr->label,
strlen(iPtr->label));
WMDrawString(scr, win, color, font, 5, 3, iPtr->label, strlen(iPtr->label));
if (iPtr->pixmap) {
WMSize size = WMGetPixmapSize(iPtr->pixmap);