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:
@@ -290,10 +290,6 @@ updateDockNumbers(WScreen *scr)
|
|||||||
int length;
|
int length;
|
||||||
char *ws_numbers;
|
char *ws_numbers;
|
||||||
WAppIcon *dicon = scr->dock->icon_array[0];
|
WAppIcon *dicon = scr->dock->icon_array[0];
|
||||||
WMColor *black, *white;
|
|
||||||
|
|
||||||
black = WMBlackColor(scr->wmscreen);
|
|
||||||
white = WMWhiteColor(scr->wmscreen);
|
|
||||||
|
|
||||||
ws_numbers = wmalloc(20);
|
ws_numbers = wmalloc(20);
|
||||||
snprintf(ws_numbers, 20, "%i [ %i ]", scr->current_workspace+1,
|
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,
|
XClearArea(dpy, dicon->icon->core->window, 2, 2, 50,
|
||||||
WMFontHeight(scr->icon_title_font)+1, False);
|
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);
|
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);
|
scr->icon_title_font, 3, 2, ws_numbers, length);
|
||||||
|
|
||||||
WMReleaseColor(black);
|
|
||||||
WMReleaseColor(white);
|
|
||||||
wfree(ws_numbers);
|
wfree(ws_numbers);
|
||||||
}
|
}
|
||||||
#endif /* WS_INDICATOR */
|
#endif /* WS_INDICATOR */
|
||||||
|
|||||||
@@ -172,7 +172,6 @@ showText(WScreen *scr, int x, int y, int h, int w, char *text)
|
|||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
Pixmap mask;
|
Pixmap mask;
|
||||||
WMFont *font = scr->info_text_font;
|
WMFont *font = scr->info_text_font;
|
||||||
WMColor *color;
|
|
||||||
int side = 0;
|
int side = 0;
|
||||||
int ty;
|
int ty;
|
||||||
int bx, by;
|
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);
|
pixmap = makePixmap(scr, width, height, side, &mask);
|
||||||
|
|
||||||
color = WMBlackColor(scr->wmscreen);
|
WMDrawString(scr->wmscreen, pixmap, scr->black, font, 8,
|
||||||
|
|
||||||
WMDrawString(scr->wmscreen, pixmap, color, font, 8,
|
|
||||||
ty + (height - WMFontHeight(font))/2,
|
ty + (height - WMFontHeight(font))/2,
|
||||||
text, strlen(text));
|
text, strlen(text));
|
||||||
|
|
||||||
WMReleaseColor(color);
|
|
||||||
|
|
||||||
XSetWindowBackgroundPixmap(dpy, scr->balloon->window, pixmap);
|
XSetWindowBackgroundPixmap(dpy, scr->balloon->window, pixmap);
|
||||||
scr->balloon->contents = pixmap;
|
scr->balloon->contents = pixmap;
|
||||||
|
|
||||||
@@ -241,8 +236,6 @@ showText(WScreen *scr, int x, int y, int h, int w, char *text)
|
|||||||
int height;
|
int height;
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
WMFont *font = scr->info_text_font;
|
WMFont *font = scr->info_text_font;
|
||||||
WMColor *color;
|
|
||||||
WMPixel pixel;
|
|
||||||
|
|
||||||
if (scr->balloon->contents)
|
if (scr->balloon->contents)
|
||||||
XFreePixmap(dpy, 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);
|
pixmap = XCreatePixmap(dpy, scr->root_win, width, height, scr->w_depth);
|
||||||
XFillRectangle(dpy, pixmap, scr->draw_gc, 0, 0, width, height);
|
XFillRectangle(dpy, pixmap, scr->draw_gc, 0, 0, width, height);
|
||||||
|
|
||||||
/* ugly hack */
|
WMDrawString(scr->wmscreen, pixmap, scr->window_title_color[0], font, 4, 2,
|
||||||
color = WMBlackColor(scr->wmscreen);
|
text, strlen(text));
|
||||||
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);
|
|
||||||
|
|
||||||
XResizeWindow(dpy, scr->balloon->window, width, height);
|
XResizeWindow(dpy, scr->balloon->window, width, height);
|
||||||
XMoveWindow(dpy, scr->balloon->window, x, y);
|
XMoveWindow(dpy, scr->balloon->window, x, y);
|
||||||
|
|||||||
107
src/defaults.c
107
src/defaults.c
@@ -2962,12 +2962,14 @@ setLargeDisplayFont(WScreen *scr, WDefaultEntry *entry, WMFont *font, void *foo)
|
|||||||
static int
|
static int
|
||||||
setHightlight(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
setHightlight(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
||||||
{
|
{
|
||||||
if (scr->select_pixel!=scr->white_pixel &&
|
if (scr->select_color)
|
||||||
scr->select_pixel!=scr->black_pixel) {
|
WMReleaseColor(scr->select_color);
|
||||||
wFreeColor(scr, scr->select_pixel);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
return REFRESH_MENU_COLOR;
|
||||||
}
|
}
|
||||||
@@ -2976,12 +2978,14 @@ setHightlight(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
|||||||
static int
|
static int
|
||||||
setHightlightText(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
setHightlightText(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
||||||
{
|
{
|
||||||
if (scr->select_text_pixel!=scr->white_pixel &&
|
if (scr->select_text_color)
|
||||||
scr->select_text_pixel!=scr->black_pixel) {
|
WMReleaseColor(scr->select_text_color);
|
||||||
wFreeColor(scr, scr->select_text_pixel);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
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,
|
scr->clip_title_color[index] = WMCreateRGBColor(scr->wmscreen, color->red,
|
||||||
color->green, color->blue,
|
color->green, color->blue,
|
||||||
True);
|
True);
|
||||||
|
wFreeColor(scr, color->pixel);
|
||||||
|
|
||||||
#ifdef GRADIENT_CLIP_ARROW
|
#ifdef GRADIENT_CLIP_ARROW
|
||||||
if (index == CLIP_NORMAL) {
|
if (index == CLIP_NORMAL) {
|
||||||
@@ -3026,16 +3031,18 @@ setClipTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
|
|||||||
static int
|
static int
|
||||||
setWTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
|
setWTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
|
||||||
{
|
{
|
||||||
if (scr->window_title_pixel[index]!=scr->white_pixel &&
|
if (scr->window_title_color[index])
|
||||||
scr->window_title_pixel[index]!=scr->black_pixel) {
|
WMReleaseColor(scr->window_title_color[index]);
|
||||||
wFreeColor(scr, scr->window_title_pixel[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)
|
if (index == WS_UNFOCUSED)
|
||||||
XSetForeground(dpy, scr->info_text_gc, color->pixel);
|
XSetForeground(dpy, scr->info_text_gc, color->pixel);
|
||||||
|
|
||||||
|
wFreeColor(scr, color->pixel);
|
||||||
|
|
||||||
return REFRESH_WINDOW_TITLE_COLOR;
|
return REFRESH_WINDOW_TITLE_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3043,13 +3050,14 @@ setWTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
|
|||||||
static int
|
static int
|
||||||
setMenuTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
|
setMenuTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
|
||||||
{
|
{
|
||||||
if (scr->menu_title_pixel[0]!=scr->white_pixel &&
|
if (scr->menu_title_color[0])
|
||||||
scr->menu_title_pixel[0]!=scr->black_pixel) {
|
WMReleaseColor(scr->menu_title_color[0]);
|
||||||
wFreeColor(scr, scr->menu_title_pixel[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
scr->menu_title_pixel[0] = color->pixel;
|
scr->menu_title_color[0] =
|
||||||
XSetForeground(dpy, scr->menu_title_gc, color->pixel);
|
WMCreateRGBColor(scr->wmscreen, color->red, color->green,
|
||||||
|
color->blue, True);
|
||||||
|
|
||||||
|
wFreeColor(scr, color->pixel);
|
||||||
|
|
||||||
return REFRESH_MENU_TITLE_COLOR;
|
return REFRESH_MENU_TITLE_COLOR;
|
||||||
}
|
}
|
||||||
@@ -3058,61 +3066,45 @@ setMenuTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
|
|||||||
static int
|
static int
|
||||||
setMenuTextColor(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
setMenuTextColor(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
||||||
{
|
{
|
||||||
XGCValues gcv;
|
if (scr->mtext_color)
|
||||||
#define gcm (GCForeground|GCBackground|GCFillStyle)
|
WMReleaseColor(scr->mtext_color);
|
||||||
|
|
||||||
if (scr->mtext_pixel!=scr->white_pixel &&
|
scr->mtext_color = WMCreateRGBColor(scr->wmscreen, color->red,
|
||||||
scr->mtext_pixel!=scr->black_pixel) {
|
color->green, color->blue, True);
|
||||||
wFreeColor(scr, scr->mtext_pixel);
|
|
||||||
}
|
|
||||||
|
|
||||||
scr->mtext_pixel = color->pixel;
|
if (WMColorPixel(scr->dtext_color) == WMColorPixel(scr->mtext_color)) {
|
||||||
|
WMSetColorAlpha(scr->dtext_color, 0x7fff);
|
||||||
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;
|
|
||||||
} else {
|
} else {
|
||||||
gcv.foreground = scr->dtext_pixel;
|
WMSetColorAlpha(scr->dtext_color, 0xffff);
|
||||||
gcv.fill_style = FillSolid;
|
|
||||||
}
|
}
|
||||||
XChangeGC(dpy, scr->disabled_menu_entry_gc, gcm, &gcv);
|
|
||||||
|
wFreeColor(scr, color->pixel);
|
||||||
|
|
||||||
return REFRESH_MENU_COLOR;
|
return REFRESH_MENU_COLOR;
|
||||||
#undef gcm
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
setMenuDisabledColor(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
setMenuDisabledColor(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
||||||
{
|
{
|
||||||
XGCValues gcv;
|
if (scr->dtext_color)
|
||||||
#define gcm (GCForeground|GCBackground|GCFillStyle)
|
WMReleaseColor(scr->dtext_color);
|
||||||
|
|
||||||
if (scr->dtext_pixel!=scr->white_pixel &&
|
scr->dtext_color = WMCreateRGBColor(scr->wmscreen, color->red,
|
||||||
scr->dtext_pixel!=scr->black_pixel) {
|
color->green, color->blue, True);
|
||||||
wFreeColor(scr, scr->dtext_pixel);
|
|
||||||
}
|
|
||||||
|
|
||||||
scr->dtext_pixel = color->pixel;
|
if (WMColorPixel(scr->dtext_color) == WMColorPixel(scr->mtext_color)) {
|
||||||
|
WMSetColorAlpha(scr->dtext_color, 0x7fff);
|
||||||
if (scr->dtext_pixel == scr->mtext_pixel) {
|
|
||||||
gcv.foreground = scr->white_pixel;
|
|
||||||
gcv.background = scr->black_pixel;
|
|
||||||
gcv.fill_style = FillStippled;
|
|
||||||
} else {
|
} else {
|
||||||
gcv.foreground = scr->dtext_pixel;
|
WMSetColorAlpha(scr->dtext_color, 0xffff);
|
||||||
gcv.fill_style = FillSolid;
|
|
||||||
}
|
}
|
||||||
XChangeGC(dpy, scr->disabled_menu_entry_gc, gcm, &gcv);
|
|
||||||
|
wFreeColor(scr, color->pixel);
|
||||||
|
|
||||||
return REFRESH_MENU_COLOR;
|
return REFRESH_MENU_COLOR;
|
||||||
#undef gcm
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
setIconTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
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,
|
color->green, color->blue,
|
||||||
True);
|
True);
|
||||||
|
|
||||||
|
wFreeColor(scr, color->pixel);
|
||||||
|
|
||||||
return REFRESH_ICON_TITLE_COLOR;
|
return REFRESH_ICON_TITLE_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3132,6 +3126,7 @@ setIconTitleBack(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
|||||||
if (scr->icon_title_texture) {
|
if (scr->icon_title_texture) {
|
||||||
wTextureDestroy(scr, (WTexture*)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);
|
XQueryColor (dpy, scr->w_colormap, color);
|
||||||
scr->icon_title_texture = wTextureMakeSolid(scr, color);
|
scr->icon_title_texture = wTextureMakeSolid(scr, color);
|
||||||
|
|
||||||
|
|||||||
25
src/dialog.c
25
src/dialog.c
@@ -442,11 +442,12 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text, int state,
|
|||||||
WMRect *rect)
|
WMRect *rect)
|
||||||
{
|
{
|
||||||
IconPanel *panel = WMGetHangedData(lPtr);
|
IconPanel *panel = WMGetHangedData(lPtr);
|
||||||
GC gc = panel->scr->draw_gc;
|
WScreen *scr = panel->scr;
|
||||||
GC copygc = panel->scr->copy_gc;
|
GC gc = scr->draw_gc;
|
||||||
|
GC copygc = scr->copy_gc;
|
||||||
char *file, *dirfile;
|
char *file, *dirfile;
|
||||||
WMPixmap *pixmap;
|
WMPixmap *pixmap;
|
||||||
WMColor *black, *white, *gray, *back;
|
WMColor *back;
|
||||||
WMSize size;
|
WMSize size;
|
||||||
WMScreen *wmscr = WMWidgetScreen(panel->win);
|
WMScreen *wmscr = WMWidgetScreen(panel->win);
|
||||||
RColor color;
|
RColor color;
|
||||||
@@ -459,10 +460,7 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text, int state,
|
|||||||
width = rect->size.width;
|
width = rect->size.width;
|
||||||
height = rect->size.height;
|
height = rect->size.height;
|
||||||
|
|
||||||
black = WMBlackColor(wmscr);
|
back = (state & WLDSSelected) ? scr->white : scr->gray;
|
||||||
white = WMWhiteColor(wmscr);
|
|
||||||
gray = WMGrayColor(wmscr);
|
|
||||||
back = (state & WLDSSelected) ? white : gray;
|
|
||||||
|
|
||||||
dirfile = wexpandpath(WMGetListSelectedItem(panel->dirList)->text);
|
dirfile = wexpandpath(WMGetListSelectedItem(panel->dirList)->text);
|
||||||
len = strlen(dirfile)+strlen(text)+4;
|
len = strlen(dirfile)+strlen(text)+4;
|
||||||
@@ -480,9 +478,6 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text, int state,
|
|||||||
|
|
||||||
if (!pixmap) {
|
if (!pixmap) {
|
||||||
/*WMRemoveListItem(lPtr, index);*/
|
/*WMRemoveListItem(lPtr, index);*/
|
||||||
WMReleaseColor(black);
|
|
||||||
WMReleaseColor(white);
|
|
||||||
WMReleaseColor(gray);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -490,7 +485,7 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text, int state,
|
|||||||
|
|
||||||
XSetClipMask(dpy, gc, None);
|
XSetClipMask(dpy, gc, None);
|
||||||
/*XDrawRectangle(dpy, d, WMColorGC(white), x+5, y+5, width-10, 54);*/
|
/*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);
|
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(i=-1;i<2;i++)
|
||||||
for(j=-1;j<2;j++)
|
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);
|
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);
|
text, tlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
WMReleasePixmap(pixmap);
|
WMReleasePixmap(pixmap);
|
||||||
/* I hope it is better to do not use cache / on my box it is fast nuff */
|
/* I hope it is better to do not use cache / on my box it is fast nuff */
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
|
|
||||||
WMReleaseColor(black);
|
|
||||||
WMReleaseColor(white);
|
|
||||||
WMReleaseColor(gray);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4221,7 +4221,8 @@ showClipBalloon(WDock *dock, int workspace)
|
|||||||
XMoveWindow(dpy, scr->clip_balloon, x, y);
|
XMoveWindow(dpy, scr->clip_balloon, x, y);
|
||||||
XClearWindow(dpy, scr->clip_balloon);
|
XClearWindow(dpy, scr->clip_balloon);
|
||||||
WMDrawString(scr->wmscreen, 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));
|
0, 0, text, strlen(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ WFrameWindow*
|
|||||||
wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
|
wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
|
||||||
int width, int height, int *clearance, int flags,
|
int width, int height, int *clearance, int flags,
|
||||||
WTexture **title_texture, WTexture **resize_texture,
|
WTexture **title_texture, WTexture **resize_texture,
|
||||||
unsigned long *color, WMFont **font)
|
WMColor **color, WMFont **font)
|
||||||
{
|
{
|
||||||
WFrameWindow *fwin;
|
WFrameWindow *fwin;
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
|
|||||||
|
|
||||||
fwin->title_texture = title_texture;
|
fwin->title_texture = title_texture;
|
||||||
fwin->resizebar_texture = resize_texture;
|
fwin->resizebar_texture = resize_texture;
|
||||||
fwin->title_pixel = color;
|
fwin->title_color = color;
|
||||||
fwin->title_clearance = clearance;
|
fwin->title_clearance = clearance;
|
||||||
fwin->font = font;
|
fwin->font = font;
|
||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
@@ -1050,8 +1050,6 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
|
|
||||||
if (fwin->title) {
|
if (fwin->title) {
|
||||||
char *title;
|
char *title;
|
||||||
WMColor *color;
|
|
||||||
WMPixel pixel;
|
|
||||||
|
|
||||||
title = ShrinkString(*fwin->font, fwin->title,
|
title = ShrinkString(*fwin->font, fwin->title,
|
||||||
fwin->titlebar->width - lofs - rofs);
|
fwin->titlebar->width - lofs - rofs);
|
||||||
@@ -1075,15 +1073,11 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
color = WMBlackColor(scr->wmscreen);
|
WMDrawString(scr->wmscreen, fwin->titlebar->window,
|
||||||
/* ugly hack */
|
fwin->title_color[fwin->flags.state],
|
||||||
pixel = color->color.pixel;
|
*fwin->font, x,
|
||||||
color->color.pixel = fwin->title_pixel[fwin->flags.state];
|
*fwin->title_clearance + TITLEBAR_EXTEND_SPACE,
|
||||||
WMDrawString(scr->wmscreen, fwin->titlebar->window, color,
|
|
||||||
*fwin->font, x, *fwin->title_clearance + TITLEBAR_EXTEND_SPACE,
|
|
||||||
title, titlelen);
|
title, titlelen);
|
||||||
color->color.pixel = pixel;
|
|
||||||
WMReleaseColor(color);
|
|
||||||
|
|
||||||
wfree(title);
|
wfree(title);
|
||||||
}
|
}
|
||||||
@@ -1255,7 +1249,7 @@ wFrameWindowUpdatePushButton(WFrameWindow *fwin, Bool pushed)
|
|||||||
fwin->flags.right_button_pushed_in = pushed;
|
fwin->flags.right_button_pushed_in = pushed;
|
||||||
|
|
||||||
paintButton(fwin->right_button, fwin->title_texture[fwin->flags.state],
|
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);
|
fwin->rbutton_image, pushed);
|
||||||
}
|
}
|
||||||
#endif /* OLWM_HINTS */
|
#endif /* OLWM_HINTS */
|
||||||
@@ -1266,7 +1260,7 @@ void
|
|||||||
wFrameWindowUpdateLanguageButton(WFrameWindow *fwin)
|
wFrameWindowUpdateLanguageButton(WFrameWindow *fwin)
|
||||||
{
|
{
|
||||||
paintButton(fwin->language_button, fwin->title_texture[fwin->flags.state],
|
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);
|
fwin->languagebutton_image, True);
|
||||||
}
|
}
|
||||||
#endif /* XKB_BUTTON_HINT */
|
#endif /* XKB_BUTTON_HINT */
|
||||||
@@ -1433,14 +1427,14 @@ handleButtonExpose(WObjDescriptor *desc, XEvent *event)
|
|||||||
if (button == fwin->language_button) {
|
if (button == fwin->language_button) {
|
||||||
if (wPreferences.modelock){
|
if (wPreferences.modelock){
|
||||||
paintButton(button, fwin->title_texture[fwin->flags.state],
|
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);
|
fwin->languagebutton_image, False);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (button == fwin->left_button) {
|
if (button == fwin->left_button) {
|
||||||
paintButton(button, fwin->title_texture[fwin->flags.state],
|
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);
|
fwin->lbutton_image, False);
|
||||||
} else {
|
} else {
|
||||||
Bool pushed = False;
|
Bool pushed = False;
|
||||||
@@ -1451,7 +1445,7 @@ handleButtonExpose(WObjDescriptor *desc, XEvent *event)
|
|||||||
#endif
|
#endif
|
||||||
/* emulate the olwm pushpin in the "out" state */
|
/* emulate the olwm pushpin in the "out" state */
|
||||||
paintButton(button, fwin->title_texture[fwin->flags.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);
|
fwin->rbutton_image, pushed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1515,7 +1509,7 @@ buttonMouseDown(WObjDescriptor *desc, XEvent *event)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pixel = fwin->title_pixel[fwin->flags.state];
|
pixel = WMColorPixel(fwin->title_color[fwin->flags.state]);
|
||||||
texture = fwin->title_texture[fwin->flags.state];
|
texture = fwin->title_texture[fwin->flags.state];
|
||||||
paintButton(button, texture, pixel, image, True);
|
paintButton(button, texture, pixel, image, True);
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ typedef struct WFrameWindow {
|
|||||||
|
|
||||||
union WTexture **title_texture;
|
union WTexture **title_texture;
|
||||||
union WTexture **resizebar_texture;
|
union WTexture **resizebar_texture;
|
||||||
unsigned long *title_pixel;
|
WMColor **title_color;
|
||||||
WMFont **font;
|
WMFont **font;
|
||||||
|
|
||||||
char *title; /* window name (title) */
|
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,
|
int width, int height, int *clearance, int flags,
|
||||||
union WTexture **title_texture,
|
union WTexture **title_texture,
|
||||||
union WTexture **resize_texture,
|
union WTexture **resize_texture,
|
||||||
unsigned long *color, WMFont **font);
|
WMColor **color, WMFont **font);
|
||||||
|
|
||||||
void wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags);
|
void wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags);
|
||||||
|
|
||||||
|
|||||||
47
src/menu.c
47
src/menu.c
@@ -175,7 +175,7 @@ wMenuCreate(WScreen *screen, char *title, int main_menu)
|
|||||||
menu->frame =
|
menu->frame =
|
||||||
wFrameWindowCreate(screen, tmp, 8, 2, 1, 1, &wPreferences.menu_title_clearance, flags,
|
wFrameWindowCreate(screen, tmp, 8, 2, 1, 1, &wPreferences.menu_title_clearance, flags,
|
||||||
screen->menu_title_texture, NULL,
|
screen->menu_title_texture, NULL,
|
||||||
screen->menu_title_pixel,
|
screen->menu_title_color,
|
||||||
&screen->menu_title_font);
|
&screen->menu_title_font);
|
||||||
|
|
||||||
menu->frame->core->descriptor.parent = menu;
|
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
|
static void
|
||||||
paintEntry(WMenu *menu, int index, int selected)
|
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;
|
WScreen *scr=menu->frame->screen_ptr;
|
||||||
Window win = menu->menu->window;
|
Window win = menu->menu->window;
|
||||||
WMenuEntry *entry=menu->entries[index];
|
WMenuEntry *entry=menu->entries[index];
|
||||||
|
GC light, dim, dark;
|
||||||
|
WMColor *color;
|
||||||
|
int x, y, w, h, tw;
|
||||||
|
int type;
|
||||||
|
|
||||||
if (!menu->flags.realized) return;
|
if (!menu->flags.realized) return;
|
||||||
h = menu->entry_height;
|
h = menu->entry_height;
|
||||||
@@ -754,8 +753,7 @@ paintEntry(WMenu *menu, int index, int selected)
|
|||||||
|
|
||||||
/* paint background */
|
/* paint background */
|
||||||
if (selected) {
|
if (selected) {
|
||||||
XSetForeground(dpy, scr->select_menu_gc, scr->select_pixel);
|
XFillRectangle(dpy, win, WMColorGC(scr->white), 1, y+1, w-2, h-3);
|
||||||
XFillRectangle(dpy, win, scr->select_menu_gc, 1, y+1, w-2, h-3);
|
|
||||||
if (scr->menu_item_texture->any.type == WTEX_SOLID)
|
if (scr->menu_item_texture->any.type == WTEX_SOLID)
|
||||||
drawFrame(scr, win, y, w, h, type);
|
drawFrame(scr, win, y, w, h, type);
|
||||||
} else {
|
} 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) {
|
if (selected) {
|
||||||
textGC = scr->select_menu_gc;
|
|
||||||
if (entry->flags.enabled)
|
if (entry->flags.enabled)
|
||||||
pixel = scr->select_text_pixel;
|
color = scr->select_text_color;
|
||||||
else
|
else
|
||||||
pixel = scr->dtext_pixel;
|
color = scr->dtext_color;
|
||||||
} else if (!entry->flags.enabled) {
|
} else if (!entry->flags.enabled) {
|
||||||
textGC = scr->disabled_menu_entry_gc;
|
color = scr->dtext_color;
|
||||||
pixel = scr->dtext_pixel;
|
|
||||||
} else {
|
} else {
|
||||||
textGC = scr->menu_entry_gc;
|
color = scr->mtext_color;
|
||||||
pixel = scr->mtext_pixel;
|
|
||||||
}
|
}
|
||||||
/* draw text */
|
/* draw text */
|
||||||
x = 5;
|
x = 5;
|
||||||
if (entry->flags.indicator)
|
if (entry->flags.indicator)
|
||||||
x += MENU_INDICATOR_SPACE + 2;
|
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,
|
WMDrawString(scr->wmscreen, win, color, scr->menu_entry_font,
|
||||||
x, 3 + y + wPreferences.menu_text_clearance, entry->text, strlen(entry->text));
|
x, 3 + y + wPreferences.menu_text_clearance, entry->text, strlen(entry->text));
|
||||||
color->color.pixel = savePixel;
|
|
||||||
scr->wmscreen->drawStringGC = saveGC;
|
|
||||||
|
|
||||||
if (entry->cascade>=0) {
|
if (entry->cascade>=0) {
|
||||||
/* draw the cascade indicator */
|
/* draw the cascade indicator */
|
||||||
@@ -839,13 +824,13 @@ paintEntry(WMenu *menu, int index, int selected)
|
|||||||
if (entry->flags.enabled) {
|
if (entry->flags.enabled) {
|
||||||
XSetForeground(dpy, scr->copy_gc, scr->black_pixel);
|
XSetForeground(dpy, scr->copy_gc, scr->black_pixel);
|
||||||
} else {
|
} else {
|
||||||
XSetForeground(dpy, scr->copy_gc, scr->dtext_pixel);
|
XSetForeground(dpy, scr->copy_gc, WMColorPixel(scr->dtext_color));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (entry->flags.enabled) {
|
if (entry->flags.enabled) {
|
||||||
XSetForeground(dpy, scr->copy_gc, scr->mtext_pixel);
|
XSetForeground(dpy, scr->copy_gc, WMColorPixel(scr->mtext_color));
|
||||||
} else {
|
} 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);
|
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,
|
tw = WMWidthOfString(scr->menu_entry_font, entry->rtext,
|
||||||
strlen(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,
|
WMDrawString(scr->wmscreen, win, color, scr->menu_entry_font, w-6-tw,
|
||||||
y + 3 + wPreferences.menu_text_clearance, entry->rtext, strlen(entry->rtext));
|
y + 3 + wPreferences.menu_text_clearance, entry->rtext, strlen(entry->rtext));
|
||||||
color->color.pixel = savePixel;
|
|
||||||
scr->wmscreen->drawStringGC = saveGC;
|
|
||||||
}
|
}
|
||||||
WMReleaseColor(color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
|||||||
wwin->normal_hints->height_inc);
|
wwin->normal_hints->height_inc);
|
||||||
fw = WMWidthOfString(scr->info_text_font, num, strlen(num));
|
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);
|
color = WMBlackColor(scr->wmscreen);
|
||||||
saveGC = scr->wmscreen->drawStringGC;
|
saveGC = scr->wmscreen->drawStringGC;
|
||||||
@@ -286,7 +286,7 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
|||||||
|
|
||||||
/* Display the height. */
|
/* Display the height. */
|
||||||
|
|
||||||
/* ugly hack */
|
/* // ugly hack */
|
||||||
color->color.pixel = scr->line_pixel;
|
color->color.pixel = scr->line_pixel;
|
||||||
scr->wmscreen->drawStringGC = gc;
|
scr->wmscreen->drawStringGC = gc;
|
||||||
WMDrawString(scr->wmscreen, root, color, scr->info_text_font,
|
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);
|
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. */
|
/* Display the width. */
|
||||||
/* ugly hack */
|
/* // ugly hack */
|
||||||
color->color.pixel = scr->line_pixel;
|
color->color.pixel = scr->line_pixel;
|
||||||
scr->wmscreen->drawStringGC = gc;
|
scr->wmscreen->drawStringGC = gc;
|
||||||
WMDrawString(scr->wmscreen, root, color, scr->info_text_font,
|
WMDrawString(scr->wmscreen, root, color, scr->info_text_font,
|
||||||
|
|||||||
53
src/screen.c
53
src/screen.c
@@ -266,7 +266,6 @@ allocGCs(WScreen *scr)
|
|||||||
{
|
{
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
XColor color;
|
XColor color;
|
||||||
unsigned long mtextcolor;
|
|
||||||
int gcm;
|
int gcm;
|
||||||
|
|
||||||
scr->stipple_bitmap =
|
scr->stipple_bitmap =
|
||||||
@@ -300,30 +299,11 @@ allocGCs(WScreen *scr)
|
|||||||
|
|
||||||
scr->icon_select_gc = XCreateGC(dpy, scr->w_win, gcm, &gcv);
|
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;
|
/* don't retain scr->black here because we may alter its alpha */
|
||||||
gcv.foreground = scr->white_pixel;
|
scr->mtext_color = WMCreateRGBColor(scr->wmscreen, 0, 0, 0, True);
|
||||||
gcv.graphics_exposures = False;
|
scr->dtext_color = WMCreateRGBColor(scr->wmscreen, 0, 0, 0, True);
|
||||||
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);
|
|
||||||
|
|
||||||
/* frame GC */
|
/* frame GC */
|
||||||
wGetColor(scr, DEF_FRAME_COLOR, &color);
|
wGetColor(scr, DEF_FRAME_COLOR, &color);
|
||||||
@@ -371,10 +351,6 @@ allocGCs(WScreen *scr)
|
|||||||
scr->copy_gc = XCreateGC(dpy, scr->w_win, GCForeground|GCBackground
|
scr->copy_gc = XCreateGC(dpy, scr->w_win, GCForeground|GCBackground
|
||||||
|GCGraphicsExposures, &gcv);
|
|GCGraphicsExposures, &gcv);
|
||||||
|
|
||||||
/* window title text GC */
|
|
||||||
gcv.graphics_exposures = False;
|
|
||||||
scr->window_title_gc = XCreateGC(dpy, scr->w_win,GCGraphicsExposures,&gcv);
|
|
||||||
|
|
||||||
/* clip title GC */
|
/* clip title GC */
|
||||||
scr->clip_title_gc = XCreateGC(dpy, scr->w_win, GCGraphicsExposures, &gcv);
|
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_depth = scr->rcontext->depth;
|
||||||
scr->w_colormap = scr->rcontext->cmap;
|
scr->w_colormap = scr->rcontext->cmap;
|
||||||
|
|
||||||
scr->black_pixel = scr->rcontext->black;
|
|
||||||
scr->white_pixel = scr->rcontext->white;
|
|
||||||
|
|
||||||
/* create screen descriptor for WINGs */
|
/* create screen descriptor for WINGs */
|
||||||
scr->wmscreen = WMCreateScreenWithRContext(dpy, screen_number,
|
scr->wmscreen = WMCreateScreenWithRContext(dpy, screen_number,
|
||||||
scr->rcontext);
|
scr->rcontext);
|
||||||
|
|
||||||
if (!scr->wmscreen) {
|
if (!scr->wmscreen) {
|
||||||
wfatal(_("could not do initialization of WINGs widget set"));
|
wfatal(_("could not initialize WINGs widget set"));
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
color = WMGrayColor(scr->wmscreen);
|
scr->black = WMBlackColor(scr->wmscreen);
|
||||||
scr->light_pixel = WMColorPixel(color);
|
scr->white = WMWhiteColor(scr->wmscreen);
|
||||||
WMReleaseColor(color);
|
scr->gray = WMGrayColor(scr->wmscreen);
|
||||||
|
scr->darkGray = WMDarkGrayColor(scr->wmscreen);
|
||||||
|
|
||||||
color = WMDarkGrayColor(scr->wmscreen);
|
scr->black_pixel = WMColorPixel(scr->black); /*scr->rcontext->black;*/
|
||||||
scr->dark_pixel = WMColorPixel(color);
|
scr->white_pixel = WMColorPixel(scr->white); /*scr->rcontext->white;*/
|
||||||
WMReleaseColor(color);
|
scr->light_pixel = WMColorPixel(scr->gray);
|
||||||
|
scr->dark_pixel = WMColorPixel(scr->darkGray);
|
||||||
|
|
||||||
{
|
{
|
||||||
XColor xcol;
|
XColor xcol;
|
||||||
@@ -795,7 +769,6 @@ wScreenInit(int screen_number)
|
|||||||
/* create GCs with default values */
|
/* create GCs with default values */
|
||||||
allocGCs(scr);
|
allocGCs(scr);
|
||||||
|
|
||||||
|
|
||||||
/* for our window manager info notice board. Need to
|
/* for our window manager info notice board. Need to
|
||||||
* create before reading the defaults, because it will be used there.
|
* create before reading the defaults, because it will be used there.
|
||||||
*/
|
*/
|
||||||
|
|||||||
21
src/screen.h
21
src/screen.h
@@ -140,6 +140,10 @@ typedef struct _WScreen {
|
|||||||
WArea totalUsableArea; /* same as above, but including
|
WArea totalUsableArea; /* same as above, but including
|
||||||
* the dock and other stuff */
|
* the dock and other stuff */
|
||||||
|
|
||||||
|
WMColor *black;
|
||||||
|
WMColor *white;
|
||||||
|
WMColor *gray;
|
||||||
|
WMColor *darkGray;
|
||||||
|
|
||||||
WMPixel black_pixel;
|
WMPixel black_pixel;
|
||||||
WMPixel white_pixel;
|
WMPixel white_pixel;
|
||||||
@@ -159,14 +163,14 @@ typedef struct _WScreen {
|
|||||||
* hint boxes */
|
* hint boxes */
|
||||||
WMFont *workspace_name_font;
|
WMFont *workspace_name_font;
|
||||||
|
|
||||||
WMPixel select_pixel;
|
WMColor *select_color;
|
||||||
WMPixel select_text_pixel;
|
WMColor *select_text_color;
|
||||||
/* foreground colors */
|
/* foreground colors */
|
||||||
WMPixel window_title_pixel[3]; /* window titlebar text (foc, unfoc, pfoc)*/
|
WMColor *window_title_color[3]; /* window titlebar text (foc, unfoc, pfoc)*/
|
||||||
WMPixel menu_title_pixel[3]; /* menu titlebar text */
|
WMColor *menu_title_color[3]; /* menu titlebar text */
|
||||||
WMColor *clip_title_color[2]; /* clip title text */
|
WMColor *clip_title_color[2]; /* clip title text */
|
||||||
WMPixel mtext_pixel; /* menu item text */
|
WMColor *mtext_color; /* menu item text */
|
||||||
WMPixel dtext_pixel; /* disabled menu item text */
|
WMColor *dtext_color; /* disabled menu item text */
|
||||||
WMPixel line_pixel;
|
WMPixel line_pixel;
|
||||||
WMPixel frame_border_pixel; /* frame border */
|
WMPixel frame_border_pixel; /* frame border */
|
||||||
|
|
||||||
@@ -185,14 +189,9 @@ typedef struct _WScreen {
|
|||||||
|
|
||||||
struct WTexSolid *icon_back_texture; /* icon back color for shadowing */
|
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 */
|
WMColor *icon_title_color; /* icon title color */
|
||||||
GC clip_title_gc; /* clip title */
|
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 info_text_gc; /* for size/position display */
|
||||||
GC icon_select_gc;
|
GC icon_select_gc;
|
||||||
|
|
||||||
|
|||||||
29
src/text.c
29
src/text.c
@@ -324,9 +324,9 @@ wTextDestroy( WTextInput *wtext )
|
|||||||
static void
|
static void
|
||||||
textRefresh(WTextInput *wtext)
|
textRefresh(WTextInput *wtext)
|
||||||
{
|
{
|
||||||
int x1,x2,y1,y2;
|
WScreen *scr = wtext->core->screen_ptr;
|
||||||
char *ptr = wtext->text.txt;
|
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,y1 is the upper left corner of the text box */
|
||||||
x1 = wtext->xOffset;
|
x1 = wtext->xOffset;
|
||||||
@@ -340,24 +340,19 @@ textRefresh( WTextInput *wtext )
|
|||||||
XFillRectangle(dpy, wtext->core->window, wtext->invGC,
|
XFillRectangle(dpy, wtext->core->window, wtext->invGC,
|
||||||
x1, y1, x2-x1, y2-y1);
|
x1, y1, x2-x1, y2-y1);
|
||||||
|
|
||||||
black = WMBlackColor(wtext->core->screen_ptr->wmscreen);
|
|
||||||
white = WMWhiteColor(wtext->core->screen_ptr->wmscreen);
|
|
||||||
/* Draw the text normally */
|
/* Draw the text normally */
|
||||||
WMDrawImageString(wtext->core->screen_ptr->wmscreen, wtext->core->window,
|
WMDrawImageString(scr->wmscreen, wtext->core->window,
|
||||||
black, white, wtext->font, x1, y1, ptr, wtext->text.length);
|
scr->black, scr->white, wtext->font, x1, y1, ptr,
|
||||||
|
wtext->text.length);
|
||||||
|
|
||||||
/* Draw the selected text */
|
/* Draw the selected text */
|
||||||
if( wtext->text.startPos != wtext->text.endPos )
|
if (wtext->text.startPos != wtext->text.endPos) {
|
||||||
{
|
|
||||||
int sp,ep;
|
int sp,ep;
|
||||||
/* we need sp < ep */
|
/* we need sp < ep */
|
||||||
if( wtext->text.startPos > wtext->text.endPos )
|
if (wtext->text.startPos > wtext->text.endPos) {
|
||||||
{
|
|
||||||
sp = wtext->text.endPos;
|
sp = wtext->text.endPos;
|
||||||
ep = wtext->text.startPos;
|
ep = wtext->text.startPos;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
sp = wtext->text.startPos;
|
sp = wtext->text.startPos;
|
||||||
ep = wtext->text.endPos;
|
ep = wtext->text.endPos;
|
||||||
}
|
}
|
||||||
@@ -375,13 +370,11 @@ textRefresh( WTextInput *wtext )
|
|||||||
|
|
||||||
/* Draw the selected text... use invGC so it will be the
|
/* Draw the selected text... use invGC so it will be the
|
||||||
* opposite color as the filled rectangle */
|
* opposite color as the filled rectangle */
|
||||||
WMDrawImageString(wtext->core->screen_ptr->wmscreen, wtext->core->window,
|
WMDrawImageString(scr->wmscreen, wtext->core->window,
|
||||||
white, black, wtext->font, x1, y1, ptr, (ep - sp));
|
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 */
|
/* 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;
|
+ wtext->xOffset;
|
||||||
|
|||||||
@@ -1154,7 +1154,7 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
&wPreferences.window_title_clearance, foo,
|
&wPreferences.window_title_clearance, foo,
|
||||||
scr->window_title_texture,
|
scr->window_title_texture,
|
||||||
scr->resizebar_texture,
|
scr->resizebar_texture,
|
||||||
scr->window_title_pixel,
|
scr->window_title_color,
|
||||||
&scr->title_font);
|
&scr->title_font);
|
||||||
|
|
||||||
wwin->frame->flags.is_client_window_frame = 1;
|
wwin->frame->flags.is_client_window_frame = 1;
|
||||||
@@ -1513,7 +1513,7 @@ wManageInternalWindow(WScreen *scr, Window window, Window owner,
|
|||||||
&wPreferences.window_title_clearance, foo,
|
&wPreferences.window_title_clearance, foo,
|
||||||
scr->window_title_texture,
|
scr->window_title_texture,
|
||||||
scr->resizebar_texture,
|
scr->resizebar_texture,
|
||||||
scr->window_title_pixel,
|
scr->window_title_color,
|
||||||
&scr->title_font);
|
&scr->title_font);
|
||||||
|
|
||||||
XSaveContext(dpy, window, wWinContext, (XPointer)&wwin->client_descriptor);
|
XSaveContext(dpy, window, wWinContext, (XPointer)&wwin->client_descriptor);
|
||||||
|
|||||||
@@ -275,7 +275,6 @@ showWorkspaceName(WScreen *scr, int workspace)
|
|||||||
WorkspaceNameData *data;
|
WorkspaceNameData *data;
|
||||||
RXImage *ximg;
|
RXImage *ximg;
|
||||||
Pixmap text, mask;
|
Pixmap text, mask;
|
||||||
WMColor *color;
|
|
||||||
int w, h;
|
int w, h;
|
||||||
int px, py;
|
int px, py;
|
||||||
char *name = scr->workspaces[workspace]->name;
|
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);
|
text = XCreatePixmap(dpy, scr->w_win, w+4, h+4, scr->w_depth);
|
||||||
mask = XCreatePixmap(dpy, scr->w_win, w+4, h+4, 1);
|
mask = XCreatePixmap(dpy, scr->w_win, w+4, h+4, 1);
|
||||||
|
|
||||||
XSetForeground(dpy, scr->draw_gc, scr->black_pixel);
|
/*XSetForeground(dpy, scr->mono_gc, 0);
|
||||||
XFillRectangle(dpy, text, scr->draw_gc, 0, 0, w+4, h+4);
|
XFillRectangle(dpy, mask, scr->mono_gc, 0, 0, w+4, h+4);*/
|
||||||
|
|
||||||
XSetForeground(dpy, scr->mono_gc, 0);
|
XFillRectangle(dpy, text, WMColorGC(scr->black), 0, 0, w+4, h+4);
|
||||||
XFillRectangle(dpy, mask, scr->mono_gc, 0, 0, w+4, h+4);
|
|
||||||
|
|
||||||
XSetForeground(dpy, scr->mono_gc, 1);
|
|
||||||
|
|
||||||
color = WMWhiteColor(scr->wmscreen);
|
|
||||||
|
|
||||||
for (x = 0; x <= 4; x++) {
|
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++) {
|
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->workspace_name_font, x, y, name, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
scr->wmscreen->drawStringGC = saveGC;
|
|
||||||
color->color.pixel = pixel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WMDrawString(scr->wmscreen, text, color, scr->workspace_name_font,
|
XSetForeground(dpy, scr->mono_gc, 1);
|
||||||
2, 2, scr->workspaces[workspace]->name,
|
XSetBackground(dpy, scr->mono_gc, 0);
|
||||||
strlen(scr->workspaces[workspace]->name));
|
|
||||||
WMReleaseColor(color);
|
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
|
#ifdef SHAPE
|
||||||
XShapeCombineMask(dpy, scr->workspace_name, ShapeBounding, 0, 0, mask,
|
XShapeCombineMask(dpy, scr->workspace_name, ShapeBounding, 0, 0, mask,
|
||||||
ShapeSet);
|
ShapeSet);
|
||||||
|
|||||||
Reference in New Issue
Block a user