diff options
author | Keith Packard <keithp@keithp.com> | 2010-01-27 14:14:15 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-01-27 14:14:15 -0800 |
commit | 0b21a0416b4cb2c32da5e3fda05a0682eb97d56e (patch) | |
tree | b15cd3052535e959b907f2247cfa70812d701d85 | |
parent | 1e6fd65d0b95260253828678131885a4ec21c594 (diff) | |
parent | 837bd2bbc02b893f96861b48c1f02b7b8e7e3e48 (diff) |
Merge remote branch 'alanc/master'
-rw-r--r-- | configure.ac | 32 | ||||
-rw-r--r-- | glx/glapitemp.h | 2 | ||||
-rw-r--r-- | glx/indirect_dispatch.h | 2 | ||||
-rw-r--r-- | glx/indirect_reqsize.h | 4 | ||||
-rw-r--r-- | glx/indirect_size.h | 4 | ||||
-rw-r--r-- | glx/indirect_size_get.c | 4 | ||||
-rw-r--r-- | glx/indirect_size_get.h | 4 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Events.c | 49 | ||||
-rw-r--r-- | hw/xfree86/os-support/bsd/bsd_VTsw.c | 9 | ||||
-rw-r--r-- | hw/xfree86/os-support/sco/VTsw_sco.c | 10 | ||||
-rw-r--r-- | hw/xfree86/os-support/shared/VTsw_noop.c | 6 | ||||
-rw-r--r-- | hw/xfree86/os-support/shared/VTsw_usl.c | 11 | ||||
-rw-r--r-- | hw/xfree86/os-support/solaris/sun_VTsw.c | 43 | ||||
-rw-r--r-- | hw/xfree86/os-support/solaris/sun_init.c | 19 | ||||
-rw-r--r-- | hw/xfree86/os-support/xf86_OSproc.h | 1 | ||||
-rw-r--r-- | os/log.c | 2 |
16 files changed, 146 insertions, 56 deletions
diff --git a/configure.ac b/configure.ac index 1f5c343b9..d2623aff5 100644 --- a/configure.ac +++ b/configure.ac @@ -642,9 +642,9 @@ AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdriv AC_ARG_ENABLE(xfake, AS_HELP_STRING([--enable-xfake], [Build the kdrive 'fake' server (default: auto)]), [XFAKE=$enableval], [XFAKE=auto]) AC_ARG_ENABLE(xfbdev, AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto]) dnl kdrive options -AC_ARG_ENABLE(kdrive-kbd, AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: enabled)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=yes]) -AC_ARG_ENABLE(kdrive-mouse, AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: enabled)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=yes]) -AC_ARG_ENABLE(kdrive-evdev, AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: enabled)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=yes]) +AC_ARG_ENABLE(kdrive-kbd, AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto]) +AC_ARG_ENABLE(kdrive-mouse, AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto]) +AC_ARG_ENABLE(kdrive-evdev, AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto]) dnl chown/chmod to be setuid root as part of build @@ -1988,9 +1988,6 @@ XEPHYR_LIBS= XEPHYR_INCS= AM_CONDITIONAL(KDRIVE, [test x$KDRIVE = xyes]) -AM_CONDITIONAL(KDRIVE_KBD, test "x$KDRIVE_KBD" = xyes) -AM_CONDITIONAL(KDRIVE_EVDEV, test "x$KDRIVE_EVDEV" = xyes) -AM_CONDITIONAL(KDRIVE_MOUSE, test "x$KDRIVE_MOUSE" = xyes) if test "$KDRIVE" = yes; then AC_DEFINE(KDRIVESERVER,1,[Build Kdrive X server]) @@ -2065,6 +2062,26 @@ if test "$KDRIVE" = yes; then *linux*) KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.la' KDRIVELINUX=yes + if test "x$KDRIVE_EVDEV" = xauto; then + KDRIVE_EVDEV=yes + fi + if test "x$KDRIVE_KBD" = xauto; then + KDRIVE_KBD=yes + fi + if test "x$KDRIVE_MOUSE" = xauto; then + KDRIVE_MOUSE=yes + fi + ;; + *) + if test "x$KDRIVE_EVDEV" = xauto; then + KDRIVE_EVDEV=no + fi + if test "x$KDRIVE_KBD" = xauto; then + KDRIVE_KBD=no + fi + if test "x$KDRIVE_MOUSE" = xauto; then + KDRIVE_MOUSE=no + fi ;; esac KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.la' @@ -2083,6 +2100,9 @@ AC_SUBST([KDRIVE_PURE_LIBS]) AC_SUBST([KDRIVE_LOCAL_LIBS]) AC_SUBST([KDRIVE_LIBS]) AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes]) +AM_CONDITIONAL(KDRIVE_EVDEV, [test "x$KDRIVE_EVDEV" = xyes]) +AM_CONDITIONAL(KDRIVE_KBD, [test "x$KDRIVE_KBD" = xyes]) +AM_CONDITIONAL(KDRIVE_MOUSE, [test "x$KDRIVE_MOUSE" = xyes]) AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes]) AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes]) AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes]) diff --git a/glx/glapitemp.h b/glx/glapitemp.h index 09259f470..ddd67afec 100644 --- a/glx/glapitemp.h +++ b/glx/glapitemp.h @@ -27,7 +27,7 @@ */ -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) # define HIDDEN __attribute__((visibility("hidden"))) # else # define HIDDEN diff --git a/glx/indirect_dispatch.h b/glx/indirect_dispatch.h index 014e417c9..6cc322c24 100644 --- a/glx/indirect_dispatch.h +++ b/glx/indirect_dispatch.h @@ -28,7 +28,7 @@ #if !defined( _INDIRECT_DISPATCH_H_ ) # define _INDIRECT_DISPATCH_H_ -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) # define HIDDEN __attribute__((visibility("hidden"))) # else # define HIDDEN diff --git a/glx/indirect_reqsize.h b/glx/indirect_reqsize.h index 26211ee5c..05ad5913f 100644 --- a/glx/indirect_reqsize.h +++ b/glx/indirect_reqsize.h @@ -28,13 +28,13 @@ #if !defined( _INDIRECT_REQSIZE_H_ ) # define _INDIRECT_REQSIZE_H_ -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) # define HIDDEN __attribute__((visibility("hidden"))) # else # define HIDDEN # endif -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PURE __attribute__((pure)) # else # define PURE diff --git a/glx/indirect_size.h b/glx/indirect_size.h index 9ba0bd690..af0919f96 100644 --- a/glx/indirect_size.h +++ b/glx/indirect_size.h @@ -36,7 +36,7 @@ * \author Ian Romanick <idr@us.ibm.com> */ -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PURE __attribute__((pure)) # else # define PURE @@ -48,7 +48,7 @@ # define FASTCALL # endif -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) # define INTERNAL __attribute__((visibility("internal"))) # else # define INTERNAL diff --git a/glx/indirect_size_get.c b/glx/indirect_size_get.c index 80f81dec6..475aa58ee 100644 --- a/glx/indirect_size_get.c +++ b/glx/indirect_size_get.c @@ -32,7 +32,7 @@ #include "indirect_util.h" #include "indirect_size.h" -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PURE __attribute__((pure)) # else # define PURE @@ -44,7 +44,7 @@ # define FASTCALL # endif -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) # define INTERNAL __attribute__((visibility("internal"))) # else # define INTERNAL diff --git a/glx/indirect_size_get.h b/glx/indirect_size_get.h index 4fcb55b4e..378baa673 100644 --- a/glx/indirect_size_get.h +++ b/glx/indirect_size_get.h @@ -36,7 +36,7 @@ * \author Ian Romanick <idr@us.ibm.com> */ -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PURE __attribute__((pure)) # else # define PURE @@ -48,7 +48,7 @@ # define FASTCALL # endif -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) # define INTERNAL __attribute__((visibility("internal"))) # else # define INTERNAL diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 8cd765a1c..ebf03bfe7 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -194,47 +194,40 @@ xf86ProcessActionEvent(ActionEvent action, void *arg) if (!xf86Info.dontZoom) xf86ZoomViewport(xf86Info.currentScreen, -1); break; -#if defined(VT_ACTIVATE) case ACTION_SWITCHSCREEN: if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) { int vtno = *((int *) arg); -#if defined(__SCO__) || defined(__UNIXWARE__) - vtno--; -#endif -#if defined(sun) - if (vtno == xf86Info.vtno) - break; - - xf86Info.vtRequestsPending = TRUE; - xf86Info.vtPendingNum = vtno; -#else - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) - ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); -#endif + + if (vtno != xf86Info.vtno) { + if (!xf86VTActivate(vtno)) { + ErrorF("Failed to switch from vt%02d to vt%02d: %s\n", + xf86Info.vtno, vtno, strerror(errno)); + } + } } break; case ACTION_SWITCHSCREEN_NEXT: if (VTSwitchEnabled && !xf86Info.dontVTSwitch) { -#if defined(__SCO__) || defined(__UNIXWARE__) - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0) -#else - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1) < 0) -#endif -#if defined (__SCO__) || (defined(sun) && defined (__i386__) && defined (SVR4)) || defined(__UNIXWARE__) - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0) -#else - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) < 0) -#endif - ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); + if (!xf86VTActivate(xf86Info.vtno + 1)) { + /* If first try failed, assume this is the last VT and + * try wrapping around to the first vt. + */ + if (!xf86VTActivate(1)) { + ErrorF("Failed to switch from vt%02d to next vt: %s\n", + xf86Info.vtno, strerror(errno)); + } + } } break; case ACTION_SWITCHSCREEN_PREV: if (VTSwitchEnabled && !xf86Info.dontVTSwitch && xf86Info.vtno > 0) { - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno - 1) < 0) - ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); + if (!xf86VTActivate(xf86Info.vtno - 1)) { + /* Don't know what the maximum VT is, so can't wrap around */ + ErrorF("Failed to switch from vt%02d to previous vt: %s\n", + xf86Info.vtno, strerror(errno)); + } } break; -#endif default: break; } diff --git a/hw/xfree86/os-support/bsd/bsd_VTsw.c b/hw/xfree86/os-support/bsd/bsd_VTsw.c index 476a0e957..4842be5c9 100644 --- a/hw/xfree86/os-support/bsd/bsd_VTsw.c +++ b/hw/xfree86/os-support/bsd/bsd_VTsw.c @@ -92,3 +92,12 @@ xf86VTSwitchTo() #endif return(TRUE); } + +Bool +xf86VTActivate(int vtno) +{ + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) { + return(FALSE); + } + return(TRUE); +} diff --git a/hw/xfree86/os-support/sco/VTsw_sco.c b/hw/xfree86/os-support/sco/VTsw_sco.c index d126e7869..0a59fb965 100644 --- a/hw/xfree86/os-support/sco/VTsw_sco.c +++ b/hw/xfree86/os-support/sco/VTsw_sco.c @@ -115,3 +115,13 @@ xf86VTSwitchTo(void) return TRUE; } } + +Bool +xf86VTActivate(int vtno) +{ + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno - 1) < 0) { + return(FALSE); + } + + return(TRUE); +} diff --git a/hw/xfree86/os-support/shared/VTsw_noop.c b/hw/xfree86/os-support/shared/VTsw_noop.c index 78cbe0e34..3425840a2 100644 --- a/hw/xfree86/os-support/shared/VTsw_noop.c +++ b/hw/xfree86/os-support/shared/VTsw_noop.c @@ -52,3 +52,9 @@ xf86VTSwitchTo(void) { return(TRUE); } + +Bool +xf86VTActivate(int vtno) +{ + return(TRUE); +} diff --git a/hw/xfree86/os-support/shared/VTsw_usl.c b/hw/xfree86/os-support/shared/VTsw_usl.c index 9308640e2..393f1c0b9 100644 --- a/hw/xfree86/os-support/shared/VTsw_usl.c +++ b/hw/xfree86/os-support/shared/VTsw_usl.c @@ -88,3 +88,14 @@ xf86VTSwitchTo(void) return(TRUE); } } + +Bool +xf86VTActivate(int vtno) +{ +#ifdef VT_ACTIVATE + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) { + return(FALSE); + } +#endif + return(TRUE); +} diff --git a/hw/xfree86/os-support/solaris/sun_VTsw.c b/hw/xfree86/os-support/solaris/sun_VTsw.c index ded2f271e..1e2774b11 100644 --- a/hw/xfree86/os-support/solaris/sun_VTsw.c +++ b/hw/xfree86/os-support/solaris/sun_VTsw.c @@ -38,17 +38,27 @@ * Handle the VT-switching interface for Solaris/OpenSolaris */ +static int xf86VTPruneDoor = 0; + void -xf86VTRequest(int sig) +xf86VTRelease(int sig) { - if (xf86Info.vtPendingNum != -1) + if (xf86Info.vtPendingNum == -1) { - ioctl(xf86Info.consoleFd, VT_RELDISP, 1); - xf86Info.vtPendingNum = -1; - + xf86VTPruneDoor = 1; + xf86Info.vtRequestsPending = TRUE; return; } + ioctl(xf86Info.consoleFd, VT_RELDISP, 1); + xf86Info.vtPendingNum = -1; + + return; +} + +void +xf86VTAcquire(int sig) +{ xf86Info.vtRequestsPending = TRUE; return; } @@ -68,6 +78,12 @@ xf86VTSwitchAway(void) xf86Info.vtRequestsPending = FALSE; + if (xf86VTPruneDoor) { + xf86VTPruneDoor = 0; + ioctl(xf86Info.consoleFd, VT_RELDISP, 1); + return (TRUE); + } + vt_door_arg.vt_ev = VT_EV_HOTKEYS; vt_door_arg.vt_num = xf86Info.vtPendingNum; door_arg.data_ptr = (char *)&vt_door_arg; @@ -102,3 +118,20 @@ xf86VTSwitchTo(void) return(TRUE); } } + +Bool +xf86VTActivate(int vtno) +{ + struct vt_stat state; + + if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &state) < 0) + return(FALSE); + + if ((state.v_state & (1 << vtno)) == 0) + return(FALSE); + + xf86Info.vtRequestsPending = TRUE; + xf86Info.vtPendingNum = vtno; + + return(TRUE); +} diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c index 2c569f02c..5846866a2 100644 --- a/hw/xfree86/os-support/solaris/sun_init.c +++ b/hw/xfree86/os-support/solaris/sun_init.c @@ -39,6 +39,8 @@ static Bool Protect0 = FALSE; static int VTnum = -1; static int xf86StartVT = -1; static int vtEnabled = 0; +extern void xf86VTAcquire(int); +extern void xf86VTRelease(int); #endif /* Device to open as xf86Info.consoleFd */ @@ -137,7 +139,8 @@ xf86OpenConsole(void) else { if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || - (xf86Info.vtno == -1)) { + (xf86Info.vtno == -1)) + { FatalError("xf86OpenConsole: Cannot find a free VT\n"); } } @@ -146,7 +149,8 @@ xf86OpenConsole(void) snprintf(consoleDev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno); } - if (fd != -1) { + if (fd != -1) + { close(fd); } @@ -178,11 +182,12 @@ xf86OpenConsole(void) if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) FatalError("xf86OpenConsole: VT_GETMODE failed\n"); - OsSignal(SIGUSR1, xf86VTRequest); + OsSignal(SIGUSR1, xf86VTAcquire); + OsSignal(SIGUSR2, xf86VTRelease); VT.mode = VT_PROCESS; - VT.relsig = SIGUSR1; VT.acqsig = SIGUSR1; + VT.relsig = SIGUSR2; if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n"); @@ -204,7 +209,8 @@ xf86OpenConsole(void) else /* serverGeneration != 1 */ { #ifdef HAS_USL_VTS - if (vtEnabled) { + if (vtEnabled) + { /* * Now re-get the VT */ @@ -285,7 +291,8 @@ xf86CloseConsole(void) #endif #ifdef HAS_USL_VTS - if (vtEnabled == 1) { + if (vtEnabled) + { if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) { VT.mode = VT_AUTO; /* Set default vt handling */ diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h index c1a117334..f0cb768be 100644 --- a/hw/xfree86/os-support/xf86_OSproc.h +++ b/hw/xfree86/os-support/xf86_OSproc.h @@ -199,6 +199,7 @@ extern _X_EXPORT Bool xf86SIGIOSupported (void); typedef void (*PMClose)(void); extern _X_EXPORT void xf86OpenConsole(void); extern _X_EXPORT void xf86CloseConsole(void); +extern _X_HIDDEN Bool xf86VTActivate(int vtno); extern _X_EXPORT Bool xf86VTSwitchPending(void); extern _X_EXPORT Bool xf86VTSwitchAway(void); extern _X_EXPORT Bool xf86VTSwitchTo(void); @@ -187,7 +187,7 @@ LogInit(const char *fname, const char *backup) sprintf(oldLog, "%s%s", logFileName, suffix); free(suffix); if (rename(logFileName, oldLog) == -1) { - FatalError("Cannot move old log file (\"%s\" to \"%s\"\n", + FatalError("Cannot move old log file \"%s\" to \"%s\"\n", logFileName, oldLog); } free(oldLog); |