TextBox and TextArea KeyPress events cannot be stolen by other controls anymore.
[GB.GTK] * BUG: TextBox and TextArea KeyPress events cannot be stolen by other controls anymore. [GB.GTK3] * BUG: TextBox and TextArea KeyPress events cannot be stolen by other controls anymore.
This commit is contained in:
parent
517266b4e4
commit
4771af3b27
4 changed files with 10 additions and 7 deletions
|
@ -240,12 +240,15 @@ bool gKey::mustIgnoreEvent(GdkEventKey *event)
|
|||
return (event->type == GDK_KEY_PRESS) && (event->keyval == 0 || !event->string || (uchar)*event->string >= 32);
|
||||
}
|
||||
|
||||
void gcb_im_commit(GtkIMContext *context, const char *str, gpointer pointer)
|
||||
void gcb_im_commit(GtkIMContext *context, const char *str, gControl *control)
|
||||
{
|
||||
bool disable = false;
|
||||
|
||||
if (!control)
|
||||
control = _im_control;
|
||||
|
||||
// Not called from a key press event!
|
||||
if (!_im_control)
|
||||
if (!control)
|
||||
return;
|
||||
|
||||
#if DEBUG_IM
|
||||
|
@ -254,12 +257,12 @@ void gcb_im_commit(GtkIMContext *context, const char *str, gpointer pointer)
|
|||
|
||||
if (!gKey::valid())
|
||||
{
|
||||
gKey::enable(_im_control, NULL);
|
||||
gKey::enable(control, NULL);
|
||||
gKey::_event.keyval = gKey::_last_key_press;
|
||||
disable = true;
|
||||
}
|
||||
|
||||
gKey::_canceled = gKey::raiseEvent(gEvent_KeyPress, _im_control, str);
|
||||
gKey::_canceled = gKey::raiseEvent(gEvent_KeyPress, control, str);
|
||||
#if DEBUG_IM
|
||||
fprintf(stderr, "cb_im_commit: canceled = %d\n", gKey::_canceled);
|
||||
#endif
|
||||
|
|
|
@ -64,7 +64,7 @@ private:
|
|||
static bool _valid;
|
||||
};
|
||||
|
||||
void gcb_im_commit(GtkIMContext *context, const char *str, gpointer pointer);
|
||||
void gcb_im_commit(GtkIMContext *context, const char *str, gControl *control);
|
||||
gboolean gcb_key_event(GtkWidget *widget, GdkEvent *event, gControl *data);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -341,7 +341,7 @@ static void cb_insert_text(GtkTextBuffer *buf, GtkTextIter *location, gchar *tex
|
|||
|
||||
if (gKey::gotCommit())
|
||||
{
|
||||
gcb_im_commit(NULL, text, NULL);
|
||||
gcb_im_commit(NULL, text, ctrl);
|
||||
if (gKey::canceled())
|
||||
{
|
||||
g_signal_stop_emission_by_name(G_OBJECT(buf), "insert-text");
|
||||
|
|
|
@ -80,7 +80,7 @@ static void cb_before_insert(GtkEditable *editable, gchar *new_text, gint new_te
|
|||
{
|
||||
if (gKey::gotCommit())
|
||||
{
|
||||
gcb_im_commit(NULL, new_text, NULL);
|
||||
gcb_im_commit(NULL, new_text, data);
|
||||
if (gKey::canceled())
|
||||
g_signal_stop_emission_by_name (G_OBJECT(editable), "insert-text");
|
||||
*position = gtk_editable_get_position(editable);
|
||||
|
|
Loading…
Reference in a new issue