[gnome-builder/wip/minimap2: 10/13] minimap: handle buffers that do not fill the minimap
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/minimap2: 10/13] minimap: handle buffers that do not fill the minimap
- Date: Wed, 22 Apr 2015 00:59:39 +0000 (UTC)
commit b5c5b13fd8207f101a0bb04274bcc0ae2413a7cb
Author: Christian Hergert <christian hergert me>
Date: Tue Apr 21 16:44:02 2015 -0700
minimap: handle buffers that do not fill the minimap
This will help keep the mouse cursor on the scrubber widget.
libide/ide-source-map.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/libide/ide-source-map.c b/libide/ide-source-map.c
index 2e5edd2..52ef6f6 100644
--- a/libide/ide-source-map.c
+++ b/libide/ide-source-map.c
@@ -478,6 +478,7 @@ ide_source_map__overlay_box_motion_notify_event (IdeSourceMap *self,
GdkRectangle rect;
GtkTextIter iter;
gdouble ratio;
+ gint child_height;
gint x;
gint y;
@@ -488,13 +489,14 @@ ide_source_map__overlay_box_motion_notify_event (IdeSourceMap *self,
GTK_WIDGET (self->child_view),
event->x, event->y, &x, &y);
- y = CLAMP (y, child_alloc.y, child_alloc.y + child_alloc.height) - child_alloc.y;
- ratio = (gdouble)y / (gdouble)child_alloc.height;
-
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->child_view));
gtk_text_buffer_get_end_iter (buffer, &iter);
gtk_text_view_get_iter_location (GTK_TEXT_VIEW (self->child_view), &iter, &rect);
+ child_height = MIN (child_alloc.height, (rect.y + rect.height));
+
+ y = CLAMP (y, child_alloc.y, child_alloc.y + child_height) - child_alloc.y;
+ ratio = (gdouble)y / (gdouble)child_height;
y = (rect.y + rect.height) * ratio;
gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (self->child_view), &iter, x, y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]