summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/dmx/examples/xinput.c2
-rw-r--r--hw/dmx/examples/xled.c2
-rw-r--r--hw/dmx/glxProxy/glxcmds.c24
-rw-r--r--hw/kdrive/ephyr/Makefile.am1
-rw-r--r--hw/kdrive/ephyr/XF86dri.c37
-rw-r--r--hw/kdrive/ephyr/ephyr.c34
-rw-r--r--hw/kdrive/ephyr/ephyr.h1
-rw-r--r--hw/kdrive/ephyr/ephyrinit.c19
-rw-r--r--hw/kdrive/ephyr/hostx.c31
-rw-r--r--hw/kdrive/ephyr/hostx.h4
-rw-r--r--hw/vfb/Xvfb.man.pre6
-rw-r--r--hw/xfree86/common/Makefile.am2
-rw-r--r--hw/xfree86/common/modeline2c.awk17
-rw-r--r--hw/xfree86/common/xf86AutoConfig.c13
-rw-r--r--hw/xfree86/common/xf86Config.c41
-rw-r--r--hw/xfree86/common/xf86Helper.c1
-rw-r--r--hw/xfree86/common/xf86Init.c11
-rw-r--r--hw/xfree86/common/xf86Mode.c140
-rw-r--r--hw/xfree86/common/xf86Priv.h3
-rw-r--r--hw/xfree86/common/xf86cvt.c292
-rw-r--r--hw/xfree86/ddc/DDC.HOWTO16
-rw-r--r--hw/xfree86/ddc/edid.h46
-rw-r--r--hw/xfree86/ddc/interpret_edid.c15
-rw-r--r--hw/xfree86/ddc/print_edid.c69
-rw-r--r--hw/xfree86/ddc/xf86DDC.c250
-rw-r--r--hw/xfree86/ddc/xf86DDC.h2
-rw-r--r--hw/xfree86/dixmods/Makefile.am6
-rw-r--r--hw/xfree86/dixmods/extmod/modinit.c23
-rw-r--r--hw/xfree86/dri/Makefile.am2
-rw-r--r--hw/xfree86/dri2/Makefile.am5
-rw-r--r--hw/xfree86/dri2/dri2.c127
-rw-r--r--hw/xfree86/dri2/dri2.h21
-rw-r--r--hw/xfree86/dri2/dri2ext.c361
-rw-r--r--hw/xfree86/exa/examodule.c13
-rw-r--r--hw/xfree86/fbdevhw/fbdevhw.c7
-rw-r--r--hw/xfree86/int10/helper_exec.c59
-rw-r--r--hw/xfree86/loader/dixsym.c12
-rw-r--r--hw/xfree86/loader/xf86sym.c6
-rw-r--r--hw/xfree86/modes/Makefile.am1
-rw-r--r--hw/xfree86/modes/xf86Crtc.c498
-rw-r--r--hw/xfree86/modes/xf86Crtc.h34
-rw-r--r--hw/xfree86/modes/xf86Cursors.c19
-rw-r--r--hw/xfree86/modes/xf86EdidModes.c141
-rw-r--r--hw/xfree86/modes/xf86Modes.c36
-rw-r--r--hw/xfree86/modes/xf86Modes.h1
-rw-r--r--hw/xfree86/modes/xf86RandR12.c76
-rw-r--r--hw/xfree86/modes/xf86cvt.c9
-rw-r--r--hw/xfree86/modes/xf86gtf.c388
-rw-r--r--hw/xfree86/os-support/bsd/i386_video.c5
-rw-r--r--hw/xfree86/os-support/bus/Makefile.am12
-rw-r--r--hw/xfree86/os-support/bus/Pci.h3
-rw-r--r--hw/xfree86/os-support/bus/bsd_pci.c2
-rw-r--r--hw/xfree86/os-support/linux/Makefile.am2
-rw-r--r--hw/xfree86/os-support/shared/ia64Pci.c55
-rw-r--r--hw/xfree86/parser/Configint.h5
-rw-r--r--hw/xfree86/parser/DRI.c2
-rw-r--r--hw/xfree86/parser/Screen.c1
-rw-r--r--hw/xfree86/parser/scan.c11
-rw-r--r--hw/xfree86/utils/cvt/Makefile.am6
-rw-r--r--hw/xfree86/utils/ioport/Makefile.am2
-rw-r--r--hw/xfree86/vbe/vbeModes.c3
-rw-r--r--hw/xfree86/x86emu/Makefile.am1
-rw-r--r--hw/xfree86/xaa/xaaInitAccel.c57
-rw-r--r--hw/xfree86/xf4bpp/ppcSpMcro.h6
-rw-r--r--hw/xnest/Events.c4
-rw-r--r--hw/xprint/pcl/PclMisc.c17
-rw-r--r--hw/xprint/pcl/PclWindow.c6
-rw-r--r--hw/xprint/ps/PsMisc.c17
-rw-r--r--hw/xprint/ps/PsWindow.c6
-rw-r--r--hw/xquartz/Makefile.am2
-rw-r--r--hw/xquartz/X11Application.h4
-rw-r--r--hw/xquartz/X11Application.m509
-rw-r--r--hw/xquartz/X11Controller.h2
-rw-r--r--hw/xquartz/X11Controller.m98
-rw-r--r--hw/xquartz/applewm.c14
-rw-r--r--hw/xquartz/bundle/English.lproj/main.nib/designable.nib502
-rw-r--r--hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nibbin35571 -> 37918 bytes
-rw-r--r--hw/xquartz/darwin.c26
-rw-r--r--hw/xquartz/darwin.h43
-rw-r--r--hw/xquartz/darwinEvents.c422
-rw-r--r--hw/xquartz/darwinEvents.h12
-rw-r--r--hw/xquartz/darwinKeyboard.c20
-rw-r--r--hw/xquartz/darwinKeyboard.h2
-rw-r--r--hw/xquartz/darwinXinput.c200
-rw-r--r--hw/xquartz/pseudoramiX.c6
-rw-r--r--hw/xquartz/quartz.c153
-rw-r--r--hw/xquartz/quartz.h2
-rw-r--r--hw/xquartz/quartzCocoa.m3
-rw-r--r--hw/xquartz/quartzCommon.h14
-rw-r--r--hw/xquartz/quartzCursor.c646
-rw-r--r--hw/xquartz/quartzCursor.h42
-rw-r--r--hw/xquartz/quartzForeground.c2
-rw-r--r--hw/xquartz/quartzKeyboard.h3
-rw-r--r--hw/xquartz/quartzPasteboard.c58
-rw-r--r--hw/xquartz/quartzPasteboard.h4
-rw-r--r--hw/xquartz/xpr/Makefile.am4
-rw-r--r--hw/xquartz/xpr/xprCursor.c4
-rw-r--r--hw/xquartz/xpr/xprFrame.c4
-rw-r--r--hw/xquartz/xpr/xprScreen.c28
-rwxr-xr-xhw/xwin/winwin32rootless.c4
100 files changed, 3213 insertions, 2767 deletions
diff --git a/hw/dmx/examples/xinput.c b/hw/dmx/examples/xinput.c
index b6753e4ec..74353a93b 100644
--- a/hw/dmx/examples/xinput.c
+++ b/hw/dmx/examples/xinput.c
@@ -38,7 +38,7 @@
#include <X11/XKBlib.h>
#include <X11/extensions/XInput.h>
#include <X11/extensions/XKB.h>
-#include "xkbstr.h"
+#include <X11/extensions/XKBstr.h>
#include <X11/extensions/dmxext.h>
#include <sys/time.h>
diff --git a/hw/dmx/examples/xled.c b/hw/dmx/examples/xled.c
index 322dda2f3..270f80511 100644
--- a/hw/dmx/examples/xled.c
+++ b/hw/dmx/examples/xled.c
@@ -37,7 +37,7 @@
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKB.h>
-#include "xkbstr.h"
+#include <X11/extensions/XKBstr.h>
#include <sys/time.h>
int main(int argc, char **argv)
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index 85e0f8701..ab7ee96b9 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -431,7 +431,7 @@ int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
__glXWindow *pGlxWindow = NULL;
int rc;
- rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess);
+ rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess);
if (rc != Success) {
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
__glXPixmapRes);
@@ -461,7 +461,7 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
__glXWindow *pGlxWindow = NULL;
int rc;
- rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess);
+ rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess);
if (rc != Success) {
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
__glXPixmapRes);
@@ -481,7 +481,7 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
if (req->member != None) {
rc = dixLookupDrawable(&pMember, req->member, client, 0,
- DixUnknownAccess);
+ DixGetAttrAccess);
if (rc != Success) {
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->member,
__glXPixmapRes);
@@ -780,7 +780,7 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) {
/*
@@ -887,7 +887,7 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (readId != None && readId != drawId ) {
- rc = dixLookupDrawable(&pReadDraw, readId, client, 0,DixUnknownAccess);
+ rc = dixLookupDrawable(&pReadDraw, readId, client, 0, DixReadAccess);
if (rc == Success) {
if (pReadDraw->type == DRAWABLE_WINDOW) {
/*
@@ -1645,7 +1645,7 @@ static int CreateGLXPixmap(__GLXclientState *cl,
#endif
rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP,
- DixUnknownAccess);
+ DixAddAccess);
if (rc != Success)
return rc;
@@ -1779,7 +1779,7 @@ static int CreateGLXPixmap(__GLXclientState *cl,
#ifdef PANORAMIX
if (pXinDraw) {
dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0,
- DixUnknownAccess);
+ DixAddAccess);
}
#endif
@@ -1950,7 +1950,7 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
/*
** Check that the GLX drawable is valid.
*/
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
if (rc == Success) {
from_screen = to_screen = pDraw->pScreen->myNum;
@@ -2104,7 +2104,7 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
/*
** Check that the GLX drawable is valid.
*/
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
if (rc == Success) {
if (pDraw->type != DRAWABLE_WINDOW) {
/*
@@ -2893,7 +2893,7 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
** Check if windowId is valid
*/
rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW,
- DixUnknownAccess);
+ DixAddAccess);
if (rc != Success)
return rc;
@@ -3277,7 +3277,7 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
#endif
if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) {
WindowPtr pWin = (WindowPtr)pDraw;
@@ -3438,7 +3438,7 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
#endif
if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixSetAttrAccess);
if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) {
WindowPtr pWin = (WindowPtr)pDraw;
diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index d025c201c..81d3d69ea 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -35,6 +35,7 @@ if XEPHYR_HAS_DRI
libxephyr_hostdri_a_SOURCES= \
ephyrdriext.c \
+ephyrdriext.h \
ephyrdri.c \
ephyrdri.h \
XF86dri.c \
diff --git a/hw/kdrive/ephyr/XF86dri.c b/hw/kdrive/ephyr/XF86dri.c
index 506d7bed8..e656ff5a0 100644
--- a/hw/kdrive/ephyr/XF86dri.c
+++ b/hw/kdrive/ephyr/XF86dri.c
@@ -385,9 +385,8 @@ Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext)
context, hHWContext );
}
-GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context)
+GLboolean XF86DRIDestroyContext( Display *dpy, int screen, XID context)
{
- Display * const dpy = (Display *) ndpy;
XExtDisplayInfo *info = find_display (dpy);
xXF86DRIDestroyContextReq *req;
@@ -407,10 +406,9 @@ GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid
}
GLboolean
-XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
- __DRIid drawable, drm_drawable_t * hHWDrawable)
+XF86DRICreateDrawable (Display *dpy, int screen,
+ XID drawable, drm_drawable_t * hHWDrawable)
{
- Display * const dpy = (Display *) ndpy;
XExtDisplayInfo *info = find_display (dpy);
xXF86DRICreateDrawableReply rep;
xXF86DRICreateDrawableReq *req;
@@ -437,16 +435,36 @@ XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
return True;
}
-GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
- __DRIid drawable )
+static int noopErrorHandler(Display *dpy, XErrorEvent *xerr)
+{
+ return 0;
+}
+
+GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen,
+ XID drawable )
{
- Display * const dpy = (Display *) ndpy;
XExtDisplayInfo *info = find_display (dpy);
xXF86DRIDestroyDrawableReq *req;
+ int (*oldXErrorHandler)(Display *, XErrorEvent *);
TRACE("DestroyDrawable...");
XF86DRICheckExtension (dpy, info, False);
+ /* This is called from the DRI driver, which used call it like this
+ *
+ * if (windowExists(drawable))
+ * destroyDrawable(drawable);
+ *
+ * which is a textbook race condition - the window may disappear
+ * from the server between checking for its existance and
+ * destroying it. Instead we change the semantics of
+ * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
+ * the windows is gone, by wrapping the destroy call in an error
+ * handler. */
+
+ XSync(dpy, GL_FALSE);
+ oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
+
LockDisplay(dpy);
GetReq(XF86DRIDestroyDrawable, req);
req->reqType = info->codes->major_opcode;
@@ -455,6 +473,9 @@ GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
req->drawable = drawable;
UnlockDisplay(dpy);
SyncHandle();
+
+ XSetErrorHandler(oldXErrorHandler);
+
TRACE("DestroyDrawable... return True");
return True;
}
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index e892a9b0f..9f45fdb72 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -891,9 +891,12 @@ ephyrPoll(void)
continue;
}
{
- if (ephyrCurScreen != ev.data.mouse_motion.screen)
+ if (ev.data.mouse_motion.screen >=0
+ && (ephyrCurScreen != ev.data.mouse_motion.screen))
{
- EPHYR_LOG ("warping mouse cursor:%d\n", ephyrCurScreen) ;
+ EPHYR_LOG ("warping mouse cursor. "
+ "cur_screen%d, motion_screen:%d\n",
+ ephyrCurScreen, ev.data.mouse_motion.screen) ;
if (ev.data.mouse_motion.screen >= 0)
{
ephyrWarpCursor
@@ -904,11 +907,30 @@ ephyrPoll(void)
}
else
{
+ int x=0, y=0;
+#ifdef XEPHYR_DRI
+ EphyrWindowPair *pair = NULL;
+#endif
EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ;
- KdEnqueuePointerEvent(ephyrMouse, mouseState,
- ev.data.mouse_motion.x,
- ev.data.mouse_motion.y,
- 0);
+ x = ev.data.mouse_motion.x;
+ y = ev.data.mouse_motion.y;
+ EPHYR_LOG ("initial (x,y):(%d,%d)\n", x, y) ;
+#ifdef XEPHYR_DRI
+ EPHYR_LOG ("is this window peered by a gl drawable ?\n") ;
+ if (findWindowPairFromRemote (ev.data.mouse_motion.window,
+ &pair))
+ {
+ EPHYR_LOG ("yes, it is peered\n") ;
+ x += pair->local->drawable.x;
+ y += pair->local->drawable.y;
+ }
+ else
+ {
+ EPHYR_LOG ("no, it is not peered\n") ;
+ }
+ EPHYR_LOG ("final (x,y):(%d,%d)\n", x, y) ;
+#endif
+ KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0);
}
}
break;
diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h
index 8ed7e23dd..5d58a216c 100644
--- a/hw/kdrive/ephyr/ephyr.h
+++ b/hw/kdrive/ephyr/ephyr.h
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
+#include <libgen.h>
#include "os.h" /* for OsSignal() */
#include "kdrive.h"
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 0d01fb425..d415fe75f 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -109,6 +109,7 @@ ddxUseMsg (void)
ErrorF("-nodri do not use DRI\n");
#endif
ErrorF("-noxv do not use XV\n");
+ ErrorF("-name [name] define the name in the WM_CLASS property\n");
ErrorF("\n");
exit(1);
@@ -148,6 +149,11 @@ ddxProcessArgument (int argc, char **argv, int i)
{
EPHYR_DBG("mark argv[%d]='%s'", i, argv[i] );
+ if (i == 1)
+ {
+ hostx_use_resname(basename(argv[0]), 0);
+ }
+
if (!strcmp (argv[i], "-parent"))
{
if(i+1 < argc)
@@ -223,6 +229,19 @@ ddxProcessArgument (int argc, char **argv, int i)
EPHYR_LOG ("no XVideo enabled\n") ;
return 1 ;
}
+ else if (!strcmp (argv[i], "-name"))
+ {
+ if (i+1 < argc && argv[i+1][0] != '-')
+ {
+ hostx_use_resname(argv[i+1], 1);
+ return 2;
+ }
+ else
+ {
+ UseMsg();
+ return 0;
+ }
+ }
else if (argv[i][0] == ':')
{
hostx_set_display_name(argv[i]);
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index ae1bb4bf9..1a71d0641 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -107,6 +107,9 @@ extern EphyrKeySyms ephyrKeySyms;
extern int monitorResolution;
+char *ephyrResName = NULL;
+int ephyrResNameFromCmd = 0;
+
static void
hostx_set_fullscreen_hint(void);
@@ -296,6 +299,13 @@ hostx_handle_signal (int signum)
HostXWantDamageDebug);
}
+void
+hostx_use_resname (char *name, int fromcmd)
+{
+ ephyrResName = name;
+ ephyrResNameFromCmd = fromcmd;
+}
+
int
hostx_init (void)
{
@@ -304,6 +314,8 @@ hostx_init (void)
Pixmap cursor_pxm;
XColor col;
int index;
+ char *tmpstr;
+ XClassHint *class_hint;
attr.event_mask =
ButtonPressMask
@@ -327,6 +339,8 @@ hostx_init (void)
HostX.depth = DefaultDepth(HostX.dpy, HostX.screen);
HostX.visual = DefaultVisual(HostX.dpy, HostX.screen);
+ class_hint = XAllocClassHint();
+
for (index = 0 ; index < HostX.n_screens ; index++)
{
struct EphyrHostScreen *host_screen = &HostX.screens[index];
@@ -389,9 +403,23 @@ hostx_init (void)
hostx_set_fullscreen_hint();
}
+
+ if (class_hint)
+ {
+ tmpstr = getenv("RESOURCE_NAME");
+ if (tmpstr && (!ephyrResNameFromCmd))
+ ephyrResName = tmpstr;
+ class_hint->res_name = ephyrResName;
+ class_hint->res_class = "Xephyr";
+ XSetClassHint(hostx_get_display(), host_screen->win, class_hint);
+
+ }
+
}
}
+ if (class_hint)
+ XFree(class_hint);
XParseColor (HostX.dpy, DefaultColormap (HostX.dpy,HostX.screen),
"red", &col);
@@ -914,8 +942,9 @@ hostx_get_event(EphyrHostXEvent *ev)
host_screen_from_window (xev.xmotion.window);
ev->type = EPHYR_EV_MOUSE_MOTION;
- ev->data.mouse_motion.x = xev.xmotion.x;
+ ev->data.mouse_motion.x = xev.xmotion.x;
ev->data.mouse_motion.y = xev.xmotion.y;
+ ev->data.mouse_motion.window = xev.xmotion.window;
ev->data.mouse_motion.screen = (host_screen ? host_screen->mynum : -1);
}
return 1;
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
index f72cfe700..47ba61b5b 100644
--- a/hw/kdrive/ephyr/hostx.h
+++ b/hw/kdrive/ephyr/hostx.h
@@ -70,6 +70,7 @@ struct EphyrHostXEvent
int x;
int y;
int screen;
+ int window;
} mouse_motion;
struct mouse_down {
@@ -144,6 +145,9 @@ hostx_want_preexisting_window(EphyrScreenInfo screen);
void
hostx_use_preexisting_window(unsigned long win_id);
+void
+hostx_use_resname (char *name, int fromcmd);
+
void
hostx_handle_signal(int signum);
diff --git a/hw/vfb/Xvfb.man.pre b/hw/vfb/Xvfb.man.pre
index e78e296f5..569afe175 100644
--- a/hw/vfb/Xvfb.man.pre
+++ b/hw/vfb/Xvfb.man.pre
@@ -55,7 +55,7 @@ manual page, \fIXvfb\fP accepts the following command line switches:
.B "\-screen \fIscreennum\fP \fIWxHxD\fP"
This option creates screen \fIscreennum\fP and sets its width, height,
and depth to W, H, and D respectively. By default, only screen 0 exists
-and has the dimensions 1280x1024x12.
+and has the dimensions 1280x1024x8.
.TP 4
.B "\-pixdepths \fIlist-of-depths\fP"
This option specifies a list of pixmap depths that the server should
@@ -106,12 +106,12 @@ will be depth 32 1600x1200.
.TP 8
Xvfb :1 -screen 1 1600x1200x16
The server will listen for connections as server number 1, will have the
-default screen configuration (one screen, 1280x1024x12), and screen 1
+default screen configuration (one screen, 1280x1024x8), and screen 1
will be depth 16 1600x1200.
.TP 8
Xvfb -pixdepths 3 27 -fbdir /var/tmp
The server will listen for connections as server number 0, will have the
-default screen configuration (one screen, 1280x1024x12),
+default screen configuration (one screen, 1280x1024x8),
will also support pixmap
depths of 3 and 27,
and will use memory mapped files in /var/tmp for the framebuffer.
diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am
index 4f0a2d6b3..0f44075ba 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -30,7 +30,7 @@ BUILT_SOURCES = xf86DefModeSet.c
AM_LDFLAGS = -r
libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
- xf86Cursor.c xf86cvt.c xf86DGA.c xf86DPMS.c \
+ xf86Cursor.c xf86DGA.c xf86DPMS.c \
xf86DoProbe.c xf86Events.c \
xf86Globals.c xf86AutoConfig.c \
xf86MiscExt.c xf86Option.c \
diff --git a/hw/xfree86/common/modeline2c.awk b/hw/xfree86/common/modeline2c.awk
index d4b9649c8..71a956e05 100644
--- a/hw/xfree86/common/modeline2c.awk
+++ b/hw/xfree86/common/modeline2c.awk
@@ -44,8 +44,6 @@ BEGIN {
flagsdict["-hsync +vsync interlace"] = "V_NHSYNC | V_PVSYNC | V_INTERLACE"
flagsdict["-hsync -vsync interlace"] = "V_NHSYNC | V_NVSYNC | V_INTERLACE"
- print "/* $" "XFree86$ */"
- print
print "/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at"
print " * modeline2c.awk */"
print ""
@@ -68,12 +66,12 @@ BEGIN {
print ""
print "#include \"globals.h\""
print ""
- print "#define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT"
- print "#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0"
+ print "#define MODEPREFIX NULL, NULL, NULL, MODE_OK, M_T_DEFAULT"
+ print "#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0"
print ""
- print "DisplayModeRec xf86DefaultModes [] = {"
+ print "const DisplayModeRec xf86DefaultModes [] = {"
- modeline = "\t{MODEPREFIX(\"%dx%d\"),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n"
+ modeline = "\t{MODEPREFIX,%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n"
modeline_data = "^[a-zA-Z]+[ \t]+[^ \t]+[ \t0-9.]+"
}
@@ -81,10 +79,10 @@ BEGIN {
flags = $0
gsub(modeline_data, "", flags)
flags = tolower(flags)
- printf(modeline, $4, $8, $3 * 1000, $4, $5, $6, $7,
+ printf(modeline, $3 * 1000, $4, $5, $6, $7,
$8, $9, $10, $11, flagsdict[flags])
# Half-width double scanned modes
- printf(modeline, $4/2, $8/2, $3 * 500, $4/2, $5/2, $6/2, $7/2,
+ printf(modeline, $3 * 500, $4/2, $5/2, $6/2, $7/2,
$8/2, $9/2, $10/2, $11/2, flagsdict[flags] " | V_DBLSCAN")
}
@@ -93,5 +91,6 @@ BEGIN {
}
END {
- printf("\t{MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX}\n};\n")
+ print "};"
+ printf "const int xf86NumDefaultModes = sizeof(xf86DefaultModes) / sizeof(DisplayModeRec);"
}
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index da6c3f38d..3210e4460 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -82,7 +82,6 @@ static int builtinLines = 0;
static const char *deviceList[] = {
"fbdev",
"vesa",
- "vga",
NULL
};
@@ -141,12 +140,13 @@ videoPtrToDriverName(struct pci_device *dev)
{
/*
* things not handled yet:
- * amd/cyrix/nsc
- * xgi
+ * cyrix/nsc. should be merged into geode anyway.
+ * xgi.
*/
switch (dev->vendor_id)
{
+ case 0x1022: return "amd";
case 0x1142: return "apm";
case 0xedd8: return "ark";
case 0x1a03: return "ast";
@@ -436,9 +436,10 @@ chooseVideoDriver(void)
if (!info) {
ErrorF("Primary device is not PCI\n");
}
-
#ifdef __linux__
- matchDriverFromFiles(matches, info->vendor_id, info->device_id);
+ else {
+ matchDriverFromFiles(matches, info->vendor_id, info->device_id);
+ }
#endif /* __linux__ */
/* TODO Handle multiple drivers claiming to support the same PCI ID */
@@ -450,8 +451,6 @@ chooseVideoDriver(void)
if (chosen_driver == NULL) {
#if defined __i386__ || defined __amd64__ || defined __hurd__
chosen_driver = "vesa";
-#elif defined __alpha__
- chosen_driver = "vga";
#elif defined __sparc__
chosen_driver = "sunffb";
#else
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 521ad548b..9dcaa1930 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -119,8 +119,11 @@ static ModuleDefault ModuleDefaults[] = {
{.name = "dbe", .toLoad = TRUE, .load_opt=NULL},
{.name = "glx", .toLoad = TRUE, .load_opt=NULL},
{.name = "freetype", .toLoad = TRUE, .load_opt=NULL},
+#ifdef XRECORD
{.name = "record", .toLoad = TRUE, .load_opt=NULL},
+#endif
{.name = "dri", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "dri2", .toLoad = TRUE, .load_opt=NULL},
{.name = NULL, .toLoad = FALSE, .load_opt=NULL}
};
@@ -494,7 +497,7 @@ xf86InputDriverlistFromConfig()
static void
fixup_video_driver_list(char **drivers)
{
- static const char *fallback[5] = { "vga", "vesa", "fbdev", "wsfb", NULL };
+ static const char *fallback[4] = { "vesa", "fbdev", "wsfb", NULL };
char **end, **drv;
char *x;
char **ati, **atimisc;
@@ -2088,8 +2091,7 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
*/
cmodep = conf_monitor->mon_modeline_lst;
while( cmodep ) {
- mode = xnfalloc(sizeof(DisplayModeRec));
- memset(mode,'\0',sizeof(DisplayModeRec));
+ mode = xnfcalloc(1, sizeof(DisplayModeRec));
mode->type = 0;
mode->Clock = cmodep->ml_clock;
mode->HDisplay = cmodep->ml_hdisplay;
@@ -2421,31 +2423,16 @@ addDefaultModes(MonPtr monitorp)
DisplayModePtr last = monitorp->Last;
int i = 0;
- while (xf86DefaultModes[i].name != NULL)
+ for (i = 0; i < xf86NumDefaultModes; i++)
{
- if ( ! modeIsPresent(xf86DefaultModes[i].name,monitorp) )
- do
- {
- mode = xnfalloc(sizeof(DisplayModeRec));
- memcpy(mode,&xf86DefaultModes[i],sizeof(DisplayModeRec));
- if (xf86DefaultModes[i].name)
- mode->name = xnfstrdup(xf86DefaultModes[i].name);
- if( last ) {
- mode->prev = last;
- last->next = mode;
- }
- else {
- /* this is the first mode */
- monitorp->Modes = mode;
- mode->prev = NULL;
- }
- last = mode;
- i++;
- }
- while((xf86DefaultModes[i].name != NULL) &&
- (!strcmp(xf86DefaultModes[i].name,xf86DefaultModes[i-1].name)));
- else
- i++;
+ mode = xf86DuplicateMode(&xf86DefaultModes[i]);
+ if (!modeIsPresent(mode, monitorp))
+ {
+ monitorp->Modes = xf86ModesAdd(monitorp->Modes, mode);
+ last = mode;
+ } else {
+ xfree(mode);
+ }
}
monitorp->Last = last;
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 0d2471aa1..1dd0bbc0d 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1093,7 +1093,6 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable)
WindowPtr pChild;
Bool WasViewable = (Bool)(pWin->viewable);
Bool anyMarked = FALSE;
- RegionPtr pOldClip = NULL;
#ifdef DO_SAVE_UNDERS
Bool dosave = FALSE;
#endif
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index d1603c081..6d5eaadc3 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -172,12 +172,11 @@ xf86CreateRootWindow(WindowPtr pWin)
Atom prop;
prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE);
- err = ChangeWindowProperty(pWin,
- prop, pProp->type,
- pProp->format, PropModeReplace,
- pProp->size, pProp->data,
- FALSE
- );
+ err = dixChangeWindowProperty(serverClient, pWin,
+ prop, pProp->type,
+ pProp->format, PropModeReplace,
+ pProp->size, pProp->data,
+ FALSE);
}
/* Look at err */
diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index fb899a1e4..c1b0a5fc9 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -636,146 +636,6 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
return MODE_OK;
}
-
-#if 0
-/*
- * xf86SetModeCrtc
- *
- * Initialises the Crtc parameters for a mode. The initialisation includes
- * adjustments for interlaced and double scan modes.
- */
-_X_EXPORT void
-xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
-{
- if ((p == NULL) || ((p->type & M_T_CRTC_C) == M_T_BUILTIN))
- return;
-
- p->CrtcHDisplay = p->HDisplay;
- p->CrtcHSyncStart = p->HSyncStart;
- p->CrtcHSyncEnd = p->HSyncEnd;
- p->CrtcHTotal = p->HTotal;
- p->CrtcHSkew = p->HSkew;
- p->CrtcVDisplay = p->VDisplay;
- p->CrtcVSyncStart = p->VSyncStart;
- p->CrtcVSyncEnd = p->VSyncEnd;
- p->CrtcVTotal = p->VTotal;
- if (p->Flags & V_INTERLACE) {
- if (adjustFlags & INTERLACE_HALVE_V) {
- p->CrtcVDisplay /= 2;
- p->CrtcVSyncStart /= 2;
- p->CrtcVSyncEnd /= 2;
- p->CrtcVTotal /= 2;
- }
- /* Force interlaced modes to have an odd VTotal */
- /* maybe we should only do this when INTERLACE_HALVE_V is set? */
- p->CrtcVTotal |= 1;
- }
-
- if (p->Flags & V_DBLSCAN) {
- p->CrtcVDisplay *= 2;
- p->CrtcVSyncStart *= 2;
- p->CrtcVSyncEnd *= 2;
- p->CrtcVTotal *= 2;
- }
- if (p->VScan > 1) {
- p->CrtcVDisplay *= p->VScan;
- p->CrtcVSyncStart *= p->VScan;
- p->CrtcVSyncEnd *= p->VScan;
- p->CrtcVTotal *= p->VScan;
- }
- p->CrtcVBlankStart = min(p->CrtcVSyncStart, p->CrtcVDisplay);
- p->CrtcVBlankEnd = max(p->CrtcVSyncEnd, p->CrtcVTotal);
- p->CrtcHBlankStart = min(p->CrtcHSyncStart, p->CrtcHDisplay);
- p->CrtcHBlankEnd = max(p->CrtcHSyncEnd, p->CrtcHTotal);
-
- p->CrtcHAdjusted = FALSE;
- p->CrtcVAdjusted = FALSE;
-}
-#endif
-
-#if 0
-/**
- * Allocates and returns a copy of pMode, including pointers within pMode.
- */
-_X_EXPORT DisplayModePtr
-xf86DuplicateMode(DisplayModePtr pMode)
-{
- DisplayModePtr pNew;
-
- pNew = xnfalloc(sizeof(DisplayModeRec));
- *pNew = *pMode;
- pNew->next = NULL;
- pNew->prev = NULL;
- if (pNew->name == NULL) {
- xf86SetModeDefaultName(pMode);
- } else {
- pNew->name = xnfstrdup(pMode->name);
- }
-
- return pNew;
-}
-
-/**
- * Duplicates every mode in the given list and returns a pointer to the first
- * mode.
- *
- * \param modeList doubly-linked mode list
- */
-_X_EXPORT DisplayModePtr
-xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
-{
- DisplayModePtr first = NULL, last = NULL;
- DisplayModePtr mode;
-
- for (mode = modeList; mode != NULL; mode = mode->next) {
- DisplayModePtr new;
-
- new = xf86DuplicateMode(mode);
-
- /* Insert pNew into modeList */
- if (last) {
- last->next = new;
- new->prev = last;
- } else {
- first = new;
- new->prev = NULL;
- }
- new->next = NULL;
- last = new;
- }
-
- return first;
-}
-
-/**
- * Returns true if the given modes should program to the same timings.
- *
- * This doesn't use Crtc values, as it might be used on ModeRecs without the
- * Crtc values set. So, it's assumed that the other numbers are enough.
- */
-_X_EXPORT Bool
-xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
-{
- if (pMode1->Clock == pMode2->Clock &&
- pMode1->HDisplay == pMode2->HDisplay &&
- pMode1->HSyncStart == pMode2->HSyncStart &&
- pMode1->HSyncEnd == pMode2->HSyncEnd &&
- pMode1->HTotal == pMode2->HTotal &&
- pMode1->HSkew == pMode2->HSkew &&
- pMode1->VDisplay == pMode2->VDisplay &&
- pMode1->VSyncStart == pMode2->VSyncStart &&
- pMode1->VSyncEnd == pMode2->VSyncEnd &&
- pMode1->VTotal == pMode2->VTotal &&
- pMode1->VScan == pMode2->VScan &&
- pMode1->Flags == pMode2->Flags)
- {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-#endif
-
/*
* xf86CheckModeForMonitor
*
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 30b259f5c..88b80be2b 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -154,7 +154,8 @@ Bool xf86PathIsSafe(const char *path);
/* xf86DefaultModes */
-extern DisplayModeRec xf86DefaultModes [];
+extern const DisplayModeRec xf86DefaultModes[];
+extern const int xf86NumDefaultModes;
/* xf86DoProbe.c */
void DoProbe(void);
diff --git a/hw/xfree86/common/xf86cvt.c b/hw/xfree86/common/xf86cvt.c
deleted file mode 100644
index dfb6e71e4..000000000
--- a/hw/xfree86/common/xf86cvt.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright 2005-2006 Luc Verhaegen.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The reason for having this function in a file of its own is
- * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode
- * code is shared directly.
- */
-
-#include "xf86.h"
-
-/*
- * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.
- *
- * These calculations are stolen from the CVT calculation spreadsheet written
- * by Graham Loveridge. He seems to be claiming no copyright and there seems to
- * be no license attached to this. He apparently just wants to see his name
- * mentioned.
- *
- * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls
- *
- * Comments and structure corresponds to the comments and structure of the xls.
- * This should ease importing of future changes to the standard (not very
- * likely though).
- *
- * About margins; i'm sure that they are to be the bit between HDisplay and
- * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and
- * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking
- * outside sync "margin" for some reason. Since we prefer seeing proper
- * blanking instead of the overscan colour, and since the Crtc* values will
- * probably get altered after us, we will disable margins altogether. With
- * these calculations, Margins will plainly expand H/VDisplay, and we don't
- * want that. -- libv
- *
- */
-_X_EXPORT DisplayModePtr
-xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
- Bool Interlaced)
-{
- DisplayModeRec *Mode = xnfalloc(sizeof(DisplayModeRec));
-
- /* 1) top/bottom margin size (% of height) - default: 1.8 */
-#define CVT_MARGIN_PERCENTAGE 1.8
-
- /* 2) character cell horizontal granularity (pixels) - default 8 */
-#define CVT_H_GRANULARITY 8
-
- /* 4) Minimum vertical porch (lines) - default 3 */
-#define CVT_MIN_V_PORCH 3
-
- /* 4) Minimum number of vertical back porch lines - default 6 */
-#define CVT_MIN_V_BPORCH 6
-
- /* Pixel Clock step (kHz) */
-#define CVT_CLOCK_STEP 250
-
- Bool Margins = FALSE;
- float VFieldRate, HPeriod;
- int HDisplayRnd, HMargin;
- int VDisplayRnd, VMargin, VSync;
- float Interlace; /* Please rename this */
-
- memset(Mode, 0, sizeof(DisplayModeRec));
-
- /* CVT default is 60.0Hz */
- if (!VRefresh)
- VRefresh = 60.0;
-
- /* 1. Required field rate */
- if (Interlaced)
- VFieldRate = VRefresh * 2;
- else
- VFieldRate = VRefresh;
-
- /* 2. Horizontal pixels */
- HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY);
-
- /* 3. Determine left and right borders */
- if (Margins) {
- /* right margin is actually exactly the same as left */
- HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
- HMargin -= HMargin % CVT_H_GRANULARITY;
- } else
- HMargin = 0;
-
- /* 4. Find total active pixels */
- Mode->HDisplay = HDisplayRnd + 2*HMargin;
-
- /* 5. Find number of lines per field */
- if (Interlaced)
- VDisplayRnd = VDisplay / 2;
- else
- VDisplayRnd = VDisplay;
-
- /* 6. Find top and bottom margins */
- /* nope. */
- if (Margins)
- /* top and bottom margins are equal again. */
- VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
- else
- VMargin = 0;
-
- Mode->VDisplay = VDisplay + 2*VMargin;
-
- /* 7. Interlace */
- if (Interlaced)
- Interlace = 0.5;
- else
- Interlace = 0.0;
-
- /* Determine VSync Width from aspect ratio */
- if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay))
- VSync = 4;
- else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay))
- VSync = 5;
- else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay))
- VSync = 6;
- else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay))
- VSync = 7;
- else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay))
- VSync = 7;
- else /* Custom */
- VSync = 10;
-
- if (!Reduced) { /* simplified GTF calculation */
-
- /* 4) Minimum time of vertical sync + back porch interval (µs)
- * default 550.0 */
-#define CVT_MIN_VSYNC_BP 550.0
-
- /* 3) Nominal HSync width (% of line period) - default 8 */
-#define CVT_HSYNC_PERCENTAGE 8
-
- float HBlankPercentage;
- int VSyncAndBackPorch, VBackPorch;
- int HBlank;
-
- /* 8. Estimated Horizontal period */
- HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) /
- (VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace);
-
- /* 9. Find number of lines in sync + backporch */
- if (((int)(CVT_MIN_VSYNC_BP / HPeriod) + 1) < (VSync + CVT_MIN_V_PORCH))
- VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH;
- else
- VSyncAndBackPorch = (int)(CVT_MIN_VSYNC_BP / HPeriod) + 1;
-
- /* 10. Find number of lines in back porch */
- VBackPorch = VSyncAndBackPorch - VSync;
-
- /* 11. Find total number of lines in vertical field */
- Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace
- + CVT_MIN_V_PORCH;
-
- /* 5) Definition of Horizontal blanking time limitation */
- /* Gradient (%/kHz) - default 600 */
-#define CVT_M_FACTOR 600
-
- /* Offset (%) - default 40 */
-#define CVT_C_FACTOR 40
-
- /* Blanking time scaling factor - default 128 */
-#define CVT_K_FACTOR 128
-
- /* Scaling factor weighting - default 20 */
-#define CVT_J_FACTOR 20
-
-#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256
-#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \
- CVT_J_FACTOR
-
- /* 12. Find ideal blanking duty cycle from formula */
- HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod/1000.0;
-
- /* 13. Blanking time */
- if (HBlankPercentage < 20)
- HBlankPercentage = 20;
-
- HBlank = Mode->HDisplay * HBlankPercentage/(100.0 - HBlankPercentage);
- HBlank -= HBlank % (2*CVT_H_GRANULARITY);
-
- /* 14. Find total number of pixels in a line. */
- Mode->HTotal = Mode->HDisplay + HBlank;
-
- /* Fill in HSync values */
- Mode->HSyncEnd = Mode->HDisplay + HBlank / 2;
-
- Mode->HSyncStart = Mode->HSyncEnd -
- (Mode->HTotal * CVT_HSYNC_PERCENTAGE) / 100;
- Mode->HSyncStart += CVT_H_GRANULARITY -
- Mode->HSyncStart % CVT_H_GRANULARITY;
-
- /* Fill in VSync values */
- Mode->VSyncStart = Mode->VDisplay + CVT_MIN_V_PORCH;
- Mode->VSyncEnd = Mode->VSyncStart + VSync;
-
- } else { /* Reduced blanking */
- /* Minimum vertical blanking interval time (µs) - default 460 */
-#define CVT_RB_MIN_VBLANK 460.0
-
- /* Fixed number of clocks for horizontal sync */
-#define CVT_RB_H_SYNC 32.0
-
- /* Fixed number of clocks for horizontal blanking */
-#define CVT_RB_H_BLANK 160.0
-
- /* Fixed number of lines for vertical front porch - default 3 */
-#define CVT_RB_VFPORCH 3
-
- int VBILines;
-
- /* 8. Estimate Horizontal period. */
- HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) /
- (VDisplayRnd + 2*VMargin);
-
- /* 9. Find number of lines in vertical blanking */
- VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1;
-
- /* 10. Check if vertical blanking is sufficient */
- if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH))
- VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH;
-
- /* 11. Find total number of lines in vertical field */
- Mode->VTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines;
-
- /* 12. Find total number of pixels in a line */
- Mode->HTotal = Mode->HDisplay + CVT_RB_H_BLANK;
-
- /* Fill in HSync values */
- Mode->HSyncEnd = Mode->HDisplay + CVT_RB_H_BLANK / 2;
- Mode->HSyncStart = Mode->HSyncEnd - CVT_RB_H_SYNC;
-
- /* Fill in VSync values */
- Mode->VSyncStart = Mode->VDisplay + CVT_RB_VFPORCH;
- Mode->VSyncEnd = Mode->VSyncStart + VSync;
- }
-
- /* 15/13. Find pixel clock frequency (kHz for xf86) */
- Mode->Clock = Mode->HTotal * 1000.0 / HPeriod;
- Mode->Clock -= Mode->Clock % CVT_CLOCK_STEP;
-
- /* 16/14. Find actual Horizontal Frequency (kHz) */
- Mode->HSync = ((float) Mode->Clock) / ((float) Mode->HTotal);
-
- /* 17/15. Find actual Field rate */
- Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
- ((float) (Mode->HTotal * Mode->VTotal));
-
- /* 18/16. Find actual vertical frame frequency */
- /* ignore - just set the mode flag for interlaced */
- if (Interlaced)
- Mode->VTotal *= 2;
-
- {
- char Name[256];
- Name[0] = 0;
-
- snprintf(Name, 256, "%dx%d", HDisplay, VDisplay);
-
- Mode->name = xnfalloc(strlen(Name) + 1);
- memcpy(Mode->name, Name, strlen(Name) + 1);
- }
-
- if (Reduced)
- Mode->Flags |= V_PHSYNC | V_NVSYNC;
- else
- Mode->Flags |= V_NHSYNC | V_PVSYNC;
-
- if (Interlaced)
- Mode->Flags |= V_INTERLACE;
-
- return Mode;
-}
diff --git a/hw/xfree86/ddc/DDC.HOWTO b/hw/xfree86/ddc/DDC.HOWTO
index 833a7ab54..1d06ca124 100644
--- a/hw/xfree86/ddc/DDC.HOWTO
+++ b/hw/xfree86/ddc/DDC.HOWTO
@@ -6,24 +6,24 @@
When implementing DDC in the driver one has the choice between
DDC1 and DDC2.
- DDC1 data is contiuously transmitted by a DDC1 capable display
+ DDC1 data is continuously transmitted by a DDC1 capable display
device. The data is send serially over a data line; the Vsync
signal serves as clock. Only one EDID 1.x data block can be
transmitted using DDC1. Since transmission of an EDID1 block
using a regular Vsync frequency would take up several seconds
the driver can increase the Vsync frequency to up to 25 kHz as
- soon as it detects DDC1 activety on the data line.
+ soon as it detects DDC1 activity on the data line.
DDC2 data is transmitted using the I2C protocol. This requires
an additional clock line. DDC2 is capable of transmitting EDID1
and EDID2 block as well as a VDIF block on display devices that
support these.
Display devices switch into the DDC2 mode as soon as they detect
- activety on the DDC clock line. Once the are in DDC2 mode they
+ activity on the DDC clock line. Once the are in DDC2 mode they
stop transmitting DDC1 signals until the next power cycle.
Some graphics chipset configurations which are not capable of
DDC2 might still be able to read DDC1 data. Where available
- DDC2 it is preferrable.
+ DDC2 it is preferable.
All relevant prototypes and defines are in xf86DDC.h.
DDC2 additionally requires I2C support. The I2C prototypes
@@ -37,7 +37,7 @@
unsigned int XXX_ddc1Read(ScrnInfoPtr pScrn)
- Additionally a function is required to inclrease the Vsync
+ Additionally a function is required to increase the Vsync
frequency to max. 25 kHz.
void XXX_ddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed)
@@ -58,7 +58,7 @@
in PreInit(). DDC1SetSpeed is a pointer to the SetSpeed()
function, DDC1Read has to point to the DDC1 read function.
The function will return a pointer to the xf86Monitor structure
- which contains all information retreived by DDC.
+ which contains all information retrieved by DDC.
NULL will be returned on failure.
DDC2 Support
@@ -73,7 +73,7 @@
to the I2CBusRec of the appropriate I2C Bus has to be passed
as the second argument.
The function will return a pointer to the xf86Monitor structure
- which contains all information retreived by DDC.
+ which contains all information retrieved by DDC.
NULL will be returned on failure.
Printing monitor parameters
@@ -86,7 +86,7 @@
is provided.
Further processing of the xf86Monitor structure is not yet
- implemented. Howerver it is planned to use the information
+ implemented. However, it is planned to use the information
about video modes, gamma values etc.
Therefore it is strongly recommended to read out DDC data
before any video mode processing is done.
diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h
index 2496e19e6..a4e79dae0 100644
--- a/hw/xfree86/ddc/edid.h
+++ b/hw/xfree86/ddc/edid.h
@@ -271,6 +271,39 @@
#define K_2ND_GTF _K_2ND_GTF(c)
#define _J_2ND_GTF(x) (x[17] / 2)
#define J_2ND_GTF _J_2ND_GTF(c)
+#define _HAVE_CVT(x) (x[10] == 0x04)
+#define HAVE_CVT _HAVE_CVT(c)
+#define _MAX_CLOCK_KHZ(x) (x[12] >> 2)
+#define MAX_CLOCK_KHZ (MAX_CLOCK * 10000) - (_MAX_CLOCK_KHZ(c) * 250)
+#define _MAXWIDTH(x) ((x[13] == 0 ? 0 : x[13] + ((x[12] & 0x03) << 8)) * 8)
+#define MAXWIDTH _MAXWIDTH(c)
+#define _SUPPORTED_ASPECT(x) x[14]
+#define SUPPORTED_ASPECT _SUPPORTED_ASPECT(c)
+#define SUPPORTED_ASPECT_4_3 0x80
+#define SUPPORTED_ASPECT_16_9 0x40
+#define SUPPORTED_ASPECT_16_10 0x20
+#define SUPPORTED_ASPECT_5_4 0x10
+#define SUPPORTED_ASPECT_15_9 0x08
+#define _PREFERRED_ASPECT(x) ((x[15] & 0xe0) >> 5)
+#define PREFERRED_ASPECT _PREFERRED_ASPECT(c)
+#define PREFERRED_ASPECT_4_3 0
+#define PREFERRED_ASPECT_16_9 1
+#define PREFERRED_ASPECT_16_10 2
+#define PREFERRED_ASPECT_5_4 3
+#define PREFERRED_ASPECT_15_9 4
+#define _SUPPORTED_BLANKING(x) ((x[15] & 0x18) >> 3)
+#define SUPPORTED_BLANKING _SUPPORTED_BLANKING(c)
+#define CVT_STANDARD 0x01
+#define CVT_REDUCED 0x02
+#define _SUPPORTED_SCALING(x) ((x[16] & 0xf0) >> 4)
+#define SUPPORTED_SCALING _SUPPORTED_SCALING(c)
+#define SCALING_HSHRINK 0x08
+#define SCALING_HSTRETCH 0x04
+#define SCALING_VSHRINK 0x02
+#define SCALING_VSTRETCH 0x01
+#define _PREFERRED_REFRESH(x) x[17]
+#define PREFERRED_REFRESH _PREFERRED_REFRESH(c)
+
#define MONITOR_NAME 0xFC
#define ADD_COLOR_POINT 0xFB
#define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
@@ -339,6 +372,8 @@
#define STD_COLOR_SPACE(x) (x & 0x4)
#define PREFERRED_TIMING_MODE(x) (x & 0x2)
#define GFT_SUPPORTED(x) (x & 0x1)
+#define GTF_SUPPORTED(x) (x & 0x1)
+#define CVT_SUPPORTED(x) (x & 0x1)
/* detailed timing misc */
#define IS_INTERLACED(x) (x)
@@ -445,12 +480,19 @@ struct monitor_ranges {
int max_v;
int min_h;
int max_h;
- int max_clock;
+ int max_clock; /* in mhz */
int gtf_2nd_f;
int gtf_2nd_c;
int gtf_2nd_m;
int gtf_2nd_k;
int gtf_2nd_j;
+ int max_clock_khz;
+ int maxwidth; /* in pixels */
+ char supported_aspect;
+ char preferred_aspect;
+ char supported_blanking;
+ char supported_scaling;
+ int preferred_refresh; /* in hz */
};
struct whitePoints{
@@ -480,7 +522,7 @@ struct detailed_monitor_section {
Uchar serial[13];
Uchar ascii_data[13];
Uchar name[13];
- struct monitor_ranges ranges; /* 40 */
+ struct monitor_ranges ranges; /* 56 */
struct std_timings std_t[5]; /* 80 */
struct whitePoints wp[2]; /* 32 */
/* color management data */
diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c
index 14b0fd73a..21391dd66 100644
--- a/hw/xfree86/ddc/interpret_edid.c
+++ b/hw/xfree86/ddc/interpret_edid.c
@@ -329,8 +329,21 @@ get_monitor_ranges(Uchar *c, struct monitor_ranges *r)
r->gtf_2nd_m = M_2ND_GTF;
r->gtf_2nd_k = K_2ND_GTF;
r->gtf_2nd_j = J_2ND_GTF;
- } else
+ } else {
r->gtf_2nd_f = 0;
+ }
+ if (HAVE_CVT) {
+ r->max_clock_khz = MAX_CLOCK_KHZ;
+ r->max_clock = r->max_clock_khz / 1000;
+ r->maxwidth = MAXWIDTH;
+ r->supported_aspect = SUPPORTED_ASPECT;
+ r->preferred_aspect = PREFERRED_ASPECT;
+ r->supported_blanking = SUPPORTED_BLANKING;
+ r->supported_scaling = SUPPORTED_SCALING;
+ r->preferred_refresh = PREFERRED_REFRESH;
+ } else {
+ r->max_clock_khz = 0;
+ }
}
static void
diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c
index d9f18fa9f..f5442adb7 100644
--- a/hw/xfree86/ddc/print_edid.c
+++ b/hw/xfree86/ddc/print_edid.c
@@ -27,6 +27,9 @@
#include <xorg-config.h>
#endif
+/* XXX kinda gross */
+#define _PARSE_EDID_
+
#include "misc.h"
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -350,23 +353,63 @@ print_detailed_monitor_section(int scrnIndex,
xf86DrvMsg(scrnIndex,X_INFO,"Monitor name: %s\n",m[i].section.name);
break;
case DS_RANGES:
+ {
+ struct monitor_ranges *r = &m[i].section.ranges;
xf86DrvMsg(scrnIndex,X_INFO,
- "Ranges: V min: %i V max: %i Hz, H min: %i H max: %i kHz,",
- m[i].section.ranges.min_v, m[i].section.ranges.max_v,
- m[i].section.ranges.min_h, m[i].section.ranges.max_h);
- if (m[i].section.ranges.max_clock != 0)
- xf86ErrorF(" PixClock max %i MHz\n",m[i].section.ranges.max_clock);
- else
+ "Ranges: V min: %i V max: %i Hz, H min: %i H max: %i kHz,",
+ r->min_v, r->max_v, r->min_h, r->max_h);
+ if (r->max_clock_khz != 0) {
+ xf86ErrorF(" PixClock max %i kHz\n", r->max_clock_khz);
+ if (r->maxwidth)
+ xf86DrvMsg(scrnIndex, X_INFO, "Maximum pixel width: %d\n",
+ r->maxwidth);
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported aspect ratios:");
+ if (r->supported_aspect & SUPPORTED_ASPECT_4_3)
+ xf86ErrorF(" 4:3%s",
+ r->preferred_aspect == PREFERRED_ASPECT_4_3?"*":"");
+ if (r->supported_aspect & SUPPORTED_ASPECT_16_9)
+ xf86ErrorF(" 16:9%s",
+ r->preferred_aspect == PREFERRED_ASPECT_16_9?"*":"");
+ if (r->supported_aspect & SUPPORTED_ASPECT_16_10)
+ xf86ErrorF(" 16:10%s",
+ r->preferred_aspect == PREFERRED_ASPECT_16_10?"*":"");
+ if (r->supported_aspect & SUPPORTED_ASPECT_5_4)
+ xf86ErrorF(" 5:4%s",
+ r->preferred_aspect == PREFERRED_ASPECT_5_4?"*":"");
+ if (r->supported_aspect & SUPPORTED_ASPECT_15_9)
+ xf86ErrorF(" 15:9%s",
+ r->preferred_aspect == PREFERRED_ASPECT_15_9?"*":"");
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported blankings:");
+ if (r->supported_blanking & CVT_STANDARD)
+ xf86ErrorF(" standard");
+ if (r->supported_blanking & CVT_REDUCED)
+ xf86ErrorF(" reduced");
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported scalings:");
+ if (r->supported_scaling & SCALING_HSHRINK)
+ xf86ErrorF(" hshrink");
+ if (r->supported_scaling & SCALING_HSTRETCH)
+ xf86ErrorF(" hstretch");
+ if (r->supported_scaling & SCALING_VSHRINK)
+ xf86ErrorF(" vshrink");
+ if (r->supported_scaling & SCALING_VSTRETCH)
+ xf86ErrorF(" vstretch");
xf86ErrorF("\n");
- if (m[i].section.ranges.gtf_2nd_f > 0)
+ xf86DrvMsg(scrnIndex, X_INFO, "Preferred refresh rate: %d\n",
+ r->preferred_refresh);
+ } else if (r->max_clock != 0) {
+ xf86ErrorF(" PixClock max %i MHz\n", r->max_clock);
+ } else {
+ xf86ErrorF("\n");
+ }
+ if (r->gtf_2nd_f > 0)
xf86DrvMsg(scrnIndex,X_INFO," 2nd GTF parameters: f: %i kHz "
- "c: %i m: %i k %i j %i\n",
- m[i].section.ranges.gtf_2nd_f,
- m[i].section.ranges.gtf_2nd_c,
- m[i].section.ranges.gtf_2nd_m,
- m[i].section.ranges.gtf_2nd_k,
- m[i].section.ranges.gtf_2nd_j);
+ "c: %i m: %i k %i j %i\n", r->gtf_2nd_f,
+ r->gtf_2nd_c, r->gtf_2nd_m, r->gtf_2nd_k,
+ r->gtf_2nd_j);
break;
+ }
case DS_STD_TIMINGS:
for (j = 0; j<5; j++)
xf86DrvMsg(scrnIndex,X_INFO,"#%i: hsize: %i vsize %i refresh: %i "
diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c
index e47b8b80c..8dda35ac4 100644
--- a/hw/xfree86/ddc/xf86DDC.c
+++ b/hw/xfree86/ddc/xf86DDC.c
@@ -2,6 +2,14 @@
*
* Copyright 1998,1999 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
*/
+
+/*
+ * Note that DDC1 does not define any method for returning blocks beyond
+ * the first. DDC2 does, but the original implementation would only ever
+ * read the first block. If you want to read and parse all blocks, use
+ * xf86DoEEDID().
+ */
+
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
@@ -13,8 +21,6 @@
#include "ddcPriv.h"
#include <string.h>
-static const OptionInfoRec *DDCAvailableOptions(void *unused);
-
#define RETRIES 4
static unsigned char *EDIDRead_DDC1(
@@ -33,18 +39,6 @@ static unsigned int *FetchEDID_DDC1(
register unsigned int (*)(ScrnInfoPtr)
);
-static unsigned char* EDID1Read_DDC2(
- int scrnIndex,
- I2CBusPtr pBus
-);
-
-static unsigned char * DDCRead_DDC2(
- int scrnIndex,
- I2CBusPtr pBus,
- int start,
- int len
-);
-
typedef enum {
DDCOPT_NODDC1,
DDCOPT_NODDC2,
@@ -58,13 +52,6 @@ static const OptionInfoRec DDCOptions[] = {
{ -1, NULL, OPTV_NONE, {0}, FALSE },
};
-/*ARGSUSED*/
-static const OptionInfoRec *
-DDCAvailableOptions(void *unused)
-{
- return (DDCOptions);
-}
-
/**
* Attempts to probe the monitor for EDID information, if NoDDC and NoDDC1 are
* unset. EDID information blocks are interpreted and the results returned in
@@ -116,58 +103,176 @@ xf86DoEDID_DDC1(
return tmp;
}
+static I2CDevPtr
+DDC2MakeDevice(I2CBusPtr pBus, int address, char *name)
+{
+ I2CDevPtr dev = NULL;
+
+ if (!(dev = xf86I2CFindDev(pBus, address))) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = name;
+ dev->SlaveAddr = address;
+ dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
+ dev->StartTimeout = 550;
+ dev->BitTimeout = 40;
+ dev->AcknTimeout = 40;
+
+ dev->pI2CBus = pBus;
+ if (!xf86I2CDevInit(dev)) {
+ xf86DrvMsg(pBus->scrnIndex, X_PROBED, "No DDC2 device\n");
+ return NULL;
+ }
+ }
+
+ return dev;
+}
+
+static I2CDevPtr
+DDC2Init(int scrnIndex, I2CBusPtr pBus)
+{
+ I2CDevPtr dev = NULL;
+
+ /*
+ * Slow down the bus so that older monitors don't
+ * miss things.
+ */
+ pBus->RiseFallTime = 20;
+
+ DDC2MakeDevice(pBus, 0x0060, "E-EDID segment register");
+ dev = DDC2MakeDevice(pBus, 0x00A0, "ddc2");
+
+ return dev;
+}
+
+/* Mmmm, smell the hacks */
+static void
+EEDIDStop(I2CDevPtr d)
+{
+}
+
+/* block is the EDID block number. a segment is two blocks. */
+static Bool
+DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer)
+{
+ unsigned char W_Buffer[1];
+ int i, segment;
+ I2CDevPtr seg;
+ void (*stop)(I2CDevPtr);
+
+ for (i = 0; i < RETRIES; i++) {
+ /* Stop bits reset the segment pointer to 0, so be careful here. */
+ segment = block >> 1;
+ if (segment) {
+ Bool b;
+
+ if (!(seg = xf86I2CFindDev(dev->pI2CBus, 0x0060)))
+ return FALSE;
+
+ W_Buffer[0] = segment;
+
+ stop = dev->pI2CBus->I2CStop;
+ dev->pI2CBus->I2CStop = EEDIDStop;
+
+ b = xf86I2CWriteRead(seg, W_Buffer, 1, NULL, 0);
+
+ dev->pI2CBus->I2CStop = stop;
+ if (!b) {
+ dev->pI2CBus->I2CStop(dev);
+ continue;
+ }
+ }
+
+ W_Buffer[0] = (block & 0x01) * EDID1_LEN;
+
+ if (xf86I2CWriteRead(dev, W_Buffer, 1, R_Buffer, EDID1_LEN)) {
+ if (!DDC_checksum(R_Buffer, EDID1_LEN))
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
/**
* Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are
* unset. EDID information blocks are interpreted and the results returned in
- * an xf86MonPtr.
+ * an xf86MonPtr. Unlike xf86DoEDID_DDC[12](), this function will return
+ * the complete EDID data, including all extension blocks.
*
* This function does not affect the list of modes used by drivers -- it is up
* to the driver to decide policy on what to do with EDID information.
*
* @return pointer to a new xf86MonPtr containing the EDID information.
* @return NULL if no monitor attached or failure to interpret the EDID.
+ *
+ * nblocks is an in/out parameter. If non-zero, it defines the number of
+ * blocks to read from the monitor; zero (or NULL pointer) means read all.
+ * If non-NULL, on return it will be filled in with the number of blocks
+ * read.
*/
xf86MonPtr
-xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
+xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
unsigned char *EDID_block = NULL;
xf86MonPtr tmp = NULL;
+ I2CDevPtr dev = NULL;
/* Default DDC and DDC2 to enabled. */
Bool noddc = FALSE, noddc2 = FALSE;
OptionInfoPtr options;
- options = xnfalloc(sizeof(DDCOptions));
- (void)memcpy(options, DDCOptions, sizeof(DDCOptions));
+ options = xalloc(sizeof(DDCOptions));
+ if (!options)
+ return NULL;
+ memcpy(options, DDCOptions, sizeof(DDCOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2);
xfree(options);
-
+
if (noddc || noddc2)
return NULL;
- EDID_block = EDID1Read_DDC2(scrnIndex,pBus);
+ if (!(dev = DDC2Init(scrnIndex, pBus)))
+ return NULL;
- if (EDID_block){
- tmp = xf86InterpretEDID(scrnIndex,EDID_block);
- } else {
-#ifdef DEBUG
- ErrorF("No EDID block returned\n");
-#endif
+ EDID_block = xcalloc(1, EDID1_LEN);
+ if (!EDID_block)
return NULL;
+
+ if (DDC2Read(dev, 0, EDID_block)) {
+ tmp = xf86InterpretEDID(scrnIndex, EDID_block);
}
-#ifdef DEBUG
- if (!tmp)
- ErrorF("Cannot interpret EDID block\n");
- else
- ErrorF("Sections to follow: %i\n",tmp->no_sections);
-#endif
-
+
+ if (nblocks) {
+ if (tmp)
+ *nblocks = tmp->no_sections;
+ else
+ *nblocks = 0;
+ }
+
return tmp;
}
+/**
+ * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are
+ * unset. EDID information blocks are interpreted and the results returned in
+ * an xf86MonPtr.
+ *
+ * This function does not affect the list of modes used by drivers -- it is up
+ * to the driver to decide policy on what to do with EDID information.
+ *
+ * @return pointer to a new xf86MonPtr containing the EDID information.
+ * @return NULL if no monitor attached or failure to interpret the EDID.
+ */
+xf86MonPtr
+xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
+{
+ int nblocks = 1;
+ return xf86DoEEDID(scrnIndex, pBus, &nblocks);
+}
+
/*
* read EDID record , pass it to callback function to interpret.
* callback function will store it for further use by calling
@@ -234,68 +339,3 @@ FetchEDID_DDC1(register ScrnInfoPtr pScrn,
} while(--count);
return (ptr);
}
-
-static unsigned char*
-EDID1Read_DDC2(int scrnIndex, I2CBusPtr pBus)
-{
- return DDCRead_DDC2(scrnIndex, pBus, 0, EDID1_LEN);
-}
-
-static unsigned char *
-DDCRead_DDC2(int scrnIndex, I2CBusPtr pBus, int start, int len)
-{
- I2CDevPtr dev;
- unsigned char W_Buffer[2];
- int w_bytes;
- unsigned char *R_Buffer;
- int i;
-
- /*
- * Slow down the bus so that older monitors don't
- * miss things.
- */
- pBus->RiseFallTime = 20;
-
- if (!(dev = xf86I2CFindDev(pBus, 0x00A0))) {
- dev = xf86CreateI2CDevRec();
- dev->DevName = "ddc2";
- dev->SlaveAddr = 0xA0;
- dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
- dev->StartTimeout = 550;
- dev->BitTimeout = 40;
- dev->AcknTimeout = 40;
-
- dev->pI2CBus = pBus;
- if (!xf86I2CDevInit(dev)) {
- xf86DrvMsg(scrnIndex, X_PROBED, "No DDC2 device\n");
- return NULL;
- }
- }
- if (start < 0x100) {
- w_bytes = 1;
- W_Buffer[0] = start;
- } else {
- w_bytes = 2;
- W_Buffer[0] = start & 0xFF;
- W_Buffer[1] = (start & 0xFF00) >> 8;
- }
- R_Buffer = xcalloc(1,sizeof(unsigned char)
- * (len));
- for (i=0; i<RETRIES; i++) {
- if (xf86I2CWriteRead(dev, W_Buffer,w_bytes, R_Buffer,len)) {
- if (!DDC_checksum(R_Buffer,len))
- return R_Buffer;
-
-#ifdef DEBUG
- else ErrorF("Checksum error in EDID block\n");
-#endif
- }
-#ifdef DEBUG
- else ErrorF("Error reading EDID block\n");
-#endif
- }
-
- xf86DestroyI2CDevRec(dev,TRUE);
- xfree(R_Buffer);
- return NULL;
-}
diff --git a/hw/xfree86/ddc/xf86DDC.h b/hw/xfree86/ddc/xf86DDC.h
index 3b072dda7..6e5bf6f7a 100644
--- a/hw/xfree86/ddc/xf86DDC.h
+++ b/hw/xfree86/ddc/xf86DDC.h
@@ -35,6 +35,8 @@ extern xf86MonPtr xf86DoEDID_DDC2(
I2CBusPtr pBus
);
+extern xf86MonPtr xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks);
+
extern xf86MonPtr xf86PrintEDID(
xf86MonPtr monPtr
);
diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am
index efc5f4a39..dad2dd36b 100644
--- a/hw/xfree86/dixmods/Makefile.am
+++ b/hw/xfree86/dixmods/Makefile.am
@@ -26,6 +26,10 @@ if MFB
MFBMOD = libmfb.la
endif
+if RECORD
+RECORDMOD = librecord.la
+endif
+
module_LTLIBRARIES = $(AFBMOD) \
$(CFBMOD) \
libfb.la \
@@ -34,7 +38,7 @@ module_LTLIBRARIES = $(AFBMOD) \
libshadow.la
extsmoduledir = $(moduledir)/extensions
-extsmodule_LTLIBRARIES = librecord.la \
+extsmodule_LTLIBRARIES = $(RECORDMOD) \
$(DBEMOD) \
$(GLXMODS) \
$(XTRAPMOD)
diff --git a/hw/xfree86/dixmods/extmod/modinit.c b/hw/xfree86/dixmods/extmod/modinit.c
index d0d892aaf..8c8a4ceeb 100644
--- a/hw/xfree86/dixmods/extmod/modinit.c
+++ b/hw/xfree86/dixmods/extmod/modinit.c
@@ -42,7 +42,7 @@ static ExtensionModule extensionModules[] = {
{
SELinuxExtensionInit,
SELINUX_EXTENSION_NAME,
- NULL,
+ &noSELinuxExtension,
NULL,
NULL
},
@@ -258,6 +258,27 @@ extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
}
}
}
+
+#ifdef XSELINUX
+ if (! strcmp(SELINUX_EXTENSION_NAME, extensionModules[i].name)) {
+ pointer o;
+ selinuxEnforcingState = SELINUX_MODE_DEFAULT;
+
+ if ((o = xf86FindOption(opts, "SELinux mode disabled"))) {
+ xf86MarkOptionUsed(o);
+ selinuxEnforcingState = SELINUX_MODE_DISABLED;
+ }
+ if ((o = xf86FindOption(opts, "SELinux mode permissive"))) {
+ xf86MarkOptionUsed(o);
+ selinuxEnforcingState = SELINUX_MODE_PERMISSIVE;
+ }
+ if ((o = xf86FindOption(opts, "SELinux mode enforcing"))) {
+ xf86MarkOptionUsed(o);
+ selinuxEnforcingState = SELINUX_MODE_ENFORCING;
+ }
+ }
+#endif
+
LoadExtension(&extensionModules[i], FALSE);
}
/* Need a non-NULL return */
diff --git a/hw/xfree86/dri/Makefile.am b/hw/xfree86/dri/Makefile.am
index 68f1eaefa..bee315288 100644
--- a/hw/xfree86/dri/Makefile.am
+++ b/hw/xfree86/dri/Makefile.am
@@ -7,7 +7,7 @@ libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \
-I$(top_builddir)/GL/include \
-I@MESA_SOURCE@/include \
-DHAVE_XORG_CONFIG_H \
- @DIX_CFLAGS@ @DRIPROTO_CFLAGS@ \
+ @DIX_CFLAGS@ @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ \
@LIBDRM_CFLAGS@ \
@GL_CFLAGS@
libdri_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
diff --git a/hw/xfree86/dri2/Makefile.am b/hw/xfree86/dri2/Makefile.am
index be3cea48f..fd8962ebb 100644
--- a/hw/xfree86/dri2/Makefile.am
+++ b/hw/xfree86/dri2/Makefile.am
@@ -2,7 +2,7 @@ libdri2_la_LTLIBRARIES = libdri2.la
libdri2_la_CFLAGS = \
-DHAVE_XORG_CONFIG_H \
-I@MESA_SOURCE@/include \
- @DIX_CFLAGS@ @DRIPROTO_CFLAGS@ @LIBDRM_CFLAGS@ \
+ @DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \
-I$(top_srcdir)/hw/xfree86/common \
-I$(top_srcdir)/hw/xfree86/os-support/bus
@@ -10,6 +10,7 @@ libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
libdri2_ladir = $(moduledir)/extensions
libdri2_la_SOURCES = \
dri2.c \
- dri2.h
+ dri2.h \
+ dri2ext.c
sdk_HEADERS = dri2.h
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 3bc533ede..74aef7196 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -38,6 +38,8 @@
#include "xf86Module.h"
#include "scrnintstr.h"
#include "windowstr.h"
+#include "region.h"
+#include "damage.h"
#include "dri2.h"
#include <GL/internal/dri_sarea.h>
@@ -48,8 +50,9 @@ static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKey;
static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKey;
typedef struct _DRI2DrawablePriv {
- drm_drawable_t drawable;
- unsigned int handle;
+ unsigned int refCount;
+ unsigned int boHandle;
+ unsigned int dri2Handle;
} DRI2DrawablePrivRec, *DRI2DrawablePrivPtr;
typedef struct _DRI2Screen {
@@ -58,9 +61,7 @@ typedef struct _DRI2Screen {
void *sarea;
unsigned int sareaSize;
const char *driverName;
- int ddxVersionMajor;
- int ddxVersionMinor;
- int ddxVersionPatch;
+ unsigned int nextHandle;
__DRIEventBuffer *buffer;
int locked;
@@ -150,7 +151,7 @@ DRI2PostDrawableConfig(DrawablePtr pDraw)
e = DRI2ScreenAllocEvent(ds, size);
e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_DRAWABLE_CONFIG, size);
- e->drawable = pPriv->drawable;
+ e->drawable = pPriv->dri2Handle;
e->x = pDraw->x - pPixmap->screen_x;
e->y = pDraw->y - pPixmap->screen_y;
e->width = pDraw->width;
@@ -167,7 +168,7 @@ DRI2PostDrawableConfig(DrawablePtr pDraw)
}
static void
-DRI2PostBufferAttach(DrawablePtr pDraw)
+DRI2PostBufferAttach(DrawablePtr pDraw, Bool force)
{
ScreenPtr pScreen = pDraw->pScreen;
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
@@ -176,7 +177,8 @@ DRI2PostBufferAttach(DrawablePtr pDraw)
PixmapPtr pPixmap;
__DRIBufferAttachEvent *e;
size_t size;
- unsigned int handle, flags;
+ unsigned int flags;
+ unsigned int boHandle;
if (pDraw->type == DRAWABLE_WINDOW) {
pWin = (WindowPtr) pDraw;
@@ -190,22 +192,20 @@ DRI2PostBufferAttach(DrawablePtr pDraw)
if (!pPriv)
return;
- size = sizeof *e;
-
- handle = ds->getPixmapHandle(pPixmap, &flags);
- if (handle == 0 || handle == pPriv->handle)
+ boHandle = ds->getPixmapHandle(pPixmap, &flags);
+ if (boHandle == pPriv->boHandle && !force)
return;
+ pPriv->boHandle = boHandle;
+ size = sizeof *e;
e = DRI2ScreenAllocEvent(ds, size);
e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_BUFFER_ATTACH, size);
- e->drawable = pPriv->drawable;
+ e->drawable = pPriv->dri2Handle;
e->buffer.attachment = DRI_DRAWABLE_BUFFER_FRONT_LEFT;
- e->buffer.handle = handle;
+ e->buffer.handle = pPriv->boHandle;
e->buffer.pitch = pPixmap->devKind;
e->buffer.cpp = pPixmap->drawable.bitsPerPixel / 8;
e->buffer.flags = flags;
-
- pPriv->handle = handle;
}
static void
@@ -226,7 +226,7 @@ DRI2ClipNotify(WindowPtr pWin, int dx, int dy)
}
DRI2PostDrawableConfig(&pWin->drawable);
- DRI2PostBufferAttach(&pWin->drawable);
+ DRI2PostBufferAttach(&pWin->drawable, FALSE);
}
static void
@@ -265,10 +265,10 @@ DRI2CloseScreen(ScreenPtr pScreen)
}
Bool
-DRI2CreateDrawable(ScreenPtr pScreen,
- DrawablePtr pDraw, drm_drawable_t *pDrmDrawable)
+DRI2CreateDrawable(DrawablePtr pDraw,
+ unsigned int *handle, unsigned int *head)
{
- DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
WindowPtr pWin;
PixmapPtr pPixmap;
DRI2DrawablePrivPtr pPriv;
@@ -286,51 +286,70 @@ DRI2CreateDrawable(ScreenPtr pScreen,
}
pPriv = dixLookupPrivate(devPrivates, key);
- if (pPriv == NULL) {
+ if (pPriv != NULL) {
+ pPriv->refCount++;
+ } else {
pPriv = xalloc(sizeof *pPriv);
- if (drmCreateDrawable(ds->fd, &pPriv->drawable))
- return FALSE;
-
+ pPriv->refCount = 1;
+ pPriv->boHandle = 0;
+ pPriv->dri2Handle = ds->nextHandle++;
dixSetPrivate(devPrivates, key, pPriv);
}
- *pDrmDrawable = pPriv->drawable;
+ *handle = pPriv->dri2Handle;
+ *head = ds->buffer->head;
DRI2PostDrawableConfig(pDraw);
- DRI2PostBufferAttach(pDraw);
+ DRI2PostBufferAttach(pDraw, TRUE);
DRI2ScreenCommitEvents(ds);
return TRUE;
}
void
-DRI2DestroyDrawable(ScreenPtr pScreen, DrawablePtr pDraw)
+DRI2DestroyDrawable(DrawablePtr pDraw)
{
- DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
- PixmapPtr pPixmap;
- WindowPtr pWin;
- DRI2DrawablePrivPtr pPriv;
+ PixmapPtr pPixmap;
+ WindowPtr pWin;
+ DRI2DrawablePrivPtr pPriv;
+ DevPrivateKey key;
+ PrivateRec **devPrivates;
if (pDraw->type == DRAWABLE_WINDOW) {
pWin = (WindowPtr) pDraw;
- pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
- dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
+ devPrivates = &pWin->devPrivates;
+ key = dri2WindowPrivateKey;
} else {
pPixmap = (PixmapPtr) pDraw;
- pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
- dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
+ devPrivates = &pPixmap->devPrivates;
+ key = dri2PixmapPrivateKey;
}
+ pPriv = dixLookupPrivate(devPrivates, key);
if (pPriv == NULL)
return;
- drmDestroyDrawable(ds->fd, pPriv->drawable);
- xfree(pPriv);
+ pPriv->refCount--;
+ if (pPriv->refCount == 0) {
+ dixSetPrivate(devPrivates, key, NULL);
+ xfree(pPriv);
+ }
+}
+
+void
+DRI2ReemitDrawableInfo(DrawablePtr pDraw, unsigned int *head)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+
+ *head = ds->buffer->head;
+
+ DRI2PostDrawableConfig(pDraw);
+ DRI2PostBufferAttach(pDraw, TRUE);
+ DRI2ScreenCommitEvents(ds);
}
Bool
DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName,
- int *ddxMajor, int *ddxMinor, int *ddxPatch,
unsigned int *sareaHandle)
{
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
@@ -340,14 +359,22 @@ DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName,
*fd = ds->fd;
*driverName = ds->driverName;
- *ddxMajor = ds->ddxVersionMajor;
- *ddxMinor = ds->ddxVersionMinor;
- *ddxPatch = ds->ddxVersionPatch;
*sareaHandle = ds->sareaBO.handle;
return TRUE;
}
+Bool
+DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
+ if (ds == NULL || drmAuthMagic(ds->fd, magic))
+ return FALSE;
+
+ return TRUE;
+}
+
unsigned int
DRI2GetPixmapHandle(PixmapPtr pPixmap, unsigned int *flags)
{
@@ -404,11 +431,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
if (!ds)
return NULL;
- ds->fd = info->fd;
+ ds->fd = info->fd;
ds->driverName = info->driverName;
- ds->ddxVersionMajor = info->ddxVersionMajor;
- ds->ddxVersionMinor = info->ddxVersionMinor;
- ds->ddxVersionPatch = info->ddxVersionPatch;
+ ds->nextHandle = 1;
ds->getPixmapHandle = info->getPixmapHandle;
ds->beginClipNotify = info->beginClipNotify;
@@ -432,9 +457,21 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
return p;
}
+extern ExtensionModule dri2ExtensionModule;
+
static pointer
DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
{
+ static Bool setupDone = FALSE;
+
+ if (!setupDone) {
+ setupDone = TRUE;
+ LoadExtension(&dri2ExtensionModule, FALSE);
+ } else {
+ if (errmaj)
+ *errmaj = LDR_ONCEONLY;
+ }
+
return (pointer) 1;
}
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index c687a93f6..85b3da41c 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -43,7 +43,6 @@ typedef struct {
int fd;
size_t driverSareaSize;
const char *driverName;
- int ddxVersionMajor, ddxVersionMinor, ddxVersionPatch;
DRI2GetPixmapHandleProcPtr getPixmapHandle;
DRI2BeginClipNotifyProcPtr beginClipNotify;
DRI2EndClipNotifyProcPtr endClipNotify;
@@ -57,24 +56,26 @@ void DRI2CloseScreen(ScreenPtr pScreen);
Bool DRI2Connect(ScreenPtr pScreen,
int *fd,
const char **driverName,
- int *ddxMajor,
- int *ddxMinor,
- int *ddxPatch,
unsigned int *sareaHandle);
+Bool DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic);
+
unsigned int DRI2GetPixmapHandle(PixmapPtr pPixmap,
unsigned int *flags);
void DRI2Lock(ScreenPtr pScreen);
void DRI2Unlock(ScreenPtr pScreen);
-Bool DRI2CreateDrawable(ScreenPtr pScreen,
- DrawablePtr pDraw,
- drm_drawable_t *pDrmDrawable);
+Bool DRI2CreateDrawable(DrawablePtr pDraw,
+ unsigned int *handle,
+ unsigned int *head);
+
+void DRI2DestroyDrawable(DrawablePtr pDraw);
-void DRI2DestroyDrawable(ScreenPtr pScreen,
- DrawablePtr pDraw);
+void DRI2ReemitDrawableInfo(DrawablePtr pDraw,
+ unsigned int *head);
-void DRI2ExtensionInit(void);
+Bool DRI2PostDamage(DrawablePtr pDrawable,
+ struct drm_clip_rect *rects, int numRects);
#endif
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
new file mode 100644
index 000000000..4ae0fda3a
--- /dev/null
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -0,0 +1,361 @@
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL 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 PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ * Kristian Høgsberg (krh@redhat.com)
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#define NEED_REPLIES
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/extensions/dri2proto.h>
+#include "dixstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "xf86drm.h"
+#include "dri2.h"
+
+/* The only xf86 include */
+#include "xf86Module.h"
+
+static ExtensionEntry *dri2Extension;
+static RESTYPE dri2DrawableRes;
+
+static Bool
+validScreen(ClientPtr client, int screen, ScreenPtr *pScreen)
+{
+ if (screen >= screenInfo.numScreens) {
+ client->errorValue = screen;
+ return FALSE;
+ }
+
+ *pScreen = screenInfo.screens[screen];
+
+ return TRUE;
+}
+
+static Bool
+validDrawable(ClientPtr client, XID drawable,
+ DrawablePtr *pDrawable, int *status)
+{
+ *status = dixLookupDrawable(pDrawable, drawable, client, 0, DixReadAccess);
+ if (*status != Success) {
+ client->errorValue = drawable;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static int
+ProcDRI2QueryVersion(ClientPtr client)
+{
+ REQUEST(xDRI2QueryVersionReq);
+ xDRI2QueryVersionReply rep;
+ int n;
+
+ if (client->swapped)
+ swaps(&stuff->length, n);
+
+ REQUEST_SIZE_MATCH(xDRI2QueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = DRI2_MAJOR;
+ rep.minorVersion = DRI2_MINOR;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.majorVersion, n);
+ swapl(&rep.minorVersion, n);
+ }
+
+ WriteToClient(client, sizeof(xDRI2QueryVersionReply), &rep);
+
+ return client->noClientException;
+}
+
+static int
+ProcDRI2Connect(ClientPtr client)
+{
+ REQUEST(xDRI2ConnectReq);
+ xDRI2ConnectReply rep;
+ ScreenPtr pScreen;
+ int fd;
+ const char *driverName;
+ char *busId = NULL;
+ unsigned int sareaHandle;
+
+ REQUEST_SIZE_MATCH(xDRI2ConnectReq);
+ if (!validScreen(client, stuff->screen, &pScreen))
+ return BadValue;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.driverNameLength = 0;
+ rep.busIdLength = 0;
+ rep.sareaHandle = 0;
+
+ if (!DRI2Connect(pScreen, &fd, &driverName, &sareaHandle))
+ goto fail;
+
+ busId = drmGetBusid(fd);
+ if (busId == NULL)
+ goto fail;
+
+ rep.driverNameLength = strlen(driverName);
+ rep.busIdLength = strlen(busId);
+ rep.sareaHandle = sareaHandle;
+ rep.length = (rep.driverNameLength + 3) / 4 + (rep.busIdLength + 3) / 4;
+
+ fail:
+ WriteToClient(client, sizeof(xDRI2ConnectReply), &rep);
+ WriteToClient(client, rep.driverNameLength, driverName);
+ WriteToClient(client, rep.busIdLength, busId);
+ drmFreeBusid(busId);
+
+ return client->noClientException;
+}
+
+static int
+ProcDRI2AuthConnection(ClientPtr client)
+{
+ REQUEST(xDRI2AuthConnectionReq);
+ xDRI2AuthConnectionReply rep;
+ ScreenPtr pScreen;
+
+ REQUEST_SIZE_MATCH(xDRI2AuthConnectionReq);
+ if (!validScreen(client, stuff->screen, &pScreen))
+ return BadValue;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.authenticated = 1;
+
+ if (!DRI2AuthConnection(pScreen, stuff->magic)) {
+ ErrorF("DRI2: Failed to authenticate %lu\n",
+ (unsigned long) stuff->magic);
+ rep.authenticated = 0;
+ }
+
+ WriteToClient(client, sizeof(xDRI2AuthConnectionReply), &rep);
+
+ return client->noClientException;
+}
+
+static int
+ProcDRI2CreateDrawable(ClientPtr client)
+{
+ REQUEST(xDRI2CreateDrawableReq);
+ xDRI2CreateDrawableReply rep;
+ DrawablePtr pDrawable;
+ unsigned int handle, head;
+ int status;
+
+ REQUEST_SIZE_MATCH(xDRI2CreateDrawableReq);
+
+ if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ return status;
+
+ if (!DRI2CreateDrawable(pDrawable, &handle, &head))
+ return BadMatch;
+
+ if (!AddResource(stuff->drawable, dri2DrawableRes, pDrawable)) {
+ DRI2DestroyDrawable(pDrawable);
+ return BadAlloc;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.handle = handle;
+ rep.head = head;
+
+ WriteToClient(client, sizeof(xDRI2CreateDrawableReply), &rep);
+
+ return client->noClientException;
+}
+
+static int
+ProcDRI2DestroyDrawable(ClientPtr client)
+{
+ REQUEST(xDRI2DestroyDrawableReq);
+ DrawablePtr pDrawable;
+ int status;
+
+ REQUEST_SIZE_MATCH(xDRI2DestroyDrawableReq);
+ if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ return status;
+
+ FreeResourceByType(stuff->drawable, dri2DrawableRes, FALSE);
+
+ return client->noClientException;
+}
+
+static int
+ProcDRI2ReemitDrawableInfo(ClientPtr client)
+{
+ REQUEST(xDRI2ReemitDrawableInfoReq);
+ xDRI2ReemitDrawableInfoReply rep;
+ DrawablePtr pDrawable;
+ unsigned int head;
+ int status;
+
+ REQUEST_SIZE_MATCH(xDRI2ReemitDrawableInfoReq);
+ if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ return status;
+
+ DRI2ReemitDrawableInfo(pDrawable, &head);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.head = head;
+
+ WriteToClient(client, sizeof(xDRI2ReemitDrawableInfoReply), &rep);
+
+ return client->noClientException;
+}
+
+static int
+ProcDRI2Dispatch (ClientPtr client)
+{
+ REQUEST(xReq);
+
+ switch (stuff->data) {
+ case X_DRI2QueryVersion:
+ return ProcDRI2QueryVersion(client);
+ }
+
+ if (!LocalClient(client))
+ return BadRequest;
+
+ switch (stuff->data) {
+ case X_DRI2Connect:
+ return ProcDRI2Connect(client);
+ case X_DRI2AuthConnection:
+ return ProcDRI2AuthConnection(client);
+ case X_DRI2CreateDrawable:
+ return ProcDRI2CreateDrawable(client);
+ case X_DRI2DestroyDrawable:
+ return ProcDRI2DestroyDrawable(client);
+ case X_DRI2ReemitDrawableInfo:
+ return ProcDRI2ReemitDrawableInfo(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static int
+SProcDRI2Connect(ClientPtr client)
+{
+ REQUEST(xDRI2ConnectReq);
+ xDRI2ConnectReply rep;
+ int n;
+
+ /* If the client is swapped, it's not local. Talk to the hand. */
+
+ swaps(&stuff->length, n);
+ if (sizeof(*stuff) / 4 != client->req_len)
+ return BadLength;
+
+ rep.sequenceNumber = client->sequence;
+ swaps(&rep.sequenceNumber, n);
+ rep.length = 0;
+ rep.driverNameLength = 0;
+ rep.busIdLength = 0;
+ rep.sareaHandle = 0;
+
+ return client->noClientException;
+}
+
+static int
+SProcDRI2Dispatch (ClientPtr client)
+{
+ REQUEST(xReq);
+
+ /*
+ * Only local clients are allowed DRI access, but remote clients
+ * still need these requests to find out cleanly.
+ */
+ switch (stuff->data)
+ {
+ case X_DRI2QueryVersion:
+ return ProcDRI2QueryVersion(client);
+ case X_DRI2Connect:
+ return SProcDRI2Connect(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static void
+DRI2ResetProc (ExtensionEntry *extEntry)
+{
+}
+
+static int DRI2DrawableGone(pointer p, XID id)
+{
+ DrawablePtr pDrawable = p;
+
+ DRI2DestroyDrawable(pDrawable);
+
+ return Success;
+}
+
+static void
+DRI2ExtensionInit(void)
+{
+ dri2Extension = AddExtension(DRI2_NAME,
+ DRI2NumberEvents,
+ DRI2NumberErrors,
+ ProcDRI2Dispatch,
+ SProcDRI2Dispatch,
+ DRI2ResetProc,
+ StandardMinorOpcode);
+
+ dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone);
+}
+
+extern Bool noDRI2Extension;
+
+_X_HIDDEN ExtensionModule dri2ExtensionModule = {
+ DRI2ExtensionInit,
+ DRI2_NAME,
+ &noDRI2Extension,
+ NULL,
+ NULL
+};
diff --git a/hw/xfree86/exa/examodule.c b/hw/xfree86/exa/examodule.c
index 086639cc5..e18da0a37 100644
--- a/hw/xfree86/exa/examodule.c
+++ b/hw/xfree86/exa/examodule.c
@@ -148,22 +148,23 @@ exaDDXDriverInit(ScreenPtr pScreen)
FALSE);
}
- if (xf86IsOptionSet(pScreenPriv->options, EXAOPT_NO_COMPOSITE)) {
- xf86DrvMsg(pScreen->myNum, X_INFO,
+ if (xf86ReturnOptValBool(pScreenPriv->options,
+ EXAOPT_NO_COMPOSITE, FALSE)) {
+ xf86DrvMsg(pScreen->myNum, X_CONFIG,
"EXA: Disabling Composite operation "
"(RENDER acceleration)\n");
pExaScr->info->CheckComposite = NULL;
pExaScr->info->PrepareComposite = NULL;
}
- if (xf86IsOptionSet(pScreenPriv->options, EXAOPT_NO_UTS)) {
- xf86DrvMsg(pScreen->myNum, X_INFO,
+ if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_UTS, FALSE)) {
+ xf86DrvMsg(pScreen->myNum, X_CONFIG,
"EXA: Disabling UploadToScreen\n");
pExaScr->info->UploadToScreen = NULL;
}
- if (xf86IsOptionSet(pScreenPriv->options, EXAOPT_NO_DFS)) {
- xf86DrvMsg(pScreen->myNum, X_INFO,
+ if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_DFS, FALSE)) {
+ xf86DrvMsg(pScreen->myNum, X_CONFIG,
"EXA: Disabling DownloadFromScreen\n");
pExaScr->info->DownloadFromScreen = NULL;
}
diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 13be7858f..a1f67486f 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -625,14 +625,11 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
pScrn->virtualY = mode->VDisplay;
if (NULL == pScrn->modes) {
- pScrn->modes = xnfalloc(sizeof(DisplayModeRec));
- this = pScrn->modes;
- memcpy(this,mode,sizeof(DisplayModeRec));
+ this = pScrn->modes = xf86DuplicateMode(mode);
this->next = this;
this->prev = this;
} else {
- this = xnfalloc(sizeof(DisplayModeRec));
- memcpy(this,mode,sizeof(DisplayModeRec));
+ this = xf86DuplicateMode(mode);
this->next = pScrn->modes;
this->prev = last;
last->next = this;
diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
index e8334262e..c3af5bc08 100644
--- a/hw/xfree86/int10/helper_exec.c
+++ b/hw/xfree86/int10/helper_exec.c
@@ -33,6 +33,7 @@
#ifdef _X86EMU
#include "x86emu/x86emui.h"
#endif
+#include <pciaccess.h>
static int pciCfg1in(CARD16 addr, CARD32 *val);
static int pciCfg1out(CARD16 addr, CARD32 val);
@@ -46,8 +47,6 @@ static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set);
#define REG pInt
-static int pci_config_cycle = 0;
-
int
setup_int(xf86Int10InfoPtr pInt)
{
@@ -461,7 +460,43 @@ Mem_wl(CARD32 addr, CARD32 val)
static CARD32 PciCfg1Addr = 0;
-#define OFFSET(Cfg1Addr) (Cfg1Addr & 0xff)
+#define PCI_OFFSET(x) ((x) & 0x000000ff)
+#define PCI_TAG(x) ((x) & 0x7fffff00)
+
+static struct pci_device*
+pci_device_for_cfg_address (CARD32 addr)
+{
+ struct pci_device *dev = NULL;
+ PCITAG tag = PCI_TAG(addr);
+ struct pci_slot_match slot_match = {
+ .domain = PCI_DOM_FROM_TAG(tag),
+ .bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)),
+ .dev = PCI_DEV_FROM_TAG(tag),
+ .func = PCI_FUNC_FROM_TAG(tag),
+ .match_data = 0
+ };
+
+ struct pci_device_iterator *iter =
+ pci_slot_match_iterator_create (&slot_match);
+ if (iter)
+ dev = pci_device_next(iter);
+ if (!dev) {
+ char buf[128]; /* enough to store "%u@%u" */
+ xf86FormatPciBusNumber(tag >> 16, buf);
+ ErrorF("Failed to find device matching %s:%u:%u\n",
+ buf, slot_match.dev, slot_match.func);
+ return NULL;
+ }
+
+ if (pci_device_next(iter)) {
+ char buf[128]; /* enough to store "%u@%u" */
+ xf86FormatPciBusNumber(tag >> 16, buf);
+ ErrorF("Multiple devices matching %s:%u:%u\n",
+ buf, slot_match.dev, slot_match.func);
+ }
+
+ return dev;
+}
static int
pciCfg1in(CARD16 addr, CARD32 *val)
@@ -471,7 +506,8 @@ pciCfg1in(CARD16 addr, CARD32 *val)
return 1;
}
if (addr == 0xCFC) {
- pci_device_cfg_read_u32(Int10Current->dev, val, OFFSET(PciCfg1Addr));
+ pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr));
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_inl(%#x) = %8.8x\n", PciCfg1Addr, *val);
return 1;
@@ -489,7 +525,8 @@ pciCfg1out(CARD16 addr, CARD32 val)
if (addr == 0xCFC) {
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_outl(%#x, %8.8x)\n", PciCfg1Addr, val);
- pci_device_cfg_write_u32(Int10Current->dev, val, OFFSET(PciCfg1Addr));
+ pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr));
return 1;
}
return 0;
@@ -508,7 +545,8 @@ pciCfg1inw(CARD16 addr, CARD16 *val)
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
const unsigned offset = addr - 0xCFC;
- pci_device_cfg_read_u16(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
+ pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr) + offset);
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_inw(%#x) = %4.4x\n", PciCfg1Addr + offset, *val);
return 1;
@@ -532,7 +570,8 @@ pciCfg1outw(CARD16 addr, CARD16 val)
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_outw(%#x, %4.4x)\n", PciCfg1Addr + offset, val);
- pci_device_cfg_write_u16(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
+ pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr) + offset);
return 1;
}
return 0;
@@ -551,7 +590,8 @@ pciCfg1inb(CARD16 addr, CARD8 *val)
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
const unsigned offset = addr - 0xCFC;
- pci_device_cfg_read_u8(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
+ pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr) + offset);
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_inb(%#x) = %2.2x\n", PciCfg1Addr + offset, *val);
return 1;
@@ -575,7 +615,8 @@ pciCfg1outb(CARD16 addr, CARD8 val)
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_outb(%#x, %2.2x)\n", PciCfg1Addr + offset, val);
- pci_device_cfg_write_u8(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
+ pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr) + offset);
return 1;
}
return 0;
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index 49c7d271b..d6d22c4b9 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -92,9 +92,6 @@
extern int XkbDfltRepeatDelay, XkbDfltRepeatInterval;
#endif
-extern Selection *CurrentSelections;
-extern int NumCurrentSelections;
-
/* DIX things */
_X_HIDDEN void *dixLookupTab[] = {
@@ -150,8 +147,6 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMVAR(isItTimeToYield)
SYMVAR(ClientStateCallback)
SYMVAR(ServerGrabCallback)
- SYMVAR(CurrentSelections)
- SYMVAR(NumCurrentSelections)
/* dixfonts.c */
SYMFUNC(CloseFont)
SYMFUNC(FontToXError)
@@ -193,8 +188,12 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(XineramaGetCursorScreen)
#endif
/* property.c */
+ SYMFUNC(dixLookupProperty)
SYMFUNC(ChangeWindowProperty)
SYMFUNC(dixChangeWindowProperty)
+ /* selection.c */
+ SYMFUNC(dixLookupSelection)
+ SYMVAR(CurrentSelections)
/* extension.c */
SYMFUNC(AddExtension)
SYMFUNC(AddExtensionAlias)
@@ -441,6 +440,9 @@ _X_HIDDEN void *dixLookupTab[] = {
#ifdef XIDLE
SYMVAR(noXIdleExtension)
#endif
+#ifdef XSELINUX
+ SYMVAR(noSELinuxExtension)
+#endif
#ifdef XV
SYMVAR(noXvExtension)
#endif
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 688d2022e..1d3e63971 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -68,8 +68,10 @@
# include "xf86Xinput.h"
#endif
#include "xf86OSmouse.h"
+#ifdef XV
#include "xf86xv.h"
#include "xf86xvmc.h"
+#endif
#include "xf86cmap.h"
#include "xf86fbman.h"
#include "dgaproc.h"
@@ -351,9 +353,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86AllocateEntityPrivateIndex)
SYMFUNC(xf86GetEntityPrivate)
- /* xf86cvt.c */
- SYMFUNC(xf86CVTMode)
-
/* xf86Configure.c */
SYMFUNC(xf86AddDeviceToConfigure)
@@ -952,6 +951,7 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86CrtcSetSizeRange)
SYMFUNC(xf86CrtcScreenInit)
SYMFUNC(xf86CVTMode)
+ SYMFUNC(xf86GTFMode)
SYMFUNC(xf86DisableUnusedFunctions)
SYMFUNC(xf86DPMSSet)
SYMFUNC(xf86DuplicateMode)
diff --git a/hw/xfree86/modes/Makefile.am b/hw/xfree86/modes/Makefile.am
index 6ee85757a..331e4061c 100644
--- a/hw/xfree86/modes/Makefile.am
+++ b/hw/xfree86/modes/Makefile.am
@@ -5,6 +5,7 @@ libxf86modes_a_SOURCES = \
xf86Crtc.h \
xf86Cursors.c \
xf86cvt.c \
+ xf86gtf.c \
xf86DiDGA.c \
xf86EdidModes.c \
xf86Modes.c \
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 266e08195..8c2b24786 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1,5 +1,6 @@
/*
* Copyright © 2006 Keith Packard
+ * Copyright © 2008 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -693,7 +694,12 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen)
/*
* Called at ScreenInit time to set up
*/
-_X_EXPORT Bool
+_X_EXPORT
+#ifdef RANDR_13_INTERFACE
+int
+#else
+Bool
+#endif
xf86CrtcScreenInit (ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
@@ -726,7 +732,11 @@ xf86CrtcScreenInit (ScreenPtr screen)
config->CloseScreen = screen->CloseScreen;
screen->CloseScreen = xf86CrtcCloseScreen;
+#ifdef RANDR_13_INTERFACE
+ return RANDR_INTERFACE_VERSION;
+#else
return TRUE;
+#endif
}
static DisplayModePtr
@@ -808,7 +818,7 @@ xf86ClosestMode (xf86OutputPtr output,
return target_mode;
}
-static Bool
+static DisplayModePtr
xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height)
{
DisplayModePtr mode;
@@ -820,9 +830,21 @@ xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height)
continue;
if (mode->type & M_T_PREFERRED)
- return TRUE;
+ return mode;
}
- return FALSE;
+ return NULL;
+}
+
+static DisplayModePtr
+xf86OutputHasUserPreferredMode (xf86OutputPtr output)
+{
+ DisplayModePtr mode, first = output->probed_modes;
+
+ for (mode = first; mode && mode->next != first; mode = mode->next)
+ if (mode->type & M_T_USERPREF)
+ return mode;
+
+ return NULL;
}
static int
@@ -1261,6 +1283,23 @@ xf86SortModes (DisplayModePtr input)
return output;
}
+static char *
+preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output)
+{
+ char *preferred_mode = NULL;
+
+ /* Check for a configured preference for a particular mode */
+ preferred_mode = xf86GetOptValString (output->options,
+ OPTION_PREFERRED_MODE);
+ if (preferred_mode)
+ return preferred_mode;
+
+ if (pScrn->display->modes && *pScrn->display->modes)
+ preferred_mode = *pScrn->display->modes;
+
+ return preferred_mode;
+}
+
_X_EXPORT void
xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
{
@@ -1445,8 +1484,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
output->probed_modes = xf86SortModes (output->probed_modes);
/* Check for a configured preference for a particular mode */
- preferred_mode = xf86GetOptValString (output->options,
- OPTION_PREFERRED_MODE);
+ preferred_mode = preferredMode(scrn, output);
if (preferred_mode)
{
@@ -1561,6 +1599,271 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn)
scrn->currentMode = scrn->modes;
}
+static void
+xf86EnableOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, Bool *enabled)
+{
+ Bool any_enabled = FALSE;
+ int o;
+
+ for (o = 0; o < config->num_output; o++)
+ any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], TRUE);
+
+ if (!any_enabled) {
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "No outputs definitely connected, trying again...\n");
+
+ for (o = 0; o < config->num_output; o++)
+ enabled[o] = xf86OutputEnabled(config->output[o], FALSE);
+ }
+}
+
+static Bool
+nextEnabledOutput(xf86CrtcConfigPtr config, Bool *enabled, int *index)
+{
+ int o = *index;
+
+ for (o++; o < config->num_output; o++) {
+ if (enabled[o]) {
+ *index = o;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static Bool
+xf86TargetExact(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ int o;
+ int pref_width = 0, pref_height = 0;
+ DisplayModePtr *preferred;
+ Bool ret = FALSE;
+
+ preferred = xnfcalloc(config->num_output, sizeof(DisplayModePtr));
+
+ /* Find all the preferred modes; fail if any outputs lack them */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ preferred[o] =
+ xf86OutputHasPreferredMode(config->output[o], width, height);
+
+ if (!preferred[o])
+ goto out;
+ }
+
+ /* check that they're all the same size */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ Rotation r = config->output[o]->initial_rotation;
+ if (!pref_width) {
+ pref_width = xf86ModeWidth(preferred[o], r);
+ pref_height = xf86ModeHeight(preferred[o], r);
+ } else {
+ if (pref_width != xf86ModeWidth(preferred[o], r))
+ goto out;
+ if (pref_height != xf86ModeHeight(preferred[o], r))
+ goto out;
+ }
+ }
+
+ /* oh good, they match. stash the selected modes and return. */
+ memcpy(modes, preferred, config->num_output * sizeof(DisplayModePtr));
+ ret = TRUE;
+
+out:
+ xfree(preferred);
+ return ret;
+}
+
+static Bool
+aspectMatch(float a, float b)
+{
+ return fabs(1 - (a / b)) < 0.05;
+}
+
+static DisplayModePtr
+nextAspectMode(xf86OutputPtr o, DisplayModePtr last, float aspect)
+{
+ DisplayModePtr m = NULL;
+
+ if (!o)
+ return NULL;
+
+ if (!last)
+ m = o->probed_modes;
+ else
+ m = last->next;
+
+ for (; m; m = m->next)
+ if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay))
+ return m;
+
+ return NULL;
+}
+
+static DisplayModePtr
+bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
+{
+ int o = -1, p;
+ DisplayModePtr mode = NULL, test = NULL, match = NULL;
+
+ nextEnabledOutput(config, enabled, &o);
+ while ((mode = nextAspectMode(config->output[o], mode, aspect))) {
+ for (p = o; nextEnabledOutput(config, enabled, &p); ) {
+ test = xf86OutputFindClosestMode(config->output[p], mode);
+ if (!test)
+ break;
+ if (test->HDisplay != mode->HDisplay ||
+ test->VDisplay != mode->VDisplay) {
+ test = NULL;
+ break;
+ }
+ }
+
+ /* if we didn't match it on all outputs, try the next one */
+ if (!test)
+ continue;
+
+ /* if it's bigger than the last one, save it */
+ if (!match || (test->HDisplay > match->HDisplay))
+ match = test;
+ }
+
+ /* return the biggest one found */
+ return match;
+}
+
+static DisplayModePtr
+biggestMode(DisplayModePtr a, DisplayModePtr b)
+{
+ int A, B;
+
+ if (!a)
+ return b;
+ if (!b)
+ return a;
+
+ A = a->HDisplay * a->VDisplay;
+ B = b->HDisplay * b->VDisplay;
+
+ if (A > B)
+ return a;
+
+ return b;
+}
+
+static Bool
+xf86TargetAspect(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ int o;
+ float aspect = 0.0, *aspects;
+ xf86OutputPtr output;
+ Bool ret = FALSE;
+ DisplayModePtr guess = NULL, aspect_guess = NULL, base_guess = NULL;
+
+ aspects = xnfcalloc(config->num_output, sizeof(float));
+
+ /* collect the aspect ratios */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ output = config->output[o];
+ if (output->mm_height)
+ aspects[o] = (float)output->mm_width / (float)output->mm_height;
+ else
+ aspects[o] = 4.0 / 3.0;
+ }
+
+ /* check that they're all the same */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ output = config->output[o];
+ if (!aspect) {
+ aspect = aspects[o];
+ } else if (!aspectMatch(aspect, aspects[o])) {
+ goto no_aspect_match;
+ }
+ }
+
+ /* if they're all 4:3, just skip ahead and save effort */
+ if (!aspectMatch(aspect, 4.0/3.0))
+ aspect_guess = bestModeForAspect(config, enabled, aspect);
+
+no_aspect_match:
+ base_guess = bestModeForAspect(config, enabled, 4.0/3.0);
+
+ guess = biggestMode(base_guess, aspect_guess);
+
+ if (!guess)
+ goto out;
+
+ /* found a mode that works everywhere, now apply it */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ modes[o] = xf86OutputFindClosestMode(config->output[o], guess);
+ }
+ ret = TRUE;
+
+out:
+ xfree(aspects);
+ return ret;
+}
+
+static Bool
+xf86TargetFallback(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ DisplayModePtr target_mode = NULL;
+ Rotation target_rotation = RR_Rotate_0;
+ DisplayModePtr default_mode;
+ int default_preferred, target_preferred = 0, o;
+
+ /* User preferred > preferred > other modes */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ default_mode = xf86DefaultMode (config->output[o], width, height);
+ if (!default_mode)
+ continue;
+
+ default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) +
+ ((default_mode->type & M_T_USERPREF) != 0));
+
+ if (default_preferred > target_preferred || !target_mode) {
+ target_mode = default_mode;
+ target_preferred = default_preferred;
+ target_rotation = config->output[o]->initial_rotation;
+ config->compat_output = o;
+ }
+ }
+
+ if (target_mode)
+ modes[config->compat_output] = target_mode;
+
+ /* Fill in other output modes */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ if (!modes[o])
+ modes[o] = xf86ClosestMode(config->output[o], target_mode,
+ target_rotation, width, height);
+ }
+
+ return (target_mode != NULL);
+}
+
+static Bool
+xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ int o;
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o); )
+ if (xf86OutputHasUserPreferredMode(config->output[o]))
+ return
+ xf86TargetFallback(scrn, config, modes, enabled, width, height);
+
+ return FALSE;
+}
+
+
/**
* Construct default screen configuration
*
@@ -1580,14 +1883,11 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int o, c;
- DisplayModePtr target_mode = NULL;
- int target_preferred = 0;
- Rotation target_rotation = RR_Rotate_0;
xf86CrtcPtr *crtcs;
DisplayModePtr *modes;
- Bool *enabled, any_enabled = FALSE;
- int width;
- int height;
+ Bool *enabled;
+ int width, height;
+ int i = scrn->scrnIndex;
/* Set up the device options */
config->options = xnfalloc (sizeof (xf86DeviceOptions));
@@ -1613,75 +1913,28 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr));
enabled = xnfcalloc (config->num_output, sizeof (Bool));
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
-
- modes[o] = NULL;
- any_enabled |= (enabled[o] = xf86OutputEnabled (output, TRUE));
- }
-
- if (!any_enabled)
- {
- xf86DrvMsg (scrn->scrnIndex, X_WARNING,
- "No outputs definitely connected, trying again...\n");
-
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
-
- modes[o] = NULL;
- enabled[o] = xf86OutputEnabled (output, FALSE);
- }
- }
-
- /*
- * User preferred > preferred > other modes
- */
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- DisplayModePtr default_mode;
- int default_preferred;
+ xf86EnableOutputs(scrn, config, enabled);
+
+ if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
+ else if (xf86TargetExact(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
+ else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n");
+ else if (xf86TargetFallback(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
+ else
+ xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
- if (!enabled[o])
- continue;
- default_mode = xf86DefaultMode (output, width, height);
- if (!default_mode)
- continue;
- default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) +
- ((default_mode->type & M_T_USERPREF) != 0));
- if (default_preferred > target_preferred || !target_mode)
- {
- target_mode = default_mode;
- target_preferred = default_preferred;
- target_rotation = output->initial_rotation;
- config->compat_output = o;
- }
- }
- if (target_mode)
- modes[config->compat_output] = target_mode;
- /*
- * Fill in other output modes
- */
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
-
- if (enabled[o])
- {
- if (!modes[o])
- modes[o] = xf86ClosestMode (output, target_mode,
- target_rotation, width, height);
- if (!modes[o])
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Output %s enabled but has no modes\n",
- output->name);
- else
- xf86DrvMsg (scrn->scrnIndex, X_INFO,
- "Output %s using initial mode %s\n",
- output->name, modes[o]->name);
- }
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ if (!modes[o])
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Output %s enabled but has no modes\n",
+ config->output[o]->name);
+ else
+ xf86DrvMsg (scrn->scrnIndex, X_INFO,
+ "Output %s using initial mode %s\n",
+ config->output[o]->name, modes[o]->name);
}
/*
@@ -1781,6 +2034,68 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
}
/*
+ * Check the CRTC we're going to map each output to vs. it's current
+ * CRTC. If they don't match, we have to disable the output and the CRTC
+ * since the driver will have to re-route things.
+ */
+static void
+xf86PrepareOutputs (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+#if RANDR_GET_CRTC_INTERFACE
+ /* Disable outputs that are unused or will be re-routed */
+ if (!output->funcs->get_crtc ||
+ output->crtc != (*output->funcs->get_crtc)(output) ||
+ output->crtc == NULL)
+#endif
+ (*output->funcs->dpms)(output, DPMSModeOff);
+ }
+}
+
+static void
+xf86PrepareCrtcs (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < config->num_crtc; c++) {
+#if RANDR_GET_CRTC_INTERFACE
+ xf86CrtcPtr crtc = config->crtc[c];
+ xf86OutputPtr output = NULL;
+ uint32_t desired_outputs = 0, current_outputs = 0;
+ int o;
+
+ for (o = 0; o < config->num_output; o++) {
+ output = config->output[o];
+ if (output->crtc == crtc)
+ desired_outputs |= (1<<o);
+ /* If we can't tell where it's mapped, force it off */
+ if (!output->funcs->get_crtc) {
+ desired_outputs = 0;
+ break;
+ }
+ if ((*output->funcs->get_crtc)(output) == crtc)
+ current_outputs |= (1<<o);
+ }
+
+ /*
+ * If mappings are different or the CRTC is unused,
+ * we need to disable it
+ */
+ if (desired_outputs != current_outputs ||
+ !desired_outputs)
+ (*crtc->funcs->dpms)(crtc, DPMSModeOff);
+#else
+ (*crtc->funcs->dpms)(crtc, DPMSModeOff);
+#endif
+ }
+}
+
+/*
* Using the desired mode information in each crtc, set
* modes (used in EnterVT functions, or at server startup)
*/
@@ -1789,26 +2104,11 @@ _X_EXPORT Bool
xf86SetDesiredModes (ScrnInfoPtr scrn)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int c, o;
-
- /*
- * Turn off everything so mode setting is done
- * with hardware in a consistent state
- */
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- (*output->funcs->dpms)(output, DPMSModeOff);
- }
+ int c;
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
+ xf86PrepareOutputs(scrn);
+ xf86PrepareCrtcs(scrn);
- crtc->funcs->dpms(crtc, DPMSModeOff);
- memset(&crtc->mode, 0, sizeof(crtc->mode));
- }
-
for (c = 0; c < config->num_crtc; c++)
{
xf86CrtcPtr crtc = config->crtc[c];
@@ -1987,7 +2287,7 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
}
}
xf86DisableUnusedFunctions(pScrn);
-#if RANDR_12_INTERFACE
+#ifdef RANDR_12_INTERFACE
xf86RandR12TellChanged (pScrn->pScreen);
#endif
return ok;
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index cc045b229..2d723a5cd 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -215,8 +215,15 @@ typedef struct _xf86CrtcFuncs {
Rotation rotation, int x, int y);
} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
+#define XF86_CRTC_VERSION 1
+
struct _xf86Crtc {
/**
+ * ABI versioning
+ */
+ int version;
+
+ /**
* Associated ScrnInfo
*/
ScrnInfoPtr scrn;
@@ -410,6 +417,21 @@ typedef struct _xf86OutputFuncs {
Atom property,
RRPropertyValuePtr value);
#endif
+#ifdef RANDR_13_INTERFACE
+ /**
+ * Callback to get an updated property value
+ */
+ Bool
+ (*get_property)(xf86OutputPtr output,
+ Atom property);
+#endif
+#ifdef RANDR_GET_CRTC_INTERFACE
+ /**
+ * Callback to get current CRTC for a given output
+ */
+ xf86CrtcPtr
+ (*get_crtc)(xf86OutputPtr output);
+#endif
/**
* Clean up driver-specific bits of the output
*/
@@ -417,8 +439,16 @@ typedef struct _xf86OutputFuncs {
(*destroy) (xf86OutputPtr output);
} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
+
+#define XF86_OUTPUT_VERSION 1
+
struct _xf86Output {
/**
+ * ABI versioning
+ */
+ int version;
+
+ /**
* Associated ScrnInfo
*/
ScrnInfoPtr scrn;
@@ -669,7 +699,11 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY);
void
xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
+#ifdef RANDR_13_INTERFACE
+int
+#else
Bool
+#endif
xf86CrtcScreenInit (ScreenPtr pScreen);
Bool
diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 171d16ab3..42a4eaaf9 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -138,7 +138,8 @@ cursor_bitpos (int flags, int x, Bool mask)
mask = !mask;
if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED)
x = (x & ~3) | (3 - (x & 3));
- if (flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST)
+ if (((flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) == 0) ==
+ (X_BYTE_ORDER == X_BIG_ENDIAN))
x = (x & ~7) | (7 - (x & 7));
if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1)
x = (x << 1) + mask;
@@ -227,8 +228,13 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
CursorPtr cursor = xf86_config->cursor;
int c;
- CARD8 *bits = cursor ? dixLookupPrivate(&cursor->devPrivates,
- screen) : NULL;
+ CARD8 *bits = cursor ?
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
+ dixLookupPrivate(&cursor->devPrivates, screen)
+#else
+ cursor->devPriv[screen->myNum]
+#endif
+ : NULL;
/* Save ARGB versions of these colors */
xf86_config->cursor_fg = (CARD32) fg | 0xff000000;
@@ -614,7 +620,12 @@ xf86_reload_cursors (ScreenPtr screen)
else
#endif
(*cursor_info->LoadCursorImage)(cursor_info->pScrn,
- dixLookupPrivate(&cursor->devPrivates, screen));
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
+ dixLookupPrivate(&cursor->devPrivates, screen)
+#else
+ cursor->devPriv[screen->myNum]
+#endif
+ );
(*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y);
(*cursor_info->ShowCursor)(cursor_info->pScrn);
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index a1bdb0b99..8f7d45dd6 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -108,13 +108,6 @@ static Bool quirk_prefer_large_75 (int scrnIndex, xf86MonPtr DDC)
static Bool quirk_detailed_h_in_cm (int scrnIndex, xf86MonPtr DDC)
{
- /* Bug #10304: "LGPhilipsLCD LP154W01-A5" */
- /* Bug #12784: "LGPhilipsLCD LP154W01-TLA2" */
- /* Red Hat #435216 "LGPhilipsLCD LP154W01-TLAE" */
- if (memcmp (DDC->vendor.name, "LPL", 4) == 0 &&
- (DDC->vendor.prod_id == 0 || DDC->vendor.prod_id == 0x2a00))
- return TRUE;
-
/* Bug #11603: Funai Electronics PM36B */
if (memcmp (DDC->vendor.name, "FCM", 4) == 0 &&
DDC->vendor.prod_id == 13600)
@@ -137,7 +130,7 @@ static Bool quirk_detailed_use_maximum_size (int scrnIndex, xf86MonPtr DDC)
{
/* Bug #10304: LGPhilipsLCD LP154W01-A5 */
if (memcmp (DDC->vendor.name, "LPL", 4) == 0 &&
- DDC->vendor.prod_id == 0)
+ (DDC->vendor.prod_id == 0 || DDC->vendor.prod_id == 0x2a00))
return TRUE;
return FALSE;
@@ -160,6 +153,16 @@ static Bool quirk_first_detailed_preferred (int scrnIndex, xf86MonPtr DDC)
DDC->vendor.prod_id == 57364)
return TRUE;
+ /* Proview AY765C 17" LCD. See bug #15160*/
+ if (memcmp (DDC->vendor.name, "PTS", 4) == 0 &&
+ DDC->vendor.prod_id == 765)
+ return TRUE;
+
+ /* ACR of some sort RH #284231 */
+ if (memcmp (DDC->vendor.name, "ACR", 4) == 0 &&
+ DDC->vendor.prod_id == 2423)
+ return TRUE;
+
return FALSE;
}
@@ -221,27 +224,27 @@ static const ddc_quirk_map_t ddc_quirks[] = {
* TODO:
* - for those with access to the VESA DMT standard; review please.
*/
-#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DRIVER
-#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
-
-static DisplayModeRec DDCEstablishedModes[17] = {
- { MODEPREFIX("800x600"), 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
- { MODEPREFIX("800x600"), 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
- { MODEPREFIX("640x480"), 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
- { MODEPREFIX("640x480"), 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
- { MODEPREFIX("640x480"), 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */
- { MODEPREFIX("640x480"), 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
- { MODEPREFIX("720x400"), 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */
- { MODEPREFIX("720x400"), 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */
- { MODEPREFIX("1280x1024"), 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
- { MODEPREFIX("1024x768"), 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
- { MODEPREFIX("1024x768"), 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
- { MODEPREFIX("1024x768"), 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
- { MODEPREFIX("1024x768"), 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */
- { MODEPREFIX("832x624"), 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */
- { MODEPREFIX("800x600"), 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
- { MODEPREFIX("800x600"), 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
- { MODEPREFIX("1152x864"), 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
+#define MODEPREFIX NULL, NULL, NULL, 0, M_T_DRIVER
+#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
+
+static const DisplayModeRec DDCEstablishedModes[17] = {
+ { MODEPREFIX, 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
+ { MODEPREFIX, 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
+ { MODEPREFIX, 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
+ { MODEPREFIX, 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
+ { MODEPREFIX, 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */
+ { MODEPREFIX, 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
+ { MODEPREFIX, 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */
+ { MODEPREFIX, 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */
+ { MODEPREFIX, 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
+ { MODEPREFIX, 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
+ { MODEPREFIX, 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
+ { MODEPREFIX, 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
+ { MODEPREFIX, 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */
+ { MODEPREFIX, 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */
+ { MODEPREFIX, 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
+ { MODEPREFIX, 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
+ { MODEPREFIX, 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
};
static DisplayModePtr
@@ -263,20 +266,57 @@ DDCModesFromEstablished(int scrnIndex, struct established_timings *timing,
return Modes;
}
+#define LEVEL_DMT 0
+#define LEVEL_GTF 1
+#define LEVEL_CVT 2
+
+static int
+MonitorStandardTimingLevel(xf86MonPtr DDC)
+{
+ if (DDC->ver.revision >= 2) {
+ if (DDC->ver.revision >= 4 && CVT_SUPPORTED(DDC->features.msc)) {
+ return LEVEL_CVT;
+ }
+ return LEVEL_GTF;
+ }
+ return LEVEL_DMT;
+}
+
/*
+ * This is not really correct. Appendix B of the EDID 1.4 spec defines
+ * the right thing to do here. If the timing given here matches a mode
+ * defined in the VESA DMT standard, we _must_ use that. If the device
+ * supports CVT modes, then we should generate a CVT timing. If both
+ * of the above fail, use GTF.
*
+ * There are some wrinkles here. EDID 1.1 and 1.0 sinks can't really
+ * "support" GTF, since it wasn't a standard yet; so if they ask for a
+ * timing in this section that isn't defined in DMT, returning a GTF mode
+ * may not actually be valid. EDID 1.3 sinks often report support for
+ * some CVT modes, but they are not required to support CVT timings for
+ * modes in the standard timing descriptor, so we should _not_ treat them
+ * as CVT-compliant (unless specified in an extension block I suppose).
+ *
+ * EDID 1.4 requires that all sink devices support both GTF and CVT timings
+ * for modes in this section, but does say that CVT is preferred.
*/
static DisplayModePtr
-DDCModesFromStandardTiming(int scrnIndex, struct std_timings *timing,
- ddc_quirk_t quirks)
+DDCModesFromStandardTiming(struct std_timings *timing, ddc_quirk_t quirks,
+ int timing_level)
{
DisplayModePtr Modes = NULL, Mode = NULL;
int i;
for (i = 0; i < STD_TIMINGS; i++) {
if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
- Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize,
- timing[i].refresh, FALSE, FALSE);
+ /* XXX check for DMT first, else... */
+ if (timing_level == LEVEL_CVT)
+ Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize,
+ timing[i].refresh, FALSE, FALSE);
+ else
+ Mode = xf86GTFMode(timing[i].hsize, timing[i].vsize,
+ timing[i].refresh, FALSE, FALSE);
+
Mode->type = M_T_DRIVER;
Modes = xf86ModesAdd(Modes, Mode);
}
@@ -321,8 +361,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
" sync.\n", __func__, timing->h_active, timing->v_active);
}
- Mode = xnfalloc(sizeof(DisplayModeRec));
- memset(Mode, 0, sizeof(DisplayModeRec));
+ Mode = xnfcalloc(1, sizeof(DisplayModeRec));
Mode->type = M_T_DRIVER;
if (preferred)
@@ -374,6 +413,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
return Mode;
}
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
static DisplayModePtr
DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
{
@@ -402,10 +442,15 @@ DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
return modes;
}
+#endif
/*
- *
+ * This is only valid when the sink claims to be continuous-frequency
+ * but does not supply a detailed range descriptor. Such sinks are
+ * arguably broken. Currently the mode validation code isn't aware of
+ * this; the non-RANDR code even punts the decision of optional sync
+ * range checking to the driver. Loss.
*/
static void
DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
@@ -547,6 +592,7 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
DisplayModePtr Modes = NULL, Mode;
ddc_quirk_t quirks;
Bool preferred;
+ int timing_level;
xf86DrvMsg (scrnIndex, X_INFO, "EDID vendor \"%s\", prod id %d\n",
DDC->vendor.name, DDC->vendor.prod_id);
@@ -561,6 +607,8 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
if (quirks & (DDC_QUIRK_PREFER_LARGE_60 | DDC_QUIRK_PREFER_LARGE_75))
preferred = FALSE;
+ timing_level = MonitorStandardTimingLevel(DDC);
+
for (i = 0; i < DET_TIMINGS; i++) {
struct detailed_monitor_section *det_mon = &DDC->det_mon[i];
@@ -574,15 +622,16 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
Modes = xf86ModesAdd(Modes, Mode);
break;
case DS_STD_TIMINGS:
- Mode = DDCModesFromStandardTiming(scrnIndex,
- det_mon->section.std_t,
- quirks);
+ Mode = DDCModesFromStandardTiming(det_mon->section.std_t,
+ quirks, timing_level);
Modes = xf86ModesAdd(Modes, Mode);
break;
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
case DS_CVT:
Mode = DDCModesFromCVT(scrnIndex, det_mon->section.cvt);
Modes = xf86ModesAdd(Modes, Mode);
break;
+#endif
default:
break;
}
@@ -593,7 +642,7 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
Modes = xf86ModesAdd(Modes, Mode);
/* Add standard timings */
- Mode = DDCModesFromStandardTiming(scrnIndex, DDC->timings2, quirks);
+ Mode = DDCModesFromStandardTiming(DDC->timings2, quirks, timing_level);
Modes = xf86ModesAdd(Modes, Mode);
if (quirks & DDC_QUIRK_PREFER_LARGE_60)
@@ -620,13 +669,17 @@ xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
Monitor->DDC = DDC;
- Monitor->widthmm = 10 * DDC->features.hsize;
- Monitor->heightmm = 10 * DDC->features.vsize;
+ if (Monitor->widthmm <= 0 && Monitor->heightmm <= 0) {
+ Monitor->widthmm = 10 * DDC->features.hsize;
+ Monitor->heightmm = 10 * DDC->features.vsize;
+ }
- /* If this is a digital display, then we can use reduced blanking */
+ /*
+ * If this is a digital display, then we can use reduced blanking.
+ * XXX This is a 1.3 heuristic. 1.4 explicitly defines rb support.
+ */
if (DDC->features.input_type)
Monitor->reducedblanking = TRUE;
- /* Allow the user to also enable this through config */
Modes = xf86DDCGetModes(scrnIndex, DDC);
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index 3d222cc73..2dff31b3a 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -214,10 +214,11 @@ xf86DuplicateMode(DisplayModePtr pMode)
*pNew = *pMode;
pNew->next = NULL;
pNew->prev = NULL;
- if (pNew->name == NULL) {
- xf86SetModeDefaultName(pMode);
- }
- pNew->name = xnfstrdup(pMode->name);
+
+ if (pMode->name == NULL)
+ xf86SetModeDefaultName(pNew);
+ else
+ pNew->name = xnfstrdup(pMode->name);
return pNew;
}
@@ -508,7 +509,12 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
for (mode = modeList; mode != NULL; mode = mode->next) {
if (xf86ModeBandwidth(mode, depth) > bandwidth)
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
mode->status = MODE_BANDWIDTH;
+#else
+ /* MODE_BANDWIDTH didn't exist in xserver 1.2 */
+ mode->status = MODE_BAD;
+#endif
}
}
@@ -657,7 +663,7 @@ xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
DisplayModePtr head = NULL, prev = NULL, mode;
int i;
- for (i = 0; xf86DefaultModes[i].name != NULL; i++)
+ for (i = 0; i < xf86NumDefaultModes; i++)
{
DisplayModePtr defMode = &xf86DefaultModes[i];
@@ -666,23 +672,9 @@ xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
if (!doubleScanAllowed && (defMode->Flags & V_DBLSCAN))
continue;
- mode = xalloc(sizeof(DisplayModeRec));
- if (!mode)
- continue;
- memcpy(mode,&xf86DefaultModes[i],sizeof(DisplayModeRec));
- mode->name = xstrdup(xf86DefaultModes[i].name);
- if (!mode->name)
- {
- xfree (mode);
- continue;
- }
- mode->prev = prev;
- mode->next = NULL;
- if (prev)
- prev->next = mode;
- else
- head = mode;
- prev = mode;
+ mode = xf86DuplicateMode(defMode);
+
+ head = xf86ModesAdd(head, mode);
}
return head;
}
diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h
index 9ad5ee653..5d49c9314 100644
--- a/hw/xfree86/modes/xf86Modes.h
+++ b/hw/xfree86/modes/xf86Modes.h
@@ -62,6 +62,7 @@ DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
Bool Reduced, Bool Interlaced);
+DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins);
void
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 1c20082ce..cbe7a32d3 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -61,11 +61,21 @@ static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
#endif
static int xf86RandR12Generation;
-static DevPrivateKey xf86RandR12Key;
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
+static DevPrivateKey xf86RandR12Key;
#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key))
+#else /* XORG_VERSION_CURRENT < 7.0 */
+
+static int xf86RandR12Index;
+#define XF86RANDRINFO(p) \
+ ((XF86RandRInfoPtr)(p)->devPrivates[xf86RandR12Index].ptr)
+
+#endif /* XORG_VERSION_CURRENT < 7.0 */
+
+
static int
xf86RandR12ModeRefresh (DisplayModePtr mode)
{
@@ -136,23 +146,6 @@ xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations)
randrp->maxY = maxY;
}
- if (scrp->currentMode->HDisplay != randrp->virtualX ||
- scrp->currentMode->VDisplay != randrp->virtualY)
- {
- pSize = RRRegisterSize (pScreen,
- randrp->virtualX, randrp->virtualY,
- randrp->mmWidth,
- randrp->mmHeight);
- if (!pSize)
- return FALSE;
- RRRegisterRate (pScreen, pSize, refresh0);
- if (scrp->virtualX == randrp->virtualX &&
- scrp->virtualY == randrp->virtualY)
- {
- RRSetCurrentConfig (pScreen, randrp->rotation, refresh0, pSize);
- }
- }
-
return TRUE;
}
@@ -341,13 +334,17 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
Bool ret = FALSE;
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key) {
+#endif
if (randrp->virtualX == -1 || randrp->virtualY == -1)
{
randrp->virtualX = pScrn->virtualX;
randrp->virtualY = pScrn->virtualY;
}
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
}
+#endif
if (pRoot && pScrn->vtSema)
(*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
@@ -359,8 +356,8 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
pScreen->width = pScrnPix->drawable.width = width;
pScreen->height = pScrnPix->drawable.height = height;
- pScreen->mmWidth = mmWidth;
- pScreen->mmHeight = mmHeight;
+ randrp->mmWidth = pScreen->mmWidth = mmWidth;
+ randrp->mmHeight = pScreen->mmHeight = mmHeight;
xf86SetViewport (pScreen, pScreen->width-1, pScreen->height-1);
xf86SetViewport (pScreen, 0, 0);
@@ -469,8 +466,10 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
mmHeight);
}
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL)
return TRUE;
+#endif
if (randrp->virtualX == -1 || randrp->virtualY == -1)
{
@@ -501,7 +500,11 @@ xf86RandR12Init (ScreenPtr pScreen)
if (xf86RandR12Generation != serverGeneration)
xf86RandR12Generation = serverGeneration;
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
xf86RandR12Key = &xf86RandR12Key;
+#else
+ xf86RandR12Index = AllocateScreenPrivateIndex();
+#endif
randrp = xalloc (sizeof (XF86RandRInfoRec));
if (!randrp)
@@ -527,7 +530,11 @@ xf86RandR12Init (ScreenPtr pScreen)
randrp->maxX = randrp->maxY = 0;
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp);
+#else
+ pScreen->devPrivates[xf86RandR12Index].ptr = randrp;
+#endif
#if RANDR_12_INTERFACE
if (!xf86RandR12Init12 (pScreen))
@@ -546,8 +553,10 @@ xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#endif
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL)
return;
+#endif
randrp = XF86RANDRINFO(pScreen);
#if RANDR_12_INTERFACE
@@ -735,6 +744,9 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
xf86CrtcPtr *save_crtcs;
Bool save_enabled = crtc->enabled;
+ if (!crtc->scrn->vtSema)
+ return FALSE;
+
save_crtcs = xalloc(config->num_output * sizeof (xf86CrtcPtr));
if ((randr_mode != NULL) != crtc->enabled)
changed = TRUE;
@@ -849,6 +861,20 @@ xf86RandR12OutputSetProperty (ScreenPtr pScreen,
}
static Bool
+xf86RandR13OutputGetProperty (ScreenPtr pScreen,
+ RROutputPtr randr_output,
+ Atom property)
+{
+ xf86OutputPtr output = randr_output->devPrivate;
+
+ if (output->funcs->get_property == NULL)
+ return TRUE;
+
+ /* Should be safe even w/o vtSema */
+ return output->funcs->get_property(output, property);
+}
+
+static Bool
xf86RandR12OutputValidateMode (ScreenPtr pScreen,
RROutputPtr randr_output,
RRModePtr randr_mode)
@@ -1077,8 +1103,10 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL)
return TRUE;
+#endif
for (c = 0; c < config->num_crtc; c++)
xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
@@ -1100,8 +1128,13 @@ xf86RandR12TellChanged (ScreenPtr pScreen)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
int c;
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL)
return;
+#else
+ if (!XF86RANDRINFO(pScreen))
+ return;
+#endif
xf86RandR12SetInfo12 (pScreen);
for (c = 0; c < config->num_crtc; c++)
@@ -1127,6 +1160,9 @@ xf86RandR12Init12 (ScreenPtr pScreen)
rp->rrCrtcSetGamma = xf86RandR12CrtcSetGamma;
rp->rrOutputSetProperty = xf86RandR12OutputSetProperty;
rp->rrOutputValidateMode = xf86RandR12OutputValidateMode;
+#if RANDR_13_INTERFACE
+ rp->rrOutputGetProperty = xf86RandR13OutputGetProperty;
+#endif
rp->rrModeDestroy = xf86RandR12ModeDestroy;
rp->rrSetConfig = NULL;
pScrn->PointerMoved = xf86RandR12PointerMoved;
diff --git a/hw/xfree86/modes/xf86cvt.c b/hw/xfree86/modes/xf86cvt.c
index 69ccc4259..e9c74aa62 100644
--- a/hw/xfree86/modes/xf86cvt.c
+++ b/hw/xfree86/modes/xf86cvt.c
@@ -20,11 +20,6 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
-/**
- * @file This is a copy of xf86cvt.c from the X Server, for compatibility with
- * old servers (pre-1.2).
- */
-
/*
* The reason for having this function in a file of its own is
* so that ../utils/cvt/cvt can link to it, and that xf86CVTMode
@@ -72,7 +67,7 @@ _X_EXPORT DisplayModePtr
xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
Bool Interlaced)
{
- DisplayModeRec *Mode = xnfalloc(sizeof(DisplayModeRec));
+ DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
/* 1) top/bottom margin size (% of height) - default: 1.8 */
#define CVT_MARGIN_PERCENTAGE 1.8
@@ -95,8 +90,6 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
int VDisplayRnd, VMargin, VSync;
float Interlace; /* Please rename this */
- memset(Mode, 0, sizeof(DisplayModeRec));
-
/* CVT default is 60.0Hz */
if (!VRefresh)
VRefresh = 60.0;
diff --git a/hw/xfree86/modes/xf86gtf.c b/hw/xfree86/modes/xf86gtf.c
new file mode 100644
index 000000000..fed56bd12
--- /dev/null
+++ b/hw/xfree86/modes/xf86gtf.c
@@ -0,0 +1,388 @@
+/*
+ * gtf.c Generate mode timings using the GTF Timing Standard
+ *
+ * gcc gtf.c -o gtf -lm -Wall
+ *
+ * Copyright (c) 2001, Andy Ritger aritger@nvidia.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:
+ *
+ * o Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * o 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.
+ * o Neither the name of NVIDIA nor the names of its contributors
+ * may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "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 REGENTS OR CONTRIBUTORS 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.
+ *
+ * This program is based on the Generalized Timing Formula(GTF TM)
+ * Standard Version: 1.0, Revision: 1.0
+ *
+ * The GTF Document contains the following Copyright information:
+ *
+ * Copyright (c) 1994, 1995, 1996 - Video Electronics Standards
+ * Association. Duplication of this document within VESA member
+ * companies for review purposes is permitted. All other rights
+ * reserved.
+ *
+ * While every precaution has been taken in the preparation
+ * of this standard, the Video Electronics Standards Association and
+ * its contributors assume no responsibility for errors or omissions,
+ * and make no warranties, expressed or implied, of functionality
+ * of suitability for any purpose. The sample code contained within
+ * this standard may be used without restriction.
+ *
+ *
+ *
+ * The GTF EXCEL(TM) SPREADSHEET, a sample (and the definitive)
+ * implementation of the GTF Timing Standard, is available at:
+ *
+ * ftp://ftp.vesa.org/pub/GTF/GTF_V1R1.xls
+ */
+
+/* Ruthlessly converted to server code by Adam Jackson <ajax@redhat.com> */
+
+#ifdef HAVE_XORG_CONFIG_H
+# include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86.h"
+#include "xf86Modes.h"
+#include <string.h>
+
+#define MARGIN_PERCENT 1.8 /* % of active vertical image */
+#define CELL_GRAN 8.0 /* assumed character cell granularity */
+#define MIN_PORCH 1 /* minimum front porch */
+#define V_SYNC_RQD 3 /* width of vsync in lines */
+#define H_SYNC_PERCENT 8.0 /* width of hsync as % of total line */
+#define MIN_VSYNC_PLUS_BP 550.0 /* min time of vsync + back porch (microsec) */
+#define M 600.0 /* blanking formula gradient */
+#define C 40.0 /* blanking formula offset */
+#define K 128.0 /* blanking formula scaling factor */
+#define J 20.0 /* blanking formula scaling factor */
+
+/* C' and M' are part of the Blanking Duty Cycle computation */
+
+#define C_PRIME (((C - J) * K/256.0) + J)
+#define M_PRIME (K/256.0 * M)
+
+
+/*
+ * xf86GTFMode() - as defined by the GTF Timing Standard, compute the
+ * Stage 1 Parameters using the vertical refresh frequency. In other
+ * words: input a desired resolution and desired refresh rate, and
+ * output the GTF mode timings.
+ *
+ * XXX All the code is in place to compute interlaced modes, but I don't
+ * feel like testing it right now.
+ *
+ * XXX margin computations are implemented but not tested (nor used by
+ * XServer of fbset mode descriptions, from what I can tell).
+ */
+
+_X_EXPORT DisplayModePtr
+xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
+{
+ DisplayModeRec *mode = xnfcalloc(1, sizeof(DisplayModeRec));
+
+ float h_pixels_rnd;
+ float v_lines_rnd;
+ float v_field_rate_rqd;
+ float top_margin;
+ float bottom_margin;
+ float interlace;
+ float h_period_est;
+ float vsync_plus_bp;
+ float v_back_porch;
+ float total_v_lines;
+ float v_field_rate_est;
+ float h_period;
+ float v_field_rate;
+ float v_frame_rate;
+ float left_margin;
+ float right_margin;
+ float total_active_pixels;
+ float ideal_duty_cycle;
+ float h_blank;
+ float total_pixels;
+ float pixel_freq;
+ float h_freq;
+
+ float h_sync;
+ float h_front_porch;
+ float v_odd_front_porch_lines;
+
+ /* 1. In order to give correct results, the number of horizontal
+ * pixels requested is first processed to ensure that it is divisible
+ * by the character size, by rounding it to the nearest character
+ * cell boundary:
+ *
+ * [H PIXELS RND] = ((ROUND([H PIXELS]/[CELL GRAN RND],0))*[CELLGRAN RND])
+ */
+
+ h_pixels_rnd = rint((float) h_pixels / CELL_GRAN) * CELL_GRAN;
+
+ /* 2. If interlace is requested, the number of vertical lines assumed
+ * by the calculation must be halved, as the computation calculates
+ * the number of vertical lines per field. In either case, the
+ * number of lines is rounded to the nearest integer.
+ *
+ * [V LINES RND] = IF([INT RQD?]="y", ROUND([V LINES]/2,0),
+ * ROUND([V LINES],0))
+ */
+
+ v_lines_rnd = interlaced ?
+ rint((float) v_lines) / 2.0 :
+ rint((float) v_lines);
+
+ /* 3. Find the frame rate required:
+ *
+ * [V FIELD RATE RQD] = IF([INT RQD?]="y", [I/P FREQ RQD]*2,
+ * [I/P FREQ RQD])
+ */
+
+ v_field_rate_rqd = interlaced ? (freq * 2.0) : (freq);
+
+ /* 4. Find number of lines in Top margin:
+ *
+ * [TOP MARGIN (LINES)] = IF([MARGINS RQD?]="Y",
+ * ROUND(([MARGIN%]/100*[V LINES RND]),0),
+ * 0)
+ */
+
+ top_margin = margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : (0.0);
+
+ /* 5. Find number of lines in Bottom margin:
+ *
+ * [BOT MARGIN (LINES)] = IF([MARGINS RQD?]="Y",
+ * ROUND(([MARGIN%]/100*[V LINES RND]),0),
+ * 0)
+ */
+
+ bottom_margin = margins ? rint(MARGIN_PERCENT/100.0 * v_lines_rnd) : (0.0);
+
+ /* 6. If interlace is required, then set variable [INTERLACE]=0.5:
+ *
+ * [INTERLACE]=(IF([INT RQD?]="y",0.5,0))
+ */
+
+ interlace = interlaced ? 0.5 : 0.0;
+
+ /* 7. Estimate the Horizontal period
+ *
+ * [H PERIOD EST] = ((1/[V FIELD RATE RQD]) - [MIN VSYNC+BP]/1000000) /
+ * ([V LINES RND] + (2*[TOP MARGIN (LINES)]) +
+ * [MIN PORCH RND]+[INTERLACE]) * 1000000
+ */
+
+ h_period_est = (((1.0/v_field_rate_rqd) - (MIN_VSYNC_PLUS_BP/1000000.0))
+ / (v_lines_rnd + (2*top_margin) + MIN_PORCH + interlace)
+ * 1000000.0);
+
+ /* 8. Find the number of lines in V sync + back porch:
+ *
+ * [V SYNC+BP] = ROUND(([MIN VSYNC+BP]/[H PERIOD EST]),0)
+ */
+
+ vsync_plus_bp = rint(MIN_VSYNC_PLUS_BP/h_period_est);
+
+ /* 9. Find the number of lines in V back porch alone:
+ *
+ * [V BACK PORCH] = [V SYNC+BP] - [V SYNC RND]
+ *
+ * XXX is "[V SYNC RND]" a typo? should be [V SYNC RQD]?
+ */
+
+ v_back_porch = vsync_plus_bp - V_SYNC_RQD;
+
+ /* 10. Find the total number of lines in Vertical field period:
+ *
+ * [TOTAL V LINES] = [V LINES RND] + [TOP MARGIN (LINES)] +
+ * [BOT MARGIN (LINES)] + [V SYNC+BP] + [INTERLACE] +
+ * [MIN PORCH RND]
+ */
+
+ total_v_lines = v_lines_rnd + top_margin + bottom_margin + vsync_plus_bp +
+ interlace + MIN_PORCH;
+
+ /* 11. Estimate the Vertical field frequency:
+ *
+ * [V FIELD RATE EST] = 1 / [H PERIOD EST] / [TOTAL V LINES] * 1000000
+ */
+
+ v_field_rate_est = 1.0 / h_period_est / total_v_lines * 1000000.0;
+
+ /* 12. Find the actual horizontal period:
+ *
+ * [H PERIOD] = [H PERIOD EST] / ([V FIELD RATE RQD] / [V FIELD RATE EST])
+ */
+
+ h_period = h_period_est / (v_field_rate_rqd / v_field_rate_est);
+
+ /* 13. Find the actual Vertical field frequency:
+ *
+ * [V FIELD RATE] = 1 / [H PERIOD] / [TOTAL V LINES] * 1000000
+ */
+
+ v_field_rate = 1.0 / h_period / total_v_lines * 1000000.0;
+
+ /* 14. Find the Vertical frame frequency:
+ *
+ * [V FRAME RATE] = (IF([INT RQD?]="y", [V FIELD RATE]/2, [V FIELD RATE]))
+ */
+
+ v_frame_rate = interlaced ? v_field_rate / 2.0 : v_field_rate;
+
+ /* 15. Find number of pixels in left margin:
+ *
+ * [LEFT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y",
+ * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 /
+ * [CELL GRAN RND]),0)) * [CELL GRAN RND],
+ * 0))
+ */
+
+ left_margin = margins ?
+ rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN :
+ 0.0;
+
+ /* 16. Find number of pixels in right margin:
+ *
+ * [RIGHT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y",
+ * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 /
+ * [CELL GRAN RND]),0)) * [CELL GRAN RND],
+ * 0))
+ */
+
+ right_margin = margins ?
+ rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN :
+ 0.0;
+
+ /* 17. Find total number of active pixels in image and left and right
+ * margins:
+ *
+ * [TOTAL ACTIVE PIXELS] = [H PIXELS RND] + [LEFT MARGIN (PIXELS)] +
+ * [RIGHT MARGIN (PIXELS)]
+ */
+
+ total_active_pixels = h_pixels_rnd + left_margin + right_margin;
+
+ /* 18. Find the ideal blanking duty cycle from the blanking duty cycle
+ * equation:
+ *
+ * [IDEAL DUTY CYCLE] = [C'] - ([M']*[H PERIOD]/1000)
+ */
+
+ ideal_duty_cycle = C_PRIME - (M_PRIME * h_period / 1000.0);
+
+ /* 19. Find the number of pixels in the blanking time to the nearest
+ * double character cell:
+ *
+ * [H BLANK (PIXELS)] = (ROUND(([TOTAL ACTIVE PIXELS] *
+ * [IDEAL DUTY CYCLE] /
+ * (100-[IDEAL DUTY CYCLE]) /
+ * (2*[CELL GRAN RND])), 0))
+ * * (2*[CELL GRAN RND])
+ */
+
+ h_blank = rint(total_active_pixels *
+ ideal_duty_cycle /
+ (100.0 - ideal_duty_cycle) /
+ (2.0 * CELL_GRAN)) * (2.0 * CELL_GRAN);
+
+ /* 20. Find total number of pixels:
+ *
+ * [TOTAL PIXELS] = [TOTAL ACTIVE PIXELS] + [H BLANK (PIXELS)]
+ */
+
+ total_pixels = total_active_pixels + h_blank;
+
+ /* 21. Find pixel clock frequency:
+ *
+ * [PIXEL FREQ] = [TOTAL PIXELS] / [H PERIOD]
+ */
+
+ pixel_freq = total_pixels / h_period;
+
+ /* 22. Find horizontal frequency:
+ *
+ * [H FREQ] = 1000 / [H PERIOD]
+ */
+
+ h_freq = 1000.0 / h_period;
+
+
+ /* Stage 1 computations are now complete; I should really pass
+ the results to another function and do the Stage 2
+ computations, but I only need a few more values so I'll just
+ append the computations here for now */
+
+
+ /* 17. Find the number of pixels in the horizontal sync period:
+ *
+ * [H SYNC (PIXELS)] =(ROUND(([H SYNC%] / 100 * [TOTAL PIXELS] /
+ * [CELL GRAN RND]),0))*[CELL GRAN RND]
+ */
+
+ h_sync = rint(H_SYNC_PERCENT/100.0 * total_pixels / CELL_GRAN) * CELL_GRAN;
+
+ /* 18. Find the number of pixels in the horizontal front porch period:
+ *
+ * [H FRONT PORCH (PIXELS)] = ([H BLANK (PIXELS)]/2)-[H SYNC (PIXELS)]
+ */
+
+ h_front_porch = (h_blank / 2.0) - h_sync;
+
+ /* 36. Find the number of lines in the odd front porch period:
+ *
+ * [V ODD FRONT PORCH(LINES)]=([MIN PORCH RND]+[INTERLACE])
+ */
+
+ v_odd_front_porch_lines = MIN_PORCH + interlace;
+
+ /* finally, pack the results in the mode struct */
+
+ mode->HDisplay = (int) (h_pixels_rnd);
+ mode->HSyncStart = (int) (h_pixels_rnd + h_front_porch);
+ mode->HSyncEnd = (int) (h_pixels_rnd + h_front_porch + h_sync);
+ mode->HTotal = (int) (total_pixels);
+ mode->VDisplay = (int) (v_lines_rnd);
+ mode->VSyncStart = (int) (v_lines_rnd + v_odd_front_porch_lines);
+ mode->VSyncEnd = (int) (v_lines_rnd + v_odd_front_porch_lines + V_SYNC_RQD);
+ mode->VTotal = (int) (total_v_lines);
+
+ mode->Clock = (int) (pixel_freq * 1000.0);
+ mode->HSync = h_freq;
+ mode->VRefresh = freq;
+
+ xf86SetModeDefaultName(mode);
+
+ mode->Flags = V_NHSYNC | V_PVSYNC;
+ if (interlaced) {
+ mode->VTotal *= 2;
+ mode->Flags |= V_INTERLACE;
+ }
+
+ return mode;
+}
diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index 0dcff6631..1ebac678d 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -212,6 +212,11 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
pVidMem->mapMem = mapVidMem;
pVidMem->unmapMem = unmapVidMem;
+#if HAVE_PCI_SYSTEM_INIT_DEV_MEM
+ if (useDevMem)
+ pci_system_init_dev_mem(devMemFd);
+#endif
+
#ifdef HAS_MTRR_SUPPORT
if (useDevMem) {
if (cleanMTRR()) {
diff --git a/hw/xfree86/os-support/bus/Makefile.am b/hw/xfree86/os-support/bus/Makefile.am
index 381b9923c..5a15430c1 100644
--- a/hw/xfree86/os-support/bus/Makefile.am
+++ b/hw/xfree86/os-support/bus/Makefile.am
@@ -27,18 +27,6 @@ if LINUX_ALPHA
PCI_SOURCES += axpPci.c
endif
-if LINUX_IA64
-PLATFORM_PCI_SOURCES = \
- 460gxPCI.c \
- 460gxPCI.h \
- altixPCI.c \
- altixPCI.h \
- e8870PCI.c \
- e8870PCI.h \
- zx1PCI.c \
- zx1PCI.h
-endif
-
if XORG_BUS_SPARC
PLATFORM_SOURCES = Sbus.c
sdk_HEADERS += xf86Sbus.h
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index 0abb34f98..ebac0905b 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -207,9 +207,8 @@
# endif
#elif defined(__ia64__)
# if defined(linux)
-# define ARCH_PCI_INIT ia64linuxPciInit
+# define ARCH_PCI_INIT linuxPciInit
# endif
-# define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper
#elif defined(__i386__) || defined(__i386)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
diff --git a/hw/xfree86/os-support/bus/bsd_pci.c b/hw/xfree86/os-support/bus/bsd_pci.c
index bceb1087f..57ad09b6a 100644
--- a/hw/xfree86/os-support/bus/bsd_pci.c
+++ b/hw/xfree86/os-support/bus/bsd_pci.c
@@ -81,4 +81,6 @@ bsdPciInit(void)
{
pciNumBuses = 1;
pciBusInfo[0] = &bsd_pci;
+
+ xf86InitVidMem();
}
diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index 5a52ffdd4..beaae3d5b 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -1,7 +1,7 @@
noinst_LTLIBRARIES = liblinux.la
if LINUX_IA64
-PLATFORM_PCI_SUPPORT = $(srcdir)/lnx_ia64.c $(srcdir)/../shared/ia64Pci.c
+PLATFORM_PCI_SUPPORT = $(srcdir)/../shared/ia64Pci.c
PLATFORM_DEFINES = -DOS_PROBE_PCI_CHIPSET=lnxProbePciChipset
PLATFORM_INCLUDES = -I$(srcdir)/../shared
endif
diff --git a/hw/xfree86/os-support/shared/ia64Pci.c b/hw/xfree86/os-support/shared/ia64Pci.c
index 45522e933..6f6924b59 100644
--- a/hw/xfree86/os-support/shared/ia64Pci.c
+++ b/hw/xfree86/os-support/shared/ia64Pci.c
@@ -42,12 +42,7 @@
#include <linux/pci.h>
#include "compiler.h"
-#include "460gxPCI.h"
-#include "e8870PCI.h"
-#include "zx1PCI.h"
-#include "altixPCI.h"
#include "Pci.h"
-#include "ia64Pci.h"
/*
* We use special in/out routines here since Altix platforms require the
@@ -191,53 +186,3 @@ _X_EXPORT unsigned int inl(unsigned long port)
return val;
}
-void
-ia64ScanPCIWrapper(scanpciWrapperOpt flags)
-{
- static IA64Chipset chipset = NONE_CHIPSET;
-
- if (flags == SCANPCI_INIT) {
-
- /* PCI configuration space probes should be done first */
- if (xorgProbe460GX(flags)) {
- chipset = I460GX_CHIPSET;
- xf86PreScan460GX();
- return;
- } else if (xorgProbeE8870(flags)) {
- chipset = E8870_CHIPSET;
- xf86PreScanE8870();
- return;
- }
-#ifdef OS_PROBE_PCI_CHIPSET
- chipset = OS_PROBE_PCI_CHIPSET(flags);
- switch (chipset) {
- case ZX1_CHIPSET:
- xf86PreScanZX1();
- return;
- case ALTIX_CHIPSET:
- xf86PreScanAltix();
- return;
- default:
- return;
- }
-#endif
- } else /* if (flags == SCANPCI_TERM) */ {
-
- switch (chipset) {
- case I460GX_CHIPSET:
- xf86PostScan460GX();
- return;
- case E8870_CHIPSET:
- xf86PostScanE8870();
- return;
- case ZX1_CHIPSET:
- xf86PostScanZX1();
- return;
- case ALTIX_CHIPSET:
- xf86PostScanAltix();
- return;
- default:
- return;
- }
- }
-}
diff --git a/hw/xfree86/parser/Configint.h b/hw/xfree86/parser/Configint.h
index 4d5fbcfab..684a001fc 100644
--- a/hw/xfree86/parser/Configint.h
+++ b/hw/xfree86/parser/Configint.h
@@ -71,11 +71,14 @@
#include <stddef.h>
#include "xf86Parser.h"
+typedef enum { PARSE_DECIMAL, PARSE_OCTAL, PARSE_HEX } ParserNumType;
+
typedef struct
{
int num; /* returned number */
char *str; /* private copy of the return-string */
double realnum; /* returned number as a real */
+ ParserNumType numType; /* used to enforce correct number formatting */
}
LexRec, *LexPtr;
@@ -211,6 +214,8 @@ else\
"\ta numerical group id."
#define MULTIPLE_MSG \
"Multiple \"%s\" lines."
+#define MUST_BE_OCTAL_MSG \
+"The number \"%d\" given in this section must be in octal (0xxx) format."
/* Warning messages */
#define OBSOLETE_MSG \
diff --git a/hw/xfree86/parser/DRI.c b/hw/xfree86/parser/DRI.c
index 18644bcc7..68a6db90b 100644
--- a/hw/xfree86/parser/DRI.c
+++ b/hw/xfree86/parser/DRI.c
@@ -117,6 +117,8 @@ xf86parseDRISection (void)
case MODE:
if (xf86getSubToken (&(ptr->dri_comment)) != NUMBER)
Error (NUMBER_MSG, "Mode");
+ if (val.numType != PARSE_OCTAL)
+ Error (MUST_BE_OCTAL_MSG, val.num);
ptr->dri_mode = val.num;
break;
case BUFFERS:
diff --git a/hw/xfree86/parser/Screen.c b/hw/xfree86/parser/Screen.c
index ad08c1382..dfc02bb72 100644
--- a/hw/xfree86/parser/Screen.c
+++ b/hw/xfree86/parser/Screen.c
@@ -508,7 +508,6 @@ xf86validateScreen (XF86ConfigPtr p)
{
XF86ConfScreenPtr screen = p->conf_screen_lst;
XF86ConfMonitorPtr monitor;
- XF86ConfDevicePtr device;
XF86ConfAdaptorLinkPtr adaptor;
while (screen)
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 9706d483b..851b91161 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -380,11 +380,20 @@ again:
if (c == '0')
if ((configBuf[configPos] == 'x') ||
(configBuf[configPos] == 'X'))
+ {
base = 16;
+ val.numType = PARSE_HEX;
+ }
else
+ {
base = 8;
+ val.numType = PARSE_OCTAL;
+ }
else
+ {
base = 10;
+ val.numType = PARSE_DECIMAL;
+ }
configRBuf[0] = c;
i = 1;
@@ -612,7 +621,7 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot,
{
char *result;
int i, l;
- static const char *env = NULL, *home = NULL;
+ static const char *env = NULL;
static char *hostname = NULL;
static char majorvers[3] = "";
diff --git a/hw/xfree86/utils/cvt/Makefile.am b/hw/xfree86/utils/cvt/Makefile.am
index 365c6cb88..4db175fbd 100644
--- a/hw/xfree86/utils/cvt/Makefile.am
+++ b/hw/xfree86/utils/cvt/Makefile.am
@@ -28,11 +28,13 @@
bin_PROGRAMS = cvt
-INCLUDES = $(XORG_INCS)
+INCLUDES = $(XORG_INCS) \
+ -I$(top_srcdir)/hw/xfree86/ddc \
+ -I$(top_srcdir)/hw/xfree86/parser
DUMMYLIB_SRCDIR = $(XFREE86_SRCDIR)/dummylib
# gah
-cvt_SOURCES = cvt.c $(top_srcdir)/hw/xfree86/common/xf86cvt.c
+cvt_SOURCES = cvt.c $(top_srcdir)/hw/xfree86/modes/xf86cvt.c
cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
cvt_LDADD = $(top_builddir)/hw/xfree86/dummylib/libdummy-nonserver.a
diff --git a/hw/xfree86/utils/ioport/Makefile.am b/hw/xfree86/utils/ioport/Makefile.am
index 1839c9a60..12f861372 100644
--- a/hw/xfree86/utils/ioport/Makefile.am
+++ b/hw/xfree86/utils/ioport/Makefile.am
@@ -37,7 +37,7 @@ ioport_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
ioport_LDADD = \
../../os-support/libxorgos.la \
../../dummylib/libdummy-nonserver.a \
- ${SYS_LIBS}
+ ${UTILS_SYS_LIBS} ${PCIACCESS_LIBS}
ioport_SOURCES = \
diff --git a/hw/xfree86/vbe/vbeModes.c b/hw/xfree86/vbe/vbeModes.c
index 061d7b695..fb730a708 100644
--- a/hw/xfree86/vbe/vbeModes.c
+++ b/hw/xfree86/vbe/vbeModes.c
@@ -127,10 +127,9 @@ CheckMode(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe, int id,
{
CARD16 major;
VbeModeInfoBlock *mode;
- DisplayModePtr pMode, p;
+ DisplayModePtr pMode;
VbeModeInfoData *data;
Bool modeOK = FALSE;
- ModeStatus status = MODE_OK;
major = (unsigned)(vbe->VESAVersion >> 8);
diff --git a/hw/xfree86/x86emu/Makefile.am b/hw/xfree86/x86emu/Makefile.am
index 9f9c87f4f..acd249c7f 100644
--- a/hw/xfree86/x86emu/Makefile.am
+++ b/hw/xfree86/x86emu/Makefile.am
@@ -21,6 +21,7 @@ EXTRA_DIST = validate.c \
x86emu/ops.h \
x86emu/prim_asm.h \
x86emu/prim_ops.h \
+ x86emu/prim_x86_gcc.h \
x86emu/regs.h \
x86emu/types.h \
x86emu/x86emui.h
diff --git a/hw/xfree86/xaa/xaaInitAccel.c b/hw/xfree86/xaa/xaaInitAccel.c
index 1b7c15487..53795f067 100644
--- a/hw/xfree86/xaa/xaaInitAccel.c
+++ b/hw/xfree86/xaa/xaaInitAccel.c
@@ -181,7 +181,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
if(infoRec->SetupForScreenToScreenCopy &&
infoRec->SubsequentScreenToScreenCopy &&
- !xf86IsOptionSet(options, XAAOPT_SCREEN_TO_SCREEN_COPY)) {
+ !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COPY, FALSE)) {
HaveScreenToScreenCopy = TRUE;
} else {
infoRec->ScreenToScreenCopyFlags = 0;
@@ -192,10 +192,10 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
/**** Solid Filled Rects ****/
if(infoRec->SetupForSolidFill && infoRec->SubsequentSolidFillRect &&
- !xf86IsOptionSet(options, XAAOPT_SOLID_FILL_RECT)) {
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_RECT, FALSE)) {
HaveSolidFillRect = TRUE;
if(infoRec->SubsequentSolidFillTrap &&
- !xf86IsOptionSet(options, XAAOPT_SOLID_FILL_TRAP))
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_TRAP, FALSE))
HaveSolidFillTrap = TRUE;
else
infoRec->SubsequentSolidFillTrap = NULL;
@@ -210,10 +210,11 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
if(infoRec->SetupForSolidLine) {
if(infoRec->SubsequentSolidTwoPointLine &&
- !xf86IsOptionSet(options, XAAOPT_SOLID_TWO_POINT_LINE))
+ !xf86ReturnOptValBool(options,
+ XAAOPT_SOLID_TWO_POINT_LINE, FALSE))
HaveSolidTwoPointLine = TRUE;
if(infoRec->SubsequentSolidBresenhamLine &&
- !xf86IsOptionSet(options, XAAOPT_SOLID_BRESENHAM_LINE)) {
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_BRESENHAM_LINE, FALSE)) {
HaveSolidBresenhamLine = TRUE;
if(infoRec->SolidBresenhamLineErrorTermBits)
@@ -222,7 +223,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
}
if(infoRec->SubsequentSolidHorVertLine &&
- !xf86IsOptionSet(options, XAAOPT_SOLID_HORVERT_LINE))
+ !xf86ReturnOptValBool(options,
+ XAAOPT_SOLID_HORVERT_LINE, FALSE))
HaveSolidHorVertLine = TRUE;
else if(HaveSolidTwoPointLine) {
infoRec->SubsequentSolidHorVertLine =
@@ -265,10 +267,14 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
if(infoRec->SetupForMono8x8PatternFill &&
infoRec->SubsequentMono8x8PatternFillRect &&
- !xf86IsOptionSet(options, XAAOPT_MONO_8x8_PATTERN_FILL_RECT)) {
+ !xf86ReturnOptValBool(options,
+ XAAOPT_MONO_8x8_PATTERN_FILL_RECT,
+ FALSE)) {
HaveMono8x8PatternFillRect = TRUE;
if(infoRec->SubsequentMono8x8PatternFillTrap &&
- !xf86IsOptionSet(options, XAAOPT_MONO_8x8_PATTERN_FILL_TRAP))
+ !xf86ReturnOptValBool(options,
+ XAAOPT_MONO_8x8_PATTERN_FILL_TRAP,
+ FALSE))
HaveMono8x8PatternFillTrap = TRUE;
if(infoRec->Mono8x8PatternFillFlags &
@@ -318,10 +324,12 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
if(infoRec->SetupForDashedLine && infoRec->DashPatternMaxLength) {
if(infoRec->SubsequentDashedTwoPointLine &&
- !xf86IsOptionSet(options, XAAOPT_DASHED_TWO_POINT_LINE))
+ !xf86ReturnOptValBool(options, XAAOPT_DASHED_TWO_POINT_LINE,
+ FALSE))
HaveDashedTwoPointLine = TRUE;
if(infoRec->SubsequentDashedBresenhamLine &&
- !xf86IsOptionSet(options, XAAOPT_DASHED_BRESENHAM_LINE)) {
+ !xf86ReturnOptValBool(options, XAAOPT_DASHED_BRESENHAM_LINE,
+ FALSE)) {
HaveDashedBresenhamLine = TRUE;
if(infoRec->DashedBresenhamLineErrorTermBits)
@@ -345,10 +353,11 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
if(infoRec->SetupForColor8x8PatternFill &&
infoRec->SubsequentColor8x8PatternFillRect &&
- !xf86IsOptionSet(options, XAAOPT_COL_8x8_PATTERN_FILL_RECT)) {
+ !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_RECT, FALSE)) {
HaveColor8x8PatternFillRect = TRUE;
if(infoRec->SubsequentColor8x8PatternFillTrap &&
- !xf86IsOptionSet(options, XAAOPT_COL_8x8_PATTERN_FILL_TRAP))
+ !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
+ FALSE))
HaveColor8x8PatternFillTrap = TRUE;
else
infoRec->SubsequentColor8x8PatternFillTrap = NULL;
@@ -381,7 +390,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
if(infoRec->SetupForCPUToScreenColorExpandFill &&
infoRec->ColorExpandBase &&
infoRec->SubsequentCPUToScreenColorExpandFill &&
- !xf86IsOptionSet(options, XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL)) {
+ !xf86ReturnOptValBool(options, XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
+ FALSE)) {
int dwordsNeeded = pScrn->virtualX;
infoRec->ColorExpandRange >>= 2; /* convert to DWORDS */
@@ -406,7 +416,9 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
infoRec->SubsequentColorExpandScanline &&
infoRec->ScanlineColorExpandBuffers &&
(infoRec->NumScanlineColorExpandBuffers > 0) &&
- !xf86IsOptionSet(options, XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL)) {
+ !xf86ReturnOptValBool(options,
+ XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
+ FALSE)) {
HaveScanlineColorExpansion = TRUE;
} else {
infoRec->ScanlineCPUToScreenColorExpandFillFlags = 0;
@@ -419,7 +431,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
if(infoRec->SetupForScreenToScreenColorExpandFill &&
infoRec->SubsequentScreenToScreenColorExpandFill &&
- !xf86IsOptionSet(options, XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL)) {
+ !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
+ FALSE)) {
HaveScreenToScreenColorExpandFill = TRUE;
if (!infoRec->CacheColorExpandDensity)
infoRec->CacheColorExpandDensity = 1;
@@ -433,7 +446,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
if(infoRec->SetupForImageWrite && infoRec->ImageWriteBase &&
infoRec->SubsequentImageWriteRect &&
- !xf86IsOptionSet(options, XAAOPT_IMAGE_WRITE_RECT)) {
+ !xf86ReturnOptValBool(options, XAAOPT_IMAGE_WRITE_RECT, FALSE)) {
infoRec->ImageWriteRange >>= 2; /* convert to DWORDS */
if(infoRec->ImageWriteFlags & CPU_TRANSFER_BASE_FIXED)
@@ -452,7 +465,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
infoRec->SubsequentImageWriteScanline &&
infoRec->ScanlineImageWriteBuffers &&
(infoRec->NumScanlineImageWriteBuffers > 0) &&
- !xf86IsOptionSet(options, XAAOPT_SCANLINE_IMAGE_WRITE_RECT)) {
+ !xf86ReturnOptValBool(options, XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
+ FALSE)) {
HaveScanlineImageWriteRect = TRUE;
} else {
infoRec->ScanlineImageWriteFlags = 0;
@@ -518,7 +532,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
#define XAAMSG(s) do { if (serverGeneration == 1) xf86ErrorF(s); } while (0)
if((infoRec->Flags & OFFSCREEN_PIXMAPS) && HaveScreenToScreenCopy &&
- !xf86IsOptionSet(options, XAAOPT_OFFSCREEN_PIXMAPS)) {
+ !xf86ReturnOptValBool(options, XAAOPT_OFFSCREEN_PIXMAPS,
+ FALSE)) {
XAAMSG("\tOffscreen Pixmaps\n");
} else {
infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
@@ -800,7 +815,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
/**** WriteBitmap ****/
if(infoRec->WriteBitmap &&
- !xf86IsOptionSet(options, XAAOPT_WRITE_BITMAP)) {
+ !xf86ReturnOptValBool(options, XAAOPT_WRITE_BITMAP, FALSE)) {
XAAMSG("\tDriver provided WriteBitmap replacement\n");
} else if(HaveColorExpansion) {
if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
@@ -959,7 +974,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
/**** WritePixmap ****/
if(infoRec->WritePixmap &&
- !xf86IsOptionSet(options, XAAOPT_WRITE_PIXMAP)) {
+ !xf86ReturnOptValBool(options, XAAOPT_WRITE_PIXMAP, FALSE)) {
XAAMSG("\tDriver provided WritePixmap replacement\n");
} else if(HaveImageWriteRect) {
infoRec->WritePixmap = XAAWritePixmap;
@@ -1433,7 +1448,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
else
infoRec->Flags &= ~PIXMAP_CACHE;
- if (xf86IsOptionSet(options, XAAOPT_PIXMAP_CACHE))
+ if (xf86ReturnOptValBool(options, XAAOPT_PIXMAP_CACHE, FALSE))
infoRec->Flags &= ~PIXMAP_CACHE;
if(infoRec->WriteMono8x8PatternToCache) {}
diff --git a/hw/xfree86/xf4bpp/ppcSpMcro.h b/hw/xfree86/xf4bpp/ppcSpMcro.h
index 2b7f951d4..655a883e5 100644
--- a/hw/xfree86/xf4bpp/ppcSpMcro.h
+++ b/hw/xfree86/xf4bpp/ppcSpMcro.h
@@ -28,11 +28,11 @@
#define SETSPANPTRS(IN,N,IPW,PW,IPPT,PPT,FPW,FPPT,FSORT) \
{ \
N = IN * miFindMaxBand(pGC->pCompositeClip); \
- if(!(PW = (int *)ALLOCATE_LOCAL(N * sizeof(int)))) \
+ if(!(PW = (int *)xalloc(N * sizeof(int)))) \
return; \
- if(!(PPT = (DDXPointRec *)ALLOCATE_LOCAL(N * sizeof(DDXPointRec)))) \
+ if(!(PPT = (DDXPointRec *)xalloc(N * sizeof(DDXPointRec)))) \
{ \
- DEALLOCATE_LOCAL(PW); \
+ free(PW); \
return; \
} \
FPW = PW; \
diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index abd6bcb73..02ff27bdf 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -89,7 +89,7 @@ xnestCollectExposures(void)
while (XCheckIfEvent(xnestDisplay, &X, xnestExposurePredicate, NULL)) {
pWin = xnestWindowPtr(X.xexpose.window);
- if (pWin) {
+ if (pWin && X.xexpose.width && X.xexpose.height) {
Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + X.xexpose.x;
Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + X.xexpose.y;
Box.x2 = Box.x1 + X.xexpose.width;
@@ -97,7 +97,7 @@ xnestCollectExposures(void)
REGION_INIT(pWin->drawable.pScreen, &Rgn, &Box, 1);
- miWindowExposures(pWin, &Rgn, NullRegion);
+ miSendExposures(pWin, &Rgn, Box.x2, Box.y2);
}
}
}
diff --git a/hw/xprint/pcl/PclMisc.c b/hw/xprint/pcl/PclMisc.c
index e0b7dced9..0b37836e9 100644
--- a/hw/xprint/pcl/PclMisc.c
+++ b/hw/xprint/pcl/PclMisc.c
@@ -115,7 +115,7 @@ GetPropString(
if(atom != BAD_RESOURCE)
{
WindowPtr pPropWin;
- int n;
+ int rc, n;
/*
* The atom has been defined, but it might only exist as a
@@ -124,15 +124,12 @@ GetPropString(
for(pPropWin = pWin; pPropWin != (WindowPtr)NULL;
pPropWin = pPropWin->parent)
{
- for(pProp = (PropertyPtr)(wUserProps(pPropWin));
- pProp != (PropertyPtr)NULL;
- pProp = pProp->next)
- {
- if (pProp->propertyName == atom)
- break;
- }
- if(pProp != (PropertyPtr)NULL)
- break;
+ rc = dixLookupProperty(&pProp, pPropWin, atom,
+ serverClient, DixReadAccess);
+ if (rc == Success)
+ break;
+ else
+ pProp = NULL;
}
if(pProp == (PropertyPtr)NULL)
return (char *)NULL;
diff --git a/hw/xprint/pcl/PclWindow.c b/hw/xprint/pcl/PclWindow.c
index a87dc0e7a..950933e49 100644
--- a/hw/xprint/pcl/PclWindow.c
+++ b/hw/xprint/pcl/PclWindow.c
@@ -128,9 +128,9 @@ PclCreateWindow(
{
propName = MakeAtom(propStrings[i], strlen(propStrings[i]),
TRUE);
- ChangeWindowProperty(pWin, propName, XA_STRING, 8,
- PropModeReplace, strlen(propVal),
- (pointer)propVal, FALSE);
+ dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING,
+ 8, PropModeReplace, strlen(propVal),
+ (pointer)propVal, FALSE);
xfree(propVal);
}
}
diff --git a/hw/xprint/ps/PsMisc.c b/hw/xprint/ps/PsMisc.c
index 0df039e0b..8d5005f91 100644
--- a/hw/xprint/ps/PsMisc.c
+++ b/hw/xprint/ps/PsMisc.c
@@ -175,7 +175,7 @@ GetPropString(
if(atom != BAD_RESOURCE)
{
WindowPtr pPropWin;
- int n;
+ int rc, n;
*/
/*
@@ -186,15 +186,12 @@ GetPropString(
for(pPropWin = pWin; pPropWin != (WindowPtr)NULL;
pPropWin = pPropWin->parent)
{
- for(pProp = (PropertyPtr)(wUserProps(pPropWin));
- pProp != (PropertyPtr)NULL;
- pProp = pProp->next)
- {
- if (pProp->propertyName == atom)
- break;
- }
- if(pProp != (PropertyPtr)NULL)
- break;
+ rc = dixLookupProperty(&pProp, pPropWin, atom,
+ serverClient, DixReadAccess);
+ if (rc == Success)
+ break;
+ else
+ pProp = NULL;
}
if(pProp == (PropertyPtr)NULL)
return (char *)NULL;
diff --git a/hw/xprint/ps/PsWindow.c b/hw/xprint/ps/PsWindow.c
index d17cf8ce0..8bfde4b0d 100644
--- a/hw/xprint/ps/PsWindow.c
+++ b/hw/xprint/ps/PsWindow.c
@@ -154,9 +154,9 @@ PsCreateWindow(WindowPtr pWin)
{
propName = MakeAtom(propStrings[i], strlen(propStrings[i]),
TRUE);
- ChangeWindowProperty(pWin, propName, XA_STRING, 8,
- PropModeReplace, strlen(propVal),
- (pointer)propVal, FALSE);
+ dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING,
+ 8, PropModeReplace, strlen(propVal),
+ (pointer)propVal, FALSE);
xfree(propVal);
}
}
diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 99d23eb1f..075382476 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -50,8 +50,6 @@ EXTRA_DIST = \
quartz.h \
quartzAudio.h \
quartzCommon.h \
- quartzCursor.c \
- quartzCursor.h \
quartzForeground.h \
quartzKeyboard.h \
quartzPasteboard.h
diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index 86da67f2e..ea9a6b758 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -98,6 +98,8 @@ extern int quartzHasRoot, quartzEnableRootless;
#define PREFS_XP_OPTIONS "xp_options"
#define PREFS_ENABLE_STEREO "enable_stereo"
#define PREFS_LOGIN_SHELL "login_shell"
-#define PREFS_QUARTZ_WM_CLICK_THROUGH "wm_click_through"
+#define PREFS_CLICK_THROUGH "wm_click_through"
+#define PREFS_FFM "wm_ffm"
+#define PREFS_FOCUS_ON_NEW_WINDOW "wm_focus_on_new_window"
#endif /* X11APPLICATION_H */
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index be5511d30..2844fca10 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -1,6 +1,6 @@
/* X11Application.m -- subclass of NSApplication to multiplex events
- Copyright (c) 2002-2007 Apple Inc.
+ Copyright (c) 2002-2008 Apple Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
@@ -61,7 +61,7 @@ int X11EnableKeyEquivalents = TRUE;
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
extern int darwinFakeButtons, input_check_flag;
-extern Bool enable_stereo;
+extern Bool enable_stereo;
extern xEvent *darwinEvents;
@@ -153,7 +153,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
tem = [infoDict objectForKey:@"CFBundleShortVersionString"];
- [dict setObject:[NSString stringWithFormat:@"XQuartz %@ - (xorg-server %s)", tem, XSERVER_VERSION]
+ [dict setObject:[NSString stringWithFormat:@"XQuartz %@ - (xorg-server %s)", tem, XSERVER_VERSION]
forKey:@"ApplicationVersion"];
[self orderFrontStandardAboutPanelWithOptions: dict];
@@ -166,173 +166,170 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
static TSMDocumentID x11_document;
DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active)
if (state) {
- QuartzMessageServerThread (kXDarwinActivate, 0);
-
- if (!_x_active) {
- if (x11_document == 0 && darwinKeymapFile == NULL) {
- OSType types[1];
- types[0] = kUnicodeDocument;
- NewTSMDocument (1, types, &x11_document, 0);
- }
-
- if (x11_document != 0) ActivateTSMDocument (x11_document);
- }
+ DarwinSendDDXEvent(kXquartzActivate, 0);
+
+ if (!_x_active) {
+ if (x11_document == 0 && darwinKeymapFile == NULL) {
+ OSType types[1];
+ types[0] = kUnicodeDocument;
+ NewTSMDocument (1, types, &x11_document, 0);
+ }
+
+ if (x11_document != 0) ActivateTSMDocument (x11_document);
+ }
} else {
- QuartzMessageServerThread (kXDarwinDeactivate, 0);
-
- if (_x_active && x11_document != 0)
- DeactivateTSMDocument (x11_document);
- }
-
- _x_active = state;
+ DarwinSendDDXEvent(kXquartzDeactivate, 0);
+
+ if (_x_active && x11_document != 0)
+ DeactivateTSMDocument (x11_document);
+ }
+
+ _x_active = state;
}
- (void) became_key:(NSWindow *)win {
- [self activateX:NO];
+ [self activateX:NO];
}
- (void) sendEvent:(NSEvent *)e {
- NSEventType type;
- BOOL for_appkit, for_x;
-
- type = [e type];
-
- /* By default pass down the responder chain and to X. */
- for_appkit = YES;
- for_x = YES;
-
- switch (type) {
- case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
- case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
- if ([e window] != nil) {
- /* Pointer event has an (AppKit) window. Probably something for the kit. */
- for_x = NO;
- if (_x_active) [self activateX:NO];
- } else if ([self modalWindow] == nil) {
- /* Must be an X window. Tell appkit it doesn't have focus. */
- WindowPtr pWin = xprGetXWindowFromAppKit([e windowNumber]);
- if (pWin) RootlessReorderWindow(pWin);
- for_appkit = NO;
-
- if ([self isActive]) {
- [self deactivate];
-
- if (!_x_active && quartzProcs->IsX11Window([e window],
- [e windowNumber]))
- [self activateX:YES];
- }
- }
- break;
-
- case NSKeyDown: case NSKeyUp:
- if (_x_active) {
- static int swallow_up;
-
- /* No kit window is focused, so send it to X. */
- for_appkit = NO;
- if (type == NSKeyDown) {
- /* Before that though, see if there are any global
- shortcuts bound to it. */
-
- if (X11EnableKeyEquivalents
- && [[self mainMenu] performKeyEquivalent:e]) {
- swallow_up = [e keyCode];
- for_x = NO;
- } else if (!quartzEnableRootless
- && ([e modifierFlags] & ALL_KEY_MASKS)
- == (NSCommandKeyMask | NSAlternateKeyMask)
- && ([e keyCode] == 0 /*a*/
- || [e keyCode] == 53 /*Esc*/)) {
- swallow_up = 0;
- for_x = NO;
+ NSEventType type;
+ BOOL for_appkit, for_x;
+
+ type = [e type];
+
+ /* By default pass down the responder chain and to X. */
+ for_appkit = YES;
+ for_x = YES;
+
+ switch (type) {
+ case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
+ case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
+ if ([e window] != nil) {
+ /* Pointer event has an (AppKit) window. Probably something for the kit. */
+ for_x = NO;
+ if (_x_active) [self activateX:NO];
+ } else if ([self modalWindow] == nil) {
+ /* Must be an X window. Tell appkit it doesn't have focus. */
+ WindowPtr pWin = xprGetXWindowFromAppKit([e windowNumber]);
+ if (pWin) RootlessReorderWindow(pWin);
+ for_appkit = NO;
+
+ if ([self isActive]) {
+ [self deactivate];
+ if (!_x_active && quartzProcs->IsX11Window([e window],
+ [e windowNumber]))
+ [self activateX:YES];
+ }
+ }
+ break;
+
+ case NSKeyDown: case NSKeyUp:
+ if (_x_active) {
+ static int swallow_up;
+
+ /* No kit window is focused, so send it to X. */
+ for_appkit = NO;
+ if (type == NSKeyDown) {
+ /* Before that though, see if there are any global
+ shortcuts bound to it. */
+
+ if (X11EnableKeyEquivalents
+ && [[self mainMenu] performKeyEquivalent:e]) {
+ swallow_up = [e keyCode];
+ for_x = NO;
+ } else if (!quartzEnableRootless
+ && ([e modifierFlags] & ALL_KEY_MASKS)
+ == (NSCommandKeyMask | NSAlternateKeyMask)
+ && ([e keyCode] == 0 /*a*/
+ || [e keyCode] == 53 /*Esc*/)) {
+ swallow_up = 0;
+ for_x = NO;
#ifdef DARWIN_DDX_MISSING
- QuartzMessageServerThread (kXDarwinToggleFullscreen, 0);
+ DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
#endif
+ }
+ } else {
+ /* If we saw a key equivalent on the down, don't pass
+ the up through to X. */
+
+ if (swallow_up != 0 && [e keyCode] == swallow_up) {
+ swallow_up = 0;
+ for_x = NO;
+ }
+ }
+ } else for_x = NO;
+ break;
+
+ case NSFlagsChanged:
+ /* For the l33t X users who remap modifier keys to normal keysyms. */
+ if (!_x_active) for_x = NO;
+ break;
+
+ case NSAppKitDefined:
+ switch ([e subtype]) {
+ case NSApplicationActivatedEventType:
+ for_x = NO;
+ if ([self modalWindow] == nil) {
+ for_appkit = NO;
+
+ /* FIXME: hack to avoid having to pass the event to appkit,
+ which would cause it to raise one of its windows. */
+ _appFlags._active = YES;
+
+ [self activateX:YES];
+ if ([e data2] & 0x10) X11ApplicationSetFrontProcess();
+ }
+ break;
+
+ case 18: /* ApplicationDidReactivate */
+ if (quartzHasRoot) for_appkit = NO;
+ break;
+
+ case NSApplicationDeactivatedEventType:
+ for_x = NO;
+ [self activateX:NO];
+ break;
+ }
+ break;
+
+ default: break; /* for gcc */
}
- } else {
- /* If we saw a key equivalent on the down, don't pass
- the up through to X. */
-
- if (swallow_up != 0 && [e keyCode] == swallow_up) {
- swallow_up = 0;
- for_x = NO;
- }
- }
- } else for_x = NO;
- break;
-
- case NSFlagsChanged:
- /* For the l33t X users who remap modifier keys to normal keysyms. */
- if (!_x_active) for_x = NO;
- break;
-
- case NSAppKitDefined:
- switch ([e subtype]) {
- case NSApplicationActivatedEventType:
- for_x = NO;
- if ([self modalWindow] == nil) {
- for_appkit = NO;
-
- /* FIXME: hack to avoid having to pass the event to appkit,
- which would cause it to raise one of its windows. */
- _appFlags._active = YES;
-
- [self activateX:YES];
- if ([e data2] & 0x10) X11ApplicationSetFrontProcess();
- }
- break;
-
- case 18: /* ApplicationDidReactivate */
- if (quartzHasRoot) for_appkit = NO;
- break;
-
- case NSApplicationDeactivatedEventType:
- for_x = NO;
- [self activateX:NO];
- break;
- }
- break;
-
- default: break; /* for gcc */
- }
-
- if (for_appkit) [super sendEvent:e];
-
- if (for_x) send_nsevent (type, e);
+
+ if (for_appkit) [super sendEvent:e];
+
+ if (for_x) send_nsevent (type, e);
}
- (void) set_window_menu:(NSArray *)list {
- [_controller set_window_menu:list];
+ [_controller set_window_menu:list];
}
- (void) set_window_menu_check:(NSNumber *)n {
- [_controller set_window_menu_check:n];
+ [_controller set_window_menu_check:n];
}
- (void) set_apps_menu:(NSArray *)list {
- [_controller set_apps_menu:list];
+ [_controller set_apps_menu:list];
}
- (void) set_front_process:unused {
- /* Hackery needed due to argv[0] hackery */
- // [self activateX:YES];
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- SetFrontProcess(&psn);
+ [NSApp activateIgnoringOtherApps:YES];
- QuartzMessageServerThread(kXDarwinBringAllToFront, 0);
+ if ([self modalWindow] == nil)
+ [self activateX:YES];
}
- (void) set_can_quit:(NSNumber *)state {
- [_controller set_can_quit:[state boolValue]];
+ [_controller set_can_quit:[state boolValue]];
}
- (void) server_ready:unused {
- [_controller server_ready];
+ [_controller server_ready];
}
- (void) show_hide_menubar:(NSNumber *)state {
- if ([state boolValue]) ShowMenuBar ();
- else HideMenuBar ();
+ if ([state boolValue]) ShowMenuBar ();
+ else HideMenuBar ();
}
@@ -350,57 +347,57 @@ static void cfrelease (CFAllocatorRef a, const void *b) {
}
static CFMutableArrayRef nsarray_to_cfarray (NSArray *in) {
- CFMutableArrayRef out;
- CFArrayCallBacks cb;
- NSObject *ns;
- const CFTypeRef *cf;
- int i, count;
-
- memset (&cb, 0, sizeof (cb));
- cb.version = 0;
- cb.retain = cfretain;
- cb.release = cfrelease;
-
- count = [in count];
- out = CFArrayCreateMutable (NULL, count, &cb);
-
- for (i = 0; i < count; i++) {
- ns = [in objectAtIndex:i];
-
- if ([ns isKindOfClass:[NSArray class]])
- cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns);
- else
- cf = CFRetain ((CFTypeRef) ns);
-
- CFArrayAppendValue (out, cf);
- CFRelease (cf);
- }
-
- return out;
+ CFMutableArrayRef out;
+ CFArrayCallBacks cb;
+ NSObject *ns;
+ const CFTypeRef *cf;
+ int i, count;
+
+ memset (&cb, 0, sizeof (cb));
+ cb.version = 0;
+ cb.retain = cfretain;
+ cb.release = cfrelease;
+
+ count = [in count];
+ out = CFArrayCreateMutable (NULL, count, &cb);
+
+ for (i = 0; i < count; i++) {
+ ns = [in objectAtIndex:i];
+
+ if ([ns isKindOfClass:[NSArray class]])
+ cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns);
+ else
+ cf = CFRetain ((CFTypeRef) ns);
+
+ CFArrayAppendValue (out, cf);
+ CFRelease (cf);
+ }
+
+ return out;
}
static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
- NSMutableArray *out;
- const CFTypeRef *cf;
- NSObject *ns;
- int i, count;
-
- count = CFArrayGetCount (in);
- out = [[NSMutableArray alloc] initWithCapacity:count];
-
- for (i = 0; i < count; i++) {
- cf = CFArrayGetValueAtIndex (in, i);
-
- if (CFGetTypeID (cf) == CFArrayGetTypeID ())
- ns = cfarray_to_nsarray ((CFArrayRef) cf);
- else
- ns = [(id)cf retain];
-
- [out addObject:ns];
- [ns release];
- }
-
- return out;
+ NSMutableArray *out;
+ const CFTypeRef *cf;
+ NSObject *ns;
+ int i, count;
+
+ count = CFArrayGetCount (in);
+ out = [[NSMutableArray alloc] initWithCapacity:count];
+
+ for (i = 0; i < count; i++) {
+ cf = CFArrayGetValueAtIndex (in, i);
+
+ if (CFGetTypeID (cf) == CFArrayGetTypeID ())
+ ns = cfarray_to_nsarray ((CFArrayRef) cf);
+ else
+ ns = [(id)cf retain];
+
+ [out addObject:ns];
+ [ns release];
+ }
+
+ return out;
}
- (CFPropertyListRef) prefs_get:(NSString *)key {
@@ -503,7 +500,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
if (value != NULL
&& CFGetTypeID (value) == CFNumberGetTypeID ()
- && CFNumberIsFloatType (value))
+ && CFNumberIsFloatType (value))
CFNumberGetValue (value, kCFNumberFloatType, &ret);
else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ())
ret = CFStringGetDoubleValue (value);
@@ -610,8 +607,10 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
quartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP
default:quartzUseSysBeep];
- quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS
- default:quartzEnableRootless];
+
+ // TODO: Add fullscreen support
+ //quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS
+ // default:quartzEnableRootless];
#ifdef DARWIN_DDX_MISSING
quartzFullscreenDisableHotkeys = ![self prefs_get_boolean:
@PREFS_FULLSCREEN_HOTKEYS default:
@@ -643,6 +642,10 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH
default:darwinDesiredDepth];
+
+ // TODO: Add 256 color support
+ if(darwinDesiredDepth == 8)
+ darwinDesiredDepth = -1;
enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO
default:false];
@@ -650,7 +653,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
/* This will end up at the end of the responder chain. */
- (void) copy:sender {
- QuartzMessageServerThread (kXDarwinPasteboardNotify, 1,
+ DarwinSendDDXEvent(kXquartzPasteboardNotify, 1,
AppleWMCopyToPasteboard);
}
@@ -851,72 +854,68 @@ convert_flags (unsigned int nsflags) {
return xflags;
}
-
-// This code should probably be merged with that in XDarwin's XServer.m - BB
static void send_nsevent (NSEventType type, NSEvent *e) {
- // static unsigned int button_state = 0;
- NSRect screen;
- NSPoint location;
- NSWindow *window;
- int pointer_x, pointer_y, ev_button, ev_type;
- // int num_events=0, i=0, state;
- // xEvent xe;
-
- /* convert location to global top-left coordinates */
- location = [e locationInWindow];
- window = [e window];
- screen = [[[NSScreen screens] objectAtIndex:0] frame];
-
+ NSRect screen;
+ NSPoint location;
+ NSWindow *window;
+ int pointer_x, pointer_y, ev_button, ev_type;
+ float pressure, tilt_x, tilt_y;
+
+ /* convert location to global top-left coordinates */
+ location = [e locationInWindow];
+ window = [e window];
+ screen = [[[NSScreen screens] objectAtIndex:0] frame];
+
if (window != nil) {
- NSRect frame = [window frame];
- pointer_x = location.x + frame.origin.x;
- pointer_y = (((screen.origin.y + screen.size.height)
- - location.y) - frame.origin.y);
- } else {
- pointer_x = location.x;
- pointer_y = (screen.origin.y + screen.size.height) - location.y;
- }
-
- pointer_y -= aquaMenuBarHeight;
- // state = convert_flags ([e modifierFlags]);
-
- switch (type) {
- case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse;
- case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse;
- case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse;
- case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse;
- case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse;
- case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse;
- case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse;
- case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse;
- case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse;
- case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
- handle_mouse:
-
- /* I'm not sure the below code is necessary or useful (-bb)
- if(ev_type==ButtonPress) {
- if (!quartzProcs->IsX11Window([e window], [e windowNumber])) {
- fprintf(stderr, "Dropping event because it's not a window\n");
- break;
+ NSRect frame = [window frame];
+ pointer_x = location.x + frame.origin.x;
+ pointer_y = (((screen.origin.y + screen.size.height)
+ - location.y) - frame.origin.y);
+ } else {
+ pointer_x = location.x;
+ pointer_y = (screen.origin.y + screen.size.height) - location.y;
}
- button_state |= (1 << ev_button);
- DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y);
- } else if (ev_type==ButtonRelease && (button_state & (1 << ev_button)) == 0) break;
- */
- DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y);
- break;
- case NSScrollWheel:
- DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y);
- break;
-
- case NSKeyDown: // do we need to translate these keyCodes?
- case NSKeyUp:
- DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
- break;
-
- case NSFlagsChanged:
- DarwinUpdateModKeys([e modifierFlags]);
- break;
- default: break; /* for gcc */
- }
+
+ pointer_y -= aquaMenuBarHeight;
+
+ pressure = 0; // for tablets
+ tilt_x = 0;
+ tilt_y = 0;
+
+ switch (type) {
+ case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse;
+ case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse;
+ case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse;
+ case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse;
+ case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse;
+ case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse;
+ case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse;
+ case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse;
+ case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse;
+ case NSTabletPoint:
+ pressure = [e pressure];
+ tilt_x = [e tilt].x;
+ tilt_y = [e tilt].y; // fall through
+ case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
+ handle_mouse:
+
+// if ([e subtype] == NSTabletPointEventSubtype) pressure = [e pressure];
+ DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y,
+ pressure, tilt_x, tilt_y);
+ break;
+
+ case NSScrollWheel:
+ DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y,
+ pressure, tilt_x, tilt_y);
+ break;
+
+ case NSKeyDown: case NSKeyUp:
+ DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
+ break;
+
+ case NSFlagsChanged:
+ DarwinUpdateModKeys([e modifierFlags]);
+ break;
+ default: break; /* for gcc */
+ }
}
diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index 64d5cd1ce..8d6a38ff0 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -45,6 +45,8 @@
IBOutlet NSButton *enable_keyequivs;
IBOutlet NSButton *sync_keymap;
IBOutlet NSButton *click_through;
+ IBOutlet NSButton *focus_follows_mouse;
+ IBOutlet NSButton *focus_on_new_window;
IBOutlet NSButton *enable_auth;
IBOutlet NSButton *enable_tcp;
IBOutlet NSPopUpButton *depth;
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index 5111eafc3..5bf4f4d52 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -1,6 +1,6 @@
/* X11Controller.m -- connect the IB ui, also the NSApp delegate
- Copyright (c) 2002-2007 Apple Inc. All rights reserved.
+ Copyright (c) 2002-2008 Apple Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
@@ -103,7 +103,7 @@
{
[NSApp activateIgnoringOtherApps:YES];
- QuartzMessageServerThread (kXDarwinControllerNotify, 2,
+ DarwinSendDDXEvent(kXquartzControllerNotify, 2,
AppleWMWindowMenuItem, [sender tag]);
}
@@ -254,7 +254,7 @@
[self remove_window_menu];
[self install_window_menu:list];
- QuartzMessageServerThread (kXDarwinControllerNotify, 1,
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1,
AppleWMWindowMenuNotify);
}
@@ -539,20 +539,20 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (void) hide_window:sender
{
if ([X11App x_active])
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideWindow);
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideWindow);
else
NSBeep (); /* FIXME: something here */
}
- (IBAction)bring_to_front:sender
{
- QuartzMessageServerThread(kXDarwinControllerNotify, 1, AppleWMBringAllToFront);
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMBringAllToFront);
}
- (IBAction)close_window:sender
{
if ([X11App x_active])
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMCloseWindow);
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMCloseWindow);
else
[[NSApp keyWindow] performClose:sender];
}
@@ -560,7 +560,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (IBAction)minimize_window:sender
{
if ([X11App x_active])
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMMinimizeWindow);
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMMinimizeWindow);
else
[[NSApp keyWindow] performMiniaturize:sender];
}
@@ -568,19 +568,19 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (IBAction)zoom_window:sender
{
if ([X11App x_active])
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMZoomWindow);
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMZoomWindow);
else
[[NSApp keyWindow] performZoom:sender];
}
- (IBAction) next_window:sender
{
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMNextWindow);
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMNextWindow);
}
- (IBAction) previous_window:sender
{
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMPreviousWindow);
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMPreviousWindow);
}
- (IBAction) enable_fullscreen_changed:sender
@@ -588,7 +588,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
int value = ![enable_fullscreen intValue];
#ifdef DARWIN_DDX_MISSING
- QuartzMessageServerThread (kXDarwinSetRootless, 1, value);
+ DarwinSendDDXEvent(kXquartzSetRootless, 1, value);
#endif
[NSApp prefs_set_boolean:@PREFS_ROOTLESS value:value];
@@ -598,7 +598,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (IBAction) toggle_fullscreen:sender
{
#ifdef DARWIN_DDX_MISSING
- QuartzMessageServerThread (kXDarwinToggleFullscreen, 0);
+ DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
#endif
}
@@ -609,47 +609,59 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (IBAction)prefs_changed:sender
{
- darwinFakeButtons = [fake_buttons intValue];
- quartzUseSysBeep = [use_sysbeep intValue];
- X11EnableKeyEquivalents = [enable_keyequivs intValue];
- darwinSyncKeymap = [sync_keymap intValue];
-
- /* after adding prefs here, also add to [X11Application read_defaults]
+ darwinFakeButtons = [fake_buttons intValue];
+ quartzUseSysBeep = [use_sysbeep intValue];
+ X11EnableKeyEquivalents = [enable_keyequivs intValue];
+ darwinSyncKeymap = [sync_keymap intValue];
+
+ /* after adding prefs here, also add to [X11Application read_defaults]
and below */
- [NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons];
- [NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep];
- [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents];
- [NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap];
- [NSApp prefs_set_boolean:@PREFS_QUARTZ_WM_CLICK_THROUGH value:[click_through intValue]];
- [NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]];
- [NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]];
- [NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]];
+ [NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons];
+ [NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep];
+ [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents];
+ [NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap];
+ [NSApp prefs_set_boolean:@PREFS_CLICK_THROUGH value:[click_through intValue]];
+ [NSApp prefs_set_boolean:@PREFS_FFM value:[focus_follows_mouse intValue]];
+ [NSApp prefs_set_boolean:@PREFS_FOCUS_ON_NEW_WINDOW value:[focus_on_new_window intValue]];
+ [NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]];
+ [NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]];
+ [NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]];
+
+ system("killall -HUP quartz-wm");
- [NSApp prefs_synchronize];
+ [NSApp prefs_synchronize];
}
- (IBAction) prefs_show:sender
{
- [fake_buttons setIntValue:darwinFakeButtons];
- [use_sysbeep setIntValue:quartzUseSysBeep];
- [enable_keyequivs setIntValue:X11EnableKeyEquivalents];
- [sync_keymap setIntValue:darwinSyncKeymap];
- [sync_keymap setEnabled:darwinKeymapFile == NULL];
- [click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_QUARTZ_WM_CLICK_THROUGH default:NO]];
-
- [enable_auth setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_AUTH default:NO]];
- [enable_tcp setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_TCP default:NO]];
- [depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]];
+ [fake_buttons setIntValue:darwinFakeButtons];
+ [use_sysbeep setIntValue:quartzUseSysBeep];
+ [enable_keyequivs setIntValue:X11EnableKeyEquivalents];
+ [sync_keymap setIntValue:darwinSyncKeymap];
+ [sync_keymap setEnabled:darwinKeymapFile == NULL];
+ [click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_CLICK_THROUGH default:NO]];
+ [focus_follows_mouse setIntValue:[NSApp prefs_get_boolean:@PREFS_FFM default:NO]];
+ [focus_on_new_window setIntValue:[NSApp prefs_get_boolean:@PREFS_FOCUS_ON_NEW_WINDOW default:YES]];
+
+ [enable_auth setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_AUTH default:NO]];
+ [enable_tcp setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_TCP default:NO]];
+
+ [depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]];
+ // TODO: Add 256 color support
+ if([depth indexOfItemWithTag:8] != -1)
+ [depth removeItemAtIndex:[depth indexOfItemWithTag:8]];
- [enable_fullscreen setIntValue:!quartzEnableRootless];
+ [enable_fullscreen setIntValue:!quartzEnableRootless];
+ // TODO: Add fullscreen support
+ [enable_fullscreen setEnabled:NO];
- [prefs_panel makeKeyAndOrderFront:sender];
+ [prefs_panel makeKeyAndOrderFront:sender];
}
- (IBAction) quit:sender
{
- QuartzMessageServerThread (kXDarwinQuit, 0);
+ DarwinSendDDXEvent(kXquartzQuit, 0);
}
- (IBAction) x11_help:sender
@@ -672,12 +684,12 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (void) applicationDidHide:(NSNotification *)notify
{
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideAll);
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideAll);
}
- (void) applicationDidUnhide:(NSNotification *)notify
{
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMShowAll);
+ DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMShowAll);
}
- (NSApplicationTerminateReply) applicationShouldTerminate:sender
@@ -705,7 +717,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
[X11App prefs_synchronize];
/* shutdown the X server, it will exit () for us. */
- QuartzMessageServerThread (kXDarwinQuit, 0);
+ DarwinSendDDXEvent(kXquartzQuit, 0);
/* In case it doesn't, exit anyway after a while. */
while (sleep (10) != 0) ;
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index c460ec6ae..072e57ff4 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -154,8 +154,8 @@ AppleWMSetScreenOrigin(
data[1] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].y
+ darwinMainScreenY);
- ChangeWindowProperty(pWin, xa_native_screen_origin(), XA_INTEGER,
- 32, PropModeReplace, 2, data, TRUE);
+ dixChangeWindowProperty(serverClient, pWin, xa_native_screen_origin(),
+ XA_INTEGER, 32, PropModeReplace, 2, data, TRUE);
}
/* Window managers can set the _APPLE_NO_ORDER_IN property on windows
@@ -169,15 +169,11 @@ AppleWMDoReorderWindow(
{
Atom atom;
PropertyPtr prop;
+ int rc;
atom = xa_apple_no_order_in();
- for (prop = wUserProps(pWin); prop != NULL; prop = prop->next)
- {
- if (prop->propertyName == atom && prop->type == atom)
- return FALSE;
- }
-
- return TRUE;
+ rc = dixLookupProperty(&prop, pWin, atom, serverClient, DixReadAccess);
+ return (rc == Success) && (prop->type == atom);
}
diff --git a/hw/xquartz/bundle/English.lproj/main.nib/designable.nib b/hw/xquartz/bundle/English.lproj/main.nib/designable.nib
index ea3a0daa8..c159d6ee1 100644
--- a/hw/xquartz/bundle/English.lproj/main.nib/designable.nib
+++ b/hw/xquartz/bundle/English.lproj/main.nib/designable.nib
@@ -2,14 +2,12 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">9C31</string>
+ <string key="IBDocument.SystemVersion">9C7010</string>
<string key="IBDocument.InterfaceBuilderVersion">639</string>
<string key="IBDocument.AppKitVersion">949.26</string>
<string key="IBDocument.HIToolboxVersion">352.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="57"/>
- <integer value="285"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -448,7 +446,7 @@
<object class="NSWindowTemplate" id="124913468">
<int key="NSWindowStyleMask">3</int>
<int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{319, 294}, {481, 345}}</string>
+ <string key="NSWindowRect">{{266, 392}, {484, 280}}</string>
<int key="NSWTFlags">1350041600</int>
<string key="NSWindowTitle">X11 Preferences</string>
<string key="NSWindowClass">NSPanel</string>
@@ -465,7 +463,7 @@
<object class="NSTabView" id="448510093">
<reference key="NSNextResponder" ref="941366957"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{10, 10}, {458, 325}}</string>
+ <string key="NSFrame">{{13, 10}, {458, 264}}</string>
<reference key="NSSuperview" ref="941366957"/>
<object class="NSMutableArray" key="NSTabViewItems">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -481,7 +479,7 @@
<object class="NSButton" id="119157981">
<reference key="NSNextResponder" ref="596750588"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{18, 243}, {402, 18}}</string>
+ <string key="NSFrame">{{18, 182}, {402, 18}}</string>
<reference key="NSSuperview" ref="596750588"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="990762273">
@@ -508,7 +506,7 @@
<object class="NSTextField" id="443008216">
<reference key="NSNextResponder" ref="596750588"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{36, 93}, {385, 31}}</string>
+ <string key="NSFrame">{{36, 32}, {385, 31}}</string>
<reference key="NSSuperview" ref="596750588"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="391919450">
@@ -544,7 +542,7 @@
<object class="NSTextField" id="282885445">
<reference key="NSNextResponder" ref="596750588"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{36, 208}, {385, 29}}</string>
+ <string key="NSFrame">{{36, 147}, {385, 29}}</string>
<reference key="NSSuperview" ref="596750588"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="649334366">
@@ -561,7 +559,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<object class="NSButton" id="842100515">
<reference key="NSNextResponder" ref="596750588"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{18, 130}, {402, 18}}</string>
+ <string key="NSFrame">{{18, 69}, {402, 18}}</string>
<reference key="NSSuperview" ref="596750588"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="940564599">
@@ -582,7 +580,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<object class="NSTextField" id="31160162">
<reference key="NSNextResponder" ref="596750588"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{36, 159}, {385, 14}}</string>
+ <string key="NSFrame">{{36, 98}, {385, 14}}</string>
<reference key="NSSuperview" ref="596750588"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="666057093">
@@ -598,7 +596,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<object class="NSButton" id="179949713">
<reference key="NSNextResponder" ref="596750588"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{18, 179}, {402, 18}}</string>
+ <string key="NSFrame">{{18, 118}, {402, 18}}</string>
<reference key="NSSuperview" ref="596750588"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="967619578">
@@ -616,45 +614,8 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
- <object class="NSButton" id="915448994">
- <reference key="NSNextResponder" ref="596750588"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{18, 69}, {402, 18}}</string>
- <reference key="NSSuperview" ref="596750588"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="117056849">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Click-through Inactive Windows</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="915448994"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSTextField" id="707276799">
- <reference key="NSNextResponder" ref="596750588"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{33, 32}, {385, 31}}</string>
- <reference key="NSSuperview" ref="596750588"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="318286890">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">When enabled, clicking on an inactive window will cause that mouse click to pass through to that window in addition to activating it.</string>
- <reference key="NSSupport" ref="26"/>
- <reference key="NSControlView" ref="707276799"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
</object>
- <string key="NSFrame">{{10, 33}, {438, 279}}</string>
+ <string key="NSFrame">{{10, 33}, {438, 218}}</string>
<reference key="NSSuperview" ref="448510093"/>
</object>
<string key="NSLabel">Input</string>
@@ -673,7 +634,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<object class="NSButton" id="418227126">
<reference key="NSNextResponder" ref="515308735"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{18, 116}, {402, 18}}</string>
+ <string key="NSFrame">{{18, 55}, {402, 18}}</string>
<reference key="NSSuperview" ref="515308735"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="1016069354">
@@ -694,7 +655,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<object class="NSTextField" id="1039016593">
<reference key="NSNextResponder" ref="515308735"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{36, 82}, {385, 28}}</string>
+ <string key="NSFrame">{{36, 21}, {385, 28}}</string>
<reference key="NSSuperview" ref="515308735"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="624655599">
@@ -710,7 +671,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<object class="NSPopUpButton" id="709074847">
<reference key="NSNextResponder" ref="515308735"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{74, 235}, {128, 26}}</string>
+ <string key="NSFrame">{{74, 174}, {128, 26}}</string>
<reference key="NSSuperview" ref="515308735"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="633115429">
@@ -801,7 +762,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<object class="NSTextField" id="201731424">
<reference key="NSNextResponder" ref="515308735"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{17, 238}, {55, 20}}</string>
+ <string key="NSFrame">{{17, 177}, {55, 20}}</string>
<reference key="NSSuperview" ref="515308735"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="930265681">
@@ -817,7 +778,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<object class="NSTextField" id="86150604">
<reference key="NSNextResponder" ref="515308735"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{36, 216}, {392, 14}}</string>
+ <string key="NSFrame">{{36, 155}, {392, 14}}</string>
<reference key="NSSuperview" ref="515308735"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="311969422">
@@ -833,7 +794,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<object class="NSButton" id="477203622">
<reference key="NSNextResponder" ref="515308735"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{18, 182}, {409, 23}}</string>
+ <string key="NSFrame">{{18, 121}, {409, 23}}</string>
<reference key="NSSuperview" ref="515308735"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="631531164">
@@ -854,7 +815,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<object class="NSTextField" id="298603383">
<reference key="NSNextResponder" ref="515308735"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{36, 145}, {385, 31}}</string>
+ <string key="NSFrame">{{36, 84}, {385, 31}}</string>
<reference key="NSSuperview" ref="515308735"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="761107402">
@@ -868,12 +829,139 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
</object>
</object>
</object>
- <string key="NSFrame">{{10, 33}, {438, 279}}</string>
+ <string key="NSFrame">{{10, 33}, {438, 218}}</string>
</object>
<string key="NSLabel">Output</string>
<reference key="NSColor" ref="57160303"/>
<reference key="NSTabView" ref="448510093"/>
</object>
+ <object class="NSTabViewItem" id="10973343">
+ <object class="NSMutableString" key="NSIdentifier">
+ <characters key="NS.bytes">2</characters>
+ </object>
+ <object class="NSView" key="NSView" id="184765684">
+ <nil key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSButton" id="657659108">
+ <reference key="NSNextResponder" ref="184765684"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{15, 184}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="184765684"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="259618205">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Click-through Inactive Windows</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="657659108"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="290578835">
+ <reference key="NSNextResponder" ref="184765684"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{23, 147}, {385, 31}}</string>
+ <reference key="NSSuperview" ref="184765684"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="399127858">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">When enabled, clicking on an inactive window will cause that mouse click to pass through to that window in addition to activating it.</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="290578835"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSButton" id="992839333">
+ <reference key="NSNextResponder" ref="184765684"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{15, 123}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="184765684"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="959555182">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Focus Follows Mouse</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="992839333"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="138261120">
+ <reference key="NSNextResponder" ref="184765684"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{23, 100}, {385, 17}}</string>
+ <reference key="NSSuperview" ref="184765684"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="183409141">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">X11 window focus follows the cursor</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="138261120"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSButton" id="128352289">
+ <reference key="NSNextResponder" ref="184765684"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{15, 79}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="184765684"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="556463187">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Focus On New Windows</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="128352289"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="57161931">
+ <reference key="NSNextResponder" ref="184765684"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{23, 45}, {385, 28}}</string>
+ <reference key="NSSuperview" ref="184765684"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="989804990">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">When enabled, creation of a new X11 window will cause X11.app to move to the foreground (instead of Finder.app, Terminal.app, etc.)</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="57161931"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrame">{{10, 33}, {438, 218}}</string>
+ </object>
+ <string key="NSLabel">Windows</string>
+ <reference key="NSColor" ref="57160303"/>
+ <reference key="NSTabView" ref="448510093"/>
+ </object>
<object class="NSTabViewItem" id="348328898">
<object class="NSView" key="NSView" id="300811574">
<nil key="NSNextResponder"/>
@@ -883,7 +971,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<object class="NSButton" id="989050925">
<reference key="NSNextResponder" ref="300811574"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{18, 243}, {402, 18}}</string>
+ <string key="NSFrame">{{18, 182}, {402, 18}}</string>
<reference key="NSSuperview" ref="300811574"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="189594322">
@@ -904,7 +992,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<object class="NSButton" id="700826966">
<reference key="NSNextResponder" ref="300811574"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{18, 166}, {402, 18}}</string>
+ <string key="NSFrame">{{18, 105}, {402, 18}}</string>
<reference key="NSSuperview" ref="300811574"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="489340979">
@@ -925,7 +1013,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
<object class="NSTextField" id="168436707">
<reference key="NSNextResponder" ref="300811574"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{36, 195}, {385, 42}}</string>
+ <string key="NSFrame">{{36, 134}, {385, 42}}</string>
<reference key="NSSuperview" ref="300811574"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="53243865">
@@ -943,7 +1031,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<object class="NSTextField" id="363817195">
<reference key="NSNextResponder" ref="300811574"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{36, 118}, {385, 42}}</string>
+ <string key="NSFrame">{{36, 57}, {385, 42}}</string>
<reference key="NSSuperview" ref="300811574"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="390084685">
@@ -959,7 +1047,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<object class="NSTextField" id="223835729">
<reference key="NSNextResponder" ref="300811574"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{20, 17}, {404, 14}}</string>
+ <string key="NSFrame">{{20, -44}, {404, 14}}</string>
<reference key="NSSuperview" ref="300811574"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="283628678">
@@ -973,7 +1061,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
</object>
</object>
</object>
- <string key="NSFrame">{{10, 33}, {438, 279}}</string>
+ <string key="NSFrame">{{10, 33}, {438, 218}}</string>
</object>
<string key="NSLabel">Security</string>
<reference key="NSColor" ref="57160303"/>
@@ -991,9 +1079,9 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
</object>
</object>
</object>
- <string key="NSFrameSize">{481, 345}</string>
+ <string key="NSFrameSize">{484, 280}</string>
</object>
- <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
+ <string key="NSScreenRect">{{0, 0}, {1280, 938}}</string>
<string key="NSMinSize">{213, 129}</string>
<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSFrameAutosaveName">x11_prefs</string>
@@ -1001,7 +1089,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<object class="NSWindowTemplate" id="604417141">
<int key="NSWindowStyleMask">11</int>
<int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{361, 362}, {454, 311}}</string>
+ <string key="NSWindowRect">{{302, 400}, {454, 311}}</string>
<int key="NSWTFlags">1350041600</int>
<string key="NSWindowTitle">X11 Application Menu</string>
<string key="NSWindowClass">NSPanel</string>
@@ -1011,7 +1099,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<string key="NSWindowContentMaxSize">{10000, 10000}</string>
<string key="NSWindowContentMinSize">{320, 240}</string>
<object class="NSView" key="NSWindowView" id="85544634">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1353,9 +1441,8 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
</object>
</object>
<string key="NSFrameSize">{454, 311}</string>
- <reference key="NSSuperview"/>
</object>
- <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
+ <string key="NSScreenRect">{{0, 0}, {1280, 938}}</string>
<string key="NSMinSize">{320, 262}</string>
<string key="NSFrameAutosaveName">x11_apps</string>
</object>
@@ -1842,14 +1929,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<int key="connectionID">549</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="915448994"/>
- </object>
- <int key="connectionID">300300</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window_separator</string>
<reference key="source" ref="485884620"/>
@@ -1859,14 +1938,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
- <string key="label">click_through</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="915448994"/>
- </object>
- <int key="connectionID">300332</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
<string key="label">menu</string>
<reference key="source" ref="815810918"/>
<reference key="destination" ref="524015605"/>
@@ -1881,6 +1952,54 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
</object>
<int key="connectionID">300336</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="657659108"/>
+ </object>
+ <int key="connectionID">300389</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="992839333"/>
+ </object>
+ <int key="connectionID">300390</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="128352289"/>
+ </object>
+ <int key="connectionID">300391</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">click_through</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="657659108"/>
+ </object>
+ <int key="connectionID">300392</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">focus_follows_mouse</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="992839333"/>
+ </object>
+ <int key="connectionID">300393</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">focus_on_new_window</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="128352289"/>
+ </object>
+ <int key="connectionID">300394</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -2239,6 +2358,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<reference ref="287591690"/>
<reference ref="960678392"/>
<reference ref="348328898"/>
+ <reference ref="10973343"/>
</object>
<reference key="parent" ref="941366957"/>
</object>
@@ -2262,8 +2382,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<reference ref="842100515"/>
<reference ref="31160162"/>
<reference ref="179949713"/>
- <reference ref="915448994"/>
- <reference ref="707276799"/>
</object>
<reference key="parent" ref="287591690"/>
</object>
@@ -2671,34 +2789,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<reference key="parent" ref="341113515"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">300296</int>
- <reference key="object" ref="915448994"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="117056849"/>
- </object>
- <reference key="parent" ref="596750588"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300297</int>
- <reference key="object" ref="117056849"/>
- <reference key="parent" ref="915448994"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300298</int>
- <reference key="object" ref="707276799"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="318286890"/>
- </object>
- <reference key="parent" ref="596750588"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300299</int>
- <reference key="object" ref="318286890"/>
- <reference key="parent" ref="707276799"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">295</int>
<reference key="object" ref="1063387772"/>
<object class="NSMutableArray" key="children">
@@ -2853,6 +2943,113 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<reference key="object" ref="444952046"/>
<reference key="parent" ref="96874957"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300337</int>
+ <reference key="object" ref="10973343"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="184765684"/>
+ </object>
+ <reference key="parent" ref="448510093"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300338</int>
+ <reference key="object" ref="184765684"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="657659108"/>
+ <reference ref="290578835"/>
+ <reference ref="992839333"/>
+ <reference ref="138261120"/>
+ <reference ref="128352289"/>
+ <reference ref="57161931"/>
+ </object>
+ <reference key="parent" ref="10973343"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300358</int>
+ <reference key="object" ref="290578835"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="399127858"/>
+ </object>
+ <reference key="parent" ref="184765684"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300359</int>
+ <reference key="object" ref="657659108"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="259618205"/>
+ </object>
+ <reference key="parent" ref="184765684"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300360</int>
+ <reference key="object" ref="259618205"/>
+ <reference key="parent" ref="657659108"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300361</int>
+ <reference key="object" ref="399127858"/>
+ <reference key="parent" ref="290578835"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300362</int>
+ <reference key="object" ref="992839333"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="959555182"/>
+ </object>
+ <reference key="parent" ref="184765684"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300363</int>
+ <reference key="object" ref="959555182"/>
+ <reference key="parent" ref="992839333"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300364</int>
+ <reference key="object" ref="138261120"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="183409141"/>
+ </object>
+ <reference key="parent" ref="184765684"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300365</int>
+ <reference key="object" ref="183409141"/>
+ <reference key="parent" ref="138261120"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300368</int>
+ <reference key="object" ref="128352289"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="556463187"/>
+ </object>
+ <reference key="parent" ref="184765684"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300369</int>
+ <reference key="object" ref="556463187"/>
+ <reference key="parent" ref="128352289"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300370</int>
+ <reference key="object" ref="57161931"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="989804990"/>
+ </object>
+ <reference key="parent" ref="184765684"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300371</int>
+ <reference key="object" ref="989804990"/>
+ <reference key="parent" ref="57161931"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -2919,10 +3116,12 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<string>24.IBPluginDependency</string>
<string>24.ImportedFromIB2</string>
<string>24.editorWindowContentRectSynchronizationRect</string>
+ <string>244.IBEditorWindowLastContentRect</string>
<string>244.IBPluginDependency</string>
<string>244.IBWindowTemplateEditedContentRect</string>
<string>244.ImportedFromIB2</string>
<string>244.editorWindowContentRectSynchronizationRect</string>
+ <string>244.lastResizeAction</string>
<string>244.windowTemplate.hasMaxSize</string>
<string>244.windowTemplate.hasMinSize</string>
<string>244.windowTemplate.maxSize</string>
@@ -2971,12 +3170,24 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<string>299.IBPluginDependency</string>
<string>299.ImportedFromIB2</string>
<string>300295.IBShouldRemoveOnLegacySave</string>
- <string>300296.IBPluginDependency</string>
- <string>300296.ImportedFromIB2</string>
- <string>300298.IBPluginDependency</string>
- <string>300298.ImportedFromIB2</string>
<string>300330.IBPluginDependency</string>
<string>300330.ImportedFromIB2</string>
+ <string>300337.IBPluginDependency</string>
+ <string>300337.ImportedFromIB2</string>
+ <string>300338.IBPluginDependency</string>
+ <string>300338.ImportedFromIB2</string>
+ <string>300358.IBPluginDependency</string>
+ <string>300358.ImportedFromIB2</string>
+ <string>300359.IBPluginDependency</string>
+ <string>300359.ImportedFromIB2</string>
+ <string>300362.IBPluginDependency</string>
+ <string>300362.ImportedFromIB2</string>
+ <string>300364.IBPluginDependency</string>
+ <string>300364.ImportedFromIB2</string>
+ <string>300368.IBPluginDependency</string>
+ <string>300368.ImportedFromIB2</string>
+ <string>300370.IBPluginDependency</string>
+ <string>300370.ImportedFromIB2</string>
<string>305.IBPluginDependency</string>
<string>305.ImportedFromIB2</string>
<string>310.IBPluginDependency</string>
@@ -3152,10 +3363,24 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{271, 666}, {301, 153}}</string>
+ <string>{{313, 353}, {484, 280}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{184, 290}, {481, 345}}</string>
+ <string>{{313, 353}, {484, 280}}</string>
<reference ref="9"/>
<string>{{184, 290}, {481, 345}}</string>
+ <object class="NSDictionary">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>IBResizeActionFinalFrame</string>
+ <string>IBResizeActionInitialFrame</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>{{182, 481}, {484, 280}}</string>
+ <string>{{182, 103}, {536, 658}}</string>
+ </object>
+ </object>
<reference ref="9"/>
<reference ref="9"/>
<string>{3.40282e+38, 3.40282e+38}</string>
@@ -3169,11 +3394,11 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<string>{{100, 746}, {155, 33}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{537, 545}, {454, 311}}</string>
+ <string>{{407, 545}, {454, 311}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<reference ref="9"/>
- <string>{{537, 545}, {454, 311}}</string>
+ <string>{{407, 545}, {454, 311}}</string>
<reference ref="9"/>
<string>{{433, 406}, {486, 327}}</string>
<object class="NSDictionary">
@@ -3320,6 +3545,18 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
<string>{{12, 633}, {218, 203}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
@@ -3356,7 +3593,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">300336</int>
+ <int key="maxID">300394</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -3378,6 +3615,17 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<object class="IBPartialClassDescription">
<string key="className">X11Controller</string>
<string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">X11Controller</string>
+ <string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
@@ -3439,6 +3687,8 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<string>enable_keyequivs</string>
<string>enable_tcp</string>
<string>fake_buttons</string>
+ <string>focus_follows_mouse</string>
+ <string>focus_on_new_window</string>
<string>prefs_panel</string>
<string>sync_keymap</string>
<string>toggle_fullscreen_item</string>
@@ -3460,6 +3710,8 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
<string>NSButton</string>
<string>NSButton</string>
<string>NSButton</string>
+ <string>NSButton</string>
+ <string>NSButton</string>
<string>NSPanel</string>
<string>NSButton</string>
<string>NSMenuItem</string>
@@ -3469,8 +3721,8 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBUserSource</string>
- <string key="minorKey"/>
+ <string key="majorKey">IBDocumentRelativeSource</string>
+ <string key="minorKey">../../X11Controller.h</string>
</object>
</object>
</object>
diff --git a/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib
index f60dcbacb..95420e4f7 100644
--- a/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib
+++ b/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 20bcee592..002ea413d 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -150,7 +150,7 @@ void
DarwinPrintBanner(void)
{
// this should change depending on which specific server we are building
- ErrorF("XQuartz starting:\n");
+ ErrorF("Xquartz starting:\n");
ErrorF("X.org Release 7.2\n"); // This is here to help fink until they fix their packages.
ErrorF("X.Org X Server %s\nBuild Date: %s\n", XSERVER_VERSION, BUILD_DATE );
}
@@ -353,24 +353,8 @@ static int DarwinMouseProc(
InitPointerDeviceStruct( (DevicePtr)pPointer, map, 5,
GetMotionHistory,
(PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), 2);
-
-#ifdef XINPUT
- InitValuatorAxisStruct( pPointer,
- 0, // X axis
- 0, // min value
- 16000, // max value (fixme screen size?)
- 1, // resolution (fixme ?)
- 1, // min resolution
- 1 ); // max resolution
- InitValuatorAxisStruct( pPointer,
- 1, // X axis
- 0, // min value
- 16000, // max value (fixme screen size?)
- 1, // resolution (fixme ?)
- 1, // min resolution
- 1 ); // max resolution
-#endif
+ GetMotionHistorySize(), 5);
+ InitProximityClassDeviceStruct( (DevicePtr)pPointer);
break;
case DEVICE_ON:
@@ -856,7 +840,7 @@ void ddxUseMsg( void )
*/
void ddxGiveUp( void )
{
- ErrorF( "Quitting XQuartz...\n" );
+ ErrorF( "Quitting Xquartz...\n" );
//if (!quartzRootless)
// quartzProcs->ReleaseScreens();
@@ -896,7 +880,7 @@ void AbortDDX( void )
*/
void
-xf86SetRootClip (ScreenPtr pScreen, BOOL enable)
+xf86SetRootClip (ScreenPtr pScreen, int enable)
{
WindowPtr pWin = WindowTable[pScreen->myNum];
WindowPtr pChild;
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index c5e2ed80d..df92d8b49 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -1,4 +1,5 @@
/*
+ * Copyright (C) 2008 Apple, Inc.
* Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -54,7 +55,7 @@ typedef struct {
void DarwinPrintBanner(void);
int DarwinParseModifierList(const char *constmodifiers);
void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
-void xf86SetRootClip (ScreenPtr pScreen, BOOL enable);
+void xf86SetRootClip (ScreenPtr pScreen, int enable);
#define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \
dixLookupPrivate(&pScreen->devPrivates, darwinScreenKey))
@@ -90,41 +91,39 @@ extern int darwinMainScreenY;
* Special ddx events understood by the X server
*/
enum {
- kXDarwinUpdateModifiers // update all modifier keys
+ kXquartzReloadKeymap // Reload system keymap
= LASTEvent+1, // (from X.h list of event names)
- kXDarwinUpdateButtons, // update state of mouse buttons 2 and up
- kXDarwinScrollWheel, // scroll wheel event
- /*
- * Quartz-specific events -- not used in IOKit mode
- */
- kXDarwinActivate, // restore X drawing and cursor
- kXDarwinDeactivate, // clip X drawing and switch to Aqua cursor
- kXDarwinSetRootClip, // enable or disable drawing to the X screen
- kXDarwinQuit, // kill the X server and release the display
- kXDarwinReadPasteboard, // copy Mac OS X pasteboard into X cut buffer
- kXDarwinWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard
- kXDarwinBringAllToFront, // bring all X windows to front
- kXDarwinToggleFullscreen, // Enable/Disable fullscreen mode
- kXDarwinSetRootless, // Set rootless mode
+ kXquartzActivate, // restore X drawing and cursor
+ kXquartzDeactivate, // clip X drawing and switch to Aqua cursor
+ kXquartzSetRootClip, // enable or disable drawing to the X screen
+ kXquartzQuit, // kill the X server and release the display
+ kXquartzReadPasteboard, // copy Mac OS X pasteboard into X cut buffer
+ kXquartzWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard
+ kXquartzBringAllToFront, // bring all X windows to front
+ kXquartzToggleFullscreen, // Enable/Disable fullscreen mode
+ kXquartzSetRootless, // Set rootless mode
+ kXquartzSpaceChanged, // Spaces changed
/*
* AppleWM events
*/
- kXDarwinControllerNotify, // send an AppleWMControllerNotify event
- kXDarwinPasteboardNotify, // notify the WM to copy or paste
+ kXquartzControllerNotify, // send an AppleWMControllerNotify event
+ kXquartzPasteboardNotify, // notify the WM to copy or paste
/*
* Xplugin notification events
*/
- kXDarwinDisplayChanged, // display configuration has changed
- kXDarwinWindowState, // window visibility state has changed
- kXDarwinWindowMoved // window has moved on screen
+ kXquartzDisplayChanged, // display configuration has changed
+ kXquartzWindowState, // window visibility state has changed
+ kXquartzWindowMoved, // window has moved on screen
};
+void DarwinSendDDXEvent(int type, int argc, ...);
+
#define ENABLE_DEBUG_LOG 1
#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, "%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
+#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);
#else
#define DEBUG_LOG(msg, args...)
#endif
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 827fd81b8..3afbaf890 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -52,33 +52,20 @@ in this Software without prior written authorization from The Open Group.
#include <unistd.h>
#include <IOKit/hidsystem/IOLLEvent.h>
+#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
-#define QUEUE_SIZE 256
-
-typedef struct _Event {
- xEvent event;
- ScreenPtr pScreen;
-} EventRec, *EventPtr;
-
int input_check_zero, input_check_flag;
static int old_flags = 0; // last known modifier state
-typedef struct _EventQueue {
- HWEventQueueType head, tail; /* long for SetInputCheck */
- CARD32 lastEventTime; /* to avoid time running backwards */
- Bool lastMotion;
- EventRec events[QUEUE_SIZE]; /* static allocation for signals */
- DevicePtr pKbd, pPtr; /* device pointer, to get funcs */
- ScreenPtr pEnqueueScreen; /* screen events are being delivered to */
- ScreenPtr pDequeueScreen; /* screen events are being dispatched to */
-} EventQueueRec, *EventQueuePtr;
-
-static EventQueueRec darwinEventQueue;
-xEvent *darwinEvents;
+xEvent *darwinEvents = NULL;
/*
* DarwinPressModifierMask
@@ -152,7 +139,7 @@ static void DarwinUpdateModifiers(
/*
* DarwinReleaseModifiers
* This hacky function releases all modifier keys. It should be called when X11.app
- * is deactivated (kXDarwinDeactivate) to prevent modifiers from getting stuck if they
+ * is deactivated (kXquartzDeactivate) to prevent modifiers from getting stuck if they
* are held down during a "context" switch -- otherwise, we would miss the KeyUp.
*/
static void DarwinReleaseModifiers(void) {
@@ -173,6 +160,9 @@ static void DarwinReleaseModifiers(void) {
static void DarwinSimulateMouseClick(
int pointer_x,
int pointer_y,
+ float pressure,
+ float tilt_x,
+ float tilt_y,
int whichButton, // mouse button to be pressed
int modifierMask) // modifiers used for the fake click
{
@@ -183,96 +173,146 @@ static void DarwinSimulateMouseClick(
DarwinUpdateModifiers(KeyRelease, modifierMask);
// push the mouse button
- DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y);
- DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y);
+ DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y,
+ pressure, tilt_x, tilt_y);
+ DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y,
+ pressure, tilt_x, tilt_y);
// restore old modifiers
DarwinUpdateModifiers(KeyPress, modifierMask);
}
+/* Generic handler for Xquartz-specifc events. When possible, these should
+ be moved into their own individual functions and set as handlers using
+ mieqSetHandler. */
-Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
- darwinEvents = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum());
- mieqInit();
- darwinEventQueue.head = darwinEventQueue.tail = 0;
- darwinEventQueue.lastEventTime = GetTimeInMillis ();
- darwinEventQueue.pKbd = pKbd;
- darwinEventQueue.pPtr = pPtr;
- darwinEventQueue.pEnqueueScreen = screenInfo.screens[0];
- darwinEventQueue.pDequeueScreen = darwinEventQueue.pEnqueueScreen;
- SetInputCheck(&input_check_zero, &input_check_flag);
- return TRUE;
-}
-
-
-/*
- * DarwinEQEnqueue
- * Must be thread safe with ProcessInputEvents.
- * DarwinEQEnqueue - called from event gathering thread
- * ProcessInputEvents - called from X server thread
- * DarwinEQEnqueue should never be called from more than one thread.
- *
- * This should be deprecated in favor of miEQEnqueue -- BB
- */
-void DarwinEQEnqueue(const xEventPtr e) {
- HWEventQueueType oldtail, newtail;
-
- oldtail = darwinEventQueue.tail;
-
- // mieqEnqueue() collapses successive motion events into one event.
- // This is difficult to do in a thread-safe way and rarely useful.
-
- newtail = oldtail + 1;
- if (newtail == QUEUE_SIZE) newtail = 0;
- /* Toss events which come in late */
- if (newtail == darwinEventQueue.head) return;
-
- darwinEventQueue.events[oldtail].event = *e;
-
- /*
- * Make sure that event times don't go backwards - this
- * is "unnecessary", but very useful
- */
- if (e->u.keyButtonPointer.time < darwinEventQueue.lastEventTime &&
- darwinEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000)
- {
- darwinEventQueue.events[oldtail].event.u.keyButtonPointer.time =
- darwinEventQueue.lastEventTime;
- }
- darwinEventQueue.events[oldtail].pScreen = darwinEventQueue.pEnqueueScreen;
-
- // Update the tail after the event is prepared
- darwinEventQueue.tail = newtail;
+void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
+ int i;
- // Signal there is an event ready to handle
- DarwinPokeEQ();
+ 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");
+#ifdef DARWIN_DDX_MISSING
+ if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot);
+ else if (quartzHasRoot) QuartzHide();
+ else QuartzShow();
+#else
+ // ErrorF("kXquartzToggleFullscreen not implemented\n");
+#endif
+ break;
+
+ case kXquartzSetRootless:
+ DEBUG_LOG("kXquartzSetRootless\n");
+#ifdef DARWIN_DDX_MISSING
+ QuartzSetRootless(xe[i].u.clientMessage.u.l.longs0);
+ if (!quartzEnableRootless && !quartzHasRoot) QuartzHide();
+#else
+ // 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);
+ }
+ }
}
+Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
+ if (!darwinEvents)
+ darwinEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!darwinEvents)
+ FatalError("Couldn't allocate event buffer\n");
-/*
- * DarwinEQPointerPost
- * Post a pointer event. Used by the mipointer.c routines.
- */
-void DarwinEQPointerPost(DeviceIntPtr pdev, xEventPtr e) {
- (*darwinEventQueue.pPtr->processInputProc)
- (e, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
-}
-
+ mieqInit();
+ mieqSetHandler(kXquartzReloadKeymap, DarwinKeyboardReloadHandler);
+ mieqSetHandler(kXquartzActivate, DarwinEventHandler);
+ mieqSetHandler(kXquartzDeactivate, DarwinEventHandler);
+ mieqSetHandler(kXquartzSetRootClip, DarwinEventHandler);
+ mieqSetHandler(kXquartzQuit, DarwinEventHandler);
+ mieqSetHandler(kXquartzReadPasteboard, QuartzReadPasteboard);
+ 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);
-void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX) {
- darwinEventQueue.pEnqueueScreen = pScreen;
- if (fromDIX)
- darwinEventQueue.pDequeueScreen = pScreen;
+ return TRUE;
}
-
/*
* ProcessInputEvents
* Read and process events from the event queue until it is empty.
*/
void ProcessInputEvents(void) {
- EventRec *e;
- int x, y;
xEvent xe;
// button number and modifier mask of currently pressed fake button
input_check_flag=0;
@@ -281,92 +321,11 @@ void ProcessInputEvents(void) {
mieqProcessInputEvents();
// Empty the signaling pipe
- x = sizeof(xe);
- while (x == sizeof(xe))
- x = read(darwinEventReadFD, &xe, sizeof(xe));
-
- while (darwinEventQueue.head != darwinEventQueue.tail)
- {
- if (screenIsSaved == SCREEN_SAVER_ON)
- dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
-
- e = &darwinEventQueue.events[darwinEventQueue.head];
- xe = e->event;
-
- // Shift from global screen coordinates to coordinates relative to
- // the origin of the current screen.
- xe.u.keyButtonPointer.rootX -= darwinMainScreenX +
- dixScreenOrigins[miPointerCurrentScreen()->myNum].x;
- xe.u.keyButtonPointer.rootY -= darwinMainScreenY +
- dixScreenOrigins[miPointerCurrentScreen()->myNum].y;
-
- /* ErrorF("old rootX = (%d,%d) darwinMainScreen = (%d,%d) dixScreenOrigins[%d]=(%d,%d)\n",
- xe.u.keyButtonPointer.rootX, xe.u.keyButtonPointer.rootY,
- darwinMainScreenX, darwinMainScreenY,
- miPointerCurrentScreen()->myNum,
- dixScreenOrigins[miPointerCurrentScreen()->myNum].x,
- dixScreenOrigins[miPointerCurrentScreen()->myNum].y); */
-
- //Assumption - screen switching can only occur on motion events
-
- if (e->pScreen != darwinEventQueue.pDequeueScreen)
- {
- darwinEventQueue.pDequeueScreen = e->pScreen;
- x = xe.u.keyButtonPointer.rootX;
- y = xe.u.keyButtonPointer.rootY;
- if (darwinEventQueue.head == QUEUE_SIZE - 1)
- darwinEventQueue.head = 0;
- else
- ++darwinEventQueue.head;
- NewCurrentScreen (darwinEventQueue.pDequeueScreen, x, y);
- }
- else
- {
- if (darwinEventQueue.head == QUEUE_SIZE - 1)
- darwinEventQueue.head = 0;
- else
- ++darwinEventQueue.head;
- switch (xe.u.u.type) {
- case KeyPress:
- case KeyRelease:
- ErrorF("Unexpected Keyboard event in DarwinProcessInputEvents\n");
- break;
-
- case ButtonPress:
- ErrorF("Unexpected ButtonPress event in DarwinProcessInputEvents\n");
- break;
-
- case ButtonRelease:
- ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
- break;
-
- case MotionNotify:
- ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
- break;
-
- case kXDarwinUpdateModifiers:
- ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
- break;
-
- case kXDarwinUpdateButtons:
- ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n");
- break;
-
- case kXDarwinScrollWheel:
- ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n");
- break;
-
- case kXDarwinDeactivate:
- DarwinReleaseModifiers();
- // fall through
- default:
- // Check for mode specific event
- QuartzProcessEvent(&xe);
- }
- }
+ int x = sizeof(xe);
+ while (x == sizeof(xe)) {
+// DEBUG_LOG("draining pipe\n");
+ x = read(darwinEventReadFD, &xe, sizeof(xe));
}
-
- // miPointerUpdate();
}
/* Sends a null byte down darwinEventWriteFD, which will cause the
@@ -378,23 +337,46 @@ void DarwinPokeEQ(void) {
write(darwinEventWriteFD, &nullbyte, 1);
}
-void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y) {
+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;
- int valuators[2] = {pointer_x, pointer_y};
+
+ 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
+ just like mice, except they have either one or three extra valuators, in this
+ order:
+
+ X coord, Y coord, pressure, X tilt, Y tilt
+ Pressure and tilt should be represented natively as floats; unfortunately,
+ 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,
+ 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, 2, 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, 3, darwinFakeMouse3Mask);
+ DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
+ tilt_x, tilt_y, 3, darwinFakeMouse3Mask);
darwinFakeMouseButtonDown = 3;
darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
+ return;
}
}
if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) {
@@ -406,10 +388,11 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
// 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, 2, valuators);
+ POINTER_ABSOLUTE, 0, 5, valuators);
for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
DarwinPokeEQ();
@@ -417,6 +400,11 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
void DarwinSendKeyboardEvents(int ev_type, int keycode) {
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. */
@@ -425,8 +413,8 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
this_seed = QuartzSystemKeymapSeed();
if (this_seed != last_seed) {
- last_seed = this_seed;
- DarwinKeyboardReload(darwinKeyboard);
+ last_seed = this_seed;
+ DarwinSendDDXEvent(kXquartzReloadKeymap, 0);
}
}
@@ -435,18 +423,48 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
DarwinPokeEQ();
}
+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,
+ pressure * INT32_MAX * 1.0f,
+ tilt_x * INT32_MAX * 1.0f,
+ tilt_y * INT32_MAX * 1.0f};
+
+ 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();
+}
+
+
/* Send the appropriate number of button 4 / 5 clicks to emulate scroll wheel */
-void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y) {
+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[2] = {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(!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, 2, valuators);
+ 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, 2, valuators);
+ POINTER_ABSOLUTE, 0, 5, valuators);
for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
}
DarwinPokeEQ();
@@ -459,3 +477,31 @@ void DarwinUpdateModKeys(int flags) {
DarwinUpdateModifiers(KeyPress, ~old_flags & flags);
old_flags = flags;
}
+
+
+/*
+ * DarwinSendDDXEvent
+ * Send the X server thread a message by placing it on the event queue.
+ */
+void DarwinSendDDXEvent(int type, int argc, ...) {
+ xEvent xe;
+ INT32 *argv;
+ int i, max_args;
+ va_list args;
+
+ memset(&xe, 0, sizeof(xe));
+ xe.u.u.type = type;
+ xe.u.clientMessage.u.l.type = type;
+
+ argv = &xe.u.clientMessage.u.l.longs0;
+ max_args = 4;
+
+ if (argc > 0 && argc <= max_args) {
+ va_start (args, argc);
+ for (i = 0; i < argc; i++)
+ argv[i] = (int) va_arg (args, int);
+ va_end (args);
+ }
+
+ mieqEnqueue(NULL, &xe);
+}
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 82cc26bc0..7c56be9c8 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2008 Apple, Inc.
* Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -32,9 +33,16 @@ 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);
+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, 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
index 8d1ee8ec9..6f2758e53 100644
--- a/hw/xquartz/darwinKeyboard.c
+++ b/hw/xquartz/darwinKeyboard.c
@@ -730,6 +730,14 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
* 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
@@ -842,16 +850,18 @@ static Bool InitModMap(register KeyClassPtr keyc) {
}
-void DarwinKeyboardReload(DeviceIntPtr pDev) {
+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(&pDev->key->curKeySyms, &keySyms)) {
+ if (SetKeySymsMap(&dev->key->curKeySyms, &keySyms)) {
/* now try to update modifiers. */
- memmove(pDev->key->modifierMap, keyInfo.modMap, MAP_LENGTH);
- InitModMap(pDev->key);
+ memmove(dev->key->modifierMap, keyInfo.modMap, MAP_LENGTH);
+ InitModMap(dev->key);
} else DEBUG_LOG("SetKeySymsMap=0\n");
SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, 0);
diff --git a/hw/xquartz/darwinKeyboard.h b/hw/xquartz/darwinKeyboard.h
index 5cf64c7d1..762f65919 100644
--- a/hw/xquartz/darwinKeyboard.h
+++ b/hw/xquartz/darwinKeyboard.h
@@ -31,7 +31,7 @@
/* Provided for darwinEvents.c */
extern darwinKeyboardInfo keyInfo;
-void DarwinKeyboardReload(DeviceIntPtr pDev);
+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);
diff --git a/hw/xquartz/darwinXinput.c b/hw/xquartz/darwinXinput.c
index e62ec0ab6..59bae6fde 100644
--- a/hw/xquartz/darwinXinput.c
+++ b/hw/xquartz/darwinXinput.c
@@ -1,8 +1,7 @@
-
/*
- * X server support of the XINPUT extension for Darwin
+ * X server support of the XINPUT extension for xquartz
*
- * This is currently a copy of mi/stubs.c, but eventually this
+ * This is currently a copy of Xi/stubs.c, but eventually this
* should include more complete XINPUT support.
*/
@@ -52,100 +51,18 @@ SOFTWARE.
********************************************************/
+#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xproto.h>
#include "inputstr.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
-#include "chgkbd.h"
-
-/***********************************************************************
- *
- * Caller: ProcXChangeKeyboardDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the keyboard device.
- *
- * The X keyboard device has a FocusRec. If the device that has been
- * made into the new X keyboard did not have a FocusRec,
- * ProcXChangeKeyboardDevice will allocate one for it.
- *
- * If you do not want clients to be able to focus the old X keyboard
- * device, call DeleteFocusClassDeviceStruct to free the FocusRec.
- *
- * If you support input devices with keys that you do not want to be
- * used as the X keyboard, you need to check for them here and return
- * a BadDevice error.
- *
- * The default implementation is to do nothing (assume you do want
- * clients to be able to focus the old X keyboard). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- */
-
-int ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev) {
- /***********************************************************************
- DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
- **********************************************************************/
- return BadMatch;
-}
-
-
-/***********************************************************************
- *
- * Caller: ProcXChangePointerDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the pointer device.
- *
- * The X pointer device does not have a FocusRec. If the device that
- * has been made into the new X pointer had a FocusRec,
- * ProcXChangePointerDevice will free it.
- *
- * If you want clients to be able to focus the old pointer device that
- * has now become accessible through the input extension, you need to
- * add a FocusRec to it here.
- *
- * The XChangePointerDevice protocol request also allows the client
- * to choose which axes of the new pointer device are used to move
- * the X cursor in the X- and Y- directions. If the axes are different
- * than the default ones, you need to keep track of that here.
- *
- * If you support input devices with valuators that you do not want to be
- * used as the X pointer, you need to check for them here and return a
- * BadDevice error.
- *
- * The default implementation is to do nothing (assume you don't want
- * clients to be able to focus the old X pointer). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- */
-
-int
-ChangePointerDevice (
- DeviceIntPtr old_dev,
- DeviceIntPtr new_dev,
- unsigned char x,
- unsigned char y)
- {
- /***********************************************************************
- InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
-
- x_axis = x; * keep track of new x-axis*
- y_axis = y; * keep track of new y-axis*
- if (x_axis != 0 || y_axis != 1)
- axes_changed = TRUE; * remember axes have changed*
- else
- axes_changed = FALSE;
- *************************************************************************/
- return BadMatch;
- }
+#include "darwin.h"
/***********************************************************************
*
@@ -161,11 +78,10 @@ ChangePointerDevice (
*/
void
-CloseInputDevice (d, client)
- DeviceIntPtr d;
- ClientPtr client;
- {
- }
+CloseInputDevice(DeviceIntPtr d, ClientPtr client)
+{
+ DEBUG_LOG("CloseInputDevice(%p, %p)\n", d, client);
+}
/***********************************************************************
*
@@ -194,8 +110,8 @@ CloseInputDevice (d, client)
*/
void
-AddOtherInputDevices ()
- {
+AddOtherInputDevices(void)
+{
/**********************************************************************
for each uninitialized device, do something like:
@@ -208,8 +124,8 @@ AddOtherInputDevices ()
RegisterOtherDevice(dev);
dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
************************************************************************/
-
- }
+ DEBUG_LOG("AddOtherInputDevices\n");
+}
/***********************************************************************
*
@@ -234,12 +150,10 @@ AddOtherInputDevices ()
*/
void
-OpenInputDevice (dev, client, status)
- DeviceIntPtr dev;
- ClientPtr client;
- int *status;
- {
- }
+OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
+{
+ DEBUG_LOG("OpenInputDevice(%p, %p, %p)\n", dev, client, status);
+}
/****************************************************************************
*
@@ -254,13 +168,11 @@ OpenInputDevice (dev, client, status)
*/
int
-SetDeviceMode (client, dev, mode)
- register ClientPtr client;
- DeviceIntPtr dev;
- int mode;
- {
+SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
+{
+ DEBUG_LOG("SetDeviceMode(%p, %p, %d)\n", client, dev, mode);
return BadMatch;
- }
+}
/****************************************************************************
*
@@ -275,15 +187,13 @@ SetDeviceMode (client, dev, mode)
*/
int
-SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
- register ClientPtr client;
- DeviceIntPtr dev;
- int *valuators;
- int first_valuator;
- int num_valuators;
- {
- return BadMatch;
- }
+SetDeviceValuators(ClientPtr client, DeviceIntPtr dev,
+ int *valuators, int first_valuator, int num_valuators)
+{
+ DEBUG_LOG("SetDeviceValuators(%p, %p, %p, %d, %d)\n", client,
+ dev, valuators, first_valuator, num_valuators);
+ return BadMatch;
+}
/****************************************************************************
*
@@ -294,16 +204,48 @@ SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
*/
int
-ChangeDeviceControl (client, dev, control)
- register ClientPtr client;
- DeviceIntPtr dev;
- xDeviceCtl *control;
- {
- switch (control->control)
- {
- case DEVICE_RESOLUTION:
- return (BadMatch);
- default:
- return (BadMatch);
- }
+ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
+ xDeviceCtl * control)
+{
+
+ DEBUG_LOG("ChangeDeviceControl(%p, %p, %p)\n", client, dev, control);
+ switch (control->control) {
+ case DEVICE_RESOLUTION:
+ return (BadMatch);
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
+ return (BadMatch);
+ case DEVICE_CORE:
+ return (BadMatch);
+ default:
+ return (BadMatch);
}
+}
+
+
+/****************************************************************************
+ *
+ * Caller: configAddDevice (and others)
+ *
+ * Add a new device with the specified options.
+ *
+ */
+int
+NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
+{
+ DEBUG_LOG("NewInputDeviceRequest(%p, %p)\n", options, pdev);
+ return BadValue;
+}
+
+/****************************************************************************
+ *
+ * Caller: configRemoveDevice (and others)
+ *
+ * Remove the specified device previously added.
+ *
+ */
+void
+DeleteInputDeviceRequest(DeviceIntPtr dev)
+{
+ DEBUG_LOG("DeleteInputDeviceRequest(%p)\n", dev);
+}
diff --git a/hw/xquartz/pseudoramiX.c b/hw/xquartz/pseudoramiX.c
index 4a9d8e1f1..49d5eb6d4 100644
--- a/hw/xquartz/pseudoramiX.c
+++ b/hw/xquartz/pseudoramiX.c
@@ -179,7 +179,7 @@ static int ProcPseudoramiXGetState(ClientPtr client)
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -206,7 +206,7 @@ static int ProcPseudoramiXGetScreenCount(ClientPtr client)
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -233,7 +233,7 @@ static int ProcPseudoramiXGetScreenSize(ClientPtr client)
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 6f42c538f..96dc021a6 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -33,6 +33,7 @@
#endif
#include "quartzCommon.h"
+#include "inputstr.h"
#include "quartz.h"
#include "darwin.h"
#include "darwinEvents.h"
@@ -231,17 +232,17 @@ RREditConnectionInfo (ScreenPtr pScreen)
#endif
/*
- * QuartzUpdateScreens
+ * QuartzDisplayChangeHandler
* Adjust for screen arrangement changes.
*/
-static void QuartzUpdateScreens(void)
+void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents)
{
ScreenPtr pScreen;
WindowPtr pRoot;
int x, y, width, height, sx, sy;
xEvent e;
- DEBUG_LOG("QuartzUpdateScreens()\n");
+ DEBUG_LOG("QuartzDisplayChangedHandler()\n");
if (noPseudoramiXExtension || screenInfo.numScreens != 1)
{
/* FIXME: if not using Xinerama, we have multiple screens, and
@@ -266,7 +267,7 @@ static void QuartzUpdateScreens(void)
#ifndef FAKE_RANDR
if(!QuartzRandRInit(pScreen))
- FatalError("Failed to init RandR extension.\n");
+ FatalError("Failed to init RandR extension.\n");
#endif
DarwinAdjustScreenOrigins(&screenInfo);
@@ -307,7 +308,7 @@ static void QuartzUpdateScreens(void)
* Calls mode specific screen resume to restore the X clip regions
* (if needed) and the X server cursor state.
*/
-static void QuartzShow(
+void QuartzShow(
int x, // cursor location
int y )
{
@@ -330,7 +331,7 @@ static void QuartzShow(
* hidden. Calls mode specific screen suspend to set X clip regions to
* prevent drawing (if needed) and restore the Aqua cursor.
*/
-static void QuartzHide(void)
+void QuartzHide(void)
{
int i;
@@ -349,7 +350,7 @@ static void QuartzHide(void)
* QuartzSetRootClip
* Enable or disable rendering to the X screen.
*/
-static void QuartzSetRootClip(
+void QuartzSetRootClip(
BOOL enable)
{
int i;
@@ -364,137 +365,11 @@ static void QuartzSetRootClip(
}
}
-
-/*
- * QuartzMessageServerThread
- * Send the X server thread a message by placing it on the event queue.
- */
-void
-QuartzMessageServerThread(
- int type,
- int argc, ...)
-{
- xEvent xe;
- INT32 *argv;
- int i, max_args;
- va_list args;
-
- memset(&xe, 0, sizeof(xe));
- xe.u.u.type = type;
- xe.u.clientMessage.u.l.type = type;
-
- argv = &xe.u.clientMessage.u.l.longs0;
- max_args = 4;
-
- if (argc > 0 && argc <= max_args) {
- va_start (args, argc);
- for (i = 0; i < argc; i++)
- argv[i] = (int) va_arg (args, int);
- va_end (args);
- }
-
- DarwinEQEnqueue(&xe);
-}
-
-
-/*
- * QuartzProcessEvent
- * Process Quartz specific events.
+/*
+ * QuartzSpaceChanged
+ * Unmap offscreen windows, map onscreen windows
*/
-void QuartzProcessEvent(xEvent *xe) {
- switch (xe->u.u.type) {
- case kXDarwinControllerNotify:
- DEBUG_LOG("kXDarwinControllerNotify\n");
- AppleWMSendEvent(AppleWMControllerNotify,
- AppleWMControllerNotifyMask,
- xe->u.clientMessage.u.l.longs0,
- xe->u.clientMessage.u.l.longs1);
- break;
-
- case kXDarwinPasteboardNotify:
- DEBUG_LOG("kXDarwinPasteboardNotify\n");
- AppleWMSendEvent(AppleWMPasteboardNotify,
- AppleWMPasteboardNotifyMask,
- xe->u.clientMessage.u.l.longs0,
- xe->u.clientMessage.u.l.longs1);
- break;
-
- case kXDarwinActivate:
- DEBUG_LOG("kXDarwinActivate\n");
- QuartzShow(xe->u.keyButtonPointer.rootX,
- xe->u.keyButtonPointer.rootY);
- AppleWMSendEvent(AppleWMActivationNotify,
- AppleWMActivationNotifyMask,
- AppleWMIsActive, 0);
- break;
-
- case kXDarwinDeactivate:
- DEBUG_LOG("kXDarwinDeactivate\n");
- AppleWMSendEvent(AppleWMActivationNotify,
- AppleWMActivationNotifyMask,
- AppleWMIsInactive, 0);
- QuartzHide();
- break;
-
- case kXDarwinDisplayChanged:
- DEBUG_LOG("kXDarwinDisplayChanged\n");
- QuartzUpdateScreens();
- break;
-
- case kXDarwinWindowState:
- DEBUG_LOG("kXDarwinWindowState\n");
- RootlessNativeWindowStateChanged(xe->u.clientMessage.u.l.longs0,
- xe->u.clientMessage.u.l.longs1);
- break;
-
- case kXDarwinWindowMoved:
- DEBUG_LOG("kXDarwinWindowMoved\n");
- RootlessNativeWindowMoved ((WindowPtr)xe->u.clientMessage.u.l.longs0);
- break;
-
- case kXDarwinToggleFullscreen:
- DEBUG_LOG("kXDarwinToggleFullscreen\n");
-#ifdef DARWIN_DDX_MISSING
- if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot);
- else if (quartzHasRoot) QuartzHide();
- else QuartzShow();
-#else
- // ErrorF("kXDarwinToggleFullscreen not implemented\n");
-#endif
- break;
-
- case kXDarwinSetRootless:
- DEBUG_LOG("kXDarwinSetRootless\n");
-#ifdef DARWIN_DDX_MISSING
- QuartzSetRootless(xe->u.clientMessage.u.l.longs0);
- if (!quartzEnableRootless && !quartzHasRoot) QuartzHide();
-#else
- // ErrorF("kXDarwinSetRootless not implemented\n");
-#endif
- break;
-
- case kXDarwinSetRootClip:
- QuartzSetRootClip((BOOL)xe->u.clientMessage.u.l.longs0);
- break;
-
- case kXDarwinQuit:
- GiveUp(0);
- break;
-
- case kXDarwinReadPasteboard:
- QuartzReadPasteboard();
- break;
-
- case kXDarwinWritePasteboard:
- QuartzWritePasteboard();
- break;
-
- case kXDarwinBringAllToFront:
- DEBUG_LOG("kXDarwinBringAllToFront\n");
- RootlessOrderAllWindows();
- break;
-
- default:
- ErrorF("Unknown application defined event type %d.\n", xe->u.u.type);
- }
+void QuartzSpaceChanged(uint32_t space_id) {
+ /* Do something special here, so we don't depend on quartz-wm for spaces to work... */
+ DEBUG_LOG("Space Changed (%u) ... do something interesting...\n", space_id);
}
diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h
index fbe308a92..ffe06f9c6 100644
--- a/hw/xquartz/quartz.h
+++ b/hw/xquartz/quartz.h
@@ -130,5 +130,5 @@ void QuartzInitOutput(int argc,char **argv);
void QuartzInitInput(int argc, char **argv);
void QuartzGiveUp(void);
void QuartzProcessEvent(xEvent *xe);
-
+void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
#endif
diff --git a/hw/xquartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m
index 53e3f0897..d8f9c69e4 100644
--- a/hw/xquartz/quartzCocoa.m
+++ b/hw/xquartz/quartzCocoa.m
@@ -37,13 +37,14 @@
#endif
#include "quartzCommon.h"
+#include "inputstr.h"
#include "quartzPasteboard.h"
#define BOOL xBOOL
#include "darwin.h"
-#undef BOOL
#include <Cocoa/Cocoa.h>
+#undef BOOL
#include "pseudoramiX.h"
diff --git a/hw/xquartz/quartzCommon.h b/hw/xquartz/quartzCommon.h
index a0d467389..c4bd2d803 100644
--- a/hw/xquartz/quartzCommon.h
+++ b/hw/xquartz/quartzCommon.h
@@ -68,6 +68,7 @@ extern int quartzEventWriteFD;
// User preferences used by Quartz modes
extern int quartzRootless;
extern int quartzUseSysBeep;
+extern int focusOnNewWindow;
extern int quartzUseAGL;
extern int quartzEnableKeyEquivalents;
@@ -91,17 +92,4 @@ int QuartzFSUseQDCursor(int depth);
void QuartzBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask);
void QuartzWakeupHandler(pointer blockData, int result, pointer pReadmask);
-// Messages that can be sent to the main thread.
-enum {
- kQuartzServerHidden,
- kQuartzServerStarted,
- kQuartzServerDied,
- kQuartzCursorUpdate,
- kQuartzPostEvent,
- kQuartzSetWindowMenu,
- kQuartzSetWindowMenuCheck,
- kQuartzSetFrontProcess,
- kQuartzSetCanQuit
-};
-
#endif /* _QUARTZCOMMON_H */
diff --git a/hw/xquartz/quartzCursor.c b/hw/xquartz/quartzCursor.c
deleted file mode 100644
index f82ccd380..000000000
--- a/hw/xquartz/quartzCursor.c
+++ /dev/null
@@ -1,646 +0,0 @@
-/**************************************************************
- *
- * Support for using the Quartz Window Manager cursor
- *
- * Copyright (c) 2001-2003 Torrey T. Lyons and Greg Parker.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "quartzCommon.h"
-#include "quartzCursor.h"
-#include "darwin.h"
-
-#include <pthread.h>
-
-#include "mi.h"
-#include "scrnintstr.h"
-#include "cursorstr.h"
-#include "mipointrst.h"
-#include "globals.h"
-
-// Size of the QuickDraw cursor
-#define CURSORWIDTH 16
-#define CURSORHEIGHT 16
-
-typedef struct {
- int qdCursorMode;
- int qdCursorVisible;
- int useQDCursor;
- QueryBestSizeProcPtr QueryBestSize;
- miPointerSpriteFuncPtr spriteFuncs;
-} QuartzCursorScreenRec, *QuartzCursorScreenPtr;
-
-static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey;
-static CursorPtr quartzLatentCursor = NULL;
-static QD_Cursor gQDArrow; // QuickDraw arrow cursor
-
-// Cursor for the main thread to set (NULL = arrow cursor).
-static CCrsrHandle currentCursor = NULL;
-static pthread_mutex_t cursorMutex;
-static pthread_cond_t cursorCondition;
-
-#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \
- dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey))
-
-#define HIDE_QD_CURSOR(pScreen, visible) \
- if (visible) { \
- int ix; \
- for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \
- CGDisplayHideCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \
- } \
- visible = FALSE; \
- } ((void)0)
-
-#define SHOW_QD_CURSOR(pScreen, visible) \
- { \
- int ix; \
- for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \
- CGDisplayShowCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \
- } \
- visible = TRUE; \
- } ((void)0)
-
-#define CHANGE_QD_CURSOR(cursorH) \
- if (!quartzServerQuitting) { \
- /* Acquire lock and tell the main thread to change cursor */ \
- pthread_mutex_lock(&cursorMutex); \
- currentCursor = (CCrsrHandle) (cursorH); \
- QuartzMessageMainThread(kQuartzCursorUpdate, NULL, 0); \
- \
- /* Wait for the main thread to change the cursor */ \
- pthread_cond_wait(&cursorCondition, &cursorMutex); \
- pthread_mutex_unlock(&cursorMutex); \
- } ((void)0)
-
-
-/*
- * MakeQDCursor helpers: CTAB_ENTER, interleave
- */
-
-// Add a color entry to a ctab
-#define CTAB_ENTER(ctab, index, r, g, b) \
- ctab->ctTable[index].value = index; \
- ctab->ctTable[index].rgb.red = r; \
- ctab->ctTable[index].rgb.green = g; \
- ctab->ctTable[index].rgb.blue = b
-
-// Make an unsigned short by interleaving the bits of bytes c1 and c2.
-// High bit of c1 is first; low bit of c2 is last.
-// Interleave is a built-in INTERCAL operator.
-static unsigned short
-interleave(
- unsigned char c1,
- unsigned char c2 )
-{
- return
- ((c1 & 0x80) << 8) | ((c2 & 0x80) << 7) |
- ((c1 & 0x40) << 7) | ((c2 & 0x40) << 6) |
- ((c1 & 0x20) << 6) | ((c2 & 0x20) << 5) |
- ((c1 & 0x10) << 5) | ((c2 & 0x10) << 4) |
- ((c1 & 0x08) << 4) | ((c2 & 0x08) << 3) |
- ((c1 & 0x04) << 3) | ((c2 & 0x04) << 2) |
- ((c1 & 0x02) << 2) | ((c2 & 0x02) << 1) |
- ((c1 & 0x01) << 1) | ((c2 & 0x01) << 0) ;
-}
-
-/*
- * MakeQDCursor
- * Make a QuickDraw color cursor from the given X11 cursor.
- * Warning: This code is nasty. Color cursors were meant to be read
- * from resources; constructing the structures programmatically is messy.
- */
-/*
- QuickDraw cursor representation:
- Our color cursor is a 2 bit per pixel pixmap.
- Each pixel's bits are (source<<1 | mask) from the original X cursor pixel.
- The cursor's color table maps the colors like this:
- (2-bit value | X result | colortable | Mac result)
- 00 | transparent | white | transparent (white outside mask)
- 01 | back color | back color | back color
- 10 | undefined | black | invert background (just for fun)
- 11 | fore color | fore color | fore color
-*/
-static CCrsrHandle
-MakeQDCursor(
- CursorPtr pCursor )
-{
- CCrsrHandle result;
- CCrsrPtr curs;
- int i, w, h;
- unsigned short rowMask;
- PixMap *pix;
- ColorTable *ctab;
- unsigned short *image;
-
- result = (CCrsrHandle) NewHandleClear(sizeof(CCrsr));
- if (!result) return NULL;
- HLock((Handle)result);
- curs = *result;
-
- // Initialize CCrsr
- curs->crsrType = 0x8001; // 0x8000 = b&w, 0x8001 = color
- curs->crsrMap = (PixMapHandle) NewHandleClear(sizeof(PixMap));
- if (!curs->crsrMap) goto pixAllocFailed;
- HLock((Handle)curs->crsrMap);
- pix = *curs->crsrMap;
- curs->crsrData = NULL; // raw cursor image data (set below)
- curs->crsrXData = NULL; // QD's processed data
- curs->crsrXValid = 0; // zero means QD must re-process cursor data
- curs->crsrXHandle = NULL; // reserved
- memset(curs->crsr1Data, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w data
- memset(curs->crsrMask, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w & color mask
- curs->crsrHotSpot.h = min(CURSORWIDTH, pCursor->bits->xhot); // hot spot
- curs->crsrHotSpot.v = min(CURSORHEIGHT, pCursor->bits->yhot); // hot spot
- curs->crsrXTable = 0; // reserved
- curs->crsrID = GetCTSeed(); // unique ID from Color Manager
-
- // Set the b&w data and mask
- w = min(pCursor->bits->width, CURSORWIDTH);
- h = min(pCursor->bits->height, CURSORHEIGHT);
- rowMask = ~((1 << (CURSORWIDTH - w)) - 1);
- for (i = 0; i < h; i++) {
- curs->crsr1Data[i] = rowMask &
- ((pCursor->bits->source[i*4]<<8) | pCursor->bits->source[i*4+1]);
- curs->crsrMask[i] = rowMask &
- ((pCursor->bits->mask[i*4]<<8) | pCursor->bits->mask[i*4+1]);
- }
-
- // Set the color data and mask
- // crsrMap: defines bit depth and size and colortable only
- pix->rowBytes = (CURSORWIDTH * 2 / 8) | 0x8000; // last bit on means PixMap
- SetRect(&pix->bounds, 0, 0, CURSORWIDTH, CURSORHEIGHT); // see TN 1020
- pix->pixelSize = 2;
- pix->cmpCount = 1;
- pix->cmpSize = 2;
- // pix->pmTable set below
-
- // crsrData is the pixel data. crsrMap's baseAddr is not used.
- curs->crsrData = NewHandleClear(CURSORWIDTH*CURSORHEIGHT * 2 / 8);
- if (!curs->crsrData) goto imageAllocFailed;
- HLock((Handle)curs->crsrData);
- image = (unsigned short *) *curs->crsrData;
- // Pixel data is just 1-bit data and mask interleaved (see above)
- for (i = 0; i < h; i++) {
- unsigned char s, m;
- s = pCursor->bits->source[i*4] & (rowMask >> 8);
- m = pCursor->bits->mask[i*4] & (rowMask >> 8);
- image[2*i] = interleave(s, m);
- s = pCursor->bits->source[i*4+1] & (rowMask & 0x00ff);
- m = pCursor->bits->mask[i*4+1] & (rowMask & 0x00ff);
- image[2*i+1] = interleave(s, m);
- }
-
- // Build the color table (entries described above)
- // NewPixMap allocates a color table handle.
- pix->pmTable = (CTabHandle) NewHandleClear(sizeof(ColorTable) + 3
- * sizeof(ColorSpec));
- if (!pix->pmTable) goto ctabAllocFailed;
- HLock((Handle)pix->pmTable);
- ctab = *pix->pmTable;
- ctab->ctSeed = GetCTSeed();
- ctab->ctFlags = 0;
- ctab->ctSize = 3; // color count - 1
- CTAB_ENTER(ctab, 0, 0xffff, 0xffff, 0xffff);
- CTAB_ENTER(ctab, 1, pCursor->backRed, pCursor->backGreen,
- pCursor->backBlue);
- CTAB_ENTER(ctab, 2, 0x0000, 0x0000, 0x0000);
- CTAB_ENTER(ctab, 3, pCursor->foreRed, pCursor->foreGreen,
- pCursor->foreBlue);
-
- HUnlock((Handle)pix->pmTable); // ctab
- HUnlock((Handle)curs->crsrData); // image data
- HUnlock((Handle)curs->crsrMap); // pix
- HUnlock((Handle)result); // cursor
-
- return result;
-
- // "What we have here is a failure to allocate"
-ctabAllocFailed:
- HUnlock((Handle)curs->crsrData);
- DisposeHandle((Handle)curs->crsrData);
-imageAllocFailed:
- HUnlock((Handle)curs->crsrMap);
- DisposeHandle((Handle)curs->crsrMap);
-pixAllocFailed:
- HUnlock((Handle)result);
- DisposeHandle((Handle)result);
- return NULL;
-}
-
-
-/*
- * FreeQDCursor
- * Destroy a QuickDraw color cursor created with MakeQDCursor().
- * The cursor must not currently be on screen.
- */
-static void FreeQDCursor(CCrsrHandle cursHandle)
-{
- CCrsrPtr curs;
- PixMap *pix;
-
- HLock((Handle)cursHandle);
- curs = *cursHandle;
- HLock((Handle)curs->crsrMap);
- pix = *curs->crsrMap;
- DisposeHandle((Handle)pix->pmTable);
- HUnlock((Handle)curs->crsrMap);
- DisposeHandle((Handle)curs->crsrMap);
- DisposeHandle((Handle)curs->crsrData);
- HUnlock((Handle)cursHandle);
- DisposeHandle((Handle)cursHandle);
-}
-
-
-/*
-===========================================================================
-
- Pointer sprite functions
-
-===========================================================================
-*/
-
-/*
- * QuartzRealizeCursor
- * Convert the X cursor representation to QuickDraw format if possible.
- */
-Bool
-QuartzRealizeCursor(
- ScreenPtr pScreen,
- CursorPtr pCursor )
-{
- CCrsrHandle qdCursor;
- QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
-
- if(!pCursor || !pCursor->bits)
- return FALSE;
-
- // if the cursor is too big we use a software cursor
- if ((pCursor->bits->height > CURSORHEIGHT) ||
- (pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor)
- {
- if (quartzRootless) {
- // rootless can't use a software cursor
- return TRUE;
- } else {
- return (*ScreenPriv->spriteFuncs->RealizeCursor)
- (pScreen, pCursor);
- }
- }
-
- // make new cursor image
- qdCursor = MakeQDCursor(pCursor);
- if (!qdCursor) return FALSE;
-
- // save the result
- dixSetPrivate(&pCursor->devPrivates, pScreen, qdCursor);
-
- return TRUE;
-}
-
-
-/*
- * QuartzUnrealizeCursor
- * Free the storage space associated with a realized cursor.
- */
-Bool
-QuartzUnrealizeCursor(
- ScreenPtr pScreen,
- CursorPtr pCursor )
-{
- QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
-
- if ((pCursor->bits->height > CURSORHEIGHT) ||
- (pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor)
- {
- if (quartzRootless) {
- return TRUE;
- } else {
- return (*ScreenPriv->spriteFuncs->UnrealizeCursor)
- (pScreen, pCursor);
- }
- } else {
- CCrsrHandle oldCursor = dixLookupPrivate(&pCursor->devPrivates,
- pScreen);
- if (currentCursor != oldCursor) {
- // This should only fail when quitting, in which case we just leak.
- FreeQDCursor(oldCursor);
- }
- dixSetPrivate(&pCursor->devPrivates, pScreen, NULL);
- return TRUE;
- }
-}
-
-
-/*
- * QuartzSetCursor
- * Set the cursor sprite and position.
- * Use QuickDraw cursor if possible.
- */
-static void
-QuartzSetCursor(
- ScreenPtr pScreen,
- CursorPtr pCursor,
- int x,
- int y)
-{
- QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
-
- quartzLatentCursor = pCursor;
-
- // Don't touch Mac OS cursor if X is hidden!
- if (!quartzServerVisible)
- return;
-
- if (!pCursor) {
- // Remove the cursor completely.
- HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
- if (! ScreenPriv->qdCursorMode)
- (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y);
- }
- else if ((pCursor->bits->height <= CURSORHEIGHT) &&
- (pCursor->bits->width <= CURSORWIDTH) && ScreenPriv->useQDCursor)
- {
- // Cursor is small enough to use QuickDraw directly.
- if (! ScreenPriv->qdCursorMode) // remove the X cursor
- (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y);
- ScreenPriv->qdCursorMode = TRUE;
-
- CHANGE_QD_CURSOR(dixLookupPrivate(&pCursor->devPrivates, pScreen));
- SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
- }
- else if (quartzRootless) {
- // Rootless can't use a software cursor, so we just use Mac OS arrow.
- CHANGE_QD_CURSOR(NULL);
- SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
- }
- else {
- // Cursor is too big for QuickDraw. Use X software cursor.
- HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
- ScreenPriv->qdCursorMode = FALSE;
- (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCursor, x, y);
- }
-}
-
-
-/*
- * QuartzReallySetCursor
- * Set the QuickDraw cursor. Called from the main thread since changing the
- * cursor with QuickDraw is not thread safe on dual processor machines.
- */
-void
-QuartzReallySetCursor()
-{
- pthread_mutex_lock(&cursorMutex);
-
- if (currentCursor) {
- SetCCursor(currentCursor);
- } else {
- SetCursor(&gQDArrow);
- }
-
- pthread_cond_signal(&cursorCondition);
- pthread_mutex_unlock(&cursorMutex);
-}
-
-
-/*
- * QuartzMoveCursor
- * Move the cursor. This is a noop for QuickDraw.
- */
-static void
-QuartzMoveCursor(
- ScreenPtr pScreen,
- int x,
- int y)
-{
- QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
-
- // only the X cursor needs to be explicitly moved
- if (!ScreenPriv->qdCursorMode)
- (*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y);
-}
-
-
-static miPointerSpriteFuncRec quartzSpriteFuncsRec = {
- QuartzRealizeCursor,
- QuartzUnrealizeCursor,
- QuartzSetCursor,
- QuartzMoveCursor
-};
-
-
-/*
-===========================================================================
-
- Pointer screen functions
-
-===========================================================================
-*/
-
-/*
- * QuartzCursorOffScreen
- */
-static Bool QuartzCursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
-{
- return FALSE;
-}
-
-
-/*
- * QuartzCrossScreen
- */
-static void QuartzCrossScreen(ScreenPtr pScreen, Bool entering)
-{
- return;
-}
-
-
-/*
- * QuartzWarpCursor
- * Change the cursor position without generating an event or motion history.
- * The input coordinates (x,y) are in pScreen-local X11 coordinates.
- *
- */
-static void
-QuartzWarpCursor(
- ScreenPtr pScreen,
- int x,
- int y)
-{
- static int neverMoved = TRUE;
-
- if (neverMoved) {
- // Don't move the cursor the first time. This is the jump-to-center
- // initialization, and it's annoying because we may still be in MacOS.
- neverMoved = FALSE;
- return;
- }
-
- if (quartzServerVisible) {
- CGDisplayErr cgErr;
- CGPoint cgPoint;
- // Only need to do this for one display. Any display will do.
- CGDirectDisplayID cgID = QUARTZ_PRIV(pScreen)->displayIDs[0];
- CGRect cgRect = CGDisplayBounds(cgID);
-
- // Convert (x,y) to CoreGraphics screen-local CG coordinates.
- // This is necessary because the X11 screen and CG screen may not
- // coincide. (e.g. X11 screen may be moved to dodge the menu bar)
-
- // Make point in X11 global coordinates
- cgPoint = CGPointMake(x + dixScreenOrigins[pScreen->myNum].x,
- y + dixScreenOrigins[pScreen->myNum].y);
- // Shift to CoreGraphics global screen coordinates
- cgPoint.x += darwinMainScreenX;
- cgPoint.y += darwinMainScreenY;
- // Shift to CoreGraphics screen-local coordinates
- cgPoint.x -= cgRect.origin.x;
- cgPoint.y -= cgRect.origin.y;
-
- cgErr = CGDisplayMoveCursorToPoint(cgID, cgPoint);
- if (cgErr != CGDisplayNoErr) {
- ErrorF("Could not set cursor position with error code 0x%x.\n",
- cgErr);
- }
- }
-
- miPointerWarpCursor(pScreen, x, y);
- miPointerUpdate();
-}
-
-
-static miPointerScreenFuncRec quartzScreenFuncsRec = {
- QuartzCursorOffScreen,
- QuartzCrossScreen,
- QuartzWarpCursor,
- DarwinEQPointerPost,
- DarwinEQSwitchScreen
-};
-
-
-/*
-===========================================================================
-
- Other screen functions
-
-===========================================================================
-*/
-
-/*
- * QuartzCursorQueryBestSize
- * Handle queries for best cursor size
- */
-static void
-QuartzCursorQueryBestSize(
- int class,
- unsigned short *width,
- unsigned short *height,
- ScreenPtr pScreen)
-{
- QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
-
- if (class == CursorShape) {
- *width = CURSORWIDTH;
- *height = CURSORHEIGHT;
- } else {
- (*ScreenPriv->QueryBestSize)(class, width, height, pScreen);
- }
-}
-
-
-/*
- * QuartzInitCursor
- * Initialize cursor support
- */
-Bool
-QuartzInitCursor(
- ScreenPtr pScreen )
-{
- QuartzCursorScreenPtr ScreenPriv;
- miPointerScreenPtr PointPriv;
- DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen);
-
- // initialize software cursor handling (always needed as backup)
- if (!miDCInitialize(pScreen, &quartzScreenFuncsRec)) {
- return FALSE;
- }
-
- ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) );
- if (!ScreenPriv) return FALSE;
-
- CURSOR_PRIV(pScreen) = ScreenPriv;
-
- // override some screen procedures
- ScreenPriv->QueryBestSize = pScreen->QueryBestSize;
- pScreen->QueryBestSize = QuartzCursorQueryBestSize;
-
- // initialize QuickDraw cursor handling
- GetQDGlobalsArrow(&gQDArrow);
- PointPriv = (miPointerScreenPtr)
- dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
-
- ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
- PointPriv->spriteFuncs = &quartzSpriteFuncsRec;
-
- if (!quartzRootless)
- ScreenPriv->useQDCursor = QuartzFSUseQDCursor(dfb->colorBitsPerPixel);
- else
- ScreenPriv->useQDCursor = TRUE;
- ScreenPriv->qdCursorMode = TRUE;
- ScreenPriv->qdCursorVisible = TRUE;
-
- // initialize cursor mutex lock
- pthread_mutex_init(&cursorMutex, NULL);
-
- // initialize condition for waiting
- pthread_cond_init(&cursorCondition, NULL);
-
- return TRUE;
-}
-
-
-// X server is hiding. Restore the Aqua cursor.
-void QuartzSuspendXCursor(
- ScreenPtr pScreen )
-{
- QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
-
- CHANGE_QD_CURSOR(NULL);
- SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
-}
-
-
-// X server is showing. Restore the X cursor.
-void QuartzResumeXCursor(
- ScreenPtr pScreen,
- int x,
- int y )
-{
- QuartzSetCursor(pScreen, quartzLatentCursor, x, y);
-}
diff --git a/hw/xquartz/quartzCursor.h b/hw/xquartz/quartzCursor.h
deleted file mode 100644
index 56a02098d..000000000
--- a/hw/xquartz/quartzCursor.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * quartzCursor.h
- *
- * External interface for Quartz hardware cursor
- *
- * Copyright (c) 2001 Torrey T. Lyons and Greg Parker.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifndef QUARTZCURSOR_H
-#define QUARTZCURSOR_H
-
-#include "screenint.h"
-
-Bool QuartzInitCursor(ScreenPtr pScreen);
-void QuartzReallySetCursor(void);
-void QuartzSuspendXCursor(ScreenPtr pScreen);
-void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y);
-
-#endif
diff --git a/hw/xquartz/quartzForeground.c b/hw/xquartz/quartzForeground.c
index 0e724de76..80a04a13b 100644
--- a/hw/xquartz/quartzForeground.c
+++ b/hw/xquartz/quartzForeground.c
@@ -38,7 +38,7 @@ int QuartzMoveToForeground() {
ProcessSerialNumber psn = { 0, kCurrentProcess };
OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication);
if( returnCode == 0) {
- fprintf(stderr, "TransformProcessType: Success\n");
+ /* fprintf(stderr, "TransformProcessType: Success\n"); */
SetFrontProcess(&psn);
} else {
fprintf(stderr, "TransformProcessType: Failure\n");
diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h
index 0c7e70e48..4f495bb46 100644
--- a/hw/xquartz/quartzKeyboard.h
+++ b/hw/xquartz/quartzKeyboard.h
@@ -45,8 +45,7 @@ typedef struct darwinKeyboardInfo_struct {
unsigned char modifierKeycodes[32][2];
} darwinKeyboardInfo;
-/* These functions need to be implemented by XQuartz, XDarwin, etc. */
-void DarwinKeyboardReload(DeviceIntPtr pDev);
+/* These functions need to be implemented by Xquartz, XDarwin, etc. */
Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info);
unsigned int QuartzSystemKeymapSeed(void);
diff --git a/hw/xquartz/quartzPasteboard.c b/hw/xquartz/quartzPasteboard.c
index 0cecff54a..d47047ce0 100644
--- a/hw/xquartz/quartzPasteboard.c
+++ b/hw/xquartz/quartzPasteboard.c
@@ -34,6 +34,8 @@
#include <dix-config.h>
#endif
+#include "misc.h"
+#include "inputstr.h"
#include "quartzPasteboard.h"
#include <X11/Xatom.h>
@@ -43,9 +45,6 @@
#include "selection.h"
#include "globals.h"
-extern Selection *CurrentSelections;
-extern int NumCurrentSelections;
-
// Helper function to read the X11 cut buffer
// FIXME: What about multiple screens? Currently, this reads the first
@@ -54,18 +53,16 @@ extern int NumCurrentSelections;
// Returns NULL if there is no cut text or there is not enough memory.
static char * QuartzReadCutBuffer(void)
{
- int i;
+ int rc, i;
char *text = NULL;
for (i = 0; i < screenInfo.numScreens; i++) {
ScreenPtr pScreen = screenInfo.screens[i];
PropertyPtr pProp;
- pProp = wUserProps (WindowTable[pScreen->myNum]);
- while (pProp && pProp->propertyName != XA_CUT_BUFFER0) {
- pProp = pProp->next;
- }
- if (! pProp) continue;
+ rc = dixLookupProperty(&pProp, WindowTable[pScreen->myNum],
+ XA_CUT_BUFFER0, serverClient, DixReadAccess);
+ if (rc != Success) continue;
if (pProp->type != XA_STRING) continue;
if (pProp->format != 8) continue;
@@ -81,8 +78,8 @@ static char * QuartzReadCutBuffer(void)
}
// Write X cut buffer to Mac OS X pasteboard
-// Called by ProcessInputEvents() in response to request from X server thread.
-void QuartzWritePasteboard(void)
+// Called by mieqProcessInputEvents() in response to request from X server thread.
+void QuartzWritePasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents)
{
char *text;
text = QuartzReadCutBuffer();
@@ -95,8 +92,8 @@ void QuartzWritePasteboard(void)
#define strequal(a, b) (0 == strcmp((a), (b)))
// Read Mac OS X pasteboard into X cut buffer
-// Called by ProcessInputEvents() in response to request from X server thread.
-void QuartzReadPasteboard(void)
+// Called by mieqProcessInputEvents() in response to request from X server thread.
+void QuartzReadPasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents)
{
char *oldText = QuartzReadCutBuffer();
char *text = QuartzReadCocoaPasteboard();
@@ -108,43 +105,40 @@ void QuartzReadPasteboard(void)
if ((text && oldText && !strequal(text, oldText)) ||
(text && !oldText)) {
- int scrn, sel;
+ int scrn, rc;
+ Selection *pSel;
for (scrn = 0; scrn < screenInfo.numScreens; scrn++) {
ScreenPtr pScreen = screenInfo.screens[scrn];
// Set the cut buffers on each screen
// fixme really on each screen?
- ChangeWindowProperty(WindowTable[pScreen->myNum], XA_CUT_BUFFER0,
- XA_STRING, 8, PropModeReplace,
- strlen(text), (pointer)text, TRUE);
+ dixChangeWindowProperty(serverClient, WindowTable[pScreen->myNum],
+ XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace,
+ strlen(text), (pointer)text, TRUE);
}
// Undo any current X selection (similar to code in dispatch.c)
// FIXME: what about secondary selection?
// FIXME: only touch first XA_PRIMARY selection?
- sel = 0;
- while ((sel < NumCurrentSelections) &&
- CurrentSelections[sel].selection != XA_PRIMARY)
- sel++;
- if (sel < NumCurrentSelections) {
+ rc = dixLookupSelection(&pSel, XA_PRIMARY, serverClient,
+ DixSetAttrAccess);
+ if (rc == Success) {
// Notify client if necessary
- if (CurrentSelections[sel].client) {
+ if (pSel->client) {
xEvent event;
event.u.u.type = SelectionClear;
event.u.selectionClear.time = GetTimeInMillis();
- event.u.selectionClear.window = CurrentSelections[sel].window;
- event.u.selectionClear.atom = CurrentSelections[sel].selection;
- TryClientEvents(CurrentSelections[sel].client, &event, 1,
- NoEventMask, NoEventMask /*CantBeFiltered*/,
- NullGrab);
+ event.u.selectionClear.window = pSel->window;
+ event.u.selectionClear.atom = pSel->selection;
+ TryClientEvents(pSel->client, &event, 1, NoEventMask,
+ NoEventMask /*CantBeFiltered*/, NullGrab);
}
// Erase it
- // FIXME: need to erase .selection too? dispatch.c doesn't
- CurrentSelections[sel].pWin = NullWindow;
- CurrentSelections[sel].window = None;
- CurrentSelections[sel].client = NullClient;
+ pSel->pWin = NullWindow;
+ pSel->window = None;
+ pSel->client = NullClient;
}
}
diff --git a/hw/xquartz/quartzPasteboard.h b/hw/xquartz/quartzPasteboard.h
index d6a8ee815..b51cd88e0 100644
--- a/hw/xquartz/quartzPasteboard.h
+++ b/hw/xquartz/quartzPasteboard.h
@@ -34,11 +34,11 @@
#define _QUARTZPASTEBOARD_H
// Aqua->X
-void QuartzReadPasteboard(void);
+void QuartzReadPasteboard(int, xEventPtr, DeviceIntPtr, int);
char * QuartzReadCocoaPasteboard(void); // caller must free string
// X->Aqua
-void QuartzWritePasteboard(void);
+void QuartzWritePasteboard(int, xEventPtr, DeviceIntPtr, int);
void QuartzWriteCocoaPasteboard(char *text);
#endif /* _QUARTZPASTEBOARD_H */
diff --git a/hw/xquartz/xpr/Makefile.am b/hw/xquartz/xpr/Makefile.am
index ae1b19297..b4d67c7b7 100644
--- a/hw/xquartz/xpr/Makefile.am
+++ b/hw/xquartz/xpr/Makefile.am
@@ -4,8 +4,7 @@ AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
AM_CPPFLAGS = \
-I$(srcdir) -I$(srcdir)/.. \
-I$(top_srcdir)/miext \
- -I$(top_srcdir)/miext/rootless \
- -I$(top_srcdir)/miext/rootless/safeAlpha
+ -I$(top_srcdir)/miext/rootless
Xquartz_SOURCES = \
appledri.c \
@@ -41,7 +40,6 @@ Xquartz_LDADD = \
$(top_builddir)/record/librecord.la \
$(top_builddir)/XTrap/libxtrap.la \
$(top_builddir)/miext/rootless/librootless.la \
- $(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
$(top_builddir)/miext/rootless/accel/librlAccel.la \
$(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin
diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c
index e084ef90e..2ad8d6f56 100644
--- a/hw/xquartz/xpr/xprCursor.c
+++ b/hw/xquartz/xpr/xprCursor.c
@@ -320,8 +320,8 @@ static miPointerScreenFuncRec quartzScreenFuncsRec = {
QuartzCursorOffScreen,
QuartzCrossScreen,
QuartzWarpCursor,
- DarwinEQPointerPost,
- DarwinEQSwitchScreen
+ NULL,
+ NULL
};
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index b9a33de90..864ef0d40 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -90,8 +90,8 @@ xprSetNativeProperty(RootlessWindowPtr pFrame)
/* FIXME: move this to AppleWM extension */
data = native_id;
- ChangeWindowProperty(pFrame->win, xa_native_window_id(),
- XA_INTEGER, 32, PropModeReplace, 1, &data, TRUE);
+ dixChangeWindowProperty(serverClient, pFrame->win, xa_native_window_id(),
+ XA_INTEGER, 32, PropModeReplace, 1, &data, TRUE);
}
}
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index e4e1fda7e..d685fca33 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -32,12 +32,12 @@
#endif
#include "quartzCommon.h"
+#include "inputstr.h"
#include "quartz.h"
#include "xpr.h"
#include "pseudoramiX.h"
#include "darwin.h"
#include "rootless.h"
-#include "safeAlpha/safeAlpha.h"
#include "dri.h"
#include "globals.h"
#include "Xplugin.h"
@@ -64,10 +64,11 @@ static const char *xprOpenGLBundle = "glxCGL.bundle";
*/
static void eventHandler(unsigned int type, const void *arg,
unsigned int arg_size, void *data) {
+
switch (type) {
case XP_EVENT_DISPLAY_CHANGED:
DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n");
- QuartzMessageServerThread(kXDarwinDisplayChanged, 0);
+ DarwinSendDDXEvent(kXquartzDisplayChanged, 0);
break;
case XP_EVENT_WINDOW_STATE_CHANGED:
@@ -75,7 +76,7 @@ static void eventHandler(unsigned int type, const void *arg,
const xp_window_state_event *ws_arg = arg;
DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", ws_arg->id, ws_arg->state);
- QuartzMessageServerThread(kXDarwinWindowState, 2,
+ DarwinSendDDXEvent(kXquartzWindowState, 2,
ws_arg->id, ws_arg->state);
} else {
DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n");
@@ -87,7 +88,7 @@ static void eventHandler(unsigned int type, const void *arg,
if (arg_size == sizeof(xp_window_id)) {
xp_window_id id = * (xp_window_id *) arg;
WindowPtr pWin = xprGetXWindow(id);
- QuartzMessageServerThread(kXDarwinWindowMoved, 1, pWin);
+ DarwinSendDDXEvent(kXquartzWindowMoved, 1, pWin);
}
break;
@@ -106,6 +107,13 @@ static void eventHandler(unsigned int type, const void *arg,
DRISurfaceNotify(*(xp_surface_id *) arg, kind);
}
break;
+ case XP_EVENT_SPACE_CHANGED:
+ DEBUG_LOG("XP_EVENT_SPACE_CHANGED\n");
+ if(arg_size == sizeof(uint32_t)) {
+ uint32_t space_id = *(uint32_t *)arg;
+ DarwinSendDDXEvent(kXquartzSpaceChanged, 1, space_id);
+ }
+ break;
default:
ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type);
}
@@ -234,7 +242,8 @@ xprDisplayInit(void)
| XP_EVENT_WINDOW_STATE_CHANGED
| XP_EVENT_WINDOW_MOVED
| XP_EVENT_SURFACE_CHANGED
- | XP_EVENT_SURFACE_DESTROYED,
+ | XP_EVENT_SURFACE_DESTROYED
+ | XP_EVENT_SPACE_CHANGED,
eventHandler, NULL);
AppleDRIExtensionInit();
@@ -341,15 +350,6 @@ xprAddScreen(int index, ScreenPtr pScreen)
static Bool
xprSetupScreen(int index, ScreenPtr pScreen)
{
- // Add alpha protecting replacements for fb screen functions
-
-#ifdef RENDER
- {
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- ps->Composite = SafeAlphaComposite;
- }
-#endif /* RENDER */
-
// Initialize accelerated rootless drawing
// Note that this must be done before DamageSetup().
RootlessAccelInit(pScreen);
diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c
index 4b4cd3ded..6f4e2c97e 100755
--- a/hw/xwin/winwin32rootless.c
+++ b/hw/xwin/winwin32rootless.c
@@ -1087,6 +1087,6 @@ winMWExtWMSetNativeProperty (RootlessWindowPtr pFrame)
/* FIXME: move this to WindowsWM extension */
lData = (long) pRLWinPriv->hWnd;
- ChangeWindowProperty (pFrame->win, AtmWindowsWmNativeHwnd (),
- XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE);
+ dixChangeWindowProperty(serverClient, pFrame->win, AtmWindowsWmNativeHwnd(),
+ XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE);
}