summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2011-06-27 12:46:55 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2011-06-27 12:46:55 +0000
commit4382c9f97a90911d5a3de4861426c49f453e1969 (patch)
tree80cfeaa2bd71d4f29ad6a5f919175d2101d4b1bf /app
parent12020040901fda226664a9de7097a7417e3616c1 (diff)
UTF8-ify, from Alexander Polakov, but without setlocale(), after
feedback from stsp@ - thanks! 'go for it' oga@
Diffstat (limited to 'app')
-rw-r--r--app/cwm/font.c7
-rw-r--r--app/cwm/menu.c12
2 files changed, 9 insertions, 10 deletions
diff --git a/app/cwm/font.c b/app/cwm/font.c
index 20075f910..1aa19cb3f 100644
--- a/app/cwm/font.c
+++ b/app/cwm/font.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: font.c,v 1.15 2011/06/24 05:45:57 okan Exp $
+ * $OpenBSD: font.c,v 1.16 2011/06/27 12:46:54 okan Exp $
*/
#include <sys/param.h>
@@ -66,7 +66,7 @@ font_width(struct screen_ctx *sc, const char *text, int len)
{
XGlyphInfo extents;
- XftTextExtents8(X_Dpy, sc->font, (const XftChar8*)text,
+ XftTextExtentsUtf8(X_Dpy, sc->font, (const FcChar8*)text,
len, &extents);
return (extents.xOff);
@@ -77,8 +77,7 @@ font_draw(struct screen_ctx *sc, const char *text, int len,
Drawable d, int x, int y)
{
XftDrawChange(sc->xftdraw, d);
- /* Really needs to be UTF8'd. */
- XftDrawString8(sc->xftdraw, &sc->xftcolor, sc->font, x, y,
+ XftDrawStringUtf8(sc->xftdraw, &sc->xftcolor, sc->font, x, y,
(const FcChar8*)text, len);
}
diff --git a/app/cwm/menu.c b/app/cwm/menu.c
index 798710002..13d097c76 100644
--- a/app/cwm/menu.c
+++ b/app/cwm/menu.c
@@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: menu.c,v 1.28 2011/06/24 06:52:23 okan Exp $
+ * $OpenBSD: menu.c,v 1.29 2011/06/27 12:46:54 okan Exp $
*/
#include <sys/param.h>
@@ -31,8 +31,8 @@
#include "calmwm.h"
-#define PROMPT_SCHAR '»'
-#define PROMPT_ECHAR '«'
+#define PROMPT_SCHAR "\xc2\xbb"
+#define PROMPT_ECHAR "\xc2\xab"
enum ctltype {
CTL_NONE = -1,
@@ -118,9 +118,9 @@ menu_filter(struct screen_ctx *sc, struct menu_q *menuq, char *prompt,
mc.list = 1;
} else {
evmask = MenuMask | KeyMask; /* only accept keys if prompt */
- snprintf(mc.promptstr, sizeof(mc.promptstr), "%s%c", prompt,
+ snprintf(mc.promptstr, sizeof(mc.promptstr), "%s%s", prompt,
PROMPT_SCHAR);
- snprintf(mc.dispstr, sizeof(mc.dispstr), "%s%s%c", mc.promptstr,
+ snprintf(mc.dispstr, sizeof(mc.dispstr), "%s%s%s", mc.promptstr,
mc.searchstr, PROMPT_ECHAR);
mc.width = font_width(sc, mc.dispstr, strlen(mc.dispstr));
mc.hasprompt = 1;
@@ -312,7 +312,7 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
mc->width = 0;
dy = 0;
if (mc->hasprompt) {
- snprintf(mc->dispstr, sizeof(mc->dispstr), "%s%s%c",
+ snprintf(mc->dispstr, sizeof(mc->dispstr), "%s%s%s",
mc->promptstr, mc->searchstr, PROMPT_ECHAR);
mc->width = font_width(sc, mc->dispstr, strlen(mc->dispstr));
dy = font_height(sc);