From f4024fc9265661f33ec73dd7b6a56a169fce3855 Mon Sep 17 00:00:00 2001 From: jsorg71 Date: Sun, 23 Sep 2007 07:02:19 +0000 Subject: [PATCH] unicode --- xrdp/xrdp_font.c | 8 +++++--- xrdp/xrdp_login_wnd.c | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xrdp/xrdp_font.c b/xrdp/xrdp_font.c index 2186128a..34c8b213 100644 --- a/xrdp/xrdp_font.c +++ b/xrdp/xrdp_font.c @@ -75,14 +75,15 @@ xrdp_font_create(struct xrdp_wm* wm) int datasize; struct xrdp_font_char* f; + DEBUG(("in xrdp_font_create")); self = (struct xrdp_font*)g_malloc(sizeof(struct xrdp_font), 1); self->wm = wm; make_stream(s); - init_stream(s, 1024 * 64); + init_stream(s, 1024 * 256); fd = g_file_open("sans-10.fv1"); if (fd != -1) { - b = g_file_read(fd, s->data, 1024 * 64); + b = g_file_read(fd, s->data, 1024 * 256); g_file_close(fd); if (b > 0) { @@ -138,6 +139,7 @@ xrdp_font_create(struct xrdp_wm* wm) self->font_items[0].data = g_malloc(3 * 16, 0); g_memcpy(self->font_items[0].data, w_char, 3 * 16); */ + DEBUG(("out xrdp_font_create")); return self; } @@ -152,7 +154,7 @@ xrdp_font_delete(struct xrdp_font* self) { return; } - for (i = 0; i < 256; i++) + for (i = 0; i < NUM_FONTS; i++) { g_free(self->font_items[i].data); } diff --git a/xrdp/xrdp_login_wnd.c b/xrdp/xrdp_login_wnd.c index ac57a2c8..c4236bcc 100644 --- a/xrdp/xrdp_login_wnd.c +++ b/xrdp/xrdp_login_wnd.c @@ -288,7 +288,7 @@ xrdp_wm_show_edits(struct xrdp_wm* self, struct xrdp_bitmap* combo) b->tab_stop = 1; b->caption1 = (char*)g_malloc(256, 1); g_strncpy(b->caption1, value + 3, 255); - b->edit_pos = g_strlen(b->caption1); + b->edit_pos = g_mbstowcs(0, b->caption1, 0); if (self->login_window->focused_control == 0) { self->login_window->focused_control = b; @@ -296,8 +296,8 @@ xrdp_wm_show_edits(struct xrdp_wm* self, struct xrdp_bitmap* combo) if (g_strncmp(name, "username", 255) == 0) { g_strncpy(b->caption1, self->session->client_info->username, 255); - b->edit_pos = g_strlen(b->caption1); - if (g_strlen(b->caption1) > 0) + b->edit_pos = g_mbstowcs(0, b->caption1, 0); + if (b->edit_pos > 0) { username_set = 1; }