[EMAIL PROTECTED] wrote:

> 
> On Mon, 27 Jan 2003, Angus Leeming wrote:
> 
>> As I read XCreateIC, most of the attributes can be added/removed
>> after xic is created. Does that not mean that you can create a
>> 'pre-edit area' on the fly. Ie, when the user types 'Shift space' in
>> a dialog, you'll have code in input.c that says: "Hello! he wants a
>> pre-edit area" and you'll modify the attributes of the input context
>> to reflect this --- for this particular input widget. Ditto, when in
>> pre-edit mode and the input.c code receives a "Space' keypress,
>> you'll know to turn off this stuff.
>> 
>> Any help?
> 
> 
> Could you give me an example code ?

Well, my idea is that you should modify the handle_key function in input.c. 
I really, really don't know if the following psuedo code can achieve what 
you want, but I hope so. Let me explain.

I suggest that you leave fl_initialize unchanged for the moment. That means, 
that all input widgets will start off in 'normal' mode. If the user opens a 
dialog and presses 'Shift space' when the cursor is in some input widget, 
then xforms handle_key function is passed a pointer to that particular 
FL_OBJECT.

So, introduce the following snippet of pseudo code to handle_key. You'll 
need to add a variable CJK_local_input to the SPEC struct (defined at the 
top of input.c) and you'll also need to initialise it to zero in 
fl_create_input.

--- input.c     2002-06-03 17:57:29.000000000 +0000
+++ input_trial.c       2003-01-27 18:42:01.000000000 +0000
@@ -858,6 +858,14 @@
            key = XK_End;
     }

+    /* toggle input method for CJK users */
+    if (key == XK_space) {
+       if (shiftkey_down(kmask) && ! sp->CJK_local_input)
+           turn_on_local_input(ob);
+       else if (!shiftkey_down(kmask) && sp->CJK_local_input)
+           turn_off_local_input(ob);
+    }
+
     /* translate all move key to cursor keys so we can distinguish 
edit/move
        keys more easily */

turn_on_local_input and turn_off_local_input are as yet undefined functions 
that will add and remove your magical attributes from your input context. I 
know absolutely nothing about such things. Note, however that these 
functions are passed the FL_OBJECT * ob, and so can ascertain the x,y,w,h 
information you desire.

Does this help you any?

-- 
Angus

Reply via email to