forked from AuroraMiddleware/gtk
Bug 705182 Reset Cocoa IME state when immodule is reset
Commits the pre-edit string on receipt of focus_out and reset commands. Patch refinements by Cody Russell <bratsche@gnome.org> and Ek Kato <ek.kato@gmail.com>
This commit is contained in:
parent
e67d0119fe
commit
9ca802161e
@ -210,10 +210,41 @@ quartz_filter_keypress (GtkIMContext *context,
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
discard_preedit (GtkIMContext *context)
|
||||||
|
{
|
||||||
|
GtkIMContextQuartz *qc = GTK_IM_CONTEXT_QUARTZ (context);
|
||||||
|
|
||||||
|
if (!qc->client_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
NSView *nsview = gdk_quartz_window_get_nsview (qc->client_window);
|
||||||
|
if (!nsview)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (GDK_IS_WINDOW (nsview))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* reset any partial input for this NSView */
|
||||||
|
[(GdkQuartzView *)nsview unmarkText];
|
||||||
|
NSInputManager *currentInputManager = [NSInputManager currentInputManager];
|
||||||
|
[currentInputManager markedTextAbandoned:nsview];
|
||||||
|
|
||||||
|
if (qc->preedit_str)
|
||||||
|
{
|
||||||
|
g_signal_emit_by_name (context, "commit", qc->preedit_str);
|
||||||
|
|
||||||
|
g_free (qc->preedit_str);
|
||||||
|
qc->preedit_str = NULL;
|
||||||
|
g_signal_emit_by_name (context, "preedit_changed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
quartz_reset (GtkIMContext *context)
|
quartz_reset (GtkIMContext *context)
|
||||||
{
|
{
|
||||||
GTK_NOTE (MISC, g_print ("quartz_reset\n"));
|
GTK_NOTE (MISC, g_print ("quartz_reset\n"));
|
||||||
|
discard_preedit (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -242,6 +273,9 @@ quartz_focus_out (GtkIMContext *context)
|
|||||||
|
|
||||||
GtkIMContextQuartz *qc = GTK_IM_CONTEXT_QUARTZ (context);
|
GtkIMContextQuartz *qc = GTK_IM_CONTEXT_QUARTZ (context);
|
||||||
qc->focused = FALSE;
|
qc->focused = FALSE;
|
||||||
|
|
||||||
|
/* Commit any partially built strings or it'll mess up other GTK+ widgets in the window */
|
||||||
|
discard_preedit (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user