xserver: Branch 'orib-soc-2006' - 2 commits
Ori Bernstein
orib at kemper.freedesktop.org
Sat Aug 12 23:36:57 EEST 2006
configure.ac | 16 +++
hw/Makefile.am | 9 +-
hw/xnest/Events.c | 40 +++++++--
hw/xnest/Handlers.c | 15 ++-
hw/xnest/Window.c | 61 ++-------------
hw/xnest/WindowFuncs.c | 194 ++++++++++++++++++++++++++++++++++++++++++------
hw/xnest/WindowFuncs.h | 7 +
hw/xscreen/Makefile.am | 20 ++++
hw/xscreen/xs-globals.c | 4
hw/xscreen/xs-globals.h | 1
hw/xscreen/xs-init.c | 117 ++++++++++++++++++++++++++++
hw/xscreen/xs-input.c | 56 +++++++++++++
hw/xscreen/xs-screen.c | 31 +++++++
hw/xscreen/xs-screen.h | 6 +
include/scrnintstr.h | 3
15 files changed, 483 insertions(+), 97 deletions(-)
New commits:
diff-tree dbacc8aa06ab3e738b306f44a76082ea2a282bd6 (from 4b7f0b3dbb4bb0c51c2a9a65eadadfad37bff252)
Author: Ori Bernstein <rand.chars at gmail.com>
Date: Sat Aug 12 16:39:55 2006 -0500
Autofooery and stubbing out of 2nd attemt at Xscreen.
diff --git a/configure.ac b/configure.ac
index 53edbd3..301cec4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -429,6 +429,7 @@ AC_ARG_ENABLE(xorg, AS_HELP_ST
AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto])
AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
+AC_ARG_ENABLE(xscreen, AS_HELP_STRING([--enable-xnest], [Build Xscreen server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
AC_ARG_ENABLE(xprint, AS_HELP_STRING([--enable-xprint], [Build Xprint extension and server (default: auto)]), [XPRINT=$enableval], [XPRINT=auto])
AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no])
@@ -945,6 +946,20 @@ if test "x$XNEST" = xyes; then
AC_SUBST([XNEST_LIBS])
fi
+dnl Xscreen DDX
+
+AC_MSG_CHECKING([whether to build Xscreen DDX])
+PKG_CHECK_MODULES(XSCREENMODULES, [xfont xext xau xcb xcb-shape xcb-image xcb-aux xcb-icccm $XDMCP_MODULES], [have_xscreen=yes], [have_xscreen=no])
+if test "x$XSCREEN" = xauto; then
+ XSCREEN="$have_xscreen"
+fi
+AC_MSG_RESULT([$XSCREEN])
+AM_CONDITIONAL(XSCREEN, [test "x$XSCREEN" = xyes])
+
+if test "x$XSCREEN" = xyes; then
+ XSCREEN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
+ AC_SUBST([XSCREEN_LIBS])
+fi
dnl Xorg DDX
@@ -1704,6 +1719,7 @@ hw/xgl/glx/module/Makefile
hw/xgl/glxext/Makefile
hw/xgl/glxext/module/Makefile
hw/xnest/Makefile
+hw/xscreen/Makefile
hw/xwin/Makefile
hw/darwin/Makefile
hw/kdrive/Makefile
diff --git a/hw/Makefile.am b/hw/Makefile.am
index 4c35a58..ee236b4 100644
--- a/hw/Makefile.am
+++ b/hw/Makefile.am
@@ -14,6 +14,10 @@ if XNEST
XNEST_SUBDIRS = xnest
endif
+if XNEST
+XSCREEN_SUBDIRS = xscreen
+endif
+
if XWIN
XWIN_SUBDIRS = xwin
endif
@@ -34,8 +38,9 @@ SUBDIRS = \
$(XWIN_SUBDIRS) \
$(XVFB_SUBDIRS) \
$(XNEST_SUBDIRS) \
- $(DMX_SUBDIRS) \
- $(KDRIVE_SUBDIRS)
+ $(XSCREEN_SUBDIRS) \
+ $(DMX_SUBDIRS) \
+ $(KDRIVE_SUBDIRS)
DIST_SUBDIRS = dmx xfree86 vfb xnest xwin darwin kdrive xgl
diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index e910a1e..7533a14 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -233,6 +233,15 @@ void xnestHandleEvent(XCBGenericEvent *e
cev = (XCBConfigureNotifyEvent *)e;
pWin = xnestWindowPtr(cev->window);
pSib = xnestWindowPtr(cev->above_sibling);
+
+ xscreenHandleConfigure(pWin, pSib ? xnestWindow(pSib).xid : 0,
+ cev->x, cev->y,
+ cev->width, cev->height);
+ break;
+#if 0
+ cev = (XCBConfigureNotifyEvent *)e;
+ pWin = xnestWindowPtr(cev->window);
+ pSib = xnestWindowPtr(cev->above_sibling);
pParent = pWin->parent;
pScreen = pWin->drawable.pScreen;
@@ -250,6 +259,9 @@ void xnestHandleEvent(XCBGenericEvent *e
cfg_data[i++] = 0;
ConfigureWindow(pWin, cfg_mask, cfg_data, wClient(pWin));
break;
+#endif
+
+#if 0
case XCBReparentNotify:
/*Reparent windows. This is to track non-xscreen managed windows and their
* relationship to xscreen managed windows. It should be harmless to poke at
@@ -260,12 +272,13 @@ void xnestHandleEvent(XCBGenericEvent *e
pWin = xnestWindowPtr(ev_reparent->window);
ErrorF("ReparentNotify\n");
- DBG_xnestListWindows(XCBSetupRootsIter (XCBGetSetup (xnestConnection)).data->root);
ErrorF("Reparenting %d to %d\n", (int) ev_reparent->window.xid, (int)ev_reparent->parent.xid);
/*we'll assume the root can't be reparented, and as such, pParent is _always_ valid*/
xnestReparentWindow(pWin, pParent, ev_reparent->x, ev_reparent->y, wClient(pWin));
- break;
+ //DBG_xnestListWindows(XCBSetupRootsIter(XCBGetSetup (xnestConnection)).data->root);
+ break;
+#endif
case XCBCreateNotify:
ev_create = (XCBCreateNotifyEvent *)e;
pParent = xnestWindowPtr(ev_create->parent);
@@ -275,7 +288,7 @@ void xnestHandleEvent(XCBGenericEvent *e
ErrorF("Adding new window\n");
/*track window*/
- pWin = xnestTrackWindow(ev_create->window,
+ pWin = xscreenTrackWindow(ev_create->window,
pParent, /*parent WindowPtr*/
ev_create->x, ev_create->y, /*x, y*/
ev_create->width, ev_create->height,/*w, h*/
@@ -294,14 +307,13 @@ void xnestHandleEvent(XCBGenericEvent *e
}
ErrorF("-- Added win %d\n", (int)pWin->drawable.id);
ErrorF("\n\n---------CreateNotify--------\n\n");
- DBG_xnestListWindows(XCBSetupRootsIter (XCBGetSetup (xnestConnection)).data->root);
+ //DBG_xnestListWindows(XCBSetupRootsIter(XCBGetSetup (xnestConnection)).data->root);
break;
case XCBNoExposure:
case XCBGraphicsExposure:
case XCBCirculateNotify:
case XCBGravityNotify:
-#if 0
case XCBMapNotify:
ev_map = (XCBMapNotifyEvent *)e;
pWin = xnestWindowPtr(ev_map->window);
@@ -317,7 +329,6 @@ void xnestHandleEvent(XCBGenericEvent *e
pWin->mapped = 0;
break;
-#endif
default:
ErrorF("****xnest warning: unhandled event %d\n", e->response_type & ~0x80);
ErrorF("****Sequence number: %d\n", e->sequence);
@@ -338,8 +349,8 @@ void xnestCollectEvents()
if (!e->response_type) {
err = (XCBGenericError *)e;
ErrorF("****** File: %s Error: %d, Sequence %d\n", __FILE__, err->error_code, err->sequence);
-
} else {
+ ErrorF("Handling event %d\n", e->response_type & ~0x80);
xnestHandleEvent(e);
}
}
diff --git a/hw/xnest/Handlers.c b/hw/xnest/Handlers.c
index a17ee54..2356e7d 100644
--- a/hw/xnest/Handlers.c
+++ b/hw/xnest/Handlers.c
@@ -31,18 +31,21 @@ is" without express or implied warranty.
#include "Xnest.h"
#include "Display.h"
+#include "WindowFuncs.h"
#include "Events.h"
#include "Handlers.h"
-void
-xnestBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
+void xnestBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
{
- xnestCollectEvents();
- XCBFlush(xnestConnection);
+ DBG_xnestListWindows(XCBSetupRootsIter (XCBGetSetup (xnestConnection)).data->root);
+ ErrorF("\n\n\nBlock\n");
+
+ xnestCollectEvents();
+ XCBFlush(xnestConnection);
}
-void
-xnestWakeupHandler(pointer blockData, int result, pointer pReadMask)
+void xnestWakeupHandler(pointer blockData, int result, pointer pReadMask)
{
+ ErrorF("\n\n\nWakeup\n");
xnestCollectEvents();
}
diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c
index 172f461..3ed2a2c 100644
--- a/hw/xnest/Window.c
+++ b/hw/xnest/Window.c
@@ -105,6 +105,7 @@ Bool xnestCreateWindow(WindowPtr pWin)
XCBGrabServer(xnestConnection);
xscreenTrackChildren(pWin);
XCBUngrabServer(xnestConnection);
+
ErrorF("Root window: %d\n", screen->root);
ErrorF(__FUNCTION__);
DBG_xnestListWindows(XCBSetupRootsIter (XCBGetSetup (xnestConnection)).data->root);
@@ -223,7 +224,7 @@ void xnestConfigureWindow(WindowPtr pWin
unsigned int valuemask;
XCBParamsConfigureWindow values;
- if (mask & XCBConfigWindowSibling &&
+ if ((mask & XCBConfigWindowSibling) &&
xnestWindowPriv(pWin)->parent.xid != xnestWindowParent(pWin).xid) {
XCBReparentWindow(xnestConnection,
xnestWindow(pWin),
diff --git a/hw/xnest/WindowFuncs.c b/hw/xnest/WindowFuncs.c
index 350f49c..fa150a2 100644
--- a/hw/xnest/WindowFuncs.c
+++ b/hw/xnest/WindowFuncs.c
@@ -43,8 +43,16 @@ void DBG_xnestListWindows(XCBWINDOW w)
{
XCBWINDOW *child;
WindowPtr pWin;
+ XCBGenericError *err;
XCBQueryTreeCookie qcook;
XCBQueryTreeRep *qrep;
+ XCBGetGeometryCookie gcook;
+ XCBGetGeometryRep *grep;
+ XCBGetGeometryRep back_grep;
+ XCBGetWindowAttributesCookie acook;
+ XCBGetWindowAttributesRep *arep;
+ XCBGetWindowAttributesRep back_arep;
+
static int splvl = 0;
int i,j;
@@ -54,7 +62,7 @@ void DBG_xnestListWindows(XCBWINDOW w)
* pScreen = xnestScreen(w);
*/
qcook = XCBQueryTree(xnestConnection, w);
- qrep = XCBQueryTreeReply(xnestConnection, qcook, NULL);
+ qrep = XCBQueryTreeReply(xnestConnection, qcook, &err);
child = XCBQueryTreeChildren(qrep);
/* Walk through the windows, initializing the privates.
* FIXME: initialize x, y, and pWin contents.. how? */
@@ -63,9 +71,36 @@ void DBG_xnestListWindows(XCBWINDOW w)
pWin = xnestWindowPtr(child[i]);
for (j=0; j<splvl; j++)
ErrorF(" ");
- ErrorF("Window %d, pWin 0x%x ", w.xid, pWin);
- if (!pWin)
- ErrorF("********************WARNING: NULL WINDOW********************");
+
+ gcook = XCBGetGeometry(xnestConnection, (XCBDRAWABLE)child[i]);
+ acook = XCBGetWindowAttributes(xnestConnection, child[i]);
+
+ grep = XCBGetGeometryReply(xnestConnection, gcook, &err);
+ if (err) {
+ ErrorF("Error %d\n", err->error_code);
+ exit(1);
+ }
+
+ arep = XCBGetWindowAttributesReply(xnestConnection, acook, &err);
+ if (err) {
+ ErrorF("Error %d\n", err->error_code);
+ exit(1);
+ }
+
+ if (pWin) {
+ ErrorF("Window %d, Internal %d, (%d, %d), (%d, %d)....(%d, %d), (%d,%d), Event mask 0x%x",
+ child[i].xid, pWin->drawable.id,
+ pWin->drawable.x, pWin->drawable.y,
+ pWin->drawable.width, pWin->drawable.height,
+ grep->x, grep->y,
+ grep->width, grep->height,
+ arep->your_event_mask);
+ } else {
+ ErrorF("Window %d, <NOT TRACKED INTERNALLY!!!!!!>, (%d, %d), (%d,%d), Event mask 0x%x",
+ grep->x, grep->y,
+ grep->width, grep->height,
+ arep->your_event_mask);
+ }
ErrorF("\n");
/*and recurse, adding this window's children*/
splvl++;
@@ -82,7 +117,7 @@ void DBG_xnestListWindows(XCBWINDOW w)
* This function is used to set up a window that's already been created
* on the backing server, which means I don't want to actually _create_ it.
**/
-WindowPtr xnestTrackWindow(XCBWINDOW w, WindowPtr pParent, int x, int y, int width, int height, int bw)
+WindowPtr xscreenTrackWindow(XCBWINDOW w, WindowPtr pParent, int x, int y, int width, int height, int bw)
{
WindowPtr pWin;
ScreenPtr pScreen;
@@ -105,7 +140,7 @@ WindowPtr xnestTrackWindow(XCBWINDOW w,
pWin->optional = (WindowOptPtr)NULL;
pWin->cursorIsNone = TRUE;
- pWin->backingStore = NotUseful;
+ pWin->backingStore = NotUseful;file:///home/ori/.mozilla/firefox/eysrj7gz.default/bookmarks.html
pWin->DIXsaveUnder = FALSE;
pWin->backStorage = (pointer) NULL;
@@ -130,7 +165,7 @@ WindowPtr xnestTrackWindow(XCBWINDOW w,
#ifdef COMPOSITE
pWin->redirectDraw = 0;
#endif
-
+
pWin->parent = pParent;
pWin->drawable = pParent->drawable;
@@ -138,6 +173,7 @@ WindowPtr xnestTrackWindow(XCBWINDOW w,
pWin->origin.y = y + bw;
pWin->drawable.width = width;
pWin->drawable.height = height;
+ pWin->borderWidth = bw;
pWin->drawable.x = pParent->drawable.x + x + bw;
pWin->drawable.y = pParent->drawable.y + y + bw;
pWin->drawable.type = DRAWABLE_WINDOW;
@@ -154,7 +190,7 @@ WindowPtr xnestTrackWindow(XCBWINDOW w,
xnestWindowPriv(pWin)->height = pWin->drawable.height;
xnestWindowPriv(pWin)->sibling_above = (XCBWINDOW){0};
xnestWindowPriv(pWin)->owner = XSCREEN_OWNED_BACKING;
-
+
pWin->borderIsPixel = pParent->borderIsPixel;
pWin->border = pParent->border;
if (pWin->borderIsPixel == FALSE)
@@ -171,6 +207,7 @@ WindowPtr xnestTrackWindow(XCBWINDOW w,
pWin->valdata = NULL;
REGION_NULL(pScreen, &pWin->winSize);
+ xnestWindowPriv(pWin)->clip_shape = NULL;
REGION_NULL(pScreen, &pWin->borderSize);
REGION_NULL(pScreen, &pWin->clipList);
REGION_NULL(pScreen, &pWin->borderClip);
@@ -179,16 +216,73 @@ WindowPtr xnestTrackWindow(XCBWINDOW w,
SetWinSize (pWin);
SetBorderSize (pWin);
- /*FIXME! THIS IS FUCKED. ONLY FOR TESTING.*/
+ /*FIXME! THIS IS FUCKED. ONLY FOR TESTING Need to actually get the resolution properly.*/
pWin->drawable.depth = 24;
return pWin;
}
-void xnestInsertWindow(WindowPtr pWin, WindowPtr pParent)
+int xscreenHandleConfigure(WindowPtr pWin, XCBWINDOW sib, int x, int y, int w, int h, int bw)
+{
+ WindowPtr pSib = NullWindow;
+ WindowPtr pParent = pWin->parent;
+ xEvent event;
+
+ if (xnestWindowPriv(pWin)->owner == XSCREEN_OWNED_XSCREEN){
+ event.u.u.type = ConfigureNotify;
+ event.u.configureNotify.window = pWin->drawable.id;
+ if (pSib)
+ event.u.configureNotify.aboveSibling = sib.xid;
+ else
+ event.u.configureNotify.aboveSibling = 0;
+ event.u.configureNotify.x = x;
+ event.u.configureNotify.y = y;
+ event.u.configureNotify.width = w;
+ event.u.configureNotify.height = h;
+ event.u.configureNotify.borderWidth = bw;
+ event.u.configureNotify.override = pWin->overrideRedirect;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ } else {
+ pWin->origin.x = x + bw;
+ pWin->origin.y = y + bw;
+ pWin->drawable.x = x + bw + pParent->drawable.x;
+ pWin->drawable.y = y + bw + pParent->drawable.y;
+ }
+}
+
+void break_here(void){
+ printf("********************************************************BREAK!!!\n");
+}
+
+void xnestRemoveWindow(WindowPtr pWin)
{
WindowPtr pPrev;
+ WindowPtr pNext;
+ WindowPtr pParent;
- pPrev = RealChildHead(pParent);
+ pPrev = pWin->prevSib;
+ pNext = pWin->nextSib;
+ pParent = pWin->parent;
+
+ if (pPrev)
+ pPrev->nextSib = pNext;
+ else
+ pParent->firstChild = pNext;
+
+ if (pNext)
+ pNext->prevSib = pPrev;
+ else
+ pWin->lastChild = pPrev;
+
+ pWin->nextSib = NULL;
+ pWin->prevSib = NULL;
+}
+
+void xnestInsertWindow(WindowPtr pWin, WindowPtr pParent)
+{
+ WindowPtr pPrev;
+
+ pPrev = pParent->firstChild;// RealChildHead(pParent);
+ pWin->parent = pParent;
if (pPrev)
{
pWin->nextSib = pPrev->nextSib;
@@ -209,6 +303,8 @@ void xnestInsertWindow(WindowPtr pWin, W
pParent->lastChild = pWin;
pParent->firstChild = pWin;
}
+ if (pWin->nextSib == pWin)
+ break_here();
}
@@ -246,15 +342,17 @@ void xscreenTrackChildren(WindowPtr pPar
gcook = XCBGetGeometry(xnestConnection, (XCBDRAWABLE)child[i]);
grep = XCBGetGeometryReply(xnestConnection, gcook, NULL);
- pWin = xnestTrackWindow(child[i], pParent, grep->x, grep->y, grep->width, grep->height, grep->border_width);
+ pWin = xscreenTrackWindow(child[i], pParent, grep->x, grep->y, grep->width, grep->height, grep->border_width);
/*listen to events on the new window*/
ev_mask = XCBEventMaskSubstructureNotify|XCBEventMaskStructureNotify;;
XCBChangeWindowAttributes(xnestConnection, child[i], XCBCWEventMask, &ev_mask);
} else {
- ErrorF("Skipping %d\n", child[i]);
+ ErrorF("*****Skipping %d\n", child[i]);
}
+ if (xnestWindowPriv(pWin)->owner != XSCREEN_OWNED_BACKING && pWin->parent)
+ xnestRemoveWindow(pWin);
xnestInsertWindow(pWin, pParent);
/*and recurse, adding this window's children*/
xscreenTrackChildren(pWin);
@@ -268,21 +366,20 @@ void xscreenTrackChildren(WindowPtr pPar
**/
int xnestReparentWindow(register WindowPtr pWin, register WindowPtr pParent,
- int x, int y, ClientPtr client)
+ int x, int y, ClientPtr client)
{
WindowPtr pPrev, pPriorParent;
- Bool WasMapped = (Bool)(pWin->mapped);
+// Bool WasMapped = (Bool)(pWin->mapped);
int bw = wBorderWidth (pWin);
register ScreenPtr pScreen;
pScreen = pWin->drawable.pScreen;
- if (WasMapped)
- UnmapWindow(pWin, FALSE);
+// if (WasMapped)
+// UnmapWindow(pWin, FALSE);
/* take out of sibling chain */
-
pPriorParent = pPrev = pWin->parent;
if (pPrev->firstChild == pWin)
pPrev->firstChild = pWin->nextSib;
@@ -296,7 +393,7 @@ int xnestReparentWindow(register WindowP
/* insert at begining of pParent */
pWin->parent = pParent;
- pPrev = RealChildHead(pParent);
+ pPrev = pParent->firstChild;//RealChildHead(pParent);
if (pPrev)
{
pWin->nextSib = pPrev->nextSib;
@@ -317,6 +414,7 @@ int xnestReparentWindow(register WindowP
pParent->lastChild = pWin;
pParent->firstChild = pWin;
}
+
pWin->origin.x = x + bw;
pWin->origin.y = y + bw;
@@ -326,14 +424,12 @@ int xnestReparentWindow(register WindowP
/* clip to parent */
SetWinSize (pWin);
SetBorderSize (pWin);
- if (pScreen->ReparentWindow)
- (*pScreen->ReparentWindow)(pWin, pPriorParent);
(*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y);
- ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
- //CheckWindowOptionalNeed(pWin);
+ //ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
+ //CheckWindowOptionalNeed(pWin);
- if (WasMapped)
- MapWindow(pWin, client);
+// if (WasMapped)
+// MapWindow(pWin, client);
RecalculateDeliverableEvents(pWin);
return(Success);
}
diff --git a/hw/xnest/WindowFuncs.h b/hw/xnest/WindowFuncs.h
index 811ed9b..da7bd7d 100644
--- a/hw/xnest/WindowFuncs.h
+++ b/hw/xnest/WindowFuncs.h
@@ -1,6 +1,6 @@
#ifndef _WINDOWFUNCS_H_
#define _WINDOWFUNCS_H_
-WindowPtr xnestTrackWindow(XCBWINDOW w, WindowPtr pParent, int x, int y, int width, int height, int bw);
+WindowPtr xscreenTrackWindow(XCBWINDOW w, WindowPtr pParent, int x, int y, int width, int height, int bw);
void xnestInsertWindow(WindowPtr pWin, WindowPtr pParent);
int xnestReparentWindow(register WindowPtr pWin, register WindowPtr pParent, int x, int y, ClientPtr client);
void DBG_xnestListWindows(XCBWINDOW w);
diff --git a/hw/xscreen/Makefile.am b/hw/xscreen/Makefile.am
new file mode 100644
index 0000000..6eb11a3
--- /dev/null
+++ b/hw/xscreen/Makefile.am
@@ -0,0 +1,20 @@
+bin_PROGRAMS = Xscreen
+
+Xscreen_SOURCES = xs-init.c \
+ xs-input.c \
+ xs-globals.h \
+ xs-globals.c \
+ xs-screen.h \
+ xs-screen.c \
+ $(top_srcdir)/Xext/dpmsstubs.c \
+ $(top_srcdir)/Xi/stubs.c \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/fb/fbcmap.c
+
+
+Xscreen_LDADD = $(XORG_CORE_LIBS) \
+ $(XNEST_LIBS) \
+ $(XNESTMODULES_LIBS)
+
+INCLUDES = $(XSCREENMODULES_CFLAGS)
+AM_CFLAGS = @SERVER_DEFINES@ -DNO_HW_ONLY_EXTS
diff --git a/hw/xscreen/xs-globals.c b/hw/xscreen/xs-globals.c
new file mode 100644
index 0000000..919de5e
--- /dev/null
+++ b/hw/xscreen/xs-globals.c
@@ -0,0 +1,4 @@
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+
+XCBConnection *xsConnection;
diff --git a/hw/xscreen/xs-globals.h b/hw/xscreen/xs-globals.h
new file mode 100644
index 0000000..e6f8d0d
--- /dev/null
+++ b/hw/xscreen/xs-globals.h
@@ -0,0 +1 @@
+extern XCBConnection *xsConnection;
diff --git a/hw/xscreen/xs-init.c b/hw/xscreen/xs-init.c
new file mode 100644
index 0000000..915f719
--- /dev/null
+++ b/hw/xscreen/xs-init.c
@@ -0,0 +1,117 @@
+#ifdef HAVE_XSCREEN_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <stdlib.h>
+
+/* need to include Xmd before XCB stuff, or
+ * things get redeclared.*/
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xcb_aux.h>
+#include <X11/XCB/xproto.h>
+#include <X11/XCB/shape.h>
+
+#include "gcstruct.h"
+#include "window.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "colormapst.h"
+#include "scrnintstr.h"
+#include "region.h"
+
+#include "xs-globals.h"
+#include "xs-screen.h"
+
+#include "mi.h"
+
+/**
+ * DIX hooks for initializing input and output.
+ * XKB stuff is not supported yet, since it's currently missing in
+ * XCB.
+ **/
+void InitInput(int argc, char *argv[])
+{
+}
+
+void xsInitPixmapFormats(const XCBSetup *setup, PixmapFormatRec fmts[])
+{
+ XCBFORMAT *bs_fmts; /*formats on backing server*/
+ int i;
+
+ bs_fmts = XCBSetupPixmapFormats(setup);
+ for (i = 0; i < setup->pixmap_formats_len; i++) {
+ fmts[i].depth = bs_fmts[i].depth;
+ fmts[i].bitsPerPixel = bs_fmts[i].bits_per_pixel;
+ fmts[i].scanlinePad = bs_fmts[i].scanline_pad;
+ }
+}
+
+/**
+ * Here is where we initialize the scren info and open the display.
+ **/
+void InitOutput(ScreenInfo *si, int argc, char *argv[])
+{
+ int screennum;
+ const XCBSetup *setup;
+ char *display;
+
+ /*FIXME: add a "-display" option*/
+ /*Globals Globals Everywhere.*/
+ xsConnection = XCBConnect(NULL, &screennum);
+
+ if (!xsConnection) { /* failure to connect */
+ /* prettify the display name */
+ display = getenv("DISPLAY");
+ if (!display)
+ display = "";
+ FatalError("Unable to open display \"%s\".\n", display);
+ }
+
+ setup = XCBGetSetup(xsConnection);
+
+ si->imageByteOrder = setup->image_byte_order;
+ si->bitmapScanlineUnit = setup->bitmap_format_scanline_unit;
+ si->bitmapBitOrder = setup->bitmap_format_bit_order;
+ si->numPixmapFormats = setup->pixmap_formats_len;
+ xsInitPixmapFormats(setup, si->formats);
+ /**
+ * NB: If anyone cares about multiple screens in Xscreen,
+ * they can add support. I don't care about it, and I'm not
+ * going to be putting in barely-tested code
+ **/
+ si->numScreens = 1;
+ AddScreen(xsOpenScreen, argc, argv);
+ /*si->numVideoScreens = ... what do I do with this?;*/
+
+}
+
+/**
+ * We don't really need to do cleanup here, at least not yet.
+ * There'll be stuff later.
+ **/
+void ddxGiveUp()
+{
+ /*FIXME: close display properly*/
+}
+
+void AbortDDX()
+{
+ /*FIXME: close display properly*/
+}
+
+/*We don't support arguments yet*/
+void ddxUseMsg()
+{
+ ErrorF("No extra options yet\n");
+}
+
+
+void ddxInitGlobals()
+{
+}
+
+int ddxProcessArgument(int argc, char *argv[], int i)
+{
+ return 0;
+}
diff --git a/hw/xscreen/xs-input.c b/hw/xscreen/xs-input.c
new file mode 100644
index 0000000..67556ca
--- /dev/null
+++ b/hw/xscreen/xs-input.c
@@ -0,0 +1,56 @@
+/**
+ * Copyright 2006 Ori Bernstein
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation. Ori Bernstein makes no representations about
+ * the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ **/
+
+#ifdef HAVE_XSCREEN_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <stdlib.h>
+
+/* need to include Xmd before XCB stuff, or
+ * things get redeclared.*/
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xcb_aux.h>
+#include <X11/XCB/xproto.h>
+#include <X11/XCB/shape.h>
+
+#include "gcstruct.h"
+#include "window.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "colormapst.h"
+#include "scrnintstr.h"
+#include "region.h"
+
+#include "mi.h"
+
+/**
+ * DIX hook for processing input events.
+ * Just hooks into the mi stuff.
+ **/
+void ProcessInputEvents()
+{
+ mieqProcessInputEvents();
+ miPointerUpdate();
+}
+
+/*The backing server should have already filtered invalid modifiers*/
+Bool LegalModifier(unsigned int key, DevicePtr pDev)
+{
+ return TRUE;
+}
+
+void OsVendorInit()
+{
+}
+
diff --git a/hw/xscreen/xs-screen.c b/hw/xscreen/xs-screen.c
new file mode 100644
index 0000000..0d7c7ba
--- /dev/null
+++ b/hw/xscreen/xs-screen.c
@@ -0,0 +1,31 @@
+#ifdef HAVE_XSCREEN_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <stdlib.h>
+
+/* need to include Xmd before XCB stuff, or
+ * things get redeclared.*/
+#include <X11/Xmd.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/xcb_aux.h>
+#include <X11/XCB/xproto.h>
+#include <X11/XCB/shape.h>
+
+#include "gcstruct.h"
+#include "window.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "colormapst.h"
+#include "scrnintstr.h"
+#include "region.h"
+
+#include "xs-globals.h"
+#include "xs-screen.h"
+
+#include "mi.h"
+
+Bool xsOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
+{
+ return FALSE;
+}
diff --git a/hw/xscreen/xs-screen.h b/hw/xscreen/xs-screen.h
new file mode 100644
index 0000000..6279060
--- /dev/null
+++ b/hw/xscreen/xs-screen.h
@@ -0,0 +1,6 @@
+#ifndef _XS_SCREEN_INCL_
+#define _XS_SCREEN_INCL_
+
+Bool xsOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]);
+
+#endif
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 19abe33..1452e14 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -591,8 +591,7 @@ typedef struct _ScreenInfo {
int bitmapScanlinePad;
int bitmapBitOrder;
int numPixmapFormats;
- PixmapFormatRec
- formats[MAXFORMATS];
+ PixmapFormatRec formats[MAXFORMATS];
int arraySize;
int numScreens;
ScreenPtr screens[MAXSCREENS];
diff-tree 4b7f0b3dbb4bb0c51c2a9a65eadadfad37bff252 (from 7bdcda388b42eec1c995deeb44ba3f3e9071c173)
Author: Ori Bernstein <rand.chars at gmail.com>
Date: Sat Aug 5 14:21:12 2006 -0500
Fixed race condition. Events still broken when WM running.
diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index a0db9db..e910a1e 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -231,7 +231,7 @@ void xnestHandleEvent(XCBGenericEvent *e
case XCBConfigureNotify:
cev = (XCBConfigureNotifyEvent *)e;
- pWin = xnestWindowPtr(cev->event);
+ pWin = xnestWindowPtr(cev->window);
pSib = xnestWindowPtr(cev->above_sibling);
pParent = pWin->parent;
pScreen = pWin->drawable.pScreen;
@@ -259,6 +259,7 @@ void xnestHandleEvent(XCBGenericEvent *e
pParent = xnestWindowPtr(ev_reparent->parent);
pWin = xnestWindowPtr(ev_reparent->window);
+ ErrorF("ReparentNotify\n");
DBG_xnestListWindows(XCBSetupRootsIter (XCBGetSetup (xnestConnection)).data->root);
ErrorF("Reparenting %d to %d\n", (int) ev_reparent->window.xid, (int)ev_reparent->parent.xid);
/*we'll assume the root can't be reparented, and as such, pParent is _always_ valid*/
@@ -273,21 +274,27 @@ void xnestHandleEvent(XCBGenericEvent *e
if (!pWin) {
ErrorF("Adding new window\n");
+ /*track window*/
pWin = xnestTrackWindow(ev_create->window,
pParent, /*parent WindowPtr*/
ev_create->x, ev_create->y, /*x, y*/
ev_create->width, ev_create->height,/*w, h*/
ev_create->border_width);
- if (!pWin) {
- ErrorF("AAGGHH! NULL WINDOW IN CREATE! SEPPUKU!");
- exit(1);
- }
+ /* Now we grab the server and walk this window's children, since
+ * otherwise we have a nice race condition, where child windows are
+ * created before we ask for notifications*/
+ XCBGrabServer(xnestConnection);
+ xscreenTrackChildren(pWin);
+ XCBUngrabServer(xnestConnection);
xnestInsertWindow(pWin, pParent);
+ /*and ask so we know about new children of this window*/
ev_mask = XCBEventMaskStructureNotify;
XCBChangeWindowAttributes(xnestConnection, ev_create->window, XCBCWEventMask, &ev_mask);
}
ErrorF("-- Added win %d\n", (int)pWin->drawable.id);
+ ErrorF("\n\n---------CreateNotify--------\n\n");
+ DBG_xnestListWindows(XCBSetupRootsIter (XCBGetSetup (xnestConnection)).data->root);
break;
case XCBNoExposure:
case XCBGraphicsExposure:
diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c
index 2b158b3..172f461 100644
--- a/hw/xnest/Window.c
+++ b/hw/xnest/Window.c
@@ -80,54 +80,7 @@ WindowPtr xnestWindowPtr(XCBWINDOW windo
* we can let Xscreen tell windows that they've been reparented,
* and other fun stuff.
**/
-static void xscreenInitBackingWindows(XCBConnection *c, WindowPtr pParent)
-{
- int i;
- XCBWINDOW *child;
- XCBQueryTreeCookie qcook;
- XCBQueryTreeRep *qrep;
- XCBGetGeometryCookie gcook;
- XCBGetGeometryRep *grep;
- XCBWINDOW w = {0};
- ScreenPtr pScreen;
- WindowPtr pWin = NULL;
- WindowPtr pPrev = NULL;
- CARD32 ev_mask;
-
-
- /*FIXME: THIS IS WRONG! How do I get the screen?
- * No issue though, so far, since I only work with one screen.
- * pScreen = xnestScreen(w);
- */
- w = xnestWindow(pParent);
- pScreen = screenInfo.screens[0];
- qcook = XCBQueryTree(c, w);
- qrep = XCBQueryTreeReply(c, qcook, NULL);
- child = XCBQueryTreeChildren(qrep);
- /* Walk through the windows, initializing the privates.
- * FIXME: initialize x, y, and pWin contents.. how? */
- for (i=0; i < qrep->children_len; i++){
- /*if we're not already tracking this one*/
- pWin = xnestWindowPtr(child[i]);
- if (!pWin) {
- ErrorF("Adding window %d\n", child[i]);
- gcook = XCBGetGeometry(c, (XCBDRAWABLE)child[i]);
- grep = XCBGetGeometryReply(c, gcook, NULL);
-
- pWin = xnestTrackWindow(child[i], pParent, grep->x, grep->y, grep->width, grep->height, grep->border_width);
-
- /*listen to events on the new window*/
- ev_mask = XCBEventMaskSubstructureNotify|XCBEventMaskStructureNotify;;
- XCBChangeWindowAttributes(xnestConnection, child[i], XCBCWEventMask, &ev_mask);
- } else {
- ErrorF("Skipping %d\n", child[i]);
- }
- xnestInsertWindow(pWin, pParent);
- /*and recurse, adding this window's children*/
- xscreenInitBackingWindows(c, pWin);
- }
-}
Bool xnestCreateWindow(WindowPtr pWin)
{
@@ -142,13 +95,20 @@ Bool xnestCreateWindow(WindowPtr pWin)
* we just set it's XID to the backing server's root.*/
screen = XCBSetupRootsIter (XCBGetSetup (xnestConnection)).data;
if (xnestIsRoot(pWin)) {
- ErrorF("Created Window\n");
+
xnestWindowPriv(pWin)->window = screen->root;
+
mask = XCBEventMaskSubstructureNotify|XCBEventMaskPointerMotion;
XCBChangeWindowAttributes(xnestConnection, screen->root, XCBCWEventMask, &mask);
+
/*now that we've created the root window, we can do the backing windows*/
- xscreenInitBackingWindows(xnestConnection, pWin);
+ XCBGrabServer(xnestConnection);
+ xscreenTrackChildren(pWin);
+ XCBUngrabServer(xnestConnection);
ErrorF("Root window: %d\n", screen->root);
+ ErrorF(__FUNCTION__);
+ DBG_xnestListWindows(XCBSetupRootsIter (XCBGetSetup (xnestConnection)).data->root);
+
return True;
}
diff --git a/hw/xnest/WindowFuncs.c b/hw/xnest/WindowFuncs.c
index cdda1d1..350f49c 100644
--- a/hw/xnest/WindowFuncs.c
+++ b/hw/xnest/WindowFuncs.c
@@ -86,6 +86,7 @@ WindowPtr xnestTrackWindow(XCBWINDOW w,
{
WindowPtr pWin;
ScreenPtr pScreen;
+ XCBWINDOW *child;
pWin = xnestWindowPtr(w);
if (pWin && xnestIsRoot(pWin))
@@ -180,7 +181,6 @@ WindowPtr xnestTrackWindow(XCBWINDOW w,
SetBorderSize (pWin);
/*FIXME! THIS IS FUCKED. ONLY FOR TESTING.*/
pWin->drawable.depth = 24;
-
return pWin;
}
@@ -210,6 +210,56 @@ void xnestInsertWindow(WindowPtr pWin, W
pParent->firstChild = pWin;
}
}
+
+
+void xscreenTrackChildren(WindowPtr pParent)
+{
+ int i;
+ XCBWINDOW *child;
+ XCBQueryTreeCookie qcook;
+ XCBQueryTreeRep *qrep;
+ XCBGetGeometryCookie gcook;
+ XCBGetGeometryRep *grep;
+ XCBWINDOW w = {0};
+ ScreenPtr pScreen;
+ WindowPtr pWin = NULL;
+ WindowPtr pPrev = NULL;
+ CARD32 ev_mask;
+
+
+ /*FIXME: THIS IS WRONG! How do I get the screen?
+ * No issue though, so far, since I only work with one screen.
+ * pScreen = xnestScreen(w);
+ */
+ w = xnestWindowPriv(pParent)->window;
+ pScreen = screenInfo.screens[0];
+ qcook = XCBQueryTree(xnestConnection, w);
+ qrep = XCBQueryTreeReply(xnestConnection, qcook, NULL);
+ child = XCBQueryTreeChildren(qrep);
+ /* Walk through the windows, initializing the privates.
+ * FIXME: initialize x, y, and pWin contents.. how? */
+ for (i=0; i < qrep->children_len; i++){
+ /*if we're not already tracking this one*/
+ pWin = xnestWindowPtr(child[i]);
+ if (!pWin) {
+ ErrorF("Adding window %d\n", child[i]);
+ gcook = XCBGetGeometry(xnestConnection, (XCBDRAWABLE)child[i]);
+ grep = XCBGetGeometryReply(xnestConnection, gcook, NULL);
+
+ pWin = xnestTrackWindow(child[i], pParent, grep->x, grep->y, grep->width, grep->height, grep->border_width);
+
+ /*listen to events on the new window*/
+ ev_mask = XCBEventMaskSubstructureNotify|XCBEventMaskStructureNotify;;
+ XCBChangeWindowAttributes(xnestConnection, child[i], XCBCWEventMask, &ev_mask);
+ } else {
+ ErrorF("Skipping %d\n", child[i]);
+ }
+
+ xnestInsertWindow(pWin, pParent);
+ /*and recurse, adding this window's children*/
+ xscreenTrackChildren(pWin);
+ }
+}
/**
* YAY! copy-paste coding.
* Again, the reparenting window code almost does what I want, but not quite.
diff --git a/hw/xnest/WindowFuncs.h b/hw/xnest/WindowFuncs.h
index 8ae4e04..811ed9b 100644
--- a/hw/xnest/WindowFuncs.h
+++ b/hw/xnest/WindowFuncs.h
@@ -1,5 +1,8 @@
+#ifndef _WINDOWFUNCS_H_
+#define _WINDOWFUNCS_H_
WindowPtr xnestTrackWindow(XCBWINDOW w, WindowPtr pParent, int x, int y, int width, int height, int bw);
void xnestInsertWindow(WindowPtr pWin, WindowPtr pParent);
int xnestReparentWindow(register WindowPtr pWin, register WindowPtr pParent, int x, int y, ClientPtr client);
void DBG_xnestListWindows(XCBWINDOW w);
-
+void xscreenTrackChildren(WindowPtr pParent);
+#endif
More information about the xorg-commit
mailing list