diff options
Diffstat (limited to 'meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktextview.c.diff')
| -rw-r--r-- | meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktextview.c.diff | 417 |
1 files changed, 0 insertions, 417 deletions
diff --git a/meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktextview.c.diff b/meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktextview.c.diff deleted file mode 100644 index 7323574a64..0000000000 --- a/meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktextview.c.diff +++ /dev/null | |||
| @@ -1,417 +0,0 @@ | |||
| 1 | --- gtk+-2.6.4/gtk/gtktextview.c 2005-03-01 08:28:56.000000000 +0200 | ||
| 2 | +++ gtk+-2.6.4/gtk/gtktextview.c 2005-04-06 16:19:38.152738264 +0300 | ||
| 3 | @@ -99,6 +99,11 @@ | ||
| 4 | |||
| 5 | #define SPACE_FOR_CURSOR 1 | ||
| 6 | |||
| 7 | +typedef struct _GtkTextViewPrivate GtkTextViewPrivate; | ||
| 8 | + | ||
| 9 | +#define GTK_TEXT_VIEW_GET_PRIVATE(obj) ( G_TYPE_INSTANCE_GET_PRIVATE ((obj),\ | ||
| 10 | + GTK_TYPE_TEXT_VIEW, GtkTextViewPrivate) ) | ||
| 11 | + | ||
| 12 | struct _GtkTextPendingScroll | ||
| 13 | { | ||
| 14 | GtkTextMark *mark; | ||
| 15 | @@ -145,6 +150,8 @@ | ||
| 16 | PROP_BUFFER, | ||
| 17 | PROP_OVERWRITE, | ||
| 18 | PROP_ACCEPTS_TAB, | ||
| 19 | + PROP_AUTOCAP, | ||
| 20 | + PROP_INPUT_MODE, | ||
| 21 | LAST_PROP | ||
| 22 | }; | ||
| 23 | |||
| 24 | @@ -343,6 +350,13 @@ | ||
| 25 | |||
| 26 | static void gtk_text_view_update_im_spot_location (GtkTextView *text_view); | ||
| 27 | |||
| 28 | +static void gtk_text_view_set_autocap (GtkTextView *text_view, | ||
| 29 | + gboolean autocap); | ||
| 30 | +static gboolean gtk_text_view_get_autocap (GtkTextView *text_view); | ||
| 31 | +static void gtk_text_view_set_input_mode (GtkTextView *text_view, | ||
| 32 | + gint mode); | ||
| 33 | +static gint gtk_text_view_get_input_mode (GtkTextView *text_view); | ||
| 34 | + | ||
| 35 | /* Container methods */ | ||
| 36 | static void gtk_text_view_add (GtkContainer *container, | ||
| 37 | GtkWidget *child); | ||
| 38 | @@ -412,6 +426,10 @@ | ||
| 39 | static gint text_window_get_width (GtkTextWindow *win); | ||
| 40 | static gint text_window_get_height (GtkTextWindow *win); | ||
| 41 | |||
| 42 | +struct _GtkTextViewPrivate | ||
| 43 | +{ | ||
| 44 | + guint release_selection : 1; | ||
| 45 | +}; | ||
| 46 | |||
| 47 | static const GtkTargetEntry target_table[] = { | ||
| 48 | { "GTK_TEXT_BUFFER_CONTENTS", GTK_TARGET_SAME_APP, 0 }, | ||
| 49 | @@ -481,6 +499,7 @@ | ||
| 50 | |||
| 51 | parent_class = g_type_class_peek_parent (klass); | ||
| 52 | |||
| 53 | + g_type_class_add_private( klass, sizeof(GtkTextViewPrivate) ); | ||
| 54 | /* Default handlers and virtual methods | ||
| 55 | */ | ||
| 56 | gobject_class->set_property = gtk_text_view_set_property; | ||
| 57 | @@ -667,6 +686,24 @@ | ||
| 58 | TRUE, | ||
| 59 | G_PARAM_READWRITE)); | ||
| 60 | |||
| 61 | + g_object_class_install_property (gobject_class, | ||
| 62 | + PROP_AUTOCAP, | ||
| 63 | + g_param_spec_boolean ("autocap", | ||
| 64 | + P_("auto capitalization"), | ||
| 65 | + P_("Enable autocap support"), | ||
| 66 | + TRUE, | ||
| 67 | + G_PARAM_READABLE | G_PARAM_WRITABLE)); | ||
| 68 | + | ||
| 69 | + g_object_class_install_property (gobject_class, | ||
| 70 | + PROP_INPUT_MODE, | ||
| 71 | + g_param_spec_int ("input_mode", | ||
| 72 | + P_("input mode"), | ||
| 73 | + P_("Define widget's input mode"), | ||
| 74 | + 0, | ||
| 75 | + 9, /* keep me updated */ | ||
| 76 | + 0, | ||
| 77 | + G_PARAM_READABLE | G_PARAM_WRITABLE)); | ||
| 78 | + | ||
| 79 | /* | ||
| 80 | * Style properties | ||
| 81 | */ | ||
| 82 | @@ -676,6 +713,14 @@ | ||
| 83 | P_("Color with which to draw error-indication underlines"), | ||
| 84 | GDK_TYPE_COLOR, | ||
| 85 | G_PARAM_READABLE)); | ||
| 86 | + | ||
| 87 | + gtk_widget_class_install_style_property (widget_class, | ||
| 88 | + g_param_spec_boolean ("autocap", | ||
| 89 | + _("auto capitalization"), | ||
| 90 | + _("Enable autocap support"), | ||
| 91 | + TRUE, | ||
| 92 | + G_PARAM_READABLE)); | ||
| 93 | + | ||
| 94 | |||
| 95 | /* | ||
| 96 | * Signals | ||
| 97 | @@ -1040,8 +1085,9 @@ | ||
| 98 | gtk_text_view_init (GtkTextView *text_view) | ||
| 99 | { | ||
| 100 | GtkWidget *widget; | ||
| 101 | - | ||
| 102 | + GtkTextViewPrivate *priv = NULL; | ||
| 103 | widget = GTK_WIDGET (text_view); | ||
| 104 | + priv = GTK_TEXT_VIEW_GET_PRIVATE(text_view); | ||
| 105 | |||
| 106 | GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS); | ||
| 107 | |||
| 108 | @@ -1057,6 +1103,8 @@ | ||
| 109 | text_view->tabs = NULL; | ||
| 110 | text_view->editable = TRUE; | ||
| 111 | |||
| 112 | + priv->release_selection = TRUE; | ||
| 113 | + | ||
| 114 | gtk_drag_dest_set (widget, | ||
| 115 | 0, | ||
| 116 | target_table, G_N_ELEMENTS (target_table), | ||
| 117 | @@ -1070,6 +1118,10 @@ | ||
| 118 | * to it; so we create it here and destroy it in finalize (). | ||
| 119 | */ | ||
| 120 | text_view->im_context = gtk_im_multicontext_new (); | ||
| 121 | + /* Set default stuff. */ | ||
| 122 | + gtk_text_view_set_autocap (text_view, TRUE); | ||
| 123 | + gtk_text_view_set_input_mode (text_view, 0); /* alpha-numeric-special */ | ||
| 124 | + g_object_set (G_OBJECT (text_view->im_context), "use-show-hide", TRUE, NULL); | ||
| 125 | |||
| 126 | g_signal_connect (text_view->im_context, "commit", | ||
| 127 | G_CALLBACK (gtk_text_view_commit_handler), text_view); | ||
| 128 | @@ -2664,6 +2716,14 @@ | ||
| 129 | gtk_text_view_set_accepts_tab (text_view, g_value_get_boolean (value)); | ||
| 130 | break; | ||
| 131 | |||
| 132 | + case PROP_AUTOCAP: | ||
| 133 | + gtk_text_view_set_autocap (text_view, g_value_get_boolean (value)); | ||
| 134 | + break; | ||
| 135 | + | ||
| 136 | + case PROP_INPUT_MODE: | ||
| 137 | + gtk_text_view_set_input_mode (text_view, g_value_get_int (value)); | ||
| 138 | + break; | ||
| 139 | + | ||
| 140 | default: | ||
| 141 | g_assert_not_reached (); | ||
| 142 | break; | ||
| 143 | @@ -2738,6 +2798,14 @@ | ||
| 144 | g_value_set_boolean (value, text_view->accepts_tab); | ||
| 145 | break; | ||
| 146 | |||
| 147 | + case PROP_AUTOCAP: | ||
| 148 | + g_value_set_boolean (value, gtk_text_view_get_autocap (text_view)); | ||
| 149 | + break; | ||
| 150 | + | ||
| 151 | + case PROP_INPUT_MODE: | ||
| 152 | + g_value_set_int (value, gtk_text_view_get_input_mode (text_view)); | ||
| 153 | + break; | ||
| 154 | + | ||
| 155 | default: | ||
| 156 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
| 157 | break; | ||
| 158 | @@ -3916,7 +3984,7 @@ | ||
| 159 | GtkTextView *text_view = GTK_TEXT_VIEW (widget); | ||
| 160 | GtkTextMark *insert; | ||
| 161 | GtkTextIter iter; | ||
| 162 | - | ||
| 163 | + | ||
| 164 | if (text_view->layout == NULL || get_buffer (text_view) == NULL) | ||
| 165 | return FALSE; | ||
| 166 | |||
| 167 | @@ -4039,6 +4107,9 @@ | ||
| 168 | if (event->window != text_view->text_window->bin_window) | ||
| 169 | return FALSE; | ||
| 170 | |||
| 171 | + if (text_view->editable) | ||
| 172 | + gtk_im_context_show (text_view->im_context); | ||
| 173 | + | ||
| 174 | if (event->button == 1) | ||
| 175 | { | ||
| 176 | if (text_view->drag_start_x >= 0) | ||
| 177 | @@ -4083,7 +4154,15 @@ | ||
| 178 | static gint | ||
| 179 | gtk_text_view_focus_in_event (GtkWidget *widget, GdkEventFocus *event) | ||
| 180 | { | ||
| 181 | + /*gboolean have_selection; | ||
| 182 | + GtkTextIter sel_start, sel_end;*/ | ||
| 183 | + | ||
| 184 | GtkTextView *text_view = GTK_TEXT_VIEW (widget); | ||
| 185 | + | ||
| 186 | + /*have_selection = gtk_text_buffer_get_selection_bounds(text_view->buffer, &sel_start, &sel_end); | ||
| 187 | + | ||
| 188 | + if(!have_selection) | ||
| 189 | + gtk_text_view_move_cursor(text_view, GTK_MOVEMENT_BUFFER_ENDS, 1, FALSE);*//*FIXME some other way to place the cursor in the end*/ | ||
| 190 | |||
| 191 | gtk_widget_queue_draw (widget); | ||
| 192 | |||
| 193 | @@ -4100,8 +4179,10 @@ | ||
| 194 | G_CALLBACK (keymap_direction_changed), text_view); | ||
| 195 | gtk_text_view_check_keymap_direction (text_view); | ||
| 196 | |||
| 197 | + /* Keyboard hack */ | ||
| 198 | text_view->need_im_reset = TRUE; | ||
| 199 | gtk_im_context_focus_in (GTK_TEXT_VIEW (widget)->im_context); | ||
| 200 | + gtk_text_view_reset_im_context (text_view); | ||
| 201 | |||
| 202 | return FALSE; | ||
| 203 | } | ||
| 204 | @@ -4110,6 +4191,14 @@ | ||
| 205 | gtk_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event) | ||
| 206 | { | ||
| 207 | GtkTextView *text_view = GTK_TEXT_VIEW (widget); | ||
| 208 | + GtkTextViewPrivate *priv = GTK_TEXT_VIEW_GET_PRIVATE(text_view); | ||
| 209 | + /*{ | ||
| 210 | + GtkTextIter start; | ||
| 211 | + GtkTextIter end; | ||
| 212 | + | ||
| 213 | + gtk_text_buffer_get_bounds(text_view->buffer, &start, &end); | ||
| 214 | + gtk_text_buffer_select_range(text_view->buffer, &start, &start); | ||
| 215 | + }*//*FIXME need a hack here to take away the focus*/ | ||
| 216 | |||
| 217 | gtk_widget_queue_draw (widget); | ||
| 218 | |||
| 219 | @@ -4125,8 +4214,11 @@ | ||
| 220 | keymap_direction_changed, | ||
| 221 | text_view); | ||
| 222 | |||
| 223 | - text_view->need_im_reset = TRUE; | ||
| 224 | - gtk_im_context_focus_out (GTK_TEXT_VIEW (widget)->im_context); | ||
| 225 | + /* This is commented out to disable unselect feature. | ||
| 226 | + When the decition of this has been made, we can either remove this patch | ||
| 227 | + or to leave it. | ||
| 228 | + if( priv->release_selection ) | ||
| 229 | + gtk_text_view_unselect( text_view );*/ | ||
| 230 | |||
| 231 | return FALSE; | ||
| 232 | } | ||
| 233 | @@ -5082,7 +5174,8 @@ | ||
| 234 | GtkTextIter end; | ||
| 235 | gboolean leave_one = FALSE; | ||
| 236 | |||
| 237 | - gtk_text_view_reset_im_context (text_view); | ||
| 238 | + /*gtk_text_view_reset_im_context (text_view);*/ /*backspace should not clear | ||
| 239 | + the word completion*/ | ||
| 240 | |||
| 241 | if (type == GTK_DELETE_CHARS) | ||
| 242 | { | ||
| 243 | @@ -5200,7 +5293,8 @@ | ||
| 244 | { | ||
| 245 | GtkTextIter insert; | ||
| 246 | |||
| 247 | - gtk_text_view_reset_im_context (text_view); | ||
| 248 | + /*gtk_text_view_reset_im_context (text_view);*/ /*backspace should not clear | ||
| 249 | + the word completion*/ | ||
| 250 | |||
| 251 | /* Backspace deletes the selection, if one exists */ | ||
| 252 | if (gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE, | ||
| 253 | @@ -5928,11 +6022,11 @@ | ||
| 254 | static void | ||
| 255 | gtk_text_view_reset_im_context (GtkTextView *text_view) | ||
| 256 | { | ||
| 257 | - if (text_view->need_im_reset) | ||
| 258 | +/* if (text_view->need_im_reset) | ||
| 259 | { | ||
| 260 | - text_view->need_im_reset = FALSE; | ||
| 261 | + text_view->need_im_reset = FALSE;*/ | ||
| 262 | gtk_im_context_reset (text_view->im_context); | ||
| 263 | - } | ||
| 264 | +/* }*/ | ||
| 265 | } | ||
| 266 | |||
| 267 | /* | ||
| 268 | @@ -6665,18 +6759,23 @@ | ||
| 269 | { | ||
| 270 | GtkTextIter start; | ||
| 271 | GtkTextIter end; | ||
| 272 | - gint pos; | ||
| 273 | + gint pos, endpos; | ||
| 274 | gchar *text; | ||
| 275 | |||
| 276 | - gtk_text_buffer_get_iter_at_mark (text_view->buffer, &start, | ||
| 277 | + gtk_text_buffer_get_iter_at_line (text_view->buffer, &start, 0); | ||
| 278 | + gtk_text_buffer_get_iter_at_mark (text_view->buffer, &end, | ||
| 279 | gtk_text_buffer_get_insert (text_view->buffer)); | ||
| 280 | - end = start; | ||
| 281 | |||
| 282 | - pos = gtk_text_iter_get_line_index (&start); | ||
| 283 | - gtk_text_iter_set_line_offset (&start, 0); | ||
| 284 | + pos = gtk_text_iter_get_line_index (&end); | ||
| 285 | + | ||
| 286 | gtk_text_iter_forward_to_line_end (&end); | ||
| 287 | + endpos = gtk_text_iter_get_line_index (&end); | ||
| 288 | |||
| 289 | text = gtk_text_iter_get_slice (&start, &end); | ||
| 290 | + if (text) | ||
| 291 | + pos = strlen (text) - (endpos - pos); /* want bytes, not characters */ | ||
| 292 | + else | ||
| 293 | + pos = 0; | ||
| 294 | gtk_im_context_set_surrounding (context, text, -1, pos); | ||
| 295 | g_free (text); | ||
| 296 | |||
| 297 | @@ -6726,8 +6825,8 @@ | ||
| 298 | need_reset = TRUE; | ||
| 299 | } | ||
| 300 | |||
| 301 | - if (need_reset) | ||
| 302 | - gtk_text_view_reset_im_context (text_view); | ||
| 303 | + /*if (need_reset) | ||
| 304 | + gtk_text_view_reset_im_context (text_view);*//*FIXME need a hack here*/ | ||
| 305 | } | ||
| 306 | |||
| 307 | static void | ||
| 308 | @@ -6957,6 +7056,13 @@ | ||
| 309 | } | ||
| 310 | |||
| 311 | static void | ||
| 312 | +block_selection_change( GtkMenuShell *menushell, gpointer user_data ) | ||
| 313 | +{ | ||
| 314 | + GtkTextViewPrivate *priv = GTK_TEXT_VIEW_GET_PRIVATE(user_data); | ||
| 315 | + priv->release_selection = TRUE; | ||
| 316 | +} | ||
| 317 | + | ||
| 318 | +static void | ||
| 319 | unichar_chosen_func (const char *text, | ||
| 320 | gpointer data) | ||
| 321 | { | ||
| 322 | @@ -7064,7 +7170,12 @@ | ||
| 323 | signals[POPULATE_POPUP], | ||
| 324 | 0, | ||
| 325 | text_view->popup_menu); | ||
| 326 | - | ||
| 327 | + { | ||
| 328 | + GtkTextViewPrivate *priv = GTK_TEXT_VIEW_GET_PRIVATE(text_view); | ||
| 329 | + g_signal_connect( GTK_WIDGET(text_view->popup_menu), "selection-done", | ||
| 330 | + G_CALLBACK(block_selection_change), text_view ); | ||
| 331 | + priv->release_selection = FALSE; | ||
| 332 | + } | ||
| 333 | if (info->button) | ||
| 334 | gtk_menu_popup (GTK_MENU (text_view->popup_menu), NULL, NULL, | ||
| 335 | NULL, NULL, | ||
| 336 | @@ -8301,3 +8412,81 @@ | ||
| 337 | |||
| 338 | return gtk_text_layout_move_iter_visually (text_view->layout, iter, count); | ||
| 339 | } | ||
| 340 | + | ||
| 341 | +/* | ||
| 342 | + * gtk_text_view_set_autocap: | ||
| 343 | + * @entry: a #GtkTextView | ||
| 344 | + * @autocap: autocap | ||
| 345 | + * | ||
| 346 | + * Sets autocapitalization of the widget. | ||
| 347 | + */ | ||
| 348 | +static void | ||
| 349 | +gtk_text_view_set_autocap (GtkTextView *text_view, | ||
| 350 | + gboolean autocap) | ||
| 351 | +{ | ||
| 352 | + g_return_if_fail (GTK_IS_TEXT_VIEW (text_view)); | ||
| 353 | + | ||
| 354 | + if (gtk_text_view_get_autocap (text_view) != autocap) | ||
| 355 | + { | ||
| 356 | + g_object_set (G_OBJECT (text_view->im_context), "autocap", autocap, NULL); | ||
| 357 | + g_object_notify (G_OBJECT (text_view), "autocap"); | ||
| 358 | + } | ||
| 359 | +} | ||
| 360 | + | ||
| 361 | +/* | ||
| 362 | + * gtk_text_view_get_autocap: | ||
| 363 | + * @entry: a #GtkTextView | ||
| 364 | + * | ||
| 365 | + * Gets autocapitalization state of the widget. | ||
| 366 | + * | ||
| 367 | + * Return value: a state | ||
| 368 | + */ | ||
| 369 | +static gboolean | ||
| 370 | +gtk_text_view_get_autocap (GtkTextView *text_view) | ||
| 371 | +{ | ||
| 372 | + gboolean autocap; | ||
| 373 | + g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), FALSE); | ||
| 374 | + | ||
| 375 | + g_object_get (G_OBJECT (text_view->im_context), "autocap", &autocap, NULL); | ||
| 376 | + | ||
| 377 | + return autocap; | ||
| 378 | +} | ||
| 379 | + | ||
| 380 | +/* | ||
| 381 | + * gtk_text_view_set_input_mode: | ||
| 382 | + * @text_view: a #GtkTextView | ||
| 383 | + * @mode: input mode | ||
| 384 | + * | ||
| 385 | + * Sets autocapitalization of the widget. | ||
| 386 | + */ | ||
| 387 | +static void | ||
| 388 | +gtk_text_view_set_input_mode (GtkTextView *text_view, | ||
| 389 | + gint mode) | ||
| 390 | +{ | ||
| 391 | + g_return_if_fail (GTK_IS_TEXT_VIEW (text_view)); | ||
| 392 | + | ||
| 393 | + if (gtk_text_view_get_input_mode (text_view) != mode) | ||
| 394 | + { | ||
| 395 | + g_object_set (G_OBJECT (text_view->im_context), "input_mode", mode, NULL); | ||
| 396 | + g_object_notify (G_OBJECT (text_view), "input_mode"); | ||
| 397 | + } | ||
| 398 | +} | ||
| 399 | + | ||
| 400 | +/* | ||
| 401 | + * gtk_text_view_get_input_mode: | ||
| 402 | + * @text_view: a #GtkTextView | ||
| 403 | + * | ||
| 404 | + * Gets input mode of the widget. | ||
| 405 | + * | ||
| 406 | + * Return value: input mode | ||
| 407 | + */ | ||
| 408 | +static gint | ||
| 409 | +gtk_text_view_get_input_mode (GtkTextView *text_view) | ||
| 410 | +{ | ||
| 411 | + gint mode; | ||
| 412 | + g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), FALSE); | ||
| 413 | + | ||
| 414 | + g_object_get (G_OBJECT (text_view->im_context), "input_mode", &mode, NULL); | ||
| 415 | + | ||
| 416 | + return mode; | ||
| 417 | +} | ||
