[ekg2-commit] ekg2: bindings.c (HEAD) mouse.c (HEAD) [peres]

CVS commit cvs w toxygen.net
Nie, 9 Wrz 2007, 00:05:56 CEST


Module name:	ekg2
Changes by:	peres	2007-09-09 00:05:54

Modified files:
	bindings.c mouse.c

Log message:
First part of ncurses 'outtawindow' mouse support.
Currently it only allows user to cycle through command history using
mouse wheel on single input prompt. In the future, we will also allow
user to scroll multi-line prompt, and move cursor by mouseclicks.

Index: bindings.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/bindings.c,v
diff -d -u -r1.71 -r1.72
--- bindings.c	31 Aug 2007 23:49:14 -0000	1.71
+++ bindings.c	8 Sep 2007 22:05:54 -0000	1.72
@@ -533,7 +533,7 @@
 }
 
 
-static BINDING_FUNCTION(binding_previous_history)
+BINDING_FUNCTION(binding_previous_history)
 {
 	if (lines) {
 		if (lines_index - lines_start == 0)
@@ -551,7 +551,7 @@
 	binding_previous_only_history(NULL);				
 }
 
-static BINDING_FUNCTION(binding_next_history)
+BINDING_FUNCTION(binding_next_history)
 {
 	if (lines) {
 		if (lines_index - line_start == 4)

Index: mouse.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/mouse.c,v
diff -d -u -r1.26 -r1.27
--- mouse.c	4 Sep 2007 14:10:56 -0000	1.26
+++ mouse.c	8 Sep 2007 22:05:54 -0000	1.27
@@ -36,6 +36,10 @@
 #include "contacts.h"
 #include "mouse.h"
 
+	/* imported bindings */
+BINDING_FUNCTION(binding_previous_history);
+BINDING_FUNCTION(binding_next_history);
+
 int mouse_initialized = 0;
 
 /* 
@@ -149,6 +153,29 @@
 			break;
 		}
 	}
+
+	if (!l) { /* special screen sections */
+			/* input */
+		if (y > stdscr->_maxy - input_size + 1) {
+			if (input_size == 1) {
+				if (mouse_flag == EKG_SCROLLED_UP)
+					binding_previous_history(NULL);
+				else if (mouse_flag == EKG_SCROLLED_DOWN)
+					binding_next_history(NULL);
+				else if (mouse_flag == EKG_BUTTON1_CLICKED) {
+					/* XXX: move cursor */
+				}
+			} else {
+				if (mouse_flag == EKG_SCROLLED_UP)
+					/* XXX: scroll */;
+				else if (mouse_flag == EKG_SCROLLED_DOWN)
+					/* XXX: scroll */;
+				else if (mouse_flag == EKG_BUTTON1_CLICKED) {
+					/* XXX: move cursor */
+				}
+			}
+		}
+	}
 }
 
 #ifdef HAVE_LIBGPM


Więcej informacji o liście dyskusyjnej ekg2-commit