summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/dmx/dmx-config.h2
-rw-r--r--hw/dmx/dmxextension.c1
-rw-r--r--hw/kdrive/ephyr/ephyr_draw.c1
-rw-r--r--hw/kdrive/ephyr/ephyrlog.h4
-rw-r--r--hw/kdrive/src/kinput.c4
-rw-r--r--hw/xfree86/Makefile.am8
-rw-r--r--hw/xfree86/common/compiler.h2
-rw-r--r--hw/xfree86/common/xf86.h1
-rw-r--r--hw/xfree86/common/xf86AutoConfig.c8
-rw-r--r--hw/xfree86/common/xf86Config.c37
-rw-r--r--hw/xfree86/common/xf86Privstr.h3
-rw-r--r--hw/xfree86/common/xf86Xinput.c12
-rw-r--r--hw/xfree86/dixmods/Makefile.am13
-rw-r--r--hw/xfree86/dixmods/cfb32module.c57
-rw-r--r--hw/xfree86/dixmods/cfbmodule.c57
-rw-r--r--hw/xfree86/dixmods/extmod/Makefile.am1
-rw-r--r--hw/xfree86/dixmods/extmod/modinit.c27
-rw-r--r--hw/xfree86/dixmods/extmod/modinit.h26
-rw-r--r--hw/xfree86/doc/man/xorg.conf.man.pre8
-rw-r--r--hw/xfree86/loader/dixsym.c12
-rw-r--r--hw/xfree86/loader/loader.c2
-rw-r--r--hw/xfree86/modes/xf86EdidModes.c6
-rw-r--r--hw/xfree86/os-support/bsd/Makefile.am1
-rw-r--r--hw/xfree86/os-support/bsd/bsdResource.c2
-rw-r--r--hw/xfree86/os-support/bsd/bsd_jstk.c183
-rw-r--r--hw/xfree86/os-support/bsd/i386_video.c8
-rw-r--r--hw/xfree86/os-support/bus/Pci.h2
-rw-r--r--hw/xfree86/os-support/linux/Makefile.am1
-rw-r--r--hw/xfree86/os-support/linux/lnx_jstk.c180
-rw-r--r--hw/xfree86/utils/xorgcfg/loadmod.c4
-rw-r--r--hw/xfree86/x86emu/prim_ops.c2
-rw-r--r--hw/xfree86/x86emu/x86emu/prim_x86_gcc.h2
-rw-r--r--hw/xfree86/x86emu/x86emu/types.h2
-rw-r--r--hw/xfree86/xf8_32bpp/Makefile.am37
-rw-r--r--hw/xfree86/xf8_32bpp/cfb8_32.h191
-rw-r--r--hw/xfree86/xf8_32bpp/cfb8_32module.c39
-rw-r--r--hw/xfree86/xf8_32bpp/cfbcpyarea.c549
-rw-r--r--hw/xfree86/xf8_32bpp/cfbcpyplane.c41
-rw-r--r--hw/xfree86/xf8_32bpp/cfbgc.c646
-rw-r--r--hw/xfree86/xf8_32bpp/cfbgcmisc.c150
-rw-r--r--hw/xfree86/xf8_32bpp/cfbgcunder.c620
-rw-r--r--hw/xfree86/xf8_32bpp/cfbimage.c174
-rw-r--r--hw/xfree86/xf8_32bpp/cfbpntwin.c51
-rw-r--r--hw/xfree86/xf8_32bpp/cfbscrinit.c311
-rw-r--r--hw/xfree86/xf8_32bpp/cfbwindow.c116
-rw-r--r--hw/xfree86/xf8_32bpp/xf86overlay.c1179
-rw-r--r--hw/xgl/egl/kinput.c4
-rw-r--r--hw/xnest/Args.c5
-rw-r--r--hw/xprint/Makefile.am3
-rw-r--r--hw/xprint/ps/psout.h2
-rw-r--r--hw/xquartz/Makefile.am8
-rw-r--r--hw/xquartz/X11Application.h3
-rw-r--r--hw/xquartz/X11Application.m43
-rw-r--r--hw/xquartz/X11Controller.h8
-rw-r--r--hw/xquartz/X11Controller.m70
-rw-r--r--hw/xquartz/applewm.c2
-rw-r--r--hw/xquartz/darwin.c40
-rw-r--r--hw/xquartz/darwin.h4
-rw-r--r--hw/xquartz/darwinEvents.c416
-rw-r--r--hw/xquartz/darwinEvents.h6
-rw-r--r--hw/xquartz/darwinKeyboard.c1019
-rw-r--r--hw/xquartz/quartz.c4
-rw-r--r--hw/xquartz/quartz.h5
-rw-r--r--hw/xquartz/quartzAudio.c2
-rw-r--r--hw/xquartz/quartzCocoa.m6
-rw-r--r--hw/xquartz/quartzCommon.h11
-rw-r--r--hw/xquartz/quartzKeyboard.c1010
-rw-r--r--hw/xquartz/quartzKeyboard.h13
-rw-r--r--hw/xquartz/quartzStartup.c8
-rw-r--r--hw/xquartz/sanitizedCarbon.h32
-rw-r--r--hw/xquartz/sanitizedCocoa.h27
-rw-r--r--hw/xquartz/threadSafety.c60
-rw-r--r--hw/xquartz/threadSafety.h (renamed from hw/xquartz/darwinKeyboard.h)42
-rw-r--r--hw/xquartz/xpr/Makefile.am7
-rw-r--r--hw/xquartz/xpr/dri.h2
-rw-r--r--hw/xquartz/xpr/xpr.h3
-rw-r--r--hw/xquartz/xpr/xprAppleWM.c2
-rw-r--r--hw/xquartz/xpr/xprCursor.c4
-rw-r--r--hw/xquartz/xpr/xprEvent.c91
-rw-r--r--hw/xquartz/xpr/xprEvent.h34
-rw-r--r--hw/xquartz/xpr/xprFrame.c2
-rw-r--r--hw/xquartz/xpr/xprScreen.c14
82 files changed, 1684 insertions, 6111 deletions
diff --git a/hw/dmx/dmx-config.h b/hw/dmx/dmx-config.h
index 343fdabf5..4a2dfe060 100644
--- a/hw/dmx/dmx-config.h
+++ b/hw/dmx/dmx-config.h
@@ -83,8 +83,6 @@
#undef XF86MISC
#undef XFreeXDGA
#undef XF86DRI
-#undef TOGCUP
-#undef MITMISC
#undef SCREENSAVER
#undef RANDR
#undef XFIXES
diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c
index 560468c4b..aaa50d5c4 100644
--- a/hw/dmx/dmxextension.c
+++ b/hw/dmx/dmxextension.c
@@ -1350,7 +1350,6 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
* RTContext
* TagResType
* StalledResType
- * RT_APPGROUP
* SecurityAuthorizationResType
* RTEventClient
* __glXContextRes
diff --git a/hw/kdrive/ephyr/ephyr_draw.c b/hw/kdrive/ephyr/ephyr_draw.c
index 422b7c6b6..7b579c24b 100644
--- a/hw/kdrive/ephyr/ephyr_draw.c
+++ b/hw/kdrive/ephyr/ephyr_draw.c
@@ -28,7 +28,6 @@
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
-#undef NDEBUG /* No, really. The whole point of this module is to crash. */
#include "ephyr.h"
#include "exa_priv.h"
diff --git a/hw/kdrive/ephyr/ephyrlog.h b/hw/kdrive/ephyr/ephyrlog.h
index 71f797777..a07a0a097 100644
--- a/hw/kdrive/ephyr/ephyrlog.h
+++ b/hw/kdrive/ephyr/ephyrlog.h
@@ -31,11 +31,11 @@
#include <assert.h>
#include "os.h"
-#ifdef NDEBUG
+#ifndef DEBUG
/*we are not in debug mode*/
#define EPHYR_LOG(...)
#define EPHYR_LOG_ERROR(...)
-#endif /*NDEBUG*/
+#endif /*!DEBUG*/
#define ERROR_LOG_LEVEL 3
#define INFO_LOG_LEVEL 4
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 62a82618a..c6724e487 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1739,7 +1739,7 @@ KdClassifyInput (KdPointerInfo *pi, int type, int x, int y, int z, int b)
return keyboard;
}
-#ifndef NDEBUG
+#ifdef DEBUG
char *kdStateNames[] = {
"start",
"button_1_pend",
@@ -1772,7 +1772,7 @@ char *kdActionNames[] = {
"gen_down_2",
"gen_up_2",
};
-#endif
+#endif /* DEBUG */
static void
KdQueueEvent (DeviceIntPtr pDev, xEvent *ev)
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 03c2c3a3f..e6cc38a7c 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -16,20 +16,16 @@ if MFB
MFB_SUBDIR = xf1bpp xf4bpp
endif
-if CFB
-CFB_SUBDIR = xf8_32bpp
-endif
-
DOC_SUBDIR = doc
SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
- ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) $(CFB_SUBDIR) \
+ ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) \
xf8_16bpp loader dixmods exa modes \
$(DRI_SUBDIR) $(DRI2_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 dixmods dri dri2 exa modes \
+ xf8_16bpp loader dixmods dri dri2 exa modes \
utils doc
bin_PROGRAMS = Xorg
diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 73ca3d0ac..7b65da844 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -498,7 +498,7 @@ extern unsigned int inb(unsigned long port);
extern unsigned int inw(unsigned long port);
extern unsigned int inl(unsigned long port);
-# elif defined(linux) && defined(__amd64__)
+# elif defined(linux) && (defined(__amd64__) || defined(__x86_64__))
# include <inttypes.h>
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 4b3e10463..065102fb5 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -71,6 +71,7 @@ extern Bool sbusSlotClaimed;
#endif
extern confDRIRec xf86ConfigDRI;
extern Bool xf86inSuspend;
+extern Bool xf86DRI2Enabled(void);
#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \
xf86ScreenKey))
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 3210e4460..5ffd84702 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -146,7 +146,11 @@ videoPtrToDriverName(struct pci_device *dev)
switch (dev->vendor_id)
{
- case 0x1022: return "amd";
+ case 0x1022:
+ if (dev->device_id == 0x2081)
+ return "geode";
+ else
+ return NULL;
case 0x1142: return "apm";
case 0xedd8: return "ark";
case 0x1a03: return "ast";
@@ -449,7 +453,7 @@ chooseVideoDriver(void)
if (info != NULL)
chosen_driver = videoPtrToDriverName(info);
if (chosen_driver == NULL) {
-#if defined __i386__ || defined __amd64__ || defined __hurd__
+#if defined __i386__ || defined __amd64__ || defined __x86_64__ || defined __hurd__
chosen_driver = "vesa";
#elif defined __sparc__
chosen_driver = "sunffb";
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 9dcaa1930..b6e1186a6 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -766,6 +766,7 @@ typedef enum {
FLAG_AUTO_ADD_DEVICES,
FLAG_AUTO_ENABLE_DEVICES,
FLAG_GLX_VISUALS,
+ FLAG_DRI2,
} FlagValues;
static OptionInfoRec FlagOptions[] = {
@@ -837,16 +838,18 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_ALLOW_EMPTY_INPUT, "AllowEmptyInput", OPTV_BOOLEAN,
{0}, FALSE },
- { FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
+ { FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
{0}, FALSE },
- { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
+ { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
{0}, FALSE },
- { FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN,
+ { FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN,
{0}, TRUE },
- { FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN,
+ { FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN,
{0}, TRUE },
{ FLAG_GLX_VISUALS, "GlxVisuals", OPTV_STRING,
{0}, FALSE },
+ { FLAG_DRI2, "DRI2", OPTV_BOOLEAN,
+ {0}, FALSE },
{ -1, NULL, OPTV_NONE,
{0}, FALSE },
};
@@ -1179,9 +1182,23 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Msg(from, "Xinerama: enabled\n");
#endif
+#ifdef DRI2
+ xf86Info.dri2 = FALSE;
+ xf86Info.dri2From = X_DEFAULT;
+ if (xf86GetOptValBool(FlagOptions, FLAG_DRI2, &value)) {
+ xf86Info.dri2 = value;
+ xf86Info.dri2From = X_CONFIG;
+ }
+#endif
+
return TRUE;
}
+Bool xf86DRI2Enabled(void)
+{
+ return xf86Info.dri2;
+}
+
/*
* Locate the core input devices. These can be specified/located in
* the following ways, in order of priority:
@@ -1338,8 +1355,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
/* 5. Built-in default. */
if (!foundPointer) {
bzero(&defPtr, sizeof(defPtr));
- defPtr.inp_identifier = "<default pointer>";
- defPtr.inp_driver = "mouse";
+ defPtr.inp_identifier = strdup("<default pointer>");
+ defPtr.inp_driver = strdup("mouse");
confInput = &defPtr;
foundPointer = TRUE;
from = X_DEFAULT;
@@ -1385,8 +1402,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (!found) {
xf86Msg(X_INFO, "No default mouse found, adding one\n");
bzero(&defPtr, sizeof(defPtr));
- defPtr.inp_identifier = "<default pointer>";
- defPtr.inp_driver = "mouse";
+ defPtr.inp_identifier = strdup("<default pointer>");
+ defPtr.inp_driver = strdup("mouse");
confInput = &defPtr;
foundPointer = configInput(&Pointer, confInput, from);
if (foundPointer) {
@@ -1474,8 +1491,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
/* 5. Built-in default. */
if (!foundKeyboard) {
bzero(&defKbd, sizeof(defKbd));
- defKbd.inp_identifier = "<default keyboard>";
- defKbd.inp_driver = "kbd";
+ defKbd.inp_identifier = strdup("<default keyboard>");
+ defKbd.inp_driver = strdup("kbd");
confInput = &defKbd;
foundKeyboard = TRUE;
keyboardMsg = "default keyboard configuration";
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index d97ca440e..8cab56ec8 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -149,6 +149,9 @@ typedef struct {
Bool autoAddDevices; /* Whether to succeed NIDR, or ignore. */
Bool autoEnableDevices; /* Whether to enable, or let the client
* control. */
+
+ Bool dri2;
+ MessageType dri2From;
} xf86InfoRec, *xf86InfoPtr;
#ifdef DPMSExtension
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index c2dd6004b..30e0e6bd7 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -480,11 +480,19 @@ void
DeleteInputDeviceRequest(DeviceIntPtr pDev)
{
LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate;
- InputDriverPtr drv = pInfo->drv;
- IDevRec *idev = pInfo->conf_idev;
+ InputDriverPtr drv;
+ IDevRec *idev;
+ if (pInfo) /* need to get these before RemoveDevice */
+ {
+ drv = pInfo->drv;
+ idev = pInfo->conf_idev;
+ }
RemoveDevice(pDev);
+ if (!pInfo) /* VCP and VCK */
+ return;
+
if(drv->UnInit)
drv->UnInit(drv, pInfo, 0);
else
diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am
index dad2dd36b..67967c52d 100644
--- a/hw/xfree86/dixmods/Makefile.am
+++ b/hw/xfree86/dixmods/Makefile.am
@@ -18,10 +18,6 @@ if AFB
AFBMOD = libafb.la
endif
-if CFB
-CFBMOD = libcfb.la libcfb32.la
-endif
-
if MFB
MFBMOD = libmfb.la
endif
@@ -31,7 +27,6 @@ RECORDMOD = librecord.la
endif
module_LTLIBRARIES = $(AFBMOD) \
- $(CFBMOD) \
libfb.la \
libwfb.la \
$(MFBMOD) \
@@ -61,14 +56,6 @@ libafb_la_LDFLAGS = -avoid-version
libafb_la_LIBADD = $(top_builddir)/afb/libafb.la
libafb_la_SOURCES = afbmodule.c
-libcfb_la_LDFLAGS = -avoid-version
-libcfb_la_LIBADD = $(top_builddir)/cfb/libcfb.la
-libcfb_la_SOURCES = cfbmodule.c
-
-libcfb32_la_LDFLAGS = -avoid-version
-libcfb32_la_LIBADD = $(top_builddir)/cfb32/libcfb32.la
-libcfb32_la_SOURCES = cfb32module.c
-
libdbe_la_LDFLAGS = -avoid-version
libdbe_la_LIBADD = $(top_builddir)/dbe/libdbe.la
libdbe_la_SOURCES = dbemodule.c
diff --git a/hw/xfree86/dixmods/cfb32module.c b/hw/xfree86/dixmods/cfb32module.c
deleted file mode 100644
index 23708e4c2..000000000
--- a/hw/xfree86/dixmods/cfb32module.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 1998 The XFree86 Project, 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
- * XFREE86 PROJECT 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 XFree86 Project 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
- * XFree86 Project.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static MODULESETUPPROTO(cfb32Setup);
-
-static XF86ModuleVersionInfo VersRec =
-{
- "cfb32",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_ANSIC, /* Only need the ansic layer */
- ABI_ANSIC_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0} /* signature, to be patched into the file by a tool */
-};
-
-_X_EXPORT XF86ModuleData cfb32ModuleData = { &VersRec, cfb32Setup, NULL };
-
-static pointer
-cfb32Setup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- /* This modules requires cfb, so load it */
- return LoadSubModule(module, "cfb", NULL, NULL, NULL, NULL,
- errmaj, errmin);
-}
diff --git a/hw/xfree86/dixmods/cfbmodule.c b/hw/xfree86/dixmods/cfbmodule.c
deleted file mode 100644
index 07074c158..000000000
--- a/hw/xfree86/dixmods/cfbmodule.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 1998 The XFree86 Project, 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
- * XFREE86 PROJECT 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 XFree86 Project 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
- * XFree86 Project.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static MODULESETUPPROTO(cfbSetup);
-
-static XF86ModuleVersionInfo VersRec =
-{
- "cfb",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_ANSIC, /* Only need the ansic layer */
- ABI_ANSIC_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0} /* signature, to be patched into the file by a tool */
-};
-
-_X_EXPORT XF86ModuleData cfbModuleData = { &VersRec, cfbSetup, NULL };
-
-static pointer
-cfbSetup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- /* This modules requires mfb, so load it */
- return LoadSubModule(module, "mfb", NULL, NULL, NULL, NULL,
- errmaj, errmin);
-}
diff --git a/hw/xfree86/dixmods/extmod/Makefile.am b/hw/xfree86/dixmods/extmod/Makefile.am
index f90e144ea..77af62da4 100644
--- a/hw/xfree86/dixmods/extmod/Makefile.am
+++ b/hw/xfree86/dixmods/extmod/Makefile.am
@@ -23,7 +23,6 @@ AM_CFLAGS = @DIX_CFLAGS@ @XORG_CFLAGS@
INCLUDES = @XORG_INCS@ \
-I$(top_srcdir)/afb \
-I$(top_srcdir)/mfb \
- -I$(top_srcdir)/cfb \
-I$(top_srcdir)/dbe \
-I$(top_srcdir)/hw/xfree86/loader \
-I$(top_srcdir)/miext/shadow
diff --git a/hw/xfree86/dixmods/extmod/modinit.c b/hw/xfree86/dixmods/extmod/modinit.c
index 8c8a4ceeb..f8440f127 100644
--- a/hw/xfree86/dixmods/extmod/modinit.c
+++ b/hw/xfree86/dixmods/extmod/modinit.c
@@ -65,15 +65,6 @@ static ExtensionModule extensionModules[] = {
NULL
},
#endif
-#ifdef MITMISC
- {
- MITMiscExtensionInit,
- MITMISCNAME,
- &noMITMiscExtension,
- NULL,
- NULL
- },
-#endif
#ifdef notyet
{
XTestExtensionInit,
@@ -164,24 +155,6 @@ static ExtensionModule extensionModules[] = {
NULL
},
#endif
-#ifdef TOGCUP
- {
- XcupExtensionInit,
- XCUPNAME,
- &noXcupExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef EVI
- {
- EVIExtensionInit,
- EVINAME,
- &noEVIExtension,
- NULL,
- NULL
- },
-#endif
#ifdef XV
{
XvExtensionInit,
diff --git a/hw/xfree86/dixmods/extmod/modinit.h b/hw/xfree86/dixmods/extmod/modinit.h
index 3c2e2022a..7282e6e06 100644
--- a/hw/xfree86/dixmods/extmod/modinit.h
+++ b/hw/xfree86/dixmods/extmod/modinit.h
@@ -18,12 +18,6 @@ extern void MultibufferExtensionInit(INITARGS);
#include <X11/extensions/multibufst.h>
#endif
-#ifdef MITMISC
-extern void MITMiscExtensionInit(INITARGS);
-#define _MITMISC_SERVER_
-#include <X11/extensions/mitmiscstr.h>
-#endif
-
#ifdef XTEST
extern void XTestExtensionInit(INITARGS);
#define _XTEST_SERVER_
@@ -89,18 +83,6 @@ extern void FontCacheExtensionInit(INITARGS);
#include "fontcachstr.h"
#endif
-#ifdef TOGCUP
-extern void XcupExtensionInit(INITARGS);
-#define _XCUP_SERVER_
-#include <X11/extensions/Xcupstr.h>
-#endif
-
-#ifdef EVI
-extern void EVIExtensionInit(INITARGS);
-#define _XEVI_SERVER_
-#include <X11/extensions/XEVIstr.h>
-#endif
-
#ifdef XV
extern void XvExtensionInit(INITARGS);
extern void XvMCExtensionInit(INITARGS);
@@ -135,14 +117,6 @@ extern void SecurityExtensionInit(INITARGS);
#endif
#if 1
-extern void XagExtensionInit(INITARGS);
-#endif
-
-#if 1
-extern void XpExtensionInit(INITARGS);
-#endif
-
-#if 1
extern void PanoramiXExtensionInit(int argc, char *argv[]);
#endif
diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index 9f3980879..8b66f89a6 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -54,7 +54,7 @@ is the relative path (with no \(lq..\(rq components) specified by that
environment variable, and
.I <hostname>
is the machine's hostname as reported by
-.BR gethostname (__oslibmansuffix__).
+.BR gethostname (__libmansuffix__).
.PP
When the __xservername__ server is started by the \(lqroot\(rq user, the config file
search locations are as follows:
@@ -93,7 +93,7 @@ is the path specified by that environment variable (usually the home
directory), and
.I <hostname>
is the machine's hostname as reported by
-.BR gethostname (__oslibmansuffix__).
+.BR gethostname (__libmansuffix__).
.PP
The
.I __xconfigfile__
@@ -1624,8 +1624,8 @@ Others are driver\-independent, and will eventually be described here.
.\" XXX These should really be in an xaa man page.
.TP 7
.BI "Option \*qAccel\*q"
-Enables XAA (X Acceleration Architecture), a mechanism that makes video
-cards' 2D hardware acceleration available to the __xservername__ server.
+Enables XAA (X Acceleration Architecture), a mechanism that makes video cards'
+2D hardware acceleration available to the __xservername__ server.
This option is on by default, but it may be necessary to turn it off if
there are bugs in the driver.
There are many options to disable specific accelerated operations, listed
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index d6d22c4b9..61dec59c4 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -358,9 +358,6 @@ _X_HIDDEN void *dixLookupTab[] = {
#ifdef DPMSExtension
SYMVAR(noDPMSExtension)
#endif
-#ifdef EVI
- SYMVAR(noEVIExtension)
-#endif
#ifdef FONTCACHE
SYMVAR(noFontCacheExtension)
#endif
@@ -373,9 +370,6 @@ _X_HIDDEN void *dixLookupTab[] = {
#ifdef MITSHM
SYMVAR(noMITShmExtension)
#endif
-#ifdef MITMISC
- SYMVAR(noMITMiscExtension)
-#endif
#ifdef MULTIBUFFER
SYMVAR(noMultibufferExtension)
#endif
@@ -394,15 +388,9 @@ _X_HIDDEN void *dixLookupTab[] = {
#ifdef XSYNC
SYMVAR(noSyncExtension)
#endif
-#ifdef TOGCUP
- SYMVAR(noXcupExtension)
-#endif
#ifdef RES
SYMVAR(noResExtension)
#endif
-#ifdef XAPPGROUP
- SYMVAR(noXagExtension)
-#endif
#ifdef XCMISC
SYMVAR(noXCMiscExtension)
#endif
diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c
index 774a4c4a0..a00269b70 100644
--- a/hw/xfree86/loader/loader.c
+++ b/hw/xfree86/loader/loader.c
@@ -63,7 +63,7 @@
#include <string.h>
#if defined(linux) && \
(defined(__alpha__) || defined(__powerpc__) || defined(__ia64__) \
- || defined(__amd64__))
+ || defined(__amd64__) || defined(__x86_64__))
#include <malloc.h>
#endif
#include <stdarg.h>
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 8f7d45dd6..09d00393e 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -93,6 +93,12 @@ static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
DDC->vendor.prod_id == 638)
return TRUE;
+ /* Acer F51 */
+ if (memcmp (DDC->vendor.name, "API", 4) == 0 &&
+ DDC->vendor.prod_id == 0x7602)
+ return TRUE;
+
+
return FALSE;
}
diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am
index 4fc270aa9..678903056 100644
--- a/hw/xfree86/os-support/bsd/Makefile.am
+++ b/hw/xfree86/os-support/bsd/Makefile.am
@@ -72,7 +72,6 @@ libbsd_la_SOURCES = \
# FIXME: Add these files to the build as needed
EXTRA_DIST = \
bsd_apm.c \
- bsd_jstk.c \
bsd_kqueue_apm.c \
bsdResource.c \
memrange.h \
diff --git a/hw/xfree86/os-support/bsd/bsdResource.c b/hw/xfree86/os-support/bsd/bsdResource.c
index fe166c845..d1ee787f1 100644
--- a/hw/xfree86/os-support/bsd/bsdResource.c
+++ b/hw/xfree86/os-support/bsd/bsdResource.c
@@ -19,7 +19,7 @@
#ifdef INCLUDE_XF86_NO_DOMAIN
-#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
+#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) || defined(__x86_64__)
resPtr
xf86AccResFromOS(resPtr ret)
diff --git a/hw/xfree86/os-support/bsd/bsd_jstk.c b/hw/xfree86/os-support/bsd/bsd_jstk.c
deleted file mode 100644
index b5b91b0c7..000000000
--- a/hw/xfree86/os-support/bsd/bsd_jstk.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 1995 by Frederic Lepied, France. <fred@sugix.frmug.fr.net>
- *
- * 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 Frederic Lepied not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Frederic Lepied makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL FREDERIC LEPIED 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.
- *
- */
-
-/* Modified for FreeBSD by David Dawes <dawes@XFree86.org> */
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <machine/joystick.h>
-#include <fcntl.h>
-
-#include "misc.h"
-#include "xf86.h"
-
-#define JS_RETURN sizeof(struct joystick)
-
-/***********************************************************************
- *
- * xf86JoystickOn --
- *
- * open the device and init timeout according to the device value.
- *
- ***********************************************************************
- */
-
-int
-xf86JoystickOn(char * name, int *timeout, int *centerX, int *centerY)
-{
- int status;
- int changed = 0;
- int timeinmicros;
- struct joystick js;
-
-#ifdef DEBUG
- ErrorF("xf86JoystickOn: %s\n", name);
-#endif
-
- if ((status = open(name, O_RDWR | O_NDELAY, 0)) < 0)
- {
- xf86Msg(X_WARNING, "xf86JoystickOn: Cannot open joystick '%s' (%s)\n",
- name, strerror(errno));
- return -1;
- }
-
- if (*timeout <= 0) {
- /* Use the current setting */
- ioctl(status, JOY_GETTIMEOUT, (char *)&timeinmicros);
- *timeout = timeinmicros / 1000;
- if (*timeout == 0)
- *timeout = 1;
- changed = 1;
- }
- /* Maximum allowed timeout in the FreeBSD driver is 10ms */
- if (*timeout > 10) {
- *timeout = 10;
- changed = 1;
- }
-
- if (changed)
- xf86Msg(X_PROBED, "Joystick: timeout value = %d\n", *timeout);
-
- timeinmicros = *timeout * 1000;
-
- /* Assume the joystick is centred when this is called */
- read(status, &js, JS_RETURN);
- if (*centerX < 0) {
- *centerX = js.x;
- xf86Msg(X_PROBED, "Joystick: CenterX set to %d\n", *centerX);
- }
- if (*centerY < 0) {
- *centerY = js.y;
- xf86Msg(X_PROBED, "Joystick: CenterY set to %d\n", *centerY);
- }
-
- return status;
-}
-
-/***********************************************************************
- *
- * xf86JoystickInit --
- *
- * called when X device is initialized.
- *
- ***********************************************************************
- */
-
-void
-xf86JoystickInit()
-{
- return;
-}
-
-/***********************************************************************
- *
- * xf86JoystickOff --
- *
- * close the handle.
- *
- ***********************************************************************
- */
-
-int
-xf86JoystickOff(int *fd, int doclose)
-{
- int oldfd;
-
- if (((oldfd = *fd) >= 0) && doclose) {
- close(*fd);
- *fd = -1;
- }
- return oldfd;
-}
-
-/***********************************************************************
- *
- * xf86JoystickGetState --
- *
- * return the state of buttons and the position of the joystick.
- *
- ***********************************************************************
- */
-
-int
-xf86JoystickGetState(int fd, int *x, int *y, int *buttons)
-{
- struct joystick js;
- int status;
-
- status = read(fd, &js, JS_RETURN);
-
- if (status != JS_RETURN)
- {
- Error("Joystick read");
- return 0;
- }
-
- *x = js.x;
- *y = js.y;
- *buttons = js.b1 | (js.b2 << 1);
-#ifdef DEBUG
- ErrorF("xf86JoystickGetState: x = %d, y = %d, buttons = %d\n", *x, *y,
- *buttons);
-#endif
-
- return 1;
-}
-
-/*
- * Entry point for XFree86 Loader
- */
-void
-bsd_jstkModuleInit(pointer *data, INT32 *magic)
-{
- *magic = MAGIC_DONE;
- *data = NULL;
-}
-/* end of bsd_jstk.c */
diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index 1ebac678d..e2f6420d8 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -55,7 +55,7 @@
#endif
#endif
-#if defined(__OpenBSD__) && defined(__amd64__)
+#if defined(__OpenBSD__) && (defined(__amd64__) || defined(__x86_64__))
#include <machine/mtrr.h>
#include <machine/sysarch.h>
#endif
@@ -108,7 +108,7 @@ static pointer NetBSDsetWC(int, unsigned long, unsigned long, Bool,
MessageType);
static void NetBSDundoWC(int, pointer);
#endif
-#if defined(__amd64__) && defined(__OpenBSD__)
+#if (defined(__amd64__) || defined(__x86_64__)) && defined(__OpenBSD__)
static pointer amd64setWC(int, unsigned long, unsigned long, Bool,
MessageType);
static void amd64undoWC(int, pointer);
@@ -229,7 +229,7 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
pVidMem->setWC = NetBSDsetWC;
pVidMem->undoWC = NetBSDundoWC;
#endif
-#if defined(__amd64__) && defined(__OpenBSD__)
+#if (defined(__amd64__) || defined(__x86_64__)) && defined(__OpenBSD__)
pVidMem->setWC = amd64setWC;
pVidMem->undoWC = amd64undoWC;
#endif
@@ -953,7 +953,7 @@ NetBSDundoWC(int screenNum, pointer list)
}
#endif
-#if defined(__OpenBSD__) && defined(__amd64__)
+#if defined(__OpenBSD__) && (defined(__amd64__) || defined(__x86_64__))
static pointer
amd64setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
MessageType from)
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index ebac0905b..b78d30720 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -246,7 +246,7 @@
# if !defined(__FreeBSD__) && !defined(linux)
# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
# endif
-#elif defined(__amd64__) || defined(__amd64)
+#elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# else
diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index beaae3d5b..93f09c10c 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -45,7 +45,6 @@ INCLUDES = $(XORG_INCS) $(PLATFORM_INCLUDES) -I/usr/include/drm # FIXME this las
# FIXME: These need to be added to the build
LNX_EXTRA_SRCS = \
lnx_font.c \
- lnx_jstk.c \
lnxResource.c
EXTRA_DIST = \
diff --git a/hw/xfree86/os-support/linux/lnx_jstk.c b/hw/xfree86/os-support/linux/lnx_jstk.c
deleted file mode 100644
index d77631ba4..000000000
--- a/hw/xfree86/os-support/linux/lnx_jstk.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright 1995 by Frederic Lepied, France. <fred@sugix.frmug.fr.net>
- *
- * 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 Frederic Lepied not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Frederic Lepied makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL FREDERIC LEPIED 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.
- *
- */
-
-
-static const char rcs_id[] = "Id: lnx_jstk.c,v 1.1 1995/12/20 14:06:09 lepied Exp";
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#define inline __inline__
-#include <linux/joystick.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-
-#include "xf86.h"
-
-#if !defined(JSIOCGTIMELIMIT)
-/* make 2.1.x joystick.h backward compatable */
-#define JSIOCGTIMELIMIT JS_GET_TIMELIMIT
-#define JSIOCSTIMELIMIT JS_SET_TIMELIMIT
-#define js_status JS_DATA_TYPE
-#endif
-
-
-/***********************************************************************
- *
- * xf86JoystickOn --
- *
- * open the device and init timeout according to the device value.
- *
- ***********************************************************************
- */
-
-int
-xf86JoystickOn(char *name, int *timeout, int *centerX, int *centerY)
-{
- int fd;
- struct js_status js;
-
-#ifdef DEBUG
- ErrorF("xf86JoystickOn %s\n", name);
-#endif
-
- if ((fd = open(name, O_RDWR | O_NDELAY, 0)) < 0)
- {
- xf86Msg(X_WARNING, "Cannot open joystick '%s' (%s)\n", name,
- strerror(errno));
- return -1;
- }
-
- if (*timeout == 0) {
- if (ioctl (fd, JSIOCGTIMELIMIT, timeout) == -1) {
- Error("joystick JSIOCGTIMELIMIT ioctl");
- }
- else {
- xf86Msg(X_CONFIG, "Joystick: timeout value = %d\n", *timeout);
- }
- }
- else {
- if (ioctl(fd, JSIOCSTIMELIMIT, timeout) == -1) {
- Error("joystick JSIOCSTIMELIMIT ioctl");
- }
- }
-
- /* Assume the joystick is centred when this is called */
- read(fd, &js, JS_RETURN);
- if (*centerX < 0) {
- *centerX = js.x;
- xf86Msg(X_CONFIG, "Joystick: CenterX set to %d\n", *centerX);
- }
- if (*centerY < 0) {
- *centerY = js.y;
- xf86Msg(X_CONFIG, "Joystick: CenterY set to %d\n", *centerY);
- }
-
- return fd;
-}
-
-/***********************************************************************
- *
- * xf86JoystickInit --
- *
- * called when X device is initialized.
- *
- ***********************************************************************
- */
-
-void
-xf86JoystickInit()
-{
- return;
-}
-
-/***********************************************************************
- *
- * xf86JoystickOff --
- *
- * close the handle.
- *
- ***********************************************************************
- */
-
-int
-xf86JoystickOff(int *fd, int doclose)
-{
- int oldfd;
-
- if (((oldfd = *fd) >= 0) && doclose) {
- close(*fd);
- *fd = -1;
- }
- return oldfd;
-}
-
-/***********************************************************************
- *
- * xf86JoystickGetState --
- *
- * return the state of buttons and the position of the joystick.
- *
- ***********************************************************************
- */
-
-int
-xf86JoystickGetState(int fd, int *x, int *y, int *buttons)
-{
- struct js_status js;
- int status;
-
- status = read(fd, &js, JS_RETURN);
-
- if (status != JS_RETURN)
- {
- Error("Joystick read");
- return 0;
- }
-
- *x = js.x;
- *y = js.y;
- *buttons = js.buttons;
-
- return 1;
-}
-
-/*
- * Entry point for XFree86 Loader
- */
-void
-linux_jstkModuleInit(pointer *data, INT32 *magic)
-{
- *magic = MAGIC_DONE;
- *data = NULL;
-}
-
-/* end of lnx_jstk.c */
diff --git a/hw/xfree86/utils/xorgcfg/loadmod.c b/hw/xfree86/utils/xorgcfg/loadmod.c
index 1207820ce..629dfe118 100644
--- a/hw/xfree86/utils/xorgcfg/loadmod.c
+++ b/hw/xfree86/utils/xorgcfg/loadmod.c
@@ -179,7 +179,9 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86memchr)
SYMFUNC(xf86memcmp)
SYMFUNC(xf86memcpy)
-#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || defined(__sparc__) || defined(__sparc) || defined(__ia64__) || defined (__amd64__)
+#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || \
+ defined(__sparc__) || defined(__sparc) || defined(__ia64__) || \
+ defined (__amd64__) || defined(__x86_64__)
/*
* Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle
* structure copies. This causes a problem both here and in shared
diff --git a/hw/xfree86/x86emu/prim_ops.c b/hw/xfree86/x86emu/prim_ops.c
index b42cdc0a5..41968e1a7 100644
--- a/hw/xfree86/x86emu/prim_ops.c
+++ b/hw/xfree86/x86emu/prim_ops.c
@@ -103,7 +103,7 @@
#include "x86emu/x86emui.h"
#if defined(__GNUC__)
-# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__)
+# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__x86_64__)
# include "x86emu/prim_x86_gcc.h"
# endif
#endif
diff --git a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
index af61e2023..5a443cdbf 100644
--- a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
+++ b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
@@ -42,7 +42,7 @@
#include "x86emu/types.h"
-#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__))
+#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__x86_64__))
#error This file is intended to be used by gcc on i386 or x86-64 system
#endif
diff --git a/hw/xfree86/x86emu/x86emu/types.h b/hw/xfree86/x86emu/x86emu/types.h
index c0c09c1b0..2d41b0f18 100644
--- a/hw/xfree86/x86emu/x86emu/types.h
+++ b/hw/xfree86/x86emu/x86emu/types.h
@@ -75,7 +75,7 @@
defined(__sparc64__) || \
defined(__s390x__) || \
(defined(__hppa__) && defined(__LP64)) || \
- defined(__amd64__) || defined(amd64) || \
+ defined(__amd64__) || defined(amd64) || defined(__x86_64__) || \
(defined(__sgi) && (_MIPS_SZLONG == 64))
#define NUM32 int
#else
diff --git a/hw/xfree86/xf8_32bpp/Makefile.am b/hw/xfree86/xf8_32bpp/Makefile.am
deleted file mode 100644
index 6f51a628e..000000000
--- a/hw/xfree86/xf8_32bpp/Makefile.am
+++ /dev/null
@@ -1,37 +0,0 @@
-module_LTLIBRARIES = libxf8_32bpp.la
-
-sdk_HEADERS = cfb8_32.h
-
-INCLUDES = $(XORG_INCS) -I$(top_srcdir)/mfb -I$(top_srcdir)/cfb
-
-AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
-
-libxf8_32bpp_la_LDFLAGS = -avoid-version
-
-libxf8_32bpp_la_SOURCES = \
- cfbcpyarea.c \
- cfbcpyplane.c \
- cfbgcmisc.c \
- cfbimage.c \
- cfbpntwin.c \
- cfbscrinit.c \
- cfbwindow.c \
- xf86overlay.c \
- cfb8_32module.c \
- cfbgc8.c \
- cfbgc32.c \
- cfbgcunder.c
-
-libxf8_32bpp_la_LIBADD = $(top_builddir)/cfb32/libcfb32.la
-
-EXTRA_DIST = cfbgc.c
-
-cfbgc8.c: $(srcdir)/cfbgc.c
- echo '#define PSZ 8' > $@
- echo '#include "$(srcdir)/cfbgc.c"' >> $@
-
-cfbgc32.c: $(srcdir)/cfbgc.c
- echo '#define PSZ 32' > $@
- echo '#include "$(srcdir)/cfbgc.c"' >> $@
-
-DISTCLEANFILES = cfbgc8.c cfbgc32.c
diff --git a/hw/xfree86/xf8_32bpp/cfb8_32.h b/hw/xfree86/xf8_32bpp/cfb8_32.h
deleted file mode 100644
index 6e985da20..000000000
--- a/hw/xfree86/xf8_32bpp/cfb8_32.h
+++ /dev/null
@@ -1,191 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef _CFB8_32_H
-#define _CFB8_32_H
-
-#include "gcstruct.h"
-
-typedef struct {
- GCOps *Ops8bpp;
- GCOps *Ops32bpp;
- unsigned long changes;
- Bool OpsAre8bpp;
-} cfb8_32GCRec, *cfb8_32GCPtr;
-
-typedef struct {
- unsigned char key;
- void (*EnableDisableFBAccess)(int scrnIndex, Bool enable);
- pointer visualData;
-} cfb8_32ScreenRec, *cfb8_32ScreenPtr;
-
-
-extern DevPrivateKey cfb8_32GetGCPrivateKey(void);
-extern DevPrivateKey cfb8_32GetScreenPrivateKey(void);
-
-RegionPtr
-cfb8_32CopyArea(
- DrawablePtr pSrcDraw,
- DrawablePtr pDstDraw,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-);
-
-void
-cfbDoBitblt8To32(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long planemask
-);
-
-void
-cfbDoBitblt32To8(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long planemask
-);
-
-
-void
-cfb8_32ValidateGC8(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable
-);
-
-void
-cfb8_32ValidateGC32(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable
-);
-
-void
-cfb32ValidateGC_Underlay(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable
-);
-
-Bool cfb8_32CreateGC(GCPtr pGC);
-
-void
-cfb8_32GetSpans(
- DrawablePtr pDraw,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart
-);
-
-void
-cfb8_32PutImage (
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage
-);
-
-void
-cfb8_32GetImage (
- DrawablePtr pDraw,
- int sx, int sy, int w, int h,
- unsigned int format,
- unsigned long planeMask,
- char *pdstLine
-);
-
-Bool
-cfb8_32ScreenInit (
- ScreenPtr pScreen,
- pointer pbits,
- int xsize, int ysize,
- int dpix, int dpiy,
- int width
-);
-
-void
-cfb8_32FillBoxSolid8 (
- DrawablePtr pDraw,
- int nbox,
- BoxPtr pBox,
- unsigned long color
-);
-
-RegionPtr
-cfb8_32CopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-);
-
-void
-cfbDoBitblt8To8GXcopy(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long pm
-);
-
-void
-cfbDoBitblt24To24GXcopy(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long pm
-);
-
-Bool cfb8_32CreateWindow(WindowPtr pWin);
-Bool cfb8_32DestroyWindow(WindowPtr pWin);
-
-Bool
-cfb8_32PositionWindow(
- WindowPtr pWin,
- int x, int y
-);
-
-void
-cfb8_32CopyWindow(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc
-);
-
-Bool
-cfb8_32ChangeWindowAttributes(
- WindowPtr pWin,
- unsigned long mask
-);
-
-
-#define CFB8_32_GET_GC_PRIVATE(pGC) ((cfb8_32GCPtr) \
- dixLookupPrivate(&(pGC)->devPrivates, cfb8_32GetGCPrivateKey()))
-
-#define CFB8_32_GET_SCREEN_PRIVATE(pScreen) ((cfb8_32ScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, cfb8_32GetScreenPrivateKey()))
-
-Bool xf86Overlay8Plus32Init (ScreenPtr pScreen);
-
-#endif /* _CFB8_32_H */
diff --git a/hw/xfree86/xf8_32bpp/cfb8_32module.c b/hw/xfree86/xf8_32bpp/cfb8_32module.c
deleted file mode 100644
index 5afabe52d..000000000
--- a/hw/xfree86/xf8_32bpp/cfb8_32module.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static MODULESETUPPROTO(xf8_32bppSetup);
-
-static XF86ModuleVersionInfo VersRec =
-{
- "xf8_32bpp",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_ANSIC, /* Only need the ansic layer */
- ABI_ANSIC_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0} /* signature, to be patched into the file by a tool */
-};
-
-_X_EXPORT XF86ModuleData xf8_32bppModuleData = {
- &VersRec,
- xf8_32bppSetup,
- NULL
-};
-
-static pointer
-xf8_32bppSetup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- if (!LoadSubModule(module, "cfb", NULL, NULL, NULL, NULL,
- errmaj, errmin))
- return NULL;
- if (!LoadSubModule(module, "cfb32", NULL, NULL, NULL, NULL,
- errmaj, errmin))
- return NULL;
- return (pointer)1; /* non-NULL required to indicate success */
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbcpyarea.c b/hw/xfree86/xf8_32bpp/cfbcpyarea.c
deleted file mode 100644
index d8f0c6d76..000000000
--- a/hw/xfree86/xf8_32bpp/cfbcpyarea.c
+++ /dev/null
@@ -1,549 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "resource.h"
-#include "colormap.h"
-#include "colormapst.h"
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include "mi.h"
-#include "mistruct.h"
-#include "dix.h"
-#include "mibstore.h"
-
-
-RegionPtr
-cfb8_32CopyArea(
- DrawablePtr pSrcDraw,
- DrawablePtr pDstDraw,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-){
-
- if(pSrcDraw->bitsPerPixel == 32) {
- if(pDstDraw->bitsPerPixel == 32) {
- if((pGC->alu == GXcopy) && (pGC->planemask == 0xff000000)) {
- return cfb32BitBlt (pSrcDraw, pDstDraw,
- pGC, srcx, srcy, width, height, dstx, dsty,
- cfbDoBitblt8To8GXcopy, 0L);
- }
- return(cfb32CopyArea(pSrcDraw, pDstDraw, pGC, srcx, srcy,
- width, height, dstx, dsty));
- } else {
- /* have to translate 32 -> 8 copies */
- return cfb32BitBlt (pSrcDraw, pDstDraw,
- pGC, srcx, srcy, width, height, dstx, dsty,
- cfbDoBitblt32To8, 0L);
- }
- } else {
- if(pDstDraw->bitsPerPixel == 32) {
- /* have to translate 8 -> 32 copies */
- return cfb32BitBlt (pSrcDraw, pDstDraw,
- pGC, srcx, srcy, width, height, dstx, dsty,
- cfbDoBitblt8To32, 0L);
- } else {
- return(cfbCopyArea(pSrcDraw, pDstDraw, pGC, srcx, srcy,
- width, height, dstx, dsty));
- }
- }
-}
-
-
-
-
-void
-cfbDoBitblt8To32(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long pm
-){
- BoxPtr pbox = REGION_RECTS(prgnDst);
- int nbox = REGION_NUM_RECTS(prgnDst);
- unsigned char *ptr8, *ptr32;
- unsigned char *data8, *data32;
- int pitch8, pitch32;
- int height, width, i;
-
- cfbGetByteWidthAndPointer(pSrc, pitch8, ptr8);
- cfbGetByteWidthAndPointer(pDst, pitch32, ptr32);
- ptr32 += 3; /* point to the top byte */
-
- pm >>= 24;
-
- if((pm == 0xff) && (rop == GXcopy)) {
- for(;nbox; pbox++, pptSrc++, nbox--) {
- data8 = ptr8 + (pptSrc->y * pitch8) + pptSrc->x;
- data32 = ptr32 + (pbox->y1 * pitch32) + (pbox->x1 << 2);
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- while(height--) {
- for(i = 0; i < width; i++)
- data32[i << 2] = data8[i];
- data8 += pitch8;
- data32 += pitch32;
- }
- }
- } else { /* it ain't pretty, but hey */
- for(;nbox; pbox++, pptSrc++, nbox--) {
- data8 = ptr8 + (pptSrc->y * pitch8) + pptSrc->x;
- data32 = ptr32 + (pbox->y1 * pitch32) + (pbox->x1 << 2);
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- while(height--) {
- switch(rop) {
- case GXcopy:
- for(i = 0; i < width; i++)
- data32[i<<2] = (data8[i] & pm) | (data32[i<<2] & ~pm);
- break;
- case GXor:
- for(i = 0; i < width; i++)
- data32[i<<2] |= data8[i] & pm;
- break;
- case GXclear:
- for(i = 0; i < width; i++)
- data32[i<<2] &= ~pm;
- break;
- case GXand:
- for(i = 0; i < width; i++)
- data32[i<<2] &= data8[i] | ~pm;
- break;
- case GXandReverse:
- for(i = 0; i < width; i++)
- data32[i<<2] = ~data32[i<<2] & (data8[i] | ~pm);
- break;
- case GXandInverted:
- for(i = 0; i < width; i++)
- data32[i<<2] &= ~data8[i] | ~pm;
- break;
- case GXnoop:
- return;
- case GXxor:
- for(i = 0; i < width; i++)
- data32[i<<2] ^= data8[i] & pm;
- break;
- case GXnor:
- for(i = 0; i < width; i++)
- data32[i<<2] = ~(data32[i<<2] | (data8[i] & pm));
- break;
- case GXequiv:
- for(i = 0; i < width; i++)
- data32[i<<2] = ~(data32[i<<2] ^ (data8[i] & pm));
- break;
- case GXinvert:
- for(i = 0; i < width; i++)
- data32[i<<2] ^= pm;
- break;
- case GXorReverse:
- for(i = 0; i < width; i++)
- data32[i<<2] = ~data32[i<<2] | (data8[i] & pm);
- break;
- case GXcopyInverted:
- for(i = 0; i < width; i++)
- data32[i<<2] = (~data8[i] & pm) | (data32[i<<2] & ~pm);
- break;
- case GXorInverted:
- for(i = 0; i < width; i++)
- data32[i<<2] |= ~data8[i] & pm;
- break;
- case GXnand:
- for(i = 0; i < width; i++)
- data32[i<<2] = ~(data32[i<<2] & (data8[i] | ~pm));
- break;
- case GXset:
- for(i = 0; i < width; i++)
- data32[i<<2] |= pm;
- break;
- }
- data8 += pitch8;
- data32 += pitch32;
- }
- }
- }
-}
-
-
-void
-cfbDoBitblt32To8(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long pm
-){
- BoxPtr pbox = REGION_RECTS(prgnDst);
- int nbox = REGION_NUM_RECTS(prgnDst);
- unsigned char *ptr8, *ptr32;
- unsigned char *data8, *data32;
- int pitch8, pitch32;
- int height, width, i;
-
- cfbGetByteWidthAndPointer(pDst, pitch8, ptr8);
- cfbGetByteWidthAndPointer(pSrc, pitch32, ptr32);
- ptr32 += 3; /* point to the top byte */
-
- if(((pm & 0xff) == 0xff) && (rop == GXcopy)) {
- for(;nbox; pbox++, pptSrc++, nbox--) {
- data8 = ptr8 + (pbox->y1 * pitch8) + pbox->x1;
- data32 = ptr32 + (pptSrc->y * pitch32) + (pptSrc->x << 2);
-
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- while(height--) {
- for(i = 0; i < width; i++)
- data8[i] = data32[i << 2];
- data8 += pitch8;
- data32 += pitch32;
- }
- }
- } else {
- for(;nbox; pbox++, pptSrc++, nbox--) {
- data8 = ptr8 + (pbox->y1 * pitch8) + pbox->x1;
- data32 = ptr32 + (pptSrc->y * pitch32) + (pptSrc->x << 2);
-
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- while(height--) {
- switch(rop) {
- case GXcopy:
- for(i = 0; i < width; i++)
- data8[i] = (data32[i<<2] & pm) | (data8[i] & ~pm);
- break;
- case GXor:
- for(i = 0; i < width; i++)
- data8[i] |= data32[i<<2] & pm;
- break;
- case GXclear:
- for(i = 0; i < width; i++)
- data8[i] &= ~pm;
- break;
- case GXand:
- for(i = 0; i < width; i++)
- data8[i] &= data32[i<<2] | ~pm;
- break;
- case GXandReverse:
- for(i = 0; i < width; i++)
- data8[i] = ~data8[i] & (data32[i<<2] | ~pm);
- break;
- case GXandInverted:
- for(i = 0; i < width; i++)
- data8[i] &= ~data32[i<<2] | ~pm;
- break;
- case GXnoop:
- return;
- case GXxor:
- for(i = 0; i < width; i++)
- data8[i] ^= data32[i<<2] & pm;
- break;
- case GXnor:
- for(i = 0; i < width; i++)
- data8[i] = ~(data8[i] | (data32[i<<2] & pm));
- break;
- case GXequiv:
- for(i = 0; i < width; i++)
- data8[i] = ~(data8[i] ^ (data32[i<<2] & pm));
- break;
- case GXinvert:
- for(i = 0; i < width; i++)
- data8[i] ^= pm;
- break;
- case GXorReverse:
- for(i = 0; i < width; i++)
- data8[i] = ~data8[i] | (data32[i<<2] & pm);
- break;
- case GXcopyInverted:
- for(i = 0; i < width; i++)
- data8[i] = (~data32[i<<2] & pm) | (data8[i] & ~pm);
- break;
- case GXorInverted:
- for(i = 0; i < width; i++)
- data8[i] |= ~data32[i<<2] & pm;
- break;
- case GXnand:
- for(i = 0; i < width; i++)
- data8[i] = ~(data8[i] & (data32[i<<2] | ~pm));
- break;
- case GXset:
- for(i = 0; i < width; i++)
- data8[i] |= pm;
- break;
- }
- data8 += pitch8;
- data32 += pitch32;
- }
- }
- }
-}
-
-
-
-static void
-Do8To8Blt(
- unsigned char *SrcPtr,
- int SrcPitch,
- unsigned char *DstPtr,
- int DstPitch,
- int nbox,
- DDXPointPtr pptSrc,
- BoxPtr pbox,
- int xdir, int ydir
-){
- int i, j, width, height, ydir2;
- CARD8 *src, *dst;
-
- SrcPtr += 3;
- DstPtr += 3;
- xdir *= 4;
- ydir2 = ydir * DstPitch;
- ydir *= SrcPitch;
-
- for(;nbox; pbox++, pptSrc++, nbox--) {
- src = SrcPtr + (pptSrc->y * SrcPitch) + (pptSrc->x << 2);
- dst = DstPtr + (pbox->y1 * DstPitch) + (pbox->x1 << 2);
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- if(ydir < 0) {
- src += (height - 1) * SrcPitch;
- dst += (height - 1) * DstPitch;
- }
-
- if(xdir < 0) {
- register int tmp = (width - 1) << 2;
- src += tmp;
- dst += tmp;
- }
-
- while(height--) {
- for(i = width, j = 0; i--; j+=xdir)
- dst[j] = src[j];
- src += ydir;
- dst += ydir2;
- }
- }
-}
-
-static void
-Do24To24Blt(
- unsigned char *SrcPtr,
- int SrcPitch,
- unsigned char *DstPtr,
- int DstPitch,
- int nbox,
- DDXPointPtr pptSrc,
- BoxPtr pbox,
- int xdir, int ydir
-){
- int i, j, width, height, ydir2;
- CARD8 *src, *dst;
-
- xdir *= 4;
- ydir2 = ydir * DstPitch;
- ydir *= SrcPitch;
-
- for(;nbox; pbox++, pptSrc++, nbox--) {
- src = SrcPtr + (pptSrc->y * SrcPitch) + (pptSrc->x << 2);
- dst = DstPtr + (pbox->y1 * DstPitch) + (pbox->x1 << 2);
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- if(ydir < 0) {
- src += (height - 1) * SrcPitch;
- dst += (height - 1) * DstPitch;
- }
-
- if(xdir < 0) {
- register int tmp = (width - 1) << 2;
- src += tmp;
- dst += tmp;
- }
-
- while(height--) {
- for(i = width, j = 0; i--; j+=xdir) {
- *((CARD16*)(dst + j)) = *((CARD32*)(src + j));
- dst[j + 2] = src[j + 2];
- }
- src += ydir;
- dst += ydir2;
- }
- }
-}
-
-
-static void
-cfb8_32DoBitBlt(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- void (*DoBlt)(
- unsigned char *SrcPtr,
- int SrcPitch,
- unsigned char *DstPtr,
- int DstPitch,
- int nbox,
- DDXPointPtr pptSrc,
- BoxPtr pbox,
- int xdir, int ydir)
-){
- int nbox, careful, SrcPitch, DstPitch;
- BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
- DDXPointPtr pptTmp, pptNew1, pptNew2;
- int xdir, ydir;
- unsigned char *SrcPtr, *DstPtr;
-
- /* XXX we have to err on the side of safety when both are windows,
- * because we don't know if IncludeInferiors is being used.
- */
- careful = ((pSrc == pDst) ||
- ((pSrc->type == DRAWABLE_WINDOW) &&
- (pDst->type == DRAWABLE_WINDOW)));
-
- pbox = REGION_RECTS(prgnDst);
- nbox = REGION_NUM_RECTS(prgnDst);
-
- pboxNew1 = NULL;
- pptNew1 = NULL;
- pboxNew2 = NULL;
- pptNew2 = NULL;
- if (careful && (pptSrc->y < pbox->y1)) {
- /* walk source botttom to top */
- ydir = -1;
-
- if (nbox > 1) {
- /* keep ordering in each band, reverse order of bands */
- pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
- if(!pboxNew1)
- return;
- pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
- if(!pptNew1) {
- xfree(pboxNew1);
- return;
- }
- pboxBase = pboxNext = pbox+nbox-1;
- while (pboxBase >= pbox) {
- while ((pboxNext >= pbox) &&
- (pboxBase->y1 == pboxNext->y1))
- pboxNext--;
- pboxTmp = pboxNext+1;
- pptTmp = pptSrc + (pboxTmp - pbox);
- while (pboxTmp <= pboxBase) {
- *pboxNew1++ = *pboxTmp++;
- *pptNew1++ = *pptTmp++;
- }
- pboxBase = pboxNext;
- }
- pboxNew1 -= nbox;
- pbox = pboxNew1;
- pptNew1 -= nbox;
- pptSrc = pptNew1;
- }
- } else {
- /* walk source top to bottom */
- ydir = 1;
- }
-
- if (careful && (pptSrc->x < pbox->x1)) {
- /* walk source right to left */
- xdir = -1;
-
- if (nbox > 1) {
- /* reverse order of rects in each band */
- pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
- pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
- if(!pboxNew2 || !pptNew2) {
- if (pptNew2) xfree(pptNew2);
- if (pboxNew2) xfree(pboxNew2);
- if (pboxNew1) {
- xfree(pptNew1);
- xfree(pboxNew1);
- }
- return;
- }
- pboxBase = pboxNext = pbox;
- while (pboxBase < pbox+nbox) {
- while ((pboxNext < pbox+nbox) &&
- (pboxNext->y1 == pboxBase->y1))
- pboxNext++;
- pboxTmp = pboxNext;
- pptTmp = pptSrc + (pboxTmp - pbox);
- while (pboxTmp != pboxBase) {
- *pboxNew2++ = *--pboxTmp;
- *pptNew2++ = *--pptTmp;
- }
- pboxBase = pboxNext;
- }
- pboxNew2 -= nbox;
- pbox = pboxNew2;
- pptNew2 -= nbox;
- pptSrc = pptNew2;
- }
- } else {
- /* walk source left to right */
- xdir = 1;
- }
-
- cfbGetByteWidthAndPointer(pSrc, SrcPitch, SrcPtr);
- cfbGetByteWidthAndPointer(pDst, DstPitch, DstPtr);
-
- (*DoBlt)(SrcPtr,SrcPitch,DstPtr,DstPitch,nbox,pptSrc,pbox,xdir,ydir);
-
- if (pboxNew2) {
- xfree(pptNew2);
- xfree(pboxNew2);
- }
- if (pboxNew1) {
- xfree(pptNew1);
- xfree(pboxNew1);
- }
-
-}
-
-
-/* A couple routines to speed up full planemask copies */
-
-void
-cfbDoBitblt8To8GXcopy(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long pm
-){
- cfb8_32DoBitBlt(pSrc, pDst, prgnDst, pptSrc, Do8To8Blt);
-}
-
-
-void
-cfbDoBitblt24To24GXcopy(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long pm
-){
- cfb8_32DoBitBlt(pSrc, pDst, prgnDst, pptSrc, Do24To24Blt);
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbcpyplane.c b/hw/xfree86/xf8_32bpp/cfbcpyplane.c
deleted file mode 100644
index e10b52525..000000000
--- a/hw/xfree86/xf8_32bpp/cfbcpyplane.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include "mi.h"
-
-
-RegionPtr
-cfb8_32CopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
- /* There's actually much more to it than this */
-
- if((pDst->bitsPerPixel == 8) && (pSrc->bitsPerPixel != 32)){
- return(cfbCopyPlane(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane));
- }
-
-
- return(miCopyPlane (pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane));
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbgc.c b/hw/xfree86/xf8_32bpp/cfbgc.c
deleted file mode 100644
index a7787caa9..000000000
--- a/hw/xfree86/xf8_32bpp/cfbgc.c
+++ /dev/null
@@ -1,646 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-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 Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL 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.
-
-******************************************************************/
-
-
-/*
-
-PSZ 8 16 24 32
-PIXEL_ADDR True True True True
-NO_ONE_RECT False False False False
-WriteBitGroup True True True True
-FOUR_BIT_CODE True False False False
-LOWMEMFTPT False False False False
-
-*/
-
-
-/* This gets built twice. Once for 8bpp and another for 32bpp */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "cfb.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "region.h"
-
-#include "mistruct.h"
-#include "mibstore.h"
-#include "migc.h"
-#include "mioverlay.h"
-
-#include "cfb8_32.h"
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-
-
-#if PSZ == 8
-# define useTEGlyphBlt cfbTEGlyphBlt8
-#else
-# ifdef WriteBitGroup
-# define useTEGlyphBlt cfbImageGlyphBlt8
-# else
-# define useTEGlyphBlt cfbTEGlyphBlt
-# endif
-#endif
-
-#ifdef WriteBitGroup
-# define useImageGlyphBlt cfbImageGlyphBlt8
-# define usePolyGlyphBlt cfbPolyGlyphBlt8
-#else
-# define useImageGlyphBlt miImageGlyphBlt
-# define usePolyGlyphBlt miPolyGlyphBlt
-#endif
-
-#ifdef FOUR_BIT_CODE
-# define usePushPixels cfbPushPixels8
-#else
-# define usePushPixels mfbPushPixels
-#endif
-
-#ifdef PIXEL_ADDR
-# define ZeroPolyArc cfbZeroPolyArcSS8Copy
-#else
-# define ZeroPolyArc miZeroPolyArc
-#endif
-
-
-static GCOps cfb8_32TEOps1Rect = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfb8_32PutImage,
- cfb8_32CopyArea,
- cfb8_32CopyPlane,
- cfbPolyPoint,
-#ifdef PIXEL_ADDR
- cfb8LineSS1Rect,
- cfb8SegmentSS1Rect,
-#else
- cfbLineSS,
- cfbSegmentSS,
-#endif
- miPolyRectangle,
- ZeroPolyArc,
- cfbFillPoly1RectCopy,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useTEGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps cfb8_32NonTEOps1Rect = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfb8_32PutImage,
- cfb8_32CopyArea,
- cfb8_32CopyPlane,
- cfbPolyPoint,
-#ifdef PIXEL_ADDR
- cfb8LineSS1Rect,
- cfb8SegmentSS1Rect,
-#else
- cfbLineSS,
- cfbSegmentSS,
-#endif
- miPolyRectangle,
- ZeroPolyArc,
- cfbFillPoly1RectCopy,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useImageGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps cfb8_32TEOps = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfb8_32PutImage,
- cfb8_32CopyArea,
- cfb8_32CopyPlane,
- cfbPolyPoint,
- cfbLineSS,
- cfbSegmentSS,
- miPolyRectangle,
- ZeroPolyArc,
- miFillPolygon,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useTEGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps cfb8_32NonTEOps = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfb8_32PutImage,
- cfb8_32CopyArea,
- cfb8_32CopyPlane,
- cfbPolyPoint,
- cfbLineSS,
- cfbSegmentSS,
- miPolyRectangle,
-#ifdef PIXEL_ADDR
- cfbZeroPolyArcSS8Copy,
-#else
- miZeroPolyArc,
-#endif
- miFillPolygon,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useImageGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps *
-cfb8_32MatchCommon (GCPtr pGC, cfbPrivGCPtr devPriv)
-{
- if (pGC->lineWidth != 0)
- return 0;
- if (pGC->lineStyle != LineSolid)
- return 0;
- if (pGC->fillStyle != FillSolid)
- return 0;
- if (devPriv->rop != GXcopy)
- return 0;
- if (pGC->font &&
- FONTMAXBOUNDS(pGC->font,rightSideBearing) -
- FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 &&
- FONTMINBOUNDS(pGC->font,characterWidth) >= 0)
- {
- if (TERMINALFONT(pGC->font)
-#ifdef FOUR_BIT_CODE
- && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
-#endif
- )
-#ifdef NO_ONE_RECT
- return &cfb8_32TEOps1Rect;
-#else
- if (devPriv->oneRect)
- return &cfb8_32TEOps1Rect;
- else
- return &cfb8_32TEOps;
-#endif
- else
-#ifdef NO_ONE_RECT
- return &cfb8_32NonTEOps1Rect;
-#else
- if (devPriv->oneRect)
- return &cfb8_32NonTEOps1Rect;
- else
- return &cfb8_32NonTEOps;
-#endif
- }
- return 0;
-}
-
-
-/* Clipping conventions
- if the drawable is a window
- CT_REGION ==> pCompositeClip really is the composite
- CT_other ==> pCompositeClip is the window clip region
- if the drawable is a pixmap
- CT_REGION ==> pCompositeClip is the translated client region
- clipped to the pixmap boundary
- CT_other ==> pCompositeClip is the pixmap bounding box
-*/
-
-void
-#if PSZ == 8
-cfb8_32ValidateGC8(
-#else
-cfb8_32ValidateGC32(
-#endif
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable
-){
- int mask; /* stateChanges */
- int index; /* used for stepping through bitfields */
- int new_rrop;
- int new_line, new_text, new_fillspans, new_fillarea;
- /* flags for changing the proc vector */
- cfbPrivGCPtr devPriv;
- int oneRect;
-
- pGC->lastWinOrg.x = pDrawable->x;
- pGC->lastWinOrg.y = pDrawable->y;
- devPriv = cfbGetGCPrivate(pGC);
-
- new_rrop = FALSE;
- new_line = FALSE;
- new_text = FALSE;
- new_fillspans = FALSE;
- new_fillarea = FALSE;
-
- /*
- * if the client clip is different or moved OR the subwindowMode has
- * changed OR the window's clip has changed since the last validation
- * we need to recompute the composite clip
- */
-
- if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
- (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)))
- {
- miComputeCompositeClip (pGC, pDrawable);
-#ifdef NO_ONE_RECT
- devPriv->oneRect = FALSE;
-#else
- oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1;
- if (oneRect != devPriv->oneRect)
- new_line = TRUE;
- devPriv->oneRect = oneRect;
-#endif
- }
-
- mask = changes;
- while (mask) {
- index = lowbit (mask);
- mask &= ~index;
-
- switch (index) {
- case GCFunction:
- case GCForeground:
- new_rrop = TRUE;
- break;
- case GCPlaneMask:
- new_rrop = TRUE;
- new_text = TRUE;
- break;
- case GCBackground:
- break;
- case GCLineStyle:
- case GCLineWidth:
- new_line = TRUE;
- break;
- case GCJoinStyle:
- case GCCapStyle:
- break;
- case GCFillStyle:
- new_text = TRUE;
- new_fillspans = TRUE;
- new_line = TRUE;
- new_fillarea = TRUE;
- break;
- case GCFillRule:
- break;
- case GCTile:
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- break;
- case GCStipple:
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- break;
- case GCTileStipXOrigin:
- case GCTileStipYOrigin:
- break;
- case GCFont:
- new_text = TRUE;
- break;
- case GCSubwindowMode:
- case GCGraphicsExposures:
- case GCClipXOrigin:
- case GCClipYOrigin:
- case GCClipMask:
- case GCDashOffset:
- case GCDashList:
- case GCArcMode:
- default:
- break;
- }
- }
-
- /*
- * If the drawable has changed, ensure suitable
- * entries are in the proc vector.
- */
- if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS)))
- new_fillspans = TRUE; /* deal with FillSpans later */
-
- if (new_rrop)
- {
- int old_rrop;
-
- old_rrop = devPriv->rop;
- devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel,
- pGC->planemask,
- &devPriv->and, &devPriv->xor);
- if (old_rrop == devPriv->rop)
- new_rrop = FALSE;
- else
- {
-#ifdef PIXEL_ADDR
- new_line = TRUE;
-#endif
-#ifdef WriteBitGroup
- new_text = TRUE;
-#endif
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- }
- }
-
- if(!pGC->ops)
- pGC->ops = & cfb8_32NonTEOps;
-
- if (new_rrop || new_fillspans || new_text || new_fillarea || new_line)
- {
- GCOps *newops;
-
- if ((newops = cfb8_32MatchCommon (pGC, devPriv)))
- {
- if (pGC->ops->devPrivate.val)
- miDestroyGCOps (pGC->ops);
- pGC->ops = newops;
- new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0;
- }
- else
- {
- if (!pGC->ops->devPrivate.val)
- {
- pGC->ops = miCreateGCOps (pGC->ops);
- pGC->ops->devPrivate.val = 1;
- }
- }
- }
-
- /* deal with the changes we've collected */
- if (new_line)
- {
- pGC->ops->FillPolygon = miFillPolygon;
-#ifdef NO_ONE_RECT
- if (pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
- break;
- default:
- pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
- break;
- }
- }
-#else
- if (devPriv->oneRect && pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
- break;
- default:
- pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
- break;
- }
- }
-#endif
- if (pGC->lineWidth == 0)
- {
-#ifdef PIXEL_ADDR
- if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid))
- {
- switch (devPriv->rop)
- {
- case GXxor:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor;
- break;
- case GXcopy:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy;
- break;
- default:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8General;
- break;
- }
- }
- else
-#endif
- pGC->ops->PolyArc = miZeroPolyArc;
- }
- else
- pGC->ops->PolyArc = miPolyArc;
- pGC->ops->PolySegment = miPolySegment;
- switch (pGC->lineStyle)
- {
- case LineSolid:
- if(pGC->lineWidth == 0)
- {
- if (pGC->fillStyle == FillSolid)
- {
-#if defined(PIXEL_ADDR) && !defined(NO_ONE_RECT)
- if (devPriv->oneRect &&
- ((pDrawable->x >= pGC->pScreen->width - 32768) &&
- (pDrawable->y >= pGC->pScreen->height - 32768)))
- {
- pGC->ops->Polylines = cfb8LineSS1Rect;
- pGC->ops->PolySegment = cfb8SegmentSS1Rect;
- } else
-#endif
-#ifdef NO_ONE_RECT
- {
- pGC->ops->Polylines = cfb8LineSS1Rect;
- pGC->ops->PolySegment = cfb8SegmentSS1Rect;
- }
-#else
- {
- pGC->ops->Polylines = cfbLineSS;
- pGC->ops->PolySegment = cfbSegmentSS;
- }
-#endif
- }
- else
- pGC->ops->Polylines = miZeroLine;
- }
- else
- pGC->ops->Polylines = miWideLine;
- break;
- case LineOnOffDash:
- case LineDoubleDash:
- if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid)
- {
- pGC->ops->Polylines = cfbLineSD;
- pGC->ops->PolySegment = cfbSegmentSD;
- } else
- pGC->ops->Polylines = miWideDash;
- break;
- }
- }
-
- if (new_text && (pGC->font))
- {
- if (FONTMAXBOUNDS(pGC->font,rightSideBearing) -
- FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
- FONTMINBOUNDS(pGC->font,characterWidth) < 0)
- {
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
- pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
- }
- else
- {
-#ifdef WriteBitGroup
- if (pGC->fillStyle == FillSolid)
- {
- if (devPriv->rop == GXcopy)
- pGC->ops->PolyGlyphBlt = cfbPolyGlyphBlt8;
- else
-#ifdef FOUR_BIT_CODE
- pGC->ops->PolyGlyphBlt = cfbPolyGlyphRop8;
-#else
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
-#endif
- }
- else
-#endif
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
- /* special case ImageGlyphBlt for terminal emulator fonts */
-#if !defined(WriteBitGroup) || PSZ == 8
- if (TERMINALFONT(pGC->font) &&
- (pGC->planemask & PMSK) == PMSK
-#ifdef FOUR_BIT_CODE
- && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
-#endif
- )
- {
- pGC->ops->ImageGlyphBlt = useTEGlyphBlt;
- }
- else
-#endif
- {
-#ifdef WriteBitGroup
- if (devPriv->rop == GXcopy &&
- pGC->fillStyle == FillSolid &&
- (pGC->planemask & PMSK) == PMSK)
- pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8;
- else
-#endif
- pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
- }
- }
- }
-
-
- if (new_fillspans) {
- switch (pGC->fillStyle) {
- case FillSolid:
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillSpans = cfbSolidSpansCopy;
- break;
- case GXxor:
- pGC->ops->FillSpans = cfbSolidSpansXor;
- break;
- default:
- pGC->ops->FillSpans = cfbSolidSpansGeneral;
- break;
- }
- break;
- case FillTiled:
- pGC->ops->FillSpans = cfbUnnaturalTileFS;
- break;
- case FillStippled:
- case FillOpaqueStippled:
- pGC->ops->FillSpans = cfbUnnaturalStippleFS;
- break;
- default:
- FatalError("cfbValidateGC: illegal fillStyle\n");
- }
- } /* end of new_fillspans */
-
- if (new_fillarea) {
-#ifndef FOUR_BIT_CODE
- pGC->ops->PolyFillRect = miPolyFillRect;
- if (pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled)
- {
- pGC->ops->PolyFillRect = cfbPolyFillRect;
- }
-#endif
-#ifdef FOUR_BIT_CODE
- pGC->ops->PushPixels = mfbPushPixels;
- if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy)
- pGC->ops->PushPixels = cfbPushPixels8;
-#endif
- pGC->ops->PolyFillArc = miPolyFillArc;
- if (pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop)
- {
- case GXcopy:
- pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy;
- break;
- default:
- pGC->ops->PolyFillArc = cfbPolyFillArcSolidGeneral;
- break;
- }
- }
- }
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbgcmisc.c b/hw/xfree86/xf8_32bpp/cfbgcmisc.c
deleted file mode 100644
index f009afc0c..000000000
--- a/hw/xfree86/xf8_32bpp/cfbgcmisc.c
+++ /dev/null
@@ -1,150 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "region.h"
-
-#include "mistruct.h"
-#include "mibstore.h"
-#include "migc.h"
-
-
-static void cfb8_32ValidateGC(GCPtr, unsigned long, DrawablePtr);
-static void cfb8_32DestroyGC(GCPtr pGC);
-static void cfb32DestroyGC_Underlay(GCPtr pGC);
-
-static
-GCFuncs cfb8_32GCFuncs = {
- cfb8_32ValidateGC,
- miChangeGC,
- miCopyGC,
- cfb8_32DestroyGC,
- miChangeClip,
- miDestroyClip,
- miCopyClip,
-};
-
-
-static
-GCFuncs cfb32GCFuncs_Underlay = {
- cfb32ValidateGC_Underlay,
- miChangeGC,
- miCopyGC,
- cfb32DestroyGC_Underlay,
- miChangeClip,
- miDestroyClip,
- miCopyClip,
-};
-
-static void
-cfb32DestroyGC_Underlay(GCPtr pGC)
-{
- if (pGC->freeCompClip)
- REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
-
- if(pGC->ops)
- miDestroyGCOps(pGC->ops);
-}
-
-
-static void
-cfb8_32DestroyGC(GCPtr pGC)
-{
- cfb8_32GCPtr pGCPriv = CFB8_32_GET_GC_PRIVATE(pGC);
-
- if (pGC->freeCompClip)
- REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
- if(pGCPriv->Ops8bpp)
- miDestroyGCOps(pGCPriv->Ops8bpp);
- if(pGCPriv->Ops32bpp)
- miDestroyGCOps(pGCPriv->Ops32bpp);
-}
-
-Bool
-cfb8_32CreateGC(GCPtr pGC)
-{
- cfb8_32GCPtr pGCPriv;
- cfbPrivGC *pPriv;
-
- if (PixmapWidthPaddingInfo[pGC->depth].padPixelsLog2 == LOG2_BITMAP_PAD)
- return (mfbCreateGC(pGC));
-
- pGC->clientClip = NULL;
- pGC->clientClipType = CT_NONE;
- pGC->miTranslate = 1;
- pGC->fExpose = TRUE;
- pGC->freeCompClip = FALSE;
- pGC->pRotatedPixmap = (PixmapPtr) NULL;
-
- pPriv = cfbGetGCPrivate(pGC);
- pPriv->rop = pGC->alu;
- pPriv->oneRect = FALSE;
-
- pGC->ops = NULL;
-
- if (pGC->depth == 8) {
- pGC->funcs = &cfb8_32GCFuncs;
-
- pGCPriv = CFB8_32_GET_GC_PRIVATE(pGC);
- pGCPriv->Ops8bpp = NULL;
- pGCPriv->Ops32bpp = NULL;
- pGCPriv->OpsAre8bpp = FALSE;
- pGCPriv->changes = 0;
- } else
- pGC->funcs = &cfb32GCFuncs_Underlay;
-
- return TRUE;
-}
-
-
-static void
-cfb8_32ValidateGC(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-){
- cfb8_32GCPtr pGCPriv = CFB8_32_GET_GC_PRIVATE(pGC);
-
- if(pDraw->bitsPerPixel == 32) {
- if(pGCPriv->OpsAre8bpp) {
- int origChanges = changes;
- pGC->ops = pGCPriv->Ops32bpp;
- changes |= pGCPriv->changes;
- pGCPriv->changes = origChanges;
- pGCPriv->OpsAre8bpp = FALSE;
- } else
- pGCPriv->changes |= changes;
-
- cfb8_32ValidateGC32(pGC, changes, pDraw);
- pGCPriv->Ops32bpp = pGC->ops;
- } else { /* bitsPerPixel == 8 */
- if(!pGCPriv->OpsAre8bpp) {
- int origChanges = changes;
- pGC->ops = pGCPriv->Ops8bpp;
- changes |= pGCPriv->changes;
- pGCPriv->changes = origChanges;
- pGCPriv->OpsAre8bpp = TRUE;
- } else
- pGCPriv->changes |= changes;
-
- cfb8_32ValidateGC8(pGC, changes, pDraw);
- pGCPriv->Ops8bpp = pGC->ops;
- }
-}
-
diff --git a/hw/xfree86/xf8_32bpp/cfbgcunder.c b/hw/xfree86/xf8_32bpp/cfbgcunder.c
deleted file mode 100644
index d90321355..000000000
--- a/hw/xfree86/xf8_32bpp/cfbgcunder.c
+++ /dev/null
@@ -1,620 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-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 Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL 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.
-
-******************************************************************/
-#define PSZ 32
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "cfb.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "region.h"
-
-#include "mistruct.h"
-#include "mibstore.h"
-#include "migc.h"
-#include "mioverlay.h"
-
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-#include "cfb8_32.h"
-
-#ifdef WriteBitGroup
-# define useTEGlyphBlt cfbImageGlyphBlt8
-#else
-# define useTEGlyphBlt cfbTEGlyphBlt
-#endif
-
-#ifdef WriteBitGroup
-# define useImageGlyphBlt cfbImageGlyphBlt8
-# define usePolyGlyphBlt cfbPolyGlyphBlt8
-#else
-# define useImageGlyphBlt miImageGlyphBlt
-# define usePolyGlyphBlt miPolyGlyphBlt
-#endif
-
-#ifdef FOUR_BIT_CODE
-# define usePushPixels cfbPushPixels8
-#else
-# define usePushPixels mfbPushPixels
-#endif
-
-#ifdef PIXEL_ADDR
-# define ZeroPolyArc cfbZeroPolyArcSS8Copy
-#else
-# define ZeroPolyArc miZeroPolyArc
-#endif
-
-
-static GCOps cfbTEOps1Rect = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfbPutImage,
- cfbCopyArea,
- cfbCopyPlane,
- cfbPolyPoint,
-#ifdef PIXEL_ADDR
- cfb8LineSS1Rect,
- cfb8SegmentSS1Rect,
-#else
- cfbLineSS,
- cfbSegmentSS,
-#endif
- miPolyRectangle,
- ZeroPolyArc,
- cfbFillPoly1RectCopy,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useTEGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps cfbNonTEOps1Rect = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfbPutImage,
- cfbCopyArea,
- cfbCopyPlane,
- cfbPolyPoint,
-#ifdef PIXEL_ADDR
- cfb8LineSS1Rect,
- cfb8SegmentSS1Rect,
-#else
- cfbLineSS,
- cfbSegmentSS,
-#endif
- miPolyRectangle,
- ZeroPolyArc,
- cfbFillPoly1RectCopy,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useImageGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps cfbTEOps = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfbPutImage,
- cfbCopyArea,
- cfbCopyPlane,
- cfbPolyPoint,
- cfbLineSS,
- cfbSegmentSS,
- miPolyRectangle,
- ZeroPolyArc,
- miFillPolygon,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useTEGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps cfbNonTEOps = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfbPutImage,
- cfbCopyArea,
- cfbCopyPlane,
- cfbPolyPoint,
- cfbLineSS,
- cfbSegmentSS,
- miPolyRectangle,
-#ifdef PIXEL_ADDR
- cfbZeroPolyArcSS8Copy,
-#else
- miZeroPolyArc,
-#endif
- miFillPolygon,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useImageGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps *
-cfb32MatchCommon_Underlay(
- GCPtr pGC,
- cfbPrivGCPtr devPriv)
-{
- if (pGC->lineWidth != 0)
- return 0;
- if (pGC->lineStyle != LineSolid)
- return 0;
- if (pGC->fillStyle != FillSolid)
- return 0;
- if (devPriv->rop != GXcopy)
- return 0;
- if (pGC->font &&
- FONTMAXBOUNDS(pGC->font,rightSideBearing) -
- FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 &&
- FONTMINBOUNDS(pGC->font,characterWidth) >= 0)
- {
- if (TERMINALFONT(pGC->font)
-#ifdef FOUR_BIT_CODE
- && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
-#endif
- )
-#ifdef NO_ONE_RECT
- return &cfbTEOps1Rect;
-#else
- if (devPriv->oneRect)
- return &cfbTEOps1Rect;
- else
- return &cfbTEOps;
-#endif
- else
-#ifdef NO_ONE_RECT
- return &cfbNonTEOps1Rect;
-#else
- if (devPriv->oneRect)
- return &cfbNonTEOps1Rect;
- else
- return &cfbNonTEOps;
-#endif
- }
- return 0;
-}
-
-
-void
-cfb32ValidateGC_Underlay(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable
-){
- int mask; /* stateChanges */
- int index; /* used for stepping through bitfields */
- int new_rrop;
- int new_line, new_text, new_fillspans, new_fillarea;
- /* flags for changing the proc vector */
- cfbPrivGCPtr devPriv;
- int oneRect;
-
- pGC->lastWinOrg.x = pDrawable->x;
- pGC->lastWinOrg.y = pDrawable->y;
- devPriv = cfbGetGCPrivate(pGC);
-
- new_rrop = FALSE;
- new_line = FALSE;
- new_text = FALSE;
- new_fillspans = FALSE;
- new_fillarea = FALSE;
-
- /*
- * if the client clip is different or moved OR the subwindowMode has
- * changed OR the window's clip has changed since the last validation
- * we need to recompute the composite clip
- */
-
- if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
- (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
- )
- {
- if(pDrawable->type == DRAWABLE_WINDOW)
- miOverlayComputeCompositeClip (pGC, (WindowPtr)pDrawable);
- else
- miComputeCompositeClip (pGC, pDrawable);
-#ifdef NO_ONE_RECT
- devPriv->oneRect = FALSE;
-#else
- oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1;
- if (oneRect != devPriv->oneRect)
- new_line = TRUE;
- devPriv->oneRect = oneRect;
-#endif
- }
-
- mask = changes;
- while (mask) {
- index = lowbit (mask);
- mask &= ~index;
-
- switch (index) {
- case GCFunction:
- case GCForeground:
- new_rrop = TRUE;
- break;
- case GCPlaneMask:
- new_rrop = TRUE;
- new_text = TRUE;
- break;
- case GCBackground:
- break;
- case GCLineStyle:
- case GCLineWidth:
- new_line = TRUE;
- break;
- case GCJoinStyle:
- case GCCapStyle:
- break;
- case GCFillStyle:
- new_text = TRUE;
- new_fillspans = TRUE;
- new_line = TRUE;
- new_fillarea = TRUE;
- break;
- case GCFillRule:
- break;
- case GCTile:
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- break;
- case GCStipple:
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- break;
- case GCTileStipXOrigin:
- case GCTileStipYOrigin:
- break;
- case GCFont:
- new_text = TRUE;
- break;
- case GCSubwindowMode:
- case GCGraphicsExposures:
- case GCClipXOrigin:
- case GCClipYOrigin:
- case GCClipMask:
- case GCDashOffset:
- case GCDashList:
- case GCArcMode:
- default:
- break;
- }
- }
-
- /*
- * If the drawable has changed, ensure suitable
- * entries are in the proc vector.
- */
- if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS)))
- new_fillspans = TRUE; /* deal with FillSpans later */
-
- if (new_rrop)
- {
- int old_rrop;
-
- old_rrop = devPriv->rop;
- devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel,
- pGC->planemask,
- &devPriv->and, &devPriv->xor);
- if (old_rrop == devPriv->rop)
- new_rrop = FALSE;
- else
- {
-#ifdef PIXEL_ADDR
- new_line = TRUE;
-#endif
-#ifdef WriteBitGroup
- new_text = TRUE;
-#endif
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- }
- }
-
- if(!pGC->ops)
- pGC->ops = & cfbNonTEOps;
-
-
- if (new_rrop || new_fillspans || new_text || new_fillarea || new_line)
- {
- GCOps *newops;
-
- if ((newops = cfb32MatchCommon_Underlay (pGC, devPriv)))
- {
- if (pGC->ops->devPrivate.val)
- miDestroyGCOps (pGC->ops);
- pGC->ops = newops;
- new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0;
- }
- else
- {
- if (!pGC->ops->devPrivate.val)
- {
- pGC->ops = miCreateGCOps (pGC->ops);
- pGC->ops->devPrivate.val = 1;
- }
- }
- }
-
- /* deal with the changes we've collected */
- if (new_line)
- {
- pGC->ops->FillPolygon = miFillPolygon;
-#ifdef NO_ONE_RECT
- if (pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
- break;
- default:
- pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
- break;
- }
- }
-#else
- if (devPriv->oneRect && pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
- break;
- default:
- pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
- break;
- }
- }
-#endif
- if (pGC->lineWidth == 0)
- {
-#ifdef PIXEL_ADDR
- if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid))
- {
- switch (devPriv->rop)
- {
- case GXxor:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor;
- break;
- case GXcopy:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy;
- break;
- default:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8General;
- break;
- }
- }
- else
-#endif
- pGC->ops->PolyArc = miZeroPolyArc;
- }
- else
- pGC->ops->PolyArc = miPolyArc;
- pGC->ops->PolySegment = miPolySegment;
- switch (pGC->lineStyle)
- {
- case LineSolid:
- if(pGC->lineWidth == 0)
- {
- if (pGC->fillStyle == FillSolid)
- {
-#if defined(PIXEL_ADDR) && !defined(NO_ONE_RECT)
- if (devPriv->oneRect &&
- ((pDrawable->x >= pGC->pScreen->width - 32768) &&
- (pDrawable->y >= pGC->pScreen->height - 32768)))
- {
- pGC->ops->Polylines = cfb8LineSS1Rect;
- pGC->ops->PolySegment = cfb8SegmentSS1Rect;
- } else
-#endif
-#ifdef NO_ONE_RECT
- {
- pGC->ops->Polylines = cfb8LineSS1Rect;
- pGC->ops->PolySegment = cfb8SegmentSS1Rect;
- }
-#else
- {
- pGC->ops->Polylines = cfbLineSS;
- pGC->ops->PolySegment = cfbSegmentSS;
- }
-#endif
- }
- else
- pGC->ops->Polylines = miZeroLine;
- }
- else
- pGC->ops->Polylines = miWideLine;
- break;
- case LineOnOffDash:
- case LineDoubleDash:
- if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid)
- {
- pGC->ops->Polylines = cfbLineSD;
- pGC->ops->PolySegment = cfbSegmentSD;
- } else
- pGC->ops->Polylines = miWideDash;
- break;
- }
- }
-
- if (new_text && (pGC->font))
- {
- if (FONTMAXBOUNDS(pGC->font,rightSideBearing) -
- FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
- FONTMINBOUNDS(pGC->font,characterWidth) < 0)
- {
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
- pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
- }
- else
- {
-#ifdef WriteBitGroup
- if (pGC->fillStyle == FillSolid)
- {
- if (devPriv->rop == GXcopy)
- pGC->ops->PolyGlyphBlt = cfbPolyGlyphBlt8;
- else
-#ifdef FOUR_BIT_CODE
- pGC->ops->PolyGlyphBlt = cfbPolyGlyphRop8;
-#else
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
-#endif
- }
- else
-#endif
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
- /* special case ImageGlyphBlt for terminal emulator fonts */
-#if !defined(WriteBitGroup) || PSZ == 8
- if (TERMINALFONT(pGC->font) &&
- (pGC->planemask & PMSK) == PMSK
-#ifdef FOUR_BIT_CODE
- && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
-#endif
- )
- {
- pGC->ops->ImageGlyphBlt = useTEGlyphBlt;
- }
- else
-#endif
- {
-#ifdef WriteBitGroup
- if (devPriv->rop == GXcopy &&
- pGC->fillStyle == FillSolid &&
- (pGC->planemask & PMSK) == PMSK)
- pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8;
- else
-#endif
- pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
- }
- }
- }
-
-
- if (new_fillspans) {
- switch (pGC->fillStyle) {
- case FillSolid:
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillSpans = cfbSolidSpansCopy;
- break;
- case GXxor:
- pGC->ops->FillSpans = cfbSolidSpansXor;
- break;
- default:
- pGC->ops->FillSpans = cfbSolidSpansGeneral;
- break;
- }
- break;
- case FillTiled:
- pGC->ops->FillSpans = cfbUnnaturalTileFS;
- break;
- case FillStippled:
- case FillOpaqueStippled:
- pGC->ops->FillSpans = cfbUnnaturalStippleFS;
- break;
- default:
- FatalError("cfbValidateGC: illegal fillStyle\n");
- }
- } /* end of new_fillspans */
-
- if (new_fillarea) {
-#ifndef FOUR_BIT_CODE
- pGC->ops->PolyFillRect = miPolyFillRect;
- if (pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled)
- {
- pGC->ops->PolyFillRect = cfbPolyFillRect;
- }
-#endif
-#ifdef FOUR_BIT_CODE
- pGC->ops->PushPixels = mfbPushPixels;
- if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy)
- pGC->ops->PushPixels = cfbPushPixels8;
-#endif
- pGC->ops->PolyFillArc = miPolyFillArc;
- if (pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop)
- {
- case GXcopy:
- pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy;
- break;
- default:
- pGC->ops->PolyFillArc = cfbPolyFillArcSolidGeneral;
- break;
- }
- }
- }
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbimage.c b/hw/xfree86/xf8_32bpp/cfbimage.c
deleted file mode 100644
index 01a5a5eb6..000000000
--- a/hw/xfree86/xf8_32bpp/cfbimage.c
+++ /dev/null
@@ -1,174 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <X11/X.h>
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include "servermd.h"
-#include "mi.h"
-
-
-void
-cfb8_32GetImage (
- DrawablePtr pDraw,
- int sx, int sy, int w, int h,
- unsigned int format,
- unsigned long planemask,
- char *pdstLine
-){
- if(!w || !h) return;
-
- if (!cfbDrawableEnabled (pDraw))
- return;
-
- if(pDraw->depth == 24){
- cfb32GetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine);
- return;
- }
-
- if((pDraw->bitsPerPixel == 8) || (pDraw->bitsPerPixel == 1)){
- cfbGetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine);
- return;
- }
-
- /* source is depth 8, 32 bpp */
- if(format != ZPixmap) {
- miGetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine);
- return;
- } else {
- BoxRec box;
- DDXPointRec ptSrc;
- RegionRec rgnDst;
- ScreenPtr pScreen;
- PixmapPtr pPixmap;
-
- pScreen = pDraw->pScreen;
- pPixmap = GetScratchPixmapHeader(pScreen, w, h, 8, 8,
- PixmapBytePad(w,8), (pointer)pdstLine);
- if (!pPixmap)
- return;
- if ((planemask & 0xff) != 0xff)
- memset((char *)pdstLine, 0, pPixmap->devKind * h);
- ptSrc.x = sx + pDraw->x;
- ptSrc.y = sy + pDraw->y;
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = w;
- box.y2 = h;
- REGION_INIT(pScreen, &rgnDst, &box, 1);
- cfbDoBitblt32To8(pDraw, (DrawablePtr)pPixmap, GXcopy, &rgnDst,
- &ptSrc, planemask);
- REGION_UNINIT(pScreen, &rgnDst);
- FreeScratchPixmapHeader(pPixmap);
- }
-}
-
-void
-cfb8_32PutImage (
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage
-){
- if(!w || !h) return;
-
- if((pDraw->bitsPerPixel == 8) || (format != XYPixmap)){
- cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage);
- return;
- } else { /* moving an 8bpp XYPixmap to a 32bpp screen */
- unsigned long oldFg, oldBg;
- XID gcv[3];
- unsigned long oldPlanemask;
- unsigned long i;
- long bytesPer;
-
- oldPlanemask = pGC->planemask;
- oldFg = pGC->fgPixel;
- oldBg = pGC->bgPixel;
- gcv[0] = ~0L;
- gcv[1] = 0;
- DoChangeGC(pGC, GCForeground | GCBackground, gcv, 0);
- bytesPer = (long)h * BitmapBytePad(w + leftPad);
-
- for (i = 0x80000000; i & 0xff000000; i >>= 1, pImage += bytesPer)
- {
- if (i & oldPlanemask)
- {
- gcv[0] = i;
- DoChangeGC(pGC, GCPlaneMask, gcv, 0);
- ValidateGC(pDraw, pGC);
- (*pGC->ops->PutImage)(pDraw, pGC, 1, x, y, w, h, leftPad,
- XYBitmap, pImage);
- }
- }
- gcv[0] = oldPlanemask;
- gcv[1] = oldFg;
- gcv[2] = oldBg;
- DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0);
- ValidateGC(pDraw, pGC);
- }
-}
-
-
-
-
-void
-cfb8_32GetSpans(
- DrawablePtr pDraw,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pDst
-){
- int pitch, i;
- CARD8 *ptr, *ptrBase;
-
- if (!cfbDrawableEnabled (pDraw))
- return;
-
- if(pDraw->bitsPerPixel == 1) {
- mfbGetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst);
- return;
- }
-
- if(pDraw->depth == 24) {
- cfb32GetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst);
- return;
- } else if(pDraw->bitsPerPixel == 8) {
- cfbGetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst);
- return;
- }
-
- /* gotta get spans from a depth 8 window */
- cfbGetByteWidthAndPointer(pDraw, pitch, ptrBase);
- ptrBase += 3; /* point to top byte */
-
- while(nspans--) {
- ptr = ptrBase + (ppt->y * pitch) + (ppt->x << 2);
-
- for(i = *pwidth; i--; ptr += 4)
- *(pDst++) = *ptr;
-
- pDst = (char*)((long)(pDst + 3) & ~3L);
-
- ppt++; pwidth++;
- }
-}
-
-
diff --git a/hw/xfree86/xf8_32bpp/cfbpntwin.c b/hw/xfree86/xf8_32bpp/cfbpntwin.c
deleted file mode 100644
index fbf597d22..000000000
--- a/hw/xfree86/xf8_32bpp/cfbpntwin.c
+++ /dev/null
@@ -1,51 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "windowstr.h"
-#include "regionstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include "mi.h"
-
-#ifdef PANORAMIX
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
-#endif
-
-void
-cfb8_32FillBoxSolid8(
- DrawablePtr pDraw,
- int nbox,
- BoxPtr pbox,
- unsigned long color
-){
- CARD8 *ptr, *data;
- int pitch, height, width, i;
- CARD8 c = (CARD8)color;
-
- cfbGetByteWidthAndPointer(pDraw, pitch, ptr);
- ptr += 3; /* point to the top byte */
-
- while(nbox--) {
- data = ptr + (pbox->y1 * pitch) + (pbox->x1 << 2);
- width = (pbox->x2 - pbox->x1) << 2;
- height = pbox->y2 - pbox->y1;
-
- while(height--) {
- for(i = 0; i < width; i+=4)
- data[i] = c;
- data += pitch;
- }
- pbox++;
- }
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbscrinit.c b/hw/xfree86/xf8_32bpp/cfbscrinit.c
deleted file mode 100644
index c3432b803..000000000
--- a/hw/xfree86/xf8_32bpp/cfbscrinit.c
+++ /dev/null
@@ -1,311 +0,0 @@
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "misc.h"
-#include "servermd.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "resource.h"
-#include "colormap.h"
-#include "colormapst.h"
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include "mi.h"
-#include "micmap.h"
-#include "mistruct.h"
-#include "dix.h"
-#include "mibstore.h"
-#include "mioverlay.h"
-#include "xf86.h"
-#include "xf86str.h"
-#include "globals.h"
-
-/* CAUTION: We require that cfb8 and cfb32 were NOT
- compiled with CFB_NEED_SCREEN_PRIVATE */
-
-static DevPrivateKey cfb8_32GCPrivateKey = &cfb8_32GCPrivateKey;
-DevPrivateKey cfb8_32GetGCPrivateKey(void)
-{
- return cfb8_32GCPrivateKey;
-}
-
-static DevPrivateKey cfb8_32ScreenPrivateKey = &cfb8_32ScreenPrivateKey;
-DevPrivateKey cfb8_32GetScreenPrivateKey(void)
-{
- return cfb8_32ScreenPrivateKey;
-}
-
-static Bool
-cfb8_32AllocatePrivates(ScreenPtr pScreen)
-{
- cfb8_32ScreenPtr pScreenPriv;
-
- if (!(pScreenPriv = xalloc(sizeof(cfb8_32ScreenRec))))
- return FALSE;
-
- dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, pScreenPriv);
-
-
- /* All cfb will have the same GC and Window private indicies */
- if(!mfbAllocatePrivates(pScreen, &cfbGCPrivateKey))
- return FALSE;
-
- if(!dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC)))
- return FALSE;
-
- if(!dixRequestPrivate(cfb8_32GCPrivateKey, sizeof(cfb8_32GCRec)))
- return FALSE;
-
- return TRUE;
-}
-
-static void DestroyColormapNoop(
- ColormapPtr pColormap)
-{
- /* NOOP */
-}
-
-static void StoreColorsNoop(
- ColormapPtr pColormap,
- int ndef,
- xColorItem * pdef)
-{
- /* NOOP */
-}
-
-static Bool
-cfb8_32SetupScreen(
- ScreenPtr pScreen,
- pointer pbits, /* pointer to screen bitmap */
- int xsize, int ysize, /* in pixels */
- int dpix, int dpiy, /* dots per inch */
- int width /* pixel width of frame buffer */
-){
- if (!cfb8_32AllocatePrivates(pScreen))
- return FALSE;
- pScreen->defColormap = FakeClientID(0);
- /* let CreateDefColormap do whatever it wants for pixels */
- pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
- pScreen->QueryBestSize = mfbQueryBestSize;
- /* SaveScreen */
- pScreen->GetImage = cfb8_32GetImage;
- pScreen->GetSpans = cfb8_32GetSpans;
- pScreen->CreateWindow = cfb8_32CreateWindow;
- pScreen->DestroyWindow = cfb8_32DestroyWindow;
- pScreen->PositionWindow = cfb8_32PositionWindow;
- pScreen->ChangeWindowAttributes = cfb8_32ChangeWindowAttributes;
- pScreen->RealizeWindow = cfb32MapWindow; /* OK */
- pScreen->UnrealizeWindow = cfb32UnmapWindow; /* OK */
- pScreen->CopyWindow = cfb8_32CopyWindow;
- pScreen->CreatePixmap = cfb32CreatePixmap; /* OK */
- pScreen->DestroyPixmap = cfb32DestroyPixmap; /* OK */
- pScreen->RealizeFont = mfbRealizeFont;
- pScreen->UnrealizeFont = mfbUnrealizeFont;
- pScreen->CreateGC = cfb8_32CreateGC;
- pScreen->CreateColormap = miInitializeColormap;
- pScreen->DestroyColormap = DestroyColormapNoop;
- pScreen->InstallColormap = miInstallColormap;
- pScreen->UninstallColormap = miUninstallColormap;
- pScreen->ListInstalledColormaps = miListInstalledColormaps;
- pScreen->StoreColors = StoreColorsNoop;
- pScreen->ResolveColor = miResolveColor;
- pScreen->BitmapToRegion = mfbPixmapToRegion;
-
- mfbRegisterCopyPlaneProc (pScreen, cfb8_32CopyPlane);
- return TRUE;
-}
-
-typedef struct {
- pointer pbits;
- int width;
-} miScreenInitParmsRec, *miScreenInitParmsPtr;
-
-static Bool
-cfb8_32CreateScreenResources(ScreenPtr pScreen)
-{
- miScreenInitParmsPtr pScrInitParms;
- int pitch;
- Bool retval;
-
- /* get the pitch before mi destroys it */
- pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate;
- pitch = pScrInitParms->width << 2;
-
- if((retval = miCreateScreenResources(pScreen))) {
- /* fix the screen pixmap */
- PixmapPtr pPix = (PixmapPtr)pScreen->devPrivate;
- pPix->drawable.bitsPerPixel = 32;
- pPix->drawable.depth = 8;
- pPix->devKind = pitch;
- }
-
- return retval;
-}
-
-
-static Bool
-cfb8_32CloseScreen (int i, ScreenPtr pScreen)
-{
- cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen);
- if(pScreenPriv->visualData)
- xfree(pScreenPriv->visualData);
-
- xfree((pointer) pScreenPriv);
- dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, NULL);
-
- return(cfb32CloseScreen(i, pScreen));
-}
-
-static void
-cfb8_32TransFunc(
- ScreenPtr pScreen,
- int nbox,
- BoxPtr pbox
-){
- cfb8_32FillBoxSolid8(&(WindowTable[pScreen->myNum]->drawable),
- nbox, pbox, xf86Screens[pScreen->myNum]->colorKey);
-}
-
-static Bool
-cfb8_32InOverlayFunc(WindowPtr pWin)
-{
- return (pWin->drawable.depth == 8);
-}
-
-static Bool
-cfb8_32FinishScreenInit(
- ScreenPtr pScreen,
- pointer pbits, /* pointer to screen bitmap */
- int xsize, int ysize, /* in pixels */
- int dpix, int dpiy, /* dots per inch */
- int width /* pixel width of frame buffer */
-){
- VisualPtr visuals;
- DepthPtr depths;
- int nvisuals;
- int ndepths;
- int rootdepth;
- VisualID defaultVisual;
-
- rootdepth = 0;
- if (!miInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
- &defaultVisual,((unsigned long)1<<(32-1)), 8, -1))
- return FALSE;
- if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
- rootdepth, ndepths, depths,
- defaultVisual, nvisuals, visuals))
- return FALSE;
-
- pScreen->CreateScreenResources = cfb8_32CreateScreenResources;
- pScreen->CloseScreen = cfb8_32CloseScreen;
- pScreen->GetScreenPixmap = cfb32GetScreenPixmap; /* OK */
- pScreen->SetScreenPixmap = cfb32SetScreenPixmap; /* OK */
-
- if (! miInitOverlay(pScreen, cfb8_32InOverlayFunc, cfb8_32TransFunc))
- return FALSE;
-
- return TRUE;
-}
-
-static void
-cfb8_32EnableDisableFBAccess (
- int index,
- Bool enable
-){
- ScreenPtr pScreen = screenInfo.screens[index];
- cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen);
-
- miOverlaySetRootClip(pScreen, enable);
-
- (*pScreenPriv->EnableDisableFBAccess) (index, enable);
-}
-
-static Atom overlayVisualsAtom;
-
-typedef struct {
- CARD32 overlay_visual;
- CARD32 transparent_type;
- CARD32 value;
- CARD32 layer;
-} overlayVisualRec;
-
-static void
-cfb8_32SetupVisuals (ScreenPtr pScreen)
-{
- cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen);
- char atomString[] = {"SERVER_OVERLAY_VISUALS"};
- overlayVisualRec *overlayVisuals;
- VisualID *visuals = NULL;
- int numVisuals = 0;
- DepthPtr pDepth = pScreen->allowedDepths;
- int numDepths = pScreen->numDepths;
- int i;
-
- /* find depth 8 visuals */
- for(i = 0; i < numDepths; i++, pDepth++) {
- if(pDepth->depth == 8) {
- numVisuals = pDepth->numVids;
- visuals = pDepth->vids;
- break;
- }
- }
-
- if(!numVisuals || !visuals) {
- ErrorF("No overlay visuals found!\n");
- return;
- }
-
- if(!(overlayVisuals = xalloc(numVisuals * sizeof(overlayVisualRec))))
- return;
-
- for(i = 0; i < numVisuals; i++) {
- overlayVisuals[i].overlay_visual = visuals[i];
- overlayVisuals[i].transparent_type = 1; /* transparent pixel */
- overlayVisuals[i].value = pScreenPriv->key;
- overlayVisuals[i].layer = 1;
- }
-
- overlayVisualsAtom = MakeAtom(atomString, sizeof(atomString) - 1, TRUE);
- xf86RegisterRootWindowProperty(pScreen->myNum, overlayVisualsAtom,
- overlayVisualsAtom, 32, numVisuals * 4, overlayVisuals);
- pScreenPriv->visualData = (pointer)overlayVisuals;
-}
-
-Bool
-cfb8_32ScreenInit(
- ScreenPtr pScreen,
- pointer pbits, /* pointer to screen bitmap */
- int xsize, int ysize, /* in pixels */
- int dpix, int dpiy, /* dots per inch */
- int w /* pixel width of frame buffer */
-){
- cfb8_32ScreenPtr pScreenPriv;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-
- if (!cfb8_32SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, w))
- return FALSE;
-
- pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen);
- pScreenPriv->key = pScrn->colorKey;
- pScreenPriv->visualData = NULL;
-
-
- pScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess;
- pScrn->EnableDisableFBAccess = cfb8_32EnableDisableFBAccess;
-
-
- if(cfb8_32FinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, w))
- {
- cfb8_32SetupVisuals(pScreen);
- return TRUE;
- }
- return FALSE;
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbwindow.c b/hw/xfree86/xf8_32bpp/cfbwindow.c
deleted file mode 100644
index 2e6057f12..000000000
--- a/hw/xfree86/xf8_32bpp/cfbwindow.c
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "windowstr.h"
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include "mistruct.h"
-#include "regionstr.h"
-#include "cfbmskbits.h"
-#include "mioverlay.h"
-
-
-/* We don't bother with cfb's fastBackground/Border so we don't
- need to use the Window privates */
-
-
-Bool
-cfb8_32CreateWindow(WindowPtr pWin)
-{
- pWin->drawable.bitsPerPixel = 32;
- return TRUE;
-}
-
-
-Bool
-cfb8_32DestroyWindow(WindowPtr pWin)
-{
- return TRUE;
-}
-
-Bool
-cfb8_32PositionWindow(
- WindowPtr pWin,
- int x, int y
-){
- return TRUE;
-}
-
-void
-cfb8_32CopyWindow(pWin, ptOldOrg, prgnSrc)
- WindowPtr pWin;
- DDXPointRec ptOldOrg;
- RegionPtr prgnSrc;
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- DDXPointPtr ppt, pptSrc;
- RegionRec rgnDst;
- RegionPtr borderClip = &pWin->borderClip;
- BoxPtr pbox;
- int dx, dy, i, nbox;
- WindowPtr pwinRoot;
- Bool doUnderlay = miOverlayCopyUnderlay(pScreen);
- Bool freeReg = FALSE;
-
- pwinRoot = WindowTable[pScreen->myNum];
-
- if(doUnderlay)
- freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip);
-
- REGION_NULL(pScreen, &rgnDst);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
- REGION_INTERSECT(pScreen, &rgnDst, borderClip, prgnSrc);
-
- pbox = REGION_RECTS(&rgnDst);
- nbox = REGION_NUM_RECTS(&rgnDst);
- if(!nbox ||
- !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
- {
- REGION_UNINIT(pScreen, &rgnDst);
- return;
- }
- ppt = pptSrc;
-
- for (i = nbox; --i >= 0; ppt++, pbox++)
- {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- }
-
- if(doUnderlay)
- cfbDoBitblt24To24GXcopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
- GXcopy, &rgnDst, pptSrc, ~0);
- else
- cfbDoBitblt8To8GXcopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
- GXcopy, &rgnDst, pptSrc, ~0);
-
- xfree(pptSrc);
- REGION_UNINIT(pScreen, &rgnDst);
- if(freeReg)
- REGION_DESTROY(pScreen, borderClip);
-}
-
-Bool
-cfb8_32ChangeWindowAttributes(
- WindowPtr pWin,
- unsigned long mask
-){
- return TRUE;
-}
-
-
-
-
diff --git a/hw/xfree86/xf8_32bpp/xf86overlay.c b/hw/xfree86/xf8_32bpp/xf86overlay.c
deleted file mode 100644
index c63b3cfd1..000000000
--- a/hw/xfree86/xf8_32bpp/xf86overlay.c
+++ /dev/null
@@ -1,1179 +0,0 @@
-
-/*
- Copyright (C) 1998. The XFree86 Project Inc.
-
- Written by Mark Vojkovich (mvojkovi@ucsd.edu)
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "regionstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "migc.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "colormapst.h"
-#include "cfb8_32.h"
-
-#define IS_DIRTY 1
-#define IS_SHARED 2
-
-/** Screen Functions **/
-
-static Bool OverlayCloseScreen (int, ScreenPtr);
-static Bool OverlayCreateGC(GCPtr pGC);
-static Bool OverlayDestroyPixmap(PixmapPtr);
-static PixmapPtr OverlayCreatePixmap(ScreenPtr, int, int, int, unsigned);
-static Bool OverlayChangeWindowAttributes(WindowPtr, unsigned long);
-
-/** Funcs **/
-static void OverlayValidateGC(GCPtr, unsigned long, DrawablePtr);
-static void OverlayChangeGC(GCPtr, unsigned long);
-static void OverlayCopyGC(GCPtr, unsigned long, GCPtr);
-static void OverlayDestroyGC(GCPtr);
-static void OverlayChangeClip(GCPtr, int, pointer, int);
-static void OverlayDestroyClip(GCPtr);
-static void OverlayCopyClip(GCPtr, GCPtr);
-
-
-static PixmapPtr OverlayRefreshPixmap(PixmapPtr);
-
-static GCFuncs OverlayGCFuncs = {
- OverlayValidateGC, OverlayChangeGC,
- OverlayCopyGC, OverlayDestroyGC,
- OverlayChangeClip, OverlayDestroyClip,
- OverlayCopyClip
-};
-
-
-/** Pixmap Ops */
-static void PixmapFillSpans(DrawablePtr, GCPtr, int, DDXPointPtr, int *,
- int);
-static void PixmapSetSpans(DrawablePtr, GCPtr, char *, DDXPointPtr,
- int *, int, int);
-static void PixmapPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
- int, int, char *);
-static void PixmapPushPixels(GCPtr, PixmapPtr, DrawablePtr, int, int,
- int, int);
-static RegionPtr PixmapCopyArea(DrawablePtr, DrawablePtr, GCPtr, int, int,
- int, int, int, int);
-static RegionPtr PixmapCopyPlane(DrawablePtr, DrawablePtr, GCPtr, int, int,
- int, int, int, int, unsigned long);
-static void PixmapPolyPoint(DrawablePtr, GCPtr, int, int, xPoint *);
-static void PixmapPolylines(DrawablePtr, GCPtr, int, int, DDXPointPtr);
-static void PixmapPolySegment(DrawablePtr, GCPtr, int, xSegment *);
-static void PixmapPolyRectangle(DrawablePtr, GCPtr, int, xRectangle *);
-static void PixmapPolyArc(DrawablePtr, GCPtr, int, xArc *);
-static void PixmapFillPolygon(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
-static void PixmapPolyFillRect(DrawablePtr, GCPtr, int, xRectangle *);
-static void PixmapPolyFillArc(DrawablePtr, GCPtr, int, xArc *);
-static int PixmapPolyText8(DrawablePtr, GCPtr, int, int, int, char *);
-static int PixmapPolyText16(DrawablePtr, GCPtr, int, int, int,
- unsigned short *);
-static void PixmapImageText8(DrawablePtr, GCPtr, int, int, int, char *);
-static void PixmapImageText16(DrawablePtr, GCPtr, int, int, int,
- unsigned short *);
-static void PixmapImageGlyphBlt(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr *, pointer);
-static void PixmapPolyGlyphBlt(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr *, pointer);
-
-static GCOps PixmapGCOps = {
- PixmapFillSpans, PixmapSetSpans,
- PixmapPutImage, PixmapCopyArea,
- PixmapCopyPlane, PixmapPolyPoint,
- PixmapPolylines, PixmapPolySegment,
- PixmapPolyRectangle, PixmapPolyArc,
- PixmapFillPolygon, PixmapPolyFillRect,
- PixmapPolyFillArc, PixmapPolyText8,
- PixmapPolyText16, PixmapImageText8,
- PixmapImageText16, PixmapImageGlyphBlt,
- PixmapPolyGlyphBlt, PixmapPushPixels,
- {NULL} /* devPrivate */
-};
-
-
-/** Window Ops **/
-static void WindowFillSpans(DrawablePtr, GCPtr, int, DDXPointPtr, int *,
- int);
-static void WindowSetSpans(DrawablePtr, GCPtr, char *, DDXPointPtr,
- int *, int, int);
-static void WindowPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
- int, int, char *);
-static void WindowPushPixels(GCPtr, PixmapPtr, DrawablePtr, int, int,
- int, int);
-static RegionPtr WindowCopyArea(DrawablePtr, DrawablePtr, GCPtr, int, int,
- int, int, int, int);
-static RegionPtr WindowCopyPlane(DrawablePtr, DrawablePtr, GCPtr, int, int,
- int, int, int, int, unsigned long);
-static void WindowPolyPoint(DrawablePtr, GCPtr, int, int, xPoint *);
-static void WindowPolylines(DrawablePtr, GCPtr, int, int, DDXPointPtr);
-static void WindowPolySegment(DrawablePtr, GCPtr, int, xSegment *);
-static void WindowPolyRectangle(DrawablePtr, GCPtr, int, xRectangle *);
-static void WindowPolyArc(DrawablePtr, GCPtr, int, xArc *);
-static void WindowFillPolygon(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
-static void WindowPolyFillRect(DrawablePtr, GCPtr, int, xRectangle *);
-static void WindowPolyFillArc(DrawablePtr, GCPtr, int, xArc *);
-static int WindowPolyText8(DrawablePtr, GCPtr, int, int, int, char *);
-static int WindowPolyText16(DrawablePtr, GCPtr, int, int, int,
- unsigned short *);
-static void WindowImageText8(DrawablePtr, GCPtr, int, int, int, char *);
-static void WindowImageText16(DrawablePtr, GCPtr, int, int, int,
- unsigned short *);
-static void WindowImageGlyphBlt(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr *, pointer);
-static void WindowPolyGlyphBlt(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr *, pointer);
-
-static GCOps WindowGCOps = {
- WindowFillSpans, WindowSetSpans,
- WindowPutImage, WindowCopyArea,
- WindowCopyPlane, WindowPolyPoint,
- WindowPolylines, WindowPolySegment,
- WindowPolyRectangle, WindowPolyArc,
- WindowFillPolygon, WindowPolyFillRect,
- WindowPolyFillArc, WindowPolyText8,
- WindowPolyText16, WindowImageText8,
- WindowImageText16, WindowImageGlyphBlt,
- WindowPolyGlyphBlt, WindowPushPixels,
- {NULL} /* devPrivate */
-};
-
-/** privates **/
-
-typedef struct {
- CloseScreenProcPtr CloseScreen;
- CreateGCProcPtr CreateGC;
- CreatePixmapProcPtr CreatePixmap;
- DestroyPixmapProcPtr DestroyPixmap;
- ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- int LockPrivate;
-} OverlayScreenRec, *OverlayScreenPtr;
-
-typedef struct {
- GCFuncs *wrapFuncs;
- GCOps *wrapOps;
- GCOps *overlayOps;
- unsigned long fg;
- unsigned long bg;
- unsigned long pm;
- PixmapPtr tile;
-} OverlayGCRec, *OverlayGCPtr;
-
-typedef struct {
- PixmapPtr pix32;
- CARD32 dirty;
-} OverlayPixmapRec, *OverlayPixmapPtr;
-
-
-static DevPrivateKey OverlayScreenKey = &OverlayScreenKey;
-static DevPrivateKey OverlayGCKey = &OverlayGCKey;
-static DevPrivateKey OverlayPixmapKey = &OverlayPixmapKey;
-
-/** Macros **/
-
-#define TILE_EXISTS(pGC) (!(pGC)->tileIsPixel && (pGC)->tile.pixmap)
-
-#define OVERLAY_GET_PIXMAP_PRIVATE(pPix) ((OverlayPixmapPtr) \
- dixLookupPrivate(&(pPix)->devPrivates, OverlayPixmapKey))
-
-#define OVERLAY_GET_SCREEN_PRIVATE(pScreen) ((OverlayScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, OverlayScreenKey))
-
-#define OVERLAY_GET_GC_PRIVATE(pGC) ((OverlayGCPtr) \
- dixLookupPrivate(&(pGC)->devPrivates, OverlayGCKey))
-
-#define OVERLAY_GC_FUNC_PROLOGUE(pGC)\
- OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
- (pGC)->funcs = pGCPriv->wrapFuncs;\
- if(pGCPriv->overlayOps) \
- (pGC)->ops = pGCPriv->wrapOps
-
-#define OVERLAY_GC_FUNC_EPILOGUE(pGC)\
- pGCPriv->wrapFuncs = (pGC)->funcs;\
- (pGC)->funcs = &OverlayGCFuncs;\
- if(pGCPriv->overlayOps) { \
- pGCPriv->wrapOps = (pGC)->ops;\
- (pGC)->ops = pGCPriv->overlayOps;\
- }
-
-#define WINDOW_GC_OP_PROLOGUE(pGC)\
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE((pGC)->pScreen);\
- OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
- unsigned long oldfg = (pGC)->fgPixel;\
- unsigned long oldbg = (pGC)->bgPixel;\
- unsigned long oldpm = (pGC)->planemask;\
- PixmapPtr oldtile = (pGC)->tile.pixmap;\
- (pGC)->fgPixel = pGCPriv->fg;\
- (pGC)->bgPixel = pGCPriv->bg;\
- (pGC)->planemask = pGCPriv->pm;\
- if(pGCPriv->tile) (pGC)->tile.pixmap = pGCPriv->tile;\
- (pGC)->funcs = pGCPriv->wrapFuncs;\
- (pGC)->ops = pGCPriv->wrapOps;\
- pScreenPriv->LockPrivate++
-
-
-#define WINDOW_GC_OP_EPILOGUE(pGC)\
- pGCPriv->wrapOps = (pGC)->ops;\
- pGCPriv->wrapFuncs = (pGC)->funcs;\
- (pGC)->fgPixel = oldfg;\
- (pGC)->bgPixel = oldbg;\
- (pGC)->planemask = oldpm;\
- (pGC)->tile.pixmap = oldtile;\
- (pGC)->funcs = &OverlayGCFuncs;\
- (pGC)->ops = &WindowGCOps;\
- pScreenPriv->LockPrivate--
-
-
-#define PIXMAP_GC_OP_PROLOGUE(pGC)\
- OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
- OverlayPixmapPtr pPixPriv = OVERLAY_GET_PIXMAP_PRIVATE((PixmapPtr)pDraw);\
- pGC->funcs = pGCPriv->wrapFuncs;\
- pGC->ops = pGCPriv->wrapOps
-
-#define PIXMAP_GC_OP_EPILOGUE(pGC)\
- pGCPriv->wrapOps = pGC->ops;\
- pGC->funcs = &OverlayGCFuncs;\
- pGC->ops = &PixmapGCOps;\
- pPixPriv->dirty |= IS_DIRTY
-
-
-Bool
-xf86Overlay8Plus32Init (ScreenPtr pScreen)
-{
- OverlayScreenPtr pScreenPriv;
-
- if (!dixRequestPrivate(OverlayGCKey, sizeof(OverlayGCRec)))
- return FALSE;
-
- if (!dixRequestPrivate(OverlayPixmapKey, sizeof(OverlayPixmapRec)))
- return FALSE;
-
- if (!(pScreenPriv = xalloc(sizeof(OverlayScreenRec))))
- return FALSE;
-
- dixSetPrivate(&pScreen->devPrivates, OverlayScreenKey, pScreenPriv);
-
- pScreenPriv->CreateGC = pScreen->CreateGC;
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreenPriv->CreatePixmap = pScreen->CreatePixmap;
- pScreenPriv->DestroyPixmap = pScreen->DestroyPixmap;
- pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
-
- pScreen->CreateGC = OverlayCreateGC;
- pScreen->CloseScreen = OverlayCloseScreen;
- pScreen->CreatePixmap = OverlayCreatePixmap;
- pScreen->DestroyPixmap = OverlayDestroyPixmap;
- pScreen->ChangeWindowAttributes = OverlayChangeWindowAttributes;
-
- pScreenPriv->LockPrivate = 0;
-
- /* allocate the key in the default map */
- if(pScreen->defColormap) {
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ColormapPtr pmap;
- xColorItem color;
-
- pmap = (ColormapPtr)LookupIDByType(pScreen->defColormap, RT_COLORMAP);
-
- pmap->red[pScrn->colorKey].refcnt = AllocPrivate;
- pmap->red[pScrn->colorKey].fShared = FALSE;
- pmap->freeRed--;
-
- color.red = color.blue = color.green = 0;
- color.pixel = pScrn->colorKey;
- color.flags = DoRed | DoGreen | DoBlue;
-
- StoreColors(pmap, 1, &color);
- }
-
- return TRUE;
-}
-
-
-/*********************** Screen Funcs ***********************/
-
-Bool
-OverlayCreateGC(GCPtr pGC)
-{
- ScreenPtr pScreen = pGC->pScreen;
- OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
- Bool ret;
-
- pScreen->CreateGC = pScreenPriv->CreateGC;
-
- if((ret = (*pScreen->CreateGC)(pGC)) && (pGC->depth != 1)) {
- pGCPriv->wrapFuncs = pGC->funcs;
- pGC->funcs = &OverlayGCFuncs;
- pGCPriv->wrapOps = NULL;
- pGCPriv->overlayOps = NULL;
- pGCPriv->tile = NULL;
- }
-
- pScreen->CreateGC = OverlayCreateGC;
-
- return ret;
-}
-
-static PixmapPtr
-OverlayCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint)
-{
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
- PixmapPtr pPix;
-
- pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
- pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
- pScreen->CreatePixmap = OverlayCreatePixmap;
-
- /* We initialize all the privates */
- if(pPix) {
- OverlayPixmapPtr pPriv = OVERLAY_GET_PIXMAP_PRIVATE(pPix);
- pPriv->pix32 = NULL;
- pPriv->dirty = IS_DIRTY;
- if(!w || !h)
- pPriv->dirty |= IS_SHARED;
- }
-
- return pPix;
-}
-
-static Bool
-OverlayDestroyPixmap(PixmapPtr pPix)
-{
- ScreenPtr pScreen = pPix->drawable.pScreen;
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
- Bool result;
-
- pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
-
- if((pPix->refcnt == 1) && (pPix->drawable.bitsPerPixel == 8)) {
- OverlayPixmapPtr pPriv = OVERLAY_GET_PIXMAP_PRIVATE(pPix);
- if(pPriv->pix32) {
- if(pPriv->pix32->refcnt != 1)
- ErrorF("Warning! private pix refcnt = %i\n", pPriv->pix32->refcnt);
- (*pScreen->DestroyPixmap)(pPriv->pix32);
- }
- pPriv->pix32 = NULL;
- }
-
- result = (*pScreen->DestroyPixmap) (pPix);
- pScreen->DestroyPixmap = OverlayDestroyPixmap;
-
- return result;
-}
-
-static Bool
-OverlayCloseScreen (int i, ScreenPtr pScreen)
-{
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
-
- pScreen->CreateGC = pScreenPriv->CreateGC;
- pScreen->CloseScreen = pScreenPriv->CloseScreen;
- pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
- pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
- pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
-
- xfree ((pointer) pScreenPriv);
-
- return (*pScreen->CloseScreen) (i, pScreen);
-}
-
-
-
-static Bool
-OverlayChangeWindowAttributes (WindowPtr pWin, unsigned long mask)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
- Bool result;
-
- if(pWin->drawable.depth == 8) {
- if((mask & CWBackPixmap) &&
- (pWin->backgroundState == BackgroundPixmap))
- OverlayRefreshPixmap(pWin->background.pixmap);
-
- if((mask & CWBorderPixmap) && !pWin->borderIsPixel)
- OverlayRefreshPixmap(pWin->border.pixmap);
- }
-
- pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
- result = (*pScreen->ChangeWindowAttributes) (pWin, mask);
- pScreen->ChangeWindowAttributes = OverlayChangeWindowAttributes;
-
- return result;
-}
-
-/*********************** GC Funcs *****************************/
-
-
-static PixmapPtr
-OverlayRefreshPixmap(PixmapPtr pix8)
-{
- OverlayPixmapPtr pixPriv = OVERLAY_GET_PIXMAP_PRIVATE(pix8);
- ScreenPtr pScreen = pix8->drawable.pScreen;
-
- if(!pixPriv->pix32) {
- PixmapPtr newPix;
-
- newPix = (*pScreen->CreatePixmap)(pScreen, pix8->drawable.width,
- pix8->drawable.height, 24, 0);
- newPix->drawable.depth = 8; /* Bad Mark! Bad Mark! */
- pixPriv->pix32 = newPix;
- }
-
- if(pixPriv->dirty) {
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
- GCPtr pGC;
-
- pGC = GetScratchGC(8, pScreen);
-
- pScreenPriv->LockPrivate++; /* don't modify this one */
- ValidateGC((DrawablePtr)pixPriv->pix32, pGC);
-
- (*pGC->ops->CopyArea)((DrawablePtr)pix8, (DrawablePtr)pixPriv->pix32,
- pGC, 0, 0, pix8->drawable.width, pix8->drawable.height, 0, 0);
- pScreenPriv->LockPrivate--;
- FreeScratchGC(pGC);
-
- pixPriv->dirty &= ~IS_DIRTY;
- pixPriv->pix32->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- }
-
- return pixPriv->pix32;
-}
-
-
-static void
-OverlayValidateGC(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-){
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pGC->pScreen);
- OVERLAY_GC_FUNC_PROLOGUE (pGC);
-
- if(pScreenPriv->LockPrivate < 0) {
- ErrorF("Something is wrong in OverlayValidateGC!\n");
- pScreenPriv->LockPrivate = 0;
- }
-
- if(pGC->depth == 24) {
- unsigned long oldpm = pGC->planemask;
- pGCPriv->overlayOps = NULL;
-
- if(pDraw->type == DRAWABLE_WINDOW)
- pGC->planemask &= 0x00ffffff;
- else
- pGC->planemask |= 0xff000000;
-
- if(oldpm != pGC->planemask) changes |= GCPlaneMask;
-
- (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
-
- } else { /* depth == 8 */
- unsigned long newChanges = 0;
-
- if(pDraw->bitsPerPixel == 32) {
-
- if(pGC->fillStyle == FillTiled)
- pGCPriv->tile = OverlayRefreshPixmap(pGC->tile.pixmap);
- else pGCPriv->tile = NULL;
-
- if(pGCPriv->overlayOps != &WindowGCOps) {
- newChanges = GCForeground | GCBackground | GCPlaneMask;
- if(pGCPriv->tile)
- newChanges |= GCTile;
- }
- pGCPriv->overlayOps = &WindowGCOps;
-
- if(!pScreenPriv->LockPrivate) {
- unsigned long oldfg = pGC->fgPixel;
- unsigned long oldbg = pGC->bgPixel;
- unsigned long oldpm = pGC->planemask;
- PixmapPtr oldtile = pGC->tile.pixmap;
-
- pGC->fgPixel = pGCPriv->fg = oldfg << 24;
- pGC->bgPixel = pGCPriv->bg = oldbg << 24;
- pGC->planemask = pGCPriv->pm = oldpm << 24;
- if(pGCPriv->tile)
- pGC->tile.pixmap = pGCPriv->tile;
-
- (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw);
-
- pGC->fgPixel = oldfg;
- pGC->bgPixel = oldbg;
- pGC->planemask = oldpm;
- pGC->tile.pixmap = oldtile;
- } else {
- pGCPriv->fg = pGC->fgPixel;
- pGCPriv->bg = pGC->bgPixel;
- pGCPriv->pm = pGC->planemask;
-
- (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw);
- }
-
- } else { /* bitsPerPixel == 8 */
- if(pGCPriv->overlayOps == &WindowGCOps) {
- newChanges = GCForeground | GCBackground | GCPlaneMask;
- if(pGCPriv->tile)
- newChanges |= GCTile;
- }
- pGCPriv->overlayOps = &PixmapGCOps;
-
- (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw);
- }
- }
-
- OVERLAY_GC_FUNC_EPILOGUE (pGC);
-}
-
-
-static void
-OverlayDestroyGC(GCPtr pGC)
-{
- OVERLAY_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->DestroyGC)(pGC);
- OVERLAY_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-OverlayChangeGC (
- GCPtr pGC,
- unsigned long mask
-){
- OVERLAY_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeGC) (pGC, mask);
- OVERLAY_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-OverlayCopyGC (
- GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst
-){
- OVERLAY_GC_FUNC_PROLOGUE (pGCDst);
- (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
- OVERLAY_GC_FUNC_EPILOGUE (pGCDst);
-}
-static void
-OverlayChangeClip (
- GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects
-){
- OVERLAY_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
- OVERLAY_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-OverlayCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
- OVERLAY_GC_FUNC_PROLOGUE (pgcDst);
- (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
- OVERLAY_GC_FUNC_EPILOGUE (pgcDst);
-}
-
-static void
-OverlayDestroyClip(GCPtr pGC)
-{
- OVERLAY_GC_FUNC_PROLOGUE (pGC);
- (* pGC->funcs->DestroyClip)(pGC);
- OVERLAY_GC_FUNC_EPILOGUE (pGC);
-}
-
-
-
-/******************* Window GC ops ***********************/
-
-static void
-WindowFillSpans(
- DrawablePtr pDraw,
- GC *pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int fSorted
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowSetSpans(
- DrawablePtr pDraw,
- GCPtr pGC,
- char *pcharsrc,
- register DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static RegionPtr
-WindowCopyArea(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-){
- RegionPtr ret;
-
- WINDOW_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->CopyArea)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty);
- WINDOW_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static RegionPtr
-WindowCopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
- RegionPtr ret;
-
- WINDOW_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
- WINDOW_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static void
-WindowPolyPoint(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- xPoint *pptInit
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolylines(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolySegment(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolyRectangle(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolyArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowFillPolygon(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolyFillRect(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolyFillArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static int
-WindowPolyText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- int ret;
-
- WINDOW_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
- WINDOW_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static int
-WindowPolyText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- int ret;
-
- WINDOW_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
- WINDOW_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static void
-WindowImageText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowImageText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowImageGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
- ppci, pglyphBase);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolyGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
- ppci, pglyphBase);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPushPixels(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy, int xOrg, int yOrg
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-
-/******************* Pixmap GC ops ***********************/
-
-static void
-PixmapFillSpans(
- DrawablePtr pDraw,
- GC *pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int fSorted
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapSetSpans(
- DrawablePtr pDraw,
- GCPtr pGC,
- char *pcharsrc,
- register DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static RegionPtr
-PixmapCopyArea(
- DrawablePtr pSrc,
- DrawablePtr pDraw,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-){
- RegionPtr ret;
-
- PIXMAP_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->CopyArea)(pSrc, pDraw,
- pGC, srcx, srcy, width, height, dstx, dsty);
- PIXMAP_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static RegionPtr
-PixmapCopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDraw,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
- RegionPtr ret;
-
- PIXMAP_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->CopyPlane)(pSrc, pDraw,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
- PIXMAP_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static void
-PixmapPolyPoint(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- xPoint *pptInit
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolylines(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolySegment(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolyRectangle(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolyArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapFillPolygon(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolyFillRect(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolyFillArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static int
-PixmapPolyText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- int ret;
-
- PIXMAP_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
- PIXMAP_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static int
-PixmapPolyText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- int ret;
-
- PIXMAP_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
- PIXMAP_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static void
-PixmapImageText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapImageText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapImageGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
- ppci, pglyphBase);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolyGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
- ppci, pglyphBase);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPushPixels(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy, int xOrg, int yOrg
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-
diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c
index 774e00eb5..f892dc173 100644
--- a/hw/xgl/egl/kinput.c
+++ b/hw/xgl/egl/kinput.c
@@ -977,7 +977,7 @@ KdClassifyInput (KdMouseInfo *mi, xEvent *ev)
return keyboard;
}
-#ifndef NDEBUG
+#ifdef DEBUG
char *kdStateNames[] = {
"start",
"button_1_pend",
@@ -1010,7 +1010,7 @@ char *kdActionNames[] = {
"gen_down_2",
"gen_up_2",
};
-#endif
+#endif /* DEBUG */
static void
KdQueueEvent (xEvent *ev)
diff --git a/hw/xnest/Args.c b/hw/xnest/Args.c
index f061f9e80..209f175ab 100644
--- a/hw/xnest/Args.c
+++ b/hw/xnest/Args.c
@@ -57,11 +57,6 @@ void ddxInitGlobals(void)
extern Bool noCompositeExtension;
noCompositeExtension = TRUE;
#endif
-
-#ifdef XKB
- extern Bool noXkbExtension;
- noXkbExtension = TRUE;
-#endif
}
int
diff --git a/hw/xprint/Makefile.am b/hw/xprint/Makefile.am
index 1b8004841..2ed7aaf57 100644
--- a/hw/xprint/Makefile.am
+++ b/hw/xprint/Makefile.am
@@ -3,7 +3,7 @@ SUBDIRS = doc pcl pcl-mono raster ps etc config
bin_PROGRAMS = Xprt
Xprt_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ \
- -DXPRINT -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \
+ -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \
-DXPRINTDIR=\"$(libdir)/X11/xserver\" \
-DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX \
-DXFree86Server
@@ -17,6 +17,7 @@ XPRINT_LIBS = \
pcl-mono/libpcl.la \
$(top_builddir)/fb/libfb.la \
$(top_builddir)/render/librender.la \
+ $(top_builddir)/dix/libXpdix.la \
$(XSERVER_LIBS) \
$(top_builddir)/Xext/libXext.la \
$(top_builddir)/xkb/libxkb.la \
diff --git a/hw/xprint/ps/psout.h b/hw/xprint/ps/psout.h
index 3e19d5a67..1138e4afe 100644
--- a/hw/xprint/ps/psout.h
+++ b/hw/xprint/ps/psout.h
@@ -169,7 +169,7 @@ typedef signed __int64 PsOutColor;
defined(ia64) || defined(__ia64__) || \
defined(__sparc64__) || defined(_LP64) || \
defined(__s390x__) || \
- defined(amd64) || defined (__amd64__) || \
+ defined(amd64) || defined (__amd64__) || defined(__x86_64__) || \
defined (__powerpc64__) || \
(defined(sgi) && (_MIPS_SZLONG == 64))
typedef signed long PsOutColor;
diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 075382476..1c97ac8f2 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -25,7 +25,6 @@ libXquartz_la_SOURCES = \
applewm.c \
darwin.c \
darwinEvents.c \
- darwinKeyboard.c \
darwinXinput.c \
keysym2ucs.c \
pseudoramiX.c \
@@ -35,7 +34,8 @@ libXquartz_la_SOURCES = \
quartzForeground.c \
quartzKeyboard.c \
quartzPasteboard.c \
- quartzStartup.c
+ quartzStartup.c \
+ threadSafety.c
EXTRA_DIST = \
X11Application.h \
@@ -44,7 +44,6 @@ EXTRA_DIST = \
darwinClut8.h \
darwin.h \
darwinEvents.h \
- darwinKeyboard.h \
keysym2ucs.h \
pseudoramiX.h \
quartz.h \
@@ -52,4 +51,5 @@ EXTRA_DIST = \
quartzCommon.h \
quartzForeground.h \
quartzKeyboard.h \
- quartzPasteboard.h
+ quartzPasteboard.h \
+ threadSafety.h
diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index ea9a6b758..47c605c67 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -32,7 +32,6 @@
#if __OBJC__
-#import <Cocoa/Cocoa.h>
#import "X11Controller.h"
@interface X11Application : NSApplication {
@@ -56,7 +55,7 @@
- (void) prefs_set_string:(NSString *)key value:(NSString *)value;
- (void) prefs_synchronize;
-- (BOOL) x_active;
+- (OSX_BOOL) x_active;
@end
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 2844fca10..265819af6 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -27,34 +27,26 @@
promote the sale, use or other dealings in this Software without
prior written authorization. */
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include "quartzCommon.h"
#include "quartzForeground.h"
-
+#include "quartzCommon.h"
#import "X11Application.h"
-#include <Carbon/Carbon.h>
-/* ouch! */
-#define BOOL X_BOOL
# include "darwin.h"
# include "darwinEvents.h"
# include "quartz.h"
# define _APPLEWM_SERVER_
# include "X11/extensions/applewm.h"
# include "micmap.h"
-#undef BOOL
-
#include <mach/mach.h>
#include <unistd.h>
#include <pthread.h>
-#include "rootlessCommon.h"
-
-WindowPtr xprGetXWindowFromAppKit(int windowNumber); // xpr/xprFrame.c
-
#define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist"
int X11EnableKeyEquivalents = TRUE;
@@ -159,7 +151,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
[self orderFrontStandardAboutPanelWithOptions: dict];
}
-- (void) activateX:(BOOL)state {
+- (void) activateX:(OSX_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) */
@@ -193,7 +185,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
- (void) sendEvent:(NSEvent *)e {
NSEventType type;
- BOOL for_appkit, for_x;
+ OSX_BOOL for_appkit, for_x;
type = [e type];
@@ -210,8 +202,6 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
if (_x_active) [self activateX:NO];
} else if ([self modalWindow] == nil) {
/* Must be an X window. Tell appkit it doesn't have focus. */
- WindowPtr pWin = xprGetXWindowFromAppKit([e windowNumber]);
- if (pWin) RootlessReorderWindow(pWin);
for_appkit = NO;
if ([self isActive]) {
@@ -244,9 +234,6 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|| [e keyCode] == 53 /*Esc*/)) {
swallow_up = 0;
for_x = NO;
-#ifdef DARWIN_DDX_MISSING
- DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
-#endif
}
} else {
/* If we saw a key equivalent on the down, don't pass
@@ -277,7 +264,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
_appFlags._active = YES;
[self activateX:YES];
- if ([e data2] & 0x10) X11ApplicationSetFrontProcess();
+ if ([e data2] & 0x10)
+ DarwinSendDDXEvent(kXquartzBringAllToFront, 0);
}
break;
@@ -647,8 +635,8 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
if(darwinDesiredDepth == 8)
darwinDesiredDepth = -1;
- enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO
- default:false];
+// enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO
+// default:false];
}
/* This will end up at the end of the responder chain. */
@@ -657,7 +645,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
AppleWMCopyToPasteboard);
}
-- (BOOL) x_active {
+- (OSX_BOOL) x_active {
return _x_active;
}
@@ -744,7 +732,7 @@ void X11ApplicationShowHideMenubar (int state) {
[n release];
}
-static void * create_thread (void *func, void *arg) {
+static pthread_t create_thread (void *func, void *arg) {
pthread_attr_t attr;
pthread_t tid;
@@ -754,7 +742,7 @@ static void * create_thread (void *func, void *arg) {
pthread_create (&tid, &attr, func, arg);
pthread_attr_destroy (&attr);
- return (void *) tid;
+ return tid;
}
static void check_xinitrc (void) {
@@ -825,7 +813,10 @@ void X11ApplicationMain (int argc, const char **argv, void (*server_thread) (voi
aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) -
NSMaxY([[NSScreen mainScreen] visibleFrame]);
- if (!create_thread (server_thread, server_arg)) {
+ APPKIT_THREAD = pthread_self();
+ SERVER_THREAD = create_thread (server_thread, server_arg);
+
+ if (!SERVER_THREAD) {
ErrorF("can't create secondary thread\n");
exit (1);
}
@@ -905,7 +896,7 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
break;
case NSScrollWheel:
- DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y,
+ DarwinSendScrollEvents([e deltaX], [e deltaY], pointer_x, pointer_y,
pressure, tilt_x, tilt_y);
break;
diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index 8d6a38ff0..c5994bd1f 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -32,7 +32,7 @@
#if __OBJC__
-#import <Cocoa/Cocoa.h>
+#include "sanitizedCocoa.h"
#include "xpr/x-list.h"
@interface X11Controller : NSObject
@@ -67,14 +67,14 @@
int checked_window_item;
x_list *pending_apps;
- BOOL finished_launching;
- BOOL can_quit;
+ OSX_BOOL finished_launching;
+ OSX_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) set_can_quit:(OSX_BOOL)state;
- (void) server_ready;
- (IBAction) apps_table_show:(id)sender;
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index 5bf4f4d52..8dfe4b342 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -27,6 +27,8 @@
promote the sale, use or other dealings in this Software without
prior written authorization. */
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -37,17 +39,13 @@
#import "X11Controller.h"
#import "X11Application.h"
-#import <Carbon/Carbon.h>
-/* ouch! */
-#define BOOL X_BOOL
#include "opaque.h"
-# include "darwin.h"
-# include "quartz.h"
-# define _APPLEWM_SERVER_
-# include "X11/extensions/applewm.h"
-# include "applewmExt.h"
-#undef BOOL
+#include "darwin.h"
+#include "quartz.h"
+#define _APPLEWM_SERVER_
+#include "X11/extensions/applewm.h"
+#include "applewmExt.h"
#include <stdio.h>
#include <unistd.h>
@@ -602,7 +600,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
#endif
}
-- (void) set_can_quit:(BOOL)state
+- (void) set_can_quit:(OSX_BOOL)state
{
can_quit = state;
}
@@ -669,7 +667,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
AHLookupAnchor ((CFStringRef)NSLocalizedString(@"Mac Help", no comment), CFSTR ("mchlp2276"));
}
-- (BOOL) validateMenuItem:(NSMenuItem *)item
+- (OSX_BOOL) validateMenuItem:(NSMenuItem *)item
{
NSMenu *menu = [item menu];
@@ -692,24 +690,26 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMShowAll);
}
-- (NSApplicationTerminateReply) applicationShouldTerminate:sender
-{
- NSString *msg;
+- (NSApplicationTerminateReply) applicationShouldTerminate:sender {
+ NSString *msg;
+ NSString *title;
- if (can_quit || [X11App prefs_get_boolean:@PREFS_NO_QUIT_ALERT default:NO])
- return NSTerminateNow;
+ if (can_quit || [X11App prefs_get_boolean:@PREFS_NO_QUIT_ALERT default:NO])
+ return NSTerminateNow;
- /* Make sure we're frontmost. */
- [NSApp activateIgnoringOtherApps:YES];
+ /* 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.. */
+ title = NSLocalizedString(@"Do you really want to quit X11?", @"Dialog title when quitting");
+ msg = NSLocalizedString(@"Any open X11 applications will stop immediately, and you will lose any unsaved changes.", @"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;
+ return (NSRunAlertPanel (title, msg, NSLocalizedString (@"Quit", @""),
+ NSLocalizedString (@"Cancel", @""), nil)
+ == NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel;
}
- (void) applicationWillTerminate:(NSNotification *)aNotification
@@ -741,17 +741,17 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
pending_apps = NULL;
}
-- (BOOL) application:(NSApplication *)app openFile:(NSString *)filename
+- (OSX_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;
+ 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
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index 072e57ff4..ba86f1045 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -25,6 +25,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 002ea413d..aad55fc64 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -76,7 +76,7 @@
#include "darwin.h"
#include "darwinEvents.h"
-#include "darwinKeyboard.h"
+#include "quartzKeyboard.h"
#include "quartz.h"
//#include "darwinClut8.h"
@@ -142,6 +142,8 @@ const int NUMFORMATS = sizeof(formats)/sizeof(formats[0]);
#define XORG_RELEASE "?"
#endif
+const char *__crashreporter_info__ = "X.Org X Server " XSERVER_VERSION "Build Date: " BUILD_DATE;
+
void DDXRingBell(int volume, int pitch, int duration) {
// FIXME -- make some noise, yo
}
@@ -333,42 +335,34 @@ static void DarwinChangePointerControl(
* DarwinMouseProc
* Handle the initialization, etc. of a mouse
*/
-static int DarwinMouseProc(
- DeviceIntPtr pPointer,
- int what )
-{
- CARD8 map[6];
-
+static int DarwinMouseProc(DeviceIntPtr pPointer, int what) {
+ CARD8 map[8] = {0, 1, 2, 3, 4, 5, 6, 7};
+
switch (what) {
-
+
case DEVICE_INIT:
pPointer->public.on = FALSE;
-
+
// Set button map.
- map[1] = 1;
- map[2] = 2;
- map[3] = 3;
- map[4] = 4;
- map[5] = 5;
- InitPointerDeviceStruct( (DevicePtr)pPointer, map, 5,
- GetMotionHistory,
- (PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), 5);
- InitProximityClassDeviceStruct( (DevicePtr)pPointer);
+ InitPointerDeviceStruct((DevicePtr)pPointer, map, 7,
+ GetMotionHistory,
+ (PtrCtrlProcPtr)NoopDDA,
+ GetMotionHistorySize(), 7);
+ InitProximityClassDeviceStruct(pPointer);
break;
-
+
case DEVICE_ON:
pPointer->public.on = TRUE;
AddEnabledDevice( darwinEventReadFD );
return Success;
-
+
case DEVICE_CLOSE:
case DEVICE_OFF:
pPointer->public.on = FALSE;
- RemoveEnabledDevice( darwinEventReadFD );
+ RemoveEnabledDevice(darwinEventReadFD);
return Success;
}
-
+
return Success;
}
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index df92d8b49..3231077be 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -34,6 +34,8 @@
#include <X11/extensions/XKB.h>
#include <assert.h>
+#include "threadSafety.h"
+
typedef struct {
void *framebuffer;
int x;
@@ -123,7 +125,7 @@ void DarwinSendDDXEvent(int type, int argc, ...);
#ifdef ENABLE_DEBUG_LOG
extern FILE *debug_log_fp;
#define DEBUG_LOG_NAME "x11-debug.txt"
-#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%x:%s:%s:%d " msg, pthread_self(), __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
+#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%s:%d " msg, threadSafetyID(pthread_self()), __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
#else
#define DEBUG_LOG(msg, args...)
#endif
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 3afbaf890..afa292fb8 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -1,7 +1,7 @@
/*
Darwin event queue and event handling
-Copyright 2007 Apple Inc.
+Copyright 2007-2008 Apple Inc.
Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved.
Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
@@ -30,6 +30,10 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xmd.h>
@@ -44,22 +48,29 @@ in this Software without prior written authorization from The Open Group.
#include "darwin.h"
#include "quartz.h"
-#include "darwinKeyboard.h"
+#include "quartzKeyboard.h"
#include "darwinEvents.h"
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
+#include <pthread.h>
+#include <errno.h>
+
#include <IOKit/hidsystem/IOLLEvent.h>
+/* Fake button press/release for scroll wheel move. */
+#define SCROLLWHEELUPFAKE 4
+#define SCROLLWHEELDOWNFAKE 5
+#define SCROLLWHEELLEFTFAKE 6
+#define SCROLLWHEELRIGHTFAKE 7
+
#define _APPLEWM_SERVER_
#include "applewmExt.h"
#include <X11/extensions/applewm.h>
-
-/* Fake button press/release for scroll wheel move. */
-#define SCROLLWHEELUPFAKE 4
-#define SCROLLWHEELDOWNFAKE 5
+/* FIXME: Abstract this better */
+void QuartzModeEQInit(void);
int input_check_zero, input_check_flag;
@@ -67,6 +78,25 @@ static int old_flags = 0; // last known modifier state
xEvent *darwinEvents = NULL;
+pthread_mutex_t mieqEnqueue_mutex;
+static inline void mieqEnqueue_lock(void) {
+ int err;
+ if((err = pthread_mutex_lock(&mieqEnqueue_mutex))) {
+ ErrorF("%s:%s:%d: Failed to lock mieqEnqueue_mutex: %d\n",
+ __FILE__, __FUNCTION__, __LINE__, err);
+ spewCallStack();
+ }
+}
+
+static inline void mieqEnqueue_unlock(void) {
+ int err;
+ if((err = pthread_mutex_unlock(&mieqEnqueue_mutex))) {
+ ErrorF("%s:%s:%d: Failed to unlock mieqEnqueue_mutex: %d\n",
+ __FILE__, __FUNCTION__, __LINE__, err);
+ spewCallStack();
+ }
+}
+
/*
* DarwinPressModifierMask
* Press or release the given modifier key, specified by its mask.
@@ -186,108 +216,104 @@ static void DarwinSimulateMouseClick(
be moved into their own individual functions and set as handlers using
mieqSetHandler. */
-void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
- int i;
-
- DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents);
- for (i=0; i<nevents; i++) {
- switch(xe[i].u.u.type) {
- case kXquartzControllerNotify:
- DEBUG_LOG("kXquartzControllerNotify\n");
- AppleWMSendEvent(AppleWMControllerNotify,
- AppleWMControllerNotifyMask,
- xe[i].u.clientMessage.u.l.longs0,
- xe[i].u.clientMessage.u.l.longs1);
- break;
-
- case kXquartzPasteboardNotify:
- DEBUG_LOG("kXquartzPasteboardNotify\n");
- AppleWMSendEvent(AppleWMPasteboardNotify,
- AppleWMPasteboardNotifyMask,
- xe[i].u.clientMessage.u.l.longs0,
- xe[i].u.clientMessage.u.l.longs1);
- break;
-
- case kXquartzActivate:
- DEBUG_LOG("kXquartzActivate\n");
- QuartzShow(xe[i].u.keyButtonPointer.rootX,
- xe[i].u.keyButtonPointer.rootY);
- AppleWMSendEvent(AppleWMActivationNotify,
- AppleWMActivationNotifyMask,
- AppleWMIsActive, 0);
- break;
-
- case kXquartzDeactivate:
- DEBUG_LOG("kXquartzDeactivate\n");
- DarwinReleaseModifiers();
- AppleWMSendEvent(AppleWMActivationNotify,
- AppleWMActivationNotifyMask,
- AppleWMIsInactive, 0);
- QuartzHide();
- break;
-
- case kXquartzWindowState:
- DEBUG_LOG("kXquartzWindowState\n");
- RootlessNativeWindowStateChanged(xe[i].u.clientMessage.u.l.longs0,
- xe[i].u.clientMessage.u.l.longs1);
- break;
-
- case kXquartzWindowMoved:
- DEBUG_LOG("kXquartzWindowMoved\n");
- RootlessNativeWindowMoved ((WindowPtr)xe[i].u.clientMessage.u.l.longs0);
- break;
-
- case kXquartzToggleFullscreen:
- DEBUG_LOG("kXquartzToggleFullscreen\n");
+static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
+ int i;
+
+ TA_SERVER();
+
+ DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents);
+ for (i=0; i<nevents; i++) {
+ switch(xe[i].u.u.type) {
+ case kXquartzControllerNotify:
+ DEBUG_LOG("kXquartzControllerNotify\n");
+ AppleWMSendEvent(AppleWMControllerNotify,
+ AppleWMControllerNotifyMask,
+ xe[i].u.clientMessage.u.l.longs0,
+ xe[i].u.clientMessage.u.l.longs1);
+ break;
+
+ case kXquartzPasteboardNotify:
+ DEBUG_LOG("kXquartzPasteboardNotify\n");
+ AppleWMSendEvent(AppleWMPasteboardNotify,
+ AppleWMPasteboardNotifyMask,
+ xe[i].u.clientMessage.u.l.longs0,
+ xe[i].u.clientMessage.u.l.longs1);
+ break;
+
+ case kXquartzActivate:
+ DEBUG_LOG("kXquartzActivate\n");
+ QuartzShow(xe[i].u.keyButtonPointer.rootX,
+ xe[i].u.keyButtonPointer.rootY);
+ AppleWMSendEvent(AppleWMActivationNotify,
+ AppleWMActivationNotifyMask,
+ AppleWMIsActive, 0);
+ break;
+
+ case kXquartzDeactivate:
+ DEBUG_LOG("kXquartzDeactivate\n");
+ DarwinReleaseModifiers();
+ AppleWMSendEvent(AppleWMActivationNotify,
+ AppleWMActivationNotifyMask,
+ AppleWMIsInactive, 0);
+ QuartzHide();
+ break;
+
+ case kXquartzToggleFullscreen:
+ DEBUG_LOG("kXquartzToggleFullscreen\n");
#ifdef DARWIN_DDX_MISSING
- if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot);
- else if (quartzHasRoot) QuartzHide();
- else QuartzShow();
+ if (quartzEnableRootless)
+ QuartzSetFullscreen(!quartzHasRoot);
+ else if (quartzHasRoot)
+ QuartzHide();
+ else
+ QuartzShow();
#else
- // ErrorF("kXquartzToggleFullscreen not implemented\n");
+ // ErrorF("kXquartzToggleFullscreen not implemented\n");
#endif
- break;
-
- case kXquartzSetRootless:
- DEBUG_LOG("kXquartzSetRootless\n");
+ break;
+
+ case kXquartzSetRootless:
+ DEBUG_LOG("kXquartzSetRootless\n");
#ifdef DARWIN_DDX_MISSING
- QuartzSetRootless(xe[i].u.clientMessage.u.l.longs0);
- if (!quartzEnableRootless && !quartzHasRoot) QuartzHide();
+ QuartzSetRootless(xe[i].u.clientMessage.u.l.longs0);
+ if (!quartzEnableRootless && !quartzHasRoot)
+ QuartzHide();
#else
- // ErrorF("kXquartzSetRootless not implemented\n");
+ // ErrorF("kXquartzSetRootless not implemented\n");
#endif
- break;
-
- case kXquartzSetRootClip:
- QuartzSetRootClip((BOOL)xe[i].u.clientMessage.u.l.longs0);
- break;
-
- case kXquartzQuit:
- GiveUp(0);
- break;
-
- case kXquartzBringAllToFront:
- DEBUG_LOG("kXquartzBringAllToFront\n");
- RootlessOrderAllWindows();
- break;
-
- case kXquartzSpaceChanged:
- DEBUG_LOG("kXquartzSpaceChanged\n");
- QuartzSpaceChanged(xe[i].u.clientMessage.u.l.longs0);
-
- break;
- default:
- ErrorF("Unknown application defined event type %d.\n", xe[i].u.u.type);
+ break;
+
+ case kXquartzSetRootClip:
+ QuartzSetRootClip((Bool)xe[i].u.clientMessage.u.l.longs0);
+ break;
+
+ case kXquartzQuit:
+ GiveUp(0);
+ break;
+
+ case kXquartzSpaceChanged:
+ DEBUG_LOG("kXquartzSpaceChanged\n");
+ QuartzSpaceChanged(xe[i].u.clientMessage.u.l.longs0);
+ break;
+
+ default:
+ ErrorF("Unknown application defined event type %d.\n", xe[i].u.u.type);
}
- }
+ }
}
Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
+ int err;
+
if (!darwinEvents)
darwinEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
if (!darwinEvents)
FatalError("Couldn't allocate event buffer\n");
+ if((err = pthread_mutex_init(&mieqEnqueue_mutex, NULL))) {
+ FatalError("Couldn't allocate mieqEnqueue mutex: %d.\n", err);
+ }
+
mieqInit();
mieqSetHandler(kXquartzReloadKeymap, DarwinKeyboardReloadHandler);
mieqSetHandler(kXquartzActivate, DarwinEventHandler);
@@ -295,16 +321,16 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
mieqSetHandler(kXquartzSetRootClip, DarwinEventHandler);
mieqSetHandler(kXquartzQuit, DarwinEventHandler);
mieqSetHandler(kXquartzReadPasteboard, QuartzReadPasteboard);
- mieqSetHandler(kXquartzWritePasteboard, QuartzWritePasteboard);
+ mieqSetHandler(kXquartzWritePasteboard, QuartzWritePasteboard);
mieqSetHandler(kXquartzToggleFullscreen, DarwinEventHandler);
mieqSetHandler(kXquartzSetRootless, DarwinEventHandler);
mieqSetHandler(kXquartzSpaceChanged, DarwinEventHandler);
mieqSetHandler(kXquartzControllerNotify, DarwinEventHandler);
mieqSetHandler(kXquartzPasteboardNotify, DarwinEventHandler);
mieqSetHandler(kXquartzDisplayChanged, QuartzDisplayChangedHandler);
- mieqSetHandler(kXquartzWindowState, DarwinEventHandler);
- mieqSetHandler(kXquartzWindowMoved, DarwinEventHandler);
+ QuartzModeEQInit();
+
return TRUE;
}
@@ -314,40 +340,38 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
*/
void ProcessInputEvents(void) {
xEvent xe;
- // button number and modifier mask of currently pressed fake button
- input_check_flag=0;
+ int x = sizeof(xe);
+
+ TA_SERVER();
- // ErrorF("calling mieqProcessInputEvents\n");
mieqProcessInputEvents();
// Empty the signaling pipe
- int x = sizeof(xe);
while (x == sizeof(xe)) {
-// DEBUG_LOG("draining pipe\n");
x = read(darwinEventReadFD, &xe, sizeof(xe));
}
}
/* 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);
+static void DarwinPokeEQ(void) {
+ char nullbyte=0;
+ input_check_flag++;
+ // <daniels> oh, i ... er ... christ.
+ write(darwinEventWriteFD, &nullbyte, 1);
}
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y,
float pressure, float tilt_x, float tilt_y) {
- static int darwinFakeMouseButtonDown = 0;
- static int darwinFakeMouseButtonMask = 0;
- int i, num_events;
+ static int darwinFakeMouseButtonDown = 0;
+ static int darwinFakeMouseButtonMask = 0;
+ int i, num_events;
if(!darwinEvents) {
ErrorF("DarwinSendPointerEvents called before darwinEvents was initialized\n");
return;
}
- /* I can't find a spec for this, but at least GTK expects that tablets are
+ /* I can't find a spec for this, but at least GTK expects that tablets are
just like mice, except they have either one or three extra valuators, in this
order:
@@ -356,126 +380,135 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
we can't do that. Again, GTK seems to record the min/max of each valuator,
and then perform scaling back to float itself using that info. Soo.... */
- int valuators[5] = {pointer_x, pointer_y,
+ int valuators[5] = {pointer_x, pointer_y,
pressure * INT32_MAX * 1.0f,
tilt_x * INT32_MAX * 1.0f,
tilt_y * INT32_MAX * 1.0f};
- if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
- // Mimic multi-button mouse with modifier-clicks
- // If both sets of modifiers are pressed,
- // button 2 is clicked.
- if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) {
- DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
+ if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
+ // Mimic multi-button mouse with modifier-clicks
+ // If both sets of modifiers are pressed,
+ // button 2 is clicked.
+ if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) {
+ DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
tilt_x, tilt_y, 2, darwinFakeMouse2Mask);
- darwinFakeMouseButtonDown = 2;
- darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
- return;
- } else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
- DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
+ darwinFakeMouseButtonDown = 2;
+ darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
+ return;
+ } else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
+ DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
tilt_x, tilt_y, 3, darwinFakeMouse3Mask);
- darwinFakeMouseButtonDown = 3;
- darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
- return;
- }
- }
- if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) {
- // If last mousedown was a fake click, don't check for
- // mouse modifiers here. The user may have released the
- // modifiers before the mouse button.
- ev_button = darwinFakeMouseButtonDown;
- darwinFakeMouseButtonDown = 0;
- // Bring modifiers back up to date
- DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags);
- darwinFakeMouseButtonMask = 0;
- return;
- }
-
- num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
- POINTER_ABSOLUTE, 0, 5, valuators);
-
- for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
- DarwinPokeEQ();
+ darwinFakeMouseButtonDown = 3;
+ darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
+ return;
+ }
+ }
+
+ if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) {
+ // If last mousedown was a fake click, don't check for
+ // mouse modifiers here. The user may have released the
+ // modifiers before the mouse button.
+ ev_button = darwinFakeMouseButtonDown;
+ darwinFakeMouseButtonDown = 0;
+ // Bring modifiers back up to date
+ DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags);
+ darwinFakeMouseButtonMask = 0;
+ return;
+ }
+
+ mieqEnqueue_lock(); {
+ num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
+ POINTER_ABSOLUTE, 0, 5, valuators);
+ for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
+ DarwinPokeEQ();
+
+ } mieqEnqueue_unlock();
}
void DarwinSendKeyboardEvents(int ev_type, int keycode) {
- int i, num_events;
+ int i, num_events;
+
if(!darwinEvents) {
ErrorF("DarwinSendKeyboardEvents called before darwinEvents was initialized\n");
return;
}
- if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) {
- /* See if keymap has changed. */
+ if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) {
+ /* See if keymap has changed. */
- static unsigned int last_seed;
- unsigned int this_seed;
+ static unsigned int last_seed;
+ unsigned int this_seed;
- this_seed = QuartzSystemKeymapSeed();
- if (this_seed != last_seed) {
- last_seed = this_seed;
- DarwinSendDDXEvent(kXquartzReloadKeymap, 0);
- }
- }
+ this_seed = QuartzSystemKeymapSeed();
+ if (this_seed != last_seed) {
+ last_seed = this_seed;
+ DarwinSendDDXEvent(kXquartzReloadKeymap, 0);
+ }
+ }
- num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
- for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&darwinEvents[i]);
- DarwinPokeEQ();
+ mieqEnqueue_lock(); {
+ num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
+ for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&darwinEvents[i]);
+ DarwinPokeEQ();
+ } mieqEnqueue_unlock();
}
void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y,
float pressure, float tilt_x, float tilt_y) {
- int i, num_events;
- int valuators[5] = {pointer_x, pointer_y,
+ int i, num_events;
+ int valuators[5] = {pointer_x, pointer_y,
pressure * INT32_MAX * 1.0f,
tilt_x * INT32_MAX * 1.0f,
tilt_y * INT32_MAX * 1.0f};
- if(!darwinEvents) {
+ if(!darwinEvents) {
ErrorF("DarwinSendProximityvents called before darwinEvents was initialized\n");
return;
-}
+ }
- num_events = GetProximityEvents(darwinEvents, darwinPointer, ev_type,
- 0, 5, valuators);
-
- for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
- DarwinPokeEQ();
+ mieqEnqueue_lock(); {
+ num_events = GetProximityEvents(darwinEvents, darwinPointer, ev_type,
+ 0, 5, valuators);
+ for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
+ DarwinPokeEQ();
+ } mieqEnqueue_unlock();
}
-/* Send the appropriate number of button 4 / 5 clicks to emulate scroll wheel */
-void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y,
- float pressure, float tilt_x, float tilt_y) {
- int i;
- int ev_button = count > 0.0f ? 4 : 5;
- int valuators[5] = {pointer_x, pointer_y,
- pressure * INT32_MAX * 1.0f,
- tilt_x * INT32_MAX * 1.0f,
- tilt_y * INT32_MAX * 1.0f};
-
+/* Send the appropriate number of button clicks to emulate scroll wheel */
+void DarwinSendScrollEvents(float count_x, float count_y,
+ int pointer_x, int pointer_y,
+ float pressure, float tilt_x, float tilt_y) {
if(!darwinEvents) {
ErrorF("DarwinSendScrollEvents called before darwinEvents was initialized\n");
return;
}
- for (count = fabs(count); count > 0.0; count = count - 1.0f) {
- int num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonPress, ev_button,
- POINTER_ABSOLUTE, 0, 5, valuators);
- for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
- num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonRelease, ev_button,
- POINTER_ABSOLUTE, 0, 5, valuators);
- for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
- }
- DarwinPokeEQ();
+ int sign_x = count_x > 0.0f ? SCROLLWHEELLEFTFAKE : SCROLLWHEELRIGHTFAKE;
+ int sign_y = count_y > 0.0f ? SCROLLWHEELUPFAKE : SCROLLWHEELDOWNFAKE;
+ count_x = fabs(count_x);
+ count_y = fabs(count_y);
+
+ while ((count_x > 0.0f) || (count_y > 0.0f)) {
+ if (count_x > 0.0f) {
+ DarwinSendPointerEvents(ButtonPress, sign_x, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DarwinSendPointerEvents(ButtonRelease, sign_x, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ count_x = count_x - 1.0f;
+ }
+ if (count_y > 0.0f) {
+ DarwinSendPointerEvents(ButtonPress, sign_y, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DarwinSendPointerEvents(ButtonRelease, sign_y, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ count_y = count_y - 1.0f;
+ }
+ }
}
/* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to
reflect changing modifier flags (alt, control, meta, etc) */
void DarwinUpdateModKeys(int flags) {
- DarwinUpdateModifiers(KeyRelease, old_flags & ~flags);
- DarwinUpdateModifiers(KeyPress, ~old_flags & flags);
- old_flags = flags;
+ DarwinUpdateModifiers(KeyRelease, old_flags & ~flags);
+ DarwinUpdateModifiers(KeyPress, ~old_flags & flags);
+ old_flags = flags;
}
@@ -503,5 +536,8 @@ void DarwinSendDDXEvent(int type, int argc, ...) {
va_end (args);
}
- mieqEnqueue(NULL, &xe);
+ mieqEnqueue_lock();
+ mieqEnqueue(darwinPointer, &xe);
+ DarwinPokeEQ();
+ mieqEnqueue_unlock();
}
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 7c56be9c8..dd3f81c30 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -32,17 +32,13 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr);
void DarwinEQEnqueue(const xEventPtr e);
void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
-void DarwinPokeEQ(void);
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y,
float pressure, float tilt_x, float tilt_y);
void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y,
float pressure, float tilt_x, float tilt_y);
void DarwinSendKeyboardEvents(int ev_type, int keycode);
-void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y,
+void DarwinSendScrollEvents(float count_x, float count_y, int pointer_x, int pointer_y,
float pressure, float tilt_x, float tilt_y);
void DarwinUpdateModKeys(int flags);
-void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev,
- int nevents);
-
#endif /* _DARWIN_EVENTS_H */
diff --git a/hw/xquartz/darwinKeyboard.c b/hw/xquartz/darwinKeyboard.c
deleted file mode 100644
index 6f2758e53..000000000
--- a/hw/xquartz/darwinKeyboard.c
+++ /dev/null
@@ -1,1019 +0,0 @@
-//=============================================================================
-//
-// Keyboard support for the Darwin X Server
-//
-// Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
-// Copyright (c) 2003 Apple Computer, Inc. All Rights Reserved.
-// Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved.
-//
-// The code to parse the Darwin keymap is derived from dumpkeymap.c
-// by Eric Sunshine, which includes the following copyright:
-//
-// Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com>
-// All rights reserved.
-//
-//-----------------------------------------------------------------------------
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// 3. The name of the author may not be used to endorse or promote products
-// derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
-// NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//=============================================================================
-
-
-/*
-===========================================================================
-
- An X keyCode must be in the range XkbMinLegalKeyCode (8) to
- XkbMaxLegalKeyCode(255).
-
- The keyCodes we get from the kernel range from 0 to 127, so we need to
- offset the range before passing the keyCode to X.
-
- An X KeySym is an extended ascii code that is device independent.
-
- The modifier map is accessed by the keyCode, but the normal map is
- accessed by keyCode - MIN_KEYCODE. Sigh.
-
-===========================================================================
-*/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-// Define this to get a diagnostic output to stderr which is helpful
-// in determining how the X server is interpreting the Darwin keymap.
-// #define DUMP_DARWIN_KEYMAP
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <IOKit/hidsystem/event_status_driver.h>
-#include <IOKit/hidsystem/ev_keymap.h>
-#include <architecture/byte_order.h> // For the NXSwap*
-#include "darwin.h"
-#include "darwinKeyboard.h"
-#include "quartzKeyboard.h"
-#include "quartzAudio.h"
-
-#ifdef NDEBUG
-#undef NDEBUG
-#include <assert.h>
-#define NDEBUG 1
-#else
-#include <assert.h>
-#endif
-
-#define AltMask Mod1Mask
-#define MetaMask Mod2Mask
-#define FunctionMask Mod3Mask
-
-#define UK(a) NoSymbol // unknown symbol
-
-static KeySym const next_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, XK_KP_Enter,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
-// 128
- NoSymbol, XK_Agrave, XK_Aacute, XK_Acircumflex,
- XK_Atilde, XK_Adiaeresis, XK_Aring, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
-// 144
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_Ugrave,
- XK_Uacute, XK_Ucircumflex, XK_Udiaeresis, XK_Yacute,
- XK_THORN, XK_mu, XK_multiply, XK_division,
-// 160
- XK_copyright, XK_exclamdown, XK_cent, XK_sterling,
- UK(fraction), XK_yen, UK(fhook), XK_section,
- XK_currency, XK_rightsinglequotemark,
- XK_leftdoublequotemark,
- XK_guillemotleft,
- XK_leftanglebracket,
- XK_rightanglebracket,
- UK(filigature), UK(flligature),
-// 176
- XK_registered, XK_endash, XK_dagger, XK_doubledagger,
- XK_periodcentered,XK_brokenbar, XK_paragraph, UK(bullet),
- XK_singlelowquotemark,
- XK_doublelowquotemark,
- XK_rightdoublequotemark,
- XK_guillemotright,
- XK_ellipsis, UK(permille), XK_notsign, XK_questiondown,
-// 192
- XK_onesuperior, XK_dead_grave, XK_dead_acute, XK_dead_circumflex,
- XK_dead_tilde, XK_dead_macron, XK_dead_breve, XK_dead_abovedot,
- XK_dead_diaeresis,
- XK_twosuperior, XK_dead_abovering,
- XK_dead_cedilla,
- XK_threesuperior,
- XK_dead_doubleacute,
- XK_dead_ogonek, XK_dead_caron,
-// 208
- XK_emdash, XK_plusminus, XK_onequarter, XK_onehalf,
- XK_threequarters,
- XK_agrave, XK_aacute, XK_acircumflex,
- XK_atilde, XK_adiaeresis, XK_aring, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
-// 224
- XK_igrave, XK_AE, XK_iacute, XK_ordfeminine,
- XK_icircumflex, XK_idiaeresis, XK_eth, XK_ntilde,
- XK_Lstroke, XK_Ooblique, XK_OE, XK_masculine,
- XK_ograve, XK_oacute, XK_ocircumflex, XK_otilde,
-// 240
- XK_odiaeresis, XK_ae, XK_ugrave, XK_uacute,
- XK_ucircumflex, XK_idotless, XK_udiaeresis, XK_ygrave,
- XK_lstroke, XK_ooblique, XK_oe, XK_ssharp,
- XK_thorn, XK_ydiaeresis, NoSymbol, NoSymbol,
- };
-
-#define MIN_SYMBOL 0xAC
-static KeySym const symbol_to_x[] = {
- XK_Left, XK_Up, XK_Right, XK_Down
- };
-static int const NUM_SYMBOL = sizeof(symbol_to_x) / sizeof(symbol_to_x[0]);
-
-#define MIN_FUNCKEY 0x20
-static KeySym const funckey_to_x[] = {
- XK_F1, XK_F2, XK_F3, XK_F4,
- XK_F5, XK_F6, XK_F7, XK_F8,
- XK_F9, XK_F10, XK_F11, XK_F12,
- XK_Insert, XK_Delete, XK_Home, XK_End,
- XK_Page_Up, XK_Page_Down, XK_F13, XK_F14,
- XK_F15
- };
-static int const NUM_FUNCKEY = sizeof(funckey_to_x) / sizeof(funckey_to_x[0]);
-
-typedef struct {
- KeySym normalSym;
- KeySym keypadSym;
-} darwinKeyPad_t;
-
-static darwinKeyPad_t const normal_to_keypad[] = {
- { XK_0, XK_KP_0 },
- { XK_1, XK_KP_1 },
- { XK_2, XK_KP_2 },
- { XK_3, XK_KP_3 },
- { XK_4, XK_KP_4 },
- { XK_5, XK_KP_5 },
- { XK_6, XK_KP_6 },
- { XK_7, XK_KP_7 },
- { XK_8, XK_KP_8 },
- { XK_9, XK_KP_9 },
- { XK_equal, XK_KP_Equal },
- { XK_asterisk, XK_KP_Multiply },
- { XK_plus, XK_KP_Add },
- { XK_comma, XK_KP_Separator },
- { XK_minus, XK_KP_Subtract },
- { XK_period, XK_KP_Decimal },
- { XK_slash, XK_KP_Divide }
-};
-static int const NUM_KEYPAD = sizeof(normal_to_keypad) / sizeof(normal_to_keypad[0]);
-
-static void DarwinChangeKeyboardControl( DeviceIntPtr device, KeybdCtrl *ctrl )
-{
- // keyclick, bell volume / pitch, autorepead, LED's
-}
-
-darwinKeyboardInfo keyInfo;
-static FILE *fref = NULL;
-static char *inBuffer = NULL;
-
-//-----------------------------------------------------------------------------
-// Data Stream Object
-// Can be configured to treat embedded "numbers" as being composed of
-// either 1, 2, or 4 bytes, apiece.
-//-----------------------------------------------------------------------------
-typedef struct _DataStream {
- unsigned char const *data;
- unsigned char const *data_end;
- short number_size; // Size in bytes of a "number" in the stream.
-} DataStream;
-
-static DataStream* new_data_stream(unsigned char const* data, int size) {
- DataStream* s = (DataStream*)xalloc( sizeof(DataStream) );
- if(s) {
- s->data = data;
- s->data_end = data + size;
- s->number_size = 1; // Default to byte-sized numbers.
- }
- return s;
-}
-
-static void destroy_data_stream(DataStream* s) {
- xfree(s);
-}
-
-static unsigned char get_byte(DataStream* s) {
- assert(s->data + 1 <= s->data_end);
- return *s->data++;
-}
-
-static short get_word(DataStream* s) {
- short hi, lo;
- assert(s->data + 2 <= s->data_end);
- hi = *s->data++;
- lo = *s->data++;
- return ((hi << 8) | lo);
-}
-
-static int get_dword(DataStream* s) {
- int b1, b2, b3, b4;
- assert(s->data + 4 <= s->data_end);
- b4 = *s->data++;
- b3 = *s->data++;
- b2 = *s->data++;
- b1 = *s->data++;
- return ((b4 << 24) | (b3 << 16) | (b2 << 8) | b1);
-}
-
-static int get_number(DataStream* s) {
- switch (s->number_size) {
- case 4: return get_dword(s);
- case 2: return get_word(s);
- default: return get_byte(s);
- }
-}
-
-//-----------------------------------------------------------------------------
-// Utility functions to help parse Darwin keymap
-//-----------------------------------------------------------------------------
-
-/*
- * bits_set
- * Calculate number of bits set in the modifier mask.
- */
-static short bits_set(short mask) {
- short n = 0;
-
- for ( ; mask != 0; mask >>= 1)
- if ((mask & 0x01) != 0)
- n++;
- return n;
-}
-
-/*
- * parse_next_char_code
- * Read the next character code from the Darwin keymapping
- * and write it to the X keymap.
- */
-static void parse_next_char_code(DataStream *s, KeySym *k) {
- const short charSet = get_number(s);
- const short charCode = get_number(s);
-
- if (charSet == 0) { // ascii character
- if (charCode >= 0 && charCode < 256)
- *k = next_to_x[charCode];
- } else if (charSet == 0x01) { // symbol character
- if (charCode >= MIN_SYMBOL &&
- charCode <= MIN_SYMBOL + NUM_SYMBOL)
- *k = symbol_to_x[charCode - MIN_SYMBOL];
- } else if (charSet == 0xFE) { // function key
- if (charCode >= MIN_FUNCKEY &&
- charCode <= MIN_FUNCKEY + NUM_FUNCKEY)
- *k = funckey_to_x[charCode - MIN_FUNCKEY];
- }
-}
-
-
-/*
- * DarwinReadKeymapFile
- * Read the appropriate keymapping from a keymapping file.
- */
-static Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) {
- struct stat st;
- NXEventSystemDevice info[20];
- int interface = 0, handler_id = 0;
- int map_interface, map_handler_id, map_size = 0;
- unsigned int i, size;
- int *bufferEnd;
- union km_tag {
- int *intP;
- char *charP;
- } km;
-
- fref = fopen( darwinKeymapFile, "rb" );
- if (fref == NULL) {
- ErrorF("Unable to open keymapping file '%s' (%s).\n",
- darwinKeymapFile, strerror(errno));
- return FALSE;
- }
- if (fstat(fileno(fref), &st) == -1) {
- ErrorF("Could not stat keymapping file '%s' (%s).\n",
- darwinKeymapFile, strerror(errno));
- return FALSE;
- }
-
- // check to make sure we don't crash later
- if (st.st_size <= 16*sizeof(int)) {
- ErrorF("Keymapping file '%s' is invalid (too small).\n",
- darwinKeymapFile);
- return FALSE;
- }
-
- inBuffer = (char*) xalloc( st.st_size );
- bufferEnd = (int *) (inBuffer + st.st_size);
- if (fread(inBuffer, st.st_size, 1, fref) != 1) {
- ErrorF("Could not read %qd bytes from keymapping file '%s' (%s).\n",
- st.st_size, darwinKeymapFile, strerror(errno));
- return FALSE;
- }
-
- if (strncmp( inBuffer, "KYM1", 4 ) == 0) {
- // Magic number OK.
- } else if (strncmp( inBuffer, "KYMP", 4 ) == 0) {
- ErrorF("Keymapping file '%s' is intended for use with the original NeXT keyboards and cannot be used by XDarwin.\n", darwinKeymapFile);
- return FALSE;
- } else {
- ErrorF("Keymapping file '%s' has a bad magic number and cannot be used by XDarwin.\n", darwinKeymapFile);
- return FALSE;
- }
-
- // find the keyboard interface and handler id
- size = sizeof( info ) / sizeof( int );
- if (!NXEventSystemInfo( darwinParamConnect, NX_EVS_DEVICE_INFO,
- (NXEventSystemInfoType) info, &size )) {
- ErrorF("Error reading event status driver info.\n");
- return FALSE;
- }
-
- size = size * sizeof( int ) / sizeof( info[0] );
- for( i = 0; i < size; i++) {
- if (info[i].dev_type == NX_EVS_DEVICE_TYPE_KEYBOARD) {
- Bool hasInterface = FALSE;
- Bool hasMatch = FALSE;
-
- interface = info[i].interface;
- handler_id = info[i].id;
-
- // Find an appropriate keymapping:
- // The first time we try to match both interface and handler_id.
- // If we can't match both, we take the first match for interface.
-
- do {
- km.charP = inBuffer;
- km.intP++;
- while (km.intP+3 < bufferEnd) {
- map_interface = NXSwapBigIntToHost(*(km.intP++));
- map_handler_id = NXSwapBigIntToHost(*(km.intP++));
- map_size = NXSwapBigIntToHost(*(km.intP++));
- if (map_interface == interface) {
- if (map_handler_id == handler_id || hasInterface) {
- hasMatch = TRUE;
- break;
- } else {
- hasInterface = TRUE;
- }
- }
- km.charP += map_size;
- }
- } while (hasInterface && !hasMatch);
-
- if (hasMatch) {
- // fill in NXKeyMapping structure
- keyMap->size = map_size;
- keyMap->mapping = (char*) xalloc(map_size);
- memcpy(keyMap->mapping, km.charP, map_size);
- return TRUE;
- }
- } // if dev_id == keyboard device
- } // foreach info struct
-
- // The keymapping file didn't match any of the info structs
- // returned by NXEventSystemInfo.
- ErrorF("Keymapping file '%s' did not contain appropriate keyboard interface.\n", darwinKeymapFile);
- return FALSE;
-}
-
-
-/*
- * DarwinParseNXKeyMapping
- */
-static Bool DarwinParseNXKeyMapping(darwinKeyboardInfo *info) {
- KeySym *k;
- int i;
- short numMods, numKeys, numPadKeys = 0;
- Bool haveKeymap = FALSE;
- NXKeyMapping keyMap;
- DataStream *keyMapStream;
- unsigned char const *numPadStart = 0;
-
- if (darwinKeymapFile) {
- haveKeymap = DarwinReadKeymapFile(&keyMap);
- if (fref)
- fclose(fref);
- if (inBuffer)
- xfree(inBuffer);
- if (!haveKeymap) {
- ErrorF("Reverting to kernel keymapping.\n");
- }
- }
-
- if (!haveKeymap) {
- // get the Darwin keyboard map
- keyMap.size = NXKeyMappingLength( darwinParamConnect );
- keyMap.mapping = (char*) xalloc( keyMap.size );
- if (!NXGetKeyMapping( darwinParamConnect, &keyMap )) {
- return FALSE;
- }
- }
-
- keyMapStream = new_data_stream( (unsigned char const*)keyMap.mapping,
- keyMap.size );
-
- // check the type of map
- if (get_word(keyMapStream)) {
- keyMapStream->number_size = 2;
- ErrorF("Current 16-bit keymapping may not be interpreted correctly.\n");
- }
-
- // Insert X modifier KeySyms into the keyboard map.
- numMods = get_number(keyMapStream);
- while (numMods-- > 0) {
- int left = 1; // first keycode is left
- short const charCode = get_number(keyMapStream);
- short numKeyCodes = get_number(keyMapStream);
-
- // This is just a marker, not a real modifier.
- // Store numeric keypad keys for later.
- if (charCode == NX_MODIFIERKEY_NUMERICPAD) {
- numPadStart = keyMapStream->data;
- numPadKeys = numKeyCodes;
- }
-
- while (numKeyCodes-- > 0) {
- const short keyCode = get_number(keyMapStream);
- if (charCode != NX_MODIFIERKEY_NUMERICPAD) {
- switch (charCode) {
- case NX_MODIFIERKEY_ALPHALOCK:
- info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Caps_Lock;
- break;
- case NX_MODIFIERKEY_SHIFT:
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Shift_L : XK_Shift_R);
- break;
- case NX_MODIFIERKEY_CONTROL:
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Control_L : XK_Control_R);
- break;
- case NX_MODIFIERKEY_ALTERNATE:
- // info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Mode_switch;
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Alt_L : XK_Alt_R);
- break;
- case NX_MODIFIERKEY_COMMAND:
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Meta_L : XK_Meta_R);
- break;
- case NX_MODIFIERKEY_SECONDARYFN:
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Control_L : XK_Control_R);
- break;
- case NX_MODIFIERKEY_HELP:
- // Help is not an X11 modifier; treat as normal key
- info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Help;
- break;
- }
- }
- left = 0;
- }
- }
-
- // Convert the Darwin keyboard mapping to an X keyboard map.
- // A key can have a different character code for each combination of
- // modifiers. We currently ignore all modifier combinations except
- // those with Shift, AlphaLock, and Alt.
- numKeys = get_number(keyMapStream);
- for (i = 0, k = info->keyMap; i < numKeys; i++, k += GLYPHS_PER_KEY) {
- short const charGenMask = get_number(keyMapStream);
- if (charGenMask != 0xFF) { // is key bound?
- short numKeyCodes = 1 << bits_set(charGenMask);
-
- // Record unmodified case
- parse_next_char_code( keyMapStream, k );
- numKeyCodes--;
-
- // If AlphaLock and Shift modifiers produce different codes,
- // we record the Shift case since X handles AlphaLock.
- if (charGenMask & 0x01) { // AlphaLock
- parse_next_char_code( keyMapStream, k+1 );
- numKeyCodes--;
- }
-
- if (charGenMask & 0x02) { // Shift
- parse_next_char_code( keyMapStream, k+1 );
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Shift-AlphaLock
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
- }
- }
-
- // Skip the Control cases
- if (charGenMask & 0x04) { // Control
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Control-AlphaLock
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
- }
-
- if (charGenMask & 0x02) { // Control-Shift
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Shift-Control-AlphaLock
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
- }
- }
- }
-
- // Process Alt cases
- if (charGenMask & 0x08) { // Alt
- parse_next_char_code( keyMapStream, k+2 );
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Alt-AlphaLock
- parse_next_char_code( keyMapStream, k+3 );
- numKeyCodes--;
- }
-
- if (charGenMask & 0x02) { // Alt-Shift
- parse_next_char_code( keyMapStream, k+3 );
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Alt-Shift-AlphaLock
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
- }
- }
- }
-
- while (numKeyCodes-- > 0) {
- get_number(keyMapStream); get_number(keyMapStream);
- }
-
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- }
- }
-
- // Now we have to go back through the list of keycodes that are on the
- // numeric keypad and update the X keymap.
- keyMapStream->data = numPadStart;
- while(numPadKeys-- > 0) {
- const short keyCode = get_number(keyMapStream);
- k = &info->keyMap[keyCode * GLYPHS_PER_KEY];
- for (i = 0; i < NUM_KEYPAD; i++) {
- if (*k == normal_to_keypad[i].normalSym) {
- k[0] = normal_to_keypad[i].keypadSym;
- break;
- }
- }
- }
-
- // free Darwin keyboard map
- destroy_data_stream( keyMapStream );
- xfree( keyMap.mapping );
-
- return TRUE;
-}
-
-/*
- * DarwinBuildModifierMaps
- * Use the keyMap field of keyboard info structure to populate
- * the modMap and modifierKeycodes fields.
- */
-static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
- int i;
- KeySym *k;
-
- memset(info->modMap, NoSymbol, sizeof(info->modMap));
- memset(info->modifierKeycodes, 0, sizeof(info->modifierKeycodes));
-
- for (i = 0; i < NUM_KEYCODES; i++) {
- k = info->keyMap + i * GLYPHS_PER_KEY;
-
- switch (*k) {
- case XK_Shift_L:
- info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
- info->modMap[MIN_KEYCODE + i] = ShiftMask;
- break;
-
- case XK_Shift_R:
-#ifdef NX_MODIFIERKEY_RSHIFT
- info->modifierKeycodes[NX_MODIFIERKEY_RSHIFT][0] = i;
-#else
- info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
-#endif
- info->modMap[MIN_KEYCODE + i] = ShiftMask;
- break;
-
- case XK_Control_L:
- info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
- info->modMap[MIN_KEYCODE + i] = ControlMask;
- break;
-
- case XK_Control_R:
-#ifdef NX_MODIFIERKEY_RCONTROL
- info->modifierKeycodes[NX_MODIFIERKEY_RCONTROL][0] = i;
-#else
- info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
-#endif
- info->modMap[MIN_KEYCODE + i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- info->modifierKeycodes[NX_MODIFIERKEY_ALPHALOCK][0] = i;
- info->modMap[MIN_KEYCODE + i] = LockMask;
- break;
-
- case XK_Alt_L:
- info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
- info->modMap[MIN_KEYCODE + i] = Mod1Mask;
- *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
- break;
-
- case XK_Alt_R:
-#ifdef NX_MODIFIERKEY_RALTERNATE
- info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i;
-#else
- info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
-#endif
- *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
- info->modMap[MIN_KEYCODE + i] = Mod1Mask;
- break;
-
- case XK_Mode_switch:
- info->modMap[MIN_KEYCODE + i] = Mod1Mask;
- break;
-
- case XK_Meta_L:
- info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
- info->modMap[MIN_KEYCODE + i] = Mod2Mask;
- break;
-
- case XK_Meta_R:
-#ifdef NX_MODIFIERKEY_RCOMMAND
- info->modifierKeycodes[NX_MODIFIERKEY_RCOMMAND][0] = i;
-#else
- info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
-#endif
- info->modMap[MIN_KEYCODE + i] = Mod2Mask;
- break;
-
- case XK_Num_Lock:
- info->modMap[MIN_KEYCODE + i] = Mod3Mask;
- break;
- }
- }
-}
-
-/*
- * DarwinLoadKeyboardMapping
- * Load the keyboard map from a file or system and convert
- * it to an equivalent X keyboard map and modifier map.
- */
-static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
- void* callstack[128];
- int i, frames = backtrace(callstack, 128);
- char** strs = backtrace_symbols(callstack, frames);
- for (i = 0; i < frames; ++i) {
- ErrorF("%s\n", strs[i]);
- }
- free(strs);
-
- memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
-
- /* TODO: Clean this up
- * QuartzReadSystemKeymap is in quartz/quartzKeyboard.c
- * DarwinParseNXKeyMapping is here
- */
- if (!DarwinParseNXKeyMapping(&keyInfo)) {
- DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running QuartzReadSystemKeymap().\n");
- if (!QuartzReadSystemKeymap(&keyInfo)) {
- FatalError("Could not build a valid keymap.");
- }
- }
-
- DarwinBuildModifierMaps(&keyInfo);
-
-#ifdef DUMP_DARWIN_KEYMAP
- int i;
- KeySym *k;
- DEBUG_LOG("Darwin -> X converted keyboard map\n");
- for (i = 0, k = keyInfo.keyMap; i < NX_NUMKEYCODES;
- i++, k += GLYPHS_PER_KEY)
- {
- int j;
- for (j = 0; j < GLYPHS_PER_KEY; j++) {
- if (k[j] == NoSymbol) {
- DEBUG_LOG("0x%02x:\tNoSym\n", i);
- } else {
- DEBUG_LOG("0x%02x:\t0x%lx\n", i, k[j]);
- }
- }
- }
-#endif
-
- keySyms->map = keyInfo.keyMap;
- keySyms->mapWidth = GLYPHS_PER_KEY;
- keySyms->minKeyCode = MIN_KEYCODE;
- keySyms->maxKeyCode = MAX_KEYCODE;
-}
-
-
-/*
- * DarwinKeyboardInit
- * Get the Darwin keyboard map and compute an equivalent
- * X keyboard map and modifier map. Set the new keyboard
- * device structure.
- */
-void DarwinKeyboardInit(DeviceIntPtr pDev) {
- KeySymsRec keySyms;
-
- // Open a shared connection to the HID System.
- // Note that the Event Status Driver is really just a wrapper
- // for a kIOHIDParamConnectType connection.
- assert( darwinParamConnect = NXOpenEventStatus() );
-
- DarwinLoadKeyboardMapping(&keySyms);
- // DarwinKeyboardReload(pDev);
- /* Initialize the seed, so we don't reload the keymap unnecessarily
- (and possibly overwrite xinitrc changes) */
- QuartzSystemKeymapSeed();
-
- assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms,
- keyInfo.modMap, QuartzBell,
- DarwinChangeKeyboardControl ));
-}
-
-
-/* Borrowed from dix/devices.c */
-static Bool InitModMap(register KeyClassPtr keyc) {
- int i, j;
- CARD8 keysPerModifier[8];
- CARD8 mask;
-
- // darwinKeyc = keyc;
- if (keyc->modifierKeyMap != NULL)
- xfree (keyc->modifierKeyMap);
-
- keyc->maxKeysPerModifier = 0;
- for (i = 0; i < 8; i++)
- keysPerModifier[i] = 0;
- for (i = 8; i < MAP_LENGTH; i++)
- {
- for (j = 0, mask = 1; j < 8; j++, mask <<= 1)
- {
- if (mask & keyc->modifierMap[i])
- {
- if (++keysPerModifier[j] > keyc->maxKeysPerModifier)
- keyc->maxKeysPerModifier = keysPerModifier[j];
- }
- }
- }
- keyc->modifierKeyMap = (KeyCode *)xalloc(8*keyc->maxKeysPerModifier);
- if (!keyc->modifierKeyMap && keyc->maxKeysPerModifier)
- return (FALSE);
- bzero((char *)keyc->modifierKeyMap, 8*(int)keyc->maxKeysPerModifier);
- for (i = 0; i < 8; i++)
- keysPerModifier[i] = 0;
- for (i = 8; i < MAP_LENGTH; i++)
- {
- for (j = 0, mask = 1; j < 8; j++, mask <<= 1)
- {
- if (mask & keyc->modifierMap[i])
- {
- keyc->modifierKeyMap[(j*keyc->maxKeysPerModifier) +
- keysPerModifier[j]] = i;
- keysPerModifier[j]++;
- }
- }
- }
- return TRUE;
-}
-
-
-void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
- KeySymsRec keySyms;
- if (dev == NULL) dev = darwinKeyboard;
-
- DEBUG_LOG("DarwinKeyboardReloadHandler(%p)\n", dev);
- DarwinLoadKeyboardMapping(&keySyms);
-
- if (SetKeySymsMap(&dev->key->curKeySyms, &keySyms)) {
- /* now try to update modifiers. */
-
- memmove(dev->key->modifierMap, keyInfo.modMap, MAP_LENGTH);
- InitModMap(dev->key);
- } else DEBUG_LOG("SetKeySymsMap=0\n");
-
- SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, 0);
- SendMappingNotify(MappingModifier, 0, 0, 0);
-}
-
-
-//-----------------------------------------------------------------------------
-// Modifier translation functions
-//
-// There are three different ways to specify a Mac modifier key:
-// keycode - specifies hardware key, read from keymapping
-// key - NX_MODIFIERKEY_*, really an index
-// mask - NX_*MASK, mask for modifier flags in event record
-// Left and right side have different keycodes but the same key and mask.
-//-----------------------------------------------------------------------------
-
-/*
- * DarwinModifierNXKeyToNXKeycode
- * Return the keycode for an NX_MODIFIERKEY_* modifier.
- * side = 0 for left or 1 for right.
- * Returns 0 if key+side is not a known modifier.
- */
-int DarwinModifierNXKeyToNXKeycode(int key, int side) {
- return keyInfo.modifierKeycodes[key][side];
-}
-
-/*
- * DarwinModifierNXKeycodeToNXKey
- * Returns -1 if keycode+side is not a modifier key
- * outSide may be NULL, else it gets 0 for left and 1 for right.
- */
-int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) {
- int key, side;
-
- keycode += MIN_KEYCODE;
- // search modifierKeycodes for this keycode+side
- for (key = 0; key < NX_NUMMODIFIERS; key++) {
- for (side = 0; side <= 1; side++) {
- if (keyInfo.modifierKeycodes[key][side] == keycode) break;
- }
- }
- if (key == NX_NUMMODIFIERS) return -1;
- if (outSide) *outSide = side;
- return key;
-}
-
-/*
- * DarwinModifierNXMaskToNXKey
- * Returns -1 if mask is not a known modifier mask.
- */
-int DarwinModifierNXMaskToNXKey(int mask) {
- switch (mask) {
- case NX_ALPHASHIFTMASK: return NX_MODIFIERKEY_ALPHALOCK;
- case NX_SHIFTMASK: return NX_MODIFIERKEY_SHIFT;
-#ifdef NX_DEVICELSHIFTKEYMASK
- case NX_DEVICELSHIFTKEYMASK: return NX_MODIFIERKEY_SHIFT;
- case NX_DEVICERSHIFTKEYMASK: return NX_MODIFIERKEY_RSHIFT;
-#endif
- case NX_CONTROLMASK: return NX_MODIFIERKEY_CONTROL;
-#ifdef NX_DEVICELCTLKEYMASK
- case NX_DEVICELCTLKEYMASK: return NX_MODIFIERKEY_CONTROL;
- case NX_DEVICERCTLKEYMASK: return NX_MODIFIERKEY_RCONTROL;
-#endif
- case NX_ALTERNATEMASK: return NX_MODIFIERKEY_ALTERNATE;
-#ifdef NX_DEVICELALTKEYMASK
- case NX_DEVICELALTKEYMASK: return NX_MODIFIERKEY_ALTERNATE;
- case NX_DEVICERALTKEYMASK: return NX_MODIFIERKEY_RALTERNATE;
-#endif
- case NX_COMMANDMASK: return NX_MODIFIERKEY_COMMAND;
-#ifdef NX_DEVICELCMDKEYMASK
- case NX_DEVICELCMDKEYMASK: return NX_MODIFIERKEY_COMMAND;
- case NX_DEVICERCMDKEYMASK: return NX_MODIFIERKEY_RCOMMAND;
-#endif
- case NX_NUMERICPADMASK: return NX_MODIFIERKEY_NUMERICPAD;
- case NX_HELPMASK: return NX_MODIFIERKEY_HELP;
- case NX_SECONDARYFNMASK: return NX_MODIFIERKEY_SECONDARYFN;
- }
- return -1;
-}
-
-static const char *DarwinModifierNXMaskTostring(int mask) {
- switch (mask) {
- case NX_ALPHASHIFTMASK: return "NX_ALPHASHIFTMASK";
- case NX_SHIFTMASK: return "NX_SHIFTMASK";
- case NX_DEVICELSHIFTKEYMASK: return "NX_DEVICELSHIFTKEYMASK";
- case NX_DEVICERSHIFTKEYMASK: return "NX_DEVICERSHIFTKEYMASK";
- case NX_CONTROLMASK: return "NX_CONTROLMASK";
- case NX_DEVICELCTLKEYMASK: return "NX_DEVICELCTLKEYMASK";
- case NX_DEVICERCTLKEYMASK: return "NX_DEVICERCTLKEYMASK";
- case NX_ALTERNATEMASK: return "NX_ALTERNATEMASK";
- case NX_DEVICELALTKEYMASK: return "NX_DEVICELALTKEYMASK";
- case NX_DEVICERALTKEYMASK: return "NX_DEVICERALTKEYMASK";
- case NX_COMMANDMASK: return "NX_COMMANDMASK";
- case NX_DEVICELCMDKEYMASK: return "NX_DEVICELCMDKEYMASK";
- case NX_DEVICERCMDKEYMASK: return "NX_DEVICERCMDKEYMASK";
- case NX_NUMERICPADMASK: return "NX_NUMERICPADMASK";
- case NX_HELPMASK: return "NX_HELPMASK";
- case NX_SECONDARYFNMASK: return "NX_SECONDARYFNMASK";
- }
- return "unknown mask";
-}
-
-/*
- * DarwinModifierNXKeyToNXMask
- * Returns 0 if key is not a known modifier key.
- */
-int DarwinModifierNXKeyToNXMask(int key) {
- switch (key) {
- case NX_MODIFIERKEY_ALPHALOCK: return NX_ALPHASHIFTMASK;
- case NX_MODIFIERKEY_SHIFT: return NX_SHIFTMASK;
-#ifdef NX_MODIFIERKEY_RSHIFT
- case NX_MODIFIERKEY_RSHIFT: return NX_SHIFTMASK;
-#endif
- case NX_MODIFIERKEY_CONTROL: return NX_CONTROLMASK;
-#ifdef NX_MODIFIERKEY_RCONTROL
- case NX_MODIFIERKEY_RCONTROL: return NX_CONTROLMASK;
-#endif
- case NX_MODIFIERKEY_ALTERNATE: return NX_ALTERNATEMASK;
-#ifdef NX_MODIFIERKEY_RALTERNATE
- case NX_MODIFIERKEY_RALTERNATE: return NX_ALTERNATEMASK;
-#endif
- case NX_MODIFIERKEY_COMMAND: return NX_COMMANDMASK;
-#ifdef NX_MODIFIERKEY_RCOMMAND
- case NX_MODIFIERKEY_RCOMMAND: return NX_COMMANDMASK;
-#endif
- case NX_MODIFIERKEY_NUMERICPAD: return NX_NUMERICPADMASK;
- case NX_MODIFIERKEY_HELP: return NX_HELPMASK;
- case NX_MODIFIERKEY_SECONDARYFN: return NX_SECONDARYFNMASK;
- }
- return 0;
-}
-
-/*
- * DarwinModifierStringToNXKey
- * Returns -1 if string is not a known modifier.
- */
-int DarwinModifierStringToNXKey(const char *str) {
- if (!strcasecmp(str, "shift")) return NX_MODIFIERKEY_SHIFT;
- else if (!strcasecmp(str, "control")) return NX_MODIFIERKEY_CONTROL;
- else if (!strcasecmp(str, "option")) return NX_MODIFIERKEY_ALTERNATE;
- else if (!strcasecmp(str, "command")) return NX_MODIFIERKEY_COMMAND;
- else if (!strcasecmp(str, "fn")) return NX_MODIFIERKEY_SECONDARYFN;
- else return -1;
-}
-
-/*
- * LegalModifier
- * This allows the ddx layer to prevent some keys from being remapped
- * as modifier keys.
- */
-Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
-{
- return 1;
-}
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 96dc021a6..4d03d02fb 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -28,6 +28,8 @@
* use or other dealings in this Software without prior written authorization.
*/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -52,7 +54,7 @@
#include "windowstr.h"
#include "colormapst.h"
#include "globals.h"
-#include "rootlessWindow.h"
+#include "mi.h"
// System headers
#include <sys/types.h>
diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h
index ffe06f9c6..e11602391 100644
--- a/hw/xquartz/quartz.h
+++ b/hw/xquartz/quartz.h
@@ -131,4 +131,9 @@ void QuartzInitInput(int argc, char **argv);
void QuartzGiveUp(void);
void QuartzProcessEvent(xEvent *xe);
void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
+
+void QuartzShow(int x, int y); // (x, y) = cursor loc
+void QuartzHide(void);
+void QuartzSetRootClip(BOOL enable);
+void QuartzSpaceChanged(uint32_t space_id);
#endif
diff --git a/hw/xquartz/quartzAudio.c b/hw/xquartz/quartzAudio.c
index 5dee32f54..d3698d7c9 100644
--- a/hw/xquartz/quartzAudio.c
+++ b/hw/xquartz/quartzAudio.c
@@ -36,6 +36,8 @@
* use or other dealings in this Software without prior written authorization.
*/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
diff --git a/hw/xquartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m
index d8f9c69e4..aa4b9fb1e 100644
--- a/hw/xquartz/quartzCocoa.m
+++ b/hw/xquartz/quartzCocoa.m
@@ -32,6 +32,8 @@
* use or other dealings in this Software without prior written authorization.
*/
+#include "sanitizedCocoa.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -40,12 +42,8 @@
#include "inputstr.h"
#include "quartzPasteboard.h"
-#define BOOL xBOOL
#include "darwin.h"
-#include <Cocoa/Cocoa.h>
-#undef BOOL
-
#include "pseudoramiX.h"
extern void FatalError(const char *, ...);
diff --git a/hw/xquartz/quartzCommon.h b/hw/xquartz/quartzCommon.h
index c4bd2d803..e63c2b760 100644
--- a/hw/xquartz/quartzCommon.h
+++ b/hw/xquartz/quartzCommon.h
@@ -35,17 +35,6 @@
#ifndef _QUARTZCOMMON_H
#define _QUARTZCOMMON_H
-// QuickDraw in ApplicationServices has the following conflicts with
-// the basic X server headers. Use QD_<name> to use the QuickDraw
-// definition of any of these symbols, or the normal name for the
-// X11 definition.
-#define Cursor QD_Cursor
-#define WindowPtr QD_WindowPtr
-#define Picture QD_Picture
-#include <ApplicationServices/ApplicationServices.h>
-#undef Cursor
-#undef WindowPtr
-#undef Picture
#include <X11/Xdefs.h>
#include "privates.h"
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 9b899ca67..698f39a22 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -1,51 +1,77 @@
/*
- quartzKeyboard.c
-
- Code to build a keymap using the Carbon Keyboard Layout API.
-
- Copyright (c) 2003-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.
+ quartzKeyboard.c: Keyboard support for Xquartz
+
+ Copyright (c) 2003-2008 Apple Inc.
+ Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
+ Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved.
+
+ The code to parse the Darwin keymap is derived from dumpkeymap.c
+ by Eric Sunshine, which includes the following copyright:
+
+ Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com>
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include "quartzCommon.h"
+// Define this to get a diagnostic output to stderr which is helpful
+// in determining how the X server is interpreting the Darwin keymap.
+#define DUMP_DARWIN_KEYMAP
+#define XQUARTZ_USE_XKB
+#define HACK_MISSING 1
+#define HACK_KEYPAD 1
-#include <CoreServices/CoreServices.h>
-#include <Carbon/Carbon.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/stat.h>
+
+#include "quartzCommon.h"
+#include "darwin.h"
#include "quartzKeyboard.h"
+#include "quartzAudio.h"
+
+#ifdef NDEBUG
+#undef NDEBUG
+#include <assert.h>
+#define NDEBUG 1
+#else
+#include <assert.h>
+#endif
+
+#include "xkbsrv.h"
+#include "exevents.h"
#include "X11/keysym.h"
#include "keysym2ucs.h"
-#define HACK_MISSING 1
-#define HACK_KEYPAD 1
+void QuartzXkbUpdate(DeviceIntPtr pDev);
enum {
MOD_COMMAND = 256,
@@ -56,6 +82,143 @@ enum {
#define UKEYSYM(u) ((u) | 0x01000000)
+#define AltMask Mod1Mask
+#define MetaMask Mod2Mask
+#define FunctionMask Mod3Mask
+
+#define UK(a) NoSymbol // unknown symbol
+
+static KeySym const next_to_x[256] = {
+ NoSymbol, NoSymbol, NoSymbol, XK_KP_Enter,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
+ NoSymbol, XK_Return, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_Escape,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
+ XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
+ XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
+ XK_comma, XK_minus, XK_period, XK_slash,
+ XK_0, XK_1, XK_2, XK_3,
+ XK_4, XK_5, XK_6, XK_7,
+ XK_8, XK_9, XK_colon, XK_semicolon,
+ XK_less, XK_equal, XK_greater, XK_question,
+ XK_at, XK_A, XK_B, XK_C,
+ XK_D, XK_E, XK_F, XK_G,
+ XK_H, XK_I, XK_J, XK_K,
+ XK_L, XK_M, XK_N, XK_O,
+ XK_P, XK_Q, XK_R, XK_S,
+ XK_T, XK_U, XK_V, XK_W,
+ XK_X, XK_Y, XK_Z, XK_bracketleft,
+ XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
+ XK_grave, XK_a, XK_b, XK_c,
+ XK_d, XK_e, XK_f, XK_g,
+ XK_h, XK_i, XK_j, XK_k,
+ XK_l, XK_m, XK_n, XK_o,
+ XK_p, XK_q, XK_r, XK_s,
+ XK_t, XK_u, XK_v, XK_w,
+ XK_x, XK_y, XK_z, XK_braceleft,
+ XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
+// 128
+ NoSymbol, XK_Agrave, XK_Aacute, XK_Acircumflex,
+ XK_Atilde, XK_Adiaeresis, XK_Aring, XK_Ccedilla,
+ XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
+ XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
+// 144
+ XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
+ XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_Ugrave,
+ XK_Uacute, XK_Ucircumflex, XK_Udiaeresis, XK_Yacute,
+ XK_THORN, XK_mu, XK_multiply, XK_division,
+// 160
+ XK_copyright, XK_exclamdown, XK_cent, XK_sterling,
+ UK(fraction), XK_yen, UK(fhook), XK_section,
+ XK_currency, XK_rightsinglequotemark,
+ XK_leftdoublequotemark,
+ XK_guillemotleft,
+ XK_leftanglebracket,
+ XK_rightanglebracket,
+ UK(filigature), UK(flligature),
+// 176
+ XK_registered, XK_endash, XK_dagger, XK_doubledagger,
+ XK_periodcentered,XK_brokenbar, XK_paragraph, UK(bullet),
+ XK_singlelowquotemark,
+ XK_doublelowquotemark,
+ XK_rightdoublequotemark,
+ XK_guillemotright,
+ XK_ellipsis, UK(permille), XK_notsign, XK_questiondown,
+// 192
+ XK_onesuperior, XK_dead_grave, XK_dead_acute, XK_dead_circumflex,
+ XK_dead_tilde, XK_dead_macron, XK_dead_breve, XK_dead_abovedot,
+ XK_dead_diaeresis,
+ XK_twosuperior, XK_dead_abovering,
+ XK_dead_cedilla,
+ XK_threesuperior,
+ XK_dead_doubleacute,
+ XK_dead_ogonek, XK_dead_caron,
+// 208
+ XK_emdash, XK_plusminus, XK_onequarter, XK_onehalf,
+ XK_threequarters,
+ XK_agrave, XK_aacute, XK_acircumflex,
+ XK_atilde, XK_adiaeresis, XK_aring, XK_ccedilla,
+ XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
+// 224
+ XK_igrave, XK_AE, XK_iacute, XK_ordfeminine,
+ XK_icircumflex, XK_idiaeresis, XK_eth, XK_ntilde,
+ XK_Lstroke, XK_Ooblique, XK_OE, XK_masculine,
+ XK_ograve, XK_oacute, XK_ocircumflex, XK_otilde,
+// 240
+ XK_odiaeresis, XK_ae, XK_ugrave, XK_uacute,
+ XK_ucircumflex, XK_idotless, XK_udiaeresis, XK_ygrave,
+ XK_lstroke, XK_ooblique, XK_oe, XK_ssharp,
+ XK_thorn, XK_ydiaeresis, NoSymbol, NoSymbol,
+ };
+
+#define MIN_SYMBOL 0xAC
+static KeySym const symbol_to_x[] = {
+ XK_Left, XK_Up, XK_Right, XK_Down
+ };
+static int const NUM_SYMBOL = sizeof(symbol_to_x) / sizeof(symbol_to_x[0]);
+
+#define MIN_FUNCKEY 0x20
+static KeySym const funckey_to_x[] = {
+ XK_F1, XK_F2, XK_F3, XK_F4,
+ XK_F5, XK_F6, XK_F7, XK_F8,
+ XK_F9, XK_F10, XK_F11, XK_F12,
+ XK_Insert, XK_Delete, XK_Home, XK_End,
+ XK_Page_Up, XK_Page_Down, XK_F13, XK_F14,
+ XK_F15
+ };
+static int const NUM_FUNCKEY = sizeof(funckey_to_x) / sizeof(funckey_to_x[0]);
+
+typedef struct {
+ KeySym normalSym;
+ KeySym keypadSym;
+} darwinKeyPad_t;
+
+static darwinKeyPad_t const normal_to_keypad[] = {
+ { XK_0, XK_KP_0 },
+ { XK_1, XK_KP_1 },
+ { XK_2, XK_KP_2 },
+ { XK_3, XK_KP_3 },
+ { XK_4, XK_KP_4 },
+ { XK_5, XK_KP_5 },
+ { XK_6, XK_KP_6 },
+ { XK_7, XK_KP_7 },
+ { XK_8, XK_KP_8 },
+ { XK_9, XK_KP_9 },
+ { XK_equal, XK_KP_Equal },
+ { XK_asterisk, XK_KP_Multiply },
+ { XK_plus, XK_KP_Add },
+ { XK_comma, XK_KP_Separator },
+ { XK_minus, XK_KP_Subtract },
+ { XK_period, XK_KP_Decimal },
+ { XK_slash, XK_KP_Divide }
+};
+
+static int const NUM_KEYPAD = sizeof(normal_to_keypad) / sizeof(normal_to_keypad[0]);
+
/* Table of keycode->keysym mappings we use to fallback on for important
keys that are often not in the Unicode mapping. */
@@ -146,6 +309,783 @@ const static struct {
{UKEYSYM (0x31b), XK_dead_horn}, /* COMBINING HORN */
};
+darwinKeyboardInfo keyInfo;
+static FILE *fref = NULL;
+static char *inBuffer = NULL;
+
+static void DarwinChangeKeyboardControl( DeviceIntPtr device, KeybdCtrl *ctrl )
+{
+ // FIXME: to be implemented
+ // keyclick, bell volume / pitch, autorepead, LED's
+}
+
+//-----------------------------------------------------------------------------
+// Data Stream Object
+// Can be configured to treat embedded "numbers" as being composed of
+// either 1, 2, or 4 bytes, apiece.
+//-----------------------------------------------------------------------------
+typedef struct _DataStream {
+ unsigned char const *data;
+ unsigned char const *data_end;
+ short number_size; // Size in bytes of a "number" in the stream.
+} DataStream;
+
+static DataStream* new_data_stream(unsigned char const* data, int size) {
+ DataStream* s = (DataStream*)xalloc( sizeof(DataStream) );
+ if(s) {
+ s->data = data;
+ s->data_end = data + size;
+ s->number_size = 1; // Default to byte-sized numbers.
+ }
+ return s;
+}
+
+static void destroy_data_stream(DataStream* s) {
+ xfree(s);
+}
+
+static unsigned char get_byte(DataStream* s) {
+ assert(s->data + 1 <= s->data_end);
+ return *s->data++;
+}
+
+static short get_word(DataStream* s) {
+ short hi, lo;
+ assert(s->data + 2 <= s->data_end);
+ hi = *s->data++;
+ lo = *s->data++;
+ return ((hi << 8) | lo);
+}
+
+static int get_dword(DataStream* s) {
+ int b1, b2, b3, b4;
+ assert(s->data + 4 <= s->data_end);
+ b4 = *s->data++;
+ b3 = *s->data++;
+ b2 = *s->data++;
+ b1 = *s->data++;
+ return ((b4 << 24) | (b3 << 16) | (b2 << 8) | b1);
+}
+
+static int get_number(DataStream* s) {
+ switch (s->number_size) {
+ case 4: return get_dword(s);
+ case 2: return get_word(s);
+ default: return get_byte(s);
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Utility functions to help parse Darwin keymap
+//-----------------------------------------------------------------------------
+
+/*
+ * bits_set
+ * Calculate number of bits set in the modifier mask.
+ */
+static short bits_set(short mask) {
+ short n = 0;
+
+ for ( ; mask != 0; mask >>= 1)
+ if ((mask & 0x01) != 0)
+ n++;
+ return n;
+}
+
+/*
+ * parse_next_char_code
+ * Read the next character code from the Darwin keymapping
+ * and write it to the X keymap.
+ */
+static void parse_next_char_code(DataStream *s, KeySym *k) {
+ const short charSet = get_number(s);
+ const short charCode = get_number(s);
+
+ if (charSet == 0) { // ascii character
+ if (charCode >= 0 && charCode < 256)
+ *k = next_to_x[charCode];
+ } else if (charSet == 0x01) { // symbol character
+ if (charCode >= MIN_SYMBOL &&
+ charCode <= MIN_SYMBOL + NUM_SYMBOL)
+ *k = symbol_to_x[charCode - MIN_SYMBOL];
+ } else if (charSet == 0xFE) { // function key
+ if (charCode >= MIN_FUNCKEY &&
+ charCode <= MIN_FUNCKEY + NUM_FUNCKEY)
+ *k = funckey_to_x[charCode - MIN_FUNCKEY];
+ }
+}
+
+
+/*
+ * DarwinReadKeymapFile
+ * Read the appropriate keymapping from a keymapping file.
+ */
+static Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) {
+ struct stat st;
+ NXEventSystemDevice info[20];
+ int interface = 0, handler_id = 0;
+ int map_interface, map_handler_id, map_size = 0;
+ unsigned int i, size;
+ int *bufferEnd;
+ union km_tag {
+ int *intP;
+ char *charP;
+ } km;
+
+ fref = fopen( darwinKeymapFile, "rb" );
+ if (fref == NULL) {
+ ErrorF("Unable to open keymapping file '%s': %s.\n",
+ darwinKeymapFile, strerror(errno));
+ return FALSE;
+ }
+ if (fstat(fileno(fref), &st) == -1) {
+ ErrorF("Could not stat keymapping file '%s': %s.\n",
+ darwinKeymapFile, strerror(errno));
+ return FALSE;
+ }
+
+ // check to make sure we don't crash later
+ if (st.st_size <= 16*sizeof(int)) {
+ ErrorF("Keymapping file '%s' is invalid (too small).\n",
+ darwinKeymapFile);
+ return FALSE;
+ }
+
+ inBuffer = (char*) xalloc( st.st_size );
+ bufferEnd = (int *) (inBuffer + st.st_size);
+ if (fread(inBuffer, st.st_size, 1, fref) != 1) {
+ ErrorF("Could not read %qd bytes from keymapping file '%s': %s.\n",
+ st.st_size, darwinKeymapFile, strerror(errno));
+ return FALSE;
+ }
+
+ if (strncmp( inBuffer, "KYM1", 4 ) == 0) {
+ // Magic number OK.
+ } else if (strncmp( inBuffer, "KYMP", 4 ) == 0) {
+ ErrorF("Keymapping file '%s' is intended for use with the original NeXT keyboards and cannot be used by XDarwin.\n", darwinKeymapFile);
+ return FALSE;
+ } else {
+ ErrorF("Keymapping file '%s' has a bad magic number and cannot be used by XDarwin.\n", darwinKeymapFile);
+ return FALSE;
+ }
+
+ // find the keyboard interface and handler id
+ size = sizeof( info ) / sizeof( int );
+ if (!NXEventSystemInfo( darwinParamConnect, NX_EVS_DEVICE_INFO,
+ (NXEventSystemInfoType) info, &size )) {
+ ErrorF("Error reading event status driver info.\n");
+ return FALSE;
+ }
+
+ size = size * sizeof( int ) / sizeof( info[0] );
+ for( i = 0; i < size; i++) {
+ if (info[i].dev_type == NX_EVS_DEVICE_TYPE_KEYBOARD) {
+ Bool hasInterface = FALSE;
+ Bool hasMatch = FALSE;
+
+ interface = info[i].interface;
+ handler_id = info[i].id;
+
+ // Find an appropriate keymapping:
+ // The first time we try to match both interface and handler_id.
+ // If we can't match both, we take the first match for interface.
+
+ do {
+ km.charP = inBuffer;
+ km.intP++;
+ while (km.intP+3 < bufferEnd) {
+ map_interface = NXSwapBigIntToHost(*(km.intP++));
+ map_handler_id = NXSwapBigIntToHost(*(km.intP++));
+ map_size = NXSwapBigIntToHost(*(km.intP++));
+ if (map_interface == interface) {
+ if (map_handler_id == handler_id || hasInterface) {
+ hasMatch = TRUE;
+ break;
+ } else {
+ hasInterface = TRUE;
+ }
+ }
+ km.charP += map_size;
+ }
+ } while (hasInterface && !hasMatch);
+
+ if (hasMatch) {
+ // fill in NXKeyMapping structure
+ keyMap->size = map_size;
+ keyMap->mapping = (char*) xalloc(map_size);
+ memcpy(keyMap->mapping, km.charP, map_size);
+ return TRUE;
+ }
+ } // if dev_id == keyboard device
+ } // foreach info struct
+
+ // The keymapping file didn't match any of the info structs
+ // returned by NXEventSystemInfo.
+ ErrorF("Keymapping file '%s' did not contain appropriate keyboard interface.\n", darwinKeymapFile);
+ return FALSE;
+}
+
+
+/*
+ * DarwinParseNXKeyMapping
+ */
+static Bool DarwinParseNXKeyMapping(darwinKeyboardInfo *info) {
+ KeySym *k;
+ int i;
+ short numMods, numKeys, numPadKeys = 0;
+ Bool haveKeymap = FALSE;
+ NXKeyMapping keyMap;
+ DataStream *keyMapStream;
+ unsigned char const *numPadStart = 0;
+
+ if (darwinKeymapFile) {
+ haveKeymap = DarwinReadKeymapFile(&keyMap);
+ if (fref)
+ fclose(fref);
+ if (inBuffer)
+ xfree(inBuffer);
+ if (!haveKeymap) {
+ ErrorF("Reverting to kernel keymapping.\n");
+ }
+ }
+
+ if (!haveKeymap) {
+ // get the Darwin keyboard map
+ keyMap.size = NXKeyMappingLength( darwinParamConnect );
+ keyMap.mapping = (char*) xalloc( keyMap.size );
+ if (!NXGetKeyMapping( darwinParamConnect, &keyMap )) {
+ return FALSE;
+ }
+ }
+
+ keyMapStream = new_data_stream( (unsigned char const*)keyMap.mapping,
+ keyMap.size );
+
+ // check the type of map
+ if (get_word(keyMapStream)) {
+ keyMapStream->number_size = 2;
+ ErrorF("Current 16-bit keymapping may not be interpreted correctly.\n");
+ }
+
+ // Insert X modifier KeySyms into the keyboard map.
+ numMods = get_number(keyMapStream);
+ while (numMods-- > 0) {
+ int left = 1; // first keycode is left
+ short const charCode = get_number(keyMapStream);
+ short numKeyCodes = get_number(keyMapStream);
+
+ // This is just a marker, not a real modifier.
+ // Store numeric keypad keys for later.
+ if (charCode == NX_MODIFIERKEY_NUMERICPAD) {
+ numPadStart = keyMapStream->data;
+ numPadKeys = numKeyCodes;
+ }
+
+ while (numKeyCodes-- > 0) {
+ const short keyCode = get_number(keyMapStream);
+ if (charCode != NX_MODIFIERKEY_NUMERICPAD) {
+ switch (charCode) {
+ case NX_MODIFIERKEY_ALPHALOCK:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Caps_Lock;
+ break;
+ case NX_MODIFIERKEY_SHIFT:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Shift_L : XK_Shift_R);
+ break;
+ case NX_MODIFIERKEY_CONTROL:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Control_L : XK_Control_R);
+ break;
+ case NX_MODIFIERKEY_ALTERNATE:
+ // info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Mode_switch;
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Alt_L : XK_Alt_R);
+ break;
+ case NX_MODIFIERKEY_COMMAND:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Meta_L : XK_Meta_R);
+ break;
+ case NX_MODIFIERKEY_SECONDARYFN:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Control_L : XK_Control_R);
+ break;
+ case NX_MODIFIERKEY_HELP:
+ // Help is not an X11 modifier; treat as normal key
+ info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Help;
+ break;
+ }
+ }
+ left = 0;
+ }
+ }
+
+ // Convert the Darwin keyboard mapping to an X keyboard map.
+ // A key can have a different character code for each combination of
+ // modifiers. We currently ignore all modifier combinations except
+ // those with Shift, AlphaLock, and Alt.
+ numKeys = get_number(keyMapStream);
+ for (i = 0, k = info->keyMap; i < numKeys; i++, k += GLYPHS_PER_KEY) {
+ short const charGenMask = get_number(keyMapStream);
+ if (charGenMask != 0xFF) { // is key bound?
+ short numKeyCodes = 1 << bits_set(charGenMask);
+
+ // Record unmodified case
+ parse_next_char_code( keyMapStream, k );
+ numKeyCodes--;
+
+ // If AlphaLock and Shift modifiers produce different codes,
+ // we record the Shift case since X handles AlphaLock.
+ if (charGenMask & 0x01) { // AlphaLock
+ parse_next_char_code( keyMapStream, k+1 );
+ numKeyCodes--;
+ }
+
+ if (charGenMask & 0x02) { // Shift
+ parse_next_char_code( keyMapStream, k+1 );
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Shift-AlphaLock
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+ }
+ }
+
+ // Skip the Control cases
+ if (charGenMask & 0x04) { // Control
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Control-AlphaLock
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+ }
+
+ if (charGenMask & 0x02) { // Control-Shift
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Shift-Control-AlphaLock
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+ }
+ }
+ }
+
+ // Process Alt cases
+ if (charGenMask & 0x08) { // Alt
+ parse_next_char_code( keyMapStream, k+2 );
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Alt-AlphaLock
+ parse_next_char_code( keyMapStream, k+3 );
+ numKeyCodes--;
+ }
+
+ if (charGenMask & 0x02) { // Alt-Shift
+ parse_next_char_code( keyMapStream, k+3 );
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Alt-Shift-AlphaLock
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+ }
+ }
+ }
+
+ while (numKeyCodes-- > 0) {
+ get_number(keyMapStream); get_number(keyMapStream);
+ }
+
+ if (k[3] == k[2]) k[3] = NoSymbol;
+ if (k[2] == k[1]) k[2] = NoSymbol;
+ if (k[1] == k[0]) k[1] = NoSymbol;
+ if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
+ }
+ }
+
+ // Now we have to go back through the list of keycodes that are on the
+ // numeric keypad and update the X keymap.
+ keyMapStream->data = numPadStart;
+ while(numPadKeys-- > 0) {
+ const short keyCode = get_number(keyMapStream);
+ k = &info->keyMap[keyCode * GLYPHS_PER_KEY];
+ for (i = 0; i < NUM_KEYPAD; i++) {
+ if (*k == normal_to_keypad[i].normalSym) {
+ k[0] = normal_to_keypad[i].keypadSym;
+ break;
+ }
+ }
+ }
+
+ // free Darwin keyboard map
+ destroy_data_stream( keyMapStream );
+ xfree( keyMap.mapping );
+
+ return TRUE;
+}
+
+/*
+ * DarwinBuildModifierMaps
+ * Use the keyMap field of keyboard info structure to populate
+ * the modMap and modifierKeycodes fields.
+ */
+static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
+ int i;
+ KeySym *k;
+
+ memset(info->modMap, NoSymbol, sizeof(info->modMap));
+ memset(info->modifierKeycodes, 0, sizeof(info->modifierKeycodes));
+
+ for (i = 0; i < NUM_KEYCODES; i++) {
+ k = info->keyMap + i * GLYPHS_PER_KEY;
+
+ switch (*k) {
+ case XK_Shift_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
+ info->modMap[MIN_KEYCODE + i] = ShiftMask;
+ break;
+
+ case XK_Shift_R:
+#ifdef NX_MODIFIERKEY_RSHIFT
+ info->modifierKeycodes[NX_MODIFIERKEY_RSHIFT][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
+#endif
+ info->modMap[MIN_KEYCODE + i] = ShiftMask;
+ break;
+
+ case XK_Control_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
+ info->modMap[MIN_KEYCODE + i] = ControlMask;
+ break;
+
+ case XK_Control_R:
+#ifdef NX_MODIFIERKEY_RCONTROL
+ info->modifierKeycodes[NX_MODIFIERKEY_RCONTROL][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
+#endif
+ info->modMap[MIN_KEYCODE + i] = ControlMask;
+ break;
+
+ case XK_Caps_Lock:
+ info->modifierKeycodes[NX_MODIFIERKEY_ALPHALOCK][0] = i;
+ info->modMap[MIN_KEYCODE + i] = LockMask;
+ break;
+
+ case XK_Alt_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
+ info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+ *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
+ break;
+
+ case XK_Alt_R:
+#ifdef NX_MODIFIERKEY_RALTERNATE
+ info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
+#endif
+ *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
+ info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+ break;
+
+ case XK_Mode_switch:
+ info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+ break;
+
+ case XK_Meta_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
+ info->modMap[MIN_KEYCODE + i] = Mod2Mask;
+ break;
+
+ case XK_Meta_R:
+#ifdef NX_MODIFIERKEY_RCOMMAND
+ info->modifierKeycodes[NX_MODIFIERKEY_RCOMMAND][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
+#endif
+ info->modMap[MIN_KEYCODE + i] = Mod2Mask;
+ break;
+
+ case XK_Num_Lock:
+ info->modMap[MIN_KEYCODE + i] = Mod3Mask;
+ break;
+ }
+ }
+}
+
+/*
+ * DarwinLoadKeyboardMapping
+ * Load the keyboard map from a file or system and convert
+ * it to an equivalent X keyboard map and modifier map.
+ */
+static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
+ memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
+
+ /* TODO: Clean this up
+ * QuartzReadSystemKeymap is in quartz/quartzKeyboard.c
+ * DarwinParseNXKeyMapping is here
+ */
+ if (!DarwinParseNXKeyMapping(&keyInfo)) {
+ DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running QuartzReadSystemKeymap().\n");
+ if (!QuartzReadSystemKeymap(&keyInfo)) {
+ FatalError("Could not build a valid keymap.");
+ }
+ }
+
+ DarwinBuildModifierMaps(&keyInfo);
+
+#ifdef DUMP_DARWIN_KEYMAP
+ int i;
+ KeySym *k;
+ DEBUG_LOG("Darwin -> X converted keyboard map\n");
+ for (i = 0, k = keyInfo.keyMap; i < NX_NUMKEYCODES;
+ i++, k += GLYPHS_PER_KEY)
+ {
+ int j;
+ for (j = 0; j < GLYPHS_PER_KEY; j++) {
+ if (k[j] == NoSymbol) {
+ DEBUG_LOG("0x%02x:\tNoSym\n", i);
+ } else {
+ DEBUG_LOG("0x%02x:\t0x%lx\n", i, k[j]);
+ }
+ }
+ }
+#endif
+
+ keySyms->map = keyInfo.keyMap;
+ keySyms->mapWidth = GLYPHS_PER_KEY;
+ keySyms->minKeyCode = MIN_KEYCODE;
+ keySyms->maxKeyCode = MAX_KEYCODE;
+}
+
+void QuartzXkbUpdate(DeviceIntPtr pDev) {
+#ifdef XQUARTZ_USE_XKB
+ SendDeviceMappingNotify(serverClient, MappingKeyboard,
+ pDev->key->curKeySyms.minKeyCode,
+ pDev->key->curKeySyms.maxKeyCode - pDev->key->curKeySyms.minKeyCode, pDev);
+ SendDeviceMappingNotify(serverClient, MappingModifier, 0, 0, pDev);
+ SwitchCoreKeyboard(pDev);
+#endif
+}
+
+/*
+ * DarwinKeyboardInit
+ * Get the Darwin keyboard map and compute an equivalent
+ * X keyboard map and modifier map. Set the new keyboard
+ * device structure.
+ */
+void DarwinKeyboardInit(DeviceIntPtr pDev) {
+ KeySymsRec keySyms;
+
+ // Open a shared connection to the HID System.
+ // Note that the Event Status Driver is really just a wrapper
+ // for a kIOHIDParamConnectType connection.
+ assert( darwinParamConnect = NXOpenEventStatus() );
+
+ DarwinLoadKeyboardMapping(&keySyms);
+ /* Initialize the seed, so we don't reload the keymap unnecessarily
+ (and possibly overwrite xinitrc changes) */
+ QuartzSystemKeymapSeed();
+
+#ifdef XQUARTZ_USE_XKB
+ XkbComponentNamesRec names;
+ bzero(&names, sizeof(names));
+ XkbSetRulesDflts("base", "pc105", "us", NULL, NULL);
+ assert(XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, keyInfo.modMap,
+ QuartzBell, DarwinChangeKeyboardControl));
+ assert(SetKeySymsMap(&pDev->key->curKeySyms, &keySyms));
+ assert(keyInfo.modMap!=NULL);
+ assert(pDev->key->modifierMap!=NULL);
+ memcpy(pDev->key->modifierMap, keyInfo.modMap, sizeof(keyInfo.modMap));
+
+ QuartzXkbUpdate(pDev);
+#else
+#error FAIL
+ assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms,
+ keyInfo.modMap, QuartzBell,
+ DarwinChangeKeyboardControl ));
+ SwitchCoreKeyboard(pDev);
+#endif
+}
+
+
+void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr pDev, int nevents) {
+ if (pDev == NULL) pDev = darwinKeyboard;
+
+ DEBUG_LOG("DarwinKeyboardReloadHandler(%p)\n", pDev);
+
+#ifdef XQUARTZ_USE_XKB
+ QuartzXkbUpdate(pDev);
+#else
+#error FAIL
+ if (pDev->key) {
+ if (pDev->key->curKeySyms.map) xfree(pDev->key->curKeySyms.map);
+ if (pDev->key->modifierKeyMap) xfree(pDev->key->modifierKeyMap);
+ xfree(pDev->key);
+ }
+
+ KeySymsRec keySyms;
+ if (!InitKeyClassDeviceStruct(pDev, &keySyms, keyInfo.modMap)) {
+ DEBUG_LOG("InitKeyClassDeviceStruct failed\n");
+ return;
+ }
+
+ SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, 0);
+ SendMappingNotify(MappingModifier, 0, 0, 0);
+#endif
+}
+
+
+//-----------------------------------------------------------------------------
+// Modifier translation functions
+//
+// There are three different ways to specify a Mac modifier key:
+// keycode - specifies hardware key, read from keymapping
+// key - NX_MODIFIERKEY_*, really an index
+// mask - NX_*MASK, mask for modifier flags in event record
+// Left and right side have different keycodes but the same key and mask.
+//-----------------------------------------------------------------------------
+
+/*
+ * DarwinModifierNXKeyToNXKeycode
+ * Return the keycode for an NX_MODIFIERKEY_* modifier.
+ * side = 0 for left or 1 for right.
+ * Returns 0 if key+side is not a known modifier.
+ */
+int DarwinModifierNXKeyToNXKeycode(int key, int side) {
+ return keyInfo.modifierKeycodes[key][side];
+}
+
+/*
+ * DarwinModifierNXKeycodeToNXKey
+ * Returns -1 if keycode+side is not a modifier key
+ * outSide may be NULL, else it gets 0 for left and 1 for right.
+ */
+int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) {
+ int key, side;
+
+ keycode += MIN_KEYCODE;
+ // search modifierKeycodes for this keycode+side
+ for (key = 0; key < NX_NUMMODIFIERS; key++) {
+ for (side = 0; side <= 1; side++) {
+ if (keyInfo.modifierKeycodes[key][side] == keycode) break;
+ }
+ }
+ if (key == NX_NUMMODIFIERS) return -1;
+ if (outSide) *outSide = side;
+ return key;
+}
+
+/*
+ * DarwinModifierNXMaskToNXKey
+ * Returns -1 if mask is not a known modifier mask.
+ */
+int DarwinModifierNXMaskToNXKey(int mask) {
+ switch (mask) {
+ case NX_ALPHASHIFTMASK: return NX_MODIFIERKEY_ALPHALOCK;
+ case NX_SHIFTMASK: return NX_MODIFIERKEY_SHIFT;
+#ifdef NX_DEVICELSHIFTKEYMASK
+ case NX_DEVICELSHIFTKEYMASK: return NX_MODIFIERKEY_SHIFT;
+ case NX_DEVICERSHIFTKEYMASK: return NX_MODIFIERKEY_RSHIFT;
+#endif
+ case NX_CONTROLMASK: return NX_MODIFIERKEY_CONTROL;
+#ifdef NX_DEVICELCTLKEYMASK
+ case NX_DEVICELCTLKEYMASK: return NX_MODIFIERKEY_CONTROL;
+ case NX_DEVICERCTLKEYMASK: return NX_MODIFIERKEY_RCONTROL;
+#endif
+ case NX_ALTERNATEMASK: return NX_MODIFIERKEY_ALTERNATE;
+#ifdef NX_DEVICELALTKEYMASK
+ case NX_DEVICELALTKEYMASK: return NX_MODIFIERKEY_ALTERNATE;
+ case NX_DEVICERALTKEYMASK: return NX_MODIFIERKEY_RALTERNATE;
+#endif
+ case NX_COMMANDMASK: return NX_MODIFIERKEY_COMMAND;
+#ifdef NX_DEVICELCMDKEYMASK
+ case NX_DEVICELCMDKEYMASK: return NX_MODIFIERKEY_COMMAND;
+ case NX_DEVICERCMDKEYMASK: return NX_MODIFIERKEY_RCOMMAND;
+#endif
+ case NX_NUMERICPADMASK: return NX_MODIFIERKEY_NUMERICPAD;
+ case NX_HELPMASK: return NX_MODIFIERKEY_HELP;
+ case NX_SECONDARYFNMASK: return NX_MODIFIERKEY_SECONDARYFN;
+ }
+ return -1;
+}
+
+static const char *DarwinModifierNXMaskTostring(int mask) {
+ switch (mask) {
+ case NX_ALPHASHIFTMASK: return "NX_ALPHASHIFTMASK";
+ case NX_SHIFTMASK: return "NX_SHIFTMASK";
+ case NX_DEVICELSHIFTKEYMASK: return "NX_DEVICELSHIFTKEYMASK";
+ case NX_DEVICERSHIFTKEYMASK: return "NX_DEVICERSHIFTKEYMASK";
+ case NX_CONTROLMASK: return "NX_CONTROLMASK";
+ case NX_DEVICELCTLKEYMASK: return "NX_DEVICELCTLKEYMASK";
+ case NX_DEVICERCTLKEYMASK: return "NX_DEVICERCTLKEYMASK";
+ case NX_ALTERNATEMASK: return "NX_ALTERNATEMASK";
+ case NX_DEVICELALTKEYMASK: return "NX_DEVICELALTKEYMASK";
+ case NX_DEVICERALTKEYMASK: return "NX_DEVICERALTKEYMASK";
+ case NX_COMMANDMASK: return "NX_COMMANDMASK";
+ case NX_DEVICELCMDKEYMASK: return "NX_DEVICELCMDKEYMASK";
+ case NX_DEVICERCMDKEYMASK: return "NX_DEVICERCMDKEYMASK";
+ case NX_NUMERICPADMASK: return "NX_NUMERICPADMASK";
+ case NX_HELPMASK: return "NX_HELPMASK";
+ case NX_SECONDARYFNMASK: return "NX_SECONDARYFNMASK";
+ }
+ return "unknown mask";
+}
+
+/*
+ * DarwinModifierNXKeyToNXMask
+ * Returns 0 if key is not a known modifier key.
+ */
+int DarwinModifierNXKeyToNXMask(int key) {
+ switch (key) {
+ case NX_MODIFIERKEY_ALPHALOCK: return NX_ALPHASHIFTMASK;
+ case NX_MODIFIERKEY_SHIFT: return NX_SHIFTMASK;
+#ifdef NX_MODIFIERKEY_RSHIFT
+ case NX_MODIFIERKEY_RSHIFT: return NX_SHIFTMASK;
+#endif
+ case NX_MODIFIERKEY_CONTROL: return NX_CONTROLMASK;
+#ifdef NX_MODIFIERKEY_RCONTROL
+ case NX_MODIFIERKEY_RCONTROL: return NX_CONTROLMASK;
+#endif
+ case NX_MODIFIERKEY_ALTERNATE: return NX_ALTERNATEMASK;
+#ifdef NX_MODIFIERKEY_RALTERNATE
+ case NX_MODIFIERKEY_RALTERNATE: return NX_ALTERNATEMASK;
+#endif
+ case NX_MODIFIERKEY_COMMAND: return NX_COMMANDMASK;
+#ifdef NX_MODIFIERKEY_RCOMMAND
+ case NX_MODIFIERKEY_RCOMMAND: return NX_COMMANDMASK;
+#endif
+ case NX_MODIFIERKEY_NUMERICPAD: return NX_NUMERICPADMASK;
+ case NX_MODIFIERKEY_HELP: return NX_HELPMASK;
+ case NX_MODIFIERKEY_SECONDARYFN: return NX_SECONDARYFNMASK;
+ }
+ return 0;
+}
+
+/*
+ * DarwinModifierStringToNXKey
+ * Returns -1 if string is not a known modifier.
+ */
+int DarwinModifierStringToNXKey(const char *str) {
+ if (!strcasecmp(str, "shift")) return NX_MODIFIERKEY_SHIFT;
+ else if (!strcasecmp(str, "control")) return NX_MODIFIERKEY_CONTROL;
+ else if (!strcasecmp(str, "option")) return NX_MODIFIERKEY_ALTERNATE;
+ else if (!strcasecmp(str, "command")) return NX_MODIFIERKEY_COMMAND;
+ else if (!strcasecmp(str, "fn")) return NX_MODIFIERKEY_SECONDARYFN;
+ else return -1;
+}
+
+/*
+ * LegalModifier
+ * This allows the ddx layer to prevent some keys from being remapped
+ * as modifier keys.
+ */
+Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
+{
+ return 1;
+}
+
unsigned int QuartzSystemKeymapSeed(void) {
static unsigned int seed;
static KeyboardLayoutRef last_key_layout;
diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h
index 4f495bb46..964ea012e 100644
--- a/hw/xquartz/quartzKeyboard.h
+++ b/hw/xquartz/quartzKeyboard.h
@@ -49,4 +49,17 @@ typedef struct darwinKeyboardInfo_struct {
Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info);
unsigned int QuartzSystemKeymapSeed(void);
+/* Provided for darwinEvents.c */
+extern darwinKeyboardInfo keyInfo;
+void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
+void DarwinKeyboardInit(DeviceIntPtr pDev);
+int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide);
+int DarwinModifierNXKeyToNXKeycode(int key, int side);
+int DarwinModifierNXKeyToNXMask(int key);
+int DarwinModifierNXMaskToNXKey(int mask);
+int DarwinModifierStringToNXKey(const char *string);
+
+/* Provided for darwin.c */
+void DarwinKeyboardInit(DeviceIntPtr pDev);
+
#endif /* QUARTZ_KEYBOARD_H */
diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c
index e25e15583..233e6e630 100644
--- a/hw/xquartz/quartzStartup.c
+++ b/hw/xquartz/quartzStartup.c
@@ -27,6 +27,8 @@
* use or other dealings in this Software without prior written authorization.
*/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -41,13 +43,7 @@
#include "opaque.h"
#include "micmap.h"
-#ifdef NDEBUG
-#undef NDEBUG
-#include <assert.h>
-#define NDEBUG 1
-#else
#include <assert.h>
-#endif
char **envpGlobal; // argcGlobal and argvGlobal
// are from dix/globals.c
diff --git a/hw/xquartz/sanitizedCarbon.h b/hw/xquartz/sanitizedCarbon.h
new file mode 100644
index 000000000..cc6ef198d
--- /dev/null
+++ b/hw/xquartz/sanitizedCarbon.h
@@ -0,0 +1,32 @@
+/*
+ * Don't #include any of the AppKit, etc stuff directly since it will
+ * pollute the X11 namespace.
+ */
+
+#ifndef _XQ_SANITIZED_CARBON_H_
+#define _XQ_SANITIZED_CARBON_H_
+
+// QuickDraw in ApplicationServices has the following conflicts with
+// the basic X server headers. Use QD_<name> to use the QuickDraw
+// definition of any of these symbols, or the normal name for the
+// X11 definition.
+#define Cursor QD_Cursor
+#define WindowPtr QD_WindowPtr
+#define Picture QD_Picture
+#define BOOL OSX_BOOL
+#define EventType HIT_EventType
+
+#include <ApplicationServices/ApplicationServices.h>
+#include <CoreServices/CoreServices.h>
+#include <Carbon/Carbon.h>
+#include <IOKit/hidsystem/event_status_driver.h>
+#include <IOKit/hidsystem/ev_keymap.h>
+#include <architecture/byte_order.h> // For the NXSwap*
+
+#undef Cursor
+#undef WindowPtr
+#undef Picture
+#undef BOOL
+#undef EventType
+
+#endif /* _XQ_SANITIZED_CARBON_H_ */
diff --git a/hw/xquartz/sanitizedCocoa.h b/hw/xquartz/sanitizedCocoa.h
new file mode 100644
index 000000000..58de64c1c
--- /dev/null
+++ b/hw/xquartz/sanitizedCocoa.h
@@ -0,0 +1,27 @@
+/*
+ * Don't #include any of the AppKit, etc stuff directly since it will
+ * pollute the X11 namespace.
+ */
+
+#ifndef _XQ_SANITIZED_COCOA_H_
+#define _XQ_SANITIZED_COCOA_H_
+
+// QuickDraw in ApplicationServices has the following conflicts with
+// the basic X server headers. Use QD_<name> to use the QuickDraw
+// definition of any of these symbols, or the normal name for the
+// X11 definition.
+#define Cursor QD_Cursor
+#define WindowPtr QD_WindowPtr
+#define Picture QD_Picture
+#define BOOL OSX_BOOL
+#define EventType HIT_EventType
+
+#include <Cocoa/Cocoa.h>
+
+#undef Cursor
+#undef WindowPtr
+#undef Picture
+#undef BOOL
+#undef EventType
+
+#endif /* _XQ_SANITIZED_COCOA_H_ */
diff --git a/hw/xquartz/threadSafety.c b/hw/xquartz/threadSafety.c
new file mode 100644
index 000000000..7835de68d
--- /dev/null
+++ b/hw/xquartz/threadSafety.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2008 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.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "threadSafety.h"
+#include "os.h"
+
+#include <execinfo.h>
+
+pthread_t SERVER_THREAD;
+pthread_t APPKIT_THREAD;
+
+void spewCallStack(void) {
+ void* callstack[128];
+ int i, frames = backtrace(callstack, 128);
+ char** strs = backtrace_symbols(callstack, frames);
+
+ for (i = 0; i < frames; ++i) {
+ ErrorF("%s\n", strs[i]);
+ }
+
+ free(strs);
+}
+
+void _threadAssert(pthread_t tid, const char *file, const char *fun, int line) {
+ if(pthread_equal(pthread_self(), tid))
+ return;
+
+ /* NOOOO! */
+ ErrorF("Thread Assertion Failed: self=%s, expected=%s\n%s:%s:%d\n",
+ threadSafetyID(pthread_self()), threadSafetyID(tid),
+ file, fun, line);
+ spewCallStack();
+}
diff --git a/hw/xquartz/darwinKeyboard.h b/hw/xquartz/threadSafety.h
index 762f65919..ed2ad9ff5 100644
--- a/hw/xquartz/darwinKeyboard.h
+++ b/hw/xquartz/threadSafety.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003-2004 Torrey T. Lyons. All Rights Reserved.
+ * Copyright (C) 2008 Apple, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -24,22 +24,32 @@
* use or other dealings in this Software without prior written authorization.
*/
-#ifndef DARWIN_KEYBOARD_H
-#define DARWIN_KEYBOARD_H 1
+#ifndef _XQ_THREAD_SAFETY_H_
+#define _XQ_THREAD_SAFETY_H_
-#include "quartzKeyboard.h"
+#define DEBUG_THREADS 1
-/* Provided for darwinEvents.c */
-extern darwinKeyboardInfo keyInfo;
-void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
-void DarwinKeyboardInit(DeviceIntPtr pDev);
-int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide);
-int DarwinModifierNXKeyToNXKeycode(int key, int side);
-int DarwinModifierNXKeyToNXMask(int key);
-int DarwinModifierNXMaskToNXKey(int mask);
-int DarwinModifierStringToNXKey(const char *string);
+#include <pthread.h>
-/* Provided for darwin.c */
-void DarwinKeyboardInit(DeviceIntPtr pDev);
+extern pthread_t SERVER_THREAD;
+extern pthread_t APPKIT_THREAD;
-#endif /* DARWIN_KEYBOARD_H */
+#define threadSafetyID(tid) (pthread_equal((tid), SERVER_THREAD) ? "X Server Thread" : "Appkit Thread")
+
+/* Dump the call stack */
+void spewCallStack(void);
+
+/* Print message to ErrorF if we're in the wrong thread */
+void _threadAssert(pthread_t tid, const char *file, const char *fun, int line);
+
+#define threadAssert(tid) _threadAssert(tid, __FILE__, __FUNCTION__, __LINE__)
+
+#ifdef DEBUG_THREADS
+#define TA_SERVER() threadAssert(SERVER_THREAD)
+#define TA_APPKIT() threadAssert(APPKIT_THREAD)
+#else
+#define TA_SERVER()
+#define TA_APPKIT()
+#endif
+
+#endif _XQ_THREAD_SAFETY_H_
diff --git a/hw/xquartz/xpr/Makefile.am b/hw/xquartz/xpr/Makefile.am
index b4d67c7b7..60074238c 100644
--- a/hw/xquartz/xpr/Makefile.am
+++ b/hw/xquartz/xpr/Makefile.am
@@ -11,6 +11,7 @@ Xquartz_SOURCES = \
dri.c \
xprAppleWM.c \
xprCursor.c \
+ xprEvent.c \
xprFrame.c \
xprScreen.c \
x-hash.c \
@@ -27,11 +28,9 @@ Xquartz_LDADD = \
$(top_builddir)/miext/shadow/libshadow.la \
$(top_builddir)/fb/libfb.la \
$(top_builddir)/mi/libmi.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 \
@@ -40,7 +39,6 @@ Xquartz_LDADD = \
$(top_builddir)/record/librecord.la \
$(top_builddir)/XTrap/libxtrap.la \
$(top_builddir)/miext/rootless/librootless.la \
- $(top_builddir)/miext/rootless/accel/librlAccel.la \
$(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin
Xquartz_LDFLAGS = \
@@ -73,4 +71,5 @@ EXTRA_DIST = \
x-hash.h \
x-hook.h \
x-list.h \
- xpr.h
+ xpr.h \
+ xprEvent.h
diff --git a/hw/xquartz/xpr/dri.h b/hw/xquartz/xpr/dri.h
index cf2638a9f..8bb2e9e80 100644
--- a/hw/xquartz/xpr/dri.h
+++ b/hw/xquartz/xpr/dri.h
@@ -41,7 +41,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "scrnintstr.h"
#define _APPLEDRI_SERVER_
#include "appledri.h"
-#include "Xplugin.h"
+#include <Xplugin.h>
typedef void (*ClipNotifyPtr)( WindowPtr, int, int );
diff --git a/hw/xquartz/xpr/xpr.h b/hw/xquartz/xpr/xpr.h
index b8c69df0d..ab79a42cd 100644
--- a/hw/xquartz/xpr/xpr.h
+++ b/hw/xquartz/xpr/xpr.h
@@ -29,7 +29,9 @@
#ifndef XPR_H
#define XPR_H
+#include "windowstr.h"
#include "screenint.h"
+#include <Xplugin.h>
Bool QuartzModeBundleInit(void);
@@ -37,6 +39,7 @@ void AppleDRIExtensionInit(void);
void xprAppleWMInit(void);
Bool xprInit(ScreenPtr pScreen);
Bool xprIsX11Window(void *nsWindow, int windowNumber);
+WindowPtr xprGetXWindow(xp_window_id wid);
void xprHideWindows(Bool hide);
diff --git a/hw/xquartz/xpr/xprAppleWM.c b/hw/xquartz/xpr/xprAppleWM.c
index bd82df03c..aa5f29159 100644
--- a/hw/xquartz/xpr/xprAppleWM.c
+++ b/hw/xquartz/xpr/xprAppleWM.c
@@ -34,7 +34,7 @@
#include "xpr.h"
#include "applewmExt.h"
#include "rootless.h"
-#include "Xplugin.h"
+#include <Xplugin.h>
#include <X11/X.h>
static int xprSetWindowLevel(
diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c
index 2ad8d6f56..76ab75c02 100644
--- a/hw/xquartz/xpr/xprCursor.c
+++ b/hw/xquartz/xpr/xprCursor.c
@@ -29,6 +29,8 @@
* use or other dealings in this Software without prior written authorization.
*/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -37,7 +39,7 @@
#include "xpr.h"
#include "darwin.h"
#include "darwinEvents.h"
-#include "Xplugin.h"
+#include <Xplugin.h>
#include "mi.h"
#include "scrnintstr.h"
diff --git a/hw/xquartz/xpr/xprEvent.c b/hw/xquartz/xpr/xprEvent.c
new file mode 100644
index 000000000..617d6e146
--- /dev/null
+++ b/hw/xquartz/xpr/xprEvent.c
@@ -0,0 +1,91 @@
+/* Copyright (c) 2008 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.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "xpr.h"
+
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "inputstr.h"
+#include "mi.h"
+#include "scrnintstr.h"
+#include "mipointer.h"
+
+#include "darwin.h"
+#include "quartz.h"
+#include "quartzKeyboard.h"
+#include "darwinEvents.h"
+
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#include "rootlessWindow.h"
+#include "xprEvent.h"
+
+static void xprEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
+ int i;
+
+ TA_SERVER();
+
+ DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents);
+ for (i=0; i<nevents; i++) {
+ switch(xe[i].u.u.type) {
+
+ case kXquartzWindowState:
+ DEBUG_LOG("kXquartzWindowState\n");
+ RootlessNativeWindowStateChanged(xprGetXWindow(xe[i].u.clientMessage.u.l.longs0),
+ xe[i].u.clientMessage.u.l.longs1);
+ break;
+
+ case kXquartzWindowMoved:
+ DEBUG_LOG("kXquartzWindowMoved\n");
+ RootlessNativeWindowMoved ((WindowPtr)xe[i].u.clientMessage.u.l.longs0);
+ break;
+
+ case kXquartzBringAllToFront:
+ DEBUG_LOG("kXquartzBringAllToFront\n");
+ RootlessOrderAllWindows();
+ break;
+ }
+ }
+}
+
+void QuartzModeEQInit(void) {
+ mieqSetHandler(kXquartzWindowState, xprEventHandler);
+ mieqSetHandler(kXquartzWindowMoved, xprEventHandler);
+ mieqSetHandler(kXquartzBringAllToFront, xprEventHandler);
+}
diff --git a/hw/xquartz/xpr/xprEvent.h b/hw/xquartz/xpr/xprEvent.h
new file mode 100644
index 000000000..5af9dfd77
--- /dev/null
+++ b/hw/xquartz/xpr/xprEvent.h
@@ -0,0 +1,34 @@
+/* Copyright (c) 2008 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.
+ */
+
+#ifndef __XPR_EVENT_H__
+#define __XPR_EVENT_H__
+
+void QuartzModeEQInit(void);
+
+#endif
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 864ef0d40..901efca12 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -33,7 +33,7 @@
#include "xpr.h"
#include "rootlessCommon.h"
-#include "Xplugin.h"
+#include <Xplugin.h>
#include "x-hash.h"
#include "x-list.h"
#include "applewmExt.h"
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index d685fca33..6f7598f1c 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -27,6 +27,8 @@
* use or other dealings in this Software without prior written authorization.
*/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -35,18 +37,16 @@
#include "inputstr.h"
#include "quartz.h"
#include "xpr.h"
+#include "xprEvent.h"
#include "pseudoramiX.h"
#include "darwin.h"
#include "rootless.h"
#include "dri.h"
#include "globals.h"
-#include "Xplugin.h"
+#include <Xplugin.h>
#include "applewmExt.h"
#include "micmap.h"
-// From xprFrame.c
-WindowPtr xprGetXWindow(xp_window_id wid);
-
#ifdef DAMAGE
# include "damage.h"
#endif
@@ -150,7 +150,7 @@ displayScreenBounds(CGDirectDisplayID id)
/* Remove menubar to help standard X11 window managers. */
- if (frame.origin.x == 0 && frame.origin.y == 0)
+ if (frame.origin.y == 0)
{
frame.origin.y += aquaMenuBarHeight;
frame.size.height -= aquaMenuBarHeight;
@@ -352,7 +352,9 @@ xprSetupScreen(int index, ScreenPtr pScreen)
{
// Initialize accelerated rootless drawing
// Note that this must be done before DamageSetup().
- RootlessAccelInit(pScreen);
+
+ // These are crashing ugly... better to be stable and not crash for now.
+ //RootlessAccelInit(pScreen);
#ifdef DAMAGE
// The Damage extension needs to wrap underneath the