1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +01:00

- Added support for NET_WM_NAME/NET_WM_ICON_NAME

- moved out font name conversion code from getstyle/setstyle/convertfonts and made it support fontsets
This commit is contained in:
kojima
2004-10-16 22:05:04 +00:00
parent 9402724e40
commit 7055530895
17 changed files with 305 additions and 549 deletions

View File

@@ -159,6 +159,8 @@ Changes since version 0.80.2:
- Removed old code to store/restore workspace state (now relies on netwm)
- Added a (simple) Font Configuration for fontconfig fonts
- MacOS X style window switching panel (navigate through windows with Alt-Tab or arrow keys)
- Added support for NET_WM_NAME/NET_WM_ICON_NAME
- moved out font name conversion code from getstyle/setstyle/convertfonts and made it support fontsets
Changes since version 0.80.1:
.............................

7
TODO
View File

@@ -5,18 +5,11 @@ To do before next release:
and give a warning if font is not converted, but let user manually convert
it with convertfonts as the process may need manual tweaking for best
results)
- convertfonts to handle fontsets (keep in mind that many people without
multibyte still have a fontsets in their config files). ev use LANG and
MB_CUR_MAX
- automate convertfonts for different locales
- Append .UTF-8 to locale
- figure out a better gnustep path for wprefs.app installation
- pick a good font fallback
- figure a better fullscreen level
- clean up netwm hints on exit
- check whether window states are being saved/restored properly via netwm
on restart/crash-restart (grep for XXX/TODO)
- review wmaker.inst
remake wrlib rule to not compile with -fomit-frame-pointer and stuff
if its added to CFLAGS

View File

@@ -235,17 +235,6 @@ lookup_available_fonts(_Panel *panel)
if (pat)
FcPatternDestroy(pat);
panel->fonts->families[panel->fonts->familyn++].name= wstrdup("sans-serif");
family= panel->fonts->families + panel->fonts->familyn-1;
family->styles= wmalloc(sizeof(FontStyle)*2);
family->stylen= 2;
family->styles[0].weight= FC_WEIGHT_MEDIUM;
family->styles[0].slant= FC_SLANT_ROMAN;
family->styles[0].width= FC_WIDTH_NORMAL;
family->styles[1].weight= FC_WEIGHT_BOLD;
family->styles[1].slant= FC_SLANT_ROMAN;
family->styles[1].width= FC_WIDTH_NORMAL;
panel->fonts->families[panel->fonts->familyn++].name= wstrdup("sans");
family= panel->fonts->families + panel->fonts->familyn-1;
family->styles= wmalloc(sizeof(FontStyle)*2);

View File

@@ -325,6 +325,8 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
switch (event->atom) {
case XA_WM_NAME:
if (!wwin->flags.net_has_title)
{
/* window title was changed */
if (!wFetchName(dpy, wwin->client_win, &tmp)) {
wWindowUpdateName(wwin, NULL);
@@ -333,9 +335,12 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
}
if (tmp)
XFree(tmp);
}
break;
case XA_WM_ICON_NAME:
if (!wwin->flags.net_has_icon_title)
{
if (!wwin->icon)
break;
else {
@@ -345,6 +350,7 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
wGetIconName(dpy, wwin->client_win, &new_title);
wIconChangeTitle(wwin->icon, new_title);
}
}
break;
case XA_WM_COMMAND:

View File

@@ -43,8 +43,9 @@
#include "application.h"
#include "defaults.h"
#include "appicon.h"
#include "wmspec.h"
/**** Global variables ****/
/**** Global varianebles ****/
extern WPreferences wPreferences;
#define MOD_MASK wPreferences.modifier_mask
@@ -179,6 +180,10 @@ wIconCreate(WWindow *wwin)
icon->file = wstrdup(file);
}
icon->icon_name = wNETWMGetIconName(wwin->client_win);
if (icon->icon_name)
wwin->flags.net_has_icon_title= 1;
else
wGetIconName(dpy, wwin->client_win, &icon->icon_name);
icon->tile_type = TILE_NORMAL;

