mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-20 16:55:46 +01:00
fixed cosmetic bug in geom. dpy window for 8bpp
removed --enable-kanji and added MultiByteText option rewrote font code to use WINGs made autoraise only work for the active window fixed compilation problem with OpenWindows and other non-X11R6 systems..
This commit is contained in:
@@ -89,6 +89,7 @@ XGETTEXT = @XGETTEXT@
|
|||||||
XLFLAGS = @XLFLAGS@
|
XLFLAGS = @XLFLAGS@
|
||||||
XLIBS = @XLIBS@
|
XLIBS = @XLIBS@
|
||||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||||
|
X_LIBRARY_PATH = @X_LIBRARY_PATH@
|
||||||
wprefsdir = @wprefsdir@
|
wprefsdir = @wprefsdir@
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = no-dependencies
|
AUTOMAKE_OPTIONS = no-dependencies
|
||||||
|
|||||||
@@ -317,6 +317,7 @@ typedef struct WPreferences {
|
|||||||
char title_shadow;
|
char title_shadow;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char multi_byte_text;
|
||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
char modelock;
|
char modelock;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -330,46 +330,35 @@ wAppIconMove(WAppIcon *aicon, int x, int y)
|
|||||||
static void
|
static void
|
||||||
updateDockNumbers(WScreen *scr)
|
updateDockNumbers(WScreen *scr)
|
||||||
{
|
{
|
||||||
int length;
|
int length;
|
||||||
char *ws_numbers;
|
char *ws_numbers;
|
||||||
GC numbers_gc;
|
GC numbers_gc;
|
||||||
XGCValues my_gc_values;
|
XGCValues my_gc_values;
|
||||||
unsigned long my_v_mask = (GCForeground);
|
unsigned long my_v_mask = (GCForeground);
|
||||||
WAppIcon *dicon = scr->dock->icon_array[0];
|
WAppIcon *dicon = scr->dock->icon_array[0];
|
||||||
|
|
||||||
my_gc_values.foreground = scr->white_pixel;
|
my_gc_values.foreground = scr->white_pixel;
|
||||||
numbers_gc = XCreateGC(dpy, dicon->icon->core->window,
|
numbers_gc = XCreateGC(dpy, dicon->icon->core->window,
|
||||||
my_v_mask, &my_gc_values);
|
my_v_mask, &my_gc_values);
|
||||||
|
|
||||||
ws_numbers = malloc(20);
|
ws_numbers = malloc(20);
|
||||||
sprintf(ws_numbers, "%i [ %i ]", scr->current_workspace+1,
|
sprintf(ws_numbers, "%i [ %i ]", scr->current_workspace+1,
|
||||||
((scr->current_workspace/10)+1));
|
((scr->current_workspace/10)+1));
|
||||||
length = strlen(ws_numbers);
|
length = strlen(ws_numbers);
|
||||||
|
|
||||||
XClearArea(dpy, dicon->icon->core->window, 2, 2, 50,
|
XClearArea(dpy, dicon->icon->core->window, 2, 2, 50,
|
||||||
scr->icon_title_font->y+1, False);
|
scr->icon_title_font->y+1, False);
|
||||||
|
|
||||||
#ifndef I18N_MB
|
XSetForeground(dpy, numbers_gc, scr->black_pixel);
|
||||||
XSetFont(dpy, numbers_gc, scr->icon_title_font->font->fid);
|
WMDrawString(scr->wmscreen, dicon->icon->core->window, numbers_gc,
|
||||||
XSetForeground(dpy, numbers_gc, scr->black_pixel);
|
scr->icon_title_font->font, 4, 3, ws_numbers, length);
|
||||||
XDrawString(dpy, dicon->icon->core->window,
|
|
||||||
numbers_gc, 4, scr->icon_title_font->y+3, ws_numbers, length);
|
|
||||||
XSetForeground(dpy, numbers_gc, scr->white_pixel);
|
|
||||||
XDrawString(dpy, dicon->icon->core->window,
|
|
||||||
numbers_gc, 3, scr->icon_title_font->y+2, ws_numbers, length);
|
|
||||||
#else
|
|
||||||
XSetForeground(dpy, numbers_gc, scr->black_pixel);
|
|
||||||
XmbDrawString(dpy, dicon->icon->core->window,
|
|
||||||
scr->icon_title_font->font, numbers_gc, 4,
|
|
||||||
scr->icon_title_font->y+3, ws_numbers, length);
|
|
||||||
XSetForeground(dpy, numbers_gc, scr->white_pixel);
|
|
||||||
XmbDrawString(dpy, dicon->icon->core->window,
|
|
||||||
scr->icon_title_font->font, numbers_gc, 3,
|
|
||||||
scr->icon_title_font->y+2, ws_numbers, length);
|
|
||||||
#endif /* I18N_MB */
|
|
||||||
|
|
||||||
XFreeGC(dpy, numbers_gc);
|
XSetForeground(dpy, numbers_gc, scr->white_pixel);
|
||||||
free(ws_numbers);
|
WMDrawString(scr->wmscreen, dicon->icon->core->window, numbers_gc,
|
||||||
|
scr->icon_title_font->font, 3, 2, ws_numbers, length);
|
||||||
|
|
||||||
|
XFreeGC(dpy, numbers_gc);
|
||||||
|
free(ws_numbers);
|
||||||
}
|
}
|
||||||
#endif /* WS_INDICATOR */
|
#endif /* WS_INDICATOR */
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ showText(WScreen *scr, int x, int y, int h, int w, char *text)
|
|||||||
int height;
|
int height;
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
Pixmap mask;
|
Pixmap mask;
|
||||||
WFont *font = scr->info_text_font;
|
WMFont *font = scr->info_text_font;
|
||||||
int side = 0;
|
int side = 0;
|
||||||
int ty;
|
int ty;
|
||||||
int bx, by;
|
int bx, by;
|
||||||
@@ -178,8 +178,8 @@ showText(WScreen *scr, int x, int y, int h, int w, char *text)
|
|||||||
if (scr->balloon->contents)
|
if (scr->balloon->contents)
|
||||||
XFreePixmap(dpy, scr->balloon->contents);
|
XFreePixmap(dpy, scr->balloon->contents);
|
||||||
|
|
||||||
width = wTextWidth(font->font, text, strlen(text))+16;
|
width = WMWidthOfString(font, text, strlen(text))+16;
|
||||||
height = font->height + 4;
|
height = WMFontHeight(font) + 4;
|
||||||
|
|
||||||
if (height < 16)
|
if (height < 16)
|
||||||
height = 16;
|
height = 16;
|
||||||
@@ -212,9 +212,9 @@ showText(WScreen *scr, int x, int y, int h, int w, char *text)
|
|||||||
|
|
||||||
XSetForeground(dpy, scr->info_text_gc, scr->black_pixel);
|
XSetForeground(dpy, scr->info_text_gc, scr->black_pixel);
|
||||||
|
|
||||||
wDrawString(pixmap, font, scr->info_text_gc, 8,
|
WMDrawString(scr->wmscreen, pixmap, scr->info_text_gc, font, 8,
|
||||||
ty + font->y + (height - font->height)/2,
|
ty + (height - WMFontHeight(font))/2,
|
||||||
text, strlen(text));
|
text, strlen(text));
|
||||||
|
|
||||||
XSetWindowBackgroundPixmap(dpy, scr->balloon->window, pixmap);
|
XSetWindowBackgroundPixmap(dpy, scr->balloon->window, pixmap);
|
||||||
scr->balloon->contents = pixmap;
|
scr->balloon->contents = pixmap;
|
||||||
@@ -235,13 +235,13 @@ showText(WScreen *scr, int x, int y, int h, int w, char *text)
|
|||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
WFont *font = scr->info_text_font;
|
WMFont *font = scr->info_text_font;
|
||||||
|
|
||||||
if (scr->balloon->contents)
|
if (scr->balloon->contents)
|
||||||
XFreePixmap(dpy, scr->balloon->contents);
|
XFreePixmap(dpy, scr->balloon->contents);
|
||||||
|
|
||||||
width = wTextWidth(font->font, text, strlen(text))+8;
|
width = WMWidthOfString(font, text, strlen(text))+8;
|
||||||
height = font->height + 4;
|
height = WMFontHeight(font) + 4;
|
||||||
|
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
x = 0;
|
x = 0;
|
||||||
@@ -267,8 +267,8 @@ showText(WScreen *scr, int x, int y, int h, int w, char *text)
|
|||||||
|
|
||||||
XSetForeground(dpy, scr->info_text_gc, scr->window_title_pixel[0]);
|
XSetForeground(dpy, scr->info_text_gc, scr->window_title_pixel[0]);
|
||||||
|
|
||||||
wDrawString(pixmap, font->font, scr->info_text_gc, 4, font->y+2, text,
|
WMDrawString(scr->wmscreen, pixmap, scr->info_text_gc, font,
|
||||||
strlen(text));
|
4, 2, text, strlen(text));
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -99,9 +99,6 @@
|
|||||||
* set by configure */
|
* set by configure */
|
||||||
#undef I18N
|
#undef I18N
|
||||||
|
|
||||||
/* Multi-byte (japanese, korean, chinese etc.) character support */
|
|
||||||
#undef I18N_MB
|
|
||||||
|
|
||||||
/* define if you want sound support */
|
/* define if you want sound support */
|
||||||
#undef WMSOUND
|
#undef WMSOUND
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ static int setClipTitleFont();
|
|||||||
static int setClipTitleColor();
|
static int setClipTitleColor();
|
||||||
|
|
||||||
static int setMenuStyle();
|
static int setMenuStyle();
|
||||||
|
static int setMultiByte();
|
||||||
|
|
||||||
static int updateUsableArea();
|
static int updateUsableArea();
|
||||||
|
|
||||||
@@ -351,6 +351,9 @@ WDefaultEntry staticOptionList[] = {
|
|||||||
{"DisableMiniwindows", "NO", NULL,
|
{"DisableMiniwindows", "NO", NULL,
|
||||||
&wPreferences.disable_miniwindows, getBool, NULL
|
&wPreferences.disable_miniwindows, getBool, NULL
|
||||||
},
|
},
|
||||||
|
{"MultiByteText", "NO", NULL,
|
||||||
|
&wPreferences.multi_byte_text, getBool, setMultiByte
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -2104,14 +2107,14 @@ static int
|
|||||||
getFont(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
|
getFont(WScreen *scr, WDefaultEntry *entry, proplist_t value, void *addr,
|
||||||
void **ret)
|
void **ret)
|
||||||
{
|
{
|
||||||
static WFont *font;
|
static WMFont *font;
|
||||||
char *val;
|
char *val;
|
||||||
|
|
||||||
STRINGP("Font");
|
STRINGP("Font");
|
||||||
|
|
||||||
val = PLGetString(value);
|
val = PLGetString(value);
|
||||||
|
|
||||||
font = wLoadFont(val);
|
font = WMCreateFont(scr->wmscreen, val);
|
||||||
if (!font) {
|
if (!font) {
|
||||||
wfatal(_("could not load any usable font!!!"));
|
wfatal(_("could not load any usable font!!!"));
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -2416,107 +2419,78 @@ setIconTile(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
setWinTitleFont(WScreen *scr, WDefaultEntry *entry, WFont *font, void *foo)
|
setWinTitleFont(WScreen *scr, WDefaultEntry *entry, WMFont *font, void *foo)
|
||||||
{
|
{
|
||||||
if (scr->title_font) {
|
if (scr->title_font) {
|
||||||
wFreeFont(scr->title_font);
|
WMReleaseFont(scr->title_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
scr->title_font = font;
|
scr->title_font = font;
|
||||||
|
|
||||||
#ifndef I18N_MB
|
|
||||||
XSetFont(dpy, scr->window_title_gc, font->font->fid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return REFRESH_WINDOW_FONT|REFRESH_BUTTON_IMAGES;
|
return REFRESH_WINDOW_FONT|REFRESH_BUTTON_IMAGES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
setMenuTitleFont(WScreen *scr, WDefaultEntry *entry, WFont *font, void *foo)
|
setMenuTitleFont(WScreen *scr, WDefaultEntry *entry, WMFont *font, void *foo)
|
||||||
{
|
{
|
||||||
if (scr->menu_title_font) {
|
if (scr->menu_title_font) {
|
||||||
wFreeFont(scr->menu_title_font);
|
WMReleaseFont(scr->menu_title_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
scr->menu_title_font = font;
|
scr->menu_title_font = font;
|
||||||
|
|
||||||
#ifndef I18N_MB
|
|
||||||
XSetFont(dpy, scr->menu_title_gc, font->font->fid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return REFRESH_MENU_TITLE_FONT;
|
return REFRESH_MENU_TITLE_FONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
setMenuTextFont(WScreen *scr, WDefaultEntry *entry, WFont *font, void *foo)
|
setMenuTextFont(WScreen *scr, WDefaultEntry *entry, WMFont *font, void *foo)
|
||||||
{
|
{
|
||||||
if (scr->menu_entry_font) {
|
if (scr->menu_entry_font) {
|
||||||
wFreeFont(scr->menu_entry_font);
|
WMReleaseFont(scr->menu_entry_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
scr->menu_entry_font = font;
|
scr->menu_entry_font = font;
|
||||||
|
|
||||||
#ifndef I18N_MB
|
|
||||||
XSetFont(dpy, scr->menu_entry_gc, font->font->fid);
|
|
||||||
XSetFont(dpy, scr->disabled_menu_entry_gc, font->font->fid);
|
|
||||||
XSetFont(dpy, scr->select_menu_gc, font->font->fid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return REFRESH_MENU_FONT;
|
return REFRESH_MENU_FONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
setIconTitleFont(WScreen *scr, WDefaultEntry *entry, WFont *font, void *foo)
|
setIconTitleFont(WScreen *scr, WDefaultEntry *entry, WMFont *font, void *foo)
|
||||||
{
|
{
|
||||||
if (scr->icon_title_font) {
|
if (scr->icon_title_font) {
|
||||||
wFreeFont(scr->icon_title_font);
|
WMReleaseFont(scr->icon_title_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
scr->icon_title_font = font;
|
scr->icon_title_font = font;
|
||||||
|
|
||||||
#ifndef I18N_MB
|
|
||||||
XSetFont(dpy, scr->icon_title_gc, font->font->fid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return REFRESH_ICON_FONT;
|
return REFRESH_ICON_FONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
setClipTitleFont(WScreen *scr, WDefaultEntry *entry, WFont *font, void *foo)
|
setClipTitleFont(WScreen *scr, WDefaultEntry *entry, WMFont *font, void *foo)
|
||||||
{
|
{
|
||||||
if (scr->clip_title_font) {
|
if (scr->clip_title_font) {
|
||||||
wFreeFont(scr->clip_title_font);
|
WMReleaseFont(scr->clip_title_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
scr->clip_title_font = font;
|
scr->clip_title_font = font;
|
||||||
|
|
||||||
#ifndef I18N_MB
|
|
||||||
XSetFont(dpy, scr->clip_title_gc, font->font->fid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return REFRESH_ICON_FONT;
|
return REFRESH_ICON_FONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
setDisplayFont(WScreen *scr, WDefaultEntry *entry, WFont *font, void *foo)
|
setDisplayFont(WScreen *scr, WDefaultEntry *entry, WMFont *font, void *foo)
|
||||||
{
|
{
|
||||||
if (scr->info_text_font) {
|
if (scr->info_text_font) {
|
||||||
wFreeFont(scr->info_text_font);
|
WMReleaseFont(scr->info_text_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
scr->info_text_font = font;
|
scr->info_text_font = font;
|
||||||
|
|
||||||
#ifndef I18N_MB
|
|
||||||
XSetFont(dpy, scr->info_text_gc, font->font->fid);
|
|
||||||
XSetFont(dpy, scr->line_gc, font->font->fid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This test works because the scr structure is initially zeroed out
|
/* This test works because the scr structure is initially zeroed out
|
||||||
and None = 0. Any other time, the window should be valid. */
|
and None = 0. Any other time, the window should be valid. */
|
||||||
if (scr->geometry_display != None) {
|
if (scr->geometry_display != None) {
|
||||||
@@ -2531,10 +2505,10 @@ setDisplayFont(WScreen *scr, WDefaultEntry *entry, WFont *font, void *foo)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
setLargeDisplayFont(WScreen *scr, WDefaultEntry *entry, WFont *font, void *foo)
|
setLargeDisplayFont(WScreen *scr, WDefaultEntry *entry, WMFont *font, void *foo)
|
||||||
{
|
{
|
||||||
if (scr->workspace_name_font) {
|
if (scr->workspace_name_font) {
|
||||||
wFreeFont(scr->workspace_name_font);
|
WMReleaseFont(scr->workspace_name_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
scr->workspace_name_font = font;
|
scr->workspace_name_font = font;
|
||||||
@@ -3044,3 +3018,15 @@ setDoubleClick(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
setMultiByte(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
|
||||||
|
{
|
||||||
|
extern _WINGsConfiguration WINGsConfiguration;
|
||||||
|
|
||||||
|
WINGsConfiguration.useMultiByte = *value;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
23
src/dock.c
23
src/dock.c
@@ -1265,17 +1265,18 @@ wClipIconPaint(WAppIcon *aicon)
|
|||||||
else
|
else
|
||||||
XSetForeground(dpy, gc, scr->clip_title_pixel[CLIP_COLLAPSED]);
|
XSetForeground(dpy, gc, scr->clip_title_pixel[CLIP_COLLAPSED]);
|
||||||
|
|
||||||
ty = ICON_SIZE - scr->clip_title_font->height - 3;
|
ty = ICON_SIZE - WMFontHeight(scr->clip_title_font) - 3;
|
||||||
|
|
||||||
tx = CLIP_BUTTON_SIZE*ICON_SIZE/64;
|
tx = CLIP_BUTTON_SIZE*ICON_SIZE/64;
|
||||||
|
|
||||||
wDrawString(win, scr->clip_title_font, gc, tx,
|
WMDrawString(scr->wmscreen, win, gc, scr->clip_title_font, tx,
|
||||||
ty + scr->clip_title_font->y, ws_name, length);
|
ty, ws_name, length);
|
||||||
|
|
||||||
tx = (ICON_SIZE/2 - wTextWidth(scr->clip_title_font->font, ws_number, nlength))/2;
|
tx = (ICON_SIZE/2 - WMWidthOfString(scr->clip_title_font, ws_number,
|
||||||
|
nlength))/2;
|
||||||
|
|
||||||
wDrawString(win, scr->clip_title_font, gc, tx,
|
WMDrawString(scr->wmscreen, win, gc, scr->clip_title_font, tx,
|
||||||
scr->clip_title_font->y + 2, ws_number, nlength);
|
2, ws_number, nlength);
|
||||||
|
|
||||||
free(ws_name);
|
free(ws_name);
|
||||||
|
|
||||||
@@ -4066,13 +4067,13 @@ showClipBalloon(WDock *dock, int workspace)
|
|||||||
|
|
||||||
text = scr->workspaces[workspace]->name;
|
text = scr->workspaces[workspace]->name;
|
||||||
|
|
||||||
w = wTextWidth(scr->clip_title_font->font, text, strlen(text));
|
w = WMWidthOfString(scr->clip_title_font, text, strlen(text));
|
||||||
|
|
||||||
h = scr->clip_title_font->height;
|
h = WMFontHeight(scr->clip_title_font);
|
||||||
XResizeWindow(dpy, scr->clip_balloon, w, h);
|
XResizeWindow(dpy, scr->clip_balloon, w, h);
|
||||||
|
|
||||||
x = dock->x_pos + CLIP_BUTTON_SIZE*ICON_SIZE/64;
|
x = dock->x_pos + CLIP_BUTTON_SIZE*ICON_SIZE/64;
|
||||||
y = dock->y_pos + ICON_SIZE-scr->clip_title_font->height - 3;
|
y = dock->y_pos + ICON_SIZE - WMFontHeight(scr->clip_title_font) - 3;
|
||||||
|
|
||||||
if (x+w > scr->scr_width) {
|
if (x+w > scr->scr_width) {
|
||||||
x = scr->scr_width - w;
|
x = scr->scr_width - w;
|
||||||
@@ -4090,8 +4091,8 @@ showClipBalloon(WDock *dock, int workspace)
|
|||||||
XSetForeground(dpy, scr->clip_title_gc,
|
XSetForeground(dpy, scr->clip_title_gc,
|
||||||
scr->clip_title_pixel[CLIP_NORMAL]);
|
scr->clip_title_pixel[CLIP_NORMAL]);
|
||||||
XClearWindow(dpy, scr->clip_balloon);
|
XClearWindow(dpy, scr->clip_balloon);
|
||||||
wDrawString(scr->clip_balloon, scr->clip_title_font, scr->clip_title_gc,
|
WMDrawString(scr->wmscreen, scr->clip_balloon, scr->clip_title_gc,
|
||||||
0, scr->clip_title_font->y, text, strlen(text));
|
scr->clip_title_font, 0, 0, text, strlen(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -409,7 +409,6 @@ handleDeadProcess(void *foo)
|
|||||||
static void
|
static void
|
||||||
saveTimestamp(XEvent *event)
|
saveTimestamp(XEvent *event)
|
||||||
{
|
{
|
||||||
WScreen *scr = wScreenForWindow(event->xany.window);
|
|
||||||
LastTimestamp = CurrentTime;
|
LastTimestamp = CurrentTime;
|
||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
@@ -973,7 +972,7 @@ raiseWindow(WScreen *scr)
|
|||||||
if (!wwin)
|
if (!wwin)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!wwin->flags.destroyed) {
|
if (!wwin->flags.destroyed && wwin->flags.focused) {
|
||||||
wRaiseFrame(wwin->frame->core);
|
wRaiseFrame(wwin->frame->core);
|
||||||
/* this is needed or a race condition will occur */
|
/* this is needed or a race condition will occur */
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|||||||
385
src/framewin.c
385
src/framewin.c
@@ -23,9 +23,6 @@
|
|||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
|
||||||
#include <X11/XKBlib.h>
|
|
||||||
#endif /* KEEP_XKB_LOCK_STATUS */
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -65,7 +62,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 flags,
|
int width, int height, int flags,
|
||||||
WTexture **title_texture, WTexture **resize_texture,
|
WTexture **title_texture, WTexture **resize_texture,
|
||||||
unsigned long *color, GC *gc, WFont **font)
|
unsigned long *color, GC *gc, WMFont **font)
|
||||||
{
|
{
|
||||||
WFrameWindow *fwin;
|
WFrameWindow *fwin;
|
||||||
|
|
||||||
@@ -81,10 +78,6 @@ wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
|
|||||||
fwin->title_pixel = color;
|
fwin->title_pixel = color;
|
||||||
fwin->title_gc = gc;
|
fwin->title_gc = gc;
|
||||||
fwin->font = font;
|
fwin->font = font;
|
||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
|
||||||
fwin->languagemode = XkbGroup1Index;
|
|
||||||
fwin->last_languagemode = XkbGroup2Index;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fwin->core = wCoreCreateTopLevel(scr, x, y, width, height,
|
fwin->core = wCoreCreateTopLevel(scr, x, y, width, height,
|
||||||
FRAME_BORDER_WIDTH);
|
FRAME_BORDER_WIDTH);
|
||||||
@@ -129,7 +122,7 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
|||||||
height = fwin->core->height - fwin->top_width - fwin->bottom_width;
|
height = fwin->core->height - fwin->top_width - fwin->bottom_width;
|
||||||
|
|
||||||
if (flags & WFF_TITLEBAR)
|
if (flags & WFF_TITLEBAR)
|
||||||
theight = (*fwin->font)->height + TITLEBAR_EXTRA_HEIGHT;
|
theight = WMFontHeight(*fwin->font) + TITLEBAR_EXTRA_HEIGHT;
|
||||||
else
|
else
|
||||||
theight = 0;
|
theight = 0;
|
||||||
|
|
||||||
@@ -151,16 +144,6 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
|||||||
if (fwin->left_button) {
|
if (fwin->left_button) {
|
||||||
wCoreConfigure(fwin->left_button, 0, 0, bsize, bsize);
|
wCoreConfigure(fwin->left_button, 0, 0, bsize, bsize);
|
||||||
}
|
}
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (fwin->language_button)
|
|
||||||
if (fwin->flags.hide_left_button || !fwin->left_button
|
|
||||||
|| fwin->flags.lbutton_dont_fit) {
|
|
||||||
wCoreConfigure(fwin->language_button, 0, 0, bsize, bsize);
|
|
||||||
} else {
|
|
||||||
wCoreConfigure(fwin->language_button, bsize, 0, bsize, bsize);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if (fwin->right_button) {
|
if (fwin->right_button) {
|
||||||
wCoreConfigure(fwin->right_button, width-bsize+1,
|
wCoreConfigure(fwin->right_button, width-bsize+1,
|
||||||
@@ -172,14 +155,6 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
|||||||
bsize, bsize);
|
bsize, bsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (fwin->language_button) {
|
|
||||||
wCoreConfigure(fwin->language_button, 6 + bsize, (theight-bsize)/2,
|
|
||||||
bsize, bsize);
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fwin->right_button) {
|
if (fwin->right_button) {
|
||||||
wCoreConfigure(fwin->right_button, width-bsize-3,
|
wCoreConfigure(fwin->right_button, width-bsize-3,
|
||||||
(theight-bsize)/2, bsize, bsize);
|
(theight-bsize)/2, bsize, bsize);
|
||||||
@@ -189,25 +164,16 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
|||||||
} else {
|
} else {
|
||||||
/* we had a titlebar, but now we don't need it anymore */
|
/* we had a titlebar, but now we don't need it anymore */
|
||||||
for (i=0; i < (fwin->flags.single_texture ? 1 : 3); i++) {
|
for (i=0; i < (fwin->flags.single_texture ? 1 : 3); i++) {
|
||||||
FREE_PIXMAP(fwin->title_back[i]);
|
FREE_PIXMAP(fwin->title_back[i]);
|
||||||
if (wPreferences.new_style) {
|
if (wPreferences.new_style) {
|
||||||
FREE_PIXMAP(fwin->lbutton_back[i]);
|
FREE_PIXMAP(fwin->lbutton_back[i]);
|
||||||
FREE_PIXMAP(fwin->rbutton_back[i]);
|
FREE_PIXMAP(fwin->rbutton_back[i]);
|
||||||
#ifdef XKB_BUTTON_HINT
|
}
|
||||||
FREE_PIXMAP(fwin->languagebutton_back[i]);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (fwin->left_button)
|
if (fwin->left_button)
|
||||||
wCoreDestroy(fwin->left_button);
|
wCoreDestroy(fwin->left_button);
|
||||||
fwin->left_button = NULL;
|
fwin->left_button = NULL;
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (fwin->language_button)
|
|
||||||
wCoreDestroy(fwin->language_button);
|
|
||||||
fwin->language_button = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fwin->right_button)
|
if (fwin->right_button)
|
||||||
wCoreDestroy(fwin->right_button);
|
wCoreDestroy(fwin->right_button);
|
||||||
fwin->right_button = NULL;
|
fwin->right_button = NULL;
|
||||||
@@ -227,59 +193,31 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
|||||||
fwin->titlebar = wCoreCreate(fwin->core, 0, 0, width+1, theight);
|
fwin->titlebar = wCoreCreate(fwin->core, 0, 0, width+1, theight);
|
||||||
|
|
||||||
if (flags & WFF_LEFT_BUTTON) {
|
if (flags & WFF_LEFT_BUTTON) {
|
||||||
fwin->flags.left_button = 1;
|
fwin->flags.left_button = 1;
|
||||||
if (wPreferences.new_style) {
|
if (wPreferences.new_style) {
|
||||||
fwin->left_button = wCoreCreate(fwin->core, 0, 0,
|
fwin->left_button = wCoreCreate(fwin->core, 0, 0,
|
||||||
bsize, bsize);
|
bsize, bsize);
|
||||||
if (width < theight*4) {
|
if (width < theight*4) {
|
||||||
fwin->flags.lbutton_dont_fit = 1;
|
fwin->flags.lbutton_dont_fit = 1;
|
||||||
|
} else {
|
||||||
|
XMapRaised(dpy, fwin->left_button->window);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
XMapRaised(dpy, fwin->left_button->window);
|
fwin->left_button =
|
||||||
}
|
wCoreCreate(fwin->titlebar, 3, (theight-bsize)/2,
|
||||||
} else {
|
|
||||||
fwin->left_button =
|
|
||||||
wCoreCreate(fwin->titlebar, 3, (theight-bsize)/2,
|
|
||||||
bsize, bsize);
|
|
||||||
|
|
||||||
XSetWindowBackground(dpy, fwin->left_button->window,
|
|
||||||
scr->widget_texture->normal.pixel);
|
|
||||||
|
|
||||||
if (width < theight*3) {
|
|
||||||
fwin->flags.lbutton_dont_fit = 1;
|
|
||||||
} else {
|
|
||||||
XMapRaised(dpy, fwin->left_button->window);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (flags & WFF_LANGUAGE_BUTTON) {
|
|
||||||
fwin->flags.language_button = 1;
|
|
||||||
if (wPreferences.new_style) {
|
|
||||||
fwin->language_button = wCoreCreate(fwin->core,
|
|
||||||
bsize, 0, bsize, bsize);
|
|
||||||
|
|
||||||
if (width < theight*4) {
|
|
||||||
fwin->flags.languagebutton_dont_fit = 1;
|
|
||||||
} else {
|
|
||||||
XMapRaised(dpy, fwin->language_button->window);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fwin->language_button =
|
|
||||||
wCoreCreate(fwin->titlebar, bsize + 6, (theight-bsize)/2,
|
|
||||||
bsize, bsize);
|
bsize, bsize);
|
||||||
|
|
||||||
XSetWindowBackground(dpy, fwin->language_button->window,
|
XSetWindowBackground(dpy, fwin->left_button->window,
|
||||||
scr->widget_texture->normal.pixel);
|
scr->widget_texture->normal.pixel);
|
||||||
|
|
||||||
if (width < theight*3) {
|
if (width < theight*3) {
|
||||||
fwin->flags.languagebutton_dont_fit = 1;
|
fwin->flags.lbutton_dont_fit = 1;
|
||||||
} else {
|
} else {
|
||||||
XMapRaised(dpy, fwin->language_button->window);
|
XMapRaised(dpy, fwin->left_button->window);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (flags & WFF_RIGHT_BUTTON) {
|
if (flags & WFF_RIGHT_BUTTON) {
|
||||||
fwin->flags.right_button = 1;
|
fwin->flags.right_button = 1;
|
||||||
@@ -378,16 +316,6 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags)
|
|||||||
fwin->left_button->descriptor.handle_mousedown = buttonMouseDown;
|
fwin->left_button->descriptor.handle_mousedown = buttonMouseDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (fwin->language_button) {
|
|
||||||
fwin->language_button->descriptor.handle_expose = handleButtonExpose;
|
|
||||||
fwin->language_button->descriptor.parent = fwin;
|
|
||||||
fwin->language_button->descriptor.parent_type = WCLASS_FRAME;
|
|
||||||
fwin->language_button->descriptor.handle_mousedown = buttonMouseDown;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if (fwin->right_button) {
|
if (fwin->right_button) {
|
||||||
fwin->right_button->descriptor.parent = fwin;
|
fwin->right_button->descriptor.parent = fwin;
|
||||||
fwin->right_button->descriptor.parent_type = WCLASS_FRAME;
|
fwin->right_button->descriptor.parent_type = WCLASS_FRAME;
|
||||||
@@ -408,11 +336,6 @@ wFrameWindowDestroy(WFrameWindow *fwin)
|
|||||||
if (fwin->left_button)
|
if (fwin->left_button)
|
||||||
wCoreDestroy(fwin->left_button);
|
wCoreDestroy(fwin->left_button);
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (fwin->language_button)
|
|
||||||
wCoreDestroy(fwin->language_button);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fwin->right_button)
|
if (fwin->right_button)
|
||||||
wCoreDestroy(fwin->right_button);
|
wCoreDestroy(fwin->right_button);
|
||||||
|
|
||||||
@@ -433,9 +356,6 @@ wFrameWindowDestroy(WFrameWindow *fwin)
|
|||||||
FREE_PIXMAP(fwin->title_back[i]);
|
FREE_PIXMAP(fwin->title_back[i]);
|
||||||
if (wPreferences.new_style) {
|
if (wPreferences.new_style) {
|
||||||
FREE_PIXMAP(fwin->lbutton_back[i]);
|
FREE_PIXMAP(fwin->lbutton_back[i]);
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
FREE_PIXMAP(fwin->languagebutton_back[i]);
|
|
||||||
#endif
|
|
||||||
FREE_PIXMAP(fwin->rbutton_back[i]);
|
FREE_PIXMAP(fwin->rbutton_back[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -463,7 +383,7 @@ updateTitlebar(WFrameWindow *fwin)
|
|||||||
int x, w;
|
int x, w;
|
||||||
int theight;
|
int theight;
|
||||||
|
|
||||||
theight = (*fwin->font)->height + TITLEBAR_EXTRA_HEIGHT;
|
theight = WMFontHeight(*fwin->font) + TITLEBAR_EXTRA_HEIGHT;
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
w = fwin->core->width + 1;
|
w = fwin->core->width + 1;
|
||||||
@@ -472,50 +392,11 @@ updateTitlebar(WFrameWindow *fwin)
|
|||||||
if (fwin->flags.hide_left_button || !fwin->left_button
|
if (fwin->flags.hide_left_button || !fwin->left_button
|
||||||
|| fwin->flags.lbutton_dont_fit) {
|
|| fwin->flags.lbutton_dont_fit) {
|
||||||
x = 0;
|
x = 0;
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if(fwin->language_button)
|
|
||||||
wCoreConfigure(fwin->language_button, 0, 0,
|
|
||||||
fwin->language_button->width,
|
|
||||||
fwin->language_button->width);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if(fwin->language_button)
|
|
||||||
wCoreConfigure(fwin->language_button, fwin->left_button->width, 0,
|
|
||||||
fwin->language_button->width,
|
|
||||||
fwin->language_button->width);
|
|
||||||
#endif
|
|
||||||
x = fwin->left_button->width;
|
x = fwin->left_button->width;
|
||||||
w -= fwin->left_button->width;
|
w -= fwin->left_button->width;
|
||||||
}
|
}
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (fwin->flags.hide_language_button || !fwin->language_button
|
|
||||||
|| fwin->flags.languagebutton_dont_fit) {
|
|
||||||
} else {
|
|
||||||
x += fwin->language_button->width;
|
|
||||||
w -= fwin->language_button->width;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
else {
|
|
||||||
int bsize = theight - 7;
|
|
||||||
if (fwin->flags.hide_left_button || !fwin->left_button
|
|
||||||
|| fwin->flags.lbutton_dont_fit) {
|
|
||||||
if(fwin->language_button)
|
|
||||||
wCoreConfigure(fwin->language_button, 3, (theight-bsize)/2,
|
|
||||||
fwin->language_button->width,
|
|
||||||
fwin->language_button->width);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(fwin->language_button)
|
|
||||||
wCoreConfigure(fwin->language_button,
|
|
||||||
6 + fwin->left_button->width, (theight-bsize)/2,
|
|
||||||
fwin->language_button->width,
|
|
||||||
fwin->language_button->width);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (wPreferences.new_style) {
|
if (wPreferences.new_style) {
|
||||||
if (!fwin->flags.hide_right_button && fwin->right_button
|
if (!fwin->flags.hide_right_button && fwin->right_button
|
||||||
@@ -544,23 +425,12 @@ wFrameWindowHideButton(WFrameWindow *fwin, int flags)
|
|||||||
fwin->flags.hide_left_button = 1;
|
fwin->flags.hide_left_button = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if ((flags & WFF_LANGUAGE_BUTTON) && fwin->language_button) {
|
|
||||||
XUnmapWindow(dpy, fwin->language_button->window);
|
|
||||||
fwin->flags.hide_language_button = 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fwin->titlebar) {
|
if (fwin->titlebar) {
|
||||||
if (wPreferences.new_style) {
|
if (wPreferences.new_style) {
|
||||||
updateTitlebar(fwin);
|
updateTitlebar(fwin);
|
||||||
} else {
|
} else {
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
updateTitlebar(fwin);
|
|
||||||
#else
|
|
||||||
XClearWindow(dpy, fwin->titlebar->window);
|
XClearWindow(dpy, fwin->titlebar->window);
|
||||||
wFrameWindowPaint(fwin);
|
wFrameWindowPaint(fwin);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
checkTitleSize(fwin);
|
checkTitleSize(fwin);
|
||||||
}
|
}
|
||||||
@@ -579,17 +449,6 @@ wFrameWindowShowButton(WFrameWindow *fwin, int flags)
|
|||||||
fwin->flags.hide_right_button = 0;
|
fwin->flags.hide_right_button = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if ((flags & WFF_LANGUAGE_BUTTON) && fwin->language_button
|
|
||||||
&& fwin->flags.hide_language_button) {
|
|
||||||
|
|
||||||
if (!fwin->flags.languagebutton_dont_fit)
|
|
||||||
XMapWindow(dpy, fwin->language_button->window);
|
|
||||||
|
|
||||||
fwin->flags.hide_language_button = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((flags & WFF_LEFT_BUTTON) && fwin->left_button
|
if ((flags & WFF_LEFT_BUTTON) && fwin->left_button
|
||||||
&& fwin->flags.hide_left_button) {
|
&& fwin->flags.hide_left_button) {
|
||||||
|
|
||||||
@@ -613,29 +472,17 @@ wFrameWindowShowButton(WFrameWindow *fwin, int flags)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
renderTexture(WScreen *scr, WTexture *texture, int width, int height,
|
|
||||||
int bwidth, int bheight, int left, int language, int right,
|
|
||||||
Pixmap *title, Pixmap *lbutton, Pixmap *languagebutton, Pixmap *rbutton)
|
|
||||||
#else
|
|
||||||
renderTexture(WScreen *scr, WTexture *texture, int width, int height,
|
renderTexture(WScreen *scr, WTexture *texture, int width, int height,
|
||||||
int bwidth, int bheight, int left, int right,
|
int bwidth, int bheight, int left, int right,
|
||||||
Pixmap *title, Pixmap *lbutton, Pixmap *rbutton)
|
Pixmap *title, Pixmap *lbutton, Pixmap *rbutton)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
RImage *img;
|
RImage *img;
|
||||||
RImage *limg, *rimg, *mimg;
|
RImage *limg, *rimg, *mimg;
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
RImage *timg;
|
|
||||||
#endif
|
|
||||||
int x, w;
|
int x, w;
|
||||||
|
|
||||||
*title = None;
|
*title = None;
|
||||||
*lbutton = None;
|
*lbutton = None;
|
||||||
*rbutton = None;
|
*rbutton = None;
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
*languagebutton = None;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
img = wTextureRenderImage(texture, width, height, WREL_FLAT);
|
img = wTextureRenderImage(texture, width, height, WREL_FLAT);
|
||||||
if (!img) {
|
if (!img) {
|
||||||
@@ -652,13 +499,6 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
|
|||||||
x = 0;
|
x = 0;
|
||||||
w = img->width;
|
w = img->width;
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (language) {
|
|
||||||
timg = RGetSubImage(img, bwidth, 0, bwidth, bheight);
|
|
||||||
} else
|
|
||||||
timg = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (limg) {
|
if (limg) {
|
||||||
RBevelImage(limg, RBEV_RAISED2);
|
RBevelImage(limg, RBEV_RAISED2);
|
||||||
if (!RConvertImage(scr->rcontext, limg, lbutton)) {
|
if (!RConvertImage(scr->rcontext, limg, lbutton)) {
|
||||||
@@ -669,18 +509,6 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
|
|||||||
RDestroyImage(limg);
|
RDestroyImage(limg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (timg) {
|
|
||||||
RBevelImage(timg, RBEV_RAISED2);
|
|
||||||
if (!RConvertImage(scr->rcontext, timg, languagebutton)) {
|
|
||||||
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
|
|
||||||
}
|
|
||||||
x += timg->width;
|
|
||||||
w -= timg->width;
|
|
||||||
RDestroyImage(timg);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (right) {
|
if (right) {
|
||||||
rimg = RGetSubImage(img, width - bwidth, 0, bwidth, bheight);
|
rimg = RGetSubImage(img, width - bwidth, 0, bwidth, bheight);
|
||||||
} else
|
} else
|
||||||
@@ -791,12 +619,6 @@ updateTexture(WFrameWindow *fwin)
|
|||||||
XSetWindowBackgroundPixmap(dpy, fwin->left_button->window,
|
XSetWindowBackgroundPixmap(dpy, fwin->left_button->window,
|
||||||
fwin->lbutton_back[i]);
|
fwin->lbutton_back[i]);
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (fwin->language_button && fwin->languagebutton_back[i])
|
|
||||||
XSetWindowBackgroundPixmap(dpy, fwin->language_button->window,
|
|
||||||
fwin->languagebutton_back[i]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fwin->right_button && fwin->rbutton_back[i])
|
if (fwin->right_button && fwin->rbutton_back[i])
|
||||||
XSetWindowBackgroundPixmap(dpy, fwin->right_button->window,
|
XSetWindowBackgroundPixmap(dpy, fwin->right_button->window,
|
||||||
fwin->rbutton_back[i]);
|
fwin->rbutton_back[i]);
|
||||||
@@ -808,11 +630,6 @@ updateTexture(WFrameWindow *fwin)
|
|||||||
if (fwin->left_button)
|
if (fwin->left_button)
|
||||||
XSetWindowBackground(dpy, fwin->left_button->window,
|
XSetWindowBackground(dpy, fwin->left_button->window,
|
||||||
pixel);
|
pixel);
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (fwin->language_button)
|
|
||||||
XSetWindowBackground(dpy, fwin->language_button->window,
|
|
||||||
pixel);
|
|
||||||
#endif
|
|
||||||
if (fwin->right_button)
|
if (fwin->right_button)
|
||||||
XSetWindowBackground(dpy, fwin->right_button->window,
|
XSetWindowBackground(dpy, fwin->right_button->window,
|
||||||
pixel);
|
pixel);
|
||||||
@@ -824,12 +641,6 @@ updateTexture(WFrameWindow *fwin)
|
|||||||
XClearWindow(dpy, fwin->left_button->window);
|
XClearWindow(dpy, fwin->left_button->window);
|
||||||
handleButtonExpose(&fwin->left_button->descriptor, NULL);
|
handleButtonExpose(&fwin->left_button->descriptor, NULL);
|
||||||
}
|
}
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (fwin->language_button) {
|
|
||||||
XClearWindow(dpy, fwin->language_button->window);
|
|
||||||
handleButtonExpose(&fwin->language_button->descriptor, NULL);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (fwin->right_button) {
|
if (fwin->right_button) {
|
||||||
XClearWindow(dpy, fwin->right_button->window);
|
XClearWindow(dpy, fwin->right_button->window);
|
||||||
handleButtonExpose(&fwin->right_button->descriptor, NULL);
|
handleButtonExpose(&fwin->right_button->descriptor, NULL);
|
||||||
@@ -843,58 +654,35 @@ static void
|
|||||||
remakeTexture(WFrameWindow *fwin, int state)
|
remakeTexture(WFrameWindow *fwin, int state)
|
||||||
{
|
{
|
||||||
Pixmap pmap, lpmap, rpmap;
|
Pixmap pmap, lpmap, rpmap;
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
Pixmap tpmap;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fwin->title_texture[state] && fwin->titlebar) {
|
if (fwin->title_texture[state] && fwin->titlebar) {
|
||||||
FREE_PIXMAP(fwin->title_back[state]);
|
FREE_PIXMAP(fwin->title_back[state]);
|
||||||
if (wPreferences.new_style) {
|
if (wPreferences.new_style) {
|
||||||
FREE_PIXMAP(fwin->lbutton_back[state]);
|
FREE_PIXMAP(fwin->lbutton_back[state]);
|
||||||
FREE_PIXMAP(fwin->rbutton_back[state]);
|
FREE_PIXMAP(fwin->rbutton_back[state]);
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
FREE_PIXMAP(fwin->languagebutton_back[state]);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fwin->title_texture[state]->any.type!=WTEX_SOLID) {
|
if (fwin->title_texture[state]->any.type!=WTEX_SOLID) {
|
||||||
int left, right;
|
int left, right;
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
int language;
|
|
||||||
#endif
|
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
/* eventually surrounded by if new_style */
|
/* eventually surrounded by if new_style */
|
||||||
left = fwin->left_button && !fwin->flags.hide_left_button
|
left = fwin->left_button && !fwin->flags.hide_left_button
|
||||||
&& !fwin->flags.lbutton_dont_fit;
|
&& !fwin->flags.lbutton_dont_fit;
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
language = fwin->language_button && !fwin->flags.hide_language_button
|
|
||||||
&& !fwin->flags.languagebutton_dont_fit;
|
|
||||||
#endif
|
|
||||||
right = fwin->right_button && !fwin->flags.hide_right_button
|
right = fwin->right_button && !fwin->flags.hide_right_button
|
||||||
&& !fwin->flags.rbutton_dont_fit;
|
&& !fwin->flags.rbutton_dont_fit;
|
||||||
|
|
||||||
width = fwin->core->width+1;
|
width = fwin->core->width+1;
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
renderTexture(fwin->screen_ptr, fwin->title_texture[state],
|
|
||||||
width, fwin->titlebar->height,
|
|
||||||
fwin->titlebar->height, fwin->titlebar->height,
|
|
||||||
left, language, right, &pmap, &lpmap, &tpmap, &rpmap);
|
|
||||||
#else
|
|
||||||
renderTexture(fwin->screen_ptr, fwin->title_texture[state],
|
renderTexture(fwin->screen_ptr, fwin->title_texture[state],
|
||||||
width, fwin->titlebar->height,
|
width, fwin->titlebar->height,
|
||||||
fwin->titlebar->height, fwin->titlebar->height,
|
fwin->titlebar->height, fwin->titlebar->height,
|
||||||
left, right, &pmap, &lpmap, &rpmap);
|
left, right, &pmap, &lpmap, &rpmap);
|
||||||
#endif
|
|
||||||
|
|
||||||
fwin->title_back[state] = pmap;
|
fwin->title_back[state] = pmap;
|
||||||
if (wPreferences.new_style) {
|
if (wPreferences.new_style) {
|
||||||
fwin->lbutton_back[state] = lpmap;
|
fwin->lbutton_back[state] = lpmap;
|
||||||
fwin->rbutton_back[state] = rpmap;
|
fwin->rbutton_back[state] = rpmap;
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
fwin->languagebutton_back[state] = tpmap;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1010,6 +798,7 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
int titlelen;
|
int titlelen;
|
||||||
char *title;
|
char *title;
|
||||||
int allButtons = 1;
|
int allButtons = 1;
|
||||||
|
WScreen *scr = fwin->screen_ptr;
|
||||||
|
|
||||||
|
|
||||||
if (!wPreferences.new_style) {
|
if (!wPreferences.new_style) {
|
||||||
@@ -1019,14 +808,6 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
else
|
else
|
||||||
allButtons = 0;
|
allButtons = 0;
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (fwin->language_button && !fwin->flags.hide_language_button
|
|
||||||
&& !fwin->flags.languagebutton_dont_fit)
|
|
||||||
lofs += fwin->language_button->width;
|
|
||||||
else
|
|
||||||
allButtons = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fwin->right_button && !fwin->flags.hide_right_button
|
if (fwin->right_button && !fwin->flags.hide_right_button
|
||||||
&& !fwin->flags.rbutton_dont_fit)
|
&& !fwin->flags.rbutton_dont_fit)
|
||||||
rofs += fwin->right_button->width + 3;
|
rofs += fwin->right_button->width + 3;
|
||||||
@@ -1034,15 +815,26 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
allButtons = 0;
|
allButtons = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
#ifdef XKB_TITLE_HINT
|
||||||
fwin->languagebutton_image =
|
if(fwin->flags.is_client_window_frame) {
|
||||||
fwin->screen_ptr->b_pixmaps[WBUT_XKBGROUP1 + fwin->languagemode];
|
char * freebuff;
|
||||||
#endif
|
freebuff = (char *)wmalloc((strlen(fwin->title)+6)*sizeof(char));
|
||||||
|
if (fwin->flags.justification == WTJ_RIGHT)
|
||||||
|
sprintf(freebuff,"%s %s",fwin->title,fwin->languagemode?XKB_ON:XKB_OFF);
|
||||||
|
else
|
||||||
|
sprintf(freebuff,"%s %s",fwin->languagemode?XKB_ON:XKB_OFF,fwin->title);
|
||||||
|
title = ShrinkString(*fwin->font, freebuff,
|
||||||
|
fwin->titlebar->width - lofs - rofs);
|
||||||
|
free(freebuff);
|
||||||
|
}
|
||||||
|
else title = ShrinkString(*fwin->font, fwin->title,
|
||||||
|
fwin->titlebar->width - lofs - rofs);
|
||||||
|
#else
|
||||||
title = ShrinkString(*fwin->font, fwin->title,
|
title = ShrinkString(*fwin->font, fwin->title,
|
||||||
fwin->titlebar->width - lofs - rofs);
|
fwin->titlebar->width - lofs - rofs);
|
||||||
|
#endif /* XKB_TITLE_HINT */
|
||||||
titlelen = strlen(title);
|
titlelen = strlen(title);
|
||||||
w = wTextWidth((*fwin->font)->font, title, titlelen);
|
w = WMWidthOfString(*fwin->font, title, titlelen);
|
||||||
|
|
||||||
switch (fwin->flags.justification) {
|
switch (fwin->flags.justification) {
|
||||||
case WTJ_LEFT:
|
case WTJ_LEFT:
|
||||||
@@ -1068,31 +860,25 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
fwin->title_pixel[fwin->flags.state+3]);
|
fwin->title_pixel[fwin->flags.state+3]);
|
||||||
for(shadowx=0;shadowx<TITLE_TEXT_SHADOW_WIDTH;shadowx++)
|
for(shadowx=0;shadowx<TITLE_TEXT_SHADOW_WIDTH;shadowx++)
|
||||||
for(shadowy=0;shadowy<TITLE_TEXT_SHADOW_HEIGHT;shadowy++)
|
for(shadowy=0;shadowy<TITLE_TEXT_SHADOW_HEIGHT;shadowy++)
|
||||||
wDrawString(fwin->titlebar->window, *fwin->font,
|
WMDrawString(scr->wmscreen, fwin->titlebar->window,
|
||||||
*fwin->title_gc,
|
*fwin->title_gc, *fwin->font,
|
||||||
x + shadowx + TITLE_TEXT_SHADOW_X_OFFSET,
|
x + shadowx + TITLE_TEXT_SHADOW_X_OFFSET,
|
||||||
(*fwin->font)->y + TITLEBAR_EXTRA_HEIGHT/2
|
TITLEBAR_EXTRA_HEIGHT/2
|
||||||
+ shadowy + TITLE_TEXT_SHADOW_Y_OFFSET, title,
|
+ shadowy + TITLE_TEXT_SHADOW_Y_OFFSET, title,
|
||||||
titlelen);
|
titlelen);
|
||||||
}
|
}
|
||||||
#endif /* TITLE_TEXT_SHADOW */
|
#endif /* TITLE_TEXT_SHADOW */
|
||||||
|
|
||||||
XSetForeground(dpy, *fwin->title_gc,
|
XSetForeground(dpy, *fwin->title_gc,
|
||||||
fwin->title_pixel[fwin->flags.state]);
|
fwin->title_pixel[fwin->flags.state]);
|
||||||
|
|
||||||
wDrawString(fwin->titlebar->window, *fwin->font,
|
WMDrawString(scr->wmscreen, fwin->titlebar->window, *fwin->title_gc,
|
||||||
*fwin->title_gc, x,
|
*fwin->font, x, TITLEBAR_EXTRA_HEIGHT/2, title, titlelen);
|
||||||
(*fwin->font)->y + TITLEBAR_EXTRA_HEIGHT/2, title,
|
|
||||||
titlelen);
|
|
||||||
|
|
||||||
free(title);
|
free(title);
|
||||||
|
|
||||||
if (fwin->left_button)
|
if (fwin->left_button)
|
||||||
handleButtonExpose(&fwin->left_button->descriptor, NULL);
|
handleButtonExpose(&fwin->left_button->descriptor, NULL);
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (fwin->language_button)
|
|
||||||
handleButtonExpose(&fwin->language_button->descriptor, NULL);
|
|
||||||
#endif
|
|
||||||
if (fwin->right_button)
|
if (fwin->right_button)
|
||||||
handleButtonExpose(&fwin->right_button->descriptor, NULL);
|
handleButtonExpose(&fwin->right_button->descriptor, NULL);
|
||||||
}
|
}
|
||||||
@@ -1144,24 +930,6 @@ reconfigure(WFrameWindow *fwin, int x, int y, int width, int height,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (fwin->language_button) {
|
|
||||||
if (width < fwin->top_width*k && !fwin->flags.languagebutton_dont_fit) {
|
|
||||||
|
|
||||||
if (!fwin->flags.hide_language_button) {
|
|
||||||
XUnmapWindow(dpy, fwin->language_button->window);
|
|
||||||
}
|
|
||||||
fwin->flags.languagebutton_dont_fit = 1;
|
|
||||||
} else if (width >= fwin->top_width*k && fwin->flags.languagebutton_dont_fit) {
|
|
||||||
|
|
||||||
if (!fwin->flags.hide_language_button) {
|
|
||||||
XMapWindow(dpy, fwin->language_button->window);
|
|
||||||
}
|
|
||||||
fwin->flags.languagebutton_dont_fit = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fwin->right_button) {
|
if (fwin->right_button) {
|
||||||
if (width < fwin->top_width*2 && !fwin->flags.rbutton_dont_fit) {
|
if (width < fwin->top_width*2 && !fwin->flags.rbutton_dont_fit) {
|
||||||
|
|
||||||
@@ -1260,16 +1028,6 @@ wFrameWindowUpdatePushButton(WFrameWindow *fwin, Bool pushed)
|
|||||||
#endif /* OLWM_HINTS */
|
#endif /* OLWM_HINTS */
|
||||||
|
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
void
|
|
||||||
wFrameWindowUpdateLanguageButton(WFrameWindow *fwin)
|
|
||||||
{
|
|
||||||
paintButton(fwin->language_button, fwin->title_texture[fwin->flags.state],
|
|
||||||
fwin->title_pixel[fwin->flags.state],
|
|
||||||
fwin->languagebutton_image, True);
|
|
||||||
}
|
|
||||||
#endif /* XKB_BUTTON_HINT */
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
@@ -1311,18 +1069,11 @@ checkTitleSize(WFrameWindow *fwin)
|
|||||||
&& !fwin->flags.lbutton_dont_fit)
|
&& !fwin->flags.lbutton_dont_fit)
|
||||||
width -= fwin->left_button->width + 3;
|
width -= fwin->left_button->width + 3;
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (fwin->language_button && !fwin->flags.hide_language_button
|
|
||||||
&& !fwin->flags.languagebutton_dont_fit)
|
|
||||||
width -= fwin->language_button->width + 3;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fwin->right_button && !fwin->flags.hide_right_button
|
if (fwin->right_button && !fwin->flags.hide_right_button
|
||||||
&& !fwin->flags.rbutton_dont_fit)
|
&& !fwin->flags.rbutton_dont_fit)
|
||||||
width -= fwin->right_button->width + 3;
|
width -= fwin->right_button->width + 3;
|
||||||
}
|
}
|
||||||
if (wTextWidth((*fwin->font)->font, fwin->title,
|
if (WMWidthOfString(*fwin->font, fwin->title, strlen(fwin->title)) > width) {
|
||||||
strlen(fwin->title)) > width) {
|
|
||||||
fwin->flags.incomplete_title = 1;
|
fwin->flags.incomplete_title = 1;
|
||||||
} else {
|
} else {
|
||||||
fwin->flags.incomplete_title = 0;
|
fwin->flags.incomplete_title = 0;
|
||||||
@@ -1429,21 +1180,12 @@ handleButtonExpose(WObjDescriptor *desc, XEvent *event)
|
|||||||
WFrameWindow *fwin = (WFrameWindow*)desc->parent;
|
WFrameWindow *fwin = (WFrameWindow*)desc->parent;
|
||||||
WCoreWindow *button = (WCoreWindow*)desc->self;
|
WCoreWindow *button = (WCoreWindow*)desc->self;
|
||||||
|
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (button == fwin->language_button) {
|
|
||||||
if (wPreferences.modelock){
|
|
||||||
paintButton(button, fwin->title_texture[fwin->flags.state],
|
|
||||||
fwin->title_pixel[fwin->flags.state],
|
|
||||||
fwin->languagebutton_image, False);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
#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],
|
fwin->title_pixel[fwin->flags.state],
|
||||||
fwin->lbutton_image, False);
|
fwin->lbutton_image, False);
|
||||||
} else {
|
} else {
|
||||||
Bool pushed = False;
|
Bool pushed = False;
|
||||||
|
|
||||||
#ifdef OLWM_HINTS
|
#ifdef OLWM_HINTS
|
||||||
if (fwin->flags.right_button_pushed_in)
|
if (fwin->flags.right_button_pushed_in)
|
||||||
@@ -1508,12 +1250,6 @@ buttonMouseDown(WObjDescriptor *desc, XEvent *event)
|
|||||||
} else {
|
} else {
|
||||||
image = fwin->rbutton_image;
|
image = fwin->rbutton_image;
|
||||||
}
|
}
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
if (button == fwin->language_button) {
|
|
||||||
if (!wPreferences.modelock) return;
|
|
||||||
image = fwin->languagebutton_image;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pixel = fwin->title_pixel[fwin->flags.state];
|
pixel = fwin->title_pixel[fwin->flags.state];
|
||||||
texture = fwin->title_texture[fwin->flags.state];
|
texture = fwin->title_texture[fwin->flags.state];
|
||||||
@@ -1555,13 +1291,6 @@ buttonMouseDown(WObjDescriptor *desc, XEvent *event)
|
|||||||
if (fwin->on_click_right)
|
if (fwin->on_click_right)
|
||||||
(*fwin->on_click_right)(button, fwin->child, &ev);
|
(*fwin->on_click_right)(button, fwin->child, &ev);
|
||||||
}
|
}
|
||||||
#ifdef XKB_BUTTON_HINT
|
|
||||||
else if (button == fwin->language_button) {
|
|
||||||
if (fwin->on_click_language)
|
|
||||||
(*fwin->on_click_language)(button, fwin->child, &ev);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ typedef struct WFrameWindow {
|
|||||||
union WTexture **resizebar_texture;
|
union WTexture **resizebar_texture;
|
||||||
unsigned long *title_pixel;
|
unsigned long *title_pixel;
|
||||||
GC *title_gc;
|
GC *title_gc;
|
||||||
WFont **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 flags,
|
int width, int height, int flags,
|
||||||
union WTexture **title_texture,
|
union WTexture **title_texture,
|
||||||
union WTexture **resize_texture,
|
union WTexture **resize_texture,
|
||||||
unsigned long *color, GC *gc, WFont **font);
|
unsigned long *color, GC *gc, WMFont **font);
|
||||||
|
|
||||||
void wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags);
|
void wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags);
|
||||||
|
|
||||||
|
|||||||
20
src/funcs.h
20
src/funcs.h
@@ -109,7 +109,7 @@ WWindow *PrevFocusWindow(WScreen *scr);
|
|||||||
|
|
||||||
void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y);
|
void SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y);
|
||||||
|
|
||||||
char *ShrinkString(WFont *font, char *string, int width);
|
char *ShrinkString(WMFont *font, char *string, int width);
|
||||||
|
|
||||||
char *FindImage(char *paths, char *file);
|
char *FindImage(char *paths, char *file);
|
||||||
|
|
||||||
@@ -158,22 +158,4 @@ void ExecExitScript();
|
|||||||
Bool wFetchName(Display *dpy, Window win, char **winname);
|
Bool wFetchName(Display *dpy, Window win, char **winname);
|
||||||
Bool wGetIconName(Display *dpy, Window win, char **iconname);
|
Bool wGetIconName(Display *dpy, Window win, char **iconname);
|
||||||
|
|
||||||
#ifdef I18N_MB
|
|
||||||
/*void wTextWidth(XFontSet *font, char *text, int length);*/
|
|
||||||
#define wDrawString(d,f,gc,x,y,text,textlen) \
|
|
||||||
XmbDrawString(dpy, d, (f)->font, gc, (x), (y), text, textlen)
|
|
||||||
|
|
||||||
#define wTextWidth(font,text,textlen) XmbTextEscapement(font,text,textlen)
|
|
||||||
|
|
||||||
#else /* !I18N_MB */
|
|
||||||
|
|
||||||
#define wTextWidth(font,text,textlen) XTextWidth(font,text,textlen)
|
|
||||||
|
|
||||||
/*void wTextWidth(XFontStruct *font, char *text, int length);*/
|
|
||||||
#define wDrawString(d,font,gc,x,y,text,textlen) \
|
|
||||||
XDrawString(dpy, d, gc, (x), (y), text, textlen)
|
|
||||||
|
|
||||||
#endif /* !I18N_MB */
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
10
src/icon.c
10
src/icon.c
@@ -308,7 +308,7 @@ makeIcon(WScreen *scr, RImage *icon, int titled, int shadowed, int tileType)
|
|||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
int x, y, sx, sy;
|
int x, y, sx, sy;
|
||||||
unsigned w, h;
|
unsigned w, h;
|
||||||
int theight = scr->icon_title_font->height;
|
int theight = WMFontHeight(scr->icon_title_font);
|
||||||
|
|
||||||
if (tileType == TILE_NORMAL)
|
if (tileType == TILE_NORMAL)
|
||||||
tile = RCloneImage(scr->icon_tile);
|
tile = RCloneImage(scr->icon_tile);
|
||||||
@@ -605,7 +605,7 @@ void
|
|||||||
wIconUpdate(WIcon *icon)
|
wIconUpdate(WIcon *icon)
|
||||||
{
|
{
|
||||||
WScreen *scr = icon->core->screen_ptr;
|
WScreen *scr = icon->core->screen_ptr;
|
||||||
int title_height = scr->icon_title_font->height;
|
int title_height = WMFontHeight(scr->icon_title_font);
|
||||||
WWindow *wwin = icon->owner;
|
WWindow *wwin = icon->owner;
|
||||||
|
|
||||||
assert(scr->icon_tile!=NULL);
|
assert(scr->icon_tile!=NULL);
|
||||||
@@ -815,15 +815,15 @@ wIconPaint(WIcon *icon)
|
|||||||
|
|
||||||
tmp = ShrinkString(scr->icon_title_font, icon->icon_name,
|
tmp = ShrinkString(scr->icon_title_font, icon->icon_name,
|
||||||
wPreferences.icon_size-4);
|
wPreferences.icon_size-4);
|
||||||
w = wTextWidth(scr->icon_title_font->font, tmp, l=strlen(tmp));
|
w = WMWidthOfString(scr->icon_title_font, tmp, l=strlen(tmp));
|
||||||
|
|
||||||
if (w > icon->core->width - 4)
|
if (w > icon->core->width - 4)
|
||||||
x = (icon->core->width - 4) - w;
|
x = (icon->core->width - 4) - w;
|
||||||
else
|
else
|
||||||
x = (icon->core->width - w)/2;
|
x = (icon->core->width - w)/2;
|
||||||
|
|
||||||
wDrawString(icon->core->window, scr->icon_title_font, gc,
|
WMDrawString(scr->wmscreen, icon->core->window, gc,
|
||||||
x, 1 + scr->icon_title_font->y, tmp, l);
|
scr->icon_title_font, x, 1, tmp, l);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ main(int argc, char **argv)
|
|||||||
wsetabort(wAbort);
|
wsetabort(wAbort);
|
||||||
|
|
||||||
/* for telling WPrefs what's the name of the wmaker binary being ran */
|
/* for telling WPrefs what's the name of the wmaker binary being ran */
|
||||||
str = wstrappend("WMAKER_BIN_NAME", argv[0]);
|
str = wstrappend("WMAKER_BIN_NAME=", argv[0]);
|
||||||
putenv(str);
|
putenv(str);
|
||||||
|
|
||||||
ArgCount = argc;
|
ArgCount = argc;
|
||||||
|
|||||||
26
src/menu.c
26
src/menu.c
@@ -552,15 +552,15 @@ wMenuRealize(WMenu *menu)
|
|||||||
wFrameWindowUpdateBorders(menu->frame, flags);
|
wFrameWindowUpdateBorders(menu->frame, flags);
|
||||||
|
|
||||||
if (menu->flags.titled) {
|
if (menu->flags.titled) {
|
||||||
twidth = wTextWidth(scr->menu_title_font->font, menu->frame->title,
|
twidth = WMWidthOfString(scr->menu_title_font, menu->frame->title,
|
||||||
strlen(menu->frame->title));
|
strlen(menu->frame->title));
|
||||||
theight = menu->frame->top_width;
|
theight = menu->frame->top_width;
|
||||||
twidth += theight + (wPreferences.new_style ? 16 : 8);
|
twidth += theight + (wPreferences.new_style ? 16 : 8);
|
||||||
} else {
|
} else {
|
||||||
twidth = 0;
|
twidth = 0;
|
||||||
theight = 0;
|
theight = 0;
|
||||||
}
|
}
|
||||||
eheight = scr->menu_entry_font->height + 6;
|
eheight = WMFontHeight(scr->menu_entry_font) + 6;
|
||||||
menu->entry_height = eheight;
|
menu->entry_height = eheight;
|
||||||
mrwidth = 0;
|
mrwidth = 0;
|
||||||
mwidth = 0;
|
mwidth = 0;
|
||||||
@@ -569,7 +569,7 @@ wMenuRealize(WMenu *menu)
|
|||||||
|
|
||||||
/* search widest text */
|
/* search widest text */
|
||||||
text = menu->entries[i]->text;
|
text = menu->entries[i]->text;
|
||||||
width = wTextWidth(scr->menu_entry_font->font, text, strlen(text))+10;
|
width = WMWidthOfString(scr->menu_entry_font, text, strlen(text))+10;
|
||||||
|
|
||||||
if (menu->entries[i]->flags.indicator) {
|
if (menu->entries[i]->flags.indicator) {
|
||||||
width += MENU_INDICATOR_SPACE;
|
width += MENU_INDICATOR_SPACE;
|
||||||
@@ -581,8 +581,8 @@ wMenuRealize(WMenu *menu)
|
|||||||
/* search widest text on right */
|
/* search widest text on right */
|
||||||
text = menu->entries[i]->rtext;
|
text = menu->entries[i]->rtext;
|
||||||
if (text)
|
if (text)
|
||||||
rwidth = wTextWidth(scr->menu_entry_font->font, text,
|
rwidth = WMWidthOfString(scr->menu_entry_font, text, strlen(text))
|
||||||
strlen(text)) + 5;
|
+ 5;
|
||||||
else if (menu->entries[i]->cascade>=0)
|
else if (menu->entries[i]->cascade>=0)
|
||||||
rwidth = 16;
|
rwidth = 16;
|
||||||
else
|
else
|
||||||
@@ -792,9 +792,8 @@ paintEntry(WMenu *menu, int index, int selected)
|
|||||||
if (entry->flags.indicator)
|
if (entry->flags.indicator)
|
||||||
x += MENU_INDICATOR_SPACE + 2;
|
x += MENU_INDICATOR_SPACE + 2;
|
||||||
|
|
||||||
wDrawString(win, scr->menu_entry_font,
|
WMDrawString(scr->wmscreen, win, textGC, scr->menu_entry_font,
|
||||||
textGC, x, 3+y+scr->menu_entry_font->y, entry->text,
|
x, 3 + y, entry->text, strlen(entry->text));
|
||||||
strlen(entry->text));
|
|
||||||
|
|
||||||
if (entry->cascade>=0) {
|
if (entry->cascade>=0) {
|
||||||
/* draw the cascade indicator */
|
/* draw the cascade indicator */
|
||||||
@@ -847,12 +846,11 @@ paintEntry(WMenu *menu, int index, int selected)
|
|||||||
/* draw right text */
|
/* draw right text */
|
||||||
|
|
||||||
if (entry->rtext && entry->cascade<0) {
|
if (entry->rtext && entry->cascade<0) {
|
||||||
tw = wTextWidth(scr->menu_entry_font->font, entry->rtext,
|
tw = WMWidthOfString(scr->menu_entry_font, entry->rtext,
|
||||||
strlen(entry->rtext));
|
strlen(entry->rtext));
|
||||||
|
|
||||||
wDrawString(win, scr->menu_entry_font, textGC, w-6-tw,
|
WMDrawString(scr->wmscreen, win, textGC, scr->menu_entry_font, w-6-tw,
|
||||||
3+y+scr->menu_entry_font->y, entry->rtext,
|
y + 3, entry->rtext, strlen(entry->rtext));
|
||||||
strlen(entry->rtext));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
43
src/misc.c
43
src/misc.c
@@ -365,27 +365,6 @@ char **iconname;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#ifdef I18N_MB
|
|
||||||
void
|
|
||||||
wTextWidth(XFontSet font, char *text, int length)
|
|
||||||
{
|
|
||||||
XRectangle rect;
|
|
||||||
XRectangle AIXsucks;
|
|
||||||
|
|
||||||
XmbTextExtents(font, text, length, &AIXsucks, &rec);
|
|
||||||
|
|
||||||
return rect.width;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void
|
|
||||||
wTextWidth(XFontStruct *font, char *text, int length)
|
|
||||||
{
|
|
||||||
return XTextWidth(font, text, length);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eatExpose()
|
eatExpose()
|
||||||
{
|
{
|
||||||
@@ -493,21 +472,19 @@ SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y)
|
|||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
ShrinkString(WFont *font, char *string, int width)
|
ShrinkString(WMFont *font, char *string, int width)
|
||||||
{
|
{
|
||||||
#ifndef I18N_MB
|
|
||||||
int w, w1=0;
|
int w, w1=0;
|
||||||
int p;
|
int p;
|
||||||
char *pos;
|
char *pos;
|
||||||
char *text;
|
char *text;
|
||||||
int p1, p2, t;
|
int p1, p2, t;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef I18N_MB
|
if (wPreferences.multi_byte_text)
|
||||||
return wstrdup(string);
|
return wstrdup(string);
|
||||||
#else
|
|
||||||
p = strlen(string);
|
p = strlen(string);
|
||||||
w = wTextWidth(font->font, string, p);
|
w = WMWidthOfString(font, string, p);
|
||||||
text = wmalloc(strlen(string)+8);
|
text = wmalloc(strlen(string)+8);
|
||||||
strcpy(text, string);
|
strcpy(text, string);
|
||||||
if (w<=width)
|
if (w<=width)
|
||||||
@@ -520,8 +497,8 @@ ShrinkString(WFont *font, char *string, int width)
|
|||||||
if (pos) {
|
if (pos) {
|
||||||
*pos = 0;
|
*pos = 0;
|
||||||
p = strlen(text);
|
p = strlen(text);
|
||||||
w1=wTextWidth(font->font, text, p);
|
w1 = WMWidthOfString(font, text, p);
|
||||||
if (w1>width) {
|
if (w1 > width) {
|
||||||
w1 = 0;
|
w1 = 0;
|
||||||
p = 0;
|
p = 0;
|
||||||
*pos = ' ';
|
*pos = ' ';
|
||||||
@@ -537,14 +514,14 @@ ShrinkString(WFont *font, char *string, int width)
|
|||||||
*text=0;
|
*text=0;
|
||||||
}
|
}
|
||||||
strcat(text, "...");
|
strcat(text, "...");
|
||||||
width -= wTextWidth(font->font, "...", 3);
|
width -= WMWidthOfString(font, "...", 3);
|
||||||
|
|
||||||
pos = string;
|
pos = string;
|
||||||
p1=0;
|
p1=0;
|
||||||
p2=p;
|
p2=p;
|
||||||
t = (p2-p1)/2;
|
t = (p2-p1)/2;
|
||||||
while (p2>p1 && p1!=t) {
|
while (p2>p1 && p1!=t) {
|
||||||
w = wTextWidth(font->font, &string[p-t], t);
|
w = WMWidthOfString(font, &string[p-t], t);
|
||||||
if (w>width) {
|
if (w>width) {
|
||||||
p2 = t;
|
p2 = t;
|
||||||
t = p1+(p2-p1)/2;
|
t = p1+(p2-p1)/2;
|
||||||
@@ -555,8 +532,8 @@ ShrinkString(WFont *font, char *string, int width)
|
|||||||
p2=p1=t;
|
p2=p1=t;
|
||||||
}
|
}
|
||||||
strcat(text, &string[p-p1]);
|
strcat(text, &string[p-p1]);
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
#endif /* I18N_MB */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,13 +72,9 @@ void
|
|||||||
wGetGeometryWindowSize(WScreen *scr, unsigned int *width,
|
wGetGeometryWindowSize(WScreen *scr, unsigned int *width,
|
||||||
unsigned int *height)
|
unsigned int *height)
|
||||||
{
|
{
|
||||||
#ifdef I18N_MB
|
*width = WMWidthOfString(scr->info_text_font, "-8888 x -8888", 13);
|
||||||
*width = XmbTextEscapement(scr->info_text_font->font, "-8888 x -8888", 13);
|
|
||||||
*height = (7 * scr->info_text_font->height) / 4 - 1;
|
*height = (7 * WMFontHeight(scr->info_text_font)) / 4 - 1;
|
||||||
#else
|
|
||||||
*width = XTextWidth(scr->info_text_font->font, "-8888 x -8888", 13);
|
|
||||||
*height = (7 * scr->info_text_font->font->ascent) / 4 - 1;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -140,15 +136,15 @@ showPosition(WWindow *wwin, int x, int y)
|
|||||||
scr->geometry_display_width-2, scr->geometry_display_height-2,
|
scr->geometry_display_width-2, scr->geometry_display_height-2,
|
||||||
False);
|
False);
|
||||||
sprintf(num, "%+i %-+i", x, y);
|
sprintf(num, "%+i %-+i", x, y);
|
||||||
fw = wTextWidth(scr->info_text_font->font, num, strlen(num));
|
fw = WMWidthOfString(scr->info_text_font, num, strlen(num));
|
||||||
|
|
||||||
XSetForeground(dpy, gc, scr->black_pixel);
|
XSetForeground(dpy, gc, scr->black_pixel);
|
||||||
|
|
||||||
fh = scr->info_text_font->height;
|
fh = WMFontHeight(scr->info_text_font);
|
||||||
wDrawString(scr->geometry_display, scr->info_text_font, gc,
|
WMDrawString(scr->wmscreen, scr->geometry_display, gc,
|
||||||
|
scr->info_text_font,
|
||||||
(scr->geometry_display_width - 2 - fw) / 2,
|
(scr->geometry_display_width - 2 - fw) / 2,
|
||||||
(scr->geometry_display_height-fh)/2 + scr->info_text_font->y,
|
(scr->geometry_display_height-fh)/2, num, strlen(num));
|
||||||
num, strlen(num));
|
|
||||||
wDrawBevel(scr->geometry_display, scr->geometry_display_width+1,
|
wDrawBevel(scr->geometry_display, scr->geometry_display_width+1,
|
||||||
scr->geometry_display_height+1,
|
scr->geometry_display_height+1,
|
||||||
scr->widget_texture, WREL_RAISED);
|
scr->widget_texture, WREL_RAISED);
|
||||||
@@ -216,8 +212,8 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
|||||||
|
|
||||||
ty = y1 + wwin->frame->top_width;
|
ty = y1 + wwin->frame->top_width;
|
||||||
by = y2 - wwin->frame->bottom_width;
|
by = y2 - wwin->frame->bottom_width;
|
||||||
fw = wTextWidth(scr->info_text_font->font, "8888", 4);
|
fw = WMWidthOfString(scr->info_text_font, "8888", 4);
|
||||||
fh = scr->info_text_font->height;
|
fh = WMFontHeight(scr->info_text_font);
|
||||||
|
|
||||||
if (wPreferences.size_display == WDIS_NEW) {
|
if (wPreferences.size_display == WDIS_NEW) {
|
||||||
XSetForeground(dpy, gc, scr->line_pixel);
|
XSetForeground(dpy, gc, scr->line_pixel);
|
||||||
@@ -270,14 +266,13 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
|||||||
|
|
||||||
sprintf(num, "%i", (by - ty - wwin->normal_hints->base_height) /
|
sprintf(num, "%i", (by - ty - wwin->normal_hints->base_height) /
|
||||||
wwin->normal_hints->height_inc);
|
wwin->normal_hints->height_inc);
|
||||||
fw = wTextWidth(scr->info_text_font->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, scr->window_title_pixel[WS_UNFOCUSED]); */
|
||||||
|
|
||||||
/* Display the height. */
|
/* Display the height. */
|
||||||
wDrawString(root, scr->info_text_font, gc,
|
WMDrawString(scr->wmscreen, root, gc, scr->info_text_font,
|
||||||
x - s + 3 - fw/2, my - fh/2 + scr->info_text_font->y + 1,
|
x - s + 3 - fw/2, my - fh/2 + 1, num, strlen(num));
|
||||||
num, strlen(num));
|
|
||||||
XSetForeground(dpy, gc, scr->line_pixel);
|
XSetForeground(dpy, gc, scr->line_pixel);
|
||||||
/* horizontal geometry */
|
/* horizontal geometry */
|
||||||
if (y1 < 15) {
|
if (y1 < 15) {
|
||||||
@@ -290,7 +285,7 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
|||||||
mx = x1 + (x2 - x1)/2;
|
mx = x1 + (x2 - x1)/2;
|
||||||
sprintf(num, "%i", (x2 - x1 - wwin->normal_hints->base_width) /
|
sprintf(num, "%i", (x2 - x1 - wwin->normal_hints->base_width) /
|
||||||
wwin->normal_hints->width_inc);
|
wwin->normal_hints->width_inc);
|
||||||
fw = wTextWidth(scr->info_text_font->font, num, strlen(num));
|
fw = WMWidthOfString(scr->info_text_font, num, strlen(num));
|
||||||
|
|
||||||
/* left arrow */
|
/* left arrow */
|
||||||
/* end bar */
|
/* end bar */
|
||||||
@@ -331,8 +326,8 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
|||||||
/* XSetForeground(dpy, gc, scr->window_title_pixel[WS_UNFOCUSED]); */
|
/* XSetForeground(dpy, gc, scr->window_title_pixel[WS_UNFOCUSED]); */
|
||||||
|
|
||||||
/* Display the width. */
|
/* Display the width. */
|
||||||
wDrawString(root, scr->info_text_font, gc,
|
WMDrawString(scr->wmscreen, root, gc, scr->info_text_font,
|
||||||
mx - fw/2 + 1, y - s + fh/2 + 1, num, strlen(num));
|
mx - fw/2 + 1, y - s + fh/2 + 1, num, strlen(num));
|
||||||
} else {
|
} else {
|
||||||
XClearArea(dpy, scr->geometry_display, 1, 1,
|
XClearArea(dpy, scr->geometry_display, 1, 1,
|
||||||
scr->geometry_display_width-2, scr->geometry_display_height-2,
|
scr->geometry_display_width-2, scr->geometry_display_height-2,
|
||||||
@@ -341,16 +336,15 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction)
|
|||||||
/ wwin->normal_hints->width_inc,
|
/ wwin->normal_hints->width_inc,
|
||||||
(by - ty - wwin->normal_hints->base_height)
|
(by - ty - wwin->normal_hints->base_height)
|
||||||
/ wwin->normal_hints->height_inc);
|
/ wwin->normal_hints->height_inc);
|
||||||
fw = wTextWidth(scr->info_text_font->font, num, strlen(num));
|
fw = WMWidthOfString(scr->info_text_font, num, strlen(num));
|
||||||
|
|
||||||
XSetForeground(dpy, scr->info_text_gc, scr->black_pixel);
|
XSetForeground(dpy, scr->info_text_gc, scr->black_pixel);
|
||||||
|
|
||||||
/* Display the height. */
|
/* Display the height. */
|
||||||
wDrawString(scr->geometry_display, scr->info_text_font,
|
WMDrawString(scr->wmscreen, scr->geometry_display, scr->info_text_gc,
|
||||||
scr->info_text_gc,
|
scr->info_text_font,
|
||||||
(scr->geometry_display_width-fw)/2,
|
(scr->geometry_display_width-fw)/2,
|
||||||
(scr->geometry_display_height-fh)/2 +scr->info_text_font->y,
|
(scr->geometry_display_height-fh)/2, num, strlen(num));
|
||||||
num, strlen(num));
|
|
||||||
wDrawBevel(scr->geometry_display, scr->geometry_display_width+1,
|
wDrawBevel(scr->geometry_display, scr->geometry_display_width+1,
|
||||||
scr->geometry_display_height+1,
|
scr->geometry_display_height+1,
|
||||||
scr->widget_texture, WREL_RAISED);
|
scr->widget_texture, WREL_RAISED);
|
||||||
@@ -451,7 +445,7 @@ drawTransparentFrame(WWindow *wwin, int x, int y, int width, int height)
|
|||||||
int bottom = 0;
|
int bottom = 0;
|
||||||
|
|
||||||
if (!WFLAGP(wwin, no_titlebar) && !wwin->flags.shaded) {
|
if (!WFLAGP(wwin, no_titlebar) && !wwin->flags.shaded) {
|
||||||
h = wwin->screen_ptr->title_font->height + TITLEBAR_EXTRA_HEIGHT;
|
h = WMFontHeight(wwin->screen_ptr->title_font) + TITLEBAR_EXTRA_HEIGHT;
|
||||||
}
|
}
|
||||||
if (!WFLAGP(wwin, no_resizebar) && !wwin->flags.shaded) {
|
if (!WFLAGP(wwin, no_resizebar) && !wwin->flags.shaded) {
|
||||||
/* Can't use wwin-frame->bottom_width because, in some cases
|
/* Can't use wwin-frame->bottom_width because, in some cases
|
||||||
@@ -1765,7 +1759,7 @@ wMouseResizeWindow(WWindow *wwin, XEvent *ev)
|
|||||||
shiftl = XKeysymToKeycode(dpy, XK_Shift_L);
|
shiftl = XKeysymToKeycode(dpy, XK_Shift_L);
|
||||||
shiftr = XKeysymToKeycode(dpy, XK_Shift_R);
|
shiftr = XKeysymToKeycode(dpy, XK_Shift_R);
|
||||||
if (!WFLAGP(wwin, no_titlebar))
|
if (!WFLAGP(wwin, no_titlebar))
|
||||||
h = wwin->screen_ptr->title_font->height + TITLEBAR_EXTRA_HEIGHT;
|
h = WMFontHeight(wwin->screen_ptr->title_font) + TITLEBAR_EXTRA_HEIGHT;
|
||||||
else
|
else
|
||||||
h = 0;
|
h = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
@@ -2060,7 +2054,7 @@ InteractivePlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!WFLAGP(wwin, no_titlebar)) {
|
if (!WFLAGP(wwin, no_titlebar)) {
|
||||||
h = scr->title_font->height + TITLEBAR_EXTRA_HEIGHT;
|
h = WMFontHeight(scr->title_font) + TITLEBAR_EXTRA_HEIGHT;
|
||||||
height += h;
|
height += h;
|
||||||
}
|
}
|
||||||
if (!WFLAGP(wwin, no_resizebar)) {
|
if (!WFLAGP(wwin, no_resizebar)) {
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
|
|||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
int h = scr->title_font->height+TITLEBAR_EXTRA_HEIGHT;
|
int h = WMFontHeight(scr->title_font) + TITLEBAR_EXTRA_HEIGHT;
|
||||||
|
|
||||||
switch (wPreferences.window_placement) {
|
switch (wPreferences.window_placement) {
|
||||||
case WPM_MANUAL:
|
case WPM_MANUAL:
|
||||||
|
|||||||
@@ -37,98 +37,6 @@
|
|||||||
#include "pixmap.h"
|
#include "pixmap.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*----------------------------------------------------------------------
|
|
||||||
* wLoadFont--
|
|
||||||
* Loads a single font into a WFont structure, initializing
|
|
||||||
* data in it. If the font could not be loaded, fixed will be used.
|
|
||||||
* If fixed can't be loaded either, the function returns NULL.
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* The font structure or NULL on error.
|
|
||||||
*
|
|
||||||
*----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
WFont*
|
|
||||||
wLoadFont(char *font_name)
|
|
||||||
{
|
|
||||||
WFont *font;
|
|
||||||
#ifdef I18N_MB
|
|
||||||
char **missing;
|
|
||||||
int num_missing = 0;
|
|
||||||
char *default_string;
|
|
||||||
int skyline;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
font = malloc(sizeof(WFont));
|
|
||||||
if (!font)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
#ifdef I18N_MB
|
|
||||||
font->font = XCreateFontSet(dpy, font_name, &missing, &num_missing,
|
|
||||||
&default_string);
|
|
||||||
if (num_missing > 0 && font->font) {
|
|
||||||
wwarning(_("The following character sets are missing in %s:"),
|
|
||||||
font_name);
|
|
||||||
for (skyline = 0; skyline < num_missing; skyline++)
|
|
||||||
wwarning(missing[skyline]);
|
|
||||||
XFreeStringList(missing);
|
|
||||||
wwarning(_("The string \"%s\" will be used in place"),
|
|
||||||
default_string);
|
|
||||||
wwarning(_("of any characters from those sets."));
|
|
||||||
}
|
|
||||||
if (!font->font) {
|
|
||||||
wwarning(_("could not create font set %s. Trying fixed"), font_name);
|
|
||||||
font->font = XCreateFontSet(dpy, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*",
|
|
||||||
&missing, &num_missing, &default_string);
|
|
||||||
if (num_missing > 0) {
|
|
||||||
XFreeStringList(missing);
|
|
||||||
}
|
|
||||||
if (!font->font) {
|
|
||||||
free(font);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
font->height = XExtentsOfFontSet(font->font)->max_logical_extent.height;
|
|
||||||
font->y = font->height+XExtentsOfFontSet(font->font)->max_logical_extent.y;
|
|
||||||
font->y = font->height-font->y;
|
|
||||||
#else
|
|
||||||
font->font = XLoadQueryFont(dpy, font_name);
|
|
||||||
if (!font->font) {
|
|
||||||
wwarning(_("could not load font %s. Trying fixed"), font_name);
|
|
||||||
font->font = XLoadQueryFont(dpy, "fixed");
|
|
||||||
if (!font->font) {
|
|
||||||
free(font);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
font->height = font->font->ascent+font->font->descent;
|
|
||||||
font->y = font->font->ascent;
|
|
||||||
#endif /* !I18N_MB */
|
|
||||||
|
|
||||||
return font;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
wFreeFont(WFont *font)
|
|
||||||
{
|
|
||||||
#ifdef I18N_MB
|
|
||||||
XFreeFontSet(dpy, font->font);
|
|
||||||
#else
|
|
||||||
XFreeFont(dpy, font->font);
|
|
||||||
#endif
|
|
||||||
free(font);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* wfatal(_("could not load any usable font set"));
|
|
||||||
wfatal(_("could not load any usable font"));
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
wGetColor(WScreen *scr, char *color_name, XColor *color)
|
wGetColor(WScreen *scr, char *color_name, XColor *color)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,8 +22,7 @@
|
|||||||
#ifndef WMRESOURCES_H_
|
#ifndef WMRESOURCES_H_
|
||||||
#define WMRESOURCES_H_
|
#define WMRESOURCES_H_
|
||||||
|
|
||||||
WFont *wLoadFont(char *font_name);
|
|
||||||
void wFreeFont(WFont *font);
|
|
||||||
int wGetColor(WScreen *scr, char *color_name, XColor *color);
|
int wGetColor(WScreen *scr, char *color_name, XColor *color);
|
||||||
void wFreeColor(WScreen *scr, unsigned long pixel);
|
void wFreeColor(WScreen *scr, unsigned long pixel);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -473,10 +473,8 @@ createPixmaps(WScreen *scr)
|
|||||||
|
|
||||||
scr->dock_dots = make3Dots(scr);
|
scr->dock_dots = make3Dots(scr);
|
||||||
|
|
||||||
#ifndef NEWSTUFF
|
|
||||||
/* titlebar button pixmaps */
|
/* titlebar button pixmaps */
|
||||||
allocButtonPixmaps(scr);
|
allocButtonPixmaps(scr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -503,7 +501,7 @@ createInternalWindows(WScreen *scr)
|
|||||||
|
|
||||||
/* window for displaying geometry information during resizes and moves */
|
/* window for displaying geometry information during resizes and moves */
|
||||||
vmask = CWBorderPixel|CWBackPixmap|CWBackPixel|CWCursor|CWSaveUnder|CWOverrideRedirect;
|
vmask = CWBorderPixel|CWBackPixmap|CWBackPixel|CWCursor|CWSaveUnder|CWOverrideRedirect;
|
||||||
attribs.border_pixel = 0;
|
attribs.border_pixel = scr->black_pixel;
|
||||||
attribs.save_under = True;
|
attribs.save_under = True;
|
||||||
attribs.override_redirect = True;
|
attribs.override_redirect = True;
|
||||||
attribs.cursor = wCursor[WCUR_DEFAULT];
|
attribs.cursor = wCursor[WCUR_DEFAULT];
|
||||||
@@ -537,7 +535,7 @@ createInternalWindows(WScreen *scr)
|
|||||||
|
|
||||||
/* shadow window for dock buttons */
|
/* shadow window for dock buttons */
|
||||||
vmask = CWBorderPixel|CWBackPixmap|CWBackPixel|CWCursor|CWSaveUnder|CWOverrideRedirect;
|
vmask = CWBorderPixel|CWBackPixmap|CWBackPixel|CWCursor|CWSaveUnder|CWOverrideRedirect;
|
||||||
attribs.border_pixel = 0;
|
attribs.border_pixel = scr->black_pixel;
|
||||||
attribs.save_under = True;
|
attribs.save_under = True;
|
||||||
attribs.override_redirect = True;
|
attribs.override_redirect = True;
|
||||||
attribs.background_pixmap = None;
|
attribs.background_pixmap = None;
|
||||||
|
|||||||
25
src/screen.h
25
src/screen.h
@@ -29,17 +29,6 @@
|
|||||||
#include <proplist.h>
|
#include <proplist.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct WFont {
|
|
||||||
#ifndef I18N_MB
|
|
||||||
XFontStruct *font;
|
|
||||||
#else
|
|
||||||
XFontSet font;
|
|
||||||
#endif
|
|
||||||
short height;
|
|
||||||
short y;
|
|
||||||
} WFont;
|
|
||||||
|
|
||||||
|
|
||||||
#define WTB_LEFT 0
|
#define WTB_LEFT 0
|
||||||
#define WTB_RIGHT 1
|
#define WTB_RIGHT 1
|
||||||
|
|
||||||
@@ -146,14 +135,14 @@ typedef struct _WScreen {
|
|||||||
Pixmap stipple_bitmap;
|
Pixmap stipple_bitmap;
|
||||||
Pixmap transp_stipple; /* for making holes in icon masks for
|
Pixmap transp_stipple; /* for making holes in icon masks for
|
||||||
* transparent icon simulation */
|
* transparent icon simulation */
|
||||||
WFont *title_font; /* default font for the titlebars */
|
WMFont *title_font; /* default font for the titlebars */
|
||||||
WFont *menu_title_font; /* font for menu titlebars */
|
WMFont *menu_title_font; /* font for menu titlebars */
|
||||||
WFont *menu_entry_font; /* font for menu items */
|
WMFont *menu_entry_font; /* font for menu items */
|
||||||
WFont *icon_title_font; /* for icon titles */
|
WMFont *icon_title_font; /* for icon titles */
|
||||||
WFont *clip_title_font; /* for clip titles */
|
WMFont *clip_title_font; /* for clip titles */
|
||||||
WFont *info_text_font; /* text on things like geometry
|
WMFont *info_text_font; /* text on things like geometry
|
||||||
* hint boxes */
|
* hint boxes */
|
||||||
WFont *workspace_name_font;
|
WMFont *workspace_name_font;
|
||||||
|
|
||||||
WMPixel select_pixel;
|
WMPixel select_pixel;
|
||||||
WMPixel select_text_pixel;
|
WMPixel select_text_pixel;
|
||||||
|
|||||||
38
src/text.c
38
src/text.c
@@ -186,7 +186,7 @@ textXtoPos( WTextInput *wtext, int x )
|
|||||||
if( x < 0 )
|
if( x < 0 )
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
x -= wTextWidth( wtext->font->font, &(wtext->text.txt[pos]), 1 );
|
x -= WMWidthOfString( wtext->font, &(wtext->text.txt[pos]), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
@@ -230,35 +230,23 @@ wTextCreate( WCoreWindow *core, int x, int y, int width, int height )
|
|||||||
|
|
||||||
gcv.foreground = core->screen_ptr->black_pixel;
|
gcv.foreground = core->screen_ptr->black_pixel;
|
||||||
gcv.background = core->screen_ptr->white_pixel;
|
gcv.background = core->screen_ptr->white_pixel;
|
||||||
#ifndef I18N_MB
|
|
||||||
gcv.font = wtext->font->font->fid;
|
|
||||||
#endif
|
|
||||||
gcv.line_width = 1;
|
gcv.line_width = 1;
|
||||||
gcv.function = GXcopy;
|
gcv.function = GXcopy;
|
||||||
|
|
||||||
wtext->gc = XCreateGC( dpy, wtext->core->window,
|
wtext->gc = XCreateGC( dpy, wtext->core->window,
|
||||||
(GCForeground|GCBackground|
|
(GCForeground|GCBackground|
|
||||||
#ifndef I18N_MB
|
|
||||||
GCFont|
|
|
||||||
#endif
|
|
||||||
GCFunction|GCLineWidth),
|
GCFunction|GCLineWidth),
|
||||||
&gcv );
|
&gcv );
|
||||||
|
|
||||||
/* set up the regular context */
|
/* set up the regular context */
|
||||||
gcv.foreground = core->screen_ptr->black_pixel;
|
gcv.foreground = core->screen_ptr->black_pixel;
|
||||||
gcv.background = core->screen_ptr->white_pixel;
|
gcv.background = core->screen_ptr->white_pixel;
|
||||||
#ifndef I18N_MB
|
|
||||||
gcv.font = wtext->font->font->fid;
|
|
||||||
#endif
|
|
||||||
gcv.line_width = 1;
|
gcv.line_width = 1;
|
||||||
gcv.function = GXcopy;
|
gcv.function = GXcopy;
|
||||||
|
|
||||||
wtext->regGC = XCreateGC( dpy, wtext->core->window,
|
wtext->regGC = XCreateGC( dpy, wtext->core->window,
|
||||||
(GCForeground|GCBackground|
|
(GCForeground|GCBackground|
|
||||||
#ifndef I18N_MB
|
GCFunction|GCLineWidth),
|
||||||
GCFont|
|
|
||||||
#endif
|
|
||||||
GCFunction|GCLineWidth),
|
|
||||||
&gcv );
|
&gcv );
|
||||||
|
|
||||||
/* set up the inverted context */
|
/* set up the inverted context */
|
||||||
@@ -266,9 +254,6 @@ wTextCreate( WCoreWindow *core, int x, int y, int width, int height )
|
|||||||
|
|
||||||
wtext->invGC = XCreateGC( dpy, wtext->core->window,
|
wtext->invGC = XCreateGC( dpy, wtext->core->window,
|
||||||
(GCForeground|GCBackground|
|
(GCForeground|GCBackground|
|
||||||
#ifndef I18N_MB
|
|
||||||
GCFont|
|
|
||||||
#endif
|
|
||||||
GCFunction|GCLineWidth),
|
GCFunction|GCLineWidth),
|
||||||
&gcv );
|
&gcv );
|
||||||
|
|
||||||
@@ -277,7 +262,7 @@ wTextCreate( WCoreWindow *core, int x, int y, int width, int height )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out the y-offset... */
|
/* Figure out the y-offset... */
|
||||||
wtext->yOffset = (height - wtext->font->height)/2;
|
wtext->yOffset = (height - WMFontHeight(wtext->font))/2;
|
||||||
wtext->xOffset = wtext->yOffset;
|
wtext->xOffset = wtext->yOffset;
|
||||||
|
|
||||||
wtext->canceled = False;
|
wtext->canceled = False;
|
||||||
@@ -358,8 +343,9 @@ textRefresh( WTextInput *wtext )
|
|||||||
x1, y1, x2-x1, y2-y1 );
|
x1, y1, x2-x1, y2-y1 );
|
||||||
|
|
||||||
/* Draw the text normally */
|
/* Draw the text normally */
|
||||||
wDrawString(wtext->core->window, wtext->font, wtext->regGC,
|
WMDrawString(wtext->core->screen_ptr->wmscreen, wtext->core->window,
|
||||||
x1, y2+TEXT_SHIFT, ptr, wtext->text.length);
|
wtext->regGC, wtext->font,
|
||||||
|
x1, y2+TEXT_SHIFT, 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 )
|
||||||
@@ -378,10 +364,10 @@ textRefresh( WTextInput *wtext )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* x1,y1 is now the upper-left of the selected area */
|
/* x1,y1 is now the upper-left of the selected area */
|
||||||
x1 += wTextWidth( wtext->font->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 +wTextWidth( wtext->font->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 */
|
||||||
@@ -390,12 +376,12 @@ 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 */
|
||||||
wDrawString(wtext->core->window, wtext->font, wtext->invGC,
|
WMDrawString(wtext->core->screen_ptr->wmscreen, wtext->core->window,
|
||||||
x1, y2+TEXT_SHIFT, ptr, (ep - sp));
|
wtext->invGC, wtext->font, x1, y2+TEXT_SHIFT, ptr, (ep - sp));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* And draw a quick little line for the cursor position */
|
/* And draw a quick little line for the cursor position */
|
||||||
x1 = wTextWidth( wtext->font->font, wtext->text.txt, wtext->text.endPos )
|
x1 = WMWidthOfString( wtext->font, wtext->text.txt, wtext->text.endPos )
|
||||||
+ wtext->xOffset;
|
+ wtext->xOffset;
|
||||||
XDrawLine( dpy, wtext->core->window, wtext->regGC, x1, 2, x1,
|
XDrawLine( dpy, wtext->core->window, wtext->regGC, x1, 2, x1,
|
||||||
wtext->core->height - 3 );
|
wtext->core->height - 3 );
|
||||||
@@ -571,7 +557,7 @@ blink(void *data)
|
|||||||
gc = wtext->invGC;
|
gc = wtext->invGC;
|
||||||
wtext->blink_on = 1;
|
wtext->blink_on = 1;
|
||||||
}
|
}
|
||||||
x = wTextWidth( wtext->font->font, wtext->text.txt, wtext->text.endPos )
|
x = WMWidthOfString( wtext->font, wtext->text.txt, wtext->text.endPos )
|
||||||
+ wtext->xOffset;
|
+ wtext->xOffset;
|
||||||
XDrawLine( dpy, wtext->core->window, gc, x, 2, x, wtext->core->height-3);
|
XDrawLine( dpy, wtext->core->window, gc, x, 2, x, wtext->core->height-3);
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ typedef struct {
|
|||||||
* cursor position. */
|
* cursor position. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WCoreWindow *core;
|
WCoreWindow *core;
|
||||||
WFont *font;
|
WMFont *font;
|
||||||
WTextBlock text;
|
WTextBlock text;
|
||||||
GC gc;
|
GC gc;
|
||||||
GC regGC; /* the normal GC */
|
GC regGC; /* the normal GC */
|
||||||
|
|||||||
@@ -307,15 +307,10 @@ showWorkspaceName(WScreen *scr, int workspace)
|
|||||||
free(scr->workspace_name_data);
|
free(scr->workspace_name_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef I18N_MB
|
|
||||||
XSetFont(dpy, scr->mono_gc, scr->workspace_name_font->font->fid);
|
|
||||||
XSetFont(dpy, scr->draw_gc, scr->workspace_name_font->font->fid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
data = wmalloc(sizeof(WorkspaceNameData));
|
data = wmalloc(sizeof(WorkspaceNameData));
|
||||||
|
|
||||||
w = wTextWidth(scr->workspace_name_font->font, name, len);
|
w = WMWidthOfString(scr->workspace_name_font, name, len);
|
||||||
h = scr->workspace_name_font->height;
|
h = WMFontHeight(scr->workspace_name_font);
|
||||||
|
|
||||||
switch (wPreferences.workspace_name_display_position) {
|
switch (wPreferences.workspace_name_display_position) {
|
||||||
case WD_CENTER:
|
case WD_CENTER:
|
||||||
@@ -362,16 +357,15 @@ showWorkspaceName(WScreen *scr, int workspace)
|
|||||||
XSetForeground(dpy, scr->mono_gc, 1);
|
XSetForeground(dpy, scr->mono_gc, 1);
|
||||||
for (x = 0; x <= 4; x++) {
|
for (x = 0; x <= 4; x++) {
|
||||||
for (y = 0; y <= 4; y++) {
|
for (y = 0; y <= 4; y++) {
|
||||||
wDrawString(mask, scr->workspace_name_font, scr->mono_gc,
|
WMDrawString(scr->wmscreen, mask, scr->mono_gc,
|
||||||
x, scr->workspace_name_font->y + y, name, len);
|
scr->workspace_name_font, x, y, name, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XSetForeground(dpy, scr->draw_gc, scr->white_pixel);
|
XSetForeground(dpy, scr->draw_gc, scr->white_pixel);
|
||||||
wDrawString(text, scr->workspace_name_font, scr->draw_gc,
|
WMDrawString(scr->wmscreen, text, scr->draw_gc, scr->workspace_name_font,
|
||||||
2, scr->workspace_name_font->y + 2,
|
2, 2, scr->workspaces[workspace]->name,
|
||||||
scr->workspaces[workspace]->name,
|
strlen(scr->workspaces[workspace]->name));
|
||||||
strlen(scr->workspaces[workspace]->name));
|
|
||||||
#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