2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer as
10 * the first lines of this file unmodified.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
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.
26 * $FreeBSD: src/sys/dev/syscons/scmouse.c,v 1.12.2.3 2001/07/28 12:51:47 yokota Exp $
29 #include "opt_syscons.h"
31 #include <sys/param.h>
32 #include <sys/systm.h>
33 #include <sys/kernel.h>
35 #include <sys/signalvar.h>
38 #include <sys/thread2.h>
39 #include <sys/mplock2.h>
41 #include <machine/console.h>
42 #include <sys/mouse.h>
46 #ifdef SC_TWOBUTTON_MOUSE
47 #define SC_MOUSE_PASTEBUTTON MOUSE_BUTTON3DOWN /* right button */
48 #define SC_MOUSE_EXTENDBUTTON MOUSE_BUTTON2DOWN /* not really used */
50 #define SC_MOUSE_PASTEBUTTON MOUSE_BUTTON2DOWN /* middle button */
51 #define SC_MOUSE_EXTENDBUTTON MOUSE_BUTTON3DOWN /* right button */
52 #endif /* SC_TWOBUTTON_MOUSE */
54 #define SC_WAKEUP_DELTA 20
56 #ifndef SC_NO_SYSMOUSE
58 static int cut_buffer_size;
59 static u_char *cut_buffer;
62 static void sc_mouse_init(void *);
63 static void sc_mouse_uninit(void *);
65 static void set_mouse_pos(scr_stat *scp);
66 #ifndef SC_NO_CUTPASTE
67 static int skip_spc_right(scr_stat *scp, int p);
68 static int skip_spc_left(scr_stat *scp, int p);
69 static void mouse_cut(scr_stat *scp);
70 static void mouse_cut_start(scr_stat *scp);
71 static void mouse_cut_end(scr_stat *scp);
72 static void mouse_cut_word(scr_stat *scp);
73 static void mouse_cut_line(scr_stat *scp);
74 static void mouse_cut_extend(scr_stat *scp);
75 static void mouse_paste(scr_stat *scp);
76 #endif /* SC_NO_CUTPASTE */
78 #ifndef SC_NO_CUTPASTE
79 /* allocate a cut buffer */
81 sc_alloc_cut_buffer(scr_stat *scp, int wait)
85 if ((cut_buffer == NULL)
86 || (cut_buffer_size < scp->xsize * scp->ysize + 1)) {
91 cut_buffer_size = scp->xsize * scp->ysize + 1;
92 p = kmalloc(cut_buffer_size, M_SYSCONS, (wait) ? M_WAITOK : M_NOWAIT);
98 #endif /* SC_NO_CUTPASTE */
102 sc_mouse_move(scr_stat *scp, int x, int y)
105 scp->mouse_xpos = scp->mouse_oldxpos = x;
106 scp->mouse_ypos = scp->mouse_oldypos = y;
107 if (scp->font_size <= 0)
108 scp->mouse_pos = scp->mouse_oldpos = 0;
110 scp->mouse_pos = scp->mouse_oldpos =
111 (y/scp->font_size - scp->yoff)*scp->xsize + x/8 - scp->xoff;
112 scp->status |= MOUSE_MOVED;
116 /* adjust mouse position */
118 set_mouse_pos(scr_stat *scp)
120 if (scp->mouse_xpos < scp->xoff*8)
121 scp->mouse_xpos = scp->xoff*8;
122 if (scp->mouse_ypos < scp->yoff*scp->font_size)
123 scp->mouse_ypos = scp->yoff*scp->font_size;
124 if (ISGRAPHSC(scp)) {
125 if (scp->mouse_xpos > scp->xpixel-1)
126 scp->mouse_xpos = scp->xpixel-1;
127 if (scp->mouse_ypos > scp->ypixel-1)
128 scp->mouse_ypos = scp->ypixel-1;
131 if (scp->mouse_xpos > (scp->xsize + scp->xoff)*8 - 1)
132 scp->mouse_xpos = (scp->xsize + scp->xoff)*8 - 1;
133 if (scp->mouse_ypos > (scp->ysize + scp->yoff)*scp->font_size - 1)
134 scp->mouse_ypos = (scp->ysize + scp->yoff)*scp->font_size - 1;
137 if (scp->mouse_xpos != scp->mouse_oldxpos || scp->mouse_ypos != scp->mouse_oldypos) {
138 scp->status |= MOUSE_MOVED;
140 (scp->mouse_ypos/scp->font_size - scp->yoff)*scp->xsize
141 + scp->mouse_xpos/8 - scp->xoff;
142 #ifndef SC_NO_CUTPASTE
143 if ((scp->status & MOUSE_VISIBLE) && (scp->status & MOUSE_CUTTING))
149 #ifndef SC_NO_CUTPASTE
152 sc_draw_mouse_image(scr_stat *scp)
157 ++scp->sc->videoio_in_progress;
158 (*scp->rndr->draw_mouse)(scp, scp->mouse_xpos, scp->mouse_ypos, TRUE);
159 scp->mouse_oldpos = scp->mouse_pos;
160 scp->mouse_oldxpos = scp->mouse_xpos;
161 scp->mouse_oldypos = scp->mouse_ypos;
162 scp->status |= MOUSE_VISIBLE;
163 --scp->sc->videoio_in_progress;
167 sc_remove_mouse_image(scr_stat *scp)
175 ++scp->sc->videoio_in_progress;
176 (*scp->rndr->draw_mouse)(scp,
177 (scp->mouse_oldpos%scp->xsize + scp->xoff)*8,
178 (scp->mouse_oldpos/scp->xsize + scp->yoff)
181 size = scp->xsize*scp->ysize;
182 i = scp->mouse_oldpos;
183 mark_for_update(scp, i);
184 mark_for_update(scp, i);
185 if (i + scp->xsize + 1 < size) {
186 mark_for_update(scp, i + scp->xsize + 1);
187 } else if (i + scp->xsize < size) {
188 mark_for_update(scp, i + scp->xsize);
189 } else if (i + 1 < size) {
190 mark_for_update(scp, i + 1);
192 scp->status &= ~MOUSE_VISIBLE;
193 --scp->sc->videoio_in_progress;
197 sc_inside_cutmark(scr_stat *scp, int pos)
202 if (scp->mouse_cut_end < 0)
204 if (scp->mouse_cut_start <= scp->mouse_cut_end) {
205 start = scp->mouse_cut_start;
206 end = scp->mouse_cut_end;
208 start = scp->mouse_cut_end;
209 end = scp->mouse_cut_start - 1;
211 return ((start <= pos) && (pos <= end));
215 sc_remove_cutmarking(scr_stat *scp)
218 if (scp->mouse_cut_end >= 0) {
219 mark_for_update(scp, scp->mouse_cut_start);
220 mark_for_update(scp, scp->mouse_cut_end);
222 scp->mouse_cut_start = scp->xsize*scp->ysize;
223 scp->mouse_cut_end = -1;
225 scp->status &= ~MOUSE_CUTTING;
229 sc_remove_all_cutmarkings(sc_softc_t *sc)
234 /* delete cut markings in all vtys */
235 for (i = 0; i < sc->vtys; ++i) {
236 scp = SC_STAT(sc->dev[i]);
239 sc_remove_cutmarking(scp);
244 sc_remove_all_mouse(sc_softc_t *sc)
249 for (i = 0; i < sc->vtys; ++i) {
250 scp = SC_STAT(sc->dev[i]);
253 if (scp->status & MOUSE_VISIBLE) {
254 scp->status &= ~MOUSE_VISIBLE;
260 #define IS_SPACE_CHAR(c) (((c) & 0xff) == ' ')
262 /* skip spaces to right */
264 skip_spc_right(scr_stat *scp, int p)
269 for (i = p % scp->xsize; i < scp->xsize; ++i) {
270 c = sc_vtb_getc(&scp->vtb, p);
271 if (!IS_SPACE_CHAR(c))
278 /* skip spaces to left */
280 skip_spc_left(scr_stat *scp, int p)
285 for (i = p-- % scp->xsize - 1; i >= 0; --i) {
286 c = sc_vtb_getc(&scp->vtb, p);
287 if (!IS_SPACE_CHAR(c))
294 /* copy marked region to the cut buffer */
296 mouse_cut(scr_stat *scp)
307 start = scp->mouse_cut_start;
308 if (scp->mouse_pos >= start) {
310 to = end = scp->mouse_pos;
312 from = end = scp->mouse_pos;
315 for (p = from, i = blank = 0; p <= to; ++p) {
316 cut_buffer[i] = sc_vtb_getc(&scp->vtb, p);
317 /* remember the position of the last non-space char */
318 if (!IS_SPACE_CHAR(cut_buffer[i++]))
319 blank = i; /* the first space after the last non-space */
320 /* trim trailing blank when crossing lines */
321 if ((p % scp->xsize) == (scp->xsize - 1)) {
322 cut_buffer[blank] = '\r';
326 cut_buffer[i] = '\0';
328 /* scan towards the end of the last line */
330 for (i = p % scp->xsize; i < scp->xsize; ++i) {
331 c = sc_vtb_getc(&scp->vtb, p);
332 if (!IS_SPACE_CHAR(c))
336 /* if there is nothing but blank chars, trim them, but mark towards eol */
337 if (i >= scp->xsize) {
342 cut_buffer[blank++] = '\r';
343 cut_buffer[blank] = '\0';
346 /* remove the current marking */
348 if (scp->mouse_cut_start <= scp->mouse_cut_end) {
349 mark_for_update(scp, scp->mouse_cut_start);
350 mark_for_update(scp, scp->mouse_cut_end);
351 } else if (scp->mouse_cut_end >= 0) {
352 mark_for_update(scp, scp->mouse_cut_end);
353 mark_for_update(scp, scp->mouse_cut_start);
356 /* mark the new region */
357 scp->mouse_cut_start = start;
358 scp->mouse_cut_end = end;
359 mark_for_update(scp, from);
360 mark_for_update(scp, to);
364 /* a mouse button is pressed, start cut operation */
366 mouse_cut_start(scr_stat *scp)
371 if (scp->status & MOUSE_VISIBLE) {
372 i = scp->mouse_cut_start;
373 j = scp->mouse_cut_end;
374 sc_remove_all_cutmarkings(scp->sc);
375 if (scp->mouse_pos == i && i == j) {
376 cut_buffer[0] = '\0';
377 } else if (skip_spc_right(scp, scp->mouse_pos) >= scp->xsize) {
378 /* if the pointer is on trailing blank chars, mark towards eol */
379 i = skip_spc_left(scp, scp->mouse_pos) + 1;
381 scp->mouse_cut_start =
382 (scp->mouse_pos / scp->xsize) * scp->xsize + i;
384 (scp->mouse_pos / scp->xsize + 1) * scp->xsize - 1;
386 cut_buffer[0] = '\r';
387 cut_buffer[1] = '\0';
388 scp->status |= MOUSE_CUTTING;
391 scp->mouse_cut_start = scp->mouse_pos;
392 scp->mouse_cut_end = scp->mouse_cut_start;
394 cut_buffer[0] = sc_vtb_getc(&scp->vtb, scp->mouse_cut_start);
395 cut_buffer[1] = '\0';
396 scp->status |= MOUSE_CUTTING;
398 mark_all(scp); /* this is probably overkill XXX */
402 /* end of cut operation */
404 mouse_cut_end(scr_stat *scp)
406 if (scp->status & MOUSE_VISIBLE)
407 scp->status &= ~MOUSE_CUTTING;
410 /* copy a word under the mouse pointer */
412 mouse_cut_word(scr_stat *scp)
423 * Because we don't have locale information in the kernel,
424 * we only distinguish space char and non-space chars. Punctuation
425 * chars, symbols and other regular chars are all treated alike.
427 if (scp->status & MOUSE_VISIBLE) {
428 /* remove the current cut mark */
430 if (scp->mouse_cut_start <= scp->mouse_cut_end) {
431 mark_for_update(scp, scp->mouse_cut_start);
432 mark_for_update(scp, scp->mouse_cut_end);
433 } else if (scp->mouse_cut_end >= 0) {
434 mark_for_update(scp, scp->mouse_cut_end);
435 mark_for_update(scp, scp->mouse_cut_start);
437 scp->mouse_cut_start = scp->xsize*scp->ysize;
438 scp->mouse_cut_end = -1;
441 sol = (scp->mouse_pos / scp->xsize) * scp->xsize;
442 eol = sol + scp->xsize;
443 c = sc_vtb_getc(&scp->vtb, scp->mouse_pos);
444 if (IS_SPACE_CHAR(c)) {
446 for (j = scp->mouse_pos; j >= sol; --j) {
447 c = sc_vtb_getc(&scp->vtb, j);
448 if (!IS_SPACE_CHAR(c))
452 for (j = scp->mouse_pos; j < eol; ++j) {
453 c = sc_vtb_getc(&scp->vtb, j);
454 if (!IS_SPACE_CHAR(c))
460 for (j = scp->mouse_pos; j >= sol; --j) {
461 c = sc_vtb_getc(&scp->vtb, j);
462 if (IS_SPACE_CHAR(c))
466 for (j = scp->mouse_pos; j < eol; ++j) {
467 c = sc_vtb_getc(&scp->vtb, j);
468 if (IS_SPACE_CHAR(c))
474 /* copy the found word */
475 for (i = 0, j = start; j <= end; ++j)
476 cut_buffer[i++] = sc_vtb_getc(&scp->vtb, j);
477 cut_buffer[i] = '\0';
478 scp->status |= MOUSE_CUTTING;
480 /* mark the region */
482 scp->mouse_cut_start = start;
483 scp->mouse_cut_end = end;
484 mark_for_update(scp, start);
485 mark_for_update(scp, end);
490 /* copy a line under the mouse pointer */
492 mouse_cut_line(scr_stat *scp)
497 if (scp->status & MOUSE_VISIBLE) {
498 /* remove the current cut mark */
500 if (scp->mouse_cut_start <= scp->mouse_cut_end) {
501 mark_for_update(scp, scp->mouse_cut_start);
502 mark_for_update(scp, scp->mouse_cut_end);
503 } else if (scp->mouse_cut_end >= 0) {
504 mark_for_update(scp, scp->mouse_cut_end);
505 mark_for_update(scp, scp->mouse_cut_start);
508 /* mark the entire line */
509 scp->mouse_cut_start =
510 (scp->mouse_pos / scp->xsize) * scp->xsize;
511 scp->mouse_cut_end = scp->mouse_cut_start + scp->xsize - 1;
512 mark_for_update(scp, scp->mouse_cut_start);
513 mark_for_update(scp, scp->mouse_cut_end);
516 /* copy the line into the cut buffer */
517 for (i = 0, j = scp->mouse_cut_start; j <= scp->mouse_cut_end; ++j)
518 cut_buffer[i++] = sc_vtb_getc(&scp->vtb, j);
519 cut_buffer[i++] = '\r';
520 cut_buffer[i] = '\0';
521 scp->status |= MOUSE_CUTTING;
525 /* extend the marked region to the mouse pointer position */
527 mouse_cut_extend(scr_stat *scp)
532 if ((scp->status & MOUSE_VISIBLE) && !(scp->status & MOUSE_CUTTING)
533 && (scp->mouse_cut_end >= 0)) {
534 if (scp->mouse_cut_start <= scp->mouse_cut_end) {
535 start = scp->mouse_cut_start;
536 end = scp->mouse_cut_end;
538 start = scp->mouse_cut_end;
539 end = scp->mouse_cut_start - 1;
542 if (scp->mouse_pos > end) {
543 scp->mouse_cut_start = start;
544 scp->mouse_cut_end = end;
545 } else if (scp->mouse_pos < start) {
546 scp->mouse_cut_start = end + 1;
547 scp->mouse_cut_end = start;
549 if (scp->mouse_pos - start > end + 1 - scp->mouse_pos) {
550 scp->mouse_cut_start = start;
551 scp->mouse_cut_end = end;
553 scp->mouse_cut_start = end + 1;
554 scp->mouse_cut_end = start;
559 scp->status |= MOUSE_CUTTING;
563 /* paste cut buffer contents into the current vty */
565 mouse_paste(scr_stat *scp)
567 if (scp->status & MOUSE_VISIBLE)
568 sc_paste(scp, cut_buffer, strlen(cut_buffer));
571 #endif /* SC_NO_CUTPASTE */
574 sc_mouse_exit1_proc(struct proc *p)
579 KKASSERT(scp != NULL);
582 KKASSERT(scp->mouse_proc == p);
583 KKASSERT(scp->mouse_pid == p->p_pid);
585 scp->mouse_signal = 0;
586 scp->mouse_proc = NULL;
591 p->p_flags &= ~P_SCMOUSE;
592 p->p_drv_priv = NULL;
598 * Handle exit1 for processes registered as MOUSE_MODE handlers.
599 * We must remove a process hold, established when MOUSE_MODE
603 sc_mouse_exit1(struct thread *td)
610 if ((p->p_flags & P_SCMOUSE) == 0)
614 sc_mouse_exit1_proc(p);
618 sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag)
625 scp = SC_STAT(tp->t_dev);
629 case CONS_MOUSECTL: /* control mouse arrow */
630 mouse = (mouse_info_t*) data;
631 cur_scp = scp->sc->cur_scp;
633 switch (mouse->operation) {
635 * Setup a process to receive signals on mouse events.
640 if (!ISSIGVALID(mouse->u.mode.signal)) {
641 /* Setting MOUSE_MODE w/ an invalid signal is used to disarm */
642 if (scp->mouse_proc == curproc) {
643 sc_mouse_exit1_proc(curproc);
651 /* Only one mouse process per syscons */
652 if (scp->mouse_proc) {
657 /* Only one syscons signal source per process */
658 if (curproc->p_flags & P_SCMOUSE) {
664 * Process is stabilized by a hold, which is removed from
665 * sc_mouse_exit1. scp's mouse_{signal,proc,pid} fields
666 * are synchronized by the MP Lock.
668 scp->mouse_signal = mouse->u.mode.signal;
669 scp->mouse_proc = curproc;
670 scp->mouse_pid = curproc->p_pid;
671 curproc->p_flags |= P_SCMOUSE;
672 KKASSERT(curproc->p_drv_priv == NULL);
673 curproc->p_drv_priv = scp;
684 if (!(scp->sc->flags & SC_MOUSE_ENABLED)) {
685 scp->sc->flags |= SC_MOUSE_ENABLED;
686 cur_scp->status &= ~MOUSE_HIDDEN;
687 if (!ISGRAPHSC(cur_scp))
699 if (scp->sc->flags & SC_MOUSE_ENABLED) {
700 scp->sc->flags &= ~SC_MOUSE_ENABLED;
701 sc_remove_all_mouse(scp->sc);
712 scp->mouse_xpos = mouse->u.data.x;
713 scp->mouse_ypos = mouse->u.data.y;
720 scp->mouse_xpos += mouse->u.data.x;
721 scp->mouse_ypos += mouse->u.data.y;
727 mouse->u.data.x = scp->mouse_xpos;
728 mouse->u.data.y = scp->mouse_ypos;
730 mouse->u.data.buttons = scp->mouse_buttons;
734 case MOUSE_MOTION_EVENT:
735 /* send out mouse event on /dev/sysmouse */
737 /* this should maybe only be settable from /dev/consolectl SOS */
738 if (SC_VTY(tp->t_dev) != SC_CONSOLECTL)
742 if (mouse->u.data.x != 0 || mouse->u.data.y != 0) {
743 cur_scp->mouse_xpos += mouse->u.data.x;
744 cur_scp->mouse_ypos += mouse->u.data.y;
745 set_mouse_pos(cur_scp);
748 if (mouse->operation == MOUSE_ACTION) {
749 f = cur_scp->mouse_buttons ^ mouse->u.data.buttons;
750 cur_scp->mouse_buttons = mouse->u.data.buttons;
754 if (sysmouse_event(mouse) == 0)
758 * If any buttons are down or the mouse has moved a lot,
759 * stop the screen saver.
761 if (((mouse->operation == MOUSE_ACTION) && mouse->u.data.buttons)
762 || (mouse->u.data.x*mouse->u.data.x
763 + mouse->u.data.y*mouse->u.data.y
764 >= SC_WAKEUP_DELTA*SC_WAKEUP_DELTA)) {
765 sc_touch_scrn_saver();
768 cur_scp->status &= ~MOUSE_HIDDEN;
771 if (cur_scp->mouse_signal) {
772 KKASSERT(cur_scp->mouse_proc != NULL);
773 ksignal(cur_scp->mouse_proc, cur_scp->mouse_signal);
779 if (ISGRAPHSC(cur_scp) || (cut_buffer == NULL))
782 #ifndef SC_NO_CUTPASTE
783 if ((mouse->operation == MOUSE_ACTION) && f) {
784 /* process button presses */
785 if (cur_scp->mouse_buttons & MOUSE_BUTTON1DOWN)
786 mouse_cut_start(cur_scp);
788 mouse_cut_end(cur_scp);
789 if (cur_scp->mouse_buttons & MOUSE_BUTTON2DOWN ||
790 cur_scp->mouse_buttons & MOUSE_BUTTON3DOWN)
791 mouse_paste(cur_scp);
793 #endif /* SC_NO_CUTPASTE */
796 case MOUSE_BUTTON_EVENT:
797 if ((mouse->u.event.id & MOUSE_BUTTONS) == 0)
799 if (mouse->u.event.value < 0)
802 /* this should maybe only be settable from /dev/consolectl SOS */
803 if (SC_VTY(tp->t_dev) != SC_CONSOLECTL)
806 if (mouse->u.event.value > 0)
807 cur_scp->mouse_buttons |= mouse->u.event.id;
809 cur_scp->mouse_buttons &= ~mouse->u.event.id;
811 if (sysmouse_event(mouse) == 0)
814 /* if a button is held down, stop the screen saver */
815 if (mouse->u.event.value > 0)
816 sc_touch_scrn_saver();
818 cur_scp->status &= ~MOUSE_HIDDEN;
821 if (cur_scp->mouse_signal) {
822 KKASSERT(cur_scp->mouse_proc != NULL);
823 ksignal(cur_scp->mouse_proc, cur_scp->mouse_signal);
829 if (ISGRAPHSC(cur_scp) || (cut_buffer == NULL))
832 #ifndef SC_NO_CUTPASTE
833 switch (mouse->u.event.id) {
834 case MOUSE_BUTTON1DOWN:
835 switch (mouse->u.event.value % 4) {
837 mouse_cut_end(cur_scp);
839 case 1: /* single click: start cut operation */
840 mouse_cut_start(cur_scp);
842 case 2: /* double click: cut a word */
843 mouse_cut_word(cur_scp);
844 mouse_cut_end(cur_scp);
846 case 3: /* triple click: cut a line */
847 mouse_cut_line(cur_scp);
848 mouse_cut_end(cur_scp);
852 case SC_MOUSE_PASTEBUTTON:
853 switch (mouse->u.event.value) {
857 mouse_paste(cur_scp);
861 case SC_MOUSE_EXTENDBUTTON:
862 switch (mouse->u.event.value) {
864 if (!(cur_scp->mouse_buttons & MOUSE_BUTTON1DOWN))
865 mouse_cut_end(cur_scp);
868 mouse_cut_extend(cur_scp);
873 #endif /* SC_NO_CUTPASTE */
876 case MOUSE_MOUSECHAR:
877 if (mouse->u.mouse_char < 0) {
878 mouse->u.mouse_char = scp->sc->mouse_char;
880 if (mouse->u.mouse_char >= (unsigned char)-1 - 4)
883 sc_remove_all_mouse(scp->sc);
884 #ifndef SC_NO_FONT_LOADING
885 if (ISTEXTSC(cur_scp) && (cur_scp->font != NULL))
886 sc_load_font(cur_scp, 0, cur_scp->font_size, cur_scp->font,
887 cur_scp->sc->mouse_char, 4);
889 scp->sc->mouse_char = mouse->u.mouse_char;
905 sc_mouse_init(void *unused)
907 at_exit(sc_mouse_exit1);
911 sc_mouse_uninit(void *unused)
915 SYSINIT(sc_mouse_init, SI_SUB_DRIVERS, SI_ORDER_ANY, sc_mouse_init, NULL);
916 SYSUNINIT(sc_mouse_uninit, SI_SUB_DRIVERS, SI_ORDER_ANY, sc_mouse_uninit, NULL);
918 #endif /* SC_NO_SYSMOUSE */