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);
|
||||||
|
|||||||
2409
src/defaults.c
2409
src/defaults.c
File diff suppressed because it is too large
Load Diff
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);
|
||||||
|
|
||||||
|
|||||||
1785
src/menu.c
1785
src/menu.c
File diff suppressed because it is too large
Load Diff
@@ -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,
|
||||||
|
|||||||
55
src/screen.c
55
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);
|
||||||
@@ -359,7 +339,7 @@ allocGCs(WScreen *scr)
|
|||||||
gcv.cap_style = CapRound;
|
gcv.cap_style = CapRound;
|
||||||
gcv.graphics_exposures = False;
|
gcv.graphics_exposures = False;
|
||||||
gcm = GCForeground|GCFunction|GCSubwindowMode|GCLineWidth|GCCapStyle
|
gcm = GCForeground|GCFunction|GCSubwindowMode|GCLineWidth|GCCapStyle
|
||||||
|GCGraphicsExposures;
|
|GCGraphicsExposures;
|
||||||
scr->line_gc = XCreateGC(dpy, scr->root_win, gcm, &gcv);
|
scr->line_gc = XCreateGC(dpy, scr->root_win, gcm, &gcv);
|
||||||
|
|
||||||
scr->line_pixel = gcv.foreground;
|
scr->line_pixel = gcv.foreground;
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
107
src/text.c
107
src/text.c
@@ -322,72 +322,65 @@ wTextDestroy( WTextInput *wtext )
|
|||||||
* Global: dpy - the display *
|
* Global: dpy - the display *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
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;
|
||||||
y1 = wtext->yOffset;
|
y1 = wtext->yOffset;
|
||||||
/* x2,y2 is the lower right corner of the text box */
|
/* x2,y2 is the lower right corner of the text box */
|
||||||
x2 = wtext->core->width - wtext->xOffset;
|
x2 = wtext->core->width - wtext->xOffset;
|
||||||
y2 = wtext->core->height - wtext->yOffset;
|
y2 = wtext->core->height - wtext->yOffset;
|
||||||
|
|
||||||
/* Fill in the text field. Use the invGC to draw the rectangle,
|
/* Fill in the text field. Use the invGC to draw the rectangle,
|
||||||
* becuase then it will be the background color */
|
* becuase then it will be the background color */
|
||||||
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);
|
/* Draw the text normally */
|
||||||
white = WMWhiteColor(wtext->core->screen_ptr->wmscreen);
|
WMDrawImageString(scr->wmscreen, wtext->core->window,
|
||||||
/* Draw the text normally */
|
scr->black, scr->white, wtext->font, x1, y1, ptr,
|
||||||
WMDrawImageString(wtext->core->screen_ptr->wmscreen, wtext->core->window,
|
wtext->text.length);
|
||||||
black, 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;
|
||||||
{
|
ep = wtext->text.startPos;
|
||||||
sp = wtext->text.endPos;
|
} else {
|
||||||
ep = wtext->text.startPos;
|
sp = wtext->text.startPos;
|
||||||
}
|
ep = wtext->text.endPos;
|
||||||
else
|
}
|
||||||
{
|
|
||||||
sp = wtext->text.startPos;
|
|
||||||
ep = wtext->text.endPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* x1,y1 is now the upper-left of the selected area */
|
/* 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 */
|
/* and x2,y2 is the lower-right of the selected area */
|
||||||
ptr += sp * sizeof(char);
|
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: *
|
/* Fill in the area where the selected text will go: *
|
||||||
* use the regGC to draw the rectangle, becuase then it *
|
* use the regGC to draw the rectangle, becuase then it *
|
||||||
* will be the color of the non-selected text */
|
* will be the color of the non-selected text */
|
||||||
XFillRectangle( dpy, wtext->core->window, wtext->regGC,
|
XFillRectangle(dpy, wtext->core->window, wtext->regGC,
|
||||||
x1, y1, x2-x1, y2-y1 );
|
x1, y1, x2-x1, y2-y1);
|
||||||
|
|
||||||
/* 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);
|
/* And draw a quick little line for the cursor position */
|
||||||
WMReleaseColor(black);
|
x1 = WMWidthOfString(wtext->font, wtext->text.txt, wtext->text.endPos)
|
||||||
|
+ wtext->xOffset;
|
||||||
/* And draw a quick little line for the cursor position */
|
XDrawLine(dpy, wtext->core->window, wtext->regGC, x1, 2, x1,
|
||||||
x1 = WMWidthOfString( wtext->font, wtext->text.txt, wtext->text.endPos )
|
wtext->core->height - 3);
|
||||||
+ wtext->xOffset;
|
}
|
||||||
XDrawLine( dpy, wtext->core->window, wtext->regGC, x1, 2, x1,
|
|
||||||
wtext->core->height - 3 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
|
|||||||
@@ -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,40 +341,34 @@ 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);
|
||||||
#endif
|
#endif
|
||||||
XSetWindowBackgroundPixmap(dpy, scr->workspace_name, text);
|
XSetWindowBackgroundPixmap(dpy, scr->workspace_name, text);
|
||||||
XClearWindow(dpy, scr->workspace_name);
|
XClearWindow(dpy, scr->workspace_name);
|
||||||
|
|||||||
Reference in New Issue
Block a user