Commit ea584724 authored by Patrik Stridvall's avatar Patrik Stridvall Committed by Alexandre Julliard

Started moving some X11 window management code to windows/x11drv.

parent 748acbb0
......@@ -22,8 +22,7 @@ CFLAGS = @CFLAGS@
OPTIONS = @OPTIONS@ -D_REENTRANT
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
XPM_LIB = -lXpm
XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
XLIB = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
WINELIB = $(WINESTUB) $(TOPOBJDIR)/@LIB_TARGET@
LIBS = @LIBS@
YACC = @YACC@
......
......@@ -39,7 +39,6 @@ LIBSUBDIRS = \
files \
graphics \
graphics/metafiledrv \
graphics/x11drv \
ipc \
library \
loader \
......@@ -55,10 +54,14 @@ LIBSUBDIRS = \
resources \
scheduler \
server \
tsx11 \
win32 \
windows
X11SUBDIRS = \
graphics/x11drv \
tsx11 \
windows/x11drv
EMUSUBDIRS = \
debugger \
graphics/psdrv \
......@@ -73,12 +76,13 @@ DOCSUBDIRS = documentation
# All sub-directories
ALLSUBDIRS = \
$(LIBSUBDIRS) \
$(X11SUBDIRS) \
$(EMUSUBDIRS) \
$(PROGSUBDIRS) \
$(DOCSUBDIRS)
# Sub-directories to run make depend into
DEPENDSUBDIRS = $(LIBSUBDIRS) $(EMUSUBDIRS) $(DOCSUBDIRS)
DEPENDSUBDIRS = $(LIBSUBDIRS) $(X11SUBDIRS) $(EMUSUBDIRS) $(DOCSUBDIRS)
# Sub-directories to run make install into
INSTALLSUBDIRS = $(DOCSUBDIRS)
......@@ -97,7 +101,6 @@ LIBOBJS = \
files/files.o \
graphics/graphics.o \
graphics/metafiledrv/metafiledrv.o \
graphics/x11drv/x11drv.o \
ipc/ipc.o \
loader/loader.o \
loader/ne/ne.o \
......@@ -112,10 +115,14 @@ LIBOBJS = \
resources/resources.o \
scheduler/scheduler.o \
server/server.o \
tsx11/tsx11.o \
win32/win32.o \
windows/windows.o
X11OBJS = \
graphics/x11drv/x11drv.o \
tsx11/tsx11.o \
windows/x11drv/x11drv.o
EMUOBJS = \
debugger/debugger.o \
graphics/psdrv/psdrv.o \
......@@ -137,21 +144,21 @@ uninstall:: uninstall_$(MAIN_TARGET)
emu: wine
lib: $(LIBSUBDIRS) $(LIB_TARGET)
lib: $(LIBSUBDIRS) $(X11SUBDIRS) $(LIB_TARGET)
wine wine.sym: $(LIBSUBDIRS) $(LIB_TARGET) $(EMUSUBDIRS) dummy
$(CC) -o wine $(EMUOBJS) $(LIB_TARGET) $(ALT_LINK) $(LDOPTIONS) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
wine wine.sym: $(LIBSUBDIRS) $(X11SUBDIRS) $(LIB_TARGET) $(EMUSUBDIRS) dummy
$(CC) -o wine $(EMUOBJS) $(LIB_TARGET) $(ALT_LINK) $(LDOPTIONS) $(X_LIBS) $(XLIB) $(LIBS)
@echo "Please ignore the 'gets' warning message, it only applies to Windows programs which use 'gets'"
nm -n wine | grep -v _compiled >wine.sym
@echo "Wine build complete."
libwine.a: $(LIBOBJS)
libwine.a: $(LIBOBJS) $(X11OBJS)
$(RM) $@
$(AR) $@ $(LIBOBJS)
$(AR) $@ $(LIBOBJS) $(X11OBJS)
$(RANLIB) $@
libwine.so.1.0: $(LIBOBJS)
$(CC) -shared -Wl,-soname,libwine.so -o$@ $(LIBOBJS) $(LDOPTIONS) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
libwine.so.1.0: $(LIBOBJS) $(X11OBJS)
$(CC) -shared -Wl,-soname,libwine.so -o$@ $(LIBOBJS) $(X11OBJS) $(LDOPTIONS) $(X_LIBS) $(XLIB) $(LIBS)
install_emu: install_lib
[ -d $(bindir) ] || $(MKDIR) $(bindir)
......
......@@ -81,12 +81,32 @@ dnl Check for -li386 for NetBSD and OpenBSD
AC_CHECK_LIB(i386,i386_set_ldt)
dnl Check for -lw for Solaris
AC_CHECK_LIB(w,iswalnum)
dnl Check for -lnsl for Solaris
AC_CHECK_FUNCS(gethostbyname)
if test "$ac_cv_func_gethostbyname" = "no"
then
AC_CHECK_LIB(nsl,gethostbyname)
fi
dnl Check for -lxpg4 for FreeBSD
AC_CHECK_LIB(xpg4,setrunelocale)
dnl Check for -ldl
AC_CHECK_LIB(dl,dlopen)
dnl Check for XFree86 DGA extension
AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
AC_SUBST(XLIB)
if test "$have_x" = "yes"
then
XLIB="-lXpm -lXext -lX11"
dnl Check for -lXpm
dnl FIXME: should be done once we can compile without -lXpm
dnl AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,AC_DEFINE(HAVE_LIBXXPM) X_PRE_LIBS="$X_PRE_LIBS -lXpm",,$X_LIBS -lXext -lX11)
dnl Check for X Shm extension
AC_CHECK_LIB(Xext,XShmQueryExtension,AC_DEFINE(HAVE_LIBXXSHM),,$X_LIBS -lXext -lX11)
dnl Check for XFree86 DGA extension
AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
else
XLIB=""
X_CFLAGS=""
X_LIBS=""
fi
dnl **** Check for Open Sound System ****
AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h)
......@@ -532,7 +552,8 @@ tools/Makefile
tools/wrc/Makefile
tsx11/Makefile
win32/Makefile
windows/Makefile ])
windows/Makefile
windows/x11drv/Makefile ])
if test "$wine_cv_libc_reentrant" = "no"
then
......
......@@ -18,6 +18,9 @@
/* Define if you have the Xxf86dga library (-lXxf86dga). */
#undef HAVE_LIBXXF86DGA
/* Define if you have the X Shm extension */
#undef HAVE_LIBXXSHM
/* Define if you have the Open Sound system. */
#undef HAVE_OSS
......
......@@ -30,6 +30,9 @@
/* Define if you have the Xxf86dga library (-lXxf86dga). */
#undef HAVE_LIBXXF86DGA
/* Define if you have the X Shm extension */
#undef HAVE_LIBXXSHM
/* Define if you have the Open Sound system. */
#undef HAVE_OSS
......@@ -69,6 +72,9 @@
/* Define if you have the clone function. */
#undef HAVE_CLONE
/* Define if you have the gethostbyname function. */
#undef HAVE_GETHOSTBYNAME
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
......@@ -165,6 +171,9 @@
/* Define if you have the i386 library (-li386). */
#undef HAVE_LIBI386
/* Define if you have the nsl library (-lnsl). */
#undef HAVE_LIBNSL
/* Define if you have the socket library (-lsocket). */
#undef HAVE_LIBSOCKET
......
......@@ -51,6 +51,7 @@ typedef enum
#define RDW_C_DELETEHRGN 0x0002
struct tagDCE;
struct _WND_DRIVER;
typedef struct tagWND
{
......@@ -81,9 +82,20 @@ typedef struct tagWND
Window window; /* X window (only for top-level windows) */
HMENU16 hSysMenu; /* window's copy of System Menu */
DWORD userdata; /* User private data */
struct _WND_DRIVER *pDriver; /* Window driver */
DWORD wExtra[1]; /* Window extra bytes */
} WND;
typedef struct _WND_DRIVER
{
BOOL32 (*pCreateWindow)(WND *, CLASS *, CREATESTRUCT32A *, BOOL32);
WND* (*pSetParent)(WND *, WND *);
} WND_DRIVER;
/* X11 windows driver */
/* FIXME: does not belong here */
extern WND_DRIVER X11DRV_WND_Driver;
typedef struct
{
RECT16 rectNormal;
......
......@@ -5,7 +5,7 @@ VPATH = @srcdir@
MODULE = none
RCFLAGS = -w32 -h
PROGRAMS = expand hello hello2 hello3 hello4 hello5 new rolex volinfo
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XLIB) $(LIBS)
C_SRCS = \
expand.c \
......
......@@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
PROGRAMS = clock
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XLIB) $(LIBS)
RCFLAGS = -w32 -h
WRCEXTRA = -A -p $*
......
......@@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
PROGRAMS = control
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XLIB) $(LIBS)
C_SRCS = control.c
......
......@@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
PROGRAMS = notepad
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XLIB) $(LIBS)
RCFLAGS = -w32 -h
WRCEXTRA = -A -p $*
......
......@@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
PROGRAMS = progman
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XLIB) $(LIBS)
RCFLAGS = -w32 -h
WRCEXTRA = -A -p $*
......
......@@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
PROGRAMS = regtest
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XLIB) $(LIBS)
RCFLAGS = -w32 -h
WRCEXTRA = -A -p $*
......
......@@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
PROGRAMS = view
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XLIB) $(LIBS)
RCFLAGS = -w32 -h
WRCEXTRA = -A -p $*
......
......@@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
PROGRAMS = winhelp hlp2sgml
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XLIB) $(LIBS)
RCFLAGS = -w32 -h
WRCEXTRA = -A -p $*
......
......@@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
PROGRAMS = winver
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XLIB) $(LIBS)
RCFLAGS = -w32 -h
WRCEXTRA = -A -p $*
......
......@@ -6,8 +6,6 @@
#include <stdlib.h>
#include <string.h>
#include <X11/Xatom.h>
#include "options.h"
#include "class.h"
#include "win.h"
......@@ -439,6 +437,7 @@ BOOL32 WIN_CreateDesktopWindow(void)
pWndDesktop->window = rootWindow;
pWndDesktop->hSysMenu = 0;
pWndDesktop->userdata = 0;
pWndDesktop->pDriver = &X11DRV_WND_Driver;
pWndDesktop->winproc = (WNDPROC16)class->winproc;
......@@ -555,6 +554,7 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom,
wndPtr->owner = WIN_GetTopParentPtr(WIN_FindWndPtr(cs->hwndParent));
}
wndPtr->pDriver = &X11DRV_WND_Driver;
wndPtr->window = 0;
wndPtr->class = classPtr;
wndPtr->winproc = classPtr->winproc;
......@@ -647,65 +647,7 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom,
wndPtr->rectWindow.bottom = cs->y + cs->cy;
wndPtr->rectClient = wndPtr->rectWindow;
/* Create the X window (only for top-level windows, and then only */
/* when there's no desktop window) */
if (!(cs->style & WS_CHILD) && (rootWindow == DefaultRootWindow(display)))
{
XSetWindowAttributes win_attr;
if (Options.managed && ((cs->style & (WS_DLGFRAME | WS_THICKFRAME)) ||
(cs->dwExStyle & WS_EX_DLGMODALFRAME)))
{
win_attr.event_mask = ExposureMask | KeyPressMask |
KeyReleaseMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask |
FocusChangeMask | StructureNotifyMask;
win_attr.override_redirect = FALSE;
wndPtr->flags |= WIN_MANAGED;
}
else
{
win_attr.event_mask = ExposureMask | KeyPressMask |
KeyReleaseMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask |
FocusChangeMask;
win_attr.override_redirect = TRUE;
}
win_attr.colormap = COLOR_GetColormap();
win_attr.backing_store = Options.backingstore ? WhenMapped : NotUseful;
win_attr.save_under = ((classPtr->style & CS_SAVEBITS) != 0);
win_attr.cursor = CURSORICON_XCursor;
wndPtr->window = TSXCreateWindow( display, rootWindow, cs->x, cs->y,
cs->cx, cs->cy, 0, CopyFromParent,
InputOutput, CopyFromParent,
CWEventMask | CWOverrideRedirect |
CWColormap | CWCursor | CWSaveUnder |
CWBackingStore, &win_attr );
if ((wndPtr->flags & WIN_MANAGED) &&
(cs->dwExStyle & WS_EX_DLGMODALFRAME))
{
XSizeHints* size_hints = TSXAllocSizeHints();
if (size_hints)
{
size_hints->min_width = size_hints->max_width = cs->cx;
size_hints->min_height = size_hints->max_height = cs->cy;
size_hints->flags = (PSize | PMinSize | PMaxSize);
TSXSetWMSizeHints( display, wndPtr->window, size_hints,
XA_WM_NORMAL_HINTS );
TSXFree(size_hints);
}
}
if (cs->hwndParent) /* Get window owner */
{
Window win = WIN_GetXWindow( cs->hwndParent );
if (win) TSXSetTransientForHint( display, wndPtr->window, win );
}
EVENT_RegisterWindow( wndPtr );
}
(*wndPtr->pDriver->pCreateWindow)(wndPtr, classPtr, cs, unicode);
/* Set the window menu */
......@@ -1070,10 +1012,12 @@ BOOL32 WINAPI DestroyWindow32( HWND32 hwnd )
while (siblingPtr)
{
if (siblingPtr->owner == wndPtr)
{
if (siblingPtr->hmemTaskQ == wndPtr->hmemTaskQ)
break;
else
siblingPtr->owner = NULL;
}
siblingPtr = siblingPtr->next;
}
if (siblingPtr) DestroyWindow32( siblingPtr->hwndSelf );
......@@ -1957,48 +1901,14 @@ HWND16 WINAPI SetParent16( HWND16 hwndChild, HWND16 hwndNewParent )
HWND32 WINAPI SetParent32( HWND32 hwndChild, HWND32 hwndNewParent )
{
WND *wndPtr = WIN_FindWndPtr( hwndChild );
WND *pWndParent = (hwndNewParent) ? WIN_FindWndPtr( hwndNewParent )
: pWndDesktop;
if( wndPtr && pWndParent && (wndPtr != pWndDesktop) )
{
WND* pWndPrev = wndPtr->parent;
if( pWndParent != pWndPrev )
{
BOOL32 bFixupDCE = IsWindowVisible32(hwndChild);
if ( wndPtr->window )
{
/* Toplevel window needs to be reparented. Used by Tk 8.0 */
TSXDestroyWindow( display, wndPtr->window );
wndPtr->window = None;
}
else if( bFixupDCE )
DCE_InvalidateDCE( wndPtr, &wndPtr->rectWindow );
WIN_UnlinkWindow(hwndChild);
wndPtr->parent = pWndParent;
/* FIXME: Create an X counterpart for reparented top-level windows
* when not in the desktop mode. */
WND *pWndNewParent =
(hwndNewParent) ? WIN_FindWndPtr( hwndNewParent ) : pWndDesktop;
WND *pWndOldParent =
(*wndPtr->pDriver->pSetParent)(wndPtr, pWndNewParent);
if ( pWndParent != pWndDesktop ) wndPtr->dwStyle |= WS_CHILD;
WIN_LinkWindow(hwndChild, HWND_BOTTOM);
if( bFixupDCE )
{
DCE_InvalidateDCE( wndPtr, &wndPtr->rectWindow );
UpdateWindow32(hwndChild);
}
}
return pWndPrev->hwndSelf;
} /* failure */
return 0;
return pWndOldParent?pWndOldParent->hwndSelf:0;
}
/*******************************************************************
* IsChild16 (USER.48)
*/
......
DEFS = @DLLFLAGS@ -D__WINE__
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = x11drv
C_SRCS = \
init.c
all: $(MODULE).o
@MAKE_RULES@
### Dependencies:
/*
* X11 windows driver
*
* Copyright 1993, 1994 Alexandre Julliard
* Copyright 1998 Patrik Stridvall
*/
#include <string.h>
#include <X11/Xatom.h>
#include "ts_xlib.h"
#include "color.h"
#include "cursoricon.h"
#include "dce.h"
#include "options.h"
#include "message.h"
#include "win.h"
#include "windows.h"
#include "x11drv.h"
static BOOL32 X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCT32A *cs, BOOL32 bUnicode);
static WND *X11DRV_WND_SetParent(WND *wndPtr, WND *pWndParent);
WND_DRIVER X11DRV_WND_Driver =
{
X11DRV_WND_CreateWindow,
X11DRV_WND_SetParent
};
/**********************************************************************
* X11DRV_WND_CreateWindow [Internal]
*/
static BOOL32 X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCT32A *cs, BOOL32 bUnicode)
{
/* Create the X window (only for top-level windows, and then only */
/* when there's no desktop window) */
if (!(cs->style & WS_CHILD) && (rootWindow == DefaultRootWindow(display)))
{
XSetWindowAttributes win_attr;
if (Options.managed && ((cs->style & (WS_DLGFRAME | WS_THICKFRAME)) ||
(cs->dwExStyle & WS_EX_DLGMODALFRAME)))
{
win_attr.event_mask = ExposureMask | KeyPressMask |
KeyReleaseMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask |
FocusChangeMask | StructureNotifyMask;
win_attr.override_redirect = FALSE;
wndPtr->flags |= WIN_MANAGED;
}
else
{
win_attr.event_mask = ExposureMask | KeyPressMask |
KeyReleaseMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask |
FocusChangeMask;
win_attr.override_redirect = TRUE;
}
win_attr.colormap = COLOR_GetColormap();
win_attr.backing_store = Options.backingstore ? WhenMapped : NotUseful;
win_attr.save_under = ((classPtr->style & CS_SAVEBITS) != 0);
win_attr.cursor = CURSORICON_XCursor;
wndPtr->window = TSXCreateWindow( display, rootWindow, cs->x, cs->y,
cs->cx, cs->cy, 0, CopyFromParent,
InputOutput, CopyFromParent,
CWEventMask | CWOverrideRedirect |
CWColormap | CWCursor | CWSaveUnder |
CWBackingStore, &win_attr );
if ((wndPtr->flags & WIN_MANAGED) &&
(cs->dwExStyle & WS_EX_DLGMODALFRAME))
{
XSizeHints* size_hints = TSXAllocSizeHints();
if (size_hints)
{
size_hints->min_width = size_hints->max_width = cs->cx;
size_hints->min_height = size_hints->max_height = cs->cy;
size_hints->flags = (PSize | PMinSize | PMaxSize);
TSXSetWMSizeHints( display, wndPtr->window, size_hints,
XA_WM_NORMAL_HINTS );
TSXFree(size_hints);
}
}
if (cs->hwndParent) /* Get window owner */
{
Window win = WIN_GetXWindow( cs->hwndParent );
if (win) TSXSetTransientForHint( display, wndPtr->window, win );
}
EVENT_RegisterWindow( wndPtr );
}
return TRUE;
}
/*****************************************************************
* X11DRV_WND_SetParent [Internal]
*/
static WND *X11DRV_WND_SetParent(WND *wndPtr, WND *pWndParent)
{
if( wndPtr && pWndParent && (wndPtr != WIN_GetDesktop()) )
{
WND* pWndPrev = wndPtr->parent;
if( pWndParent != pWndPrev )
{
BOOL32 bFixupDCE = IsWindowVisible32(wndPtr->hwndSelf);
if ( wndPtr->window )
{
/* Toplevel window needs to be reparented. Used by Tk 8.0 */
TSXDestroyWindow( display, wndPtr->window );
wndPtr->window = None;
}
else if( bFixupDCE )
DCE_InvalidateDCE( wndPtr, &wndPtr->rectWindow );
WIN_UnlinkWindow(wndPtr->hwndSelf);
wndPtr->parent = pWndParent;
/* FIXME: Create an X counterpart for reparented top-level windows
* when not in the desktop mode. */
if ( pWndParent != WIN_GetDesktop() ) wndPtr->dwStyle |= WS_CHILD;
WIN_LinkWindow(wndPtr->hwndSelf, HWND_BOTTOM);
if( bFixupDCE )
{
DCE_InvalidateDCE( wndPtr, &wndPtr->rectWindow );
UpdateWindow32(wndPtr->hwndSelf);
}
}
return pWndPrev;
} /* failure */
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment