|
|
@ -888,6 +888,7 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
|
|
|
struct xrdp_rect r1;
|
|
|
|
struct xrdp_rect r1;
|
|
|
|
struct xrdp_rect r2;
|
|
|
|
struct xrdp_rect r2;
|
|
|
|
struct xrdp_painter* painter;
|
|
|
|
struct xrdp_painter* painter;
|
|
|
|
|
|
|
|
twchar wtext[256];
|
|
|
|
char text[256];
|
|
|
|
char text[256];
|
|
|
|
char* p;
|
|
|
|
char* p;
|
|
|
|
|
|
|
|
|
|
|
@ -1009,10 +1010,16 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
|
|
|
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)
|
|
|
|
|
|
|
|
{
|
|
|
|
if (self->wm->focused_window == self->parent)
|
|
|
|
if (self->wm->focused_window == self->parent)
|
|
|
|
|
|
|
|
{
|
|
|
|
if (self->parent->focused_control == self)
|
|
|
|
if (self->parent->focused_control == self)
|
|
|
|
|
|
|
|
{
|
|
|
|
xrdp_bitmap_draw_focus_box(self, painter, 4, 4, self->width - 8,
|
|
|
|
xrdp_bitmap_draw_focus_box(self, painter, 4, 4, self->width - 8,
|
|
|
|
self->height - 8);
|
|
|
|
self->height - 8);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (self->state == BUTTON_STATE_DOWN) /* 1 */
|
|
|
|
else if (self->state == BUTTON_STATE_DOWN) /* 1 */
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1066,13 +1073,15 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
|
|
|
painter->fg_color = self->wm->black;
|
|
|
|
painter->fg_color = self->wm->black;
|
|
|
|
if (self->password_char != 0)
|
|
|
|
if (self->password_char != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
i = g_strlen(self->caption1);
|
|
|
|
i = g_mbstowcs(0, self->caption1, 0);
|
|
|
|
g_memset(text, self->password_char, i);
|
|
|
|
g_memset(text, self->password_char, i);
|
|
|
|
text[i] = 0;
|
|
|
|
text[i] = 0;
|
|
|
|
xrdp_painter_draw_text(painter, self, 4, 2, text);
|
|
|
|
xrdp_painter_draw_text(painter, self, 4, 2, text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
xrdp_painter_draw_text(painter, self, 4, 2, self->caption1);
|
|
|
|
xrdp_painter_draw_text(painter, self, 4, 2, self->caption1);
|
|
|
|
|
|
|
|
}
|
|
|
|
/* draw xor box(cursor) */
|
|
|
|
/* draw xor box(cursor) */
|
|
|
|
if (self->parent != 0)
|
|
|
|
if (self->parent != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1080,11 +1089,16 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (self->password_char != 0)
|
|
|
|
if (self->password_char != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_memset(text, self->password_char, self->edit_pos);
|
|
|
|
wchar_repeat(wtext, 255, self->password_char, self->edit_pos);
|
|
|
|
text[self->edit_pos] = 0;
|
|
|
|
wtext[self->edit_pos] = 0;
|
|
|
|
|
|
|
|
g_wcstombs(text, wtext, 255);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
g_strncpy(text, self->caption1, self->edit_pos);
|
|
|
|
{
|
|
|
|
|
|
|
|
g_mbstowcs(wtext, self->caption1, 255);
|
|
|
|
|
|
|
|
wtext[self->edit_pos] = 0;
|
|
|
|
|
|
|
|
g_wcstombs(text, wtext, 255);
|
|
|
|
|
|
|
|
}
|
|
|
|
w = xrdp_painter_text_width(painter, text);
|
|
|
|
w = xrdp_painter_text_width(painter, text);
|
|
|
|
painter->fg_color = self->wm->white;
|
|
|
|
painter->fg_color = self->wm->white;
|
|
|
|
painter->rop = 0x5a;
|
|
|
|
painter->rop = 0x5a;
|
|
|
@ -1134,9 +1148,13 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
|
|
|
xrdp_painter_fill_rect(painter, self, 1, 1, self->width - 2, 1);
|
|
|
|
xrdp_painter_fill_rect(painter, self, 1, 1, self->width - 2, 1);
|
|
|
|
/* draw text */
|
|
|
|
/* draw text */
|
|
|
|
if (self->parent->focused_control == self)
|
|
|
|
if (self->parent->focused_control == self)
|
|
|
|
|
|
|
|
{
|
|
|
|
painter->font->color = self->wm->white;
|
|
|
|
painter->font->color = self->wm->white;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
painter->font->color = self->wm->black;
|
|
|
|
painter->font->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));
|
|
|
|
/* draw button on right */
|
|
|
|
/* draw button on right */
|
|
|
@ -1145,9 +1163,13 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
|
|
|
w = (self->width - x) - 2;
|
|
|
|
w = (self->width - x) - 2;
|
|
|
|
h = self->height - 4;
|
|
|
|
h = self->height - 4;
|
|
|
|
if (self->state == BUTTON_STATE_UP) /* 0 */
|
|
|
|
if (self->state == BUTTON_STATE_UP) /* 0 */
|
|
|
|
|
|
|
|
{
|
|
|
|
xrdp_bitmap_draw_button(self, painter, x, y, w, h, 0);
|
|
|
|
xrdp_bitmap_draw_button(self, painter, x, y, w, h, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
xrdp_bitmap_draw_button(self, painter, x, y, w, h, 1);
|
|
|
|
xrdp_bitmap_draw_button(self, painter, x, y, w, h, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (self->type == WND_TYPE_SPECIAL) /* 8 special */
|
|
|
|
else if (self->type == WND_TYPE_SPECIAL) /* 8 special */
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1169,7 +1191,9 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
|
|
|
painter->font->color = self->wm->white;
|
|
|
|
painter->font->color = self->wm->white;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
painter->font->color = self->wm->black;
|
|
|
|
painter->font->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;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1177,13 +1201,17 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* notify */
|
|
|
|
/* notify */
|
|
|
|
if (self->notify != 0)
|
|
|
|
if (self->notify != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
self->notify(self, self, WM_PAINT, (long)painter, 0); /* 3 */
|
|
|
|
self->notify(self, self, WM_PAINT, (long)painter, 0); /* 3 */
|
|
|
|
|
|
|
|
}
|
|
|
|
/* draw any child windows in the area */
|
|
|
|
/* draw any child windows in the area */
|
|
|
|
for (i = 0; i < self->child_list->count; i++)
|
|
|
|
for (i = 0; i < self->child_list->count; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
b = (struct xrdp_bitmap*)list_get_item(self->child_list, i);
|
|
|
|
b = (struct xrdp_bitmap*)list_get_item(self->child_list, i);
|
|
|
|
if (rect == 0)
|
|
|
|
if (rect == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
xrdp_bitmap_invalidate(b, 0);
|
|
|
|
xrdp_bitmap_invalidate(b, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MAKERECT(r1, b->left, b->top, b->width, b->height);
|
|
|
|
MAKERECT(r1, b->left, b->top, b->width, b->height);
|
|
|
@ -1205,7 +1233,7 @@ int APP_CC
|
|
|
|
xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
|
|
|
xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
|
|
|
int param1, int param2)
|
|
|
|
int param1, int param2)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char c;
|
|
|
|
twchar c;
|
|
|
|
int n;
|
|
|
|
int n;
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
int shift;
|
|
|
|
int shift;
|
|
|
@ -1334,7 +1362,7 @@ xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
|
|
|
else if ((scan_code == 77 || scan_code == 80) &&
|
|
|
|
else if ((scan_code == 77 || scan_code == 80) &&
|
|
|
|
(ext || self->wm->num_lock == 0))
|
|
|
|
(ext || self->wm->num_lock == 0))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (self->edit_pos < g_strlen(self->caption1))
|
|
|
|
if (self->edit_pos < g_mbstowcs(0, self->caption1, 0))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
self->edit_pos++;
|
|
|
|
self->edit_pos++;
|
|
|
|
xrdp_bitmap_invalidate(self, 0);
|
|
|
|
xrdp_bitmap_invalidate(self, 0);
|
|
|
@ -1343,13 +1371,13 @@ xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
|
|
|
/* backspace */
|
|
|
|
/* backspace */
|
|
|
|
else if (scan_code == 14)
|
|
|
|
else if (scan_code == 14)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
n = g_strlen(self->caption1);
|
|
|
|
n = g_mbstowcs(0, self->caption1, 0);
|
|
|
|
if (n > 0)
|
|
|
|
if (n > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (self->edit_pos > 0)
|
|
|
|
if (self->edit_pos > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
self->edit_pos--;
|
|
|
|
self->edit_pos--;
|
|
|
|
remove_char_at(self->caption1, self->edit_pos);
|
|
|
|
remove_char_at(self->caption1, 255, self->edit_pos);
|
|
|
|
xrdp_bitmap_invalidate(self, 0);
|
|
|
|
xrdp_bitmap_invalidate(self, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1358,12 +1386,12 @@ xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
|
|
|
else if (scan_code == 83 &&
|
|
|
|
else if (scan_code == 83 &&
|
|
|
|
(ext || self->wm->num_lock == 0))
|
|
|
|
(ext || self->wm->num_lock == 0))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
n = g_strlen(self->caption1);
|
|
|
|
n = g_mbstowcs(0, self->caption1, 0);
|
|
|
|
if (n > 0)
|
|
|
|
if (n > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (self->edit_pos < n)
|
|
|
|
if (self->edit_pos < n)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
remove_char_at(self->caption1, self->edit_pos);
|
|
|
|
remove_char_at(self->caption1, 255, self->edit_pos);
|
|
|
|
xrdp_bitmap_invalidate(self, 0);
|
|
|
|
xrdp_bitmap_invalidate(self, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1372,7 +1400,7 @@ xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
|
|
|
else if (scan_code == 79 &&
|
|
|
|
else if (scan_code == 79 &&
|
|
|
|
(ext || self->wm->num_lock == 0))
|
|
|
|
(ext || self->wm->num_lock == 0))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
n = g_strlen(self->caption1);
|
|
|
|
n = g_mbstowcs(0, self->caption1, 0);
|
|
|
|
if (self->edit_pos < n)
|
|
|
|
if (self->edit_pos < n)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
self->edit_pos = n;
|
|
|
|
self->edit_pos = n;
|
|
|
@ -1380,8 +1408,8 @@ xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* home */
|
|
|
|
/* home */
|
|
|
|
else if (scan_code == 71 &&
|
|
|
|
else if ((scan_code == 71) &&
|
|
|
|
(ext || self->wm->num_lock == 0))
|
|
|
|
(ext || (self->wm->num_lock == 0)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (self->edit_pos > 0)
|
|
|
|
if (self->edit_pos > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1391,14 +1419,13 @@ xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
c = get_char_from_scan_code(param2, scan_code, self->wm->keys,
|
|
|
|
c = get_char_from_scan_code
|
|
|
|
self->wm->caps_lock,
|
|
|
|
(param2, scan_code, self->wm->keys, self->wm->caps_lock,
|
|
|
|
self->wm->num_lock,
|
|
|
|
self->wm->num_lock, self->wm->scroll_lock,
|
|
|
|
self->wm->scroll_lock,
|
|
|
|
self->wm->session->client_info->keylayout);
|
|
|
|
self->wm->session->client_info->keylayout);
|
|
|
|
if (c >= 32)
|
|
|
|
if ((unsigned char)c >= 32)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
add_char_at(self->caption1, c, self->edit_pos);
|
|
|
|
add_char_at(self->caption1, 255, c, self->edit_pos);
|
|
|
|
self->edit_pos++;
|
|
|
|
self->edit_pos++;
|
|
|
|
xrdp_bitmap_invalidate(self, 0);
|
|
|
|
xrdp_bitmap_invalidate(self, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1412,8 +1439,8 @@ xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
|
|
|
scan_code = param1 % 128;
|
|
|
|
scan_code = param1 % 128;
|
|
|
|
ext = param2 & 0x0100;
|
|
|
|
ext = param2 & 0x0100;
|
|
|
|
/* left or up arrow */
|
|
|
|
/* left or up arrow */
|
|
|
|
if ((scan_code == 75 || scan_code == 72) &&
|
|
|
|
if (((scan_code == 75) || (scan_code == 72)) &&
|
|
|
|
(ext || self->wm->num_lock == 0))
|
|
|
|
(ext || (self->wm->num_lock == 0)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (self->item_index > 0)
|
|
|
|
if (self->item_index > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|