} else {
if (view->cursor == EV_VIEW_CURSOR_LINK ||
view->cursor == EV_VIEW_CURSOR_IBEAM ||
- view->cursor == EV_VIEW_CURSOR_DRAG)
+ view->cursor == EV_VIEW_CURSOR_DRAG ||
+ view->cursor == EV_VIEW_CURSOR_AUTOSCROLL)
ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL);
}
}
view->pressed_button = event->button;
view->selection_info.in_drag = FALSE;
+
+ if (view->scroll_info.autoscrolling)
+ return TRUE;
switch (event->button) {
case 1: {
-
- if (view->scroll_info.autoscrolling == TRUE) {
- view->scroll_info.autoscrolling = FALSE;
- return TRUE;
- }
-
EvImage *image;
EvFormField *field;
case 2:
/* use root coordinates as reference point because
* scrolling changes window relative coordinates */
- if (view->scroll_info.autoscrolling == TRUE) {
- view->scroll_info.autoscrolling = FALSE;
- return TRUE;
- }
view->drag_info.start.x = event->x_root;
view->drag_info.start.y = event->y_root;
view->drag_info.hadj = gtk_adjustment_get_value (view->hadjustment);
return TRUE;
case 3:
- if (!view->scroll_info.autoscrolling)
- view->scroll_info.start_y = event->y;
+ view->scroll_info.start_y = event->y;
return ev_view_do_popup_menu (view, event->x, event->y);
}
if (view->scroll_info.autoscrolling) {
view->scroll_info.last_y = y;
+ return TRUE;
}
if (view->selection_info.in_drag) {
EvView *view = EV_VIEW (widget);
EvLink *link = NULL;
- view->drag_info.in_drag = FALSE;
view->image_dnd_info.in_drag = FALSE;
-
- view->drag_info.release_timeout_id = g_timeout_add (20,
- (GSourceFunc)ev_view_scroll_drag_release, view);
- if (view->pressed_button == 2) {
- ev_view_handle_cursor_over_xy (view, event->x, event->y);
+ if (view->scroll_info.autoscrolling) {
+ ev_view_autoscroll_stop (view);
+ view->pressed_button = -1;
+
+ return TRUE;
+ }
+
+ if (view->drag_info.in_drag) {
+ view->drag_info.release_timeout_id =
+ g_timeout_add (20,
+ (GSourceFunc)ev_view_scroll_drag_release, view);
}
- if (view->document && view->pressed_button != 3) {
+ if (view->document && !view->drag_info.in_drag && view->pressed_button != 3) {
link = ev_view_get_link_at_location (view, event->x, event->y);
}
+
+ view->drag_info.in_drag = FALSE;
+
+ if (view->pressed_button == 2) {
+ ev_view_handle_cursor_over_xy (view, event->x, event->y);
+ }
view->pressed_button = -1;
gtk_widget_queue_draw (GTK_WIDGET (view));
}
-static gboolean ev_view_autoscroll_cb (EvView *view)
+static gboolean
+ev_view_autoscroll_cb (EvView *view)
{
gdouble speed, value;
}
-void ev_view_autoscroll(EvView *view)
+void
+ev_view_autoscroll_start (EvView *view)
{
+ gint x, y;
+
+ g_return_if_fail (EV_IS_VIEW (view));
+
+ if (view->scroll_info.autoscrolling)
+ return;
+
view->scroll_info.autoscrolling = TRUE;
- view->scroll_info.timeout_id = g_timeout_add (20, (GSourceFunc)(ev_view_autoscroll_cb), view);
+ view->scroll_info.timeout_id =
+ g_timeout_add (20, (GSourceFunc)ev_view_autoscroll_cb,
+ view);
+
+ gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y);
+ ev_view_handle_cursor_over_xy (view, x, y);
+}
+
+void
+ev_view_autoscroll_stop (EvView *view)
+{
+ gint x, y;
+
+ g_return_if_fail (EV_IS_VIEW (view));
+
+ if (!view->scroll_info.autoscrolling)
+ return;
+
+ view->scroll_info.autoscrolling = FALSE;
+ if (view->scroll_info.timeout_id) {
+ g_source_remove (view->scroll_info.timeout_id);
+ view->scroll_info.timeout_id = 0;
+ }
+
+ gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y);
+ ev_view_handle_cursor_over_xy (view, x, y);
}
void
duration = ev_document_transition_get_page_duration (EV_DOCUMENT_TRANSITION (view->document),
view->current_page);
if (duration > 0) {
-#if GLIB_CHECK_VERSION (2, 13, 0)
view->trans_timeout_id =
g_timeout_add_seconds (duration,
(GSourceFunc) transition_next_page,
view);
-#else
- view->trans_timeout_id =
- g_timeout_add (duration * 1000,
- (GSourceFunc) transition_next_page,
- view);
-#endif
}
}