From d115469e426e53a52abf2cea282f2a5ae43ba689 Mon Sep 17 00:00:00 2001 From: rmax Date: Thu, 11 Nov 2004 11:33:55 +0000 Subject: * generic/tkEvent.c (InvokeInputMethods): Call XSetICFocus whenever the window receives focus. This fixes bug #905830 but avoids #1000051. --- ChangeLog | 6 ++++++ generic/tkEvent.c | 26 ++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91457fa..a074956 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-11-11 Reinhard Max + + * generic/tkEvent.c (InvokeInputMethods): Call XSetICFocus + whenever the window receives focus. This fixes bug #905830 but + avoids #1000051. + 2004-11-11 Daniel Steffen * generic/tkMain.c: diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 3b4b5a1..bb09034 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEvent.c,v 1.25 2004/08/29 09:27:35 dkf Exp $ + * RCS: @(#) $Id: tkEvent.c,v 1.26 2004/11/11 11:33:56 rmax Exp $ */ #include "tkPort.h" @@ -390,6 +390,11 @@ CreateXIMSpotMethods(winPtr) * insist. Create the input context for the window if * it hasn't already been done (XFilterEvent needs this * context). + * + * When the event is a FocusIn event, set the input context + * focus to the receiving window. This is needed for certain + * versions of Solaris, but we are still not sure whether it + * is being done in the right way. * * Results: * 1 when we are done with the event. @@ -408,8 +413,8 @@ InvokeInputMethods(winPtr,eventPtr) { TkDisplay *dispPtr = winPtr->dispPtr; if ((dispPtr->flags & TK_DISPLAY_USE_IM)) { + long im_event_mask = 0L; if (!(winPtr->flags & (TK_CHECKED_IC|TK_ALREADY_DEAD))) { - long im_event_mask = 0L; winPtr->flags |= TK_CHECKED_IC; if (dispPtr->inputMethod != NULL) { #if TK_XIM_SPOT @@ -425,14 +430,15 @@ InvokeInputMethods(winPtr,eventPtr) NULL); #endif } - if (winPtr->inputContext != NULL) { - XGetICValues(winPtr->inputContext, - XNFilterEvents, &im_event_mask, NULL); - if (im_event_mask != 0L) { - XSelectInput(winPtr->display, winPtr->window, - winPtr->atts.event_mask | im_event_mask); - XSetICFocus(winPtr->inputContext); - } + } + if (winPtr->inputContext != NULL && + (eventPtr->xany.type == FocusIn)) { + XGetICValues(winPtr->inputContext, + XNFilterEvents, &im_event_mask, NULL); + if (im_event_mask != 0L) { + XSelectInput(winPtr->display, winPtr->window, + winPtr->atts.event_mask | im_event_mask); + XSetICFocus(winPtr->inputContext); } } if (XFilterEvent(eventPtr, None)) { -- cgit v0.12