|
Lines 876-882
Link Here
|
| 876 |
if (!new_value) |
876 |
if (!new_value) |
| 877 |
{ |
877 |
{ |
| 878 |
gtk_entry_reset_im_context (entry); |
878 |
gtk_entry_reset_im_context (entry); |
| 879 |
if (GTK_WIDGET_HAS_FOCUS (entry)) |
879 |
if (GTK_WIDGET_HAS_FOCUS (entry) && entry->visible) |
| 880 |
gtk_im_context_focus_out (entry->im_context); |
880 |
gtk_im_context_focus_out (entry->im_context); |
| 881 |
|
881 |
|
| 882 |
entry->preedit_length = 0; |
882 |
entry->preedit_length = 0; |
|
Lines 885-891
Link Here
|
| 885 |
|
885 |
|
| 886 |
entry->editable = new_value; |
886 |
entry->editable = new_value; |
| 887 |
|
887 |
|
| 888 |
if (new_value && GTK_WIDGET_HAS_FOCUS (entry)) |
888 |
if (new_value && GTK_WIDGET_HAS_FOCUS (entry) && entry->visible) |
| 889 |
gtk_im_context_focus_in (entry->im_context); |
889 |
gtk_im_context_focus_in (entry->im_context); |
| 890 |
|
890 |
|
| 891 |
gtk_entry_queue_draw (entry); |
891 |
gtk_entry_queue_draw (entry); |
|
Lines 1849-1855
Link Here
|
| 1849 |
|
1849 |
|
| 1850 |
gtk_entry_pend_cursor_blink (entry); |
1850 |
gtk_entry_pend_cursor_blink (entry); |
| 1851 |
|
1851 |
|
| 1852 |
if (entry->editable) |
1852 |
if (entry->editable && entry->visible) |
| 1853 |
{ |
1853 |
{ |
| 1854 |
if (gtk_im_context_filter_keypress (entry->im_context, event)) |
1854 |
if (gtk_im_context_filter_keypress (entry->im_context, event)) |
| 1855 |
{ |
1855 |
{ |
|
Lines 1876-1881
Link Here
|
| 1876 |
*/ |
1876 |
*/ |
| 1877 |
return TRUE; |
1877 |
return TRUE; |
| 1878 |
|
1878 |
|
|
|
1879 |
/* Commit key event directly if visible is set to FALSE. |
| 1880 |
*/ |
| 1881 |
if (entry->editable && !entry->visible) |
| 1882 |
{ |
| 1883 |
gunichar ch; |
| 1884 |
ch = gdk_keyval_to_unicode (event->keyval); |
| 1885 |
|
| 1886 |
if (g_unichar_validate (ch)) |
| 1887 |
{ |
| 1888 |
gchar buf[10]; |
| 1889 |
gint len; |
| 1890 |
len = g_unichar_to_utf8 (ch, buf); |
| 1891 |
buf[len] = '\0'; |
| 1892 |
|
| 1893 |
g_signal_emit_by_name (entry->im_context, "commit", &buf); |
| 1894 |
|
| 1895 |
return TRUE; |
| 1896 |
} |
| 1897 |
} |
| 1898 |
|
| 1879 |
return FALSE; |
1899 |
return FALSE; |
| 1880 |
} |
1900 |
} |
| 1881 |
|
1901 |
|
|
Lines 1885-1891
Link Here
|
| 1885 |
{ |
1905 |
{ |
| 1886 |
GtkEntry *entry = GTK_ENTRY (widget); |
1906 |
GtkEntry *entry = GTK_ENTRY (widget); |
| 1887 |
|
1907 |
|
| 1888 |
if (entry->editable) |
1908 |
if (entry->editable && entry->visible) |
| 1889 |
{ |
1909 |
{ |
| 1890 |
if (gtk_im_context_filter_keypress (entry->im_context, event)) |
1910 |
if (gtk_im_context_filter_keypress (entry->im_context, event)) |
| 1891 |
{ |
1911 |
{ |
|
Lines 1905-1911
Link Here
|
| 1905 |
|
1925 |
|
| 1906 |
gtk_widget_queue_draw (widget); |
1926 |
gtk_widget_queue_draw (widget); |
| 1907 |
|
1927 |
|
| 1908 |
if (entry->editable) |
1928 |
if (entry->editable && entry->visible) |
| 1909 |
{ |
1929 |
{ |
| 1910 |
entry->need_im_reset = TRUE; |
1930 |
entry->need_im_reset = TRUE; |
| 1911 |
gtk_im_context_focus_in (entry->im_context); |
1931 |
gtk_im_context_focus_in (entry->im_context); |
|
Lines 1929-1935
Link Here
|
| 1929 |
|
1949 |
|
| 1930 |
gtk_widget_queue_draw (widget); |
1950 |
gtk_widget_queue_draw (widget); |
| 1931 |
|
1951 |
|
| 1932 |
if (entry->editable) |
1952 |
if (entry->editable && entry->visible) |
| 1933 |
{ |
1953 |
{ |
| 1934 |
entry->need_im_reset = TRUE; |
1954 |
entry->need_im_reset = TRUE; |
| 1935 |
gtk_im_context_focus_out (entry->im_context); |
1955 |
gtk_im_context_focus_out (entry->im_context); |
|
Lines 2735-2741
Link Here
|
| 2735 |
gtk_entry_preedit_changed_cb (GtkIMContext *context, |
2755 |
gtk_entry_preedit_changed_cb (GtkIMContext *context, |
| 2736 |
GtkEntry *entry) |
2756 |
GtkEntry *entry) |
| 2737 |
{ |
2757 |
{ |
| 2738 |
if (entry->editable) |
2758 |
if (entry->editable && entry->visible) |
| 2739 |
{ |
2759 |
{ |
| 2740 |
gchar *preedit_string; |
2760 |
gchar *preedit_string; |
| 2741 |
gint cursor_pos; |
2761 |
gint cursor_pos; |
|
Lines 2756-2767
Link Here
|
| 2756 |
gtk_entry_retrieve_surrounding_cb (GtkIMContext *context, |
2776 |
gtk_entry_retrieve_surrounding_cb (GtkIMContext *context, |
| 2757 |
GtkEntry *entry) |
2777 |
GtkEntry *entry) |
| 2758 |
{ |
2778 |
{ |
| 2759 |
gtk_im_context_set_surrounding (context, |
2779 |
if (entry->visible) |
| 2760 |
entry->text, |
2780 |
{ |
| 2761 |
entry->n_bytes, |
2781 |
gtk_im_context_set_surrounding (context, |
| 2762 |
g_utf8_offset_to_pointer (entry->text, entry->current_pos) - entry->text); |
2782 |
entry->text, |
|
|
2783 |
entry->n_bytes, |
| 2784 |
g_utf8_offset_to_pointer (entry->text, entry->current_pos) - entry->text); |
| 2785 |
return TRUE; |
| 2786 |
} |
| 2763 |
|
2787 |
|
| 2764 |
return TRUE; |
2788 |
return FALSE; |
| 2765 |
} |
2789 |
} |
| 2766 |
|
2790 |
|
| 2767 |
static gboolean |
2791 |
static gboolean |
|
Lines 2770-2781
Link Here
|
| 2770 |
gint n_chars, |
2794 |
gint n_chars, |
| 2771 |
GtkEntry *entry) |
2795 |
GtkEntry *entry) |
| 2772 |
{ |
2796 |
{ |
| 2773 |
if (entry->editable) |
2797 |
if (entry->editable && entry->visible) |
| 2774 |
gtk_editable_delete_text (GTK_EDITABLE (entry), |
2798 |
{ |
| 2775 |
entry->current_pos + offset, |
2799 |
gtk_editable_delete_text (GTK_EDITABLE (entry), |
| 2776 |
entry->current_pos + offset + n_chars); |
2800 |
entry->current_pos + offset, |
|
|
2801 |
entry->current_pos + offset + n_chars); |
| 2777 |
|
2802 |
|
| 2778 |
return TRUE; |
2803 |
return TRUE; |
|
|
2804 |
} |
| 2805 |
|
| 2806 |
return FALSE; |
| 2779 |
} |
2807 |
} |
| 2780 |
|
2808 |
|
| 2781 |
/* Internal functions |
2809 |
/* Internal functions |
|
Lines 2874-2880
Link Here
|
| 2874 |
area.width = 0; |
2902 |
area.width = 0; |
| 2875 |
area.height = area_height; |
2903 |
area.height = area_height; |
| 2876 |
|
2904 |
|
| 2877 |
gtk_im_context_set_cursor_location (entry->im_context, &area); |
2905 |
if (entry->visible) |
|
|
2906 |
gtk_im_context_set_cursor_location (entry->im_context, &area); |
| 2878 |
} |
2907 |
} |
| 2879 |
|
2908 |
|
| 2880 |
static gboolean |
2909 |
static gboolean |
|
Lines 2947-2953
Link Here
|
| 2947 |
|
2976 |
|
| 2948 |
pango_layout_set_single_paragraph_mode (layout, TRUE); |
2977 |
pango_layout_set_single_paragraph_mode (layout, TRUE); |
| 2949 |
|
2978 |
|
| 2950 |
if (include_preedit) |
2979 |
if (include_preedit && entry->visible) |
| 2951 |
{ |
2980 |
{ |
| 2952 |
gtk_im_context_get_preedit_string (entry->im_context, |
2981 |
gtk_im_context_get_preedit_string (entry->im_context, |
| 2953 |
&preedit_string, &preedit_attrs, NULL); |
2982 |
&preedit_string, &preedit_attrs, NULL); |
|
Lines 3295-3301
Link Here
|
| 3295 |
static void |
3324 |
static void |
| 3296 |
gtk_entry_reset_im_context (GtkEntry *entry) |
3325 |
gtk_entry_reset_im_context (GtkEntry *entry) |
| 3297 |
{ |
3326 |
{ |
| 3298 |
if (entry->need_im_reset) |
3327 |
if (entry->need_im_reset && entry->visible) |
| 3299 |
{ |
3328 |
{ |
| 3300 |
entry->need_im_reset = 0; |
3329 |
entry->need_im_reset = 0; |
| 3301 |
gtk_im_context_reset (entry->im_context); |
3330 |
gtk_im_context_reset (entry->im_context); |