|
|
|
@ -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 */
|
|
|
|
@ -1049,61 +1045,15 @@ xrdp_wm_mouse_click(struct xrdp_wm* self, int x, int y, int but, int down)
|
|
|
|
|
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
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|