diff options
author | Ian Romanick <idr@umwelt.(none)> | 2006-08-25 09:34:21 -0700 |
---|---|---|
committer | Ian Romanick <idr@umwelt.(none)> | 2006-08-25 09:34:21 -0700 |
commit | 21291d6ca7188e5733ed0c93215ee0f1f0f90cc9 (patch) | |
tree | 164ae681be0cfee5fc239a999e296547d3343312 /hw | |
parent | 1a5561c4ecccaf32b03c41373adf376100d457aa (diff) | |
parent | cd2da4e41eae233b50f8830d9a8f5d1d916a5a1b (diff) |
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into pci-rework
Diffstat (limited to 'hw')
-rw-r--r-- | hw/vfb/InitOutput.c | 3 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Bus.c | 2 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Config.c | 9 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Configure.c | 3 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Cursor.c | 36 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Init.c | 8 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Mode.c | 81 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Privstr.h | 1 | ||||
-rw-r--r-- | hw/xfree86/common/xf86str.h | 7 | ||||
-rw-r--r-- | hw/xfree86/doc/man/xorg.conf.man.pre | 4 | ||||
-rw-r--r-- | hw/xfree86/os-support/Makefile.am | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/hurd/Makefile.am | 17 | ||||
-rw-r--r-- | hw/xfree86/os-support/hurd/hurd_init.c | 90 | ||||
-rw-r--r-- | hw/xfree86/os-support/hurd/hurd_mmap.c | 96 | ||||
-rw-r--r-- | hw/xfree86/os-support/hurd/hurd_mouse.c | 301 | ||||
-rw-r--r-- | hw/xfree86/os-support/hurd/hurd_video.c | 191 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_video.c | 16 | ||||
-rw-r--r-- | hw/xfree86/vgahw/vgaHW.h | 2 | ||||
-rw-r--r-- | hw/xnest/Args.c | 7 | ||||
-rw-r--r-- | hw/xwin/winclipboardwndproc.c | 104 | ||||
-rw-r--r-- | hw/xwin/winmultiwindowwndproc.c | 29 | ||||
-rw-r--r-- | hw/xwin/winshadgdi.c | 7 |
22 files changed, 902 insertions, 114 deletions
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c index b8253f607..a2d866118 100644 --- a/hw/vfb/InitOutput.c +++ b/hw/vfb/InitOutput.c @@ -364,6 +364,9 @@ ddxProcessArgument(int argc, char *argv[], int i) if (strcmp (argv[i], "-render") == 0) /* -render */ { Render = FALSE; +#ifdef COMPOSITE + noCompositeExtension = TRUE; +#endif return 1; } diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 14d52bf32..edcc6b0c7 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -3023,7 +3023,7 @@ static void CheckGenericGA() { /* This needs to be changed for multiple domains */ -#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) +#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__arm__) && !defined(__s390__) IOADDRESS GenericIOBase = VGAHW_GET_IOBASE(); CARD8 CurrentValue, TestValue; diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 4d933aa9d..87b8a0b72 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -761,7 +761,8 @@ typedef enum { FLAG_RENDER_COLORMAP_MODE, FLAG_HANDLE_SPECIAL_KEYS, FLAG_RANDR, - FLAG_AIGLX + FLAG_AIGLX, + FLAG_IGNORE_ABI } FlagValues; static OptionInfoRec FlagOptions[] = { @@ -833,6 +834,8 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, { FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN, {0}, FALSE }, + { FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN, + {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; @@ -891,6 +894,10 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) &(xf86Info.grabInfo.allowDeactivate)); xf86GetOptValBool(FlagOptions, FLAG_ALLOW_CLOSEDOWN_GRABS, &(xf86Info.grabInfo.allowClosedown)); + xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI); + if (&xf86Info.ignoreABI) { + xf86Msg(X_CONFIG, "Ignoring ABI Version\n"); + } /* * Set things up based on the config file information. Some of these diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index 3158a967d..5b786e8c6 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -88,6 +88,9 @@ static char *DFLT_MOUSE_DEV = "/dev/devi/mouse0"; #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) static char *DFLT_MOUSE_DEV = "/dev/sysmouse"; static char *DFLT_MOUSE_PROTO = "auto"; +#elif defined(linux) +static char DFLT_MOUSE_DEV[] = "/dev/input/mice"; +static char DFLT_MOUSE_PROTO[] = "auto"; #else static char *DFLT_MOUSE_DEV = "/dev/mouse"; static char *DFLT_MOUSE_PROTO = "auto"; diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c index 14e0fcd91..61f0ce55e 100644 --- a/hw/xfree86/common/xf86Cursor.c +++ b/hw/xfree86/common/xf86Cursor.c @@ -576,24 +576,40 @@ xf86InitOrigins(void) /* force edge lists */ if(screen->left) { ref = screen->left->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } pLayout->left = AddEdge(pLayout->left, 0, xf86Screens[i]->pScreen->height, xf86Screens[ref]->pScreen->width, 0, ref); } if(screen->right) { ref = screen->right->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } pScreen = xf86Screens[i]->pScreen; pLayout->right = AddEdge(pLayout->right, 0, pScreen->height, -pScreen->width, 0, ref); } if(screen->top) { ref = screen->top->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } pLayout->up = AddEdge(pLayout->up, 0, xf86Screens[i]->pScreen->width, 0, xf86Screens[ref]->pScreen->height, ref); } if(screen->bottom) { ref = screen->bottom->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } pScreen = xf86Screens[i]->pScreen; pLayout->down = AddEdge(pLayout->down, 0, pScreen->width, 0, -pScreen->height, ref); @@ -609,6 +625,10 @@ xf86InitOrigins(void) break; case PosRelative: ref = screen->refscreen->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } if(screensLeft & (1 << ref)) break; dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->x; dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->y; @@ -616,6 +636,10 @@ xf86InitOrigins(void) break; case PosRightOf: ref = screen->refscreen->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } if(screensLeft & (1 << ref)) break; pScreen = xf86Screens[ref]->pScreen; dixScreenOrigins[i].x = @@ -625,6 +649,10 @@ xf86InitOrigins(void) break; case PosLeftOf: ref = screen->refscreen->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } if(screensLeft & (1 << ref)) break; pScreen = xf86Screens[i]->pScreen; dixScreenOrigins[i].x = @@ -634,6 +662,10 @@ xf86InitOrigins(void) break; case PosBelow: ref = screen->refscreen->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } if(screensLeft & (1 << ref)) break; pScreen = xf86Screens[ref]->pScreen; dixScreenOrigins[i].x = dixScreenOrigins[ref].x; @@ -643,6 +675,10 @@ xf86InitOrigins(void) break; case PosAbove: ref = screen->refscreen->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } if(screensLeft & (1 << ref)) break; pScreen = xf86Screens[i]->pScreen; dixScreenOrigins[i].x = dixScreenOrigins[ref].x; diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index b2857bbf3..334754da1 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -137,7 +137,8 @@ static int numFormats = 6; #endif static Bool formatsDone = FALSE; -InputDriverRec XF86KEYBOARD = { +#ifdef USE_DEPRECATED_KEYBOARD_DRIVER +static InputDriverRec XF86KEYBOARD = { 1, "keyboard", NULL, @@ -146,6 +147,7 @@ InputDriverRec XF86KEYBOARD = { NULL, 0 }; +#endif static Bool xf86CreateRootWindow(WindowPtr pWin) @@ -562,6 +564,10 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) /* Tell the loader the default module search path */ LoaderSetPath(xf86ModulePath); + if (xf86Info.ignoreABI) { + LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL); + } + #ifdef TESTING { char **list, **l; diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c index b892e3e6a..cd57e9916 100644 --- a/hw/xfree86/common/xf86Mode.c +++ b/hw/xfree86/common/xf86Mode.c @@ -47,6 +47,22 @@ #include "xf86Priv.h" #include "xf86DDC.h" +static void +printModeRejectMessage(int index, DisplayModePtr p, int status) +{ + char *type; + + if (p->type & M_T_BUILTIN) + type = "built-in "; + else if (p->type & M_T_DEFAULT) + type = "default "; + else + type = ""; + + xf86DrvMsg(index, X_INFO, "Not using %smode \"%s\" (%s)\n", type, p->name, + xf86ModeStatusToString(status)); +} + /* * xf86GetNearestClock -- * Find closest clock to given frequency (in kHz). This assumes the @@ -1644,18 +1660,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, q->name = xnfstrdup(p->name); q->status = MODE_OK; } else { - if (p->type & M_T_BUILTIN) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using built-in mode \"%s\" (%s)\n", - p->name, xf86ModeStatusToString(status)); - else if (p->type & M_T_DEFAULT) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using default mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(status)); - else - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(status)); + printModeRejectMessage(scrp->scrnIndex, p, status); } } @@ -1758,7 +1763,8 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, * horizontal timing parameters that CRTs may have * problems with. */ - if ((q->type & M_T_DEFAULT) && + if (!scrp->monitor->reducedblanking && + (q->type & M_T_DEFAULT) && ((double)q->HTotal / (double)q->HDisplay) < 1.15) continue; @@ -1795,39 +1801,14 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, repeat = FALSE; lookupNext: - if (repeat && ((status = p->status) != MODE_OK)) { - if (p->type & M_T_BUILTIN) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using built-in mode \"%s\" (%s)\n", - p->name, xf86ModeStatusToString(status)); - else if (p->type & M_T_DEFAULT) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using default mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(status)); - else - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(status)); - } + if (repeat && ((status = p->status) != MODE_OK)) + printModeRejectMessage(scrp->scrnIndex, p, status); saveType = p->type; status = xf86LookupMode(scrp, p, clockRanges, strategy); - if (repeat && status == MODE_NOMODE) { + if (repeat && status == MODE_NOMODE) continue; - } - if (status != MODE_OK) { - if (p->type & M_T_BUILTIN) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using built-in mode \"%s\" (%s)\n", - p->name, xf86ModeStatusToString(status)); - else if (p->type & M_T_DEFAULT) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using default mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(status)); - else - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(status)); - } + if (status != MODE_OK) + printModeRejectMessage(scrp->scrnIndex, p, status); if (status == MODE_ERROR) { ErrorF("xf86ValidateModes: " "unexpected result from xf86LookupMode()\n"); @@ -2022,20 +2003,6 @@ xf86PruneDriverModes(ScrnInfoPtr scrp) return; n = p->next; if (p->status != MODE_OK) { -#if 0 - if (p->type & M_T_BUILTIN) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using built-in mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(p->status)); - else if (p->type & M_T_DEFAULT) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using default mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(p->status)); - else - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(p->status)); -#endif xf86DeleteMode(&(scrp->modes), p); } p = n; diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index a01b07fd7..67d4304c9 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -166,6 +166,7 @@ typedef struct { MessageType randRFrom; Bool aiglx; MessageType aiglxFrom; + Bool ignoreABI; struct { Bool disabled; /* enable/disable deactivating * grabs or closing the diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index 0dc176e04..1c78bd341 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -129,14 +129,19 @@ typedef enum { MODE_ERROR = -1 /* error condition */ } ModeStatus; +/* + * The mode sets are, from best to worst: USERDEF, DRIVER, and DEFAULT/BUILTIN. + * Preferred will bubble a mode to the top within a set. + */ # define M_T_BUILTIN 0x01 /* built-in mode */ # define M_T_CLOCK_C (0x02 | M_T_BUILTIN) /* built-in mode - configure clock */ # define M_T_CRTC_C (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC */ # define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C) /* built-in mode - configure CRTC and clock */ +# define M_T_PREFERRED 0x08 /* preferred mode within a set */ # define M_T_DEFAULT 0x10 /* (VESA) default modes */ # define M_T_USERDEF 0x20 /* One of the modes from the config file */ -# define M_T_EDID 0x40 /* Mode from the EDID info from the monitor */ +# define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */ /* Video mode */ typedef struct _DisplayModeRec { diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index 3340af0b5..e94804c3b 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -605,6 +605,10 @@ the builtin handler will be used. .TP 7 .BI "Option \*qAIGLX\*q \*q" boolean \*q enable or disable AIGLX. AIGLX is enabled by default. +.TP 7 +.BI "Option \*qIgnoreABI\*q \*q" boolean \*q +Allow modules built for a different, potentially incompatible version of +the X server to load. Disabled by default. .SH MODULE SECTION The .B Module diff --git a/hw/xfree86/os-support/Makefile.am b/hw/xfree86/os-support/Makefile.am index 789767430..e64703a53 100644 --- a/hw/xfree86/os-support/Makefile.am +++ b/hw/xfree86/os-support/Makefile.am @@ -3,7 +3,7 @@ DRI_SUBDIRS=drm endif SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS) -DIST_SUBDIRS = bsd bus drm misc linux lynxos solaris sysv sco usl +DIST_SUBDIRS = bsd bus drm misc linux lynxos solaris sysv sco usl hurd sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h xf86_ansic.h xf86_libc.h \ assyntax.h xf86OSKbd.h xf86OSmouse.h diff --git a/hw/xfree86/os-support/hurd/Makefile.am b/hw/xfree86/os-support/hurd/Makefile.am new file mode 100644 index 000000000..a05087619 --- /dev/null +++ b/hw/xfree86/os-support/hurd/Makefile.am @@ -0,0 +1,17 @@ +noinst_LTLIBRARIES = libhurd.la + +libhurd_la_SOURCES = hurd_init.c hurd_mmap.c \ + hurd_mouse.c hurd_video.c \ + $(srcdir)/../shared/VTsw_noop.c \ + $(srcdir)/../shared/posix_tty.c \ + $(srcdir)/../shared/libc_wrapper.c \ + $(srcdir)/../shared/stdResource.c \ + $(srcdir)/../shared/stdPci.c \ + $(srcdir)/../shared/sigiostubs.c \ + $(srcdir)/../shared/pm_noop.c \ + $(srcdir)/../shared/kmod_noop.c \ + $(srcdir)/../shared/agp_noop.c + +AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) @SERVER_DEFINES@ @LOADER_DEFINES@ + +INCLUDES = $(XORG_INCS) diff --git a/hw/xfree86/os-support/hurd/hurd_init.c b/hw/xfree86/os-support/hurd/hurd_init.c new file mode 100644 index 000000000..aec5b3d46 --- /dev/null +++ b/hw/xfree86/os-support/hurd/hurd_init.c @@ -0,0 +1,90 @@ +/* + * Copyright 1997,1998 by UCHIYAMA Yasushi + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of UCHIYAMA Yasushi not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. UCHIYAMA Yasushi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_init.c,v 1.1 1998/08/16 10:25:48 dawes Exp $ */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <X11/X.h> + +#include "input.h" +#include "scrnintstr.h" + +#include "compiler.h" + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +#include <stdio.h> +#include <errno.h> +#include <sys/time.h> +#include <sys/file.h> +#include <assert.h> +#include <mach.h> + +int +xf86ProcessArgument( int argc,char **argv, int i ) +{ + return 0; +} +void +xf86UseMsg() +{ + return; +} + + +void +xf86OpenConsole() +{ + if( serverGeneration == 1 ) + { + kern_return_t err; + mach_port_t device; + int fd; + err = get_privileged_ports( NULL, &device ); + if( err ) + { + errno = err; + FatalError( "xf86KbdInit can't get_privileged_ports. (%s)\n" , strerror(errno) ); + } + mach_port_deallocate (mach_task_self (), device); + + if( ( fd = open( "/dev/kbd" , O_RDONLY|O_NONBLOCK ) ) < 0 ) + { + fprintf( stderr , "Cannot open keyboard (%s)\n",strerror(errno) ); + exit(1); + } + xf86Info.consoleFd = fd; + } + return; +} + +void +xf86CloseConsole() +{ + close( xf86Info.consoleFd ); + return; +} diff --git a/hw/xfree86/os-support/hurd/hurd_mmap.c b/hw/xfree86/os-support/hurd/hurd_mmap.c new file mode 100644 index 000000000..5e800d28b --- /dev/null +++ b/hw/xfree86/os-support/hurd/hurd_mmap.c @@ -0,0 +1,96 @@ +/* + * Copyright 1997 by UCHIYAMA Yasushi + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of UCHIYAMA Yasushi not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. UCHIYAMA Yasushi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ +/* $XFree86$ */ +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include<mach.h> +#include<device/device.h> +#include<mach/machine/mach_i386.h> + +#include <X11/X.h> + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +#define BIOS_SIZE 0x20000 + +int +xf86ReadBIOS(unsigned long Base,unsigned long Offset,unsigned char *Buf,int Len) +{ + mach_port_t device,iopl_dev; + memory_object_t iopl_mem; + vm_address_t addr = (vm_address_t)0; /* serach starting address */ + kern_return_t err; + + + err = get_privileged_ports (NULL, &device); + if( err ) + { + errno = err; + FatalError("xf86ReadBIOS() can't get_privileged_ports. (%s)\n",strerror(errno)); + } + err = device_open(device,D_READ|D_WRITE,"iopl",&iopl_dev); + mach_port_deallocate (mach_task_self (), device); + if( err ) + { + errno = err; + FatalError("xf86ReadBIOS() can't device_open. (%s)\n",strerror(errno)); + } + err = device_map(iopl_dev,VM_PROT_READ|VM_PROT_WRITE, Base , BIOS_SIZE ,&iopl_mem,0); + if( err ) + { + errno = err; + FatalError("xf86ReadBIOS() can't device_map. (%s)\n",strerror(errno)); + } + err = vm_map(mach_task_self(), + &addr, + BIOS_SIZE, + 0, + TRUE, + iopl_mem, + Base, + FALSE, + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE, + VM_INHERIT_SHARE); + mach_port_deallocate(mach_task_self(),iopl_mem); + if( err ) + { + errno = err; + FatalError("xf86ReadBIOS() can't vm_map. (%s)\n",strerror(errno)); + } + + memcpy(Buf,(void*)((int)addr + Offset), Len); + + err = vm_deallocate(mach_task_self(), addr, BIOS_SIZE); + if( err ) + { + errno = err; + FatalError("xf86ReadBIOS() can't vm_deallocate. (%s)\n",strerror(errno)); + } + + return Len; +} diff --git a/hw/xfree86/os-support/hurd/hurd_mouse.c b/hw/xfree86/os-support/hurd/hurd_mouse.c new file mode 100644 index 000000000..e7a2da84d --- /dev/null +++ b/hw/xfree86/os-support/hurd/hurd_mouse.c @@ -0,0 +1,301 @@ +/* + * Copyright 1997,1998 by UCHIYAMA Yasushi + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of UCHIYAMA Yasushi not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. UCHIYAMA Yasushi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_mouse.c,v 1.7 2000/02/10 22:33:44 dawes Exp $ */ + +#define NEED_EVENTS +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <X11/X.h> +#include <X11/Xproto.h> +#include "inputstr.h" +#include "scrnintstr.h" +#include "mipointer.h" + +#include "xf86.h" +#include "xf86Xinput.h" +#include "xf86OSmouse.h" +#include "xf86_OSlib.h" +#include "xisb.h" + +#include <stdio.h> +#include <errno.h> +#include <sys/time.h> +#include <sys/file.h> +#include <assert.h> +#include <mach.h> +#include <sys/ioctl.h> + +typedef unsigned short kev_type; /* kd event type */ +typedef unsigned char Scancode; + +struct mouse_motion { + short mm_deltaX; /* units? */ + short mm_deltaY; +}; + +typedef struct { + kev_type type; /* see below */ + struct timeval time; /* timestamp */ + union { /* value associated with event */ + boolean_t up; /* MOUSE_LEFT .. MOUSE_RIGHT */ + Scancode sc; /* KEYBD_EVENT */ + struct mouse_motion mmotion; /* MOUSE_MOTION */ + } value; +} kd_event; + +/* + * kd_event ID's. + */ +#define MOUSE_LEFT 1 /* mouse left button up/down */ +#define MOUSE_MIDDLE 2 +#define MOUSE_RIGHT 3 +#define MOUSE_MOTION 4 /* mouse motion */ +#define KEYBD_EVENT 5 /* key up/down */ + +#define NUMEVENTS 64 + +/* + * OsMouseProc -- + * Handle the initialization, etc. of a mouse + */ +static int +OsMouseProc(DeviceIntPtr pPointer, int what) +{ + InputInfoPtr pInfo; + MouseDevPtr pMse; + unsigned char map[MSE_MAXBUTTONS + 1]; + int nbuttons; + + pInfo = pPointer->public.devicePrivate; + pMse = pInfo->private; + pMse->device = pPointer; + + switch (what) { + case DEVICE_INIT: + pPointer->public.on = FALSE; + + for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons) + map[nbuttons + 1] = nbuttons + 1; + + InitPointerDeviceStruct((DevicePtr)pPointer, + map, + min(pMse->buttons, MSE_MAXBUTTONS), + miPointerGetMotionEvents, + pMse->Ctrl, + miPointerGetMotionBufferSize()); + + /* X valuator */ + xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1); + xf86InitValuatorDefaults(pPointer, 0); + /* Y valuator */ + xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1); + xf86InitValuatorDefaults(pPointer, 1); + xf86MotionHistoryAllocate(pInfo); + break; + + case DEVICE_ON: + pInfo->fd = xf86OpenSerial(pInfo->options); + if (pInfo->fd == -1) + xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); + else { + pMse->buffer = XisbNew(pInfo->fd, + NUMEVENTS * sizeof(kd_event)); + if (!pMse->buffer) { + xfree(pMse); + xf86CloseSerial(pInfo->fd); + pInfo->fd = -1; + } else { + xf86FlushInput(pInfo->fd); + AddEnabledDevice(pInfo->fd); + } + } + pMse->lastButtons = 0; + pMse->lastMappedButtons = 0; + pMse->emulateState = 0; + pPointer->public.on = TRUE; + break; + + case DEVICE_OFF: + case DEVICE_CLOSE: + if (pInfo->fd != -1) { + RemoveEnabledDevice(pInfo->fd); + if (pMse->buffer) { + XisbFree(pMse->buffer); + pMse->buffer = NULL; + } + xf86CloseSerial(pInfo->fd); + pInfo->fd = -1; + } + pPointer->public.on = FALSE; + usleep(300000); + break; + } + return Success; +} + +/* + * OsMouseReadInput -- + * Get some events from our queue. Process all outstanding events now. + */ +static void +OsMouseReadInput(InputInfoPtr pInfo) +{ + MouseDevPtr pMse; + static kd_event eventList[NUMEVENTS]; + int n, c; + kd_event *event = eventList; + unsigned char *pBuf; + + pMse = pInfo->private; + + XisbBlockDuration(pMse->buffer, -1); + pBuf = (unsigned char *)eventList; + n = 0; + while ((c = XisbRead(pMse->buffer)) >= 0 && n < sizeof(eventList)) + pBuf[n++] = (unsigned char)c; + + if (n == 0) + return; + + n /= sizeof(kd_event); + while( n-- ) { + int buttons = pMse->lastButtons; + int dx = 0, dy = 0; + switch (event->type) { + case MOUSE_RIGHT: + buttons = buttons & 6 |(event->value.up ? 0 : 1); + break; + case MOUSE_MIDDLE: + buttons = buttons & 5 |(event->value.up ? 0 : 2); + break; + case MOUSE_LEFT: + buttons = buttons & 3 |(event->value.up ? 0 : 4) ; + break; + case MOUSE_MOTION: + dx = event->value.mmotion.mm_deltaX; + dy = - event->value.mmotion.mm_deltaY; + break; + default: + ErrorF("Bad mouse event (%d)\n",event->type); + continue; + } + pMse->PostEvent(pInfo, buttons, dx, dy, 0, 0); + ++event; + } + return; +} + +static Bool +OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) +{ + MouseDevPtr pMse; + + /* This is called when the protocol is "OSMouse". */ + + pMse = pInfo->private; + pMse->protocol = protocol; + xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); + + /* Collect the options, and process the common options. */ + xf86CollectInputOptions(pInfo, NULL, NULL); + xf86ProcessCommonOptions(pInfo, pInfo->options); + + /* Check if the device can be opened. */ + pInfo->fd = xf86OpenSerial(pInfo->options); + if (pInfo->fd == -1) { + if (xf86GetAllowMouseOpenFail()) + xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); + else { + xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name); + xfree(pMse); + return FALSE; + } + } + xf86CloseSerial(pInfo->fd); + pInfo->fd = -1; + + /* Process common mouse options (like Emulate3Buttons, etc). */ + pMse->CommonOptions(pInfo); + + /* Setup the local procs. */ + pInfo->device_control = OsMouseProc; + pInfo->read_input = OsMouseReadInput; + + pInfo->flags |= XI86_CONFIGURED; + return TRUE; +} + +static int +SupportedInterfaces(void) +{ + /* XXX Need to check this. */ + return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO; +} + +static const char *internalNames[] = { + "OSMouse", + NULL +}; + +static const char ** +BuiltinNames(void) +{ + return internalNames; +} + +static Bool +CheckProtocol(const char *protocol) +{ + int i; + + for (i = 0; internalNames[i]; i++) + if (xf86NameCmp(protocol, internalNames[i]) == 0) + return TRUE; + return FALSE; +} + +/* XXX Is this appropriate? If not, this function should be removed. */ +static const char * +DefaultProtocol(void) +{ + return "OSMouse"; +} + +OSMouseInfoPtr +xf86OSMouseInit(int flags) +{ + OSMouseInfoPtr p; + + p = xcalloc(sizeof(OSMouseInfoRec), 1); + if (!p) + return NULL; + p->SupportedInterfaces = SupportedInterfaces; + p->BuiltinNames = BuiltinNames; + p->DefaultProtocol = DefaultProtocol; + p->CheckProtocol = CheckProtocol; + p->PreInit = OsMousePreInit; + return p; +} + diff --git a/hw/xfree86/os-support/hurd/hurd_video.c b/hw/xfree86/os-support/hurd/hurd_video.c new file mode 100644 index 000000000..45e9a094b --- /dev/null +++ b/hw/xfree86/os-support/hurd/hurd_video.c @@ -0,0 +1,191 @@ +/* + * Copyright 1997, 1998 by UCHIYAMA Yasushi + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of UCHIYAMA Yasushi not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. UCHIYAMA Yasushi makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_video.c,v 1.3 1999/04/29 12:24:52 dawes Exp $ */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <mach.h> +#include <device/device.h> +#include <mach/machine/mach_i386.h> + +#include <X11/X.h> +#include "input.h" +#include "scrnintstr.h" + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" +#include "xf86OSpriv.h" + +/************************************************************************** + * Video Memory Mapping section + ***************************************************************************/ +pointer +xf86MapVidMem(int ScreenNum,int Flags, unsigned long Base, unsigned long Size) +{ + mach_port_t device,iopl_dev; + memory_object_t iopl_mem; + kern_return_t err; + vm_address_t addr=(vm_address_t)0; + + err = get_privileged_ports (NULL, &device); + if( err ) + { + errno = err; + FatalError("xf86MapVidMem() can't get_privileged_ports. (%s)\n",strerror(errno)); + } + err = device_open(device,D_READ|D_WRITE,"iopl",&iopl_dev); + mach_port_deallocate (mach_task_self(), device); + if( err ) + { + errno = err; + FatalError("xf86MapVidMem() can't device_open. (%s)\n",strerror(errno)); + } + + err = device_map(iopl_dev,VM_PROT_READ|VM_PROT_WRITE, Base , Size ,&iopl_mem,0); + if( err ) + { + errno = err; + FatalError("xf86MapVidMem() can't device_map. (%s)\n",strerror(errno)); + } + err = vm_map(mach_task_self(), + &addr, + Size, + 0, /* mask */ + TRUE, /* anywhere */ + iopl_mem, + (vm_offset_t)Base, + FALSE, /* copy on write */ + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE, + VM_INHERIT_SHARE); + mach_port_deallocate(mach_task_self(),iopl_mem); + if( err ) + { + errno = err; + FatalError("xf86MapVidMem() can't vm_map.(iopl_mem) (%s)\n",strerror(errno)); + } + mach_port_deallocate(mach_task_self(),iopl_dev); + if( err ) + { + errno = err; + FatalError("xf86MapVidMem() can't mach_port_deallocate.(iopl_dev) (%s)\n",strerror(errno)); + } + return (pointer)addr; +} + +void +xf86UnMapVidMem(int ScreenNum,pointer Base,unsigned long Size) +{ + kern_return_t err = vm_deallocate(mach_task_self(), (int)Base, Size); + if( err ) + { + errno = err; + ErrorF("xf86UnMapVidMem: can't dealloc framebuffer space (%s)\n",strerror(errno)); + } + return; +} + +Bool +xf86LinearVidMem() +{ + return(TRUE); +} + +/************************************************************************** + * I/O Permissions section + ***************************************************************************/ +mach_port_t io_port; + +Bool +xf86EnableIO() +{ + mach_port_t device; + kern_return_t err; + + err = get_privileged_ports(NULL, &device); + if( err ) + { + errno = err; + FatalError("xf86EnableIO() can't get_privileged_ports. (%s)\n",strerror(errno)); + } + err = device_open(device,D_READ|D_WRITE,"io",&io_port); + mach_port_deallocate(mach_task_self(), device); + if( err ) + { + errno = err; + FatalError("xf86EnableIO() can't device_open. (%s)\n",strerror(errno)); + } + + err = i386_io_port_add(mach_thread_self (), io_port); + if( err ) + { + errno = err; + FatalError("xf86EnableIO() can't i386_io_port_add.(io_port) (%s)\n",strerror(errno)); + } + return TRUE; +} + +void +xf86DisableIO() +{ + kern_return_t err; + + err = i386_io_port_remove(mach_thread_self (), io_port); + if( err ) + { + errno = err; + FatalError("xf86DisableIO() can't i386_io_port_remove.(io_port) (%s)\n",strerror(errno)); + } + mach_port_deallocate(mach_task_self(), io_port); + return; +} + +/************************************************************************** + * Interrupt Handling section + **************************************************************************/ +Bool +xf86DisableInterrupts() +{ + return TRUE; +} +void +xf86EnableInterrupts() +{ + return; +} + +void +xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base, + unsigned long Size) +{ +} + +Bool +xf86CheckMTRR(int s) +{ + return FALSE; +} + diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c index 051970b23..4b580464f 100644 --- a/hw/xfree86/os-support/linux/lnx_video.c +++ b/hw/xfree86/os-support/linux/lnx_video.c @@ -464,7 +464,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) Base,realBase,alignOff); #endif -#if defined(__ia64__) +#if defined(__ia64__) || defined(__arm__) || defined(__s390__) #ifndef MAP_WRITECOMBINED #define MAP_WRITECOMBINED 0x00010000 #endif @@ -594,7 +594,7 @@ xf86DisableIO(void) #if defined(__powerpc__) munmap(ioBase, 0x20000); ioBase = NULL; -#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) +#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) iopl(0); ioperm(0, 1024, 0); #endif @@ -613,12 +613,12 @@ xf86DisableIO(void) _X_EXPORT Bool xf86DisableInterrupts() { -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__) +#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) if (!ExtendedEnabled) if (iopl(3) || ioperm(0, 1024, 1)) return (FALSE); #endif -#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__) +#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__) || defined(__s390__) #else # ifdef __GNUC__ # if defined(__ia64__) @@ -632,7 +632,7 @@ xf86DisableInterrupts() asm("cli"); # endif #endif -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__) +#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) if (!ExtendedEnabled) { iopl(0); ioperm(0, 1024, 0); @@ -645,12 +645,12 @@ xf86DisableInterrupts() _X_EXPORT void xf86EnableInterrupts() { -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__) +#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) if (!ExtendedEnabled) if (iopl(3) || ioperm(0, 1024, 1)) return; #endif -#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__) +#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__) || defined(__s390__) #else # ifdef __GNUC__ # if defined(__ia64__) @@ -664,7 +664,7 @@ xf86EnableInterrupts() asm("sti"); # endif #endif -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__) +#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) if (!ExtendedEnabled) { iopl(0); ioperm(0, 1024, 0); diff --git a/hw/xfree86/vgahw/vgaHW.h b/hw/xfree86/vgahw/vgaHW.h index 0879f9641..ff7d1e5e0 100644 --- a/hw/xfree86/vgahw/vgaHW.h +++ b/hw/xfree86/vgahw/vgaHW.h @@ -175,7 +175,7 @@ typedef struct _vgaHWRec { #define BITS_PER_GUN 6 #define COLORMAP_SIZE 256 -#if defined(__powerpc__) +#if defined(__powerpc__) || defined(__arm__) || defined(__s390__) #define DACDelay(hw) /* No legacy VGA support */ #else #define DACDelay(hw) \ diff --git a/hw/xnest/Args.c b/hw/xnest/Args.c index 0aa0ca478..5d0a0c02d 100644 --- a/hw/xnest/Args.c +++ b/hw/xnest/Args.c @@ -58,6 +58,13 @@ void ddxInitGlobals(void) int ddxProcessArgument (int argc, char *argv[], int i) { + +#ifdef COMPOSITE + /* XXX terrible hack */ + extern Bool noCompositeExtension; + noCompositeExtension = TRUE; +#endif + if (!strcmp(argv[i], "-display")) { if (++i < argc) { xnestDisplayName = argv[i]; diff --git a/hw/xwin/winclipboardwndproc.c b/hw/xwin/winclipboardwndproc.c index 369aac58d..802a74035 100644 --- a/hw/xwin/winclipboardwndproc.c +++ b/hw/xwin/winclipboardwndproc.c @@ -56,6 +56,8 @@ extern void *g_pClipboardDisplay; extern Window g_iClipboardWindow; extern Atom g_atomLastOwnedSelection; +/* BPS - g_hwndClipboard needed for X app->Windows paste fix */ +extern HWND g_hwndClipboard; /* * Local function prototypes @@ -141,6 +143,12 @@ winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay, * Process a given Windows message */ +/* BPS - Define our own message, which we'll post to ourselves to facilitate + * resetting the delayed rendering mechanism after each paste from X app to + * Windows app. TODO - Perhaps move to win.h with the other WM_USER messages. + */ +#define WM_USER_PASTE_COMPLETE (WM_USER + 1003) + LRESULT CALLBACK winClipboardWindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) @@ -167,16 +175,19 @@ winClipboardWindowProc (HWND hwnd, UINT message, case WM_CREATE: { + HWND first, next; + DWORD error_code = 0; winDebug ("winClipboardWindowProc - WM_CREATE\n"); + first = GetClipboardViewer(); /* Get handle to first viewer in chain. */ + if (first == hwnd) return 0; /* Make sure it's not us! */ /* Add ourselves to the clipboard viewer chain */ - s_hwndNextViewer = SetClipboardViewer (hwnd); - if (s_hwndNextViewer == hwnd) - { - s_hwndNextViewer = NULL; - winErrorFVerb (1, "winClipboardWindowProc - WM_CREATE: " - "attempted to set next window to ourselves."); - } + next = SetClipboardViewer (hwnd); + error_code = GetLastError(); + if (SUCCEEDED(error_code) && (next == first)) /* SetClipboardViewer must have succeeded, and the handle */ + s_hwndNextViewer = next; /* it returned must have been the first window in the chain */ + else + s_fCBCInitialized = FALSE; } return 0; @@ -220,28 +231,27 @@ winClipboardWindowProc (HWND hwnd, UINT message, * expensive than just putting ourselves back into the chain. */ + HWND first, next; + DWORD error_code = 0; winDebug ("winClipboardWindowProc - WM_WM_REINIT: Enter\n"); - if (hwnd != GetClipboardViewer ()) - { - winDebug (" WM_WM_REINIT: Replacing us(%x) with %x at head " - "of chain\n", hwnd, s_hwndNextViewer); - s_fCBCInitialized = FALSE; - ChangeClipboardChain (hwnd, s_hwndNextViewer); - s_hwndNextViewer = NULL; - s_fCBCInitialized = FALSE; - winDebug (" WM_WM_REINIT: Putting us back at head of chain.\n"); - s_hwndNextViewer = SetClipboardViewer (hwnd); - if (s_hwndNextViewer == hwnd) - { - s_hwndNextViewer = NULL; - winErrorFVerb (1, "winClipboardWindowProc - WM_WM_REINIT: " - "attempted to set next window to ourselves.\n"); - } - } + + first = GetClipboardViewer(); /* Get handle to first viewer in chain. */ + if (first == hwnd) return 0; /* Make sure it's not us! */ + winDebug (" WM_WM_REINIT: Replacing us(%x) with %x at head " + "of chain\n", hwnd, s_hwndNextViewer); + s_fCBCInitialized = FALSE; + ChangeClipboardChain (hwnd, s_hwndNextViewer); + s_hwndNextViewer = NULL; + s_fCBCInitialized = FALSE; + winDebug (" WM_WM_REINIT: Putting us back at head of chain.\n"); + first = GetClipboardViewer(); /* Get handle to first viewer in chain. */ + if (first == hwnd) return 0; /* Make sure it's not us! */ + next = SetClipboardViewer (hwnd); + error_code = GetLastError(); + if (SUCCEEDED(error_code) && (next == first)) /* SetClipboardViewer must have succeeded, and the handle */ + s_hwndNextViewer = next; /* it returned must have been the first window in the chain */ else - { - winDebug (" WM_WM_REINIT: already at head of viewer chain.\n"); - } + s_fCBCInitialized = FALSE; } winDebug ("winClipboardWindowProc - WM_WM_REINIT: Exit\n"); return 0; @@ -325,8 +335,6 @@ winClipboardWindowProc (HWND hwnd, UINT message, * previous XSetSelectionOwner messages. */ XSync (pDisplay, FALSE); - - winDebug("winClipboardWindowProc - XSync done.\n"); /* Release PRIMARY selection if owned */ iReturn = XGetSelectionOwner (pDisplay, XA_PRIMARY); @@ -525,6 +533,13 @@ winClipboardWindowProc (HWND hwnd, UINT message, SetClipboardData (CF_TEXT, NULL); } + /* BPS - Post ourselves a user message whose handler will reset the + * delayed rendering mechanism after the paste is complete. This is + * necessary because calling SetClipboardData() with a NULL argument + * here will cause the data we just put on the clipboard to be lost! + */ + PostMessage(g_hwndClipboard, WM_USER_PASTE_COMPLETE, 0, 0); + /* Special handling for WM_RENDERALLFORMATS */ if (message == WM_RENDERALLFORMATS) { @@ -542,6 +557,37 @@ winClipboardWindowProc (HWND hwnd, UINT message, winDebug ("winClipboardWindowProc - WM_RENDER*FORMAT - Returning.\n"); return 0; } + /* BPS - This WM_USER message is posted by us. It gives us the opportunity + * to reset the delayed rendering mechanism after each and every paste + * from an X app to a Windows app. Without such a mechanism, subsequent + * changes of selection in the X app owning the selection are not + * reflected in pastes into Windows apps, since Windows won't send us the + * WM_RENDERFORMAT message unless someone has set changed data (or NULL) + * on the clipboard. */ + case WM_USER_PASTE_COMPLETE: + { + if (hwnd != GetClipboardOwner ()) + /* In case we've lost the selection since posting the message */ + return 0; + winDebug ("winClipboardWindowProc - WM_USER_PASTE_COMPLETE\n"); + + /* Set up for another delayed rendering callback */ + OpenClipboard (g_hwndClipboard); + + /* Take ownership of the Windows clipboard */ + EmptyClipboard (); + + /* Advertise Unicode if we support it */ + if (g_fUnicodeSupport) + SetClipboardData (CF_UNICODETEXT, NULL); + + /* Always advertise regular text */ + SetClipboardData (CF_TEXT, NULL); + + /* Release the clipboard */ + CloseClipboard (); + } + return 0; } /* Let Windows perform default processing for unhandled messages */ diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index 045adbac6..0df896dd3 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -304,7 +304,6 @@ winTopLevelWindowProc (HWND hwnd, UINT message, winScreenInfo *s_pScreenInfo = NULL; HWND hwndScreen = NULL; DrawablePtr pDraw = NULL; - int iX, iY, iWidth, iHeight, iBorder; winWMMessageRec wmMsg; Bool fWMMsgInitialized = FALSE; static Bool s_fTracking = FALSE; @@ -394,6 +393,15 @@ winTopLevelWindowProc (HWND hwnd, UINT message, * currently being created. */ winReorderWindowsMultiWindow (); + + /* Fix a 'round title bar corner background should be transparent not black' problem when first painted */ + RECT rWindow; + HRGN hRgnWindow; + GetWindowRect(hwnd, &rWindow); + hRgnWindow = CreateRectRgnIndirect(&rWindow); + SetWindowRgn (hwnd, hRgnWindow, TRUE); + DeleteObject(hRgnWindow); + return 0; case WM_INIT_SYS_MENU: @@ -433,20 +441,19 @@ winTopLevelWindowProc (HWND hwnd, UINT message, /* BeginPaint gives us an hdc that clips to the invalidated region */ hdcUpdate = BeginPaint (hwnd, &ps); - - /* Get the position and dimensions of the window */ - iBorder = wBorderWidth (pWin); - iX = pWin->drawable.x; - iY = pWin->drawable.y; - iWidth = pWin->drawable.width; - iHeight = pWin->drawable.height; + /* Avoid the BitBlt's if the PAINTSTRUCT is bogus */ + if (ps.rcPaint.right==0 && ps.rcPaint.bottom==0 && ps.rcPaint.left==0 && ps.rcPaint.top==0) + { + EndPaint (hwndScreen, &ps); + return 0; + } /* Try to copy from the shadow buffer */ if (!BitBlt (hdcUpdate, - 0, 0, - iWidth, iHeight, + ps.rcPaint.left, ps.rcPaint.top, + ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top, s_pScreenPriv->hdcShadow, - iX, iY, + ps.rcPaint.left + pWin->drawable.x, ps.rcPaint.top + pWin->drawable.y, SRCCOPY)) { LPVOID lpMsgBuf; diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c index ba9819298..04cc2f716 100644 --- a/hw/xwin/winshadgdi.c +++ b/hw/xwin/winshadgdi.c @@ -540,8 +540,9 @@ winShadowUpdateGDI (ScreenPtr pScreen, * handle large regions by creating a clipping region and * doing a single blit constrained to that clipping region. */ - if (pScreenInfo->dwClipUpdatesNBoxes == 0 - || dwBox < pScreenInfo->dwClipUpdatesNBoxes) + if (!pScreenInfo->fMultiWindow && + (pScreenInfo->dwClipUpdatesNBoxes == 0 || + dwBox < pScreenInfo->dwClipUpdatesNBoxes)) { /* Loop through all boxes in the damaged region */ while (dwBox--) @@ -566,7 +567,7 @@ winShadowUpdateGDI (ScreenPtr pScreen, ++pBox; } } - else + else if (!pScreenInfo->fMultiWindow) { /* Compute a GDI region from the damaged region */ hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); |