don't supress key up and sync modifiers on connect

ulab-original
jsorg71 17 years ago
parent 57484bd701
commit 30b0b77fce

@ -386,6 +386,8 @@ xrdp_mm_setup_mod2(struct xrdp_mm* self)
char* value; char* value;
int i; int i;
int rv; int rv;
int key_flags;
int device_flags;
rv = 1; rv = 1;
text[0] = 0; text[0] = 0;
@ -443,6 +445,32 @@ xrdp_mm_setup_mod2(struct xrdp_mm* self)
rv = 0; rv = 0;
} }
} }
if (rv == 0)
{
/* sync modifiers */
key_flags = 0;
device_flags = 0;
if (self->wm->scroll_lock)
{
key_flags |= 1;
}
if (self->wm->num_lock)
{
key_flags |= 2;
}
if (self->wm->caps_lock)
{
key_flags |= 4;
}
if (self->mod != 0)
{
if (self->mod->mod_event != 0)
{
self->mod->mod_event(self->mod, 17, key_flags, device_flags,
key_flags, device_flags);
}
}
}
return rv; return rv;
} }

@ -227,7 +227,6 @@ struct xrdp_wm
int caps_lock; int caps_lock;
int scroll_lock; int scroll_lock;
int num_lock; int num_lock;
struct list* key_down_list;
/* client info */ /* client info */
struct xrdp_client_info* client_info; struct xrdp_client_info* client_info;
/* session log */ /* session log */
@ -359,11 +358,3 @@ struct xrdp_mod_data
struct list* names; struct list* names;
struct list* values; struct list* values;
}; };
struct xrdp_key_down
{
int scan_code;
int param1;
int param2;
int param4;
};

@ -42,8 +42,6 @@ xrdp_wm_create(struct xrdp_process* owner,
self->cache = xrdp_cache_create(self, self->session, self->client_info); self->cache = xrdp_cache_create(self, self->session, self->client_info);
self->log = list_create(); self->log = list_create();
self->log->auto_free = 1; self->log->auto_free = 1;
self->key_down_list = list_create();
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); self->default_font = xrdp_font_create(self);
/* this will use built in keymap or load from file */ /* this will use built in keymap or load from file */
@ -65,8 +63,6 @@ xrdp_wm_delete(struct xrdp_wm* self)
xrdp_bitmap_delete(self->screen); xrdp_bitmap_delete(self->screen);
/* free the log */ /* free the log */
list_delete(self->log); list_delete(self->log);
/* key down list */
list_delete(self->key_down_list);
/* free default font */ /* free default font */
xrdp_font_delete(self->default_font); xrdp_font_delete(self->default_font);
/* free self */ /* free self */
@ -1049,61 +1045,15 @@ xrdp_wm_mouse_click(struct xrdp_wm* self, int x, int y, int but, int down)
return 0; return 0;
} }
/*****************************************************************************/
static struct xrdp_key_down* APP_CC
xrdp_get_key_down(struct xrdp_wm* self, int scan_code, int* index)
{
int i;
struct xrdp_key_down* key_down;
for (i = 0; i < self->key_down_list->count; i++)
{
key_down = (struct xrdp_key_down*)list_get_item(self->key_down_list, i);
if (key_down != 0)
{
if (key_down->scan_code == scan_code)
{
if (index != 0)
{
*index = i;
}
return key_down;
}
}
}
return 0;
}
/*****************************************************************************/
static void APP_CC
xrdp_add_key_down(struct xrdp_wm* self, int param1, int param2,
int scan_code, int param4)
{
struct xrdp_key_down* key_down;
if (xrdp_get_key_down(self, scan_code, 0) != 0)
{
return;
}
key_down = (struct xrdp_key_down*)g_malloc(sizeof(struct xrdp_key_down), 0);
key_down->scan_code = scan_code;
key_down->param1 = param1;
key_down->param2 = param2;
key_down->param4 = param4;
list_add_item(self->key_down_list, (long)key_down);
}
/*****************************************************************************/ /*****************************************************************************/
int APP_CC int APP_CC
xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code) xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code)
{ {
int msg; int msg;
int key_down_index;
int c; int c;
struct xrdp_key_down* key_down;
/*g_printf("count %d\n", self->key_down_list->count);*/ /*g_printf("count %d\n", self->key_down_list->count);*/
scan_code = scan_code % 128; scan_code = scan_code % 128;
key_down = 0;
if (self->popup_wnd != 0) if (self->popup_wnd != 0)
{ {
xrdp_wm_clear_popup(self); xrdp_wm_clear_popup(self);
@ -1113,12 +1063,6 @@ xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code)
{ {
self->keys[scan_code] = 0; self->keys[scan_code] = 0;
msg = WM_KEYUP; msg = WM_KEYUP;
key_down = xrdp_get_key_down(self, scan_code, &key_down_index);
/* if there was no key down, don't allow a key up */
if (key_down == 0)
{
return 0;
}
} }
else /* key down */ else /* key down */
{ {
@ -1140,8 +1084,6 @@ xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code)
if (self->mm->mod != 0) if (self->mm->mod != 0)
{ {
if (self->mm->mod->mod_event != 0) if (self->mm->mod->mod_event != 0)
{
if (msg == WM_KEYDOWN)
{ {
c = get_char_from_scan_code c = get_char_from_scan_code
(device_flags, scan_code, self->keys, self->caps_lock, (device_flags, scan_code, self->keys, self->caps_lock,
@ -1151,27 +1093,11 @@ xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code)
{ {
self->mm->mod->mod_event(self->mm->mod, msg, c, self->mm->mod->mod_event(self->mm->mod, msg, c,
0xffff, scan_code, device_flags); 0xffff, scan_code, device_flags);
xrdp_add_key_down(self, c, 0xffff, scan_code,
device_flags);
} }
else else
{ {
self->mm->mod->mod_event(self->mm->mod, msg, scan_code, self->mm->mod->mod_event(self->mm->mod, msg, scan_code,
device_flags, scan_code, device_flags); device_flags, scan_code, device_flags);
xrdp_add_key_down(self, scan_code, device_flags, scan_code,
device_flags);
}
}
else /* key up */
{
if (key_down != 0)
{
self->mm->mod->mod_event(self->mm->mod, msg, key_down->param1,
key_down->param2 | KBD_FLAG_UP,
key_down->scan_code,
key_down->param4 | KBD_FLAG_UP);
list_remove_item(self->key_down_list, key_down_index);
}
} }
} }
} }

Loading…
Cancel
Save