Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 387315 - Use gtk_entry_im_context_filter_keypress to omit direct ImContext call
Summary: Use gtk_entry_im_context_filter_keypress to omit direct ImContext call
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.3 M3   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 386931 (view as bug list)
Depends on:
Blocks: 340067
  Show dependency tree
 
Reported: 2012-08-15 14:58 EDT by Anatoly Spektor CLA
Modified: 2012-10-31 09:46 EDT (History)
2 users (show)

See Also:


Attachments
possible fix (932 bytes, patch)
2012-09-07 17:14 EDT, Silenio Quarti CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anatoly Spektor CLA 2012-08-15 14:58:30 EDT
This bug is related to : https://bugs.eclipse.org/bugs/show_bug.cgi?id=386931

 This patch uses new GTK+ API  gtk_entry_im_context_filter_keypress() method thus avoiding use of gtk_im_context_filter_keypress () that tries to directly access im_context in GtkEntry class:

http://fedorapeople.org/cgit/aspektor/public_git/eclipse.platform.swt.git/log/?h=gtk_im_context_filter_keypress
Comment 1 Anatoly Spektor CLA 2012-08-15 15:15:34 EDT
There are still 2 cases left  where gtk_im_context_filter_keypress ()  not covered by the patch, they are in Text Widget. I have tried both gtk_entry_im_context... and gtk_text_view_im_context... to replace functions in Text, but I keep getting wrong result together with the critical warnings about not GTK_ENTRY or not GTK_IM_CONTEXT.


 If someone could take a look at these cases, It would be highly appreciated.

  Regards,


 Anatoly
Comment 2 Anatoly Spektor CLA 2012-08-15 16:28:35 EDT
(In reply to comment #1)
> There are still 2 cases left  where gtk_im_context_filter_keypress ()  not
> covered by the patch, they are in Text Widget. I have tried both
> gtk_entry_im_context... and gtk_text_view_im_context... to replace functions
> in Text, but I keep getting wrong result together with the critical warnings
> about not GTK_ENTRY or not GTK_IM_CONTEXT.
> 
> 
>  If someone could take a look at these cases, It would be highly appreciated.
> 
>   Regards,
> 
> 
>  Anatoly

One more comment regarding gtk_im_context_filter_keypress

 In Control widget there is this code :

 int /*long*/ imHandle = imHandle ();
	if (imHandle != 0) {
		if (OS.gtk_im_context_filter_keypress (imHandle, event)) return 1;
	}

 and imHandle:

int /*long*/ imHandle () {
	return 0;
}

So if imHandle always returns zero, filter_keypress can't be reached. Is this done intentionally, for some special purposes, or it is part of some old code and filter_keypress can be removed ?


Thanks,

Anatoly
Comment 3 Silenio Quarti CLA 2012-09-07 12:31:24 EDT
(In reply to comment #2)
> So if imHandle always returns zero, filter_keypress can't be reached. Is
> this done intentionally, for some special purposes, or it is part of some
> old code and filter_keypress can be removed ?

The method imHandle() is re-implemented in Composite. StyledText has an imHandle for example.
Comment 4 Silenio Quarti CLA 2012-09-07 17:14:37 EDT
Created attachment 220855 [details]
possible fix

Here is way of getting the IM Context of GtkEntry and GtkTextView widgets.  It works, but it is very "hack". It overwrites the GtkIMMulticontext constructor to get a hold of the one created by the text widgets. 

Another option is to use gtk_entry_im_context_filter_keypress() (your patch). And the new "preedit-changed" signal to replace what it is done with the "commit" signal. We would have to some how send key events from gtk_insert_text() which is called when the native commit signal is handled. I played around with this solution, but it became more hack than the one above and it did not get it to work since I could not reliably determine when to send key events. Maybe we could make this work, but I think we are going to use the hack above.
Comment 5 Arun Thondapu CLA 2012-09-09 09:41:50 EDT
(In reply to comment #4)
> Created attachment 220855 [details]
> possible fix
> 
This seems to be the patch from bug 382812.
Comment 6 Silenio Quarti CLA 2012-09-10 10:28:14 EDT
(In reply to comment #5)
> This seems to be the patch from bug 382812.

It fixes this bug as well.
Comment 7 Silenio Quarti CLA 2012-10-24 17:15:02 EDT
(In reply to comment #6)
> (In reply to comment #5)
> > This seems to be the patch from bug 382812.
> 
> It fixes this bug as well.

I am sorry. I just realized I attached a completely unrelated patch.
Comment 8 Silenio Quarti CLA 2012-10-24 17:19:35 EDT
*** Bug 386931 has been marked as a duplicate of this bug. ***
Comment 9 Silenio Quarti CLA 2012-10-24 17:24:43 EDT
Unfortunately, I lost the patch. I will rewrite it, but for now I just removed the compile error:

http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=7412358a7a63a2695a4ecdf1d3a7d47db7890ea9