summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xrdp/xrdp_mm.c28
-rw-r--r--xrdp/xrdp_types.h9
-rw-r--r--xrdp/xrdp_wm.c94
3 files changed, 38 insertions, 93 deletions
diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c
index cceaba81..105a166a 100644
--- a/xrdp/xrdp_mm.c
+++ b/xrdp/xrdp_mm.c
@@ -386,6 +386,8 @@ xrdp_mm_setup_mod2(struct xrdp_mm* self)
char* value;
int i;
int rv;
+ int key_flags;
+ int device_flags;
rv = 1;
text[0] = 0;
@@ -443,6 +445,32 @@ xrdp_mm_setup_mod2(struct xrdp_mm* self)
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;
}
diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h
index 7ddee810..3db33a9a 100644
--- a/xrdp/xrdp_types.h
+++ b/xrdp/xrdp_types.h
@@ -227,7 +227,6 @@ struct xrdp_wm
int caps_lock;
int scroll_lock;
int num_lock;
- struct list* key_down_list;
/* client info */
struct xrdp_client_info* client_info;
/* session log */
@@ -359,11 +358,3 @@ struct xrdp_mod_data
struct list* names;
struct list* values;
};
-
-struct xrdp_key_down
-{
- int scan_code;
- int param1;
- int param2;
- int param4;
-};
diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c
index d4e92ca3..1918e4ab 100644
--- a/xrdp/xrdp_wm.c
+++ b/xrdp/xrdp_wm.c
@@ -42,8 +42,6 @@ xrdp_wm_create(struct xrdp_process* owner,
self->cache = xrdp_cache_create(self, self->session, self->client_info);
self->log = list_create();
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->default_font = xrdp_font_create(self);
/* 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);
/* free the log */
list_delete(self->log);
- /* key down list */
- list_delete(self->key_down_list);
/* free default font */
xrdp_font_delete(self->default_font);
/* free self */
@@ -1050,60 +1046,14 @@ xrdp_wm_mouse_click(struct xrdp_wm* self, int x, int y, int but, int down)
}
/*****************************************************************************/
-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
xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code)
{
int msg;
- int key_down_index;
int c;
- struct xrdp_key_down* key_down;
/*g_printf("count %d\n", self->key_down_list->count);*/
scan_code = scan_code % 128;
- key_down = 0;
if (self->popup_wnd != 0)
{
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;
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 */
{
@@ -1141,37 +1085,19 @@ xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code)
{
if (self->mm->mod->mod_event != 0)
{
- if (msg == WM_KEYDOWN)
+ c = get_char_from_scan_code
+ (device_flags, scan_code, self->keys, self->caps_lock,
+ self->num_lock, self->scroll_lock,
+ &(self->keymap));
+ if (c != 0)
{
- c = get_char_from_scan_code
- (device_flags, scan_code, self->keys, self->caps_lock,
- self->num_lock, self->scroll_lock,
- &(self->keymap));
- if (c != 0)
- {
- self->mm->mod->mod_event(self->mm->mod, msg, c,
- 0xffff, scan_code, device_flags);
- xrdp_add_key_down(self, c, 0xffff, scan_code,
- device_flags);
- }
- else
- {
- self->mm->mod->mod_event(self->mm->mod, msg, scan_code,
- device_flags, scan_code, device_flags);
- xrdp_add_key_down(self, scan_code, device_flags, scan_code,
- device_flags);
- }
+ self->mm->mod->mod_event(self->mm->mod, msg, c,
+ 0xffff, scan_code, device_flags);
}
- else /* key up */
+ else
{
- 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);
- }
+ self->mm->mod->mod_event(self->mm->mod, msg, scan_code,
+ device_flags, scan_code, device_flags);
}
}
}