Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv22694

Modified Files:
        tmux.h window-copy.c 
Log Message:
Sync OpenBSD patchset 733:

replace some magic mouse constants with defines for clarity. ok nicm


Index: window-copy.c
===================================================================
RCS file: /cvsroot/tmux/tmux/window-copy.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -d -r1.120 -r1.121
--- window-copy.c       6 Jun 2010 00:23:44 -0000       1.120
+++ window-copy.c       2 Jul 2010 02:56:07 -0000       1.121
@@ -762,26 +762,17 @@
        struct screen                   *s = &data->screen;
        u_int                            i;
 
-       /*
-        * xterm mouse mode is fairly silly. Buttons are in the bottom two
-        * bits: 0 button 1; 1 button 2; 2 button 3; 3 buttons released.
-        *
-        * Bit 3 is shift; bit 4 is meta; bit 5 control.
-        *
-        * Bit 6 is added for mouse buttons 4 and 5.
-        */
-
        if (m->x >= screen_size_x(s))
                return;
        if (m->y >= screen_size_y(s))
                return;
 
        /* If mouse wheel (buttons 4 and 5), scroll. */
-       if ((m->b & 64) == 64) {
-               if ((m->b & 3) == 0) {
+       if ((m->b & MOUSE_45)) {
+               if ((m->b & MOUSE_BUTTON) == MOUSE_1) {
                        for (i = 0; i < 5; i++)
                                window_copy_cursor_up(wp, 0);
-               } else if ((m->b & 3) == 1) {
+               } else if ((m->b & MOUSE_BUTTON) == MOUSE_2) {
                        for (i = 0; i < 5; i++)
                                window_copy_cursor_down(wp, 0);
                }
@@ -793,7 +784,7 @@
         * pressed, or stop the selection on their release.
         */
        if (s->mode & MODE_MOUSEMOTION) {
-               if ((m->b & 3) != 3) {
+               if ((m->b & MOUSE_BUTTON) != MOUSE_UP) {
                        window_copy_update_cursor(wp, m->x, m->y);
                        if (window_copy_update_selection(wp))
                                window_copy_redraw_screen(wp);
@@ -808,7 +799,7 @@
        }
 
        /* Otherwise i other buttons pressed, start selection and motion. */
-       if ((m->b & 3) != 3) {
+       if ((m->b & MOUSE_BUTTON) != MOUSE_UP) {
                s->mode |= MODE_MOUSEMOTION;
 
                window_copy_update_cursor(wp, m->x, m->y);

Index: tmux.h
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.h,v
retrieving revision 1.568
retrieving revision 1.569
diff -u -d -r1.568 -r1.569
--- tmux.h      2 Jul 2010 02:54:52 -0000       1.568
+++ tmux.h      2 Jul 2010 02:56:07 -0000       1.569
@@ -1049,9 +1049,23 @@
        u_int            last_width;
 };
 
+/*
+ * xterm mouse mode is fairly silly. Buttons are in the bottom two
+ * bits: 0 button 1; 1 button 2; 2 button 3; 3 buttons released.
+ *
+ * Bit 3 is shift; bit 4 is meta; bit 5 control.
+ *
+ * Bit 6 is added for mouse buttons 4 and 5.
+ */
 /* Mouse input. */
 struct mouse_event {
        u_char  b;
+#define MOUSE_1 0
+#define MOUSE_2 1
+#define MOUSE_3 2
+#define MOUSE_UP 3
+#define MOUSE_BUTTON 3
+#define MOUSE_45 64
        u_char  x;
        u_char  y;
 };


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to