[maemo-commits] [maemo-commits] r11618 - in projects/haf/trunk/gtk+: . gtk
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Fri May 11 19:14:02 EEST 2007
- Previous message: [maemo-commits] r11617 - projects/haf/tags/hildon-desktop
- Next message: [maemo-commits] r11619 - projects/haf/hafbuildbot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: mitch Date: 2007-05-11 19:14:00 +0300 (Fri, 11 May 2007) New Revision: 11618 Modified: projects/haf/trunk/gtk+/ChangeLog projects/haf/trunk/gtk+/gtk/gtkentry.c projects/haf/trunk/gtk+/gtk/gtklabel.c projects/haf/trunk/gtk+/gtk/gtkpaned.c projects/haf/trunk/gtk+/gtk/gtkstatusbar.c projects/haf/trunk/gtk+/gtk/gtktextview.c Log: 2007-05-11 Michael Natterer <mitch at imendio.com> Merge all GtkTextView fixes from the gtk-2-10 branch. The last one fixes bug #54825. Changes some other files that were part of the applied patches (bugfixes only). 2007-05-11 Michael Natterer <mitch at imendio.com> * gtk/gtktextview.c (selection_motion_event_handler): call gdk_event_request_motions(event) so selecting works with XInput devices too. Spotted by Tommi Komulainen. 2007-03-11 Matthias Clasen <mclasen at redhat.com> Merge from trunk: * gtk/gtktextview.c (gtk_text_view_set_buffer): Set first_para_mark to NULL. (#396805, Colin Leroy, patch by Mariano Su?\195?\161rez-Alvarez) 2007-03-09 Matthias Clasen <mclasen at redhat.com> Merge from trunk: * gtk/gtktextview.c (gtk_text_view_end_selection_drag): Get rid of the unused event argument. Update all callers. * gtk/gtktextview.c (gtk_text_view_focus_out): Call gtk_text_view_end_selection_drag. (#351671, Boyd Timothy) 2007-01-07 Matthias Clasen <mclasen at redhat.com> * gtk/gtktextview.c (gtk_text_view_set_border_window_size): Call text_window_realize() with the correct parameters. (#393813, Yevgen Muntyan) 2006-12-30 Matthias Clasen <mclasen at redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy): Remove the scroll timeout. (#390872, Yevgen Muntyan) 2006-12-30 Matthias Clasen <mclasen at redhat.com> * gtk/gtkentry.c: * gtk/gtklabel.c: * gtk/gtkpaned.c: * gtk/gtkstatusbar.c: * gtk/gtktextview.c: Don't install cursors on insensitive widgets. (#358864, Jan Schampera) 2006-12-29 Matthias Clasen <mclasen at redhat.com> * gtk/gtkentry.c (blink_cb): * gtk/gtktextview.c (blink_cb): Don't die in an assertion if focus went missing. Just warn, clean up and continue. (#374378) 2006-12-24 Matthias Clasen <mclasen at redhat.com> * gtk/gtktextview.c: Improve the DND scrolling behaviour. (#92387, Carlos Garnacho Parro) 2006-12-20 Matthias Clasen <mclasen at redhat.com> * gtk/gtktextview.c (gtk_text_view_start_selection_drag): Silently return if a drag is already in progress, rather than asserting. (#335622, Li Yuan, testcase by Erwann Chenede) Modified: projects/haf/trunk/gtk+/ChangeLog =================================================================== --- projects/haf/trunk/gtk+/ChangeLog 2007-05-11 15:44:55 UTC (rev 11617) +++ projects/haf/trunk/gtk+/ChangeLog 2007-05-11 16:14:00 UTC (rev 11618) @@ -1,3 +1,70 @@ +2007-05-11 Michael Natterer <mitch at imendio.com> + + Merge all GtkTextView fixes from the gtk-2-10 branch. The last + one fixes bug #54825. Changes some other files that were part of + the applied patches (bugfixes only). + + 2007-05-11 Michael Natterer <mitch at imendio.com> + + * gtk/gtktextview.c (selection_motion_event_handler): call + gdk_event_request_motions(event) so selecting works with + XInput devices too. Spotted by Tommi Komulainen. + + 2007-03-11 Matthias Clasen <mclasen at redhat.com> + + Merge from trunk: + + * gtk/gtktextview.c (gtk_text_view_set_buffer): Set first_para_mark + to NULL. (#396805, Colin Leroy, patch by Mariano Suárez-Alvarez) + + 2007-03-09 Matthias Clasen <mclasen at redhat.com> + + Merge from trunk: + + * gtk/gtktextview.c (gtk_text_view_end_selection_drag): + Get rid of the unused event argument. Update all callers. + + * gtk/gtktextview.c (gtk_text_view_focus_out): Call + gtk_text_view_end_selection_drag. (#351671, Boyd Timothy) + + 2007-01-07 Matthias Clasen <mclasen at redhat.com> + + * gtk/gtktextview.c (gtk_text_view_set_border_window_size): + Call text_window_realize() with the correct parameters. + (#393813, Yevgen Muntyan) + + 2006-12-30 Matthias Clasen <mclasen at redhat.com> + + * gtk/gtktextview.c (gtk_text_view_destroy): Remove the + scroll timeout. (#390872, Yevgen Muntyan) + + 2006-12-30 Matthias Clasen <mclasen at redhat.com> + + * gtk/gtkentry.c: + * gtk/gtklabel.c: + * gtk/gtkpaned.c: + * gtk/gtkstatusbar.c: + * gtk/gtktextview.c: Don't install cursors on insensitive + widgets. (#358864, Jan Schampera) + + 2006-12-29 Matthias Clasen <mclasen at redhat.com> + + * gtk/gtkentry.c (blink_cb): + * gtk/gtktextview.c (blink_cb): Don't die in an assertion + if focus went missing. Just warn, clean up and continue. + (#374378) + + 2006-12-24 Matthias Clasen <mclasen at redhat.com> + + * gtk/gtktextview.c: Improve the DND scrolling + behaviour. (#92387, Carlos Garnacho Parro) + + 2006-12-20 Matthias Clasen <mclasen at redhat.com> + + * gtk/gtktextview.c (gtk_text_view_start_selection_drag): + Silently return if a drag is already in progress, rather + than asserting. (#335622, Li Yuan, testcase by Erwann Chenede) + 2007-05-10 Tommi Komulainen <tommi.komulainen at nokia.com> * gtk/gtkmenu.c (gtk_menu_class_init): Add "opposite-arrows" style Modified: projects/haf/trunk/gtk+/gtk/gtkentry.c =================================================================== --- projects/haf/trunk/gtk+/gtk/gtkentry.c 2007-05-11 15:44:55 UTC (rev 11617) +++ projects/haf/trunk/gtk+/gtk/gtkentry.c 2007-05-11 16:14:00 UTC (rev 11618) @@ -1286,14 +1286,19 @@ gdk_window_set_user_data (widget->window, entry); get_text_area_size (entry, &attributes.x, &attributes.y, &attributes.width, &attributes.height); + + if (GTK_WIDGET_IS_SENSITIVE (widget)) + { + attributes.cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), GDK_XTERM); + attributes_mask |= GDK_WA_CURSOR; + } - attributes.cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), GDK_XTERM); - attributes_mask |= GDK_WA_CURSOR; + entry->text_area = gdk_window_new (widget->window, &attributes, attributes_mask); - entry->text_area = gdk_window_new (widget->window, &attributes, attributes_mask); gdk_window_set_user_data (entry->text_area, entry); - gdk_cursor_unref (attributes.cursor); + if (attributes_mask & GDK_WA_CURSOR) + gdk_cursor_unref (attributes.cursor); widget->style = gtk_style_attach (widget->style, widget->window); @@ -2214,11 +2219,24 @@ GtkStateType previous_state) { GtkEntry *entry = GTK_ENTRY (widget); + GdkCursor *cursor; if (GTK_WIDGET_REALIZED (widget)) { gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]); gdk_window_set_background (entry->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]); + + if (GTK_WIDGET_IS_SENSITIVE (widget)) + cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), GDK_XTERM); + else + cursor = NULL; + + gdk_window_set_cursor (entry->text_area, cursor); + + if (cursor) + gdk_cursor_unref (cursor); + + entry->mouse_cursor_obscured = FALSE; } if (!GTK_WIDGET_IS_SENSITIVE (widget)) @@ -5620,9 +5638,12 @@ g_warning ("GtkEntry - did not receive focus-out-event. If you\n" "connect a handler to this signal, it must return\n" "FALSE so the entry gets the event as well"); + + gtk_entry_check_cursor_blink (entry); + + return FALSE; } - g_assert (GTK_WIDGET_HAS_FOCUS (entry)); g_assert (entry->selection_bound == entry->current_pos); if (entry->cursor_visible) Modified: projects/haf/trunk/gtk+/gtk/gtklabel.c =================================================================== --- projects/haf/trunk/gtk+/gtk/gtklabel.c 2007-05-11 15:44:55 UTC (rev 11617) +++ projects/haf/trunk/gtk+/gtk/gtklabel.c 2007-05-11 16:14:00 UTC (rev 11618) @@ -2281,12 +2281,28 @@ GtkStateType prev_state) { GtkLabel *label; + GdkCursor *cursor; label = GTK_LABEL (widget); if (label->select_info) - gtk_label_select_region (label, 0, 0); + { + gtk_label_select_region (label, 0, 0); + if (GTK_WIDGET_REALIZED (widget)) + { + if (GTK_WIDGET_IS_SENSITIVE (widget)) + cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), GDK_XTERM); + else + cursor = NULL; + + gdk_window_set_cursor (label->select_info->window, cursor); + + if (cursor) + gdk_cursor_unref (cursor); + } + } + if (GTK_WIDGET_CLASS (gtk_label_parent_class)->state_changed) GTK_WIDGET_CLASS (gtk_label_parent_class)->state_changed (widget, prev_state); } @@ -3156,20 +3172,25 @@ attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_ONLY; attributes.override_redirect = TRUE; - attributes.cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), - GDK_XTERM); attributes.event_mask = gtk_widget_get_events (widget) | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK; + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_NOREDIR; + if (GTK_WIDGET_IS_SENSITIVE (widget)) + { + attributes.cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), + GDK_XTERM); + attributes_mask |= GDK_WA_CURSOR; + } - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_NOREDIR | GDK_WA_CURSOR; label->select_info->window = gdk_window_new (widget->window, &attributes, attributes_mask); gdk_window_set_user_data (label->select_info->window, widget); - gdk_cursor_unref (attributes.cursor); + if (attributes_mask & GDK_WA_CURSOR) + gdk_cursor_unref (attributes.cursor); } static void Modified: projects/haf/trunk/gtk+/gtk/gtkpaned.c =================================================================== --- projects/haf/trunk/gtk+/gtk/gtkpaned.c 2007-05-11 15:44:55 UTC (rev 11617) +++ projects/haf/trunk/gtk+/gtk/gtkpaned.c 2007-05-11 16:14:00 UTC (rev 11618) @@ -83,6 +83,8 @@ static void gtk_paned_unrealize (GtkWidget *widget); static void gtk_paned_map (GtkWidget *widget); static void gtk_paned_unmap (GtkWidget *widget); +static void gtk_paned_state_changed (GtkWidget *widget, + GtkStateType previous_state); static gboolean gtk_paned_expose (GtkWidget *widget, GdkEventExpose *event); static gboolean gtk_paned_enter (GtkWidget *widget, @@ -194,6 +196,7 @@ widget_class->motion_notify_event = gtk_paned_motion; widget_class->grab_broken_event = gtk_paned_grab_broken; widget_class->grab_notify = gtk_paned_grab_notify; + widget_class->state_changed = gtk_paned_state_changed; container_class->add = gtk_paned_add; container_class->remove = gtk_paned_remove; @@ -638,8 +641,6 @@ attributes.y = paned->handle_pos.y; attributes.width = paned->handle_pos.width; attributes.height = paned->handle_pos.height; - attributes.cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), - paned->cursor_type); attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | @@ -647,12 +648,19 @@ GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_CURSOR; + attributes_mask = GDK_WA_X | GDK_WA_Y; + if (GTK_WIDGET_IS_SENSITIVE (widget)) + { + attributes.cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), + paned->cursor_type); + attributes_mask |= GDK_WA_CURSOR; + } paned->handle = gdk_window_new (widget->window, &attributes, attributes_mask); gdk_window_set_user_data (paned->handle, paned); - gdk_cursor_unref (attributes.cursor); + if (attributes_mask & GDK_WA_CURSOR) + gdk_cursor_unref (attributes.cursor); widget->style = gtk_style_attach (widget->style, widget->window); @@ -916,6 +924,28 @@ stop_drag (paned); } +static void +gtk_paned_state_changed (GtkWidget *widget, + GtkStateType previous_state) +{ + GtkPaned *paned = GTK_PANED (widget); + GdkCursor *cursor; + + if (GTK_WIDGET_REALIZED (paned)) + { + if (GTK_WIDGET_IS_SENSITIVE (widget)) + cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), + paned->cursor_type); + else + cursor = NULL; + + gdk_window_set_cursor (paned->handle, cursor); + + if (cursor) + gdk_cursor_unref (cursor); + } +} + static gboolean gtk_paned_button_release (GtkWidget *widget, GdkEventButton *event) Modified: projects/haf/trunk/gtk+/gtk/gtkstatusbar.c =================================================================== --- projects/haf/trunk/gtk+/gtk/gtkstatusbar.c 2007-05-11 15:44:55 UTC (rev 11617) +++ projects/haf/trunk/gtk+/gtk/gtkstatusbar.c 2007-05-11 16:14:00 UTC (rev 11618) @@ -77,6 +77,8 @@ GtkAllocation *allocation); static void gtk_statusbar_direction_changed (GtkWidget *widget, GtkTextDirection prev_dir); +static void gtk_statusbar_state_changed (GtkWidget *widget, + GtkStateType previous_state); static void gtk_statusbar_create_window (GtkStatusbar *statusbar); static void gtk_statusbar_destroy_window (GtkStatusbar *statusbar); static void gtk_statusbar_get_property (GObject *object, @@ -116,14 +118,12 @@ widget_class->unrealize = gtk_statusbar_unrealize; widget_class->map = gtk_statusbar_map; widget_class->unmap = gtk_statusbar_unmap; - widget_class->button_press_event = gtk_statusbar_button_press; widget_class->expose_event = gtk_statusbar_expose_event; - widget_class->size_request = gtk_statusbar_size_request; widget_class->size_allocate = gtk_statusbar_size_allocate; - widget_class->direction_changed = gtk_statusbar_direction_changed; + widget_class->state_changed = gtk_statusbar_state_changed; class->text_pushed = gtk_statusbar_update; class->text_popped = gtk_statusbar_update; @@ -523,14 +523,19 @@ GdkCursorType cursor_type; GdkCursor *cursor; - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) - cursor_type = GDK_BOTTOM_RIGHT_CORNER; + if (GTK_WIDGET_IS_SENSITIVE (widget)) + { + if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) + cursor_type = GDK_BOTTOM_RIGHT_CORNER; + else + cursor_type = GDK_BOTTOM_LEFT_CORNER; + + cursor = gdk_cursor_new_for_display (display, cursor_type); + gdk_window_set_cursor (statusbar->grip_window, cursor); + gdk_cursor_unref (cursor); + } else - cursor_type = GDK_BOTTOM_LEFT_CORNER; - - cursor = gdk_cursor_new_for_display (display, cursor_type); - gdk_window_set_cursor (statusbar->grip_window, cursor); - gdk_cursor_unref (cursor); + gdk_window_set_cursor (statusbar->grip_window, NULL); } } @@ -578,6 +583,15 @@ } static void +gtk_statusbar_state_changed (GtkWidget *widget, + GtkStateType previous_state) +{ + GtkStatusbar *statusbar = GTK_STATUSBAR (widget); + + set_grip_cursor (statusbar); +} + +static void gtk_statusbar_destroy_window (GtkStatusbar *statusbar) { gdk_window_set_user_data (statusbar->grip_window, NULL); Modified: projects/haf/trunk/gtk+/gtk/gtktextview.c =================================================================== --- projects/haf/trunk/gtk+/gtk/gtktextview.c 2007-05-11 15:44:55 UTC (rev 11617) +++ projects/haf/trunk/gtk+/gtk/gtktextview.c 2007-05-11 16:14:00 UTC (rev 11618) @@ -45,7 +45,6 @@ #include "gtkimmulticontext.h" #include "gdk/gdkkeysyms.h" #include "gtkprivate.h" -#include "gtksizegroup.h" /* FIXME http://bugzilla.gnome.org/show_bug.cgi?id=72258 */ #include "gtktextutil.h" #include "gtkwindow.h" #include "gtkalias.h" @@ -287,8 +286,7 @@ static void gtk_text_view_start_selection_drag (GtkTextView *text_view, const GtkTextIter *iter, GdkEventButton *event); -static gboolean gtk_text_view_end_selection_drag (GtkTextView *text_view, - GdkEventButton *event); +static gboolean gtk_text_view_end_selection_drag (GtkTextView *text_view); static void gtk_text_view_start_selection_dnd (GtkTextView *text_view, const GtkTextIter *iter, GdkEventMotion *event); @@ -411,7 +409,7 @@ gint height_request); static void text_window_free (GtkTextWindow *win); static void text_window_realize (GtkTextWindow *win, - GdkWindow *parent); + GtkWidget *widget); static void text_window_unrealize (GtkTextWindow *win); static void text_window_size_allocate (GtkTextWindow *win, GdkRectangle *rect); @@ -1203,6 +1201,7 @@ text_view); g_object_unref (text_view->buffer); text_view->dnd_mark = NULL; + text_view->first_para_mark = NULL; if (GTK_WIDGET_REALIZED (text_view)) { @@ -2577,6 +2576,12 @@ gtk_text_view_set_buffer (text_view, NULL); gtk_text_view_destroy_layout (text_view); + if (text_view->scroll_timeout) + { + g_source_remove (text_view->scroll_timeout); + text_view->scroll_timeout = 0; + } + (* GTK_OBJECT_CLASS (gtk_text_view_parent_class)->destroy) (object); } @@ -3533,23 +3538,19 @@ gdk_window_set_background (widget->window, &widget->style->bg[GTK_WIDGET_STATE (widget)]); - text_window_realize (text_view->text_window, widget->window); + text_window_realize (text_view->text_window, widget); if (text_view->left_window) - text_window_realize (text_view->left_window, - widget->window); + text_window_realize (text_view->left_window, widget); if (text_view->top_window) - text_window_realize (text_view->top_window, - widget->window); + text_window_realize (text_view->top_window, widget); if (text_view->right_window) - text_window_realize (text_view->right_window, - widget->window); + text_window_realize (text_view->right_window, widget); if (text_view->bottom_window) - text_window_realize (text_view->bottom_window, - widget->window); + text_window_realize (text_view->bottom_window, widget); gtk_text_view_ensure_layout (text_view); @@ -3689,10 +3690,23 @@ GtkStateType previous_state) { GtkTextView *text_view = GTK_TEXT_VIEW (widget); + GdkCursor *cursor; if (GTK_WIDGET_REALIZED (widget)) { gtk_text_view_set_background (text_view); + + if (GTK_WIDGET_IS_SENSITIVE (widget)) + cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), GDK_XTERM); + else + cursor = NULL; + + gdk_window_set_cursor (text_view->text_window->bin_window, cursor); + + if (cursor) + gdk_cursor_unref (cursor); + + text_view->mouse_cursor_obscured = FALSE; } if (!GTK_WIDGET_IS_SENSITIVE (widget)) @@ -3763,7 +3777,7 @@ { if (!was_grabbed) { - gtk_text_view_end_selection_drag (GTK_TEXT_VIEW (widget), NULL); + gtk_text_view_end_selection_drag (GTK_TEXT_VIEW (widget)); gtk_text_view_unobscure_mouse_cursor (GTK_TEXT_VIEW (widget)); } } @@ -4087,7 +4101,7 @@ { GtkTextIter iter; - gtk_text_view_end_selection_drag (text_view, event); + gtk_text_view_end_selection_drag (text_view); gtk_text_layout_get_iter_at_pixel (text_view->layout, &iter, @@ -4128,7 +4142,7 @@ text_view->drag_start_y = -1; } - if (gtk_text_view_end_selection_drag (GTK_TEXT_VIEW (widget), event)) + if (gtk_text_view_end_selection_drag (GTK_TEXT_VIEW (widget))) return TRUE; else if (text_view->pending_place_cursor_button == event->button) { @@ -4195,6 +4209,8 @@ { GtkTextView *text_view = GTK_TEXT_VIEW (widget); + gtk_text_view_end_selection_drag (text_view); + gtk_widget_queue_draw (widget); DV(g_print (G_STRLOC": focus_out_event\n")); @@ -4571,10 +4587,13 @@ g_warning ("GtkTextView - did not receive focus-out-event. If you\n" "connect a handler to this signal, it must return\n" "FALSE so the text view gets the event as well"); + + gtk_text_view_check_cursor_blink (text_view); + + return FALSE; } g_assert (text_view->layout); - g_assert (GTK_WIDGET_HAS_FOCUS (text_view)); g_assert (text_view->cursor_visible); visible = gtk_text_layout_get_cursor_visible (text_view->layout); @@ -5550,7 +5569,9 @@ static void get_iter_at_pointer (GtkTextView *text_view, - GtkTextIter *iter) + GtkTextIter *iter, + gint *xp, + gint *yp) { gint x, y; GdkModifierType state; @@ -5562,6 +5583,11 @@ iter, x + text_view->xoffset, y + text_view->yoffset); + if (xp) + *xp = x; + + if (yp) + *yp = y; } static void @@ -5571,7 +5597,7 @@ GtkTextIter newplace; GtkTextMark *mark; - get_iter_at_pointer (text_view, &newplace); + get_iter_at_pointer (text_view, &newplace, NULL, NULL); mark = gtk_text_buffer_get_mark (get_buffer (text_view), mark_name); @@ -5608,29 +5634,58 @@ return TRUE; /* remain installed. */ } -#define DND_SCROLL_MARGIN 0.20 +#define UPPER_OFFSET_ANCHOR 0.8 +#define LOWER_OFFSET_ANCHOR 0.2 +static gboolean +check_scroll (gdouble offset, GtkAdjustment *adj) +{ + if ((offset > UPPER_OFFSET_ANCHOR && + adj->value + adj->page_size < adj->upper) || + (offset < LOWER_OFFSET_ANCHOR && + adj->value > adj->lower)) + return TRUE; + + return FALSE; +} + static gint drag_scan_timeout (gpointer data) { GtkTextView *text_view; GtkTextIter newplace; + gint x, y, width, height; + gdouble pointer_xoffset, pointer_yoffset; GDK_THREADS_ENTER (); text_view = GTK_TEXT_VIEW (data); - get_iter_at_pointer (text_view, &newplace); + get_iter_at_pointer (text_view, &newplace, &x, &y); + gdk_drawable_get_size (text_view->text_window->bin_window, &width, &height); gtk_text_buffer_move_mark (get_buffer (text_view), text_view->dnd_mark, &newplace); - DV(g_print (G_STRLOC": scrolling onscreen\n")); - gtk_text_view_scroll_to_mark (text_view, - text_view->dnd_mark, - DND_SCROLL_MARGIN, FALSE, 0.0, 0.0); + pointer_xoffset = (gdouble) x / width; + pointer_yoffset = (gdouble) y / height; + if (check_scroll (pointer_xoffset, text_view->hadjustment) || + check_scroll (pointer_yoffset, text_view->vadjustment)) + { + /* do not make offsets surpass lower nor upper anchors, this makes + * scrolling speed relative to the distance of the pointer to the + * anchors when it moves beyond them. + */ + pointer_xoffset = CLAMP (pointer_xoffset, LOWER_OFFSET_ANCHOR, UPPER_OFFSET_ANCHOR); + pointer_yoffset = CLAMP (pointer_yoffset, LOWER_OFFSET_ANCHOR, UPPER_OFFSET_ANCHOR); + + gtk_text_view_scroll_to_mark (text_view, + text_view->dnd_mark, + 0., TRUE, pointer_xoffset, pointer_yoffset); + } + GDK_THREADS_LEAVE (); return TRUE; @@ -5745,6 +5800,8 @@ GdkEventMotion *event, SelectionData *data) { + gdk_event_request_motions (event); + if (data->granularity == SELECT_CHARACTERS) { move_mark_to_pointer_and_scroll (text_view, "insert"); @@ -5760,7 +5817,7 @@ gtk_text_buffer_get_iter_at_mark (buffer, &orig_start, data->orig_start); gtk_text_buffer_get_iter_at_mark (buffer, &orig_end, data->orig_end); - get_iter_at_pointer (text_view, &cursor); + get_iter_at_pointer (text_view, &cursor, NULL, NULL); start = cursor; extend_selection (text_view, data->granularity, &start, &end); @@ -5799,7 +5856,8 @@ GtkTextBuffer *buffer; SelectionData *data; - g_assert (text_view->selection_drag_handler == 0); + if (text_view->selection_drag_handler != 0) + return; data = g_new0 (SelectionData, 1); @@ -5872,8 +5930,7 @@ /* returns whether we were really dragging */ static gboolean -gtk_text_view_end_selection_drag (GtkTextView *text_view, - GdkEventButton *event) +gtk_text_view_end_selection_drag (GtkTextView *text_view) { if (text_view->selection_drag_handler == 0) return FALSE; @@ -6092,7 +6149,7 @@ } gtk_text_view_stop_cursor_blink (text_view); - gtk_text_view_end_selection_drag (text_view, NULL); + gtk_text_view_end_selection_drag (text_view); g_object_unref (text_view->layout); text_view->layout = NULL; @@ -6355,21 +6412,10 @@ gdk_drag_status (context, 0, time); gtk_text_mark_set_visible (text_view->dnd_mark, FALSE); } - - gtk_text_buffer_move_mark (get_buffer (text_view), - text_view->dnd_mark, - &newplace); - DV(g_print (G_STRLOC": scrolling to mark\n")); - gtk_text_view_scroll_to_mark (text_view, - text_view->dnd_mark, - DND_SCROLL_MARGIN, FALSE, 0.0, 0.0); - - if (text_view->scroll_timeout != 0) /* reset on every motion event */ - g_source_remove (text_view->scroll_timeout); - - text_view->scroll_timeout = - g_timeout_add (50, drag_scan_timeout, text_view); + if (!text_view->scroll_timeout) + text_view->scroll_timeout = + g_timeout_add (100, drag_scan_timeout, text_view); /* TRUE return means don't propagate the drag motion to parent * widgets that may also be drop sites. @@ -7563,7 +7609,7 @@ static void text_window_realize (GtkTextWindow *win, - GdkWindow *parent) + GtkWidget *widget) { GdkWindowAttr attributes; gint attributes_mask; @@ -7581,7 +7627,7 @@ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; - win->window = gdk_window_new (parent, + win->window = gdk_window_new (widget->window, &attributes, attributes_mask); @@ -7613,23 +7659,26 @@ if (win->type == GTK_TEXT_WINDOW_TEXT) { - /* I-beam cursor */ - cursor = gdk_cursor_new_for_display (gdk_drawable_get_display (parent), - GDK_XTERM); - gdk_window_set_cursor (win->bin_window, cursor); - gdk_cursor_unref (cursor); + if (GTK_WIDGET_IS_SENSITIVE (widget)) + { + /* I-beam cursor */ + cursor = gdk_cursor_new_for_display (gdk_drawable_get_display (widget->window), + GDK_XTERM); + gdk_window_set_cursor (win->bin_window, cursor); + gdk_cursor_unref (cursor); + } - gtk_im_context_set_client_window (GTK_TEXT_VIEW (win->widget)->im_context, + gtk_im_context_set_client_window (GTK_TEXT_VIEW (widget)->im_context, win->window); gdk_window_set_background (win->bin_window, - &win->widget->style->base[GTK_WIDGET_STATE (win->widget)]); + &widget->style->base[GTK_WIDGET_STATE (widget)]); } else { gdk_window_set_background (win->bin_window, - &win->widget->style->bg[GTK_WIDGET_STATE (win->widget)]); + &widget->style->bg[GTK_WIDGET_STATE (widget)]); } g_object_set_qdata (G_OBJECT (win->window), @@ -8229,7 +8278,7 @@ width, 0); /* if the widget is already realized we need to realize the child manually */ if (GTK_WIDGET_REALIZED (text_view)) - text_window_realize (*winp, GTK_WIDGET (text_view)->window); + text_window_realize (*winp, GTK_WIDGET (text_view)); } else { @@ -8269,7 +8318,7 @@ /* if the widget is already realized we need to realize the child manually */ if (GTK_WIDGET_REALIZED (text_view)) - text_window_realize (*winp, GTK_WIDGET (text_view)->window); + text_window_realize (*winp, GTK_WIDGET (text_view)); } else {
- Previous message: [maemo-commits] r11617 - projects/haf/tags/hildon-desktop
- Next message: [maemo-commits] r11619 - projects/haf/hafbuildbot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]