Merge branch 'master' into XACE-SELINUX
This commit is contained in:
commit
23fc429aad
|
@ -1,16 +1,16 @@
|
|||
SUBDIRS = glx mesa
|
||||
|
||||
# someone could get really crazy someday and add support for the SI...
|
||||
|
||||
# xwin/darwin/xfree86 have their accel support under the DDX
|
||||
|
||||
APPLE_EXTRAS = \
|
||||
apple/aglGlx.c \
|
||||
apple/indirect.c
|
||||
if BUILD_DARWIN
|
||||
DARWIN_SUBDIRS = apple
|
||||
endif
|
||||
SUBDIRS = glx mesa $(DARWIN_SUBDIRS)
|
||||
|
||||
WINDOWS_EXTRAS = \
|
||||
windows/ChangeLog \
|
||||
windows/glwindows.h \
|
||||
windows/glwrap.c \
|
||||
windows/indirect.c
|
||||
|
||||
EXTRA_DIST = symlink-mesa.sh $(APPLE_EXTRAS) $(WINDOWS_EXTRAS)
|
||||
EXTRA_DIST = symlink-mesa.sh $(WINDOWS_EXTRAS)
|
||||
|
|
15
GL/apple/Makefile.am
Normal file
15
GL/apple/Makefile.am
Normal file
|
@ -0,0 +1,15 @@
|
|||
AM_CFLAGS = -I$(top_srcdir) \
|
||||
-I$(top_srcdir)/hw/darwin/quartz \
|
||||
-I$(top_srcdir)/GL/glx \
|
||||
-I$(top_srcdir)/hw/darwin/quartz/cr \
|
||||
-I$(top_srcdir)/GL/include
|
||||
|
||||
if HAVE_AGL_FRAMEWORK
|
||||
noinst_LIBRARIES = libAGLcore.a
|
||||
libAGLcore_a_SOURCES = aglGlx.c \
|
||||
$(top_srcdir)/hw/darwin/quartz/xpr/x-list.c \
|
||||
$(top_srcdir)/hw/darwin/quartz/xpr/x-list.h \
|
||||
$(top_srcdir)/hw/darwin/quartz/xpr/x-hash.c \
|
||||
$(top_srcdir)/hw/darwin/quartz/xpr/x-hash.h \
|
||||
$(top_srcdir)/hw/dmx/glxProxy/compsize.c
|
||||
endif
|
2142
GL/apple/indirect.c
2142
GL/apple/indirect.c
File diff suppressed because it is too large
Load Diff
|
@ -39,6 +39,11 @@
|
|||
#include <byteswap.h>
|
||||
#elif defined(USE_SYS_ENDIAN_H)
|
||||
#include <sys/endian.h>
|
||||
#elif defined(__APPLE__)
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#define bswap_16 OSSwapInt16
|
||||
#define bswap_32 OSSwapInt32
|
||||
#define bswap_64 OSSwapInt64
|
||||
#else
|
||||
#define bswap_16(value) \
|
||||
((((value) & 0xff) << 8) | ((value) >> 8))
|
||||
|
|
|
@ -1187,6 +1187,7 @@ CALLBACK(SecurityCheckMapAccess)
|
|||
if (STATEPTR(rec->client) &&
|
||||
(TRUSTLEVEL(rec->client) != XSecurityClientTrusted) &&
|
||||
(pWin->drawable.class == InputOnly) &&
|
||||
pWin->parent && pWin->parent->parent &&
|
||||
(TRUSTLEVEL(wClient(pWin->parent)) == XSecurityClientTrusted))
|
||||
|
||||
rec->rval = FALSE;
|
||||
|
|
|
@ -441,6 +441,8 @@ ProcXTestFakeInput(client)
|
|||
(root->drawable.pScreen,
|
||||
ev->u.keyButtonPointer.rootX,
|
||||
ev->u.keyButtonPointer.rootY, FALSE);
|
||||
dev->valuator->lastx = ev->u.keyButtonPointer.rootX;
|
||||
dev->valuator->lasty = ev->u.keyButtonPointer.rootY;
|
||||
break;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
|
|
|
@ -303,15 +303,15 @@ configSetup(void)
|
|||
if (!configData)
|
||||
configData = (struct config_data *) xcalloc(sizeof(struct config_data), 1);
|
||||
if (!configData) {
|
||||
ErrorF("[dbus] failed to allocate data struct.\n");
|
||||
ErrorF("[dbus] failed to allocate data struct\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
dbus_error_init(&error);
|
||||
configData->connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
|
||||
if (!configData->connection || dbus_error_is_set(&error)) {
|
||||
ErrorF("[dbus] some kind of error occurred: %s (%s)\n", error.name,
|
||||
error.message);
|
||||
DebugF("[dbus] some kind of error occurred while connecting: %s (%s)\n",
|
||||
error.name, error.message);
|
||||
dbus_error_free(&error);
|
||||
xfree(configData);
|
||||
configData = NULL;
|
||||
|
|
217
configure.ac
217
configure.ac
|
@ -280,6 +280,7 @@ case $host_cpu in
|
|||
use_x86_asm="yes"
|
||||
I386_VIDEO=yes
|
||||
case $host_os in
|
||||
darwin*) use_x86_asm="no" ;;
|
||||
*linux*) DEFAULT_INT10=vm86 ;;
|
||||
*freebsd*) AC_DEFINE(USE_DEV_IO) ;;
|
||||
*netbsd*) AC_DEFINE(USE_I386_IOPL)
|
||||
|
@ -305,6 +306,7 @@ case $host_cpu in
|
|||
use_x86_asm="yes"
|
||||
I386_VIDEO=yes
|
||||
case $host_os in
|
||||
darwin*) use_x86_asm="no" ;;
|
||||
*freebsd*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
|
||||
*netbsd*) AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
|
||||
SYS_LIBS=-lx86_64
|
||||
|
@ -473,6 +475,10 @@ AC_ARG_WITH(rgb-path, AS_HELP_STRING([--with-rgb-path=PATH], [Path to RG
|
|||
AC_ARG_WITH(dri-driver-path, AS_HELP_STRING([--with-dri-driver-path=PATH], [Path to DRI drivers (default: ${libdir}/dri)]),
|
||||
[ DRI_DRIVER_PATH="$withval" ],
|
||||
[ DRI_DRIVER_PATH="${libdir}/dri" ])
|
||||
APPLE_APPLICATIONS_DIR="${bindir}/Applications"
|
||||
AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: ${bindir}/Applications)]),
|
||||
[ APPLE_APPLICATIONS_DIR="${withval}" ].
|
||||
[ APPLE_APPLICATIONS_DIR="${bindir}/Applications" ])
|
||||
AC_ARG_ENABLE(builddocs, AS_HELP_STRING([--enable-builddocs], [Build docs (default: disabled)]),
|
||||
[BUILDDOCS=$enableval],
|
||||
[BUILDDOCS=no])
|
||||
|
@ -495,6 +501,7 @@ AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes exten
|
|||
AC_ARG_ENABLE(xtrap, AS_HELP_STRING([--disable-xtrap], [Build XTrap extension (default: enabled)]), [XTRAP=$enableval], [XTRAP=yes])
|
||||
AC_ARG_ENABLE(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
|
||||
AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
|
||||
AC_ARG_ENABLE(quartz, AS_HELP_STRING([--enable-quartz], [Build with darwin quartz support (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
|
||||
AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
|
||||
AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
|
||||
AC_ARG_ENABLE(screensaver, AS_HELP_STRING([--disable-screensaver], [Build ScreenSaver extension (default: enabled)]), [SCREENSAVER=$enableval], [SCREENSAVER=yes])
|
||||
|
@ -526,7 +533,7 @@ AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build
|
|||
|
||||
dnl DDXes.
|
||||
AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
|
||||
AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto])
|
||||
AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=no])
|
||||
AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
|
||||
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
|
||||
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
|
||||
|
@ -534,6 +541,10 @@ AC_ARG_ENABLE(xprint, AS_HELP_STRING([--enable-xprint], [Build Xprint ex
|
|||
AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no])
|
||||
AC_ARG_ENABLE(xglx, AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no])
|
||||
AC_ARG_ENABLE(xegl, AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no])
|
||||
dnl legacy fb support
|
||||
AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: enabled)]), [MFB=$enableval], [MFB=$XORG])
|
||||
AC_ARG_ENABLE(cfb, AS_HELP_STRING([--enable-cfb], [Build legacy color framebuffer support (default: enabled)]), [CFB=$enableval], [CFB=$XORG])
|
||||
AC_ARG_ENABLE(afb, AS_HELP_STRING([--enable-afb], [Build legacy advanced framebuffer support (default: enabled)]), [AFB=$enableval], [AFB=$XORG])
|
||||
dnl kdrive and its subsystems
|
||||
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
|
||||
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
|
||||
|
@ -1021,6 +1032,9 @@ if test "x$GCC" = "xyes"; then
|
|||
LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
|
||||
fi
|
||||
case $host_os in
|
||||
darwin*)
|
||||
LD_EXPORT_SYMBOLS_FLAG=""
|
||||
;;
|
||||
openbsd*)
|
||||
LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
|
||||
;;
|
||||
|
@ -1078,7 +1092,19 @@ AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
|
|||
AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
|
||||
|
||||
XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
|
||||
AC_DEFINE_UNQUOTED(X_BYTE_ORDER,[$ENDIAN],[Endian order])
|
||||
AC_DEFINE_UNQUOTED(_X_BYTE_ORDER,[$ENDIAN],[Endian order])
|
||||
AH_VERBATIM([X_BYTE_ORDER],[
|
||||
/* Deal with multiple architecture compiles on Mac OS X */
|
||||
#ifndef __APPLE_CC__
|
||||
#define X_BYTE_ORDER _X_BYTE_ORDER
|
||||
#else
|
||||
#ifdef __BIG_ENDIAN__
|
||||
#define X_BYTE_ORDER X_BIG_ENDIAN
|
||||
#else
|
||||
#define X_BYTE_ORDER X_LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
])
|
||||
|
||||
AC_SUBST([XSERVER_LIBS])
|
||||
|
||||
|
@ -1169,7 +1195,6 @@ if test "x$XORG" = xauto; then
|
|||
XORG="yes"
|
||||
case $host_os in
|
||||
cygwin*) XORG="no" ;;
|
||||
darwin*) XORG="no" ;;
|
||||
esac
|
||||
fi
|
||||
AC_MSG_RESULT([$XORG])
|
||||
|
@ -1246,43 +1271,70 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
|
|||
XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
|
||||
XORG_LIBS="$COMPOSITE_LIB $MI_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB $SELINUX_LIB $OS_LIB"
|
||||
|
||||
if test "x$DGA" = xauto; then
|
||||
PKG_CHECK_MODULES(DGA, xf86dgaproto, [DGA=yes], [DGA=no])
|
||||
fi
|
||||
if test "x$DGA" = xyes; then
|
||||
XORG_MODULES="$XORG_MODULES xf86dgaproto"
|
||||
AC_DEFINE(DGA, 1, [Support DGA extension])
|
||||
AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
|
||||
fi
|
||||
|
||||
if test "x$XF86MISC" = xauto; then
|
||||
PKG_CHECK_MODULES(XF86MISC, xf86miscproto, [XF86MISC=yes], [XF86MISC=no])
|
||||
fi
|
||||
if test "x$XF86MISC" = xyes; then
|
||||
XORG_MODULES="$XORG_MODULES xf86miscproto"
|
||||
AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
|
||||
fi
|
||||
|
||||
if test "x$XF86VIDMODE" = xauto; then
|
||||
PKG_CHECK_MODULES(XF86VIDMODE, xf86vidmodeproto, [XF86VIDMODE=yes], [XF86VIDMODE=no])
|
||||
fi
|
||||
if test "x$XF86VIDMODE" = xyes; then
|
||||
XORG_MODULES="$XORG_MODULES xf86vidmodeproto"
|
||||
AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
|
||||
fi
|
||||
|
||||
if test -n "$XORG_MODULES"; then
|
||||
PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
|
||||
XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
|
||||
XORG_LIBS="$XORG_LIBS $XORG_MODULES_LIBS"
|
||||
fi
|
||||
|
||||
dnl Check to see if dlopen is in default libraries (like Solaris, which
|
||||
dnl has it in libc), or if libdl is needed to get it.
|
||||
AC_CHECK_FUNC([dlopen], [],
|
||||
AC_CHECK_LIB([dl], [dlopen], XORG_LIBS="$XORG_LIBS -ldl"))
|
||||
|
||||
case $host_os in
|
||||
darwin*)
|
||||
XORG_OS="Darwin"
|
||||
build_darwin=yes
|
||||
if test "X$XQUARTZ" = Xauto; then
|
||||
AC_CACHE_CHECK([for Carbon framework],xorg_cv_Carbon_framework,[
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS -framework Carbon"
|
||||
AC_LINK_IFELSE([char FSFindFolder();
|
||||
int main() {
|
||||
FSFindFolder();
|
||||
return 0;}
|
||||
],[xorg_cv_Carbon_framework=yes],
|
||||
[xorg_cv_Carbon_framework=no])
|
||||
LDFLAGS=$save_LDFLAGS])
|
||||
if test "X$xorg_cv_Carbon_framework" = Xyes; then
|
||||
AC_DEFINE([DARWIN_WITH_QUARTZ],[1],
|
||||
[Have Quartz])
|
||||
XQUARTZ=yes
|
||||
else
|
||||
XQUARTZ=no
|
||||
fi
|
||||
fi
|
||||
# glxAGL / glxCGL don't work yet
|
||||
# AC_CACHE_CHECK([for AGL framework],xorg_cv_AGL_framework,[
|
||||
# save_LDFLAGS=$LDFLAGS
|
||||
# LDFLAGS="$LDFLAGS -framework AGL"
|
||||
# AC_LINK_IFELSE([char aglEnable();
|
||||
#int main() {
|
||||
#aglEnable();
|
||||
#return 0;}
|
||||
# ],[xorg_cv_AGL_framework=yes],
|
||||
# [xorg_cv_AGL_framework=no])
|
||||
# LDFLAGS=$save_LDFLAGS
|
||||
# ])
|
||||
xorg_cv_AGL_framework=no
|
||||
DARWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
|
||||
AC_SUBST([DARWIN_LIBS])
|
||||
AC_CHECK_LIB([Xplugin],[xp_init],[:])
|
||||
AC_SUBST([APPLE_APPLICATIONS_DIR])
|
||||
CFLAGS="${CFLAGS} -D__DARWIN__"
|
||||
PLIST_VERSION_STRING=$VENDOR_VERSION_STRING
|
||||
AC_SUBST([PLIST_VERSION_STRING])
|
||||
PLIST_VENDOR_WEB=$VENDOR_WEB
|
||||
AC_SUBST([PLIST_VENDOR_WEB])
|
||||
# Not sure that we should be disabling all these...
|
||||
if test "x$XF86MISC" = xyes || test "x$XF86MISC" = xauto; then
|
||||
AC_MSG_NOTICE([Disabling XF86Misc extension])
|
||||
XF86MISC=no
|
||||
fi
|
||||
if test "x$XF86VIDMODE" = xyes || test "x$XF86VIDMODE" = xauto; then
|
||||
AC_MSG_NOTICE([Disabling XF86VidMode extension])
|
||||
XF86VIDMODE=no
|
||||
fi
|
||||
if test "x$DGA" = xyes || test "x$DGA" = xauto; then
|
||||
AC_MSG_NOTICE([Disabling DGA extension])
|
||||
DGA=no
|
||||
fi
|
||||
;;
|
||||
linux*)
|
||||
if test "x$LNXAPM" = xyes; then
|
||||
XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
|
||||
|
@ -1405,11 +1457,14 @@ dnl has it in libc), or if libdl is needed to get it.
|
|||
|
||||
case $host_cpu in
|
||||
i*86)
|
||||
xorg_bus_ix86pci=yes
|
||||
case $host_os in
|
||||
darwin*) ;;
|
||||
*) xorg_bus_ix86pci=yes ;;
|
||||
esac
|
||||
;;
|
||||
powerpc*)
|
||||
case $host_os in
|
||||
linux*|freebsd*|netbsd*|openbsd*|kfreebsd*-gnu)
|
||||
darwin*|linux*|freebsd*|netbsd*|openbsd*|kfreebsd*-gnu)
|
||||
;;
|
||||
*)
|
||||
xorg_bus_ppcpci="yes"
|
||||
|
@ -1422,7 +1477,7 @@ dnl has it in libc), or if libdl is needed to get it.
|
|||
;;
|
||||
x86_64*|amd64*)
|
||||
case $host_os in
|
||||
freebsd*|kfreebsd*-gnu)
|
||||
darwin*|freebsd*|kfreebsd*-gnu)
|
||||
# FreeBSD uses the system pci interface
|
||||
;;
|
||||
*)
|
||||
|
@ -1435,6 +1490,37 @@ dnl has it in libc), or if libdl is needed to get it.
|
|||
if test "x$XORG_OS_PCI" = x ; then
|
||||
XORG_OS_PCI=$XORG_OS
|
||||
fi
|
||||
if test "x$DGA" = xauto; then
|
||||
PKG_CHECK_MODULES(DGA, xf86dgaproto, [DGA=yes], [DGA=no])
|
||||
fi
|
||||
if test "x$DGA" = xyes; then
|
||||
XORG_MODULES="$XORG_MODULES xf86dgaproto"
|
||||
AC_DEFINE(DGA, 1, [Support DGA extension])
|
||||
AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
|
||||
fi
|
||||
|
||||
if test "x$XF86MISC" = xauto; then
|
||||
PKG_CHECK_MODULES(XF86MISC, xf86miscproto, [XF86MISC=yes], [XF86MISC=no])
|
||||
fi
|
||||
if test "x$XF86MISC" = xyes; then
|
||||
XORG_MODULES="$XORG_MODULES xf86miscproto"
|
||||
AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
|
||||
fi
|
||||
|
||||
if test "x$XF86VIDMODE" = xauto; then
|
||||
PKG_CHECK_MODULES(XF86VIDMODE, xf86vidmodeproto, [XF86VIDMODE=yes], [XF86VIDMODE=no])
|
||||
fi
|
||||
if test "x$XF86VIDMODE" = xyes; then
|
||||
XORG_MODULES="$XORG_MODULES xf86vidmodeproto"
|
||||
AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
|
||||
fi
|
||||
|
||||
if test -n "$XORG_MODULES"; then
|
||||
PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
|
||||
XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
|
||||
XORG_LIBS="$XORG_LIBS $XORG_MODULES_LIBS"
|
||||
fi
|
||||
|
||||
AC_SUBST([XORG_LIBS])
|
||||
AC_SUBST([XORG_INCS])
|
||||
AC_SUBST([XORG_OS])
|
||||
|
@ -1495,11 +1581,23 @@ AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
|
|||
AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
|
||||
AM_CONDITIONAL([SOLARIS_USL_CONSOLE], [test "x$solaris_usl_console" = xyes])
|
||||
AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
|
||||
AM_CONDITIONAL(MFB, [test "x$XORG" = xyes])
|
||||
AM_CONDITIONAL(CFB, [test "x$XORG" = xyes])
|
||||
AM_CONDITIONAL(AFB, [test "x$XORG" = xyes])
|
||||
AM_CONDITIONAL([BUILD_DARWIN],[test "X$build_darwin" = Xyes])
|
||||
AM_CONDITIONAL([XQUARTZ],[test "X$XQUARTZ" = Xyes])
|
||||
AM_CONDITIONAL(DGA, [test "x$DGA" = xyes])
|
||||
|
||||
dnl legacy fb support
|
||||
test "x$MFB" = xauto && MFB="$XORG"
|
||||
test "x$CFB" = xauto && CFB="$XORG"
|
||||
test "x$AFB" = xauto && AFB="$XORG"
|
||||
AM_CONDITIONAL(MFB, [test "x$MFB" = xyes])
|
||||
AM_CONDITIONAL(CFB, [test "x$CFB" = xyes])
|
||||
AM_CONDITIONAL(AFB, [test "x$AFB" = xyes])
|
||||
if test "x$MFB" = xyes -o "x$CFB" = xyes -o "x$AFB" = xyes; then
|
||||
if test "x$XORG" != xyes; then
|
||||
AC_MSG_ERROR([legacy fb support requires the Xorg server])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Xprint DDX
|
||||
|
||||
AC_MSG_CHECKING([whether to build Xprint DDX])
|
||||
|
@ -1508,7 +1606,7 @@ AC_MSG_RESULT([$XPRINT])
|
|||
if test "x$XPRINT" = xyes; then
|
||||
PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau])
|
||||
XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
|
||||
XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS"
|
||||
XPRINT_LIBS="$DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS $XPRINT_LIBS"
|
||||
AC_SUBST([XPRINT_CFLAGS])
|
||||
AC_SUBST([XPRINT_LIBS])
|
||||
|
||||
|
@ -1622,6 +1720,21 @@ AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes && false])
|
|||
AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
|
||||
AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])
|
||||
|
||||
dnl Darwin / OS X DDX
|
||||
AM_CONDITIONAL(HAVE_X_PLUGIN, [test "x$ac_cv_lib_Xplugin_xp_init" = xyes])
|
||||
AM_CONDITIONAL(HAVE_AGL_FRAMEWORK, [test "x$xorg_cv_AGL_framework" = xyes])
|
||||
# Support for objc in autotools is minimal and not
|
||||
# documented.
|
||||
OBJC='$(CC)'
|
||||
OBJCLD='$(CCLD)'
|
||||
OBJCLINK='$(LINK)'
|
||||
OBJCFLAGS='$(CFLAGS)'
|
||||
AC_SUBST([OBJC])
|
||||
AC_SUBST([OBJCCLD])
|
||||
AC_SUBST([OBJCLINK])
|
||||
AC_SUBST([OBJCFLAGS])
|
||||
# internal, undocumented automake func follows :(
|
||||
_AM_DEPENDENCIES([OBJC])
|
||||
|
||||
dnl kdrive DDX
|
||||
|
||||
|
@ -1751,11 +1864,6 @@ AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
|
|||
AM_CONDITIONAL(KDRIVEVESA, [test x"$ac_cv_header_sys_vm86_h" = xyes])
|
||||
AM_CONDITIONAL(KDRIVEFBDEV, [test x"$ac_cv_header_linux_fb_h" = xyes])
|
||||
|
||||
dnl XDarwin DDX (FIXME)
|
||||
AM_CONDITIONAL(XQUARTZ, false)
|
||||
AM_CONDITIONAL(HAVE_X_PLUGIN, false)
|
||||
AM_CONDITIONAL(HAVE_AGL_FRAMEWORK, false)
|
||||
|
||||
dnl these only go in xkb-config.h (which is shared by the Xorg and Xnest servers)
|
||||
AC_DEFINE(__XKBDEFRULES__, "xorg", [Default XKB rules])
|
||||
AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
|
||||
|
@ -1860,6 +1968,7 @@ XORG_RELEASE_VERSION
|
|||
AC_OUTPUT([
|
||||
Makefile
|
||||
GL/Makefile
|
||||
GL/apple/Makefile
|
||||
GL/glx/Makefile
|
||||
GL/mesa/Makefile
|
||||
GL/mesa/glapi/Makefile
|
||||
|
@ -1893,6 +2002,8 @@ miext/damage/Makefile
|
|||
miext/shadow/Makefile
|
||||
miext/cw/Makefile
|
||||
miext/rootless/Makefile
|
||||
miext/rootless/safeAlpha/Makefile
|
||||
miext/rootless/accel/Makefile
|
||||
os/Makefile
|
||||
randr/Makefile
|
||||
render/Makefile
|
||||
|
@ -1919,6 +2030,7 @@ hw/xfree86/fbdevhw/Makefile
|
|||
hw/xfree86/i2c/Makefile
|
||||
hw/xfree86/int10/Makefile
|
||||
hw/xfree86/loader/Makefile
|
||||
hw/xfree86/modes/Makefile
|
||||
hw/xfree86/os-support/Makefile
|
||||
hw/xfree86/os-support/bsd/Makefile
|
||||
hw/xfree86/os-support/bus/Makefile
|
||||
|
@ -1969,6 +2081,19 @@ hw/xgl/glxext/module/Makefile
|
|||
hw/xnest/Makefile
|
||||
hw/xwin/Makefile
|
||||
hw/darwin/Makefile
|
||||
hw/darwin/bundle/Makefile
|
||||
hw/darwin/bundle/Dutch.lproj/Makefile
|
||||
hw/darwin/bundle/English.lproj/Makefile
|
||||
hw/darwin/bundle/French.lproj/Makefile
|
||||
hw/darwin/bundle/German.lproj/Makefile
|
||||
hw/darwin/bundle/Japanese.lproj/Makefile
|
||||
hw/darwin/bundle/Portuguese.lproj/Makefile
|
||||
hw/darwin/bundle/Spanish.lproj/Makefile
|
||||
hw/darwin/bundle/Swedish.lproj/Makefile
|
||||
hw/darwin/bundle/ko.lproj/Makefile
|
||||
hw/darwin/iokit/Makefile
|
||||
hw/darwin/quartz/Makefile
|
||||
hw/darwin/utils/Makefile
|
||||
hw/kdrive/Makefile
|
||||
hw/kdrive/ati/Makefile
|
||||
hw/kdrive/chips/Makefile
|
||||
|
|
|
@ -64,6 +64,7 @@ Equipment Corporation.
|
|||
#include "opaque.h"
|
||||
#include "dixfontstr.h"
|
||||
#include "closestr.h"
|
||||
#include "dixfont.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,25 +1,35 @@
|
|||
appmandir = $(APP_MAN_DIR)
|
||||
filemandir = $(FILE_MAN_DIR)
|
||||
|
||||
# Xserver.man covers options generic to all X servers built in this tree
|
||||
# (i.e. those handled in the os/utils.c options processing instead of in
|
||||
# the DDX-level options processing)
|
||||
appman_PRE = Xserver.man.pre
|
||||
fileman_PRE = SecurityPolicy.man.pre
|
||||
|
||||
appman_PROCESSED = $(appman_PRE:man.pre=man)
|
||||
fileman_PROCESSED = $(fileman_PRE:man.pre=man)
|
||||
|
||||
appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@)
|
||||
fileman_DATA = $(fileman_PRE:man.pre=@FILE_MAN_SUFFIX@)
|
||||
|
||||
BUILT_SOURCES = $(appman_PROCESSED)
|
||||
BUILT_SOURCES = $(appman_PROCESSED) $(fileman_PROCESSED)
|
||||
|
||||
CLEANFILES = $(appman_PROCESSED) $(appman_DATA)
|
||||
CLEANFILES = $(appman_PROCESSED) $(appman_DATA) \
|
||||
$(fileman_PROCESSED) $(fileman_DATA)
|
||||
|
||||
include $(top_srcdir)/cpprules.in
|
||||
|
||||
.man.$(APP_MAN_SUFFIX):
|
||||
cp $< $@
|
||||
|
||||
.man.$(FILE_MAN_SUFFIX):
|
||||
cp $< $@
|
||||
|
||||
EXTRAMANDEFS = -D__default_font_path__="`echo $(COMPILEDDEFAULTFONTPATH) | sed -e 's/,/, /g'`"
|
||||
|
||||
# Docs about X server internals that we ship with source but don't install
|
||||
DEVEL_DOCS = smartsched
|
||||
|
||||
|
||||
EXTRA_DIST = $(DEVEL_DOCS) $(appman_PRE)
|
||||
EXTRA_DIST = $(DEVEL_DOCS) $(appman_PRE) $(fileman_PRE)
|
||||
|
|
258
doc/SecurityPolicy.man.pre
Normal file
258
doc/SecurityPolicy.man.pre
Normal file
|
@ -0,0 +1,258 @@
|
|||
.\" Split out of Xserver.man, which was covered by this notice:
|
||||
.\" Copyright 1984 - 1991, 1993, 1994, 1998 The Open Group
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, distribute, and sell this software and its
|
||||
.\" documentation for any purpose is hereby granted without fee, provided that
|
||||
.\" the above copyright notice appear in all copies and that both that
|
||||
.\" copyright notice and this permission notice appear in supporting
|
||||
.\" documentation.
|
||||
.\"
|
||||
.\" The above copyright notice and this permission notice shall be included
|
||||
.\" in all copies or substantial portions of the Software.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
.\" OTHER DEALINGS IN THE SOFTWARE.
|
||||
.\"
|
||||
.\" Except as contained in this notice, the name of The Open Group shall
|
||||
.\" not be used in advertising or otherwise to promote the sale, use or
|
||||
.\" other dealings in this Software without prior written authorization
|
||||
.\" from The Open Group.
|
||||
.\" $XFree86: xc/programs/Xserver/Xserver.man,v 3.31 2004/01/10 22:27:46 dawes Exp $
|
||||
.\" shorthand for double quote that works everywhere.
|
||||
.ds q \N'34'
|
||||
.TH SecurityPolicy __filemansuffix__ __xorgversion__
|
||||
.SH NAME
|
||||
SecurityPolicy \- X Window System SECURITY Extension Policy file format
|
||||
.SH DESCRIPTION
|
||||
The SECURITY extension to the X Window System uses a policy file to determine
|
||||
which operations should be allowed or denied. The default location for this
|
||||
file is
|
||||
.IR __projectroot__/lib/xserver/SecurityPolicy .
|
||||
.PP
|
||||
The syntax of the security policy file is as follows.
|
||||
Notation: "*" means zero or more occurrences of the preceding element,
|
||||
and "+" means one or more occurrences. To interpret <foo/bar>, ignore
|
||||
the text after the /; it is used to distinguish between instances of
|
||||
<foo> in the next section.
|
||||
.PP
|
||||
.nf
|
||||
<policy file> ::= <version line> <other line>*
|
||||
|
||||
<version line> ::= <string/v> '\en'
|
||||
|
||||
<other line > ::= <comment> | <access rule> | <site policy> | <blank line>
|
||||
|
||||
<comment> ::= # <not newline>* '\en'
|
||||
|
||||
<blank line> ::= <space> '\en'
|
||||
|
||||
<site policy> ::= sitepolicy <string/sp> '\en'
|
||||
|
||||
<access rule> ::= property <property/ar> <window> <perms> '\en'
|
||||
|
||||
<property> ::= <string>
|
||||
|
||||
<window> ::= any | root | <required property>
|
||||
|
||||
<required property> ::= <property/rp> | <property with value>
|
||||
|
||||
<property with value> ::= <property/rpv> = <string/rv>
|
||||
|
||||
<perms> ::= [ <operation> | <action> | <space> ]*
|
||||
|
||||
<operation> ::= r | w | d
|
||||
|
||||
<action> ::= a | i | e
|
||||
|
||||
<string> ::= <dbl quoted string> | <single quoted string> | <unquoted string>
|
||||
|
||||
<dbl quoted string> ::= <space> " <not dquote>* " <space>
|
||||
|
||||
<single quoted string> ::= <space> ' <not squote>* ' <space>
|
||||
|
||||
<unquoted string> ::= <space> <not space>+ <space>
|
||||
|
||||
<space> ::= [ ' ' | '\et' ]*
|
||||
|
||||
Character sets:
|
||||
|
||||
<not newline> ::= any character except '\en'
|
||||
<not dquote> ::= any character except "
|
||||
<not squote> ::= any character except '
|
||||
<not space> ::= any character except those in <space>
|
||||
.fi
|
||||
.PP
|
||||
The semantics associated with the above syntax are as follows.
|
||||
.PP
|
||||
<version line>, the first line in the file, specifies the file format
|
||||
version. If the server does not recognize the version <string/v>, it
|
||||
ignores the rest of the file. The version string for the file format
|
||||
described here is "version-1" .
|
||||
.PP
|
||||
Once past the <version line>, lines that do not match the above syntax
|
||||
are ignored.
|
||||
.PP
|
||||
<comment> lines are ignored.
|
||||
.PP
|
||||
<sitepolicy> lines are currently ignored. They are intended to
|
||||
specify the site policies used by the XC-QUERY-SECURITY-1
|
||||
authorization method.
|
||||
.PP
|
||||
<access rule> lines specify how the server should react to untrusted
|
||||
client requests that affect the X Window property named <property/ar>.
|
||||
The rest of this section describes the interpretation of an
|
||||
<access rule>.
|
||||
.PP
|
||||
For an <access rule> to apply to a given instance of <property/ar>,
|
||||
<property/ar> must be on a window that is in the set of windows
|
||||
specified by <window>. If <window> is any, the rule applies to
|
||||
<property/ar> on any window. If <window> is root, the rule applies to
|
||||
<property/ar> only on root windows.
|
||||
.PP
|
||||
If <window> is <required property>, the following apply. If <required
|
||||
property> is a <property/rp>, the rule applies when the window also
|
||||
has that <property/rp>, regardless of its value. If <required
|
||||
property> is a <property with value>, <property/rpv> must also have
|
||||
the value specified by <string/rv>. In this case, the property must
|
||||
have type STRING and format 8, and should contain one or more
|
||||
null-terminated strings. If any of the strings match <string/rv>, the
|
||||
rule applies.
|
||||
.PP
|
||||
The definition of string matching is simple case-sensitive string
|
||||
comparison with one elaboration: the occurrence of the character '*' in
|
||||
<string/rv> is a wildcard meaning "any string." A <string/rv> can
|
||||
contain multiple wildcards anywhere in the string. For example, "x*"
|
||||
matches strings that begin with x, "*x" matches strings that end with
|
||||
x, "*x*" matches strings containing x, and "x*y*" matches strings that
|
||||
start with x and subsequently contain y.
|
||||
.PP
|
||||
There may be multiple <access rule> lines for a given <property/ar>.
|
||||
The rules are tested in the order that they appear in the file. The
|
||||
first rule that applies is used.
|
||||
.PP
|
||||
<perms> specify operations that untrusted clients may attempt, and
|
||||
the actions that the server should take in response to those operations.
|
||||
.PP
|
||||
<operation> can be r (read), w (write), or d (delete). The following
|
||||
table shows how X Protocol property requests map to these operations
|
||||
in the X.Org server implementation.
|
||||
.PP
|
||||
.nf
|
||||
GetProperty r, or r and d if delete = True
|
||||
ChangeProperty w
|
||||
RotateProperties r and w
|
||||
DeleteProperty d
|
||||
ListProperties none, untrusted clients can always list all properties
|
||||
.fi
|
||||
.PP
|
||||
<action> can be a (allow), i (ignore), or e (error). Allow means
|
||||
execute the request as if it had been issued by a trusted client.
|
||||
Ignore means treat the request as a no-op. In the case of
|
||||
GetProperty, ignore means return an empty property value if the
|
||||
property exists, regardless of its actual value. Error means do not
|
||||
execute the request and return a BadAtom error with the atom set to
|
||||
the property name. Error is the default action for all properties,
|
||||
including those not listed in the security policy file.
|
||||
.PP
|
||||
An <action> applies to all <operation>s that follow it, until the next
|
||||
<action> is encountered. Thus, irwad means ignore read and write,
|
||||
allow delete.
|
||||
.PP
|
||||
GetProperty and RotateProperties may do multiple operations (r and d,
|
||||
or r and w). If different actions apply to the operations, the most
|
||||
severe action is applied to the whole request; there is no partial
|
||||
request execution. The severity ordering is: allow < ignore < error.
|
||||
Thus, if the <perms> for a property are ired (ignore read, error
|
||||
delete), and an untrusted client attempts GetProperty on that property
|
||||
with delete = True, an error is returned, but the property value is
|
||||
not. Similarly, if any of the properties in a RotateProperties do not
|
||||
allow both read and write, an error is returned without changing any
|
||||
property values.
|
||||
.PP
|
||||
Here is an example security policy file.
|
||||
.PP
|
||||
.ta 3i 4i
|
||||
.nf
|
||||
version-1
|
||||
|
||||
XCOMM Allow reading of application resources, but not writing.
|
||||
property RESOURCE_MANAGER root ar iw
|
||||
property SCREEN_RESOURCES root ar iw
|
||||
|
||||
XCOMM Ignore attempts to use cut buffers. Giving errors causes apps to crash,
|
||||
XCOMM and allowing access may give away too much information.
|
||||
property CUT_BUFFER0 root irw
|
||||
property CUT_BUFFER1 root irw
|
||||
property CUT_BUFFER2 root irw
|
||||
property CUT_BUFFER3 root irw
|
||||
property CUT_BUFFER4 root irw
|
||||
property CUT_BUFFER5 root irw
|
||||
property CUT_BUFFER6 root irw
|
||||
property CUT_BUFFER7 root irw
|
||||
|
||||
XCOMM If you are using Motif, you probably want these.
|
||||
property _MOTIF_DEFAULT_BINDINGS root ar iw
|
||||
property _MOTIF_DRAG_WINDOW root ar iw
|
||||
property _MOTIF_DRAG_TARGETS any ar iw
|
||||
property _MOTIF_DRAG_ATOMS any ar iw
|
||||
property _MOTIF_DRAG_ATOM_PAIRS any ar iw
|
||||
|
||||
XCOMM The next two rules let xwininfo -tree work when untrusted.
|
||||
property WM_NAME any ar
|
||||
|
||||
XCOMM Allow read of WM_CLASS, but only for windows with WM_NAME.
|
||||
XCOMM This might be more restrictive than necessary, but demonstrates
|
||||
XCOMM the <required property> facility, and is also an attempt to
|
||||
XCOMM say "top level windows only."
|
||||
property WM_CLASS WM_NAME ar
|
||||
|
||||
XCOMM These next three let xlsclients work untrusted. Think carefully
|
||||
XCOMM before including these; giving away the client machine name and command
|
||||
XCOMM may be exposing too much.
|
||||
property WM_STATE WM_NAME ar
|
||||
property WM_CLIENT_MACHINE WM_NAME ar
|
||||
property WM_COMMAND WM_NAME ar
|
||||
|
||||
XCOMM To let untrusted clients use the standard colormaps created by
|
||||
XCOMM xstdcmap, include these lines.
|
||||
property RGB_DEFAULT_MAP root ar
|
||||
property RGB_BEST_MAP root ar
|
||||
property RGB_RED_MAP root ar
|
||||
property RGB_GREEN_MAP root ar
|
||||
property RGB_BLUE_MAP root ar
|
||||
property RGB_GRAY_MAP root ar
|
||||
|
||||
XCOMM To let untrusted clients use the color management database created
|
||||
XCOMM by xcmsdb, include these lines.
|
||||
property XDCCC_LINEAR_RGB_CORRECTION root ar
|
||||
property XDCCC_LINEAR_RGB_MATRICES root ar
|
||||
property XDCCC_GRAY_SCREENWHITEPOINT root ar
|
||||
property XDCCC_GRAY_CORRECTION root ar
|
||||
|
||||
XCOMM To let untrusted clients use the overlay visuals that many vendors
|
||||
XCOMM support, include this line.
|
||||
property SERVER_OVERLAY_VISUALS root ar
|
||||
|
||||
XCOMM Dumb examples to show other capabilities.
|
||||
|
||||
XCOMM oddball property names and explicit specification of error conditions
|
||||
property "property with spaces" 'property with "' aw er ed
|
||||
|
||||
XCOMM Allow deletion of Woo-Hoo if window also has property OhBoy with value
|
||||
XCOMM ending in "son". Reads and writes will cause an error.
|
||||
property Woo-Hoo OhBoy = "*son" ad
|
||||
|
||||
.fi
|
||||
.SH FILES
|
||||
.TP 30
|
||||
.I __projectroot__/lib/xserver/SecurityPolicy
|
||||
Default X server security policy
|
||||
.SH "SEE ALSO"
|
||||
.PP
|
||||
\fIXserver\fp(__appmansuffix__),
|
||||
.I "Security Extension Specification"
|
|
@ -414,221 +414,8 @@ X servers that support the SECURITY extension accept the following option:
|
|||
causes the server to attempt to read and interpret filename as a security
|
||||
policy file with the format described below. The file is read at server
|
||||
startup and reread at each server reset.
|
||||
.PP
|
||||
The syntax of the security policy file is as follows.
|
||||
Notation: "*" means zero or more occurrences of the preceding element,
|
||||
and "+" means one or more occurrences. To interpret <foo/bar>, ignore
|
||||
the text after the /; it is used to distinguish between instances of
|
||||
<foo> in the next section.
|
||||
.PP
|
||||
.nf
|
||||
<policy file> ::= <version line> <other line>*
|
||||
|
||||
<version line> ::= <string/v> '\en'
|
||||
|
||||
<other line > ::= <comment> | <access rule> | <site policy> | <blank line>
|
||||
|
||||
<comment> ::= # <not newline>* '\en'
|
||||
|
||||
<blank line> ::= <space> '\en'
|
||||
|
||||
<site policy> ::= sitepolicy <string/sp> '\en'
|
||||
|
||||
<access rule> ::= property <property/ar> <window> <perms> '\en'
|
||||
|
||||
<property> ::= <string>
|
||||
|
||||
<window> ::= any | root | <required property>
|
||||
|
||||
<required property> ::= <property/rp> | <property with value>
|
||||
|
||||
<property with value> ::= <property/rpv> = <string/rv>
|
||||
|
||||
<perms> ::= [ <operation> | <action> | <space> ]*
|
||||
|
||||
<operation> ::= r | w | d
|
||||
|
||||
<action> ::= a | i | e
|
||||
|
||||
<string> ::= <dbl quoted string> | <single quoted string> | <unquoted string>
|
||||
|
||||
<dbl quoted string> ::= <space> " <not dqoute>* " <space>
|
||||
|
||||
<single quoted string> ::= <space> ' <not squote>* ' <space>
|
||||
|
||||
<unquoted string> ::= <space> <not space>+ <space>
|
||||
|
||||
<space> ::= [ ' ' | '\et' ]*
|
||||
|
||||
Character sets:
|
||||
|
||||
<not newline> ::= any character except '\en'
|
||||
<not dqoute> ::= any character except "
|
||||
<not squote> ::= any character except '
|
||||
<not space> ::= any character except those in <space>
|
||||
.fi
|
||||
.PP
|
||||
The semantics associated with the above syntax are as follows.
|
||||
.PP
|
||||
<version line>, the first line in the file, specifies the file format
|
||||
version. If the server does not recognize the version <string/v>, it
|
||||
ignores the rest of the file. The version string for the file format
|
||||
described here is "version-1" .
|
||||
.PP
|
||||
Once past the <version line>, lines that do not match the above syntax
|
||||
are ignored.
|
||||
.PP
|
||||
<comment> lines are ignored.
|
||||
.PP
|
||||
<sitepolicy> lines are currently ignored. They are intended to
|
||||
specify the site policies used by the XC-QUERY-SECURITY-1
|
||||
authorization method.
|
||||
.PP
|
||||
<access rule> lines specify how the server should react to untrusted
|
||||
client requests that affect the X Window property named <property/ar>.
|
||||
The rest of this section describes the interpretation of an
|
||||
<access rule>.
|
||||
.PP
|
||||
For an <access rule> to apply to a given instance of <property/ar>,
|
||||
<property/ar> must be on a window that is in the set of windows
|
||||
specified by <window>. If <window> is any, the rule applies to
|
||||
<property/ar> on any window. If <window> is root, the rule applies to
|
||||
<property/ar> only on root windows.
|
||||
.PP
|
||||
If <window> is <required property>, the following apply. If <required
|
||||
property> is a <property/rp>, the rule applies when the window also
|
||||
has that <property/rp>, regardless of its value. If <required
|
||||
property> is a <property with value>, <property/rpv> must also have
|
||||
the value specified by <string/rv>. In this case, the property must
|
||||
have type STRING and format 8, and should contain one or more
|
||||
null-terminated strings. If any of the strings match <string/rv>, the
|
||||
rule applies.
|
||||
.PP
|
||||
The definition of string matching is simple case-sensitive string
|
||||
comparison with one elaboration: the occurrence of the character '*' in
|
||||
<string/rv> is a wildcard meaning "any string." A <string/rv> can
|
||||
contain multiple wildcards anywhere in the string. For example, "x*"
|
||||
matches strings that begin with x, "*x" matches strings that end with
|
||||
x, "*x*" matches strings containing x, and "x*y*" matches strings that
|
||||
start with x and subsequently contain y.
|
||||
.PP
|
||||
There may be multiple <access rule> lines for a given <property/ar>.
|
||||
The rules are tested in the order that they appear in the file. The
|
||||
first rule that applies is used.
|
||||
.PP
|
||||
<perms> specify operations that untrusted clients may attempt, and
|
||||
the actions that the server should take in response to those operations.
|
||||
.PP
|
||||
<operation> can be r (read), w (write), or d (delete). The following
|
||||
table shows how X Protocol property requests map to these operations
|
||||
in The Open Group server implementation.
|
||||
.PP
|
||||
.nf
|
||||
GetProperty r, or r and d if delete = True
|
||||
ChangeProperty w
|
||||
RotateProperties r and w
|
||||
DeleteProperty d
|
||||
ListProperties none, untrusted clients can always list all properties
|
||||
.fi
|
||||
.PP
|
||||
<action> can be a (allow), i (ignore), or e (error). Allow means
|
||||
execute the request as if it had been issued by a trusted client.
|
||||
Ignore means treat the request as a no-op. In the case of
|
||||
GetProperty, ignore means return an empty property value if the
|
||||
property exists, regardless of its actual value. Error means do not
|
||||
execute the request and return a BadAtom error with the atom set to
|
||||
the property name. Error is the default action for all properties,
|
||||
including those not listed in the security policy file.
|
||||
.PP
|
||||
An <action> applies to all <operation>s that follow it, until the next
|
||||
<action> is encountered. Thus, irwad means ignore read and write,
|
||||
allow delete.
|
||||
.PP
|
||||
GetProperty and RotateProperties may do multiple operations (r and d,
|
||||
or r and w). If different actions apply to the operations, the most
|
||||
severe action is applied to the whole request; there is no partial
|
||||
request execution. The severity ordering is: allow < ignore < error.
|
||||
Thus, if the <perms> for a property are ired (ignore read, error
|
||||
delete), and an untrusted client attempts GetProperty on that property
|
||||
with delete = True, an error is returned, but the property value is
|
||||
not. Similarly, if any of the properties in a RotateProperties do not
|
||||
allow both read and write, an error is returned without changing any
|
||||
property values.
|
||||
.PP
|
||||
Here is an example security policy file.
|
||||
.PP
|
||||
.ta 3i 4i
|
||||
.nf
|
||||
version-1
|
||||
|
||||
XCOMM Allow reading of application resources, but not writing.
|
||||
property RESOURCE_MANAGER root ar iw
|
||||
property SCREEN_RESOURCES root ar iw
|
||||
|
||||
XCOMM Ignore attempts to use cut buffers. Giving errors causes apps to crash,
|
||||
XCOMM and allowing access may give away too much information.
|
||||
property CUT_BUFFER0 root irw
|
||||
property CUT_BUFFER1 root irw
|
||||
property CUT_BUFFER2 root irw
|
||||
property CUT_BUFFER3 root irw
|
||||
property CUT_BUFFER4 root irw
|
||||
property CUT_BUFFER5 root irw
|
||||
property CUT_BUFFER6 root irw
|
||||
property CUT_BUFFER7 root irw
|
||||
|
||||
XCOMM If you are using Motif, you probably want these.
|
||||
property _MOTIF_DEFAULT_BINDINGS root ar iw
|
||||
property _MOTIF_DRAG_WINDOW root ar iw
|
||||
property _MOTIF_DRAG_TARGETS any ar iw
|
||||
property _MOTIF_DRAG_ATOMS any ar iw
|
||||
property _MOTIF_DRAG_ATOM_PAIRS any ar iw
|
||||
|
||||
XCOMM The next two rules let xwininfo -tree work when untrusted.
|
||||
property WM_NAME any ar
|
||||
|
||||
XCOMM Allow read of WM_CLASS, but only for windows with WM_NAME.
|
||||
XCOMM This might be more restrictive than necessary, but demonstrates
|
||||
XCOMM the <required property> facility, and is also an attempt to
|
||||
XCOMM say "top level windows only."
|
||||
property WM_CLASS WM_NAME ar
|
||||
|
||||
XCOMM These next three let xlsclients work untrusted. Think carefully
|
||||
XCOMM before including these; giving away the client machine name and command
|
||||
XCOMM may be exposing too much.
|
||||
property WM_STATE WM_NAME ar
|
||||
property WM_CLIENT_MACHINE WM_NAME ar
|
||||
property WM_COMMAND WM_NAME ar
|
||||
|
||||
XCOMM To let untrusted clients use the standard colormaps created by
|
||||
XCOMM xstdcmap, include these lines.
|
||||
property RGB_DEFAULT_MAP root ar
|
||||
property RGB_BEST_MAP root ar
|
||||
property RGB_RED_MAP root ar
|
||||
property RGB_GREEN_MAP root ar
|
||||
property RGB_BLUE_MAP root ar
|
||||
property RGB_GRAY_MAP root ar
|
||||
|
||||
XCOMM To let untrusted clients use the color management database created
|
||||
XCOMM by xcmsdb, include these lines.
|
||||
property XDCCC_LINEAR_RGB_CORRECTION root ar
|
||||
property XDCCC_LINEAR_RGB_MATRICES root ar
|
||||
property XDCCC_GRAY_SCREENWHITEPOINT root ar
|
||||
property XDCCC_GRAY_CORRECTION root ar
|
||||
|
||||
XCOMM To let untrusted clients use the overlay visuals that many vendors
|
||||
XCOMM support, include this line.
|
||||
property SERVER_OVERLAY_VISUALS root ar
|
||||
|
||||
XCOMM Dumb examples to show other capabilities.
|
||||
|
||||
XCOMM oddball property names and explicit specification of error conditions
|
||||
property "property with spaces" 'property with "' aw er ed
|
||||
|
||||
XCOMM Allow deletion of Woo-Hoo if window also has property OhBoy with value
|
||||
XCOMM ending in "son". Reads and writes will cause an error.
|
||||
property Woo-Hoo OhBoy = "*son" ad
|
||||
|
||||
.fi
|
||||
The syntax of the security policy file is described in
|
||||
\fISecurityPolicy\fP(__filemansuffix__).
|
||||
.SH "NETWORK CONNECTIONS"
|
||||
The X server supports client connections via a platform-dependent subset of
|
||||
the following transport types: TCP\/IP, Unix Domain sockets, DECnet,
|
||||
|
@ -757,6 +544,9 @@ Error log file for display number \fBn\fP if run from \fIinit\fP(__adminmansuffi
|
|||
.TP 30
|
||||
.I __projectroot__/lib/X11/xdm/xdm-errors
|
||||
Default error log file if the server is run from \fIxdm\fP(1)
|
||||
.TP 30
|
||||
.I __projectroot__/lib/xserver/SecurityPolicy
|
||||
Default X server security policy
|
||||
.SH "SEE ALSO"
|
||||
General information: \fIX\fP(__miscmansuffix__)
|
||||
.PP
|
||||
|
@ -771,6 +561,7 @@ Fonts: \fIbdftopcf\fP(1), \fImkfontdir\fP(1), \fImkfontscale\fP(1),
|
|||
.PP
|
||||
Security: \fIXsecurity\fP(__miscmansuffix__), \fIxauth\fP(1), \fIXau\fP(1),
|
||||
\fIxdm\fP(1), \fIxhost\fP(1), \fIxfwp\fP(1),
|
||||
\fISecurityPolicy\fP(__filemansuffix__),
|
||||
.I "Security Extension Specification"
|
||||
.PP
|
||||
Starting the server: \fIxdm\fP(1), \fIxinit\fP(1)
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
if DMX
|
||||
if BUILD_DARWIN
|
||||
# Darwin does not need the dmx subdir
|
||||
else
|
||||
DMX_SUBDIRS = dmx
|
||||
endif
|
||||
endif
|
||||
|
||||
if XORG
|
||||
if BUILD_DARWIN
|
||||
# Darwin does not need the xfree86 subdir
|
||||
else
|
||||
XORG_SUBDIRS = xfree86
|
||||
endif
|
||||
endif
|
||||
|
||||
if XVFB
|
||||
XVFB_SUBDIRS = vfb
|
||||
|
@ -30,12 +38,15 @@ if XPRINT
|
|||
XPRINT_SUBDIRS = xprint
|
||||
endif
|
||||
|
||||
# need to add darwin support here
|
||||
if BUILD_DARWIN
|
||||
DARWIN_SUBDIRS = darwin
|
||||
endif
|
||||
|
||||
SUBDIRS = \
|
||||
$(XORG_SUBDIRS) \
|
||||
$(XGL_SUBDIRS) \
|
||||
$(XWIN_SUBDIRS) \
|
||||
$(DARWIN_SUBDIRS) \
|
||||
$(XVFB_SUBDIRS) \
|
||||
$(XNEST_SUBDIRS) \
|
||||
$(DMX_SUBDIRS) \
|
||||
|
|
|
@ -3,7 +3,7 @@ libdarwin_XINPUT_SRCS = darwinXinput.c
|
|||
|
||||
AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
|
||||
AM_CPPFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
|
||||
INCLUDES = @XORG_INCS@
|
||||
INCLUDES = @XORG_INCS@ -I../../miext/rootless
|
||||
|
||||
DEFS = @DEFS@ -DUSE_NEW_CLUT
|
||||
|
||||
|
@ -17,65 +17,106 @@ SUBDIRS = \
|
|||
utils \
|
||||
.
|
||||
|
||||
|
||||
darwinappdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app
|
||||
|
||||
|
||||
libdarwinShared_a_SOURCES = darwin.c \
|
||||
darwinEvents.c \
|
||||
darwinKeyboard.c \
|
||||
$(darwin_XINPUT_SRCS)
|
||||
|
||||
bin_PROGRAMS = XDarwin
|
||||
bin_PROGRAMS = XDarwin Xquartz
|
||||
XDarwin_SOURCES = \
|
||||
$(top_srcdir)/fb/fbcmap.c \
|
||||
$(top_srcdir)/mi/miinitext.c \
|
||||
$(top_srcdir)/Xi/stubs.c
|
||||
|
||||
Xquartz_SOURCES = \
|
||||
$(top_srcdir)/fb/fbcmap.c \
|
||||
$(top_srcdir)/mi/miinitext.c \
|
||||
$(top_srcdir)/Xi/stubs.c \
|
||||
apple/X11Application.m \
|
||||
apple/X11Controller.m \
|
||||
quartz/Xserver.m \
|
||||
quartz/Preferences.m \
|
||||
quartz/applewm.c \
|
||||
quartz/keysym2ucs.c \
|
||||
quartz/pseudoramiX.c \
|
||||
quartz/quartz.c \
|
||||
quartz/quartzAudio.c \
|
||||
quartz/quartzCocoa.m \
|
||||
quartz/quartzKeyboard.c \
|
||||
quartz/quartzPasteboard.c \
|
||||
quartz/quartzStartup.c \
|
||||
quartz/xpr/appledri.c \
|
||||
quartz/xpr/dri.c \
|
||||
quartz/xpr/xprAppleWM.c \
|
||||
quartz/xpr/xprCursor.c \
|
||||
quartz/xpr/xprFrame.c \
|
||||
quartz/xpr/xprScreen.c \
|
||||
quartz/xpr/x-hash.c \
|
||||
quartz/xpr/x-hook.c \
|
||||
quartz/xpr/x-list.c
|
||||
|
||||
XDarwin_LDADD = \
|
||||
$(top_builddir)/dix/dixfonts.lo \
|
||||
$(top_builddir)/dix/libdix.la \
|
||||
$(top_builddir)/config/libconfig.a \
|
||||
$(top_builddir)/os/libos.la \
|
||||
./libdarwinShared.a \
|
||||
./iokit/libiokit.a \
|
||||
$(top_builddir)/dix/libxpstubs.la \
|
||||
$(top_builddir)/miext/shadow/libshadow.la \
|
||||
$(top_builddir)/fb/libfb.la \
|
||||
$(top_builddir)/composite/libcomposite.la \
|
||||
$(top_builddir)/damageext/libdamageext.la \
|
||||
$(top_builddir)/miext/damage/libdamage.la \
|
||||
$(top_builddir)/xfixes/libxfixes.la \
|
||||
$(top_builddir)/miext/cw/libcw.la \
|
||||
$(top_builddir)/Xext/libXext.la \
|
||||
$(top_builddir)/xkb/libxkb.la \
|
||||
$(top_builddir)/xkb/libxkbstubs.la \
|
||||
$(top_builddir)/Xi/libXi.la \
|
||||
$(top_builddir)/dbe/libdbe.la \
|
||||
$(top_builddir)/record/librecord.la \
|
||||
$(top_builddir)/XTrap/libxtrap.la \
|
||||
$(XGLX_LIBS) \
|
||||
$(DARWIN_LIBS) \
|
||||
$(top_builddir)/miext/rootless/librootless.la \
|
||||
$(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
|
||||
$(top_builddir)/miext/rootless/accel/librlAccel.la \
|
||||
@XORG_LIBS@ \
|
||||
-lXau -lXdmcp -lXfont -lfreetype
|
||||
$(XSERVER_LIBS)
|
||||
|
||||
Xquartz_LDADD = \
|
||||
$(top_builddir)/dix/dixfonts.lo \
|
||||
$(top_builddir)/dix/libdix.la \
|
||||
$(top_builddir)/config/libconfig.a \
|
||||
./libdarwinShared.a \
|
||||
$(top_builddir)/miext/shadow/libshadow.la \
|
||||
$(top_builddir)/miext/cw/libcw.la \
|
||||
$(DARWIN_LIBS) \
|
||||
$(top_builddir)/miext/rootless/librootless.la \
|
||||
$(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
|
||||
$(top_builddir)/miext/rootless/accel/librlAccel.la \
|
||||
@XORG_LIBS@ \
|
||||
$(XSERVER_LIBS) -lXplugin
|
||||
|
||||
XDarwin_LDFLAGS = \
|
||||
-XCClinker -Objc \
|
||||
-Wl,-u,_miDCInitialize \
|
||||
-Wl,-framework,IOKit
|
||||
-XCClinker -Objc \
|
||||
-Wl,-u,_miDCInitialize \
|
||||
-Wl,-framework,IOKit
|
||||
|
||||
Xquartz_LDFLAGS = \
|
||||
-XCClinker -Objc \
|
||||
-Wl,-u,_miDCInitialize \
|
||||
-Wl,-framework,Carbon \
|
||||
-Wl,-framework,OpenGL \
|
||||
-Wl,-framework,Cocoa \
|
||||
-Wl,-framework,CoreAudio \
|
||||
-Wl,-framework,IOKit
|
||||
|
||||
XDarwin_CFLAGS = -DINXDARWIN
|
||||
Xquartz_CFLAGS = -DINXQUARTZ -DHAS_CG_MACH_PORT -DHAS_KL_API -DHAVE_XORG_CONFIG_H
|
||||
|
||||
if XQUARTZ
|
||||
macosdir = $(darwinappdir)/Contents/MacOS
|
||||
|
||||
DEFS += -DDARWIN_WITH_QUARTZ -DXFree86Server
|
||||
|
||||
macos_PROGRAMS = XDarwinApp
|
||||
macos_SCRIPTS = x11app
|
||||
|
||||
x11app:
|
||||
cd apple && xcodebuild
|
||||
|
||||
XDarwinApp_SOURCES = \
|
||||
$(top_srcdir)/fb/fbcmap.c \
|
||||
$(top_srcdir)/mi/miinitext.c \
|
||||
$(top_srcdir)/fb/fbcmap.c \
|
||||
$(top_srcdir)/mi/miinitext.c \
|
||||
$(top_srcdir)/Xi/stubs.c
|
||||
|
||||
XDarwinApp_LDADD = \
|
||||
|
@ -86,28 +127,14 @@ XDarwinApp_LDADD = \
|
|||
./quartz/XApplication.o \
|
||||
./libdarwinShared.a \
|
||||
./quartz/libXQuartz.a \
|
||||
$(top_builddir)/dix/libxpstubs.la \
|
||||
$(top_builddir)/miext/shadow/libshadow.la \
|
||||
$(top_builddir)/fb/libfb.la \
|
||||
$(top_builddir)/composite/libcomposite.la \
|
||||
$(top_builddir)/damageext/libdamageext.la \
|
||||
$(top_builddir)/miext/damage/libdamage.la \
|
||||
$(top_builddir)/xfixes/libxfixes.la \
|
||||
$(top_builddir)/miext/cw/libcw.la \
|
||||
$(top_builddir)/Xext/libXext.la \
|
||||
$(top_builddir)/xkb/libxkb.la \
|
||||
$(top_builddir)/xkb/libxkbstubs.la \
|
||||
$(top_builddir)/Xi/libXi.la \
|
||||
$(top_builddir)/dbe/libdbe.la \
|
||||
$(top_builddir)/record/librecord.la \
|
||||
$(top_builddir)/XTrap/libxtrap.la \
|
||||
$(XGLX_LIBS) \
|
||||
$(DARWIN_LIBS) \
|
||||
$(top_builddir)/miext/rootless/librootless.la \
|
||||
$(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
|
||||
$(top_builddir)/miext/rootless/accel/librlAccel.la \
|
||||
@XORG_LIBS@ \
|
||||
-lXau -lXdmcp -lXfont -lfreetype \
|
||||
$(top_builddir)/fb/libfb.la
|
||||
$(XSERVER_LIBS)
|
||||
|
||||
XDarwinApp_LDFLAGS = \
|
||||
-XCClinker -Objc \
|
||||
|
@ -118,21 +145,24 @@ XDarwinApp_LDFLAGS = \
|
|||
-Wl,-framework,CoreAudio \
|
||||
-Wl,-framework,IOKit
|
||||
|
||||
XDarwinApp_CFLAGS = -DINXDARWINAPP
|
||||
HOOK_TARGETS = xquartz-install-hook
|
||||
|
||||
|
||||
crplugindir = $(darwinappdir)/Contents/Resources/cr.bundle/Contents/MacOS
|
||||
crplugin_LTLIBRARIES = cr.la
|
||||
cr_la_SOURCES =
|
||||
cr_la_SOURCES = \
|
||||
quartz/cr/crAppleWM.m \
|
||||
quartz/cr/crFrame.m \
|
||||
quartz/cr/crScreen.m \
|
||||
quartz/fullscreen/quartzCursor.c \
|
||||
quartz/cr/XView.m
|
||||
|
||||
cr_la_LIBADD = \
|
||||
quartz/cr/crAppleWM.o \
|
||||
quartz/cr/crFrame.o \
|
||||
quartz/cr/crScreen.o \
|
||||
quartz/fullscreen/quartzCursor.o \
|
||||
quartz/cr/XView.o \
|
||||
$(top_builddir)/miext/rootless/librootless.la \
|
||||
$(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
|
||||
$(top_builddir)/miext/rootless/accel/librlAccel.la
|
||||
|
||||
cr_la_LDFLAGS = -shrext '' -Wl,-framework,ApplicationServices \
|
||||
-Wl,-framework,Cocoa \
|
||||
-Wl,-framework,Carbon \
|
||||
|
@ -143,10 +173,11 @@ cr_la_DEPENDENCIES = XDarwinApp
|
|||
|
||||
fullscreenplugindir = $(darwinappdir)/Contents/Resources/fullscreen.bundle/Contents/MacOS
|
||||
fullscreenplugin_LTLIBRARIES = fullscreen.la
|
||||
fullscreen_la_SOURCES =
|
||||
fullscreen_la_SOURCES = \
|
||||
quartz/fullscreen/fullscreen.c \
|
||||
quartz/fullscreen/quartzCursor.c
|
||||
|
||||
fullscreen_la_LIBADD = \
|
||||
quartz/fullscreen/fullscreen.o \
|
||||
quartz/fullscreen/quartzCursor.o \
|
||||
$(top_builddir)/miext/shadow/libshadow.la
|
||||
|
||||
fullscreen_la_LDFLAGS = -shrext '' -Wl,-framework,ApplicationServices \
|
||||
|
@ -175,20 +206,22 @@ if HAVE_X_PLUGIN
|
|||
|
||||
xprplugindir = $(darwinappdir)/Contents/Resources/xpr.bundle/Contents/MacOS
|
||||
xprplugin_LTLIBRARIES = xpr.la
|
||||
xpr_la_SOURCES =
|
||||
xpr_la_SOURCES = \
|
||||
quartz/xpr/appledri.c \
|
||||
quartz/xpr/dri.c \
|
||||
quartz/xpr/xprAppleWM.c \
|
||||
quartz/xpr/xprCursor.c \
|
||||
quartz/xpr/xprFrame.c \
|
||||
quartz/xpr/xprScreen.c \
|
||||
quartz/xpr/x-hash.c \
|
||||
quartz/xpr/x-hook.c \
|
||||
quartz/xpr/x-list.c
|
||||
|
||||
xpr_la_LIBADD = \
|
||||
quartz/xpr/appledri.o \
|
||||
quartz/xpr/dri.o \
|
||||
quartz/xpr/xprAppleWM.o \
|
||||
quartz/xpr/xprCursor.o \
|
||||
quartz/xpr/xprFrame.o \
|
||||
quartz/xpr/xprScreen.o \
|
||||
quartz/xpr/x-hash.o \
|
||||
quartz/xpr/x-hook.o \
|
||||
quartz/xpr/x-list.o \
|
||||
$(top_builddir)/miext/rootless/librootless.la \
|
||||
$(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
|
||||
$(top_builddir)/miext/rootless/accel/librlAccel.la
|
||||
|
||||
xpr_la_LDFLAGS = -shrext '' -Wl,-framework,ApplicationServices \
|
||||
-lXplugin \
|
||||
-XCClinker -bundle_loader -XCClinker XDarwinApp \
|
||||
|
@ -242,6 +275,7 @@ install-data-hook: $(HOOK_TARGETS)
|
|||
|
||||
xquartz-install-hook:
|
||||
mv $(DESTDIR)$(macosdir)/XDarwinApp $(DESTDIR)$(macosdir)/XDarwin
|
||||
cd apple && xcodebuild CFLAGS="$(XSERVERCFLAGS_CFLAGS)" LDFLAGS="$(XSERVERCFLAGS_LIBS)"
|
||||
|
||||
EXTRA_DIST = \
|
||||
darwin.c \
|
||||
|
|
41
hw/darwin/README.apple
Normal file
41
hw/darwin/README.apple
Normal file
|
@ -0,0 +1,41 @@
|
|||
This directory contains a port of the XDarwin code to the modular X.org
|
||||
codebase to be compiled on Darwin/OS X; this would not have been possible
|
||||
without the help of Torrey Lyons and Peter O'Gorman, to whom I am
|
||||
grateful for their patches, time and moral support.
|
||||
|
||||
The server builds 4 targets:
|
||||
|
||||
* XDarwin: this server runs on Darwin systems without Quartz
|
||||
(i.e. non-OS X); it has not been well-tested.
|
||||
|
||||
* XDarwinApp: this builds XDarwin.app, which is a full X server using
|
||||
Quartz. It has loadable module support for AGL and CGL, and well as
|
||||
fullscreen and rootless support.
|
||||
|
||||
* Xquartz: this server runs on Quartz-based systems, and is meant to
|
||||
work with X11.app
|
||||
|
||||
* x11app: this builds a version of Apple's X11.app using patches by
|
||||
Torrey Lyons; most, but not all, functionality of Apple's original
|
||||
X11.app is present in this release.
|
||||
|
||||
Known issues:
|
||||
|
||||
* AGL and CGL support for 3D indirect acceleration does not work;
|
||||
indirect.c needs to be rewritten.
|
||||
|
||||
* Fullscreen mode does not work; I don't know why.
|
||||
|
||||
* The keyboard and mouse do not work at all; they worked in X11R7.1,
|
||||
and I believe that they were broken by the events changes in dix/.
|
||||
|
||||
* Some features in X11.app are not yet implemented; these are marked
|
||||
with #ifdef DARWIN_DDX_MISSING in the code.
|
||||
|
||||
* The build system code could probably be cleaned up slightly.
|
||||
|
||||
* Most testing of this code has occurred under 10.5, but it should
|
||||
also work under 10.4.
|
||||
|
||||
Any patches or code contributions would be most welcome and may be
|
||||
sent to me at bbyer@apple.com.
|
BIN
hw/darwin/apple/English.lproj/InfoPlist.strings
Normal file
BIN
hw/darwin/apple/English.lproj/InfoPlist.strings
Normal file
Binary file not shown.
65
hw/darwin/apple/English.lproj/main.nib/.svn/entries
Normal file
65
hw/darwin/apple/English.lproj/main.nib/.svn/entries
Normal file
|
@ -0,0 +1,65 @@
|
|||
8
|
||||
|
||||
dir
|
||||
29110
|
||||
svn+ssh://src.apple.com/svn/BSD/X11server/trunk/darwin/apple/English.lproj/main.nib
|
||||
svn+ssh://src.apple.com/svn/BSD
|
||||
|
||||
|
||||
|
||||
2007-02-03T03:06:20.842932Z
|
||||
28761
|
||||
bbyer
|
||||
|
||||
|
||||
svn:special svn:externals svn:needs-lock
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
e92bca22-270c-0410-9cea-e3f1106b6a1c
|
||||
|
||||
info.nib
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2007-02-27T01:00:07.000000Z
|
||||
456347804c516786b1d1339ce2ef50a2
|
||||
2007-02-03T03:06:20.842932Z
|
||||
28761
|
||||
bbyer
|
||||
|
||||
keyedobjects.nib
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2007-02-27T01:00:07.000000Z
|
||||
eb3010372b09768c846df0d996cfdd8d
|
||||
2007-02-03T03:06:20.842932Z
|
||||
28761
|
||||
bbyer
|
||||
has-props
|
||||
|
||||
classes.nib
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2007-02-27T01:00:07.000000Z
|
||||
0ae2660c3afabbd5aa02fc34712c96e6
|
||||
2007-02-03T03:06:20.842932Z
|
||||
28761
|
||||
bbyer
|
||||
|
1
hw/darwin/apple/English.lproj/main.nib/.svn/format
Normal file
1
hw/darwin/apple/English.lproj/main.nib/.svn/format
Normal file
|
@ -0,0 +1 @@
|
|||
8
|
|
@ -0,0 +1,5 @@
|
|||
K 13
|
||||
svn:mime-type
|
||||
V 24
|
||||
application/octet-stream
|
||||
END
|
|
@ -0,0 +1,318 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBClasses</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>IBLibraryObjectTemplate</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>OUTLETS</key>
|
||||
<dict>
|
||||
<key>draggedView</key>
|
||||
<string>NSView</string>
|
||||
<key>representedObject</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSView</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>IBInspector</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>OUTLETS</key>
|
||||
<dict>
|
||||
<key>inspectorView</key>
|
||||
<string>NSView</string>
|
||||
</dict>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>NSDateFormatter</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSFormatter</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ACTIONS</key>
|
||||
<dict>
|
||||
<key>apps_table_cancel</key>
|
||||
<string>id</string>
|
||||
<key>apps_table_delete</key>
|
||||
<string>id</string>
|
||||
<key>apps_table_done</key>
|
||||
<string>id</string>
|
||||
<key>apps_table_duplicate</key>
|
||||
<string>id</string>
|
||||
<key>apps_table_new</key>
|
||||
<string>id</string>
|
||||
<key>apps_table_show</key>
|
||||
<string>id</string>
|
||||
<key>bring_to_front</key>
|
||||
<string>id</string>
|
||||
<key>close_window</key>
|
||||
<string>id</string>
|
||||
<key>enable_fullscreen_changed</key>
|
||||
<string>id</string>
|
||||
<key>minimize_window</key>
|
||||
<string>id</string>
|
||||
<key>next_window</key>
|
||||
<string>id</string>
|
||||
<key>prefs_changed</key>
|
||||
<string>id</string>
|
||||
<key>prefs_show</key>
|
||||
<string>id</string>
|
||||
<key>previous_window</key>
|
||||
<string>id</string>
|
||||
<key>toggle_fullscreen</key>
|
||||
<string>id</string>
|
||||
<key>x11_help</key>
|
||||
<string>id</string>
|
||||
<key>zoom_window</key>
|
||||
<string>id</string>
|
||||
</dict>
|
||||
<key>CLASS</key>
|
||||
<string>X11Controller</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>OUTLETS</key>
|
||||
<dict>
|
||||
<key>apps_separator</key>
|
||||
<string>id</string>
|
||||
<key>apps_table</key>
|
||||
<string>id</string>
|
||||
<key>depth</key>
|
||||
<string>id</string>
|
||||
<key>dock_apps_menu</key>
|
||||
<string>id</string>
|
||||
<key>dock_menu</key>
|
||||
<string>id</string>
|
||||
<key>dock_window_separator</key>
|
||||
<string>id</string>
|
||||
<key>enable_auth</key>
|
||||
<string>id</string>
|
||||
<key>enable_fullscreen</key>
|
||||
<string>id</string>
|
||||
<key>enable_keyequivs</key>
|
||||
<string>id</string>
|
||||
<key>enable_tcp</key>
|
||||
<string>id</string>
|
||||
<key>fake_buttons</key>
|
||||
<string>id</string>
|
||||
<key>prefs_panel</key>
|
||||
<string>id</string>
|
||||
<key>sync_keymap</key>
|
||||
<string>id</string>
|
||||
<key>toggle_fullscreen_item</key>
|
||||
<string>id</string>
|
||||
<key>use_sysbeep</key>
|
||||
<string>id</string>
|
||||
<key>window_separator</key>
|
||||
<string>id</string>
|
||||
<key>x11_about_item</key>
|
||||
<string>id</string>
|
||||
</dict>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>NSNumberFormatter</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSFormatter</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>NSFormatter</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ACTIONS</key>
|
||||
<dict>
|
||||
<key>alignCenter:</key>
|
||||
<string>id</string>
|
||||
<key>alignJustified:</key>
|
||||
<string>id</string>
|
||||
<key>alignLeft:</key>
|
||||
<string>id</string>
|
||||
<key>alignRight:</key>
|
||||
<string>id</string>
|
||||
<key>arrangeInFront:</key>
|
||||
<string>id</string>
|
||||
<key>centerSelectionInVisibleArea:</key>
|
||||
<string>id</string>
|
||||
<key>changeFont:</key>
|
||||
<string>id</string>
|
||||
<key>checkSpelling:</key>
|
||||
<string>id</string>
|
||||
<key>clear:</key>
|
||||
<string>id</string>
|
||||
<key>clearRecentDocuments:</key>
|
||||
<string>id</string>
|
||||
<key>complete:</key>
|
||||
<string>id</string>
|
||||
<key>copy:</key>
|
||||
<string>id</string>
|
||||
<key>copyFont:</key>
|
||||
<string>id</string>
|
||||
<key>copyRuler:</key>
|
||||
<string>id</string>
|
||||
<key>cut:</key>
|
||||
<string>id</string>
|
||||
<key>delete:</key>
|
||||
<string>id</string>
|
||||
<key>deminiaturize:</key>
|
||||
<string>id</string>
|
||||
<key>fax:</key>
|
||||
<string>id</string>
|
||||
<key>hide:</key>
|
||||
<string>id</string>
|
||||
<key>hideOtherApplications:</key>
|
||||
<string>id</string>
|
||||
<key>loosenKerning:</key>
|
||||
<string>id</string>
|
||||
<key>lowerBaseline:</key>
|
||||
<string>id</string>
|
||||
<key>makeKeyAndOrderFront:</key>
|
||||
<string>id</string>
|
||||
<key>miniaturize:</key>
|
||||
<string>id</string>
|
||||
<key>newDocument:</key>
|
||||
<string>id</string>
|
||||
<key>openDocument:</key>
|
||||
<string>id</string>
|
||||
<key>orderBack:</key>
|
||||
<string>id</string>
|
||||
<key>orderFront:</key>
|
||||
<string>id</string>
|
||||
<key>orderFrontColorPanel:</key>
|
||||
<string>id</string>
|
||||
<key>orderFrontHelpPanel:</key>
|
||||
<string>id</string>
|
||||
<key>orderOut:</key>
|
||||
<string>id</string>
|
||||
<key>outline:</key>
|
||||
<string>id</string>
|
||||
<key>paste:</key>
|
||||
<string>id</string>
|
||||
<key>pasteAsPlainText:</key>
|
||||
<string>id</string>
|
||||
<key>pasteAsRichText:</key>
|
||||
<string>id</string>
|
||||
<key>pasteFont:</key>
|
||||
<string>id</string>
|
||||
<key>pasteRuler:</key>
|
||||
<string>id</string>
|
||||
<key>pause:</key>
|
||||
<string>id</string>
|
||||
<key>performClose:</key>
|
||||
<string>id</string>
|
||||
<key>performFindPanelAction:</key>
|
||||
<string>id</string>
|
||||
<key>performMiniaturize:</key>
|
||||
<string>id</string>
|
||||
<key>performZoom:</key>
|
||||
<string>id</string>
|
||||
<key>play:</key>
|
||||
<string>id</string>
|
||||
<key>print:</key>
|
||||
<string>id</string>
|
||||
<key>printDocument:</key>
|
||||
<string>id</string>
|
||||
<key>raiseBaseline:</key>
|
||||
<string>id</string>
|
||||
<key>record:</key>
|
||||
<string>id</string>
|
||||
<key>redo:</key>
|
||||
<string>id</string>
|
||||
<key>resume:</key>
|
||||
<string>id</string>
|
||||
<key>revertDocumentToSaved:</key>
|
||||
<string>id</string>
|
||||
<key>run:</key>
|
||||
<string>id</string>
|
||||
<key>runPageLayout:</key>
|
||||
<string>id</string>
|
||||
<key>runToolbarCustomizationPalette:</key>
|
||||
<string>id</string>
|
||||
<key>saveAllDocuments:</key>
|
||||
<string>id</string>
|
||||
<key>saveDocument:</key>
|
||||
<string>id</string>
|
||||
<key>saveDocumentAs:</key>
|
||||
<string>id</string>
|
||||
<key>saveDocumentTo:</key>
|
||||
<string>id</string>
|
||||
<key>selectAll:</key>
|
||||
<string>id</string>
|
||||
<key>selectText:</key>
|
||||
<string>id</string>
|
||||
<key>showGuessPanel:</key>
|
||||
<string>id</string>
|
||||
<key>showHelp:</key>
|
||||
<string>id</string>
|
||||
<key>start:</key>
|
||||
<string>id</string>
|
||||
<key>startSpeaking:</key>
|
||||
<string>id</string>
|
||||
<key>stop:</key>
|
||||
<string>id</string>
|
||||
<key>stopSpeaking:</key>
|
||||
<string>id</string>
|
||||
<key>subscript:</key>
|
||||
<string>id</string>
|
||||
<key>superscript:</key>
|
||||
<string>id</string>
|
||||
<key>terminate:</key>
|
||||
<string>id</string>
|
||||
<key>tightenKerning:</key>
|
||||
<string>id</string>
|
||||
<key>toggleContinuousSpellChecking:</key>
|
||||
<string>id</string>
|
||||
<key>toggleRuler:</key>
|
||||
<string>id</string>
|
||||
<key>toggleToolbarShown:</key>
|
||||
<string>id</string>
|
||||
<key>turnOffKerning:</key>
|
||||
<string>id</string>
|
||||
<key>turnOffLigatures:</key>
|
||||
<string>id</string>
|
||||
<key>underline:</key>
|
||||
<string>id</string>
|
||||
<key>undo:</key>
|
||||
<string>id</string>
|
||||
<key>unhideAllApplications:</key>
|
||||
<string>id</string>
|
||||
<key>unscript:</key>
|
||||
<string>id</string>
|
||||
<key>useAllLigatures:</key>
|
||||
<string>id</string>
|
||||
<key>useStandardKerning:</key>
|
||||
<string>id</string>
|
||||
<key>useStandardLigatures:</key>
|
||||
<string>id</string>
|
||||
</dict>
|
||||
<key>CLASS</key>
|
||||
<string>FirstResponder</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>IBVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>588</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>244</integer>
|
||||
<integer>29</integer>
|
||||
<integer>423</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>9A356</string>
|
||||
<key>targetFramework</key>
|
||||
<string>IBCocoaFramework</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
318
hw/darwin/apple/English.lproj/main.nib/classes.nib
generated
Normal file
318
hw/darwin/apple/English.lproj/main.nib/classes.nib
generated
Normal file
|
@ -0,0 +1,318 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBClasses</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>IBLibraryObjectTemplate</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>OUTLETS</key>
|
||||
<dict>
|
||||
<key>draggedView</key>
|
||||
<string>NSView</string>
|
||||
<key>representedObject</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSView</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>IBInspector</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>OUTLETS</key>
|
||||
<dict>
|
||||
<key>inspectorView</key>
|
||||
<string>NSView</string>
|
||||
</dict>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>NSDateFormatter</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSFormatter</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ACTIONS</key>
|
||||
<dict>
|
||||
<key>apps_table_cancel</key>
|
||||
<string>id</string>
|
||||
<key>apps_table_delete</key>
|
||||
<string>id</string>
|
||||
<key>apps_table_done</key>
|
||||
<string>id</string>
|
||||
<key>apps_table_duplicate</key>
|
||||
<string>id</string>
|
||||
<key>apps_table_new</key>
|
||||
<string>id</string>
|
||||
<key>apps_table_show</key>
|
||||
<string>id</string>
|
||||
<key>bring_to_front</key>
|
||||
<string>id</string>
|
||||
<key>close_window</key>
|
||||
<string>id</string>
|
||||
<key>enable_fullscreen_changed</key>
|
||||
<string>id</string>
|
||||
<key>minimize_window</key>
|
||||
<string>id</string>
|
||||
<key>next_window</key>
|
||||
<string>id</string>
|
||||
<key>prefs_changed</key>
|
||||
<string>id</string>
|
||||
<key>prefs_show</key>
|
||||
<string>id</string>
|
||||
<key>previous_window</key>
|
||||
<string>id</string>
|
||||
<key>toggle_fullscreen</key>
|
||||
<string>id</string>
|
||||
<key>x11_help</key>
|
||||
<string>id</string>
|
||||
<key>zoom_window</key>
|
||||
<string>id</string>
|
||||
</dict>
|
||||
<key>CLASS</key>
|
||||
<string>X11Controller</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>OUTLETS</key>
|
||||
<dict>
|
||||
<key>apps_separator</key>
|
||||
<string>id</string>
|
||||
<key>apps_table</key>
|
||||
<string>id</string>
|
||||
<key>depth</key>
|
||||
<string>id</string>
|
||||
<key>dock_apps_menu</key>
|
||||
<string>id</string>
|
||||
<key>dock_menu</key>
|
||||
<string>id</string>
|
||||
<key>dock_window_separator</key>
|
||||
<string>id</string>
|
||||
<key>enable_auth</key>
|
||||
<string>id</string>
|
||||
<key>enable_fullscreen</key>
|
||||
<string>id</string>
|
||||
<key>enable_keyequivs</key>
|
||||
<string>id</string>
|
||||
<key>enable_tcp</key>
|
||||
<string>id</string>
|
||||
<key>fake_buttons</key>
|
||||
<string>id</string>
|
||||
<key>prefs_panel</key>
|
||||
<string>id</string>
|
||||
<key>sync_keymap</key>
|
||||
<string>id</string>
|
||||
<key>toggle_fullscreen_item</key>
|
||||
<string>id</string>
|
||||
<key>use_sysbeep</key>
|
||||
<string>id</string>
|
||||
<key>window_separator</key>
|
||||
<string>id</string>
|
||||
<key>x11_about_item</key>
|
||||
<string>id</string>
|
||||
</dict>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>NSNumberFormatter</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSFormatter</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>NSFormatter</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ACTIONS</key>
|
||||
<dict>
|
||||
<key>alignCenter:</key>
|
||||
<string>id</string>
|
||||
<key>alignJustified:</key>
|
||||
<string>id</string>
|
||||
<key>alignLeft:</key>
|
||||
<string>id</string>
|
||||
<key>alignRight:</key>
|
||||
<string>id</string>
|
||||
<key>arrangeInFront:</key>
|
||||
<string>id</string>
|
||||
<key>centerSelectionInVisibleArea:</key>
|
||||
<string>id</string>
|
||||
<key>changeFont:</key>
|
||||
<string>id</string>
|
||||
<key>checkSpelling:</key>
|
||||
<string>id</string>
|
||||
<key>clear:</key>
|
||||
<string>id</string>
|
||||
<key>clearRecentDocuments:</key>
|
||||
<string>id</string>
|
||||
<key>complete:</key>
|
||||
<string>id</string>
|
||||
<key>copy:</key>
|
||||
<string>id</string>
|
||||
<key>copyFont:</key>
|
||||
<string>id</string>
|
||||
<key>copyRuler:</key>
|
||||
<string>id</string>
|
||||
<key>cut:</key>
|
||||
<string>id</string>
|
||||
<key>delete:</key>
|
||||
<string>id</string>
|
||||
<key>deminiaturize:</key>
|
||||
<string>id</string>
|
||||
<key>fax:</key>
|
||||
<string>id</string>
|
||||
<key>hide:</key>
|
||||
<string>id</string>
|
||||
<key>hideOtherApplications:</key>
|
||||
<string>id</string>
|
||||
<key>loosenKerning:</key>
|
||||
<string>id</string>
|
||||
<key>lowerBaseline:</key>
|
||||
<string>id</string>
|
||||
<key>makeKeyAndOrderFront:</key>
|
||||
<string>id</string>
|
||||
<key>miniaturize:</key>
|
||||
<string>id</string>
|
||||
<key>newDocument:</key>
|
||||
<string>id</string>
|
||||
<key>openDocument:</key>
|
||||
<string>id</string>
|
||||
<key>orderBack:</key>
|
||||
<string>id</string>
|
||||
<key>orderFront:</key>
|
||||
<string>id</string>
|
||||
<key>orderFrontColorPanel:</key>
|
||||
<string>id</string>
|
||||
<key>orderFrontHelpPanel:</key>
|
||||
<string>id</string>
|
||||
<key>orderOut:</key>
|
||||
<string>id</string>
|
||||
<key>outline:</key>
|
||||
<string>id</string>
|
||||
<key>paste:</key>
|
||||
<string>id</string>
|
||||
<key>pasteAsPlainText:</key>
|
||||
<string>id</string>
|
||||
<key>pasteAsRichText:</key>
|
||||
<string>id</string>
|
||||
<key>pasteFont:</key>
|
||||
<string>id</string>
|
||||
<key>pasteRuler:</key>
|
||||
<string>id</string>
|
||||
<key>pause:</key>
|
||||
<string>id</string>
|
||||
<key>performClose:</key>
|
||||
<string>id</string>
|
||||
<key>performFindPanelAction:</key>
|
||||
<string>id</string>
|
||||
<key>performMiniaturize:</key>
|
||||
<string>id</string>
|
||||
<key>performZoom:</key>
|
||||
<string>id</string>
|
||||
<key>play:</key>
|
||||
<string>id</string>
|
||||
<key>print:</key>
|
||||
<string>id</string>
|
||||
<key>printDocument:</key>
|
||||
<string>id</string>
|
||||
<key>raiseBaseline:</key>
|
||||
<string>id</string>
|
||||
<key>record:</key>
|
||||
<string>id</string>
|
||||
<key>redo:</key>
|
||||
<string>id</string>
|
||||
<key>resume:</key>
|
||||
<string>id</string>
|
||||
<key>revertDocumentToSaved:</key>
|
||||
<string>id</string>
|
||||
<key>run:</key>
|
||||
<string>id</string>
|
||||
<key>runPageLayout:</key>
|
||||
<string>id</string>
|
||||
<key>runToolbarCustomizationPalette:</key>
|
||||
<string>id</string>
|
||||
<key>saveAllDocuments:</key>
|
||||
<string>id</string>
|
||||
<key>saveDocument:</key>
|
||||
<string>id</string>
|
||||
<key>saveDocumentAs:</key>
|
||||
<string>id</string>
|
||||
<key>saveDocumentTo:</key>
|
||||
<string>id</string>
|
||||
<key>selectAll:</key>
|
||||
<string>id</string>
|
||||
<key>selectText:</key>
|
||||
<string>id</string>
|
||||
<key>showGuessPanel:</key>
|
||||
<string>id</string>
|
||||
<key>showHelp:</key>
|
||||
<string>id</string>
|
||||
<key>start:</key>
|
||||
<string>id</string>
|
||||
<key>startSpeaking:</key>
|
||||
<string>id</string>
|
||||
<key>stop:</key>
|
||||
<string>id</string>
|
||||
<key>stopSpeaking:</key>
|
||||
<string>id</string>
|
||||
<key>subscript:</key>
|
||||
<string>id</string>
|
||||
<key>superscript:</key>
|
||||
<string>id</string>
|
||||
<key>terminate:</key>
|
||||
<string>id</string>
|
||||
<key>tightenKerning:</key>
|
||||
<string>id</string>
|
||||
<key>toggleContinuousSpellChecking:</key>
|
||||
<string>id</string>
|
||||
<key>toggleRuler:</key>
|
||||
<string>id</string>
|
||||
<key>toggleToolbarShown:</key>
|
||||
<string>id</string>
|
||||
<key>turnOffKerning:</key>
|
||||
<string>id</string>
|
||||
<key>turnOffLigatures:</key>
|
||||
<string>id</string>
|
||||
<key>underline:</key>
|
||||
<string>id</string>
|
||||
<key>undo:</key>
|
||||
<string>id</string>
|
||||
<key>unhideAllApplications:</key>
|
||||
<string>id</string>
|
||||
<key>unscript:</key>
|
||||
<string>id</string>
|
||||
<key>useAllLigatures:</key>
|
||||
<string>id</string>
|
||||
<key>useStandardKerning:</key>
|
||||
<string>id</string>
|
||||
<key>useStandardLigatures:</key>
|
||||
<string>id</string>
|
||||
</dict>
|
||||
<key>CLASS</key>
|
||||
<string>FirstResponder</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>IBVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</plist>
|
18
hw/darwin/apple/English.lproj/main.nib/info.nib
generated
Normal file
18
hw/darwin/apple/English.lproj/main.nib/info.nib
generated
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>588</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>244</integer>
|
||||
<integer>29</integer>
|
||||
<integer>423</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>9A356</string>
|
||||
<key>targetFramework</key>
|
||||
<string>IBCocoaFramework</string>
|
||||
</dict>
|
||||
</plist>
|
BIN
hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib
generated
Normal file
BIN
hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib
generated
Normal file
Binary file not shown.
71
hw/darwin/apple/Info.plist
Normal file
71
hw/darwin/apple/Info.plist
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>x11app</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>X11.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>X11 Application</string>
|
||||
<key>CFBundleTypeOSTypes</key>
|
||||
<array>
|
||||
<string>****</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>LSIsAppleDefaultForType</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>tool</string>
|
||||
<string>*</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>UNIX Application</string>
|
||||
<key>CFBundleTypeOSTypes</key>
|
||||
<array>
|
||||
<string>****</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>X11</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>X11</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>X11.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.x.X11</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>X11</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2003-2007, Apple Inc.
|
||||
Copyright © 2003, XFree86 Project, Inc.</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>main</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>X11Application</string>
|
||||
</dict>
|
||||
</plist>
|
BIN
hw/darwin/apple/X11.icns
Normal file
BIN
hw/darwin/apple/X11.icns
Normal file
Binary file not shown.
320
hw/darwin/apple/X11.xcodeproj/project.pbxproj
Normal file
320
hw/darwin/apple/X11.xcodeproj/project.pbxproj
Normal file
|
@ -0,0 +1,320 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 42;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */; };
|
||||
527F241A0B5D938C007840A7 /* main.nib in Resources */ = {isa = PBXBuildFile; fileRef = 02345980000FD03B11CA0E72 /* main.nib */; };
|
||||
527F241B0B5D938C007840A7 /* X11.icns in Resources */ = {isa = PBXBuildFile; fileRef = 50459C5F038587C60ECA21EC /* X11.icns */; };
|
||||
527F241D0B5D938C007840A7 /* bundle-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 50EE2AB703849F0B0ECA21EC /* bundle-main.c */; };
|
||||
527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */; };
|
||||
527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 570C5748047186C400ACF82F /* SystemConfiguration.framework */; };
|
||||
527F24370B5D9D89007840A7 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 527F24260B5D938C007840A7 /* Info.plist */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0867D6ABFE840B52C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
1870340FFE93FCAF11CA0CD7 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/main.nib; sourceTree = "<group>"; };
|
||||
50459C5F038587C60ECA21EC /* X11.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = X11.icns; sourceTree = "<group>"; };
|
||||
50EE2AB703849F0B0ECA21EC /* bundle-main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "bundle-main.c"; sourceTree = "<group>"; };
|
||||
50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
|
||||
527F24260B5D938C007840A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
527F24270B5D938C007840A7 /* X11.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = X11.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
570C5748047186C400ACF82F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = "<absolute>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
527F241E0B5D938C007840A7 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */,
|
||||
527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
195DF8CFFE9D517E11CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
527F24270B5D938C007840A7 /* X11.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
20286C29FDCF999611CA2CEA /* X11 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
20286C2AFDCF999611CA2CEA /* Sources */,
|
||||
20286C2CFDCF999611CA2CEA /* Resources */,
|
||||
20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */,
|
||||
195DF8CFFE9D517E11CA2CBB /* Products */,
|
||||
527F24260B5D938C007840A7 /* Info.plist */,
|
||||
);
|
||||
name = X11;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
20286C2AFDCF999611CA2CEA /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50EE2AB703849F0B0ECA21EC /* bundle-main.c */,
|
||||
);
|
||||
name = Sources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
20286C2CFDCF999611CA2CEA /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50459C5F038587C60ECA21EC /* X11.icns */,
|
||||
0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */,
|
||||
02345980000FD03B11CA0E72 /* main.nib */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */,
|
||||
570C5748047186C400ACF82F /* SystemConfiguration.framework */,
|
||||
);
|
||||
name = "External Frameworks and Libraries";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
527F24170B5D938C007840A7 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
527F24160B5D938C007840A7 /* X11 */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */;
|
||||
buildPhases = (
|
||||
527F24170B5D938C007840A7 /* Headers */,
|
||||
527F24180B5D938C007840A7 /* Resources */,
|
||||
527F241C0B5D938C007840A7 /* Sources */,
|
||||
527F241E0B5D938C007840A7 /* Frameworks */,
|
||||
527F24210B5D938C007840A7 /* Rez */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = X11;
|
||||
productName = X11;
|
||||
productReference = 527F24270B5D938C007840A7 /* X11.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
20286C28FDCF999611CA2CEA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */;
|
||||
compatibilityVersion = "Xcode 2.4";
|
||||
hasScannedForEncodings = 1;
|
||||
mainGroup = 20286C29FDCF999611CA2CEA /* X11 */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
shouldCheckCompatibility = 1;
|
||||
targets = (
|
||||
527F24160B5D938C007840A7 /* X11 */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
527F24180B5D938C007840A7 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
527F24370B5D9D89007840A7 /* Info.plist in Resources */,
|
||||
527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */,
|
||||
527F241A0B5D938C007840A7 /* main.nib in Resources */,
|
||||
527F241B0B5D938C007840A7 /* X11.icns in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXRezBuildPhase section */
|
||||
527F24210B5D938C007840A7 /* Rez */ = {
|
||||
isa = PBXRezBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXRezBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
527F241C0B5D938C007840A7 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
527F241D0B5D938C007840A7 /* bundle-main.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
02345980000FD03B11CA0E72 /* main.nib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
1870340FFE93FCAF11CA0CD7 /* English */,
|
||||
);
|
||||
name = main.nib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
0867D6ABFE840B52C02AAC07 /* English */,
|
||||
);
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
527F24090B5D8FFC007840A7 /* Development */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DSTROOT = "$(DSTROOT)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Development;
|
||||
};
|
||||
527F240A0B5D8FFC007840A7 /* Deployment */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DSTROOT = "$(DSTROOT)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Deployment;
|
||||
};
|
||||
527F240B0B5D8FFC007840A7 /* Default */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DSTROOT = "$(DSTROOT)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Default;
|
||||
};
|
||||
527F24230B5D938C007840A7 /* Development */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH_32_BIT)";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DSTROOT = "$(DSTROOT)";
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = $DSTROOT/Applications/Utilties;
|
||||
LIBRARY_SEARCH_PATHS = "";
|
||||
OTHER_CFLAGS = "$(CFLAGS)";
|
||||
OTHER_LDFLAGS = "$(LDFLAGS)";
|
||||
OTHER_REZFLAGS = "";
|
||||
PRODUCT_NAME = X11;
|
||||
SECTORDER_FLAGS = "";
|
||||
WARNING_CFLAGS = (
|
||||
"-Wmost",
|
||||
"-Wno-four-char-constants",
|
||||
"-Wno-unknown-pragmas",
|
||||
);
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Development;
|
||||
};
|
||||
527F24240B5D938C007840A7 /* Deployment */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DSTROOT = "$(DSTROOT)";
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = $DSTROOT/Applications/Utilties;
|
||||
LIBRARY_SEARCH_PATHS = "";
|
||||
OTHER_CFLAGS = "$(CFLAGS)";
|
||||
OTHER_LDFLAGS = "$(LDFLAGS)";
|
||||
OTHER_REZFLAGS = "";
|
||||
PRODUCT_NAME = X11;
|
||||
SECTORDER_FLAGS = "";
|
||||
WARNING_CFLAGS = (
|
||||
"-Wmost",
|
||||
"-Wno-four-char-constants",
|
||||
"-Wno-unknown-pragmas",
|
||||
);
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Deployment;
|
||||
};
|
||||
527F24250B5D938C007840A7 /* Default */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DSTROOT = "$(DSTROOT)";
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = $DSTROOT/Applications/Utilties;
|
||||
LIBRARY_SEARCH_PATHS = "";
|
||||
OTHER_CFLAGS = "$(CFLAGS)";
|
||||
OTHER_LDFLAGS = "$(LDFLAGS)";
|
||||
OTHER_REZFLAGS = "";
|
||||
PRODUCT_NAME = X11;
|
||||
SECTORDER_FLAGS = "";
|
||||
WARNING_CFLAGS = (
|
||||
"-Wmost",
|
||||
"-Wno-four-char-constants",
|
||||
"-Wno-unknown-pragmas",
|
||||
);
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Default;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
527F24090B5D8FFC007840A7 /* Development */,
|
||||
527F240A0B5D8FFC007840A7 /* Deployment */,
|
||||
527F240B0B5D8FFC007840A7 /* Default */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Default;
|
||||
};
|
||||
527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
527F24230B5D938C007840A7 /* Development */,
|
||||
527F24240B5D938C007840A7 /* Deployment */,
|
||||
527F24250B5D938C007840A7 /* Default */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Default;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 20286C28FDCF999611CA2CEA /* Project object */;
|
||||
}
|
104
hw/darwin/apple/X11Application.h
Normal file
104
hw/darwin/apple/X11Application.h
Normal file
|
@ -0,0 +1,104 @@
|
|||
/* X11Application.h -- subclass of NSApplication to multiplex events
|
||||
$Id: X11Application.h,v 1.26 2003/08/08 19:16:13 jharper Exp $
|
||||
|
||||
Copyright (c) 2002-2007 Apple Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization. */
|
||||
|
||||
#ifndef X11APPLICATION_H
|
||||
#define X11APPLICATION_H 1
|
||||
|
||||
#if __OBJC__
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "X11Controller.h"
|
||||
|
||||
@interface X11Application : NSApplication {
|
||||
X11Controller *_controller;
|
||||
|
||||
unsigned int _x_active :1;
|
||||
}
|
||||
|
||||
- (void) set_controller:controller;
|
||||
- (void) set_window_menu:(NSArray *)list;
|
||||
|
||||
- (int) prefs_get_integer:(NSString *)key default:(int)def;
|
||||
- (const char *) prefs_get_string:(NSString *)key default:(const char *)def;
|
||||
- (float) prefs_get_float:(NSString *)key default:(float)def;
|
||||
- (int) prefs_get_boolean:(NSString *)key default:(int)def;
|
||||
- (NSArray *) prefs_get_array:(NSString *)key;
|
||||
- (void) prefs_set_integer:(NSString *)key value:(int)value;
|
||||
- (void) prefs_set_float:(NSString *)key value:(float)value;
|
||||
- (void) prefs_set_boolean:(NSString *)key value:(int)value;
|
||||
- (void) prefs_set_array:(NSString *)key value:(NSArray *)value;
|
||||
- (void) prefs_set_string:(NSString *)key value:(NSString *)value;
|
||||
- (void) prefs_synchronize;
|
||||
|
||||
- (BOOL) x_active;
|
||||
|
||||
@end
|
||||
|
||||
extern X11Application *X11App;
|
||||
|
||||
#endif /* __OBJC__ */
|
||||
|
||||
extern void X11ApplicationSetWindowMenu (int nitems, const char **items,
|
||||
const char *shortcuts);
|
||||
extern void X11ApplicationSetWindowMenuCheck (int idx);
|
||||
extern void X11ApplicationSetFrontProcess (void);
|
||||
extern void X11ApplicationSetCanQuit (int state);
|
||||
extern void X11ApplicationServerReady (void);
|
||||
extern void X11ApplicationShowHideMenubar (int state);
|
||||
|
||||
extern void X11ApplicationMain (int argc, const char *argv[],
|
||||
void (*server_thread) (void *),
|
||||
void *server_arg);
|
||||
|
||||
extern int X11EnableKeyEquivalents;
|
||||
extern int quartzHasRoot, quartzEnableRootless;
|
||||
|
||||
#define APP_PREFS "com.apple.x11"
|
||||
|
||||
#define PREFS_APPSMENU "apps_menu"
|
||||
#define PREFS_FAKEBUTTONS "enable_fake_buttons"
|
||||
#define PREFS_SYSBEEP "enable_system_beep"
|
||||
#define PREFS_KEYEQUIVS "enable_key_equivalents"
|
||||
#define PREFS_KEYMAP_FILE "keymap_file"
|
||||
#define PREFS_SYNC_KEYMAP "sync_keymap"
|
||||
#define PREFS_DEPTH "depth"
|
||||
#define PREFS_NO_AUTH "no_auth"
|
||||
#define PREFS_NO_TCP "nolisten_tcp"
|
||||
#define PREFS_DONE_XINIT_CHECK "done_xinit_check"
|
||||
#define PREFS_NO_QUIT_ALERT "no_quit_alert"
|
||||
#define PREFS_FAKE_BUTTON2 "fake_button2"
|
||||
#define PREFS_FAKE_BUTTON3 "fake_button3"
|
||||
#define PREFS_ROOTLESS "rootless"
|
||||
#define PREFS_FULLSCREEN_HOTKEYS "fullscreen_hotkeys"
|
||||
#define PREFS_SWAP_ALT_META "swap_alt_meta"
|
||||
#define PREFS_XP_OPTIONS "xp_options"
|
||||
#define PREFS_ENABLE_STEREO "enable_stereo"
|
||||
|
||||
#endif /* X11APPLICATION_H */
|
972
hw/darwin/apple/X11Application.m
Normal file
972
hw/darwin/apple/X11Application.m
Normal file
|
@ -0,0 +1,972 @@
|
|||
/* X11Application.m -- subclass of NSApplication to multiplex events
|
||||
|
||||
Copyright (c) 2002-2007 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization. */
|
||||
|
||||
#include "../quartz/quartzCommon.h"
|
||||
|
||||
#import "X11Application.h"
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
/* ouch! */
|
||||
#define BOOL X_BOOL
|
||||
# include "darwin.h"
|
||||
# include "../quartz/quartz.h"
|
||||
# define _APPLEWM_SERVER_
|
||||
# include "X11/extensions/applewm.h"
|
||||
# include "micmap.h"
|
||||
#undef BOOL
|
||||
|
||||
#include "xf86Version.h"
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define DEFAULTS_FILE "/etc/X11/xserver/Xquartz.plist"
|
||||
|
||||
int X11EnableKeyEquivalents = TRUE;
|
||||
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
|
||||
|
||||
extern int darwinFakeButtons, input_check_flag;
|
||||
// extern Bool enable_stereo;
|
||||
Bool enable_stereo; //<-- this needs to go back to being an extern once glxCGL is fixed
|
||||
|
||||
extern xEvent *darwinEvents;
|
||||
|
||||
X11Application *X11App;
|
||||
|
||||
#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)
|
||||
|
||||
@implementation X11Application
|
||||
|
||||
typedef struct message_struct message;
|
||||
struct message_struct {
|
||||
mach_msg_header_t hdr;
|
||||
SEL selector;
|
||||
NSObject *arg;
|
||||
};
|
||||
|
||||
static mach_port_t _port;
|
||||
|
||||
static void send_nsevent (NSEventType type, NSEvent *e);
|
||||
|
||||
/* Quartz mode initialization routine. This is often dynamically loaded
|
||||
but is statically linked into this X server. */
|
||||
extern Bool QuartzModeBundleInit(void);
|
||||
|
||||
static void init_ports (void) {
|
||||
kern_return_t r;
|
||||
NSPort *p;
|
||||
|
||||
if (_port != MACH_PORT_NULL) return;
|
||||
|
||||
r = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &_port);
|
||||
if (r != KERN_SUCCESS) return;
|
||||
|
||||
p = [NSMachPort portWithMachPort:_port];
|
||||
[p setDelegate:NSApp];
|
||||
[p scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
||||
}
|
||||
|
||||
static void message_kit_thread (SEL selector, NSObject *arg) {
|
||||
message msg;
|
||||
kern_return_t r;
|
||||
|
||||
msg.hdr.msgh_bits = MACH_MSGH_BITS (MACH_MSG_TYPE_MAKE_SEND, 0);
|
||||
msg.hdr.msgh_size = sizeof (msg);
|
||||
msg.hdr.msgh_remote_port = _port;
|
||||
msg.hdr.msgh_local_port = MACH_PORT_NULL;
|
||||
msg.hdr.msgh_reserved = 0;
|
||||
msg.hdr.msgh_id = 0;
|
||||
|
||||
msg.selector = selector;
|
||||
msg.arg = [arg retain];
|
||||
|
||||
r = mach_msg (&msg.hdr, MACH_SEND_MSG, msg.hdr.msgh_size,
|
||||
0, MACH_PORT_NULL, 0, MACH_PORT_NULL);
|
||||
if (r != KERN_SUCCESS)
|
||||
ErrorF("%s: mach_msg failed: %x\n", __FUNCTION__, r);
|
||||
}
|
||||
|
||||
- (void) handleMachMessage:(void *)_msg {
|
||||
message *msg = _msg;
|
||||
|
||||
[self performSelector:msg->selector withObject:msg->arg];
|
||||
[msg->arg release];
|
||||
}
|
||||
|
||||
- (void) set_controller:obj {
|
||||
if (_controller == nil) _controller = [obj retain];
|
||||
}
|
||||
|
||||
- (void) dealloc {
|
||||
if (_controller != nil) [_controller release];
|
||||
|
||||
if (_port != MACH_PORT_NULL)
|
||||
mach_port_deallocate (mach_task_self (), _port);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) orderFrontStandardAboutPanel: (id) sender {
|
||||
NSMutableDictionary *dict;
|
||||
NSDictionary *infoDict;
|
||||
NSString *tem;
|
||||
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity:2];
|
||||
infoDict = [[NSBundle mainBundle] infoDictionary];
|
||||
|
||||
[dict setObject: NSLocalizedString (@"The X Window System", @"About panel")
|
||||
forKey:@"ApplicationName"];
|
||||
|
||||
tem = [infoDict objectForKey:@"CFBundleShortVersionString"];
|
||||
|
||||
[dict setObject:[NSString stringWithFormat:@"X11.app %@ - X.org X11R7.3", tem]
|
||||
forKey:@"ApplicationVersion"];
|
||||
|
||||
[self orderFrontStandardAboutPanelWithOptions: dict];
|
||||
}
|
||||
|
||||
- (void) activateX:(BOOL)state {
|
||||
/* Create a TSM document that supports full Unicode input, and
|
||||
have it activated while X is active (unless using the old
|
||||
keymapping files) */
|
||||
static TSMDocumentID x11_document;
|
||||
|
||||
if (state) {
|
||||
QuartzMessageServerThread (kXDarwinActivate, 0);
|
||||
|
||||
if (!_x_active) {
|
||||
if (x11_document == 0 && darwinKeymapFile == NULL) {
|
||||
OSType types[1];
|
||||
types[0] = kUnicodeDocument;
|
||||
NewTSMDocument (1, types, &x11_document, 0);
|
||||
}
|
||||
|
||||
if (x11_document != 0) ActivateTSMDocument (x11_document);
|
||||
}
|
||||
} else {
|
||||
QuartzMessageServerThread (kXDarwinDeactivate, 0);
|
||||
|
||||
if (_x_active && x11_document != 0)
|
||||
DeactivateTSMDocument (x11_document);
|
||||
}
|
||||
|
||||
_x_active = state;
|
||||
}
|
||||
|
||||
- (void) became_key:(NSWindow *)win {
|
||||
[self activateX:NO];
|
||||
}
|
||||
|
||||
- (void) sendEvent:(NSEvent *)e {
|
||||
NSEventType type;
|
||||
BOOL for_appkit, for_x;
|
||||
|
||||
type = [e type];
|
||||
|
||||
/* By default pass down the responder chain and to X. */
|
||||
for_appkit = YES;
|
||||
for_x = YES;
|
||||
|
||||
switch (type) {
|
||||
case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
|
||||
case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
|
||||
if ([e window] != nil) {
|
||||
/* Pointer event has a window. Probably something for the kit. */
|
||||
|
||||
for_x = NO;
|
||||
|
||||
if (_x_active) [self activateX:NO];
|
||||
} else if ([self modalWindow] == nil) {
|
||||
/* Must be an X window. Tell appkit it doesn't have focus. */
|
||||
|
||||
for_appkit = NO;
|
||||
|
||||
if ([self isActive]) {
|
||||
[self deactivate];
|
||||
|
||||
if (!_x_active && quartzProcs->IsX11Window([e window], [e windowNumber]))
|
||||
[self activateX:YES];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NSKeyDown: case NSKeyUp:
|
||||
if (_x_active) {
|
||||
static int swallow_up;
|
||||
|
||||
/* No kit window is focused, so send it to X. */
|
||||
|
||||
for_appkit = NO;
|
||||
|
||||
if (type == NSKeyDown) {
|
||||
/* Before that though, see if there are any global
|
||||
shortcuts bound to it. */
|
||||
|
||||
if (X11EnableKeyEquivalents
|
||||
&& [[self mainMenu] performKeyEquivalent:e]) {
|
||||
swallow_up = [e keyCode];
|
||||
for_x = NO;
|
||||
} else if (!quartzEnableRootless
|
||||
&& ([e modifierFlags] & ALL_KEY_MASKS)
|
||||
== (NSCommandKeyMask | NSAlternateKeyMask)
|
||||
&& ([e keyCode] == 0 /*a*/
|
||||
|| [e keyCode] == 53 /*Esc*/)) {
|
||||
swallow_up = 0;
|
||||
for_x = NO;
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
QuartzMessageServerThread (kXDarwinToggleFullscreen, 0);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
/* If we saw a key equivalent on the down, don't pass
|
||||
the up through to X. */
|
||||
|
||||
if (swallow_up != 0 && [e keyCode] == swallow_up) {
|
||||
swallow_up = 0;
|
||||
for_x = NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
else for_x = NO;
|
||||
break;
|
||||
|
||||
case NSFlagsChanged:
|
||||
/* For the l33t X users who remap modifier keys to normal keysyms. */
|
||||
if (!_x_active)
|
||||
for_x = NO;
|
||||
break;
|
||||
|
||||
case NSAppKitDefined:
|
||||
switch ([e subtype]) {
|
||||
case NSApplicationActivatedEventType:
|
||||
for_x = NO;
|
||||
if ([self modalWindow] == nil) {
|
||||
for_appkit = NO;
|
||||
|
||||
/* FIXME: hack to avoid having to pass the event to appkit,
|
||||
which would cause it to raise one of its windows. */
|
||||
_appFlags._active = YES;
|
||||
|
||||
[self activateX:YES];
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
if ([e data2] & 0x10) QuartzMessageServerThread (kXDarwinBringAllToFront, 0);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case 18: /* ApplicationDidReactivate */
|
||||
if (quartzHasRoot) for_appkit = NO;
|
||||
break;
|
||||
|
||||
case NSApplicationDeactivatedEventType:
|
||||
for_x = NO;
|
||||
[self activateX:NO];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default: break; /* for gcc */
|
||||
}
|
||||
|
||||
if (for_appkit) [super sendEvent:e];
|
||||
if (for_x) send_nsevent (type, e);
|
||||
}
|
||||
|
||||
- (void) set_window_menu:(NSArray *)list {
|
||||
[_controller set_window_menu:list];
|
||||
}
|
||||
|
||||
- (void) set_window_menu_check:(NSNumber *)n {
|
||||
[_controller set_window_menu_check:n];
|
||||
}
|
||||
|
||||
- (void) set_apps_menu:(NSArray *)list {
|
||||
[_controller set_apps_menu:list];
|
||||
}
|
||||
|
||||
- (void) set_front_process:unused {
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
if ([self modalWindow] == nil) [self activateX:YES];
|
||||
}
|
||||
|
||||
- (void) set_can_quit:(NSNumber *)state {
|
||||
[_controller set_can_quit:[state boolValue]];
|
||||
}
|
||||
|
||||
- (void) server_ready:unused {
|
||||
[_controller server_ready];
|
||||
}
|
||||
|
||||
- (void) show_hide_menubar:(NSNumber *)state {
|
||||
if ([state boolValue]) ShowMenuBar ();
|
||||
else HideMenuBar ();
|
||||
}
|
||||
|
||||
|
||||
/* user preferences */
|
||||
|
||||
/* Note that these functions only work for arrays whose elements
|
||||
can be toll-free-bridged between NS and CF worlds. */
|
||||
|
||||
static const void *cfretain (CFAllocatorRef a, const void *b) {
|
||||
return CFRetain (b);
|
||||
}
|
||||
|
||||
static void cfrelease (CFAllocatorRef a, const void *b) {
|
||||
CFRelease (b);
|
||||
}
|
||||
|
||||
static CFMutableArrayRef nsarray_to_cfarray (NSArray *in) {
|
||||
CFMutableArrayRef out;
|
||||
CFArrayCallBacks cb;
|
||||
NSObject *ns;
|
||||
const CFTypeRef *cf;
|
||||
int i, count;
|
||||
|
||||
memset (&cb, 0, sizeof (cb));
|
||||
cb.version = 0;
|
||||
cb.retain = cfretain;
|
||||
cb.release = cfrelease;
|
||||
|
||||
count = [in count];
|
||||
out = CFArrayCreateMutable (NULL, count, &cb);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
ns = [in objectAtIndex:i];
|
||||
|
||||
if ([ns isKindOfClass:[NSArray class]])
|
||||
cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns);
|
||||
else
|
||||
cf = CFRetain ((CFTypeRef) ns);
|
||||
|
||||
CFArrayAppendValue (out, cf);
|
||||
CFRelease (cf);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
|
||||
NSMutableArray *out;
|
||||
const CFTypeRef *cf;
|
||||
NSObject *ns;
|
||||
int i, count;
|
||||
|
||||
count = CFArrayGetCount (in);
|
||||
out = [[NSMutableArray alloc] initWithCapacity:count];
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
cf = CFArrayGetValueAtIndex (in, i);
|
||||
|
||||
if (CFGetTypeID (cf) == CFArrayGetTypeID ())
|
||||
ns = cfarray_to_nsarray ((CFArrayRef) cf);
|
||||
else
|
||||
ns = [(id)cf retain];
|
||||
|
||||
[out addObject:ns];
|
||||
[ns release];
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
- (CFPropertyListRef) prefs_get:(NSString *)key {
|
||||
CFPropertyListRef value;
|
||||
|
||||
value = CFPreferencesCopyAppValue ((CFStringRef) key, CFSTR (APP_PREFS));
|
||||
|
||||
if (value == NULL) {
|
||||
static CFDictionaryRef defaults;
|
||||
|
||||
if (defaults == NULL) {
|
||||
CFStringRef error = NULL;
|
||||
CFDataRef data;
|
||||
CFURLRef url;
|
||||
SInt32 error_code;
|
||||
|
||||
url = (CFURLCreateFromFileSystemRepresentation
|
||||
(NULL, (unsigned char *)DEFAULTS_FILE, strlen (DEFAULTS_FILE), false));
|
||||
if (CFURLCreateDataAndPropertiesFromResource (NULL, url, &data,
|
||||
NULL, NULL, &error_code)) {
|
||||
defaults = (CFPropertyListCreateFromXMLData
|
||||
(NULL, data, kCFPropertyListMutableContainersAndLeaves, &error));
|
||||
if (error != NULL) CFRelease (error);
|
||||
CFRelease (data);
|
||||
}
|
||||
CFRelease (url);
|
||||
|
||||
if (defaults != NULL) {
|
||||
NSMutableArray *apps, *elt;
|
||||
int count, i;
|
||||
NSString *name, *nname;
|
||||
|
||||
/* Localize the names in the default apps menu. */
|
||||
|
||||
apps = [(NSDictionary *)defaults objectForKey:@PREFS_APPSMENU];
|
||||
if (apps != nil) {
|
||||
count = [apps count];
|
||||
for (i = 0; i < count; i++) {
|
||||
elt = [apps objectAtIndex:i];
|
||||
if (elt != nil && [elt isKindOfClass:[NSArray class]]) {
|
||||
name = [elt objectAtIndex:0];
|
||||
if (name != nil) {
|
||||
nname = NSLocalizedString (name, nil);
|
||||
if (nname != nil && nname != name)
|
||||
[elt replaceObjectAtIndex:0 withObject:nname];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (defaults != NULL) value = CFDictionaryGetValue (defaults, key);
|
||||
if (value != NULL) CFRetain (value);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
- (int) prefs_get_integer:(NSString *)key default:(int)def {
|
||||
CFPropertyListRef value;
|
||||
int ret;
|
||||
|
||||
value = [self prefs_get:key];
|
||||
|
||||
if (value != NULL && CFGetTypeID (value) == CFNumberGetTypeID ())
|
||||
CFNumberGetValue (value, kCFNumberIntType, &ret);
|
||||
else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ())
|
||||
ret = CFStringGetIntValue (value);
|
||||
else
|
||||
ret = def;
|
||||
|
||||
if (value != NULL) CFRelease (value);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (const char *) prefs_get_string:(NSString *)key default:(const char *)def {
|
||||
CFPropertyListRef value;
|
||||
const char *ret = NULL;
|
||||
|
||||
value = [self prefs_get:key];
|
||||
|
||||
if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) {
|
||||
NSString *s = (NSString *) value;
|
||||
|
||||
ret = [s UTF8String];
|
||||
}
|
||||
|
||||
if (value != NULL) CFRelease (value);
|
||||
|
||||
return ret != NULL ? ret : def;
|
||||
}
|
||||
|
||||
- (float) prefs_get_float:(NSString *)key default:(float)def {
|
||||
CFPropertyListRef value;
|
||||
float ret = def;
|
||||
|
||||
value = [self prefs_get:key];
|
||||
|
||||
if (value != NULL
|
||||
&& CFGetTypeID (value) == CFNumberGetTypeID ()
|
||||
&& CFNumberIsFloatType (value))
|
||||
CFNumberGetValue (value, kCFNumberFloatType, &ret);
|
||||
else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ())
|
||||
ret = CFStringGetDoubleValue (value);
|
||||
|
||||
if (value != NULL) CFRelease (value);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (int) prefs_get_boolean:(NSString *)key default:(int)def {
|
||||
CFPropertyListRef value;
|
||||
int ret = def;
|
||||
|
||||
value = [self prefs_get:key];
|
||||
|
||||
if (value != NULL) {
|
||||
if (CFGetTypeID (value) == CFNumberGetTypeID ())
|
||||
CFNumberGetValue (value, kCFNumberIntType, &ret);
|
||||
else if (CFGetTypeID (value) == CFBooleanGetTypeID ())
|
||||
ret = CFBooleanGetValue (value);
|
||||
else if (CFGetTypeID (value) == CFStringGetTypeID ()) {
|
||||
const char *tem = [(NSString *) value lossyCString];
|
||||
if (strcasecmp (tem, "true") == 0 || strcasecmp (tem, "yes") == 0)
|
||||
ret = YES;
|
||||
else
|
||||
ret = NO;
|
||||
}
|
||||
|
||||
CFRelease (value);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (NSArray *) prefs_get_array:(NSString *)key {
|
||||
NSArray *ret = nil;
|
||||
CFPropertyListRef value;
|
||||
|
||||
value = [self prefs_get:key];
|
||||
|
||||
if (value != NULL) {
|
||||
if (CFGetTypeID (value) == CFArrayGetTypeID ())
|
||||
ret = [cfarray_to_nsarray (value) autorelease];
|
||||
|
||||
CFRelease (value);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (void) prefs_set_integer:(NSString *)key value:(int)value {
|
||||
CFNumberRef x;
|
||||
|
||||
x = CFNumberCreate (NULL, kCFNumberIntType, &value);
|
||||
|
||||
CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS),
|
||||
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||
|
||||
CFRelease (x);
|
||||
}
|
||||
|
||||
- (void) prefs_set_float:(NSString *)key value:(float)value {
|
||||
CFNumberRef x;
|
||||
|
||||
x = CFNumberCreate (NULL, kCFNumberFloatType, &value);
|
||||
|
||||
CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS),
|
||||
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||
|
||||
CFRelease (x);
|
||||
}
|
||||
|
||||
- (void) prefs_set_boolean:(NSString *)key value:(int)value {
|
||||
CFPreferencesSetValue ((CFStringRef) key,
|
||||
(CFTypeRef) value ? kCFBooleanTrue
|
||||
: kCFBooleanFalse, CFSTR (APP_PREFS),
|
||||
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||
|
||||
}
|
||||
|
||||
- (void) prefs_set_array:(NSString *)key value:(NSArray *)value {
|
||||
CFArrayRef cfarray;
|
||||
|
||||
cfarray = nsarray_to_cfarray (value);
|
||||
CFPreferencesSetValue ((CFStringRef) key,
|
||||
(CFTypeRef) cfarray,
|
||||
CFSTR (APP_PREFS),
|
||||
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||
CFRelease (cfarray);
|
||||
}
|
||||
|
||||
- (void) prefs_set_string:(NSString *)key value:(NSString *)value {
|
||||
CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) value,
|
||||
CFSTR (APP_PREFS), kCFPreferencesCurrentUser,
|
||||
kCFPreferencesAnyHost);
|
||||
}
|
||||
|
||||
- (void) prefs_synchronize {
|
||||
CFPreferencesAppSynchronize (kCFPreferencesCurrentApplication);
|
||||
}
|
||||
|
||||
- (void) read_defaults {
|
||||
const char *tem;
|
||||
|
||||
quartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP
|
||||
default:quartzUseSysBeep];
|
||||
quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS
|
||||
default:quartzEnableRootless];
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
quartzFullscreenDisableHotkeys = ![self prefs_get_boolean:
|
||||
@PREFS_FULLSCREEN_HOTKEYS default:
|
||||
!quartzFullscreenDisableHotkeys];
|
||||
quartzXpluginOptions = [self prefs_get_integer:@PREFS_XP_OPTIONS
|
||||
default:quartzXpluginOptions];
|
||||
#endif
|
||||
|
||||
darwinSwapAltMeta = [self prefs_get_boolean:@PREFS_SWAP_ALT_META
|
||||
default:darwinSwapAltMeta];
|
||||
darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS
|
||||
default:darwinFakeButtons];
|
||||
if (darwinFakeButtons) {
|
||||
const char *fake2, *fake3;
|
||||
|
||||
fake2 = [self prefs_get_string:@PREFS_FAKE_BUTTON2 default:NULL];
|
||||
fake3 = [self prefs_get_string:@PREFS_FAKE_BUTTON3 default:NULL];
|
||||
|
||||
if (fake2 != NULL) darwinFakeMouse2Mask = DarwinParseModifierList(fake2);
|
||||
if (fake3 != NULL) darwinFakeMouse3Mask = DarwinParseModifierList(fake3);
|
||||
|
||||
}
|
||||
|
||||
X11EnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS
|
||||
default:X11EnableKeyEquivalents];
|
||||
|
||||
darwinSyncKeymap = [self prefs_get_boolean:@PREFS_SYNC_KEYMAP
|
||||
default:darwinSyncKeymap];
|
||||
|
||||
tem = [self prefs_get_string:@PREFS_KEYMAP_FILE default:NULL];
|
||||
|
||||
if (tem != NULL) darwinKeymapFile = strdup (tem);
|
||||
else darwinKeymapFile = NULL;
|
||||
|
||||
darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH
|
||||
default:darwinDesiredDepth];
|
||||
|
||||
enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO
|
||||
default:false];
|
||||
}
|
||||
|
||||
/* This will end up at the end of the responder chain. */
|
||||
- (void) copy:sender {
|
||||
QuartzMessageServerThread (kXDarwinPasteboardNotify, 1,
|
||||
AppleWMCopyToPasteboard);
|
||||
}
|
||||
|
||||
- (BOOL) x_active {
|
||||
return _x_active;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static NSArray *
|
||||
array_with_strings_and_numbers (int nitems, const char **items,
|
||||
const char *numbers) {
|
||||
NSMutableArray *array, *subarray;
|
||||
NSString *string, *number;
|
||||
int i;
|
||||
|
||||
/* (Can't autorelease on the X server thread) */
|
||||
|
||||
array = [[NSMutableArray alloc] initWithCapacity:nitems];
|
||||
|
||||
for (i = 0; i < nitems; i++) {
|
||||
subarray = [[NSMutableArray alloc] initWithCapacity:2];
|
||||
|
||||
string = [[NSString alloc] initWithUTF8String:items[i]];
|
||||
[subarray addObject:string];
|
||||
[string release];
|
||||
|
||||
if (numbers[i] != 0) {
|
||||
number = [[NSString alloc] initWithFormat:@"%d", numbers[i]];
|
||||
[subarray addObject:number];
|
||||
[number release];
|
||||
} else
|
||||
[subarray addObject:@""];
|
||||
|
||||
[array addObject:subarray];
|
||||
[subarray release];
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
void X11ApplicationSetWindowMenu (int nitems, const char **items,
|
||||
const char *shortcuts) {
|
||||
NSArray *array;
|
||||
array = array_with_strings_and_numbers (nitems, items, shortcuts);
|
||||
|
||||
/* Send the array of strings over to the appkit thread */
|
||||
|
||||
message_kit_thread (@selector (set_window_menu:), array);
|
||||
[array release];
|
||||
}
|
||||
|
||||
void X11ApplicationSetWindowMenuCheck (int idx) {
|
||||
NSNumber *n;
|
||||
|
||||
n = [[NSNumber alloc] initWithInt:idx];
|
||||
|
||||
message_kit_thread (@selector (set_window_menu_check:), n);
|
||||
|
||||
[n release];
|
||||
}
|
||||
|
||||
void X11ApplicationSetFrontProcess (void) {
|
||||
message_kit_thread (@selector (set_front_process:), nil);
|
||||
}
|
||||
|
||||
void X11ApplicationSetCanQuit (int state) {
|
||||
NSNumber *n;
|
||||
|
||||
n = [[NSNumber alloc] initWithBool:state];
|
||||
|
||||
message_kit_thread (@selector (set_can_quit:), n);
|
||||
|
||||
[n release];
|
||||
}
|
||||
|
||||
void X11ApplicationServerReady (void) {
|
||||
message_kit_thread (@selector (server_ready:), nil);
|
||||
}
|
||||
|
||||
void X11ApplicationShowHideMenubar (int state) {
|
||||
NSNumber *n;
|
||||
|
||||
n = [[NSNumber alloc] initWithBool:state];
|
||||
|
||||
message_kit_thread (@selector (show_hide_menubar:), n);
|
||||
|
||||
[n release];
|
||||
}
|
||||
|
||||
static void * create_thread (void *func, void *arg) {
|
||||
pthread_attr_t attr;
|
||||
pthread_t tid;
|
||||
|
||||
pthread_attr_init (&attr);
|
||||
pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
|
||||
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
|
||||
pthread_create (&tid, &attr, func, arg);
|
||||
pthread_attr_destroy (&attr);
|
||||
|
||||
return (void *) tid;
|
||||
}
|
||||
|
||||
static void check_xinitrc (void) {
|
||||
char *tem, buf[1024];
|
||||
NSString *msg;
|
||||
|
||||
if ([X11App prefs_get_boolean:@PREFS_DONE_XINIT_CHECK default:NO])
|
||||
return;
|
||||
|
||||
tem = getenv ("HOME");
|
||||
if (tem == NULL) goto done;
|
||||
|
||||
snprintf (buf, sizeof (buf), "%s/.xinitrc", tem);
|
||||
if (access (buf, F_OK) != 0)
|
||||
goto done;
|
||||
|
||||
/* FIXME: put localized strings into Resources/English.lproj */
|
||||
|
||||
msg = NSLocalizedString (@"You have an existing ~/.xinitrc file.\n\n\
|
||||
Windows displayed by X11 applications may not have titlebars, or may look \
|
||||
different to windows displayed by native applications.\n\n\
|
||||
Would you like to move aside the existing file and use the standard X11 \
|
||||
environment?", @"Startup xinitrc dialog");
|
||||
|
||||
if (NSRunAlertPanel (nil, msg, NSLocalizedString (@"Yes", @""),
|
||||
NSLocalizedString (@"No", @""), nil)
|
||||
== NSAlertDefaultReturn) {
|
||||
char buf2[1024];
|
||||
int i = -1;
|
||||
|
||||
snprintf (buf2, sizeof (buf2), "%s.old", buf);
|
||||
|
||||
for (i = 1; access (buf2, F_OK) == 0; i++)
|
||||
snprintf (buf2, sizeof (buf2), "%s.old.%d", buf, i);
|
||||
|
||||
rename (buf, buf2);
|
||||
}
|
||||
|
||||
done:
|
||||
[X11App prefs_set_boolean:@PREFS_DONE_XINIT_CHECK value:YES];
|
||||
[X11App prefs_synchronize];
|
||||
}
|
||||
|
||||
void X11ApplicationMain (int argc, const char *argv[],
|
||||
void (*server_thread) (void *), void *server_arg) {
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
#ifdef DEBUG
|
||||
while (access ("/tmp/x11-block", F_OK) == 0) sleep (1);
|
||||
#endif
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
X11App = (X11Application *) [X11Application sharedApplication];
|
||||
|
||||
init_ports ();
|
||||
|
||||
[NSApp read_defaults];
|
||||
|
||||
[NSBundle loadNibNamed:@"main" owner:NSApp];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:NSApp
|
||||
selector:@selector (became_key:)
|
||||
name:NSWindowDidBecomeKeyNotification object:nil];
|
||||
|
||||
check_xinitrc ();
|
||||
|
||||
/*
|
||||
* The xpr Quartz mode is statically linked into this server.
|
||||
* Initialize all the Quartz functions.
|
||||
*/
|
||||
QuartzModeBundleInit();
|
||||
|
||||
/* Calculate the height of the menubar so we can avoid it. */
|
||||
aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) -
|
||||
NSMaxY([[NSScreen mainScreen] visibleFrame]) - 1;
|
||||
|
||||
if (!create_thread (server_thread, server_arg)) {
|
||||
ErrorF("can't create secondary thread\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
[NSApp run];
|
||||
}
|
||||
|
||||
|
||||
/* event conversion */
|
||||
|
||||
static inline unsigned short
|
||||
convert_flags (unsigned int nsflags) {
|
||||
unsigned int xflags = 0;
|
||||
|
||||
if (nsflags == ~0) return 0xffff;
|
||||
|
||||
if (nsflags & NSAlphaShiftKeyMask) xflags |= LockMask;
|
||||
if (nsflags & NSShiftKeyMask) xflags |= ShiftMask;
|
||||
if (nsflags & NSControlKeyMask) xflags |= ControlMask;
|
||||
if (nsflags & NSAlternateKeyMask) xflags |= Mod1Mask;
|
||||
if (nsflags & NSCommandKeyMask) xflags |= Mod2Mask;
|
||||
/* FIXME: secondaryfn? */
|
||||
|
||||
return xflags;
|
||||
}
|
||||
|
||||
/* Sends a null byte down darwinEventWriteFD, which will cause the
|
||||
Dispatch() event loop to check out event queue */
|
||||
void DarwinPokeEQ(void) {
|
||||
char nullbyte=0;
|
||||
input_check_flag++;
|
||||
// <daniels> bushing: oh, i ... er ... christ.
|
||||
write(darwinEventWriteFD, &nullbyte, 1);
|
||||
}
|
||||
|
||||
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y) {
|
||||
int i;
|
||||
int valuators[2] = {pointer_x, pointer_y};
|
||||
int num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
|
||||
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||
|
||||
for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
|
||||
DarwinPokeEQ();
|
||||
}
|
||||
|
||||
void DarwinSendKeyboardEvents(int ev_type, int keycode) {
|
||||
int i;
|
||||
int num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
|
||||
for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&darwinEvents[i]);
|
||||
DarwinPokeEQ();
|
||||
}
|
||||
|
||||
/* Send the appropriate number of button 4 / 5 clicks to emulate scroll wheel */
|
||||
void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y) {
|
||||
int i;
|
||||
int ev_button = count > 0.0f ? 4 : 5;
|
||||
int valuators[2] = {pointer_x, pointer_y};
|
||||
|
||||
for (count = fabs(count); count > 0.0; count = count - 1.0f) {
|
||||
int num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonPress, ev_button,
|
||||
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||
for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
|
||||
num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonRelease, ev_button,
|
||||
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||
for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
|
||||
}
|
||||
DarwinPokeEQ();
|
||||
}
|
||||
|
||||
// This code should probably be merged with that in XDarwin's XServer.m - BB
|
||||
static void send_nsevent (NSEventType type, NSEvent *e) {
|
||||
// static unsigned int button_state = 0;
|
||||
NSRect screen;
|
||||
NSPoint location;
|
||||
NSWindow *window;
|
||||
int pointer_x, pointer_y, ev_button, ev_type;
|
||||
// int num_events=0, i=0, state;
|
||||
xEvent xe;
|
||||
|
||||
/* convert location to global top-left coordinates */
|
||||
location = [e locationInWindow];
|
||||
window = [e window];
|
||||
screen = [[[NSScreen screens] objectAtIndex:0] frame];
|
||||
|
||||
if (window != nil) {
|
||||
NSRect frame = [window frame];
|
||||
pointer_x = location.x + frame.origin.x;
|
||||
pointer_y = (((screen.origin.y + screen.size.height)
|
||||
- location.y) - frame.origin.y);
|
||||
} else {
|
||||
pointer_x = location.x;
|
||||
pointer_y = (screen.origin.y + screen.size.height) - location.y;
|
||||
}
|
||||
|
||||
pointer_y -= aquaMenuBarHeight;
|
||||
// state = convert_flags ([e modifierFlags]);
|
||||
|
||||
switch (type) {
|
||||
case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse;
|
||||
case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse;
|
||||
case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse;
|
||||
case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse;
|
||||
case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse;
|
||||
case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse;
|
||||
case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse;
|
||||
case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse;
|
||||
case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse;
|
||||
case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
|
||||
handle_mouse:
|
||||
|
||||
/* I'm not sure the below code is necessary or useful (-bb)
|
||||
if(ev_type==ButtonPress) {
|
||||
if (!quartzProcs->IsX11Window([e window], [e windowNumber])) {
|
||||
fprintf(stderr, "Dropping event because it's not a window\n");
|
||||
break;
|
||||
}
|
||||
button_state |= (1 << ev_button);
|
||||
DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y);
|
||||
} else if (ev_type==ButtonRelease && (button_state & (1 << ev_button)) == 0) break;
|
||||
*/
|
||||
DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y);
|
||||
break;
|
||||
case NSScrollWheel:
|
||||
DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y);
|
||||
break;
|
||||
|
||||
case NSKeyDown: // do we need to translate these keyCodes?
|
||||
case NSKeyUp:
|
||||
DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
|
||||
break;
|
||||
|
||||
case NSFlagsChanged:
|
||||
bzero(&xe, sizeof(xe));
|
||||
xe.u.u.type = kXDarwinUpdateModifiers;
|
||||
xe.u.clientMessage.u.l.longs0 = [e modifierFlags];
|
||||
DarwinEQEnqueue (&xe);
|
||||
DarwinPokeEQ();
|
||||
break;
|
||||
default: break; /* for gcc */
|
||||
}
|
||||
}
|
86
hw/darwin/apple/X11Controller.h
Normal file
86
hw/darwin/apple/X11Controller.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/* X11Controller.h -- connect the IB ui
|
||||
$Id: X11Controller.h,v 1.21 2003/07/24 17:52:29 jharper Exp $
|
||||
|
||||
Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization. */
|
||||
|
||||
#ifndef X11CONTROLLER_H
|
||||
#define X11CONTROLLER_H 1
|
||||
|
||||
#if __OBJC__
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include "../quartz/xpr/x-list.h"
|
||||
|
||||
@interface X11Controller : NSObject
|
||||
{
|
||||
NSPanel *prefs_panel;
|
||||
|
||||
NSButton *fake_buttons;
|
||||
NSButton *enable_fullscreen;
|
||||
NSButton *use_sysbeep;
|
||||
NSButton *enable_keyequivs;
|
||||
NSButton *sync_keymap;
|
||||
NSButton *enable_auth;
|
||||
NSButton *enable_tcp;
|
||||
NSPopUpButton *depth;
|
||||
|
||||
NSMenuItem *x11_about_item;
|
||||
NSMenuItem *window_separator;
|
||||
NSMenuItem *dock_window_separator;
|
||||
NSMenuItem *apps_separator;
|
||||
NSMenuItem *toggle_fullscreen_item;
|
||||
NSMenu *dock_apps_menu;
|
||||
NSTableView *apps_table;
|
||||
|
||||
NSArray *apps;
|
||||
NSMutableArray *table_apps;
|
||||
|
||||
NSMenu *dock_menu;
|
||||
|
||||
int checked_window_item;
|
||||
x_list *pending_apps;
|
||||
|
||||
BOOL finished_launching;
|
||||
BOOL can_quit;
|
||||
}
|
||||
|
||||
- (void) set_window_menu:(NSArray *)list;
|
||||
- (void) set_window_menu_check:(NSNumber *)n;
|
||||
- (void) set_apps_menu:(NSArray *)list;
|
||||
- (void) set_can_quit:(BOOL)state;
|
||||
- (void) server_ready;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __OBJC__ */
|
||||
|
||||
extern void X11ControllerMain (int argc, const char *argv[],
|
||||
void (*server_thread) (void *),
|
||||
void *server_arg);
|
||||
|
||||
#endif /* X11CONTROLLER_H */
|
752
hw/darwin/apple/X11Controller.m
Normal file
752
hw/darwin/apple/X11Controller.m
Normal file
|
@ -0,0 +1,752 @@
|
|||
/* X11Controller.m -- connect the IB ui, also the NSApp delegate
|
||||
$Id: X11Controller.m,v 1.40 2006/09/06 21:19:32 jharper Exp $
|
||||
|
||||
Copyright (c) 2002-2007 Apple Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization. */
|
||||
|
||||
#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin"
|
||||
|
||||
#include "../quartz/quartzCommon.h"
|
||||
|
||||
#import "X11Controller.h"
|
||||
#import "X11Application.h"
|
||||
#import <Carbon/Carbon.h>
|
||||
|
||||
/* ouch! */
|
||||
#define BOOL X_BOOL
|
||||
//# include "Xproto.h"
|
||||
#include "opaque.h"
|
||||
# include "darwin.h"
|
||||
# include "../quartz/quartz.h"
|
||||
# define _APPLEWM_SERVER_
|
||||
# include "X11/extensions/applewm.h"
|
||||
# include "../quartz/applewmExt.h"
|
||||
//# include "X.h"
|
||||
#undef BOOL
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#define TRACE() fprintf (stderr, "%s\n", __FUNCTION__)
|
||||
|
||||
@implementation X11Controller
|
||||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
X11Application *xapp = NSApp;
|
||||
NSArray *array;
|
||||
|
||||
/* Point X11Application at ourself. */
|
||||
[xapp set_controller:self];
|
||||
|
||||
array = [xapp prefs_get_array:@PREFS_APPSMENU];
|
||||
if (array != nil)
|
||||
{
|
||||
int count;
|
||||
|
||||
/* convert from [TITLE1 COMMAND1 TITLE2 COMMAND2 ...]
|
||||
to [[TITLE1 COMMAND1] [TITLE2 COMMAND2] ...] format. */
|
||||
|
||||
count = [array count];
|
||||
if (count > 0
|
||||
&& ![[array objectAtIndex:0] isKindOfClass:[NSArray class]])
|
||||
{
|
||||
int i;
|
||||
NSMutableArray *copy, *sub;
|
||||
|
||||
copy = [NSMutableArray arrayWithCapacity:(count / 2)];
|
||||
|
||||
for (i = 0; i < count / 2; i++)
|
||||
{
|
||||
sub = [[NSMutableArray alloc] initWithCapacity:3];
|
||||
[sub addObject:[array objectAtIndex:i*2]];
|
||||
[sub addObject:[array objectAtIndex:i*2+1]];
|
||||
[sub addObject:@""];
|
||||
[copy addObject:sub];
|
||||
[sub release];
|
||||
}
|
||||
|
||||
array = copy;
|
||||
}
|
||||
|
||||
[self set_apps_menu:array];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) item_selected:sender
|
||||
{
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
QuartzMessageServerThread (kXDarwinControllerNotify, 2,
|
||||
AppleWMWindowMenuItem, [sender tag]);
|
||||
}
|
||||
|
||||
- (void) remove_window_menu
|
||||
{
|
||||
NSMenu *menu;
|
||||
int first, count, i;
|
||||
|
||||
/* Work backwards so we don't mess up the indices */
|
||||
menu = [window_separator menu];
|
||||
first = [menu indexOfItem:window_separator] + 1;
|
||||
count = [menu numberOfItems];
|
||||
for (i = count - 1; i >= first; i--)
|
||||
[menu removeItemAtIndex:i];
|
||||
|
||||
menu = [dock_window_separator menu];
|
||||
count = [menu indexOfItem:dock_window_separator];
|
||||
for (i = 0; i < count; i++)
|
||||
[dock_menu removeItemAtIndex:0];
|
||||
}
|
||||
|
||||
- (void) install_window_menu:(NSArray *)list
|
||||
{
|
||||
NSMenu *menu;
|
||||
NSMenuItem *item;
|
||||
int first, count, i;
|
||||
|
||||
menu = [window_separator menu];
|
||||
first = [menu indexOfItem:window_separator] + 1;
|
||||
count = [list count];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
NSString *name, *shortcut;
|
||||
|
||||
name = [[list objectAtIndex:i] objectAtIndex:0];
|
||||
shortcut = [[list objectAtIndex:i] objectAtIndex:1];
|
||||
|
||||
item = (NSMenuItem *) [menu addItemWithTitle:name action:@selector
|
||||
(item_selected:) keyEquivalent:shortcut];
|
||||
[item setTarget:self];
|
||||
[item setTag:i];
|
||||
[item setEnabled:YES];
|
||||
|
||||
item = (NSMenuItem *) [dock_menu insertItemWithTitle:name
|
||||
action:@selector
|
||||
(item_selected:) keyEquivalent:shortcut
|
||||
atIndex:i];
|
||||
[item setTarget:self];
|
||||
[item setTag:i];
|
||||
[item setEnabled:YES];
|
||||
}
|
||||
|
||||
if (checked_window_item >= 0 && checked_window_item < count)
|
||||
{
|
||||
item = (NSMenuItem *) [menu itemAtIndex:first + checked_window_item];
|
||||
[item setState:NSOnState];
|
||||
item = (NSMenuItem *) [dock_menu itemAtIndex:checked_window_item];
|
||||
[item setState:NSOnState];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) remove_apps_menu
|
||||
{
|
||||
NSMenu *menu;
|
||||
NSMenuItem *item;
|
||||
int i;
|
||||
|
||||
if (apps == nil || apps_separator == nil) return;
|
||||
|
||||
menu = [apps_separator menu];
|
||||
|
||||
if (menu != nil)
|
||||
{
|
||||
for (i = [menu numberOfItems] - 1; i >= 0; i--)
|
||||
{
|
||||
item = (NSMenuItem *) [menu itemAtIndex:i];
|
||||
if ([item tag] != 0)
|
||||
[menu removeItemAtIndex:i];
|
||||
}
|
||||
}
|
||||
|
||||
if (dock_apps_menu != nil)
|
||||
{
|
||||
for (i = [dock_apps_menu numberOfItems] - 1; i >= 0; i--)
|
||||
{
|
||||
item = (NSMenuItem *) [dock_apps_menu itemAtIndex:i];
|
||||
if ([item tag] != 0)
|
||||
[dock_apps_menu removeItemAtIndex:i];
|
||||
}
|
||||
}
|
||||
|
||||
[apps release];
|
||||
apps = nil;
|
||||
}
|
||||
|
||||
- (void) prepend_apps_item:(NSArray *)list index:(int)i menu:(NSMenu *)menu
|
||||
{
|
||||
NSString *title, *shortcut = @"";
|
||||
NSArray *group;
|
||||
NSMenuItem *item;
|
||||
|
||||
group = [list objectAtIndex:i];
|
||||
title = [group objectAtIndex:0];
|
||||
if ([group count] >= 3)
|
||||
shortcut = [group objectAtIndex:2];
|
||||
|
||||
if ([title length] != 0)
|
||||
{
|
||||
item = (NSMenuItem *) [menu insertItemWithTitle:title
|
||||
action:@selector (app_selected:)
|
||||
keyEquivalent:shortcut atIndex:0];
|
||||
[item setTarget:self];
|
||||
[item setEnabled:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
item = (NSMenuItem *) [NSMenuItem separatorItem];
|
||||
[menu insertItem:item atIndex:0];
|
||||
}
|
||||
|
||||
[item setTag:i+1]; /* can't be zero, so add one */
|
||||
}
|
||||
|
||||
- (void) install_apps_menu:(NSArray *)list
|
||||
{
|
||||
NSMenu *menu;
|
||||
int i, count;
|
||||
|
||||
count = [list count];
|
||||
|
||||
if (count == 0 || apps_separator == nil) return;
|
||||
|
||||
menu = [apps_separator menu];
|
||||
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
{
|
||||
if (menu != nil)
|
||||
[self prepend_apps_item:list index:i menu:menu];
|
||||
if (dock_apps_menu != nil)
|
||||
[self prepend_apps_item:list index:i menu:dock_apps_menu];
|
||||
}
|
||||
|
||||
apps = [list retain];
|
||||
}
|
||||
|
||||
- (void) set_window_menu:(NSArray *)list
|
||||
{
|
||||
[self remove_window_menu];
|
||||
[self install_window_menu:list];
|
||||
|
||||
QuartzMessageServerThread (kXDarwinControllerNotify, 1,
|
||||
AppleWMWindowMenuNotify);
|
||||
}
|
||||
|
||||
- (void) set_window_menu_check:(NSNumber *)nn
|
||||
{
|
||||
NSMenu *menu;
|
||||
NSMenuItem *item;
|
||||
int first, count;
|
||||
int n = [nn intValue];
|
||||
|
||||
menu = [window_separator menu];
|
||||
first = [menu indexOfItem:window_separator] + 1;
|
||||
count = [menu numberOfItems] - first;
|
||||
|
||||
if (checked_window_item >= 0 && checked_window_item < count)
|
||||
{
|
||||
item = (NSMenuItem *) [menu itemAtIndex:first + checked_window_item];
|
||||
[item setState:NSOffState];
|
||||
item = (NSMenuItem *) [dock_menu itemAtIndex:checked_window_item];
|
||||
[item setState:NSOffState];
|
||||
}
|
||||
if (n >= 0 && n < count)
|
||||
{
|
||||
item = (NSMenuItem *) [menu itemAtIndex:first + n];
|
||||
[item setState:NSOnState];
|
||||
item = (NSMenuItem *) [dock_menu itemAtIndex:n];
|
||||
[item setState:NSOnState];
|
||||
}
|
||||
checked_window_item = n;
|
||||
}
|
||||
|
||||
- (void) set_apps_menu:(NSArray *)list
|
||||
{
|
||||
[self remove_apps_menu];
|
||||
[self install_apps_menu:list];
|
||||
}
|
||||
|
||||
- (void) launch_client:(NSString *)filename
|
||||
{
|
||||
const char *command = [filename UTF8String];
|
||||
const char *shell;
|
||||
const char *argv[5];
|
||||
int child1, child2 = 0;
|
||||
int status;
|
||||
|
||||
shell = getenv("SHELL");
|
||||
if (shell == NULL) shell = "/bin/bash";
|
||||
|
||||
argv[0] = shell;
|
||||
argv[1] = "-l";
|
||||
argv[2] = "-c";
|
||||
argv[3] = command;
|
||||
argv[4] = NULL;
|
||||
|
||||
/* Do the fork-twice trick to avoid having to reap zombies */
|
||||
|
||||
child1 = fork();
|
||||
|
||||
switch (child1) {
|
||||
case -1: /* error */
|
||||
break;
|
||||
|
||||
case 0: /* child1 */
|
||||
child2 = fork();
|
||||
|
||||
switch (child2) {
|
||||
int max_files, i;
|
||||
char buf[1024], *temp;
|
||||
|
||||
case -1: /* error */
|
||||
_exit(1);
|
||||
|
||||
case 0: /* child2 */
|
||||
/* close all open files except for standard streams */
|
||||
max_files = sysconf(_SC_OPEN_MAX);
|
||||
for (i = 3; i < max_files; i++) close(i);
|
||||
|
||||
/* ensure stdin is on /dev/null */
|
||||
close(0);
|
||||
open("/dev/null", O_RDONLY);
|
||||
|
||||
/* Setup environment */
|
||||
temp = getenv("DISPLAY");
|
||||
if (temp == NULL || temp[0] == 0) {
|
||||
snprintf(buf, sizeof(buf), ":%s", display);
|
||||
setenv("DISPLAY", buf, TRUE);
|
||||
}
|
||||
|
||||
temp = getenv("PATH");
|
||||
if (temp == NULL || temp[0] == 0)
|
||||
setenv ("PATH", DEFAULT_PATH, TRUE);
|
||||
else if (strnstr(temp, "/usr/X11/bin", sizeof(temp)) == NULL) {
|
||||
snprintf(buf, sizeof(buf), "%s:/usr/X11/bin", temp);
|
||||
setenv("PATH", buf, TRUE);
|
||||
}
|
||||
/* cd $HOME */
|
||||
temp = getenv("HOME");
|
||||
if (temp != NULL && temp[0]!=0) chdir(temp);
|
||||
|
||||
execvp(argv[0], (char **const) argv);
|
||||
|
||||
_exit(2);
|
||||
|
||||
default: /* parent (child1) */
|
||||
_exit(0);
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* parent */
|
||||
waitpid(child1, &status, 0);
|
||||
}
|
||||
}
|
||||
|
||||
- (void) app_selected:sender
|
||||
{
|
||||
int tag;
|
||||
NSString *item;
|
||||
|
||||
tag = [sender tag] - 1;
|
||||
if (apps == nil || tag < 0 || tag >= [apps count])
|
||||
return;
|
||||
|
||||
item = [[apps objectAtIndex:tag] objectAtIndex:1];
|
||||
|
||||
[self launch_client:item];
|
||||
}
|
||||
|
||||
- (IBAction) apps_table_show:sender
|
||||
{
|
||||
NSArray *columns;
|
||||
|
||||
if (table_apps == nil) {
|
||||
table_apps = [[NSMutableArray alloc] initWithCapacity:1];
|
||||
|
||||
if (apps != nil)[table_apps addObjectsFromArray:apps];
|
||||
}
|
||||
|
||||
columns = [apps_table tableColumns];
|
||||
[[columns objectAtIndex:0] setIdentifier:@"0"];
|
||||
[[columns objectAtIndex:1] setIdentifier:@"1"];
|
||||
[[columns objectAtIndex:2] setIdentifier:@"2"];
|
||||
|
||||
[apps_table setDataSource:self];
|
||||
[apps_table selectRow:0 byExtendingSelection:NO];
|
||||
|
||||
[[apps_table window] makeKeyAndOrderFront:sender];
|
||||
}
|
||||
|
||||
- (IBAction) apps_table_cancel:sender
|
||||
{
|
||||
[[apps_table window] orderOut:sender];
|
||||
[apps_table reloadData];
|
||||
|
||||
[table_apps release];
|
||||
table_apps = nil;
|
||||
}
|
||||
|
||||
- (IBAction) apps_table_done:sender
|
||||
{
|
||||
[apps_table deselectAll:sender]; /* flush edits? */
|
||||
|
||||
[self remove_apps_menu];
|
||||
[self install_apps_menu:table_apps];
|
||||
|
||||
[NSApp prefs_set_array:@PREFS_APPSMENU value:table_apps];
|
||||
[NSApp prefs_synchronize];
|
||||
|
||||
[[apps_table window] orderOut:sender];
|
||||
|
||||
[table_apps release];
|
||||
table_apps = nil;
|
||||
}
|
||||
|
||||
- (IBAction) apps_table_new:sender
|
||||
{
|
||||
NSMutableArray *item;
|
||||
|
||||
int row = [apps_table selectedRow], i;
|
||||
|
||||
if (row < 0) row = 0;
|
||||
else row = row + 1;
|
||||
|
||||
i = row;
|
||||
if (i > [table_apps count])
|
||||
return; /* avoid exceptions */
|
||||
|
||||
[apps_table deselectAll:sender];
|
||||
|
||||
item = [[NSMutableArray alloc] initWithCapacity:3];
|
||||
[item addObject:@""];
|
||||
[item addObject:@""];
|
||||
[item addObject:@""];
|
||||
|
||||
[table_apps insertObject:item atIndex:i];
|
||||
[item release];
|
||||
|
||||
[apps_table reloadData];
|
||||
[apps_table selectRow:row byExtendingSelection:NO];
|
||||
}
|
||||
|
||||
- (IBAction) apps_table_duplicate:sender
|
||||
{
|
||||
int row = [apps_table selectedRow], i;
|
||||
NSObject *item;
|
||||
|
||||
if (row < 0) {
|
||||
[self apps_table_new:sender];
|
||||
return;
|
||||
}
|
||||
|
||||
i = row;
|
||||
if (i > [table_apps count] - 1) return; /* avoid exceptions */
|
||||
|
||||
[apps_table deselectAll:sender];
|
||||
|
||||
item = [[table_apps objectAtIndex:i] mutableCopy];
|
||||
[table_apps insertObject:item atIndex:i];
|
||||
[item release];
|
||||
|
||||
[apps_table reloadData];
|
||||
[apps_table selectRow:row+1 byExtendingSelection:NO];
|
||||
}
|
||||
|
||||
- (IBAction) apps_table_delete:sender
|
||||
{
|
||||
int row = [apps_table selectedRow];
|
||||
|
||||
if (row >= 0)
|
||||
{
|
||||
int i = row;
|
||||
|
||||
if (i > [table_apps count] - 1) return; /* avoid exceptions */
|
||||
|
||||
[apps_table deselectAll:sender];
|
||||
|
||||
[table_apps removeObjectAtIndex:i];
|
||||
}
|
||||
|
||||
[apps_table reloadData];
|
||||
|
||||
row = MIN (row, [table_apps count] - 1);
|
||||
if (row >= 0)
|
||||
[apps_table selectRow:row byExtendingSelection:NO];
|
||||
}
|
||||
|
||||
- (int) numberOfRowsInTableView:(NSTableView *)tableView
|
||||
{
|
||||
if (table_apps == nil) return 0;
|
||||
|
||||
return [table_apps count];
|
||||
}
|
||||
|
||||
- (id) tableView:(NSTableView *)tableView
|
||||
objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
|
||||
{
|
||||
NSArray *item;
|
||||
int col;
|
||||
|
||||
if (table_apps == nil) return nil;
|
||||
|
||||
col = [[tableColumn identifier] intValue];
|
||||
|
||||
item = [table_apps objectAtIndex:row];
|
||||
if ([item count] > col)
|
||||
return [item objectAtIndex:col];
|
||||
else
|
||||
return @"";
|
||||
}
|
||||
|
||||
- (void) tableView:(NSTableView *)tableView setObjectValue:(id)object
|
||||
forTableColumn:(NSTableColumn *)tableColumn row:(int)row
|
||||
{
|
||||
NSMutableArray *item;
|
||||
int col;
|
||||
|
||||
if (table_apps == nil) return;
|
||||
|
||||
col = [[tableColumn identifier] intValue];
|
||||
|
||||
item = [table_apps objectAtIndex:row];
|
||||
[item replaceObjectAtIndex:col withObject:object];
|
||||
}
|
||||
|
||||
- (void) hide_window:sender
|
||||
{
|
||||
if ([X11App x_active])
|
||||
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideWindow);
|
||||
else
|
||||
NSBeep (); /* FIXME: something here */
|
||||
}
|
||||
|
||||
- (IBAction)bring_to_front:sender
|
||||
{
|
||||
QuartzMessageServerThread(kXDarwinControllerNotify, 1, AppleWMBringAllToFront);
|
||||
}
|
||||
|
||||
- (IBAction)close_window:sender
|
||||
{
|
||||
if ([X11App x_active])
|
||||
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMCloseWindow);
|
||||
else
|
||||
[[NSApp keyWindow] performClose:sender];
|
||||
}
|
||||
|
||||
- (IBAction)minimize_window:sender
|
||||
{
|
||||
if ([X11App x_active])
|
||||
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMMinimizeWindow);
|
||||
else
|
||||
[[NSApp keyWindow] performMiniaturize:sender];
|
||||
}
|
||||
|
||||
- (IBAction)zoom_window:sender
|
||||
{
|
||||
if ([X11App x_active])
|
||||
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMZoomWindow);
|
||||
else
|
||||
[[NSApp keyWindow] performZoom:sender];
|
||||
}
|
||||
|
||||
- (IBAction) next_window:sender
|
||||
{
|
||||
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMNextWindow);
|
||||
}
|
||||
|
||||
- (IBAction) previous_window:sender
|
||||
{
|
||||
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMPreviousWindow);
|
||||
}
|
||||
|
||||
- (IBAction) enable_fullscreen_changed:sender
|
||||
{
|
||||
int value = ![enable_fullscreen intValue];
|
||||
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
QuartzMessageServerThread (kXDarwinSetRootless, 1, value);
|
||||
#endif
|
||||
|
||||
[NSApp prefs_set_boolean:@PREFS_ROOTLESS value:value];
|
||||
[NSApp prefs_synchronize];
|
||||
}
|
||||
|
||||
- (IBAction) toggle_fullscreen:sender
|
||||
{
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
QuartzMessageServerThread (kXDarwinToggleFullscreen, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) set_can_quit:(BOOL)state
|
||||
{
|
||||
can_quit = state;
|
||||
}
|
||||
|
||||
- (IBAction)prefs_changed:sender
|
||||
{
|
||||
darwinFakeButtons = [fake_buttons intValue];
|
||||
quartzUseSysBeep = [use_sysbeep intValue];
|
||||
X11EnableKeyEquivalents = [enable_keyequivs intValue];
|
||||
darwinSyncKeymap = [sync_keymap intValue];
|
||||
|
||||
/* after adding prefs here, also add to [X11Application read_defaults]
|
||||
and below */
|
||||
|
||||
[NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons];
|
||||
[NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep];
|
||||
[NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents];
|
||||
[NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap];
|
||||
[NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]];
|
||||
[NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]];
|
||||
[NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]];
|
||||
|
||||
[NSApp prefs_synchronize];
|
||||
}
|
||||
|
||||
- (IBAction) prefs_show:sender
|
||||
{
|
||||
[fake_buttons setIntValue:darwinFakeButtons];
|
||||
[use_sysbeep setIntValue:quartzUseSysBeep];
|
||||
[enable_keyequivs setIntValue:X11EnableKeyEquivalents];
|
||||
[sync_keymap setIntValue:darwinSyncKeymap];
|
||||
[sync_keymap setEnabled:darwinKeymapFile == NULL];
|
||||
|
||||
[enable_auth setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_AUTH default:NO]];
|
||||
[enable_tcp setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_TCP default:NO]];
|
||||
[depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]];
|
||||
|
||||
[enable_fullscreen setIntValue:!quartzEnableRootless];
|
||||
|
||||
[prefs_panel makeKeyAndOrderFront:sender];
|
||||
}
|
||||
|
||||
- (IBAction) quit:sender
|
||||
{
|
||||
QuartzMessageServerThread (kXDarwinQuit, 0);
|
||||
}
|
||||
|
||||
- (IBAction) x11_help:sender
|
||||
{
|
||||
AHLookupAnchor (CFSTR ("Mac Help"), CFSTR ("mchlp2276"));
|
||||
}
|
||||
|
||||
- (BOOL) validateMenuItem:(NSMenuItem *)item
|
||||
{
|
||||
NSMenu *menu = [item menu];
|
||||
|
||||
if (item == toggle_fullscreen_item)
|
||||
return !quartzEnableRootless;
|
||||
else if (menu == [window_separator menu] || menu == dock_menu
|
||||
|| (menu == [x11_about_item menu] && [item tag] == 42))
|
||||
return (AppleWMSelectedEvents () & AppleWMControllerNotifyMask) != 0;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
- (void) applicationDidHide:(NSNotification *)notify
|
||||
{
|
||||
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideAll);
|
||||
}
|
||||
|
||||
- (void) applicationDidUnhide:(NSNotification *)notify
|
||||
{
|
||||
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMShowAll);
|
||||
}
|
||||
|
||||
- (NSApplicationTerminateReply) applicationShouldTerminate:sender
|
||||
{
|
||||
NSString *msg;
|
||||
|
||||
if (can_quit || [X11App prefs_get_boolean:@PREFS_NO_QUIT_ALERT default:NO])
|
||||
return NSTerminateNow;
|
||||
|
||||
/* Make sure we're frontmost. */
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
msg = NSLocalizedString (@"Are you sure you want to quit X11?\n\nIf you quit X11, any X11 applications you are running will stop immediately and you will lose any changes you have not saved.", @"Dialog when quitting");
|
||||
|
||||
/* FIXME: safe to run the alert in here? Or should we return Later
|
||||
and then run the alert on a timer? It seems to work here, so.. */
|
||||
|
||||
return (NSRunAlertPanel (nil, msg, NSLocalizedString (@"Quit", @""),
|
||||
NSLocalizedString (@"Cancel", @""), nil)
|
||||
== NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel;
|
||||
}
|
||||
|
||||
- (void) applicationWillTerminate:(NSNotification *)aNotification
|
||||
{
|
||||
[X11App prefs_synchronize];
|
||||
|
||||
/* shutdown the X server, it will exit () for us. */
|
||||
QuartzMessageServerThread (kXDarwinQuit, 0);
|
||||
|
||||
/* In case it doesn't, exit anyway after a while. */
|
||||
while (sleep (10) != 0) ;
|
||||
exit (1);
|
||||
}
|
||||
|
||||
- (void) server_ready
|
||||
{
|
||||
x_list *node;
|
||||
|
||||
finished_launching = YES;
|
||||
|
||||
for (node = pending_apps; node != NULL; node = node->next)
|
||||
{
|
||||
NSString *filename = node->data;
|
||||
[self launch_client:filename];
|
||||
[filename release];
|
||||
}
|
||||
|
||||
x_list_free (pending_apps);
|
||||
pending_apps = NULL;
|
||||
}
|
||||
|
||||
- (BOOL) application:(NSApplication *)app openFile:(NSString *)filename
|
||||
{
|
||||
const char *name = [filename UTF8String];
|
||||
|
||||
if (finished_launching)
|
||||
[self launch_client:filename];
|
||||
else if (name[0] != ':') /* ignore display names */
|
||||
pending_apps = x_list_prepend (pending_apps, [filename retain]);
|
||||
|
||||
/* FIXME: report failures. */
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
void X11ControllerMain (int argc, const char *argv[],
|
||||
void (*server_thread) (void *), void *server_arg)
|
||||
{
|
||||
X11ApplicationMain (argc, argv, server_thread, server_arg);
|
||||
}
|
158
hw/darwin/apple/Xquartz.man
Normal file
158
hw/darwin/apple/Xquartz.man
Normal file
|
@ -0,0 +1,158 @@
|
|||
.\" $XFree86: xc/programs/Xserver/hw/darwin/XDarwin.man,v 1.4 2002/01/09 18:01:58 torrey Exp $
|
||||
.\"
|
||||
.TH XQUARTZ 1 __vendorversion__
|
||||
.SH NAME
|
||||
Xquartz \- X window system server for Quartz operating system
|
||||
.SH SYNOPSIS
|
||||
.B Xquartz
|
||||
[ options ] ...
|
||||
.SH DESCRIPTION
|
||||
.I Xquartz
|
||||
is the X window server for Mac OS X provided by Apple.
|
||||
.I Xquartz
|
||||
runs in parallel with Aqua in rootless mode. In rootless mode, the X
|
||||
window system and Mac OS X share your display. The root window of the
|
||||
X11 display is the size of the screen and contains all the other
|
||||
windows. The X11 root window is not displayed in rootless mode as Mac
|
||||
OS X handles the desktop background.
|
||||
.SH OPTIONS
|
||||
.PP
|
||||
In addition to the normal server options described in the \fIXserver(1)\fP
|
||||
manual page, \fIXquartz\fP accepts the following command line switches:
|
||||
.TP 8
|
||||
.B \-fakebuttons
|
||||
Emulates a 3 button mouse using modifier keys. By default, the Command modifier
|
||||
is used to emulate button 2 and Option is used for button 3. Thus, clicking the
|
||||
first mouse button while holding down Command will act like clicking
|
||||
button 2. Holding down Option will simulate button 3.
|
||||
.TP 8
|
||||
.B \-nofakebuttons
|
||||
Do not emulate a 3 button mouse. This is the default.
|
||||
.TP 8
|
||||
.B "\-fakemouse2 \fImodifiers\fP"
|
||||
Change the modifier keys used to emulate the second mouse button. By default,
|
||||
Command is used to emulate the second button. Any combination of the following
|
||||
modifier names may be used: Shift, Option, Control, Command, Fn. For example,
|
||||
.B \-fakemouse2 """Option,Shift""
|
||||
will set holding Option, Shift and clicking on button one as equivalent to
|
||||
clicking the second mouse button.
|
||||
.TP 8
|
||||
.B "\-fakemouse3 \fImodifiers\fP"
|
||||
Change the modifier keys used to emulate the third mouse button. By default,
|
||||
Option is used to emulate the third button. Any combination of the following
|
||||
modifier names may be used: Shift, Option, Control, Command, Fn. For example,
|
||||
.B \-fakemouse3 """Control,Shift""
|
||||
will set holding Control, Shift and clicking on button one as equivalent to
|
||||
clicking the third mouse button.
|
||||
.TP 8
|
||||
.B "\-swapAltMeta"
|
||||
Swaps the meaning of the Alt and Meta modifier keys.
|
||||
.TP 8
|
||||
.B "\-keymap \fIfile\fP"
|
||||
On startup \fIXquartz\fP translates a Darwin keymapping into an X keymap.
|
||||
The default is to read this keymapping from USA.keymapping. With this option
|
||||
the keymapping will be read from \fIfile\fP instead. If the file's path is
|
||||
not specified, it will be searched for in Library/Keyboards/ underneath the
|
||||
following directories (in order): ~, /, /Network, /System.
|
||||
.TP 8
|
||||
.B \-nokeymap
|
||||
On startup \fIXquartz\fP translates a Darwin keymapping into an X keymap.
|
||||
With this option \fIXquartz\fP queries the kernel for the current keymapping
|
||||
instead of reading it from a file. This will often fail on newer kernels.
|
||||
.TP 8
|
||||
.B "\-depth \fIdepth\fP"
|
||||
Specifies the color bit depth to use. Currently only 15, and 24 color
|
||||
bits per pixel are supported. If not specified, defaults to the depth
|
||||
of the main display.
|
||||
.SH CUSTOMIZATION
|
||||
\fIXquartz\fP can also be customized using the defaults(1) command. The available options are:
|
||||
.TP 8
|
||||
.B defaults write com.apple.x11 enable_fake_buttons -boolean true
|
||||
Equivalent to the \fB-fakebuttons\fP command line option.
|
||||
.TP 8
|
||||
.B defaults write com.apple.x11 fake_button2 \fImodifiers\fP
|
||||
Equivalent to the \fB-fakemouse2\fP option.
|
||||
.TP 8
|
||||
.B defaults write com.apple.x11 fake_button3 \fImodifiers\fP
|
||||
Equivalent to the \fB-fakemouse3\fP option.
|
||||
.TP 8
|
||||
.B defaults write com.apple.x11 swap_alt_meta -boolean true
|
||||
Equivalent to the \fB-swapAltMeta\fP option.
|
||||
.TP 8
|
||||
.B defaults write com.apple.x11 keymap_file \fIfilename\fP
|
||||
Equivalent to the \fB-keymap\fP option.
|
||||
.TP 8
|
||||
.B defaults write com.apple.x11 no_quit_alert -boolean true
|
||||
Disables the alert dialog displayed when attempting to quit X11.
|
||||
.TP 8
|
||||
.B defaults write com.apple.x11 no_auth -boolean true
|
||||
Stops the X server requiring that clients authenticate themselves when
|
||||
connecting. See Xsecurity(__miscmansuffix__).
|
||||
.TP 8
|
||||
.B defaults write com.apple.x11 nolisten_tcp -boolean true
|
||||
Prevents the X server accepting remote connections.
|
||||
.TP 8
|
||||
.B defaults write com.apple.x11 xinit_kills_server -boolean false
|
||||
Stops the X server exiting when the xinitrc script terminates.
|
||||
.TP 8
|
||||
.B defaults write com.apple.x11 fullscreen_hotkeys -boolean false
|
||||
Allows system hotkeys to be handled while in X11 fullscreen mode.
|
||||
.TP 8
|
||||
.B defaults write com.apple.x11 enable_system_beep -boolean false
|
||||
Don't use the standard system beep effect for X11 alerts.
|
||||
.TP 8
|
||||
.B defaults write com.apple.x11 enable_key_equivalents -boolean false
|
||||
Disable menu keyboard equivalents while X11 windows are focused.
|
||||
.TP 8
|
||||
.B defaults write com.apple.x11 depth \fIdepth\fP
|
||||
Equivalent to the \fB-depth\fP option.
|
||||
.SH "SEE ALSO"
|
||||
.PP
|
||||
X(__miscmansuffix__), XFree86(1), Xserver(1), xdm(1), xinit(1)
|
||||
.PP
|
||||
.SH AUTHORS
|
||||
XFree86 was originally ported to Mac OS X Server by John Carmack. Dave
|
||||
Zarzycki used this as the basis of his port of XFree86 4.0 to Darwin 1.0.
|
||||
Torrey T. Lyons improved and integrated this code into the XFree86
|
||||
Project's mainline for the 4.0.2 release.
|
||||
.PP
|
||||
The following members of the XonX Team contributed to the following
|
||||
releases (in alphabetical order):
|
||||
.TP 4
|
||||
XFree86 4.1.0:
|
||||
.br
|
||||
Rob Braun - Darwin x86 support
|
||||
.br
|
||||
Torrey T. Lyons - Project Lead
|
||||
.br
|
||||
Andreas Monitzer - Cocoa version of XDarwin front end
|
||||
.br
|
||||
Gregory Robert Parker - Original Quartz implementation
|
||||
.br
|
||||
Christoph Pfisterer - Dynamic shared X libraries
|
||||
.br
|
||||
Toshimitsu Tanaka - Japanese localization
|
||||
.TP 4
|
||||
XFree86 4.2.0:
|
||||
.br
|
||||
Rob Braun - Darwin x86 support
|
||||
.br
|
||||
Pablo Di Noto - Spanish localization
|
||||
.br
|
||||
Paul Edens - Dutch localization
|
||||
.br
|
||||
Kyunghwan Kim - Korean localization
|
||||
.br
|
||||
Mario Klebsch - Non-US keyboard support
|
||||
.br
|
||||
Torrey T. Lyons - Project Lead
|
||||
.br
|
||||
Andreas Monitzer - German localization
|
||||
.br
|
||||
Patrik Montgomery - Swedish localization
|
||||
.br
|
||||
Greg Parker - Rootless support
|
||||
.br
|
||||
Toshimitsu Tanaka - Japanese localization
|
||||
.br
|
||||
Olivier Verdier - French localization
|
912
hw/darwin/apple/bundle-main.c
Normal file
912
hw/darwin/apple/bundle-main.c
Normal file
|
@ -0,0 +1,912 @@
|
|||
/* bundle-main.c -- X server launcher
|
||||
$Id: bundle-main.c,v 1.17 2003/09/11 00:17:10 jharper Exp $
|
||||
|
||||
Copyright (c) 2002-2007 Apple Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
|
||||
Parts of this file are derived from xdm, which has this copyright:
|
||||
|
||||
Copyright 1988, 1998 The Open Group
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee,
|
||||
provided that the above copyright notice appear in all copies and
|
||||
that both that copyright notice and this permission notice appear in
|
||||
supporting documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall
|
||||
not be used in advertising or otherwise to promote the sale, use or
|
||||
other dealings in this Software without prior written authorization
|
||||
from The Open Group. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <setjmp.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xauth.h>
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <SystemConfiguration/SystemConfiguration.h>
|
||||
|
||||
#define X_SERVER "/usr/X11/bin/Xquartz"
|
||||
#define XTERM_PATH "/usr/X11/bin/xterm"
|
||||
#define WM_PATH "/usr/X11/bin/quartz-wm"
|
||||
#define DEFAULT_XINITRC "/etc/X11/xinit/xinitrc"
|
||||
#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin"
|
||||
|
||||
/* what xinit does */
|
||||
#ifndef SHELL
|
||||
# define SHELL "sh"
|
||||
#endif
|
||||
|
||||
#undef FALSE
|
||||
#define FALSE 0
|
||||
#undef TRUE
|
||||
#define TRUE 1
|
||||
|
||||
#define MAX_DISPLAYS 64
|
||||
|
||||
static int server_pid = -1, client_pid = -1;
|
||||
static int xinit_kills_server = FALSE;
|
||||
static jmp_buf exit_continuation;
|
||||
static const char *server_name = NULL;
|
||||
static Display *server_dpy;
|
||||
|
||||
static char *auth_file;
|
||||
|
||||
typedef struct addr_list_struct addr_list;
|
||||
|
||||
struct addr_list_struct {
|
||||
addr_list *next;
|
||||
Xauth auth;
|
||||
};
|
||||
|
||||
static addr_list *addresses;
|
||||
|
||||
|
||||
/* Utility functions. */
|
||||
|
||||
/* Return the current host name. Matches what Xlib does. */
|
||||
static char *
|
||||
host_name (void)
|
||||
{
|
||||
#ifdef NEED_UTSNAME
|
||||
static struct utsname name;
|
||||
|
||||
uname(&name);
|
||||
|
||||
return name.nodename;
|
||||
#else
|
||||
static char buf[100];
|
||||
|
||||
gethostname(buf, sizeof(buf));
|
||||
|
||||
return buf;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
read_boolean_pref (CFStringRef name, int default_)
|
||||
{
|
||||
int value;
|
||||
Boolean ok;
|
||||
|
||||
value = CFPreferencesGetAppBooleanValue (name,
|
||||
CFSTR ("com.apple.x11"), &ok);
|
||||
return ok ? value : default_;
|
||||
}
|
||||
|
||||
static inline int
|
||||
binary_equal (const void *a, const void *b, int length)
|
||||
{
|
||||
return memcmp (a, b, length) == 0;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
binary_dup (const void *a, int length)
|
||||
{
|
||||
void *b = malloc (length);
|
||||
if (b != NULL)
|
||||
memcpy (b, a, length);
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline void
|
||||
binary_free (void *data, int length)
|
||||
{
|
||||
if (data != NULL)
|
||||
free (data);
|
||||
}
|
||||
|
||||
|
||||
/* Functions for managing the authentication entries. */
|
||||
|
||||
/* Returns true if something matching AUTH is in our list of auth items */
|
||||
static int
|
||||
check_auth_item (Xauth *auth)
|
||||
{
|
||||
addr_list *a;
|
||||
|
||||
for (a = addresses; a != NULL; a = a->next)
|
||||
{
|
||||
if (a->auth.family == auth->family
|
||||
&& a->auth.address_length == auth->address_length
|
||||
&& binary_equal (a->auth.address, auth->address, auth->address_length)
|
||||
&& a->auth.number_length == auth->number_length
|
||||
&& binary_equal (a->auth.number, auth->number, auth->number_length)
|
||||
&& a->auth.name_length == auth->name_length
|
||||
&& binary_equal (a->auth.name, auth->name, auth->name_length))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Add one item to our list of auth items. */
|
||||
static void
|
||||
add_auth_item (Xauth *auth)
|
||||
{
|
||||
addr_list *a = malloc (sizeof (addr_list));
|
||||
|
||||
a->auth.family = auth->family;
|
||||
a->auth.address_length = auth->address_length;
|
||||
a->auth.address = binary_dup (auth->address, auth->address_length);
|
||||
a->auth.number_length = auth->number_length;
|
||||
a->auth.number = binary_dup (auth->number, auth->number_length);
|
||||
a->auth.name_length = auth->name_length;
|
||||
a->auth.name = binary_dup (auth->name, auth->name_length);
|
||||
a->auth.data_length = auth->data_length;
|
||||
a->auth.data = binary_dup (auth->data, auth->data_length);
|
||||
|
||||
a->next = addresses;
|
||||
addresses = a;
|
||||
}
|
||||
|
||||
/* Free all allocated auth items. */
|
||||
static void
|
||||
free_auth_items (void)
|
||||
{
|
||||
addr_list *a;
|
||||
|
||||
while ((a = addresses) != NULL)
|
||||
{
|
||||
addresses = a->next;
|
||||
|
||||
binary_free (a->auth.address, a->auth.address_length);
|
||||
binary_free (a->auth.number, a->auth.number_length);
|
||||
binary_free (a->auth.name, a->auth.name_length);
|
||||
binary_free (a->auth.data, a->auth.data_length);
|
||||
free (a);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add the unix domain auth item. */
|
||||
static void
|
||||
define_local (Xauth *auth)
|
||||
{
|
||||
char *host = host_name ();
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "x11: hostname is %s\n", host);
|
||||
#endif
|
||||
|
||||
auth->family = FamilyLocal;
|
||||
auth->address_length = strlen (host);
|
||||
auth->address = host;
|
||||
|
||||
add_auth_item (auth);
|
||||
}
|
||||
|
||||
/* Add the tcp auth item. */
|
||||
static void
|
||||
define_named (Xauth *auth, const char *name)
|
||||
{
|
||||
struct ifaddrs *addrs, *ptr;
|
||||
|
||||
if (getifaddrs (&addrs) != 0)
|
||||
return;
|
||||
|
||||
for (ptr = addrs; ptr != NULL; ptr = ptr->ifa_next)
|
||||
{
|
||||
if (ptr->ifa_addr->sa_family != AF_INET)
|
||||
continue;
|
||||
|
||||
auth->family = FamilyInternet;
|
||||
auth->address_length = sizeof (struct in_addr);
|
||||
auth->address = (char *) &(((struct sockaddr_in *) ptr->ifa_addr)->sin_addr);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "x11: ipaddr is %d.%d.%d.%d\n",
|
||||
(unsigned char) auth->address[0],
|
||||
(unsigned char) auth->address[1],
|
||||
(unsigned char) auth->address[2],
|
||||
(unsigned char) auth->address[3]);
|
||||
#endif
|
||||
|
||||
add_auth_item (auth);
|
||||
}
|
||||
|
||||
freeifaddrs (addrs);
|
||||
}
|
||||
|
||||
/* Parse the display number from NAME and add it to AUTH. */
|
||||
static void
|
||||
set_auth_number (Xauth *auth, const char *name)
|
||||
{
|
||||
char *colon;
|
||||
char *dot, *number;
|
||||
|
||||
colon = strrchr(name, ':');
|
||||
if (colon != NULL)
|
||||
{
|
||||
colon++;
|
||||
dot = strchr(colon, '.');
|
||||
|
||||
if (dot != NULL)
|
||||
auth->number_length = dot - colon;
|
||||
else
|
||||
auth->number_length = strlen (colon);
|
||||
|
||||
number = malloc (auth->number_length + 1);
|
||||
if (number != NULL)
|
||||
{
|
||||
strncpy (number, colon, auth->number_length);
|
||||
number[auth->number_length] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
auth->number_length = 0;
|
||||
}
|
||||
|
||||
auth->number = number;
|
||||
}
|
||||
}
|
||||
|
||||
/* Put 128 bits of random data into DATA. If possible, it will be "high
|
||||
quality" */
|
||||
static int
|
||||
generate_mit_magic_cookie (char data[16])
|
||||
{
|
||||
int fd, ret, i;
|
||||
long *ldata = (long *) data;
|
||||
|
||||
fd = open ("/dev/random", O_RDONLY);
|
||||
if (fd > 0) {
|
||||
ret = read (fd, data, 16);
|
||||
close (fd);
|
||||
if (ret == 16) return TRUE;
|
||||
}
|
||||
|
||||
/* fall back to the usual crappy rng */
|
||||
|
||||
srand48 (getpid () ^ time (NULL));
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
ldata[i] = lrand48 ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Create the keys we'll be using for the display named NAME. */
|
||||
static int
|
||||
make_auth_keys (const char *name)
|
||||
{
|
||||
Xauth auth;
|
||||
char key[16];
|
||||
|
||||
if (auth_file == NULL)
|
||||
return FALSE;
|
||||
|
||||
auth.name = "MIT-MAGIC-COOKIE-1";
|
||||
auth.name_length = strlen (auth.name);
|
||||
|
||||
if (!generate_mit_magic_cookie (key))
|
||||
{
|
||||
auth_file = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
auth.data = key;
|
||||
auth.data_length = 16;
|
||||
|
||||
set_auth_number (&auth, name);
|
||||
|
||||
define_named (&auth, host_name ());
|
||||
define_local (&auth);
|
||||
|
||||
free (auth.number);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* If ADD-ENTRIES is true, merge our auth entries into the existing
|
||||
Xauthority file. If ADD-ENTRIES is false, remove our entries. */
|
||||
static int
|
||||
write_auth_file (int add_entries)
|
||||
{
|
||||
char *home, newname[1024];
|
||||
int fd, ret;
|
||||
FILE *new_fh, *old_fh;
|
||||
addr_list *addr;
|
||||
Xauth *auth;
|
||||
|
||||
if (auth_file == NULL)
|
||||
return FALSE;
|
||||
|
||||
home = getenv ("HOME");
|
||||
if (home == NULL)
|
||||
{
|
||||
auth_file = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
snprintf (newname, sizeof (newname), "%s/.XauthorityXXXXXX", home);
|
||||
mktemp (newname);
|
||||
|
||||
if (XauLockAuth (auth_file, 1, 2, 10) != LOCK_SUCCESS)
|
||||
{
|
||||
/* FIXME: do something here? */
|
||||
|
||||
auth_file = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fd = open (newname, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
||||
if (fd >= 0)
|
||||
{
|
||||
new_fh = fdopen (fd, "w");
|
||||
if (new_fh != NULL)
|
||||
{
|
||||
if (add_entries)
|
||||
{
|
||||
for (addr = addresses; addr != NULL; addr = addr->next)
|
||||
{
|
||||
XauWriteAuth (new_fh, &addr->auth);
|
||||
}
|
||||
}
|
||||
|
||||
old_fh = fopen (auth_file, "r");
|
||||
if (old_fh != NULL)
|
||||
{
|
||||
while ((auth = XauReadAuth (old_fh)) != NULL)
|
||||
{
|
||||
if (!check_auth_item (auth))
|
||||
XauWriteAuth (new_fh, auth);
|
||||
XauDisposeAuth (auth);
|
||||
}
|
||||
fclose (old_fh);
|
||||
}
|
||||
|
||||
fclose (new_fh);
|
||||
unlink (auth_file);
|
||||
|
||||
ret = rename (newname, auth_file);
|
||||
|
||||
if (ret != 0)
|
||||
auth_file = NULL;
|
||||
|
||||
XauUnlockAuth (auth_file);
|
||||
return ret == 0;
|
||||
}
|
||||
|
||||
close (fd);
|
||||
}
|
||||
|
||||
XauUnlockAuth (auth_file);
|
||||
auth_file = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Subprocess management functions. */
|
||||
|
||||
static int
|
||||
start_server (char **xargv)
|
||||
{
|
||||
int child;
|
||||
|
||||
child = fork ();
|
||||
|
||||
switch (child)
|
||||
{
|
||||
case -1: /* error */
|
||||
perror ("fork");
|
||||
return FALSE;
|
||||
|
||||
case 0: /* child */
|
||||
execv (X_SERVER, xargv);
|
||||
perror ("Couldn't exec " X_SERVER);
|
||||
_exit (1);
|
||||
|
||||
default: /* parent */
|
||||
server_pid = child;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
wait_for_server (void)
|
||||
{
|
||||
int count = 100;
|
||||
|
||||
while (count-- > 0)
|
||||
{
|
||||
int status;
|
||||
|
||||
server_dpy = XOpenDisplay (server_name);
|
||||
if (server_dpy != NULL)
|
||||
return TRUE;
|
||||
|
||||
if (waitpid (server_pid, &status, WNOHANG) == server_pid)
|
||||
return FALSE;
|
||||
|
||||
sleep (1);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
start_client (void)
|
||||
{
|
||||
int child;
|
||||
|
||||
child = fork();
|
||||
|
||||
switch (child) {
|
||||
char *temp, buf[1024];
|
||||
|
||||
case -1: /* error */
|
||||
perror("fork");
|
||||
return FALSE;
|
||||
|
||||
case 0: /* child */
|
||||
/* Setup environment */
|
||||
temp = getenv("DISPLAY");
|
||||
if (temp != NULL && temp[0] != 0)
|
||||
setenv("DISPLAY", server_name, TRUE);
|
||||
|
||||
temp = getenv("PATH");
|
||||
if (temp == NULL || temp[0] == 0)
|
||||
setenv ("PATH", DEFAULT_PATH, TRUE);
|
||||
else if (strnstr(temp, "/usr/X11/bin", sizeof(temp)) == NULL) {
|
||||
snprintf(buf, sizeof(buf), "%s:/usr/X11/bin", temp);
|
||||
setenv("PATH", buf, TRUE);
|
||||
}
|
||||
|
||||
/* First try value of $XINITRC, if set. */
|
||||
temp = getenv("XINITRC");
|
||||
if (temp != NULL && temp[0] != 0 && access(temp, R_OK) == 0)
|
||||
execlp (SHELL, SHELL, temp, NULL);
|
||||
|
||||
/* Then look for .xinitrc in user's home directory. */
|
||||
temp = getenv("HOME");
|
||||
if (temp != NULL && temp[0] != 0) {
|
||||
chdir(temp);
|
||||
snprintf (buf, sizeof (buf), "%s/.xinitrc", temp);
|
||||
if (access(buf, R_OK) == 0)
|
||||
execlp(SHELL, SHELL, buf, NULL);
|
||||
}
|
||||
|
||||
/* Then try the default xinitrc in the lib directory. */
|
||||
|
||||
if (access(DEFAULT_XINITRC, R_OK) == 0)
|
||||
execlp(SHELL, SHELL, DEFAULT_XINITRC, NULL);
|
||||
|
||||
/* Then fallback to hardcoding an xterm and the window manager. */
|
||||
|
||||
// system(XTERM_PATH " &");
|
||||
execl(WM_PATH, WM_PATH, NULL);
|
||||
|
||||
perror("exec");
|
||||
_exit(1);
|
||||
|
||||
default: /* parent */
|
||||
client_pid = child;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sigchld_handler (int sig)
|
||||
{
|
||||
int pid, status;
|
||||
|
||||
again:
|
||||
pid = waitpid (WAIT_ANY, &status, WNOHANG);
|
||||
|
||||
if (pid > 0)
|
||||
{
|
||||
if (pid == server_pid)
|
||||
{
|
||||
server_pid = -1;
|
||||
|
||||
if (client_pid >= 0)
|
||||
kill (client_pid, SIGTERM);
|
||||
}
|
||||
else if (pid == client_pid)
|
||||
{
|
||||
client_pid = -1;
|
||||
|
||||
if (server_pid >= 0 && xinit_kills_server)
|
||||
kill (server_pid, SIGTERM);
|
||||
}
|
||||
goto again;
|
||||
}
|
||||
|
||||
if (server_pid == -1 && client_pid == -1)
|
||||
longjmp (exit_continuation, 1);
|
||||
|
||||
signal (SIGCHLD, sigchld_handler);
|
||||
}
|
||||
|
||||
|
||||
/* Server utilities. */
|
||||
|
||||
static Boolean
|
||||
display_exists_p (int number)
|
||||
{
|
||||
char buf[64];
|
||||
void *conn;
|
||||
char *fullname = NULL;
|
||||
int idisplay, iscreen;
|
||||
char *conn_auth_name, *conn_auth_data;
|
||||
int conn_auth_namelen, conn_auth_datalen;
|
||||
#ifdef USE_XTRANS_INTERNALS
|
||||
extern void *_X11TransConnectDisplay ();
|
||||
extern void _XDisconnectDisplay ();
|
||||
#endif
|
||||
/* Since connecting to the display waits for a few seconds if the
|
||||
display doesn't exist, check for trivial non-existence - if the
|
||||
socket in /tmp exists or not.. (note: if the socket exists, the
|
||||
server may still not, so we need to try to connect in that case..) */
|
||||
|
||||
sprintf (buf, "/tmp/.X11-unix/X%d", number);
|
||||
if (access (buf, F_OK) != 0)
|
||||
return FALSE;
|
||||
#ifdef USE_XTRANS_INTERNALS
|
||||
/* This is a private function that we shouldn't really be calling,
|
||||
but it's the best way to see if the server exists (without
|
||||
needing to hold the necessary authentication to use it) */
|
||||
|
||||
sprintf (buf, ":%d", number);
|
||||
conn = _X11TransConnectDisplay (buf, &fullname, &idisplay, &iscreen,
|
||||
&conn_auth_name, &conn_auth_namelen,
|
||||
&conn_auth_data, &conn_auth_datalen);
|
||||
if (conn == NULL)
|
||||
return FALSE;
|
||||
|
||||
_XDisconnectDisplay (conn);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* Monitoring when the system's ip addresses change. */
|
||||
|
||||
static Boolean pending_timer;
|
||||
|
||||
static void
|
||||
timer_callback (CFRunLoopTimerRef timer, void *info)
|
||||
{
|
||||
pending_timer = FALSE;
|
||||
|
||||
/* Update authentication names. Need to write .Xauthority file first
|
||||
without the existing entries, then again with the new entries.. */
|
||||
|
||||
write_auth_file (FALSE);
|
||||
|
||||
free_auth_items ();
|
||||
make_auth_keys (server_name);
|
||||
|
||||
write_auth_file (TRUE);
|
||||
}
|
||||
|
||||
/* This function is called when the system's ip addresses may have changed. */
|
||||
static void
|
||||
ipaddr_callback (SCDynamicStoreRef store, CFArrayRef changed_keys, void *info)
|
||||
{
|
||||
#if DEBUG
|
||||
if (changed_keys != NULL) {
|
||||
fprintf (stderr, "x11: changed sc keys: ");
|
||||
CFShow (changed_keys);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (auth_file != NULL && !pending_timer)
|
||||
{
|
||||
CFRunLoopTimerRef timer;
|
||||
|
||||
timer = CFRunLoopTimerCreate (NULL, CFAbsoluteTimeGetCurrent () + 1.0,
|
||||
0.0, 0, 0, timer_callback, NULL);
|
||||
CFRunLoopAddTimer (CFRunLoopGetCurrent (), timer,
|
||||
kCFRunLoopDefaultMode);
|
||||
CFRelease (timer);
|
||||
|
||||
pending_timer = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* This code adapted from "Living in a Dynamic TCP/IP Environment" technote. */
|
||||
static Boolean
|
||||
install_ipaddr_source (void)
|
||||
{
|
||||
CFRunLoopSourceRef source = NULL;
|
||||
|
||||
SCDynamicStoreContext context = {0};
|
||||
SCDynamicStoreRef ref;
|
||||
|
||||
ref = SCDynamicStoreCreate (NULL,
|
||||
CFSTR ("AddIPAddressListChangeCallbackSCF"),
|
||||
ipaddr_callback, &context);
|
||||
|
||||
if (ref != NULL)
|
||||
{
|
||||
const void *keys[4], *patterns[2];
|
||||
int i;
|
||||
|
||||
keys[0] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4);
|
||||
keys[1] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv6);
|
||||
keys[2] = SCDynamicStoreKeyCreateComputerName (NULL);
|
||||
keys[3] = SCDynamicStoreKeyCreateHostNames (NULL);
|
||||
|
||||
patterns[0] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4);
|
||||
patterns[1] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv6);
|
||||
|
||||
if (keys[0] != NULL && keys[1] != NULL && keys[2] != NULL
|
||||
&& keys[3] != NULL && patterns[0] != NULL && patterns[1] != NULL)
|
||||
{
|
||||
CFArrayRef key_array, pattern_array;
|
||||
|
||||
key_array = CFArrayCreate (NULL, keys, 4, &kCFTypeArrayCallBacks);
|
||||
pattern_array = CFArrayCreate (NULL, patterns, 2, &kCFTypeArrayCallBacks);
|
||||
|
||||
if (key_array != NULL || pattern_array != NULL)
|
||||
{
|
||||
SCDynamicStoreSetNotificationKeys (ref, key_array, pattern_array);
|
||||
source = SCDynamicStoreCreateRunLoopSource (NULL, ref, 0);
|
||||
}
|
||||
|
||||
if (key_array != NULL)
|
||||
CFRelease (key_array);
|
||||
if (pattern_array != NULL)
|
||||
CFRelease (pattern_array);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
if (keys[i] != NULL)
|
||||
CFRelease (keys[i]);
|
||||
for (i = 0; i < 2; i++)
|
||||
if (patterns[i] != NULL)
|
||||
CFRelease (patterns[i]);
|
||||
|
||||
CFRelease (ref);
|
||||
}
|
||||
|
||||
if (source != NULL)
|
||||
{
|
||||
CFRunLoopAddSource (CFRunLoopGetCurrent (),
|
||||
source, kCFRunLoopDefaultMode);
|
||||
CFRelease (source);
|
||||
}
|
||||
|
||||
return source != NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Entrypoint. */
|
||||
|
||||
void
|
||||
termination_signal_handler (int unused_sig)
|
||||
{
|
||||
signal (SIGTERM, SIG_DFL);
|
||||
signal (SIGHUP, SIG_DFL);
|
||||
signal (SIGINT, SIG_DFL);
|
||||
signal (SIGQUIT, SIG_DFL);
|
||||
|
||||
longjmp (exit_continuation, 1);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char **xargv;
|
||||
int i, j;
|
||||
int fd;
|
||||
|
||||
xargv = alloca (sizeof (char *) * (argc + 32));
|
||||
|
||||
if (!read_boolean_pref (CFSTR ("no_auth"), FALSE))
|
||||
auth_file = XauFileName ();
|
||||
|
||||
/* The standard X11 behaviour is for the server to quit when the first
|
||||
client exits. But it can be useful for debugging (and to mimic our
|
||||
behaviour in the beta releases) to not do that. */
|
||||
|
||||
xinit_kills_server = read_boolean_pref (CFSTR ("xinit_kills_server"), TRUE);
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (argv[i][0] == ':')
|
||||
server_name = argv[i];
|
||||
}
|
||||
|
||||
if (server_name == NULL)
|
||||
{
|
||||
static char name[8];
|
||||
|
||||
/* No display number specified, so search for the first unused.
|
||||
|
||||
There's a big old race condition here if two servers start at
|
||||
the same time, but that's fairly unlikely. We could create
|
||||
lockfiles or something, but that's seems more likely to cause
|
||||
problems than the race condition itself.. */
|
||||
|
||||
for (i = 0; i < MAX_DISPLAYS; i++)
|
||||
{
|
||||
if (!display_exists_p (i))
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == MAX_DISPLAYS)
|
||||
{
|
||||
fprintf (stderr, "%s: couldn't allocate a display number", argv[0]);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
sprintf (name, ":%d", i);
|
||||
server_name = name;
|
||||
}
|
||||
|
||||
if (auth_file != NULL)
|
||||
{
|
||||
/* Create new Xauth keys and add them to the .Xauthority file */
|
||||
|
||||
make_auth_keys (server_name);
|
||||
write_auth_file (TRUE);
|
||||
}
|
||||
|
||||
/* Construct our new argv */
|
||||
|
||||
i = j = 0;
|
||||
|
||||
xargv[i++] = argv[j++];
|
||||
|
||||
if (auth_file != NULL)
|
||||
{
|
||||
xargv[i++] = "-auth";
|
||||
xargv[i++] = auth_file;
|
||||
}
|
||||
|
||||
/* By default, don't listen on tcp sockets if Xauth is disabled. */
|
||||
|
||||
if (read_boolean_pref (CFSTR ("nolisten_tcp"), auth_file == NULL))
|
||||
{
|
||||
xargv[i++] = "-nolisten";
|
||||
xargv[i++] = "tcp";
|
||||
}
|
||||
|
||||
while (j < argc)
|
||||
{
|
||||
if (argv[j++][0] != ':')
|
||||
xargv[i++] = argv[j-1];
|
||||
}
|
||||
|
||||
xargv[i++] = (char *) server_name;
|
||||
xargv[i++] = NULL;
|
||||
|
||||
/* Detach from any controlling terminal and connect stdin to /dev/null */
|
||||
|
||||
#ifdef TIOCNOTTY
|
||||
fd = open ("/dev/tty", O_RDONLY);
|
||||
if (fd != -1)
|
||||
{
|
||||
ioctl (fd, TIOCNOTTY, 0);
|
||||
close (fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
fd = open ("/dev/null", O_RDWR, 0);
|
||||
if (fd >= 0)
|
||||
{
|
||||
dup2 (fd, 0);
|
||||
if (fd > 0)
|
||||
close (fd);
|
||||
}
|
||||
|
||||
if (!start_server (xargv))
|
||||
return 1;
|
||||
|
||||
if (!wait_for_server ())
|
||||
{
|
||||
kill (server_pid, SIGTERM);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!start_client ())
|
||||
{
|
||||
kill (server_pid, SIGTERM);
|
||||
return 1;
|
||||
}
|
||||
|
||||
signal (SIGCHLD, sigchld_handler);
|
||||
|
||||
signal (SIGTERM, termination_signal_handler);
|
||||
signal (SIGHUP, termination_signal_handler);
|
||||
signal (SIGINT, termination_signal_handler);
|
||||
signal (SIGQUIT, termination_signal_handler);
|
||||
|
||||
if (setjmp (exit_continuation) == 0)
|
||||
{
|
||||
if (install_ipaddr_source ())
|
||||
CFRunLoopRun ();
|
||||
else
|
||||
while (1) pause ();
|
||||
}
|
||||
|
||||
signal (SIGCHLD, SIG_IGN);
|
||||
|
||||
if (client_pid >= 0) kill (client_pid, SIGTERM);
|
||||
if (server_pid >= 0) kill (server_pid, SIGTERM);
|
||||
|
||||
if (auth_file != NULL)
|
||||
{
|
||||
/* Remove our Xauth keys */
|
||||
|
||||
write_auth_file (FALSE);
|
||||
}
|
||||
|
||||
free_auth_items ();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -204,6 +204,12 @@ DarwinPrintBanner()
|
|||
}
|
||||
|
||||
|
||||
void DDXRingBell(int volume, int pitch, int duration)
|
||||
{
|
||||
// FIXME -- make some noise, yo
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* DarwinSaveScreen
|
||||
* X screensaver support. Not implemented.
|
||||
|
|
|
@ -58,6 +58,10 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr);
|
|||
void DarwinEQEnqueue(const xEvent *e);
|
||||
void DarwinEQPointerPost(xEvent *e);
|
||||
void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
|
||||
void DarwinPokeEQ(void);
|
||||
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y);
|
||||
void DarwinSendKeyboardEvents(int ev_type, int keycode);
|
||||
void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y);
|
||||
|
||||
// From darwinKeyboard.c
|
||||
int DarwinModifierNXKeyToNXKeycode(int key, int side);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
* Darwin event queue and event handling
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
|
||||
Darwin event queue and event handling
|
||||
|
||||
Copyright 2007 Apple Inc.
|
||||
Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved.
|
||||
Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
|
||||
|
||||
This file is based on mieq.c by Keith Packard,
|
||||
which contains the following copyright:
|
||||
|
@ -61,6 +61,8 @@ typedef struct _Event {
|
|||
ScreenPtr pScreen;
|
||||
} EventRec, *EventPtr;
|
||||
|
||||
int input_check_zero, input_check_flag;
|
||||
|
||||
typedef struct _EventQueue {
|
||||
HWEventQueueType head, tail; /* long for SetInputCheck */
|
||||
CARD32 lastEventTime; /* to avoid time running backwards */
|
||||
|
@ -72,7 +74,7 @@ typedef struct _EventQueue {
|
|||
} EventQueueRec, *EventQueuePtr;
|
||||
|
||||
static EventQueueRec darwinEventQueue;
|
||||
|
||||
xEvent *darwinEvents;
|
||||
|
||||
/*
|
||||
* DarwinPressModifierMask
|
||||
|
@ -177,18 +179,16 @@ static void DarwinSimulateMouseClick(
|
|||
}
|
||||
|
||||
|
||||
Bool
|
||||
DarwinEQInit(
|
||||
DevicePtr pKbd,
|
||||
DevicePtr pPtr)
|
||||
{
|
||||
Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
|
||||
darwinEvents = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum());
|
||||
mieqInit();
|
||||
darwinEventQueue.head = darwinEventQueue.tail = 0;
|
||||
darwinEventQueue.lastEventTime = GetTimeInMillis ();
|
||||
darwinEventQueue.pKbd = pKbd;
|
||||
darwinEventQueue.pPtr = pPtr;
|
||||
darwinEventQueue.pEnqueueScreen = screenInfo.screens[0];
|
||||
darwinEventQueue.pDequeueScreen = darwinEventQueue.pEnqueueScreen;
|
||||
SetInputCheck (&darwinEventQueue.head, &darwinEventQueue.tail);
|
||||
SetInputCheck(&input_check_zero, &input_check_flag);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -199,11 +199,10 @@ DarwinEQInit(
|
|||
* DarwinEQEnqueue - called from event gathering thread
|
||||
* ProcessInputEvents - called from X server thread
|
||||
* DarwinEQEnqueue should never be called from more than one thread.
|
||||
*
|
||||
* This should be deprecated in favor of miEQEnqueue -- BB
|
||||
*/
|
||||
void
|
||||
DarwinEQEnqueue(
|
||||
const xEvent *e)
|
||||
{
|
||||
void DarwinEQEnqueue(const xEvent *e) {
|
||||
HWEventQueueType oldtail, newtail;
|
||||
char byte = 0;
|
||||
|
||||
|
@ -213,13 +212,12 @@ DarwinEQEnqueue(
|
|||
// This is difficult to do in a thread-safe way and rarely useful.
|
||||
|
||||
newtail = oldtail + 1;
|
||||
if (newtail == QUEUE_SIZE)
|
||||
newtail = 0;
|
||||
if (newtail == QUEUE_SIZE) newtail = 0;
|
||||
/* Toss events which come in late */
|
||||
if (newtail == darwinEventQueue.head)
|
||||
return;
|
||||
if (newtail == darwinEventQueue.head) return;
|
||||
|
||||
darwinEventQueue.events[oldtail].event = *e;
|
||||
|
||||
/*
|
||||
* Make sure that event times don't go backwards - this
|
||||
* is "unnecessary", but very useful
|
||||
|
@ -244,20 +242,13 @@ DarwinEQEnqueue(
|
|||
* DarwinEQPointerPost
|
||||
* Post a pointer event. Used by the mipointer.c routines.
|
||||
*/
|
||||
void
|
||||
DarwinEQPointerPost(
|
||||
xEvent *e)
|
||||
{
|
||||
void DarwinEQPointerPost(xEvent *e) {
|
||||
(*darwinEventQueue.pPtr->processInputProc)
|
||||
(e, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DarwinEQSwitchScreen(
|
||||
ScreenPtr pScreen,
|
||||
Bool fromDIX)
|
||||
{
|
||||
void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX) {
|
||||
darwinEventQueue.pEnqueueScreen = pScreen;
|
||||
if (fromDIX)
|
||||
darwinEventQueue.pDequeueScreen = pScreen;
|
||||
|
@ -268,8 +259,7 @@ DarwinEQSwitchScreen(
|
|||
* ProcessInputEvents
|
||||
* Read and process events from the event queue until it is empty.
|
||||
*/
|
||||
void ProcessInputEvents(void)
|
||||
{
|
||||
void ProcessInputEvents(void) {
|
||||
EventRec *e;
|
||||
int x, y;
|
||||
xEvent xe;
|
||||
|
@ -277,12 +267,15 @@ void ProcessInputEvents(void)
|
|||
// button number and modifier mask of currently pressed fake button
|
||||
static int darwinFakeMouseButtonDown = 0;
|
||||
static int darwinFakeMouseButtonMask = 0;
|
||||
input_check_flag=0;
|
||||
|
||||
// ErrorF("calling mieqProcessInputEvents\n");
|
||||
mieqProcessInputEvents();
|
||||
|
||||
// Empty the signaling pipe
|
||||
x = sizeof(xe);
|
||||
while (x == sizeof(xe)) {
|
||||
while (x == sizeof(xe))
|
||||
x = read(darwinEventReadFD, &xe, sizeof(xe));
|
||||
}
|
||||
|
||||
while (darwinEventQueue.head != darwinEventQueue.tail)
|
||||
{
|
||||
|
@ -298,10 +291,16 @@ void ProcessInputEvents(void)
|
|||
dixScreenOrigins[miPointerCurrentScreen()->myNum].x;
|
||||
xe.u.keyButtonPointer.rootY -= darwinMainScreenY +
|
||||
dixScreenOrigins[miPointerCurrentScreen()->myNum].y;
|
||||
|
||||
/* ErrorF("old rootX = (%d,%d) darwinMainScreen = (%d,%d) dixScreenOrigins[%d]=(%d,%d)\n",
|
||||
xe.u.keyButtonPointer.rootX, xe.u.keyButtonPointer.rootY,
|
||||
darwinMainScreenX, darwinMainScreenY,
|
||||
miPointerCurrentScreen()->myNum,
|
||||
dixScreenOrigins[miPointerCurrentScreen()->myNum].x,
|
||||
dixScreenOrigins[miPointerCurrentScreen()->myNum].y); */
|
||||
|
||||
//Assumption - screen switching can only occur on motion events
|
||||
|
||||
/*
|
||||
* Assumption - screen switching can only occur on motion events
|
||||
*/
|
||||
if (e->pScreen != darwinEventQueue.pDequeueScreen)
|
||||
{
|
||||
darwinEventQueue.pDequeueScreen = e->pScreen;
|
||||
|
|
54
hw/darwin/quartz/Makefile.am
Normal file
54
hw/darwin/quartz/Makefile.am
Normal file
|
@ -0,0 +1,54 @@
|
|||
noinst_LIBRARIES = libXQuartz.a
|
||||
|
||||
AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
|
||||
AM_OBJCFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
|
||||
|
||||
INCLUDES = -I$(srcdir) -I$(srcdir)/.. @XORG_INCS@
|
||||
AM_DEFS = -DHAS_CG_MACH_PORT -DHAS_KL_API
|
||||
if HAVE_X_PLUGIN
|
||||
AM_DEFS += -DBUILD_XPR
|
||||
endif
|
||||
DEFS = @DEFS@ $(AM_DEFS) -DXBINDIR=\"${bindir}\"
|
||||
|
||||
libXQuartz_a_SOURCES = \
|
||||
Preferences.m \
|
||||
XApplication.m \
|
||||
XServer.m \
|
||||
applewm.c \
|
||||
keysym2ucs.c \
|
||||
quartz.c \
|
||||
quartzAudio.c \
|
||||
quartzCocoa.m \
|
||||
quartzPasteboard.c \
|
||||
quartzKeyboard.c \
|
||||
quartzStartup.c \
|
||||
pseudoramiX.c
|
||||
|
||||
bin_PROGRAMS = XDarwinStartup
|
||||
|
||||
XDarwinStartup_SOURCES = XDarwinStartup.c
|
||||
XDarwinStartup_LDFLAGS = -Wl,-framework,CoreFoundation \
|
||||
-Wl,-framework,ApplicationServices
|
||||
XDarwinStartupCFLAGS = -DXBINDIR="${bindir}"
|
||||
XDARWINROOT = @APPLE_APPLICATIONS_DIR@
|
||||
BINDIR = $(bindir)
|
||||
install-exec-local:
|
||||
-(cd $(DESTDIR)$(BINDIR); rm X; $(LN_S) XDarwinStartup X)
|
||||
|
||||
man1_MANS = XDarwinStartup.man
|
||||
|
||||
EXTRA_DIST = \
|
||||
applewmExt.h \
|
||||
keysym2ucs.h \
|
||||
Preferences.h \
|
||||
pseudoramiX.h \
|
||||
quartzAudio.h \
|
||||
quartzCommon.h \
|
||||
quartzCursor.c \
|
||||
quartzCursor.h \
|
||||
quartz.h \
|
||||
quartzPasteboard.h \
|
||||
XApplication.h \
|
||||
XDarwin.pbproj/project.pbxproj \
|
||||
XServer.h \
|
||||
XDarwinStartup.man
|
|
@ -31,7 +31,9 @@
|
|||
* authorization.
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/Preferences.m,v 1.5 2004/06/08 22:58:10 torrey Exp $ */
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#import "quartzCommon.h"
|
||||
|
||||
#define BOOL xBOOL
|
||||
|
@ -44,7 +46,7 @@
|
|||
|
||||
// Macros to build the path name
|
||||
#ifndef XBINDIR
|
||||
#define XBINDIR /usr/X11R6/bin
|
||||
#define XBINDIR /usr/X11/bin
|
||||
#endif
|
||||
#define STR(s) #s
|
||||
#define XSTRPATH(s) STR(s)
|
||||
|
|
|
@ -387,7 +387,7 @@
|
|||
<key>CFBundleIconFile</key>
|
||||
<string>XDarwin.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.xfree86.XDarwin</string>
|
||||
<string>org.x.x11</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
// Macros to build the path name
|
||||
#ifndef XBINDIR
|
||||
#define XBINDIR /usr/X11R6/bin
|
||||
#define XBINDIR /usr/X11/bin
|
||||
#endif
|
||||
#define STR(s) #s
|
||||
#define XSTRPATH(s) STR(s) "/"
|
||||
|
@ -124,7 +124,7 @@ int main(
|
|||
|
||||
// Otherwise query LaunchServices for the location of the XDarwin application
|
||||
theStatus = LSFindApplicationForInfo(kLSUnknownCreator,
|
||||
CFSTR("org.xfree86.XDarwin"),
|
||||
CFSTR("org.x.x11"),
|
||||
NULL, NULL, &appURL);
|
||||
if (theStatus) {
|
||||
fprintf(stderr, "Could not find the XDarwin application. (Error = 0x%lx)\n", theStatus);
|
||||
|
|
|
@ -36,18 +36,20 @@
|
|||
*/
|
||||
/* $XdotOrg: xc/programs/Xserver/hw/darwin/quartz/XServer.m,v 1.3 2004/07/30 19:12:17 torrey Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/XServer.m,v 1.19 2003/11/24 05:39:01 torrey Exp $ */
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartzCommon.h"
|
||||
|
||||
#define BOOL xBOOL
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "X11/X.h"
|
||||
#include "X11/Xproto.h"
|
||||
#include "os.h"
|
||||
#include "opaque.h"
|
||||
#include "darwin.h"
|
||||
#include "quartz.h"
|
||||
#define _APPLEWM_SERVER_
|
||||
#include "applewm.h"
|
||||
#include "X11/extensions/applewm.h"
|
||||
#include "applewmExt.h"
|
||||
#undef BOOL
|
||||
|
||||
|
@ -830,13 +832,13 @@ static io_connect_t root_port;
|
|||
chdir(tem);
|
||||
|
||||
/* Setup environment */
|
||||
snprintf(buf, sizeof(buf), ":%s", display);
|
||||
setenv("DISPLAY", buf, TRUE);
|
||||
// snprintf(buf, sizeof(buf), ":%s", display);
|
||||
// setenv("DISPLAY", buf, TRUE);
|
||||
tem = getenv("PATH");
|
||||
if (tem != NULL && tem[0] != NULL)
|
||||
snprintf(buf, sizeof(buf), "%s:/usr/X11R6/bin", tem);
|
||||
snprintf(buf, sizeof(buf), "%s:/usr/X11/bin", tem);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "/bin:/usr/bin:/usr/X11R6/bin");
|
||||
snprintf(buf, sizeof(buf), "/bin:/usr/bin:/usr/X11/bin");
|
||||
setenv("PATH", buf, TRUE);
|
||||
|
||||
execvp(argv[0], (char **const) argv);
|
||||
|
|
|
@ -24,7 +24,9 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartzCommon.h"
|
||||
|
||||
#define NEED_REPLIES
|
||||
|
@ -43,7 +45,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <X11/Xatom.h>
|
||||
#include "darwin.h"
|
||||
#define _APPLEWM_SERVER_
|
||||
#include "applewmstr.h"
|
||||
#include "X11/extensions/applewmstr.h"
|
||||
#include "applewmExt.h"
|
||||
|
||||
#define DEFINE_ATOM_HELPER(func,atom_name) \
|
||||
|
@ -444,7 +446,11 @@ ProcAppleWMSetWindowMenu(
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef INXQUARTZ
|
||||
X11ApplicationSetWindowMenu (nitems, items, shortcuts);
|
||||
#else
|
||||
QuartzSetWindowMenu (nitems, items, shortcuts);
|
||||
#endif
|
||||
|
||||
free(items);
|
||||
free(shortcuts);
|
||||
|
@ -460,10 +466,12 @@ ProcAppleWMSetWindowMenuCheck(
|
|||
REQUEST(xAppleWMSetWindowMenuCheckReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xAppleWMSetWindowMenuCheckReq);
|
||||
|
||||
#ifdef INXQUARTZ
|
||||
X11ApplicationSetWindowMenuCheck(stuff->index);
|
||||
#else
|
||||
QuartzMessageMainThread(kQuartzSetWindowMenuCheck, &stuff->index,
|
||||
sizeof(stuff->index));
|
||||
|
||||
#endif
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
|
@ -473,9 +481,11 @@ ProcAppleWMSetFrontProcess(
|
|||
)
|
||||
{
|
||||
REQUEST_SIZE_MATCH(xAppleWMSetFrontProcessReq);
|
||||
|
||||
#ifdef INXQUARTZ
|
||||
X11ApplicationSetFrontProcess();
|
||||
#else
|
||||
QuartzMessageMainThread(kQuartzSetFrontProcess, NULL, 0);
|
||||
|
||||
#endif
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
|
@ -514,9 +524,12 @@ ProcAppleWMSetCanQuit(
|
|||
REQUEST(xAppleWMSetCanQuitReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xAppleWMSetCanQuitReq);
|
||||
|
||||
#ifdef INXQUARTZ
|
||||
X11ApplicationSetCanQuit(stuff->state);
|
||||
#else
|
||||
QuartzMessageMainThread(kQuartzSetCanQuit, &stuff->state,
|
||||
sizeof(stuff->state));
|
||||
#endif
|
||||
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/XView.m,v 1.1 2003/06/07 05:49:07 torrey Exp $ */
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#import "XView.h"
|
||||
|
||||
|
||||
|
|
|
@ -27,17 +27,19 @@
|
|||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/xpr/xprFrame.c,v 1.2 2003/06/30 01:45:13 torrey Exp $ */
|
||||
|
||||
#include "quartzCommon.h"
|
||||
#include "cr.h"
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartz/quartzCommon.h"
|
||||
#include "quartz/cr/cr.h"
|
||||
|
||||
#undef BOOL
|
||||
#define BOOL xBOOL
|
||||
#include "rootless.h"
|
||||
#include "X.h"
|
||||
#include "X11/X.h"
|
||||
#define _APPLEWM_SERVER_
|
||||
#include "applewm.h"
|
||||
#include "applewmExt.h"
|
||||
#include "X11/extensions/applewm.h"
|
||||
#include "quartz/applewmExt.h"
|
||||
#undef BOOL
|
||||
|
||||
#define StdDocumentStyleMask (NSTitledWindowMask | \
|
||||
|
|
|
@ -29,14 +29,16 @@
|
|||
*/
|
||||
/* $XdotOrg: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m,v 1.2 2004/04/23 19:15:51 eich Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m,v 1.9 2004/03/19 02:05:29 torrey Exp $ */
|
||||
|
||||
#include "quartzCommon.h"
|
||||
#include "cr.h"
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartz/quartzCommon.h"
|
||||
#include "quartz/cr/cr.h"
|
||||
|
||||
#undef BOOL
|
||||
#define BOOL xBOOL
|
||||
#include "rootless.h"
|
||||
#include "applewmExt.h"
|
||||
#include "quartz/applewmExt.h"
|
||||
#include "windowstr.h"
|
||||
#undef BOOL
|
||||
|
||||
|
|
|
@ -29,19 +29,21 @@
|
|||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/crScreen.m,v 1.5 2003/11/12 20:21:52 torrey Exp $ */
|
||||
|
||||
#include "quartzCommon.h"
|
||||
#include "cr.h"
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartz/quartzCommon.h"
|
||||
#include "quartz/cr/cr.h"
|
||||
|
||||
#undef BOOL
|
||||
#define BOOL xBOOL
|
||||
#include "darwin.h"
|
||||
#include "quartz.h"
|
||||
#include "quartzCursor.h"
|
||||
#include "quartz/quartz.h"
|
||||
#include "quartz/quartzCursor.h"
|
||||
#include "rootless.h"
|
||||
#include "safeAlpha.h"
|
||||
#include "pseudoramiX.h"
|
||||
#include "applewmExt.h"
|
||||
#include "safeAlpha/safeAlpha.h"
|
||||
#include "quartz/pseudoramiX.h"
|
||||
#include "quartz/applewmExt.h"
|
||||
|
||||
#include "regionstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
|
|
@ -25,11 +25,13 @@
|
|||
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#include "quartzCommon.h"
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartz/quartzCommon.h"
|
||||
#include "darwin.h"
|
||||
#include "quartz.h"
|
||||
#include "quartzCursor.h"
|
||||
#include "quartz/quartz.h"
|
||||
#include "quartz/quartzCursor.h"
|
||||
#include "colormapst.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "micmap.h"
|
||||
|
|
|
@ -29,9 +29,11 @@
|
|||
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#include "quartzCommon.h"
|
||||
#include "quartzCursor.h"
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartz/quartzCommon.h"
|
||||
#include "quartz/quartzCursor.h"
|
||||
#include "darwin.h"
|
||||
|
||||
#include <pthread.h>
|
||||
|
|
|
@ -34,7 +34,9 @@ Equipment Corporation.
|
|||
******************************************************************/
|
||||
|
||||
#include "pseudoramiX.h"
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "extnsionst.h"
|
||||
#include "dixstruct.h"
|
||||
#include "window.h"
|
||||
|
|
|
@ -29,14 +29,16 @@
|
|||
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartzCommon.h"
|
||||
#include "quartz.h"
|
||||
#include "darwin.h"
|
||||
#include "quartzAudio.h"
|
||||
#include "pseudoramiX.h"
|
||||
#define _APPLEWM_SERVER_
|
||||
#include "applewm.h"
|
||||
#include "X11/extensions/applewm.h"
|
||||
#include "applewmExt.h"
|
||||
|
||||
// X headers
|
||||
|
@ -158,7 +160,11 @@ void DarwinModeInitInput(
|
|||
int argc,
|
||||
char **argv )
|
||||
{
|
||||
#ifdef INXQUARTZ
|
||||
X11ApplicationServerReady();
|
||||
#else
|
||||
QuartzMessageMainThread(kQuartzServerStarted, NULL, 0);
|
||||
#endif
|
||||
|
||||
// Do final display mode specific initialization before handling events
|
||||
if (quartzProcs->InitInput)
|
||||
|
@ -272,7 +278,9 @@ static void QuartzHide(void)
|
|||
}
|
||||
}
|
||||
quartzServerVisible = FALSE;
|
||||
#ifndef INXQUARTZ
|
||||
QuartzMessageMainThread(kQuartzServerHidden, NULL, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,7 +35,9 @@
|
|||
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartzCommon.h"
|
||||
#include "quartzAudio.h"
|
||||
|
||||
|
@ -44,6 +46,7 @@
|
|||
|
||||
#include "inputstr.h"
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <assert.h>
|
||||
|
||||
void NSBeep();
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/quartzCocoa.m,v 1.5 2004/06/08 22:58:10 torrey Exp $ */
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "quartzCommon.h"
|
||||
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartzCommon.h"
|
||||
#include "quartzCursor.h"
|
||||
#include "darwin.h"
|
||||
|
@ -90,7 +93,9 @@ static pthread_cond_t cursorCondition;
|
|||
/* Acquire lock and tell the main thread to change cursor */ \
|
||||
pthread_mutex_lock(&cursorMutex); \
|
||||
currentCursor = (CCrsrHandle) (cursorH); \
|
||||
#ifndef INXQUARTZ
|
||||
QuartzMessageMainThread(kQuartzCursorUpdate, NULL, 0); \
|
||||
#endif
|
||||
\
|
||||
/* Wait for the main thread to change the cursor */ \
|
||||
pthread_cond_wait(&cursorCondition, &cursorMutex); \
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "screenint.h"
|
||||
|
||||
Bool QuartzInitCursor(ScreenPtr pScreen);
|
||||
void QuartzReallySetCursor(void);
|
||||
void QuartzSuspendXCursor(ScreenPtr pScreen);
|
||||
void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y);
|
||||
|
||||
|
|
|
@ -33,13 +33,16 @@
|
|||
prior written authorization.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartzCommon.h"
|
||||
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
#include "darwinKeyboard.h"
|
||||
#include "keysym.h"
|
||||
#include "X11/keysym.h"
|
||||
#include "keysym2ucs.h"
|
||||
|
||||
#ifdef HAS_KL_API
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartzPasteboard.h"
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
|
|
|
@ -37,21 +37,37 @@
|
|||
#include "quartz.h"
|
||||
#include "opaque.h"
|
||||
#include "micmap.h"
|
||||
|
||||
int NSApplicationMain(int argc, char *argv[]);
|
||||
#include <assert.h>
|
||||
|
||||
char **envpGlobal; // argcGlobal and argvGlobal
|
||||
// are from dix/globals.c
|
||||
|
||||
#ifdef INXQUARTZ
|
||||
void X11ControllerMain(int argc, char *argv[], void (*server_thread) (void *), void *server_arg);
|
||||
# ifdef GLXEXT
|
||||
void GlxExtensionInit(void);
|
||||
void GlxWrapInitVisuals(miInitVisualsProcPtr *);
|
||||
# endif
|
||||
|
||||
static void server_thread (void *arg) {
|
||||
extern int main (int argc, char **argv, char **envp);
|
||||
exit (main (argcGlobal, argvGlobal, envpGlobal));
|
||||
}
|
||||
#else
|
||||
int NSApplicationMain(int argc, char *argv[]);
|
||||
typedef Bool (*QuartzModeBundleInitPtr)(void);
|
||||
|
||||
# ifdef GLXEXT
|
||||
// GLX bundle function pointers
|
||||
typedef void (*GlxExtensionInitPtr)(void);
|
||||
static GlxExtensionInitPtr GlxExtensionInit = NULL;
|
||||
|
||||
typedef void (*GlxWrapInitVisualsPtr)(miInitVisualsProcPtr *);
|
||||
static GlxWrapInitVisualsPtr GlxWrapInitVisuals = NULL;
|
||||
|
||||
typedef Bool (*QuartzModeBundleInitPtr)(void);
|
||||
|
||||
void * __DarwinglXMesaProvider = NULL;
|
||||
typedef void (*GlxPushProviderPtr)(void *);
|
||||
GlxPushProviderPtr GlxPushProvider = NULL;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* DarwinHandleGUI
|
||||
|
@ -71,7 +87,9 @@ void DarwinHandleGUI(
|
|||
int fd[2];
|
||||
|
||||
if (been_here) {
|
||||
#ifdef INXDARWINAPP
|
||||
QuartzReadPreferences();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
been_here = TRUE;
|
||||
|
@ -106,11 +124,27 @@ void DarwinHandleGUI(
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef INXQUARTZ
|
||||
/* Initially I ran the X server on the main thread, and received
|
||||
events on the second thread. But now we may be using Carbon,
|
||||
that needs to run on the main thread. (Otherwise, when it's
|
||||
prebound, it will initialize itself on the wrong thread)
|
||||
|
||||
grr.. but doing that means that if the X thread gets scheduled
|
||||
before the main thread when we're _not_ prebound, things fail,
|
||||
so initialize by hand. */
|
||||
extern void _InitHLTB(void);
|
||||
|
||||
_InitHLTB();
|
||||
|
||||
X11ControllerMain(argc, argv, server_thread, NULL);
|
||||
#else
|
||||
main_exit = NSApplicationMain(argc, argv);
|
||||
#endif
|
||||
exit(main_exit);
|
||||
}
|
||||
|
||||
|
||||
#ifndef INXQUARTZ
|
||||
/*
|
||||
* QuartzLoadDisplayBundle
|
||||
* Try to load the appropriate bundle containing the back end display code.
|
||||
|
@ -168,7 +202,7 @@ Bool QuartzLoadDisplayBundle(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
#ifdef GLXEXT
|
||||
/*
|
||||
* LoadGlxBundle
|
||||
* The Quartz mode X server needs to dynamically load the appropriate
|
||||
|
@ -186,7 +220,7 @@ static void LoadGlxBundle(void)
|
|||
|
||||
// Choose the bundle to load
|
||||
ErrorF("Loading GLX bundle ");
|
||||
if (quartzUseAGL) {
|
||||
if (/*quartzUseAGL*/0) {
|
||||
bundleName = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault,
|
||||
quartzOpenGLBundle,
|
||||
kCFStringEncodingASCII,
|
||||
|
@ -213,6 +247,14 @@ static void LoadGlxBundle(void)
|
|||
}
|
||||
|
||||
// Find the GLX init functions
|
||||
|
||||
|
||||
__DarwinglXMesaProvider = (void *) CFBundleGetDataPointerForName(
|
||||
glxBundle, CFSTR("__glXMesaProvider"));
|
||||
|
||||
GlxPushProvider = (void *) CFBundleGetFunctionPointerForName(
|
||||
glxBundle, CFSTR("GlxPushProvider"));
|
||||
|
||||
GlxExtensionInit = (void *) CFBundleGetFunctionPointerForName(
|
||||
glxBundle, CFSTR("GlxExtensionInit"));
|
||||
|
||||
|
@ -227,7 +269,26 @@ static void LoadGlxBundle(void)
|
|||
CFRelease(bundleName);
|
||||
CFRelease(bundleURL);
|
||||
}
|
||||
# endif
|
||||
#else
|
||||
|
||||
Bool QuartzLoadDisplayBundle(const char *dpyBundleName)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLXEXT
|
||||
void DarwinGlxPushProvider(void *impl)
|
||||
{
|
||||
#ifndef INXQUARTZ
|
||||
if (!GlxExtensionInit)
|
||||
LoadGlxBundle();
|
||||
#endif
|
||||
|
||||
GlxPushProvider(impl);
|
||||
}
|
||||
|
||||
/*
|
||||
* DarwinGlxExtensionInit
|
||||
|
@ -235,9 +296,10 @@ static void LoadGlxBundle(void)
|
|||
*/
|
||||
void DarwinGlxExtensionInit(void)
|
||||
{
|
||||
#ifndef INXQUARTZ
|
||||
if (!GlxExtensionInit)
|
||||
LoadGlxBundle();
|
||||
|
||||
#endif
|
||||
GlxExtensionInit();
|
||||
}
|
||||
|
||||
|
@ -248,12 +310,13 @@ void DarwinGlxExtensionInit(void)
|
|||
void DarwinGlxWrapInitVisuals(
|
||||
miInitVisualsProcPtr *procPtr)
|
||||
{
|
||||
#ifndef INXQUARTZ
|
||||
if (!GlxWrapInitVisuals)
|
||||
LoadGlxBundle();
|
||||
|
||||
#endif
|
||||
GlxWrapInitVisuals(procPtr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int DarwinModeProcessArgument( int argc, char *argv[], int i )
|
||||
{
|
||||
|
|
|
@ -35,6 +35,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#define NEED_REPLIES
|
||||
#define NEED_EVENTS
|
||||
#include <X11/X.h>
|
||||
|
|
107
hw/darwin/quartz/xpr/appledri.h
Normal file
107
hw/darwin/quartz/xpr/appledri.h
Normal file
|
@ -0,0 +1,107 @@
|
|||
/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */
|
||||
/**************************************************************************
|
||||
|
||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
Copyright 2000 VA Linux Systems, Inc.
|
||||
Copyright (c) 2002 Apple Computer, Inc.
|
||||
All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sub license, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the
|
||||
next paragraph) shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
* Jens Owen <jens@valinux.com>
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _APPLEDRI_H_
|
||||
#define _APPLEDRI_H_
|
||||
|
||||
#include <X11/Xfuncproto.h>
|
||||
|
||||
#define X_AppleDRIQueryVersion 0
|
||||
#define X_AppleDRIQueryDirectRenderingCapable 1
|
||||
#define X_AppleDRICreateSurface 2
|
||||
#define X_AppleDRIDestroySurface 3
|
||||
#define X_AppleDRIAuthConnection 4
|
||||
/* Requests up to and including 18 were used in a previous version */
|
||||
|
||||
/* Events */
|
||||
#define AppleDRIObsoleteEvent1 0
|
||||
#define AppleDRIObsoleteEvent2 1
|
||||
#define AppleDRIObsoleteEvent3 2
|
||||
#define AppleDRISurfaceNotify 3
|
||||
#define AppleDRINumberEvents 4
|
||||
|
||||
/* Errors */
|
||||
#define AppleDRIClientNotLocal 0
|
||||
#define AppleDRIOperationNotSupported 1
|
||||
#define AppleDRINumberErrors (AppleDRIOperationNotSupported + 1)
|
||||
|
||||
/* Kinds of SurfaceNotify events: */
|
||||
#define AppleDRISurfaceNotifyChanged 0
|
||||
#define AppleDRISurfaceNotifyDestroyed 1
|
||||
|
||||
#ifndef _APPLEDRI_SERVER_
|
||||
|
||||
typedef struct {
|
||||
int type; /* of event */
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came frome a SendEvent request */
|
||||
Display *display; /* Display the event was read from */
|
||||
Window window; /* window of event */
|
||||
Time time; /* server timestamp when event happened */
|
||||
int kind; /* subtype of event */
|
||||
int arg;
|
||||
} XAppleDRINotifyEvent;
|
||||
|
||||
_XFUNCPROTOBEGIN
|
||||
|
||||
Bool XAppleDRIQueryExtension (Display *dpy, int *event_base, int *error_base);
|
||||
|
||||
Bool XAppleDRIQueryVersion (Display *dpy, int *majorVersion,
|
||||
int *minorVersion, int *patchVersion);
|
||||
|
||||
Bool XAppleDRIQueryDirectRenderingCapable (Display *dpy, int screen,
|
||||
Bool *isCapable);
|
||||
|
||||
void *XAppleDRISetSurfaceNotifyHandler (void (*fun) (Display *dpy,
|
||||
unsigned uid, int kind));
|
||||
|
||||
Bool XAppleDRIAuthConnection (Display *dpy, int screen, unsigned int magic);
|
||||
|
||||
Bool XAppleDRICreateSurface (Display *dpy, int screen, Drawable drawable,
|
||||
unsigned int client_id, unsigned int key[2],
|
||||
unsigned int* uid);
|
||||
|
||||
Bool XAppleDRIDestroySurface (Display *dpy, int screen, Drawable drawable);
|
||||
|
||||
Bool XAppleDRISynchronizeSurfaces (Display *dpy);
|
||||
|
||||
_XFUNCPROTOEND
|
||||
|
||||
#endif /* _APPLEDRI_SERVER_ */
|
||||
#endif /* _APPLEDRI_H_ */
|
||||
|
176
hw/darwin/quartz/xpr/appledristr.h
Normal file
176
hw/darwin/quartz/xpr/appledristr.h
Normal file
|
@ -0,0 +1,176 @@
|
|||
/* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.9 2001/03/21 16:01:08 dawes Exp $ */
|
||||
/**************************************************************************
|
||||
|
||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
Copyright 2000 VA Linux Systems, Inc.
|
||||
Copyright (c) 2002 Apple Computer, Inc.
|
||||
All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sub license, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the
|
||||
next paragraph) shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
* Jens Owen <jens@valinux.com>
|
||||
* Rickard E. (Rik) Fiath <faith@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _APPLEDRISTR_H_
|
||||
#define _APPLEDRISTR_H_
|
||||
|
||||
#include "appledri.h"
|
||||
|
||||
#define APPLEDRINAME "Apple-DRI"
|
||||
|
||||
#define APPLE_DRI_MAJOR_VERSION 1 /* current version numbers */
|
||||
#define APPLE_DRI_MINOR_VERSION 0
|
||||
#define APPLE_DRI_PATCH_VERSION 0
|
||||
|
||||
typedef struct _AppleDRIQueryVersion {
|
||||
CARD8 reqType; /* always DRIReqCode */
|
||||
CARD8 driReqType; /* always X_DRIQueryVersion */
|
||||
CARD16 length B16;
|
||||
} xAppleDRIQueryVersionReq;
|
||||
#define sz_xAppleDRIQueryVersionReq 4
|
||||
|
||||
typedef struct {
|
||||
BYTE type; /* X_Reply */
|
||||
BOOL pad1;
|
||||
CARD16 sequenceNumber B16;
|
||||
CARD32 length B32;
|
||||
CARD16 majorVersion B16; /* major version of DRI protocol */
|
||||
CARD16 minorVersion B16; /* minor version of DRI protocol */
|
||||
CARD32 patchVersion B32; /* patch version of DRI protocol */
|
||||
CARD32 pad3 B32;
|
||||
CARD32 pad4 B32;
|
||||
CARD32 pad5 B32;
|
||||
CARD32 pad6 B32;
|
||||
} xAppleDRIQueryVersionReply;
|
||||
#define sz_xAppleDRIQueryVersionReply 32
|
||||
|
||||
typedef struct _AppleDRIQueryDirectRenderingCapable {
|
||||
CARD8 reqType; /* always DRIReqCode */
|
||||
CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
|
||||
CARD16 length B16;
|
||||
CARD32 screen B32;
|
||||
} xAppleDRIQueryDirectRenderingCapableReq;
|
||||
#define sz_xAppleDRIQueryDirectRenderingCapableReq 8
|
||||
|
||||
typedef struct {
|
||||
BYTE type; /* X_Reply */
|
||||
BOOL pad1;
|
||||
CARD16 sequenceNumber B16;
|
||||
CARD32 length B32;
|
||||
BOOL isCapable;
|
||||
BOOL pad2;
|
||||
BOOL pad3;
|
||||
BOOL pad4;
|
||||
CARD32 pad5 B32;
|
||||
CARD32 pad6 B32;
|
||||
CARD32 pad7 B32;
|
||||
CARD32 pad8 B32;
|
||||
CARD32 pad9 B32;
|
||||
} xAppleDRIQueryDirectRenderingCapableReply;
|
||||
#define sz_xAppleDRIQueryDirectRenderingCapableReply 32
|
||||
|
||||
typedef struct _AppleDRIAuthConnection {
|
||||
CARD8 reqType; /* always DRIReqCode */
|
||||
CARD8 driReqType; /* always X_DRICloseConnection */
|
||||
CARD16 length B16;
|
||||
CARD32 screen B32;
|
||||
CARD32 magic B32;
|
||||
} xAppleDRIAuthConnectionReq;
|
||||
#define sz_xAppleDRIAuthConnectionReq 12
|
||||
|
||||
typedef struct {
|
||||
BYTE type;
|
||||
BOOL pad1;
|
||||
CARD16 sequenceNumber B16;
|
||||
CARD32 length B32;
|
||||
CARD32 authenticated B32;
|
||||
CARD32 pad2 B32;
|
||||
CARD32 pad3 B32;
|
||||
CARD32 pad4 B32;
|
||||
CARD32 pad5 B32;
|
||||
CARD32 pad6 B32;
|
||||
} xAppleDRIAuthConnectionReply;
|
||||
#define zx_xAppleDRIAuthConnectionReply 32
|
||||
|
||||
typedef struct _AppleDRICreateSurface {
|
||||
CARD8 reqType; /* always DRIReqCode */
|
||||
CARD8 driReqType; /* always X_DRICreateSurface */
|
||||
CARD16 length B16;
|
||||
CARD32 screen B32;
|
||||
CARD32 drawable B32;
|
||||
CARD32 client_id B32;
|
||||
} xAppleDRICreateSurfaceReq;
|
||||
#define sz_xAppleDRICreateSurfaceReq 16
|
||||
|
||||
typedef struct {
|
||||
BYTE type; /* X_Reply */
|
||||
BOOL pad1;
|
||||
CARD16 sequenceNumber B16;
|
||||
CARD32 length B32;
|
||||
CARD32 key_0 B32;
|
||||
CARD32 key_1 B32;
|
||||
CARD32 uid B32;
|
||||
CARD32 pad4 B32;
|
||||
CARD32 pad5 B32;
|
||||
CARD32 pad6 B32;
|
||||
} xAppleDRICreateSurfaceReply;
|
||||
#define sz_xAppleDRICreateSurfaceReply 32
|
||||
|
||||
typedef struct _AppleDRIDestroySurface {
|
||||
CARD8 reqType; /* always DRIReqCode */
|
||||
CARD8 driReqType; /* always X_DRIDestroySurface */
|
||||
CARD16 length B16;
|
||||
CARD32 screen B32;
|
||||
CARD32 drawable B32;
|
||||
} xAppleDRIDestroySurfaceReq;
|
||||
#define sz_xAppleDRIDestroySurfaceReq 12
|
||||
|
||||
typedef struct _AppleDRINotify {
|
||||
BYTE type; /* always eventBase + event type */
|
||||
BYTE kind;
|
||||
CARD16 sequenceNumber B16;
|
||||
Time time B32; /* time of change */
|
||||
CARD16 pad1 B16;
|
||||
CARD32 arg B32;
|
||||
CARD32 pad3 B32;
|
||||
} xAppleDRINotifyEvent;
|
||||
#define sz_xAppleDRINotifyEvent 20
|
||||
|
||||
#ifdef _APPLEDRI_SERVER_
|
||||
|
||||
void AppleDRISendEvent (
|
||||
#if NeedFunctionPrototypes
|
||||
int /* type */,
|
||||
unsigned int /* mask */,
|
||||
int /* which */,
|
||||
int /* arg */
|
||||
#endif
|
||||
);
|
||||
|
||||
#endif /* _APPLEDRI_SERVER_ */
|
||||
#endif /* _APPLEDRISTR_H_ */
|
|
@ -33,6 +33,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
*
|
||||
*/
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization. */
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "x-hash.h"
|
||||
#include "x-list.h"
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -28,7 +28,9 @@
|
|||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization. */
|
||||
/* $XFree86: $ */
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "x-hook.h"
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization. */
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "x-list.h"
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
|
|
@ -27,14 +27,15 @@
|
|||
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "xpr.h"
|
||||
#include "applewmExt.h"
|
||||
#include "quartz/applewmExt.h"
|
||||
#include "rootless.h"
|
||||
#include "Xplugin.h"
|
||||
#include <X11/X.h>
|
||||
|
||||
|
||||
static int xprSetWindowLevel(
|
||||
WindowPtr pWin,
|
||||
int level)
|
||||
|
|
|
@ -30,8 +30,10 @@
|
|||
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#include "quartzCommon.h"
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartz/quartzCommon.h"
|
||||
#include "xpr.h"
|
||||
#include "darwin.h"
|
||||
#include "Xplugin.h"
|
||||
|
|
|
@ -27,13 +27,15 @@
|
|||
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "xpr.h"
|
||||
#include "rootlessCommon.h"
|
||||
#include "Xplugin.h"
|
||||
#include "x-hash.h"
|
||||
#include "x-list.h"
|
||||
#include "applewmExt.h"
|
||||
#include "quartz/applewmExt.h"
|
||||
|
||||
#include "propertyst.h"
|
||||
#include "dix.h"
|
||||
|
|
|
@ -27,18 +27,20 @@
|
|||
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#include "quartzCommon.h"
|
||||
#include "quartz.h"
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
#include "quartz/quartzCommon.h"
|
||||
#include "quartz/quartz.h"
|
||||
#include "xpr.h"
|
||||
#include "pseudoramiX.h"
|
||||
#include "quartz/pseudoramiX.h"
|
||||
#include "darwin.h"
|
||||
#include "rootless.h"
|
||||
#include "safeAlpha.h"
|
||||
#include "safeAlpha/safeAlpha.h"
|
||||
#include "dri.h"
|
||||
#include "globals.h"
|
||||
#include "Xplugin.h"
|
||||
#include "applewmExt.h"
|
||||
#include "quartz/applewmExt.h"
|
||||
|
||||
#ifdef DAMAGE
|
||||
# include "damage.h"
|
||||
|
@ -47,7 +49,6 @@
|
|||
// Name of GLX bundle for native OpenGL
|
||||
static const char *xprOpenGLBundle = "glxCGL.bundle";
|
||||
|
||||
|
||||
/*
|
||||
* eventHandler
|
||||
* Callback handler for Xplugin events.
|
||||
|
@ -98,7 +99,6 @@ eventHandler(unsigned int type, const void *arg,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* displayScreenBounds
|
||||
* Return the display ID for a particular display index.
|
||||
|
@ -117,7 +117,6 @@ displayAtIndex(int index)
|
|||
return kCGNullDirectDisplay;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* displayScreenBounds
|
||||
* Return the bounds of a particular display.
|
||||
|
@ -140,7 +139,6 @@ displayScreenBounds(CGDirectDisplayID id)
|
|||
return frame;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* xprAddPseudoramiXScreens
|
||||
* Add a single virtual screen encompassing all the physical screens
|
||||
|
@ -196,7 +194,6 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
|
|||
xfree(displayList);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* xprDisplayInit
|
||||
* Find number of CoreGraphics displays and initialize Xplugin.
|
||||
|
@ -219,9 +216,7 @@ xprDisplayInit(void)
|
|||
darwinScreensFound = 1;
|
||||
|
||||
if (xp_init(XP_IN_BACKGROUND) != Success)
|
||||
{
|
||||
FatalError("Could not initialize the Xplugin library.");
|
||||
}
|
||||
|
||||
xp_select_events(XP_EVENT_DISPLAY_CHANGED
|
||||
| XP_EVENT_WINDOW_STATE_CHANGED
|
||||
|
@ -234,7 +229,6 @@ xprDisplayInit(void)
|
|||
xprAppleWMInit();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* xprAddScreen
|
||||
* Init the framebuffer and record pixmap parameters for the screen.
|
||||
|
@ -304,7 +298,6 @@ xprAddScreen(int index, ScreenPtr pScreen)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* xprSetupScreen
|
||||
* Setup the screen for rootless access.
|
||||
|
@ -341,7 +334,6 @@ xprSetupScreen(int index, ScreenPtr pScreen)
|
|||
return DRIFinishScreenInit(pScreen);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* xprUpdateScreen
|
||||
* Update screen after configuation change.
|
||||
|
@ -358,7 +350,6 @@ xprUpdateScreen(ScreenPtr pScreen)
|
|||
RootlessUpdateScreenPixmap(pScreen);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* xprInitInput
|
||||
* Finalize xpr specific setup.
|
||||
|
@ -375,7 +366,6 @@ xprInitInput(int argc, char **argv)
|
|||
AppleWMSetScreenOrigin(WindowTable[i]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Quartz display mode function list.
|
||||
*/
|
||||
|
@ -401,7 +391,6 @@ static QuartzModeProcsRec xprModeProcs = {
|
|||
DRIDestroySurface
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* QuartzModeBundleInit
|
||||
* Initialize the display mode bundle after loading.
|
||||
|
|
11
hw/darwin/utils/Makefile.am
Normal file
11
hw/darwin/utils/Makefile.am
Normal file
|
@ -0,0 +1,11 @@
|
|||
bin_PROGRAMS = dumpkeymap
|
||||
|
||||
dumpkeymap_SOURCES = dumpkeymap.c
|
||||
|
||||
dumpkeymap_LDFLAGS = -Wl,-framework,IOKit
|
||||
|
||||
man1_MANS = dumpkeymap.man
|
||||
|
||||
EXTRA_DIST = \
|
||||
README.txt \
|
||||
dumpkeymap.man
|
|
@ -656,7 +656,7 @@ hostx_paint_debug_rect(int x, int y,
|
|||
void
|
||||
hostx_load_keymap(void)
|
||||
{
|
||||
KeySym *keymap;
|
||||
XID *keymap;
|
||||
int host_width, min_keycode, max_keycode, width;
|
||||
int i,j;
|
||||
|
||||
|
@ -677,7 +677,7 @@ hostx_load_keymap(void)
|
|||
*/
|
||||
width = (host_width > 4) ? 4 : host_width;
|
||||
|
||||
ephyrKeySyms.map = (KeySym *)calloc(sizeof(KeySym),
|
||||
ephyrKeySyms.map = (CARD32 *)calloc(sizeof(CARD32),
|
||||
(max_keycode - min_keycode + 1) *
|
||||
width);
|
||||
if (!ephyrKeySyms.map)
|
||||
|
@ -685,7 +685,7 @@ hostx_load_keymap(void)
|
|||
|
||||
for (i=0; i<(max_keycode - min_keycode+1); i++)
|
||||
for (j=0; j<width; j++)
|
||||
ephyrKeySyms.map[(i*width)+j] = keymap[(i*host_width) + j];
|
||||
ephyrKeySyms.map[(i*width)+j] = (CARD32) keymap[(i*host_width) + j];
|
||||
|
||||
EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ typedef struct {
|
|||
int minKeyCode;
|
||||
int maxKeyCode;
|
||||
int mapWidth;
|
||||
KeySym *map;
|
||||
CARD32 *map;
|
||||
} EphyrKeySyms;
|
||||
|
||||
struct EphyrHostXEvent
|
||||
|
|
|
@ -1915,11 +1915,6 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki,
|
|||
KeybdCtrl *ctrl = NULL;
|
||||
int type, nEvents, i;
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("enqueuing kb event (scancode %d, %s)\n", scan_code, is_up ? "up" : "down");
|
||||
ErrorF("event is from %s\n", ki->name);
|
||||
#endif
|
||||
|
||||
if (!ki || !ki->dixdev || !ki->dixdev->kbdfeed || !ki->dixdev->key)
|
||||
return;
|
||||
|
||||
|
@ -1947,9 +1942,6 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki,
|
|||
}
|
||||
|
||||
nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, type, key_code);
|
||||
#ifdef DEBUG
|
||||
ErrorF("KdEnqueueKeyboardEvent: got %d events from GKE\n", nEvents);
|
||||
#endif
|
||||
for (i = 0; i < nEvents; i++)
|
||||
KdQueueEvent(ki->dixdev, kdEvents + i);
|
||||
}
|
||||
|
@ -2009,12 +2001,6 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
|
|||
}
|
||||
z = rz;
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("sending motion notification for (%d, %d, %d)\n", x, y, z);
|
||||
ErrorF(" comes from (%d, %d, %d)\n", rx, ry, rz);
|
||||
ErrorF(" is %s\n", (flags & KD_MOUSE_DELTA) ? "relative" : "absolute");
|
||||
#endif
|
||||
|
||||
if (flags & KD_MOUSE_DELTA)
|
||||
dixflags = POINTER_RELATIVE & POINTER_ACCELERATE;
|
||||
else
|
||||
|
@ -2028,9 +2014,6 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
|
|||
button <<= 1, n++) {
|
||||
if (((pi->buttonState & button) ^ (buttons & button)) &&
|
||||
!(buttons & button)) {
|
||||
#ifdef DEBUG
|
||||
ErrorF(" posting button release %d\n", n);
|
||||
#endif
|
||||
_KdEnqueuePointerEvent(pi, ButtonRelease, x, y, z, n,
|
||||
dixflags, FALSE);
|
||||
}
|
||||
|
@ -2039,9 +2022,6 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
|
|||
button <<= 1, n++) {
|
||||
if (((pi->buttonState & button) ^ (buttons & button)) &&
|
||||
(buttons & button)) {
|
||||
#ifdef DEBUG
|
||||
ErrorF(" posting button press %d\n", n);
|
||||
#endif
|
||||
_KdEnqueuePointerEvent(pi, ButtonPress, x, y, z, n,
|
||||
dixflags, FALSE);
|
||||
}
|
||||
|
@ -2057,11 +2037,6 @@ _KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z,
|
|||
int nEvents = 0, i = 0;
|
||||
int valuators[3] = { x, y, z };
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("mouse enqueuing event from device %s (%d, %d, %d; %d)\n",
|
||||
pi->name, x, y, z, b);
|
||||
#endif
|
||||
|
||||
/* TRUE from KdHandlePointerEvent, means 'we swallowed the event'. */
|
||||
if (!force && KdHandlePointerEvent(pi, type, x, y, z, b, absrel))
|
||||
return;
|
||||
|
|
|
@ -8,16 +8,24 @@ if XF86UTILS
|
|||
XF86UTILS_SUBDIR = utils
|
||||
endif
|
||||
|
||||
if MFB
|
||||
MFB_SUBDIR = xf1bpp xf4bpp
|
||||
endif
|
||||
|
||||
if CFB
|
||||
CFB_SUBDIR = xf8_16bpp xf8_32bpp
|
||||
endif
|
||||
|
||||
DOC_SUBDIR = doc
|
||||
|
||||
SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
|
||||
ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp xf8_16bpp \
|
||||
xf8_32bpp loader scanpci dixmods exa \
|
||||
ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) $(CFB_SUBDIR) \
|
||||
loader scanpci dixmods exa modes \
|
||||
$(DRI_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR)
|
||||
|
||||
DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
|
||||
parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \
|
||||
xf8_16bpp xf8_32bpp loader scanpci dixmods dri exa \
|
||||
xf8_16bpp xf8_32bpp loader scanpci dixmods dri exa modes \
|
||||
utils doc
|
||||
|
||||
bin_PROGRAMS = Xorg
|
||||
|
@ -47,6 +55,9 @@ XORG_LIBS = \
|
|||
rac/librac.a \
|
||||
parser/libxf86config.a \
|
||||
dixmods/libdixmods.la \
|
||||
modes/libxf86modes.a \
|
||||
ddc/libddc.a \
|
||||
i2c/libi2c.a \
|
||||
@XORG_LIBS@
|
||||
|
||||
Xorg_DEPENDENCIES = \
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#undef HAS_UTSNAME
|
||||
#if !defined(WIN32) && !defined(__UNIXOS2__)
|
||||
|
|
|
@ -368,6 +368,7 @@ xf86HandleBuiltinMode(ScrnInfoPtr scrp,
|
|||
return MODE_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/** Calculates the horizontal sync rate of a mode */
|
||||
_X_EXPORT double
|
||||
xf86ModeHSync(DisplayModePtr mode)
|
||||
|
@ -411,6 +412,7 @@ xf86SetModeDefaultName(DisplayModePtr mode)
|
|||
|
||||
mode->name = XNFprintf("%dx%d", mode->HDisplay, mode->VDisplay);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* xf86LookupMode
|
||||
|
@ -680,6 +682,7 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* xf86SetModeCrtc
|
||||
*
|
||||
|
@ -733,7 +736,9 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
|
|||
p->CrtcHAdjusted = FALSE;
|
||||
p->CrtcVAdjusted = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Allocates and returns a copy of pMode, including pointers within pMode.
|
||||
*/
|
||||
|
@ -814,6 +819,7 @@ xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* xf86CheckModeForMonitor
|
||||
|
@ -2040,6 +2046,7 @@ add(char **p, char *new)
|
|||
strcat(*p, new);
|
||||
}
|
||||
|
||||
#if 0
|
||||
_X_EXPORT void
|
||||
xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
|
||||
{
|
||||
|
@ -2075,6 +2082,7 @@ xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
|
|||
mode->VTotal, flags);
|
||||
xfree(flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
_X_EXPORT void
|
||||
xf86PrintModes(ScrnInfoPtr scrp)
|
||||
|
@ -2145,6 +2153,7 @@ xf86PrintModes(ScrnInfoPtr scrp)
|
|||
} while (p != NULL && p != scrp->modes);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Adds the new mode into the mode list, and returns the new list
|
||||
*
|
||||
|
@ -2168,3 +2177,4 @@ xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
|
|||
|
||||
return modes;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
sdk_HEADERS = edid.h vdif.h xf86DDC.h
|
||||
|
||||
module_LTLIBRARIES = libddc.la
|
||||
noinst_LIBRARIES = libddc.a
|
||||
|
||||
libddc_la_LDFLAGS = -avoid-version
|
||||
libddc_la_SOURCES = xf86DDC.c edid.c interpret_edid.c print_edid.c \
|
||||
interpret_vdif.c print_vdif.c ddcProperty.c \
|
||||
edid_modes.c
|
||||
libddc_a_SOURCES = xf86DDC.c edid.c interpret_edid.c print_edid.c \
|
||||
interpret_vdif.c print_vdif.c ddcProperty.c
|
||||
|
||||
INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "property.h"
|
||||
#include "propertyst.h"
|
||||
#include "xf86DDC.h"
|
||||
#include "xf86_ansic.h"
|
||||
|
||||
#define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA"
|
||||
#define EDID2_ATOM_NAME "XFree86_DDC_EDID2_RAWDATA"
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
static const OptionInfoRec *DDCAvailableOptions(void *unused);
|
||||
|
||||
#if DDC_MODULE
|
||||
|
||||
static MODULESETUPPROTO(ddcSetup);
|
||||
|
||||
static XF86ModuleVersionInfo ddcVersRec =
|
||||
|
@ -57,6 +59,8 @@ ddcSetup(pointer module, pointer opts, int *errmaj, int *errmin)
|
|||
return (pointer)1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define RETRIES 4
|
||||
|
||||
static unsigned char *EDIDRead_DDC1(
|
||||
|
|
|
@ -14,12 +14,23 @@ if DBE
|
|||
DBEMOD = libdbe.la
|
||||
endif
|
||||
|
||||
module_LTLIBRARIES = libafb.la \
|
||||
libcfb.la \
|
||||
libcfb32.la \
|
||||
if AFB
|
||||
AFBMOD = libafb.la
|
||||
endif
|
||||
|
||||
if CFB
|
||||
CFBMOD = libcfb.la libcfb32.la
|
||||
endif
|
||||
|
||||
if MFB
|
||||
MFBMOD = libmfb.la
|
||||
endif
|
||||
|
||||
module_LTLIBRARIES = $(AFBMOD) \
|
||||
$(CFBMOD) \
|
||||
libfb.la \
|
||||
libwfb.la \
|
||||
libmfb.la \
|
||||
$(MFBMOD) \
|
||||
libshadow.la
|
||||
|
||||
extsmoduledir = $(moduledir)/extensions
|
||||
|
|
|
@ -204,6 +204,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
|||
pDRIPriv->directRenderingSupport = TRUE;
|
||||
pDRIPriv->pDriverInfo = pDRIInfo;
|
||||
pDRIPriv->nrWindows = 0;
|
||||
pDRIPriv->nrWindowsVisible = 0;
|
||||
pDRIPriv->fullscreen = NULL;
|
||||
|
||||
pDRIPriv->createDummyCtx = pDRIInfo->createDummyCtx;
|
||||
|
@ -1006,6 +1007,93 @@ DRITransitionTo2d(ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
|
||||
static int
|
||||
DRIDCNTreeTraversal(WindowPtr pWin, pointer data)
|
||||
{
|
||||
DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
|
||||
|
||||
if (pDRIDrawablePriv) {
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
|
||||
if (REGION_NUM_RECTS(&pWin->clipList) > 0) {
|
||||
WindowPtr *pDRIWindows = (WindowPtr*)data;
|
||||
int i = 0;
|
||||
|
||||
while (pDRIWindows[i])
|
||||
i++;
|
||||
|
||||
pDRIWindows[i] = pWin;
|
||||
|
||||
pDRIPriv->nrWalked++;
|
||||
}
|
||||
|
||||
if (pDRIPriv->nrWindows == pDRIPriv->nrWalked)
|
||||
return WT_STOPWALKING;
|
||||
}
|
||||
|
||||
return WT_WALKCHILDREN;
|
||||
}
|
||||
|
||||
static void
|
||||
DRIDriverClipNotify(ScreenPtr pScreen)
|
||||
{
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
|
||||
if (pDRIPriv->pDriverInfo->ClipNotify) {
|
||||
WindowPtr *pDRIWindows = xcalloc(sizeof(WindowPtr), pDRIPriv->nrWindows);
|
||||
DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
|
||||
|
||||
if (pDRIPriv->nrWindows > 0) {
|
||||
pDRIPriv->nrWalked = 0;
|
||||
TraverseTree(WindowTable[pScreen->myNum], DRIDCNTreeTraversal,
|
||||
(pointer)pDRIWindows);
|
||||
}
|
||||
|
||||
pDRIInfo->ClipNotify(pScreen, pDRIWindows, pDRIPriv->nrWindows);
|
||||
|
||||
xfree(pDRIWindows);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
DRIIncreaseNumberVisible(ScreenPtr pScreen)
|
||||
{
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
|
||||
switch (++pDRIPriv->nrWindowsVisible) {
|
||||
case 1:
|
||||
DRITransitionTo3d( pScreen );
|
||||
break;
|
||||
case 2:
|
||||
DRITransitionToSharedBuffers( pScreen );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DRIDriverClipNotify(pScreen);
|
||||
}
|
||||
|
||||
static void
|
||||
DRIDecreaseNumberVisible(ScreenPtr pScreen)
|
||||
{
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
|
||||
switch (--pDRIPriv->nrWindowsVisible) {
|
||||
case 0:
|
||||
DRITransitionTo2d( pScreen );
|
||||
break;
|
||||
case 1:
|
||||
DRITransitionToPrivateBuffers( pScreen );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DRIDriverClipNotify(pScreen);
|
||||
}
|
||||
|
||||
Bool
|
||||
DRICreateDrawable(ScreenPtr pScreen, Drawable id,
|
||||
DrawablePtr pDrawable, drm_drawable_t * hHWDrawable)
|
||||
|
@ -1040,21 +1128,16 @@ DRICreateDrawable(ScreenPtr pScreen, Drawable id,
|
|||
pDRIDrawablePriv->pScreen = pScreen;
|
||||
pDRIDrawablePriv->refCount = 1;
|
||||
pDRIDrawablePriv->drawableIndex = -1;
|
||||
pDRIDrawablePriv->nrects = REGION_NUM_RECTS(&pWin->clipList);
|
||||
|
||||
/* save private off of preallocated index */
|
||||
pWin->devPrivates[DRIWindowPrivIndex].ptr =
|
||||
(pointer)pDRIDrawablePriv;
|
||||
|
||||
switch (++pDRIPriv->nrWindows) {
|
||||
case 1:
|
||||
DRITransitionTo3d( pScreen );
|
||||
break;
|
||||
case 2:
|
||||
DRITransitionToSharedBuffers( pScreen );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pDRIPriv->nrWindows++;
|
||||
|
||||
if (pDRIDrawablePriv->nrects)
|
||||
DRIIncreaseNumberVisible(pScreen);
|
||||
|
||||
/* track this in case this window is destroyed */
|
||||
AddResource(id, DRIDrawablePrivResType, (pointer)pWin);
|
||||
|
@ -1126,19 +1209,14 @@ DRIDrawablePrivDelete(pointer pResource, XID id)
|
|||
pDRIDrawablePriv->hwDrawable)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
xfree(pDRIDrawablePriv);
|
||||
pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL;
|
||||
|
||||
switch (--pDRIPriv->nrWindows) {
|
||||
case 0:
|
||||
DRITransitionTo2d( pDrawable->pScreen );
|
||||
break;
|
||||
case 1:
|
||||
DRITransitionToPrivateBuffers( pDrawable->pScreen );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pDRIPriv->nrWindows--;
|
||||
|
||||
if (REGION_NUM_RECTS(&pWin->clipList))
|
||||
DRIDecreaseNumberVisible(pDrawable->pScreen);
|
||||
}
|
||||
else { /* pixmap (or for GLX 1.3, a PBuffer) */
|
||||
/* NOT_DONE */
|
||||
|
@ -1276,7 +1354,7 @@ DRIGetDrawableInfo(ScreenPtr pScreen,
|
|||
*backX = *X;
|
||||
*backY = *Y;
|
||||
|
||||
if (pDRIPriv->nrWindows == 1 && *numClipRects) {
|
||||
if (pDRIPriv->nrWindowsVisible == 1 && *numClipRects) {
|
||||
/* Use a single cliprect. */
|
||||
|
||||
int x0 = *X;
|
||||
|
@ -1652,7 +1730,7 @@ DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
|
|||
|
||||
if(!pDRIPriv) return;
|
||||
|
||||
if(pDRIPriv->nrWindows > 0) {
|
||||
if(pDRIPriv->nrWindowsVisible > 0) {
|
||||
RegionRec reg;
|
||||
|
||||
REGION_NULL(pScreen, ®);
|
||||
|
@ -1844,19 +1922,28 @@ DRIClipNotify(WindowPtr pWin, int dx, int dy)
|
|||
if(!pDRIPriv) return;
|
||||
|
||||
if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
|
||||
int nrects = REGION_NUM_RECTS(&pWin->clipList);
|
||||
|
||||
if(!pDRIPriv->windowsTouched) {
|
||||
DRILockTree(pScreen);
|
||||
pDRIPriv->windowsTouched = TRUE;
|
||||
}
|
||||
|
||||
if (nrects && !pDRIDrawablePriv->nrects)
|
||||
DRIIncreaseNumberVisible(pScreen);
|
||||
else if (!nrects && pDRIDrawablePriv->nrects)
|
||||
DRIDecreaseNumberVisible(pScreen);
|
||||
else
|
||||
DRIDriverClipNotify(pScreen);
|
||||
|
||||
pDRIDrawablePriv->nrects = nrects;
|
||||
|
||||
pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp
|
||||
= DRIDrawableValidationStamp++;
|
||||
|
||||
drmUpdateDrawableInfo(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable,
|
||||
DRM_DRAWABLE_CLIPRECTS,
|
||||
REGION_NUM_RECTS(&pWin->clipList),
|
||||
REGION_RECTS(&pWin->clipList));
|
||||
nrects, REGION_RECTS(&pWin->clipList));
|
||||
}
|
||||
|
||||
/* call lower wrapped functions */
|
||||
|
|
|
@ -107,7 +107,7 @@ typedef struct {
|
|||
*/
|
||||
|
||||
#define DRIINFO_MAJOR_VERSION 5
|
||||
#define DRIINFO_MINOR_VERSION 0
|
||||
#define DRIINFO_MINOR_VERSION 1
|
||||
#define DRIINFO_PATCH_VERSION 0
|
||||
|
||||
typedef struct {
|
||||
|
@ -173,6 +173,9 @@ typedef struct {
|
|||
/* New with DRI version 4.1.0 */
|
||||
void (*TransitionSingleToMulti3D)(ScreenPtr pScreen);
|
||||
void (*TransitionMultiToSingle3D)(ScreenPtr pScreen);
|
||||
|
||||
/* New with DRI version 5.1.0 */
|
||||
void (*ClipNotify)(ScreenPtr pScreen, WindowPtr *ppWin, int num);
|
||||
} DRIInfoRec, *DRIInfoPtr;
|
||||
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ typedef struct _DRIDrawablePrivRec
|
|||
int drawableIndex;
|
||||
ScreenPtr pScreen;
|
||||
int refCount;
|
||||
int nrects;
|
||||
} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
|
||||
|
||||
struct _DRIContextPrivRec
|
||||
|
@ -87,6 +88,8 @@ typedef struct _DRIScreenPrivRec
|
|||
void** partial3DContextStore; /* parital 3D context */
|
||||
DRIInfoPtr pDriverInfo;
|
||||
int nrWindows;
|
||||
int nrWindowsVisible;
|
||||
int nrWalked;
|
||||
drm_clip_rect_t private_buffer_rect; /* management of private buffers */
|
||||
DrawablePtr fullscreen; /* pointer to fullscreen drawable */
|
||||
drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module_LTLIBRARIES = libi2c.la
|
||||
noinst_LIBRARIES = libi2c.a
|
||||
|
||||
multimediadir = $(moduledir)/multimedia
|
||||
multimedia_LTLIBRARIES = \
|
||||
|
@ -10,8 +10,7 @@ multimedia_LTLIBRARIES = \
|
|||
tda9885_drv.la \
|
||||
uda1380_drv.la
|
||||
|
||||
libi2c_la_LDFLAGS = -avoid-version
|
||||
libi2c_la_SOURCES = xf86i2c.c xf86i2cmodule.c
|
||||
libi2c_a_SOURCES = xf86i2c.c
|
||||
|
||||
INCLUDES = $(XORG_INCS)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ noinst_LIBRARIES = libloader.a
|
|||
|
||||
INCLUDES = $(XORG_INCS) -I$(srcdir)/../parser -I$(srcdir)/../dixmods/extmod \
|
||||
-I$(srcdir)/../vbe -I$(top_srcdir)/miext/cw -I$(srcdir)/../int10 \
|
||||
-I$(srcdir)/../ddc -I$(srcdir)/../i2c
|
||||
-I$(srcdir)/../ddc -I$(srcdir)/../i2c -I$(srcdir)/../modes
|
||||
|
||||
#AM_LDFLAGS = -r
|
||||
AM_CFLAGS = -DIN_LOADER $(DIX_CFLAGS) $(XORG_CFLAGS)
|
||||
|
|
|
@ -768,7 +768,7 @@ LoadSubModule(ModuleDescPtr parent, const char *module,
|
|||
|
||||
submod = doLoadModule(module, NULL, subdirlist, patternlist, options,
|
||||
modreq, errmaj, errmin, LD_FLAG_GLOBAL);
|
||||
if (submod) {
|
||||
if (submod && submod != (ModuleDescPtr) 1) {
|
||||
parent->child = AddSibling(parent->child, submod);
|
||||
submod->parent = parent;
|
||||
}
|
||||
|
@ -799,7 +799,7 @@ LoadSubModuleLocal(ModuleDescPtr parent, const char *module,
|
|||
|
||||
submod = doLoadModule(module, NULL, subdirlist, patternlist, options,
|
||||
modreq, errmaj, errmin, 0);
|
||||
if (submod) {
|
||||
if (submod && submod != (ModuleDescPtr) 1) {
|
||||
parent->child = AddSibling(parent->child, submod);
|
||||
submod->parent = parent;
|
||||
}
|
||||
|
@ -838,6 +838,11 @@ DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static const char *compiled_in_modules[] = {
|
||||
"ddc",
|
||||
"i2c",
|
||||
NULL
|
||||
};
|
||||
|
||||
static ModuleDescPtr
|
||||
doLoadModule(const char *module, const char *path, const char **subdirlist,
|
||||
|
@ -856,9 +861,17 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
|
|||
PatternPtr patterns = NULL;
|
||||
int noncanonical = 0;
|
||||
char *m = NULL;
|
||||
char **cim;
|
||||
|
||||
xf86MsgVerb(X_INFO, 3, "LoadModule: \"%s\"", module);
|
||||
|
||||
for (cim = compiled_in_modules; *cim; cim++)
|
||||
if (!strcmp (module, *cim))
|
||||
{
|
||||
xf86MsgVerb(X_INFO, 3, "Module alread ybuilt-in");
|
||||
return (ModuleDescPtr) 1;
|
||||
}
|
||||
|
||||
patterns = InitPatterns(patternlist);
|
||||
name = LoaderGetCanonicalName(module, patterns);
|
||||
noncanonical = (name && strcmp(module, name) != 0);
|
||||
|
@ -1108,6 +1121,9 @@ UnloadDriver(ModuleDescPtr mod)
|
|||
static void
|
||||
UnloadModuleOrDriver(ModuleDescPtr mod)
|
||||
{
|
||||
if (mod == (ModuleDescPtr) 1)
|
||||
return;
|
||||
|
||||
if (mod == NULL || mod->name == NULL)
|
||||
return;
|
||||
|
||||
|
@ -1156,6 +1172,8 @@ FreeModuleDesc(ModuleDescPtr head)
|
|||
{
|
||||
ModuleDescPtr sibs, prev;
|
||||
|
||||
if (head == (ModuleDescPtr) 1)
|
||||
return;
|
||||
/*
|
||||
* only free it if it's not marked as in use. In use means that it may
|
||||
* be unloaded someday, and UnloadModule or UnloadDriver will free it
|
||||
|
@ -1338,7 +1356,7 @@ LoaderGetCanonicalName(const char *modname, PatternPtr patterns)
|
|||
unsigned long
|
||||
LoaderGetModuleVersion(ModuleDescPtr mod)
|
||||
{
|
||||
if (!mod || !mod->VersionInfo)
|
||||
if (!mod || mod == (ModuleDescPtr) 1 || !mod->VersionInfo)
|
||||
return 0;
|
||||
|
||||
return MODULE_VERSION_NUMERIC(mod->VersionInfo->majorversion,
|
||||
|
|
|
@ -89,6 +89,13 @@
|
|||
#include "xf86sbusBus.h"
|
||||
#endif
|
||||
#include "compiler.h"
|
||||
#include "xf86Crtc.h"
|
||||
#include "xf86Modes.h"
|
||||
#ifdef RANDR
|
||||
#include "xf86RandR12.h"
|
||||
#endif
|
||||
#include "xf86DDC.h"
|
||||
#include "edid.h"
|
||||
|
||||
#ifndef HAS_GLIBC_SIGSETJMP
|
||||
#if defined(setjmp) && defined(__GNU_LIBRARY__) && \
|
||||
|
@ -1161,4 +1168,85 @@ _X_HIDDEN void *xfree86LookupTab[] = {
|
|||
|
||||
/* Pci.c */
|
||||
SYMVAR(pciNumBuses)
|
||||
|
||||
/* modes */
|
||||
SYMFUNC(xf86CrtcConfigInit)
|
||||
SYMFUNC(xf86CrtcConfigPrivateIndex)
|
||||
SYMFUNC(xf86CrtcCreate)
|
||||
SYMFUNC(xf86CrtcDestroy)
|
||||
SYMFUNC(xf86CrtcInUse)
|
||||
SYMFUNC(xf86CrtcRotate)
|
||||
SYMFUNC(xf86CrtcSetMode)
|
||||
SYMFUNC(xf86CrtcSetSizeRange)
|
||||
SYMFUNC(xf86CVTMode)
|
||||
SYMFUNC(xf86DisableUnusedFunctions)
|
||||
SYMFUNC(xf86DPMSSet)
|
||||
SYMFUNC(xf86DuplicateMode)
|
||||
SYMFUNC(xf86DuplicateModes)
|
||||
SYMFUNC(xf86GetDefaultModes)
|
||||
SYMFUNC(xf86GetMonitorModes)
|
||||
SYMFUNC(xf86InitialConfiguration)
|
||||
SYMFUNC(xf86ModeHSync)
|
||||
SYMFUNC(xf86ModesAdd)
|
||||
SYMFUNC(xf86ModesEqual)
|
||||
SYMFUNC(xf86ModeVRefresh)
|
||||
SYMFUNC(xf86OutputCreate)
|
||||
SYMFUNC(xf86OutputDestroy)
|
||||
SYMFUNC(xf86OutputGetEDID)
|
||||
SYMFUNC(xf86OutputGetEDIDModes)
|
||||
SYMFUNC(xf86OutputRename)
|
||||
SYMFUNC(xf86OutputSetEDID)
|
||||
SYMFUNC(xf86PrintModeline)
|
||||
SYMFUNC(xf86ProbeOutputModes)
|
||||
SYMFUNC(xf86PruneInvalidModes)
|
||||
SYMFUNC(xf86SetModeCrtc)
|
||||
SYMFUNC(xf86SetModeDefaultName)
|
||||
SYMFUNC(xf86SetScrnInfoModes)
|
||||
SYMFUNC(xf86ValidateModesClocks)
|
||||
SYMFUNC(xf86ValidateModesFlags)
|
||||
SYMFUNC(xf86ValidateModesSize)
|
||||
SYMFUNC(xf86ValidateModesSync)
|
||||
SYMFUNC(xf86ValidateModesUserConfig)
|
||||
SYMFUNC(xf86DiDGAInit)
|
||||
SYMFUNC(xf86DiDGAReInit)
|
||||
SYMFUNC(xf86DDCGetModes)
|
||||
SYMFUNC(xf86SaveScreen)
|
||||
#ifdef RANDR
|
||||
SYMFUNC(xf86RandR12CreateScreenResources)
|
||||
SYMFUNC(xf86RandR12GetOriginalVirtualSize)
|
||||
SYMFUNC(xf86RandR12GetRotation)
|
||||
SYMFUNC(xf86RandR12Init)
|
||||
SYMFUNC(xf86RandR12PreInit)
|
||||
SYMFUNC(xf86RandR12SetConfig)
|
||||
SYMFUNC(xf86RandR12SetRotations)
|
||||
#endif
|
||||
|
||||
SYMFUNC(xf86DoEDID_DDC1)
|
||||
SYMFUNC(xf86DoEDID_DDC2)
|
||||
SYMFUNC(xf86InterpretEDID)
|
||||
SYMFUNC(xf86PrintEDID)
|
||||
SYMFUNC(xf86InterpretVdif)
|
||||
SYMFUNC(xf86print_vdif)
|
||||
SYMFUNC(xf86DDCMonitorSet)
|
||||
SYMFUNC(xf86SetDDCproperties)
|
||||
|
||||
SYMFUNC(xf86CreateI2CBusRec)
|
||||
SYMFUNC(xf86CreateI2CDevRec)
|
||||
SYMFUNC(xf86DestroyI2CBusRec)
|
||||
SYMFUNC(xf86DestroyI2CDevRec)
|
||||
SYMFUNC(xf86I2CBusInit)
|
||||
SYMFUNC(xf86I2CDevInit)
|
||||
SYMFUNC(xf86I2CFindBus)
|
||||
SYMFUNC(xf86I2CFindDev)
|
||||
SYMFUNC(xf86I2CGetScreenBuses)
|
||||
SYMFUNC(xf86I2CProbeAddress)
|
||||
SYMFUNC(xf86I2CReadByte)
|
||||
SYMFUNC(xf86I2CReadBytes)
|
||||
SYMFUNC(xf86I2CReadStatus)
|
||||
SYMFUNC(xf86I2CReadWord)
|
||||
SYMFUNC(xf86I2CWriteByte)
|
||||
SYMFUNC(xf86I2CWriteBytes)
|
||||
SYMFUNC(xf86I2CWriteRead)
|
||||
SYMFUNC(xf86I2CWriteVec)
|
||||
SYMFUNC(xf86I2CWriteWord)
|
||||
};
|
||||
|
|
27
hw/xfree86/modes/Makefile.am
Normal file
27
hw/xfree86/modes/Makefile.am
Normal file
|
@ -0,0 +1,27 @@
|
|||
noinst_LIBRARIES = libxf86modes.a
|
||||
|
||||
libxf86modes_a_SOURCES = \
|
||||
xf86Crtc.c \
|
||||
xf86Crtc.h \
|
||||
xf86cvt.c \
|
||||
xf86DiDGA.c \
|
||||
xf86EdidModes.c \
|
||||
xf86Modes.c \
|
||||
xf86Modes.h \
|
||||
xf86RandR12.c \
|
||||
xf86RandR12.h \
|
||||
xf86Rename.h \
|
||||
xf86Rotate.c
|
||||
|
||||
INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
|
||||
-I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
|
||||
-I$(srcdir)/../scanpci -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
|
||||
-I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod
|
||||
|
||||
sdk_HEADERS = \
|
||||
xf86Crtc.h \
|
||||
xf86Modes.h \
|
||||
xf86RandR12.h \
|
||||
xf86Rename.h
|
||||
|
||||
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
|
1749
hw/xfree86/modes/xf86Crtc.c
Normal file
1749
hw/xfree86/modes/xf86Crtc.c
Normal file
File diff suppressed because it is too large
Load Diff
641
hw/xfree86/modes/xf86Crtc.h
Normal file
641
hw/xfree86/modes/xf86Crtc.h
Normal file
|
@ -0,0 +1,641 @@
|
|||
/*
|
||||
* Copyright © 2006 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of the copyright holders not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no representations
|
||||
* about the suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifndef _XF86CRTC_H_
|
||||
#define _XF86CRTC_H_
|
||||
|
||||
#include <edid.h>
|
||||
#include "randrstr.h"
|
||||
#if XF86_MODES_RENAME
|
||||
#include "xf86Rename.h"
|
||||
#endif
|
||||
#include "xf86Modes.h"
|
||||
#include "damage.h"
|
||||
|
||||
/* Compat definitions for older X Servers. */
|
||||
#ifndef M_T_PREFERRED
|
||||
#define M_T_PREFERRED 0x08
|
||||
#endif
|
||||
#ifndef M_T_DRIVER
|
||||
#define M_T_DRIVER 0x40
|
||||
#endif
|
||||
|
||||
typedef struct _xf86Crtc xf86CrtcRec, *xf86CrtcPtr;
|
||||
typedef struct _xf86Output xf86OutputRec, *xf86OutputPtr;
|
||||
|
||||
/* define a standard for connector types */
|
||||
typedef enum _xf86ConnectorType {
|
||||
XF86ConnectorNone,
|
||||
XF86ConnectorVGA,
|
||||
XF86ConnectorDVI_I,
|
||||
XF86ConnectorDVI_D,
|
||||
XF86ConnectorDVI_A,
|
||||
XF86ConnectorComposite,
|
||||
XF86ConnectorSvideo,
|
||||
XF86ConnectorComponent,
|
||||
XF86ConnectorLFP,
|
||||
XF86ConnectorProprietary,
|
||||
} xf86ConnectorType;
|
||||
|
||||
typedef enum _xf86OutputStatus {
|
||||
XF86OutputStatusConnected,
|
||||
XF86OutputStatusDisconnected,
|
||||
XF86OutputStatusUnknown,
|
||||
} xf86OutputStatus;
|
||||
|
||||
typedef struct _xf86CrtcFuncs {
|
||||
/**
|
||||
* Turns the crtc on/off, or sets intermediate power levels if available.
|
||||
*
|
||||
* Unsupported intermediate modes drop to the lower power setting. If the
|
||||
* mode is DPMSModeOff, the crtc must be disabled sufficiently for it to
|
||||
* be safe to call mode_set.
|
||||
*/
|
||||
void
|
||||
(*dpms)(xf86CrtcPtr crtc,
|
||||
int mode);
|
||||
|
||||
/**
|
||||
* Saves the crtc's state for restoration on VT switch.
|
||||
*/
|
||||
void
|
||||
(*save)(xf86CrtcPtr crtc);
|
||||
|
||||
/**
|
||||
* Restore's the crtc's state at VT switch.
|
||||
*/
|
||||
void
|
||||
(*restore)(xf86CrtcPtr crtc);
|
||||
|
||||
/**
|
||||
* Lock CRTC prior to mode setting, mostly for DRI.
|
||||
* Returns whether unlock is needed
|
||||
*/
|
||||
Bool
|
||||
(*lock) (xf86CrtcPtr crtc);
|
||||
|
||||
/**
|
||||
* Unlock CRTC after mode setting, mostly for DRI
|
||||
*/
|
||||
void
|
||||
(*unlock) (xf86CrtcPtr crtc);
|
||||
|
||||
/**
|
||||
* Callback to adjust the mode to be set in the CRTC.
|
||||
*
|
||||
* This allows a CRTC to adjust the clock or even the entire set of
|
||||
* timings, which is used for panels with fixed timings or for
|
||||
* buses with clock limitations.
|
||||
*/
|
||||
Bool
|
||||
(*mode_fixup)(xf86CrtcPtr crtc,
|
||||
DisplayModePtr mode,
|
||||
DisplayModePtr adjusted_mode);
|
||||
|
||||
/**
|
||||
* Prepare CRTC for an upcoming mode set.
|
||||
*/
|
||||
void
|
||||
(*prepare)(xf86CrtcPtr crtc);
|
||||
|
||||
/**
|
||||
* Callback for setting up a video mode after fixups have been made.
|
||||
*/
|
||||
void
|
||||
(*mode_set)(xf86CrtcPtr crtc,
|
||||
DisplayModePtr mode,
|
||||
DisplayModePtr adjusted_mode,
|
||||
int x, int y);
|
||||
|
||||
/**
|
||||
* Commit mode changes to a CRTC
|
||||
*/
|
||||
void
|
||||
(*commit)(xf86CrtcPtr crtc);
|
||||
|
||||
/* Set the color ramps for the CRTC to the given values. */
|
||||
void
|
||||
(*gamma_set)(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
|
||||
int size);
|
||||
|
||||
/**
|
||||
* Allocate the shadow area, delay the pixmap creation until needed
|
||||
*/
|
||||
void *
|
||||
(*shadow_allocate) (xf86CrtcPtr crtc, int width, int height);
|
||||
|
||||
/**
|
||||
* Create shadow pixmap for rotation support
|
||||
*/
|
||||
PixmapPtr
|
||||
(*shadow_create) (xf86CrtcPtr crtc, void *data, int width, int height);
|
||||
|
||||
/**
|
||||
* Destroy shadow pixmap
|
||||
*/
|
||||
void
|
||||
(*shadow_destroy) (xf86CrtcPtr crtc, PixmapPtr pPixmap, void *data);
|
||||
|
||||
/**
|
||||
* Clean up driver-specific bits of the crtc
|
||||
*/
|
||||
void
|
||||
(*destroy) (xf86CrtcPtr crtc);
|
||||
} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
|
||||
|
||||
struct _xf86Crtc {
|
||||
/**
|
||||
* Associated ScrnInfo
|
||||
*/
|
||||
ScrnInfoPtr scrn;
|
||||
|
||||
/**
|
||||
* Active state of this CRTC
|
||||
*
|
||||
* Set when this CRTC is driving one or more outputs
|
||||
*/
|
||||
Bool enabled;
|
||||
|
||||
/** Track whether cursor is within CRTC range */
|
||||
Bool cursorInRange;
|
||||
|
||||
/** Track state of cursor associated with this CRTC */
|
||||
Bool cursorShown;
|
||||
|
||||
/**
|
||||
* Active mode
|
||||
*
|
||||
* This reflects the mode as set in the CRTC currently
|
||||
* It will be cleared when the VT is not active or
|
||||
* during server startup
|
||||
*/
|
||||
DisplayModeRec mode;
|
||||
Rotation rotation;
|
||||
PixmapPtr rotatedPixmap;
|
||||
void *rotatedData;
|
||||
|
||||
/**
|
||||
* Position on screen
|
||||
*
|
||||
* Locates this CRTC within the frame buffer
|
||||
*/
|
||||
int x, y;
|
||||
|
||||
/**
|
||||
* Desired mode
|
||||
*
|
||||
* This is set to the requested mode, independent of
|
||||
* whether the VT is active. In particular, it receives
|
||||
* the startup configured mode and saves the active mode
|
||||
* on VT switch.
|
||||
*/
|
||||
DisplayModeRec desiredMode;
|
||||
Rotation desiredRotation;
|
||||
int desiredX, desiredY;
|
||||
|
||||
/** crtc-specific functions */
|
||||
const xf86CrtcFuncsRec *funcs;
|
||||
|
||||
/**
|
||||
* Driver private
|
||||
*
|
||||
* Holds driver-private information
|
||||
*/
|
||||
void *driver_private;
|
||||
|
||||
#ifdef RANDR_12_INTERFACE
|
||||
/**
|
||||
* RandR crtc
|
||||
*
|
||||
* When RandR 1.2 is available, this
|
||||
* points at the associated crtc object
|
||||
*/
|
||||
RRCrtcPtr randr_crtc;
|
||||
#else
|
||||
void *randr_crtc;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct _xf86OutputFuncs {
|
||||
/**
|
||||
* Called to allow the output a chance to create properties after the
|
||||
* RandR objects have been created.
|
||||
*/
|
||||
void
|
||||
(*create_resources)(xf86OutputPtr output);
|
||||
|
||||
/**
|
||||
* Turns the output on/off, or sets intermediate power levels if available.
|
||||
*
|
||||
* Unsupported intermediate modes drop to the lower power setting. If the
|
||||
* mode is DPMSModeOff, the output must be disabled, as the DPLL may be
|
||||
* disabled afterwards.
|
||||
*/
|
||||
void
|
||||
(*dpms)(xf86OutputPtr output,
|
||||
int mode);
|
||||
|
||||
/**
|
||||
* Saves the output's state for restoration on VT switch.
|
||||
*/
|
||||
void
|
||||
(*save)(xf86OutputPtr output);
|
||||
|
||||
/**
|
||||
* Restore's the output's state at VT switch.
|
||||
*/
|
||||
void
|
||||
(*restore)(xf86OutputPtr output);
|
||||
|
||||
/**
|
||||
* Callback for testing a video mode for a given output.
|
||||
*
|
||||
* This function should only check for cases where a mode can't be supported
|
||||
* on the output specifically, and not represent generic CRTC limitations.
|
||||
*
|
||||
* \return MODE_OK if the mode is valid, or another MODE_* otherwise.
|
||||
*/
|
||||
int
|
||||
(*mode_valid)(xf86OutputPtr output,
|
||||
DisplayModePtr pMode);
|
||||
|
||||
/**
|
||||
* Callback to adjust the mode to be set in the CRTC.
|
||||
*
|
||||
* This allows an output to adjust the clock or even the entire set of
|
||||
* timings, which is used for panels with fixed timings or for
|
||||
* buses with clock limitations.
|
||||
*/
|
||||
Bool
|
||||
(*mode_fixup)(xf86OutputPtr output,
|
||||
DisplayModePtr mode,
|
||||
DisplayModePtr adjusted_mode);
|
||||
|
||||
/**
|
||||
* Callback for preparing mode changes on an output
|
||||
*/
|
||||
void
|
||||
(*prepare)(xf86OutputPtr output);
|
||||
|
||||
/**
|
||||
* Callback for committing mode changes on an output
|
||||
*/
|
||||
void
|
||||
(*commit)(xf86OutputPtr output);
|
||||
|
||||
/**
|
||||
* Callback for setting up a video mode after fixups have been made.
|
||||
*
|
||||
* This is only called while the output is disabled. The dpms callback
|
||||
* must be all that's necessary for the output, to turn the output on
|
||||
* after this function is called.
|
||||
*/
|
||||
void
|
||||
(*mode_set)(xf86OutputPtr output,
|
||||
DisplayModePtr mode,
|
||||
DisplayModePtr adjusted_mode);
|
||||
|
||||
/**
|
||||
* Probe for a connected output, and return detect_status.
|
||||
*/
|
||||
xf86OutputStatus
|
||||
(*detect)(xf86OutputPtr output);
|
||||
|
||||
/**
|
||||
* Query the device for the modes it provides.
|
||||
*
|
||||
* This function may also update MonInfo, mm_width, and mm_height.
|
||||
*
|
||||
* \return singly-linked list of modes or NULL if no modes found.
|
||||
*/
|
||||
DisplayModePtr
|
||||
(*get_modes)(xf86OutputPtr output);
|
||||
|
||||
#ifdef RANDR_12_INTERFACE
|
||||
/**
|
||||
* Callback when an output's property has changed.
|
||||
*/
|
||||
Bool
|
||||
(*set_property)(xf86OutputPtr output,
|
||||
Atom property,
|
||||
RRPropertyValuePtr value);
|
||||
#endif
|
||||
/**
|
||||
* Clean up driver-specific bits of the output
|
||||
*/
|
||||
void
|
||||
(*destroy) (xf86OutputPtr output);
|
||||
} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
|
||||
|
||||
struct _xf86Output {
|
||||
/**
|
||||
* Associated ScrnInfo
|
||||
*/
|
||||
ScrnInfoPtr scrn;
|
||||
|
||||
/**
|
||||
* Currently connected crtc (if any)
|
||||
*
|
||||
* If this output is not in use, this field will be NULL.
|
||||
*/
|
||||
xf86CrtcPtr crtc;
|
||||
|
||||
/**
|
||||
* Possible CRTCs for this output as a mask of crtc indices
|
||||
*/
|
||||
CARD32 possible_crtcs;
|
||||
|
||||
/**
|
||||
* Possible outputs to share the same CRTC as a mask of output indices
|
||||
*/
|
||||
CARD32 possible_clones;
|
||||
|
||||
/**
|
||||
* Whether this output can support interlaced modes
|
||||
*/
|
||||
Bool interlaceAllowed;
|
||||
|
||||
/**
|
||||
* Whether this output can support double scan modes
|
||||
*/
|
||||
Bool doubleScanAllowed;
|
||||
|
||||
/**
|
||||
* List of available modes on this output.
|
||||
*
|
||||
* This should be the list from get_modes(), plus perhaps additional
|
||||
* compatible modes added later.
|
||||
*/
|
||||
DisplayModePtr probed_modes;
|
||||
|
||||
/**
|
||||
* Options parsed from the related monitor section
|
||||
*/
|
||||
OptionInfoPtr options;
|
||||
|
||||
/**
|
||||
* Configured monitor section
|
||||
*/
|
||||
XF86ConfMonitorPtr conf_monitor;
|
||||
|
||||
/**
|
||||
* Desired initial position
|
||||
*/
|
||||
int initial_x, initial_y;
|
||||
|
||||
/**
|
||||
* Desired initial rotation
|
||||
*/
|
||||
Rotation initial_rotation;
|
||||
|
||||
/**
|
||||
* Current connection status
|
||||
*
|
||||
* This indicates whether a monitor is known to be connected
|
||||
* to this output or not, or whether there is no way to tell
|
||||
*/
|
||||
xf86OutputStatus status;
|
||||
|
||||
/** EDID monitor information */
|
||||
xf86MonPtr MonInfo;
|
||||
|
||||
/** subpixel order */
|
||||
int subpixel_order;
|
||||
|
||||
/** Physical size of the currently attached output device. */
|
||||
int mm_width, mm_height;
|
||||
|
||||
/** Output name */
|
||||
char *name;
|
||||
|
||||
/** output-specific functions */
|
||||
const xf86OutputFuncsRec *funcs;
|
||||
|
||||
/** driver private information */
|
||||
void *driver_private;
|
||||
|
||||
#ifdef RANDR_12_INTERFACE
|
||||
/**
|
||||
* RandR 1.2 output structure.
|
||||
*
|
||||
* When RandR 1.2 is available, this points at the associated
|
||||
* RandR output structure and is created when this output is created
|
||||
*/
|
||||
RROutputPtr randr_output;
|
||||
#else
|
||||
void *randr_output;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct _xf86CrtcConfigFuncs {
|
||||
/**
|
||||
* Requests that the driver resize the screen.
|
||||
*
|
||||
* The driver is responsible for updating scrn->virtualX and scrn->virtualY.
|
||||
* If the requested size cannot be set, the driver should leave those values
|
||||
* alone and return FALSE.
|
||||
*
|
||||
* A naive driver that cannot reallocate the screen may simply change
|
||||
* virtual[XY]. A more advanced driver will want to also change the
|
||||
* devPrivate.ptr and devKind of the screen pixmap, update any offscreen
|
||||
* pixmaps it may have moved, and change pScrn->displayWidth.
|
||||
*/
|
||||
Bool
|
||||
(*resize)(ScrnInfoPtr scrn,
|
||||
int width,
|
||||
int height);
|
||||
} xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr;
|
||||
|
||||
typedef struct _xf86CrtcConfig {
|
||||
int num_output;
|
||||
xf86OutputPtr *output;
|
||||
/**
|
||||
* compat_output is used whenever we deal
|
||||
* with legacy code that only understands a single
|
||||
* output. pScrn->modes will be loaded from this output,
|
||||
* adjust frame will whack this output, etc.
|
||||
*/
|
||||
int compat_output;
|
||||
|
||||
int num_crtc;
|
||||
xf86CrtcPtr *crtc;
|
||||
|
||||
int minWidth, minHeight;
|
||||
int maxWidth, maxHeight;
|
||||
|
||||
/* For crtc-based rotation */
|
||||
DamagePtr rotationDamage;
|
||||
|
||||
/* DGA */
|
||||
unsigned int dga_flags;
|
||||
unsigned long dga_address;
|
||||
DGAModePtr dga_modes;
|
||||
int dga_nmode;
|
||||
int dga_width, dga_height, dga_stride;
|
||||
DisplayModePtr dga_save_mode;
|
||||
|
||||
const xf86CrtcConfigFuncsRec *funcs;
|
||||
|
||||
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
|
||||
|
||||
extern int xf86CrtcConfigPrivateIndex;
|
||||
|
||||
#define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr))
|
||||
|
||||
/*
|
||||
* Initialize xf86CrtcConfig structure
|
||||
*/
|
||||
|
||||
void
|
||||
xf86CrtcConfigInit (ScrnInfoPtr scrn,
|
||||
const xf86CrtcConfigFuncsRec *funcs);
|
||||
|
||||
void
|
||||
xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
|
||||
int minWidth, int minHeight,
|
||||
int maxWidth, int maxHeight);
|
||||
|
||||
/*
|
||||
* Crtc functions
|
||||
*/
|
||||
xf86CrtcPtr
|
||||
xf86CrtcCreate (ScrnInfoPtr scrn,
|
||||
const xf86CrtcFuncsRec *funcs);
|
||||
|
||||
void
|
||||
xf86CrtcDestroy (xf86CrtcPtr crtc);
|
||||
|
||||
|
||||
/**
|
||||
* Allocate a crtc for the specified output
|
||||
*
|
||||
* Find a currently unused CRTC which is suitable for
|
||||
* the specified output
|
||||
*/
|
||||
|
||||
xf86CrtcPtr
|
||||
xf86AllocCrtc (xf86OutputPtr output);
|
||||
|
||||
/**
|
||||
* Free a crtc
|
||||
*
|
||||
* Mark the crtc as unused by any outputs
|
||||
*/
|
||||
|
||||
void
|
||||
xf86FreeCrtc (xf86CrtcPtr crtc);
|
||||
|
||||
/**
|
||||
* Sets the given video mode on the given crtc
|
||||
*/
|
||||
Bool
|
||||
xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
|
||||
int x, int y);
|
||||
|
||||
/*
|
||||
* Assign crtc rotation during mode set
|
||||
*/
|
||||
Bool
|
||||
xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation);
|
||||
|
||||
/**
|
||||
* Return whether any output is assigned to the crtc
|
||||
*/
|
||||
Bool
|
||||
xf86CrtcInUse (xf86CrtcPtr crtc);
|
||||
|
||||
/*
|
||||
* Output functions
|
||||
*/
|
||||
xf86OutputPtr
|
||||
xf86OutputCreate (ScrnInfoPtr scrn,
|
||||
const xf86OutputFuncsRec *funcs,
|
||||
const char *name);
|
||||
|
||||
Bool
|
||||
xf86OutputRename (xf86OutputPtr output, const char *name);
|
||||
|
||||
void
|
||||
xf86OutputDestroy (xf86OutputPtr output);
|
||||
|
||||
void
|
||||
xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY);
|
||||
|
||||
void
|
||||
xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
|
||||
|
||||
Bool
|
||||
xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow);
|
||||
|
||||
void
|
||||
xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
|
||||
|
||||
Bool
|
||||
xf86SaveScreen(ScreenPtr pScreen, int mode);
|
||||
|
||||
void
|
||||
xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
|
||||
|
||||
/**
|
||||
* Set the EDID information for the specified output
|
||||
*/
|
||||
void
|
||||
xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon);
|
||||
|
||||
/**
|
||||
* Return the list of modes supported by the EDID information
|
||||
* stored in 'output'
|
||||
*/
|
||||
DisplayModePtr
|
||||
xf86OutputGetEDIDModes (xf86OutputPtr output);
|
||||
|
||||
xf86MonPtr
|
||||
xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
|
||||
|
||||
/**
|
||||
* Initialize dga for this screen
|
||||
*/
|
||||
|
||||
Bool
|
||||
xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address);
|
||||
|
||||
/**
|
||||
* Re-initialize dga for this screen (as when the set of modes changes)
|
||||
*/
|
||||
|
||||
Bool
|
||||
xf86DiDGAReInit (ScreenPtr pScreen);
|
||||
|
||||
/*
|
||||
* Set the subpixel order reported for the screen using
|
||||
* the information from the outputs
|
||||
*/
|
||||
|
||||
void
|
||||
xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen);
|
||||
|
||||
/*
|
||||
* Get a standard string name for a connector type
|
||||
*/
|
||||
char *
|
||||
xf86ConnectorGetName(xf86ConnectorType connector);
|
||||
|
||||
#endif /* _XF86CRTC_H_ */
|
286
hw/xfree86/modes/xf86DiDGA.c
Normal file
286
hw/xfree86/modes/xf86DiDGA.c
Normal file
|
@ -0,0 +1,286 @@
|
|||
/*
|
||||
* Copyright © 2006 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of the copyright holders not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no representations
|
||||
* about the suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#else
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xf86DDC.h"
|
||||
#include "xf86_OSproc.h"
|
||||
#include "dgaproc.h"
|
||||
#include "xf86Crtc.h"
|
||||
#include "xf86Modes.h"
|
||||
#include "gcstruct.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
|
||||
static Bool
|
||||
xf86_dga_get_modes (ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
DGAModePtr modes, mode;
|
||||
DisplayModePtr display_mode;
|
||||
int bpp = scrn->bitsPerPixel >> 3;
|
||||
int num;
|
||||
|
||||
num = 0;
|
||||
display_mode = scrn->modes;
|
||||
while (display_mode)
|
||||
{
|
||||
num++;
|
||||
display_mode = display_mode->next;
|
||||
if (display_mode == scrn->modes)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!num)
|
||||
return FALSE;
|
||||
|
||||
modes = xalloc(num * sizeof(DGAModeRec));
|
||||
if (!modes)
|
||||
return FALSE;
|
||||
|
||||
num = 0;
|
||||
display_mode = scrn->modes;
|
||||
while (display_mode)
|
||||
{
|
||||
mode = modes + num++;
|
||||
|
||||
mode->mode = display_mode;
|
||||
mode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE;
|
||||
mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
|
||||
if (display_mode->Flags & V_DBLSCAN)
|
||||
mode->flags |= DGA_DOUBLESCAN;
|
||||
if (display_mode->Flags & V_INTERLACE)
|
||||
mode->flags |= DGA_INTERLACED;
|
||||
mode->byteOrder = scrn->imageByteOrder;
|
||||
mode->depth = scrn->depth;
|
||||
mode->bitsPerPixel = scrn->bitsPerPixel;
|
||||
mode->red_mask = scrn->mask.red;
|
||||
mode->green_mask = scrn->mask.green;
|
||||
mode->blue_mask = scrn->mask.blue;
|
||||
mode->visualClass = (bpp == 1) ? PseudoColor : TrueColor;
|
||||
mode->viewportWidth = display_mode->HDisplay;
|
||||
mode->viewportHeight = display_mode->VDisplay;
|
||||
mode->xViewportStep = (bpp == 3) ? 2 : 1;
|
||||
mode->yViewportStep = 1;
|
||||
mode->viewportFlags = DGA_FLIP_RETRACE;
|
||||
mode->offset = 0;
|
||||
mode->address = (unsigned char *) xf86_config->dga_address;
|
||||
mode->bytesPerScanline = xf86_config->dga_stride;
|
||||
mode->imageWidth = xf86_config->dga_width;
|
||||
mode->imageHeight = xf86_config->dga_height;
|
||||
mode->pixmapWidth = mode->imageWidth;
|
||||
mode->pixmapHeight = mode->imageHeight;
|
||||
mode->maxViewportX = mode->imageWidth - mode->viewportWidth;
|
||||
mode->maxViewportY = mode->imageHeight - mode->viewportHeight;
|
||||
|
||||
display_mode = display_mode->next;
|
||||
if (display_mode == scrn->modes)
|
||||
break;
|
||||
}
|
||||
if (xf86_config->dga_modes)
|
||||
xfree (xf86_config->dga_modes);
|
||||
xf86_config->dga_nmode = num;
|
||||
xf86_config->dga_modes = modes;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86_dga_set_mode(ScrnInfoPtr scrn, DGAModePtr display_mode)
|
||||
{
|
||||
ScreenPtr pScreen = scrn->pScreen;
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
|
||||
if (!display_mode)
|
||||
{
|
||||
if (xf86_config->dga_save_mode)
|
||||
{
|
||||
xf86SwitchMode(pScreen, xf86_config->dga_save_mode);
|
||||
xf86_config->dga_save_mode = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!xf86_config->dga_save_mode)
|
||||
{
|
||||
xf86_config->dga_save_mode = scrn->currentMode;
|
||||
xf86SwitchMode(pScreen, display_mode->mode);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
xf86_dga_get_viewport(ScrnInfoPtr scrn)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags)
|
||||
{
|
||||
scrn->AdjustFrame(scrn->pScreen->myNum, x, y, flags);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86_dga_get_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr *ppDrawable, GCPtr *ppGC)
|
||||
{
|
||||
ScreenPtr pScreen = scrn->pScreen;
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
PixmapPtr pPixmap;
|
||||
GCPtr pGC;
|
||||
|
||||
pPixmap = GetScratchPixmapHeader (pScreen, xf86_config->dga_width, xf86_config->dga_height,
|
||||
scrn->depth, scrn->bitsPerPixel, xf86_config->dga_stride,
|
||||
(char *) scrn->memPhysBase + scrn->fbOffset);
|
||||
if (!pPixmap)
|
||||
return FALSE;
|
||||
pGC = GetScratchGC (scrn->depth, pScreen);
|
||||
if (!pGC)
|
||||
{
|
||||
FreeScratchPixmapHeader (pPixmap);
|
||||
return FALSE;
|
||||
}
|
||||
*ppDrawable = &pPixmap->drawable;
|
||||
*ppGC = pGC;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
xf86_dga_release_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr pDrawable, GCPtr pGC)
|
||||
{
|
||||
FreeScratchGC (pGC);
|
||||
FreeScratchPixmapHeader ((PixmapPtr) pDrawable);
|
||||
}
|
||||
|
||||
static void
|
||||
xf86_dga_fill_rect(ScrnInfoPtr scrn, int x, int y, int w, int h, unsigned long color)
|
||||
{
|
||||
GCPtr pGC;
|
||||
DrawablePtr pDrawable;
|
||||
XID vals[1];
|
||||
xRectangle r;
|
||||
|
||||
if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC))
|
||||
return;
|
||||
vals[0] = color;
|
||||
ChangeGC (pGC, GCForeground, vals);
|
||||
ValidateGC (pDrawable, pGC);
|
||||
r.x = x;
|
||||
r.y = y;
|
||||
r.width = w;
|
||||
r.height = h;
|
||||
pGC->ops->PolyFillRect (pDrawable, pGC, 1, &r);
|
||||
xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC);
|
||||
}
|
||||
|
||||
static void
|
||||
xf86_dga_sync(ScrnInfoPtr scrn)
|
||||
{
|
||||
ScreenPtr pScreen = scrn->pScreen;
|
||||
WindowPtr pRoot = WindowTable [pScreen->myNum];
|
||||
char buffer[4];
|
||||
|
||||
pScreen->GetImage (&pRoot->drawable, 0, 0, 1, 1, ZPixmap, ~0L, buffer);
|
||||
}
|
||||
|
||||
static void
|
||||
xf86_dga_blit_rect(ScrnInfoPtr scrn, int srcx, int srcy, int w, int h, int dstx, int dsty)
|
||||
{
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
|
||||
if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC))
|
||||
return;
|
||||
ValidateGC (pDrawable, pGC);
|
||||
pGC->ops->CopyArea (pDrawable, pDrawable, pGC, srcx, srcy, w, h, dstx, dsty);
|
||||
xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86_dga_open_framebuffer(ScrnInfoPtr scrn,
|
||||
char **name,
|
||||
unsigned char **mem, int *size, int *offset, int *flags)
|
||||
{
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
|
||||
*size = xf86_config->dga_stride * xf86_config->dga_height;
|
||||
*mem = (unsigned char *) (xf86_config->dga_address);
|
||||
*offset = 0;
|
||||
*flags = DGA_NEED_ROOT;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
xf86_dga_close_framebuffer(ScrnInfoPtr scrn)
|
||||
{
|
||||
}
|
||||
|
||||
static DGAFunctionRec xf86_dga_funcs = {
|
||||
xf86_dga_open_framebuffer,
|
||||
xf86_dga_close_framebuffer,
|
||||
xf86_dga_set_mode,
|
||||
xf86_dga_set_viewport,
|
||||
xf86_dga_get_viewport,
|
||||
xf86_dga_sync,
|
||||
xf86_dga_fill_rect,
|
||||
xf86_dga_blit_rect,
|
||||
NULL
|
||||
};
|
||||
|
||||
Bool
|
||||
xf86DiDGAReInit (ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
|
||||
if (!xf86_dga_get_modes (pScreen))
|
||||
return FALSE;
|
||||
|
||||
return DGAReInitModes (pScreen, xf86_config->dga_modes, xf86_config->dga_nmode);
|
||||
}
|
||||
|
||||
Bool
|
||||
xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address)
|
||||
{
|
||||
ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
|
||||
xf86_config->dga_flags = 0;
|
||||
xf86_config->dga_address = dga_address;
|
||||
xf86_config->dga_width = scrn->virtualX;
|
||||
xf86_config->dga_height = scrn->virtualY;
|
||||
xf86_config->dga_stride = scrn->displayWidth * scrn->bitsPerPixel >> 3;
|
||||
|
||||
if (!xf86_dga_get_modes (pScreen))
|
||||
return FALSE;
|
||||
|
||||
return DGAInit(pScreen, &xf86_dga_funcs, xf86_config->dga_modes, xf86_config->dga_nmode);
|
||||
}
|
490
hw/xfree86/modes/xf86EdidModes.c
Normal file
490
hw/xfree86/modes/xf86EdidModes.c
Normal file
|
@ -0,0 +1,490 @@
|
|||
/*
|
||||
* Copyright 2006 Luc Verhaegen.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file This is a copy of edid_modes.c from the X Server, for compatibility
|
||||
* with old X Servers.
|
||||
*/
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#else
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xf86DDC.h"
|
||||
#include <X11/Xatom.h>
|
||||
#include "property.h"
|
||||
#include "propertyst.h"
|
||||
#include "xf86DDC.h"
|
||||
#include "xf86Crtc.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* Quirks to work around broken EDID data from various monitors.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
DDC_QUIRK_NONE = 0,
|
||||
/* Force detailed sync polarity to -h +v */
|
||||
DDC_QUIRK_DT_SYNC_HM_VP = 1 << 0,
|
||||
/* First detailed mode is bogus, prefer largest mode at 60hz */
|
||||
DDC_QUIRK_PREFER_LARGE_60 = 1 << 1,
|
||||
/* 135MHz clock is too high, drop a bit */
|
||||
DDC_QUIRK_135_CLOCK_TOO_HIGH = 1 << 2
|
||||
} ddc_quirk_t;
|
||||
|
||||
static Bool quirk_dt_sync_hm_vp (int scrnIndex, xf86MonPtr DDC)
|
||||
{
|
||||
/* Belinea 1924S1W */
|
||||
if (memcmp (DDC->vendor.name, "MAX", 4) == 0 &&
|
||||
DDC->vendor.prod_id == 1932)
|
||||
return TRUE;
|
||||
/* Belinea 10 20 30W */
|
||||
if (memcmp (DDC->vendor.name, "MAX", 4) == 0 &&
|
||||
DDC->vendor.prod_id == 2007)
|
||||
return TRUE;
|
||||
/* ViewSonic VX2025wm (bug #9941) */
|
||||
if (memcmp (DDC->vendor.name, "VSC", 4) == 0 &&
|
||||
DDC->vendor.prod_id == 58653)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
|
||||
{
|
||||
/* Belinea 10 15 55 */
|
||||
if (memcmp (DDC->vendor.name, "MAX", 4) == 0 &&
|
||||
DDC->vendor.prod_id == 1516)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static Bool quirk_135_clock_too_high (int scrnIndex, xf86MonPtr DDC)
|
||||
{
|
||||
/* Envision Peripherals, Inc. EN-7100e. See bug #9550. */
|
||||
if (memcmp (DDC->vendor.name, "EPI", 4) == 0 &&
|
||||
DDC->vendor.prod_id == 59264)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
Bool (*detect) (int scrnIndex, xf86MonPtr DDC);
|
||||
ddc_quirk_t quirk;
|
||||
char *description;
|
||||
} ddc_quirk_map_t;
|
||||
|
||||
static const ddc_quirk_map_t ddc_quirks[] = {
|
||||
{
|
||||
quirk_dt_sync_hm_vp, DDC_QUIRK_DT_SYNC_HM_VP,
|
||||
"Set detailed timing sync polarity to -h +v"
|
||||
},
|
||||
{
|
||||
quirk_prefer_large_60, DDC_QUIRK_PREFER_LARGE_60,
|
||||
"Detailed timing is not preferred, use largest mode at 60Hz"
|
||||
},
|
||||
{
|
||||
quirk_135_clock_too_high, DDC_QUIRK_135_CLOCK_TOO_HIGH,
|
||||
"Recommended 135MHz pixel clock is too high"
|
||||
},
|
||||
{
|
||||
NULL, DDC_QUIRK_NONE,
|
||||
"No known quirks"
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* - for those with access to the VESA DMT standard; review please.
|
||||
*/
|
||||
#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DRIVER
|
||||
#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
|
||||
|
||||
static DisplayModeRec DDCEstablishedModes[17] = {
|
||||
{ MODEPREFIX("800x600"), 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
|
||||
{ MODEPREFIX("800x600"), 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
|
||||
{ MODEPREFIX("640x480"), 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
|
||||
{ MODEPREFIX("640x480"), 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
|
||||
{ MODEPREFIX("640x480"), 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */
|
||||
{ MODEPREFIX("640x480"), 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
|
||||
{ MODEPREFIX("720x400"), 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */
|
||||
{ MODEPREFIX("720x400"), 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */
|
||||
{ MODEPREFIX("1280x1024"), 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
|
||||
{ MODEPREFIX("1024x768"), 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
|
||||
{ MODEPREFIX("1024x768"), 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
|
||||
{ MODEPREFIX("1024x768"), 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
|
||||
{ MODEPREFIX("1024x768"), 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */
|
||||
{ MODEPREFIX("832x624"), 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */
|
||||
{ MODEPREFIX("800x600"), 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
|
||||
{ MODEPREFIX("800x600"), 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
|
||||
{ MODEPREFIX("1152x864"), 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
|
||||
};
|
||||
|
||||
static DisplayModePtr
|
||||
DDCModesFromEstablished(int scrnIndex, struct established_timings *timing,
|
||||
ddc_quirk_t quirks)
|
||||
{
|
||||
DisplayModePtr Modes = NULL, Mode = NULL;
|
||||
CARD32 bits = (timing->t1) | (timing->t2 << 8) |
|
||||
((timing->t_manu & 0x80) << 9);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 17; i++) {
|
||||
if (bits & (0x01 << i)) {
|
||||
Mode = xf86DuplicateMode(&DDCEstablishedModes[i]);
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
}
|
||||
}
|
||||
|
||||
return Modes;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static DisplayModePtr
|
||||
DDCModesFromStandardTiming(int scrnIndex, struct std_timings *timing,
|
||||
ddc_quirk_t quirks)
|
||||
{
|
||||
DisplayModePtr Modes = NULL, Mode = NULL;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < STD_TIMINGS; i++) {
|
||||
if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
|
||||
Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize,
|
||||
timing[i].refresh, FALSE, FALSE);
|
||||
Mode->type = M_T_DRIVER;
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
}
|
||||
}
|
||||
|
||||
return Modes;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static DisplayModePtr
|
||||
DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
|
||||
int preferred, ddc_quirk_t quirks)
|
||||
{
|
||||
DisplayModePtr Mode;
|
||||
|
||||
/* We don't do stereo */
|
||||
if (timing->stereo) {
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"%s: Ignoring: We don't handle stereo.\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* We only do seperate sync currently */
|
||||
if (timing->sync != 0x03) {
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"%s: %dx%d Warning: We only handle seperate"
|
||||
" sync.\n", __func__, timing->h_active, timing->v_active);
|
||||
}
|
||||
|
||||
Mode = xnfalloc(sizeof(DisplayModeRec));
|
||||
memset(Mode, 0, sizeof(DisplayModeRec));
|
||||
|
||||
Mode->type = M_T_DRIVER;
|
||||
if (preferred)
|
||||
Mode->type |= M_T_PREFERRED;
|
||||
|
||||
if( ( quirks & DDC_QUIRK_135_CLOCK_TOO_HIGH ) &&
|
||||
timing->clock == 135000000 )
|
||||
Mode->Clock = 108880;
|
||||
else
|
||||
Mode->Clock = timing->clock / 1000.0;
|
||||
|
||||
Mode->HDisplay = timing->h_active;
|
||||
Mode->HSyncStart = timing->h_active + timing->h_sync_off;
|
||||
Mode->HSyncEnd = Mode->HSyncStart + timing->h_sync_width;
|
||||
Mode->HTotal = timing->h_active + timing->h_blanking;
|
||||
|
||||
Mode->VDisplay = timing->v_active;
|
||||
Mode->VSyncStart = timing->v_active + timing->v_sync_off;
|
||||
Mode->VSyncEnd = Mode->VSyncStart + timing->v_sync_width;
|
||||
Mode->VTotal = timing->v_active + timing->v_blanking;
|
||||
|
||||
xf86SetModeDefaultName(Mode);
|
||||
|
||||
/* We ignore h/v_size and h/v_border for now. */
|
||||
|
||||
if (timing->interlaced)
|
||||
Mode->Flags |= V_INTERLACE;
|
||||
|
||||
if (quirks & DDC_QUIRK_DT_SYNC_HM_VP)
|
||||
Mode->Flags |= V_NHSYNC | V_PVSYNC;
|
||||
else
|
||||
{
|
||||
if (timing->misc & 0x02)
|
||||
Mode->Flags |= V_PHSYNC;
|
||||
else
|
||||
Mode->Flags |= V_NHSYNC;
|
||||
|
||||
if (timing->misc & 0x01)
|
||||
Mode->Flags |= V_PVSYNC;
|
||||
else
|
||||
Mode->Flags |= V_NVSYNC;
|
||||
}
|
||||
|
||||
return Mode;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static void
|
||||
DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
|
||||
{
|
||||
DisplayModePtr Mode = Modes;
|
||||
|
||||
if (!Monitor || !Modes)
|
||||
return;
|
||||
|
||||
/* set up the ranges for scanning through the modes */
|
||||
Monitor->nHsync = 1;
|
||||
Monitor->hsync[0].lo = 1024.0;
|
||||
Monitor->hsync[0].hi = 0.0;
|
||||
|
||||
Monitor->nVrefresh = 1;
|
||||
Monitor->vrefresh[0].lo = 1024.0;
|
||||
Monitor->vrefresh[0].hi = 0.0;
|
||||
|
||||
while (Mode) {
|
||||
if (!Mode->HSync)
|
||||
Mode->HSync = ((float) Mode->Clock ) / ((float) Mode->HTotal);
|
||||
|
||||
if (!Mode->VRefresh)
|
||||
Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
|
||||
((float) (Mode->HTotal * Mode->VTotal));
|
||||
|
||||
if (Mode->HSync < Monitor->hsync[0].lo)
|
||||
Monitor->hsync[0].lo = Mode->HSync;
|
||||
|
||||
if (Mode->HSync > Monitor->hsync[0].hi)
|
||||
Monitor->hsync[0].hi = Mode->HSync;
|
||||
|
||||
if (Mode->VRefresh < Monitor->vrefresh[0].lo)
|
||||
Monitor->vrefresh[0].lo = Mode->VRefresh;
|
||||
|
||||
if (Mode->VRefresh > Monitor->vrefresh[0].hi)
|
||||
Monitor->vrefresh[0].hi = Mode->VRefresh;
|
||||
|
||||
Mode = Mode->next;
|
||||
}
|
||||
}
|
||||
|
||||
DisplayModePtr
|
||||
xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
|
||||
{
|
||||
int preferred, i;
|
||||
DisplayModePtr Modes = NULL, Mode;
|
||||
ddc_quirk_t quirks;
|
||||
|
||||
xf86DrvMsg (scrnIndex, X_INFO, "EDID vendor \"%s\", prod id %d\n",
|
||||
DDC->vendor.name, DDC->vendor.prod_id);
|
||||
quirks = DDC_QUIRK_NONE;
|
||||
for (i = 0; ddc_quirks[i].detect; i++)
|
||||
if (ddc_quirks[i].detect (scrnIndex, DDC))
|
||||
{
|
||||
xf86DrvMsg (scrnIndex, X_INFO, " EDID quirk: %s\n",
|
||||
ddc_quirks[i].description);
|
||||
quirks |= ddc_quirks[i].quirk;
|
||||
}
|
||||
|
||||
preferred = PREFERRED_TIMING_MODE(DDC->features.msc);
|
||||
if (quirks & DDC_QUIRK_PREFER_LARGE_60)
|
||||
preferred = 0;
|
||||
|
||||
for (i = 0; i < DET_TIMINGS; i++) {
|
||||
struct detailed_monitor_section *det_mon = &DDC->det_mon[i];
|
||||
|
||||
switch (det_mon->type) {
|
||||
case DT:
|
||||
Mode = DDCModeFromDetailedTiming(scrnIndex,
|
||||
&det_mon->section.d_timings,
|
||||
preferred,
|
||||
quirks);
|
||||
preferred = 0;
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
break;
|
||||
case DS_STD_TIMINGS:
|
||||
Mode = DDCModesFromStandardTiming(scrnIndex,
|
||||
det_mon->section.std_t,
|
||||
quirks);
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add established timings */
|
||||
Mode = DDCModesFromEstablished(scrnIndex, &DDC->timings1, quirks);
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
|
||||
/* Add standard timings */
|
||||
Mode = DDCModesFromStandardTiming(scrnIndex, DDC->timings2, quirks);
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
|
||||
if (quirks & DDC_QUIRK_PREFER_LARGE_60)
|
||||
{
|
||||
DisplayModePtr best = Modes;
|
||||
for (Mode = Modes; Mode; Mode = Mode->next)
|
||||
{
|
||||
if (Mode == best) continue;
|
||||
if (Mode->HDisplay * Mode->VDisplay > best->HDisplay * best->VDisplay)
|
||||
{
|
||||
best = Mode;
|
||||
continue;
|
||||
}
|
||||
if (Mode->HDisplay * Mode->VDisplay == best->HDisplay * best->VDisplay)
|
||||
{
|
||||
double mode_refresh = xf86ModeVRefresh (Mode);
|
||||
double best_refresh = xf86ModeVRefresh (best);
|
||||
double mode_dist = fabs(mode_refresh - 60.0);
|
||||
double best_dist = fabs(best_refresh - 60.0);
|
||||
if (mode_dist < best_dist)
|
||||
{
|
||||
best = Mode;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (best)
|
||||
best->type |= M_T_PREFERRED;
|
||||
}
|
||||
return Modes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill out MonPtr with xf86MonPtr information.
|
||||
*/
|
||||
void
|
||||
xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
|
||||
{
|
||||
DisplayModePtr Modes = NULL, Mode;
|
||||
int i, clock;
|
||||
Bool have_hsync = FALSE, have_vrefresh = FALSE;
|
||||
|
||||
if (!Monitor || !DDC)
|
||||
return;
|
||||
|
||||
Monitor->DDC = DDC;
|
||||
|
||||
Monitor->widthmm = 10 * DDC->features.hsize;
|
||||
Monitor->heightmm = 10 * DDC->features.vsize;
|
||||
|
||||
/* If this is a digital display, then we can use reduced blanking */
|
||||
if (DDC->features.input_type)
|
||||
Monitor->reducedblanking = TRUE;
|
||||
/* Allow the user to also enable this through config */
|
||||
|
||||
Modes = xf86DDCGetModes(scrnIndex, DDC);
|
||||
|
||||
/* Skip EDID ranges if they were specified in the config file */
|
||||
have_hsync = (Monitor->nHsync != 0);
|
||||
have_vrefresh = (Monitor->nVrefresh != 0);
|
||||
|
||||
/* Go through the detailed monitor sections */
|
||||
for (i = 0; i < DET_TIMINGS; i++) {
|
||||
switch (DDC->det_mon[i].type) {
|
||||
case DS_RANGES:
|
||||
if (!have_hsync) {
|
||||
if (!Monitor->nHsync)
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"Using EDID range info for horizontal sync\n");
|
||||
Monitor->hsync[Monitor->nHsync].lo =
|
||||
DDC->det_mon[i].section.ranges.min_h;
|
||||
Monitor->hsync[Monitor->nHsync].hi =
|
||||
DDC->det_mon[i].section.ranges.max_h;
|
||||
Monitor->nHsync++;
|
||||
} else {
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"Using hsync ranges from config file\n");
|
||||
}
|
||||
|
||||
if (!have_vrefresh) {
|
||||
if (!Monitor->nVrefresh)
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"Using EDID range info for vertical refresh\n");
|
||||
Monitor->vrefresh[Monitor->nVrefresh].lo =
|
||||
DDC->det_mon[i].section.ranges.min_v;
|
||||
Monitor->vrefresh[Monitor->nVrefresh].hi =
|
||||
DDC->det_mon[i].section.ranges.max_v;
|
||||
Monitor->nVrefresh++;
|
||||
} else {
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"Using vrefresh ranges from config file\n");
|
||||
}
|
||||
|
||||
clock = DDC->det_mon[i].section.ranges.max_clock * 1000;
|
||||
if (clock > Monitor->maxPixClock)
|
||||
Monitor->maxPixClock = clock;
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Modes) {
|
||||
/* Print Modes */
|
||||
xf86DrvMsg(scrnIndex, X_INFO, "Printing DDC gathered Modelines:\n");
|
||||
|
||||
Mode = Modes;
|
||||
while (Mode) {
|
||||
xf86PrintModeline(scrnIndex, Mode);
|
||||
Mode = Mode->next;
|
||||
}
|
||||
|
||||
/* Do we still need ranges to be filled in? */
|
||||
if (!Monitor->nHsync || !Monitor->nVrefresh)
|
||||
DDCGuessRangesFromModes(scrnIndex, Monitor, Modes);
|
||||
|
||||
/* look for last Mode */
|
||||
Mode = Modes;
|
||||
|
||||
while (Mode->next)
|
||||
Mode = Mode->next;
|
||||
|
||||
/* add to MonPtr */
|
||||
if (Monitor->Modes) {
|
||||
Monitor->Last->next = Modes;
|
||||
Modes->prev = Monitor->Last;
|
||||
Monitor->Last = Mode;
|
||||
} else {
|
||||
Monitor->Modes = Modes;
|
||||
Monitor->Last = Mode;
|
||||
}
|
||||
}
|
||||
}
|
664
hw/xfree86/modes/xf86Modes.c
Normal file
664
hw/xfree86/modes/xf86Modes.c
Normal file
|
@ -0,0 +1,664 @@
|
|||
/* -*- c-basic-offset: 4 -*- */
|
||||
/* $XdotOrg: xserver/xorg/hw/xfree86/common/xf86Mode.c,v 1.10 2006/03/07 16:00:57 libv Exp $ */
|
||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.69 2003/10/08 14:58:28 dawes Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the copyright holder(s)
|
||||
* and author(s) shall not be used in advertising or otherwise to promote
|
||||
* the sale, use or other dealings in this Software without prior written
|
||||
* authorization from the copyright holder(s) and author(s).
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#else
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "xf86Modes.h"
|
||||
#include "xf86Priv.h"
|
||||
|
||||
extern XF86ConfigPtr xf86configptr;
|
||||
|
||||
/**
|
||||
* @file this file contains symbols from xf86Mode.c and friends that are static
|
||||
* there but we still want to use. We need to come up with better API here.
|
||||
*/
|
||||
|
||||
#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,2,99,2,0)
|
||||
/**
|
||||
* Calculates the horizontal sync rate of a mode.
|
||||
*
|
||||
* Exact copy of xf86Mode.c's.
|
||||
*/
|
||||
double
|
||||
xf86ModeHSync(DisplayModePtr mode)
|
||||
{
|
||||
double hsync = 0.0;
|
||||
|
||||
if (mode->HSync > 0.0)
|
||||
hsync = mode->HSync;
|
||||
else if (mode->HTotal > 0)
|
||||
hsync = (float)mode->Clock / (float)mode->HTotal;
|
||||
|
||||
return hsync;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the vertical refresh rate of a mode.
|
||||
*
|
||||
* Exact copy of xf86Mode.c's.
|
||||
*/
|
||||
double
|
||||
xf86ModeVRefresh(DisplayModePtr mode)
|
||||
{
|
||||
double refresh = 0.0;
|
||||
|
||||
if (mode->VRefresh > 0.0)
|
||||
refresh = mode->VRefresh;
|
||||
else if (mode->HTotal > 0 && mode->VTotal > 0) {
|
||||
refresh = mode->Clock * 1000.0 / mode->HTotal / mode->VTotal;
|
||||
if (mode->Flags & V_INTERLACE)
|
||||
refresh *= 2.0;
|
||||
if (mode->Flags & V_DBLSCAN)
|
||||
refresh /= 2.0;
|
||||
if (mode->VScan > 1)
|
||||
refresh /= (float)(mode->VScan);
|
||||
}
|
||||
return refresh;
|
||||
}
|
||||
|
||||
int
|
||||
xf86ModeWidth (DisplayModePtr mode, Rotation rotation)
|
||||
{
|
||||
switch (rotation & 0xf) {
|
||||
case RR_Rotate_0:
|
||||
case RR_Rotate_180:
|
||||
return mode->HDisplay;
|
||||
case RR_Rotate_90:
|
||||
case RR_Rotate_270:
|
||||
return mode->VDisplay;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
xf86ModeHeight (DisplayModePtr mode, Rotation rotation)
|
||||
{
|
||||
switch (rotation & 0xf) {
|
||||
case RR_Rotate_0:
|
||||
case RR_Rotate_180:
|
||||
return mode->VDisplay;
|
||||
case RR_Rotate_90:
|
||||
case RR_Rotate_270:
|
||||
return mode->HDisplay;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/** Sets a default mode name of <width>x<height> on a mode. */
|
||||
void
|
||||
xf86SetModeDefaultName(DisplayModePtr mode)
|
||||
{
|
||||
if (mode->name != NULL)
|
||||
xfree(mode->name);
|
||||
|
||||
mode->name = XNFprintf("%dx%d", mode->HDisplay, mode->VDisplay);
|
||||
}
|
||||
|
||||
/*
|
||||
* xf86SetModeCrtc
|
||||
*
|
||||
* Initialises the Crtc parameters for a mode. The initialisation includes
|
||||
* adjustments for interlaced and double scan modes.
|
||||
*
|
||||
* Exact copy of xf86Mode.c's.
|
||||
*/
|
||||
void
|
||||
xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
|
||||
{
|
||||
if ((p == NULL) || ((p->type & M_T_CRTC_C) == M_T_BUILTIN))
|
||||
return;
|
||||
|
||||
p->CrtcHDisplay = p->HDisplay;
|
||||
p->CrtcHSyncStart = p->HSyncStart;
|
||||
p->CrtcHSyncEnd = p->HSyncEnd;
|
||||
p->CrtcHTotal = p->HTotal;
|
||||
p->CrtcHSkew = p->HSkew;
|
||||
p->CrtcVDisplay = p->VDisplay;
|
||||
p->CrtcVSyncStart = p->VSyncStart;
|
||||
p->CrtcVSyncEnd = p->VSyncEnd;
|
||||
p->CrtcVTotal = p->VTotal;
|
||||
if (p->Flags & V_INTERLACE) {
|
||||
if (adjustFlags & INTERLACE_HALVE_V) {
|
||||
p->CrtcVDisplay /= 2;
|
||||
p->CrtcVSyncStart /= 2;
|
||||
p->CrtcVSyncEnd /= 2;
|
||||
p->CrtcVTotal /= 2;
|
||||
}
|
||||
/* Force interlaced modes to have an odd VTotal */
|
||||
/* maybe we should only do this when INTERLACE_HALVE_V is set? */
|
||||
p->CrtcVTotal |= 1;
|
||||
}
|
||||
|
||||
if (p->Flags & V_DBLSCAN) {
|
||||
p->CrtcVDisplay *= 2;
|
||||
p->CrtcVSyncStart *= 2;
|
||||
p->CrtcVSyncEnd *= 2;
|
||||
p->CrtcVTotal *= 2;
|
||||
}
|
||||
if (p->VScan > 1) {
|
||||
p->CrtcVDisplay *= p->VScan;
|
||||
p->CrtcVSyncStart *= p->VScan;
|
||||
p->CrtcVSyncEnd *= p->VScan;
|
||||
p->CrtcVTotal *= p->VScan;
|
||||
}
|
||||
p->CrtcVBlankStart = min(p->CrtcVSyncStart, p->CrtcVDisplay);
|
||||
p->CrtcVBlankEnd = max(p->CrtcVSyncEnd, p->CrtcVTotal);
|
||||
p->CrtcHBlankStart = min(p->CrtcHSyncStart, p->CrtcHDisplay);
|
||||
p->CrtcHBlankEnd = max(p->CrtcHSyncEnd, p->CrtcHTotal);
|
||||
|
||||
p->CrtcHAdjusted = FALSE;
|
||||
p->CrtcVAdjusted = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates and returns a copy of pMode, including pointers within pMode.
|
||||
*/
|
||||
DisplayModePtr
|
||||
xf86DuplicateMode(DisplayModePtr pMode)
|
||||
{
|
||||
DisplayModePtr pNew;
|
||||
|
||||
pNew = xnfalloc(sizeof(DisplayModeRec));
|
||||
*pNew = *pMode;
|
||||
pNew->next = NULL;
|
||||
pNew->prev = NULL;
|
||||
if (pNew->name == NULL) {
|
||||
xf86SetModeDefaultName(pMode);
|
||||
} else {
|
||||
pNew->name = xnfstrdup(pMode->name);
|
||||
}
|
||||
|
||||
return pNew;
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates every mode in the given list and returns a pointer to the first
|
||||
* mode.
|
||||
*
|
||||
* \param modeList doubly-linked mode list
|
||||
*/
|
||||
DisplayModePtr
|
||||
xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
|
||||
{
|
||||
DisplayModePtr first = NULL, last = NULL;
|
||||
DisplayModePtr mode;
|
||||
|
||||
for (mode = modeList; mode != NULL; mode = mode->next) {
|
||||
DisplayModePtr new;
|
||||
|
||||
new = xf86DuplicateMode(mode);
|
||||
|
||||
/* Insert pNew into modeList */
|
||||
if (last) {
|
||||
last->next = new;
|
||||
new->prev = last;
|
||||
} else {
|
||||
first = new;
|
||||
new->prev = NULL;
|
||||
}
|
||||
new->next = NULL;
|
||||
last = new;
|
||||
}
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given modes should program to the same timings.
|
||||
*
|
||||
* This doesn't use Crtc values, as it might be used on ModeRecs without the
|
||||
* Crtc values set. So, it's assumed that the other numbers are enough.
|
||||
*
|
||||
* This isn't in xf86Modes.c, but it might deserve to be there.
|
||||
*/
|
||||
Bool
|
||||
xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
|
||||
{
|
||||
if (pMode1->Clock == pMode2->Clock &&
|
||||
pMode1->HDisplay == pMode2->HDisplay &&
|
||||
pMode1->HSyncStart == pMode2->HSyncStart &&
|
||||
pMode1->HSyncEnd == pMode2->HSyncEnd &&
|
||||
pMode1->HTotal == pMode2->HTotal &&
|
||||
pMode1->HSkew == pMode2->HSkew &&
|
||||
pMode1->VDisplay == pMode2->VDisplay &&
|
||||
pMode1->VSyncStart == pMode2->VSyncStart &&
|
||||
pMode1->VSyncEnd == pMode2->VSyncEnd &&
|
||||
pMode1->VTotal == pMode2->VTotal &&
|
||||
pMode1->VScan == pMode2->VScan &&
|
||||
pMode1->Flags == pMode2->Flags)
|
||||
{
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* exact copy of xf86Mode.c */
|
||||
static void
|
||||
add(char **p, char *new)
|
||||
{
|
||||
*p = xnfrealloc(*p, strlen(*p) + strlen(new) + 2);
|
||||
strcat(*p, " ");
|
||||
strcat(*p, new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print out a modeline.
|
||||
*
|
||||
* Convenient VRefresh printing was added, though, compared to xf86Mode.c
|
||||
*/
|
||||
void
|
||||
xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
|
||||
{
|
||||
char tmp[256];
|
||||
char *flags = xnfcalloc(1, 1);
|
||||
|
||||
if (mode->HSkew) {
|
||||
snprintf(tmp, 256, "hskew %i", mode->HSkew);
|
||||
add(&flags, tmp);
|
||||
}
|
||||
if (mode->VScan) {
|
||||
snprintf(tmp, 256, "vscan %i", mode->VScan);
|
||||
add(&flags, tmp);
|
||||
}
|
||||
if (mode->Flags & V_INTERLACE) add(&flags, "interlace");
|
||||
if (mode->Flags & V_CSYNC) add(&flags, "composite");
|
||||
if (mode->Flags & V_DBLSCAN) add(&flags, "doublescan");
|
||||
if (mode->Flags & V_BCAST) add(&flags, "bcast");
|
||||
if (mode->Flags & V_PHSYNC) add(&flags, "+hsync");
|
||||
if (mode->Flags & V_NHSYNC) add(&flags, "-hsync");
|
||||
if (mode->Flags & V_PVSYNC) add(&flags, "+vsync");
|
||||
if (mode->Flags & V_NVSYNC) add(&flags, "-vsync");
|
||||
if (mode->Flags & V_PCSYNC) add(&flags, "+csync");
|
||||
if (mode->Flags & V_NCSYNC) add(&flags, "-csync");
|
||||
#if 0
|
||||
if (mode->Flags & V_CLKDIV2) add(&flags, "vclk/2");
|
||||
#endif
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"Modeline \"%s\"x%.01f %6.2f %i %i %i %i %i %i %i %i%s "
|
||||
"(%.01f kHz)\n",
|
||||
mode->name, mode->VRefresh, mode->Clock/1000., mode->HDisplay,
|
||||
mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
|
||||
mode->VDisplay, mode->VSyncStart, mode->VSyncEnd,
|
||||
mode->VTotal, flags, xf86ModeHSync(mode));
|
||||
xfree(flags);
|
||||
}
|
||||
#endif /* XORG_VERSION_CURRENT <= 7.2.99.2 */
|
||||
|
||||
/**
|
||||
* Marks as bad any modes with unsupported flags.
|
||||
*
|
||||
* \param modeList doubly-linked or circular list of modes.
|
||||
* \param flags flags supported by the driver.
|
||||
*
|
||||
* \bug only V_INTERLACE and V_DBLSCAN are supported. Is that enough?
|
||||
*
|
||||
* This is not in xf86Modes.c, but would be part of the proposed new API.
|
||||
*/
|
||||
void
|
||||
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
||||
int flags)
|
||||
{
|
||||
DisplayModePtr mode;
|
||||
|
||||
for (mode = modeList; mode != NULL; mode = mode->next) {
|
||||
if (mode->Flags & V_INTERLACE && !(flags & V_INTERLACE))
|
||||
mode->status = MODE_NO_INTERLACE;
|
||||
if (mode->Flags & V_DBLSCAN && !(flags & V_DBLSCAN))
|
||||
mode->status = MODE_NO_DBLESCAN;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks as bad any modes extending beyond the given max X, Y, or pitch.
|
||||
*
|
||||
* \param modeList doubly-linked or circular list of modes.
|
||||
*
|
||||
* This is not in xf86Modes.c, but would be part of the proposed new API.
|
||||
*/
|
||||
void
|
||||
xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
||||
int maxX, int maxY, int maxPitch)
|
||||
{
|
||||
DisplayModePtr mode;
|
||||
|
||||
for (mode = modeList; mode != NULL; mode = mode->next) {
|
||||
if (maxPitch > 0 && mode->HDisplay > maxPitch)
|
||||
mode->status = MODE_BAD_WIDTH;
|
||||
|
||||
if (maxX > 0 && mode->HDisplay > maxX)
|
||||
mode->status = MODE_VIRTUAL_X;
|
||||
|
||||
if (maxY > 0 && mode->VDisplay > maxY)
|
||||
mode->status = MODE_VIRTUAL_Y;
|
||||
|
||||
if (mode->next == modeList)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks as bad any modes that aren't supported by the given monitor's
|
||||
* hsync and vrefresh ranges.
|
||||
*
|
||||
* \param modeList doubly-linked or circular list of modes.
|
||||
*
|
||||
* This is not in xf86Modes.c, but would be part of the proposed new API.
|
||||
*/
|
||||
void
|
||||
xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
||||
MonPtr mon)
|
||||
{
|
||||
DisplayModePtr mode;
|
||||
|
||||
for (mode = modeList; mode != NULL; mode = mode->next) {
|
||||
Bool bad;
|
||||
int i;
|
||||
|
||||
bad = TRUE;
|
||||
for (i = 0; i < mon->nHsync; i++) {
|
||||
if (xf86ModeHSync(mode) >= mon->hsync[i].lo &&
|
||||
xf86ModeHSync(mode) <= mon->hsync[i].hi)
|
||||
{
|
||||
bad = FALSE;
|
||||
}
|
||||
}
|
||||
if (bad)
|
||||
mode->status = MODE_HSYNC;
|
||||
|
||||
bad = TRUE;
|
||||
for (i = 0; i < mon->nVrefresh; i++) {
|
||||
if (xf86ModeVRefresh(mode) >= mon->vrefresh[i].lo &&
|
||||
xf86ModeVRefresh(mode) <= mon->vrefresh[i].hi)
|
||||
{
|
||||
bad = FALSE;
|
||||
}
|
||||
}
|
||||
if (bad)
|
||||
mode->status = MODE_VSYNC;
|
||||
|
||||
if (mode->next == modeList)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks as bad any modes extending beyond outside of the given clock ranges.
|
||||
*
|
||||
* \param modeList doubly-linked or circular list of modes.
|
||||
* \param min pointer to minimums of clock ranges
|
||||
* \param max pointer to maximums of clock ranges
|
||||
* \param n_ranges number of ranges.
|
||||
*
|
||||
* This is not in xf86Modes.c, but would be part of the proposed new API.
|
||||
*/
|
||||
void
|
||||
xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
||||
int *min, int *max, int n_ranges)
|
||||
{
|
||||
DisplayModePtr mode;
|
||||
int i;
|
||||
|
||||
for (mode = modeList; mode != NULL; mode = mode->next) {
|
||||
Bool good = FALSE;
|
||||
for (i = 0; i < n_ranges; i++) {
|
||||
if (mode->Clock >= min[i] && mode->Clock <= max[i]) {
|
||||
good = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!good)
|
||||
mode->status = MODE_CLOCK_RANGE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the user has specified a set of mode names to use, mark as bad any modes
|
||||
* not listed.
|
||||
*
|
||||
* The user mode names specified are prefixes to names of modes, so "1024x768"
|
||||
* will match modes named "1024x768", "1024x768x75", "1024x768-good", but
|
||||
* "1024x768x75" would only match "1024x768x75" from that list.
|
||||
*
|
||||
* MODE_BAD is used as the rejection flag, for lack of a better flag.
|
||||
*
|
||||
* \param modeList doubly-linked or circular list of modes.
|
||||
*
|
||||
* This is not in xf86Modes.c, but would be part of the proposed new API.
|
||||
*/
|
||||
void
|
||||
xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
|
||||
{
|
||||
DisplayModePtr mode;
|
||||
|
||||
if (pScrn->display->modes[0] == NULL)
|
||||
return;
|
||||
|
||||
for (mode = modeList; mode != NULL; mode = mode->next) {
|
||||
int i;
|
||||
Bool good = FALSE;
|
||||
|
||||
for (i = 0; pScrn->display->modes[i] != NULL; i++) {
|
||||
if (strncmp(pScrn->display->modes[i], mode->name,
|
||||
strlen(pScrn->display->modes[i])) == 0) {
|
||||
good = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!good)
|
||||
mode->status = MODE_BAD;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Frees any modes from the list with a status other than MODE_OK.
|
||||
*
|
||||
* \param modeList pointer to a doubly-linked or circular list of modes.
|
||||
* \param verbose determines whether the reason for mode invalidation is
|
||||
* printed.
|
||||
*
|
||||
* This is not in xf86Modes.c, but would be part of the proposed new API.
|
||||
*/
|
||||
void
|
||||
xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
|
||||
Bool verbose)
|
||||
{
|
||||
DisplayModePtr mode;
|
||||
|
||||
for (mode = *modeList; mode != NULL;) {
|
||||
DisplayModePtr next = mode->next, first = *modeList;
|
||||
|
||||
if (mode->status != MODE_OK) {
|
||||
if (verbose) {
|
||||
char *type = "";
|
||||
if (mode->type & M_T_BUILTIN)
|
||||
type = "built-in ";
|
||||
else if (mode->type & M_T_DEFAULT)
|
||||
type = "default ";
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
||||
"Not using %smode \"%s\" (%s)\n", type, mode->name,
|
||||
xf86ModeStatusToString(mode->status));
|
||||
}
|
||||
xf86DeleteMode(modeList, mode);
|
||||
}
|
||||
|
||||
if (next == first)
|
||||
break;
|
||||
mode = next;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the new mode into the mode list, and returns the new list
|
||||
*
|
||||
* \param modes doubly-linked mode list.
|
||||
*/
|
||||
DisplayModePtr
|
||||
xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
|
||||
{
|
||||
if (modes == NULL)
|
||||
return new;
|
||||
|
||||
if (new) {
|
||||
DisplayModePtr mode = modes;
|
||||
|
||||
while (mode->next)
|
||||
mode = mode->next;
|
||||
|
||||
mode->next = new;
|
||||
new->prev = mode;
|
||||
}
|
||||
|
||||
return modes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a mode list from a list of config file modes
|
||||
*/
|
||||
static DisplayModePtr
|
||||
xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
|
||||
{
|
||||
DisplayModePtr head = NULL, prev = NULL, mode;
|
||||
|
||||
for (; conf_mode; conf_mode = (XF86ConfModeLinePtr) conf_mode->list.next)
|
||||
{
|
||||
mode = xcalloc(1, sizeof(DisplayModeRec));
|
||||
if (!mode)
|
||||
continue;
|
||||
mode->name = xstrdup(conf_mode->ml_identifier);
|
||||
if (!mode->name)
|
||||
{
|
||||
xfree (mode);
|
||||
continue;
|
||||
}
|
||||
mode->type = 0;
|
||||
mode->Clock = conf_mode->ml_clock;
|
||||
mode->HDisplay = conf_mode->ml_hdisplay;
|
||||
mode->HSyncStart = conf_mode->ml_hsyncstart;
|
||||
mode->HSyncEnd = conf_mode->ml_hsyncend;
|
||||
mode->HTotal = conf_mode->ml_htotal;
|
||||
mode->VDisplay = conf_mode->ml_vdisplay;
|
||||
mode->VSyncStart = conf_mode->ml_vsyncstart;
|
||||
mode->VSyncEnd = conf_mode->ml_vsyncend;
|
||||
mode->VTotal = conf_mode->ml_vtotal;
|
||||
mode->Flags = conf_mode->ml_flags;
|
||||
mode->HSkew = conf_mode->ml_hskew;
|
||||
mode->VScan = conf_mode->ml_vscan;
|
||||
|
||||
mode->prev = prev;
|
||||
mode->next = NULL;
|
||||
if (prev)
|
||||
prev->next = mode;
|
||||
else
|
||||
head = mode;
|
||||
prev = mode;
|
||||
}
|
||||
return head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a mode list from a monitor configuration
|
||||
*/
|
||||
DisplayModePtr
|
||||
xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
|
||||
{
|
||||
DisplayModePtr modes = NULL;
|
||||
XF86ConfModesLinkPtr modes_link;
|
||||
|
||||
if (!conf_monitor)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* first we collect the mode lines from the UseModes directive
|
||||
*/
|
||||
for (modes_link = conf_monitor->mon_modes_sect_lst;
|
||||
modes_link;
|
||||
modes_link = modes_link->list.next)
|
||||
{
|
||||
/* If this modes link hasn't been resolved, go look it up now */
|
||||
if (!modes_link->ml_modes)
|
||||
modes_link->ml_modes = xf86findModes (modes_link->ml_modes_str,
|
||||
xf86configptr->conf_modes_lst);
|
||||
if (modes_link->ml_modes)
|
||||
modes = xf86ModesAdd (modes,
|
||||
xf86GetConfigModes (modes_link->ml_modes->mon_modeline_lst));
|
||||
}
|
||||
|
||||
return xf86ModesAdd (modes,
|
||||
xf86GetConfigModes (conf_monitor->mon_modeline_lst));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a mode list containing all of the default modes
|
||||
*/
|
||||
DisplayModePtr
|
||||
xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
|
||||
{
|
||||
DisplayModePtr head = NULL, prev = NULL, mode;
|
||||
int i;
|
||||
|
||||
for (i = 0; xf86DefaultModes[i].name != NULL; i++)
|
||||
{
|
||||
DisplayModePtr defMode = &xf86DefaultModes[i];
|
||||
|
||||
if (!interlaceAllowed && (defMode->Flags & V_INTERLACE))
|
||||
continue;
|
||||
if (!doubleScanAllowed && (defMode->Flags & V_DBLSCAN))
|
||||
continue;
|
||||
|
||||
mode = xalloc(sizeof(DisplayModeRec));
|
||||
if (!mode)
|
||||
continue;
|
||||
memcpy(mode,&xf86DefaultModes[i],sizeof(DisplayModeRec));
|
||||
mode->name = xstrdup(xf86DefaultModes[i].name);
|
||||
if (!mode->name)
|
||||
{
|
||||
xfree (mode);
|
||||
continue;
|
||||
}
|
||||
mode->prev = prev;
|
||||
mode->next = NULL;
|
||||
if (prev)
|
||||
prev->next = mode;
|
||||
else
|
||||
head = mode;
|
||||
prev = mode;
|
||||
}
|
||||
return head;
|
||||
}
|
98
hw/xfree86/modes/xf86Modes.h
Normal file
98
hw/xfree86/modes/xf86Modes.h
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright © 2006 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Eric Anholt <eric@anholt.net>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _XF86MODES_H_
|
||||
#define _XF86MODES_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xorgVersion.h"
|
||||
#include "edid.h"
|
||||
#include "xf86Parser.h"
|
||||
#if XF86_MODES_RENAME
|
||||
#include "xf86Rename.h"
|
||||
#endif
|
||||
|
||||
double xf86ModeHSync(DisplayModePtr mode);
|
||||
double xf86ModeVRefresh(DisplayModePtr mode);
|
||||
|
||||
int
|
||||
xf86ModeWidth (DisplayModePtr mode, Rotation rotation);
|
||||
|
||||
int
|
||||
xf86ModeHeight (DisplayModePtr mode, Rotation rotation);
|
||||
|
||||
DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode);
|
||||
DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn,
|
||||
DisplayModePtr modeList);
|
||||
void xf86SetModeDefaultName(DisplayModePtr mode);
|
||||
void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
|
||||
Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
|
||||
void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
|
||||
DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
|
||||
|
||||
DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
|
||||
DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
|
||||
Bool Reduced, Bool Interlaced);
|
||||
|
||||
void
|
||||
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
||||
int flags);
|
||||
|
||||
void
|
||||
xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
||||
int *min, int *max, int n_ranges);
|
||||
|
||||
void
|
||||
xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
||||
int maxX, int maxY, int maxPitch);
|
||||
|
||||
void
|
||||
xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
||||
MonPtr mon);
|
||||
|
||||
void
|
||||
xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
|
||||
Bool verbose);
|
||||
|
||||
void
|
||||
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
||||
int flags);
|
||||
|
||||
void
|
||||
xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
|
||||
|
||||
DisplayModePtr
|
||||
xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
|
||||
|
||||
DisplayModePtr
|
||||
xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed);
|
||||
|
||||
#endif /* _XF86MODES_H_ */
|
960
hw/xfree86/modes/xf86RandR12.c
Normal file
960
hw/xfree86/modes/xf86RandR12.c
Normal file
|
@ -0,0 +1,960 @@
|
|||
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.3 2004/07/30 21:53:09 eich Exp $ */
|
||||
/*
|
||||
* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.7tsi Exp $
|
||||
*
|
||||
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of the copyright holders not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no representations
|
||||
* about the suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#else
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "xf86.h"
|
||||
#include "os.h"
|
||||
#include "mibank.h"
|
||||
#include "globals.h"
|
||||
#include "xf86.h"
|
||||
#include "xf86Priv.h"
|
||||
#include "xf86DDC.h"
|
||||
#include "mipointer.h"
|
||||
#include "windowstr.h"
|
||||
#include <randrstr.h>
|
||||
#include <X11/extensions/render.h>
|
||||
|
||||
#include "xf86Crtc.h"
|
||||
#include "xf86RandR12.h"
|
||||
|
||||
typedef struct _xf86RandR12Info {
|
||||
int virtualX;
|
||||
int virtualY;
|
||||
int mmWidth;
|
||||
int mmHeight;
|
||||
int maxX;
|
||||
int maxY;
|
||||
Rotation rotation; /* current mode */
|
||||
Rotation supported_rotations; /* driver supported */
|
||||
} XF86RandRInfoRec, *XF86RandRInfoPtr;
|
||||
|
||||
#ifdef RANDR_12_INTERFACE
|
||||
static Bool xf86RandR12Init12 (ScreenPtr pScreen);
|
||||
static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
|
||||
#endif
|
||||
|
||||
static int xf86RandR12Index;
|
||||
static int xf86RandR12Generation;
|
||||
|
||||
#define XF86RANDRINFO(p) \
|
||||
((XF86RandRInfoPtr)(p)->devPrivates[xf86RandR12Index].ptr)
|
||||
|
||||
static int
|
||||
xf86RandR12ModeRefresh (DisplayModePtr mode)
|
||||
{
|
||||
if (mode->VRefresh)
|
||||
return (int) (mode->VRefresh + 0.5);
|
||||
else
|
||||
return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations)
|
||||
{
|
||||
RRScreenSizePtr pSize;
|
||||
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
|
||||
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
|
||||
DisplayModePtr mode;
|
||||
int refresh0 = 60;
|
||||
int maxX = 0, maxY = 0;
|
||||
|
||||
*rotations = randrp->supported_rotations;
|
||||
|
||||
if (randrp->virtualX == -1 || randrp->virtualY == -1)
|
||||
{
|
||||
randrp->virtualX = scrp->virtualX;
|
||||
randrp->virtualY = scrp->virtualY;
|
||||
}
|
||||
|
||||
/* Re-probe the outputs for new monitors or modes */
|
||||
xf86ProbeOutputModes (scrp, 0, 0);
|
||||
xf86SetScrnInfoModes (scrp);
|
||||
xf86DiDGAReInit (pScreen);
|
||||
|
||||
for (mode = scrp->modes; ; mode = mode->next)
|
||||
{
|
||||
int refresh = xf86RandR12ModeRefresh (mode);
|
||||
if (randrp->maxX == 0 || randrp->maxY == 0)
|
||||
{
|
||||
if (maxX < mode->HDisplay)
|
||||
maxX = mode->HDisplay;
|
||||
if (maxY < mode->VDisplay)
|
||||
maxY = mode->VDisplay;
|
||||
}
|
||||
if (mode == scrp->modes)
|
||||
refresh0 = refresh;
|
||||
pSize = RRRegisterSize (pScreen,
|
||||
mode->HDisplay, mode->VDisplay,
|
||||
randrp->mmWidth, randrp->mmHeight);
|
||||
if (!pSize)
|
||||
return FALSE;
|
||||
RRRegisterRate (pScreen, pSize, refresh);
|
||||
|
||||
if (xf86ModesEqual(mode, scrp->currentMode) &&
|
||||
mode->HDisplay == scrp->virtualX &&
|
||||
mode->VDisplay == scrp->virtualY)
|
||||
{
|
||||
RRSetCurrentConfig (pScreen, randrp->rotation, refresh, pSize);
|
||||
}
|
||||
if (mode->next == scrp->modes)
|
||||
break;
|
||||
}
|
||||
|
||||
if (randrp->maxX == 0 || randrp->maxY == 0)
|
||||
{
|
||||
randrp->maxX = maxX;
|
||||
randrp->maxY = maxY;
|
||||
}
|
||||
|
||||
if (scrp->currentMode->HDisplay != randrp->virtualX ||
|
||||
scrp->currentMode->VDisplay != randrp->virtualY)
|
||||
{
|
||||
pSize = RRRegisterSize (pScreen,
|
||||
randrp->virtualX, randrp->virtualY,
|
||||
randrp->mmWidth,
|
||||
randrp->mmHeight);
|
||||
if (!pSize)
|
||||
return FALSE;
|
||||
RRRegisterRate (pScreen, pSize, refresh0);
|
||||
if (scrp->virtualX == randrp->virtualX &&
|
||||
scrp->virtualY == randrp->virtualY)
|
||||
{
|
||||
RRSetCurrentConfig (pScreen, randrp->rotation, refresh0, pSize);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR12SetMode (ScreenPtr pScreen,
|
||||
DisplayModePtr mode,
|
||||
Bool useVirtual,
|
||||
int mmWidth,
|
||||
int mmHeight)
|
||||
{
|
||||
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
|
||||
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
|
||||
int oldWidth = pScreen->width;
|
||||
int oldHeight = pScreen->height;
|
||||
int oldmmWidth = pScreen->mmWidth;
|
||||
int oldmmHeight = pScreen->mmHeight;
|
||||
WindowPtr pRoot = WindowTable[pScreen->myNum];
|
||||
DisplayModePtr currentMode = NULL;
|
||||
Bool ret = TRUE;
|
||||
PixmapPtr pspix = NULL;
|
||||
|
||||
if (pRoot)
|
||||
(*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
|
||||
if (useVirtual)
|
||||
{
|
||||
scrp->virtualX = randrp->virtualX;
|
||||
scrp->virtualY = randrp->virtualY;
|
||||
}
|
||||
else
|
||||
{
|
||||
scrp->virtualX = mode->HDisplay;
|
||||
scrp->virtualY = mode->VDisplay;
|
||||
}
|
||||
|
||||
if(randrp->rotation & (RR_Rotate_90 | RR_Rotate_270))
|
||||
{
|
||||
/* If the screen is rotated 90 or 270 degrees, swap the sizes. */
|
||||
pScreen->width = scrp->virtualY;
|
||||
pScreen->height = scrp->virtualX;
|
||||
pScreen->mmWidth = mmHeight;
|
||||
pScreen->mmHeight = mmWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
pScreen->width = scrp->virtualX;
|
||||
pScreen->height = scrp->virtualY;
|
||||
pScreen->mmWidth = mmWidth;
|
||||
pScreen->mmHeight = mmHeight;
|
||||
}
|
||||
if (scrp->currentMode == mode) {
|
||||
/* Save current mode */
|
||||
currentMode = scrp->currentMode;
|
||||
/* Reset, just so we ensure the drivers SwitchMode is called */
|
||||
scrp->currentMode = NULL;
|
||||
}
|
||||
/*
|
||||
* We know that if the driver failed to SwitchMode to the rotated
|
||||
* version, then it should revert back to it's prior mode.
|
||||
*/
|
||||
if (!xf86SwitchMode (pScreen, mode))
|
||||
{
|
||||
ret = FALSE;
|
||||
scrp->virtualX = pScreen->width = oldWidth;
|
||||
scrp->virtualY = pScreen->height = oldHeight;
|
||||
pScreen->mmWidth = oldmmWidth;
|
||||
pScreen->mmHeight = oldmmHeight;
|
||||
scrp->currentMode = currentMode;
|
||||
}
|
||||
/*
|
||||
* Get the new Screen pixmap ptr as SwitchMode might have called
|
||||
* ModifyPixmapHeader and xf86EnableDisableFBAccess will put it back...
|
||||
* Unfortunately.
|
||||
*/
|
||||
pspix = (*pScreen->GetScreenPixmap) (pScreen);
|
||||
if (pspix->devPrivate.ptr)
|
||||
scrp->pixmapPrivate = pspix->devPrivate;
|
||||
|
||||
/*
|
||||
* Make sure the layout is correct
|
||||
*/
|
||||
xf86ReconfigureLayout();
|
||||
|
||||
/*
|
||||
* Make sure the whole screen is visible
|
||||
*/
|
||||
xf86SetViewport (pScreen, pScreen->width, pScreen->height);
|
||||
xf86SetViewport (pScreen, 0, 0);
|
||||
if (pRoot)
|
||||
(*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Bool
|
||||
xf86RandR12SetConfig (ScreenPtr pScreen,
|
||||
Rotation rotation,
|
||||
int rate,
|
||||
RRScreenSizePtr pSize)
|
||||
{
|
||||
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
|
||||
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
|
||||
DisplayModePtr mode;
|
||||
int px, py;
|
||||
Bool useVirtual = FALSE;
|
||||
int maxX = 0, maxY = 0;
|
||||
Rotation oldRotation = randrp->rotation;
|
||||
|
||||
randrp->rotation = rotation;
|
||||
|
||||
if (randrp->virtualX == -1 || randrp->virtualY == -1)
|
||||
{
|
||||
randrp->virtualX = scrp->virtualX;
|
||||
randrp->virtualY = scrp->virtualY;
|
||||
}
|
||||
|
||||
miPointerPosition (&px, &py);
|
||||
for (mode = scrp->modes; ; mode = mode->next)
|
||||
{
|
||||
if (randrp->maxX == 0 || randrp->maxY == 0)
|
||||
{
|
||||
if (maxX < mode->HDisplay)
|
||||
maxX = mode->HDisplay;
|
||||
if (maxY < mode->VDisplay)
|
||||
maxY = mode->VDisplay;
|
||||
}
|
||||
if (mode->HDisplay == pSize->width &&
|
||||
mode->VDisplay == pSize->height &&
|
||||
(rate == 0 || xf86RandR12ModeRefresh (mode) == rate))
|
||||
break;
|
||||
if (mode->next == scrp->modes)
|
||||
{
|
||||
if (pSize->width == randrp->virtualX &&
|
||||
pSize->height == randrp->virtualY)
|
||||
{
|
||||
mode = scrp->modes;
|
||||
useVirtual = TRUE;
|
||||
break;
|
||||
}
|
||||
if (randrp->maxX == 0 || randrp->maxY == 0)
|
||||
{
|
||||
randrp->maxX = maxX;
|
||||
randrp->maxY = maxY;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (randrp->maxX == 0 || randrp->maxY == 0)
|
||||
{
|
||||
randrp->maxX = maxX;
|
||||
randrp->maxY = maxY;
|
||||
}
|
||||
|
||||
if (!xf86RandR12SetMode (pScreen, mode, useVirtual, pSize->mmWidth,
|
||||
pSize->mmHeight)) {
|
||||
randrp->rotation = oldRotation;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Move the cursor back where it belongs; SwitchMode repositions it
|
||||
*/
|
||||
if (pScreen == miPointerCurrentScreen ())
|
||||
{
|
||||
px = (px >= pScreen->width ? (pScreen->width - 1) : px);
|
||||
py = (py >= pScreen->height ? (pScreen->height - 1) : py);
|
||||
|
||||
xf86SetViewport(pScreen, px, py);
|
||||
|
||||
(*pScreen->SetCursorPosition) (pScreen, px, py, FALSE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR12ScreenSetSize (ScreenPtr pScreen,
|
||||
CARD16 width,
|
||||
CARD16 height,
|
||||
CARD32 mmWidth,
|
||||
CARD32 mmHeight)
|
||||
{
|
||||
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
|
||||
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
WindowPtr pRoot = WindowTable[pScreen->myNum];
|
||||
Bool ret = FALSE;
|
||||
|
||||
if (randrp->virtualX == -1 || randrp->virtualY == -1)
|
||||
{
|
||||
randrp->virtualX = pScrn->virtualX;
|
||||
randrp->virtualY = pScrn->virtualY;
|
||||
}
|
||||
if (pRoot)
|
||||
(*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
|
||||
|
||||
/* Let the driver update virtualX and virtualY */
|
||||
if (!(*config->funcs->resize)(pScrn, width, height))
|
||||
goto finish;
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
pScreen->width = width;
|
||||
pScreen->height = height;
|
||||
pScreen->mmWidth = mmWidth;
|
||||
pScreen->mmHeight = mmHeight;
|
||||
|
||||
xf86SetViewport (pScreen, pScreen->width-1, pScreen->height-1);
|
||||
xf86SetViewport (pScreen, 0, 0);
|
||||
|
||||
finish:
|
||||
if (pRoot)
|
||||
(*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
|
||||
#if RANDR_12_INTERFACE
|
||||
if (WindowTable[pScreen->myNum] && ret)
|
||||
RRScreenSizeNotify (pScreen);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
Rotation
|
||||
xf86RandR12GetRotation(ScreenPtr pScreen)
|
||||
{
|
||||
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
|
||||
|
||||
return randrp->rotation;
|
||||
}
|
||||
|
||||
Bool
|
||||
xf86RandR12CreateScreenResources (ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
|
||||
int c;
|
||||
int width, height;
|
||||
int mmWidth, mmHeight;
|
||||
#ifdef PANORAMIX
|
||||
/* XXX disable RandR when using Xinerama */
|
||||
if (!noPanoramiXExtension)
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compute size of screen
|
||||
*/
|
||||
width = 0; height = 0;
|
||||
for (c = 0; c < config->num_crtc; c++)
|
||||
{
|
||||
xf86CrtcPtr crtc = config->crtc[c];
|
||||
int crtc_width = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
|
||||
int crtc_height = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
|
||||
|
||||
if (crtc->enabled && crtc_width > width)
|
||||
width = crtc_width;
|
||||
if (crtc->enabled && crtc_height > height)
|
||||
height = crtc_height;
|
||||
}
|
||||
|
||||
if (width && height)
|
||||
{
|
||||
/*
|
||||
* Compute physical size of screen
|
||||
*/
|
||||
if (monitorResolution)
|
||||
{
|
||||
mmWidth = width * 25.4 / monitorResolution;
|
||||
mmHeight = height * 25.4 / monitorResolution;
|
||||
}
|
||||
else
|
||||
{
|
||||
mmWidth = pScreen->mmWidth;
|
||||
mmHeight = pScreen->mmHeight;
|
||||
}
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
||||
"Setting screen physical size to %d x %d\n",
|
||||
mmWidth, mmHeight);
|
||||
xf86RandR12ScreenSetSize (pScreen,
|
||||
width,
|
||||
height,
|
||||
mmWidth,
|
||||
mmHeight);
|
||||
}
|
||||
|
||||
if (randrp->virtualX == -1 || randrp->virtualY == -1)
|
||||
{
|
||||
randrp->virtualX = pScrn->virtualX;
|
||||
randrp->virtualY = pScrn->virtualY;
|
||||
}
|
||||
xf86CrtcSetScreenSubpixelOrder (pScreen);
|
||||
#if RANDR_12_INTERFACE
|
||||
if (xf86RandR12CreateScreenResources12 (pScreen))
|
||||
return TRUE;
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
xf86RandR12Init (ScreenPtr pScreen)
|
||||
{
|
||||
rrScrPrivPtr rp;
|
||||
XF86RandRInfoPtr randrp;
|
||||
|
||||
#ifdef PANORAMIX
|
||||
/* XXX disable RandR when using Xinerama */
|
||||
if (!noPanoramiXExtension)
|
||||
return TRUE;
|
||||
#endif
|
||||
if (xf86RandR12Generation != serverGeneration)
|
||||
{
|
||||
xf86RandR12Index = AllocateScreenPrivateIndex();
|
||||
xf86RandR12Generation = serverGeneration;
|
||||
}
|
||||
|
||||
randrp = xalloc (sizeof (XF86RandRInfoRec));
|
||||
if (!randrp)
|
||||
return FALSE;
|
||||
|
||||
if (!RRScreenInit(pScreen))
|
||||
{
|
||||
xfree (randrp);
|
||||
return FALSE;
|
||||
}
|
||||
rp = rrGetScrPriv(pScreen);
|
||||
rp->rrGetInfo = xf86RandR12GetInfo;
|
||||
rp->rrSetConfig = xf86RandR12SetConfig;
|
||||
|
||||
randrp->virtualX = -1;
|
||||
randrp->virtualY = -1;
|
||||
randrp->mmWidth = pScreen->mmWidth;
|
||||
randrp->mmHeight = pScreen->mmHeight;
|
||||
|
||||
randrp->rotation = RR_Rotate_0; /* initial rotated mode */
|
||||
|
||||
randrp->supported_rotations = RR_Rotate_0;
|
||||
|
||||
randrp->maxX = randrp->maxY = 0;
|
||||
|
||||
pScreen->devPrivates[xf86RandR12Index].ptr = randrp;
|
||||
|
||||
#if RANDR_12_INTERFACE
|
||||
if (!xf86RandR12Init12 (pScreen))
|
||||
return FALSE;
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
|
||||
{
|
||||
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
|
||||
#if RANDR_12_INTERFACE
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
int c;
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
|
||||
for (c = 0; c < config->num_crtc; c++) {
|
||||
xf86CrtcPtr crtc = config->crtc[c];
|
||||
|
||||
RRCrtcSetRotations (crtc->randr_crtc, rotations);
|
||||
}
|
||||
#endif
|
||||
randrp->supported_rotations = rotations;
|
||||
}
|
||||
|
||||
void
|
||||
xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y)
|
||||
{
|
||||
ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
|
||||
|
||||
if (xf86RandR12Generation != serverGeneration ||
|
||||
XF86RANDRINFO(pScreen)->virtualX == -1)
|
||||
{
|
||||
*x = pScrn->virtualX;
|
||||
*y = pScrn->virtualY;
|
||||
} else {
|
||||
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
|
||||
|
||||
*x = randrp->virtualX;
|
||||
*y = randrp->virtualY;
|
||||
}
|
||||
}
|
||||
|
||||
#if RANDR_12_INTERFACE
|
||||
static Bool
|
||||
xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
|
||||
{
|
||||
ScreenPtr pScreen = randr_crtc->pScreen;
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
RRModePtr randr_mode = NULL;
|
||||
int x;
|
||||
int y;
|
||||
Rotation rotation;
|
||||
int numOutputs;
|
||||
RROutputPtr *randr_outputs;
|
||||
RROutputPtr randr_output;
|
||||
xf86CrtcPtr crtc = randr_crtc->devPrivate;
|
||||
xf86OutputPtr output;
|
||||
int i, j;
|
||||
DisplayModePtr mode = &crtc->mode;
|
||||
Bool ret;
|
||||
|
||||
randr_outputs = ALLOCATE_LOCAL(config->num_output * sizeof (RROutputPtr));
|
||||
if (!randr_outputs)
|
||||
return FALSE;
|
||||
x = crtc->x;
|
||||
y = crtc->y;
|
||||
rotation = crtc->rotation;
|
||||
numOutputs = 0;
|
||||
randr_mode = NULL;
|
||||
for (i = 0; i < config->num_output; i++)
|
||||
{
|
||||
output = config->output[i];
|
||||
if (output->crtc == crtc)
|
||||
{
|
||||
randr_output = output->randr_output;
|
||||
randr_outputs[numOutputs++] = randr_output;
|
||||
/*
|
||||
* We make copies of modes, so pointer equality
|
||||
* isn't sufficient
|
||||
*/
|
||||
for (j = 0; j < randr_output->numModes; j++)
|
||||
{
|
||||
DisplayModePtr outMode = randr_output->modes[j]->devPrivate;
|
||||
if (xf86ModesEqual(mode, outMode))
|
||||
{
|
||||
randr_mode = randr_output->modes[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ret = RRCrtcNotify (randr_crtc, randr_mode, x, y,
|
||||
rotation, numOutputs, randr_outputs);
|
||||
DEALLOCATE_LOCAL(randr_outputs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR12CrtcSet (ScreenPtr pScreen,
|
||||
RRCrtcPtr randr_crtc,
|
||||
RRModePtr randr_mode,
|
||||
int x,
|
||||
int y,
|
||||
Rotation rotation,
|
||||
int num_randr_outputs,
|
||||
RROutputPtr *randr_outputs)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
xf86CrtcPtr crtc = randr_crtc->devPrivate;
|
||||
DisplayModePtr mode = randr_mode ? randr_mode->devPrivate : NULL;
|
||||
Bool changed = FALSE;
|
||||
int o, ro;
|
||||
xf86CrtcPtr *save_crtcs;
|
||||
Bool save_enabled = crtc->enabled;
|
||||
|
||||
save_crtcs = ALLOCATE_LOCAL(config->num_crtc * sizeof (xf86CrtcPtr));
|
||||
if ((mode != NULL) != crtc->enabled)
|
||||
changed = TRUE;
|
||||
else if (mode && !xf86ModesEqual (&crtc->mode, mode))
|
||||
changed = TRUE;
|
||||
|
||||
if (rotation != crtc->rotation)
|
||||
changed = TRUE;
|
||||
|
||||
if (x != crtc->x || y != crtc->y)
|
||||
changed = TRUE;
|
||||
for (o = 0; o < config->num_output; o++)
|
||||
{
|
||||
xf86OutputPtr output = config->output[o];
|
||||
xf86CrtcPtr new_crtc;
|
||||
|
||||
save_crtcs[o] = output->crtc;
|
||||
|
||||
if (output->crtc == crtc)
|
||||
new_crtc = NULL;
|
||||
else
|
||||
new_crtc = output->crtc;
|
||||
for (ro = 0; ro < num_randr_outputs; ro++)
|
||||
if (output->randr_output == randr_outputs[ro])
|
||||
{
|
||||
new_crtc = crtc;
|
||||
break;
|
||||
}
|
||||
if (new_crtc != output->crtc)
|
||||
{
|
||||
changed = TRUE;
|
||||
output->crtc = new_crtc;
|
||||
}
|
||||
}
|
||||
/* XXX need device-independent mode setting code through an API */
|
||||
if (changed)
|
||||
{
|
||||
crtc->enabled = mode != NULL;
|
||||
|
||||
if (mode)
|
||||
{
|
||||
if (!xf86CrtcSetMode (crtc, mode, rotation, x, y))
|
||||
{
|
||||
crtc->enabled = save_enabled;
|
||||
for (o = 0; o < config->num_output; o++)
|
||||
{
|
||||
xf86OutputPtr output = config->output[o];
|
||||
output->crtc = save_crtcs[o];
|
||||
}
|
||||
DEALLOCATE_LOCAL(save_crtcs);
|
||||
return FALSE;
|
||||
}
|
||||
/*
|
||||
* Save the last successful setting for EnterVT
|
||||
*/
|
||||
crtc->desiredMode = *mode;
|
||||
crtc->desiredRotation = rotation;
|
||||
crtc->desiredX = x;
|
||||
crtc->desiredY = y;
|
||||
}
|
||||
xf86DisableUnusedFunctions (pScrn);
|
||||
}
|
||||
DEALLOCATE_LOCAL(save_crtcs);
|
||||
return xf86RandR12CrtcNotify (randr_crtc);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR12CrtcSetGamma (ScreenPtr pScreen,
|
||||
RRCrtcPtr randr_crtc)
|
||||
{
|
||||
xf86CrtcPtr crtc = randr_crtc->devPrivate;
|
||||
|
||||
if (crtc->funcs->gamma_set == NULL)
|
||||
return FALSE;
|
||||
|
||||
crtc->funcs->gamma_set(crtc, randr_crtc->gammaRed, randr_crtc->gammaGreen,
|
||||
randr_crtc->gammaBlue, randr_crtc->gammaSize);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR12OutputSetProperty (ScreenPtr pScreen,
|
||||
RROutputPtr randr_output,
|
||||
Atom property,
|
||||
RRPropertyValuePtr value)
|
||||
{
|
||||
xf86OutputPtr output = randr_output->devPrivate;
|
||||
|
||||
/* If we don't have any property handler, then we don't care what the
|
||||
* user is setting properties to.
|
||||
*/
|
||||
if (output->funcs->set_property == NULL)
|
||||
return TRUE;
|
||||
|
||||
return output->funcs->set_property(output, property, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a list of xf86 modes and a RandR Output object, construct
|
||||
* RandR modes and assign them to the output
|
||||
*/
|
||||
static Bool
|
||||
xf86RROutputSetModes (RROutputPtr randr_output, DisplayModePtr modes)
|
||||
{
|
||||
DisplayModePtr mode;
|
||||
RRModePtr *rrmodes = NULL;
|
||||
int nmode = 0;
|
||||
int npreferred = 0;
|
||||
Bool ret = TRUE;
|
||||
int pref;
|
||||
|
||||
for (mode = modes; mode; mode = mode->next)
|
||||
nmode++;
|
||||
|
||||
if (nmode) {
|
||||
rrmodes = xalloc (nmode * sizeof (RRModePtr));
|
||||
|
||||
if (!rrmodes)
|
||||
return FALSE;
|
||||
nmode = 0;
|
||||
|
||||
for (pref = 1; pref >= 0; pref--) {
|
||||
for (mode = modes; mode; mode = mode->next) {
|
||||
if ((pref != 0) == ((mode->type & M_T_PREFERRED) != 0)) {
|
||||
xRRModeInfo modeInfo;
|
||||
RRModePtr rrmode;
|
||||
|
||||
modeInfo.nameLength = strlen (mode->name);
|
||||
modeInfo.width = mode->HDisplay;
|
||||
modeInfo.dotClock = mode->Clock * 1000;
|
||||
modeInfo.hSyncStart = mode->HSyncStart;
|
||||
modeInfo.hSyncEnd = mode->HSyncEnd;
|
||||
modeInfo.hTotal = mode->HTotal;
|
||||
modeInfo.hSkew = mode->HSkew;
|
||||
|
||||
modeInfo.height = mode->VDisplay;
|
||||
modeInfo.vSyncStart = mode->VSyncStart;
|
||||
modeInfo.vSyncEnd = mode->VSyncEnd;
|
||||
modeInfo.vTotal = mode->VTotal;
|
||||
modeInfo.modeFlags = mode->Flags;
|
||||
|
||||
rrmode = RRModeGet (&modeInfo, mode->name);
|
||||
if (rrmode) {
|
||||
rrmode->devPrivate = mode;
|
||||
rrmodes[nmode++] = rrmode;
|
||||
npreferred += pref;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = RROutputSetModes (randr_output, rrmodes, nmode, npreferred);
|
||||
xfree (rrmodes);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Mirror the current mode configuration to RandR
|
||||
*/
|
||||
static Bool
|
||||
xf86RandR12SetInfo12 (ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
RROutputPtr *clones;
|
||||
RRCrtcPtr *crtcs;
|
||||
int ncrtc;
|
||||
int o, c, l;
|
||||
RRCrtcPtr randr_crtc;
|
||||
int nclone;
|
||||
|
||||
clones = ALLOCATE_LOCAL(config->num_output * sizeof (RROutputPtr));
|
||||
crtcs = ALLOCATE_LOCAL (config->num_crtc * sizeof (RRCrtcPtr));
|
||||
for (o = 0; o < config->num_output; o++)
|
||||
{
|
||||
xf86OutputPtr output = config->output[o];
|
||||
|
||||
ncrtc = 0;
|
||||
for (c = 0; c < config->num_crtc; c++)
|
||||
if (output->possible_crtcs & (1 << c))
|
||||
crtcs[ncrtc++] = config->crtc[c]->randr_crtc;
|
||||
|
||||
if (output->crtc)
|
||||
randr_crtc = output->crtc->randr_crtc;
|
||||
else
|
||||
randr_crtc = NULL;
|
||||
|
||||
if (!RROutputSetCrtcs (output->randr_output, crtcs, ncrtc))
|
||||
{
|
||||
DEALLOCATE_LOCAL (crtcs);
|
||||
DEALLOCATE_LOCAL (clones);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RROutputSetCrtc (output->randr_output, randr_crtc);
|
||||
RROutputSetPhysicalSize(output->randr_output,
|
||||
output->mm_width,
|
||||
output->mm_height);
|
||||
xf86RROutputSetModes (output->randr_output, output->probed_modes);
|
||||
|
||||
switch (output->status) {
|
||||
case XF86OutputStatusConnected:
|
||||
RROutputSetConnection (output->randr_output, RR_Connected);
|
||||
break;
|
||||
case XF86OutputStatusDisconnected:
|
||||
RROutputSetConnection (output->randr_output, RR_Disconnected);
|
||||
break;
|
||||
case XF86OutputStatusUnknown:
|
||||
RROutputSetConnection (output->randr_output, RR_UnknownConnection);
|
||||
break;
|
||||
}
|
||||
|
||||
RROutputSetSubpixelOrder (output->randr_output, output->subpixel_order);
|
||||
|
||||
/*
|
||||
* Valid clones
|
||||
*/
|
||||
nclone = 0;
|
||||
for (l = 0; l < config->num_output; l++)
|
||||
{
|
||||
xf86OutputPtr clone = config->output[l];
|
||||
|
||||
if (l != o && (output->possible_clones & (1 << l)))
|
||||
clones[nclone++] = clone->randr_output;
|
||||
}
|
||||
if (!RROutputSetClones (output->randr_output, clones, nclone))
|
||||
{
|
||||
DEALLOCATE_LOCAL (crtcs);
|
||||
DEALLOCATE_LOCAL (clones);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
DEALLOCATE_LOCAL (crtcs);
|
||||
DEALLOCATE_LOCAL (clones);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Query the hardware for the current state, then mirror
|
||||
* that to RandR
|
||||
*/
|
||||
static Bool
|
||||
xf86RandR12GetInfo12 (ScreenPtr pScreen, Rotation *rotations)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
|
||||
xf86ProbeOutputModes (pScrn, 0, 0);
|
||||
xf86SetScrnInfoModes (pScrn);
|
||||
xf86DiDGAReInit (pScreen);
|
||||
return xf86RandR12SetInfo12 (pScreen);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR12CreateObjects12 (ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
int c;
|
||||
int o;
|
||||
|
||||
if (!RRInit ())
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* Configure crtcs
|
||||
*/
|
||||
for (c = 0; c < config->num_crtc; c++)
|
||||
{
|
||||
xf86CrtcPtr crtc = config->crtc[c];
|
||||
|
||||
crtc->randr_crtc = RRCrtcCreate (crtc);
|
||||
RRCrtcAttachScreen (crtc->randr_crtc, pScreen);
|
||||
RRCrtcGammaSetSize (crtc->randr_crtc, 256);
|
||||
}
|
||||
/*
|
||||
* Configure outputs
|
||||
*/
|
||||
for (o = 0; o < config->num_output; o++)
|
||||
{
|
||||
xf86OutputPtr output = config->output[o];
|
||||
|
||||
output->randr_output = RROutputCreate (output->name,
|
||||
strlen (output->name),
|
||||
output);
|
||||
RROutputAttachScreen (output->randr_output, pScreen);
|
||||
|
||||
if (output->funcs->create_resources != NULL)
|
||||
output->funcs->create_resources(output);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
|
||||
{
|
||||
int c;
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
|
||||
for (c = 0; c < config->num_crtc; c++)
|
||||
xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
|
||||
|
||||
|
||||
RRScreenSetSizeRange (pScreen, config->minWidth, config->minHeight,
|
||||
config->maxWidth, config->maxHeight);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
xf86RandR12PointerMoved (int scrnIndex, int x, int y)
|
||||
{
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR12Init12 (ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
rrScrPrivPtr rp = rrGetScrPriv(pScreen);
|
||||
|
||||
rp->rrGetInfo = xf86RandR12GetInfo12;
|
||||
rp->rrScreenSetSize = xf86RandR12ScreenSetSize;
|
||||
rp->rrCrtcSet = xf86RandR12CrtcSet;
|
||||
rp->rrCrtcSetGamma = xf86RandR12CrtcSetGamma;
|
||||
rp->rrOutputSetProperty = xf86RandR12OutputSetProperty;
|
||||
rp->rrSetConfig = NULL;
|
||||
pScrn->PointerMoved = xf86RandR12PointerMoved;
|
||||
if (!xf86RandR12CreateObjects12 (pScreen))
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* Configure output modes
|
||||
*/
|
||||
if (!xf86RandR12SetInfo12 (pScreen))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Bool
|
||||
xf86RandR12PreInit (ScrnInfoPtr pScrn)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
37
hw/xfree86/modes/xf86RandR12.h
Normal file
37
hw/xfree86/modes/xf86RandR12.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright © 2006 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of the copyright holders not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no representations
|
||||
* about the suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _XF86_RANDR_H_
|
||||
#define _XF86_RANDR_H_
|
||||
#include <randrstr.h>
|
||||
#include <X11/extensions/render.h>
|
||||
|
||||
Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen);
|
||||
Bool xf86RandR12Init(ScreenPtr pScreen);
|
||||
void xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotation);
|
||||
Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate,
|
||||
RRScreenSizePtr pSize);
|
||||
Rotation xf86RandR12GetRotation(ScreenPtr pScreen);
|
||||
void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y);
|
||||
Bool xf86RandR12PreInit (ScrnInfoPtr pScrn);
|
||||
|
||||
#endif /* _XF86_RANDR_H_ */
|
80
hw/xfree86/modes/xf86Rename.h
Normal file
80
hw/xfree86/modes/xf86Rename.h
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright © 2006 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of the copyright holders not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no representations
|
||||
* about the suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _XF86RENAME_H_
|
||||
#define _XF86RENAME_H_
|
||||
|
||||
#include "local_xf86Rename.h"
|
||||
|
||||
#define xf86CrtcConfigInit XF86NAME(xf86CrtcConfigInit)
|
||||
#define xf86CrtcConfigPrivateIndex XF86NAME(xf86CrtcConfigPrivateIndex)
|
||||
#define xf86CrtcCreate XF86NAME(xf86CrtcCreate)
|
||||
#define xf86CrtcDestroy XF86NAME(xf86CrtcDestroy)
|
||||
#define xf86CrtcInUse XF86NAME(xf86CrtcInUse)
|
||||
#define xf86CrtcRotate XF86NAME(xf86CrtcRotate)
|
||||
#define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode)
|
||||
#define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange)
|
||||
#define xf86CVTMode XF86NAME(xf86CVTMode)
|
||||
#define xf86DisableUnusedFunctions XF86NAME(xf86DisableUnusedFunctions)
|
||||
#define xf86DPMSSet XF86NAME(xf86DPMSSet)
|
||||
#define xf86DuplicateMode XF86NAME(xf86DuplicateMode)
|
||||
#define xf86DuplicateModes XF86NAME(xf86DuplicateModes)
|
||||
#define xf86GetDefaultModes XF86NAME(xf86GetDefaultModes)
|
||||
#define xf86GetMonitorModes XF86NAME(xf86GetMonitorModes)
|
||||
#define xf86InitialConfiguration XF86NAME(xf86InitialConfiguration)
|
||||
#define xf86ModeHSync XF86NAME(xf86ModeHSync)
|
||||
#define xf86ModesAdd XF86NAME(xf86ModesAdd)
|
||||
#define xf86ModesEqual XF86NAME(xf86ModesEqual)
|
||||
#define xf86ModeVRefresh XF86NAME(xf86ModeVRefresh)
|
||||
#define xf86OutputCreate XF86NAME(xf86OutputCreate)
|
||||
#define xf86OutputDestroy XF86NAME(xf86OutputDestroy)
|
||||
#define xf86OutputGetEDID XF86NAME(xf86OutputGetEDID)
|
||||
#define xf86OutputGetEDIDModes XF86NAME(xf86OutputGetEDIDModes)
|
||||
#define xf86OutputRename XF86NAME(xf86OutputRename)
|
||||
#define xf86OutputSetEDID XF86NAME(xf86OutputSetEDID)
|
||||
#define xf86PrintModeline XF86NAME(xf86PrintModeline)
|
||||
#define xf86ProbeOutputModes XF86NAME(xf86ProbeOutputModes)
|
||||
#define xf86PruneInvalidModes XF86NAME(xf86PruneInvalidModes)
|
||||
#define xf86SetModeCrtc XF86NAME(xf86SetModeCrtc)
|
||||
#define xf86SetModeDefaultName XF86NAME(xf86SetModeDefaultName)
|
||||
#define xf86SetScrnInfoModes XF86NAME(xf86SetScrnInfoModes)
|
||||
#define xf86ValidateModesClocks XF86NAME(xf86ValidateModesClocks)
|
||||
#define xf86ValidateModesFlags XF86NAME(xf86ValidateModesFlags)
|
||||
#define xf86ValidateModesSize XF86NAME(xf86ValidateModesSize)
|
||||
#define xf86ValidateModesSync XF86NAME(xf86ValidateModesSync)
|
||||
#define xf86ValidateModesUserConfig XF86NAME(xf86ValidateModesUserConfig)
|
||||
#define xf86DiDGAInit XF86NAME(xf86DiDGAInit)
|
||||
#define xf86DiDGAReInit XF86NAME(xf86DiDGAReInit)
|
||||
#define xf86DDCGetModes XF86NAME(xf86DDCGetModes)
|
||||
#define xf86RandR12CreateScreenResources XF86NAME(xf86RandR12CreateScreenResources)
|
||||
#define xf86RandR12GetOriginalVirtualSize XF86NAME(xf86RandR12GetOriginalVirtualSize)
|
||||
#define xf86RandR12GetRotation XF86NAME(xf86RandR12GetRotation)
|
||||
#define xf86RandR12Init XF86NAME(xf86RandR12Init)
|
||||
#define xf86RandR12PreInit XF86NAME(xf86RandR12PreInit)
|
||||
#define xf86RandR12SetConfig XF86NAME(xf86RandR12SetConfig)
|
||||
#define xf86RandR12SetRotations XF86NAME(xf86RandR12SetRotations)
|
||||
#define xf86SaveScreen XF86NAME(xf86SaveScreen)
|
||||
#define xf86CrtcSetScreenSubpixelOrder XF86NAME(xf86CrtcSetScreenSubpixelOrder)
|
||||
#define xf86ModeWidth XF86NAME(xf86ModeWidth)
|
||||
#define xf86ModeHeight XF86NAME(xf86ModeHeight)
|
||||
|
||||
#endif /* _XF86RENAME_H_ */
|
427
hw/xfree86/modes/xf86Rotate.c
Normal file
427
hw/xfree86/modes/xf86Rotate.c
Normal file
|
@ -0,0 +1,427 @@
|
|||
/*
|
||||
* Copyright © 2006 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of the copyright holders not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no representations
|
||||
* about the suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#else
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xf86DDC.h"
|
||||
#include "fb.h"
|
||||
#include "windowstr.h"
|
||||
#include "xf86Crtc.h"
|
||||
#include "xf86Modes.h"
|
||||
#include "xf86RandR12.h"
|
||||
#include "X11/extensions/render.h"
|
||||
#define DPMS_SERVER
|
||||
#include "X11/extensions/dpms.h"
|
||||
#include "X11/Xatom.h"
|
||||
|
||||
/* borrowed from composite extension, move to Render and publish? */
|
||||
|
||||
static VisualPtr
|
||||
compGetWindowVisual (WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
VisualID vid = wVisual (pWin);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pScreen->numVisuals; i++)
|
||||
if (pScreen->visuals[i].vid == vid)
|
||||
return &pScreen->visuals[i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PictFormatPtr
|
||||
compWindowFormat (WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
|
||||
return PictureMatchVisual (pScreen, pWin->drawable.depth,
|
||||
compGetWindowVisual (pWin));
|
||||
}
|
||||
|
||||
static void
|
||||
xf86TranslateBox (BoxPtr b, int dx, int dy)
|
||||
{
|
||||
b->x1 += dx;
|
||||
b->y1 += dy;
|
||||
b->x2 += dx;
|
||||
b->y2 += dy;
|
||||
}
|
||||
|
||||
static void
|
||||
xf86TransformBox (BoxPtr dst, BoxPtr src, Rotation rotation,
|
||||
int xoff, int yoff,
|
||||
int dest_width, int dest_height)
|
||||
{
|
||||
BoxRec stmp = *src;
|
||||
|
||||
xf86TranslateBox (&stmp, -xoff, -yoff);
|
||||
switch (rotation & 0xf) {
|
||||
default:
|
||||
case RR_Rotate_0:
|
||||
*dst = stmp;
|
||||
break;
|
||||
case RR_Rotate_90:
|
||||
dst->x1 = stmp.y1;
|
||||
dst->y1 = dest_height - stmp.x2;
|
||||
dst->x2 = stmp.y2;
|
||||
dst->y2 = dest_height - stmp.x1;
|
||||
break;
|
||||
case RR_Rotate_180:
|
||||
dst->x1 = dest_width - stmp.x2;
|
||||
dst->y1 = dest_height - stmp.y2;
|
||||
dst->x2 = dest_width - stmp.x1;
|
||||
dst->y2 = dest_height - stmp.y1;
|
||||
break;
|
||||
case RR_Rotate_270:
|
||||
dst->x1 = dest_width - stmp.y2;
|
||||
dst->y1 = stmp.x1;
|
||||
dst->y2 = stmp.x2;
|
||||
dst->x2 = dest_width - stmp.y1;
|
||||
break;
|
||||
}
|
||||
if (rotation & RR_Reflect_X) {
|
||||
int x1 = dst->x1;
|
||||
dst->x1 = dest_width - dst->x2;
|
||||
dst->x2 = dest_width - x1;
|
||||
}
|
||||
if (rotation & RR_Reflect_Y) {
|
||||
int y1 = dst->y1;
|
||||
dst->y1 = dest_height - dst->y2;
|
||||
dst->y2 = dest_height - y1;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
|
||||
{
|
||||
ScrnInfoPtr scrn = crtc->scrn;
|
||||
ScreenPtr screen = scrn->pScreen;
|
||||
WindowPtr root = WindowTable[screen->myNum];
|
||||
PixmapPtr dst_pixmap = crtc->rotatedPixmap;
|
||||
PictFormatPtr format = compWindowFormat (WindowTable[screen->myNum]);
|
||||
int error;
|
||||
PicturePtr src, dst;
|
||||
PictTransform transform;
|
||||
int n = REGION_NUM_RECTS(region);
|
||||
BoxPtr b = REGION_RECTS(region);
|
||||
XID include_inferiors = IncludeInferiors;
|
||||
|
||||
src = CreatePicture (None,
|
||||
&root->drawable,
|
||||
format,
|
||||
CPSubwindowMode,
|
||||
&include_inferiors,
|
||||
serverClient,
|
||||
&error);
|
||||
if (!src)
|
||||
return;
|
||||
|
||||
dst = CreatePicture (None,
|
||||
&dst_pixmap->drawable,
|
||||
format,
|
||||
0L,
|
||||
NULL,
|
||||
serverClient,
|
||||
&error);
|
||||
if (!dst)
|
||||
return;
|
||||
|
||||
memset (&transform, '\0', sizeof (transform));
|
||||
transform.matrix[2][2] = IntToxFixed(1);
|
||||
transform.matrix[0][2] = IntToxFixed(crtc->x);
|
||||
transform.matrix[1][2] = IntToxFixed(crtc->y);
|
||||
switch (crtc->rotation & 0xf) {
|
||||
default:
|
||||
case RR_Rotate_0:
|
||||
transform.matrix[0][0] = IntToxFixed(1);
|
||||
transform.matrix[1][1] = IntToxFixed(1);
|
||||
break;
|
||||
case RR_Rotate_90:
|
||||
transform.matrix[0][1] = IntToxFixed(-1);
|
||||
transform.matrix[1][0] = IntToxFixed(1);
|
||||
transform.matrix[0][2] += IntToxFixed(crtc->mode.VDisplay);
|
||||
break;
|
||||
case RR_Rotate_180:
|
||||
transform.matrix[0][0] = IntToxFixed(-1);
|
||||
transform.matrix[1][1] = IntToxFixed(-1);
|
||||
transform.matrix[0][2] += IntToxFixed(crtc->mode.HDisplay);
|
||||
transform.matrix[1][2] += IntToxFixed(crtc->mode.VDisplay);
|
||||
break;
|
||||
case RR_Rotate_270:
|
||||
transform.matrix[0][1] = IntToxFixed(1);
|
||||
transform.matrix[1][0] = IntToxFixed(-1);
|
||||
transform.matrix[1][2] += IntToxFixed(crtc->mode.HDisplay);
|
||||
break;
|
||||
}
|
||||
|
||||
/* handle reflection */
|
||||
if (crtc->rotation & RR_Reflect_X)
|
||||
{
|
||||
/* XXX figure this out */
|
||||
}
|
||||
if (crtc->rotation & RR_Reflect_Y)
|
||||
{
|
||||
/* XXX figure this out too */
|
||||
}
|
||||
|
||||
error = SetPictureTransform (src, &transform);
|
||||
if (error)
|
||||
return;
|
||||
|
||||
while (n--)
|
||||
{
|
||||
BoxRec dst_box;
|
||||
|
||||
xf86TransformBox (&dst_box, b, crtc->rotation,
|
||||
crtc->x, crtc->y,
|
||||
crtc->mode.HDisplay, crtc->mode.VDisplay);
|
||||
CompositePicture (PictOpSrc,
|
||||
src, NULL, dst,
|
||||
dst_box.x1, dst_box.y1, 0, 0, dst_box.x1, dst_box.y1,
|
||||
dst_box.x2 - dst_box.x1,
|
||||
dst_box.y2 - dst_box.y1);
|
||||
b++;
|
||||
}
|
||||
FreePicture (src, None);
|
||||
FreePicture (dst, None);
|
||||
}
|
||||
|
||||
static void
|
||||
xf86CrtcDamageShadow (xf86CrtcPtr crtc)
|
||||
{
|
||||
ScrnInfoPtr pScrn = crtc->scrn;
|
||||
BoxRec damage_box;
|
||||
RegionRec damage_region;
|
||||
ScreenPtr pScreen = pScrn->pScreen;
|
||||
|
||||
damage_box.x1 = crtc->x;
|
||||
damage_box.x2 = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
|
||||
damage_box.y1 = crtc->y;
|
||||
damage_box.y2 = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
|
||||
REGION_INIT (pScreen, &damage_region, &damage_box, 1);
|
||||
DamageDamageRegion (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
|
||||
&damage_region);
|
||||
REGION_UNINIT (pScreen, &damage_region);
|
||||
}
|
||||
|
||||
static void
|
||||
xf86RotatePrepare (ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
int c;
|
||||
|
||||
for (c = 0; c < xf86_config->num_crtc; c++)
|
||||
{
|
||||
xf86CrtcPtr crtc = xf86_config->crtc[c];
|
||||
|
||||
if (crtc->rotatedData && !crtc->rotatedPixmap)
|
||||
{
|
||||
crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
|
||||
crtc->rotatedData,
|
||||
crtc->mode.HDisplay,
|
||||
crtc->mode.VDisplay);
|
||||
/* Hook damage to screen pixmap */
|
||||
DamageRegister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
|
||||
xf86_config->rotationDamage);
|
||||
|
||||
xf86CrtcDamageShadow (crtc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xf86RotateRedisplay(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
DamagePtr damage = xf86_config->rotationDamage;
|
||||
RegionPtr region;
|
||||
|
||||
if (!damage)
|
||||
return;
|
||||
xf86RotatePrepare (pScreen);
|
||||
region = DamageRegion(damage);
|
||||
if (REGION_NOTEMPTY(pScreen, region))
|
||||
{
|
||||
int c;
|
||||
|
||||
for (c = 0; c < xf86_config->num_crtc; c++)
|
||||
{
|
||||
xf86CrtcPtr crtc = xf86_config->crtc[c];
|
||||
|
||||
if (crtc->rotation != RR_Rotate_0)
|
||||
{
|
||||
BoxRec box;
|
||||
RegionRec crtc_damage;
|
||||
|
||||
/* compute portion of damage that overlaps crtc */
|
||||
box.x1 = crtc->x;
|
||||
box.x2 = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
|
||||
box.y1 = crtc->y;
|
||||
box.y2 = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
|
||||
REGION_INIT(pScreen, &crtc_damage, &box, 1);
|
||||
REGION_INTERSECT (pScreen, &crtc_damage, &crtc_damage, region);
|
||||
|
||||
/* update damaged region */
|
||||
if (REGION_NOTEMPTY(pScreen, &crtc_damage))
|
||||
xf86RotateCrtcRedisplay (crtc, &crtc_damage);
|
||||
|
||||
REGION_UNINIT (pScreen, &crtc_damage);
|
||||
}
|
||||
}
|
||||
DamageEmpty(damage);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xf86RotateBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead)
|
||||
{
|
||||
ScreenPtr pScreen = (ScreenPtr) data;
|
||||
|
||||
xf86RotateRedisplay(pScreen);
|
||||
}
|
||||
|
||||
static void
|
||||
xf86RotateWakeupHandler(pointer data, int i, pointer LastSelectMask)
|
||||
{
|
||||
}
|
||||
|
||||
Bool
|
||||
xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
|
||||
{
|
||||
ScrnInfoPtr pScrn = crtc->scrn;
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
ScreenPtr pScreen = pScrn->pScreen;
|
||||
|
||||
if (rotation == RR_Rotate_0)
|
||||
{
|
||||
/* Free memory from rotation */
|
||||
if (crtc->rotatedPixmap || crtc->rotatedData)
|
||||
{
|
||||
crtc->funcs->shadow_destroy (crtc, crtc->rotatedPixmap, crtc->rotatedData);
|
||||
crtc->rotatedPixmap = NULL;
|
||||
crtc->rotatedData = NULL;
|
||||
}
|
||||
|
||||
if (xf86_config->rotationDamage)
|
||||
{
|
||||
/* Free damage structure */
|
||||
DamageUnregister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
|
||||
xf86_config->rotationDamage);
|
||||
DamageDestroy (xf86_config->rotationDamage);
|
||||
xf86_config->rotationDamage = NULL;
|
||||
/* Free block/wakeup handler */
|
||||
RemoveBlockAndWakeupHandlers (xf86RotateBlockHandler,
|
||||
xf86RotateWakeupHandler,
|
||||
(pointer) pScreen);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* these are the size of the shadow pixmap, which
|
||||
* matches the mode, not the pre-rotated copy in the
|
||||
* frame buffer
|
||||
*/
|
||||
int width = mode->HDisplay;
|
||||
int height = mode->VDisplay;
|
||||
void *shadowData = crtc->rotatedData;
|
||||
PixmapPtr shadow = crtc->rotatedPixmap;
|
||||
int old_width = shadow ? shadow->drawable.width : 0;
|
||||
int old_height = shadow ? shadow->drawable.height : 0;
|
||||
|
||||
/* Allocate memory for rotation */
|
||||
if (old_width != width || old_height != height)
|
||||
{
|
||||
if (shadow || shadowData)
|
||||
{
|
||||
crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
|
||||
crtc->rotatedPixmap = NULL;
|
||||
crtc->rotatedData = NULL;
|
||||
}
|
||||
shadowData = crtc->funcs->shadow_allocate (crtc, width, height);
|
||||
if (!shadowData)
|
||||
goto bail1;
|
||||
crtc->rotatedData = shadowData;
|
||||
/* shadow will be damaged in xf86RotatePrepare */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* mark shadowed area as damaged so it will be repainted */
|
||||
xf86CrtcDamageShadow (crtc);
|
||||
}
|
||||
|
||||
if (!xf86_config->rotationDamage)
|
||||
{
|
||||
/* Create damage structure */
|
||||
xf86_config->rotationDamage = DamageCreate (NULL, NULL,
|
||||
DamageReportNone,
|
||||
TRUE, pScreen, pScreen);
|
||||
if (!xf86_config->rotationDamage)
|
||||
goto bail2;
|
||||
|
||||
/* Assign block/wakeup handler */
|
||||
if (!RegisterBlockAndWakeupHandlers (xf86RotateBlockHandler,
|
||||
xf86RotateWakeupHandler,
|
||||
(pointer) pScreen))
|
||||
{
|
||||
goto bail3;
|
||||
}
|
||||
}
|
||||
if (0)
|
||||
{
|
||||
bail3:
|
||||
DamageDestroy (xf86_config->rotationDamage);
|
||||
xf86_config->rotationDamage = NULL;
|
||||
|
||||
bail2:
|
||||
if (shadow || shadowData)
|
||||
{
|
||||
crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
|
||||
crtc->rotatedPixmap = NULL;
|
||||
crtc->rotatedData = NULL;
|
||||
}
|
||||
bail1:
|
||||
if (old_width && old_height)
|
||||
crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
|
||||
NULL,
|
||||
old_width,
|
||||
old_height);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
return TRUE;
|
||||
}
|
308
hw/xfree86/modes/xf86cvt.c
Normal file
308
hw/xfree86/modes/xf86cvt.c
Normal file
|
@ -0,0 +1,308 @@
|
|||
/*
|
||||
* Copyright 2005-2006 Luc Verhaegen.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file This is a copy of xf86cvt.c from the X Server, for compatibility with
|
||||
* old servers (pre-1.2).
|
||||
*/
|
||||
|
||||
/*
|
||||
* The reason for having this function in a file of its own is
|
||||
* so that ../utils/cvt/cvt can link to it, and that xf86CVTMode
|
||||
* code is shared directly.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#else
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xf86Modes.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.
|
||||
*
|
||||
* These calculations are stolen from the CVT calculation spreadsheet written
|
||||
* by Graham Loveridge. He seems to be claiming no copyright and there seems to
|
||||
* be no license attached to this. He apparently just wants to see his name
|
||||
* mentioned.
|
||||
*
|
||||
* This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls
|
||||
*
|
||||
* Comments and structure corresponds to the comments and structure of the xls.
|
||||
* This should ease importing of future changes to the standard (not very
|
||||
* likely though).
|
||||
*
|
||||
* About margins; i'm sure that they are to be the bit between HDisplay and
|
||||
* HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and
|
||||
* VTotal, where the overscan colour is shown. FB seems to call _all_ blanking
|
||||
* outside sync "margin" for some reason. Since we prefer seeing proper
|
||||
* blanking instead of the overscan colour, and since the Crtc* values will
|
||||
* probably get altered after us, we will disable margins altogether. With
|
||||
* these calculations, Margins will plainly expand H/VDisplay, and we don't
|
||||
* want that. -- libv
|
||||
*
|
||||
*/
|
||||
_X_EXPORT DisplayModePtr
|
||||
xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
|
||||
Bool Interlaced)
|
||||
{
|
||||
DisplayModeRec *Mode = xnfalloc(sizeof(DisplayModeRec));
|
||||
|
||||
/* 1) top/bottom margin size (% of height) - default: 1.8 */
|
||||
#define CVT_MARGIN_PERCENTAGE 1.8
|
||||
|
||||
/* 2) character cell horizontal granularity (pixels) - default 8 */
|
||||
#define CVT_H_GRANULARITY 8
|
||||
|
||||
/* 4) Minimum vertical porch (lines) - default 3 */
|
||||
#define CVT_MIN_V_PORCH 3
|
||||
|
||||
/* 4) Minimum number of vertical back porch lines - default 6 */
|
||||
#define CVT_MIN_V_BPORCH 6
|
||||
|
||||
/* Pixel Clock step (kHz) */
|
||||
#define CVT_CLOCK_STEP 250
|
||||
|
||||
Bool Margins = FALSE;
|
||||
float VFieldRate, HPeriod;
|
||||
int HDisplayRnd, HMargin;
|
||||
int VDisplayRnd, VMargin, VSync;
|
||||
float Interlace; /* Please rename this */
|
||||
|
||||
memset(Mode, 0, sizeof(DisplayModeRec));
|
||||
|
||||
/* CVT default is 60.0Hz */
|
||||
if (!VRefresh)
|
||||
VRefresh = 60.0;
|
||||
|
||||
/* 1. Required field rate */
|
||||
if (Interlaced)
|
||||
VFieldRate = VRefresh * 2;
|
||||
else
|
||||
VFieldRate = VRefresh;
|
||||
|
||||
/* 2. Horizontal pixels */
|
||||
HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY);
|
||||
|
||||
/* 3. Determine left and right borders */
|
||||
if (Margins) {
|
||||
/* right margin is actually exactly the same as left */
|
||||
HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
|
||||
HMargin -= HMargin % CVT_H_GRANULARITY;
|
||||
} else
|
||||
HMargin = 0;
|
||||
|
||||
/* 4. Find total active pixels */
|
||||
Mode->HDisplay = HDisplayRnd + 2*HMargin;
|
||||
|
||||
/* 5. Find number of lines per field */
|
||||
if (Interlaced)
|
||||
VDisplayRnd = VDisplay / 2;
|
||||
else
|
||||
VDisplayRnd = VDisplay;
|
||||
|
||||
/* 6. Find top and bottom margins */
|
||||
/* nope. */
|
||||
if (Margins)
|
||||
/* top and bottom margins are equal again. */
|
||||
VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
|
||||
else
|
||||
VMargin = 0;
|
||||
|
||||
Mode->VDisplay = VDisplay + 2*VMargin;
|
||||
|
||||
/* 7. Interlace */
|
||||
if (Interlaced)
|
||||
Interlace = 0.5;
|
||||
else
|
||||
Interlace = 0.0;
|
||||
|
||||
/* Determine VSync Width from aspect ratio */
|
||||
if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay))
|
||||
VSync = 4;
|
||||
else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay))
|
||||
VSync = 5;
|
||||
else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay))
|
||||
VSync = 6;
|
||||
else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay))
|
||||
VSync = 7;
|
||||
else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay))
|
||||
VSync = 7;
|
||||
else /* Custom */
|
||||
VSync = 10;
|
||||
|
||||
if (!Reduced) { /* simplified GTF calculation */
|
||||
|
||||
/* 4) Minimum time of vertical sync + back porch interval (µs)
|
||||
* default 550.0 */
|
||||
#define CVT_MIN_VSYNC_BP 550.0
|
||||
|
||||
/* 3) Nominal HSync width (% of line period) - default 8 */
|
||||
#define CVT_HSYNC_PERCENTAGE 8
|
||||
|
||||
float HBlankPercentage;
|
||||
int VSyncAndBackPorch, VBackPorch;
|
||||
int HBlank;
|
||||
|
||||
/* 8. Estimated Horizontal period */
|
||||
HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) /
|
||||
(VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace);
|
||||
|
||||
/* 9. Find number of lines in sync + backporch */
|
||||
if (((int)(CVT_MIN_VSYNC_BP / HPeriod) + 1) < (VSync + CVT_MIN_V_PORCH))
|
||||
VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH;
|
||||
else
|
||||
VSyncAndBackPorch = (int)(CVT_MIN_VSYNC_BP / HPeriod) + 1;
|
||||
|
||||
/* 10. Find number of lines in back porch */
|
||||
VBackPorch = VSyncAndBackPorch - VSync;
|
||||
|
||||
/* 11. Find total number of lines in vertical field */
|
||||
Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace
|
||||
+ CVT_MIN_V_PORCH;
|
||||
|
||||
/* 5) Definition of Horizontal blanking time limitation */
|
||||
/* Gradient (%/kHz) - default 600 */
|
||||
#define CVT_M_FACTOR 600
|
||||
|
||||
/* Offset (%) - default 40 */
|
||||
#define CVT_C_FACTOR 40
|
||||
|
||||
/* Blanking time scaling factor - default 128 */
|
||||
#define CVT_K_FACTOR 128
|
||||
|
||||
/* Scaling factor weighting - default 20 */
|
||||
#define CVT_J_FACTOR 20
|
||||
|
||||
#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256
|
||||
#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \
|
||||
CVT_J_FACTOR
|
||||
|
||||
/* 12. Find ideal blanking duty cycle from formula */
|
||||
HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod/1000.0;
|
||||
|
||||
/* 13. Blanking time */
|
||||
if (HBlankPercentage < 20)
|
||||
HBlankPercentage = 20;
|
||||
|
||||
HBlank = Mode->HDisplay * HBlankPercentage/(100.0 - HBlankPercentage);
|
||||
HBlank -= HBlank % (2*CVT_H_GRANULARITY);
|
||||
|
||||
/* 14. Find total number of pixels in a line. */
|
||||
Mode->HTotal = Mode->HDisplay + HBlank;
|
||||
|
||||
/* Fill in HSync values */
|
||||
Mode->HSyncEnd = Mode->HDisplay + HBlank / 2;
|
||||
|
||||
Mode->HSyncStart = Mode->HSyncEnd -
|
||||
(Mode->HTotal * CVT_HSYNC_PERCENTAGE) / 100;
|
||||
Mode->HSyncStart += CVT_H_GRANULARITY -
|
||||
Mode->HSyncStart % CVT_H_GRANULARITY;
|
||||
|
||||
/* Fill in VSync values */
|
||||
Mode->VSyncStart = Mode->VDisplay + CVT_MIN_V_PORCH;
|
||||
Mode->VSyncEnd = Mode->VSyncStart + VSync;
|
||||
|
||||
} else { /* Reduced blanking */
|
||||
/* Minimum vertical blanking interval time (µs) - default 460 */
|
||||
#define CVT_RB_MIN_VBLANK 460.0
|
||||
|
||||
/* Fixed number of clocks for horizontal sync */
|
||||
#define CVT_RB_H_SYNC 32.0
|
||||
|
||||
/* Fixed number of clocks for horizontal blanking */
|
||||
#define CVT_RB_H_BLANK 160.0
|
||||
|
||||
/* Fixed number of lines for vertical front porch - default 3 */
|
||||
#define CVT_RB_VFPORCH 3
|
||||
|
||||
int VBILines;
|
||||
|
||||
/* 8. Estimate Horizontal period. */
|
||||
HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) /
|
||||
(VDisplayRnd + 2*VMargin);
|
||||
|
||||
/* 9. Find number of lines in vertical blanking */
|
||||
VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1;
|
||||
|
||||
/* 10. Check if vertical blanking is sufficient */
|
||||
if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH))
|
||||
VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH;
|
||||
|
||||
/* 11. Find total number of lines in vertical field */
|
||||
Mode->VTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines;
|
||||
|
||||
/* 12. Find total number of pixels in a line */
|
||||
Mode->HTotal = Mode->HDisplay + CVT_RB_H_BLANK;
|
||||
|
||||
/* Fill in HSync values */
|
||||
Mode->HSyncEnd = Mode->HDisplay + CVT_RB_H_BLANK / 2;
|
||||
Mode->HSyncStart = Mode->HSyncEnd - CVT_RB_H_SYNC;
|
||||
|
||||
/* Fill in VSync values */
|
||||
Mode->VSyncStart = Mode->VDisplay + CVT_RB_VFPORCH;
|
||||
Mode->VSyncEnd = Mode->VSyncStart + VSync;
|
||||
}
|
||||
|
||||
/* 15/13. Find pixel clock frequency (kHz for xf86) */
|
||||
Mode->Clock = Mode->HTotal * 1000.0 / HPeriod;
|
||||
Mode->Clock -= Mode->Clock % CVT_CLOCK_STEP;
|
||||
|
||||
/* 16/14. Find actual Horizontal Frequency (kHz) */
|
||||
Mode->HSync = ((float) Mode->Clock) / ((float) Mode->HTotal);
|
||||
|
||||
/* 17/15. Find actual Field rate */
|
||||
Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
|
||||
((float) (Mode->HTotal * Mode->VTotal));
|
||||
|
||||
/* 18/16. Find actual vertical frame frequency */
|
||||
/* ignore - just set the mode flag for interlaced */
|
||||
if (Interlaced)
|
||||
Mode->VTotal *= 2;
|
||||
|
||||
{
|
||||
char Name[256];
|
||||
Name[0] = 0;
|
||||
|
||||
snprintf(Name, 256, "%dx%d", HDisplay, VDisplay);
|
||||
|
||||
Mode->name = xnfalloc(strlen(Name) + 1);
|
||||
memcpy(Mode->name, Name, strlen(Name) + 1);
|
||||
}
|
||||
|
||||
if (Reduced)
|
||||
Mode->Flags |= V_PHSYNC | V_NVSYNC;
|
||||
else
|
||||
Mode->Flags |= V_NHSYNC | V_PVSYNC;
|
||||
|
||||
if (Interlaced)
|
||||
Mode->Flags |= V_INTERLACE;
|
||||
|
||||
return Mode;
|
||||
}
|
|
@ -217,7 +217,8 @@ axpPciInit()
|
|||
* only set up the root bus for each domain (hose) and the bridged
|
||||
* buses will be set up as they are found.
|
||||
*/
|
||||
bus = PCI_MAKE_BUS(domain, 0);
|
||||
/* make a bus with both the domain and the root bus in it */
|
||||
bus = PCI_MAKE_BUS(domain, pDomain->root_bus);
|
||||
pciBusInfo[bus] = xnfalloc(sizeof(pciBusInfo_t));
|
||||
(void)memset(pciBusInfo[bus], 0, sizeof(pciBusInfo_t));
|
||||
|
||||
|
@ -249,7 +250,7 @@ axpPciBusFromTag(PCITAG tag)
|
|||
|| !(pDomain = pBusInfo->pciBusPriv)
|
||||
|| (pDomain->domain != PCI_DOM_FROM_TAG(tag))) return -1;
|
||||
|
||||
bus = PCI_BUS_NO_DOMAIN(bus) + pDomain->root_bus;
|
||||
bus = PCI_BUS_NO_DOMAIN(bus); /* should just be root_bus */
|
||||
dfn = PCI_DFN_FROM_TAG(tag);
|
||||
if (_iobase(IOBASE_HOSE, -1, bus, dfn) != pDomain->hose) return -1;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user