summaryrefslogtreecommitdiff
path: root/modules/input
diff options
context:
space:
mode:
authorHidetoshi Tajima <hidetoshi.tajima@sun.com>2003-06-06 19:42:10 +0000
committerHidetoshi Tajima <tajima@src.gnome.org>2003-06-06 19:42:10 +0000
commit16191e527407f6d24b8cd376de8b106233ee5906 (patch)
tree2f0bef7a93ab0718a7ef6d8bb2449061d4167aff /modules/input
parente793749779429d2bb0e0b382db686ec788b93589 (diff)
downloadgtk+-16191e527407f6d24b8cd376de8b106233ee5906.tar.gz
Add a 'finalizing' flag to keep preedit-[start,changed,end] signals from
Fri Jun 6 11:05:45 2003 Hidetoshi Tajima <hidetoshi.tajima@sun.com> * modules/input/gtkimcontextxim.h (struct _GtkIMContextXIM): * modules/input/gtkimcontextxim.c (preedit_start_callback, preedit_draw_callback, preedit_done_callback): Add a 'finalizing' flag to keep preedit-[start,changed,end] signals from being called during finalization (#111861).
Diffstat (limited to 'modules/input')
-rw-r--r--modules/input/gtkimcontextxim.c47
-rw-r--r--modules/input/gtkimcontextxim.h1
2 files changed, 27 insertions, 21 deletions
diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c
index 953f8916bd..570337c539 100644
--- a/modules/input/gtkimcontextxim.c
+++ b/modules/input/gtkimcontextxim.c
@@ -75,11 +75,9 @@ static void gtk_im_context_xim_get_preedit_string (GtkIMContext *co
PangoAttrList **attrs,
gint *cursor_pos);
-static void reinitialize_ic (GtkIMContextXIM *context_xim,
- gboolean send_signal);
+static void reinitialize_ic (GtkIMContextXIM *context_xim);
static void set_ic_client_window (GtkIMContextXIM *context_xim,
- GdkWindow *client_window,
- gboolean send_signal);
+ GdkWindow *client_window);
static void setup_styles (GtkXIMInfo *info);
@@ -175,7 +173,7 @@ reinitialize_all_ics (GtkXIMInfo *info)
GSList *tmp_list;
for (tmp_list = info->ics; tmp_list; tmp_list = tmp_list->next)
- reinitialize_ic (tmp_list->data, TRUE);
+ reinitialize_ic (tmp_list->data);
}
static void
@@ -320,7 +318,7 @@ xim_info_display_closed (GdkDisplay *display,
info->ics = NULL;
for (tmp_list = ics; tmp_list; tmp_list = tmp_list->next)
- set_ic_client_window (tmp_list->data, NULL, TRUE);
+ set_ic_client_window (tmp_list->data, NULL);
g_slist_free (ics);
@@ -418,6 +416,7 @@ gtk_im_context_xim_init (GtkIMContextXIM *im_context_xim)
im_context_xim->use_preedit = TRUE;
im_context_xim->filter_key_release = FALSE;
im_context_xim->status_visible = FALSE;
+ im_context_xim->finalizing = FALSE;
}
static void
@@ -425,15 +424,16 @@ gtk_im_context_xim_finalize (GObject *obj)
{
GtkIMContextXIM *context_xim = GTK_IM_CONTEXT_XIM (obj);
- set_ic_client_window (context_xim, NULL, FALSE);
+ context_xim->finalizing = TRUE;
+
+ set_ic_client_window (context_xim, NULL);
g_free (context_xim->locale);
g_free (context_xim->mb_charset);
}
static void
-reinitialize_ic (GtkIMContextXIM *context_xim,
- gboolean send_signal)
+reinitialize_ic (GtkIMContextXIM *context_xim)
{
if (context_xim->ic)
{
@@ -444,7 +444,7 @@ reinitialize_ic (GtkIMContextXIM *context_xim,
if (context_xim->preedit_length)
{
context_xim->preedit_length = 0;
- if (send_signal)
+ if (!context_xim->finalizing)
g_signal_emit_by_name (context_xim, "preedit_changed");
}
}
@@ -452,10 +452,9 @@ reinitialize_ic (GtkIMContextXIM *context_xim,
static void
set_ic_client_window (GtkIMContextXIM *context_xim,
- GdkWindow *client_window,
- gboolean send_signal)
+ GdkWindow *client_window)
{
- reinitialize_ic (context_xim, send_signal);
+ reinitialize_ic (context_xim);
if (context_xim->client_window)
{
context_xim->im_info->ics = g_slist_remove (context_xim->im_info->ics, context_xim);
@@ -477,7 +476,7 @@ gtk_im_context_xim_set_client_window (GtkIMContext *context,
{
GtkIMContextXIM *context_xim = GTK_IM_CONTEXT_XIM (context);
- set_ic_client_window (context_xim, client_window, TRUE);
+ set_ic_client_window (context_xim, client_window);
}
GtkIMContext *
@@ -677,7 +676,7 @@ gtk_im_context_xim_set_use_preedit (GtkIMContext *context,
if (context_xim->use_preedit != use_preedit)
{
context_xim->use_preedit = use_preedit;
- reinitialize_ic (context_xim, TRUE);
+ reinitialize_ic (context_xim);
}
return;
@@ -836,8 +835,10 @@ preedit_start_callback (XIC xic,
XPointer call_data)
{
GtkIMContext *context = GTK_IM_CONTEXT (client_data);
+ GtkIMContextXIM *context_xim = GTK_IM_CONTEXT_XIM (context);
- g_signal_emit_by_name (context, "preedit_start");
+ if (!context_xim->finalizing)
+ g_signal_emit_by_name (context, "preedit_start");
}
static void
@@ -846,8 +847,10 @@ preedit_done_callback (XIC xic,
XPointer call_data)
{
GtkIMContext *context = GTK_IM_CONTEXT (client_data);
-
- g_signal_emit_by_name (context, "preedit_end");
+ GtkIMContextXIM *context_xim = GTK_IM_CONTEXT_XIM (context);
+
+ if (!context_xim->finalizing)
+ g_signal_emit_by_name (context, "preedit_end");
}
static gint
@@ -972,7 +975,8 @@ preedit_draw_callback (XIC xic,
if (new_text)
g_free (new_text);
- g_signal_emit_by_name (context, "preedit_changed");
+ if (!context->finalizing)
+ g_signal_emit_by_name (context, "preedit_changed");
}
@@ -986,7 +990,8 @@ preedit_caret_callback (XIC xic,
if (call_data->direction == XIMAbsolutePosition)
{
context->preedit_cursor = call_data->position;
- g_signal_emit_by_name (context, "preedit_changed");
+ if (!context->finalizing)
+ g_signal_emit_by_name (context, "preedit_changed");
}
else
{
@@ -1018,7 +1023,7 @@ status_draw_callback (XIC xic,
{
GtkIMContextXIM *context = GTK_IM_CONTEXT_XIM (client_data);
- if (context->status_visible == FALSE)
+ if (!context->status_visible)
return;
if (call_data->type == XIMTextType)
diff --git a/modules/input/gtkimcontextxim.h b/modules/input/gtkimcontextxim.h
index 84d5ee534f..006ecbeacc 100644
--- a/modules/input/gtkimcontextxim.h
+++ b/modules/input/gtkimcontextxim.h
@@ -75,6 +75,7 @@ struct _GtkIMContextXIM
guint use_preedit : 1;
guint status_visible : 1;
+ guint finalizing : 1;
};
struct _GtkIMContextXIMClass