Deleted Added
full compact
scmouse.c (181905) scmouse.c (197539)
1/*-
2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/syscons/scmouse.c 181905 2008-08-20 08:31:58Z ed $");
28__FBSDID("$FreeBSD: head/sys/dev/syscons/scmouse.c 197539 2009-09-27 18:19:41Z ed $");
29
30#include "opt_syscons.h"
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/conf.h>
35#include <sys/consio.h>
36#include <sys/fbio.h>

--- 75 unchanged lines hidden (view full) ---

112 M_DEVBUF, (wait) ? M_WAITOK : M_NOWAIT);
113 if (p != NULL)
114 p[0] = '\0';
115 cut_buffer = p;
116 }
117}
118#endif /* SC_NO_CUTPASTE */
119
29
30#include "opt_syscons.h"
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/conf.h>
35#include <sys/consio.h>
36#include <sys/fbio.h>

--- 75 unchanged lines hidden (view full) ---

112 M_DEVBUF, (wait) ? M_WAITOK : M_NOWAIT);
113 if (p != NULL)
114 p[0] = '\0';
115 cut_buffer = p;
116 }
117}
118#endif /* SC_NO_CUTPASTE */
119
120static void
121sc_mouse_input_button(scr_stat *scp, int button)
122{
123 char mouseb[6] = "\x1B[M";
124
125 mouseb[3] = ' ' + button;
126 mouseb[4] = '!' + scp->mouse_pos % scp->xsize;
127 mouseb[5] = '!' + scp->mouse_pos / scp->xsize;
128 sc_respond(scp, mouseb, sizeof mouseb, 1);
129}
130
131static void
132sc_mouse_input(scr_stat *scp, mouse_info_t *mouse)
133{
134
135 switch (mouse->operation) {
136 case MOUSE_BUTTON_EVENT:
137 if (mouse->u.event.value > 0) {
138 /* Mouse button pressed. */
139 if (mouse->u.event.id & MOUSE_BUTTON1DOWN)
140 sc_mouse_input_button(scp, 0);
141 if (mouse->u.event.id & MOUSE_BUTTON2DOWN)
142 sc_mouse_input_button(scp, 1);
143 if (mouse->u.event.id & MOUSE_BUTTON3DOWN)
144 sc_mouse_input_button(scp, 2);
145 } else {
146 /* Mouse button released. */
147 sc_mouse_input_button(scp, 3);
148 }
149 break;
150 case MOUSE_MOTION_EVENT:
151 if (mouse->u.data.z < 0) {
152 /* Scroll up. */
153 sc_mouse_input_button(scp, 64);
154 } else if (mouse->u.data.z > 0) {
155 /* Scroll down. */
156 sc_mouse_input_button(scp, 65);
157 }
158 break;
159 }
160}
161
120/* move mouse */
121void
122sc_mouse_move(scr_stat *scp, int x, int y)
123{
124 int s;
125
126 s = spltty();
127 scp->mouse_xpos = scp->mouse_oldxpos = x;

--- 622 unchanged lines hidden (view full) ---

750 || (mouse->u.data.x*mouse->u.data.x
751 + mouse->u.data.y*mouse->u.data.y
752 >= SC_WAKEUP_DELTA*SC_WAKEUP_DELTA)) {
753 sc_touch_scrn_saver();
754 }
755
756 cur_scp->status &= ~MOUSE_HIDDEN;
757
162/* move mouse */
163void
164sc_mouse_move(scr_stat *scp, int x, int y)
165{
166 int s;
167
168 s = spltty();
169 scp->mouse_xpos = scp->mouse_oldxpos = x;

--- 622 unchanged lines hidden (view full) ---

792 || (mouse->u.data.x*mouse->u.data.x
793 + mouse->u.data.y*mouse->u.data.y
794 >= SC_WAKEUP_DELTA*SC_WAKEUP_DELTA)) {
795 sc_touch_scrn_saver();
796 }
797
798 cur_scp->status &= ~MOUSE_HIDDEN;
799
800 if (cur_scp->mouse_level > 0) {
801 sc_mouse_input(scp, mouse);
802 break;
803 }
804
758 if (cur_scp->mouse_signal && cur_scp->mouse_proc) {
759 /* has controlling process died? */
760 if (cur_scp->mouse_proc != (p1 = pfind(cur_scp->mouse_pid))) {
761 cur_scp->mouse_signal = 0;
762 cur_scp->mouse_proc = NULL;
763 cur_scp->mouse_pid = 0;
764 if (p1)
765 PROC_UNLOCK(p1);

--- 40 unchanged lines hidden (view full) ---

806 return 0;
807
808 /* if a button is held down, stop the screen saver */
809 if (mouse->u.event.value > 0)
810 sc_touch_scrn_saver();
811
812 cur_scp->status &= ~MOUSE_HIDDEN;
813
805 if (cur_scp->mouse_signal && cur_scp->mouse_proc) {
806 /* has controlling process died? */
807 if (cur_scp->mouse_proc != (p1 = pfind(cur_scp->mouse_pid))) {
808 cur_scp->mouse_signal = 0;
809 cur_scp->mouse_proc = NULL;
810 cur_scp->mouse_pid = 0;
811 if (p1)
812 PROC_UNLOCK(p1);

--- 40 unchanged lines hidden (view full) ---

853 return 0;
854
855 /* if a button is held down, stop the screen saver */
856 if (mouse->u.event.value > 0)
857 sc_touch_scrn_saver();
858
859 cur_scp->status &= ~MOUSE_HIDDEN;
860
861 if (cur_scp->mouse_level > 0) {
862 sc_mouse_input(scp, mouse);
863 break;
864 }
865
814 if (cur_scp->mouse_signal && cur_scp->mouse_proc) {
815 if (cur_scp->mouse_proc != (p1 = pfind(cur_scp->mouse_pid))){
816 cur_scp->mouse_signal = 0;
817 cur_scp->mouse_proc = NULL;
818 cur_scp->mouse_pid = 0;
819 if (p1)
820 PROC_UNLOCK(p1);
821 } else {

--- 85 unchanged lines hidden ---
866 if (cur_scp->mouse_signal && cur_scp->mouse_proc) {
867 if (cur_scp->mouse_proc != (p1 = pfind(cur_scp->mouse_pid))){
868 cur_scp->mouse_signal = 0;
869 cur_scp->mouse_proc = NULL;
870 cur_scp->mouse_pid = 0;
871 if (p1)
872 PROC_UNLOCK(p1);
873 } else {

--- 85 unchanged lines hidden ---