diff options
author | jsorg71 <jsorg71> | 2007-09-26 07:22:14 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2007-09-26 07:22:14 +0000 |
commit | 62e47c6de0b840f194e5fcc68663acfaeea8ad68 (patch) | |
tree | 93c4b6d750ad3932027c625b8c96c256e583776b | |
parent | 4aab3a34447c8ed829f269220930074338ab46a7 (diff) | |
download | xrdp-proprietary-62e47c6de0b840f194e5fcc68663acfaeea8ad68.tar.gz xrdp-proprietary-62e47c6de0b840f194e5fcc68663acfaeea8ad68.zip |
font changes, no color in font struct, wm default font, etc
-rw-r--r-- | xrdp/xrdp_bitmap.c | 22 | ||||
-rw-r--r-- | xrdp/xrdp_font.c | 12 | ||||
-rw-r--r-- | xrdp/xrdp_login_wnd.c | 2 | ||||
-rw-r--r-- | xrdp/xrdp_painter.c | 5 | ||||
-rw-r--r-- | xrdp/xrdp_types.h | 5 | ||||
-rw-r--r-- | xrdp/xrdp_wm.c | 5 |
6 files changed, 30 insertions, 21 deletions
diff --git a/xrdp/xrdp_bitmap.c b/xrdp/xrdp_bitmap.c index a31d3071..04121187 100644 --- a/xrdp/xrdp_bitmap.c +++ b/xrdp/xrdp_bitmap.c @@ -265,14 +265,14 @@ xrdp_bitmap_set_focus(struct xrdp_bitmap* self, int focused) /* active title bar */ painter->fg_color = self->wm->blue; xrdp_painter_fill_rect(painter, self, 3, 3, self->width - 5, 18); - painter->font->color = self->wm->white; + painter->fg_color = self->wm->white; } else { /* inactive title bar */ painter->fg_color = self->wm->dark_grey; xrdp_painter_fill_rect(painter, self, 3, 3, self->width - 5, 18); - painter->font->color = self->wm->black; + painter->fg_color = self->wm->black; } xrdp_painter_draw_text(painter, self, 4, 4, self->caption1); xrdp_painter_end_update(painter); @@ -950,14 +950,14 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect) /* active title bar */ painter->fg_color = self->wm->blue; xrdp_painter_fill_rect(painter, self, 3, 3, self->width - 5, 18); - painter->font->color = self->wm->white; + painter->fg_color = self->wm->white; } else { /* inactive title bar */ painter->fg_color = self->wm->dark_grey; xrdp_painter_fill_rect(painter, self, 3, 3, self->width - 5, 18); - painter->font->color = self->wm->black; + painter->fg_color = self->wm->black; } xrdp_painter_draw_text(painter, self, 4, 4, self->caption1); } @@ -1006,7 +1006,7 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect) self->width, self->height, 0); w = xrdp_painter_text_width(painter, self->caption1); h = xrdp_painter_text_height(painter, self->caption1); - painter->font->color = self->wm->black; + painter->fg_color = self->wm->black; xrdp_painter_draw_text(painter, self, self->width / 2 - w / 2, self->height / 2 - h / 2, self->caption1); if (self->parent != 0) @@ -1027,7 +1027,7 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect) self->width, self->height, 1); w = xrdp_painter_text_width(painter, self->caption1); h = xrdp_painter_text_height(painter, self->caption1); - painter->font->color = self->wm->black; + painter->fg_color = self->wm->black; xrdp_painter_draw_text(painter, self, (self->width / 2 - w / 2) + 1, (self->height / 2 - h / 2) + 1, self->caption1); if (self->parent != 0) @@ -1110,7 +1110,7 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect) } else if (self->type == WND_TYPE_LABEL) /* 6 */ { - painter->font->color = self->wm->black; + painter->fg_color = self->wm->black; xrdp_painter_draw_text(painter, self, 0, 0, self->caption1); } else if (self->type == WND_TYPE_COMBO) /* 7 combo box */ @@ -1149,11 +1149,11 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect) /* draw text */ if (self->parent->focused_control == self) { - painter->font->color = self->wm->white; + painter->fg_color = self->wm->white; } else { - painter->font->color = self->wm->black; + painter->fg_color = self->wm->black; } xrdp_painter_draw_text(painter, self, 4, 2, (char*)list_get_item(self->string_list, self->item_index)); @@ -1188,11 +1188,11 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect) { painter->fg_color = self->wm->blue; xrdp_painter_fill_rect(painter, self, 0, y, self->width, h); - painter->font->color = self->wm->white; + painter->fg_color = self->wm->white; } else { - painter->font->color = self->wm->black; + painter->fg_color = self->wm->black; } xrdp_painter_draw_text(painter, self, 2, y, p); y = y + h; diff --git a/xrdp/xrdp_font.c b/xrdp/xrdp_font.c index 34c8b213..93bcbab8 100644 --- a/xrdp/xrdp_font.c +++ b/xrdp/xrdp_font.c @@ -73,17 +73,23 @@ xrdp_font_create(struct xrdp_wm* wm) int i; int index; int datasize; + int file_size; struct xrdp_font_char* f; DEBUG(("in xrdp_font_create")); + file_size = g_file_get_size(DEFAULT_FONT_NAME); + if (file_size < 1) + { + return 0; + } self = (struct xrdp_font*)g_malloc(sizeof(struct xrdp_font), 1); self->wm = wm; make_stream(s); - init_stream(s, 1024 * 256); - fd = g_file_open("sans-10.fv1"); + init_stream(s, file_size + 1024); + fd = g_file_open(DEFAULT_FONT_NAME); if (fd != -1) { - b = g_file_read(fd, s->data, 1024 * 256); + b = g_file_read(fd, s->data, file_size + 1024); g_file_close(fd); if (b > 0) { diff --git a/xrdp/xrdp_login_wnd.c b/xrdp/xrdp_login_wnd.c index c4236bcc..87d7ec72 100644 --- a/xrdp/xrdp_login_wnd.c +++ b/xrdp/xrdp_login_wnd.c @@ -58,7 +58,7 @@ xrdp_wm_login_help_notify(struct xrdp_bitmap* wnd, p = (struct xrdp_painter*)param1; if (p != 0) { - p->font->color = wnd->wm->black; + p->fg_color = wnd->wm->black; xrdp_painter_draw_text(p, wnd, 10, 30, "You must be authenticated \ before using this"); xrdp_painter_draw_text(p, wnd, 10, 46, "session."); diff --git a/xrdp/xrdp_painter.c b/xrdp/xrdp_painter.c index 7fb23621..f9bf8839 100644 --- a/xrdp/xrdp_painter.c +++ b/xrdp/xrdp_painter.c @@ -44,7 +44,6 @@ xrdp_painter_delete(struct xrdp_painter* self) { return; } - xrdp_font_delete(self->font); g_free(self); } @@ -70,7 +69,7 @@ xrdp_painter_font_needed(struct xrdp_painter* self) { if (self->font == 0) { - self->font = xrdp_font_create(self->wm); + self->font = self->wm->default_font; } return 0; } @@ -411,7 +410,7 @@ xrdp_painter_draw_text(struct xrdp_painter* self, y1 = y + total_height; flags = 0x03; /* 0x03 0x73; TEXT2_IMPLICIT_X and something else */ libxrdp_orders_text(self->session, f, flags, 0, - font->color, 0, + self->fg_color, 0, x - 1, y - 1, x + total_width, y + total_height, 0, 0, 0, 0, x1, y1, data, len * 2, &draw_rect); diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index fbc519a6..6bfa2e9c 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -226,6 +226,7 @@ struct xrdp_wm struct xrdp_bitmap* log_wnd; int login_mode; struct xrdp_mm* mm; + struct xrdp_font* default_font; }; /* rdp process */ @@ -329,14 +330,14 @@ struct xrdp_bitmap int crc; }; -#define NUM_FONTS 4096 +#define NUM_FONTS 0x4e00 +#define DEFAULT_FONT_NAME "sans-10.fv1" /* font */ struct xrdp_font { struct xrdp_wm* wm; struct xrdp_font_char font_items[NUM_FONTS]; - int color; char name[32]; int size; int style; diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index a8e57056..c3bc6cba 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -45,6 +45,7 @@ xrdp_wm_create(struct xrdp_process* owner, self->key_down_list = list_create(); self->key_down_list->auto_free = 1; self->mm = xrdp_mm_create(self); + self->default_font = xrdp_font_create(self); return self; } @@ -64,6 +65,8 @@ xrdp_wm_delete(struct xrdp_wm* self) list_delete(self->log); /* key down list */ list_delete(self->key_down_list); + /* free default font */ + xrdp_font_delete(self->default_font); /* free self */ g_free(self); } @@ -1414,7 +1417,7 @@ xrdp_wm_log_wnd_notify(struct xrdp_bitmap* wnd, painter = (struct xrdp_painter*)param1; if (painter != 0) { - painter->font->color = wnd->wm->black; + painter->fg_color = wnd->wm->black; for (index = 0; index < wnd->wm->log->count; index++) { text = (char*)list_get_item(wnd->wm->log, index); |