[gtk+/touch-selection-improvements: 4/17] texthandle: Use active state when handles are being dragged
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/touch-selection-improvements: 4/17] texthandle: Use active state when handles are being dragged
- Date: Thu, 18 Dec 2014 13:54:35 +0000 (UTC)
commit fa230ffb1173369c666d31a12f611b7fc3e58693
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Nov 20 13:46:30 2014 +0100
texthandle: Use active state when handles are being dragged
The active state flags is set on both handles when this happens.
gtk/gtktexthandle.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index 2b42685..893dde2 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -166,6 +166,22 @@ gtk_text_handle_widget_draw (GtkWidget *widget,
return TRUE;
}
+static void
+gtk_text_handle_set_state (GtkTextHandle *handle,
+ GtkStateFlags state)
+{
+ GtkTextHandlePrivate *priv;
+ gint i;
+
+ priv = handle->priv;
+
+ for (i = 0; i <= GTK_TEXT_HANDLE_POSITION_SELECTION_START; i++)
+ {
+ gtk_widget_set_state_flags (priv->windows[i].widget, state, TRUE);
+ gtk_widget_queue_draw (priv->windows[i].widget);
+ }
+}
+
static gboolean
gtk_text_handle_widget_event (GtkWidget *widget,
GdkEvent *event,
@@ -185,11 +201,13 @@ gtk_text_handle_widget_event (GtkWidget *widget,
priv->windows[pos].dx = event->button.x;
priv->windows[pos].dy = event->button.y;
priv->windows[pos].dragged = TRUE;
+ gtk_text_handle_set_state (handle, GTK_STATE_FLAG_ACTIVE);
}
else if (event->type == GDK_BUTTON_RELEASE)
{
g_signal_emit (handle, signals[DRAG_FINISHED], 0, pos);
priv->windows[pos].dragged = FALSE;
+ gtk_text_handle_set_state (handle, GTK_STATE_FLAG_NORMAL);
}
else if (event->type == GDK_MOTION_NOTIFY &&
event->motion.state & GDK_BUTTON1_MASK &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]