View File

@@ -1084,8 +1084,6 @@ wScreenSaveState(WScreen *scr)
WWindow *wwin;
char *str;
WMPropList *old_state, *foo;
CARD32 data[2];
make_keys();

View File

@@ -36,6 +36,7 @@
#include "properties.h"
#include "session.h"
#include "winspector.h"
#include "wmspec.h"
extern Atom _XA_WM_DELETE_WINDOW;
extern Time LastTimestamp;
@@ -197,6 +198,7 @@ RestoreDesktop(WScreen *scr)
XSetInputFocus(dpy, PointerRoot, RevertToParent, CurrentTime);
wColormapInstallForWindow(scr, NULL);
PropCleanUp(scr->root_win);
wNETWMCleanup(scr);
XSync(dpy, 0);
}

View File

@@ -722,12 +722,14 @@ wManageWindow(WScreen *scr, Window window)
return NULL;
}
if (!wFetchName(dpy, window, &title)) {
title = NULL;
}
wwin = wWindowCreate();
title= wNETWMGetWindowName(window);
if (title)
wwin->flags.net_has_title= 1;
if (!title && !wFetchName(dpy, window, &title))
title = NULL;
XSaveContext(dpy, window, wWinContext, (XPointer)&wwin->client_descriptor);
#ifdef DEBUG

View File

@@ -304,6 +304,8 @@ typedef struct WWindow {
unsigned int net_skip_pager:1;
unsigned int net_handle_icon:1;
unsigned int net_show_desktop:1;
unsigned int net_has_title:1; /* use netwm version of WM_NAME */
unsigned int net_has_icon_title:1;
#endif
} flags; /* state of the window */

View File

