got enter and esc keys working on login screen

ulab-original
jsorg71 19 years ago
parent e61e379a92
commit 272eaf7003

@ -1140,9 +1140,13 @@ int xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
struct xrdp_bitmap* focus_out_control;
if (self == 0)
{
return 0;
}
if (self->wm == 0)
{
return 0;
}
if (self->type == WND_TYPE_WND)
{
if (msg == WM_KEYDOWN)
@ -1154,18 +1158,24 @@ int xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
shift = self->wm->keys[42] || self->wm->keys[54];
i = -1;
if (self->child_list != 0)
{
i = xrdp_list_index_of(self->child_list, (long)self->focused_control);
}
if (shift)
{
i--;
if (i < 0)
{
i = self->child_list->count - 1;
}
}
else
{
i++;
if (i >= self->child_list->count)
{
i = 0;
}
}
n = self->child_list->count;
b = (struct xrdp_bitmap*)xrdp_list_get_item(self->child_list, i);
@ -1184,17 +1194,45 @@ int xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
{
i--;
if (i < 0)
{
i = self->child_list->count - 1;
}
}
else
{
i++;
if (i >= self->child_list->count)
{
i = 0;
}
}
b = (struct xrdp_bitmap*)xrdp_list_get_item(self->child_list, i);
}
}
else if (scan_code == 28) /* enter */
{
if (self->default_button != 0)
{
if (self->notify != 0)
{
/* I think this should use def_proc */
self->notify(self, self->default_button, 1, 0, 0);
return 0;
}
}
}
else if (scan_code == 1) /* esc */
{
if (self->esc_button != 0)
{
if (self->notify != 0)
{
/* I think this should use def_proc */
self->notify(self, self->esc_button, 1, 0, 0);
return 0;
}
}
}
}
if (self->focused_control != 0)
{

@ -124,7 +124,7 @@ int xrdp_wm_setup_mod(struct xrdp_wm* self,
/* id self->mod is null, there must be a problem */
if (self->mod == 0)
{
DEBUG(("problem loading lib in xrdp_wm_setup_mod"));
DEBUG(("problem loading lib in xrdp_wm_setup_mod\n\r"));
return 1;
}
return 0;
@ -196,6 +196,8 @@ int xrdp_wm_login_notify(struct xrdp_bitmap* wnd,
set_string(&but->caption1, "OK");
/* draw it */
help->focused_control = but;
help->default_button = but;
help->esc_button = but;
xrdp_bitmap_invalidate(help, 0);
xrdp_wm_set_focused(wnd->wm, help);
}
@ -494,6 +496,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
but->id = 3;
set_string(&but->caption1, "OK");
but->tab_stop = 1;
self->login_window->default_button = but;
/* button */
but = xrdp_bitmap_create(60, 25, self->screen->bpp, WND_TYPE_BUTTON, self);
@ -505,6 +508,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
but->id = 2;
set_string(&but->caption1, "Cancel");
but->tab_stop = 1;
self->login_window->esc_button = but;
/* button */
but = xrdp_bitmap_create(60, 25, self->screen->bpp, WND_TYPE_BUTTON, self);

@ -487,6 +487,10 @@ struct xrdp_bitmap
struct xrdp_bitmap* focused_control;
struct xrdp_bitmap* owner; /* window that created us */
struct xrdp_bitmap* parent; /* window contained in */
/* for modal dialog */
struct xrdp_bitmap* default_button; /* button when enter is pressed */
struct xrdp_bitmap* esc_button; /* button when esc is pressed */
/* list of child windows */
struct xrdp_list* child_list;
/* for edit */
int edit_pos;

Loading…
Cancel
Save