font changes, no color in font struct, wm default font, etc
This commit is contained in:
parent
4aab3a3444
commit
62e47c6de0
@ -265,14 +265,14 @@ xrdp_bitmap_set_focus(struct xrdp_bitmap* self, int focused)
|
|||||||
/* active title bar */
|
/* active title bar */
|
||||||
painter->fg_color = self->wm->blue;
|
painter->fg_color = self->wm->blue;
|
||||||
xrdp_painter_fill_rect(painter, self, 3, 3, self->width - 5, 18);
|
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
|
else
|
||||||
{
|
{
|
||||||
/* inactive title bar */
|
/* inactive title bar */
|
||||||
painter->fg_color = self->wm->dark_grey;
|
painter->fg_color = self->wm->dark_grey;
|
||||||
xrdp_painter_fill_rect(painter, self, 3, 3, self->width - 5, 18);
|
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_draw_text(painter, self, 4, 4, self->caption1);
|
||||||
xrdp_painter_end_update(painter);
|
xrdp_painter_end_update(painter);
|
||||||
@ -950,14 +950,14 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
|||||||
/* active title bar */
|
/* active title bar */
|
||||||
painter->fg_color = self->wm->blue;
|
painter->fg_color = self->wm->blue;
|
||||||
xrdp_painter_fill_rect(painter, self, 3, 3, self->width - 5, 18);
|
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
|
else
|
||||||
{
|
{
|
||||||
/* inactive title bar */
|
/* inactive title bar */
|
||||||
painter->fg_color = self->wm->dark_grey;
|
painter->fg_color = self->wm->dark_grey;
|
||||||
xrdp_painter_fill_rect(painter, self, 3, 3, self->width - 5, 18);
|
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_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);
|
self->width, self->height, 0);
|
||||||
w = xrdp_painter_text_width(painter, self->caption1);
|
w = xrdp_painter_text_width(painter, self->caption1);
|
||||||
h = xrdp_painter_text_height(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,
|
xrdp_painter_draw_text(painter, self, self->width / 2 - w / 2,
|
||||||
self->height / 2 - h / 2, self->caption1);
|
self->height / 2 - h / 2, self->caption1);
|
||||||
if (self->parent != 0)
|
if (self->parent != 0)
|
||||||
@ -1027,7 +1027,7 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
|||||||
self->width, self->height, 1);
|
self->width, self->height, 1);
|
||||||
w = xrdp_painter_text_width(painter, self->caption1);
|
w = xrdp_painter_text_width(painter, self->caption1);
|
||||||
h = xrdp_painter_text_height(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,
|
xrdp_painter_draw_text(painter, self, (self->width / 2 - w / 2) + 1,
|
||||||
(self->height / 2 - h / 2) + 1, self->caption1);
|
(self->height / 2 - h / 2) + 1, self->caption1);
|
||||||
if (self->parent != 0)
|
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 */
|
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);
|
xrdp_painter_draw_text(painter, self, 0, 0, self->caption1);
|
||||||
}
|
}
|
||||||
else if (self->type == WND_TYPE_COMBO) /* 7 combo box */
|
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 */
|
/* draw text */
|
||||||
if (self->parent->focused_control == self)
|
if (self->parent->focused_control == self)
|
||||||
{
|
{
|
||||||
painter->font->color = self->wm->white;
|
painter->fg_color = self->wm->white;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
painter->font->color = self->wm->black;
|
painter->fg_color = self->wm->black;
|
||||||
}
|
}
|
||||||
xrdp_painter_draw_text(painter, self, 4, 2,
|
xrdp_painter_draw_text(painter, self, 4, 2,
|
||||||
(char*)list_get_item(self->string_list, self->item_index));
|
(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;
|
painter->fg_color = self->wm->blue;
|
||||||
xrdp_painter_fill_rect(painter, self, 0, y, self->width, h);
|
xrdp_painter_fill_rect(painter, self, 0, y, self->width, h);
|
||||||
painter->font->color = self->wm->white;
|
painter->fg_color = self->wm->white;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
painter->font->color = self->wm->black;
|
painter->fg_color = self->wm->black;
|
||||||
}
|
}
|
||||||
xrdp_painter_draw_text(painter, self, 2, y, p);
|
xrdp_painter_draw_text(painter, self, 2, y, p);
|
||||||
y = y + h;
|
y = y + h;
|
||||||
|
@ -73,17 +73,23 @@ xrdp_font_create(struct xrdp_wm* wm)
|
|||||||
int i;
|
int i;
|
||||||
int index;
|
int index;
|
||||||
int datasize;
|
int datasize;
|
||||||
|
int file_size;
|
||||||
struct xrdp_font_char* f;
|
struct xrdp_font_char* f;
|
||||||
|
|
||||||
DEBUG(("in xrdp_font_create"));
|
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 = (struct xrdp_font*)g_malloc(sizeof(struct xrdp_font), 1);
|
||||||
self->wm = wm;
|
self->wm = wm;
|
||||||
make_stream(s);
|
make_stream(s);
|
||||||
init_stream(s, 1024 * 256);
|
init_stream(s, file_size + 1024);
|
||||||
fd = g_file_open("sans-10.fv1");
|
fd = g_file_open(DEFAULT_FONT_NAME);
|
||||||
if (fd != -1)
|
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);
|
g_file_close(fd);
|
||||||
if (b > 0)
|
if (b > 0)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +58,7 @@ xrdp_wm_login_help_notify(struct xrdp_bitmap* wnd,
|
|||||||
p = (struct xrdp_painter*)param1;
|
p = (struct xrdp_painter*)param1;
|
||||||
if (p != 0)
|
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 \
|
xrdp_painter_draw_text(p, wnd, 10, 30, "You must be authenticated \
|
||||||
before using this");
|
before using this");
|
||||||
xrdp_painter_draw_text(p, wnd, 10, 46, "session.");
|
xrdp_painter_draw_text(p, wnd, 10, 46, "session.");
|
||||||
|
@ -44,7 +44,6 @@ xrdp_painter_delete(struct xrdp_painter* self)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xrdp_font_delete(self->font);
|
|
||||||
g_free(self);
|
g_free(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +69,7 @@ xrdp_painter_font_needed(struct xrdp_painter* self)
|
|||||||
{
|
{
|
||||||
if (self->font == 0)
|
if (self->font == 0)
|
||||||
{
|
{
|
||||||
self->font = xrdp_font_create(self->wm);
|
self->font = self->wm->default_font;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -411,7 +410,7 @@ xrdp_painter_draw_text(struct xrdp_painter* self,
|
|||||||
y1 = y + total_height;
|
y1 = y + total_height;
|
||||||
flags = 0x03; /* 0x03 0x73; TEXT2_IMPLICIT_X and something else */
|
flags = 0x03; /* 0x03 0x73; TEXT2_IMPLICIT_X and something else */
|
||||||
libxrdp_orders_text(self->session, f, flags, 0,
|
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,
|
x - 1, y - 1, x + total_width, y + total_height,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
x1, y1, data, len * 2, &draw_rect);
|
x1, y1, data, len * 2, &draw_rect);
|
||||||
|
@ -226,6 +226,7 @@ struct xrdp_wm
|
|||||||
struct xrdp_bitmap* log_wnd;
|
struct xrdp_bitmap* log_wnd;
|
||||||
int login_mode;
|
int login_mode;
|
||||||
struct xrdp_mm* mm;
|
struct xrdp_mm* mm;
|
||||||
|
struct xrdp_font* default_font;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* rdp process */
|
/* rdp process */
|
||||||
@ -329,14 +330,14 @@ struct xrdp_bitmap
|
|||||||
int crc;
|
int crc;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUM_FONTS 4096
|
#define NUM_FONTS 0x4e00
|
||||||
|
#define DEFAULT_FONT_NAME "sans-10.fv1"
|
||||||
|
|
||||||
/* font */
|
/* font */
|
||||||
struct xrdp_font
|
struct xrdp_font
|
||||||
{
|
{
|
||||||
struct xrdp_wm* wm;
|
struct xrdp_wm* wm;
|
||||||
struct xrdp_font_char font_items[NUM_FONTS];
|
struct xrdp_font_char font_items[NUM_FONTS];
|
||||||
int color;
|
|
||||||
char name[32];
|
char name[32];
|
||||||
int size;
|
int size;
|
||||||
int style;
|
int style;
|
||||||
|
@ -45,6 +45,7 @@ xrdp_wm_create(struct xrdp_process* owner,
|
|||||||
self->key_down_list = list_create();
|
self->key_down_list = list_create();
|
||||||
self->key_down_list->auto_free = 1;
|
self->key_down_list->auto_free = 1;
|
||||||
self->mm = xrdp_mm_create(self);
|
self->mm = xrdp_mm_create(self);
|
||||||
|
self->default_font = xrdp_font_create(self);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,6 +65,8 @@ xrdp_wm_delete(struct xrdp_wm* self)
|
|||||||
list_delete(self->log);
|
list_delete(self->log);
|
||||||
/* key down list */
|
/* key down list */
|
||||||
list_delete(self->key_down_list);
|
list_delete(self->key_down_list);
|
||||||
|
/* free default font */
|
||||||
|
xrdp_font_delete(self->default_font);
|
||||||
/* free self */
|
/* free self */
|
||||||
g_free(self);
|
g_free(self);
|
||||||
}
|
}
|
||||||
@ -1414,7 +1417,7 @@ xrdp_wm_log_wnd_notify(struct xrdp_bitmap* wnd,
|
|||||||
painter = (struct xrdp_painter*)param1;
|
painter = (struct xrdp_painter*)param1;
|
||||||
if (painter != 0)
|
if (painter != 0)
|
||||||
{
|
{
|
||||||
painter->font->color = wnd->wm->black;
|
painter->fg_color = wnd->wm->black;
|
||||||
for (index = 0; index < wnd->wm->log->count; index++)
|
for (index = 0; index < wnd->wm->log->count; index++)
|
||||||
{
|
{
|
||||||
text = (char*)list_get_item(wnd->wm->log, index);
|
text = (char*)list_get_item(wnd->wm->log, index);
|
||||||
|
Loading…
Reference in New Issue
Block a user