mousetweaks r143 - in trunk: . src
- From: gerdk svn gnome org
- To: svn-commits-list gnome org
- Subject: mousetweaks r143 - in trunk: . src
- Date: Thu, 17 Apr 2008 15:16:36 +0100 (BST)
Author: gerdk
Date: Thu Apr 17 15:16:27 2008
New Revision: 143
URL: http://svn.gnome.org/viewvc/mousetweaks?rev=143&view=rev
Log:
2008-04-17 Gerd Kohlberger <gerdk svn gnome org>
* src/mt-main.c/h: Add simple line drawing for gesture mode.
Modified:
trunk/ChangeLog
trunk/src/mt-main.c
trunk/src/mt-main.h
Modified: trunk/src/mt-main.c
==============================================================================
--- trunk/src/mt-main.c (original)
+++ trunk/src/mt-main.c Thu Apr 17 15:16:27 2008
@@ -139,6 +139,29 @@
}
static void
+draw_line (gint x1, gint y1, gint x2, gint y2)
+{
+ GdkScreen *screen;
+ GdkWindow *root;
+ GdkGC *gc;
+
+ screen = gdk_display_get_default_screen (gdk_display_get_default ());
+ root = gdk_screen_get_root_window (screen);
+
+ gc = gdk_gc_new (root);
+ gdk_gc_set_subwindow (gc, GDK_INCLUDE_INFERIORS);
+ gdk_gc_set_function (gc, GDK_INVERT);
+ gdk_gc_set_line_attributes (gc, 1,
+ GDK_LINE_SOLID,
+ GDK_CAP_ROUND,
+ GDK_JOIN_ROUND);
+ gdk_draw_arc (root, gc, TRUE,
+ x1 - 4, y1 - 4, 8, 8, 0, 23040);
+ gdk_draw_line (root, gc, x1, y1, x2, y2);
+ g_object_unref (gc);
+}
+
+static void
dwell_start_gesture (MTClosure *mt)
{
if (mt->override_cursor) {
@@ -168,6 +191,12 @@
else
mt_cursor_set (GDK_LEFT_PTR);
+ if (mt->x_old > -1 && mt->y_old > -1) {
+ draw_line (mt->pointer_x, mt->pointer_y, mt->x_old, mt->y_old);
+ mt->x_old = -1;
+ mt->y_old = -1;
+ }
+
mt->dwell_gesture_started = FALSE;
mt_timer_stop (mt->dwell_timer);
}
@@ -246,6 +275,17 @@
mt->pointer_y = (gint) event->detail2;
mt_timer_start (mt->dwell_timer);
}
+
+ if (mt->dwell_gesture_started) {
+ if (mt->x_old > -1 && mt->y_old > -1)
+ draw_line (mt->pointer_x, mt->pointer_y, mt->x_old, mt->y_old);
+
+ draw_line (mt->pointer_x, mt->pointer_y,
+ event->detail1, event->detail2);
+
+ mt->x_old = event->detail1;
+ mt->y_old = event->detail2;
+ }
}
if (mt_timer_is_running (mt->delay_timer)) {
@@ -499,6 +539,9 @@
mt->service = mt_service_get_default ();
mt_service_set_clicktype (mt->service, DWELL_CLICK_TYPE_SINGLE, NULL);
+ mt->x_old = -1;
+ mt->y_old = -1;
+
return mt;
}
Modified: trunk/src/mt-main.h
==============================================================================
--- trunk/src/mt-main.h (original)
+++ trunk/src/mt-main.h Thu Apr 17 15:16:27 2008
@@ -43,6 +43,8 @@
gint direction;
gint pointer_x;
gint pointer_y;
+ gint x_old;
+ gint y_old;
/* options */
gint threshold;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]