gtk2/gtk/gtkimcontextime.h

61 lines
2.2 KiB
C
Raw Normal View History

/*
* 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/>.
*
* $Id$
*/
#include <gtk/gtk.h>
#define GTK_TYPE_IM_CONTEXT_IME (gtk_im_context_ime_get_type ())
#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))
typedef struct _GtkIMContextIME GtkIMContextIME;
typedef struct _GtkIMContextIMEPrivate GtkIMContextIMEPrivate;
typedef struct _GtkIMContextIMEClass GtkIMContextIMEClass;
struct _GtkIMContextIME
{
GtkIMContext object;
GdkSurface *client_surface;
GdkWindow -> GdkSurface initial type rename This renames the GdkWindow class and related classes (impl, backend subclasses) to surface. Additionally it renames related types: GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType, GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge This is an automatic conversion using the below commands: git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass git sed -f g GdkWindow GdkSurface git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2" git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE" git sed -f g "broadway_window" "broadway_surface" git sed -f g "BroadwayWindow" "BroadwaySurface" git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE" git sed -f g "wayland_window" "wayland_surface" git sed -f g "WaylandWindow" "WaylandSurface" git sed -f g "X11_WINDOW" "X11_SURFACE" git sed -f g "x11_window" "x11_surface" git sed -f g "X11Window" "X11Surface" git sed -f g "WIN32_WINDOW" "WIN32_SURFACE" git sed -f g "win32_window" "win32_surface" git sed -f g "Win32Window" "Win32Surface" git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE" git sed -f g "quartz_window" "quartz_surface" git sed -f g "QuartzWindow" "QuartzSurface" git checkout NEWS* po-properties
2018-03-20 10:40:08 +00:00
GdkSurface *toplevel;
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;
GtkIMContextIMEPrivate *priv;
};
struct _GtkIMContextIMEClass
{
GtkIMContextClass parent_class;
};
GDK_AVAILABLE_IN_ALL
GType gtk_im_context_ime_get_type (void) G_GNUC_CONST;
void gtk_im_context_ime_register_type (GTypeModule * type_module);
GtkIMContext *gtk_im_context_ime_new (void);