1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

- fixes for AA fonts

- fixed the workspace name display problem.
- replaced most of scr->xxx_pixel with scr->xxx_color
- removed some obsoleted GC's in the WScreen structure
This commit is contained in:
dan
2002-10-17 20:26:30 +00:00
parent 1e92274495
commit 3bed15d673
14 changed files with 2532 additions and 2632 deletions

View File

@@ -290,10 +290,6 @@ updateDockNumbers(WScreen *scr)
int length;
char *ws_numbers;
WAppIcon *dicon = scr->dock->icon_array[0];
WMColor *black, *white;
black = WMBlackColor(scr->wmscreen);
white = WMWhiteColor(scr->wmscreen);
ws_numbers = wmalloc(20);
snprintf(ws_numbers, 20, "%i [ %i ]", scr->current_workspace+1,
@@ -303,14 +299,12 @@ updateDockNumbers(WScreen *scr)
XClearArea(dpy, dicon->icon->core->window, 2, 2, 50,
WMFontHeight(scr->icon_title_font)+1, False);
WMDrawString(scr->wmscreen, dicon->icon->core->window, black,
WMDrawString(scr->wmscreen, dicon->icon->core->window, scr->black,
scr->icon_title_font, 4, 3, ws_numbers, length);
WMDrawString(scr->wmscreen, dicon->icon->core->window, white,
WMDrawString(scr->wmscreen, dicon->icon->core->window, scr->white,
scr->icon_title_font, 3, 2, ws_numbers, length);
WMReleaseColor(black);
WMReleaseColor(white);
wfree(ws_numbers);
}
#endif /* WS_INDICATOR */

View File

@@ -172,7 +172,6 @@ showText(WScreen *scr, int x, int y, int h, int w, char *text)
Pixmap pixmap;
Pixmap mask;
WMFont *font = scr->info_text_font;
WMColor *color;
int side = 0;
int ty;
int bx, by;
@@ -212,14 +211,10 @@ showText(WScreen *scr, int x, int y, int h, int w, char *text)
}
pixmap = makePixmap(scr, width, height, side, &mask);
color = WMBlackColor(scr->wmscreen);
WMDrawString(scr->wmscreen, pixmap, color, font, 8,
WMDrawString(scr->wmscreen, pixmap, scr->black, font, 8,
ty + (height - WMFontHeight(font))/2,
text, strlen(text));
WMReleaseColor(color);
XSetWindowBackgroundPixmap(dpy, scr->balloon->window, pixmap);
scr->balloon->contents = pixmap;
@@ -241,8 +236,6 @@ showText(WScreen *scr, int x, int y, int h, int w, char *text)
int height;
Pixmap pixmap;
WMFont *font = scr->info_text_font;
WMColor *color;
WMPixel pixel;
if (scr->balloon->contents)
XFreePixmap(dpy, scr->balloon->contents);
@@ -272,13 +265,8 @@ showText(WScreen *scr, int x, int y, int h, int w, char *text)
pixmap = XCreatePixmap(dpy, scr->root_win, width, height, scr->w_depth);
XFillRectangle(dpy, pixmap, scr->draw_gc, 0, 0, width, height);
/* ugly hack */
color = WMBlackColor(scr->wmscreen);
pixel = color->color.pixel;
color->color.pixel = scr->window_title_pixel[0];
WMDrawString(scr->wmscreen, pixmap, color, font, 4, 2, text, strlen(text));
color->color.pixel = pixel;
WMReleaseColor(color);
WMDrawString(scr->wmscreen, pixmap, scr->window_title_color[0], font, 4, 2,
text, strlen(text));
XResizeWindow(dpy, scr->balloon->window, width, height);
XMoveWindow(dpy, scr->balloon->window, x, y);

View File

@@ -84,8 +84,8 @@ extern Atom _XA_WINDOWMAKER_ICON_SIZE;
extern Atom _XA_WINDOWMAKER_ICON_TILE;
/*
extern WMPropList *wDomainName;
extern WMPropList *wAttributeDomainName;
extern WMPropList *wDomainName;
extern WMPropList *wAttributeDomainName;
*/
extern WPreferences wPreferences;
@@ -139,8 +139,8 @@ static int setClearance();
static int setIfDockPresent();
static int setStickyIcons();
/*
static int setPositive();
*/
static int setPositive();
*/
static int setWidgetColor();
static int setIconTile();
static int setWinTitleFont();
@@ -863,7 +863,7 @@ static void rereadDefaults(void);
#if 0
static void
rereadDefaults(void)
rereadDefaults(void)
{
/* must defer the update because accessing X data from a
* signal handler can mess up Xlib */
@@ -899,7 +899,7 @@ initDefaults()
entry->plvalue = NULL;
}
/*
/*
wDomainName = WMCreatePLString(WMDOMAIN_NAME);
wAttributeDomainName = WMCreatePLString(WMATTRIBUTE_DOMAIN_NAME);
@@ -2761,7 +2761,7 @@ again:
/* ---------------- value setting functions --------------- */
static int
setJustify(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
setJustify(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
{
return REFRESH_WINDOW_TITLE_COLOR;
}
@@ -2962,12 +2962,14 @@ setLargeDisplayFont(WScreen *scr, WDefaultEntry *entry, WMFont *font, void *foo)
static int
setHightlight(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
{
if (scr->select_pixel!=scr->white_pixel &&
scr->select_pixel!=scr->black_pixel) {
wFreeColor(scr, scr->select_pixel);
}
if (scr->select_color)
WMReleaseColor(scr->select_color);
scr->select_pixel = color->pixel;
scr->select_color =
WMCreateRGBColor(scr->wmscreen, color->red, color->green,
color->blue, True);
wFreeColor(scr, color->pixel);
return REFRESH_MENU_COLOR;
}
@@ -2976,12 +2978,14 @@ setHightlight(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
static int
setHightlightText(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
{
if (scr->select_text_pixel!=scr->white_pixel &&
scr->select_text_pixel!=scr->black_pixel) {
wFreeColor(scr, scr->select_text_pixel);
}
if (scr->select_text_color)
WMReleaseColor(scr->select_text_color);
scr->select_text_pixel = color->pixel;
scr->select_text_color =
WMCreateRGBColor(scr->wmscreen, color->red, color->green,
color->blue, True);
wFreeColor(scr, color->pixel);
return REFRESH_MENU_COLOR;
}
@@ -2995,6 +2999,7 @@ setClipTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
scr->clip_title_color[index] = WMCreateRGBColor(scr->wmscreen, color->red,
color->green, color->blue,
True);
wFreeColor(scr, color->pixel);
#ifdef GRADIENT_CLIP_ARROW
if (index == CLIP_NORMAL) {
@@ -3026,16 +3031,18 @@ setClipTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
static int
setWTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
{
if (scr->window_title_pixel[index]!=scr->white_pixel &&
scr->window_title_pixel[index]!=scr->black_pixel) {
wFreeColor(scr, scr->window_title_pixel[index]);
}
if (scr->window_title_color[index])
WMReleaseColor(scr->window_title_color[index]);
scr->window_title_pixel[index] = color->pixel;
scr->window_title_color[index] =
WMCreateRGBColor(scr->wmscreen, color->red, color->green, color->blue,
True);
if (index == WS_UNFOCUSED)
XSetForeground(dpy, scr->info_text_gc, color->pixel);
wFreeColor(scr, color->pixel);
return REFRESH_WINDOW_TITLE_COLOR;
}
@@ -3043,13 +3050,14 @@ setWTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
static int
setMenuTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
{
if (scr->menu_title_pixel[0]!=scr->white_pixel &&
scr->menu_title_pixel[0]!=scr->black_pixel) {
wFreeColor(scr, scr->menu_title_pixel[0]);
}
if (scr->menu_title_color[0])
WMReleaseColor(scr->menu_title_color[0]);
scr->menu_title_pixel[0] = color->pixel;
XSetForeground(dpy, scr->menu_title_gc, color->pixel);
scr->menu_title_color[0] =
WMCreateRGBColor(scr->wmscreen, color->red, color->green,
color->blue, True);
wFreeColor(scr, color->pixel);
return REFRESH_MENU_TITLE_COLOR;
}
@@ -3058,61 +3066,45 @@ setMenuTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
static int
setMenuTextColor(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
{
XGCValues gcv;
#define gcm (GCForeground|GCBackground|GCFillStyle)
if (scr->mtext_color)
WMReleaseColor(scr->mtext_color);
if (scr->mtext_pixel!=scr->white_pixel &&
scr->mtext_pixel!=scr->black_pixel) {
wFreeColor(scr, scr->mtext_pixel);
}
scr->mtext_color = WMCreateRGBColor(scr->wmscreen, color->red,
color->green, color->blue, True);
scr->mtext_pixel = color->pixel;
XSetForeground(dpy, scr->menu_entry_gc, color->pixel);
if (scr->dtext_pixel == scr->mtext_pixel) {
gcv.foreground = scr->white_pixel;
gcv.background = scr->black_pixel;
gcv.fill_style = FillStippled;
if (WMColorPixel(scr->dtext_color) == WMColorPixel(scr->mtext_color)) {
WMSetColorAlpha(scr->dtext_color, 0x7fff);
} else {
gcv.foreground = scr->dtext_pixel;
gcv.fill_style = FillSolid;
WMSetColorAlpha(scr->dtext_color, 0xffff);
}
XChangeGC(dpy, scr->disabled_menu_entry_gc, gcm, &gcv);
wFreeColor(scr, color->pixel);
return REFRESH_MENU_COLOR;
#undef gcm
}
static int
setMenuDisabledColor(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
{
XGCValues gcv;
#define gcm (GCForeground|GCBackground|GCFillStyle)
if (scr->dtext_color)
WMReleaseColor(scr->dtext_color);
if (scr->dtext_pixel!=scr->white_pixel &&
scr->dtext_pixel!=scr->black_pixel) {
wFreeColor(scr, scr->dtext_pixel);
}
scr->dtext_color = WMCreateRGBColor(scr->wmscreen, color->red,
color->green, color->blue, True);
scr->dtext_pixel = color->pixel;
if (scr->dtext_pixel == scr->mtext_pixel) {
gcv.foreground = scr->white_pixel;
gcv.background = scr->black_pixel;
gcv.fill_style = FillStippled;
if (WMColorPixel(scr->dtext_color) == WMColorPixel(scr->mtext_color)) {
WMSetColorAlpha(scr->dtext_color, 0x7fff);
} else {
gcv.foreground = scr->dtext_pixel;
gcv.fill_style = FillSolid;
WMSetColorAlpha(scr->dtext_color, 0xffff);
}
XChangeGC(dpy, scr->disabled_menu_entry_gc, gcm, &gcv);
wFreeColor(scr, color->pixel);
return REFRESH_MENU_COLOR;
#undef gcm
}
static int
setIconTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
{
@@ -3122,6 +3114,8 @@ setIconTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
color->green, color->blue,
True);
wFreeColor(scr, color->pixel);
return REFRESH_ICON_TITLE_COLOR;
}
@@ -3132,6 +3126,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
XQueryColor (dpy, scr->w_colormap, color);
scr->icon_title_texture = wTextureMakeSolid(scr, color);
@@ -3423,12 +3418,12 @@ setMenuStyle(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
/*
static int
setButtonImages(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
{
static int
setButtonImages(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
{
return REFRESH_BUTTON_IMAGES;
}
*/
}
*/
/*
* Very ugly kluge.

View File

@@ -442,11 +442,12 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text, int state,
WMRect *rect)
{
IconPanel *panel = WMGetHangedData(lPtr);
GC gc = panel->scr->draw_gc;
GC copygc = panel->scr->copy_gc;
WScreen *scr = panel->scr;
GC gc = scr->draw_gc;
GC copygc = scr->copy_gc;
char *file, *dirfile;
WMPixmap *pixmap;
WMColor *black, *white, *gray, *back;
WMColor *back;
WMSize size;
WMScreen *wmscr = WMWidgetScreen(panel->win);
RColor color;
@@ -459,10 +460,7 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text, int state,
width = rect->size.width;
height = rect->size.height;
black = WMBlackColor(wmscr);
white = WMWhiteColor(wmscr);
gray = WMGrayColor(wmscr);
back = (state & WLDSSelected) ? white : gray;
back = (state & WLDSSelected) ? scr->white : scr->gray;
dirfile = wexpandpath(WMGetListSelectedItem(panel->dirList)->text);
len = strlen(dirfile)+strlen(text)+4;
@@ -480,9 +478,6 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text, int state,
if (!pixmap) {
/*WMRemoveListItem(lPtr, index);*/
WMReleaseColor(black);
WMReleaseColor(white);
WMReleaseColor(gray);
return;
}
@@ -490,7 +485,7 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text, int state,
XSetClipMask(dpy, gc, None);
/*XDrawRectangle(dpy, d, WMColorGC(white), x+5, y+5, width-10, 54);*/
XDrawLine(dpy, d, WMColorGC(white), x, y+height-1, x+width, y+height-1);
XDrawLine(dpy, d, WMColorGC(scr->white), x, y+height-1, x+width, y+height-1);
size = WMGetPixmapSize(pixmap);
@@ -512,20 +507,16 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text, int state,
for(i=-1;i<2;i++)
for(j=-1;j<2;j++)
WMDrawString(wmscr, d, white, panel->normalfont,
WMDrawString(wmscr, d, scr->white, panel->normalfont,
ofx+i, ofy+j, text, tlen);
WMDrawString(wmscr, d, black, panel->normalfont, ofx, ofy,
WMDrawString(wmscr, d, scr->black, panel->normalfont, ofx, ofy,
text, tlen);
}
WMReleasePixmap(pixmap);
/* I hope it is better to do not use cache / on my box it is fast nuff */
XFlush(dpy);
WMReleaseColor(black);
WMReleaseColor(white);
WMReleaseColor(gray);
}

View File

@@ -4221,7 +4221,8 @@ showClipBalloon(WDock *dock, int workspace)
XMoveWindow(dpy, scr->clip_balloon, x, y);
XClearWindow(dpy, scr->clip_balloon);
WMDrawString(scr->wmscreen, scr->clip_balloon,
scr->clip_title_color[CLIP_NORMAL], scr->clip_title_font,
scr->clip_title_color[CLIP_NORMAL],
scr->clip_title_font,
0, 0, text, strlen(text));
}

View File

@@ -67,7 +67,7 @@ WFrameWindow*
wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
int width, int height, int *clearance, int flags,
WTexture **title_texture, WTexture **resize_texture,
unsigned long *color, WMFont **font)
WMColor **color, WMFont **font)
{
WFrameWindow *fwin;
@@ -80,7 +80,7 @@ wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
fwin->title_texture = title_texture;
fwin->resizebar_texture = resize_texture;
fwin->title_pixel = color;
fwin->title_color = color;
fwin->title_clearance = clearance;
fwin->font = font;
#ifdef KEEP_XKB_LOCK_STATUS
@@ -1050,8 +1050,6 @@ wFrameWindowPaint(WFrameWindow *fwin)
if (fwin->title) {
char *title;
WMColor *color;
WMPixel pixel;
title = ShrinkString(*fwin->font, fwin->title,
fwin->titlebar->width - lofs - rofs);
@@ -1075,15 +1073,11 @@ wFrameWindowPaint(WFrameWindow *fwin)
break;
}
color = WMBlackColor(scr->wmscreen);
/* ugly hack */
pixel = color->color.pixel;
color->color.pixel = fwin->title_pixel[fwin->flags.state];
WMDrawString(scr->wmscreen, fwin->titlebar->window, color,
*fwin->font, x, *fwin->title_clearance + TITLEBAR_EXTEND_SPACE,
WMDrawString(scr->wmscreen, fwin->titlebar->window,
fwin->title_color[fwin->flags.state],
*fwin->font, x,
*fwin->title_clearance + TITLEBAR_EXTEND_SPACE,
title, titlelen);
color->color.pixel = pixel;
WMReleaseColor(color);
wfree(title);
}
@@ -1255,7 +1249,7 @@ wFrameWindowUpdatePushButton(WFrameWindow *fwin, Bool pushed)
fwin->flags.right_button_pushed_in = pushed;
paintButton(fwin->right_button, fwin->title_texture[fwin->flags.state],
fwin->title_pixel[fwin->flags.state],
WMColorPixel(fwin->title_color[fwin->flags.state]),
fwin->rbutton_image, pushed);
}
#endif /* OLWM_HINTS */
@@ -1266,7 +1260,7 @@ void
wFrameWindowUpdateLanguageButton(WFrameWindow *fwin)
{
paintButton(fwin->language_button, fwin->title_texture[fwin->flags.state],
fwin->title_pixel[fwin->flags.state],
WMColorPixel(fwin->title_color[fwin->flags.state]),
fwin->languagebutton_image, True);
}
#endif /* XKB_BUTTON_HINT */
@@ -1433,14 +1427,14 @@ handleButtonExpose(WObjDescriptor *desc, XEvent *event)
if (button == fwin->language_button) {
if (wPreferences.modelock){
paintButton(button, fwin->title_texture[fwin->flags.state],
fwin->title_pixel[fwin->flags.state],
WMColorPixel(fwin->title_color[fwin->flags.state]),
fwin->languagebutton_image, False);
}
} else
#endif
if (button == fwin->left_button) {
paintButton(button, fwin->title_texture[fwin->flags.state],
fwin->title_pixel[fwin->flags.state],
WMColorPixel(fwin->title_color[fwin->flags.state]),
fwin->lbutton_image, False);
} else {
Bool pushed = False;
@@ -1451,7 +1445,7 @@ handleButtonExpose(WObjDescriptor *desc, XEvent *event)
#endif
/* emulate the olwm pushpin in the "out" state */
paintButton(button, fwin->title_texture[fwin->flags.state],
fwin->title_pixel[fwin->flags.state],
WMColorPixel(fwin->title_color[fwin->flags.state]),
fwin->rbutton_image, pushed);
}
}
@@ -1515,7 +1509,7 @@ buttonMouseDown(WObjDescriptor *desc, XEvent *event)
}
#endif
pixel = fwin->title_pixel[fwin->flags.state];
pixel = WMColorPixel(fwin->title_color[fwin->flags.state]);
texture = fwin->title_texture[fwin->flags.state];
paintButton(button, texture, pixel, image, True);

View File

@@ -81,7 +81,7 @@ typedef struct WFrameWindow {
union WTexture **title_texture;
union WTexture **resizebar_texture;
unsigned long *title_pixel;
WMColor **title_color;
WMFont **font;
char *title; /* window name (title) */
@@ -156,7 +156,7 @@ wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
int width, int height, int *clearance, int flags,
union WTexture **title_texture,
union WTexture **resize_texture,
unsigned long *color, WMFont **font);
WMColor **color, WMFont **font);
void wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags);

View File

@@ -175,7 +175,7 @@ wMenuCreate(WScreen *screen, char *title, int main_menu)
menu->frame =
wFrameWindowCreate(screen, tmp, 8, 2, 1, 1, &wPreferences.menu_title_clearance, flags,
screen->menu_title_texture, NULL,
screen->menu_title_pixel,
screen->menu_title_color,
&screen->menu_title_font);
menu->frame->core->descriptor.parent = menu;
@@ -723,14 +723,13 @@ drawFrame(WScreen *scr, Drawable win, int y, int w, int h, int type)
static void
paintEntry(WMenu *menu, int index, int selected)
{
int x, y, w, h, tw;
int type;
GC light, dim, dark, textGC, saveGC;
WMColor *color;
WMPixel pixel, savePixel;
WScreen *scr=menu->frame->screen_ptr;
Window win = menu->menu->window;
WMenuEntry *entry=menu->entries[index];
GC light, dim, dark;
WMColor *color;
int x, y, w, h, tw;
int type;
if (!menu->flags.realized) return;
h = menu->entry_height;
@@ -754,8 +753,7 @@ paintEntry(WMenu *menu, int index, int selected)
/* paint background */
if (selected) {
XSetForeground(dpy, scr->select_menu_gc, scr->select_pixel);
XFillRectangle(dpy, win, scr->select_menu_gc, 1, y+1, w-2, h-3);
XFillRectangle(dpy, win, WMColorGC(scr->white), 1, y+1, w-2, h-3);
if (scr->menu_item_texture->any.type == WTEX_SOLID)
drawFrame(scr, win, y, w, h, type);
} else {
@@ -768,36 +766,23 @@ paintEntry(WMenu *menu, int index, int selected)
}
}
/* very ugly hack */
saveGC = scr->wmscreen->drawStringGC;
color = WMBlackColor(scr->wmscreen);
savePixel = color->color.pixel;
if (selected) {
textGC = scr->select_menu_gc;
if (entry->flags.enabled)
pixel = scr->select_text_pixel;
color = scr->select_text_color;
else
pixel = scr->dtext_pixel;
color = scr->dtext_color;
} else if (!entry->flags.enabled) {
textGC = scr->disabled_menu_entry_gc;
pixel = scr->dtext_pixel;
color = scr->dtext_color;
} else {
textGC = scr->menu_entry_gc;
pixel = scr->mtext_pixel;
color = scr->mtext_color;
}
/* draw text */
x = 5;
if (entry->flags.indicator)
x += MENU_INDICATOR_SPACE + 2;
/* this is nasty */
scr->wmscreen->drawStringGC = textGC;
color->color.pixel = pixel;
WMDrawString(scr->wmscreen, win, color, scr->menu_entry_font,
x, 3 + y + wPreferences.menu_text_clearance, entry->text, strlen(entry->text));
color->color.pixel = savePixel;
scr->wmscreen->drawStringGC = saveGC;
if (entry->cascade>=0) {
/* draw the cascade indicator */
@@ -839,13 +824,13 @@ paintEntry(WMenu *menu, int index, int selected)
if (entry->flags.enabled) {
XSetForeground(dpy, scr->copy_gc, scr->black_pixel);
} else {
XSetForeground(dpy, scr->copy_gc, scr->dtext_pixel);
XSetForeground(dpy, scr->copy_gc, WMColorPixel(scr->dtext_color));
}
} else {
if (entry->flags.enabled) {
XSetForeground(dpy, scr->copy_gc, scr->mtext_pixel);
XSetForeground(dpy, scr->copy_gc, WMColorPixel(scr->mtext_color));
} else {
XSetForeground(dpy, scr->copy_gc, scr->dtext_pixel);
XSetForeground(dpy, scr->copy_gc, WMColorPixel(scr->dtext_color));
}
}
XFillRectangle(dpy, win, scr->copy_gc, 5, y+(h-ih)/2, iw, ih);
@@ -862,15 +847,9 @@ paintEntry(WMenu *menu, int index, int selected)
tw = WMWidthOfString(scr->menu_entry_font, entry->rtext,
strlen(entry->rtext));
/* this is nasty */
scr->wmscreen->drawStringGC = textGC;
color->color.pixel = pixel;
WMDrawString(scr->wmscreen, win, color, scr->menu_entry_font, w-6-tw,
y + 3 + wPreferences.menu_text_clearance, entry->rtext, strlen(entry->rtext));
color->color.pixel = savePixel;
scr->wmscreen->drawStringGC = saveGC;
}
WMReleaseColor(color);
}

View File

@@ -278,7 +278,7 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
wwin->normal_hints->height_inc);
fw = WMWidthOfString(scr->info_text_font, num, strlen(num));
/* XSetForeground(dpy, gc, scr->window_title_pixel[WS_UNFOCUSED]); */
/* XSetForeground(dpy, gc, WMColorPixel(scr->window_title_color[WS_UNFOCUSED])); */
color = WMBlackColor(scr->wmscreen);
saveGC = scr->wmscreen->drawStringGC;
@@ -286,7 +286,7 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
/* Display the height. */
/* ugly hack */
/* // ugly hack */
color->color.pixel = scr->line_pixel;
scr->wmscreen->drawStringGC = gc;
WMDrawString(scr->wmscreen, root, color, scr->info_text_font,
@@ -344,10 +344,10 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
XDrawSegments(dpy, root, gc, segment, 4);
/* XSetForeground(dpy, gc, scr->window_title_pixel[WS_UNFOCUSED]); */
/* XSetForeground(dpy, gc, WMColorPixel(scr->window_title_color[WS_UNFOCUSED])); */
/* Display the width. */
/* ugly hack */
/* // ugly hack */
color->color.pixel = scr->line_pixel;
scr->wmscreen->drawStringGC = gc;
WMDrawString(scr->wmscreen, root, color, scr->info_text_font,

View File

@@ -266,7 +266,6 @@ allocGCs(WScreen *scr)
{
XGCValues gcv;
XColor color;
unsigned long mtextcolor;
int gcm;
scr->stipple_bitmap =
@@ -300,30 +299,11 @@ allocGCs(WScreen *scr)
scr->icon_select_gc = XCreateGC(dpy, scr->w_win, gcm, &gcv);
gcm = GCForeground|GCGraphicsExposures;
scr->menu_title_color[0] = WMRetainColor(scr->white);
scr->menu_title_pixel[0] = scr->white_pixel;
gcv.foreground = scr->white_pixel;
gcv.graphics_exposures = False;
scr->menu_title_gc = XCreateGC(dpy, scr->w_win, gcm, &gcv);
scr->mtext_pixel = scr->black_pixel;
mtextcolor = gcv.foreground = scr->black_pixel;
scr->menu_entry_gc = XCreateGC(dpy, scr->w_win, gcm, &gcv);
/* selected menu entry GC */
gcm = GCForeground|GCBackground|GCGraphicsExposures;
gcv.foreground = scr->white_pixel;
gcv.background = scr->white_pixel;
gcv.graphics_exposures = False;
scr->select_menu_gc = XCreateGC(dpy, scr->w_win, gcm, &gcv);
/* disabled menu entry GC */
scr->dtext_pixel = scr->black_pixel;
gcm = GCForeground|GCBackground|GCStipple|GCGraphicsExposures;
gcv.stipple = scr->stipple_bitmap;
gcv.graphics_exposures = False;
scr->disabled_menu_entry_gc = XCreateGC(dpy, scr->w_win, gcm, &gcv);
/* don't retain scr->black here because we may alter its alpha */
scr->mtext_color = WMCreateRGBColor(scr->wmscreen, 0, 0, 0, True);
scr->dtext_color = WMCreateRGBColor(scr->wmscreen, 0, 0, 0, True);
/* frame GC */
wGetColor(scr, DEF_FRAME_COLOR, &color);
@@ -371,10 +351,6 @@ allocGCs(WScreen *scr)
scr->copy_gc = XCreateGC(dpy, scr->w_win, GCForeground|GCBackground
|GCGraphicsExposures, &gcv);
/* window title text GC */
gcv.graphics_exposures = False;
scr->window_title_gc = XCreateGC(dpy, scr->w_win,GCGraphicsExposures,&gcv);
/* clip title GC */
scr->clip_title_gc = XCreateGC(dpy, scr->w_win, GCGraphicsExposures, &gcv);
@@ -764,26 +740,24 @@ wScreenInit(int screen_number)
scr->w_depth = scr->rcontext->depth;
scr->w_colormap = scr->rcontext->cmap;
scr->black_pixel = scr->rcontext->black;
scr->white_pixel = scr->rcontext->white;
/* create screen descriptor for WINGs */
scr->wmscreen = WMCreateScreenWithRContext(dpy, screen_number,
scr->rcontext);
if (!scr->wmscreen) {
wfatal(_("could not do initialization of WINGs widget set"));
wfatal(_("could not initialize WINGs widget set"));
return NULL;
}
color = WMGrayColor(scr->wmscreen);
scr->light_pixel = WMColorPixel(color);
WMReleaseColor(color);
scr->black = WMBlackColor(scr->wmscreen);
scr->white = WMWhiteColor(scr->wmscreen);
scr->gray = WMGrayColor(scr->wmscreen);
scr->darkGray = WMDarkGrayColor(scr->wmscreen);
color = WMDarkGrayColor(scr->wmscreen);
scr->dark_pixel = WMColorPixel(color);
WMReleaseColor(color);
scr->black_pixel = WMColorPixel(scr->black); /*scr->rcontext->black;*/
scr->white_pixel = WMColorPixel(scr->white); /*scr->rcontext->white;*/
scr->light_pixel = WMColorPixel(scr->gray);
scr->dark_pixel = WMColorPixel(scr->darkGray);
{
XColor xcol;
@@ -795,7 +769,6 @@ wScreenInit(int screen_number)
/* create GCs with default values */
allocGCs(scr);
/* for our window manager info notice board. Need to
* create before reading the defaults, because it will be used there.
*/

View File

@@ -140,6 +140,10 @@ typedef struct _WScreen {
WArea totalUsableArea; /* same as above, but including
* the dock and other stuff */
WMColor *black;
WMColor *white;
WMColor *gray;
WMColor *darkGray;
WMPixel black_pixel;
WMPixel white_pixel;
@@ -159,14 +163,14 @@ typedef struct _WScreen {
* hint boxes */
WMFont *workspace_name_font;
WMPixel select_pixel;
WMPixel select_text_pixel;
WMColor *select_color;
WMColor *select_text_color;
/* foreground colors */
WMPixel window_title_pixel[3]; /* window titlebar text (foc, unfoc, pfoc)*/
WMPixel menu_title_pixel[3]; /* menu titlebar text */
WMColor *window_title_color[3]; /* window titlebar text (foc, unfoc, pfoc)*/
WMColor *menu_title_color[3]; /* menu titlebar text */
WMColor *clip_title_color[2]; /* clip title text */
WMPixel mtext_pixel; /* menu item text */
WMPixel dtext_pixel; /* disabled menu item text */
WMColor *mtext_color; /* menu item text */
WMColor *dtext_color; /* disabled menu item text */
WMPixel line_pixel;
WMPixel frame_border_pixel; /* frame border */
@@ -185,14 +189,9 @@ typedef struct _WScreen {
struct WTexSolid *icon_back_texture; /* icon back color for shadowing */
GC window_title_gc; /* window title text GC */
GC menu_title_gc; /* menu titles */
WMColor *icon_title_color; /* icon title color */
GC clip_title_gc; /* clip title */
GC menu_entry_gc; /* menu entries */
GC select_menu_gc; /* selected menu entries */
GC disabled_menu_entry_gc; /* disabled menu entries */
GC info_text_gc; /* for size/position display */
GC icon_select_gc;

View File

@@ -322,11 +322,11 @@ wTextDestroy( WTextInput *wtext )
* Global: dpy - the display *
\********************************************************************/
static void
textRefresh( WTextInput *wtext )
textRefresh(WTextInput *wtext)
{
int x1,x2,y1,y2;
WScreen *scr = wtext->core->screen_ptr;
char *ptr = wtext->text.txt;
WMColor *black, *white;
int x1,x2,y1,y2;
/* x1,y1 is the upper left corner of the text box */
x1 = wtext->xOffset;
@@ -337,57 +337,50 @@ textRefresh( WTextInput *wtext )
/* Fill in the text field. Use the invGC to draw the rectangle,
* becuase then it will be the background color */
XFillRectangle( dpy, wtext->core->window, wtext->invGC,
x1, y1, x2-x1, y2-y1 );
XFillRectangle(dpy, wtext->core->window, wtext->invGC,
x1, y1, x2-x1, y2-y1);
black = WMBlackColor(wtext->core->screen_ptr->wmscreen);
white = WMWhiteColor(wtext->core->screen_ptr->wmscreen);
/* Draw the text normally */
WMDrawImageString(wtext->core->screen_ptr->wmscreen, wtext->core->window,
black, white, wtext->font, x1, y1, ptr, wtext->text.length);
WMDrawImageString(scr->wmscreen, wtext->core->window,
scr->black, scr->white, wtext->font, x1, y1, ptr,
wtext->text.length);
/* Draw the selected text */
if( wtext->text.startPos != wtext->text.endPos )
{
if (wtext->text.startPos != wtext->text.endPos) {
int sp,ep;
/* we need sp < ep */
if( wtext->text.startPos > wtext->text.endPos )
{
if (wtext->text.startPos > wtext->text.endPos) {
sp = wtext->text.endPos;
ep = wtext->text.startPos;
}
else
{
} else {
sp = wtext->text.startPos;
ep = wtext->text.endPos;
}
/* x1,y1 is now the upper-left of the selected area */
x1 += WMWidthOfString( wtext->font, ptr, sp );
x1 += WMWidthOfString(wtext->font, ptr, sp);
/* and x2,y2 is the lower-right of the selected area */
ptr += sp * sizeof(char);
x2 = x1 + WMWidthOfString( wtext->font, ptr, (ep - sp) );
x2 = x1 + WMWidthOfString(wtext->font, ptr, (ep - sp));
/* Fill in the area where the selected text will go: *
* use the regGC to draw the rectangle, becuase then it *
* will be the color of the non-selected text */
XFillRectangle( dpy, wtext->core->window, wtext->regGC,
x1, y1, x2-x1, y2-y1 );
XFillRectangle(dpy, wtext->core->window, wtext->regGC,
x1, y1, x2-x1, y2-y1);
/* Draw the selected text... use invGC so it will be the
* opposite color as the filled rectangle */
WMDrawImageString(wtext->core->screen_ptr->wmscreen, wtext->core->window,
white, black, wtext->font, x1, y1, ptr, (ep - sp));
WMDrawImageString(scr->wmscreen, wtext->core->window,
scr->white, scr->black, wtext->font, x1, y1, ptr,
(ep - sp));
}
WMReleaseColor(white);
WMReleaseColor(black);
/* And draw a quick little line for the cursor position */
x1 = WMWidthOfString( wtext->font, wtext->text.txt, wtext->text.endPos )
x1 = WMWidthOfString(wtext->font, wtext->text.txt, wtext->text.endPos)
+ wtext->xOffset;
XDrawLine( dpy, wtext->core->window, wtext->regGC, x1, 2, x1,
wtext->core->height - 3 );
}
XDrawLine(dpy, wtext->core->window, wtext->regGC, x1, 2, x1,
wtext->core->height - 3);
}
/********************************************************************\

View File

@@ -1154,7 +1154,7 @@ wManageWindow(WScreen *scr, Window window)
&wPreferences.window_title_clearance, foo,
scr->window_title_texture,
scr->resizebar_texture,
scr->window_title_pixel,
scr->window_title_color,
&scr->title_font);
wwin->frame->flags.is_client_window_frame = 1;
@@ -1513,7 +1513,7 @@ wManageInternalWindow(WScreen *scr, Window window, Window owner,
&wPreferences.window_title_clearance, foo,
scr->window_title_texture,
scr->resizebar_texture,
scr->window_title_pixel,
scr->window_title_color,
&scr->title_font);
XSaveContext(dpy, window, wWinContext, (XPointer)&wwin->client_descriptor);

View File

@@ -275,7 +275,6 @@ showWorkspaceName(WScreen *scr, int workspace)
WorkspaceNameData *data;
RXImage *ximg;
Pixmap text, mask;
WMColor *color;
int w, h;
int px, py;
char *name = scr->workspaces[workspace]->name;
@@ -342,37 +341,31 @@ showWorkspaceName(WScreen *scr, int workspace)
text = XCreatePixmap(dpy, scr->w_win, w+4, h+4, scr->w_depth);
mask = XCreatePixmap(dpy, scr->w_win, w+4, h+4, 1);
XSetForeground(dpy, scr->draw_gc, scr->black_pixel);
XFillRectangle(dpy, text, scr->draw_gc, 0, 0, w+4, h+4);
/*XSetForeground(dpy, scr->mono_gc, 0);
XFillRectangle(dpy, mask, scr->mono_gc, 0, 0, w+4, h+4);*/
XSetForeground(dpy, scr->mono_gc, 0);
XFillRectangle(dpy, mask, scr->mono_gc, 0, 0, w+4, h+4);
XSetForeground(dpy, scr->mono_gc, 1);
color = WMWhiteColor(scr->wmscreen);
XFillRectangle(dpy, text, WMColorGC(scr->black), 0, 0, w+4, h+4);
for (x = 0; x <= 4; x++) {
GC saveGC = scr->wmscreen->drawStringGC;
WMPixel pixel = color->color.pixel;
/* ugly hack */
color->color.pixel = 1;
scr->wmscreen->drawStringGC = scr->mono_gc;
for (y = 0; y <= 4; y++) {
WMDrawString(scr->wmscreen, mask, color,
WMDrawString(scr->wmscreen, text, scr->white,
scr->workspace_name_font, x, y, name, len);
}
scr->wmscreen->drawStringGC = saveGC;
color->color.pixel = pixel;
}
WMDrawString(scr->wmscreen, text, color, scr->workspace_name_font,
2, 2, scr->workspaces[workspace]->name,
strlen(scr->workspaces[workspace]->name));
WMReleaseColor(color);
XSetForeground(dpy, scr->mono_gc, 1);
XSetBackground(dpy, scr->mono_gc, 0);
XCopyPlane(dpy, text, mask, scr->mono_gc, 0, 0, w+4, h+4, 0, 0, 1<<(scr->w_depth-1));
/*XSetForeground(dpy, scr->mono_gc, 1);*/
XSetBackground(dpy, scr->mono_gc, 1);
XFillRectangle(dpy, text, WMColorGC(scr->black), 0, 0, w+4, h+4);
WMDrawString(scr->wmscreen, text, scr->white, scr->workspace_name_font,
2, 2, name, len);
#ifdef SHAPE
XShapeCombineMask(dpy, scr->workspace_name, ShapeBounding, 0, 0, mask,
ShapeSet);