Module Name:    xsrc
Committed By:   tsutsui
Date:           Fri Oct 15 17:42:04 UTC 2021

Modified Files:
        xsrc/external/mit/xorg-server/dist/hw/sun: sunIo.c sunKbd.c

Log Message:
Handle restoring keyboard state via AbortDevices() rather than AbortDDX().

Tested on 3/60.  Note AbortDevices() and DEVICE_ABORT in deviceProc
functions were introduced after Xorg 1.14.0:
 
https://gitlab.freedesktop.org/xorg/xserver/-/commit/9f79e93b6b3416055d08a0e8f9f16d5fd0649e36


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/xorg-server/dist/hw/sun/sunIo.c
cvs rdiff -u -r1.10 -r1.11 xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xorg-server/dist/hw/sun/sunIo.c
diff -u xsrc/external/mit/xorg-server/dist/hw/sun/sunIo.c:1.6 xsrc/external/mit/xorg-server/dist/hw/sun/sunIo.c:1.7
--- xsrc/external/mit/xorg-server/dist/hw/sun/sunIo.c:1.6	Tue Dec  8 10:33:47 2020
+++ xsrc/external/mit/xorg-server/dist/hw/sun/sunIo.c	Fri Oct 15 17:42:04 2021
@@ -163,17 +163,12 @@ AbortDDX(enum ExitCode error)
 {
     int		i;
     ScreenPtr	pScreen;
-    DevicePtr	devPtr;
 
 #ifdef SVR4
     (void) OsSignal (SIGPOLL, SIG_IGN);
 #else
     (void) OsSignal (SIGIO, SIG_IGN);
 #endif
-    if (sunKeyboardDevice) {
-        devPtr = &sunKeyboardDevice->public;
-	(void) sunChangeKbdTranslation (((sunKbdPrivPtr)(devPtr->devicePrivate))->fd, FALSE);
-    }
 #if defined(SVR4) || defined(CSRG_BASED)
     sunNonBlockConsoleOff ();
 #else

Index: xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c
diff -u xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c:1.10 xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c:1.11
--- xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c:1.10	Wed Mar 17 15:02:27 2021
+++ xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c	Fri Oct 15 17:42:04 2021
@@ -669,7 +669,7 @@ sunKbdProc(DeviceIntPtr device, int what
 	 * Set the keyboard into "direct" mode and turn on
 	 * event translation.
 	 */
-	if (sunChangeKbdTranslation(pPriv->fd,TRUE) == -1)
+	if (sunChangeKbdTranslation(pPriv->fd, TRUE) == -1)
 	    FatalError("Can't set keyboard translation\n");
 	SetNotifyFd(pPriv->fd, sunKbdHandlerNotify, X_NOTIFY_READ, NULL);
 	pKeyboard->on = TRUE;
@@ -687,13 +687,18 @@ sunKbdProc(DeviceIntPtr device, int what
 	/*
 	 * Restore original keyboard directness and translation.
 	 */
-	if (sunChangeKbdTranslation(pPriv->fd,FALSE) == -1)
+	if (sunChangeKbdTranslation(pPriv->fd, FALSE) == -1)
 	    FatalError("Can't reset keyboard translation\n");
 	RemoveNotifyFd(pPriv->fd);
 	pKeyboard->on = FALSE;
 	break;
 
     case DEVICE_ABORT:
+	/*
+	 * Restore original keyboard directness and translation.
+	 */
+	pPriv = (sunKbdPrivPtr)pKeyboard->devicePrivate;
+	(void)sunChangeKbdTranslation(pPriv->fd, FALSE);
 	break;
     }
     return Success;

Reply via email to