@@ -74,10 +74,10 @@ static Atom net_moveresize_window; /* TODO */
static Atom net_wm_moveresize; /* TODO */
/* Application Window Properties */
static Atom net_wm_name; /* TODO */
static Atom net_wm_visible_name; /* TODO */
static Atom net_wm_icon_name; /* TODO */
static Atom net_wm_visible_icon_name; /* TODO */
static Atom net_wm_name;
static Atom net_wm_visible_name; /* TODO (unnecessary?) */
static Atom net_wm_icon_name;
static Atom net_wm_visible_icon_name; /* TODO (unnecessary?) */
static Atom net_wm_desktop;
static Atom net_wm_window_type;
static Atom net_wm_window_type_desktop;
@@ -296,6 +296,9 @@ setSupportedHints(WScreen *scr)
atom[i++] = net_wm_icon;
atom[i++] = net_wm_handled_icons;
atom[i++] = net_wm_name;
atom[i++] = net_wm_icon_name;
XChangeProperty(dpy, scr->root_win, net_supported, XA_ATOM, 32,
PropModeReplace, (unsigned char*)atom, i);
@@ -535,6 +538,16 @@ wNETWMInitStuff(WScreen *scr)
}
void
wNETWMCleanup(WScreen *scr)
{
int i;
for (i= 0; i < atomNr; i++)
XDeleteProperty(dpy, scr->root_win, *atomNames[i].atom);
}
void
wNETWMUpdateActions(WWindow *wwin, Bool del)
{
@@ -1018,6 +1031,7 @@ doStateAtom(WWindow *wwin, Atom state, int set, Bool init)
}
}
} else if (state == net_wm_state_fullscreen) {
puts("GoT FS ST");
if (set == _NET_WM_STATE_TOGGLE) {
set = !(wwin->flags.fullscreen);
}
@@ -1502,6 +1516,15 @@ wNETWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event)
updateNetIconInfo(wwin);
} else if (event->atom == net_wm_window_type) {
updateWindowType(wwin);
} else if (event->atom == net_wm_name) {
char *name= wNETWMGetWindowName(wwin->client_win);
wWindowUpdateName(wwin, name);
if (name) wfree(name);
} else if (event->atom == net_wm_icon_name) {
if (wwin->icon) {
char *name= wNETWMGetIconName(wwin->client_win);
wIconChangeTitle(wwin->icon, name);
}
} else {
ret = False;
}
@@ -1535,6 +1558,46 @@ wNETWMGetPidForWindow(Window window)
}
char*
wNETWMGetWindowName(Window window)
{
char *name;
char *ret;
int size;
name= (char*)PropGetCheckProperty(window,
net_wm_name, utf8_string, 0,
0, &size);
if (name) {
ret= wstrndup(name, size);
XFree(name);
}
else
ret= NULL;
return ret;
}
char*
wNETWMGetIconName(Window window)
{
char *name;
char *ret;
int size;
name= (char*)PropGetCheckProperty(window,
net_wm_icon_name, utf8_string, 0,
0, &size);
if (name) {
ret= wstrndup(name, size);
XFree(name);
}
else
ret= NULL;
return ret;
}
static void
observer(void *self, WMNotification *notif)
{

View File

@@ -30,6 +30,7 @@
#include <X11/Xlib.h>
void wNETWMInitStuff(WScreen *scr);
void wNETWMCleanup(WScreen *scr);
void wNETWMUpdateWorkarea(WScreen *scr, WArea usableArea);
Bool wNETWMGetUsableArea(WScreen *scr, int head, WArea *area);
Bool wNETWMCheckInitialClientState(WWindow *wwin);
@@ -42,4 +43,6 @@ void wNETWMUpdateDesktop(WScreen *scr);
void wNETWMPositionSplash(WWindow *wwin, int *x, int *y, int width, int height);
int wNETWMGetPidForWindow(Window window);
int wNETWMGetCurrentDesktopFromHint(WScreen *scr);
char *wNETWMGetIconName(Window window);
char *wNETWMGetWindowName(Window window);
#endif

View File

@@ -28,12 +28,18 @@ wxpaste_LDADD = @XLFLAGS@ @XLIBS@
getstyle_LDADD = $(top_builddir)/WINGs/libWUtil.a $(liblist)
getstyle_SOURCES = getstyle.c fontconv.c
setstyle_LDADD = \
$(top_builddir)/WINGs/libWUtil.a \
@XLFLAGS@ @XLIBS@ $(liblist)
setstyle_SOURCES = setstyle.c fontconv.c
convertfonts_LDADD = $(top_builddir)/WINGs/libWUtil.a $(liblist)
convertfonts_SOURCES = convertfonts.c fontconv.c
seticons_LDADD= $(top_builddir)/WINGs/libWUtil.a $(liblist)
geticonset_LDADD= $(top_builddir)/WINGs/libWUtil.a $(liblist)

View File

@@ -31,7 +31,6 @@
#include "../src/wconfig.h"
#define DEFAULT_FONT "sans-serif:pixelsize=12"
char *FontOptions[] = {
"IconTitleFont",
@@ -49,173 +48,7 @@ char *FontOptions[] = {
char *ProgName;
static int
countChar(char *str, char c)
{
int count = 0;
if (!str)
return 0;
for (; *str!=0; str++) {
if (*str == c) {
count++;
}
}
return count;
}
typedef struct str {
char *str;
int len;
} str;
#define XLFD_TOKENS 14
static str*
getXLFDTokens(char *xlfd)
{
static str tokens[XLFD_TOKENS];
int i, len, size;
char *ptr;
if (!xlfd || *xlfd!='-' || countChar(xlfd, '-')<XLFD_TOKENS)
return NULL;
memset(tokens, 0, sizeof(str)*XLFD_TOKENS);
len = strlen(xlfd);
for (ptr=xlfd, i=0; i<XLFD_TOKENS && len>0; i++) {
/* skip one '-' */
ptr++;
len--;
if (len <= 0)
break;
size = strcspn(ptr, "-");
tokens[i].str = ptr;
tokens[i].len = size;
ptr += size;
len -= size;
}
return tokens;
}
static int
strToInt(str *token)
{
int res=0, pos, c;
if (token->len==0 || token->str[0]=='*') {
return -1;
} else {
for (res=0, pos=0; pos<token->len; pos++) {
c = token->str[pos] - '0';
if (c<0 || c>9)
break;
res = res*10 + c;
}
}
return res;
}
static char*
mapSlantToName(str *slant)
{
if (slant->len==0 || slant->str[0]=='*')
return "roman";
switch(slant->str[0]) {
case 'i':
return "italic";
case 'o':
return "oblique";
case 'r':
default:
return "roman";
}
}
char*
xlfdToFc(char *xlfd, char *useFamily, Bool keepXLFD)
{
str *tokens, *family, *weight, *slant;
char *name, buf[512];
int size, pixelsize;
tokens = getXLFDTokens(xlfd);
if (!tokens)
return wstrdup(DEFAULT_FONT);
family = &(tokens[1]);
weight = &(tokens[2]);
slant = &(tokens[3]);
if (useFamily) {
name = wstrdup(useFamily);
} else {
if (family->len==0 || family->str[0]=='*')
return wstrdup(DEFAULT_FONT);
sprintf(buf, "%.*s", family->len, family->str);
name = wstrdup(buf);
}
pixelsize = strToInt(&tokens[6]);
size = strToInt(&tokens[7]);
if (size<=0 && pixelsize<=0) {
name = wstrappend(name, ":pixelsize=12");
} else if (pixelsize>0) {
/* if pixelsize is present size will be ignored so we skip it */
sprintf(buf, ":pixelsize=%d", pixelsize);
name = wstrappend(name, buf);
} else {
sprintf(buf, "-%d", size/10);
name = wstrappend(name, buf);
}
if (weight->len>0 && weight->str[0]!='*') {
sprintf(buf, ":weight=%.*s", weight->len, weight->str);
name = wstrappend(name, buf);
}
if (slant->len>0 && slant->str[0]!='*') {
sprintf(buf, ":slant=%s", mapSlantToName(slant));
name = wstrappend(name, buf);
}
if (keepXLFD) {
name = wstrappend(name, ":xlfd=");
name = wstrappend(name, xlfd);
}
return name;
}
/* return converted font (if conversion is needed) else the original font */
static char*
convertFont(char *font, Bool keepXLFD)
{
if (font[0]=='-') {
if (!strchr(font, ',')) {
return xlfdToFc(font, NULL, keepXLFD);
} else {
return xlfdToFc(font, "sans-serif", keepXLFD);
}
} else {
return font;
}
}
extern char* convertFont(char *font, Bool keepXLFD);
void

183
util/fontconv.c Normal file
View File

@@ -0,0 +1,183 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <WINGs/WUtil.h>
#include "../src/wconfig.h"
#define DEFAULT_FONT "sans-serif:pixelsize=12"
static int
countChar(char *str, char c)
{
int count = 0;
if (!str)
return 0;
for (; *str!=0; str++) {
if (*str == c) {
count++;
}
}
return count;
}
typedef struct str {
char *str;
int len;
} str;
#define XLFD_TOKENS 14
static str*
getXLFDTokens(char *xlfd)
{
static str tokens[XLFD_TOKENS];
int i, len, size;
char *ptr;
if (!xlfd || *xlfd!='-' || countChar(xlfd, '-')<XLFD_TOKENS)
return NULL;
memset(tokens, 0, sizeof(str)*XLFD_TOKENS);
len = strlen(xlfd);
for (ptr=xlfd, i=0; i<XLFD_TOKENS && len>0; i++) {
/* skip one '-' */
ptr++;
len--;
if (len <= 0)
break;
size = strcspn(ptr, "-");
tokens[i].str = ptr;
tokens[i].len = size;
ptr += size;
len -= size;
}
return tokens;
}
static int
strToInt(str *token)
{
int res=0, pos, c;
if (token->len==0 || token->str[0]=='*') {
return -1;
} else {
for (res=0, pos=0; pos<token->len; pos++) {
c = token->str[pos] - '0';
if (c<0 || c>9)
break;
res = res*10 + c;
}
}
return res;
}
static char*
mapSlantToName(str *slant)
{
if (slant->len==0 || slant->str[0]=='*')
return "roman";
switch(slant->str[0]) {
case 'i':
return "italic";
case 'o':
return "oblique";
case 'r':
default:
return "roman";
}
}
char*
xlfdToFc(char *xlfd, char *useFamily, Bool keepXLFD)
{
str *tokens, *family, *weight, *slant;
char *name, buf[512];
int size, pixelsize;
tokens = getXLFDTokens(xlfd);
if (!tokens)
return wstrdup(DEFAULT_FONT);
family = &(tokens[1]);
weight = &(tokens[2]);
slant = &(tokens[3]);
if (useFamily) {
name = wstrdup(useFamily);
} else {
if (family->len==0 || family->str[0]=='*')
return wstrdup(DEFAULT_FONT);
sprintf(buf, "%.*s", family->len, family->str);
name = wstrdup(buf);
}
pixelsize = strToInt(&tokens[6]);
size = strToInt(&tokens[7]);
if (size<=0 && pixelsize<=0) {
name = wstrappend(name, ":pixelsize=12");
} else if (pixelsize>0) {
/* if pixelsize is present size will be ignored so we skip it */
sprintf(buf, ":pixelsize=%d", pixelsize);
name = wstrappend(name, buf);
} else {
sprintf(buf, "-%d", size/10);
name = wstrappend(name, buf);
}
if (weight->len>0 && weight->str[0]!='*') {
sprintf(buf, ":weight=%.*s", weight->len, weight->str);
name = wstrappend(name, buf);
}
if (slant->len>0 && slant->str[0]!='*') {
sprintf(buf, ":slant=%s", mapSlantToName(slant));
name = wstrappend(name, buf);
}
if (keepXLFD) {
name = wstrappend(name, ":xlfd=");
name = wstrappend(name, xlfd);
}
return name;
}
/* return converted font (if conversion is needed) else the original font */
char* convertFont(char *font, Bool keepXLFD)
{
if (font[0]=='-') {
char *res;
char *tmp= wstrdup(font);
if (MB_CUR_MAX < 2) {
char *ptr= strchr(tmp, ',');
if (ptr) *ptr= 0;
res= xlfdToFc(tmp, NULL, keepXLFD);
} else {
res= xlfdToFc(tmp, "sans", keepXLFD);
}
wfree(tmp);
return res;
} else {
return font;
}
}

View File

@@ -123,6 +123,8 @@ WMPropList *PixmapPath = NULL;
char *ThemePath = NULL;
extern char* convertFont(char *font, Bool keepXLFD);
void
print_help()
@@ -403,171 +405,6 @@ isFontOption(char *option)
}
static int
countChar(char *str, char c)
{
int count = 0;
if (!str)
return 0;
for (; *str!=0; str++) {
if (*str == c) {
count++;
}
}
return count;
}
typedef struct str {
char *str;
int len;
} str;
#define XLFD_TOKENS 14
static str*
getXLFDTokens(char *xlfd)
{
static str tokens[XLFD_TOKENS];
int i, len, size;
char *ptr;
if (!xlfd || countChar(xlfd, '-')<XLFD_TOKENS)
return NULL;
memset(tokens, 0, sizeof(str)*XLFD_TOKENS);
len = strlen(xlfd);
for (ptr=xlfd, i=0; i<XLFD_TOKENS && len>0; i++) {
size = strspn(ptr, "-");
ptr += size;
len -= size;
if (len <= 0)
break;
size = strcspn(ptr, "-");
if (size==0)
break;
tokens[i].str = ptr;
tokens[i].len = size;
ptr += size;
len -= size;
}
return tokens;
}
static int
strToInt(str *token)
{
int res=0, pos, c;
if (token->len==0 || token->str[0]=='*') {
return -1;
} else {
for (res=0, pos=0; pos<token->len; pos++) {
c = token->str[pos] - '0';
if (c<0 || c>9)
break;
res = res*10 + c;
}
}
return res;
}
static char*
mapSlantToName(str *slant)
{
if (slant->len==0 || slant->str[0]=='*')
return "roman";
switch(slant->str[0]) {
case 'i':
return "italic";
case 'o':
return "oblique";
case 'r':
default:
return "roman";
}
}
char*
xlfdToFc(char *xlfd)
{
str *tokens, *family, *weight, *slant;
char *name, buf[512];
int size, pixelsize;
tokens = getXLFDTokens(xlfd);
if (!tokens)
return wstrdup(DEFAULT_FONT);
family = &(tokens[1]);
weight = &(tokens[2]);
slant = &(tokens[3]);
if (family->len==0 || family->str[0]=='*')
return wstrdup(DEFAULT_FONT);
sprintf(buf, "%.*s", family->len, family->str);
name = wstrdup(buf);
pixelsize = strToInt(&tokens[6]);
size = strToInt(&tokens[7]);
if (size<=0 && pixelsize<=0) {
name = wstrappend(name, ":pixelsize=12");
} else if (pixelsize>0) {
/* if pixelsize is present size will be ignored so we skip it */
sprintf(buf, ":pixelsize=%d", pixelsize);
name = wstrappend(name, buf);
} else {
sprintf(buf, "-%d", size/10);
name = wstrappend(name, buf);
}
if (weight->len>0 && weight->str[0]!='*') {
sprintf(buf, ":weight=%.*s", weight->len, weight->str);
name = wstrappend(name, buf);
}
if (slant->len>0 && slant->str[0]!='*') {
sprintf(buf, ":slant=%s", mapSlantToName(slant));
name = wstrappend(name, buf);
}
name = wstrappend(name, ":xlfd=");
name = wstrappend(name, xlfd);
return name;
}
/* return converted font (if conversion is needed) else the original font */
static char*
convertFont(char *font)
{
if (font[0]=='-') {
if (!strchr(font, ',')) {
return xlfdToFc(font);
} else {
wwarning("fontsets are not supported. replaced "
"with default %s", DEFAULT_FONT);
return wstrdup(DEFAULT_FONT);
}
} else {
return font;
}
}
void
copyFile(char *dir, char *file)
{
@@ -775,7 +612,7 @@ main(int argc, char **argv)
char *newfont, *oldfont;
oldfont = WMGetFromPLString(val);
newfont = convertFont(oldfont);
newfont = convertFont(oldfont, False);
/* newfont is a reference to old if conversion is not needed */
if (newfont != oldfont) {
WMReleasePropList(val);

View File

@@ -76,7 +76,7 @@ int ignoreCursors = 0;
Display *dpy;
extern char* convertFont(char *font, Bool keepXLFD);
WMPropList *readBlackBoxStyle(char *path);
@@ -111,171 +111,6 @@ isFontOption(char *option)
}
static int
countChar(char *str, char c)
{
int count = 0;
if (!str)
return 0;
for (; *str!=0; str++) {
if (*str == c) {
count++;
}
}
return count;
}
typedef struct str {
char *str;
int len;
} str;
#define XLFD_TOKENS 14
static str*
getXLFDTokens(char *xlfd)
{
static str tokens[XLFD_TOKENS];
int i, len, size;
char *ptr;
if (!xlfd || countChar(xlfd, '-')<XLFD_TOKENS)
return NULL;
memset(tokens, 0, sizeof(str)*XLFD_TOKENS);
len = strlen(xlfd);
for (ptr=xlfd, i=0; i<XLFD_TOKENS && len>0; i++) {
size = strspn(ptr, "-");
ptr += size;
len -= size;
if (len <= 0)
break;
size = strcspn(ptr, "-");
if (size==0)
break;
tokens[i].str = ptr;
tokens[i].len = size;
ptr += size;
len -= size;
}
return tokens;
}
static int
strToInt(str *token)
{
int res=0, pos, c;
if (token->len==0 || token->str[0]=='*') {
return -1;
} else {
for (res=0, pos=0; pos<token->len; pos++) {
c = token->str[pos] - '0';
if (c<0 || c>9)
break;
res = res*10 + c;
}
}
return res;
}
static char*
mapSlantToName(str *slant)
{
if (slant->len==0 || slant->str[0]=='*')
return "roman";
switch(slant->str[0]) {
case 'i':
return "italic";
case 'o':
return "oblique";
case 'r':
default:
return "roman";
}
}
char*
xlfdToFc(char *xlfd)
{
str *tokens, *family, *weight, *slant;
char *name, buf[512];
int size, pixelsize;
tokens = getXLFDTokens(xlfd);
if (!tokens)
return wstrdup(DEFAULT_FONT);
family = &(tokens[1]);
weight = &(tokens[2]);
slant = &(tokens[3]);
if (family->len==0 || family->str[0]=='*')
return wstrdup(DEFAULT_FONT);
sprintf(buf, "%.*s", family->len, family->str);
name = wstrdup(buf);
pixelsize = strToInt(&tokens[6]);
size = strToInt(&tokens[7]);
if (size<=0 && pixelsize<=0) {
name = wstrappend(name, ":pixelsize=12");
} else if (pixelsize>0) {
/* if pixelsize is present size will be ignored so we skip it */
sprintf(buf, ":pixelsize=%d", pixelsize);
name = wstrappend(name, buf);
} else {
sprintf(buf, "-%d", size/10);
name = wstrappend(name, buf);
}
if (weight->len>0 && weight->str[0]!='*') {
sprintf(buf, ":weight=%.*s", weight->len, weight->str);
name = wstrappend(name, buf);
}
if (slant->len>0 && slant->str[0]!='*') {
sprintf(buf, ":slant=%s", mapSlantToName(slant));
name = wstrappend(name, buf);
}
name = wstrappend(name, ":xlfd=");
name = wstrappend(name, xlfd);
return name;
}
/* return converted font (if conversion is needed) else the original font */
static char*
convertFont(char *font)
{
if (font[0]=='-') {
if (!strchr(font, ',')) {
return xlfdToFc(font);
} else {
wwarning("fontsets are not supported. replaced "
"with default %s", DEFAULT_FONT);
return wstrdup(DEFAULT_FONT);
}
} else {
return font;
}
}
char*
defaultsPathForDomain(char *domain)
{
@@ -502,7 +337,7 @@ hackStyle(WMPropList *style)
value = WMGetFromPLDictionary(style, tmp);
if (value) {
oldfont = WMGetFromPLString(value);
newfont = convertFont(oldfont);
newfont = convertFont(oldfont, False);
if (newfont != oldfont) {
value = WMCreatePLString(newfont);
WMPutInPLDictionary(style, tmp, value);

View File

@@ -272,9 +272,6 @@ test -f ~$GSDIR/Library/WindowMaker/exitscript || \
cp $GLOBALDIR/exitscript.sh $GSDIR/Library/WindowMaker/exitscript
chmod +rx $GSDIR/Library/WindowMaker/exitscript
# no need to call wmchlocale --auto, since national menu is already copied
wsetfont --auto
# xx herbert
if test -n "$BATCH" ; then
echo "Installation Finished"