diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index ea6dedf6027d..a0d71b29edec 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.41 1997/06/23 09:31:03 kato Exp $ + * $Id: syscons.c,v 1.42 1997/06/30 10:00:43 kato Exp $ */ #include "sc.h" @@ -331,6 +331,7 @@ static inline void draw_cursor_image(scr_stat *scp) { u_short cursor_image, *ptr; + u_short prev_image; #ifdef PC98 int pos = scp->cursor_pos - scp->scr_buf; while((inb(TEXT_GDC + 0) & 0x04) == 0) {} @@ -342,11 +343,26 @@ draw_cursor_image(scr_stat *scp) /* do we have a destructive cursor ? */ if (flags & CHAR_CURSOR) { - cursor_image = *scp->cursor_pos; + prev_image = scp->cursor_saveunder; + cursor_image = *ptr & 0x00ff; + if (cursor_image == DEAD_CHAR) + cursor_image = prev_image & 0x00ff; + cursor_image |= *(scp->cursor_pos) & 0xff00; scp->cursor_saveunder = cursor_image; + /* update the cursor bitmap if the char under the cursor has changed */ + if (prev_image != cursor_image) + set_destructive_cursor(scp); /* modify cursor_image */ if (!(flags & BLINK_CURSOR)||((flags & BLINK_CURSOR)&&(blinkrate & 4))){ - set_destructive_cursor(scp); + /* + * When the mouse pointer is at the same position as the cursor, + * the cursor bitmap needs to be updated even if the char under + * the cursor hasn't changed, because the mouse pionter may + * have moved by a few dots within the cursor cel. + */ + if ((prev_image == cursor_image) + && (cursor_image != *(scp->cursor_pos))) + set_destructive_cursor(scp); cursor_image &= 0xff00; cursor_image |= DEAD_CHAR; } @@ -701,6 +717,8 @@ scattach(struct isa_device *dev) scinit(); flags = dev->id_flags; + if (!crtc_vga) + flags &= ~CHAR_CURSOR; scp = console[0]; @@ -746,11 +764,8 @@ scattach(struct isa_device *dev) #endif /* initialize cursor stuff */ - if (!(scp->status & UNKNOWN_MODE)) { + if (!(scp->status & UNKNOWN_MODE)) draw_cursor_image(scp); - if (crtc_vga && (flags & CHAR_CURSOR)) - set_destructive_cursor(scp); - } /* get screen update going */ scrn_timer(NULL); @@ -1064,9 +1079,18 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) if (!crtc_vga) return ENXIO; flags |= CHAR_CURSOR; - set_destructive_cursor(scp); } else flags &= ~CHAR_CURSOR; + /* + * The cursor shape is global property; all virtual consoles + * are affected. Update the cursor in the current console... + */ + if (!(cur_console->status & UNKNOWN_MODE)) { + remove_cursor_image(cur_console); + if (flags & CHAR_CURSOR) + set_destructive_cursor(cur_console); + draw_cursor_image(cur_console); + } return 0; case CONS_BELLTYPE: /* set bell type sound/visual */ @@ -1519,8 +1543,6 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) copy_font(LOAD, FONT_14, font_14); if (fonts_loaded & FONT_16) copy_font(LOAD, FONT_16, font_16); - if (flags & CHAR_CURSOR) - set_destructive_cursor(scp); load_palette(palette); } /* FALL THROUGH */ @@ -1716,9 +1738,11 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) return ENXIO; bcopy(data, font_8, 8*256); fonts_loaded |= FONT_8; - copy_font(LOAD, FONT_8, font_8); - if (flags & CHAR_CURSOR) - set_destructive_cursor(scp); + if (!(cur_console->status & UNKNOWN_MODE)) { + copy_font(LOAD, FONT_8, font_8); + if (flags & CHAR_CURSOR) + set_destructive_cursor(cur_console); + } return 0; case GIO_FONT8x8: /* get 8x8 dot font */ @@ -1736,9 +1760,11 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) return ENXIO; bcopy(data, font_14, 14*256); fonts_loaded |= FONT_14; - copy_font(LOAD, FONT_14, font_14); - if (flags & CHAR_CURSOR) - set_destructive_cursor(scp); + if (!(cur_console->status & UNKNOWN_MODE)) { + copy_font(LOAD, FONT_14, font_14); + if (flags & CHAR_CURSOR) + set_destructive_cursor(cur_console); + } return 0; case GIO_FONT8x14: /* get 8x14 dot font */ @@ -1756,9 +1782,11 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) return ENXIO; bcopy(data, font_16, 16*256); fonts_loaded |= FONT_16; - copy_font(LOAD, FONT_16, font_16); - if (flags & CHAR_CURSOR) - set_destructive_cursor(scp); + if (!(cur_console->status & UNKNOWN_MODE)) { + copy_font(LOAD, FONT_16, font_16); + if (flags & CHAR_CURSOR) + set_destructive_cursor(cur_console); + } return 0; case GIO_FONT8x16: /* get 8x16 dot font */ @@ -2144,11 +2172,10 @@ exchange_scr(void) } move_crsr(new_scp, new_scp->xpos, new_scp->ypos); #ifndef PC98 - if ((old_scp->status & UNKNOWN_MODE) && crtc_vga) { - if (flags & CHAR_CURSOR) - set_destructive_cursor(new_scp); + if (!(new_scp->status & UNKNOWN_MODE) && (flags & CHAR_CURSOR)) + set_destructive_cursor(new_scp); + if ((old_scp->status & UNKNOWN_MODE) && crtc_vga) load_palette(palette); - } #endif if (old_scp->status & KBD_RAW_MODE || new_scp->status & KBD_RAW_MODE) shfts = ctls = alts = agrs = metas = 0; @@ -2838,17 +2865,24 @@ scan_esc(scr_stat *scp, u_char c) flags |= BLINK_CURSOR; else flags &= ~BLINK_CURSOR; - if ((scp->term.param[0] & 0x02) && crtc_vga) { + if ((scp->term.param[0] & 0x02) && crtc_vga) flags |= CHAR_CURSOR; - set_destructive_cursor(scp); - } else + else flags &= ~CHAR_CURSOR; } else if (scp->term.num_param == 2) { scp->cursor_start = scp->term.param[0] & 0x1F; scp->cursor_end = scp->term.param[1] & 0x1F; - if (flags & CHAR_CURSOR) - set_destructive_cursor(scp); + } + /* + * The cursor shape is global property; all virtual consoles + * are affected. Update the cursor in the current console... + */ + if (!(cur_console->status & UNKNOWN_MODE)) { + remove_cursor_image(cur_console); + if (crtc_vga && (flags & CHAR_CURSOR)) + set_destructive_cursor(cur_console); + draw_cursor_image(cur_console); } break; @@ -3393,6 +3427,7 @@ scinit(void) console[0]->atr_buf = Atrat; console[0]->cursor_atr = Atrat + hw_cursor; #endif + console[0]->cursor_saveunder = *console[0]->cursor_pos; console[0]->xpos = hw_cursor % COL; console[0]->ypos = hw_cursor / COL; for (i=1; icursor_saveunder = *scp->cursor_pos; return scp; } @@ -5009,6 +5045,7 @@ do_bell(scr_stat *scp, int pitch, int duration) copy_font(SAVE, FONT_16, font_16); fonts_loaded = FONT_16; save_palette(); + set_destructive_cursor(console[0]); } #ifdef SC_SPLASH_SCREEN