mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
reverted the last test commit (duh)
This commit is contained in:
@@ -123,9 +123,6 @@ Changes since version 0.80.2:
|
|||||||
appicon when a KDE3 application opens a config panel.
|
appicon when a KDE3 application opens a config panel.
|
||||||
- Updated slovak translation (Jan Tomka <judas@linux.sk>)
|
- Updated slovak translation (Jan Tomka <judas@linux.sk>)
|
||||||
- Added xdnd v3 support in WINGs (Sylvain Reynal <sreynal@nerim.net>)
|
- Added xdnd v3 support in WINGs (Sylvain Reynal <sreynal@nerim.net>)
|
||||||
- Check whether libXft is at least version 2.1.2 else refuse to compile.
|
|
||||||
- Fixed bug in icon chooser dialog that could cause a segmentation fault
|
|
||||||
in some cases (Pascal Hofstee <caelian@gmail.com>)
|
|
||||||
|
|
||||||
|
|
||||||
Changes since version 0.80.1:
|
Changes since version 0.80.1:
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ libExtraWINGs_a_SOURCES = \
|
|||||||
wtableview.h \
|
wtableview.h \
|
||||||
wtabledelegates.h
|
wtabledelegates.h
|
||||||
|
|
||||||
AM_CFLAGS = -fno-strict-aliasing
|
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
|
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
|
||||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
|
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
|
||||||
|
|||||||
@@ -108,9 +108,7 @@ libWUtil_a_SOURCES = \
|
|||||||
wutil.c
|
wutil.c
|
||||||
|
|
||||||
|
|
||||||
AM_CPPFLAGS = -DLOCALEDIR=\"$(NLSDIR)\"
|
AM_CPPFLAGS = @CPPFLAGS@ -DLOCALEDIR=\"$(NLSDIR)\"
|
||||||
|
|
||||||
AM_CFLAGS = -fno-strict-aliasing
|
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/WINGs/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
INCLUDES = -I$(top_srcdir)/WINGs/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
||||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFTFLAGS@ @HEADER_SEARCH_PATH@ -DDEBUG
|
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFTFLAGS@ @HEADER_SEARCH_PATH@ -DDEBUG
|
||||||
|
|||||||
@@ -116,14 +116,14 @@ testFrame(WMScreen *scr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*static void
|
static void
|
||||||
resizedWindow(void *self, WMNotification *notif)
|
resizedWindow(void *self, WMNotification *notif)
|
||||||
{
|
{
|
||||||
WMView *view = (WMView*)WMGetNotificationObject(notif);
|
WMView *view = (WMView*)WMGetNotificationObject(notif);
|
||||||
WMSize size = WMGetViewSize(view);
|
WMSize size = WMGetViewSize(view);
|
||||||
|
|
||||||
WMResizeWidget((WMWidget*)self, size.width, size.height);
|
WMResizeWidget((WMWidget*)self, size.width, size.height);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testBox(WMScreen *scr)
|
testBox(WMScreen *scr)
|
||||||
@@ -609,8 +609,7 @@ testText(WMScreen *scr)
|
|||||||
WMFont *font, *ifont;
|
WMFont *font, *ifont;
|
||||||
|
|
||||||
font = WMDefaultSystemFont(scr);
|
font = WMDefaultSystemFont(scr);
|
||||||
//ifont = WMCopyFontWithStyle(scr, font, WFSEmphasized);
|
ifont = WMCopyFontWithStyle(scr, font, WFSEmphasized);
|
||||||
ifont = WMCreateFont(scr, "verdana,sans:pixelsize=12:italic");
|
|
||||||
if (ifont) {
|
if (ifont) {
|
||||||
WMSetTextDefaultFont(text, ifont);
|
WMSetTextDefaultFont(text, ifont);
|
||||||
WMReleaseFont(ifont);
|
WMReleaseFont(ifont);
|
||||||
@@ -620,7 +619,7 @@ testText(WMScreen *scr)
|
|||||||
WMReleaseFont(font);
|
WMReleaseFont(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file) {
|
if(file) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
WMFreezeText(text);
|
WMFreezeText(text);
|
||||||
|
|||||||
@@ -1834,11 +1834,12 @@ void WMShowFontPanel(WMFontPanel *panel);
|
|||||||
|
|
||||||
void WMHideFontPanel(WMFontPanel *panel);
|
void WMHideFontPanel(WMFontPanel *panel);
|
||||||
|
|
||||||
void WMFreeFontPanel(WMFontPanel *panel);
|
|
||||||
|
|
||||||
void WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data);
|
void WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data);
|
||||||
|
|
||||||
void WMSetFontPanelFont(WMFontPanel *panel, char *fontName);
|
void WMSetFontPanelFont(WMFontPanel *panel, WMFont *font);
|
||||||
|
|
||||||
|
/* you can free the returned string */
|
||||||
|
char* WMGetFontPanelFontName(WMFontPanel *panel);
|
||||||
|
|
||||||
WMFont* WMGetFontPanelFont(WMFontPanel *panel);
|
WMFont* WMGetFontPanelFont(WMFontPanel *panel);
|
||||||
|
|
||||||
|
|||||||
@@ -22,13 +22,18 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#define DOUBLE_BUFFER
|
||||||
|
|
||||||
|
|
||||||
#define DOUBLE_BUFFER 1
|
|
||||||
|
|
||||||
#define WC_UserWidget 128
|
#define WC_UserWidget 128
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SCROLLER_WIDTH 20
|
#define SCROLLER_WIDTH 20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define XDND_VERSION 4
|
#define XDND_VERSION 4
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ _WINGsConfiguration WINGsConfiguration;
|
|||||||
|
|
||||||
#define BOLD_SYSTEM_FONT "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-bold-r-*-*-%d-*-*-*-*-*-*-*"
|
#define BOLD_SYSTEM_FONT "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-bold-r-*-*-%d-*-*-*-*-*-*-*"
|
||||||
|
|
||||||
|
#define XFTSYSTEM_FONT "-*-arial-medium-r-normal-*-%d-*-*-*-*-*-*-*"
|
||||||
|
|
||||||
|
#define XFTBOLD_SYSTEM_FONT "-*-arial-bold-r-normal-*-%d-*-*-*-*-*-*-*"
|
||||||
|
|
||||||
#define FLOPPY_PATH "/floppy"
|
#define FLOPPY_PATH "/floppy"
|
||||||
|
|
||||||
|
|
||||||
@@ -41,7 +45,6 @@ getButtonWithName(const char *name, unsigned defaultButton)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// fix this
|
|
||||||
static Bool
|
static Bool
|
||||||
missingOrInvalidXLFD(char *xlfd)
|
missingOrInvalidXLFD(char *xlfd)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -193,15 +193,14 @@ W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
|
|||||||
WMDraggingInfo *info = &scr->dragInfo;
|
WMDraggingInfo *info = &scr->dragInfo;
|
||||||
Atom messageType = event->message_type;
|
Atom messageType = event->message_type;
|
||||||
|
|
||||||
#ifdef XDND_DEBUG
|
|
||||||
{
|
|
||||||
char* msgTypeName = XGetAtomName(scr->display, messageType);
|
char* msgTypeName = XGetAtomName(scr->display, messageType);
|
||||||
|
|
||||||
|
#ifdef XDND_DEBUG
|
||||||
|
|
||||||
if (msgTypeName != NULL)
|
if (msgTypeName != NULL)
|
||||||
printf("event type = %s\n", msgTypeName);
|
printf("event type = %s\n", msgTypeName);
|
||||||
else
|
else
|
||||||
printf("pb with event type !\n");
|
printf("pb with event type !\n");
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ createDropDataArray(WMArray *requiredTypes)
|
|||||||
static WMArray*
|
static WMArray*
|
||||||
getTypesFromTypeList(WMScreen *scr, Window sourceWin)
|
getTypesFromTypeList(WMScreen *scr, Window sourceWin)
|
||||||
{
|
{
|
||||||
/* // WMDraggingInfo *info = &scr->dragInfo;*/
|
WMDraggingInfo *info = &scr->dragInfo;
|
||||||
Atom dataType;
|
Atom dataType;
|
||||||
Atom* typeAtomList;
|
Atom* typeAtomList;
|
||||||
WMArray* typeList;
|
WMArray* typeList;
|
||||||
@@ -365,6 +365,7 @@ W_DragDestinationStoreEnterMsgInfo(WMDraggingInfo *info,
|
|||||||
WMView *toplevel, XClientMessageEvent *event)
|
WMView *toplevel, XClientMessageEvent *event)
|
||||||
{
|
{
|
||||||
WMScreen *scr = W_VIEW_SCREEN(toplevel);
|
WMScreen *scr = W_VIEW_SCREEN(toplevel);
|
||||||
|
int i,j, typesCount;
|
||||||
|
|
||||||
if (XDND_DEST_INFO(info) == NULL)
|
if (XDND_DEST_INFO(info) == NULL)
|
||||||
initDestinationDragInfo(info);
|
initDestinationDragInfo(info);
|
||||||
@@ -608,7 +609,7 @@ static void
|
|||||||
sendAllowedAction(WMView *destView, Atom action)
|
sendAllowedAction(WMView *destView, Atom action)
|
||||||
{
|
{
|
||||||
WMScreen *scr = W_VIEW_SCREEN(destView);
|
WMScreen *scr = W_VIEW_SCREEN(destView);
|
||||||
/* // WMPoint destPos = WMGetViewScreenPosition(destView); */
|
WMPoint destPos = WMGetViewScreenPosition(destView);
|
||||||
WMSize destSize = WMGetViewSize(destView);
|
WMSize destSize = WMGetViewSize(destView);
|
||||||
int destX, destY;
|
int destX, destY;
|
||||||
Window foo;
|
Window foo;
|
||||||
|
|||||||
@@ -425,8 +425,6 @@ sendEnterMessage(WMDraggingInfo *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// this functon doesn't return something in all cases.
|
|
||||||
// control reaches end of non-void function. fix this -Dan
|
|
||||||
static Bool
|
static Bool
|
||||||
sendPositionMessage(WMDraggingInfo *info, WMPoint *mousePos)
|
sendPositionMessage(WMDraggingInfo *info, WMPoint *mousePos)
|
||||||
{
|
{
|
||||||
@@ -742,6 +740,7 @@ isXdndAware(WMScreen *scr, Window win)
|
|||||||
int format;
|
int format;
|
||||||
unsigned long count, remain;
|
unsigned long count, remain;
|
||||||
unsigned char *winXdndVersion;
|
unsigned char *winXdndVersion;
|
||||||
|
unsigned char *proxy;
|
||||||
|
|
||||||
if (win == None)
|
if (win == None)
|
||||||
return False;
|
return False;
|
||||||
@@ -877,7 +876,7 @@ initMotionProcess(WMView *view, WMDraggingInfo *info,
|
|||||||
static void
|
static void
|
||||||
processMotion(WMDraggingInfo *info, Window windowUnderDrag, WMPoint *mousePos)
|
processMotion(WMDraggingInfo *info, Window windowUnderDrag, WMPoint *mousePos)
|
||||||
{
|
{
|
||||||
/* // WMScreen *scr = sourceScreen(info); */
|
WMScreen *scr = sourceScreen(info);
|
||||||
Window newDestination = findDestination(info, mousePos);
|
Window newDestination = findDestination(info, mousePos);
|
||||||
|
|
||||||
W_DragSourceStopTimer();
|
W_DragSourceStopTimer();
|
||||||
@@ -1059,7 +1058,6 @@ traceStatusMsg(Display *dpy, XClientMessageEvent *statusEvent)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
storeDropAction(WMDraggingInfo *info, Atom destAction)
|
storeDropAction(WMDraggingInfo *info, Atom destAction)
|
||||||
{
|
{
|
||||||
WMView* sourceView = XDND_SOURCE_VIEW(info);
|
WMView* sourceView = XDND_SOURCE_VIEW(info);
|
||||||
|
|||||||
@@ -26,11 +26,10 @@ class WMTimer:
|
|||||||
self._o = wings.pyWMAddPersistentTimerHandler(milliseconds, (callback, cdata))
|
self._o = wings.pyWMAddPersistentTimerHandler(milliseconds, (callback, cdata))
|
||||||
else:
|
else:
|
||||||
self._o = wings.pyWMAddTimerHandler(milliseconds, (callback, cdata))
|
self._o = wings.pyWMAddTimerHandler(milliseconds, (callback, cdata))
|
||||||
self.__WMDeleteTimerHandler = wings.pyWMDeleteTimerHandler
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.__WMDeleteTimerHandler(self._o)
|
wings.pyWMDeleteTimerHandler(self._o)
|
||||||
|
#delete = __del__
|
||||||
|
|
||||||
class WMPersistentTimer(WMTimer):
|
class WMPersistentTimer(WMTimer):
|
||||||
def __init__(self, milliseconds, callback, cdata=None):
|
def __init__(self, milliseconds, callback, cdata=None):
|
||||||
@@ -88,14 +87,13 @@ class WMView:
|
|||||||
|
|
||||||
class WMWidget(WMView):
|
class WMWidget(WMView):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self._o = None
|
||||||
if self.__class__ == WMWidget:
|
if self.__class__ == WMWidget:
|
||||||
raise Error, "a WMWidget can't be instantiated directly"
|
raise Error, "a WMWidget can't be instantiated directly"
|
||||||
self._o = None
|
|
||||||
self.__WMDestroyWidget = wings.WMDestroyWidget
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if self._o is not None:
|
if (self._o != None):
|
||||||
self.__WMDestroyWidget(self._o)
|
wings.WMDestroyWidget(self._o)
|
||||||
|
|
||||||
def resize(self, width, height):
|
def resize(self, width, height):
|
||||||
wings.WMResizeWidget(self._o, width, height)
|
wings.WMResizeWidget(self._o, width, height)
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ static WMEventHook *extraEventHandler=NULL;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
WMCreateEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
WMCreateEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
||||||
void *clientData)
|
void *clientData)
|
||||||
{
|
{
|
||||||
W_EventHandler *hPtr;
|
W_EventHandler *hPtr;
|
||||||
|
|||||||
1252
WINGs/wfont.c
1252
WINGs/wfont.c
File diff suppressed because it is too large
Load Diff
@@ -1,769 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "wconfig.h"
|
|
||||||
|
|
||||||
#ifndef XFT
|
|
||||||
|
|
||||||
#include "WINGsP.h"
|
|
||||||
|
|
||||||
#include <wraster.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <X11/Xlocale.h>
|
|
||||||
|
|
||||||
|
|
||||||
static char *makeFontSetOfSize(char *fontset, int size);
|
|
||||||
|
|
||||||
|
|
||||||
/* XLFD pattern matching */
|
|
||||||
static char*
|
|
||||||
getElementFromXLFD(const char *xlfd, int index)
|
|
||||||
{
|
|
||||||
const char *p = xlfd;
|
|
||||||
while (*p != 0) {
|
|
||||||
if (*p == '-' && --index == 0) {
|
|
||||||
const char *end = strchr(p + 1, '-');
|
|
||||||
char *buf;
|
|
||||||
size_t len;
|
|
||||||
if (end == 0) end = p + strlen(p);
|
|
||||||
len = end - (p + 1);
|
|
||||||
buf = wmalloc(len);
|
|
||||||
memcpy(buf, p + 1, len);
|
|
||||||
buf[len] = 0;
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
return strdup("*");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* XLFD pattern matching */
|
|
||||||
static char*
|
|
||||||
generalizeXLFD(const char *xlfd)
|
|
||||||
{
|
|
||||||
char *buf;
|
|
||||||
int len;
|
|
||||||
char *weight = getElementFromXLFD(xlfd, 3);
|
|
||||||
char *slant = getElementFromXLFD(xlfd, 4);
|
|
||||||
char *pxlsz = getElementFromXLFD(xlfd, 7);
|
|
||||||
|
|
||||||
#define Xstrlen(A) ((A)?strlen(A):0)
|
|
||||||
len = Xstrlen(xlfd)+Xstrlen(weight)+Xstrlen(slant)+Xstrlen(pxlsz)*2+60;
|
|
||||||
#undef Xstrlen
|
|
||||||
|
|
||||||
buf = wmalloc(len + 1);
|
|
||||||
snprintf(buf, len + 1, "%s,-*-*-%s-%s-*-*-%s-*-*-*-*-*-*-*,"
|
|
||||||
"-*-*-*-*-*-*-%s-*-*-*-*-*-*-*,*",
|
|
||||||
xlfd, weight, slant, pxlsz, pxlsz);
|
|
||||||
|
|
||||||
wfree(pxlsz);
|
|
||||||
wfree(slant);
|
|
||||||
wfree(weight);
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XLFD pattern matching */
|
|
||||||
static XFontSet
|
|
||||||
W_CreateFontSetWithGuess(Display *dpy, char *xlfd, char ***missing,
|
|
||||||
int *nmissing, char **def_string)
|
|
||||||
{
|
|
||||||
XFontSet fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
|
|
||||||
|
|
||||||
if (fs != NULL && *nmissing == 0) return fs;
|
|
||||||
|
|
||||||
/* for non-iso8859-1 language and iso8859-1 specification
|
|
||||||
(this fontset is only for pattern analysis) */
|
|
||||||
if (fs == NULL) {
|
|
||||||
if (*nmissing != 0) XFreeStringList(*missing);
|
|
||||||
setlocale(LC_CTYPE, "C");
|
|
||||||
fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
|
|
||||||
setlocale(LC_CTYPE, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make XLFD font name for pattern analysis */
|
|
||||||
if (fs != NULL) {
|
|
||||||
XFontStruct **fontstructs;
|
|
||||||
char **fontnames;
|
|
||||||
if (XFontsOfFontSet(fs, &fontstructs, &fontnames) > 0)
|
|
||||||
xlfd = fontnames[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
xlfd = generalizeXLFD(xlfd);
|
|
||||||
|
|
||||||
if (*nmissing != 0) XFreeStringList(*missing);
|
|
||||||
if (fs != NULL) XFreeFontSet(dpy, fs);
|
|
||||||
|
|
||||||
fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
|
|
||||||
|
|
||||||
wfree(xlfd);
|
|
||||||
return fs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static char*
|
|
||||||
xlfdFromFontName(char *fontName)
|
|
||||||
{
|
|
||||||
char *systemFont, *boldSystemFont;
|
|
||||||
char *font;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
systemFont = WINGsConfiguration.systemFont;
|
|
||||||
boldSystemFont = WINGsConfiguration.boldSystemFont;
|
|
||||||
|
|
||||||
size = WINGsConfiguration.defaultFontSize;
|
|
||||||
|
|
||||||
if (strcmp(fontName, "SystemFont")==0) {
|
|
||||||
font = systemFont;
|
|
||||||
} else if (strncmp(fontName, "SystemFont-", 11)==0) {
|
|
||||||
font = systemFont;
|
|
||||||
if (sscanf(&fontName[11], "%i", &size)!=1) {
|
|
||||||
size = WINGsConfiguration.defaultFontSize;
|
|
||||||
wwarning(_("Invalid size specification '%s' in %s. "
|
|
||||||
"Using default %d\n"), &fontName[11], fontName, size);
|
|
||||||
}
|
|
||||||
} else if (strcmp(fontName, "BoldSystemFont")==0) {
|
|
||||||
font = boldSystemFont;
|
|
||||||
} else if (strncmp(fontName, "BoldSystemFont-", 15)==0) {
|
|
||||||
font = boldSystemFont;
|
|
||||||
if (sscanf(&fontName[15], "%i", &size)!=1) {
|
|
||||||
size = WINGsConfiguration.defaultFontSize;
|
|
||||||
wwarning(_("Invalid size specification '%s' in %s. "
|
|
||||||
"Using default %d\n"), &fontName[15], fontName, size);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
font = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (font!=NULL ? makeFontSetOfSize(font, size) : wstrdup(fontName));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WMFont*
|
|
||||||
WMCreateFontSet(WMScreen *scrPtr, char *fontName)
|
|
||||||
{
|
|
||||||
WMFont *font;
|
|
||||||
Display *display = scrPtr->display;
|
|
||||||
char **missing;
|
|
||||||
int nmissing = 0;
|
|
||||||
char *defaultString;
|
|
||||||
char *fname;
|
|
||||||
XFontSetExtents *extents;
|
|
||||||
|
|
||||||
fname = xlfdFromFontName(fontName);
|
|
||||||
|
|
||||||
font = WMHashGet(scrPtr->fontSetCache, fname);
|
|
||||||
if (font) {
|
|
||||||
WMRetainFont(font);
|
|
||||||
wfree(fname);
|
|
||||||
return font;
|
|
||||||
}
|
|
||||||
|
|
||||||
font = wmalloc(sizeof(WMFont));
|
|
||||||
memset(font, 0, sizeof(WMFont));
|
|
||||||
|
|
||||||
font->notFontSet = 0;
|
|
||||||
|
|
||||||
font->screen = scrPtr;
|
|
||||||
|
|
||||||
font->font.set = W_CreateFontSetWithGuess(display, fname, &missing,
|
|
||||||
&nmissing, &defaultString);
|
|
||||||
if (nmissing > 0 && font->font.set) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
wwarning(_("the following character sets are missing in %s:"), fname);
|
|
||||||
for (i = 0; i < nmissing; i++) {
|
|
||||||
wwarning(missing[i]);
|
|
||||||
}
|
|
||||||
XFreeStringList(missing);
|
|
||||||
if (defaultString)
|
|
||||||
wwarning(_("the string \"%s\" will be used in place of any characters from those sets."),
|
|
||||||
defaultString);
|
|
||||||
}
|
|
||||||
if (!font->font.set) {
|
|
||||||
wfree(font);
|
|
||||||
wfree(fname);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
extents = XExtentsOfFontSet(font->font.set);
|
|
||||||
|
|
||||||
font->height = extents->max_logical_extent.height;
|
|
||||||
font->y = font->height - (font->height + extents->max_logical_extent.y);
|
|
||||||
|
|
||||||
font->refCount = 1;
|
|
||||||
|
|
||||||
font->name = fname;
|
|
||||||
|
|
||||||
assert(WMHashInsert(scrPtr->fontSetCache, font->name, font)==NULL);
|
|
||||||
|
|
||||||
return font;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WMFont*
|
|
||||||
WMCreateNormalFont(WMScreen *scrPtr, char *fontName)
|
|
||||||
{
|
|
||||||
WMFont *font;
|
|
||||||
Display *display = scrPtr->display;
|
|
||||||
char *fname, *ptr;
|
|
||||||
|
|
||||||
fontName = xlfdFromFontName(fontName);
|
|
||||||
|
|
||||||
if ((ptr = strchr(fontName, ','))) {
|
|
||||||
fname = wmalloc(ptr - fontName + 1);
|
|
||||||
strncpy(fname, fontName, ptr - fontName);
|
|
||||||
fname[ptr - fontName] = 0;
|
|
||||||
} else {
|
|
||||||
fname = wstrdup(fontName);
|
|
||||||
}
|
|
||||||
|
|
||||||
wfree(fontName);
|
|
||||||
|
|
||||||
font = WMHashGet(scrPtr->fontCache, fname);
|
|
||||||
if (font) {
|
|
||||||
WMRetainFont(font);
|
|
||||||
wfree(fname);
|
|
||||||
return font;
|
|
||||||
}
|
|
||||||
|
|
||||||
font = wmalloc(sizeof(WMFont));
|
|
||||||
memset(font, 0, sizeof(WMFont));
|
|
||||||
|
|
||||||
font->notFontSet = 1;
|
|
||||||
|
|
||||||
font->screen = scrPtr;
|
|
||||||
|
|
||||||
font->font.normal = XLoadQueryFont(display, fname);
|
|
||||||
if (!font->font.normal) {
|
|
||||||
wfree(font);
|
|
||||||
wfree(fname);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
font->height = font->font.normal->ascent+font->font.normal->descent;
|
|
||||||
font->y = font->font.normal->ascent;
|
|
||||||
|
|
||||||
font->refCount = 1;
|
|
||||||
|
|
||||||
font->name = fname;
|
|
||||||
|
|
||||||
assert(WMHashInsert(scrPtr->fontCache, font->name, font)==NULL);
|
|
||||||
|
|
||||||
return font;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WMFont*
|
|
||||||
WMCreateFont(WMScreen *scrPtr, char *fontName)
|
|
||||||
{
|
|
||||||
return WMCreateFontWithFlags(scrPtr, fontName, WFDefaultFont);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WMFont*
|
|
||||||
WMCreateFontWithFlags(WMScreen *scrPtr, char *fontName, WMFontFlags flags)
|
|
||||||
{
|
|
||||||
Bool multiByte = scrPtr->useMultiByte;
|
|
||||||
WMFont *font;
|
|
||||||
|
|
||||||
if (flags & WFFontSet) {
|
|
||||||
multiByte = True;
|
|
||||||
} else if (flags & WFNormalFont) {
|
|
||||||
multiByte = False;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (multiByte) {
|
|
||||||
font = WMCreateFontSet(scrPtr, fontName);
|
|
||||||
} else {
|
|
||||||
font = WMCreateNormalFont(scrPtr, fontName);
|
|
||||||
}
|
|
||||||
|
|
||||||
return font;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WMFont*
|
|
||||||
WMRetainFont(WMFont *font)
|
|
||||||
{
|
|
||||||
wassertrv(font!=NULL, NULL);
|
|
||||||
|
|
||||||
font->refCount++;
|
|
||||||
|
|
||||||
return font;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
WMReleaseFont(WMFont *font)
|
|
||||||
{
|
|
||||||
wassertr(font!=NULL);
|
|
||||||
|
|
||||||
font->refCount--;
|
|
||||||
if (font->refCount < 1) {
|
|
||||||
if (font->notFontSet) {
|
|
||||||
XFreeFont(font->screen->display, font->font.normal);
|
|
||||||
} else {
|
|
||||||
XFreeFontSet(font->screen->display, font->font.set);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (font->name) {
|
|
||||||
if (font->notFontSet) {
|
|
||||||
WMHashRemove(font->screen->fontCache, font->name);
|
|
||||||
} else {
|
|
||||||
WMHashRemove(font->screen->fontSetCache, font->name);
|
|
||||||
}
|
|
||||||
wfree(font->name);
|
|
||||||
}
|
|
||||||
wfree(font);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Bool
|
|
||||||
WMIsAntialiasingEnabled(WMScreen *scrPtr)
|
|
||||||
{
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int
|
|
||||||
WMFontHeight(WMFont *font)
|
|
||||||
{
|
|
||||||
wassertrv(font!=NULL, 0);
|
|
||||||
|
|
||||||
return font->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char*
|
|
||||||
WMGetFontName(WMFont *font)
|
|
||||||
{
|
|
||||||
wassertrv(font!=NULL, NULL);
|
|
||||||
|
|
||||||
return font->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WMFont*
|
|
||||||
WMDefaultSystemFont(WMScreen *scrPtr)
|
|
||||||
{
|
|
||||||
return WMRetainFont(scrPtr->normalFont);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WMFont*
|
|
||||||
WMDefaultBoldSystemFont(WMScreen *scrPtr)
|
|
||||||
{
|
|
||||||
return WMRetainFont(scrPtr->boldFont);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static WMFont*
|
|
||||||
makeSystemFontOfSize(WMScreen *scrPtr, int size, Bool bold)
|
|
||||||
{
|
|
||||||
WMFont *font;
|
|
||||||
char *fontSpec;
|
|
||||||
|
|
||||||
#define WConf WINGsConfiguration
|
|
||||||
if (bold) {
|
|
||||||
fontSpec = makeFontSetOfSize(WConf.boldSystemFont, size);
|
|
||||||
} else {
|
|
||||||
fontSpec = makeFontSetOfSize(WConf.systemFont, size);
|
|
||||||
}
|
|
||||||
#undef WConf
|
|
||||||
|
|
||||||
if (scrPtr->useMultiByte) {
|
|
||||||
font = WMCreateFontSet(scrPtr, fontSpec);
|
|
||||||
} else {
|
|
||||||
font = WMCreateNormalFont(scrPtr, fontSpec);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!font) {
|
|
||||||
if (scrPtr->useMultiByte) {
|
|
||||||
wwarning(_("could not load font set %s. Trying fixed."), fontSpec);
|
|
||||||
font = WMCreateFontSet(scrPtr, "fixed");
|
|
||||||
if (!font) {
|
|
||||||
font = WMCreateFontSet(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
wwarning(_("could not load font %s. Trying fixed."), fontSpec);
|
|
||||||
font = WMCreateNormalFont(scrPtr, "fixed");
|
|
||||||
}
|
|
||||||
if (!font) {
|
|
||||||
wwarning(_("could not load fixed font!"));
|
|
||||||
wfree(fontSpec);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wfree(fontSpec);
|
|
||||||
|
|
||||||
return font;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WMFont*
|
|
||||||
WMSystemFontOfSize(WMScreen *scrPtr, int size)
|
|
||||||
{
|
|
||||||
return makeSystemFontOfSize(scrPtr, size, False);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WMFont*
|
|
||||||
WMBoldSystemFontOfSize(WMScreen *scrPtr, int size)
|
|
||||||
{
|
|
||||||
return makeSystemFontOfSize(scrPtr, size, True);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
XFontSet
|
|
||||||
WMGetFontFontSet(WMFont *font)
|
|
||||||
{
|
|
||||||
wassertrv(font!=NULL, NULL);
|
|
||||||
|
|
||||||
if (!font->notFontSet && !font->antialiased)
|
|
||||||
return font->font.set;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
WMWidthOfString(WMFont *font, char *text, int length)
|
|
||||||
{
|
|
||||||
wassertrv(font!=NULL, 0);
|
|
||||||
wassertrv(text!=NULL, 0);
|
|
||||||
|
|
||||||
if (font->notFontSet) {
|
|
||||||
return XTextWidth(font->font.normal, text, length);
|
|
||||||
} else {
|
|
||||||
XRectangle rect;
|
|
||||||
XRectangle AIXsucks;
|
|
||||||
|
|
||||||
XmbTextExtents(font->font.set, text, length, &AIXsucks, &rect);
|
|
||||||
|
|
||||||
return rect.width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
WMDrawString(WMScreen *scr, Drawable d, WMColor *color, WMFont *font,
|
|
||||||
int x, int y, char *text, int length)
|
|
||||||
{
|
|
||||||
wassertr(font!=NULL);
|
|
||||||
|
|
||||||
if (font->notFontSet) {
|
|
||||||
XSetFont(scr->display, scr->drawStringGC, font->font.normal->fid);
|
|
||||||
XSetForeground(scr->display, scr->drawStringGC, W_PIXEL(color));
|
|
||||||
XDrawString(scr->display, d, scr->drawStringGC, x, y + font->y,
|
|
||||||
text, length);
|
|
||||||
} else {
|
|
||||||
XSetForeground(scr->display, scr->drawStringGC, W_PIXEL(color));
|
|
||||||
XmbDrawString(scr->display, d, font->font.set, scr->drawStringGC,
|
|
||||||
x, y + font->y, text, length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
WMDrawImageString(WMScreen *scr, Drawable d, WMColor *color, WMColor *background,
|
|
||||||
WMFont *font, int x, int y, char *text, int length)
|
|
||||||
{
|
|
||||||
wassertr(font!=NULL);
|
|
||||||
|
|
||||||
if (font->notFontSet) {
|
|
||||||
XSetForeground(scr->display, scr->drawImStringGC, W_PIXEL(color));
|
|
||||||
XSetBackground(scr->display, scr->drawImStringGC, W_PIXEL(background));
|
|
||||||
XSetFont(scr->display, scr->drawImStringGC, font->font.normal->fid);
|
|
||||||
XDrawImageString(scr->display, d, scr->drawImStringGC,
|
|
||||||
x, y + font->y, text, length);
|
|
||||||
} else {
|
|
||||||
XSetForeground(scr->display, scr->drawImStringGC, W_PIXEL(color));
|
|
||||||
XSetBackground(scr->display, scr->drawImStringGC, W_PIXEL(background));
|
|
||||||
XmbDrawImageString(scr->display, d, font->font.set, scr->drawImStringGC,
|
|
||||||
x, y + font->y, text, length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static char*
|
|
||||||
makeFontSetOfSize(char *fontset, int size)
|
|
||||||
{
|
|
||||||
char font[300], *f;
|
|
||||||
char *newfs = NULL;
|
|
||||||
char *ptr;
|
|
||||||
|
|
||||||
do {
|
|
||||||
char *tmp;
|
|
||||||
int end;
|
|
||||||
|
|
||||||
|
|
||||||
f = fontset;
|
|
||||||
ptr = strchr(fontset, ',');
|
|
||||||
if (ptr) {
|
|
||||||
int count = ptr-fontset;
|
|
||||||
|
|
||||||
if (count > 255) {
|
|
||||||
wwarning(_("font description %s is too large."), fontset);
|
|
||||||
} else {
|
|
||||||
memcpy(font, fontset, count);
|
|
||||||
font[count] = 0;
|
|
||||||
f = (char*)font;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newfs)
|
|
||||||
end = strlen(newfs);
|
|
||||||
else
|
|
||||||
end = 0;
|
|
||||||
|
|
||||||
tmp = wmalloc(end + strlen(f) + 8);
|
|
||||||
if (end != 0) {
|
|
||||||
sprintf(tmp, "%s,", newfs);
|
|
||||||
sprintf(tmp + end + 1, f, size);
|
|
||||||
} else {
|
|
||||||
sprintf(tmp + end, f, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newfs)
|
|
||||||
wfree(newfs);
|
|
||||||
newfs = tmp;
|
|
||||||
|
|
||||||
fontset = ptr+1;
|
|
||||||
} while (ptr!=NULL);
|
|
||||||
|
|
||||||
return newfs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define FONT_PROPS 14
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char *props[FONT_PROPS];
|
|
||||||
} W_FontAttributes;
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
changeFontProp(char *buf, char *newprop, int position)
|
|
||||||
{
|
|
||||||
char buf2[512];
|
|
||||||
char *ptr, *pptr, *rptr;
|
|
||||||
int count;
|
|
||||||
|
|
||||||
if (buf[0]!='-') {
|
|
||||||
/* // remove warning later. or maybe not */
|
|
||||||
wwarning(_("Invalid font specification: '%s'\n"), buf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr = pptr = rptr = buf;
|
|
||||||
count = 0;
|
|
||||||
while (*ptr && *ptr!=',') {
|
|
||||||
if (*ptr == '-') {
|
|
||||||
count++;
|
|
||||||
if (count-1==position+1) {
|
|
||||||
rptr = ptr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (count-1==position) {
|
|
||||||
pptr = ptr+1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ptr++;
|
|
||||||
}
|
|
||||||
if (position==FONT_PROPS-1) {
|
|
||||||
rptr = ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
*pptr = 0;
|
|
||||||
snprintf(buf2, 512, "%s%s%s", buf, newprop, rptr);
|
|
||||||
strcpy(buf, buf2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static WMArray*
|
|
||||||
getOptions(char *options)
|
|
||||||
{
|
|
||||||
char *ptr, *ptr2, *str;
|
|
||||||
WMArray *result;
|
|
||||||
int count;
|
|
||||||
|
|
||||||
result = WMCreateArrayWithDestructor(2, (WMFreeDataProc*)wfree);
|
|
||||||
|
|
||||||
ptr = options;
|
|
||||||
while (1) {
|
|
||||||
ptr2 = strchr(ptr, ',');
|
|
||||||
if (!ptr2) {
|
|
||||||
WMAddToArray(result, wstrdup(ptr));
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
count = ptr2 - ptr;
|
|
||||||
str = wmalloc(count+1);
|
|
||||||
memcpy(str, ptr, count);
|
|
||||||
str[count] = 0;
|
|
||||||
WMAddToArray(result, str);
|
|
||||||
ptr = ptr2 + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define WFAUnchanged (NULL)
|
|
||||||
/* Struct for font change operations */
|
|
||||||
typedef struct WMFontAttributes {
|
|
||||||
char *foundry;
|
|
||||||
char *family;
|
|
||||||
char *weight;
|
|
||||||
char *slant;
|
|
||||||
char *setWidth;
|
|
||||||
char *addStyle;
|
|
||||||
char *pixelSize;
|
|
||||||
char *pointSize;
|
|
||||||
char *resolutionX;
|
|
||||||
char *resolutionY;
|
|
||||||
char *spacing;
|
|
||||||
char *averageWidth;
|
|
||||||
char *registry;
|
|
||||||
char *encoding;
|
|
||||||
} WMFontAttributes;
|
|
||||||
|
|
||||||
WMFont*
|
|
||||||
WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font,
|
|
||||||
const WMFontAttributes *changes)
|
|
||||||
{
|
|
||||||
int index[FONT_PROPS], count[FONT_PROPS];
|
|
||||||
int totalProps, i, j, carry;
|
|
||||||
char fname[512];
|
|
||||||
WMFontFlags fFlags;
|
|
||||||
WMBag *props;
|
|
||||||
WMArray *options;
|
|
||||||
WMFont *result;
|
|
||||||
char *prop;
|
|
||||||
|
|
||||||
snprintf(fname, 512, "%s", font->name);
|
|
||||||
|
|
||||||
fFlags = (font->antialiased ? WFAntialiased : WFNotAntialiased);
|
|
||||||
fFlags |= (font->notFontSet ? WFNormalFont : WFFontSet);
|
|
||||||
|
|
||||||
props = WMCreateBagWithDestructor(1, (WMFreeDataProc*)WMFreeArray);
|
|
||||||
|
|
||||||
totalProps = 0;
|
|
||||||
for (i=0; i<FONT_PROPS; i++) {
|
|
||||||
prop = ((W_FontAttributes*)changes)->props[i];
|
|
||||||
count[i] = index[i] = 0;
|
|
||||||
if (!prop) {
|
|
||||||
/* No change for this property */
|
|
||||||
continue;
|
|
||||||
} else if (strchr(prop, ',')==NULL) {
|
|
||||||
/* Simple option */
|
|
||||||
changeFontProp(fname, prop, i);
|
|
||||||
} else {
|
|
||||||
/* Option with fallback alternatives */
|
|
||||||
if ((changes==WFAEmphasized || changes==WFABoldEmphasized) &&
|
|
||||||
font->antialiased && strcmp(prop, "o,i")==0) {
|
|
||||||
options = getOptions("i,o");
|
|
||||||
} else {
|
|
||||||
options = getOptions(prop);
|
|
||||||
}
|
|
||||||
WMInsertInBag(props, i, options);
|
|
||||||
count[i] = WMGetArrayItemCount(options);
|
|
||||||
if (totalProps==0)
|
|
||||||
totalProps = 1;
|
|
||||||
totalProps = totalProps * count[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (totalProps == 0) {
|
|
||||||
/* No options with fallback alternatives at all */
|
|
||||||
WMFreeBag(props);
|
|
||||||
return WMCreateFontWithFlags(scrPtr, fname, fFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0; i<totalProps; i++) {
|
|
||||||
for (j=0; j<FONT_PROPS; j++) {
|
|
||||||
if (count[j]!=0) {
|
|
||||||
options = WMGetFromBag(props, j);
|
|
||||||
prop = WMGetFromArray(options, index[j]);
|
|
||||||
if (prop) {
|
|
||||||
changeFontProp(fname, prop, j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = WMCreateFontWithFlags(scrPtr, fname, fFlags);
|
|
||||||
if (result) {
|
|
||||||
WMFreeBag(props);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
for (j=FONT_PROPS-1, carry=1; j>=0; j--) {
|
|
||||||
if (count[j]!=0) {
|
|
||||||
index[j] += carry;
|
|
||||||
carry = (index[j]==count[j]);
|
|
||||||
index[j] %= count[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WMFreeBag(props);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// should WFANormal also set "normal" or leave it alone?
|
|
||||||
static const WMFontAttributes W_FANormal = {
|
|
||||||
WFAUnchanged, WFAUnchanged, "medium,normal,regular", "r", "normal",
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static const WMFontAttributes W_FABold = {
|
|
||||||
WFAUnchanged, WFAUnchanged, "bold", WFAUnchanged,
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static const WMFontAttributes W_FANotBold = {
|
|
||||||
WFAUnchanged, WFAUnchanged, "medium,normal,regular", WFAUnchanged,
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static const WMFontAttributes W_FAEmphasized = {
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, "o,i",
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static const WMFontAttributes W_FANotEmphasized = {
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, "r",
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static const WMFontAttributes W_FABoldEmphasized = {
|
|
||||||
WFAUnchanged, WFAUnchanged, "bold", "o,i",
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
|
|
||||||
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const WMFontAttributes *WFANormal = &W_FANormal;
|
|
||||||
const WMFontAttributes *WFABold = &W_FABold;
|
|
||||||
const WMFontAttributes *WFANotBold = &W_FANotBold;
|
|
||||||
const WMFontAttributes *WFAEmphasized = &W_FAEmphasized;
|
|
||||||
const WMFontAttributes *WFANotEmphasized = &W_FANotEmphasized;
|
|
||||||
const WMFontAttributes *WFABoldEmphasized = &W_FABoldEmphasized;
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -9,10 +9,6 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef XFT
|
|
||||||
#include <X11/Xft/Xft.h>
|
|
||||||
#include <fontconfig/fontconfig.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* XXX TODO */
|
/* XXX TODO */
|
||||||
@@ -85,11 +81,8 @@ static int scalableFontSizes[] = {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef XFT
|
static void getSelectedFont(FontPanel *panel, char buffer[], int bufsize);
|
||||||
static void setFontPanelFontName(FontPanel *panel, FcChar8 *family, FcChar8 *style, double size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int isXLFD(char *font, int *length_ret);
|
|
||||||
|
|
||||||
static void arrangeLowerFrame(FontPanel *panel);
|
static void arrangeLowerFrame(FontPanel *panel);
|
||||||
|
|
||||||
@@ -181,7 +174,7 @@ setClickedAction(WMWidget *w, void *data)
|
|||||||
static void
|
static void
|
||||||
revertClickedAction(WMWidget *w, void *data)
|
revertClickedAction(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
/*FontPanel *panel = (FontPanel*)data;*/
|
FontPanel *panel = (FontPanel*)data;
|
||||||
/* XXX TODO */
|
/* XXX TODO */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,8 +196,7 @@ WMGetFontPanel(WMScreen *scr)
|
|||||||
memset(panel, 0, sizeof(FontPanel));
|
memset(panel, 0, sizeof(FontPanel));
|
||||||
|
|
||||||
panel->win = WMCreateWindow(scr, "fontPanel");
|
panel->win = WMCreateWindow(scr, "fontPanel");
|
||||||
/* WMSetWidgetBackgroundColor(panel->win, WMWhiteColor(scr));*/
|
/* WMSetWidgetBackgroundColor(panel->win, WMWhiteColor(scr));*/
|
||||||
WMSetWindowTitle(panel->win, _("Font Panel"));
|
|
||||||
WMResizeWidget(panel->win, DEF_WIDTH, DEF_HEIGHT);
|
WMResizeWidget(panel->win, DEF_WIDTH, DEF_HEIGHT);
|
||||||
WMSetWindowMinSize(panel->win, MIN_WIDTH, MIN_HEIGHT);
|
WMSetWindowMinSize(panel->win, MIN_WIDTH, MIN_HEIGHT);
|
||||||
WMSetViewNotifySizeChanges(WMWidgetView(panel->win), True);
|
WMSetViewNotifySizeChanges(WMWidgetView(panel->win), True);
|
||||||
@@ -221,7 +213,7 @@ WMGetFontPanel(WMScreen *scr)
|
|||||||
WMSetFrameRelief(panel->upperF, WRFlat);
|
WMSetFrameRelief(panel->upperF, WRFlat);
|
||||||
WMSetViewNotifySizeChanges(WMWidgetView(panel->upperF), True);
|
WMSetViewNotifySizeChanges(WMWidgetView(panel->upperF), True);
|
||||||
panel->lowerF = WMCreateFrame(panel->win);
|
panel->lowerF = WMCreateFrame(panel->win);
|
||||||
/* WMSetWidgetBackgroundColor(panel->lowerF, WMBlackColor(scr));*/
|
/* WMSetWidgetBackgroundColor(panel->lowerF, WMBlackColor(scr));*/
|
||||||
WMSetFrameRelief(panel->lowerF, WRFlat);
|
WMSetFrameRelief(panel->lowerF, WRFlat);
|
||||||
WMSetViewNotifySizeChanges(WMWidgetView(panel->lowerF), True);
|
WMSetViewNotifySizeChanges(WMWidgetView(panel->lowerF), True);
|
||||||
|
|
||||||
@@ -240,7 +232,7 @@ WMGetFontPanel(WMScreen *scr)
|
|||||||
panel->sampleT = WMCreateTextField(panel->upperF);
|
panel->sampleT = WMCreateTextField(panel->upperF);
|
||||||
WMResizeWidget(panel->sampleT, DEF_WIDTH - 20, 50);
|
WMResizeWidget(panel->sampleT, DEF_WIDTH - 20, 50);
|
||||||
WMMoveWidget(panel->sampleT, 10, 10);
|
WMMoveWidget(panel->sampleT, 10, 10);
|
||||||
WMSetTextFieldText(panel->sampleT, _("The quick brown fox jumps over the lazy dog"));
|
WMSetTextFieldText(panel->sampleT, _("Test!!!"));
|
||||||
|
|
||||||
font = WMBoldSystemFontOfSize(scr, 12);
|
font = WMBoldSystemFontOfSize(scr, 12);
|
||||||
|
|
||||||
@@ -275,7 +267,7 @@ WMGetFontPanel(WMScreen *scr)
|
|||||||
WMSetLabelTextAlignment(panel->sizL, WACenter);
|
WMSetLabelTextAlignment(panel->sizL, WACenter);
|
||||||
|
|
||||||
panel->sizT = WMCreateTextField(panel->lowerF);
|
panel->sizT = WMCreateTextField(panel->lowerF);
|
||||||
/* WMSetTextFieldAlignment(panel->sizT, WARight);*/
|
/* WMSetTextFieldAlignment(panel->sizT, WARight);*/
|
||||||
|
|
||||||
panel->sizLs = WMCreateList(panel->lowerF);
|
panel->sizLs = WMCreateList(panel->lowerF);
|
||||||
WMSetListAction(panel->sizLs, sizeClick, panel);
|
WMSetListAction(panel->sizLs, sizeClick, panel);
|
||||||
@@ -357,6 +349,21 @@ WMHideFontPanel(WMFontPanel *panel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WMSetFontPanelFont(WMFontPanel *panel, WMFont *font)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Bool
|
||||||
|
WMSetFontPanelFontName(WMFontPanel *panel, char *fontName)
|
||||||
|
{
|
||||||
|
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WMFont*
|
WMFont*
|
||||||
WMGetFontPanelFont(WMFontPanel *panel)
|
WMGetFontPanelFont(WMFontPanel *panel)
|
||||||
{
|
{
|
||||||
@@ -364,37 +371,18 @@ WMGetFontPanelFont(WMFontPanel *panel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
char*
|
||||||
WMSetFontPanelFont(WMFontPanel *panel, char *fontName)
|
WMGetFontPanelFontName(WMFontPanel *panel)
|
||||||
{
|
{
|
||||||
#ifdef XFT
|
char name[512];
|
||||||
int fname_len;
|
|
||||||
FcPattern *pattern;
|
|
||||||
FcChar8 *family, *style;
|
|
||||||
double size;
|
|
||||||
|
|
||||||
if (!isXLFD(fontName, &fname_len)) {
|
getSelectedFont(panel, name, sizeof(name));
|
||||||
/* maybe its proper fontconfig and we can parse it */
|
|
||||||
pattern = FcNameParse(fontName);
|
|
||||||
} else {
|
|
||||||
/* maybe its proper xlfd and we can convert it to an FcPattern */
|
|
||||||
pattern = XftXlfdParse(fontName, False, False);
|
|
||||||
//FcPatternPrint(pattern);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pattern)
|
return wstrdup(name);
|
||||||
return;
|
|
||||||
|
|
||||||
if (FcPatternGetString(pattern, FC_FAMILY, 0, &family)==FcResultMatch)
|
|
||||||
if (FcPatternGetString(pattern, FC_STYLE, 0, &style)==FcResultMatch)
|
|
||||||
if (FcPatternGetDouble(pattern, "pixelsize", 0, &size)==FcResultMatch)
|
|
||||||
setFontPanelFontName(panel, family, style, size);
|
|
||||||
|
|
||||||
FcPatternDestroy(pattern);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data)
|
WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data)
|
||||||
{
|
{
|
||||||
@@ -470,22 +458,6 @@ arrangeLowerFrame(FontPanel *panel)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
isXLFD(char *font, int *length_ret)
|
|
||||||
{
|
|
||||||
int c = 0;
|
|
||||||
|
|
||||||
*length_ret = 0;
|
|
||||||
while (*font) {
|
|
||||||
(*length_ret)++;
|
|
||||||
if (*font++ == '-')
|
|
||||||
c++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return c==NUM_FIELDS;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef XFT
|
|
||||||
static Bool
|
static Bool
|
||||||
parseFont(char *font, char values[NUM_FIELDS][256])
|
parseFont(char *font, char values[NUM_FIELDS][256])
|
||||||
{
|
{
|
||||||
@@ -516,6 +488,22 @@ parseFont(char *font, char values[NUM_FIELDS][256])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
isXLFD(char *font, int *length_ret)
|
||||||
|
{
|
||||||
|
int c = 0;
|
||||||
|
|
||||||
|
*length_ret = 0;
|
||||||
|
while (*font) {
|
||||||
|
(*length_ret)++;
|
||||||
|
if (*font++ == '-')
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return c==NUM_FIELDS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -543,18 +531,6 @@ typedef struct {
|
|||||||
|
|
||||||
WMArray *typefaces;
|
WMArray *typefaces;
|
||||||
} Family;
|
} Family;
|
||||||
#endif
|
|
||||||
#ifdef XFT
|
|
||||||
typedef struct {
|
|
||||||
char *typeface;
|
|
||||||
WMArray *sizes;
|
|
||||||
} Xft_Typeface;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char *name; /* gotta love simplicity */
|
|
||||||
WMArray *typefaces;
|
|
||||||
} Xft_Family;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -574,12 +550,9 @@ compare_int(const void *a, const void *b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
#ifdef XFT
|
|
||||||
addSizeToTypeface(Xft_Typeface *face, int size)
|
|
||||||
#else
|
|
||||||
addSizeToTypeface(Typeface *face, int size)
|
addSizeToTypeface(Typeface *face, int size)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
int j;
|
int j;
|
||||||
@@ -600,35 +573,7 @@ addSizeToTypeface(Typeface *face, int size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XFT
|
|
||||||
static void
|
|
||||||
addTypefaceToXftFamily(Xft_Family *fam, char *style)
|
|
||||||
{
|
|
||||||
Xft_Typeface *face;
|
|
||||||
WMArrayIterator i;
|
|
||||||
|
|
||||||
if(fam->typefaces) {
|
|
||||||
WM_ITERATE_ARRAY(fam->typefaces, face, i) {
|
|
||||||
if(strcmp(face->typeface, style) != 0)
|
|
||||||
continue; /* go to next interation */
|
|
||||||
addSizeToTypeface(face, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fam->typefaces = WMCreateArray(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
face = wmalloc(sizeof(Xft_Typeface));
|
|
||||||
memset(face, 0 , sizeof(Xft_Typeface));
|
|
||||||
|
|
||||||
face->typeface = wstrdup(style);
|
|
||||||
face->sizes = WMCreateArray(4);
|
|
||||||
addSizeToTypeface(face, 0);
|
|
||||||
|
|
||||||
WMAddToArray(fam->typefaces, face);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* XFT */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
addTypefaceToFamily(Family *family, char fontFields[NUM_FIELDS][256])
|
addTypefaceToFamily(Family *family, char fontFields[NUM_FIELDS][256])
|
||||||
@@ -670,7 +615,7 @@ addTypefaceToFamily(Family *family, char fontFields[NUM_FIELDS][256])
|
|||||||
|
|
||||||
WMAddToArray(family->typefaces, face);
|
WMAddToArray(family->typefaces, face);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* families (same family name) (Hashtable of family -> array)
|
* families (same family name) (Hashtable of family -> array)
|
||||||
@@ -678,39 +623,6 @@ addTypefaceToFamily(Family *family, char fontFields[NUM_FIELDS][256])
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef XFT
|
|
||||||
static void
|
|
||||||
addFontToXftFamily(WMHashTable *families, char *name, char *style)
|
|
||||||
{
|
|
||||||
WMArrayIterator i;
|
|
||||||
WMArray *array;
|
|
||||||
Xft_Family *fam;
|
|
||||||
|
|
||||||
array = WMHashGet(families, name);
|
|
||||||
if(array) {
|
|
||||||
WM_ITERATE_ARRAY(array, fam, i) {
|
|
||||||
if(strcmp(fam->name, name) == 0 )
|
|
||||||
addTypefaceToXftFamily(fam, style);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
array = WMCreateArray(8);
|
|
||||||
|
|
||||||
fam = wmalloc(sizeof(Xft_Family));
|
|
||||||
memset(fam, 0, sizeof(Xft_Family));
|
|
||||||
|
|
||||||
fam->name = wstrdup(name);
|
|
||||||
|
|
||||||
addTypefaceToXftFamily(fam, style);
|
|
||||||
|
|
||||||
WMAddToArray(array, fam);
|
|
||||||
|
|
||||||
WMHashInsert(families, fam->name, array);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* XFT */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
|
addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
|
||||||
{
|
{
|
||||||
@@ -819,39 +731,19 @@ addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
|
|||||||
|
|
||||||
WMHashInsert(families, fam->name, family);
|
WMHashInsert(families, fam->name, family);
|
||||||
}
|
}
|
||||||
#endif /* XFT */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
listFamilies(WMScreen *scr, WMFontPanel *panel)
|
listFamilies(WMScreen *scr, WMFontPanel *panel)
|
||||||
{
|
{
|
||||||
#ifdef XFT
|
|
||||||
FcObjectSet *os = 0;
|
|
||||||
FcFontSet *fs;
|
|
||||||
FcPattern *pat;
|
|
||||||
#else /* XFT */
|
|
||||||
char **fontList;
|
char **fontList;
|
||||||
char fields[NUM_FIELDS][256];
|
|
||||||
int count;
|
|
||||||
#endif /* XFT */
|
|
||||||
WMHashTable *families;
|
WMHashTable *families;
|
||||||
|
char fields[NUM_FIELDS][256];
|
||||||
WMHashEnumerator enumer;
|
WMHashEnumerator enumer;
|
||||||
WMArray *array;
|
WMArray *array;
|
||||||
int i;
|
int i, count;
|
||||||
|
|
||||||
#ifdef XFT
|
|
||||||
pat = FcPatternCreate();
|
|
||||||
os = FcObjectSetBuild(FC_FAMILY, FC_STYLE, 0);
|
|
||||||
fs = FcFontList(0, pat, os);
|
|
||||||
if (!fs) {
|
|
||||||
WMRunAlertPanel(scr, panel->win, _("Error"),
|
|
||||||
_("Could not init font config library\n"), _("OK"), NULL, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (pat)
|
|
||||||
FcPatternDestroy (pat);
|
|
||||||
#else /* XFT */
|
|
||||||
fontList = XListFonts(scr->display, ALL_FONTS_MASK, MAX_FONTS_TO_RETRIEVE,
|
fontList = XListFonts(scr->display, ALL_FONTS_MASK, MAX_FONTS_TO_RETRIEVE,
|
||||||
&count);
|
&count);
|
||||||
if (!fontList) {
|
if (!fontList) {
|
||||||
@@ -859,23 +751,9 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
|
|||||||
_("Could not retrieve font list"), _("OK"), NULL, NULL);
|
_("Could not retrieve font list"), _("OK"), NULL, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* XFT */
|
|
||||||
|
|
||||||
families = WMCreateHashTable(WMStringPointerHashCallbacks);
|
families = WMCreateHashTable(WMStringPointerHashCallbacks);
|
||||||
|
|
||||||
#ifdef XFT
|
|
||||||
if(fs) {
|
|
||||||
for (i = 0; i < fs->nfont; i++) {
|
|
||||||
FcChar8 *family;
|
|
||||||
FcChar8 *style;
|
|
||||||
|
|
||||||
if (FcPatternGetString(fs->fonts[i],FC_FAMILY,0,&family)==FcResultMatch)
|
|
||||||
if (FcPatternGetString(fs->fonts[i],FC_STYLE,0,&style)==FcResultMatch)
|
|
||||||
addFontToXftFamily(families, family, style);
|
|
||||||
}
|
|
||||||
FcFontSetDestroy(fs);
|
|
||||||
}
|
|
||||||
#else /* XFT */
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
int fname_len;
|
int fname_len;
|
||||||
|
|
||||||
@@ -895,27 +773,9 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
|
|||||||
}
|
}
|
||||||
addFontToFamily(families, fields);
|
addFontToFamily(families, fields);
|
||||||
}
|
}
|
||||||
#endif /* XFT */
|
|
||||||
|
|
||||||
enumer = WMEnumerateHashTable(families);
|
enumer = WMEnumerateHashTable(families);
|
||||||
|
|
||||||
#ifdef XFT
|
|
||||||
while ((array = WMNextHashEnumeratorItem(&enumer))) {
|
|
||||||
WMArrayIterator i;
|
|
||||||
Xft_Family *fam;
|
|
||||||
char buffer[256];
|
|
||||||
WMListItem *item;
|
|
||||||
|
|
||||||
WM_ITERATE_ARRAY(array, fam, i) {
|
|
||||||
strcpy(buffer, fam->name);
|
|
||||||
item = WMAddListItem(panel->famLs, buffer);
|
|
||||||
|
|
||||||
item->clientData = fam;
|
|
||||||
}
|
|
||||||
|
|
||||||
WMFreeArray(array);
|
|
||||||
}
|
|
||||||
#else /* XFT */
|
|
||||||
while ((array = WMNextHashEnumeratorItem(&enumer))) {
|
while ((array = WMNextHashEnumeratorItem(&enumer))) {
|
||||||
WMArrayIterator i;
|
WMArrayIterator i;
|
||||||
Family *fam;
|
Family *fam;
|
||||||
@@ -943,7 +803,6 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
|
|||||||
}
|
}
|
||||||
WMFreeArray(array);
|
WMFreeArray(array);
|
||||||
}
|
}
|
||||||
#endif /* XFT */
|
|
||||||
WMSortListItems(panel->famLs);
|
WMSortListItems(panel->famLs);
|
||||||
|
|
||||||
WMFreeHashTable(families);
|
WMFreeHashTable(families);
|
||||||
@@ -954,42 +813,23 @@ static void
|
|||||||
getSelectedFont(FontPanel *panel, char buffer[], int bufsize)
|
getSelectedFont(FontPanel *panel, char buffer[], int bufsize)
|
||||||
{
|
{
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
#ifdef XFT
|
|
||||||
Xft_Family *family;
|
|
||||||
Xft_Typeface *face;
|
|
||||||
#else
|
|
||||||
Family *family;
|
Family *family;
|
||||||
Typeface *face;
|
Typeface *face;
|
||||||
#endif
|
|
||||||
char *size;
|
char *size;
|
||||||
|
|
||||||
|
|
||||||
item = WMGetListSelectedItem(panel->famLs);
|
item = WMGetListSelectedItem(panel->famLs);
|
||||||
if (!item)
|
if (!item)
|
||||||
return;
|
return;
|
||||||
#ifdef XFT
|
|
||||||
family = (Xft_Family*)item->clientData;
|
|
||||||
#else
|
|
||||||
family = (Family*)item->clientData;
|
family = (Family*)item->clientData;
|
||||||
#endif
|
|
||||||
|
|
||||||
item = WMGetListSelectedItem(panel->typLs);
|
item = WMGetListSelectedItem(panel->typLs);
|
||||||
if (!item)
|
if (!item)
|
||||||
return;
|
return;
|
||||||
#ifdef XFT
|
|
||||||
face = (Xft_Typeface*)item->clientData;
|
|
||||||
#else
|
|
||||||
face = (Typeface*)item->clientData;
|
face = (Typeface*)item->clientData;
|
||||||
#endif
|
|
||||||
|
|
||||||
size = WMGetTextFieldText(panel->sizT);
|
size = WMGetTextFieldText(panel->sizT);
|
||||||
|
|
||||||
#ifdef XFT
|
|
||||||
snprintf(buffer, bufsize, "%s:style=%s:pixelsize=%s",
|
|
||||||
family->name,
|
|
||||||
face->typeface,
|
|
||||||
size);
|
|
||||||
#else
|
|
||||||
snprintf(buffer, bufsize, "-%s-%s-%s-%s-%s-%s-%s-*-*-*-*-*-%s-%s",
|
snprintf(buffer, bufsize, "-%s-%s-%s-%s-%s-%s-%s-*-*-*-*-*-%s-%s",
|
||||||
family->foundry,
|
family->foundry,
|
||||||
family->name,
|
family->name,
|
||||||
@@ -1000,7 +840,7 @@ getSelectedFont(FontPanel *panel, char buffer[], int bufsize)
|
|||||||
size,
|
size,
|
||||||
family->registry,
|
family->registry,
|
||||||
family->encoding);
|
family->encoding);
|
||||||
#endif /* XFT */
|
|
||||||
wfree(size);
|
wfree(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1013,6 +853,7 @@ preview(FontPanel *panel)
|
|||||||
WMFont *font;
|
WMFont *font;
|
||||||
|
|
||||||
getSelectedFont(panel, buffer, sizeof(buffer));
|
getSelectedFont(panel, buffer, sizeof(buffer));
|
||||||
|
|
||||||
font = WMCreateFont(WMWidgetScreen(panel->win), buffer);
|
font = WMCreateFont(WMWidgetScreen(panel->win), buffer);
|
||||||
if (font) {
|
if (font) {
|
||||||
WMSetTextFieldFont(panel->sampleT, font);
|
WMSetTextFieldFont(panel->sampleT, font);
|
||||||
@@ -1027,14 +868,9 @@ familyClick(WMWidget *w, void *data)
|
|||||||
{
|
{
|
||||||
WMList *lPtr = (WMList*)w;
|
WMList *lPtr = (WMList*)w;
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
#ifdef XFT
|
|
||||||
Xft_Family *family;
|
|
||||||
Xft_Typeface *face;
|
|
||||||
#else
|
|
||||||
Family *family;
|
Family *family;
|
||||||
Typeface *face;
|
|
||||||
#endif
|
|
||||||
FontPanel *panel = (FontPanel*)data;
|
FontPanel *panel = (FontPanel*)data;
|
||||||
|
Typeface *face;
|
||||||
WMArrayIterator i;
|
WMArrayIterator i;
|
||||||
/* current typeface and size */
|
/* current typeface and size */
|
||||||
char *oface = NULL;
|
char *oface = NULL;
|
||||||
@@ -1051,11 +887,7 @@ familyClick(WMWidget *w, void *data)
|
|||||||
|
|
||||||
|
|
||||||
item = WMGetListSelectedItem(lPtr);
|
item = WMGetListSelectedItem(lPtr);
|
||||||
#ifdef XFT
|
|
||||||
family = (Xft_Family*)item->clientData;
|
|
||||||
#else
|
|
||||||
family = (Family*)item->clientData;
|
family = (Family*)item->clientData;
|
||||||
#endif
|
|
||||||
|
|
||||||
WMClearList(panel->typLs);
|
WMClearList(panel->typLs);
|
||||||
|
|
||||||
@@ -1065,13 +897,6 @@ familyClick(WMWidget *w, void *data)
|
|||||||
int top=0;
|
int top=0;
|
||||||
WMListItem *fitem;
|
WMListItem *fitem;
|
||||||
|
|
||||||
#ifdef XFT
|
|
||||||
strcpy(buffer, face->typeface);
|
|
||||||
if(strcasecmp(face->typeface, "Roman") == 0)
|
|
||||||
top = 1;
|
|
||||||
if(strcasecmp(face->typeface, "Regular") == 0)
|
|
||||||
top = 1;
|
|
||||||
#else
|
|
||||||
if (strcmp(face->weight, "medium") == 0) {
|
if (strcmp(face->weight, "medium") == 0) {
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -1102,7 +927,7 @@ familyClick(WMWidget *w, void *data)
|
|||||||
if (buffer[0] == 0) {
|
if (buffer[0] == 0) {
|
||||||
strcpy(buffer, _("Normal"));
|
strcpy(buffer, _("Normal"));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (top)
|
if (top)
|
||||||
fitem = WMInsertListItem(panel->typLs, 0, buffer);
|
fitem = WMInsertListItem(panel->typLs, 0, buffer);
|
||||||
else
|
else
|
||||||
@@ -1141,11 +966,7 @@ typefaceClick(WMWidget *w, void *data)
|
|||||||
{
|
{
|
||||||
FontPanel *panel = (FontPanel*)data;
|
FontPanel *panel = (FontPanel*)data;
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
#ifdef XFT
|
|
||||||
Xft_Typeface *face;
|
|
||||||
#else
|
|
||||||
Typeface *face;
|
Typeface *face;
|
||||||
#endif
|
|
||||||
WMArrayIterator i;
|
WMArrayIterator i;
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
|
|
||||||
@@ -1157,11 +978,7 @@ typefaceClick(WMWidget *w, void *data)
|
|||||||
|
|
||||||
|
|
||||||
item = WMGetListSelectedItem(panel->typLs);
|
item = WMGetListSelectedItem(panel->typLs);
|
||||||
#ifdef XFT
|
|
||||||
face = (Xft_Typeface*)item->clientData;
|
|
||||||
#else
|
|
||||||
face = (Typeface*)item->clientData;
|
face = (Typeface*)item->clientData;
|
||||||
#endif
|
|
||||||
|
|
||||||
WMClearList(panel->sizLs);
|
WMClearList(panel->sizLs);
|
||||||
|
|
||||||
@@ -1192,6 +1009,7 @@ typefaceClick(WMWidget *w, void *data)
|
|||||||
preview(panel);
|
preview(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sizeClick(WMWidget *w, void *data)
|
sizeClick(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
@@ -1199,6 +1017,7 @@ sizeClick(WMWidget *w, void *data)
|
|||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
|
|
||||||
item = WMGetListSelectedItem(panel->sizLs);
|
item = WMGetListSelectedItem(panel->sizLs);
|
||||||
|
|
||||||
WMSetTextFieldText(panel->sizT, item->text);
|
WMSetTextFieldText(panel->sizT, item->text);
|
||||||
|
|
||||||
WMSelectTextFieldRange(panel->sizT, wmkrange(0, strlen(item->text)));
|
WMSelectTextFieldRange(panel->sizT, wmkrange(0, strlen(item->text)));
|
||||||
@@ -1206,89 +1025,3 @@ sizeClick(WMWidget *w, void *data)
|
|||||||
preview(panel);
|
preview(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef XFT
|
|
||||||
static void
|
|
||||||
setFontPanelFontName(FontPanel *panel, FcChar8 *family, FcChar8 *style, double size)
|
|
||||||
{
|
|
||||||
int famrow;
|
|
||||||
int stlrow;
|
|
||||||
int sz;
|
|
||||||
char asize[64];
|
|
||||||
void *vsize;
|
|
||||||
WMListItem *item;
|
|
||||||
Xft_Family *fam;
|
|
||||||
Xft_Typeface *face;
|
|
||||||
WMArrayIterator i;
|
|
||||||
|
|
||||||
famrow = WMFindRowOfListItemWithTitle(panel->famLs, family);
|
|
||||||
if (famrow < 0 ){
|
|
||||||
famrow = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
WMSelectListItem(panel->famLs, famrow);
|
|
||||||
WMSetListPosition(panel->famLs, famrow);
|
|
||||||
|
|
||||||
WMClearList(panel->typLs);
|
|
||||||
|
|
||||||
item = WMGetListSelectedItem(panel->famLs);
|
|
||||||
|
|
||||||
fam = (Xft_Family*)item->clientData;
|
|
||||||
WM_ITERATE_ARRAY(fam->typefaces, face, i) {
|
|
||||||
char buffer[256];
|
|
||||||
int top=0;
|
|
||||||
WMListItem *fitem;
|
|
||||||
|
|
||||||
strcpy(buffer, face->typeface);
|
|
||||||
if(strcasecmp(face->typeface, "Roman") == 0)
|
|
||||||
top = 1;
|
|
||||||
if (top)
|
|
||||||
fitem = WMInsertListItem(panel->typLs, 0, buffer);
|
|
||||||
else
|
|
||||||
fitem = WMAddListItem(panel->typLs, buffer);
|
|
||||||
fitem->clientData = face;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
stlrow = WMFindRowOfListItemWithTitle(panel->typLs, style);
|
|
||||||
|
|
||||||
if (stlrow < 0) {
|
|
||||||
stlrow = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
WMSelectListItem(panel->typLs, stlrow);
|
|
||||||
|
|
||||||
item = WMGetListSelectedItem(panel->typLs);
|
|
||||||
|
|
||||||
face = (Xft_Typeface*)item->clientData;
|
|
||||||
|
|
||||||
WMClearList(panel->sizLs);
|
|
||||||
|
|
||||||
|
|
||||||
WM_ITERATE_ARRAY(face->sizes, vsize, i) {
|
|
||||||
char buffer[32];
|
|
||||||
if ((int)vsize != 0) {
|
|
||||||
sprintf(buffer, "%i", (int)vsize);
|
|
||||||
|
|
||||||
WMAddListItem(panel->sizLs, buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(asize, sizeof(asize)-1, "%d",(int)(size+0.5));
|
|
||||||
|
|
||||||
sz = WMFindRowOfListItemWithTitle(panel->sizLs, asize);
|
|
||||||
|
|
||||||
if (sz < 0) {
|
|
||||||
sz = 4;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
WMSelectListItem(panel->sizLs, sz);
|
|
||||||
sizeClick(panel->sizLs, panel);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,6 @@
|
|||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#include <X11/cursorfont.h>
|
#include <X11/cursorfont.h>
|
||||||
|
|
||||||
#include <X11/Xlocale.h>
|
|
||||||
|
|
||||||
/********** data ************/
|
/********** data ************/
|
||||||
|
|
||||||
|
|
||||||
@@ -593,7 +591,6 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
|||||||
"WM_STATE"
|
"WM_STATE"
|
||||||
};
|
};
|
||||||
Atom atoms[sizeof(atomNames)/sizeof(char*)];
|
Atom atoms[sizeof(atomNames)/sizeof(char*)];
|
||||||
char *locale;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
@@ -759,20 +756,16 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
|||||||
scrPtr->stipple = stipple;
|
scrPtr->stipple = stipple;
|
||||||
|
|
||||||
scrPtr->useMultiByte = WINGsConfiguration.useMultiByte;
|
scrPtr->useMultiByte = WINGsConfiguration.useMultiByte;
|
||||||
scrPtr->useMultiByte = 0;
|
|
||||||
|
|
||||||
locale = setlocale(LC_CTYPE, NULL);
|
|
||||||
//printf("LC_CTYPE=%s\n", locale);
|
|
||||||
if (!locale || strcmp(locale, "C")==0 || strcmp(locale, "POSIX")==0)
|
|
||||||
scrPtr->useWideChar = 0;
|
|
||||||
else
|
|
||||||
scrPtr->useWideChar = 1;
|
scrPtr->useWideChar = 1;
|
||||||
|
|
||||||
scrPtr->antialiasedText = WINGsConfiguration.antialiasedText;
|
scrPtr->antialiasedText = WINGsConfiguration.antialiasedText;
|
||||||
|
|
||||||
scrPtr->normalFont = WMSystemFontOfSize(scrPtr, 0);
|
scrPtr->normalFont = WMSystemFontOfSize(scrPtr,
|
||||||
|
WINGsConfiguration.defaultFontSize);
|
||||||
|
|
||||||
scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr, 0);
|
scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr,
|
||||||
|
WINGsConfiguration.defaultFontSize);
|
||||||
|
|
||||||
if (!scrPtr->boldFont)
|
if (!scrPtr->boldFont)
|
||||||
scrPtr->boldFont = scrPtr->normalFont;
|
scrPtr->boldFont = scrPtr->normalFont;
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ typedef struct W_ICContext {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Bool
|
Bool W_InitIMStuff(WMScreen *scr)
|
||||||
W_InitIMStuff(WMScreen *scr)
|
|
||||||
{
|
{
|
||||||
WMIMContext *ctx;
|
WMIMContext *ctx;
|
||||||
|
|
||||||
@@ -39,8 +38,7 @@ W_InitIMStuff(WMScreen *scr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void W_CloseIMStuff(WMScreen *scr)
|
||||||
W_CloseIMStuff(WMScreen *scr)
|
|
||||||
{
|
{
|
||||||
if (!scr->imctx)
|
if (!scr->imctx)
|
||||||
return;
|
return;
|
||||||
@@ -53,8 +51,7 @@ W_CloseIMStuff(WMScreen *scr)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
WMICContext*
|
WMICContext *W_CreateIC(WMView *view)
|
||||||
W_CreateIC(WMView *view)
|
|
||||||
{
|
{
|
||||||
WMScreen *scr = W_VIEW_SCREEN(view);
|
WMScreen *scr = W_VIEW_SCREEN(view);
|
||||||
WMICContext *ctx;
|
WMICContext *ctx;
|
||||||
@@ -63,12 +60,11 @@ W_CreateIC(WMView *view)
|
|||||||
ctx->next = scr->imctx->icList;
|
ctx->next = scr->imctx->icList;
|
||||||
if (scr->imctx->icList)
|
if (scr->imctx->icList)
|
||||||
scr->imctx->icList->prev = ctx;
|
scr->imctx->icList->prev = ctx;
|
||||||
//scr->imctx = ctx;
|
scr->imctx = ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void W_DestroyIC(WMICContext *ctx)
|
||||||
W_DestroyIC(WMICContext *ctx)
|
|
||||||
{
|
{
|
||||||
XDestroyIC(ctx->xic);
|
XDestroyIC(ctx->xic);
|
||||||
|
|
||||||
@@ -76,8 +72,7 @@ W_DestroyIC(WMICContext *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int W_LookupString(WMView *view, XKeyEvent *event,
|
||||||
W_LookupString(WMView *view, XKeyEvent *event,
|
|
||||||
char buffer, int bufsize, KeySym ksym)
|
char buffer, int bufsize, KeySym ksym)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ fitText(char *text, WMFont *font, int width, int wrap)
|
|||||||
i = j;
|
i = j;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//i = strcspn(text, "\n\r");
|
|
||||||
while (text[i]!='\n' && text[i]!=0)
|
while (text[i]!='\n' && text[i]!=0)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -309,6 +309,7 @@ paintArrow(WMScroller *sPtr, Drawable d, int part)
|
|||||||
|
|
||||||
|
|
||||||
if (sPtr->flags.horizontal) {
|
if (sPtr->flags.horizontal) {
|
||||||
|
|
||||||
/* paint button */
|
/* paint button */
|
||||||
#ifndef DOUBLE_BUFFER
|
#ifndef DOUBLE_BUFFER
|
||||||
XFillRectangle(scr->display, d, gc,
|
XFillRectangle(scr->display, d, gc,
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ createPanel(Panel *p)
|
|||||||
WMSetButtonText(panel->swi[7], _("Smooth font edges (needs restart)."));
|
WMSetButtonText(panel->swi[7], _("Smooth font edges (needs restart)."));
|
||||||
|
|
||||||
//if (!WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
|
//if (!WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
|
||||||
WMSetButtonEnabled(panel->swi[7], True);
|
WMSetButtonEnabled(panel->swi[7], False);
|
||||||
|
|
||||||
WMRealizeWidget(panel->box);
|
WMRealizeWidget(panel->box);
|
||||||
WMMapSubwidgets(panel->box);
|
WMMapSubwidgets(panel->box);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "WPrefs.h"
|
#include "WPrefs.h"
|
||||||
#include <X11/Xlocale.h>
|
#include <X11/Xlocale.h>
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
typedef struct _Panel {
|
typedef struct _Panel {
|
||||||
WMBox *box;
|
WMBox *box;
|
||||||
@@ -358,7 +358,7 @@ paintItems(WMScreen *scr, Drawable d, WMColor *color, WMFont *font,
|
|||||||
int l = strlen(text);
|
int l = strlen(text);
|
||||||
int x = previewPositions[part].pos.x;
|
int x = previewPositions[part].pos.x;
|
||||||
int y = previewPositions[part].pos.y;
|
int y = previewPositions[part].pos.y;
|
||||||
//int w = previewPositions[part].size.width;
|
int w = previewPositions[part].size.width;
|
||||||
int h = previewPositions[part].size.height/4;
|
int h = previewPositions[part].size.height/4;
|
||||||
int i;
|
int i;
|
||||||
for( i = 0; i < 4 ; i++) {
|
for( i = 0; i < 4 ; i++) {
|
||||||
@@ -443,7 +443,7 @@ dumpRImage(char *path, RImage *image)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static int
|
static int
|
||||||
isPixmap(WMPropList *prop)
|
isPixmap(WMPropList *prop)
|
||||||
{
|
{
|
||||||
WMPropList *p;
|
WMPropList *p;
|
||||||
@@ -455,7 +455,7 @@ isPixmap(WMPropList *prop)
|
|||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
static Pixmap
|
static Pixmap
|
||||||
renderTexture(WMScreen *scr, WMPropList *texture, int width, int height,
|
renderTexture(WMScreen *scr, WMPropList *texture, int width, int height,
|
||||||
@@ -669,7 +669,7 @@ renderMenu(_Panel *panel, WMPropList *texture, int width, int iheight)
|
|||||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||||
Display *dpy = WMScreenDisplay(scr);
|
Display *dpy = WMScreenDisplay(scr);
|
||||||
Pixmap pix, tmp;
|
Pixmap pix, tmp;
|
||||||
//RContext *rc = WMScreenRContext(scr);
|
RContext *rc = WMScreenRContext(scr);
|
||||||
GC gc = XCreateGC(dpy, WMWidgetXID(panel->parent), 0, NULL);
|
GC gc = XCreateGC(dpy, WMWidgetXID(panel->parent), 0, NULL);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -835,7 +835,7 @@ paintPreviewBox(Panel *panel, int elements)
|
|||||||
{
|
{
|
||||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||||
Display *dpy = WMScreenDisplay(scr);
|
Display *dpy = WMScreenDisplay(scr);
|
||||||
//int refresh = 0;
|
int refresh = 0;
|
||||||
GC gc;
|
GC gc;
|
||||||
WMColor *black = WMBlackColor(scr);
|
WMColor *black = WMBlackColor(scr);
|
||||||
Pixmap mitem;
|
Pixmap mitem;
|
||||||
@@ -926,7 +926,7 @@ static void
|
|||||||
paintTextField(void *data, int section)
|
paintTextField(void *data, int section)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
//char *sample = NULL;
|
char *sample = NULL;
|
||||||
int encoding;
|
int encoding;
|
||||||
encoding = WMGetPopUpButtonSelectedItem(panel->langP);
|
encoding = WMGetPopUpButtonSelectedItem(panel->langP);
|
||||||
WMSetTextFieldFont(panel->fontT, getFontForPreview(panel, section));
|
WMSetTextFieldFont(panel->fontT, getFontForPreview(panel, section));
|
||||||
@@ -1072,7 +1072,7 @@ refillFontSetList(void *data)
|
|||||||
char *encoding = getFontEncoding(panel);
|
char *encoding = getFontEncoding(panel);
|
||||||
int section = WMGetPopUpButtonSelectedItem(panel->fontSel);
|
int section = WMGetPopUpButtonSelectedItem(panel->fontSel);
|
||||||
int i;
|
int i;
|
||||||
//int pos;
|
int pos;
|
||||||
WMClearList(panel->fsetLs);
|
WMClearList(panel->fsetLs);
|
||||||
if(!encoding) {
|
if(!encoding) {
|
||||||
array = getCurrentFontProp(panel, section);
|
array = getCurrentFontProp(panel, section);
|
||||||
@@ -1259,7 +1259,7 @@ static void
|
|||||||
changeLanguageAction(WMWidget *w, void *data)
|
changeLanguageAction(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
Panel *panel = (Panel*)data;
|
Panel *panel = (Panel*)data;
|
||||||
//WMScreen *scr = WMWidgetScreen(panel->box);
|
WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
int section;
|
int section;
|
||||||
|
|
||||||
section = WMGetPopUpButtonSelectedItem(w);
|
section = WMGetPopUpButtonSelectedItem(w);
|
||||||
@@ -1314,7 +1314,7 @@ static char*
|
|||||||
getFontSampleString(void *data)
|
getFontSampleString(void *data)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
//WMScreen *scr = WMWidgetScreen(panel->box);
|
WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
WMMenuItem *mi;
|
WMMenuItem *mi;
|
||||||
WMPropList *pl;
|
WMPropList *pl;
|
||||||
int section;
|
int section;
|
||||||
@@ -1336,7 +1336,7 @@ static char*
|
|||||||
getFontEncoding(void *data)
|
getFontEncoding(void *data)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
//WMScreen *scr = WMWidgetScreen(panel->box);
|
WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
WMMenuItem *mi;
|
WMMenuItem *mi;
|
||||||
WMPropList *pl;
|
WMPropList *pl;
|
||||||
int section;
|
int section;
|
||||||
@@ -1358,7 +1358,7 @@ static Bool
|
|||||||
isEncodingMultiByte(void *data)
|
isEncodingMultiByte(void *data)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
//WMScreen *scr = WMWidgetScreen(panel->box);
|
WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
WMMenuItem *mi;
|
WMMenuItem *mi;
|
||||||
WMPropList *pl;
|
WMPropList *pl;
|
||||||
int section;
|
int section;
|
||||||
@@ -1473,19 +1473,25 @@ getDefaultSystemFont(void *data, int element)
|
|||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
WMScreen *scr = WMWidgetScreen(panel->box);
|
WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
|
|
||||||
switch(element) {
|
switch(element) {
|
||||||
case 0:
|
case 0:
|
||||||
case 2:
|
|
||||||
return WMBoldSystemFontOfSize(scr, 12);
|
return WMBoldSystemFontOfSize(scr, 12);
|
||||||
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
return WMBoldSystemFontOfSize(scr, 24);
|
return WMBoldSystemFontOfSize(scr, 24);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return WMBoldSystemFontOfSize(scr, 12);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
return WMSystemFontOfSize(scr, 12);
|
||||||
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
return WMSystemFontOfSize(scr, 8);
|
||||||
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
return WMSystemFontOfSize(scr, 8);
|
return WMSystemFontOfSize(scr, 8);
|
||||||
case 3:
|
break;
|
||||||
default:
|
|
||||||
return WMSystemFontOfSize(scr, 12);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1509,7 +1515,7 @@ static void
|
|||||||
toggleAA(WMWidget *w, void *data)
|
toggleAA(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)data;
|
_Panel *panel = (_Panel*)data;
|
||||||
//int section;
|
int section;
|
||||||
if(panel->AntialiasedText)
|
if(panel->AntialiasedText)
|
||||||
panel->AntialiasedText = False;
|
panel->AntialiasedText = False;
|
||||||
else
|
else
|
||||||
@@ -1616,7 +1622,7 @@ addButtonAction(WMWidget *w, void *data)
|
|||||||
array = getDefaultFontProp(panel, encoding, section);
|
array = getDefaultFontProp(panel, encoding, section);
|
||||||
|
|
||||||
WMHideFontPanel(panel->fontPanel);
|
WMHideFontPanel(panel->fontPanel);
|
||||||
chosenFont = WMGetFontName(WMGetFontPanelFont(panel->fontPanel));
|
chosenFont = WMGetFontPanelFontName(panel->fontPanel);
|
||||||
string = WMCreatePLString(chosenFont);
|
string = WMCreatePLString(chosenFont);
|
||||||
pos = WMGetListSelectedItemRow(panel->fsetLs);
|
pos = WMGetListSelectedItemRow(panel->fsetLs);
|
||||||
WMInsertListItem(panel->fsetLs, pos+1, chosenFont);
|
WMInsertListItem(panel->fsetLs, pos+1, chosenFont);
|
||||||
@@ -1645,7 +1651,7 @@ changeButtonAction(WMWidget *w, void *data)
|
|||||||
|
|
||||||
WMHideFontPanel(panel->fontPanel);
|
WMHideFontPanel(panel->fontPanel);
|
||||||
|
|
||||||
chosenFont = WMGetFontName(WMGetFontPanelFont(panel->fontPanel));
|
chosenFont = WMGetFontPanelFontName(panel->fontPanel);
|
||||||
string = WMCreatePLString(chosenFont);
|
string = WMCreatePLString(chosenFont);
|
||||||
|
|
||||||
pos = WMGetListSelectedItemRow(panel->fsetLs);
|
pos = WMGetListSelectedItemRow(panel->fsetLs);
|
||||||
@@ -1714,7 +1720,7 @@ removeButtonClick(WMWidget *w, void *data)
|
|||||||
static void
|
static void
|
||||||
showData(_Panel *panel)
|
showData(_Panel *panel)
|
||||||
{
|
{
|
||||||
//WMScreen *scr = WMWidgetScreen(panel->parent);
|
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||||
char *str;
|
char *str;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
@@ -42,9 +42,7 @@ WPrefs_SOURCES = \
|
|||||||
imagebrowser.h \
|
imagebrowser.h \
|
||||||
xmodifier.c
|
xmodifier.c
|
||||||
|
|
||||||
AM_CPPFLAGS = -DLOCALEDIR=\"$(NLSDIR)\"
|
AM_CPPFLAGS = @CPPFLAGS@ -DLOCALEDIR=\"$(NLSDIR)\"
|
||||||
|
|
||||||
AM_CFLAGS = -fno-strict-aliasing
|
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs @HEADER_SEARCH_PATH@
|
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs @HEADER_SEARCH_PATH@
|
||||||
|
|
||||||
|
|||||||
36
acinclude.m4
36
acinclude.m4
@@ -24,42 +24,6 @@ CPPFLAGS="$CPPFLAGS_old"
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl WM_CHECK_XFT_VERSION(MIN_VERSION, [ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])
|
|
||||||
dnl
|
|
||||||
dnl # $XFTFLAGS should be defined before calling this macro,
|
|
||||||
dnl # else it will not be able to find Xft.h
|
|
||||||
dnl
|
|
||||||
AC_DEFUN(WM_CHECK_XFT_VERSION,
|
|
||||||
[
|
|
||||||
CPPFLAGS_old="$CPPFLAGS"
|
|
||||||
CPPFLAGS="$CPPFLAGS $XFTFLAGS $inc_search_path"
|
|
||||||
xft_major_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
|
||||||
xft_minor_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
|
||||||
xft_micro_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
|
||||||
AC_MSG_CHECKING([whether libXft is at least version $1])
|
|
||||||
AC_CACHE_VAL(ac_cv_lib_xft_version_ok,
|
|
||||||
[AC_TRY_LINK(
|
|
||||||
[/* Test version of libXft we have */
|
|
||||||
#include <X11/Xft/Xft.h>
|
|
||||||
|
|
||||||
#if !defined(XFT_VERSION) || XFT_VERSION < $xft_major_version*10000 + $xft_minor_version*100 + $xft_micro_version
|
|
||||||
#error libXft on this system is too old. Consider upgrading to at least $1
|
|
||||||
#endif
|
|
||||||
], [],
|
|
||||||
eval "ac_cv_lib_xft_version_ok=yes",
|
|
||||||
eval "ac_cv_lib_xft_version_ok=no")])
|
|
||||||
if eval "test \"`echo '$ac_cv_lib_xft_version_ok'`\" = yes"; then
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
ifelse([$2], , :, [$2])
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
ifelse([$3], , , [$3])
|
|
||||||
fi
|
|
||||||
CPPFLAGS="$CPPFLAGS_old"
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl WM_CHECK_REDCRAP_BUGS(prefix,bindir,libdir)
|
dnl WM_CHECK_REDCRAP_BUGS(prefix,bindir,libdir)
|
||||||
dnl
|
dnl
|
||||||
|
|||||||
55
configure.ac
55
configure.ac
@@ -15,7 +15,7 @@ AC_INIT(src/WindowMaker.h)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE(WindowMaker, 0.85.0)
|
AM_INIT_AUTOMAKE(WindowMaker, 0.90.0)
|
||||||
|
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
|
|
||||||
@@ -519,54 +519,35 @@ fi
|
|||||||
|
|
||||||
dnl Xft antialiased font support
|
dnl Xft antialiased font support
|
||||||
dnl ============================
|
dnl ============================
|
||||||
|
|
||||||
xft=yes
|
xft=yes
|
||||||
XFTLIBS=""
|
XFTLIBS=""
|
||||||
|
AC_ARG_ENABLE(xft,
|
||||||
|
[ --disable-xft disable Xft antialiased font support],
|
||||||
|
xft=$enableval, xft=yes)
|
||||||
|
|
||||||
if test "x$PKGCONFIG" != x -a "`$PKGCONFIG xft; echo $?`" = 0; then
|
if test "$xft" = yes; then
|
||||||
|
if test "x$PKGCONFIG" != x -a "`$PKGCONFIG xft; echo $?`" = 0; then
|
||||||
XFTCONFIG="$PKGCONFIG xft"
|
XFTCONFIG="$PKGCONFIG xft"
|
||||||
pkgconfig_xft=yes
|
pkgconfig_xft=yes
|
||||||
else
|
else
|
||||||
AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
|
AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
|
||||||
fi
|
fi
|
||||||
|
AC_MSG_CHECKING([for the Xft2 library])
|
||||||
AC_MSG_CHECKING([for the Xft2 library])
|
if test "x$XFTCONFIG" != x; then
|
||||||
|
|
||||||
if test "x$XFTCONFIG" != x; then
|
|
||||||
XFTLIBS=`$XFTCONFIG --libs`
|
XFTLIBS=`$XFTCONFIG --libs`
|
||||||
XFTFLAGS=`$XFTCONFIG --cflags`
|
XFTFLAGS=`$XFTCONFIG --cflags`
|
||||||
AC_MSG_RESULT([found])
|
AC_MSG_RESULT([found])
|
||||||
else
|
else
|
||||||
|
xft=no
|
||||||
AC_MSG_RESULT([not found])
|
AC_MSG_RESULT([not found])
|
||||||
echo
|
fi
|
||||||
echo "ERROR!!! libXft2 is not installed or could not be found."
|
if test "$xft" = yes; then
|
||||||
echo " Xft2 is a requirement for building Window Maker."
|
AC_SUBST(XFTFLAGS)
|
||||||
echo " Please install it (along with fontconfig) before continuing."
|
AC_SUBST(XFTLIBS)
|
||||||
echo
|
AC_DEFINE(XFT, 1, [define if you want support for antialiased fonts (set by configure)])
|
||||||
exit 1
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
minXFT="2.1.2"
|
|
||||||
goodxft="no"
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl The macro below will use $XFTFLAGS (defined above) to find Xft.h
|
|
||||||
dnl
|
|
||||||
WM_CHECK_XFT_VERSION($minXFT, goodxft=yes, goodxft=no)
|
|
||||||
|
|
||||||
if test "$goodxft" = no; then
|
|
||||||
echo
|
|
||||||
echo "ERROR!!! libXft on this system is an old version."
|
|
||||||
echo " Please consider upgrading to at least version ${minXFT}."
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST(XFTFLAGS)
|
|
||||||
AC_SUBST(XFTLIBS)
|
|
||||||
AC_DEFINE(XFT, 1, [define if you want support for antialiased fonts (set by configure)])
|
|
||||||
|
|
||||||
|
|
||||||
dnl XINERAMA support
|
dnl XINERAMA support
|
||||||
dnl ================
|
dnl ================
|
||||||
xinerama=no
|
xinerama=no
|
||||||
|
|||||||
@@ -104,9 +104,7 @@ wmaker_SOURCES = \
|
|||||||
text.h
|
text.h
|
||||||
|
|
||||||
|
|
||||||
AM_CPPFLAGS = $(DFLAGS) -DLOCALEDIR=\"$(NLSDIR)\"
|
AM_CPPFLAGS = @CPPFLAGS@ $(DFLAGS) -DLOCALEDIR=\"$(NLSDIR)\"
|
||||||
|
|
||||||
AM_CFLAGS = -fno-strict-aliasing
|
|
||||||
|
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ setIconCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
result = wIconChooserDialog(scr, &file, icon->wm_instance, icon->wm_class);
|
result = wIconChooserDialog(scr, &file, icon->wm_instance, icon->wm_class);
|
||||||
|
|
||||||
if (result && !icon->destroyed) {
|
if (result && !icon->destroyed) {
|
||||||
if (file && *file==0) {
|
if (file[0]==0) {
|
||||||
wfree(file);
|
wfree(file);
|
||||||
file = NULL;
|
file = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,9 +198,7 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
if (hasModifier) {
|
if (hasModifier) {
|
||||||
keymap = XGetModifierMapping(dpy);
|
keymap = XGetModifierMapping(dpy);
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Grabbing keyboard\n");
|
|
||||||
#endif
|
|
||||||
XGrabKeyboard(dpy, scr->root_win, False, GrabModeAsync, GrabModeAsync,
|
XGrabKeyboard(dpy, scr->root_win, False, GrabModeAsync, GrabModeAsync,
|
||||||
CurrentTime);
|
CurrentTime);
|
||||||
}
|
}
|
||||||
@@ -225,6 +223,11 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
wWindowFocus(newFocused, scr->focused_window);
|
wWindowFocus(newFocused, scr->focused_window);
|
||||||
oldFocused = newFocused;
|
oldFocused = newFocused;
|
||||||
|
|
||||||
|
if (hasModifier)
|
||||||
|
done = False;
|
||||||
|
else
|
||||||
|
done = True;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (wPreferences.popup_switchmenu &&
|
if (wPreferences.popup_switchmenu &&
|
||||||
(!scr->switch_menu || !scr->switch_menu->flags.mapped)) {
|
(!scr->switch_menu || !scr->switch_menu->flags.mapped)) {
|
||||||
@@ -233,9 +236,8 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
openedSwitchMenu = True;
|
openedSwitchMenu = True;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
while (!done) {
|
||||||
while (hasModifier && !done) {
|
WMMaskEvent(dpy,KeyPressMask|KeyReleaseMask|ExposureMask, &ev);
|
||||||
WMMaskEvent(dpy, KeyPressMask|KeyReleaseMask|ExposureMask, &ev);
|
|
||||||
|
|
||||||
if (ev.type != KeyRelease && ev.type != KeyPress) {
|
if (ev.type != KeyRelease && ev.type != KeyPress) {
|
||||||
WMHandleEvent(&ev);
|
WMHandleEvent(&ev);
|
||||||
@@ -245,9 +247,6 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
modifiers = ev.xkey.state & ValidModMask;
|
modifiers = ev.xkey.state & ValidModMask;
|
||||||
|
|
||||||
if (ev.type == KeyPress) {
|
if (ev.type == KeyPress) {
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Got key press\n");
|
|
||||||
#endif
|
|
||||||
if (wKeyBindings[WKBD_FOCUSNEXT].keycode == ev.xkey.keycode
|
if (wKeyBindings[WKBD_FOCUSNEXT].keycode == ev.xkey.keycode
|
||||||
&& wKeyBindings[WKBD_FOCUSNEXT].modifier == modifiers) {
|
&& wKeyBindings[WKBD_FOCUSNEXT].modifier == modifiers) {
|
||||||
|
|
||||||
@@ -275,18 +274,12 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Got something else\n");
|
|
||||||
#endif
|
|
||||||
somethingElse = True;
|
somethingElse = True;
|
||||||
done = True;
|
done = True;
|
||||||
}
|
}
|
||||||
} else if (ev.type == KeyRelease) {
|
} else if (ev.type == KeyRelease) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Got key release\n");
|
|
||||||
#endif
|
|
||||||
for (i = 0; i < 8 * keymap->max_keypermod; i++) {
|
for (i = 0; i < 8 * keymap->max_keypermod; i++) {
|
||||||
if (keymap->modifiermap[i] == ev.xkey.keycode &&
|
if (keymap->modifiermap[i] == ev.xkey.keycode &&
|
||||||
wKeyBindings[WKBD_FOCUSNEXT].modifier
|
wKeyBindings[WKBD_FOCUSNEXT].modifier
|
||||||
@@ -301,9 +294,6 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
|
|||||||
XFreeModifiermap(keymap);
|
XFreeModifiermap(keymap);
|
||||||
|
|
||||||
if (hasModifier) {
|
if (hasModifier) {
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Ungrabbing keyboard\n");
|
|
||||||
#endif
|
|
||||||
XUngrabKeyboard(dpy, CurrentTime);
|
XUngrabKeyboard(dpy, CurrentTime);
|
||||||
}
|
}
|
||||||
wSetFocusTo(scr, newFocused);
|
wSetFocusTo(scr, newFocused);
|
||||||
|
|||||||
13
src/dialog.c
13
src/dialog.c
@@ -636,7 +636,6 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class)
|
|||||||
IconPanel *panel;
|
IconPanel *panel;
|
||||||
WMColor *color;
|
WMColor *color;
|
||||||
WMFont *boldFont;
|
WMFont *boldFont;
|
||||||
Bool result;
|
|
||||||
|
|
||||||
panel = wmalloc(sizeof(IconPanel));
|
panel = wmalloc(sizeof(IconPanel));
|
||||||
memset(panel, 0, sizeof(IconPanel));
|
memset(panel, 0, sizeof(IconPanel));
|
||||||
@@ -785,7 +784,7 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class)
|
|||||||
/* check if the file the user selected is not the one that
|
/* check if the file the user selected is not the one that
|
||||||
* would be loaded by default with the current search path */
|
* would be loaded by default with the current search path */
|
||||||
*file = WMGetListSelectedItem(panel->iconList)->text;
|
*file = WMGetListSelectedItem(panel->iconList)->text;
|
||||||
if (**file==0) {
|
if ((*file)[0]==0) {
|
||||||
wfree(*file);
|
wfree(*file);
|
||||||
*file = NULL;
|
*file = NULL;
|
||||||
} else {
|
} else {
|
||||||
@@ -804,8 +803,6 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class)
|
|||||||
*file = NULL;
|
*file = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = panel->result;
|
|
||||||
|
|
||||||
WMReleaseFont(panel->normalfont);
|
WMReleaseFont(panel->normalfont);
|
||||||
|
|
||||||
WMUnmapWidget(panel->win);
|
WMUnmapWidget(panel->win);
|
||||||
@@ -818,7 +815,7 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class)
|
|||||||
|
|
||||||
XDestroyWindow(dpy, parent);
|
XDestroyWindow(dpy, parent);
|
||||||
|
|
||||||
return result;
|
return panel->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -865,10 +862,6 @@ typedef struct {
|
|||||||
"Copyright \xa9 1997-2003 Alfredo K. Kojima <kojima@windowmaker.org>\n"\
|
"Copyright \xa9 1997-2003 Alfredo K. Kojima <kojima@windowmaker.org>\n"\
|
||||||
"Copyright \xa9 1998-2003 Dan Pascu <dan@windowmaker.org>"
|
"Copyright \xa9 1998-2003 Dan Pascu <dan@windowmaker.org>"
|
||||||
|
|
||||||
#define COPYRIGHT_TEXT_UTF8 \
|
|
||||||
"Copyright \xc2\xa9 1997-2003 Alfredo K. Kojima <kojima@windowmaker.org>\n"\
|
|
||||||
"Copyright \xc2\xa9 1998-2003 Dan Pascu <dan@windowmaker.org>"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static InfoPanel *thePanel = NULL;
|
static InfoPanel *thePanel = NULL;
|
||||||
@@ -1317,7 +1310,7 @@ wShowInfoPanel(WScreen *scr)
|
|||||||
WMResizeWidget(panel->copyrL, 360, 40);
|
WMResizeWidget(panel->copyrL, 360, 40);
|
||||||
WMMoveWidget(panel->copyrL, 15, 185);
|
WMMoveWidget(panel->copyrL, 15, 185);
|
||||||
WMSetLabelTextAlignment(panel->copyrL, WALeft);
|
WMSetLabelTextAlignment(panel->copyrL, WALeft);
|
||||||
WMSetLabelText(panel->copyrL, COPYRIGHT_TEXT_UTF8);
|
WMSetLabelText(panel->copyrL, COPYRIGHT_TEXT);
|
||||||
/* we want the (c) character in the font, so don't use a FontSet here */
|
/* we want the (c) character in the font, so don't use a FontSet here */
|
||||||
// fix this -Dan font = WMCreateFontWithFlags(scr->wmscreen, "SystemFont-11", WFNormalFont);
|
// fix this -Dan font = WMCreateFontWithFlags(scr->wmscreen, "SystemFont-11", WFNormalFont);
|
||||||
font = WMSystemFontOfSize(scr->wmscreen, 11);
|
font = WMSystemFontOfSize(scr->wmscreen, 11);
|
||||||
|
|||||||
24
src/event.c
24
src/event.c
@@ -478,7 +478,7 @@ handleMapRequest(XEvent *ev)
|
|||||||
Window window = ev->xmaprequest.window;
|
Window window = ev->xmaprequest.window;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("got map request for %x\n", (unsigned)window);
|
L("got map request for %x\n", (unsigned)window);
|
||||||
#endif
|
#endif
|
||||||
if ((wwin = wWindowFor(window))) {
|
if ((wwin = wWindowFor(window))) {
|
||||||
if (wwin->flags.shaded) {
|
if (wwin->flags.shaded) {
|
||||||
@@ -553,7 +553,7 @@ handleDestroyNotify(XEvent *event)
|
|||||||
int index;
|
int index;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("got destroy notify\n");
|
L("got destroy notify");
|
||||||
#endif
|
#endif
|
||||||
wwin = wWindowFor(window);
|
wwin = wWindowFor(window);
|
||||||
if (wwin) {
|
if (wwin) {
|
||||||
@@ -607,7 +607,7 @@ handleExpose(XEvent *event)
|
|||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("got expose\n");
|
L("got expose");
|
||||||
#endif
|
#endif
|
||||||
while (XCheckTypedWindowEvent(dpy, event->xexpose.window, Expose, &ev));
|
while (XCheckTypedWindowEvent(dpy, event->xexpose.window, Expose, &ev));
|
||||||
|
|
||||||
@@ -662,7 +662,7 @@ handleButtonPress(XEvent *event)
|
|||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("got button press\n");
|
L("got button press");
|
||||||
#endif
|
#endif
|
||||||
scr = wScreenForRootWindow(event->xbutton.root);
|
scr = wScreenForRootWindow(event->xbutton.root);
|
||||||
|
|
||||||
@@ -749,7 +749,7 @@ handleMapNotify(XEvent *event)
|
|||||||
{
|
{
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("got map\n");
|
L("got map");
|
||||||
#endif
|
#endif
|
||||||
wwin = wWindowFor(event->xmap.event);
|
wwin = wWindowFor(event->xmap.event);
|
||||||
if (wwin && wwin->client_win == event->xmap.event) {
|
if (wwin && wwin->client_win == event->xmap.event) {
|
||||||
@@ -772,7 +772,7 @@ handleUnmapNotify(XEvent *event)
|
|||||||
XEvent ev;
|
XEvent ev;
|
||||||
Bool withdraw = False;
|
Bool withdraw = False;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("got unmap\n");
|
L("got unmap");
|
||||||
#endif
|
#endif
|
||||||
/* only process windows with StructureNotify selected
|
/* only process windows with StructureNotify selected
|
||||||
* (ignore SubstructureNotify) */
|
* (ignore SubstructureNotify) */
|
||||||
@@ -824,7 +824,7 @@ handleConfigureRequest(XEvent *event)
|
|||||||
{
|
{
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("got configure request\n");
|
L("got configure request");
|
||||||
#endif
|
#endif
|
||||||
if (!(wwin=wWindowFor(event->xconfigurerequest.window))) {
|
if (!(wwin=wWindowFor(event->xconfigurerequest.window))) {
|
||||||
/*
|
/*
|
||||||
@@ -847,7 +847,7 @@ handlePropertyNotify(XEvent *event)
|
|||||||
unsigned int ju;
|
unsigned int ju;
|
||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("got property notify\n");
|
L("got property notify");
|
||||||
#endif
|
#endif
|
||||||
if ((wwin=wWindowFor(event->xproperty.window))) {
|
if ((wwin=wWindowFor(event->xproperty.window))) {
|
||||||
if (!XGetGeometry(dpy, wwin->client_win, &jr, &ji, &ji,
|
if (!XGetGeometry(dpy, wwin->client_win, &jr, &ji, &ji,
|
||||||
@@ -876,7 +876,7 @@ handleClientMessage(XEvent *event)
|
|||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
WObjDescriptor *desc;
|
WObjDescriptor *desc;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("got client message\n");
|
L("got client message");
|
||||||
#endif
|
#endif
|
||||||
/* handle transition from Normal to Iconic state */
|
/* handle transition from Normal to Iconic state */
|
||||||
if (event->xclient.message_type == _XA_WM_CHANGE_STATE
|
if (event->xclient.message_type == _XA_WM_CHANGE_STATE
|
||||||
@@ -1038,7 +1038,7 @@ handleEnterNotify(XEvent *event)
|
|||||||
XEvent ev;
|
XEvent ev;
|
||||||
WScreen *scr = wScreenForRootWindow(event->xcrossing.root);
|
WScreen *scr = wScreenForRootWindow(event->xcrossing.root);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("got enter notify\n");
|
L("got enter notify");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
@@ -1178,7 +1178,7 @@ handleShapeNotify(XEvent *event)
|
|||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("got shape notify\n");
|
L("got shape notify");
|
||||||
#endif
|
#endif
|
||||||
while (XCheckTypedWindowEvent(dpy, shev->window, event->type, &ev)) {
|
while (XCheckTypedWindowEvent(dpy, shev->window, event->type, &ev)) {
|
||||||
XShapeEvent *sev = (XShapeEvent*)&ev;
|
XShapeEvent *sev = (XShapeEvent*)&ev;
|
||||||
@@ -1739,7 +1739,7 @@ handleMotionNotify(XEvent *event)
|
|||||||
p.y >= (rect.pos.y + rect.size.height - 2)) {
|
p.y >= (rect.pos.y + rect.size.height - 2)) {
|
||||||
WMenu *menu;
|
WMenu *menu;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("pointer at screen edge\n");
|
L("pointer at screen edge");
|
||||||
#endif
|
#endif
|
||||||
menu = wMenuUnderPointer(scr);
|
menu = wMenuUnderPointer(scr);
|
||||||
if (menu!=NULL)
|
if (menu!=NULL)
|
||||||
|
|||||||
@@ -717,15 +717,12 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Locale) {
|
if (!Locale) {
|
||||||
/* return of wstrconcat should not be free-ed! read putenv man page */
|
|
||||||
putenv(wstrconcat("LANG=", Locale));
|
|
||||||
} else {
|
|
||||||
Locale = getenv("LC_ALL");
|
Locale = getenv("LC_ALL");
|
||||||
|
}
|
||||||
if (!Locale) {
|
if (!Locale) {
|
||||||
Locale = getenv("LANG");
|
Locale = getenv("LANG");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
|
|||||||
unsigned int width, unsigned int height,
|
unsigned int width, unsigned int height,
|
||||||
WArea usableArea)
|
WArea usableArea)
|
||||||
{
|
{
|
||||||
//WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
int test_x = 0, test_y = Y_ORIGIN(scr);
|
int test_x = 0, test_y = Y_ORIGIN(scr);
|
||||||
int from_x, to_x, from_y, to_y;
|
int from_x, to_x, from_y, to_y;
|
||||||
int sx;
|
int sx;
|
||||||
|
|||||||
19
src/text.c
19
src/text.c
@@ -28,7 +28,6 @@
|
|||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "WindowMaker.h"
|
#include "WindowMaker.h"
|
||||||
@@ -43,14 +42,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if 0
|
||||||
# define ENTER(X) fprintf(stderr,"Entering: %s()\n", X);
|
# define ENTER(X) fprintf(stderr,"Entering: %s()\n", X);
|
||||||
# define LEAVE(X) fprintf(stderr,"Leaving: %s()\n", X);
|
# define LEAVE(X) fprintf(stderr,"Leaving: %s()\n", X);
|
||||||
# define PDEBUG(X) fprintf(stderr,"debug: %s()\n", X);
|
# define DEBUG(X) fprintf(stderr,"debug: %s()\n", X);
|
||||||
#else
|
#else
|
||||||
# define ENTER(X)
|
# define ENTER(X)
|
||||||
# define LEAVE(X)
|
# define LEAVE(X)
|
||||||
# define PDEBUG(X)
|
# define DEBUG(X)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern Cursor wCursor[WCUR_LAST];
|
extern Cursor wCursor[WCUR_LAST];
|
||||||
@@ -583,32 +582,32 @@ textEventHandler( WObjDescriptor *desc, XEvent *event )
|
|||||||
* text so we can wTextRefresh() */
|
* text so we can wTextRefresh() */
|
||||||
if( event->xmotion.state & (Button1Mask|Button3Mask|Button2Mask) )
|
if( event->xmotion.state & (Button1Mask|Button3Mask|Button2Mask) )
|
||||||
{
|
{
|
||||||
PDEBUG("MotionNotify");
|
DEBUG("MotionNotify");
|
||||||
handled = True;
|
handled = True;
|
||||||
wtext->text.endPos = textXtoPos( wtext, event->xmotion.x );
|
wtext->text.endPos = textXtoPos( wtext, event->xmotion.x );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
PDEBUG("ButtonPress");
|
DEBUG("ButtonPress");
|
||||||
handled = True;
|
handled = True;
|
||||||
wtext->text.startPos = textXtoPos( wtext, event->xbutton.x );
|
wtext->text.startPos = textXtoPos( wtext, event->xbutton.x );
|
||||||
wtext->text.endPos = wtext->text.startPos;
|
wtext->text.endPos = wtext->text.startPos;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
PDEBUG("ButtonRelease");
|
DEBUG("ButtonRelease");
|
||||||
handled = True;
|
handled = True;
|
||||||
wtext->text.endPos = textXtoPos( wtext, event->xbutton.x );
|
wtext->text.endPos = textXtoPos( wtext, event->xbutton.x );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
PDEBUG("KeyPress");
|
DEBUG("KeyPress");
|
||||||
handled = handleKeyPress( wtext, &event->xkey );
|
handled = handleKeyPress( wtext, &event->xkey );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
PDEBUG("EnterNotify");
|
DEBUG("EnterNotify");
|
||||||
handled = True;
|
handled = True;
|
||||||
#if 0
|
#if 0
|
||||||
if (!wtext->magic)
|
if (!wtext->magic)
|
||||||
@@ -622,7 +621,7 @@ textEventHandler( WObjDescriptor *desc, XEvent *event )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LeaveNotify:
|
case LeaveNotify:
|
||||||
PDEBUG("LeaveNotify");
|
DEBUG("LeaveNotify");
|
||||||
handled = True;
|
handled = True;
|
||||||
#if 0
|
#if 0
|
||||||
wtext->blinking = 0;
|
wtext->blinking = 0;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void wXDNDMakeAwareness(Window window) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wXDNDClearAwareness(Window window) {
|
void wXDNDClearAwareness(Window window) {
|
||||||
//long int xdnd_version = 3;
|
long int xdnd_version = 3;
|
||||||
XDeleteProperty (dpy, window, _XA_XdndAware);
|
XDeleteProperty (dpy, window, _XA_XdndAware);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "wconfig.h"
|
#include "wconfig.h"
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
|
|||||||
@@ -3,10 +3,9 @@ AUTOMAKE_OPTIONS = no-dependencies
|
|||||||
|
|
||||||
pkgdatadir = $(datadir)/@PACKAGE@
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
|
||||||
bin_PROGRAMS = wxcopy wxpaste wdwrite wdread getstyle setstyle convertfonts \
|
bin_PROGRAMS = wxcopy wxpaste wdwrite wdread getstyle setstyle seticons geticonset wmsetbg wmsetup wmagnify
|
||||||
seticons geticonset wmsetbg wmsetup wmagnify
|
|
||||||
|
|
||||||
bin_SCRIPTS = wmaker.inst wm-oldmenu2new wsetfont wmchlocale wkdemenu.pl \
|
bin_SCRIPTS = wmaker.inst wm-oldmenu2new wsetfont wmchlocale wkdemenu.pl\
|
||||||
wcopy wpaste
|
wcopy wpaste
|
||||||
|
|
||||||
EXTRA_DIST = wmaker.inst.in bughint wm-oldmenu2new wsetfont directjpeg.c \
|
EXTRA_DIST = wmaker.inst.in bughint wm-oldmenu2new wsetfont directjpeg.c \
|
||||||
@@ -32,8 +31,6 @@ setstyle_LDADD = \
|
|||||||
$(top_builddir)/WINGs/libWUtil.a \
|
$(top_builddir)/WINGs/libWUtil.a \
|
||||||
@XLFLAGS@ @XLIBS@ $(liblist)
|
@XLFLAGS@ @XLIBS@ $(liblist)
|
||||||
|
|
||||||
convertfonts_LDADD = $(top_builddir)/WINGs/libWUtil.a $(liblist)
|
|
||||||
|
|
||||||
seticons_LDADD= $(top_builddir)/WINGs/libWUtil.a $(liblist)
|
seticons_LDADD= $(top_builddir)/WINGs/libWUtil.a $(liblist)
|
||||||
|
|
||||||
geticonset_LDADD= $(top_builddir)/WINGs/libWUtil.a $(liblist)
|
geticonset_LDADD= $(top_builddir)/WINGs/libWUtil.a $(liblist)
|
||||||
|
|||||||
@@ -1,317 +0,0 @@
|
|||||||
/* convertfonts.c - converts fonts in a style file to fontconfig format
|
|
||||||
*
|
|
||||||
* WindowMaker window manager
|
|
||||||
*
|
|
||||||
* Copyright (c) 2004 Dan Pascu
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
||||||
* USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#define PROG_VERSION "convertfonts (Window Maker) 1.0"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <WINGs/WUtil.h>
|
|
||||||
|
|
||||||
#include "../src/wconfig.h"
|
|
||||||
|
|
||||||
#define DEFAULT_FONT "sans-serif:pixelsize=12"
|
|
||||||
|
|
||||||
char *FontOptions[] = {
|
|
||||||
"IconTitleFont",
|
|
||||||
"ClipTitleFont",
|
|
||||||
"DisplayFont",
|
|
||||||
"LargeDisplayFont",
|
|
||||||
"MenuTextFont",
|
|
||||||
"MenuTitleFont",
|
|
||||||
"WindowTitleFont",
|
|
||||||
"SystemFont",
|
|
||||||
"BoldSystemFont",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
print_help()
|
|
||||||
{
|
|
||||||
printf("\nUsage: %s <style_file>\n\n", ProgName);
|
|
||||||
puts("Converts fonts in a style file into fontconfig format");
|
|
||||||
puts("");
|
|
||||||
puts(" --help display this help and exit");
|
|
||||||
puts(" --version output version information and exit");
|
|
||||||
puts(" --keep-xlfd preserve the original xlfd by appending a ':xlfd=<xlfd>' hint");
|
|
||||||
puts(" to the font name. This property is not used by the fontconfig");
|
|
||||||
puts(" matching engine to find the font, but it is useful as a hint");
|
|
||||||
puts(" about what the original font was to allow hand tuning the");
|
|
||||||
puts(" result or restoring the xlfd. The default is to not add it");
|
|
||||||
puts(" as it results in long, unreadable and confusing names.");
|
|
||||||
puts(" --sets-too try to approximate fontsets by using their first complete xlfd.");
|
|
||||||
puts(" This only works for singlebyte languages. The default is to");
|
|
||||||
puts(" replace the fontset with the default: 'sans-serif:pixelsize=12'");
|
|
||||||
puts(" which should display properly for any language.");
|
|
||||||
puts("");
|
|
||||||
}
|
|
||||||
|
|
||||||
// replace --sets-too with something better
|
|
||||||
int
|
|
||||||
main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
WMPropList *style, *key, *val;
|
|
||||||
char *file = NULL, *oldfont, *newfont;
|
|
||||||
struct stat statbuf;
|
|
||||||
Bool keepXLFD = False;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
ProgName = argv[0];
|
|
||||||
|
|
||||||
if (argc<2) {
|
|
||||||
print_help();
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=1; i < argc; i++) {
|
|
||||||
if (strcmp("--version", argv[i])==0) {
|
|
||||||
puts(PROG_VERSION);
|
|
||||||
exit(0);
|
|
||||||
} else if (strcmp("--help", argv[i])==0) {
|
|
||||||
print_help();
|
|
||||||
exit(0);
|
|
||||||
} else if (strcmp("--keep-xlfd", argv[i])==0) {
|
|
||||||
keepXLFD = True;;
|
|
||||||
} else if (argv[i][0]=='-') {
|
|
||||||
printf("%s: invalid argument '%s'\n", ProgName, argv[i]);
|
|
||||||
printf("Try '%s --help' for more information\n", ProgName);
|
|
||||||
exit(1);
|
|
||||||
} else {
|
|
||||||
file = argv[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WMPLSetCaseSensitive(False);
|
|
||||||
|
|
||||||
if (stat(file, &statbuf) < 0) {
|
|
||||||
perror(file);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
style = WMReadPropListFromFile(file);
|
|
||||||
if (!style) {
|
|
||||||
perror(file);
|
|
||||||
printf("%s: could not load style file.\n", ProgName);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!WMIsPLDictionary(style)) {
|
|
||||||
printf("%s: '%s' is not a well formatted style file\n", ProgName, file);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0; FontOptions[i]!=NULL; i++) {
|
|
||||||
key = WMCreatePLString(FontOptions[i]);
|
|
||||||
val = WMGetFromPLDictionary(style, key);
|
|
||||||
if (val) {
|
|
||||||
oldfont = WMGetFromPLString(val);
|
|
||||||
newfont = convertFont(oldfont, keepXLFD);
|
|
||||||
if (oldfont != newfont) {
|
|
||||||
val = WMCreatePLString(newfont);
|
|
||||||
WMPutInPLDictionary(style, key, val);
|
|
||||||
WMReleasePropList(val);
|
|
||||||
wfree(newfont);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
WMReleasePropList(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
WMWritePropListToFile(style, file, True);
|
|
||||||
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -589,7 +589,7 @@ findCopyFile(char *dir, char *file)
|
|||||||
if (!fullPath) {
|
if (!fullPath) {
|
||||||
char buffer[4000];
|
char buffer[4000];
|
||||||
|
|
||||||
sprintf(buffer, "could not find file %s", file);
|
sprintf(buffer, "coould not find file %s", file);
|
||||||
abortar(buffer);
|
abortar(buffer);
|
||||||
}
|
}
|
||||||
copyFile(dir, fullPath);
|
copyFile(dir, fullPath);
|
||||||
@@ -776,7 +776,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
oldfont = WMGetFromPLString(val);
|
oldfont = WMGetFromPLString(val);
|
||||||
newfont = convertFont(oldfont);
|
newfont = convertFont(oldfont);
|
||||||
/* newfont is a reference to old if conversion is not needed */
|
/* font is a reference to old if conversion is not needed */
|
||||||
if (newfont != oldfont) {
|
if (newfont != oldfont) {
|
||||||
WMReleasePropList(val);
|
WMReleasePropList(val);
|
||||||
val = WMCreatePLString(newfont);
|
val = WMCreatePLString(newfont);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include <WINGs/WINGs.h>
|
#include <WINGs/WINGs.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ parseTexture(RContext *rc, char *text)
|
|||||||
XColor color;
|
XColor color;
|
||||||
Pixmap pixmap = None;
|
Pixmap pixmap = None;
|
||||||
RImage *image = NULL;
|
RImage *image = NULL;
|
||||||
//int w, h;
|
int w, h;
|
||||||
int iwidth, iheight;
|
int iwidth, iheight;
|
||||||
RColor rcolor;
|
RColor rcolor;
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "WMaker.h"
|
#include "WMaker.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|||||||
@@ -678,8 +678,7 @@ image2StandardPseudoColor(RContext *ctx, RImage *image)
|
|||||||
int x1, ofs;
|
int x1, ofs;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("pseudo color dithering with %d colors per channel\n",
|
printf("pseudo color dithering with %d colors per channel\n", cpc);
|
||||||
ctx->attribs->colors_per_channel);
|
|
||||||
#endif
|
#endif
|
||||||
err = (short*)malloc(3*(image->width+2)*sizeof(short));
|
err = (short*)malloc(3*(image->width+2)*sizeof(short));
|
||||||
nerr = (short*)malloc(3*(image->width+2)*sizeof(short));
|
nerr = (short*)malloc(3*(image->width+2)*sizeof(short));
|
||||||
|
|||||||
Reference in New Issue
Block a user