View | Details | Raw Unified | Return to bug 15996
Collapse All | Expand All

(-)sys/dev/syscons/syscons.c (-30 / +70 lines)
Lines 48-53 Link Here
48
#include <sys/conf.h>
48
#include <sys/conf.h>
49
#include <sys/proc.h>
49
#include <sys/proc.h>
50
#include <sys/signalvar.h>
50
#include <sys/signalvar.h>
51
#include <sys/sysctl.h>
51
#include <sys/tty.h>
52
#include <sys/tty.h>
52
#include <sys/kernel.h>
53
#include <sys/kernel.h>
53
#include <sys/malloc.h>
54
#include <sys/malloc.h>
Lines 239-244 Link Here
239
#define SC_CONSOLE	255
240
#define SC_CONSOLE	255
240
vm_offset_t         	Crtat;
241
vm_offset_t         	Crtat;
241
static const int	nsccons = MAXCONS+2;
242
static const int	nsccons = MAXCONS+2;
243
static int		sc_mouse_char = SC_MOUSE_CHAR;
242
244
243
#define WRAPHIST(scp, pointer, offset)\
245
#define WRAPHIST(scp, pointer, offset)\
244
    ((scp)->history + ((((pointer) - (scp)->history) + (scp)->history_size \
246
    ((scp)->history + ((((pointer) - (scp)->history) + (scp)->history_size \
Lines 337-342 Link Here
337
static void remove_cutmarking(scr_stat *scp); 
339
static void remove_cutmarking(scr_stat *scp); 
338
static void do_bell(scr_stat *scp, int pitch, int duration);
340
static void do_bell(scr_stat *scp, int pitch, int duration);
339
static timeout_t blink_screen;
341
static timeout_t blink_screen;
342
static void reload_current_font(scr_stat *scp);
343
344
static int
345
sysctl_sc_mouse_char SYSCTL_HANDLER_ARGS
346
{
347
    int error;
348
349
    error = sysctl_handle_int(oidp, &sc_mouse_char, 0, req);
350
    if (!error && req->newptr) {
351
	/* Limit range to ensure mouse pointer characters exist in font */
352
	if(sc_mouse_char < 0) sc_mouse_char = 0;
353
	if(sc_mouse_char > 256 - 4) sc_mouse_char = 256 - 4;
354
355
	/*
356
	 * The base character for drawing the mouse pointer has changed.
357
	 * Clear the pointer, restore the original font, and then redraw
358
	 * the pointer mangling characters at the new location.
359
	 */
360
	remove_mouse_image(cur_console);
361
362
	/* Reload fonts to demangle character defs used by mouse cursor. */
363
	reload_current_font(cur_console);
364
365
	if (cur_console->status & MOUSE_VISIBLE)
366
	    draw_mouse_image(cur_console);
367
    }
368
    return (error);
369
}
370
371
SYSCTL_NODE(_hw, OID_AUTO, syscons, CTLFLAG_RW, 0, "Syscons driver mgmt");
372
SYSCTL_PROC(_hw_syscons, OID_AUTO, sc_mouse_char, CTLTYPE_INT|CTLFLAG_RW,
373
        0, 0, sysctl_sc_mouse_char, "I",
374
	"First character of four character range used to draw mouse cursor");
340
375
341
#define	CDEV_MAJOR	12
376
#define	CDEV_MAJOR	12
342
377
Lines 4096-4122 Link Here
4096
    Crtat = scp->adp->va_window;
4131
    Crtat = scp->adp->va_window;
4097
4132
4098
    if (!(scp->status & GRAPHICS_MODE)) {
4133
    if (!(scp->status & GRAPHICS_MODE)) {
4099
	/* load appropriate font */
4134
	reload_current_font(scp);
4100
	if (!(scp->status & PIXEL_MODE) && ISFONTAVAIL(scp->adp->va_flags)) {
4101
	    if (scp->font_size < 14) {
4102
		if (fonts_loaded & FONT_8)
4103
		    copy_font(scp, LOAD, 8, font_8);
4104
	    } else if (scp->font_size >= 16) {
4105
		if (fonts_loaded & FONT_16)
4106
		    copy_font(scp, LOAD, 16, font_16);
4107
	    } else {
4108
		if (fonts_loaded & FONT_14)
4109
		    copy_font(scp, LOAD, 14, font_14);
4110
	    }
4111
	    /*
4112
	     * FONT KLUDGE:
4113
	     * This is an interim kludge to display correct font.
4114
	     * Always use the font page #0 on the video plane 2.
4115
	     * Somehow we cannot show the font in other font pages on
4116
	     * some video cards... XXX
4117
	     */ 
4118
	    (*vidsw[scp->ad]->show_font)(scp->adp, 0);
4119
	}
4120
	mark_all(scp);
4135
	mark_all(scp);
4121
    }
4136
    }
4122
4137
Lines 4217-4229 Link Here
4217
    }
4232
    }
4218
4233
4219
    if (scp->status & MOUSE_VISIBLE) {
4234
    if (scp->status & MOUSE_VISIBLE) {
4220
	if ((scp->cursor_saveunder & 0xff) == SC_MOUSE_CHAR)
4235
	if ((scp->cursor_saveunder & 0xff) == sc_mouse_char)
4221
    	    bcopy(&scp->mouse_cursor[0], cursor, scp->font_size);
4236
    	    bcopy(&scp->mouse_cursor[0], cursor, scp->font_size);
4222
	else if ((scp->cursor_saveunder & 0xff) == SC_MOUSE_CHAR + 1)
4237
	else if ((scp->cursor_saveunder & 0xff) == sc_mouse_char + 1)
4223
    	    bcopy(&scp->mouse_cursor[32], cursor, scp->font_size);
4238
    	    bcopy(&scp->mouse_cursor[32], cursor, scp->font_size);
4224
	else if ((scp->cursor_saveunder & 0xff) == SC_MOUSE_CHAR + 2)
4239
	else if ((scp->cursor_saveunder & 0xff) == sc_mouse_char + 2)
4225
    	    bcopy(&scp->mouse_cursor[64], cursor, scp->font_size);
4240
    	    bcopy(&scp->mouse_cursor[64], cursor, scp->font_size);
4226
	else if ((scp->cursor_saveunder & 0xff) == SC_MOUSE_CHAR + 3)
4241
	else if ((scp->cursor_saveunder & 0xff) == sc_mouse_char + 3)
4227
    	    bcopy(&scp->mouse_cursor[96], cursor, scp->font_size);
4242
    	    bcopy(&scp->mouse_cursor[96], cursor, scp->font_size);
4228
	else
4243
	else
4229
	    bcopy(font_buffer+((scp->cursor_saveunder & 0xff)*scp->font_size),
4244
	    bcopy(font_buffer+((scp->cursor_saveunder & 0xff)*scp->font_size),
Lines 4551-4566 Link Here
4551
#endif
4566
#endif
4552
    font_loading_in_progress = TRUE;
4567
    font_loading_in_progress = TRUE;
4553
    (*vidsw[scp->ad]->load_font)(scp->adp, 0, 32, scp->mouse_cursor, 
4568
    (*vidsw[scp->ad]->load_font)(scp->adp, 0, 32, scp->mouse_cursor, 
4554
			   SC_MOUSE_CHAR, 4); 
4569
			   sc_mouse_char, 4); 
4555
    font_loading_in_progress = FALSE;
4570
    font_loading_in_progress = FALSE;
4556
4571
4557
    writew(crt_pos, (*(scp->mouse_pos) & 0xff00) | SC_MOUSE_CHAR);
4572
    writew(crt_pos, (*(scp->mouse_pos) & 0xff00) | sc_mouse_char);
4558
    writew(crt_pos+2*scp->xsize,
4573
    writew(crt_pos+2*scp->xsize,
4559
	   (*(scp->mouse_pos + scp->xsize) & 0xff00) | (SC_MOUSE_CHAR + 2));
4574
	   (*(scp->mouse_pos + scp->xsize) & 0xff00) | (sc_mouse_char + 2));
4560
    if (scp->mouse_xpos < (scp->xsize-1)*8) {
4575
    if (scp->mouse_xpos < (scp->xsize-1)*8) {
4561
    	writew(crt_pos + 2, (*(scp->mouse_pos + 1) & 0xff00) | (SC_MOUSE_CHAR + 1));
4576
    	writew(crt_pos + 2, (*(scp->mouse_pos + 1) & 0xff00) | (sc_mouse_char + 1));
4562
    	writew(crt_pos+2*scp->xsize + 2,
4577
    	writew(crt_pos+2*scp->xsize + 2,
4563
	       (*(scp->mouse_pos + scp->xsize + 1) & 0xff00) | (SC_MOUSE_CHAR + 3));
4578
	       (*(scp->mouse_pos + scp->xsize + 1) & 0xff00) | (sc_mouse_char + 3));
4564
    }
4579
    }
4565
    mark_for_update(scp, scp->mouse_pos - scp->scr_buf);
4580
    mark_for_update(scp, scp->mouse_pos - scp->scr_buf);
4566
    mark_for_update(scp, scp->mouse_pos + scp->xsize + 1 - scp->scr_buf);
4581
    mark_for_update(scp, scp->mouse_pos + scp->xsize + 1 - scp->scr_buf);
Lines 4671-4676 Link Here
4671
		     scp->xsize * scp->ysize);
4686
		     scp->xsize * scp->ysize);
4672
	blink_in_progress--;
4687
	blink_in_progress--;
4673
	timeout(blink_screen, scp, hz / 10);
4688
	timeout(blink_screen, scp, hz / 10);
4689
    }
4690
}
4691
4692
static void
4693
reload_current_font(scr_stat *scp)
4694
{
4695
    if (!(scp->status & PIXEL_MODE) && ISFONTAVAIL(scp->adp->va_flags)) {
4696
	if (scp->font_size < 14) {
4697
	    if (fonts_loaded & FONT_8)
4698
		copy_font(scp, LOAD, 8, font_8);
4699
	} else if (scp->font_size >= 16) {
4700
	    if (fonts_loaded & FONT_16)
4701
		copy_font(scp, LOAD, 16, font_16);
4702
	} else {
4703
	    if (fonts_loaded & FONT_14)
4704
		copy_font(scp, LOAD, 14, font_14);
4705
	}
4706
	/*
4707
	 * FONT KLUDGE:
4708
	 * This is an interim kludge to display correct font.
4709
	 * Always use the font page #0 on the video plane 2.
4710
	 * Somehow we cannot show the font in other font pages on
4711
	 * some video cards... XXX
4712
	 */ 
4713
	(*vidsw[scp->ad]->show_font)(scp->adp, 0);
4674
    }
4714
    }
4675
}
4715
}

Return to bug 15996