[gnome-todo] arrow-frame: limit max drag
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] arrow-frame: limit max drag
- Date: Mon, 10 Aug 2015 21:53:39 +0000 (UTC)
commit 8f2f3ef4bf0d57cdacc9a68892c1b20d06d96896
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Aug 10 18:48:43 2015 -0300
arrow-frame: limit max drag
We don't want to drag the arrow out of the
window boundaries.
src/gtd-arrow-frame.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/gtd-arrow-frame.c b/src/gtd-arrow-frame.c
index 39fe843..25ffa0d 100644
--- a/src/gtd-arrow-frame.c
+++ b/src/gtd-arrow-frame.c
@@ -17,6 +17,7 @@
*/
#include "gtd-arrow-frame.h"
+#include "gtd-task-list-view.h"
#include "gtd-task-row.h"
typedef struct
@@ -85,13 +86,18 @@ on_pan_cb (GtkWidget *widget,
{
GtdArrowFramePrivate *priv;
GtkTextDirection dir;
+ GtkWidget *ancestor;
gdouble offset_x;
+ gint max_width;
priv = GTD_ARROW_FRAME (widget)->priv;
dir = gtk_widget_get_direction (widget);
+ ancestor = gtk_widget_get_ancestor (widget, GTD_TYPE_TASK_LIST_VIEW);
priv->moving = TRUE;
+ max_width = gtk_widget_get_allocated_width (ancestor);
+
gtk_gesture_drag_get_offset (GTK_GESTURE_DRAG (pan),
&offset_x,
NULL);
@@ -99,7 +105,7 @@ on_pan_cb (GtkWidget *widget,
if (dir == GTK_TEXT_DIR_RTL)
priv->offset = MAX (0, offset_x);
else
- priv->offset = MAX (0, priv->offset + -1 * offset_x);
+ priv->offset = MAX (0, priv->offset - offset_x);
gtk_widget_queue_resize (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]