From 77bbd18d5c51b71ae615384d21c034d16181399e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Tue, 20 Dec 2011 14:51:44 -0500 Subject: [PATCH] libfreerdp-core: fix input callback registration for slow-path input --- client/X11/xf_event.c | 19 ++++++++++++------- libfreerdp-core/freerdp.c | 3 ++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/client/X11/xf_event.c b/client/X11/xf_event.c index 667b301fc..ccd293df2 100644 --- a/client/X11/xf_event.c +++ b/client/X11/xf_event.c @@ -338,7 +338,9 @@ boolean xf_event_FocusIn(xfInfo* xfi, XEvent* event, boolean app) if (xfi->mouse_active && (app != true)) XGrabKeyboard(xfi->display, xfi->window->handle, true, GrabModeAsync, GrabModeAsync, CurrentTime); - xf_rail_send_activate(xfi, event->xany.window, true); + if (app) + xf_rail_send_activate(xfi, event->xany.window, true); + xf_kbd_focus_in(xfi); if (app != true) @@ -357,7 +359,8 @@ boolean xf_event_FocusOut(xfInfo* xfi, XEvent* event, boolean app) if (event->xfocus.mode == NotifyWhileGrabbed) XUngrabKeyboard(xfi->display, CurrentTime); - xf_rail_send_activate(xfi, event->xany.window, false); + if (app) + xf_rail_send_activate(xfi, event->xany.window, false); return true; } @@ -453,11 +456,14 @@ boolean xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, boolean app) if (window != NULL) { xfWindow* xfw; + Window childWindow; xfw = (xfWindow*) window->extra; - // ConfigureNotify coordinates are expressed relative to the window parent. - // Translate these to root window coordinates. - Window childWindow; + /* + * ConfigureNotify coordinates are expressed relative to the window parent. + * Translate these to root window coordinates. + */ + XTranslateCoordinates(xfi->display, xfw->handle, RootWindowOfScreen(xfi->screen), 0, 0, &xfw->left, &xfw->top, &childWindow); @@ -468,8 +474,7 @@ boolean xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, boolean app) xfw->bottom = xfw->top + xfw->height - 1; DEBUG_X11_LMS("window=0x%X rc={l=%d t=%d r=%d b=%d} w=%u h=%u send_event=%d", - (uint32) xfw->handle, - xfw->left, xfw->top, xfw->right, xfw->bottom, + (uint32) xfw->handle, xfw->left, xfw->top, xfw->right, xfw->bottom, xfw->width, xfw->height, event->xconfigure.send_event); if (app && ! event->xconfigure.send_event) diff --git a/libfreerdp-core/freerdp.c b/libfreerdp-core/freerdp.c index 769b77b23..6366ce457 100644 --- a/libfreerdp-core/freerdp.c +++ b/libfreerdp-core/freerdp.c @@ -58,6 +58,8 @@ boolean freerdp_connect(freerdp* instance) extension_post_connect(rdp->extension); + input_register_client_callbacks(rdp->input); + IFCALLRET(instance->PostConnect, status, instance); if (status != true) @@ -168,7 +170,6 @@ void freerdp_context_new(freerdp* instance) instance->update->altsec->context = instance->context; instance->input->context = instance->context; - input_register_client_callbacks(rdp->input); IFCALL(instance->ContextNew, instance, instance->context); }