diff options
Diffstat (limited to 'generic/tkEvent.c')
-rw-r--r-- | generic/tkEvent.c | 90 |
1 files changed, 24 insertions, 66 deletions
diff --git a/generic/tkEvent.c b/generic/tkEvent.c index bcadee5..36f1c3a 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.39 2009/01/11 19:05:17 georgeps Exp $ + * RCS: @(#) $Id: tkEvent.c,v 1.40 2010/01/01 22:50:27 dkf Exp $ */ #include "tkInt.h" @@ -212,7 +212,6 @@ static int TkXErrorHandler(ClientData clientData, static void UpdateButtonEventState(XEvent *eventPtr); static int WindowEventProc(Tcl_Event *evPtr, int flags); #ifdef TK_USE_INPUT_METHODS -static int InvokeInputMethods(TkWindow *winPtr, XEvent *eventPtr); static void CreateXIC(TkWindow *winPtr); #endif /* TK_USE_INPUT_METHODS */ @@ -322,7 +321,7 @@ InvokeMouseHandlers( *---------------------------------------------------------------------- */ -#if defined(TK_USE_INPUT_METHODS) +#ifdef TK_USE_INPUT_METHODS static void CreateXIC( TkWindow *winPtr) @@ -373,62 +372,6 @@ CreateXIC( /* *---------------------------------------------------------------------- * - * InvokeInputMethods -- - * - * Pass the event to the input method(s), if there are any, and discard - * the event if the input method(s) 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. - * - * Results: - * 1 when we are done with the event. - * 0 when the event can be processed further. - * - * Side effects: - * Input contexts/methods may be created. - * - *---------------------------------------------------------------------- - */ - -#ifdef TK_USE_INPUT_METHODS -static int -InvokeInputMethods( - TkWindow *winPtr, - XEvent *eventPtr) -{ - TkDisplay *dispPtr = winPtr->dispPtr; - - if ((dispPtr->flags & TK_DISPLAY_USE_IM)) { - if (!(winPtr->flags & (TK_CHECKED_IC|TK_ALREADY_DEAD))) { - winPtr->flags |= TK_CHECKED_IC; - if (dispPtr->inputMethod != NULL) { - CreateXIC(winPtr); - } - } - switch (eventPtr->type) { - case FocusIn: - if (winPtr->inputContext != NULL) { - XSetICFocus(winPtr->inputContext); - } - break; - case KeyPress: - case KeyRelease: - if (XFilterEvent(eventPtr, None)) { - return 1; - } - break; - } - } - return 0; -} -#endif /*TK_USE_INPUT_METHODS*/ - -/* - *---------------------------------------------------------------------- - * * GetTkWindowFromXEvent -- * * Attempt to find which TkWindow is associated with an event. If it @@ -1276,7 +1219,7 @@ Tk_HandleEvent( unsigned long mask; InProgress ip; Tcl_Interp *interp = NULL; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); UpdateButtonEventState(eventPtr); @@ -1330,7 +1273,7 @@ Tk_HandleEvent( * code. */ - Tcl_Preserve((ClientData) interp); + Tcl_Preserve(interp); result = ((InvokeFocusHandlers(&winPtr, mask, eventPtr)) || (InvokeMouseHandlers(winPtr, mask, eventPtr))); @@ -1340,11 +1283,26 @@ Tk_HandleEvent( } } + /* + * 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 code is only + * ever active for X11. + */ + #ifdef TK_USE_INPUT_METHODS - if (InvokeInputMethods(winPtr, eventPtr)) { - goto releaseInterpreter; + if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM)) { + if (!(winPtr->flags & (TK_CHECKED_IC|TK_ALREADY_DEAD))) { + winPtr->flags |= TK_CHECKED_IC; + if (winPtr->dispPtr->inputMethod != NULL) { + CreateXIC(winPtr); + } + } + if (eventPtr->type == FocusIn && winPtr->inputContext != NULL) { + XSetICFocus(winPtr->inputContext); + } } -#endif +#endif /*TK_USE_INPUT_METHODS*/ /* * For events where it hasn't already been done, update the current time @@ -1375,7 +1333,7 @@ Tk_HandleEvent( Tk_InternAtom((Tk_Window) winPtr, "WM_PROTOCOLS")) { TkWmProtocolEventProc(winPtr, eventPtr); } else { - InvokeClientMessageHandlers(tsdPtr, (Tk_Window)winPtr, + InvokeClientMessageHandlers(tsdPtr, (Tk_Window) winPtr, eventPtr); } } @@ -1417,7 +1375,7 @@ Tk_HandleEvent( releaseInterpreter: if (interp != NULL) { - Tcl_Release((ClientData) interp); + Tcl_Release(interp); } /* |