aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2019-04-21 10:33:09 +0000
committerBruce Evans <bde@FreeBSD.org>2019-04-21 10:33:09 +0000
commite848f3d19c724083c0ccf4ac1e353e0a10e884b7 (patch)
tree38aad3bc3e003ff70d6c1db34e1b295c2f178566 /lib
parenta8083b9c0b1c4bf40c4a966156f5ae36402f7f31 (diff)
downloadsrc-e848f3d19c724083c0ccf4ac1e353e0a10e884b7.tar.gz
src-e848f3d19c724083c0ccf4ac1e353e0a10e884b7.zip
Fix missing restoring of the mouse cursor position, the border color and the
blank state after a screen switch.
Notes
Notes: svn path=/head/; revision=346486
Diffstat (limited to 'lib')
-rw-r--r--lib/libvgl/main.c3
-rw-r--r--lib/libvgl/mouse.c16
-rw-r--r--lib/libvgl/simple.c16
-rw-r--r--lib/libvgl/vgl.h3
4 files changed, 38 insertions, 0 deletions
diff --git a/lib/libvgl/main.c b/lib/libvgl/main.c
index 3b5ac8e955df..6a5d987ed92e 100644
--- a/lib/libvgl/main.c
+++ b/lib/libvgl/main.c
@@ -436,6 +436,9 @@ VGLCheckSwitch()
VGLDisplay->Xsize = VGLModeInfo.vi_width;
VGLDisplay->Ysize = VGLModeInfo.vi_height;
VGLSetVScreenSize(VGLDisplay, VGLDisplay->VXsize, VGLDisplay->VYsize);
+ VGLRestoreBlank();
+ VGLRestoreBorder();
+ VGLMouseRestore();
VGLPanScreen(VGLDisplay, VGLDisplay->Xorigin, VGLDisplay->Yorigin);
switch (VGLDisplay->Type) {
case VIDBUF4S:
diff --git a/lib/libvgl/mouse.c b/lib/libvgl/mouse.c
index 8dc429a932c3..bee63f3c94dd 100644
--- a/lib/libvgl/mouse.c
+++ b/lib/libvgl/mouse.c
@@ -272,6 +272,22 @@ VGLMouseInit(int mode)
return 0;
}
+void
+VGLMouseRestore(void)
+{
+ struct mouse_info mouseinfo;
+
+ INTOFF();
+ mouseinfo.operation = MOUSE_GETINFO;
+ if (ioctl(0, CONS_MOUSECTL, &mouseinfo) == 0) {
+ mouseinfo.operation = MOUSE_MOVEABS;
+ mouseinfo.u.data.x = VGLMouseXpos;
+ mouseinfo.u.data.y = VGLMouseYpos;
+ ioctl(0, CONS_MOUSECTL, &mouseinfo);
+ }
+ INTON();
+}
+
int
VGLMouseStatus(int *x, int *y, char *buttons)
{
diff --git a/lib/libvgl/simple.c b/lib/libvgl/simple.c
index 1da02746c529..73496c0a783d 100644
--- a/lib/libvgl/simple.c
+++ b/lib/libvgl/simple.c
@@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
#include <sys/endian.h>
#include "vgl.h"
+static int VGLBlank;
+static byte VGLBorderColor;
static byte VGLSavePaletteRed[256];
static byte VGLSavePaletteGreen[256];
static byte VGLSavePaletteBlue[256];
@@ -637,6 +639,12 @@ VGLSetPaletteIndex(byte color, byte red, byte green, byte blue)
}
void
+VGLRestoreBorder(void)
+{
+ VGLSetBorder(VGLBorderColor);
+}
+
+void
VGLSetBorder(byte color)
{
if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT && ioctl(0, KDENABIO, 0))
@@ -646,11 +654,18 @@ VGLSetBorder(byte color)
outb(0x3C0,0x11); outb(0x3C0, color);
inb(0x3DA);
outb(0x3C0, 0x20);
+ VGLBorderColor = color;
if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT)
ioctl(0, KDDISABIO, 0);
}
void
+VGLRestoreBlank(void)
+{
+ VGLBlankDisplay(VGLBlank);
+}
+
+void
VGLBlankDisplay(int blank)
{
byte val;
@@ -660,6 +675,7 @@ VGLBlankDisplay(int blank)
VGLCheckSwitch();
outb(0x3C4, 0x01); val = inb(0x3C5); outb(0x3C4, 0x01);
outb(0x3C5, ((blank) ? (val |= 0x20) : (val &= 0xDF)));
+ VGLBlank = blank;
if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT)
ioctl(0, KDDISABIO, 0);
}
diff --git a/lib/libvgl/vgl.h b/lib/libvgl/vgl.h
index 48d2dbf39765..106d9a79956d 100644
--- a/lib/libvgl/vgl.h
+++ b/lib/libvgl/vgl.h
@@ -130,6 +130,7 @@ void VGLMouseAction(int dummy);
void VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *OrMask);
void VGLMouseSetStdImage(void);
int VGLMouseInit(int mode);
+void VGLMouseRestore(void);
int VGLMouseStatus(int *x, int *y, char *buttons);
int VGLMouseFreeze(int x, int y, int width, int hight, u_long color);
void VGLMouseUnFreeze(void);
@@ -142,6 +143,8 @@ void VGLFilledBox(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long colo
void VGLEllipse(VGLBitmap *object, int xc, int yc, int a, int b, u_long color);
void VGLFilledEllipse(VGLBitmap *object, int xc, int yc, int a, int b, u_long color);
void VGLClear(VGLBitmap *object, u_long color);
+void VGLRestoreBlank(void);
+void VGLRestoreBorder(void);
void VGLRestorePalette(void);
void VGLSavePalette(void);
void VGLSetPalette(byte *red, byte *green, byte *blue);