Merge remote branch 'alanc/master'

This commit is contained in:
Keith Packard 2010-01-27 14:14:15 -08:00
commit 0b21a0416b
16 changed files with 147 additions and 57 deletions

View File

@ -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])

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -92,3 +92,12 @@ xf86VTSwitchTo()
#endif
return(TRUE);
}
Bool
xf86VTActivate(int vtno)
{
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) {
return(FALSE);
}
return(TRUE);
}

View File

@ -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);
}

View File

@ -52,3 +52,9 @@ xf86VTSwitchTo(void)
{
return(TRUE);
}
Bool
xf86VTActivate(int vtno)
{
return(TRUE);
}

View File

@ -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);
}

View File

@ -38,17 +38,27 @@
* Handle the VT-switching interface for Solaris/OpenSolaris
*/
void
xf86VTRequest(int sig)
{
if (xf86Info.vtPendingNum != -1)
{
ioctl(xf86Info.consoleFd, VT_RELDISP, 1);
xf86Info.vtPendingNum = -1;
static int xf86VTPruneDoor = 0;
void
xf86VTRelease(int sig)
{
if (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);
}

View File

@ -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 */

View File

@ -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);

View File

@ -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);