mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +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;
|
||||
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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
2707
src/defaults.c
2707
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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,14 +1050,12 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
||||
|
||||
if (fwin->title) {
|
||||
char *title;
|
||||
WMColor *color;
|
||||
WMPixel pixel;
|
||||
|
||||
|
||||
title = ShrinkString(*fwin->font, fwin->title,
|
||||
fwin->titlebar->width - lofs - rofs);
|
||||
titlelen = strlen(title);
|
||||
w = WMWidthOfString(*fwin->font, title, titlelen);
|
||||
|
||||
|
||||
switch (fwin->flags.justification) {
|
||||
case WTJ_LEFT:
|
||||
x = lofs;
|
||||
@@ -1074,20 +1072,16 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
||||
x = (fwin->titlebar->width - w) / 2;
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
if (fwin->left_button)
|
||||
handleButtonExpose(&fwin->left_button->descriptor, NULL);
|
||||
if (fwin->right_button)
|
||||
@@ -1095,7 +1089,7 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
||||
#ifdef XKB_BUTTON_HINT
|
||||
if (fwin->language_button)
|
||||
handleButtonExpose(&fwin->language_button->descriptor, NULL);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
2101
src/menu.c
2101
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);
|
||||
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,
|
||||
|
||||
59
src/screen.c
59
src/screen.c
@@ -266,7 +266,6 @@ allocGCs(WScreen *scr)
|
||||
{
|
||||
XGCValues gcv;
|
||||
XColor color;
|
||||
unsigned long mtextcolor;
|
||||
int gcm;
|
||||
|
||||
scr->stipple_bitmap =
|
||||
@@ -291,7 +290,7 @@ allocGCs(WScreen *scr)
|
||||
gcv.dash_offset = 0;
|
||||
gcv.dashes = 4;
|
||||
gcv.graphics_exposures = False;
|
||||
|
||||
|
||||
gcm = GCFunction | GCGraphicsExposures;
|
||||
gcm |= GCForeground | GCBackground;
|
||||
gcm |= GCLineWidth | GCLineStyle;
|
||||
@@ -300,30 +299,11 @@ allocGCs(WScreen *scr)
|
||||
|
||||
scr->icon_select_gc = XCreateGC(dpy, scr->w_win, gcm, &gcv);
|
||||
|
||||
gcm = GCForeground|GCGraphicsExposures;
|
||||
|
||||
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->menu_title_color[0] = WMRetainColor(scr->white);
|
||||
|
||||
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);
|
||||
@@ -359,11 +339,11 @@ allocGCs(WScreen *scr)
|
||||
gcv.cap_style = CapRound;
|
||||
gcv.graphics_exposures = False;
|
||||
gcm = GCForeground|GCFunction|GCSubwindowMode|GCLineWidth|GCCapStyle
|
||||
|GCGraphicsExposures;
|
||||
|GCGraphicsExposures;
|
||||
scr->line_gc = XCreateGC(dpy, scr->root_win, gcm, &gcv);
|
||||
|
||||
scr->line_pixel = gcv.foreground;
|
||||
|
||||
|
||||
/* copy GC */
|
||||
gcv.foreground = scr->white_pixel;
|
||||
gcv.background = scr->black_pixel;
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
25
src/screen.h
25
src/screen.h
@@ -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 */
|
||||
|
||||
@@ -180,19 +184,14 @@ typedef struct _WScreen {
|
||||
struct WTexSolid *menu_item_auxtexture; /* additional texture to draw menu
|
||||
* cascade arrows */
|
||||
struct WTexSolid *icon_title_texture;/* icon titles */
|
||||
|
||||
|
||||
struct WTexSolid *widget_texture;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
113
src/text.c
113
src/text.c
@@ -322,72 +322,65 @@ wTextDestroy( WTextInput *wtext )
|
||||
* Global: dpy - the display *
|
||||
\********************************************************************/
|
||||
static void
|
||||
textRefresh( WTextInput *wtext )
|
||||
textRefresh(WTextInput *wtext)
|
||||
{
|
||||
int x1,x2,y1,y2;
|
||||
char *ptr = wtext->text.txt;
|
||||
WMColor *black, *white;
|
||||
|
||||
/* x1,y1 is the upper left corner of the text box */
|
||||
x1 = wtext->xOffset;
|
||||
y1 = wtext->yOffset;
|
||||
/* x2,y2 is the lower right corner of the text box */
|
||||
x2 = wtext->core->width - wtext->xOffset;
|
||||
y2 = wtext->core->height - wtext->yOffset;
|
||||
WScreen *scr = wtext->core->screen_ptr;
|
||||
char *ptr = wtext->text.txt;
|
||||
int x1,x2,y1,y2;
|
||||
|
||||
/* 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 );
|
||||
/* x1,y1 is the upper left corner of the text box */
|
||||
x1 = wtext->xOffset;
|
||||
y1 = wtext->yOffset;
|
||||
/* x2,y2 is the lower right corner of the text box */
|
||||
x2 = wtext->core->width - wtext->xOffset;
|
||||
y2 = wtext->core->height - wtext->yOffset;
|
||||
|
||||
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);
|
||||
/* 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);
|
||||
|
||||
/* Draw the selected text */
|
||||
if( wtext->text.startPos != wtext->text.endPos )
|
||||
{
|
||||
int sp,ep;
|
||||
/* we need sp < ep */
|
||||
if( wtext->text.startPos > wtext->text.endPos )
|
||||
{
|
||||
sp = wtext->text.endPos;
|
||||
ep = wtext->text.startPos;
|
||||
}
|
||||
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 );
|
||||
/* and x2,y2 is the lower-right of the selected area */
|
||||
ptr += sp * sizeof(char);
|
||||
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 );
|
||||
|
||||
/* 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));
|
||||
/* Draw the text normally */
|
||||
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) {
|
||||
int sp,ep;
|
||||
/* we need sp < ep */
|
||||
if (wtext->text.startPos > wtext->text.endPos) {
|
||||
sp = wtext->text.endPos;
|
||||
ep = wtext->text.startPos;
|
||||
} 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);
|
||||
/* and x2,y2 is the lower-right of the selected area */
|
||||
ptr += sp * sizeof(char);
|
||||
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);
|
||||
|
||||
/* Draw the selected text... use invGC so it will be the
|
||||
* opposite color as the filled rectangle */
|
||||
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 )
|
||||
+ wtext->xOffset;
|
||||
XDrawLine( dpy, wtext->core->window, wtext->regGC, x1, 2, x1,
|
||||
wtext->core->height - 3 );
|
||||
}
|
||||
/* And draw a quick little line for the cursor position */
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,40 +341,34 @@ 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,
|
||||
scr->workspace_name_font, x, y, name, len);
|
||||
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);
|
||||
ShapeSet);
|
||||
#endif
|
||||
XSetWindowBackgroundPixmap(dpy, scr->workspace_name, text);
|
||||
XClearWindow(dpy, scr->workspace_name);
|
||||
|
||||
Reference in New Issue
Block a user