mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-11 08:54:14 +01:00
- API change in WINGs for WMDraw*String().
WMDrawString() and WMDrawImageString() now take WMColor instead of GC as arguments. WMDrawImageString() receives 2 colors (text & background). This is to allow easy extension for Xft/Xrender and hide X low level details - Added alpha channel to WMColor. 2 new functions also: WMCreateRGBAColor() and WMSetColorAlpha() - Miscelaneous code cleanups in wtext.c - Removed obsoleted acconfig.h and implemented its functionality using AC_DEFINE and AC_DEFINE_UNQUOTED as autoconf 2.5x recommends. This will definitely enforce the need to use autoconf 2.5x
This commit is contained in:
@@ -289,14 +289,11 @@ updateDockNumbers(WScreen *scr)
|
||||
{
|
||||
int length;
|
||||
char *ws_numbers;
|
||||
GC numbers_gc;
|
||||
XGCValues my_gc_values;
|
||||
unsigned long my_v_mask = (GCForeground);
|
||||
WAppIcon *dicon = scr->dock->icon_array[0];
|
||||
|
||||
my_gc_values.foreground = scr->white_pixel;
|
||||
numbers_gc = XCreateGC(dpy, dicon->icon->core->window,
|
||||
my_v_mask, &my_gc_values);
|
||||
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,
|
||||
@@ -306,15 +303,14 @@ updateDockNumbers(WScreen *scr)
|
||||
XClearArea(dpy, dicon->icon->core->window, 2, 2, 50,
|
||||
WMFontHeight(scr->icon_title_font)+1, False);
|
||||
|
||||
XSetForeground(dpy, numbers_gc, scr->black_pixel);
|
||||
WMDrawString(scr->wmscreen, dicon->icon->core->window, numbers_gc,
|
||||
WMDrawString(scr->wmscreen, dicon->icon->core->window, black,
|
||||
scr->icon_title_font, 4, 3, ws_numbers, length);
|
||||
|
||||
XSetForeground(dpy, numbers_gc, scr->white_pixel);
|
||||
WMDrawString(scr->wmscreen, dicon->icon->core->window, numbers_gc,
|
||||
WMDrawString(scr->wmscreen, dicon->icon->core->window, white,
|
||||
scr->icon_title_font, 3, 2, ws_numbers, length);
|
||||
|
||||
XFreeGC(dpy, numbers_gc);
|
||||
WMReleaseColor(black);
|
||||
WMReleaseColor(white);
|
||||
wfree(ws_numbers);
|
||||
}
|
||||
#endif /* WS_INDICATOR */
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
#include <wraster.h>
|
||||
|
||||
#include <WINGs/WINGsP.h>
|
||||
|
||||
#include "WindowMaker.h"
|
||||
#include "screen.h"
|
||||
#include "texture.h"
|
||||
@@ -170,6 +172,7 @@ 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;
|
||||
@@ -209,12 +212,14 @@ showText(WScreen *scr, int x, int y, int h, int w, char *text)
|
||||
}
|
||||
pixmap = makePixmap(scr, width, height, side, &mask);
|
||||
|
||||
XSetForeground(dpy, scr->info_text_gc, scr->black_pixel);
|
||||
color = WMBlackColor(scr->wmscreen);
|
||||
|
||||
WMDrawString(scr->wmscreen, pixmap, scr->info_text_gc, font, 8,
|
||||
WMDrawString(scr->wmscreen, pixmap, color, font, 8,
|
||||
ty + (height - WMFontHeight(font))/2,
|
||||
text, strlen(text));
|
||||
|
||||
WMReleaseColor(color);
|
||||
|
||||
XSetWindowBackgroundPixmap(dpy, scr->balloon->window, pixmap);
|
||||
scr->balloon->contents = pixmap;
|
||||
|
||||
@@ -224,7 +229,8 @@ showText(WScreen *scr, int x, int y, int h, int w, char *text)
|
||||
XFreePixmap(dpy, mask);
|
||||
XMoveWindow(dpy, scr->balloon->window, bx, by);
|
||||
XMapRaised(dpy, scr->balloon->window);
|
||||
|
||||
|
||||
|
||||
scr->balloon->mapped = 1;
|
||||
}
|
||||
#else /* !SHAPED_BALLOON */
|
||||
@@ -235,6 +241,8 @@ 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);
|
||||
@@ -264,10 +272,13 @@ 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);
|
||||
|
||||
XSetForeground(dpy, scr->info_text_gc, scr->window_title_pixel[0]);
|
||||
|
||||
WMDrawString(scr->wmscreen, pixmap, scr->info_text_gc, font,
|
||||
4, 2, text, strlen(text));
|
||||
/* 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);
|
||||
|
||||
XResizeWindow(dpy, scr->balloon->window, width, height);
|
||||
XMoveWindow(dpy, scr->balloon->window, x, y);
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
|
||||
#include <wraster.h>
|
||||
|
||||
#include <WINGs/WINGsP.h>
|
||||
|
||||
#include "WindowMaker.h"
|
||||
#include "wcore.h"
|
||||
@@ -2989,11 +2990,11 @@ setHightlightText(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
||||
static int
|
||||
setClipTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
|
||||
{
|
||||
if (scr->clip_title_pixel[index]!=scr->white_pixel &&
|
||||
scr->clip_title_pixel[index]!=scr->black_pixel) {
|
||||
wFreeColor(scr, scr->clip_title_pixel[index]);
|
||||
}
|
||||
scr->clip_title_pixel[index] = color->pixel;
|
||||
if (scr->clip_title_color[index])
|
||||
WMReleaseColor(scr->clip_title_color[index]);
|
||||
scr->clip_title_color[index] = WMCreateRGBColor(scr->wmscreen, color->red,
|
||||
color->green, color->blue,
|
||||
True);
|
||||
|
||||
#ifdef GRADIENT_CLIP_ARROW
|
||||
if (index == CLIP_NORMAL) {
|
||||
@@ -3115,7 +3116,11 @@ setMenuDisabledColor(WScreen *scr, WDefaultEntry *entry, XColor *color, void *fo
|
||||
static int
|
||||
setIconTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
|
||||
{
|
||||
XSetForeground(dpy, scr->icon_title_gc, color->pixel);
|
||||
if (scr->icon_title_color)
|
||||
WMReleaseColor(scr->icon_title_color);
|
||||
scr->icon_title_color = WMCreateRGBColor(scr->wmscreen, color->red,
|
||||
color->green, color->blue,
|
||||
True);
|
||||
|
||||
return REFRESH_ICON_TITLE_COLOR;
|
||||
}
|
||||
|
||||
@@ -521,12 +521,11 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text,
|
||||
|
||||
for(i=-1;i<2;i++)
|
||||
for(j=-1;j<2;j++)
|
||||
WMDrawString(wmscr, d, WMColorGC(whitecolor),
|
||||
panel->normalfont, ofx+i, ofy+j,
|
||||
text, tlen);
|
||||
WMDrawString(wmscr, d, whitecolor, panel->normalfont,
|
||||
ofx+i, ofy+j, text, tlen);
|
||||
|
||||
WMDrawString(wmscr, d, WMColorGC(blackcolor), panel->normalfont,
|
||||
ofx, ofy, text, tlen);
|
||||
WMDrawString(wmscr, d, blackcolor, panel->normalfont, ofx, ofy,
|
||||
text, tlen);
|
||||
}
|
||||
|
||||
WMReleasePixmap(pixmap);
|
||||
|
||||
31
src/dock.c
31
src/dock.c
@@ -56,7 +56,7 @@
|
||||
#include "wsound.h"
|
||||
|
||||
|
||||
#include <WINGs/WUtil.h>
|
||||
#include <WINGs/WINGsP.h>
|
||||
|
||||
|
||||
|
||||
@@ -353,10 +353,18 @@ paintClipButtons(WAppIcon *clipIcon, Bool lpushed, Bool rpushed)
|
||||
int tp = ICON_SIZE - pt;
|
||||
int as = pt - 15; /* 15 = 5+5+5 */
|
||||
GC gc = scr->clip_title_gc;
|
||||
WMColor *color;
|
||||
#ifdef GRADIENT_CLIP_ARROW
|
||||
Bool collapsed = clipIcon->dock->collapsed;
|
||||
#endif
|
||||
|
||||
if (!clipIcon->dock->collapsed)
|
||||
color = scr->clip_title_color[CLIP_NORMAL];
|
||||
else
|
||||
color = scr->clip_title_color[CLIP_COLLAPSED];
|
||||
|
||||
XSetForeground(dpy, gc, WMColorPixel(color));
|
||||
|
||||
if (rpushed) {
|
||||
p[0].x = tp+1;
|
||||
p[0].y = 1;
|
||||
@@ -1279,7 +1287,7 @@ wClipIconPaint(WAppIcon *aicon)
|
||||
{
|
||||
WScreen *scr = aicon->icon->core->screen_ptr;
|
||||
WWorkspace *workspace = scr->workspaces[scr->current_workspace];
|
||||
GC gc;
|
||||
WMColor *color;
|
||||
Window win = aicon->icon->core->window;
|
||||
int length, nlength;
|
||||
char *ws_name, ws_number[10];
|
||||
@@ -1293,26 +1301,24 @@ wClipIconPaint(WAppIcon *aicon)
|
||||
snprintf(ws_number, sizeof(ws_number), "%i", scr->current_workspace + 1);
|
||||
nlength = strlen(ws_number);
|
||||
|
||||
gc = scr->clip_title_gc;
|
||||
|
||||
if (!workspace->clip->collapsed)
|
||||
XSetForeground(dpy, gc, scr->clip_title_pixel[CLIP_NORMAL]);
|
||||
color = scr->clip_title_color[CLIP_NORMAL];
|
||||
else
|
||||
XSetForeground(dpy, gc, scr->clip_title_pixel[CLIP_COLLAPSED]);
|
||||
color = scr->clip_title_color[CLIP_COLLAPSED];
|
||||
|
||||
ty = ICON_SIZE - WMFontHeight(scr->clip_title_font) - 3;
|
||||
|
||||
tx = CLIP_BUTTON_SIZE*ICON_SIZE/64;
|
||||
|
||||
WMDrawString(scr->wmscreen, win, gc, scr->clip_title_font, tx,
|
||||
WMDrawString(scr->wmscreen, win, color, scr->clip_title_font, tx,
|
||||
ty, ws_name, length);
|
||||
/*WMDrawString(scr->wmscreen, win, gc, scr->clip_title_font, 4,
|
||||
/*WMDrawString(scr->wmscreen, win, color, scr->clip_title_font, 4,
|
||||
2, ws_name, length);*/
|
||||
|
||||
tx = (ICON_SIZE/2 - WMWidthOfString(scr->clip_title_font, ws_number,
|
||||
nlength))/2;
|
||||
|
||||
WMDrawString(scr->wmscreen, win, gc, scr->clip_title_font, tx,
|
||||
WMDrawString(scr->wmscreen, win, color, scr->clip_title_font, tx,
|
||||
2, ws_number, nlength);
|
||||
|
||||
wfree(ws_name);
|
||||
@@ -4213,11 +4219,10 @@ showClipBalloon(WDock *dock, int workspace)
|
||||
XRestackWindows(dpy, stack, 2);
|
||||
}
|
||||
XMoveWindow(dpy, scr->clip_balloon, x, y);
|
||||
XSetForeground(dpy, scr->clip_title_gc,
|
||||
scr->clip_title_pixel[CLIP_NORMAL]);
|
||||
XClearWindow(dpy, scr->clip_balloon);
|
||||
WMDrawString(scr->wmscreen, scr->clip_balloon, scr->clip_title_gc,
|
||||
scr->clip_title_font, 0, 0, text, strlen(text));
|
||||
WMDrawString(scr->wmscreen, scr->clip_balloon,
|
||||
scr->clip_title_color[CLIP_NORMAL], scr->clip_title_font,
|
||||
0, 0, text, strlen(text));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
#include <wraster.h>
|
||||
|
||||
#include <WINGs/WINGsP.h>
|
||||
|
||||
#include "WindowMaker.h"
|
||||
#include "GNUstep.h"
|
||||
#include "texture.h"
|
||||
@@ -65,8 +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,
|
||||
GC *gc, WMFont **font)
|
||||
unsigned long *color, WMFont **font)
|
||||
{
|
||||
WFrameWindow *fwin;
|
||||
|
||||
@@ -81,7 +82,6 @@ wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
|
||||
fwin->resizebar_texture = resize_texture;
|
||||
fwin->title_pixel = color;
|
||||
fwin->title_clearance = clearance;
|
||||
fwin->title_gc = gc;
|
||||
fwin->font = font;
|
||||
#ifdef KEEP_XKB_LOCK_STATUS
|
||||
fwin->languagemode = XkbGroup1Index;
|
||||
@@ -1049,7 +1049,9 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
||||
#endif
|
||||
|
||||
if (fwin->title) {
|
||||
char *title;
|
||||
char *title;
|
||||
WMColor *color;
|
||||
WMPixel pixel;
|
||||
|
||||
title = ShrinkString(*fwin->font, fwin->title,
|
||||
fwin->titlebar->width - lofs - rofs);
|
||||
@@ -1073,12 +1075,15 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
||||
break;
|
||||
}
|
||||
|
||||
XSetForeground(dpy, *fwin->title_gc,
|
||||
fwin->title_pixel[fwin->flags.state]);
|
||||
|
||||
WMDrawString(scr->wmscreen, fwin->titlebar->window,
|
||||
*fwin->title_gc, *fwin->font, x, *fwin->title_clearance + TITLEBAR_EXTEND_SPACE,
|
||||
title, titlelen);
|
||||
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,
|
||||
title, titlelen);
|
||||
color->color.pixel = pixel;
|
||||
WMReleaseColor(color);
|
||||
|
||||
wfree(title);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,6 @@ typedef struct WFrameWindow {
|
||||
union WTexture **title_texture;
|
||||
union WTexture **resizebar_texture;
|
||||
unsigned long *title_pixel;
|
||||
GC *title_gc;
|
||||
WMFont **font;
|
||||
|
||||
char *title; /* window name (title) */
|
||||
@@ -157,8 +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,
|
||||
GC *gc, WMFont **font);
|
||||
unsigned long *color, WMFont **font);
|
||||
|
||||
void wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags);
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ typedef struct W_GeometryView {
|
||||
W_Class widgetClass;
|
||||
WMView *view;
|
||||
|
||||
GC gc;
|
||||
WMColor *black;
|
||||
WMColor *gray;
|
||||
WMFont *font;
|
||||
|
||||
WMSize textSize;
|
||||
@@ -67,20 +68,8 @@ WCreateGeometryView(WMScreen *scr)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
{
|
||||
WMColor *black = WMBlackColor(scr);
|
||||
WMColor *gray = WMGrayColor(scr);
|
||||
XGCValues gcv;
|
||||
|
||||
gcv.foreground = WMColorPixel(black);
|
||||
gcv.background = WMColorPixel(gray);
|
||||
|
||||
gview->gc = XCreateGC(WMScreenDisplay(scr), W_DRAWABLE(scr),
|
||||
GCForeground|GCBackground, &gcv);
|
||||
|
||||
WMReleaseColor(black);
|
||||
WMReleaseColor(gray);
|
||||
}
|
||||
gview->black = WMBlackColor(scr);
|
||||
gview->gray = WMGrayColor(scr);
|
||||
|
||||
WMCreateEventHandler(gview->view, ExposureMask, handleEvents, gview);
|
||||
|
||||
@@ -136,7 +125,7 @@ paint(WGeometryView *gview)
|
||||
|
||||
WMDrawImageString(W_VIEW_SCREEN(gview->view),
|
||||
W_VIEW_DRAWABLE(gview->view),
|
||||
gview->gc, gview->font,
|
||||
gview->black, gview->gray, gview->font,
|
||||
(W_VIEW_WIDTH(gview->view)-gview->textSize.width)/2,
|
||||
(W_VIEW_HEIGHT(gview->view)-gview->textSize.height)/2,
|
||||
buffer, strlen(buffer));
|
||||
|
||||
@@ -812,7 +812,6 @@ void
|
||||
wIconPaint(WIcon *icon)
|
||||
{
|
||||
WScreen *scr=icon->core->screen_ptr;
|
||||
GC gc = scr->icon_title_gc;
|
||||
int x;
|
||||
char *tmp;
|
||||
|
||||
@@ -838,7 +837,7 @@ wIconPaint(WIcon *icon)
|
||||
else
|
||||
x = (icon->core->width - w)/2;
|
||||
|
||||
WMDrawString(scr->wmscreen, icon->core->window, gc,
|
||||
WMDrawString(scr->wmscreen, icon->core->window, scr->icon_title_color,
|
||||
scr->icon_title_font, x, 1, tmp, l);
|
||||
wfree(tmp);
|
||||
}
|
||||
|
||||
45
src/menu.c
45
src/menu.c
@@ -43,6 +43,8 @@
|
||||
#include "stacking.h"
|
||||
#include "text.h"
|
||||
|
||||
#include <WINGs/WINGsP.h>
|
||||
|
||||
|
||||
/****** Global Variables ******/
|
||||
|
||||
@@ -174,7 +176,6 @@ wMenuCreate(WScreen *screen, char *title, int main_menu)
|
||||
wFrameWindowCreate(screen, tmp, 8, 2, 1, 1, &wPreferences.menu_title_clearance, flags,
|
||||
screen->menu_title_texture, NULL,
|
||||
screen->menu_title_pixel,
|
||||
&screen->menu_title_gc,
|
||||
&screen->menu_title_font);
|
||||
|
||||
menu->frame->core->descriptor.parent = menu;
|
||||
@@ -724,7 +725,9 @@ paintEntry(WMenu *menu, int index, int selected)
|
||||
{
|
||||
int x, y, w, h, tw;
|
||||
int type;
|
||||
GC light, dim, dark, textGC;
|
||||
GC light, dim, dark, textGC, saveGC;
|
||||
WMColor *color;
|
||||
WMPixel pixel, savePixel;
|
||||
WScreen *scr=menu->frame->screen_ptr;
|
||||
Window win = menu->menu->window;
|
||||
WMenuEntry *entry=menu->entries[index];
|
||||
@@ -765,24 +768,36 @@ paintEntry(WMenu *menu, int index, int selected)
|
||||
}
|
||||
}
|
||||
|
||||
/* very ugly hack */
|
||||
saveGC = scr->wmscreen->drawStringGC;
|
||||
color = WMBlackColor(scr->wmscreen);
|
||||
savePixel = color->color.pixel;
|
||||
|
||||
if (selected) {
|
||||
textGC = scr->select_menu_gc;
|
||||
if (entry->flags.enabled)
|
||||
XSetForeground(dpy, textGC, scr->select_text_pixel);
|
||||
pixel = scr->select_text_pixel;
|
||||
else
|
||||
XSetForeground(dpy, textGC, scr->dtext_pixel);
|
||||
pixel = scr->dtext_pixel;
|
||||
} else if (!entry->flags.enabled) {
|
||||
textGC = scr->disabled_menu_entry_gc;
|
||||
} else {
|
||||
textGC = scr->menu_entry_gc;
|
||||
textGC = scr->disabled_menu_entry_gc;
|
||||
pixel = scr->dtext_pixel;
|
||||
} else {
|
||||
textGC = scr->menu_entry_gc;
|
||||
pixel = scr->mtext_pixel;
|
||||
}
|
||||
/* draw text */
|
||||
x = 5;
|
||||
if (entry->flags.indicator)
|
||||
x += MENU_INDICATOR_SPACE + 2;
|
||||
|
||||
WMDrawString(scr->wmscreen, win, textGC, scr->menu_entry_font,
|
||||
/* this is nasty */
|
||||
scr->wmscreen->drawStringGC = textGC;
|
||||
color->color.pixel = pixel;
|
||||
WMDrawString(scr->wmscreen, win, color, scr->menu_entry_font,
|
||||
x, 3 + y + wPreferences.menu_text_clearance, entry->text, strlen(entry->text));
|
||||
color->color.pixel = savePixel;
|
||||
scr->wmscreen->drawStringGC = saveGC;
|
||||
|
||||
if (entry->cascade>=0) {
|
||||
/* draw the cascade indicator */
|
||||
@@ -844,12 +859,18 @@ paintEntry(WMenu *menu, int index, int selected)
|
||||
/* draw right text */
|
||||
|
||||
if (entry->rtext && entry->cascade<0) {
|
||||
tw = WMWidthOfString(scr->menu_entry_font, entry->rtext,
|
||||
strlen(entry->rtext));
|
||||
|
||||
tw = WMWidthOfString(scr->menu_entry_font, entry->rtext,
|
||||
strlen(entry->rtext));
|
||||
WMDrawString(scr->wmscreen, win, textGC, scr->menu_entry_font, w-6-tw,
|
||||
y + 3 + wPreferences.menu_text_clearance, entry->rtext, strlen(entry->rtext));
|
||||
/* this is nasty */
|
||||
scr->wmscreen->drawStringGC = textGC;
|
||||
color->color.pixel = pixel;
|
||||
WMDrawString(scr->wmscreen, win, color, scr->menu_entry_font, w-6-tw,
|
||||
y + 3 + wPreferences.menu_text_clearance, entry->rtext, strlen(entry->rtext));
|
||||
color->color.pixel = savePixel;
|
||||
scr->wmscreen->drawStringGC = saveGC;
|
||||
}
|
||||
WMReleaseColor(color);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
|
||||
#include "geomview.h"
|
||||
|
||||
#include <WINGs/WINGsP.h>
|
||||
|
||||
|
||||
#ifdef KWM_HINTS
|
||||
#include "kwm.h"
|
||||
@@ -210,11 +212,13 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
||||
{
|
||||
WScreen *scr = wwin->screen_ptr;
|
||||
Window root = scr->root_win;
|
||||
GC gc = scr->line_gc;
|
||||
GC gc = scr->line_gc, saveGC;
|
||||
int ty, by, my, x, y, mx, s;
|
||||
char num[16];
|
||||
XSegment segment[4];
|
||||
int fw, fh;
|
||||
WMColor *color;
|
||||
WMPixel pixel;
|
||||
|
||||
ty = y1 + wwin->frame->top_width;
|
||||
by = y2 - wwin->frame->bottom_width;
|
||||
@@ -275,10 +279,21 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
||||
fw = WMWidthOfString(scr->info_text_font, num, strlen(num));
|
||||
|
||||
/* XSetForeground(dpy, gc, scr->window_title_pixel[WS_UNFOCUSED]); */
|
||||
|
||||
/* Display the height. */
|
||||
WMDrawString(scr->wmscreen, root, gc, scr->info_text_font,
|
||||
x - s + 3 - fw/2, my - fh/2 + 1, num, strlen(num));
|
||||
|
||||
color = WMBlackColor(scr->wmscreen);
|
||||
saveGC = scr->wmscreen->drawStringGC;
|
||||
pixel = color->color.pixel;
|
||||
|
||||
/* Display the height. */
|
||||
|
||||
/* ugly hack */
|
||||
color->color.pixel = scr->line_pixel;
|
||||
scr->wmscreen->drawStringGC = gc;
|
||||
WMDrawString(scr->wmscreen, root, color, scr->info_text_font,
|
||||
x - s + 3 - fw/2, my - fh/2 + 1, num, strlen(num));
|
||||
scr->wmscreen->drawStringGC = saveGC;
|
||||
color->color.pixel = pixel;
|
||||
|
||||
XSetForeground(dpy, gc, scr->line_pixel);
|
||||
/* horizontal geometry */
|
||||
if (y1 < 15) {
|
||||
@@ -332,8 +347,14 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
||||
/* XSetForeground(dpy, gc, scr->window_title_pixel[WS_UNFOCUSED]); */
|
||||
|
||||
/* Display the width. */
|
||||
WMDrawString(scr->wmscreen, root, gc, scr->info_text_font,
|
||||
/* ugly hack */
|
||||
color->color.pixel = scr->line_pixel;
|
||||
scr->wmscreen->drawStringGC = gc;
|
||||
WMDrawString(scr->wmscreen, root, color, scr->info_text_font,
|
||||
mx - fw/2 + 1, y - s - fh/2 + 1, num, strlen(num));
|
||||
scr->wmscreen->drawStringGC = saveGC;
|
||||
color->color.pixel = pixel;
|
||||
WMReleaseColor(color);
|
||||
} else {
|
||||
WSetGeometryViewShownSize(scr->gview,
|
||||
(x2 - x1 - wwin->normal_hints->base_width)
|
||||
|
||||
@@ -375,9 +375,6 @@ allocGCs(WScreen *scr)
|
||||
gcv.graphics_exposures = False;
|
||||
scr->window_title_gc = XCreateGC(dpy, scr->w_win,GCGraphicsExposures,&gcv);
|
||||
|
||||
/* icon title GC */
|
||||
scr->icon_title_gc = XCreateGC(dpy, scr->w_win, GCGraphicsExposures, &gcv);
|
||||
|
||||
/* clip title GC */
|
||||
scr->clip_title_gc = XCreateGC(dpy, scr->w_win, GCGraphicsExposures, &gcv);
|
||||
|
||||
|
||||
@@ -164,9 +164,9 @@ typedef struct _WScreen {
|
||||
/* foreground colors */
|
||||
WMPixel window_title_pixel[3]; /* window titlebar text (foc, unfoc, pfoc)*/
|
||||
WMPixel menu_title_pixel[3]; /* menu titlebar text */
|
||||
WMPixel clip_title_pixel[2]; /* clip title text */
|
||||
WMPixel mtext_pixel; /* menu item text */
|
||||
WMPixel dtext_pixel; /* disabled menu item text */
|
||||
WMColor *clip_title_color[2]; /* clip title text */
|
||||
WMPixel mtext_pixel; /* menu item text */
|
||||
WMPixel dtext_pixel; /* disabled menu item text */
|
||||
WMPixel line_pixel;
|
||||
WMPixel frame_border_pixel; /* frame border */
|
||||
|
||||
@@ -188,7 +188,7 @@ typedef struct _WScreen {
|
||||
GC window_title_gc; /* window title text GC */
|
||||
GC menu_title_gc; /* menu titles */
|
||||
|
||||
GC icon_title_gc; /* icon title background */
|
||||
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 */
|
||||
|
||||
18
src/text.c
18
src/text.c
@@ -323,9 +323,10 @@ wTextDestroy( WTextInput *wtext )
|
||||
\********************************************************************/
|
||||
static void
|
||||
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;
|
||||
@@ -339,9 +340,11 @@ textRefresh( WTextInput *wtext )
|
||||
XFillRectangle( dpy, wtext->core->window, wtext->invGC,
|
||||
x1, y1, x2-x1, y2-y1 );
|
||||
|
||||
black = WMBlackColor(wtext->core->screen_ptr->wmscreen);
|
||||
white = WMWhiteColor(wtext->core->screen_ptr->wmscreen);
|
||||
/* Draw the text normally */
|
||||
WMDrawString(wtext->core->screen_ptr->wmscreen, wtext->core->window,
|
||||
wtext->regGC, wtext->font, x1, y1, ptr, wtext->text.length);
|
||||
WMDrawImageString(wtext->core->screen_ptr->wmscreen, wtext->core->window,
|
||||
black, white, wtext->font, x1, y1, ptr, wtext->text.length);
|
||||
|
||||
/* Draw the selected text */
|
||||
if( wtext->text.startPos != wtext->text.endPos )
|
||||
@@ -372,10 +375,13 @@ textRefresh( WTextInput *wtext )
|
||||
|
||||
/* Draw the selected text... use invGC so it will be the
|
||||
* opposite color as the filled rectangle */
|
||||
WMDrawString(wtext->core->screen_ptr->wmscreen, wtext->core->window,
|
||||
wtext->invGC, wtext->font, x1, y1, ptr, (ep - sp));
|
||||
WMDrawImageString(wtext->core->screen_ptr->wmscreen, wtext->core->window,
|
||||
white, 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;
|
||||
|
||||
@@ -474,24 +474,20 @@ wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
|
||||
*/
|
||||
if (wwin->user_flags.no_appicon && wwin->defined_user_flags.no_appicon)
|
||||
wwin->user_flags.emulate_appicon = 0;
|
||||
/*//WSETUFLAG(wwin, emulate_appicon, 0);*/
|
||||
|
||||
if (wwin->main_window!=None) {
|
||||
WApplication *wapp = wApplicationOf(wwin->main_window);
|
||||
if (wapp && !wapp->flags.emulated)
|
||||
wwin->user_flags.emulate_appicon = 0;
|
||||
/*//WSETUFLAG(wwin, emulate_appicon, 0);*/
|
||||
}
|
||||
|
||||
if (wwin->transient_for!=None
|
||||
&& wwin->transient_for!=wwin->screen_ptr->root_win)
|
||||
wwin->user_flags.emulate_appicon = 0;
|
||||
/*//WSETUFLAG(wwin, emulate_appicon, 0);*/
|
||||
|
||||
if (wwin->user_flags.sunken && wwin->defined_user_flags.sunken
|
||||
&& wwin->user_flags.floating && wwin->defined_user_flags.floating)
|
||||
wwin->user_flags.sunken = 0;
|
||||
/*//WSETUFLAG(wwin, sunken, 0);*/
|
||||
|
||||
WSETUFLAG(wwin, no_shadeable, WFLAGP(wwin, no_titlebar));
|
||||
|
||||
@@ -1159,7 +1155,6 @@ wManageWindow(WScreen *scr, Window window)
|
||||
scr->window_title_texture,
|
||||
scr->resizebar_texture,
|
||||
scr->window_title_pixel,
|
||||
&scr->window_title_gc,
|
||||
&scr->title_font);
|
||||
|
||||
wwin->frame->flags.is_client_window_frame = 1;
|
||||
@@ -1519,7 +1514,6 @@ wManageInternalWindow(WScreen *scr, Window window, Window owner,
|
||||
scr->window_title_texture,
|
||||
scr->resizebar_texture,
|
||||
scr->window_title_pixel,
|
||||
&scr->window_title_gc,
|
||||
&scr->title_font);
|
||||
|
||||
XSaveContext(dpy, window, wWinContext, (XPointer)&wwin->client_descriptor);
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#include "kwm.h"
|
||||
#endif
|
||||
|
||||
#include <WINGs/WUtil.h>
|
||||
#include <WINGs/WINGsP.h>
|
||||
|
||||
|
||||
extern WPreferences wPreferences;
|
||||
@@ -275,6 +275,7 @@ 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;
|
||||
@@ -348,17 +349,30 @@ showWorkspaceName(WScreen *scr, int workspace)
|
||||
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++) {
|
||||
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, scr->mono_gc,
|
||||
WMDrawString(scr->wmscreen, mask, color,
|
||||
scr->workspace_name_font, x, y, name, len);
|
||||
}
|
||||
}
|
||||
|
||||
scr->wmscreen->drawStringGC = saveGC;
|
||||
color->color.pixel = pixel;
|
||||
}
|
||||
|
||||
XSetForeground(dpy, scr->draw_gc, scr->white_pixel);
|
||||
WMDrawString(scr->wmscreen, text, scr->draw_gc, scr->workspace_name_font,
|
||||
WMDrawString(scr->wmscreen, text, color, scr->workspace_name_font,
|
||||
2, 2, scr->workspaces[workspace]->name,
|
||||
strlen(scr->workspaces[workspace]->name));
|
||||
strlen(scr->workspaces[workspace]->name));
|
||||
WMReleaseColor(color);
|
||||
#ifdef SHAPE
|
||||
XShapeCombineMask(dpy, scr->workspace_name, ShapeBounding, 0, 0, mask,
|
||||
ShapeSet);
|
||||
|
||||
Reference in New Issue
Block a user