diff options
Diffstat (limited to 'xorg-server/hw')
47 files changed, 1979 insertions, 1997 deletions
diff --git a/xorg-server/hw/dmx/Makefile.am b/xorg-server/hw/dmx/Makefile.am index b31fbb85c..3c59320e1 100644 --- a/xorg-server/hw/dmx/Makefile.am +++ b/xorg-server/hw/dmx/Makefile.am @@ -84,10 +84,7 @@ XDMX_LIBS = \ @XDMX_LIBS@ \ $(GLX_LIBS) \ input/libdmxinput.a \ - config/libdmxconfig.a \ - $(MAIN_LIB) \ - $(XSERVER_LIBS) \ - $(top_builddir)/xfixes/libxfixes.la + config/libdmxconfig.a Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) Xdmx_DEPENDENCIES= $(XDMX_LIBS) diff --git a/xorg-server/hw/dmx/Makefile.in b/xorg-server/hw/dmx/Makefile.in index 3a87107b8..1e9c1693e 100644 --- a/xorg-server/hw/dmx/Makefile.in +++ b/xorg-server/hw/dmx/Makefile.in @@ -83,10 +83,9 @@ am_Xdmx_OBJECTS = dmx.$(OBJEXT) dmxcb.$(OBJEXT) dmxcmap.$(OBJEXT) \ dmxsync.$(OBJEXT) dmxvisual.$(OBJEXT) dmxwindow.$(OBJEXT) \ miinitext.$(OBJEXT) fbcmap_mi.$(OBJEXT) $(am__objects_2) Xdmx_OBJECTS = $(am_Xdmx_OBJECTS) -am__DEPENDENCIES_1 = -am__DEPENDENCIES_2 = $(GLX_LIBS) input/libdmxinput.a \ - config/libdmxconfig.a $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(top_builddir)/xfixes/libxfixes.la +am__DEPENDENCIES_1 = $(GLX_LIBS) input/libdmxinput.a \ + config/libdmxconfig.a +am__DEPENDENCIES_2 = AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent @@ -364,10 +363,7 @@ XDMX_LIBS = \ @XDMX_LIBS@ \ $(GLX_LIBS) \ input/libdmxinput.a \ - config/libdmxconfig.a \ - $(MAIN_LIB) \ - $(XSERVER_LIBS) \ - $(top_builddir)/xfixes/libxfixes.la + config/libdmxconfig.a XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ diff --git a/xorg-server/hw/dmx/dmx-config.h b/xorg-server/hw/dmx/dmx-config.h index 5b7b60593..9791dc0bc 100644 --- a/xorg-server/hw/dmx/dmx-config.h +++ b/xorg-server/hw/dmx/dmx-config.h @@ -72,17 +72,4 @@ /* Enable the DMX extension */ #define DMXEXT -/* Disable the extensions that are not currently supported */ -#undef MULTIBUFFER -#undef XV -#undef DBE -#undef XF86VIDMODE -#undef XFreeXDGA -#undef XF86DRI -#undef SCREENSAVER -#undef RANDR -#undef XFIXES -#undef DAMAGE -#undef COMPOSITE - #endif /* DMX_CONFIG_H */ diff --git a/xorg-server/hw/dmx/input/dmxevents.c b/xorg-server/hw/dmx/input/dmxevents.c index 5c3d79215..70737b4c4 100644 --- a/xorg-server/hw/dmx/input/dmxevents.c +++ b/xorg-server/hw/dmx/input/dmxevents.c @@ -183,7 +183,7 @@ static void enqueueMotion(DevicePtr pDev, int x, int y) GetEventList(&events); nevents = GetPointerEvents(events, p, MotionNotify, detail, - POINTER_ABSOLUTE, 0, 2, valuators); + POINTER_ABSOLUTE | POINTER_SCREEN, 0, 2, valuators); for (i = 0; i < nevents; i++) mieqEnqueue(p, (InternalEvent*)(events + i)->event); return; @@ -688,7 +688,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, detail = dmxGetButtonMapping(dmxLocal, detail); GetEventList(&events); nevents = GetPointerEvents(events, p, type, detail, - POINTER_ABSOLUTE, + POINTER_ABSOLUTE | POINTER_SCREEN, 0, /* first_valuator = 0 */ 0, /* num_valuators = 0 */ valuators); @@ -700,9 +700,9 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, GetEventList(&events); valuators[0] = e->xmotion.x; valuators[1] = e->xmotion.y; - valuators[2] = e->xmotion.state; + valuators[2] = e->xmotion.state; /* FIXME: WTF?? */ nevents = GetPointerEvents(events, p, type, detail, - POINTER_ABSOLUTE, 0, 3, valuators); + POINTER_ABSOLUTE | POINTER_SCREEN, 0, 3, valuators); for (i = 0; i < nevents; i++) mieqEnqueue(p, (InternalEvent*)(events + i)->event); return; diff --git a/xorg-server/hw/kdrive/ephyr/Xephyr.man.pre b/xorg-server/hw/kdrive/ephyr/Xephyr.man.pre index 008256914..eb80b96b0 100644 --- a/xorg-server/hw/kdrive/ephyr/Xephyr.man.pre +++ b/xorg-server/hw/kdrive/ephyr/Xephyr.man.pre @@ -46,6 +46,11 @@ sets the screen size. .BI -parent " id" uses exiting window .I id . +If a +.BI -screen +argument follows a +.BI -parent +argument, this screen is embedded into the given window. .TP 8 .B -host-cursor set 'cursor acceleration': diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c index 947a7ff1b..87e48afaf 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyr.c +++ b/xorg-server/hw/kdrive/ephyr/ephyr.c @@ -1,1183 +1,1187 @@ -/* - * Xephyr - A kdrive X server thats runs in a host X window. - * Authored by Matthew Allum <mallum@openedhand.com> - * - * Copyright © 2004 Nokia - * - * 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 Nokia not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Nokia makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL NOKIA 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. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "ephyr.h" - -#include "inputstr.h" -#include "scrnintstr.h" -#include "ephyrlog.h" - -#ifdef XF86DRI -#include "ephyrdri.h" -#include "ephyrdriext.h" -#include "ephyrglxext.h" -#endif /* XF86DRI */ - -extern int KdTsPhyScreen; -#ifdef GLXEXT -extern Bool noGlxVisualInit; -#endif - -KdKeyboardInfo *ephyrKbd; -KdPointerInfo *ephyrMouse; -EphyrKeySyms ephyrKeySyms; -Bool ephyrNoDRI=FALSE ; -Bool ephyrNoXV=FALSE ; - -static int mouseState = 0; - -typedef struct _EphyrInputPrivate { - Bool enabled; -} EphyrKbdPrivate, EphyrPointerPrivate; - -Bool EphyrWantGrayScale = 0; - - -Bool -ephyrInitialize (KdCardInfo *card, EphyrPriv *priv) -{ -#ifdef _MSC_VER - __asm int 3; -#else - OsSignal(SIGUSR1, hostx_handle_signal); -#endif - priv->base = 0; - priv->bytes_per_line = 0; - return TRUE; -} - -Bool -ephyrCardInit (KdCardInfo *card) -{ - EphyrPriv *priv; - - priv = (EphyrPriv *) xalloc (sizeof (EphyrPriv)); - if (!priv) - return FALSE; - - if (!ephyrInitialize (card, priv)) - { - xfree (priv); - return FALSE; - } - card->driver = priv; - - return TRUE; -} - -Bool -ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv) -{ - int width = 640, height = 480; - CARD32 redMask, greenMask, blueMask; - - if (hostx_want_screen_size(screen, &width, &height) - || !screen->width || !screen->height) - { - screen->width = width; - screen->height = height; - } - - if (EphyrWantGrayScale) - screen->fb[0].depth = 8; - - if (screen->fb[0].depth && screen->fb[0].depth != hostx_get_depth()) - { - if (screen->fb[0].depth < hostx_get_depth() - && (screen->fb[0].depth == 24 || screen->fb[0].depth == 16 - || screen->fb[0].depth == 8)) - { - hostx_set_server_depth(screen, screen->fb[0].depth); - } - else - ErrorF("\nXephyr: requested screen depth not supported, setting to match hosts.\n"); - } - - screen->fb[0].depth = hostx_get_server_depth(screen); - screen->rate = 72; - - if (screen->fb[0].depth <= 8) - { - if (EphyrWantGrayScale) - screen->fb[0].visuals = ((1 << StaticGray) | (1 << GrayScale)); - else - screen->fb[0].visuals = ((1 << StaticGray) | - (1 << GrayScale) | - (1 << StaticColor) | - (1 << PseudoColor) | - (1 << TrueColor) | - (1 << DirectColor)); - - screen->fb[0].redMask = 0x00; - screen->fb[0].greenMask = 0x00; - screen->fb[0].blueMask = 0x00; - screen->fb[0].depth = 8; - screen->fb[0].bitsPerPixel = 8; - } - else - { - screen->fb[0].visuals = (1 << TrueColor); - - if (screen->fb[0].depth <= 15) - { - screen->fb[0].depth = 15; - screen->fb[0].bitsPerPixel = 16; - } - else if (screen->fb[0].depth <= 16) - { - screen->fb[0].depth = 16; - screen->fb[0].bitsPerPixel = 16; - } - else if (screen->fb[0].depth <= 24) - { - screen->fb[0].depth = 24; - screen->fb[0].bitsPerPixel = 32; - } - else if (screen->fb[0].depth <= 30) - { - screen->fb[0].depth = 30; - screen->fb[0].bitsPerPixel = 32; - } - else - { - ErrorF("\nXephyr: Unsupported screen depth %d\n", - screen->fb[0].depth); - return FALSE; - } - - hostx_get_visual_masks (screen, &redMask, &greenMask, &blueMask); - - screen->fb[0].redMask = (Pixel) redMask; - screen->fb[0].greenMask = (Pixel) greenMask; - screen->fb[0].blueMask = (Pixel) blueMask; - - } - - scrpriv->randr = screen->randr; - - return ephyrMapFramebuffer (screen); -} - -Bool -ephyrScreenInit (KdScreenInfo *screen) -{ - EphyrScrPriv *scrpriv; - - scrpriv = xcalloc (1, sizeof (EphyrScrPriv)); - - if (!scrpriv) - return FALSE; - - screen->driver = scrpriv; - - if (!ephyrScreenInitialize (screen, scrpriv)) - { - screen->driver = 0; - xfree (scrpriv); - return FALSE; - } - - return TRUE; -} - -void* -ephyrWindowLinear (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size, - void *closure) -{ - KdScreenPriv(pScreen); - EphyrPriv *priv = pScreenPriv->card->driver; - - if (!pScreenPriv->enabled) - return 0; - - *size = priv->bytes_per_line; - return priv->base + row * priv->bytes_per_line + offset; -} - -Bool -ephyrMapFramebuffer (KdScreenInfo *screen) -{ - EphyrScrPriv *scrpriv = screen->driver; - EphyrPriv *priv = screen->card->driver; - KdPointerMatrix m; - int buffer_height; - - EPHYR_LOG("screen->width: %d, screen->height: %d index=%d", - screen->width, screen->height, screen->mynum); - - KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height); - KdSetPointerMatrix (&m); - - priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2; - - /* point the framebuffer to the data in an XImage */ - /* If fakexa is enabled, allocate a larger buffer so that fakexa has space to - * put offscreen pixmaps. - */ - if (ephyrFuncs.initAccel == NULL) - buffer_height = screen->height; - else - buffer_height = 3 * screen->height; - - priv->base = hostx_screen_init (screen, screen->width, screen->height, buffer_height); - - screen->memory_base = (CARD8 *) (priv->base); - screen->memory_size = priv->bytes_per_line * buffer_height; - screen->off_screen_base = priv->bytes_per_line * screen->height; - - if ((scrpriv->randr & RR_Rotate_0) && !(scrpriv->randr & RR_Reflect_All)) - { - scrpriv->shadow = FALSE; - - screen->fb[0].byteStride = priv->bytes_per_line; - screen->fb[0].pixelStride = screen->width; - screen->fb[0].frameBuffer = (CARD8 *) (priv->base); - } - else - { - /* Rotated/Reflected so we need to use shadow fb */ - scrpriv->shadow = TRUE; - - EPHYR_LOG("allocing shadow"); - - KdShadowFbAlloc (screen, 0, - scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)); - } - - return TRUE; -} - -void -ephyrSetScreenSizes (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - - if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180)) - { - pScreen->width = screen->width; - pScreen->height = screen->height; - pScreen->mmWidth = screen->width_mm; - pScreen->mmHeight = screen->height_mm; - } - else - { - pScreen->width = screen->height; - pScreen->height = screen->width; - pScreen->mmWidth = screen->height_mm; - pScreen->mmHeight = screen->width_mm; - } -} - -Bool -ephyrUnmapFramebuffer (KdScreenInfo *screen) -{ - EphyrScrPriv *scrpriv = screen->driver; - - if (scrpriv->shadow) - KdShadowFbFree (screen, 0); - - /* Note, priv->base will get freed when XImage recreated */ - - return TRUE; -} - -void -ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - - EPHYR_LOG("slow paint"); - - /* FIXME: Slow Rotated/Reflected updates could be much - * much faster efficiently updating via tranforming - * pBuf->pDamage regions - */ - shadowUpdateRotatePacked(pScreen, pBuf); - hostx_paint_rect(screen, 0,0,0,0, screen->width, screen->height); -} - -static void -ephyrInternalDamageRedisplay (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - RegionPtr pRegion; - - if (!scrpriv || !scrpriv->pDamage) - return; - - pRegion = DamageRegion (scrpriv->pDamage); - - if (REGION_NOTEMPTY (pScreen, pRegion)) - { - int nbox; - BoxPtr pbox; - - nbox = REGION_NUM_RECTS (pRegion); - pbox = REGION_RECTS (pRegion); - - while (nbox--) - { - hostx_paint_rect(screen, - pbox->x1, pbox->y1, - pbox->x1, pbox->y1, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); - pbox++; - } - DamageEmpty (scrpriv->pDamage); - } -} - -static void -ephyrInternalDamageBlockHandler (pointer data, - OSTimePtr pTimeout, - pointer pRead) -{ - ScreenPtr pScreen = (ScreenPtr) data; - - ephyrInternalDamageRedisplay (pScreen); -} - -static void -ephyrInternalDamageWakeupHandler (pointer data, int i, pointer LastSelectMask) -{ - /* FIXME: Not needed ? */ -} - -Bool -ephyrSetInternalDamage (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - PixmapPtr pPixmap = NULL; - - scrpriv->pDamage = DamageCreate ((DamageReportFunc) 0, - (DamageDestroyFunc) 0, - DamageReportNone, - TRUE, - pScreen, - pScreen); - - if (!RegisterBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler, - ephyrInternalDamageWakeupHandler, - (pointer) pScreen)) - return FALSE; - - pPixmap = (*pScreen->GetScreenPixmap) (pScreen); - - DamageRegister (&pPixmap->drawable, scrpriv->pDamage); - - return TRUE; -} - -void -ephyrUnsetInternalDamage (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - PixmapPtr pPixmap = NULL; - - pPixmap = (*pScreen->GetScreenPixmap) (pScreen); - DamageUnregister (&pPixmap->drawable, scrpriv->pDamage); - DamageDestroy (scrpriv->pDamage); - - RemoveBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler, - ephyrInternalDamageWakeupHandler, - (pointer) pScreen); -} - -#ifdef RANDR -Bool -ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - RRScreenSizePtr pSize; - Rotation randr; - int n = 0; - - struct { int width, height; } sizes[] = - { - { 1600, 1200 }, - { 1400, 1050 }, - { 1280, 960 }, - { 1280, 1024 }, - { 1152, 864 }, - { 1024, 768 }, - { 832, 624 }, - { 800, 600 }, - { 720, 400 }, - { 480, 640 }, - { 640, 480 }, - { 640, 400 }, - { 320, 240 }, - { 240, 320 }, - { 160, 160 }, - { 0, 0 } - }; - - EPHYR_LOG("mark"); - - *rotations = RR_Rotate_All|RR_Reflect_All; - - if (!hostx_want_preexisting_window (screen) - && !hostx_want_fullscreen ()) /* only if no -parent switch */ - { - while (sizes[n].width != 0 && sizes[n].height != 0) - { - RRRegisterSize (pScreen, - sizes[n].width, - sizes[n].height, - (sizes[n].width * screen->width_mm)/screen->width, - (sizes[n].height *screen->height_mm)/screen->height - ); - n++; - } - } - - pSize = RRRegisterSize (pScreen, - screen->width, - screen->height, - screen->width_mm, - screen->height_mm); - - randr = KdSubRotation (scrpriv->randr, screen->randr); - - RRSetCurrentConfig (pScreen, randr, 0, pSize); - - return TRUE; -} - -Bool -ephyrRandRSetConfig (ScreenPtr pScreen, - Rotation randr, - int rate, - RRScreenSizePtr pSize) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - Bool wasEnabled = pScreenPriv->enabled; - EphyrScrPriv oldscr; - int oldwidth, oldheight, oldmmwidth, oldmmheight; - Bool oldshadow; - int newwidth, newheight; - - if (screen->randr & (RR_Rotate_0|RR_Rotate_180)) - { - newwidth = pSize->width; - newheight = pSize->height; - } - else - { - newwidth = pSize->height; - newheight = pSize->width; - } - - if (wasEnabled) - KdDisableScreen (pScreen); - - oldscr = *scrpriv; - - oldwidth = screen->width; - oldheight = screen->height; - oldmmwidth = pScreen->mmWidth; - oldmmheight = pScreen->mmHeight; - oldshadow = scrpriv->shadow; - - /* - * Set new configuration - */ - - scrpriv->randr = KdAddRotation (screen->randr, randr); - - ephyrUnmapFramebuffer (screen); - - screen->width = newwidth; - screen->height = newheight; - - if (!ephyrMapFramebuffer (screen)) - goto bail4; - - /* FIXME below should go in own call */ - - if (oldshadow) - KdShadowUnset (screen->pScreen); - else - ephyrUnsetInternalDamage(screen->pScreen); - - if (scrpriv->shadow) - { - if (!KdShadowSet (screen->pScreen, - scrpriv->randr, - ephyrShadowUpdate, - ephyrWindowLinear)) - goto bail4; - } - else - { - /* Without shadow fb ( non rotated ) we need - * to use damage to efficiently update display - * via signal regions what to copy from 'fb'. - */ - if (!ephyrSetInternalDamage(screen->pScreen)) - goto bail4; - } - - ephyrSetScreenSizes (screen->pScreen); - - /* - * Set frame buffer mapping - */ - (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen), - pScreen->width, - pScreen->height, - screen->fb[0].depth, - screen->fb[0].bitsPerPixel, - screen->fb[0].byteStride, - screen->fb[0].frameBuffer); - - /* set the subpixel order */ - - KdSetSubpixelOrder (pScreen, scrpriv->randr); - - if (wasEnabled) - KdEnableScreen (pScreen); - - return TRUE; - - bail4: - EPHYR_LOG("bailed"); - - ephyrUnmapFramebuffer (screen); - *scrpriv = oldscr; - (void) ephyrMapFramebuffer (screen); - - pScreen->width = oldwidth; - pScreen->height = oldheight; - pScreen->mmWidth = oldmmwidth; - pScreen->mmHeight = oldmmheight; - - if (wasEnabled) - KdEnableScreen (pScreen); - return FALSE; -} - -Bool -ephyrRandRInit (ScreenPtr pScreen) -{ - rrScrPrivPtr pScrPriv; - - if (!RRScreenInit (pScreen)) - return FALSE; - - pScrPriv = rrGetScrPriv(pScreen); - pScrPriv->rrGetInfo = ephyrRandRGetInfo; - pScrPriv->rrSetConfig = ephyrRandRSetConfig; - return TRUE; -} -#endif - -Bool -ephyrCreateColormap (ColormapPtr pmap) -{ - return fbInitializeColormap (pmap); -} - -Bool -ephyrInitScreen (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - - EPHYR_LOG ("pScreen->myNum:%d\n", pScreen->myNum) ; - hostx_set_screen_number (screen, pScreen->myNum); - hostx_set_win_title (screen, "(ctrl+shift grabs mouse and keyboard)") ; - pScreen->CreateColormap = ephyrCreateColormap; - -#ifdef XV - if (!ephyrNoXV) { - if (!ephyrInitVideo (pScreen)) { - EPHYR_LOG_ERROR ("failed to initialize xvideo\n") ; - } else { - EPHYR_LOG ("initialized xvideo okay\n") ; - } - } -#endif /*XV*/ - -#ifdef XF86DRI - if (!ephyrNoDRI && !hostx_has_dri ()) { - EPHYR_LOG ("host x does not support DRI. Disabling DRI forwarding\n") ; - ephyrNoDRI = TRUE ; -#ifdef GLXEXT - noGlxVisualInit = FALSE ; -#endif - } - if (!ephyrNoDRI) { - ephyrDRIExtensionInit (pScreen) ; - ephyrHijackGLXExtension () ; - } -#endif - -#ifdef GLXEXT - if (ephyrNoDRI) { - noGlxVisualInit = FALSE ; - } -#endif - - return TRUE; -} - -Bool -ephyrFinishInitScreen (ScreenPtr pScreen) -{ - /* FIXME: Calling this even if not using shadow. - * Seems harmless enough. But may be safer elsewhere. - */ - if (!shadowSetup (pScreen)) - return FALSE; - -#ifdef RANDR - if (!ephyrRandRInit (pScreen)) - return FALSE; -#endif - - return TRUE; -} - -Bool -ephyrCreateResources (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - - EPHYR_LOG("mark pScreen=%p mynum=%d shadow=%d", - pScreen, pScreen->myNum, scrpriv->shadow); - - if (scrpriv->shadow) - return KdShadowSet (pScreen, - scrpriv->randr, - ephyrShadowUpdate, - ephyrWindowLinear); - else - return ephyrSetInternalDamage(pScreen); -} - -void -ephyrPreserve (KdCardInfo *card) -{ -} - -Bool -ephyrEnable (ScreenPtr pScreen) -{ - return TRUE; -} - -Bool -ephyrDPMS (ScreenPtr pScreen, int mode) -{ - return TRUE; -} - -void -ephyrDisable (ScreenPtr pScreen) -{ -} - -void -ephyrRestore (KdCardInfo *card) -{ -} - -void -ephyrScreenFini (KdScreenInfo *screen) -{ - EphyrScrPriv *scrpriv = screen->driver; - if (scrpriv->shadow) { - KdShadowFbFree (screen, 0); - } - xfree(screen->driver); - screen->driver = NULL; -} - -/* - * Port of Mark McLoughlin's Xnest fix for focus in + modifier bug. - * See https://bugs.freedesktop.org/show_bug.cgi?id=3030 - */ -void -ephyrUpdateModifierState(unsigned int state) -{ -#if 0 - DeviceIntPtr pkeydev; - KeyClassPtr keyc; - int i; - CARD8 mask; - - pkeydev = inputInfo.keyboard; - - if (!pkeydev) - return; - -/* This is pretty broken. - * - * What should happen is that focus out should do as a VT switch does in - * traditional servers: fake releases for all keys (and buttons too, come - * to think of it) currently down. Then, on focus in, get the state from - * the host, and fake keypresses for everything currently down. - * - * So I'm leaving this broken for a little while. Sorry, folks. - * - * -daniels - */ - - keyc = pkeydev->key; - - state = state & 0xff; - - if (keyc->state == state) - return; - - for (i = 0, mask = 1; i < 8; i++, mask <<= 1) - { - int key; - - /* Modifier is down, but shouldn't be */ - if ((keyc->state & mask) && !(state & mask)) - { - int count = keyc->modifierKeyCount[i]; - - for (key = 0; key < MAP_LENGTH; key++) - if (keyc->xkbInfo->desc->map->modmap[key] & mask) - { - int bit; - BYTE *kptr; - - kptr = &keyc->down[key >> 3]; - bit = 1 << (key & 7); - - if (*kptr & bit && ephyrKbd && - ((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled) - KdEnqueueKeyboardEvent(ephyrKbd, key, TRUE); /* release */ - - if (--count == 0) - break; - } - } - - /* Modifier shoud be down, but isn't */ - if (!(keyc->state & mask) && (state & mask)) - for (key = 0; key < MAP_LENGTH; key++) - if (keyc->xkbInfo->desc->map->modmap[key] & mask) - { - if (keyc->xkbInfo->desc->map->modmap[key] & mask && ephyrKbd && - ((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled) - KdEnqueueKeyboardEvent(ephyrKbd, key, FALSE); /* press */ - break; - } - } -#endif -} - -static void -ephyrBlockSigio (void) -{ -#ifdef _MSC_VER - __asm int 3; -#else - sigset_t set; - - sigemptyset (&set); - sigaddset (&set, SIGIO); - sigprocmask (SIG_BLOCK, &set, 0); -#endif -} - -static void -ephyrUnblockSigio (void) -{ -#ifdef _MSC_VER - __asm int 3; -#else - sigset_t set; - - sigemptyset (&set); - sigaddset (&set, SIGIO); - sigprocmask (SIG_UNBLOCK, &set, 0); -#endif -} - -static Bool -ephyrCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) -{ - return FALSE; -} - -static void -ephyrCrossScreen (ScreenPtr pScreen, Bool entering) -{ -} - -int ephyrCurScreen; /*current event screen*/ - -static void -ephyrWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) -{ - ephyrBlockSigio (); - ephyrCurScreen = pScreen->myNum; - miPointerWarpCursor (inputInfo.pointer, pScreen, x, y); - ephyrUnblockSigio (); -} - -miPointerScreenFuncRec ephyrPointerScreenFuncs = -{ - ephyrCursorOffScreen, - ephyrCrossScreen, - ephyrWarpCursor, - NULL, - NULL -}; - -#ifdef XF86DRI -/** - * find if the remote window denoted by a_remote - * is paired with an internal Window within the Xephyr server. - * If the remove window is paired with an internal window, send an - * expose event to the client insterested in the internal window expose event. - * - * Pairing happens when a drawable inside Xephyr is associated with - * a GL surface in a DRI environment. - * Look at the function ProcXF86DRICreateDrawable in ephyrdriext.c to - * know a paired window is created. - * - * This is useful to make GL drawables (only windows for now) handle - * expose events and send those events to clients. - */ -static void -ephyrExposePairedWindow (int a_remote) -{ - EphyrWindowPair *pair = NULL; - RegionRec reg; - ScreenPtr screen; - - if (!findWindowPairFromRemote (a_remote, &pair)) { - EPHYR_LOG ("did not find a pair for this window\n"); - return; - } - screen = pair->local->drawable.pScreen; - REGION_NULL (screen, ®); - REGION_COPY (screen, ®, &pair->local->clipList); - screen->WindowExposures (pair->local, ®, NullRegion); - REGION_UNINIT (screen, ®); -} -#endif /* XF86DRI */ - -void -ephyrPoll(void) -{ - EphyrHostXEvent ev; - - while (hostx_get_event(&ev)) - { - switch (ev.type) - { - case EPHYR_EV_MOUSE_MOTION: - if (!ephyrMouse || - !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) { - EPHYR_LOG ("skipping mouse motion:%d\n", ephyrCurScreen) ; - continue; - } - { - if (ev.data.mouse_motion.screen >=0 - && (ephyrCurScreen != ev.data.mouse_motion.screen)) - { - EPHYR_LOG ("warping mouse cursor. " - "cur_screen%d, motion_screen:%d\n", - ephyrCurScreen, ev.data.mouse_motion.screen) ; - if (ev.data.mouse_motion.screen >= 0) - { - ephyrWarpCursor - (inputInfo.pointer, screenInfo.screens[ev.data.mouse_motion.screen], - ev.data.mouse_motion.x, - ev.data.mouse_motion.y ); - } - } - else - { - int x=0, y=0; -#ifdef XF86DRI - EphyrWindowPair *pair = NULL; -#endif - EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ; - x = ev.data.mouse_motion.x; - y = ev.data.mouse_motion.y; - EPHYR_LOG ("initial (x,y):(%d,%d)\n", x, y) ; -#ifdef XF86DRI - EPHYR_LOG ("is this window peered by a gl drawable ?\n") ; - if (findWindowPairFromRemote (ev.data.mouse_motion.window, - &pair)) - { - EPHYR_LOG ("yes, it is peered\n") ; - x += pair->local->drawable.x; - y += pair->local->drawable.y; - } - else - { - EPHYR_LOG ("no, it is not peered\n") ; - } - EPHYR_LOG ("final (x,y):(%d,%d)\n", x, y) ; -#endif - KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0); - } - } - break; - - case EPHYR_EV_MOUSE_PRESS: - if (!ephyrMouse || - !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) { - EPHYR_LOG ("skipping mouse press:%d\n", ephyrCurScreen) ; - continue; - } - EPHYR_LOG ("enqueuing mouse press:%d\n", ephyrCurScreen) ; - ephyrUpdateModifierState(ev.key_state); - mouseState |= ev.data.mouse_down.button_num; - KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0); - break; - - case EPHYR_EV_MOUSE_RELEASE: - if (!ephyrMouse || - !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) - continue; - ephyrUpdateModifierState(ev.key_state); - mouseState &= ~ev.data.mouse_up.button_num; - EPHYR_LOG ("enqueuing mouse release:%d\n", ephyrCurScreen) ; - KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0); - break; - - case EPHYR_EV_KEY_PRESS: - if (!ephyrKbd || - !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled) - continue; - ephyrUpdateModifierState(ev.key_state); - KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_down.scancode, FALSE); - break; - - case EPHYR_EV_KEY_RELEASE: - if (!ephyrKbd || - !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled) - continue; - KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE); - break; - -#ifdef XF86DRI - case EPHYR_EV_EXPOSE: - /* - * We only receive expose events when the expose event have - * be generated for a drawable that is a host X window managed - * by Xephyr. Host X windows managed by Xephyr exists for instance - * when Xephyr is asked to create a GL drawable in a DRI environment. - */ - ephyrExposePairedWindow (ev.data.expose.window); - break; -#endif /* XF86DRI */ - - default: - break; - } - } -} - -void -ephyrCardFini (KdCardInfo *card) -{ - EphyrPriv *priv = card->driver; - xfree (priv); -} - -void -ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) -{ - /* XXX Not sure if this is right */ - - EPHYR_LOG("mark"); - - while (n--) - { - pdefs->red = 0; - pdefs->green = 0; - pdefs->blue = 0; - pdefs++; - } - -} - -void -ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) -{ - int min, max, p; - - /* XXX Not sure if this is right */ - - min = 256; - max = 0; - - while (n--) - { - p = pdefs->pixel; - if (p < min) - min = p; - if (p > max) - max = p; - - hostx_set_cmap_entry(p, - pdefs->red >> 8, - pdefs->green >> 8, - pdefs->blue >> 8); - pdefs++; - } -} - -/* Mouse calls */ - -static Status -MouseInit (KdPointerInfo *pi) -{ - pi->driverPrivate = (EphyrPointerPrivate *) - xcalloc(sizeof(EphyrPointerPrivate), 1); - ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE; - pi->nAxes = 3; - pi->nButtons = 32; - pi->name = strdup("Xephyr virtual mouse"); - ephyrMouse = pi; - return Success; -} - -static Status -MouseEnable (KdPointerInfo *pi) -{ - ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = TRUE; - return Success; -} - -static void -MouseDisable (KdPointerInfo *pi) -{ - ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE; - return; -} - -static void -MouseFini (KdPointerInfo *pi) -{ - ephyrMouse = NULL; - return; -} - -KdPointerDriver EphyrMouseDriver = { - "ephyr", - MouseInit, - MouseEnable, - MouseDisable, - MouseFini, - NULL, -}; - -/* Keyboard */ - -static Status -EphyrKeyboardInit (KdKeyboardInfo *ki) -{ - ki->driverPrivate = (EphyrKbdPrivate *) - xcalloc(sizeof(EphyrKbdPrivate), 1); - hostx_load_keymap(); - if (!ephyrKeySyms.map) { - ErrorF("Couldn't load keymap from host\n"); - return BadAlloc; - } - ki->minScanCode = ephyrKeySyms.minKeyCode; - ki->maxScanCode = ephyrKeySyms.maxKeyCode; - ki->name = strdup("Xephyr virtual keyboard"); - ephyrKbd = ki; - return Success; -} - -static Status -EphyrKeyboardEnable (KdKeyboardInfo *ki) -{ - ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = TRUE; - - return Success; -} - -static void -EphyrKeyboardDisable (KdKeyboardInfo *ki) -{ - ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = FALSE; -} - -static void -EphyrKeyboardFini (KdKeyboardInfo *ki) -{ - ephyrKbd = NULL; - return; -} - -static void -EphyrKeyboardLeds (KdKeyboardInfo *ki, int leds) -{ -} - -static void -EphyrKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration) -{ -} - - -KdKeyboardDriver EphyrKeyboardDriver = { - "ephyr", - EphyrKeyboardInit, - EphyrKeyboardEnable, - EphyrKeyboardLeds, - EphyrKeyboardBell, - EphyrKeyboardDisable, - EphyrKeyboardFini, - NULL, -}; +/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2004 Nokia
+ *
+ * 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 Nokia not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Nokia makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL NOKIA 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "ephyr.h"
+
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "ephyrlog.h"
+
+#ifdef XF86DRI
+#include "ephyrdri.h"
+#include "ephyrdriext.h"
+#include "ephyrglxext.h"
+#endif /* XF86DRI */
+
+extern int KdTsPhyScreen;
+#ifdef GLXEXT
+extern Bool noGlxVisualInit;
+#endif
+
+KdKeyboardInfo *ephyrKbd;
+KdPointerInfo *ephyrMouse;
+EphyrKeySyms ephyrKeySyms;
+Bool ephyrNoDRI=FALSE ;
+Bool ephyrNoXV=FALSE ;
+
+static int mouseState = 0;
+
+typedef struct _EphyrInputPrivate {
+ Bool enabled;
+} EphyrKbdPrivate, EphyrPointerPrivate;
+
+Bool EphyrWantGrayScale = 0;
+
+
+Bool
+ephyrInitialize (KdCardInfo *card, EphyrPriv *priv)
+{
+#ifdef _MSC_VER
+ __asm int 3;
+#else
+ OsSignal(SIGUSR1, hostx_handle_signal);
+#endif
+ priv->base = 0;
+ priv->bytes_per_line = 0;
+ return TRUE;
+}
+
+Bool
+ephyrCardInit (KdCardInfo *card)
+{
+ EphyrPriv *priv;
+
+ priv = (EphyrPriv *) xalloc (sizeof (EphyrPriv));
+ if (!priv)
+ return FALSE;
+
+ if (!ephyrInitialize (card, priv))
+ {
+ xfree (priv);
+ return FALSE;
+ }
+ card->driver = priv;
+
+ return TRUE;
+}
+
+Bool
+ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv)
+{
+ int width = 640, height = 480;
+ CARD32 redMask, greenMask, blueMask;
+
+ if (hostx_want_screen_size(screen, &width, &height)
+ || !screen->width || !screen->height)
+ {
+ screen->width = width;
+ screen->height = height;
+ }
+
+ if (EphyrWantGrayScale)
+ screen->fb[0].depth = 8;
+
+ if (screen->fb[0].depth && screen->fb[0].depth != hostx_get_depth())
+ {
+ if (screen->fb[0].depth < hostx_get_depth()
+ && (screen->fb[0].depth == 24 || screen->fb[0].depth == 16
+ || screen->fb[0].depth == 8))
+ {
+ hostx_set_server_depth(screen, screen->fb[0].depth);
+ }
+ else
+ ErrorF("\nXephyr: requested screen depth not supported, setting to match hosts.\n");
+ }
+
+ screen->fb[0].depth = hostx_get_server_depth(screen);
+ screen->rate = 72;
+
+ if (screen->fb[0].depth <= 8)
+ {
+ if (EphyrWantGrayScale)
+ screen->fb[0].visuals = ((1 << StaticGray) | (1 << GrayScale));
+ else
+ screen->fb[0].visuals = ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) |
+ (1 << DirectColor));
+
+ screen->fb[0].redMask = 0x00;
+ screen->fb[0].greenMask = 0x00;
+ screen->fb[0].blueMask = 0x00;
+ screen->fb[0].depth = 8;
+ screen->fb[0].bitsPerPixel = 8;
+ }
+ else
+ {
+ screen->fb[0].visuals = (1 << TrueColor);
+
+ if (screen->fb[0].depth <= 15)
+ {
+ screen->fb[0].depth = 15;
+ screen->fb[0].bitsPerPixel = 16;
+ }
+ else if (screen->fb[0].depth <= 16)
+ {
+ screen->fb[0].depth = 16;
+ screen->fb[0].bitsPerPixel = 16;
+ }
+ else if (screen->fb[0].depth <= 24)
+ {
+ screen->fb[0].depth = 24;
+ screen->fb[0].bitsPerPixel = 32;
+ }
+ else if (screen->fb[0].depth <= 30)
+ {
+ screen->fb[0].depth = 30;
+ screen->fb[0].bitsPerPixel = 32;
+ }
+ else
+ {
+ ErrorF("\nXephyr: Unsupported screen depth %d\n",
+ screen->fb[0].depth);
+ return FALSE;
+ }
+
+ hostx_get_visual_masks (screen, &redMask, &greenMask, &blueMask);
+
+ screen->fb[0].redMask = (Pixel) redMask;
+ screen->fb[0].greenMask = (Pixel) greenMask;
+ screen->fb[0].blueMask = (Pixel) blueMask;
+
+ }
+
+ scrpriv->randr = screen->randr;
+
+ return ephyrMapFramebuffer (screen);
+}
+
+Bool
+ephyrScreenInit (KdScreenInfo *screen)
+{
+ EphyrScrPriv *scrpriv;
+
+ scrpriv = xcalloc (1, sizeof (EphyrScrPriv));
+
+ if (!scrpriv)
+ return FALSE;
+
+ screen->driver = scrpriv;
+
+ if (!ephyrScreenInitialize (screen, scrpriv))
+ {
+ screen->driver = 0;
+ xfree (scrpriv);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void*
+ephyrWindowLinear (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure)
+{
+ KdScreenPriv(pScreen);
+ EphyrPriv *priv = pScreenPriv->card->driver;
+
+ if (!pScreenPriv->enabled)
+ return 0;
+
+ *size = priv->bytes_per_line;
+ return priv->base + row * priv->bytes_per_line + offset;
+}
+
+Bool
+ephyrMapFramebuffer (KdScreenInfo *screen)
+{
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrPriv *priv = screen->card->driver;
+ KdPointerMatrix m;
+ int buffer_height;
+
+ EPHYR_LOG("screen->width: %d, screen->height: %d index=%d",
+ screen->width, screen->height, screen->mynum);
+
+ KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
+ KdSetPointerMatrix (&m);
+
+ priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
+
+ /* point the framebuffer to the data in an XImage */
+ /* If fakexa is enabled, allocate a larger buffer so that fakexa has space to
+ * put offscreen pixmaps.
+ */
+ if (ephyrFuncs.initAccel == NULL)
+ buffer_height = screen->height;
+ else
+ buffer_height = 3 * screen->height;
+
+ priv->base = hostx_screen_init (screen, screen->width, screen->height, buffer_height);
+
+ screen->memory_base = (CARD8 *) (priv->base);
+ screen->memory_size = priv->bytes_per_line * buffer_height;
+ screen->off_screen_base = priv->bytes_per_line * screen->height;
+
+ if ((scrpriv->randr & RR_Rotate_0) && !(scrpriv->randr & RR_Reflect_All))
+ {
+ scrpriv->shadow = FALSE;
+
+ screen->fb[0].byteStride = priv->bytes_per_line;
+ screen->fb[0].pixelStride = screen->width;
+ screen->fb[0].frameBuffer = (CARD8 *) (priv->base);
+ }
+ else
+ {
+ /* Rotated/Reflected so we need to use shadow fb */
+ scrpriv->shadow = TRUE;
+
+ EPHYR_LOG("allocing shadow");
+
+ KdShadowFbAlloc (screen, 0,
+ scrpriv->randr & (RR_Rotate_90|RR_Rotate_270));
+ }
+
+ return TRUE;
+}
+
+void
+ephyrSetScreenSizes (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+
+ if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180))
+ {
+ pScreen->width = screen->width;
+ pScreen->height = screen->height;
+ pScreen->mmWidth = screen->width_mm;
+ pScreen->mmHeight = screen->height_mm;
+ }
+ else
+ {
+ pScreen->width = screen->height;
+ pScreen->height = screen->width;
+ pScreen->mmWidth = screen->height_mm;
+ pScreen->mmHeight = screen->width_mm;
+ }
+}
+
+Bool
+ephyrUnmapFramebuffer (KdScreenInfo *screen)
+{
+ EphyrScrPriv *scrpriv = screen->driver;
+
+ if (scrpriv->shadow)
+ KdShadowFbFree (screen, 0);
+
+ /* Note, priv->base will get freed when XImage recreated */
+
+ return TRUE;
+}
+
+void
+ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+
+ EPHYR_LOG("slow paint");
+
+ /* FIXME: Slow Rotated/Reflected updates could be much
+ * much faster efficiently updating via tranforming
+ * pBuf->pDamage regions
+ */
+ shadowUpdateRotatePacked(pScreen, pBuf);
+ hostx_paint_rect(screen, 0,0,0,0, screen->width, screen->height);
+}
+
+static void
+ephyrInternalDamageRedisplay (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ RegionPtr pRegion;
+
+ if (!scrpriv || !scrpriv->pDamage)
+ return;
+
+ pRegion = DamageRegion (scrpriv->pDamage);
+
+ if (REGION_NOTEMPTY (pScreen, pRegion))
+ {
+ int nbox;
+ BoxPtr pbox;
+
+ nbox = REGION_NUM_RECTS (pRegion);
+ pbox = REGION_RECTS (pRegion);
+
+ while (nbox--)
+ {
+ hostx_paint_rect(screen,
+ pbox->x1, pbox->y1,
+ pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ pbox++;
+ }
+ DamageEmpty (scrpriv->pDamage);
+ }
+}
+
+static void
+ephyrInternalDamageBlockHandler (pointer data,
+ OSTimePtr pTimeout,
+ pointer pRead)
+{
+ ScreenPtr pScreen = (ScreenPtr) data;
+
+ ephyrInternalDamageRedisplay (pScreen);
+}
+
+static void
+ephyrInternalDamageWakeupHandler (pointer data, int i, pointer LastSelectMask)
+{
+ /* FIXME: Not needed ? */
+}
+
+Bool
+ephyrSetInternalDamage (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ PixmapPtr pPixmap = NULL;
+
+ scrpriv->pDamage = DamageCreate ((DamageReportFunc) 0,
+ (DamageDestroyFunc) 0,
+ DamageReportNone,
+ TRUE,
+ pScreen,
+ pScreen);
+
+ if (!RegisterBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler,
+ ephyrInternalDamageWakeupHandler,
+ (pointer) pScreen))
+ return FALSE;
+
+ pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+
+ DamageRegister (&pPixmap->drawable, scrpriv->pDamage);
+
+ return TRUE;
+}
+
+void
+ephyrUnsetInternalDamage (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ PixmapPtr pPixmap = NULL;
+
+ pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+ DamageUnregister (&pPixmap->drawable, scrpriv->pDamage);
+ DamageDestroy (scrpriv->pDamage);
+
+ RemoveBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler,
+ ephyrInternalDamageWakeupHandler,
+ (pointer) pScreen);
+}
+
+#ifdef RANDR
+Bool
+ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ RRScreenSizePtr pSize;
+ Rotation randr;
+ int n = 0;
+
+ struct { int width, height; } sizes[] =
+ {
+ { 1600, 1200 },
+ { 1400, 1050 },
+ { 1280, 960 },
+ { 1280, 1024 },
+ { 1152, 864 },
+ { 1024, 768 },
+ { 832, 624 },
+ { 800, 600 },
+ { 720, 400 },
+ { 480, 640 },
+ { 640, 480 },
+ { 640, 400 },
+ { 320, 240 },
+ { 240, 320 },
+ { 160, 160 },
+ { 0, 0 }
+ };
+
+ EPHYR_LOG("mark");
+
+ *rotations = RR_Rotate_All|RR_Reflect_All;
+
+ if (!hostx_want_preexisting_window (screen)
+ && !hostx_want_fullscreen ()) /* only if no -parent switch */
+ {
+ while (sizes[n].width != 0 && sizes[n].height != 0)
+ {
+ RRRegisterSize (pScreen,
+ sizes[n].width,
+ sizes[n].height,
+ (sizes[n].width * screen->width_mm)/screen->width,
+ (sizes[n].height *screen->height_mm)/screen->height
+ );
+ n++;
+ }
+ }
+
+ pSize = RRRegisterSize (pScreen,
+ screen->width,
+ screen->height,
+ screen->width_mm,
+ screen->height_mm);
+
+ randr = KdSubRotation (scrpriv->randr, screen->randr);
+
+ RRSetCurrentConfig (pScreen, randr, 0, pSize);
+
+ return TRUE;
+}
+
+Bool
+ephyrRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ Bool wasEnabled = pScreenPriv->enabled;
+ EphyrScrPriv oldscr;
+ int oldwidth, oldheight, oldmmwidth, oldmmheight;
+ Bool oldshadow;
+ int newwidth, newheight;
+
+ if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
+ {
+ newwidth = pSize->width;
+ newheight = pSize->height;
+ }
+ else
+ {
+ newwidth = pSize->height;
+ newheight = pSize->width;
+ }
+
+ if (wasEnabled)
+ KdDisableScreen (pScreen);
+
+ oldscr = *scrpriv;
+
+ oldwidth = screen->width;
+ oldheight = screen->height;
+ oldmmwidth = pScreen->mmWidth;
+ oldmmheight = pScreen->mmHeight;
+ oldshadow = scrpriv->shadow;
+
+ /*
+ * Set new configuration
+ */
+
+ scrpriv->randr = KdAddRotation (screen->randr, randr);
+
+ ephyrUnmapFramebuffer (screen);
+
+ screen->width = newwidth;
+ screen->height = newheight;
+
+ if (!ephyrMapFramebuffer (screen))
+ goto bail4;
+
+ /* FIXME below should go in own call */
+
+ if (oldshadow)
+ KdShadowUnset (screen->pScreen);
+ else
+ ephyrUnsetInternalDamage(screen->pScreen);
+
+ if (scrpriv->shadow)
+ {
+ if (!KdShadowSet (screen->pScreen,
+ scrpriv->randr,
+ ephyrShadowUpdate,
+ ephyrWindowLinear))
+ goto bail4;
+ }
+ else
+ {
+ /* Without shadow fb ( non rotated ) we need
+ * to use damage to efficiently update display
+ * via signal regions what to copy from 'fb'.
+ */
+ if (!ephyrSetInternalDamage(screen->pScreen))
+ goto bail4;
+ }
+
+ ephyrSetScreenSizes (screen->pScreen);
+
+ /*
+ * Set frame buffer mapping
+ */
+ (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
+ pScreen->width,
+ pScreen->height,
+ screen->fb[0].depth,
+ screen->fb[0].bitsPerPixel,
+ screen->fb[0].byteStride,
+ screen->fb[0].frameBuffer);
+
+ /* set the subpixel order */
+
+ KdSetSubpixelOrder (pScreen, scrpriv->randr);
+
+ if (wasEnabled)
+ KdEnableScreen (pScreen);
+
+ return TRUE;
+
+ bail4:
+ EPHYR_LOG("bailed");
+
+ ephyrUnmapFramebuffer (screen);
+ *scrpriv = oldscr;
+ (void) ephyrMapFramebuffer (screen);
+
+ pScreen->width = oldwidth;
+ pScreen->height = oldheight;
+ pScreen->mmWidth = oldmmwidth;
+ pScreen->mmHeight = oldmmheight;
+
+ if (wasEnabled)
+ KdEnableScreen (pScreen);
+ return FALSE;
+}
+
+Bool
+ephyrRandRInit (ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRScreenInit (pScreen))
+ return FALSE;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+ pScrPriv->rrGetInfo = ephyrRandRGetInfo;
+ pScrPriv->rrSetConfig = ephyrRandRSetConfig;
+ return TRUE;
+}
+#endif
+
+Bool
+ephyrCreateColormap (ColormapPtr pmap)
+{
+ return fbInitializeColormap (pmap);
+}
+
+Bool
+ephyrInitScreen (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+
+ EPHYR_LOG ("pScreen->myNum:%d\n", pScreen->myNum) ;
+ hostx_set_screen_number (screen, pScreen->myNum);
+ hostx_set_win_title (screen, "(ctrl+shift grabs mouse and keyboard)") ;
+ pScreen->CreateColormap = ephyrCreateColormap;
+
+#ifdef XV
+ if (!ephyrNoXV) {
+ if (!ephyrInitVideo (pScreen)) {
+ EPHYR_LOG_ERROR ("failed to initialize xvideo\n") ;
+ } else {
+ EPHYR_LOG ("initialized xvideo okay\n") ;
+ }
+ }
+#endif /*XV*/
+
+#ifdef XF86DRI
+ if (!ephyrNoDRI && !hostx_has_dri ()) {
+ EPHYR_LOG ("host x does not support DRI. Disabling DRI forwarding\n") ;
+ ephyrNoDRI = TRUE ;
+#ifdef GLXEXT
+ noGlxVisualInit = FALSE ;
+#endif
+ }
+ if (!ephyrNoDRI) {
+ ephyrDRIExtensionInit (pScreen) ;
+ ephyrHijackGLXExtension () ;
+ }
+#endif
+
+#ifdef GLXEXT
+ if (ephyrNoDRI) {
+ noGlxVisualInit = FALSE ;
+ }
+#endif
+
+ return TRUE;
+}
+
+Bool
+ephyrFinishInitScreen (ScreenPtr pScreen)
+{
+ /* FIXME: Calling this even if not using shadow.
+ * Seems harmless enough. But may be safer elsewhere.
+ */
+ if (!shadowSetup (pScreen))
+ return FALSE;
+
+#ifdef RANDR
+ if (!ephyrRandRInit (pScreen))
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
+Bool
+ephyrCreateResources (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+
+ EPHYR_LOG("mark pScreen=%p mynum=%d shadow=%d",
+ pScreen, pScreen->myNum, scrpriv->shadow);
+
+ if (scrpriv->shadow)
+ return KdShadowSet (pScreen,
+ scrpriv->randr,
+ ephyrShadowUpdate,
+ ephyrWindowLinear);
+ else
+ return ephyrSetInternalDamage(pScreen);
+}
+
+void
+ephyrPreserve (KdCardInfo *card)
+{
+}
+
+Bool
+ephyrEnable (ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+Bool
+ephyrDPMS (ScreenPtr pScreen, int mode)
+{
+ return TRUE;
+}
+
+void
+ephyrDisable (ScreenPtr pScreen)
+{
+}
+
+void
+ephyrRestore (KdCardInfo *card)
+{
+}
+
+void
+ephyrScreenFini (KdScreenInfo *screen)
+{
+ EphyrScrPriv *scrpriv = screen->driver;
+ if (scrpriv->shadow) {
+ KdShadowFbFree (screen, 0);
+ }
+ xfree(screen->driver);
+ screen->driver = NULL;
+}
+
+/*
+ * Port of Mark McLoughlin's Xnest fix for focus in + modifier bug.
+ * See https://bugs.freedesktop.org/show_bug.cgi?id=3030
+ */
+void
+ephyrUpdateModifierState(unsigned int state)
+{
+#if 0
+ DeviceIntPtr pkeydev;
+ KeyClassPtr keyc;
+ int i;
+ CARD8 mask;
+
+ pkeydev = inputInfo.keyboard;
+
+ if (!pkeydev)
+ return;
+
+/* This is pretty broken.
+ *
+ * What should happen is that focus out should do as a VT switch does in
+ * traditional servers: fake releases for all keys (and buttons too, come
+ * to think of it) currently down. Then, on focus in, get the state from
+ * the host, and fake keypresses for everything currently down.
+ *
+ * So I'm leaving this broken for a little while. Sorry, folks.
+ *
+ * -daniels
+ */
+
+ keyc = pkeydev->key;
+
+ state = state & 0xff;
+
+ if (keyc->state == state)
+ return;
+
+ for (i = 0, mask = 1; i < 8; i++, mask <<= 1)
+ {
+ int key;
+
+ /* Modifier is down, but shouldn't be */
+ if ((keyc->state & mask) && !(state & mask))
+ {
+ int count = keyc->modifierKeyCount[i];
+
+ for (key = 0; key < MAP_LENGTH; key++)
+ if (keyc->xkbInfo->desc->map->modmap[key] & mask)
+ {
+ int bit;
+ BYTE *kptr;
+
+ kptr = &keyc->down[key >> 3];
+ bit = 1 << (key & 7);
+
+ if (*kptr & bit && ephyrKbd &&
+ ((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
+ KdEnqueueKeyboardEvent(ephyrKbd, key, TRUE); /* release */
+
+ if (--count == 0)
+ break;
+ }
+ }
+
+ /* Modifier shoud be down, but isn't */
+ if (!(keyc->state & mask) && (state & mask))
+ for (key = 0; key < MAP_LENGTH; key++)
+ if (keyc->xkbInfo->desc->map->modmap[key] & mask)
+ {
+ if (keyc->xkbInfo->desc->map->modmap[key] & mask && ephyrKbd &&
+ ((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
+ KdEnqueueKeyboardEvent(ephyrKbd, key, FALSE); /* press */
+ break;
+ }
+ }
+#endif
+}
+
+static void
+ephyrBlockSigio (void)
+{
+#ifdef _MSC_VER
+ __asm int 3;
+#else
+ sigset_t set;
+
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_BLOCK, &set, 0);
+#endif
+}
+
+static void
+ephyrUnblockSigio (void)
+{
+#ifdef _MSC_VER
+ __asm int 3;
+#else
+ sigset_t set;
+
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_UNBLOCK, &set, 0);
+#endif
+}
+
+static Bool
+ephyrCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
+{
+ return FALSE;
+}
+
+static void
+ephyrCrossScreen (ScreenPtr pScreen, Bool entering)
+{
+}
+
+int ephyrCurScreen; /*current event screen*/
+
+static void
+ephyrWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+{
+ ephyrBlockSigio ();
+ ephyrCurScreen = pScreen->myNum;
+ miPointerWarpCursor (inputInfo.pointer, pScreen, x, y);
+ ephyrUnblockSigio ();
+}
+
+miPointerScreenFuncRec ephyrPointerScreenFuncs =
+{
+ ephyrCursorOffScreen,
+ ephyrCrossScreen,
+ ephyrWarpCursor,
+ NULL,
+ NULL
+};
+
+#ifdef XF86DRI
+/**
+ * find if the remote window denoted by a_remote
+ * is paired with an internal Window within the Xephyr server.
+ * If the remove window is paired with an internal window, send an
+ * expose event to the client insterested in the internal window expose event.
+ *
+ * Pairing happens when a drawable inside Xephyr is associated with
+ * a GL surface in a DRI environment.
+ * Look at the function ProcXF86DRICreateDrawable in ephyrdriext.c to
+ * know a paired window is created.
+ *
+ * This is useful to make GL drawables (only windows for now) handle
+ * expose events and send those events to clients.
+ */
+static void
+ephyrExposePairedWindow (int a_remote)
+{
+ EphyrWindowPair *pair = NULL;
+ RegionRec reg;
+ ScreenPtr screen;
+
+ if (!findWindowPairFromRemote (a_remote, &pair)) {
+ EPHYR_LOG ("did not find a pair for this window\n");
+ return;
+ }
+ screen = pair->local->drawable.pScreen;
+ REGION_NULL (screen, ®);
+ REGION_COPY (screen, ®, &pair->local->clipList);
+ screen->WindowExposures (pair->local, ®, NullRegion);
+ REGION_UNINIT (screen, ®);
+}
+#endif /* XF86DRI */
+
+void
+ephyrPoll(void)
+{
+ EphyrHostXEvent ev;
+
+ while (hostx_get_event(&ev))
+ {
+ switch (ev.type)
+ {
+ case EPHYR_EV_MOUSE_MOTION:
+ if (!ephyrMouse ||
+ !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) {
+ EPHYR_LOG ("skipping mouse motion:%d\n", ephyrCurScreen) ;
+ continue;
+ }
+ {
+ if (ev.data.mouse_motion.screen >=0
+ && (ephyrCurScreen != ev.data.mouse_motion.screen))
+ {
+ EPHYR_LOG ("warping mouse cursor. "
+ "cur_screen%d, motion_screen:%d\n",
+ ephyrCurScreen, ev.data.mouse_motion.screen) ;
+ if (ev.data.mouse_motion.screen >= 0)
+ {
+ ephyrWarpCursor
+ (inputInfo.pointer, screenInfo.screens[ev.data.mouse_motion.screen],
+ ev.data.mouse_motion.x,
+ ev.data.mouse_motion.y );
+ }
+ }
+ else
+ {
+ int x=0, y=0;
+#ifdef XF86DRI
+ EphyrWindowPair *pair = NULL;
+#endif
+ EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ;
+ x = ev.data.mouse_motion.x;
+ y = ev.data.mouse_motion.y;
+ EPHYR_LOG ("initial (x,y):(%d,%d)\n", x, y) ;
+#ifdef XF86DRI
+ EPHYR_LOG ("is this window peered by a gl drawable ?\n") ;
+ if (findWindowPairFromRemote (ev.data.mouse_motion.window,
+ &pair))
+ {
+ EPHYR_LOG ("yes, it is peered\n") ;
+ x += pair->local->drawable.x;
+ y += pair->local->drawable.y;
+ }
+ else
+ {
+ EPHYR_LOG ("no, it is not peered\n") ;
+ }
+ EPHYR_LOG ("final (x,y):(%d,%d)\n", x, y) ;
+#endif
+ KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0);
+ }
+ }
+ break;
+
+ case EPHYR_EV_MOUSE_PRESS:
+ if (!ephyrMouse ||
+ !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) {
+ EPHYR_LOG ("skipping mouse press:%d\n", ephyrCurScreen) ;
+ continue;
+ }
+ EPHYR_LOG ("enqueuing mouse press:%d\n", ephyrCurScreen) ;
+ ephyrUpdateModifierState(ev.key_state);
+ mouseState |= ev.data.mouse_down.button_num;
+ KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
+ break;
+
+ case EPHYR_EV_MOUSE_RELEASE:
+ if (!ephyrMouse ||
+ !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
+ continue;
+ ephyrUpdateModifierState(ev.key_state);
+ mouseState &= ~ev.data.mouse_up.button_num;
+ EPHYR_LOG ("enqueuing mouse release:%d\n", ephyrCurScreen) ;
+ KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
+ break;
+
+ case EPHYR_EV_KEY_PRESS:
+ if (!ephyrKbd ||
+ !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
+ continue;
+ ephyrUpdateModifierState(ev.key_state);
+ KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_down.scancode, FALSE);
+ break;
+
+ case EPHYR_EV_KEY_RELEASE:
+ if (!ephyrKbd ||
+ !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
+ continue;
+ KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE);
+ break;
+
+#ifdef XF86DRI
+ case EPHYR_EV_EXPOSE:
+ /*
+ * We only receive expose events when the expose event have
+ * be generated for a drawable that is a host X window managed
+ * by Xephyr. Host X windows managed by Xephyr exists for instance
+ * when Xephyr is asked to create a GL drawable in a DRI environment.
+ */
+ ephyrExposePairedWindow (ev.data.expose.window);
+ break;
+#endif /* XF86DRI */
+
+ default:
+ break;
+ }
+ }
+}
+
+void
+ephyrCardFini (KdCardInfo *card)
+{
+ EphyrPriv *priv = card->driver;
+ xfree (priv);
+}
+
+void
+ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ /* XXX Not sure if this is right */
+
+ EPHYR_LOG("mark");
+
+ while (n--)
+ {
+ pdefs->red = 0;
+ pdefs->green = 0;
+ pdefs->blue = 0;
+ pdefs++;
+ }
+
+}
+
+void
+ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ int min, max, p;
+
+ /* XXX Not sure if this is right */
+
+ min = 256;
+ max = 0;
+
+ while (n--)
+ {
+ p = pdefs->pixel;
+ if (p < min)
+ min = p;
+ if (p > max)
+ max = p;
+
+ hostx_set_cmap_entry(p,
+ pdefs->red >> 8,
+ pdefs->green >> 8,
+ pdefs->blue >> 8);
+ pdefs++;
+ }
+}
+
+/* Mouse calls */
+
+static Status
+MouseInit (KdPointerInfo *pi)
+{
+ pi->driverPrivate = (EphyrPointerPrivate *)
+ xcalloc(sizeof(EphyrPointerPrivate), 1);
+ ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
+ pi->nAxes = 3;
+ pi->nButtons = 32;
+ if (pi->name)
+ xfree(pi->name);
+ pi->name = strdup("Xephyr virtual mouse");
+ ephyrMouse = pi;
+ return Success;
+}
+
+static Status
+MouseEnable (KdPointerInfo *pi)
+{
+ ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = TRUE;
+ return Success;
+}
+
+static void
+MouseDisable (KdPointerInfo *pi)
+{
+ ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
+ return;
+}
+
+static void
+MouseFini (KdPointerInfo *pi)
+{
+ ephyrMouse = NULL;
+ return;
+}
+
+KdPointerDriver EphyrMouseDriver = {
+ "ephyr",
+ MouseInit,
+ MouseEnable,
+ MouseDisable,
+ MouseFini,
+ NULL,
+};
+
+/* Keyboard */
+
+static Status
+EphyrKeyboardInit (KdKeyboardInfo *ki)
+{
+ ki->driverPrivate = (EphyrKbdPrivate *)
+ xcalloc(sizeof(EphyrKbdPrivate), 1);
+ hostx_load_keymap();
+ if (!ephyrKeySyms.map) {
+ ErrorF("Couldn't load keymap from host\n");
+ return BadAlloc;
+ }
+ ki->minScanCode = ephyrKeySyms.minKeyCode;
+ ki->maxScanCode = ephyrKeySyms.maxKeyCode;
+ if (ki->name)
+ xfree(ki->name);
+ ki->name = strdup("Xephyr virtual keyboard");
+ ephyrKbd = ki;
+ return Success;
+}
+
+static Status
+EphyrKeyboardEnable (KdKeyboardInfo *ki)
+{
+ ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = TRUE;
+
+ return Success;
+}
+
+static void
+EphyrKeyboardDisable (KdKeyboardInfo *ki)
+{
+ ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = FALSE;
+}
+
+static void
+EphyrKeyboardFini (KdKeyboardInfo *ki)
+{
+ ephyrKbd = NULL;
+ return;
+}
+
+static void
+EphyrKeyboardLeds (KdKeyboardInfo *ki, int leds)
+{
+}
+
+static void
+EphyrKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
+{
+}
+
+
+KdKeyboardDriver EphyrKeyboardDriver = {
+ "ephyr",
+ EphyrKeyboardInit,
+ EphyrKeyboardEnable,
+ EphyrKeyboardLeds,
+ EphyrKeyboardBell,
+ EphyrKeyboardDisable,
+ EphyrKeyboardFini,
+ NULL,
+};
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrinit.c b/xorg-server/hw/kdrive/ephyr/ephyrinit.c index 27c346dd1..dec57b78c 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrinit.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrinit.c @@ -1,407 +1,421 @@ -/* - * Xephyr - A kdrive X server thats runs in a host X window. - * Authored by Matthew Allum <mallum@o-hand.com> - * - * Copyright © 2004 Nokia - * - * 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 Nokia not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Nokia makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL NOKIA 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. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "ephyr.h" -#include "ephyrlog.h" - -extern Window EphyrPreExistingHostWin; -extern Bool EphyrWantGrayScale; -extern Bool kdHasPointer; -extern Bool kdHasKbd; - -#ifdef GLXEXT -extern Bool ephyrNoDRI; -extern Bool noGlxVisualInit; -#endif -extern Bool ephyrNoXV; - -void processScreenArg (char *screen_size, char *parent_id) ; - -void -InitCard (char *name) -{ - KdCardAttr attr; - - EPHYR_DBG("mark"); - - - KdCardInfoAdd (&ephyrFuncs, &attr, 0); -} - -#ifndef _MSC_VER -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdKeyboardInfo *ki; - KdPointerInfo *pi; - - KdAddKeyboardDriver(&EphyrKeyboardDriver); -#ifdef linux - KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver); -#endif - KdAddPointerDriver(&EphyrMouseDriver); -#ifdef linux - KdAddPointerDriver(&LinuxEvdevMouseDriver); -#endif - - if (!kdHasKbd) { - ki = KdNewKeyboard(); - if (!ki) - FatalError("Couldn't create Xephyr keyboard\n"); - ki->driver = &EphyrKeyboardDriver; - KdAddKeyboard(ki); - } - - if (!kdHasPointer) { - pi = KdNewPointer(); - if (!pi) - FatalError("Couldn't create Xephyr pointer\n"); - pi->driver = &EphyrMouseDriver; - KdAddPointer(pi); - } - - KdInitInput(); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); - - ErrorF("\nXephyr Option Usage:\n"); - ErrorF("-parent <XID> Use existing window as Xephyr root win\n"); - ErrorF("-host-cursor Re-use exisiting X host server cursor\n"); - ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n"); - ErrorF("-grayscale Simulate 8bit grayscale\n"); - ErrorF("-fakexa Simulate acceleration using software rendering\n"); - ErrorF("-verbosity <level> Set log verbosity level\n"); -#ifdef GLXEXT - ErrorF("-nodri do not use DRI\n"); -#endif - ErrorF("-noxv do not use XV\n"); - ErrorF("-name [name] define the name in the WM_CLASS property\n"); - ErrorF("-title [title] set the window title in the WM_NAME property\n"); - ErrorF("\n"); - - exit(1); -} -#endif - -void -processScreenArg (char *screen_size, char *parent_id) -{ - KdCardInfo *card; - - InitCard (0); /*Put each screen on a separate card*/ - card = KdCardInfoLast (); - - if (card) - { - KdScreenInfo *screen; - unsigned long p_id = 0; - - screen = KdScreenInfoAdd (card); - KdParseScreen (screen, screen_size); - - if (parent_id) - { - p_id = strtol (parent_id, NULL, 0); - } - EPHYR_DBG ("screen number:%d\n", screen->mynum) ; - hostx_add_screen (screen, p_id, screen->mynum); - } - else - { - ErrorF("No matching card found!\n"); - } -} - -#ifndef _MSC_VER -int -ddxProcessArgument (int argc, char **argv, int i) -{ - EPHYR_DBG("mark argv[%d]='%s'", i, argv[i] ); - - if (i == 1) - { - hostx_use_resname(basename(argv[0]), 0); - } - - if (!strcmp (argv[i], "-parent")) - { - if(i+1 < argc) - { - processScreenArg ("100x100", argv[i+1]); - return 2; - } - - UseMsg(); - exit(1); - } - else if (!strcmp (argv[i], "-screen")) - { - if ((i+1) < argc) - { - processScreenArg (argv[i+1], NULL); - return 2; - } - - UseMsg(); - exit(1); - } - else if (!strcmp (argv[i], "-host-cursor")) - { - hostx_use_host_cursor(); - return 1; - } - else if (!strcmp (argv[i], "-fullscreen")) - { - hostx_use_fullscreen(); - return 1; - } - else if (!strcmp (argv[i], "-grayscale")) - { - EphyrWantGrayScale = 1; - return 1; - } - else if (!strcmp (argv[i], "-fakexa")) - { - ephyrFuncs.initAccel = ephyrDrawInit; - ephyrFuncs.enableAccel = ephyrDrawEnable; - ephyrFuncs.disableAccel = ephyrDrawDisable; - ephyrFuncs.finiAccel = ephyrDrawFini; - return 1; - } - else if (!strcmp (argv[i], "-verbosity")) - { - if(i+1 < argc && argv[i+1][0] != '-') - { - int verbosity=atoi (argv[i+1]) ; - LogSetParameter (XLOG_VERBOSITY, verbosity) ; - EPHYR_LOG ("set verbosiry to %d\n", verbosity) ; - return 2 ; - } - else - { - UseMsg() ; - exit(1) ; - } - } -#ifdef GLXEXT - else if (!strcmp (argv[i], "-nodri")) - { - noGlxVisualInit = FALSE ; - ephyrNoDRI = TRUE ; - EPHYR_LOG ("no direct rendering enabled\n") ; - return 1 ; - } -#endif - else if (!strcmp (argv[i], "-noxv")) - { - ephyrNoXV = TRUE ; - EPHYR_LOG ("no XVideo enabled\n") ; - return 1 ; - } - else if (!strcmp (argv[i], "-name")) - { - if (i+1 < argc && argv[i+1][0] != '-') - { - hostx_use_resname(argv[i+1], 1); - return 2; - } - else - { - UseMsg(); - return 0; - } - } - else if (!strcmp (argv[i], "-title")) - { - if (i+1 < argc && argv[i+1][0] != '-') - { - hostx_set_title(argv[i+1]); - return 2; - } - else - { - UseMsg(); - return 0; - } - } - else if (argv[i][0] == ':') - { - hostx_set_display_name(argv[i]); - } - /* Xnest compatibility */ - else if (!strcmp(argv[i], "-display")) - { - hostx_set_display_name(argv[i+1]); - return 2; - } - else if (!strcmp(argv[i], "-sync") || - !strcmp(argv[i], "-full") || - !strcmp(argv[i], "-sss") || - !strcmp(argv[i], "-install")) - { - return 1; - } - else if (!strcmp(argv[i], "-bw") || - !strcmp(argv[i], "-class") || - !strcmp(argv[i], "-geometry") || - !strcmp(argv[i], "-scrns")) - { - return 2; - } - /* end Xnest compat */ - - return KdProcessArgument (argc, argv, i); -} - -#ifdef DDXBEFORERESET -void -ddxBeforeReset (void) -{ -} -#endif - -void -OsVendorInit (void) -{ - EPHYR_DBG("mark"); - - if (hostx_want_host_cursor()) - { - ephyrFuncs.initCursor = &ephyrCursorInit; - ephyrFuncs.enableCursor = &ephyrCursorEnable; - } - - KdOsInit (&EphyrOsFuncs); -} - -#ifdef DDXOSFATALERROR -void -OsVendorFatalError(void) -{ -} -#endif - -#endif - -/* 'Fake' cursor stuff, could be improved */ - -static Bool -ephyrRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static Bool -ephyrUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static void -ephyrSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - ; -} - -static void -ephyrMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) -{ - ; -} - -static Bool -ephyrDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) -{ - return TRUE; -} - -miPointerSpriteFuncRec EphyrPointerSpriteFuncs = { - ephyrRealizeCursor, - ephyrUnrealizeCursor, - ephyrSetCursor, - ephyrMoveCursor, - ephyrDeviceCursorInitialize, - NULL -}; - - -Bool -ephyrCursorInit(ScreenPtr pScreen) -{ - miPointerInitialize(pScreen, - &EphyrPointerSpriteFuncs, - &ephyrPointerScreenFuncs, - FALSE); - - return TRUE; -} - -void -ephyrCursorEnable(ScreenPtr pScreen) -{ - ; -} - -KdCardFuncs ephyrFuncs = { - ephyrCardInit, /* cardinit */ - ephyrScreenInit, /* scrinit */ - ephyrInitScreen, /* initScreen */ - ephyrFinishInitScreen, /* finishInitScreen */ - ephyrCreateResources, /* createRes */ - ephyrPreserve, /* preserve */ - ephyrEnable, /* enable */ - ephyrDPMS, /* dpms */ - ephyrDisable, /* disable */ - ephyrRestore, /* restore */ - ephyrScreenFini, /* scrfini */ - ephyrCardFini, /* cardfini */ - - 0, /* initCursor */ - 0, /* enableCursor */ - 0, /* disableCursor */ - 0, /* finiCursor */ - 0, /* recolorCursor */ - - 0, /* initAccel */ - 0, /* enableAccel */ - 0, /* disableAccel */ - 0, /* finiAccel */ - - ephyrGetColors,/* getColors */ - ephyrPutColors, /* putColors */ -}; +/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@o-hand.com>
+ *
+ * Copyright © 2004 Nokia
+ *
+ * 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 Nokia not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Nokia makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL NOKIA 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "ephyr.h"
+#include "ephyrlog.h"
+
+extern Window EphyrPreExistingHostWin;
+extern Bool EphyrWantGrayScale;
+extern Bool kdHasPointer;
+extern Bool kdHasKbd;
+
+#ifdef GLXEXT
+extern Bool ephyrNoDRI;
+extern Bool noGlxVisualInit;
+#endif
+extern Bool ephyrNoXV;
+
+void processScreenArg (char *screen_size, char *parent_id) ;
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+
+ EPHYR_DBG("mark");
+
+
+ KdCardInfoAdd (&ephyrFuncs, &attr, 0);
+}
+
+#ifndef _MSC_VER
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdKeyboardInfo *ki;
+ KdPointerInfo *pi;
+
+ KdAddKeyboardDriver(&EphyrKeyboardDriver);
+#ifdef linux
+ KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver);
+#endif
+ KdAddPointerDriver(&EphyrMouseDriver);
+#ifdef linux
+ KdAddPointerDriver(&LinuxEvdevMouseDriver);
+#endif
+
+ if (!kdHasKbd) {
+ ki = KdNewKeyboard();
+ if (!ki)
+ FatalError("Couldn't create Xephyr keyboard\n");
+ ki->driver = &EphyrKeyboardDriver;
+ KdAddKeyboard(ki);
+ }
+
+ if (!kdHasPointer) {
+ pi = KdNewPointer();
+ if (!pi)
+ FatalError("Couldn't create Xephyr pointer\n");
+ pi->driver = &EphyrMouseDriver;
+ KdAddPointer(pi);
+ }
+
+ KdInitInput();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+
+ ErrorF("\nXephyr Option Usage:\n");
+ ErrorF("-parent <XID> Use existing window as Xephyr root win\n");
+ ErrorF("-host-cursor Re-use exisiting X host server cursor\n");
+ ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n");
+ ErrorF("-grayscale Simulate 8bit grayscale\n");
+ ErrorF("-fakexa Simulate acceleration using software rendering\n");
+ ErrorF("-verbosity <level> Set log verbosity level\n");
+#ifdef GLXEXT
+ ErrorF("-nodri do not use DRI\n");
+#endif
+ ErrorF("-noxv do not use XV\n");
+ ErrorF("-name [name] define the name in the WM_CLASS property\n");
+ ErrorF("-title [title] set the window title in the WM_NAME property\n");
+ ErrorF("\n");
+
+ exit(1);
+}
+#endif
+
+void
+processScreenArg (char *screen_size, char *parent_id)
+{
+ KdCardInfo *card;
+
+ InitCard (0); /*Put each screen on a separate card*/
+ card = KdCardInfoLast ();
+
+ if (card)
+ {
+ KdScreenInfo *screen;
+ unsigned long p_id = 0;
+
+ screen = KdScreenInfoAdd (card);
+ KdParseScreen (screen, screen_size);
+
+ if (parent_id)
+ {
+ p_id = strtol (parent_id, NULL, 0);
+ }
+ EPHYR_DBG ("screen number:%d\n", screen->mynum) ;
+ hostx_add_screen (screen, p_id, screen->mynum);
+ }
+ else
+ {
+ ErrorF("No matching card found!\n");
+ }
+}
+
+#ifndef _MSC_VER
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ static char* parent = NULL;
+ EPHYR_DBG("mark argv[%d]='%s'", i, argv[i] );
+
+ if (i == 1)
+ {
+ hostx_use_resname(basename(argv[0]), 0);
+ }
+
+ if (!strcmp (argv[i], "-parent"))
+ {
+ if(i+1 < argc)
+ {
+ int j;
+ /* If parent is specified and a screen argument follows, don't do
+ * anything, let the -screen handling init the rest */
+ for (j = i; j < argc; j++)
+ {
+ if (!strcmp(argv[j], "-screen"))
+ {
+ parent = argv[i + 1];
+ return 2;
+ }
+ }
+
+ processScreenArg ("100x100", argv[i+1]);
+ return 2;
+ }
+
+ UseMsg();
+ exit(1);
+ }
+ else if (!strcmp (argv[i], "-screen"))
+ {
+ if ((i+1) < argc)
+ {
+ processScreenArg (argv[i+1], parent);
+ parent = NULL;
+ return 2;
+ }
+
+ UseMsg();
+ exit(1);
+ }
+ else if (!strcmp (argv[i], "-host-cursor"))
+ {
+ hostx_use_host_cursor();
+ return 1;
+ }
+ else if (!strcmp (argv[i], "-fullscreen"))
+ {
+ hostx_use_fullscreen();
+ return 1;
+ }
+ else if (!strcmp (argv[i], "-grayscale"))
+ {
+ EphyrWantGrayScale = 1;
+ return 1;
+ }
+ else if (!strcmp (argv[i], "-fakexa"))
+ {
+ ephyrFuncs.initAccel = ephyrDrawInit;
+ ephyrFuncs.enableAccel = ephyrDrawEnable;
+ ephyrFuncs.disableAccel = ephyrDrawDisable;
+ ephyrFuncs.finiAccel = ephyrDrawFini;
+ return 1;
+ }
+ else if (!strcmp (argv[i], "-verbosity"))
+ {
+ if(i+1 < argc && argv[i+1][0] != '-')
+ {
+ int verbosity=atoi (argv[i+1]) ;
+ LogSetParameter (XLOG_VERBOSITY, verbosity) ;
+ EPHYR_LOG ("set verbosiry to %d\n", verbosity) ;
+ return 2 ;
+ }
+ else
+ {
+ UseMsg() ;
+ exit(1) ;
+ }
+ }
+#ifdef GLXEXT
+ else if (!strcmp (argv[i], "-nodri"))
+ {
+ noGlxVisualInit = FALSE ;
+ ephyrNoDRI = TRUE ;
+ EPHYR_LOG ("no direct rendering enabled\n") ;
+ return 1 ;
+ }
+#endif
+ else if (!strcmp (argv[i], "-noxv"))
+ {
+ ephyrNoXV = TRUE ;
+ EPHYR_LOG ("no XVideo enabled\n") ;
+ return 1 ;
+ }
+ else if (!strcmp (argv[i], "-name"))
+ {
+ if (i+1 < argc && argv[i+1][0] != '-')
+ {
+ hostx_use_resname(argv[i+1], 1);
+ return 2;
+ }
+ else
+ {
+ UseMsg();
+ return 0;
+ }
+ }
+ else if (!strcmp (argv[i], "-title"))
+ {
+ if (i+1 < argc && argv[i+1][0] != '-')
+ {
+ hostx_set_title(argv[i+1]);
+ return 2;
+ }
+ else
+ {
+ UseMsg();
+ return 0;
+ }
+ }
+ else if (argv[i][0] == ':')
+ {
+ hostx_set_display_name(argv[i]);
+ }
+ /* Xnest compatibility */
+ else if (!strcmp(argv[i], "-display"))
+ {
+ hostx_set_display_name(argv[i+1]);
+ return 2;
+ }
+ else if (!strcmp(argv[i], "-sync") ||
+ !strcmp(argv[i], "-full") ||
+ !strcmp(argv[i], "-sss") ||
+ !strcmp(argv[i], "-install"))
+ {
+ return 1;
+ }
+ else if (!strcmp(argv[i], "-bw") ||
+ !strcmp(argv[i], "-class") ||
+ !strcmp(argv[i], "-geometry") ||
+ !strcmp(argv[i], "-scrns"))
+ {
+ return 2;
+ }
+ /* end Xnest compat */
+
+ return KdProcessArgument (argc, argv, i);
+}
+
+#ifdef DDXBEFORERESET
+void
+ddxBeforeReset (void)
+{
+}
+#endif
+
+void
+OsVendorInit (void)
+{
+ EPHYR_DBG("mark");
+
+ if (hostx_want_host_cursor())
+ {
+ ephyrFuncs.initCursor = &ephyrCursorInit;
+ ephyrFuncs.enableCursor = &ephyrCursorEnable;
+ }
+
+ KdOsInit (&EphyrOsFuncs);
+}
+
+#ifdef DDXOSFATALERROR
+void
+OsVendorFatalError(void)
+{
+}
+#endif
+
+#endif
+
+/* 'Fake' cursor stuff, could be improved */
+
+static Bool
+ephyrRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
+{
+ return TRUE;
+}
+
+static Bool
+ephyrUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
+{
+ return TRUE;
+}
+
+static void
+ephyrSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+{
+ ;
+}
+
+static void
+ephyrMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+{
+ ;
+}
+
+static Bool
+ephyrDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
+ ephyrRealizeCursor,
+ ephyrUnrealizeCursor,
+ ephyrSetCursor,
+ ephyrMoveCursor,
+ ephyrDeviceCursorInitialize,
+ NULL
+};
+
+
+Bool
+ephyrCursorInit(ScreenPtr pScreen)
+{
+ miPointerInitialize(pScreen,
+ &EphyrPointerSpriteFuncs,
+ &ephyrPointerScreenFuncs,
+ FALSE);
+
+ return TRUE;
+}
+
+void
+ephyrCursorEnable(ScreenPtr pScreen)
+{
+ ;
+}
+
+KdCardFuncs ephyrFuncs = {
+ ephyrCardInit, /* cardinit */
+ ephyrScreenInit, /* scrinit */
+ ephyrInitScreen, /* initScreen */
+ ephyrFinishInitScreen, /* finishInitScreen */
+ ephyrCreateResources, /* createRes */
+ ephyrPreserve, /* preserve */
+ ephyrEnable, /* enable */
+ ephyrDPMS, /* dpms */
+ ephyrDisable, /* disable */
+ ephyrRestore, /* restore */
+ ephyrScreenFini, /* scrfini */
+ ephyrCardFini, /* cardfini */
+
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ 0, /* recolorCursor */
+
+ 0, /* initAccel */
+ 0, /* enableAccel */
+ 0, /* disableAccel */
+ 0, /* finiAccel */
+
+ ephyrGetColors,/* getColors */
+ ephyrPutColors, /* putColors */
+};
diff --git a/xorg-server/hw/kdrive/src/kinfo.c b/xorg-server/hw/kdrive/src/kinfo.c index cb646130e..4551fd76b 100644 --- a/xorg-server/hw/kdrive/src/kinfo.c +++ b/xorg-server/hw/kdrive/src/kinfo.c @@ -166,6 +166,12 @@ KdFreeKeyboard(KdKeyboardInfo *ki) xfree(ki->name); if (ki->path) xfree(ki->path); + if (ki->xkbRules) + xfree(ki->xkbRules); + if (ki->xkbModel) + xfree(ki->xkbModel); + if (ki->xkbLayout) + xfree(ki->xkbLayout); ki->next = NULL; xfree(ki); } diff --git a/xorg-server/hw/xfree86/common/compiler.h b/xorg-server/hw/xfree86/common/compiler.h index 71a94c0c8..ae6a4615c 100644 --- a/xorg-server/hw/xfree86/common/compiler.h +++ b/xorg-server/hw/xfree86/common/compiler.h @@ -1211,6 +1211,8 @@ extern _X_EXPORT void (*xf86WriteMmio32)(int, void *, unsigned long); extern _X_EXPORT void (*xf86WriteMmioNB8)(int, void *, unsigned long);
extern _X_EXPORT void (*xf86WriteMmioNB16)(int, void *, unsigned long);
extern _X_EXPORT void (*xf86WriteMmioNB32)(int, void *, unsigned long);
+extern _X_EXPORT void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int);
+extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
/* Some macros to hide the system dependencies for MMIO accesses */
/* Changed to kill noise generated by gcc's -Wcast-align */
@@ -1342,4 +1344,18 @@ extern _X_EXPORT void (*xf86WriteMmioNB32)(int, void *, unsigned long); # define MMIO_MOVE32(base, offset, val) MMIO_OUT32(base, offset, val)
# endif /* __alpha__ */
+
+/*
+ * With Intel, the version in os-support/misc/SlowBcopy.s is used.
+ * This avoids port I/O during the copy (which causes problems with
+ * some hardware).
+ */
+# ifdef __alpha__
+# define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count)
+# define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count)
+# else /* __alpha__ */
+# define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count)
+# define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count)
+# endif /* __alpha__ */
+
#endif /* _COMPILER_H */
diff --git a/xorg-server/hw/xfree86/common/xf86DGA.c b/xorg-server/hw/xfree86/common/xf86DGA.c index 42b7c5805..804fd37c1 100644 --- a/xorg-server/hw/xfree86/common/xf86DGA.c +++ b/xorg-server/hw/xfree86/common/xf86DGA.c @@ -120,8 +120,22 @@ DGAInit( DGAScreenKey = &DGAScreenKeyIndex; - if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec)))) - return FALSE; + pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); + + if (!pScreenPriv) + { + if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec)))) + return FALSE; + dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv); + pScreenPriv->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = DGACloseScreen; + pScreenPriv->DestroyColormap = pScreen->DestroyColormap; + pScreen->DestroyColormap = DGADestroyColormap; + pScreenPriv->InstallColormap = pScreen->InstallColormap; + pScreen->InstallColormap = DGAInstallColormap; + pScreenPriv->UninstallColormap = pScreen->UninstallColormap; + pScreen->UninstallColormap = DGAUninstallColormap; + } pScreenPriv->pScrn = pScrn; pScreenPriv->numModes = num; @@ -146,17 +160,6 @@ DGAInit( modes[i].flags &= ~DGA_PIXMAP_AVAILABLE; #endif - dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv); - pScreenPriv->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = DGACloseScreen; - pScreenPriv->DestroyColormap = pScreen->DestroyColormap; - pScreen->DestroyColormap = DGADestroyColormap; - pScreenPriv->InstallColormap = pScreen->InstallColormap; - pScreen->InstallColormap = DGAInstallColormap; - pScreenPriv->UninstallColormap = pScreen->UninstallColormap; - pScreen->UninstallColormap = DGAUninstallColormap; - - return TRUE; } diff --git a/xorg-server/hw/xfree86/loader/sdksyms.c b/xorg-server/hw/xfree86/loader/sdksyms.c index df06ef561..12af6b72e 100644 --- a/xorg-server/hw/xfree86/loader/sdksyms.c +++ b/xorg-server/hw/xfree86/loader/sdksyms.c @@ -740,6 +740,7 @@ _X_HIDDEN void *xorg_symbols[] = { (void *) &IsKeyboardDevice, (void *) &IsPointerEvent, (void *) &IsMaster, + (void *) &CopyKeyClass, (void *) &CorePointerProc, (void *) &CoreKeyboardProc, (void *) &SecurityLookupWindow, @@ -804,6 +805,7 @@ _X_HIDDEN void *xorg_symbols[] = { (void *) &FreeColors, (void *) &StoreColors, (void *) &IsMapInstalled, + (void *) &ResizeVisualArray, (void *) &screenInfo, (void *) &InitOutput, (void *) &FindGlyphHashSet, diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c index c1e31e003..506fbb9cb 100644 --- a/xorg-server/hw/xfree86/modes/xf86Crtc.c +++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c @@ -806,7 +806,7 @@ xf86CrtcScreenInit (ScreenPtr screen) screen->CloseScreen = xf86CrtcCloseScreen; #ifdef XFreeXDGA - xf86DiDGAInit(screen, 0); + _xf86_di_dga_init_internal(screen); #endif #ifdef RANDR_13_INTERFACE return RANDR_INTERFACE_VERSION; @@ -1928,7 +1928,7 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn) scrn->currentMode = scrn->modes; #ifdef XFreeXDGA if (scrn->pScreen) - xf86DiDGAReInit(scrn->pScreen); + _xf86_di_dga_reinit_internal(scrn->pScreen); #endif } diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.h b/xorg-server/hw/xfree86/modes/xf86Crtc.h index 69afaa5d1..9baa956a3 100644 --- a/xorg-server/hw/xfree86/modes/xf86Crtc.h +++ b/xorg-server/hw/xfree86/modes/xf86Crtc.h @@ -833,6 +833,10 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus); extern _X_EXPORT Bool xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address); +/* this is the real function, used only internally */ +_X_INTERNAL Bool +_xf86_di_dga_init_internal (ScreenPtr pScreen); + /** * Re-initialize dga for this screen (as when the set of modes changes) */ @@ -841,6 +845,10 @@ extern _X_EXPORT Bool xf86DiDGAReInit (ScreenPtr pScreen); #endif +/* This is the real function, used only internally */ +_X_INTERNAL Bool +_xf86_di_dga_reinit_internal (ScreenPtr pScreen); + /* * Set the subpixel order reported for the screen using * the information from the outputs diff --git a/xorg-server/hw/xfree86/modes/xf86DiDGA.c b/xorg-server/hw/xfree86/modes/xf86DiDGA.c index 0f7b8342c..60fbdbf05 100644 --- a/xorg-server/hw/xfree86/modes/xf86DiDGA.c +++ b/xorg-server/hw/xfree86/modes/xf86DiDGA.c @@ -175,6 +175,12 @@ static DGAFunctionRec xf86_dga_funcs = { Bool xf86DiDGAReInit (ScreenPtr pScreen) { + return TRUE; +} + +Bool +_xf86_di_dga_reinit_internal (ScreenPtr pScreen) +{ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); @@ -190,12 +196,15 @@ xf86DiDGAReInit (ScreenPtr pScreen) Bool xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address) { + return TRUE; +} + +Bool +_xf86_di_dga_init_internal (ScreenPtr pScreen) +{ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); - if (DGAAvailable(pScreen->myNum)) - return TRUE; - xf86_config->dga_flags = 0; xf86_config->dga_address = 0; xf86_config->dga_width = 0; diff --git a/xorg-server/hw/xfree86/modes/xf86EdidModes.c b/xorg-server/hw/xfree86/modes/xf86EdidModes.c index 6e11f9a3d..2f80070cf 100644 --- a/xorg-server/hw/xfree86/modes/xf86EdidModes.c +++ b/xorg-server/hw/xfree86/modes/xf86EdidModes.c @@ -957,7 +957,7 @@ xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC) quirks = xf86DDCDetectQuirks(scrnIndex, DDC, FALSE); - if (Monitor->widthmm <= 0 && Monitor->heightmm <= 0) { + if (Monitor->widthmm <= 0 || Monitor->heightmm <= 0) { Monitor->widthmm = 10 * DDC->features.hsize; Monitor->heightmm = 10 * DDC->features.vsize; } diff --git a/xorg-server/hw/xfree86/modes/xf86Rotate.c b/xorg-server/hw/xfree86/modes/xf86Rotate.c index 9e65c9969..5de6b0c00 100644 --- a/xorg-server/hw/xfree86/modes/xf86Rotate.c +++ b/xorg-server/hw/xfree86/modes/xf86Rotate.c @@ -268,13 +268,9 @@ xf86RotateBlockHandler(int screenNum, pointer blockData, rotation_active = xf86RotateRedisplay(pScreen); pScreen->BlockHandler = xf86_config->BlockHandler; (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask); - if (rotation_active) { - /* Re-wrap if rotation is still happening */ - xf86_config->BlockHandler = pScreen->BlockHandler; - pScreen->BlockHandler = xf86RotateBlockHandler; - } else { - xf86_config->BlockHandler = NULL; - } + /* cannot avoid re-wrapping until all wrapping is audited */ + xf86_config->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = xf86RotateBlockHandler; } void diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c index b8b00c892..4a99db375 100644 --- a/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c +++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c @@ -42,7 +42,7 @@ * Video Memory Mapping section ***************************************************************************/ static pointer -mapVidMem(int ScreenNum,int Flags, unsigned long Base, unsigned long Size) +mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags) { mach_port_t device,iopl_dev; memory_object_t iopl_mem; diff --git a/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c b/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c index 8a5017e52..182a3e6ec 100644 --- a/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c +++ b/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c @@ -1,8 +1,15 @@ +/******************************************************************************* + for Alpha Linux +*******************************************************************************/ + /* * Create a dependency that should be immune from the effect of register * renaming as is commonly seen in superscalar processors. This should * insert a minimum of 100-ns delays between reads/writes at clock rates * up to 100 MHz---GGL + * + * Slowbcopy(char *src, char *dst, int count) + * */ #ifdef HAVE_XORG_CONFIG_H @@ -47,3 +54,48 @@ xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len) while(len--) *dst++ = *src++; } + +#ifdef __alpha__ + +#ifdef linux + +#define SPARSE (7) + +#else + +#define SPARSE 0 + +#endif + +void +xf86SlowBCopyFromBus(unsigned char *src, unsigned char *dst, int count) +{ + unsigned long addr; + long result; + + addr = (unsigned long) src; + while( count ){ + result = *(volatile int *) addr; + result >>= ((addr>>SPARSE) & 3) * 8; + *dst++ = (unsigned char) (0xffUL & result); + addr += 1<<SPARSE; + count--; + outb(0x80, 0x00); + } +} + +void +xf86SlowBCopyToBus(unsigned char *src, unsigned char *dst, int count) +{ + unsigned long addr; + + addr = (unsigned long) dst; + while(count) { + *(volatile unsigned int *) addr = (unsigned short)(*src) * 0x01010101; + src++; + addr += 1<<SPARSE; + count--; + outb(0x80, 0x00); + } +} +#endif diff --git a/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c b/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c index a615a1d45..40afd5b8e 100644 --- a/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c +++ b/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c @@ -131,7 +131,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, return(-1); } - xf86SlowBcopy((unsigned char *)(base+Offset), Buf, Len); + xf86SlowBCopyFromBus((unsigned char *)(base+Offset), Buf, Len); munmap((caddr_t)base, mlen); close(fd); diff --git a/xorg-server/hw/xfree86/vgahw/vgaHW.c b/xorg-server/hw/xfree86/vgahw/vgaHW.c index 025dde2da..004376b75 100644 --- a/xorg-server/hw/xfree86/vgahw/vgaHW.c +++ b/xorg-server/hw/xfree86/vgahw/vgaHW.c @@ -793,7 +793,7 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore) if (hwp->FontInfo1) { hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */ hwp->writeGr(hwp, 0x04, 0x02); /* read plane 2 */ - xf86SlowBcopy(hwp->FontInfo1, hwp->Base, FONT_AMOUNT); + slowbcopy_tobus(hwp->FontInfo1, hwp->Base, FONT_AMOUNT); } #endif @@ -801,7 +801,7 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore) if (hwp->FontInfo2) { hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */ hwp->writeGr(hwp, 0x04, 0x03); /* read plane 3 */ - xf86SlowBcopy(hwp->FontInfo2, hwp->Base, FONT_AMOUNT); + slowbcopy_tobus(hwp->FontInfo2, hwp->Base, FONT_AMOUNT); } #endif @@ -809,10 +809,10 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore) if (hwp->TextInfo) { hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */ hwp->writeGr(hwp, 0x04, 0x00); /* read plane 0 */ - xf86SlowBcopy(hwp->TextInfo, hwp->Base, TEXT_AMOUNT); + slowbcopy_tobus(hwp->TextInfo, hwp->Base, TEXT_AMOUNT); hwp->writeSeq(hwp, 0x02, 0x02); /* write to plane 1 */ hwp->writeGr(hwp, 0x04, 0x01); /* read plane 1 */ - xf86SlowBcopy((unsigned char *)hwp->TextInfo + TEXT_AMOUNT, + slowbcopy_tobus((unsigned char *)hwp->TextInfo + TEXT_AMOUNT, hwp->Base, TEXT_AMOUNT); } #endif @@ -971,24 +971,24 @@ vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save) if (hwp->FontInfo1 || (hwp->FontInfo1 = xalloc(FONT_AMOUNT))) { hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */ hwp->writeGr(hwp, 0x04, 0x02); /* read plane 2 */ - xf86SlowBcopy(hwp->Base, hwp->FontInfo1, FONT_AMOUNT); + slowbcopy_frombus(hwp->Base, hwp->FontInfo1, FONT_AMOUNT); } #endif /* SAVE_FONT1 */ #if SAVE_FONT2 if (hwp->FontInfo2 || (hwp->FontInfo2 = xalloc(FONT_AMOUNT))) { hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */ hwp->writeGr(hwp, 0x04, 0x03); /* read plane 3 */ - xf86SlowBcopy(hwp->Base, hwp->FontInfo2, FONT_AMOUNT); + slowbcopy_frombus(hwp->Base, hwp->FontInfo2, FONT_AMOUNT); } #endif /* SAVE_FONT2 */ #if SAVE_TEXT if (hwp->TextInfo || (hwp->TextInfo = xalloc(2 * TEXT_AMOUNT))) { hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */ hwp->writeGr(hwp, 0x04, 0x00); /* read plane 0 */ - xf86SlowBcopy(hwp->Base, hwp->TextInfo, TEXT_AMOUNT); + slowbcopy_frombus(hwp->Base, hwp->TextInfo, TEXT_AMOUNT); hwp->writeSeq(hwp, 0x02, 0x02); /* write to plane 1 */ hwp->writeGr(hwp, 0x04, 0x01); /* read plane 1 */ - xf86SlowBcopy(hwp->Base, + slowbcopy_frombus(hwp->Base, (unsigned char *)hwp->TextInfo + TEXT_AMOUNT, TEXT_AMOUNT); } #endif /* SAVE_TEXT */ diff --git a/xorg-server/hw/xquartz/GL/capabilities.c b/xorg-server/hw/xquartz/GL/capabilities.c index 99b9eae61..43064044c 100644 --- a/xorg-server/hw/xquartz/GL/capabilities.c +++ b/xorg-server/hw/xquartz/GL/capabilities.c @@ -103,7 +103,7 @@ static void handleStencilModes(struct glCapabilitiesConfig *c, GLint smodes) { } static int handleColorAndAccumulation(struct glColorBufCapabilities *c, - GLint cmodes) { + GLint cmodes, int forAccum) { int offset = 0; /*1*/ @@ -204,8 +204,9 @@ static int handleColorAndAccumulation(struct glColorBufCapabilities *c, ++offset; } -#if 0 - /* + if(forAccum) { +//#if 0 + /* FIXME * Disable this path, because some part of libGL, X, or Xplugin * doesn't work with sizes greater than 8. * When this is enabled and visuals are chosen using depths @@ -274,7 +275,8 @@ static int handleColorAndAccumulation(struct glColorBufCapabilities *c, c[offset].a = 16; ++offset; } -#endif + } +//#endif /* FIXME should we handle the floating point color modes, and if so, how? */ @@ -284,14 +286,14 @@ static int handleColorAndAccumulation(struct glColorBufCapabilities *c, static void handleColorModes(struct glCapabilitiesConfig *c, GLint cmodes) { c->total_color_buffers = handleColorAndAccumulation(c->color_buffers, - cmodes); + cmodes, 0); assert(c->total_color_buffers < GLCAPS_COLOR_BUFFERS); } static void handleAccumulationModes(struct glCapabilitiesConfig *c, GLint cmodes) { c->total_accum_buffers = handleColorAndAccumulation(c->accum_buffers, - cmodes); + cmodes, 1); assert(c->total_accum_buffers < GLCAPS_COLOR_BUFFERS); } diff --git a/xorg-server/hw/xquartz/GL/visualConfigs.c b/xorg-server/hw/xquartz/GL/visualConfigs.c index fee665d1d..f92677847 100644 --- a/xorg-server/hw/xquartz/GL/visualConfigs.c +++ b/xorg-server/hw/xquartz/GL/visualConfigs.c @@ -277,7 +277,7 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) (c-1)->next = NULL; if (c - visualConfigs != numConfigs) { - FatalError("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", numConfigs, c - visualConfigs); + FatalError("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", numConfigs, (int)(c - visualConfigs)); } freeGlCapabilities(&caps); diff --git a/xorg-server/hw/xquartz/Makefile.am b/xorg-server/hw/xquartz/Makefile.am index ae8aa7f53..65c70b076 100644 --- a/xorg-server/hw/xquartz/Makefile.am +++ b/xorg-server/hw/xquartz/Makefile.am @@ -33,7 +33,6 @@ libXquartz_la_SOURCES = \ quartzAudio.c \ quartzCocoa.m \ quartzKeyboard.c \ - quartzPasteboard.c \ quartzStartup.c \ threadSafety.c @@ -50,7 +49,6 @@ EXTRA_DIST = \ quartzAudio.h \ quartzCommon.h \ quartzKeyboard.h \ - quartzPasteboard.h \ sanitizedCarbon.h \ sanitizedCocoa.h \ threadSafety.h diff --git a/xorg-server/hw/xquartz/Makefile.in b/xorg-server/hw/xquartz/Makefile.in index e63ae0d6a..a5f6a17a1 100644 --- a/xorg-server/hw/xquartz/Makefile.in +++ b/xorg-server/hw/xquartz/Makefile.in @@ -61,7 +61,7 @@ am_libXquartz_la_OBJECTS = fbcmap_mi.lo miinitext.lo X11Application.lo \ X11Controller.lo applewm.lo darwin.lo darwinEvents.lo \ darwinXinput.lo keysym2ucs.lo pseudoramiX.lo quartz.lo \ quartzAudio.lo quartzCocoa.lo quartzKeyboard.lo \ - quartzPasteboard.lo quartzStartup.lo threadSafety.lo + quartzStartup.lo threadSafety.lo libXquartz_la_OBJECTS = $(am_libXquartz_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) @@ -465,7 +465,6 @@ libXquartz_la_SOURCES = \ quartzAudio.c \ quartzCocoa.m \ quartzKeyboard.c \ - quartzPasteboard.c \ quartzStartup.c \ threadSafety.c @@ -482,7 +481,6 @@ EXTRA_DIST = \ quartzAudio.h \ quartzCommon.h \ quartzKeyboard.h \ - quartzPasteboard.h \ sanitizedCarbon.h \ sanitizedCocoa.h \ threadSafety.h @@ -553,7 +551,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzAudio.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzCocoa.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzKeyboard.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzPasteboard.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzStartup.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threadSafety.Plo@am__quote@ diff --git a/xorg-server/hw/xquartz/X11Application.m b/xorg-server/hw/xquartz/X11Application.m index 9fb192648..749a8932b 100644 --- a/xorg-server/hw/xquartz/X11Application.m +++ b/xorg-server/hw/xquartz/X11Application.m @@ -184,9 +184,6 @@ static void message_kit_thread (SEL selector, NSObject *arg) { } - (void) activateX:(OSX_BOOL)state { - /* Create a TSM document that supports full Unicode input, and - have it activated while X is active */ - static TSMDocumentID x11_document; size_t i; DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active) if (state) { @@ -195,16 +192,6 @@ static void message_kit_thread (SEL selector, NSObject *arg) { bgMouseLocationUpdated = FALSE; } DarwinSendDDXEvent(kXquartzActivate, 0); - - if (!_x_active) { - if (x11_document == 0) { - OSType types[1]; - types[0] = kUnicodeDocument; - NewTSMDocument (1, types, &x11_document, 0); - } - - if (x11_document != 0) ActivateTSMDocument (x11_document); - } } else { if(darwin_all_modifier_flags) @@ -217,9 +204,6 @@ static void message_kit_thread (SEL selector, NSObject *arg) { } DarwinSendDDXEvent(kXquartzDeactivate, 0); - - if (_x_active && x11_document != 0) - DeactivateTSMDocument (x11_document); } _x_active = state; @@ -259,23 +243,26 @@ static void message_kit_thread (SEL selector, NSObject *arg) { if(!for_appkit) { NSPoint NSlocation = [e locationInWindow]; NSWindow *window = [e window]; - + NSRect NSframe, NSvisibleFrame; + CGRect CGframe, CGvisibleFrame; + CGPoint CGlocation; + if (window != nil) { NSRect frame = [window frame]; NSlocation.x += frame.origin.x; NSlocation.y += frame.origin.y; } - NSRect NSframe = [[NSScreen mainScreen] frame]; - NSRect NSvisibleFrame = [[NSScreen mainScreen] visibleFrame]; + NSframe = [[NSScreen mainScreen] frame]; + NSvisibleFrame = [[NSScreen mainScreen] visibleFrame]; - CGRect CGframe = CGRectMake(NSframe.origin.x, NSframe.origin.y, + CGframe = CGRectMake(NSframe.origin.x, NSframe.origin.y, NSframe.size.width, NSframe.size.height); - CGRect CGvisibleFrame = CGRectMake(NSvisibleFrame.origin.x, + CGvisibleFrame = CGRectMake(NSvisibleFrame.origin.x, NSvisibleFrame.origin.y, NSvisibleFrame.size.width, NSvisibleFrame.size.height); - CGPoint CGlocation = CGPointMake(NSlocation.x, NSlocation.y); + CGlocation = CGPointMake(NSlocation.x, NSlocation.y); if(CGRectContainsPoint(CGframe, CGlocation) && !CGRectContainsPoint(CGvisibleFrame, CGlocation)) @@ -350,6 +337,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) { case NSApplicationActivatedEventType: for_x = NO; if ([self modalWindow] == nil) { + BOOL switch_on_activate, ok; for_appkit = NO; /* FIXME: hack to avoid having to pass the event to appkit, @@ -360,7 +348,6 @@ static void message_kit_thread (SEL selector, NSObject *arg) { /* Get the Spaces preference for SwitchOnActivate */ (void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences")); - BOOL switch_on_activate, ok; switch_on_activate = CFPreferencesGetAppBooleanValue(CFSTR("AppleSpacesSwitchOnActivate"), CFSTR(".GlobalPreferences"), &ok); if(!ok) switch_on_activate = YES; @@ -1180,6 +1167,17 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe break; case NSKeyDown: case NSKeyUp: + { + /* XKB clobbers our keymap at startup, so we need to force it on the first keypress. + * TODO: Make this less of a kludge. + */ + static int force_resync_keymap = YES; + if(force_resync_keymap) { + DarwinSendDDXEvent(kXquartzReloadKeymap, 0); + force_resync_keymap = NO; + } + } + if(darwinSyncKeymap) { #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 TISInputSourceRef key_layout = TISCopyCurrentKeyboardLayoutInputSource(); diff --git a/xorg-server/hw/xquartz/X11Controller.m b/xorg-server/hw/xquartz/X11Controller.m index f58747e15..d8d23ec2f 100644 --- a/xorg-server/hw/xquartz/X11Controller.m +++ b/xorg-server/hw/xquartz/X11Controller.m @@ -632,6 +632,8 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction)prefs_changed:sender { + BOOL pbproxy_active; + darwinFakeButtons = [fake_buttons intValue]; quartzUseSysBeep = [use_sysbeep intValue]; X11EnableKeyEquivalents = [enable_keyequivs intValue]; @@ -653,7 +655,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row [NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]]; [NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]]; - BOOL pbproxy_active = [sync_pasteboard intValue]; + pbproxy_active = [sync_pasteboard intValue]; [NSApp prefs_set_boolean:@PREFS_SYNC_PB value:pbproxy_active]; [NSApp prefs_set_boolean:@PREFS_SYNC_PB_TO_CLIPBOARD value:[sync_pasteboard_to_clipboard intValue]]; diff --git a/xorg-server/hw/xquartz/applewm.c b/xorg-server/hw/xquartz/applewm.c index 14be180a1..d2cca13f3 100644 --- a/xorg-server/hw/xquartz/applewm.c +++ b/xorg-server/hw/xquartz/applewm.c @@ -210,10 +210,7 @@ updateEventMask (WMEventPtr *pHead) /*ARGSUSED*/ static int -WMFreeClient (data, id) - pointer data; - XID id; -{ +WMFreeClient (pointer data, XID id) { WMEventPtr pEvent; WMEventPtr *pHead, pCur, pPrev; @@ -237,10 +234,7 @@ WMFreeClient (data, id) /*ARGSUSED*/ static int -WMFreeEvents (data, id) - pointer data; - XID id; -{ +WMFreeEvents (pointer data, XID id) { WMEventPtr *pHead, pCur, pNext; pHead = (WMEventPtr *) data; @@ -344,10 +338,7 @@ ProcAppleWMSelectInput (register ClientPtr client) */ void -AppleWMSendEvent (type, mask, which, arg) - int type, which, arg; - unsigned int mask; -{ +AppleWMSendEvent (int type, unsigned int mask, int which, int arg) { WMEventPtr *pHead, pEvent; ClientPtr client; xAppleWMNotifyEvent se; @@ -712,9 +703,7 @@ ProcAppleWMDispatch ( } static void -SNotifyEvent(from, to) - xAppleWMNotifyEvent *from, *to; -{ +SNotifyEvent(xAppleWMNotifyEvent *from, xAppleWMNotifyEvent *to) { to->type = from->type; to->kind = from->kind; cpswaps (from->sequenceNumber, to->sequenceNumber); diff --git a/xorg-server/hw/xquartz/darwin.c b/xorg-server/hw/xquartz/darwin.c index 7129ac61f..30b890589 100644 --- a/xorg-server/hw/xquartz/darwin.c +++ b/xorg-server/hw/xquartz/darwin.c @@ -67,8 +67,7 @@ #include <IOKit/hidsystem/IOHIDLib.h> #ifdef MITSHM -#define _XSHM_SERVER_ -#include <X11/extensions/XShm.h> +#include "shmint.h" #endif #include "darwin.h" @@ -291,8 +290,8 @@ static int DarwinMouseProc(DeviceIntPtr pPointer, int what) { #define NAXES 2 // 7 buttons: left, right, middle, then four scroll wheel "buttons" CARD8 map[NBUTTONS + 1] = {0, 1, 2, 3, 4, 5, 6, 7}; - Atom btn_labels[NAXES] = {0}; - Atom axes_labels[NBUTTONS] = {0}; + Atom btn_labels[NBUTTONS] = {0}; + Atom axes_labels[NAXES] = {0}; switch (what) { case DEVICE_INIT: @@ -341,8 +340,8 @@ static int DarwinTabletProc(DeviceIntPtr pPointer, int what) { #define NBUTTONS 3 #define NAXES 5 CARD8 map[NBUTTONS + 1] = {0, 1, 2, 3}; - Atom axes_labels[NAXES] = {0}; Atom btn_labels[NBUTTONS] = {0}; + Atom axes_labels[NAXES] = {0}; switch (what) { case DEVICE_INIT: @@ -354,6 +353,9 @@ static int DarwinTabletProc(DeviceIntPtr pPointer, int what) { axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y); + axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE); + axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_X); + axes_labels[4] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_Y); // Set button map. InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS, diff --git a/xorg-server/hw/xquartz/darwinEvents.c b/xorg-server/hw/xquartz/darwinEvents.c index 4822af479..421efcedf 100644 --- a/xorg-server/hw/xquartz/darwinEvents.c +++ b/xorg-server/hw/xquartz/darwinEvents.c @@ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group. #include "windowstr.h" #include "pixmapstr.h" #include "inputstr.h" +#include "eventstr.h" #include "mi.h" #include "scrnintstr.h" #include "mipointer.h" @@ -71,7 +72,7 @@ in this Software without prior written authorization from The Open Group. #include "applewmExt.h" /* FIXME: Abstract this better */ -void QuartzModeEQInit(void); +extern Bool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev); int darwin_all_modifier_flags = 0; // last known modifier state int darwin_all_modifier_mask = 0; @@ -84,7 +85,7 @@ static pthread_mutex_t fd_add_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t fd_add_ready_cond = PTHREAD_COND_INITIALIZER; static pthread_t fd_add_tid = NULL; -static EventList *darwinEvents = NULL; +static EventListPtr darwinEvents = NULL; static pthread_mutex_t mieq_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t mieq_ready_cond = PTHREAD_COND_INITIALIZER; @@ -190,89 +191,98 @@ static void DarwinUpdateModifiers( be moved into their own individual functions and set as handlers using mieqSetHandler. */ -static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { - int i; - +static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr dev) { + XQuartzEvent *e = &(ie->xquartz_event); + TA_SERVER(); -// DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents); - for (i=0; i<nevents; i++) { - switch(xe[i].u.u.type) { - case kXquartzControllerNotify: - DEBUG_LOG("kXquartzControllerNotify\n"); - AppleWMSendEvent(AppleWMControllerNotify, - AppleWMControllerNotifyMask, - xe[i].u.clientMessage.u.l.longs0, - xe[i].u.clientMessage.u.l.longs1); - break; - - case kXquartzPasteboardNotify: - DEBUG_LOG("kXquartzPasteboardNotify\n"); - AppleWMSendEvent(AppleWMPasteboardNotify, - AppleWMPasteboardNotifyMask, - xe[i].u.clientMessage.u.l.longs0, - xe[i].u.clientMessage.u.l.longs1); - break; - - case kXquartzActivate: - DEBUG_LOG("kXquartzActivate\n"); - QuartzShow(xe[i].u.keyButtonPointer.rootX, - xe[i].u.keyButtonPointer.rootY); - AppleWMSendEvent(AppleWMActivationNotify, - AppleWMActivationNotifyMask, - AppleWMIsActive, 0); - break; - - case kXquartzDeactivate: - DEBUG_LOG("kXquartzDeactivate\n"); - AppleWMSendEvent(AppleWMActivationNotify, - AppleWMActivationNotifyMask, - AppleWMIsInactive, 0); + switch(e->subtype) { + case kXquartzControllerNotify: + DEBUG_LOG("kXquartzControllerNotify\n"); + AppleWMSendEvent(AppleWMControllerNotify, + AppleWMControllerNotifyMask, + e->data[0], + e->data[1]); + break; + + case kXquartzPasteboardNotify: + DEBUG_LOG("kXquartzPasteboardNotify\n"); + AppleWMSendEvent(AppleWMPasteboardNotify, + AppleWMPasteboardNotifyMask, + e->data[0], + e->data[1]); + break; + + case kXquartzActivate: + DEBUG_LOG("kXquartzActivate\n"); + QuartzShow(); + AppleWMSendEvent(AppleWMActivationNotify, + AppleWMActivationNotifyMask, + AppleWMIsActive, 0); + break; + + case kXquartzDeactivate: + DEBUG_LOG("kXquartzDeactivate\n"); + AppleWMSendEvent(AppleWMActivationNotify, + AppleWMActivationNotifyMask, + AppleWMIsInactive, 0); + QuartzHide(); + break; + + case kXquartzReloadPreferences: + DEBUG_LOG("kXquartzReloadPreferences\n"); + AppleWMSendEvent(AppleWMActivationNotify, + AppleWMActivationNotifyMask, + AppleWMReloadPreferences, 0); + break; + + case kXquartzToggleFullscreen: + DEBUG_LOG("kXquartzToggleFullscreen\n"); + if (quartzEnableRootless) + QuartzSetFullscreen(!quartzHasRoot); + else if (quartzHasRoot) QuartzHide(); - break; - - case kXquartzReloadPreferences: - DEBUG_LOG("kXquartzReloadPreferences\n"); - AppleWMSendEvent(AppleWMActivationNotify, - AppleWMActivationNotifyMask, - AppleWMReloadPreferences, 0); - break; - - case kXquartzToggleFullscreen: - DEBUG_LOG("kXquartzToggleFullscreen\n"); - if (quartzEnableRootless) - QuartzSetFullscreen(!quartzHasRoot); - else if (quartzHasRoot) - QuartzHide(); - else - QuartzShow(xe[i].u.keyButtonPointer.rootX, - xe[i].u.keyButtonPointer.rootY); - break; - - case kXquartzSetRootless: - DEBUG_LOG("kXquartzSetRootless\n"); - QuartzSetRootless(xe[i].u.clientMessage.u.l.longs0); - if (!quartzEnableRootless && !quartzHasRoot) - QuartzHide(); - break; - - case kXquartzSetRootClip: - QuartzSetRootClip((Bool)xe[i].u.clientMessage.u.l.longs0); - break; - - case kXquartzQuit: - GiveUp(0); - break; - - case kXquartzSpaceChanged: - DEBUG_LOG("kXquartzSpaceChanged\n"); - QuartzSpaceChanged(xe[i].u.clientMessage.u.l.longs0); - break; - - default: - ErrorF("Unknown application defined event type %d.\n", xe[i].u.u.type); - } - } + else + QuartzShow(); + break; + + case kXquartzSetRootless: + DEBUG_LOG("kXquartzSetRootless\n"); + QuartzSetRootless(e->data[0]); + if (!quartzEnableRootless && !quartzHasRoot) + QuartzHide(); + break; + + case kXquartzSetRootClip: + QuartzSetRootClip((Bool)e->data[0]); + break; + + case kXquartzQuit: + GiveUp(0); + break; + + case kXquartzSpaceChanged: + DEBUG_LOG("kXquartzSpaceChanged\n"); + QuartzSpaceChanged(e->data[0]); + break; + + case kXquartzListenOnOpenFD: + ErrorF("Calling ListenOnOpenFD() for new fd: %d\n", (int)e->data[0]); + ListenOnOpenFD((int)e->data[0], 1); + break; + + case kXquartzReloadKeymap: + DarwinKeyboardReloadHandler(); + break; + + case kXquartzDisplayChanged: + QuartzUpdateScreens(); + break; + + default: + if(!QuartzModeEventHandler(screenNum, e, dev)) + ErrorF("Unknown application defined event type %d.\n", e->subtype); + } } void DarwinListenOnOpenFD(int fd) { @@ -298,16 +308,6 @@ static void DarwinProcessFDAdditionQueue_thread(void *args) { } } -static void kXquartzListenOnOpenFDHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { - size_t i; - TA_SERVER(); - - for (i=0; i<nevents; i++) { - ErrorF("Calling ListenOnOpenFD() for new fd: %d\n", (int)xe[i].u.clientMessage.u.l.longs0); - ListenOnOpenFD((int)xe[i].u.clientMessage.u.l.longs0, 1); - } -} - Bool DarwinEQInit(void) { int *p; @@ -320,23 +320,7 @@ Bool DarwinEQInit(void) { } mieqInit(); - mieqSetHandler(kXquartzReloadKeymap, DarwinKeyboardReloadHandler); - mieqSetHandler(kXquartzActivate, DarwinEventHandler); - mieqSetHandler(kXquartzDeactivate, DarwinEventHandler); - mieqSetHandler(kXquartzReloadPreferences, DarwinEventHandler); - mieqSetHandler(kXquartzSetRootClip, DarwinEventHandler); - mieqSetHandler(kXquartzQuit, DarwinEventHandler); - mieqSetHandler(kXquartzReadPasteboard, QuartzReadPasteboard); - mieqSetHandler(kXquartzWritePasteboard, QuartzWritePasteboard); - mieqSetHandler(kXquartzToggleFullscreen, DarwinEventHandler); - mieqSetHandler(kXquartzSetRootless, DarwinEventHandler); - mieqSetHandler(kXquartzSpaceChanged, DarwinEventHandler); - mieqSetHandler(kXquartzControllerNotify, DarwinEventHandler); - mieqSetHandler(kXquartzPasteboardNotify, DarwinEventHandler); - mieqSetHandler(kXquartzDisplayChanged, QuartzDisplayChangedHandler); - mieqSetHandler(kXquartzListenOnOpenFD, kXquartzListenOnOpenFDHandler); - - QuartzModeEQInit(); + mieqSetHandler(ET_XQuartz, DarwinEventHandler); /* Note that this *could* cause a potential async issue, since we're checking * darwinEvents without holding the lock, but darwinEvents is only ever set @@ -364,16 +348,16 @@ Bool DarwinEQInit(void) { * Read and process events from the event queue until it is empty. */ void ProcessInputEvents(void) { - xEvent xe; - int x = sizeof(xe); + char nullbyte; + int x = sizeof(nullbyte); TA_SERVER(); mieqProcessInputEvents(); // Empty the signaling pipe - while (x == sizeof(xe)) { - x = read(darwinEventReadFD, &xe, sizeof(xe)); + while (x == sizeof(nullbyte)) { + x = read(darwinEventReadFD, &nullbyte, sizeof(nullbyte)); } } @@ -382,7 +366,7 @@ void ProcessInputEvents(void) { static void DarwinPokeEQ(void) { char nullbyte=0; // <daniels> oh, i ... er ... christ. - write(darwinEventWriteFD, &nullbyte, 1); + write(darwinEventWriteFD, &nullbyte, sizeof(nullbyte)); } /* Convert from Appkit pointer input values to X input values: @@ -476,7 +460,7 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa darwinEvents_lock(); { num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button, POINTER_ABSOLUTE, 0, pDev==darwinTabletCurrent?5:2, valuators); - for(i=0; i<num_events; i++) mieqEnqueue (pDev, darwinEvents[i].event); + for(i=0; i<num_events; i++) mieqEnqueue (pDev, (InternalEvent*)darwinEvents[i].event); if(num_events > 0) DarwinPokeEQ(); } darwinEvents_unlock(); } @@ -491,7 +475,7 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) { darwinEvents_lock(); { num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE); - for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,darwinEvents[i].event); + for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard, (InternalEvent*)darwinEvents[i].event); if(num_events > 0) DarwinPokeEQ(); } darwinEvents_unlock(); } @@ -519,7 +503,7 @@ void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) { darwinEvents_lock(); { num_events = GetProximityEvents(darwinEvents, pDev, ev_type, 0, 5, valuators); - for(i=0; i<num_events; i++) mieqEnqueue (pDev,darwinEvents[i].event); + for(i=0; i<num_events; i++) mieqEnqueue (pDev, (InternalEvent*)darwinEvents[i].event); if(num_events > 0) DarwinPokeEQ(); } darwinEvents_unlock(); } @@ -529,13 +513,14 @@ void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) { void DarwinSendScrollEvents(float count_x, float count_y, float pointer_x, float pointer_y, float pressure, float tilt_x, float tilt_y) { + int sign_x, sign_y; if(!darwinEvents) { DEBUG_LOG("DarwinSendScrollEvents called before darwinEvents was initialized\n"); return; } - int sign_x = count_x > 0.0f ? SCROLLWHEELLEFTFAKE : SCROLLWHEELRIGHTFAKE; - int sign_y = count_y > 0.0f ? SCROLLWHEELUPFAKE : SCROLLWHEELDOWNFAKE; + sign_x = count_x > 0.0f ? SCROLLWHEELLEFTFAKE : SCROLLWHEELRIGHTFAKE; + sign_y = count_y > 0.0f ? SCROLLWHEELUPFAKE : SCROLLWHEELDOWNFAKE; count_x = fabs(count_x); count_y = fabs(count_y); @@ -566,27 +551,26 @@ void DarwinUpdateModKeys(int flags) { * Send the X server thread a message by placing it on the event queue. */ void DarwinSendDDXEvent(int type, int argc, ...) { - xEvent xe; - INT32 *argv; - int i, max_args; + XQuartzEvent e; + int i; va_list args; - memset(&xe, 0, sizeof(xe)); - xe.u.u.type = type; - xe.u.clientMessage.u.l.type = type; - - argv = &xe.u.clientMessage.u.l.longs0; - max_args = 4; + memset(&e, 0, sizeof(e)); + e.header = ET_Internal; + e.type = ET_XQuartz; + e.length = sizeof(e); + e.time = GetTimeInMillis(); + e.subtype = type; - if (argc > 0 && argc <= max_args) { + if (argc > 0 && argc < XQUARTZ_EVENT_MAXARGS) { va_start (args, argc); for (i = 0; i < argc; i++) - argv[i] = (int) va_arg (args, int); + e.data[i] = (uint32_t) va_arg (args, uint32_t); va_end (args); } darwinEvents_lock(); { - mieqEnqueue(NULL, &xe); + mieqEnqueue(NULL, (InternalEvent*)&e); DarwinPokeEQ(); } darwinEvents_unlock(); } diff --git a/xorg-server/hw/xquartz/darwinEvents.h b/xorg-server/hw/xquartz/darwinEvents.h index 126851422..590305f3e 100644 --- a/xorg-server/hw/xquartz/darwinEvents.h +++ b/xorg-server/hw/xquartz/darwinEvents.h @@ -45,17 +45,14 @@ void DarwinUpdateModKeys(int flags); void DarwinListenOnOpenFD(int fd); /* - * Special ddx events understood by the X server + * Subtypes for the ET_XQuartz event type */ enum { - kXquartzReloadKeymap // Reload system keymap - = LASTEvent+1, // (from X.h list of event names) + kXquartzReloadKeymap, // Reload system keymap kXquartzActivate, // restore X drawing and cursor kXquartzDeactivate, // clip X drawing and switch to Aqua cursor kXquartzSetRootClip, // enable or disable drawing to the X screen kXquartzQuit, // kill the X server and release the display - kXquartzReadPasteboard, // copy Mac OS X pasteboard into X cut buffer - kXquartzWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard kXquartzBringAllToFront, // bring all X windows to front kXquartzToggleFullscreen, // Enable/Disable fullscreen mode kXquartzSetRootless, // Set rootless mode diff --git a/xorg-server/hw/xquartz/mach-startup/bundle-main.c b/xorg-server/hw/xquartz/mach-startup/bundle-main.c index e887c469d..917bbafbe 100644 --- a/xorg-server/hw/xquartz/mach-startup/bundle-main.c +++ b/xorg-server/hw/xquartz/mach-startup/bundle-main.c @@ -149,15 +149,17 @@ static int accept_fd_handoff(int connected_fd) { char databuf[] = "display"; struct iovec iov[1]; - iov[0].iov_base = databuf; - iov[0].iov_len = sizeof(databuf); - union { struct cmsghdr hdr; char bytes[CMSG_SPACE(sizeof(int))]; } buf; struct msghdr msg; + struct cmsghdr *cmsg; + + iov[0].iov_base = databuf; + iov[0].iov_len = sizeof(databuf); + msg.msg_iov = iov; msg.msg_iovlen = 1; msg.msg_control = buf.bytes; @@ -166,7 +168,7 @@ static int accept_fd_handoff(int connected_fd) { msg.msg_namelen = 0; msg.msg_flags = 0; - struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); + cmsg = CMSG_FIRSTHDR (&msg); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN(sizeof(int)); @@ -197,6 +199,7 @@ static void socket_handoff_thread(void *arg) { socket_handoff_t *handoff_data = (socket_handoff_t *)arg; int launchd_fd = -1; int connected_fd; + unsigned remain; /* Now actually get the passed file descriptor from this connection * If we encounter an error, keep listening. @@ -229,7 +232,7 @@ static void socket_handoff_thread(void *arg) { * into it. */ - unsigned remain = 3000000; + remain = 3000000; fprintf(stderr, "X11.app: Received new $DISPLAY fd: %d ... sleeping to allow xinitrc to catchup.\n", launchd_fd); while((remain = usleep(remain)) > 0); @@ -626,11 +629,11 @@ static char *command_from_prefs(const char *key, const char *default_value) { if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) { CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII); + int len = strlen(default_value) + 1; CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication); CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); - int len = strlen(default_value) + 1; command = (char *)malloc(len * sizeof(char)); if(!command) return NULL; diff --git a/xorg-server/hw/xquartz/mach-startup/launchd_fd.c b/xorg-server/hw/xquartz/mach-startup/launchd_fd.c index fa623ea12..6dace8ea1 100644 --- a/xorg-server/hw/xquartz/mach-startup/launchd_fd.c +++ b/xorg-server/hw/xquartz/mach-startup/launchd_fd.c @@ -36,7 +36,7 @@ #include "launchd_fd.h" -int launchd_display_fd() { +int launchd_display_fd(void) { launch_data_t sockets_dict, checkin_request, checkin_response; launch_data_t listening_fd_array, listening_fd; diff --git a/xorg-server/hw/xquartz/mach-startup/stub.c b/xorg-server/hw/xquartz/mach-startup/stub.c index 7a557bd3f..3d22db5d1 100644 --- a/xorg-server/hw/xquartz/mach-startup/stub.c +++ b/xorg-server/hw/xquartz/mach-startup/stub.c @@ -69,13 +69,12 @@ static char x11_path[PATH_MAX + 1]; static pid_t x11app_pid = 0; -static void set_x11_path() { +static void set_x11_path(void) { #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 CFURLRef appURL = NULL; CFBundleRef bundle = NULL; OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL); - UInt32 ver; switch (osstatus) { case noErr: @@ -96,20 +95,6 @@ static void set_x11_path() { exit(3); } - ver = CFBundleGetVersionNumber(bundle); - if( !(ver >= 0x02308000 || (ver >= 0x02168000 && ver < 0x02208000))) { - CFStringRef versionStr = CFBundleGetValueForInfoDictionaryKey(bundle, kCFBundleVersionKey); - const char * versionCStr = "Unknown"; - - if(versionStr) - versionCStr = CFStringGetCStringPtr(versionStr, kCFStringEncodingMacRoman); - - fprintf(stderr, "Xquartz: Could not find a new enough X11.app LSFindApplicationForInfo() returned\n"); - fprintf(stderr, " X11.app = %s\n", x11_path); - fprintf(stderr, " Version = %s (%x), Expected Version > 2.3.0 or 2.1.6\n", versionCStr, (unsigned)ver); - exit(9); - } - strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path)); #ifdef DEBUG fprintf(stderr, "Xquartz: X11.app = %s\n", x11_path); @@ -162,15 +147,17 @@ static void send_fd_handoff(int connected_fd, int launchd_fd) { char databuf[] = "display"; struct iovec iov[1]; - iov[0].iov_base = databuf; - iov[0].iov_len = sizeof(databuf); - union { struct cmsghdr hdr; char bytes[CMSG_SPACE(sizeof(int))]; } buf; struct msghdr msg; + struct cmsghdr *cmsg; + + iov[0].iov_base = databuf; + iov[0].iov_len = sizeof(databuf); + msg.msg_iov = iov; msg.msg_iovlen = 1; msg.msg_control = buf.bytes; @@ -179,7 +166,7 @@ static void send_fd_handoff(int connected_fd, int launchd_fd) { msg.msg_namelen = 0; msg.msg_flags = 0; - struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); + cmsg = CMSG_FIRSTHDR (&msg); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN(sizeof(int)); @@ -245,10 +232,11 @@ int main(int argc, char **argv, char **envp) { kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); if(kr != KERN_SUCCESS) { + pid_t child; set_x11_path(); /* This forking is ugly and will be cleaned up later */ - pid_t child = fork(); + child = fork(); if(child == -1) { fprintf(stderr, "Xquartz: Could not fork: %s\n", strerror(errno)); return EXIT_FAILURE; diff --git a/xorg-server/hw/xquartz/quartz.c b/xorg-server/hw/xquartz/quartz.c index ca8b24595..c4142a801 100644 --- a/xorg-server/hw/xquartz/quartz.c +++ b/xorg-server/hw/xquartz/quartz.c @@ -231,7 +231,7 @@ RREditConnectionInfo (ScreenPtr pScreen) } #endif -static void QuartzUpdateScreens(void) { +void QuartzUpdateScreens(void) { ScreenPtr pScreen; WindowPtr pRoot; int x, y, width, height, sx, sy; @@ -299,14 +299,6 @@ static void QuartzUpdateScreens(void) { #endif } -/* - * QuartzDisplayChangeHandler - * Adjust for screen arrangement changes. - */ -void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { - QuartzUpdateScreens(); -} - void QuartzSetFullscreen(Bool state) { DEBUG_LOG("QuartzSetFullscreen: state=%d\n", state); @@ -374,10 +366,7 @@ void QuartzSetRootless(Bool state) { * Calls mode specific screen resume to restore the X clip regions * (if needed) and the X server cursor state. */ -void QuartzShow( - int x, // cursor location - int y ) -{ +void QuartzShow(void) { int i; if (quartzServerVisible) @@ -386,7 +375,7 @@ void QuartzShow( quartzServerVisible = TRUE; for (i = 0; i < screenInfo.numScreens; i++) { if (screenInfo.screens[i]) { - quartzProcs->ResumeScreen(screenInfo.screens[i], x, y); + quartzProcs->ResumeScreen(screenInfo.screens[i]); } } diff --git a/xorg-server/hw/xquartz/quartz.h b/xorg-server/hw/xquartz/quartz.h index c5da4c510..b1a3f3183 100644 --- a/xorg-server/hw/xquartz/quartz.h +++ b/xorg-server/hw/xquartz/quartz.h @@ -33,8 +33,6 @@ #ifndef _QUARTZ_H #define _QUARTZ_H -#include "quartzPasteboard.h" - #include "screenint.h" #include "window.h" @@ -59,7 +57,7 @@ typedef Bool (*InitCursorProc)(ScreenPtr pScreen); * Suspend and resume X11 activity */ typedef void (*SuspendScreenProc)(ScreenPtr pScreen); -typedef void (*ResumeScreenProc)(ScreenPtr pScreen, int x, int y); +typedef void (*ResumeScreenProc)(ScreenPtr pScreen); /* * Screen state change support @@ -123,13 +121,15 @@ void QuartzInitInput(int argc, char **argv); void QuartzInitServer(int argc, char **argv, char **envp); void QuartzGiveUp(void); void QuartzProcessEvent(xEvent *xe); -void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents); +void QuartzUpdateScreens(void); -void QuartzShow(int x, int y); // (x, y) = cursor loc +void QuartzShow(void); void QuartzHide(void); void QuartzSetRootClip(BOOL enable); void QuartzSpaceChanged(uint32_t space_id); void QuartzSetFullscreen(Bool state); void QuartzSetRootless(Bool state); + +int server_main(int argc, char **argv, char **envp); #endif diff --git a/xorg-server/hw/xquartz/quartzAudio.c b/xorg-server/hw/xquartz/quartzAudio.c index 8cf241738..af63d18f5 100644 --- a/xorg-server/hw/xquartz/quartzAudio.c +++ b/xorg-server/hw/xquartz/quartzAudio.c @@ -311,8 +311,10 @@ void QuartzAudioInit(void) // Prepare for playback #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + { AudioDeviceIOProcID sInputIOProcID = NULL; status = AudioDeviceCreateIOProcID( outputDevice, QuartzAudioIOProc, &data, &sInputIOProcID ); + } #else status = AudioDeviceAddIOProc(outputDevice, QuartzAudioIOProc, &data); #endif diff --git a/xorg-server/hw/xquartz/quartzCocoa.m b/xorg-server/hw/xquartz/quartzCocoa.m index 0ab94936c..450147207 100644 --- a/xorg-server/hw/xquartz/quartzCocoa.m +++ b/xorg-server/hw/xquartz/quartzCocoa.m @@ -40,67 +40,10 @@ #include "quartzCommon.h" #include "inputstr.h" -#include "quartzPasteboard.h" #include "darwin.h" /* - * QuartzWriteCocoaPasteboard - * Write text to the Mac OS X pasteboard. - */ -void QuartzWriteCocoaPasteboard( - char *text) -{ - NSPasteboard *pasteboard; - NSArray *pasteboardTypes; - NSString *string; - - if (! text) return; - pasteboard = [NSPasteboard generalPasteboard]; - if (! pasteboard) return; - string = [NSString stringWithCString:text]; - if (! string) return; - pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType]; - - // nil owner because we don't provide type translations - [pasteboard declareTypes:pasteboardTypes owner:nil]; - [pasteboard setString:string forType:NSStringPboardType]; -} - - -/* - * QuartzReadCocoaPasteboard - * Read text from the Mac OS X pasteboard and return it as a heap string. - * The caller must free the string. - */ -char *QuartzReadCocoaPasteboard(void) -{ - NSPasteboard *pasteboard; - NSArray *pasteboardTypes; - NSString *existingType; - char *text = NULL; - - pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType]; - pasteboard = [NSPasteboard generalPasteboard]; - if (! pasteboard) return NULL; - - existingType = [pasteboard availableTypeFromArray:pasteboardTypes]; - if (existingType) { - NSString *string = [pasteboard stringForType:existingType]; - char *buffer; - - if (! string) return NULL; - buffer = (char *) [string UTF8String]; - text = (char *) malloc(strlen(buffer)+1); - if (text) - strcpy(text, buffer); - } - - return text; -} - - -/* * QuartzFSUseQDCursor * Return whether the screen should use a QuickDraw cursor. */ diff --git a/xorg-server/hw/xquartz/quartzKeyboard.c b/xorg-server/hw/xquartz/quartzKeyboard.c index 4abf4af7f..d36d967a2 100644 --- a/xorg-server/hw/xquartz/quartzKeyboard.c +++ b/xorg-server/hw/xquartz/quartzKeyboard.c @@ -251,6 +251,10 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) { break; case XK_Mode_switch: + info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i; +#ifdef NX_MODIFIERKEY_RALTERNATE + info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i; +#endif info->modMap[MIN_KEYCODE + i] = Mod1Mask; break; @@ -296,13 +300,11 @@ static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) { static void DarwinKeyboardSetDeviceKeyMap(KeySymsRec *keySyms, CARD8 *modmap) { DeviceIntPtr pDev; - pthread_mutex_lock(&keyInfo_mutex); for (pDev = inputInfo.devices; pDev; pDev = pDev->next) if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) XkbApplyMappingChange(pDev, keySyms, keySyms->minKeyCode, keySyms->maxKeyCode - keySyms->minKeyCode + 1, modmap, serverClient); - pthread_mutex_unlock(&keyInfo_mutex); } /* @@ -356,7 +358,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) { CopyKeyClass(pDev, inputInfo.keyboard); } -void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr pDev, int nevents) { +void DarwinKeyboardReloadHandler(void) { KeySymsRec keySyms; DEBUG_LOG("DarwinKeyboardReloadHandler\n"); diff --git a/xorg-server/hw/xquartz/quartzKeyboard.h b/xorg-server/hw/xquartz/quartzKeyboard.h index 215a4a9a5..1aaec6ef2 100644 --- a/xorg-server/hw/xquartz/quartzKeyboard.h +++ b/xorg-server/hw/xquartz/quartzKeyboard.h @@ -53,7 +53,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info); /* Provided for darwinEvents.c */ extern darwinKeyboardInfo keyInfo; extern pthread_mutex_t keyInfo_mutex; -void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents); +void DarwinKeyboardReloadHandler(void); int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide); int DarwinModifierNXKeyToNXKeycode(int key, int side); int DarwinModifierNXKeyToNXMask(int key); diff --git a/xorg-server/hw/xquartz/xpr/appledri.c b/xorg-server/hw/xquartz/xpr/appledri.c index 835ccabaf..74a4ec315 100644 --- a/xorg-server/hw/xquartz/xpr/appledri.c +++ b/xorg-server/hw/xquartz/xpr/appledri.c @@ -255,10 +255,10 @@ ProcAppleDRIDestroySurface( register ClientPtr client ) { + int rc; REQUEST(xAppleDRIDestroySurfaceReq); DrawablePtr pDrawable; REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq); - int rc; rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, DixReadAccess); diff --git a/xorg-server/hw/xquartz/xpr/x-hash.h b/xorg-server/hw/xquartz/xpr/x-hash.h index 78bc7b317..f876b6b71 100644 --- a/xorg-server/hw/xquartz/xpr/x-hash.h +++ b/xorg-server/hw/xquartz/xpr/x-hash.h @@ -72,7 +72,7 @@ X_PFX (cvt_vptr_to_uint) (void * val) __attribute__((always_inline)); static __inline__ void * X_PFX (cvt_uint_to_vptr) (unsigned int val) { - return (void*)((size_t)(val)); + return (void*)((unsigned long)(val)); } static __inline__ unsigned int diff --git a/xorg-server/hw/xquartz/xpr/xpr.h b/xorg-server/hw/xquartz/xpr/xpr.h index c657e1586..af1a90ca0 100644 --- a/xorg-server/hw/xquartz/xpr/xpr.h +++ b/xorg-server/hw/xquartz/xpr/xpr.h @@ -45,7 +45,7 @@ void xprHideWindows(Bool hide); Bool QuartzInitCursor(ScreenPtr pScreen); void QuartzSuspendXCursor(ScreenPtr pScreen); -void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y); +void QuartzResumeXCursor(ScreenPtr pScreen); /* If we are rooted, we need the root window and desktop levels to be below * the menubar (24) but above native windows. Normal window level is 0. diff --git a/xorg-server/hw/xquartz/xpr/xprCursor.c b/xorg-server/hw/xquartz/xpr/xprCursor.c index 8c47b671c..b577fc099 100644 --- a/xorg-server/hw/xquartz/xpr/xprCursor.c +++ b/xorg-server/hw/xquartz/xpr/xprCursor.c @@ -392,7 +392,7 @@ QuartzSuspendXCursor(ScreenPtr pScreen) * X server is showing. Restore the X cursor. */ void -QuartzResumeXCursor(ScreenPtr pScreen, int x, int y) +QuartzResumeXCursor(ScreenPtr pScreen) { WindowPtr pWin; CursorPtr pCursor; @@ -407,5 +407,5 @@ QuartzResumeXCursor(ScreenPtr pScreen, int x, int y) if (pCursor == NULL) return; - QuartzSetCursor(darwinPointer, pScreen, pCursor, x, y); + QuartzSetCursor(darwinPointer, pScreen, pCursor, /* x */ 0, /* y */ 0); } diff --git a/xorg-server/hw/xquartz/xpr/xprEvent.c b/xorg-server/hw/xquartz/xpr/xprEvent.c index f8e985aba..6245cce42 100644 --- a/xorg-server/hw/xquartz/xpr/xprEvent.c +++ b/xorg-server/hw/xquartz/xpr/xprEvent.c @@ -39,6 +39,7 @@ #include "windowstr.h" #include "pixmapstr.h" #include "inputstr.h" +#include "eventstr.h" #include "mi.h" #include "scrnintstr.h" #include "mipointer.h" @@ -55,36 +56,26 @@ #include "rootlessWindow.h" #include "xprEvent.h" -static void xprEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { - int i; - +Bool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev) { TA_SERVER(); - DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents); - for (i=0; i<nevents; i++) { - switch(xe[i].u.u.type) { - - case kXquartzWindowState: - DEBUG_LOG("kXquartzWindowState\n"); - RootlessNativeWindowStateChanged(xprGetXWindow(xe[i].u.clientMessage.u.l.longs0), - xe[i].u.clientMessage.u.l.longs1); - break; - - case kXquartzWindowMoved: - DEBUG_LOG("kXquartzWindowMoved\n"); - RootlessNativeWindowMoved(xprGetXWindow(xe[i].u.clientMessage.u.l.longs0)); - break; - - case kXquartzBringAllToFront: - DEBUG_LOG("kXquartzBringAllToFront\n"); - RootlessOrderAllWindows(); - break; - } + switch(e->subtype) { + case kXquartzWindowState: + DEBUG_LOG("kXquartzWindowState\n"); + RootlessNativeWindowStateChanged(xprGetXWindow(e->data[0]), + e->data[1]); + return TRUE; + + case kXquartzWindowMoved: + DEBUG_LOG("kXquartzWindowMoved\n"); + RootlessNativeWindowMoved(xprGetXWindow(e->data[0])); + return TRUE; + + case kXquartzBringAllToFront: + DEBUG_LOG("kXquartzBringAllToFront\n"); + RootlessOrderAllWindows(); + return TRUE; + default: + return FALSE; } } - -void QuartzModeEQInit(void) { - mieqSetHandler(kXquartzWindowState, xprEventHandler); - mieqSetHandler(kXquartzWindowMoved, xprEventHandler); - mieqSetHandler(kXquartzBringAllToFront, xprEventHandler); -} diff --git a/xorg-server/hw/xquartz/xpr/xprEvent.h b/xorg-server/hw/xquartz/xpr/xprEvent.h index 5af9dfd77..ebfa36bd8 100644 --- a/xorg-server/hw/xquartz/xpr/xprEvent.h +++ b/xorg-server/hw/xquartz/xpr/xprEvent.h @@ -29,6 +29,6 @@ #ifndef __XPR_EVENT_H__ #define __XPR_EVENT_H__ -void QuartzModeEQInit(void); +Bool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev); #endif diff --git a/xorg-server/hw/xquartz/xpr/xprFrame.c b/xorg-server/hw/xquartz/xpr/xprFrame.c index 6635f08d8..a3e207616 100644 --- a/xorg-server/hw/xquartz/xpr/xprFrame.c +++ b/xorg-server/hw/xquartz/xpr/xprFrame.c @@ -215,10 +215,10 @@ xprDestroyFrame(RootlessFrameID wid) static void xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY) { - TA_SERVER(); - xp_window_changes wc; + TA_SERVER(); + wc.x = newX; wc.y = newY; // ErrorF("xprMoveFrame(%d, %p, %d, %d)\n", wid, pScreen, newX, newY); @@ -272,7 +272,7 @@ static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) { } if(window_hash) { - RootlessWindowRec *winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr((xp_window_id)wid), NULL); + RootlessWindowRec *winRec = x_hash_table_lookup(window_hash, wid, NULL); if(winRec) { if(quartzEnableRootless) @@ -566,8 +566,8 @@ xprHideWindows(Bool hide) TA_SERVER(); for (screen = 0; screen < screenInfo.numScreens; screen++) { - pRoot = WindowTable[screenInfo.screens[screen]->myNum]; RootlessFrameID prevWid = NULL; + pRoot = WindowTable[screenInfo.screens[screen]->myNum]; for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) { RootlessWindowRec *winRec = WINREC(pWin); diff --git a/xorg-server/hw/xquartz/xpr/xprScreen.c b/xorg-server/hw/xquartz/xpr/xprScreen.c index 3387ecf0a..22a727e67 100644 --- a/xorg-server/hw/xquartz/xpr/xprScreen.c +++ b/xorg-server/hw/xquartz/xpr/xprScreen.c @@ -317,11 +317,11 @@ xprAddScreen(int index, ScreenPtr pScreen) if (noPseudoramiXExtension) { - ErrorF("Warning: noPseudoramiXExtension!\n"); - CGDirectDisplayID dpy; CGRect frame; + ErrorF("Warning: noPseudoramiXExtension!\n"); + dpy = displayAtIndex(index); frame = displayScreenBounds(dpy); |