mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
added a runtime disabling of multibyte text support
This commit is contained in:
@@ -39,6 +39,8 @@ changes since wmaker 0.53.0:
|
||||
- added WMGetColorPanelColor(WMColorPanel *panel)
|
||||
- made WMGetUDStringForKey() to only return a reference to the string, not a
|
||||
wstrdup()'ed copy. DO NOT FREE IT ANYMORE!
|
||||
- added MultiByteText option to userdefaults file to control use of multibyte
|
||||
string drawing functions
|
||||
|
||||
|
||||
changes since wmaker 0.52.0:
|
||||
|
||||
@@ -162,6 +162,7 @@ typedef struct W_Screen {
|
||||
|
||||
WMHashTable *fontCache;
|
||||
|
||||
Bool useMultiByte;
|
||||
|
||||
struct W_Balloon *balloon;
|
||||
|
||||
@@ -331,6 +332,7 @@ typedef struct W_EventHandler {
|
||||
typedef struct _WINGsConfiguration {
|
||||
char *systemFont;
|
||||
char *boldSystemFont;
|
||||
Bool useMultiByte;
|
||||
unsigned doubleClickDelay;
|
||||
} _WINGsConfiguration;
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ W_ReadConfigurations(void)
|
||||
WINGsConfiguration.boldSystemFont =
|
||||
WMGetUDStringForKey(defaults, "BoldSystemFont");
|
||||
|
||||
WINGsConfiguration.useMultiByte =
|
||||
WMGetUDStringForKey(defaults, "MultiByteText");
|
||||
|
||||
WINGsConfiguration.doubleClickDelay =
|
||||
WMGetUDIntegerForKey(defaults, "DoubleClickTime");
|
||||
}
|
||||
|
||||
@@ -101,6 +101,8 @@ WMCreateFontInDefaultEncoding(WMScreen *scrPtr, char *fontName)
|
||||
|
||||
font->refCount = 1;
|
||||
|
||||
font->name = wstrdup(fontName);
|
||||
|
||||
assert(WMHashInsert(scrPtr->fontCache, font->name, font)==NULL);
|
||||
|
||||
return font;
|
||||
@@ -159,13 +161,21 @@ WMSystemFontOfSize(WMScreen *scrPtr, int size)
|
||||
|
||||
fontSpec = makeFontSetOfSize(WINGsConfiguration.systemFont, size);
|
||||
|
||||
font = WMCreateFont(scrPtr, fontSpec);
|
||||
if (WINGsConfiguration.useMultiByte)
|
||||
font = WMCreateFont(scrPtr, fontSpec);
|
||||
else
|
||||
font = WMCreateFontInDefaultEncoding(scrPtr, fontSpec);
|
||||
|
||||
if (!font) {
|
||||
wwarning("could not load font set %s. Trying fixed.", fontSpec);
|
||||
font = WMCreateFont(scrPtr, "fixed");
|
||||
if (!font) {
|
||||
font = WMCreateFont(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
|
||||
if (WINGsConfiguration.useMultiByte) {
|
||||
wwarning("could not load font set %s. Trying fixed.", fontSpec);
|
||||
font = WMCreateFont(scrPtr, "fixed");
|
||||
if (!font) {
|
||||
font = WMCreateFont(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
|
||||
}
|
||||
} else {
|
||||
wwarning("could not load font %s. Trying fixed.", fontSpec);
|
||||
font = WMCreateFontInDefaultEncoding(scrPtr, "fixed");
|
||||
}
|
||||
if (!font) {
|
||||
wwarning("could not load fixed font!");
|
||||
@@ -187,13 +197,21 @@ WMBoldSystemFontOfSize(WMScreen *scrPtr, int size)
|
||||
|
||||
fontSpec = makeFontSetOfSize(WINGsConfiguration.boldSystemFont, size);
|
||||
|
||||
font = WMCreateFont(scrPtr, fontSpec);
|
||||
if (WINGsConfiguration.useMultiByte)
|
||||
font = WMCreateFont(scrPtr, fontSpec);
|
||||
else
|
||||
font = WMCreateFontInDefaultEncoding(scrPtr, fontSpec);
|
||||
|
||||
if (!font) {
|
||||
wwarning("could not load font set %s. Trying fixed.", fontSpec);
|
||||
font = WMCreateFont(scrPtr, "fixed");
|
||||
if (!font) {
|
||||
font = WMCreateFont(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
|
||||
if (WINGsConfiguration.useMultiByte) {
|
||||
wwarning("could not load font set %s. Trying fixed.", fontSpec);
|
||||
font = WMCreateFont(scrPtr, "fixed");
|
||||
if (!font) {
|
||||
font = WMCreateFont(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
|
||||
}
|
||||
} else {
|
||||
wwarning("could not load font %s. Trying fixed.", fontSpec);
|
||||
font = WMCreateFontInDefaultEncoding(scrPtr, "fixed");
|
||||
}
|
||||
if (!font) {
|
||||
wwarning("could not load fixed font!");
|
||||
|
||||
@@ -596,6 +596,8 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
||||
|
||||
scrPtr->stipple = stipple;
|
||||
|
||||
scrPtr->useMultiByte = WINGsConfiguration.useMultiByte;
|
||||
|
||||
scrPtr->normalFont = WMSystemFontOfSize(scrPtr, 12);
|
||||
|
||||
scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr, 12);
|
||||
|
||||
@@ -154,7 +154,7 @@ testGradientButtons(WMScreen *scr)
|
||||
WMSetButtonAltImage(btn, pix2);
|
||||
WMSetButtonText(btn, "Button");
|
||||
|
||||
WMSetBalloonTextForView("This is another button", WMWidgetView(btn));
|
||||
WMSetBalloonTextForView("Este é outro balão.", WMWidgetView(btn));
|
||||
|
||||
btn = WMCreateButton(win, WBTMomentaryChange);
|
||||
WMResizeWidget(btn, 60, 24);
|
||||
@@ -486,14 +486,14 @@ int main(int argc, char **argv)
|
||||
* Put the testSomething() function you want to test here.
|
||||
*/
|
||||
|
||||
testGradientButtons(scr);
|
||||
|
||||
|
||||
testColorWell(scr);
|
||||
#if 0
|
||||
testColorWell(scr);
|
||||
|
||||
testTabView(scr);
|
||||
testTextField(scr);
|
||||
testGradientButtons(scr);
|
||||
|
||||
testOpenFilePanel(scr);
|
||||
testFontPanel(scr);
|
||||
|
||||
Reference in New Issue
Block a user