2004-08-26 14:29:25 +00:00
|
|
|
/*
|
|
|
|
* gtkimmoduleime
|
|
|
|
* Copyright (C) 2003 Takuro Ashie
|
|
|
|
* Copyright (C) 2003 Kazuki IWAMOTO
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2004-08-26 14:29:25 +00:00
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*/
|
|
|
|
|
2008-05-27 23:55:28 +00:00
|
|
|
#include <gtk/gtk.h>
|
2004-08-26 14:29:25 +00:00
|
|
|
|
|
|
|
#define GTK_TYPE_IM_CONTEXT_IME gtk_type_im_context_ime
|
2008-06-17 19:11:54 +00:00
|
|
|
#define GTK_IM_CONTEXT_IME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IM_CONTEXT_IME, GtkIMContextIME))
|
|
|
|
#define GTK_IM_CONTEXT_IME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IM_CONTEXT_IME, GtkIMContextIMEClass))
|
|
|
|
#define GTK_IS_IM_CONTEXT_IME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IM_CONTEXT_IME))
|
|
|
|
#define GTK_IS_IM_CONTEXT_IME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IM_CONTEXT_IME))
|
|
|
|
#define GTK_IM_CONTEXT_IME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IM_CONTEXT_IME, GtkIMContextIMEClass))
|
2004-08-26 14:29:25 +00:00
|
|
|
|
|
|
|
typedef struct _GtkIMContextIME GtkIMContextIME;
|
|
|
|
typedef struct _GtkIMContextIMEPrivate GtkIMContextIMEPrivate;
|
|
|
|
typedef struct _GtkIMContextIMEClass GtkIMContextIMEClass;
|
|
|
|
|
|
|
|
struct _GtkIMContextIME
|
|
|
|
{
|
|
|
|
GtkIMContext object;
|
|
|
|
|
2018-03-21 10:49:14 +00:00
|
|
|
GdkSurface *client_surface;
|
2018-03-20 10:40:08 +00:00
|
|
|
GdkSurface *toplevel;
|
2004-08-26 14:29:25 +00:00
|
|
|
guint use_preedit : 1;
|
|
|
|
guint preediting : 1;
|
|
|
|
guint opened : 1;
|
|
|
|
guint focus : 1;
|
|
|
|
GdkRectangle cursor_location;
|
input/IME: Defer the emit of the "commit" signal
On Windows, when IME is used, each keystroke results in the
WM_IME_COMPOSITION event being sent first. This means that in our case
when one decides on to accept the input that is in the preedit buffer,
we first get from Windows the WM_IME_COMPOSITION event
(where we emit the commit signal), followed by the WM_IME_ENDCOMPOSITION
event (where we emit the pair of preedit-changed and preedit-end
signals).
Since commit f11f989 (GtkEntry: Remove recompute idle), we do the input
recomputation directly, this will cause a pair of "Pango-WARNING:
Assertion failed: (index >= 0 && index <= layout->length)" being shown,
as gtkentry.c's priv->preedit_length and priv->preedit_cursor was unable
to be reset to 0 in time as a result of the recomputation triggered by
the commit being done before the reset of priv->preedit_length and
priv->preedit_cursor (which are no longer valid as we essentially say
that we are done with the preedit buffer).
As we could only acquire the final string that was entered in this
preedit session when we handle the WM_IME_COMPOSITION event, fix this by
saving up the final string we acquire from Windows IME in UTF-8 when we
handle the WM_IME_COMPOSITION event from Windows, and emit the commit
signal with that string after we emit the preedit-changed and
preedit-end signals when we handle the WM_IME_ENDCOMPOSITION event from
Windows, which comes afterwards.
Also fix the formatting of the code around the parts of the files that
was changed.
https://bugzilla.gnome.org/show_bug.cgi?id=787142
2017-08-31 10:43:07 +00:00
|
|
|
gchar *commit_string;
|
2004-08-26 14:29:25 +00:00
|
|
|
|
|
|
|
GtkIMContextIMEPrivate *priv;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GtkIMContextIMEClass
|
|
|
|
{
|
|
|
|
GtkIMContextClass parent_class;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void gtk_im_context_ime_register_type (GTypeModule * type_module);
|
|
|
|
GtkIMContext *gtk_im_context_ime_new (void);
|