diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 654ab5ba5..000000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: c -cache: - ccache: true - directories: - - $HOME/Library/Caches/Homebrew -branches: - except: - - /appveyor.*/ - -os: osx -osx_image: xcode9.2 - -matrix: - include: - - env: TOOL=meson - - env: TOOL=autotools - -install: - - brew update - - HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache meson - -script: - - ./test/scripts/build-travis-osx.sh $TOOL - - ccache -s - -before_cache: - - brew cleanup diff --git a/hw/meson.build b/hw/meson.build index 0f43ab6e2..c870e19c2 100644 --- a/hw/meson.build +++ b/hw/meson.build @@ -14,10 +14,6 @@ if build_xorg subdir('xfree86') endif -if build_xquartz - subdir('xquartz') -endif - if build_xwayland subdir('xwayland') endif diff --git a/hw/xquartz/GL/capabilities.c b/hw/xquartz/GL/capabilities.c deleted file mode 100644 index 1744f1203..000000000 --- a/hw/xquartz/GL/capabilities.c +++ /dev/null @@ -1,571 +0,0 @@ -/* - * Copyright (c) 2008-2012 Apple Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include - -#define Cursor Mac_Cursor -#define BOOL Mac_BOOL -#include -#include -#include -#include -#include -#undef Cursor -#undef BOOL - -#include "capabilities.h" - -#include "os.h" - -static void -handleBufferModes(struct glCapabilitiesConfig *c, GLint bufferModes) -{ - if (bufferModes & kCGLStereoscopicBit) { - c->stereo = true; - } - - if (bufferModes & kCGLDoubleBufferBit) { - c->buffers = 2; - } - else { - c->buffers = 1; - } -} - -static void -handleStencilModes(struct glCapabilitiesConfig *c, GLint smodes) -{ - int offset = 0; - - if (kCGL0Bit & smodes) - c->stencil_bit_depths[offset++] = 0; - - if (kCGL1Bit & smodes) - c->stencil_bit_depths[offset++] = 1; - - if (kCGL2Bit & smodes) - c->stencil_bit_depths[offset++] = 2; - - if (kCGL3Bit & smodes) - c->stencil_bit_depths[offset++] = 3; - - if (kCGL4Bit & smodes) - c->stencil_bit_depths[offset++] = 4; - - if (kCGL5Bit & smodes) - c->stencil_bit_depths[offset++] = 5; - - if (kCGL6Bit & smodes) - c->stencil_bit_depths[offset++] = 6; - - if (kCGL8Bit & smodes) - c->stencil_bit_depths[offset++] = 8; - - if (kCGL10Bit & smodes) - c->stencil_bit_depths[offset++] = 10; - - if (kCGL12Bit & smodes) - c->stencil_bit_depths[offset++] = 12; - - if (kCGL16Bit & smodes) - c->stencil_bit_depths[offset++] = 16; - - if (kCGL24Bit & smodes) - c->stencil_bit_depths[offset++] = 24; - - if (kCGL32Bit & smodes) - c->stencil_bit_depths[offset++] = 32; - - if (kCGL48Bit & smodes) - c->stencil_bit_depths[offset++] = 48; - - if (kCGL64Bit & smodes) - c->stencil_bit_depths[offset++] = 64; - - if (kCGL96Bit & smodes) - c->stencil_bit_depths[offset++] = 96; - - if (kCGL128Bit & smodes) - c->stencil_bit_depths[offset++] = 128; - - assert(offset < GLCAPS_STENCIL_BIT_DEPTH_BUFFERS); - - c->total_stencil_bit_depths = offset; -} - -static int -handleColorAndAccumulation(struct glColorBufCapabilities *c, - GLint cmodes, int forAccum) -{ - int offset = 0; - - /*1*/ - if (kCGLRGB444Bit & cmodes) { - c[offset].r = 4; - c[offset].g = 4; - c[offset].b = 4; - ++offset; - } - - /*2*/ - if (kCGLARGB4444Bit & cmodes) { - c[offset].a = 4; - c[offset].r = 4; - c[offset].g = 4; - c[offset].b = 4; - c[offset].is_argb = true; - ++offset; - } - - /*3*/ - if (kCGLRGB444A8Bit & cmodes) { - c[offset].r = 4; - c[offset].g = 4; - c[offset].b = 4; - c[offset].a = 8; - ++offset; - } - - /*4*/ - if (kCGLRGB555Bit & cmodes) { - c[offset].r = 5; - c[offset].g = 5; - c[offset].b = 5; - ++offset; - } - - /*5*/ - if (kCGLARGB1555Bit & cmodes) { - c[offset].a = 1; - c[offset].r = 5; - c[offset].g = 5; - c[offset].b = 5; - c[offset].is_argb = true; - ++offset; - } - - /*6*/ - if (kCGLRGB555A8Bit & cmodes) { - c[offset].r = 5; - c[offset].g = 5; - c[offset].b = 5; - c[offset].a = 8; - ++offset; - } - - /*7*/ - if (kCGLRGB565Bit & cmodes) { - c[offset].r = 5; - c[offset].g = 6; - c[offset].b = 5; - ++offset; - } - - /*8*/ - if (kCGLRGB565A8Bit & cmodes) { - c[offset].r = 5; - c[offset].g = 6; - c[offset].b = 5; - c[offset].a = 8; - ++offset; - } - - /*9*/ - if (kCGLRGB888Bit & cmodes) { - c[offset].r = 8; - c[offset].g = 8; - c[offset].b = 8; - ++offset; - } - - /*10*/ - if (kCGLARGB8888Bit & cmodes) { - c[offset].a = 8; - c[offset].r = 8; - c[offset].g = 8; - c[offset].b = 8; - c[offset].is_argb = true; - ++offset; - } - - /*11*/ - if (kCGLRGB888A8Bit & cmodes) { - c[offset].r = 8; - c[offset].g = 8; - c[offset].b = 8; - c[offset].a = 8; - ++offset; - } - - 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 - * such as 16, the result is that the windows don't redraw - * and are often white, until a resize. - */ - - /*12*/ - if (kCGLRGB101010Bit & cmodes) { - c[offset].r = 10; - c[offset].g = 10; - c[offset].b = 10; - ++offset; - } - - /*13*/ - if (kCGLARGB2101010Bit & cmodes) { - c[offset].a = 2; - c[offset].r = 10; - c[offset].g = 10; - c[offset].b = 10; - c[offset].is_argb = true; - ++offset; - } - - /*14*/ - if (kCGLRGB101010_A8Bit & cmodes) { - c[offset].r = 10; - c[offset].g = 10; - c[offset].b = 10; - c[offset].a = 8; - ++offset; - } - - /*15*/ - if (kCGLRGB121212Bit & cmodes) { - c[offset].r = 12; - c[offset].g = 12; - c[offset].b = 12; - ++offset; - } - - /*16*/ - if (kCGLARGB12121212Bit & cmodes) { - c[offset].a = 12; - c[offset].r = 12; - c[offset].g = 12; - c[offset].b = 12; - c[offset].is_argb = true; - ++offset; - } - - /*17*/ - if (kCGLRGB161616Bit & cmodes) { - c[offset].r = 16; - c[offset].g = 16; - c[offset].b = 16; - ++offset; - } - - /*18*/ - if (kCGLRGBA16161616Bit & cmodes) { - c[offset].r = 16; - c[offset].g = 16; - c[offset].b = 16; - c[offset].a = 16; - ++offset; - } - } - //#endif - - /* FIXME should we handle the floating point color modes, and if so, how? */ - - return offset; -} - -static void -handleColorModes(struct glCapabilitiesConfig *c, GLint cmodes) -{ - c->total_color_buffers = handleColorAndAccumulation(c->color_buffers, - 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, 1); - assert(c->total_accum_buffers < GLCAPS_COLOR_BUFFERS); -} - -static void -handleDepthModes(struct glCapabilitiesConfig *c, GLint dmodes) -{ - int offset = 0; -#define DEPTH(flag, value) do { \ - if (dmodes & flag) { \ - c->depth_buffers[offset++] = value; \ - } \ -} while (0) - - /*1*/ - DEPTH(kCGL0Bit, 0); - /*2*/ - DEPTH(kCGL1Bit, 1); - /*3*/ - DEPTH(kCGL2Bit, 2); - /*4*/ - DEPTH(kCGL3Bit, 3); - /*5*/ - DEPTH(kCGL4Bit, 4); - /*6*/ - DEPTH(kCGL5Bit, 5); - /*7*/ - DEPTH(kCGL6Bit, 6); - /*8*/ - DEPTH(kCGL8Bit, 8); - /*9*/ - DEPTH(kCGL10Bit, 10); - /*10*/ - DEPTH(kCGL12Bit, 12); - /*11*/ - DEPTH(kCGL16Bit, 16); - /*12*/ - DEPTH(kCGL24Bit, 24); - /*13*/ - DEPTH(kCGL32Bit, 32); - /*14*/ - DEPTH(kCGL48Bit, 48); - /*15*/ - DEPTH(kCGL64Bit, 64); - /*16*/ - DEPTH(kCGL96Bit, 96); - /*17*/ - DEPTH(kCGL128Bit, 128); - -#undef DEPTH - - c->total_depth_buffer_depths = offset; - assert(c->total_depth_buffer_depths < GLCAPS_DEPTH_BUFFERS); -} - -/* Return non-zero if an error occurred. */ -static CGLError -handleRendererDescriptions(CGLRendererInfoObj info, GLint r, - struct glCapabilitiesConfig *c) -{ - CGLError err; - GLint accelerated = 0, flags = 0, aux = 0, samplebufs = 0, samples = 0; - - err = CGLDescribeRenderer(info, r, kCGLRPAccelerated, &accelerated); - - if (err) - return err; - - c->accelerated = accelerated; - - /* Buffering modes: single/double, stereo */ - err = CGLDescribeRenderer(info, r, kCGLRPBufferModes, &flags); - - if (err) - return err; - - handleBufferModes(c, flags); - - /* AUX buffers */ - err = CGLDescribeRenderer(info, r, kCGLRPMaxAuxBuffers, &aux); - - if (err) - return err; - - c->aux_buffers = aux; - - /* Depth buffer size */ - err = CGLDescribeRenderer(info, r, kCGLRPDepthModes, &flags); - - if (err) - return err; - - handleDepthModes(c, flags); - - /* Multisample buffers */ - err = CGLDescribeRenderer(info, r, kCGLRPMaxSampleBuffers, &samplebufs); - - if (err) - return err; - - c->multisample_buffers = samplebufs; - - /* Multisample samples per multisample buffer */ - err = CGLDescribeRenderer(info, r, kCGLRPMaxSamples, &samples); - - if (err) - return err; - - c->multisample_samples = samples; - - /* Stencil bit depths */ - err = CGLDescribeRenderer(info, r, kCGLRPStencilModes, &flags); - - if (err) - return err; - - handleStencilModes(c, flags); - - /* Color modes (RGB/RGBA depths supported */ - err = CGLDescribeRenderer(info, r, kCGLRPColorModes, &flags); - - if (err) - return err; - - handleColorModes(c, flags); - - err = CGLDescribeRenderer(info, r, kCGLRPAccumModes, &flags); - - if (err) - return err; - - handleAccumulationModes(c, flags); - - return kCGLNoError; -} - -static void -initCapabilities(struct glCapabilities *cap) -{ - cap->configurations = NULL; - cap->total_configurations = 0; -} - -static void -initConfig(struct glCapabilitiesConfig *c) -{ - int i; - - c->accelerated = false; - c->stereo = false; - c->aux_buffers = 0; - c->buffers = 0; - - c->total_depth_buffer_depths = 0; - - for (i = 0; i < GLCAPS_DEPTH_BUFFERS; ++i) { - c->depth_buffers[i] = GLCAPS_INVALID_DEPTH_VALUE; - } - - c->multisample_buffers = 0; - c->multisample_samples = 0; - - c->total_stencil_bit_depths = 0; - - for (i = 0; i < GLCAPS_STENCIL_BIT_DEPTH_BUFFERS; ++i) { - c->stencil_bit_depths[i] = GLCAPS_INVALID_STENCIL_DEPTH; - } - - c->total_color_buffers = 0; - - for (i = 0; i < GLCAPS_COLOR_BUFFERS; ++i) { - c->color_buffers[i].r = c->color_buffers[i].g = - c->color_buffers[i].b = - c->color_buffers[i].a = - GLCAPS_COLOR_BUF_INVALID_VALUE; - c->color_buffers[i].is_argb = false; - } - - c->total_accum_buffers = 0; - - for (i = 0; i < GLCAPS_COLOR_BUFFERS; ++i) { - c->accum_buffers[i].r = c->accum_buffers[i].g = - c->accum_buffers[i].b = - c->accum_buffers[i].a = - GLCAPS_COLOR_BUF_INVALID_VALUE; - c->accum_buffers[i].is_argb = false; - } - - c->next = NULL; -} - -void -freeGlCapabilities(struct glCapabilities *cap) -{ - struct glCapabilitiesConfig *conf, *next; - - conf = cap->configurations; - - while (conf) { - next = conf->next; - free(conf); - conf = next; - } - - cap->configurations = NULL; -} - -/* Return true if an error occurred. */ -bool -getGlCapabilities(struct glCapabilities *cap) -{ - CGLRendererInfoObj info; - CGLError err; - GLint numRenderers = 0, r; - - initCapabilities(cap); - - err = CGLQueryRendererInfo((GLuint) - 1, &info, &numRenderers); - if (err) { - ErrorF("CGLQueryRendererInfo error: %s\n", CGLErrorString(err)); - return err; - } - - for (r = 0; r < numRenderers; r++) { - struct glCapabilitiesConfig tmpconf, *conf; - - initConfig(&tmpconf); - - err = handleRendererDescriptions(info, r, &tmpconf); - if (err) { - ErrorF("handleRendererDescriptions returned error: %s\n", - CGLErrorString( - err)); - ErrorF("trying to continue...\n"); - continue; - } - - conf = malloc(sizeof(*conf)); - if (NULL == conf) { - FatalError("Unable to allocate memory for OpenGL capabilities\n"); - } - - /* Copy the struct. */ - *conf = tmpconf; - - /* Now link the configuration into the list. */ - conf->next = cap->configurations; - cap->configurations = conf; - } - - CGLDestroyRendererInfo(info); - - /* No error occurred. We are done. */ - return kCGLNoError; -} diff --git a/hw/xquartz/GL/capabilities.h b/hw/xquartz/GL/capabilities.h deleted file mode 100644 index 62b3ac25a..000000000 --- a/hw/xquartz/GL/capabilities.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2008-2012 Apple Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef CAPABILITIES_H -#define CAPABILITIES_H - -#include - -enum { GLCAPS_INVALID_STENCIL_DEPTH = -1 }; -enum { GLCAPS_COLOR_BUF_INVALID_VALUE = -1 }; -enum { GLCAPS_COLOR_BUFFERS = 20 }; -enum { GLCAPS_STENCIL_BIT_DEPTH_BUFFERS = 20 }; -enum { GLCAPS_DEPTH_BUFFERS = 20 }; -enum { GLCAPS_INVALID_DEPTH_VALUE = 1 }; - -struct glColorBufCapabilities { - char r, g, b, a; - bool is_argb; -}; - -struct glCapabilitiesConfig { - bool accelerated; - bool stereo; - int aux_buffers; - int buffers; - int total_depth_buffer_depths; - int depth_buffers[GLCAPS_DEPTH_BUFFERS]; - int multisample_buffers; - int multisample_samples; - int total_stencil_bit_depths; - char stencil_bit_depths[GLCAPS_STENCIL_BIT_DEPTH_BUFFERS]; - int total_color_buffers; - struct glColorBufCapabilities color_buffers[GLCAPS_COLOR_BUFFERS]; - int total_accum_buffers; - struct glColorBufCapabilities accum_buffers[GLCAPS_COLOR_BUFFERS]; - struct glCapabilitiesConfig *next; -}; - -struct glCapabilities { - struct glCapabilitiesConfig *configurations; - int total_configurations; -}; - -bool -getGlCapabilities(struct glCapabilities *cap); -void -freeGlCapabilities(struct glCapabilities *cap); - -#endif diff --git a/hw/xquartz/GL/glcontextmodes.c b/hw/xquartz/GL/glcontextmodes.c deleted file mode 100644 index 64a1ac7c4..000000000 --- a/hw/xquartz/GL/glcontextmodes.c +++ /dev/null @@ -1,585 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2003 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file glcontextmodes.c - * Utility routines for working with \c __GLcontextModes structures. At - * some point most or all of these functions will be moved to the Mesa - * code base. - * - * \author Ian Romanick - */ - -#if defined(IN_MINI_GLX) -#include -#else -#if defined(HAVE_DIX_CONFIG_H) -#include -#endif -#include -#include -#include "GL/glxint.h" -#endif - -/* Memory macros */ -#if defined(IN_MINI_GLX) -#include -#include -#define _mesa_malloc(b) malloc(b) -#define _mesa_free(m) free(m) -#define _mesa_memset memset -#else -#ifdef XFree86Server -#include -#include -#define _mesa_malloc(b) malloc(b) -#define _mesa_free(m) free(m) -#define _mesa_memset memset -#else -#include -#define _mesa_memset memset -#define _mesa_malloc(b) Xmalloc(b) -#define _mesa_free(m) free(m) -#endif /* XFree86Server */ -#endif /* !defined(IN_MINI_GLX) */ - -#include "glcontextmodes.h" - -#if !defined(IN_MINI_GLX) -#define NUM_VISUAL_TYPES 6 - -/** - * Convert an X visual type to a GLX visual type. - * - * \param visualType X visual type (i.e., \c TrueColor, \c StaticGray, etc.) - * to be converted. - * \return If \c visualType is a valid X visual type, a GLX visual type will - * be returned. Otherwise \c GLX_NONE will be returned. - */ -GLint -_gl_convert_from_x_visual_type(int visualType) -{ - static const int glx_visual_types[NUM_VISUAL_TYPES] = { - GLX_STATIC_GRAY, GLX_GRAY_SCALE, - GLX_STATIC_COLOR, GLX_PSEUDO_COLOR, - GLX_TRUE_COLOR, GLX_DIRECT_COLOR - }; - - return ((unsigned)visualType < NUM_VISUAL_TYPES) - ? glx_visual_types[visualType] : GLX_NONE; -} - -/** - * Convert a GLX visual type to an X visual type. - * - * \param visualType GLX visual type (i.e., \c GLX_TRUE_COLOR, - * \c GLX_STATIC_GRAY, etc.) to be converted. - * \return If \c visualType is a valid GLX visual type, an X visual type will - * be returned. Otherwise -1 will be returned. - */ -GLint -_gl_convert_to_x_visual_type(int visualType) -{ - static const int x_visual_types[NUM_VISUAL_TYPES] = { - TrueColor, DirectColor, - PseudoColor, StaticColor, - GrayScale, StaticGray - }; - - return ((unsigned)(visualType - GLX_TRUE_COLOR) < NUM_VISUAL_TYPES) - ? x_visual_types[visualType - GLX_TRUE_COLOR] : -1; -} - -/** - * Copy a GLX visual config structure to a GL context mode structure. All - * of the fields in \c config are copied to \c mode. Additional fields in - * \c mode that can be derived from the fields of \c config (i.e., - * \c haveDepthBuffer) are also filled in. The remaining fields in \c mode - * that cannot be derived are set to default values. - * - * \param mode Destination GL context mode. - * \param config Source GLX visual config. - * - * \note - * The \c fbconfigID and \c visualID fields of the \c __GLcontextModes - * structure will be set to the \c vid of the \c __GLXvisualConfig structure. - */ -void -_gl_copy_visual_to_context_mode(__GLcontextModes * mode, - const __GLXvisualConfig * config) -{ - __GLcontextModes * const next = mode->next; - - (void)_mesa_memset(mode, 0, sizeof(__GLcontextModes)); - mode->next = next; - - mode->visualID = config->vid; - mode->visualType = _gl_convert_from_x_visual_type(config->class); - mode->fbconfigID = config->vid; - mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT; - - mode->rgbMode = (config->rgba != 0); - mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT; - - mode->colorIndexMode = !(mode->rgbMode); - mode->doubleBufferMode = (config->doubleBuffer != 0); - mode->stereoMode = (config->stereo != 0); - - mode->haveAccumBuffer = ((config->accumRedSize + - config->accumGreenSize + - config->accumBlueSize + - config->accumAlphaSize) > 0); - mode->haveDepthBuffer = (config->depthSize > 0); - mode->haveStencilBuffer = (config->stencilSize > 0); - - mode->redBits = config->redSize; - mode->greenBits = config->greenSize; - mode->blueBits = config->blueSize; - mode->alphaBits = config->alphaSize; - mode->redMask = config->redMask; - mode->greenMask = config->greenMask; - mode->blueMask = config->blueMask; - mode->alphaMask = config->alphaMask; - mode->rgbBits = mode->rgbMode ? config->bufferSize : 0; - mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0; - - mode->accumRedBits = config->accumRedSize; - mode->accumGreenBits = config->accumGreenSize; - mode->accumBlueBits = config->accumBlueSize; - mode->accumAlphaBits = config->accumAlphaSize; - mode->depthBits = config->depthSize; - mode->stencilBits = config->stencilSize; - - mode->numAuxBuffers = config->auxBuffers; - mode->level = config->level; - - mode->visualRating = config->visualRating; - mode->transparentPixel = config->transparentPixel; - mode->transparentRed = config->transparentRed; - mode->transparentGreen = config->transparentGreen; - mode->transparentBlue = config->transparentBlue; - mode->transparentAlpha = config->transparentAlpha; - mode->transparentIndex = config->transparentIndex; - mode->samples = config->multiSampleSize; - mode->sampleBuffers = config->nMultiSampleBuffers; - /* mode->visualSelectGroup = config->visualSelectGroup; ? */ - - mode->swapMethod = GLX_SWAP_UNDEFINED_OML; - - mode->bindToTextureRgb = (mode->rgbMode) ? GL_TRUE : GL_FALSE; - mode->bindToTextureRgba = (mode->rgbMode && mode->alphaBits) ? - GL_TRUE : GL_FALSE; - mode->bindToMipmapTexture = mode->rgbMode ? GL_TRUE : GL_FALSE; - mode->bindToTextureTargets = mode->rgbMode ? - GLX_TEXTURE_1D_BIT_EXT | - GLX_TEXTURE_2D_BIT_EXT | - GLX_TEXTURE_RECTANGLE_BIT_EXT : 0; - mode->yInverted = GL_FALSE; -} - -/** - * Get data from a GL context mode. - * - * \param mode GL context mode whose data is to be returned. - * \param attribute Attribute of \c mode that is to be returned. - * \param value_return Location to store the data member of \c mode. - * \return If \c attribute is a valid attribute of \c mode, zero is - * returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned. - */ -int -_gl_get_context_mode_data(const __GLcontextModes *mode, int attribute, - int *value_return) -{ - switch (attribute) { - case GLX_USE_GL: - *value_return = GL_TRUE; - return 0; - - case GLX_BUFFER_SIZE: - *value_return = mode->rgbBits; - return 0; - - case GLX_RGBA: - *value_return = mode->rgbMode; - return 0; - - case GLX_RED_SIZE: - *value_return = mode->redBits; - return 0; - - case GLX_GREEN_SIZE: - *value_return = mode->greenBits; - return 0; - - case GLX_BLUE_SIZE: - *value_return = mode->blueBits; - return 0; - - case GLX_ALPHA_SIZE: - *value_return = mode->alphaBits; - return 0; - - case GLX_DOUBLEBUFFER: - *value_return = mode->doubleBufferMode; - return 0; - - case GLX_STEREO: - *value_return = mode->stereoMode; - return 0; - - case GLX_AUX_BUFFERS: - *value_return = mode->numAuxBuffers; - return 0; - - case GLX_DEPTH_SIZE: - *value_return = mode->depthBits; - return 0; - - case GLX_STENCIL_SIZE: - *value_return = mode->stencilBits; - return 0; - - case GLX_ACCUM_RED_SIZE: - *value_return = mode->accumRedBits; - return 0; - - case GLX_ACCUM_GREEN_SIZE: - *value_return = mode->accumGreenBits; - return 0; - - case GLX_ACCUM_BLUE_SIZE: - *value_return = mode->accumBlueBits; - return 0; - - case GLX_ACCUM_ALPHA_SIZE: - *value_return = mode->accumAlphaBits; - return 0; - - case GLX_LEVEL: - *value_return = mode->level; - return 0; - - case GLX_TRANSPARENT_TYPE_EXT: - *value_return = mode->transparentPixel; - return 0; - - case GLX_TRANSPARENT_RED_VALUE: - *value_return = mode->transparentRed; - return 0; - - case GLX_TRANSPARENT_GREEN_VALUE: - *value_return = mode->transparentGreen; - return 0; - - case GLX_TRANSPARENT_BLUE_VALUE: - *value_return = mode->transparentBlue; - return 0; - - case GLX_TRANSPARENT_ALPHA_VALUE: - *value_return = mode->transparentAlpha; - return 0; - - case GLX_TRANSPARENT_INDEX_VALUE: - *value_return = mode->transparentIndex; - return 0; - - case GLX_X_VISUAL_TYPE: - *value_return = mode->visualType; - return 0; - - case GLX_CONFIG_CAVEAT: - *value_return = mode->visualRating; - return 0; - - case GLX_VISUAL_ID: - *value_return = mode->visualID; - return 0; - - case GLX_DRAWABLE_TYPE: - *value_return = mode->drawableType; - return 0; - - case GLX_RENDER_TYPE: - *value_return = mode->renderType; - return 0; - - case GLX_X_RENDERABLE: - *value_return = mode->xRenderable; - return 0; - - case GLX_FBCONFIG_ID: - *value_return = mode->fbconfigID; - return 0; - - case GLX_MAX_PBUFFER_WIDTH: - *value_return = mode->maxPbufferWidth; - return 0; - - case GLX_MAX_PBUFFER_HEIGHT: - *value_return = mode->maxPbufferHeight; - return 0; - - case GLX_MAX_PBUFFER_PIXELS: - *value_return = mode->maxPbufferPixels; - return 0; - - case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX: - *value_return = mode->optimalPbufferWidth; - return 0; - - case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX: - *value_return = mode->optimalPbufferHeight; - return 0; - - case GLX_SWAP_METHOD_OML: - *value_return = mode->swapMethod; - return 0; - - case GLX_SAMPLE_BUFFERS_SGIS: - *value_return = mode->sampleBuffers; - return 0; - - case GLX_SAMPLES_SGIS: - *value_return = mode->samples; - return 0; - - case GLX_BIND_TO_TEXTURE_RGB_EXT: - *value_return = mode->bindToTextureRgb; - return 0; - - case GLX_BIND_TO_TEXTURE_RGBA_EXT: - *value_return = mode->bindToTextureRgba; - return 0; - - case GLX_BIND_TO_MIPMAP_TEXTURE_EXT: - *value_return = mode->bindToMipmapTexture == GL_TRUE ? GL_TRUE : - GL_FALSE; - return 0; - - case GLX_BIND_TO_TEXTURE_TARGETS_EXT: - *value_return = mode->bindToTextureTargets; - return 0; - - case GLX_Y_INVERTED_EXT: - *value_return = mode->yInverted; - return 0; - - /* Applications are NOT allowed to query GLX_VISUAL_SELECT_GROUP_SGIX. - * It is ONLY for communication between the GLX client and the GLX - * server. - */ - case GLX_VISUAL_SELECT_GROUP_SGIX: - default: - return GLX_BAD_ATTRIBUTE; - } -} -#endif /* !defined(IN_MINI_GLX) */ - -/** - * Allocate a linked list of \c __GLcontextModes structures. The fields of - * each structure will be initialized to "reasonable" default values. In - * most cases this is the default value defined by table 3.4 of the GLX - * 1.3 specification. This means that most values are either initialized to - * zero or \c GLX_DONT_CARE (which is -1). As support for additional - * extensions is added, the new values will be initialized to appropriate - * values from the extension specification. - * - * \param count Number of structures to allocate. - * \param minimum_size Minimum size of a structure to allocate. This allows - * for differences in the version of the - * \c __GLcontextModes structure used in libGL and in a - * DRI-based driver. - * \returns A pointer to the first element in a linked list of \c count - * structures on success, or \c NULL on failure. - * - * \warning Use of \c minimum_size does \b not guarantee binary compatibility. - * The fundamental assumption is that if the \c minimum_size - * specified by the driver and the size of the \c __GLcontextModes - * structure in libGL is the same, then the meaning of each byte in - * the structure is the same in both places. \b Be \b careful! - * Basically this means that fields have to be added in libGL and - * then propagated to drivers. Drivers should \b never arbitrarilly - * extend the \c __GLcontextModes data-structure. - */ -__GLcontextModes * -_gl_context_modes_create(unsigned count, size_t minimum_size) -{ - const size_t size = (minimum_size > sizeof(__GLcontextModes)) - ? minimum_size : sizeof(__GLcontextModes); - __GLcontextModes * base = NULL; - __GLcontextModes ** next; - unsigned i; - - next = &base; - for (i = 0; i < count; i++) { - *next = (__GLcontextModes *)_mesa_malloc(size); - if (*next == NULL) { - _gl_context_modes_destroy(base); - base = NULL; - break; - } - - (void)_mesa_memset(*next, 0, size); - (*next)->visualID = GLX_DONT_CARE; - (*next)->visualType = GLX_DONT_CARE; - (*next)->visualRating = GLX_NONE; - (*next)->transparentPixel = GLX_NONE; - (*next)->transparentRed = GLX_DONT_CARE; - (*next)->transparentGreen = GLX_DONT_CARE; - (*next)->transparentBlue = GLX_DONT_CARE; - (*next)->transparentAlpha = GLX_DONT_CARE; - (*next)->transparentIndex = GLX_DONT_CARE; - (*next)->xRenderable = GLX_DONT_CARE; - (*next)->fbconfigID = GLX_DONT_CARE; - (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML; - (*next)->bindToTextureRgb = GLX_DONT_CARE; - (*next)->bindToTextureRgba = GLX_DONT_CARE; - (*next)->bindToMipmapTexture = GLX_DONT_CARE; - (*next)->bindToTextureTargets = GLX_DONT_CARE; - (*next)->yInverted = GLX_DONT_CARE; - - next = &((*next)->next); - } - - return base; -} - -/** - * Destroy a linked list of \c __GLcontextModes structures created by - * \c _gl_context_modes_create. - * - * \param modes Linked list of structures to be destroyed. All structures - * in the list will be freed. - */ -void -_gl_context_modes_destroy(__GLcontextModes * modes) -{ - while (modes != NULL) { - __GLcontextModes * const next = modes->next; - - _mesa_free(modes); - modes = next; - } -} - -/** - * Find a context mode matching a Visual ID. - * - * \param modes List list of context-mode structures to be searched. - * \param vid Visual ID to be found. - * \returns A pointer to a context-mode in \c modes if \c vid was found in - * the list, or \c NULL if it was not. - */ - -__GLcontextModes * -_gl_context_modes_find_visual(__GLcontextModes *modes, int vid) -{ - __GLcontextModes *m; - - for (m = modes; m != NULL; m = m->next) - if (m->visualID == vid) - return m; - - return NULL; -} - -__GLcontextModes * -_gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid) -{ - __GLcontextModes *m; - - for (m = modes; m != NULL; m = m->next) - if (m->fbconfigID == fbid) - return m; - - return NULL; -} - -/** - * Determine if two context-modes are the same. This is intended to be used - * by libGL implementations to compare to sets of driver generated FBconfigs. - * - * \param a Context-mode to be compared. - * \param b Context-mode to be compared. - * \returns \c GL_TRUE if the two context-modes are the same. \c GL_FALSE is - * returned otherwise. - */ -GLboolean -_gl_context_modes_are_same(const __GLcontextModes * a, - const __GLcontextModes * b) -{ - return ((a->rgbMode == b->rgbMode) && - (a->floatMode == b->floatMode) && - (a->colorIndexMode == b->colorIndexMode) && - (a->doubleBufferMode == b->doubleBufferMode) && - (a->stereoMode == b->stereoMode) && - (a->redBits == b->redBits) && - (a->greenBits == b->greenBits) && - (a->blueBits == b->blueBits) && - (a->alphaBits == b->alphaBits) && -#if 0 /* For some reason these don't get set on the client-side in libGL. */ - (a->redMask == b->redMask) && - (a->greenMask == b->greenMask) && - (a->blueMask == b->blueMask) && - (a->alphaMask == b->alphaMask) && -#endif - (a->rgbBits == b->rgbBits) && - (a->indexBits == b->indexBits) && - (a->accumRedBits == b->accumRedBits) && - (a->accumGreenBits == b->accumGreenBits) && - (a->accumBlueBits == b->accumBlueBits) && - (a->accumAlphaBits == b->accumAlphaBits) && - (a->depthBits == b->depthBits) && - (a->stencilBits == b->stencilBits) && - (a->numAuxBuffers == b->numAuxBuffers) && - (a->level == b->level) && - (a->visualRating == b->visualRating) && - - (a->transparentPixel == b->transparentPixel) && - - ((a->transparentPixel != GLX_TRANSPARENT_RGB) || - ((a->transparentRed == b->transparentRed) && - (a->transparentGreen == b->transparentGreen) && - (a->transparentBlue == b->transparentBlue) && - (a->transparentAlpha == b->transparentAlpha))) && - - ((a->transparentPixel != GLX_TRANSPARENT_INDEX) || - (a->transparentIndex == b->transparentIndex)) && - - (a->sampleBuffers == b->sampleBuffers) && - (a->samples == b->samples) && - ((a->drawableType & b->drawableType) != 0) && - (a->renderType == b->renderType) && - (a->maxPbufferWidth == b->maxPbufferWidth) && - (a->maxPbufferHeight == b->maxPbufferHeight) && - (a->maxPbufferPixels == b->maxPbufferPixels) && - (a->optimalPbufferWidth == b->optimalPbufferWidth) && - (a->optimalPbufferHeight == b->optimalPbufferHeight) && - (a->swapMethod == b->swapMethod) && - (a->bindToTextureRgb == b->bindToTextureRgb) && - (a->bindToTextureRgba == b->bindToTextureRgba) && - (a->bindToMipmapTexture == b->bindToMipmapTexture) && - (a->bindToTextureTargets == b->bindToTextureTargets) && - (a->yInverted == b->yInverted)); -} diff --git a/hw/xquartz/GL/glcontextmodes.h b/hw/xquartz/GL/glcontextmodes.h deleted file mode 100644 index 5b64add29..000000000 --- a/hw/xquartz/GL/glcontextmodes.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2003 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file glcontextmodes.h - * \author Ian Romanick - */ - -#ifndef GLCONTEXTMODES_H -#define GLCONTEXTMODES_H - -#if !defined(IN_MINI_GLX) -extern GLint -_gl_convert_from_x_visual_type(int visualType); -extern GLint -_gl_convert_to_x_visual_type(int visualType); -extern void -_gl_copy_visual_to_context_mode(__GLcontextModes * mode, - const __GLXvisualConfig * config); -extern int -_gl_get_context_mode_data(const __GLcontextModes *mode, int attribute, - int *value_return); -#endif /* !defined(IN_MINI_GLX) */ - -extern __GLcontextModes * -_gl_context_modes_create(unsigned count, size_t minimum_size); -extern void -_gl_context_modes_destroy(__GLcontextModes * modes); -extern __GLcontextModes * -_gl_context_modes_find_visual(__GLcontextModes *modes, int vid); -extern __GLcontextModes * -_gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid); -extern GLboolean -_gl_context_modes_are_same(const __GLcontextModes * a, - const __GLcontextModes * b); - -#endif /* GLCONTEXTMODES_H */ diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c deleted file mode 100644 index a8ccfc8ee..000000000 --- a/hw/xquartz/GL/indirect.c +++ /dev/null @@ -1,667 +0,0 @@ -/* - * GLX implementation that uses Apple's OpenGL.framework - * (Indirect rendering path -- it's also used for some direct mode code too) - * - * Copyright (c) 2007-2012 Apple Inc. - * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. - * Copyright (c) 2002 Greg Parker. All Rights Reserved. - * - * Portions of this file are copied from Mesa's xf86glx.c, - * which contains the following copyright: - * - * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include /* Just to prevent glxserver.h from loading mesa's and colliding with OpenGL.h */ - -#include -#include - -#include -#include - -#include "x-hash.h" - -#include "visualConfigs.h" -#include "dri.h" -#include "extension_string.h" - -#include "darwin.h" -#define GLAQUA_DEBUG_MSG(msg, args ...) ASL_LOG(ASL_LEVEL_DEBUG, "GLXAqua", \ - msg, \ - ## args) - -__GLXprovider * -GlxGetDRISWrastProvider(void); - -static void -setup_dispatch_table(void); -GLuint -__glFloorLog2(GLuint val); -void -warn_func(void * p1, char *format, ...); - -// some prototypes -static __GLXscreen * -__glXAquaScreenProbe(ScreenPtr pScreen); -static __GLXdrawable * -__glXAquaScreenCreateDrawable(ClientPtr client, __GLXscreen *screen, - DrawablePtr pDraw, XID drawId, int type, - XID glxDrawId, - __GLXconfig *conf); - -static void -__glXAquaContextDestroy(__GLXcontext *baseContext); -static int -__glXAquaContextMakeCurrent(__GLXcontext *baseContext); -static int -__glXAquaContextLoseCurrent(__GLXcontext *baseContext); -static int -__glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, - unsigned long mask); - -static CGLPixelFormatObj -makeFormat(__GLXconfig *conf); - -__GLXprovider __glXDRISWRastProvider = { - __glXAquaScreenProbe, - "Core OpenGL", - NULL -}; - -typedef struct __GLXAquaScreen __GLXAquaScreen; -typedef struct __GLXAquaContext __GLXAquaContext; -typedef struct __GLXAquaDrawable __GLXAquaDrawable; - -/* - * The following structs must keep the base as the first member. - * It's used to treat the start of the struct as a different struct - * in GLX. - * - * Note: these structs should be initialized with xcalloc or memset - * prior to usage, and some of them require initializing - * the base with function pointers. - */ -struct __GLXAquaScreen { - __GLXscreen base; -}; - -struct __GLXAquaContext { - __GLXcontext base; - CGLContextObj ctx; - CGLPixelFormatObj pixelFormat; - xp_surface_id sid; - unsigned isAttached : 1; -}; - -struct __GLXAquaDrawable { - __GLXdrawable base; - DrawablePtr pDraw; - xp_surface_id sid; - __GLXAquaContext *context; -}; - -static __GLXcontext * -__glXAquaScreenCreateContext(__GLXscreen *screen, - __GLXconfig *conf, - __GLXcontext *baseShareContext, - unsigned num_attribs, - const uint32_t *attribs, - int *error) -{ - __GLXAquaContext *context; - __GLXAquaContext *shareContext = (__GLXAquaContext *)baseShareContext; - CGLError gl_err; - - /* Unused (for now?) */ - (void)num_attribs; - (void)attribs; - (void)error; - - GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n"); - - context = calloc(1, sizeof(__GLXAquaContext)); - - if (context == NULL) - return NULL; - - memset(context, 0, sizeof *context); - - context->base.pGlxScreen = screen; - context->base.config = conf; - context->base.destroy = __glXAquaContextDestroy; - context->base.makeCurrent = __glXAquaContextMakeCurrent; - context->base.loseCurrent = __glXAquaContextLoseCurrent; - context->base.copy = __glXAquaContextCopy; - /*FIXME verify that the context->base is fully initialized. */ - - context->pixelFormat = makeFormat(conf); - - if (!context->pixelFormat) { - free(context); - return NULL; - } - - context->ctx = NULL; - gl_err = CGLCreateContext(context->pixelFormat, - shareContext ? shareContext->ctx : NULL, - &context->ctx); - - if (gl_err != 0) { - ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err)); - CGLDestroyPixelFormat(context->pixelFormat); - free(context); - return NULL; - } - - setup_dispatch_table(); - GLAQUA_DEBUG_MSG("glAquaCreateContext done\n"); - - return &context->base; -} - -/* maps from surface id -> list of __GLcontext */ -static x_hash_table *surface_hash; - -static void -__glXAquaContextDestroy(__GLXcontext *baseContext) -{ - x_list *lst; - - __GLXAquaContext *context = (__GLXAquaContext *)baseContext; - - GLAQUA_DEBUG_MSG("glAquaContextDestroy (ctx %p)\n", baseContext); - if (context != NULL) { - if (context->sid != 0 && surface_hash != NULL) { - lst = - x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr( - context->sid), NULL); - lst = x_list_remove(lst, context); - x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr( - context->sid), lst); - } - - if (context->ctx != NULL) - CGLDestroyContext(context->ctx); - - if (context->pixelFormat != NULL) - CGLDestroyPixelFormat(context->pixelFormat); - - free(context); - } -} - -static int -__glXAquaContextLoseCurrent(__GLXcontext *baseContext) -{ - CGLError gl_err; - - GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%p)\n", baseContext); - - gl_err = CGLSetCurrentContext(NULL); - if (gl_err != 0) - ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); - - /* - * There should be no need to set __glXLastContext to NULL here, because - * glxcmds.c does it as part of the context cache flush after calling - * this. - */ - - return GL_TRUE; -} - -/* Called when a surface is destroyed as a side effect of destroying - the window it's attached to. */ -static void -surface_notify(void *_arg, void *data) -{ - DRISurfaceNotifyArg *arg = (DRISurfaceNotifyArg *)_arg; - __GLXAquaDrawable *draw = (__GLXAquaDrawable *)data; - __GLXAquaContext *context; - x_list *lst; - if (_arg == NULL || data == NULL) { - ErrorF("surface_notify called with bad params"); - return; - } - - GLAQUA_DEBUG_MSG("surface_notify(%p, %p)\n", _arg, data); - switch (arg->kind) { - case AppleDRISurfaceNotifyDestroyed: - if (surface_hash != NULL) - x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(arg->id)); - draw->pDraw = NULL; - draw->sid = 0; - break; - - case AppleDRISurfaceNotifyChanged: - if (surface_hash != NULL) { - lst = - x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr( - arg->id), NULL); - for (; lst != NULL; lst = lst->next) { - context = lst->data; - xp_update_gl_context(context->ctx); - } - } - break; - - default: - ErrorF("surface_notify: unknown kind %d\n", arg->kind); - break; - } -} - -static BOOL -attach(__GLXAquaContext *context, __GLXAquaDrawable *draw) -{ - DrawablePtr pDraw; - - GLAQUA_DEBUG_MSG("attach(%p, %p)\n", context, draw); - - if (NULL == context || NULL == draw) - return TRUE; - - pDraw = draw->base.pDraw; - - if (NULL == pDraw) { - ErrorF("%s:%s() pDraw is NULL!\n", __FILE__, __func__); - return TRUE; - } - - if (draw->sid == 0) { - //if (!quartzProcs->CreateSurface(pDraw->pScreen, pDraw->id, pDraw, - if (!DRICreateSurface(pDraw->pScreen, pDraw->id, pDraw, - 0, &draw->sid, NULL, - surface_notify, draw)) - return TRUE; - draw->pDraw = pDraw; - } - - if (!context->isAttached || context->sid != draw->sid) { - x_list *lst; - - if (xp_attach_gl_context(context->ctx, draw->sid) != Success) { - //quartzProcs->DestroySurface(pDraw->pScreen, pDraw->id, pDraw, - DRIDestroySurface(pDraw->pScreen, pDraw->id, pDraw, - surface_notify, draw); - if (surface_hash != NULL) - x_hash_table_remove(surface_hash, - x_cvt_uint_to_vptr(draw->sid)); - - draw->sid = 0; - return TRUE; - } - - context->isAttached = TRUE; - context->sid = draw->sid; - - if (surface_hash == NULL) - surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL); - - lst = - x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr( - context->sid), NULL); - if (x_list_find(lst, context) == NULL) { - lst = x_list_prepend(lst, context); - x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr( - context->sid), lst); - } - - GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", (unsigned int)pDraw->id, - (unsigned int)draw->sid); - } - - draw->context = context; - - return FALSE; -} - -#if 0 // unused -static void -unattach(__GLXAquaContext *context) -{ - x_list *lst; - GLAQUA_DEBUG_MSG("unattach\n"); - if (context == NULL) { - ErrorF("Tried to unattach a null context\n"); - return; - } - if (context->isAttached) { - GLAQUA_DEBUG_MSG("unattaching\n"); - - if (surface_hash != NULL) { - lst = x_hash_table_lookup(surface_hash, (void *)context->sid, - NULL); - lst = x_list_remove(lst, context); - x_hash_table_insert(surface_hash, (void *)context->sid, lst); - } - - CGLClearDrawable(context->ctx); - context->isAttached = FALSE; - context->sid = 0; - } -} -#endif - -static int -__glXAquaContextMakeCurrent(__GLXcontext *baseContext) -{ - CGLError gl_err; - __GLXAquaContext *context = (__GLXAquaContext *)baseContext; - __GLXAquaDrawable *drawPriv = (__GLXAquaDrawable *)context->base.drawPriv; - - GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%p)\n", baseContext); - - if (context->base.drawPriv != context->base.readPriv) - return 0; - - if (attach(context, drawPriv)) - return /*error*/ 0; - - gl_err = CGLSetCurrentContext(context->ctx); - if (gl_err != 0) - ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); - - return gl_err == 0; -} - -static int -__glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, - unsigned long mask) -{ - CGLError gl_err; - - __GLXAquaContext *dst = (__GLXAquaContext *)baseDst; - __GLXAquaContext *src = (__GLXAquaContext *)baseSrc; - - GLAQUA_DEBUG_MSG("GLXAquaContextCopy\n"); - - gl_err = CGLCopyContext(src->ctx, dst->ctx, mask); - if (gl_err != 0) - ErrorF("CGLCopyContext error: %s\n", CGLErrorString(gl_err)); - - return gl_err == 0; -} - -/* Drawing surface notification callbacks */ -static GLboolean -__glXAquaDrawableSwapBuffers(ClientPtr client, __GLXdrawable *base) -{ - CGLError err; - __GLXAquaDrawable *drawable; - - // GLAQUA_DEBUG_MSG("glAquaDrawableSwapBuffers(%p)\n",base); - - if (!base) { - ErrorF("%s passed NULL\n", __func__); - return GL_FALSE; - } - - drawable = (__GLXAquaDrawable *)base; - - if (NULL == drawable->context) { - ErrorF("%s called with a NULL->context for drawable %p!\n", - __func__, (void *)drawable); - return GL_FALSE; - } - - err = CGLFlushDrawable(drawable->context->ctx); - - if (kCGLNoError != err) { - ErrorF("CGLFlushDrawable error: %s in %s\n", CGLErrorString(err), - __func__); - return GL_FALSE; - } - - return GL_TRUE; -} - -static CGLPixelFormatObj -makeFormat(__GLXconfig *conf) -{ - CGLPixelFormatAttribute attr[64]; - CGLPixelFormatObj fobj; - GLint formats; - CGLError error; - int i = 0; - - if (conf->doubleBufferMode) - attr[i++] = kCGLPFADoubleBuffer; - - if (conf->stereoMode) - attr[i++] = kCGLPFAStereo; - - attr[i++] = kCGLPFAColorSize; - attr[i++] = conf->redBits + conf->greenBits + conf->blueBits; - attr[i++] = kCGLPFAAlphaSize; - attr[i++] = conf->alphaBits; - - if ((conf->accumRedBits + conf->accumGreenBits + conf->accumBlueBits + - conf->accumAlphaBits) > 0) { - - attr[i++] = kCGLPFAAccumSize; - attr[i++] = conf->accumRedBits + conf->accumGreenBits - + conf->accumBlueBits + conf->accumAlphaBits; - } - - attr[i++] = kCGLPFADepthSize; - attr[i++] = conf->depthBits; - - if (conf->stencilBits) { - attr[i++] = kCGLPFAStencilSize; - attr[i++] = conf->stencilBits; - } - - if (conf->numAuxBuffers > 0) { - attr[i++] = kCGLPFAAuxBuffers; - attr[i++] = conf->numAuxBuffers; - } - - if (conf->sampleBuffers > 0) { - attr[i++] = kCGLPFASampleBuffers; - attr[i++] = conf->sampleBuffers; - attr[i++] = kCGLPFASamples; - attr[i++] = conf->samples; - } - - attr[i] = 0; - - error = CGLChoosePixelFormat(attr, &fobj, &formats); - if (error) { - ErrorF("error: creating pixel format %s\n", CGLErrorString(error)); - return NULL; - } - - return fobj; -} - -static void -__glXAquaScreenDestroy(__GLXscreen *screen) -{ - - GLAQUA_DEBUG_MSG("glXAquaScreenDestroy(%p)\n", screen); - __glXScreenDestroy(screen); - - free(screen); -} - -/* This is called by __glXInitScreens(). */ -static __GLXscreen * -__glXAquaScreenProbe(ScreenPtr pScreen) -{ - __GLXAquaScreen *screen; - - GLAQUA_DEBUG_MSG("glXAquaScreenProbe\n"); - - if (pScreen == NULL) - return NULL; - - screen = calloc(1, sizeof *screen); - - if (NULL == screen) - return NULL; - - screen->base.destroy = __glXAquaScreenDestroy; - screen->base.createContext = __glXAquaScreenCreateContext; - screen->base.createDrawable = __glXAquaScreenCreateDrawable; - screen->base.swapInterval = /*FIXME*/ NULL; - screen->base.pScreen = pScreen; - - screen->base.fbconfigs = __glXAquaCreateVisualConfigs( - &screen->base.numFBConfigs, pScreen->myNum); - - __glXInitExtensionEnableBits(screen->base.glx_enable_bits); - __glXScreenInit(&screen->base, pScreen); - - return &screen->base; -} - -#if 0 // unused -static void -__glXAquaDrawableCopySubBuffer(__GLXdrawable *drawable, - int x, int y, int w, int h) -{ - /*TODO finish me*/ -} -#endif - -static void -__glXAquaDrawableDestroy(__GLXdrawable *base) -{ - /* gstaplin: base is the head of the structure, so it's at the same - * offset in memory. - * Is this safe with strict aliasing? I noticed that the other dri code - * does this too... - */ - __GLXAquaDrawable *glxPriv = (__GLXAquaDrawable *)base; - - GLAQUA_DEBUG_MSG("TRACE"); - - /* It doesn't work to call DRIDestroySurface here, the drawable's - already gone.. But dri.c notices the window destruction and - frees the surface itself. */ - - /*gstaplin: verify the statement above. The surface destroy - *messages weren't making it through, and may still not be. - *We need a good test case for surface creation and destruction. - *We also need a good way to enable introspection on the server - *to validate the test, beyond using gdb with print. - */ - - free(glxPriv); -} - -static __GLXdrawable * -__glXAquaScreenCreateDrawable(ClientPtr client, - __GLXscreen *screen, - DrawablePtr pDraw, - XID drawId, - int type, - XID glxDrawId, - __GLXconfig *conf) -{ - __GLXAquaDrawable *glxPriv; - - glxPriv = malloc(sizeof *glxPriv); - - if (glxPriv == NULL) - return NULL; - - memset(glxPriv, 0, sizeof *glxPriv); - - if (!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, glxDrawId, - conf)) { - free(glxPriv); - return NULL; - } - - glxPriv->base.destroy = __glXAquaDrawableDestroy; - glxPriv->base.swapBuffers = __glXAquaDrawableSwapBuffers; - glxPriv->base.copySubBuffer = NULL; /* __glXAquaDrawableCopySubBuffer; */ - - glxPriv->pDraw = pDraw; - glxPriv->sid = 0; - glxPriv->context = NULL; - - return &glxPriv->base; -} - -// Extra goodies for glx - -GLuint -__glFloorLog2(GLuint val) -{ - int c = 0; - - while (val > 1) { - c++; - val >>= 1; - } - return c; -} - -#ifndef OPENGL_FRAMEWORK_PATH -#define OPENGL_FRAMEWORK_PATH \ - "/System/Library/Frameworks/OpenGL.framework/OpenGL" -#endif - -static void *opengl_framework_handle; - -static glx_func_ptr -get_proc_address(const char *sym) -{ - return (glx_func_ptr) dlsym(opengl_framework_handle, sym); -} - -static void -setup_dispatch_table(void) -{ - const char *opengl_framework_path; - - if (opengl_framework_handle) { - return; - } - - opengl_framework_path = getenv("OPENGL_FRAMEWORK_PATH"); - if (!opengl_framework_path) { - opengl_framework_path = OPENGL_FRAMEWORK_PATH; - } - - (void)dlerror(); /*drain dlerror */ - opengl_framework_handle = dlopen(opengl_framework_path, RTLD_LOCAL); - - if (!opengl_framework_handle) { - ErrorF("unable to dlopen %s : %s, using RTLD_DEFAULT\n", - opengl_framework_path, dlerror()); - opengl_framework_handle = RTLD_DEFAULT; - } - - __glXsetGetProcAddress(get_proc_address); -} diff --git a/hw/xquartz/GL/meson.build b/hw/xquartz/GL/meson.build deleted file mode 100644 index 556417525..000000000 --- a/hw/xquartz/GL/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -libcglcore = static_library('CGLCore', - ['indirect.c', 'capabilities.c', 'visualConfigs.c'], - include_directories: [inc, glx_inc, '..', '../xpr'], - dependencies: [xproto_dep, pixman_dep], -) diff --git a/hw/xquartz/GL/visualConfigs.c b/hw/xquartz/GL/visualConfigs.c deleted file mode 100644 index d810e2dfe..000000000 --- a/hw/xquartz/GL/visualConfigs.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (c) 2007, 2008 Apple Inc. - * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. - * Copyright (c) 2002 Greg Parker. All Rights Reserved. - * - * Portions of this file are copied from Mesa's xf86glx.c, - * which contains the following copyright: - * - * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "dri.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "capabilities.h" -#include "visualConfigs.h" -#include "darwinfb.h" - -/* Based originally on code from indirect.c which was based on code from i830_dri.c. */ -__GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) { - int numConfigs = 0; - __GLXconfig *visualConfigs, *c, *l; - struct glCapabilities caps; - struct glCapabilitiesConfig *conf; - int stereo, depth, aux, buffers, stencil, accum, color, msample; - - if(getGlCapabilities(&caps)) { - ErrorF("error from getGlCapabilities()!\n"); - return NULL; - } - - /* - conf->stereo is 0 or 1, but we need at least 1 iteration of the loop, - so we treat a true conf->stereo as 2. - - The depth size is 0 or 24. Thus we do 2 iterations for that. - - conf->aux_buffers (when available/non-zero) result in 2 iterations instead of 1. - - conf->buffers indicates whether we have single or double buffering. - - conf->total_stencil_bit_depths - - conf->total_color_buffers indicates the RGB/RGBA color depths. - - conf->total_accum_buffers iterations for accum (with at least 1 if equal to 0) - - conf->total_depth_buffer_depths - - conf->multisample_buffers iterations (with at least 1 if equal to 0). We add 1 - for the 0 multisampling config. - - */ - - assert(NULL != caps.configurations); - - numConfigs = 0; - - for(conf = caps.configurations; conf; conf = conf->next) { - if(conf->total_color_buffers <= 0) - continue; - - numConfigs += (conf->stereo ? 2 : 1) - * (conf->aux_buffers ? 2 : 1) - * conf->buffers - * ((conf->total_stencil_bit_depths > 0) ? conf->total_stencil_bit_depths : 1) - * conf->total_color_buffers - * ((conf->total_accum_buffers > 0) ? conf->total_accum_buffers : 1) - * conf->total_depth_buffer_depths - * (conf->multisample_buffers + 1); - } - - if(numConfigsPtr) - *numConfigsPtr = numConfigs; - - /* Note that as of 1.20.0, we cannot allocate all the configs at once. - * __glXScreenDestroy now walks all the fbconfigs and frees them one at a time. - * See 4b0a3cbab131eb453e2b3fc0337121969258a7be. - */ - visualConfigs = calloc(sizeof(*visualConfigs), 1); - - l = NULL; - c = visualConfigs; /* current buffer */ - for(conf = caps.configurations; conf; conf = conf->next) { - for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) { - for(aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) { - for(buffers = 0; buffers < conf->buffers; ++buffers) { - for(stencil = 0; stencil < ((conf->total_stencil_bit_depths > 0) ? - conf->total_stencil_bit_depths : 1); ++stencil) { - for(color = 0; color < conf->total_color_buffers; ++color) { - for(accum = 0; accum < ((conf->total_accum_buffers > 0) ? - conf->total_accum_buffers : 1); ++accum) { - for(depth = 0; depth < conf->total_depth_buffer_depths; ++depth) { - for(msample = 0; msample < (conf->multisample_buffers + 1); ++msample) { - - // Global - c->visualID = -1; - c->visualType = GLX_TRUE_COLOR; - c->next = calloc(sizeof(*visualConfigs), 1); - assert(c->next); - - c->level = 0; - c->indexBits = 0; - - if(conf->accelerated) { - c->visualRating = GLX_NONE; - } else { - c->visualRating = GLX_SLOW_VISUAL_EXT; - } - - c->transparentPixel = GLX_NONE; - c->transparentRed = GLX_NONE; - c->transparentGreen = GLX_NONE; - c->transparentBlue = GLX_NONE; - c->transparentAlpha = GLX_NONE; - c->transparentIndex = GLX_NONE; - - c->visualSelectGroup = 0; - - c->swapMethod = GLX_SWAP_UNDEFINED_OML; - - // Stereo - c->stereoMode = stereo ? TRUE : FALSE; - - // Aux buffers - c->numAuxBuffers = aux ? conf->aux_buffers : 0; - - // Double Buffered - c->doubleBufferMode = buffers ? TRUE : FALSE; - - // Stencil Buffer - if(conf->total_stencil_bit_depths > 0) { - c->stencilBits = conf->stencil_bit_depths[stencil]; - } else { - c->stencilBits = 0; - } - - // Color - if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->color_buffers[color].a) { - c->alphaBits = conf->color_buffers[color].a; - } else { - c->alphaBits = 0; - } - c->redBits = conf->color_buffers[color].r; - c->greenBits = conf->color_buffers[color].g; - c->blueBits = conf->color_buffers[color].b; - - c->rgbBits = c->alphaBits + c->redBits + c->greenBits + c->blueBits; - - c->alphaMask = AM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits); - c->redMask = RM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits); - c->greenMask = GM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits); - c->blueMask = BM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits); - - // Accumulation Buffers - if(conf->total_accum_buffers > 0) { - c->accumRedBits = conf->accum_buffers[accum].r; - c->accumGreenBits = conf->accum_buffers[accum].g; - c->accumBlueBits = conf->accum_buffers[accum].b; - if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) { - c->accumAlphaBits = conf->accum_buffers[accum].a; - } else { - c->accumAlphaBits = 0; - } - } else { - c->accumRedBits = 0; - c->accumGreenBits = 0; - c->accumBlueBits = 0; - c->accumAlphaBits = 0; - } - - // Depth - c->depthBits = conf->depth_buffers[depth]; - - // MultiSample - if(msample > 0) { - c->samples = conf->multisample_samples; - c->sampleBuffers = conf->multisample_buffers; - } else { - c->samples = 0; - c->sampleBuffers = 0; - } - - /* - * The Apple libGL supports GLXPixmaps and - * GLXPbuffers in direct mode. - */ - /* SGIX_fbconfig / GLX 1.3 */ - c->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT; - c->renderType = GLX_RGBA_BIT; - c->fbconfigID = -1; - - /* SGIX_pbuffer / GLX 1.3 */ - - /* - * The CGL layer provides a way of retrieving - * the maximum pbuffer width/height, but only - * if we create a context and call glGetIntegerv. - * - * The following values are from a test program - * that does so. - */ - c->maxPbufferWidth = 8192; - c->maxPbufferHeight = 8192; - c->maxPbufferPixels = /*Do we need this?*/ 0; - /* - * There is no introspection for this sort of thing - * with CGL. What should we do realistically? - */ - c->optimalPbufferWidth = 0; - c->optimalPbufferHeight = 0; - - /* EXT_texture_from_pixmap */ - c->bindToTextureRgb = 0; - c->bindToTextureRgba = 0; - c->bindToMipmapTexture = 0; - c->bindToTextureTargets = 0; - c->yInverted = 0; - - /* EXT_framebuffer_sRGB */ - c->sRGBCapable = GL_FALSE; - - l = c; - c = c->next; - } - } - } - } - } - } - } - } - } - - free(c); - l->next = NULL; - - freeGlCapabilities(&caps); - return visualConfigs; -} diff --git a/hw/xquartz/GL/visualConfigs.h b/hw/xquartz/GL/visualConfigs.h deleted file mode 100644 index 889cdb904..000000000 --- a/hw/xquartz/GL/visualConfigs.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2008 Apple Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef VISUAL_CONFIGS_H -#define VISUAL_CONFIGS_H - -__GLXconfig * -__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber); - -#endif diff --git a/hw/xquartz/NSUserDefaults+XQuartzDefaults.h b/hw/xquartz/NSUserDefaults+XQuartzDefaults.h deleted file mode 100644 index 2f180b241..000000000 --- a/hw/xquartz/NSUserDefaults+XQuartzDefaults.h +++ /dev/null @@ -1,49 +0,0 @@ -// -// NSUserDefaults+XQuartzDefaults.h -// XQuartz -// -// Created by Jeremy Huddleston Sequoia on 2021.02.19. -// Copyright (c) 2021 Apple Inc. All rights reserved. -// - -#import - -extern NSString * const XQuartzPrefKeyAppsMenu; -extern NSString * const XQuartzPrefKeyFakeButtons; -extern NSString * const XQuartzPrefKeyFakeButton2; -extern NSString * const XQuartzPrefKeyFakeButton3; -extern NSString * const XQuartzPrefKeyKeyEquivs; -extern NSString * const XQuartzPrefKeyFullscreenHotkeys; -extern NSString * const XQuartzPrefKeyFullscreenMenu; -extern NSString * const XQuartzPrefKeySyncKeymap; -extern NSString * const XQuartzPrefKeyDepth; -extern NSString * const XQuartzPrefKeyNoAuth; -extern NSString * const XQuartzPrefKeyNoTCP; -extern NSString * const XQuartzPrefKeyDoneXinitCheck; -extern NSString * const XQuartzPrefKeyNoQuitAlert; -extern NSString * const XQuartzPrefKeyNoRANDRAlert; -extern NSString * const XQuartzPrefKeyOptionSendsAlt; -extern NSString * const XQuartzPrefKeyAppKitModifiers; -extern NSString * const XQuartzPrefKeyWindowItemModifiers; -extern NSString * const XQuartzPrefKeyRootless; -extern NSString * const XQuartzPrefKeyRENDERExtension; -extern NSString * const XQuartzPrefKeyTESTExtension; -extern NSString * const XQuartzPrefKeyLoginShell; -extern NSString * const XQuartzPrefKeyClickThrough; -extern NSString * const XQuartzPrefKeyFocusFollowsMouse; -extern NSString * const XQuartzPrefKeyFocusOnNewWindow; - -extern NSString * const XQuartzPrefKeyScrollInDeviceDirection; -extern NSString * const XQuartzPrefKeySyncPasteboard; -extern NSString * const XQuartzPrefKeySyncPasteboardToClipboard; -extern NSString * const XQuartzPrefKeySyncPasteboardToPrimary; -extern NSString * const XQuartzPrefKeySyncClipboardToPasteBoard; -extern NSString * const XQuartzPrefKeySyncPrimaryOnSelect; - -@interface NSUserDefaults (XQuartzDefaults) - -+ (NSUserDefaults *)globalDefaults; -+ (NSUserDefaults *)dockDefaults; -+ (NSUserDefaults *)xquartzDefaults; - -@end diff --git a/hw/xquartz/NSUserDefaults+XQuartzDefaults.m b/hw/xquartz/NSUserDefaults+XQuartzDefaults.m deleted file mode 100644 index ecc192197..000000000 --- a/hw/xquartz/NSUserDefaults+XQuartzDefaults.m +++ /dev/null @@ -1,148 +0,0 @@ -// -// NSUserDefaults+XQuartzDefaults.m -// XQuartz -// -// Created by Jeremy Huddleston Sequoia on 2021.02.19. -// Copyright (c) 2021 Apple Inc. All rights reserved. -// - -#import "NSUserDefaults+XQuartzDefaults.h" -#import - -NSString * const XQuartzPrefKeyAppsMenu = @"apps_menu"; -NSString * const XQuartzPrefKeyFakeButtons = @"enable_fake_buttons"; -NSString * const XQuartzPrefKeyFakeButton2 = @"fake_button2"; -NSString * const XQuartzPrefKeyFakeButton3 = @"fake_button3"; -NSString * const XQuartzPrefKeyKeyEquivs = @"enable_key_equivalents"; -NSString * const XQuartzPrefKeyFullscreenHotkeys = @"fullscreen_hotkeys"; -NSString * const XQuartzPrefKeyFullscreenMenu = @"fullscreen_menu"; -NSString * const XQuartzPrefKeySyncKeymap = @"sync_keymap"; -NSString * const XQuartzPrefKeyDepth = @"depth"; -NSString * const XQuartzPrefKeyNoAuth = @"no_auth"; -NSString * const XQuartzPrefKeyNoTCP = @"nolisten_tcp"; -NSString * const XQuartzPrefKeyDoneXinitCheck = @"done_xinit_check"; -NSString * const XQuartzPrefKeyNoQuitAlert = @"no_quit_alert"; -NSString * const XQuartzPrefKeyNoRANDRAlert = @"no_randr_alert"; -NSString * const XQuartzPrefKeyOptionSendsAlt = @"option_sends_alt"; -NSString * const XQuartzPrefKeyAppKitModifiers = @"appkit_modifiers"; -NSString * const XQuartzPrefKeyWindowItemModifiers = @"window_item_modifiers"; -NSString * const XQuartzPrefKeyRootless = @"rootless"; -NSString * const XQuartzPrefKeyRENDERExtension = @"enable_render_extension"; -NSString * const XQuartzPrefKeyTESTExtension = @"enable_test_extensions"; -NSString * const XQuartzPrefKeyLoginShell = @"login_shell"; -NSString * const XQuartzPrefKeyUpdateFeed = @"update_feed"; -NSString * const XQuartzPrefKeyClickThrough = @"wm_click_through"; -NSString * const XQuartzPrefKeyFocusFollowsMouse = @"wm_ffm"; -NSString * const XQuartzPrefKeyFocusOnNewWindow = @"wm_focus_on_new_window"; - -NSString * const XQuartzPrefKeyScrollInDeviceDirection = @"scroll_in_device_direction"; -NSString * const XQuartzPrefKeySyncPasteboard = @"sync_pasteboard"; -NSString * const XQuartzPrefKeySyncPasteboardToClipboard = @"sync_pasteboard_to_clipboard"; -NSString * const XQuartzPrefKeySyncPasteboardToPrimary = @"sync_pasteboard_to_primary"; -NSString * const XQuartzPrefKeySyncClipboardToPasteBoard = @"sync_clipboard_to_pasteboard"; -NSString * const XQuartzPrefKeySyncPrimaryOnSelect = @"sync_primary_on_select"; - -@implementation NSUserDefaults (XQuartzDefaults) - -+ (NSUserDefaults *)globalDefaults -{ - static dispatch_once_t once; - static NSUserDefaults *defaults; - - dispatch_once(&once, ^{ - NSString * const defaultsDomain = @".GlobalPreferences"; - defaults = [[[NSUserDefaults alloc] initWithSuiteName:defaultsDomain] retain]; - - NSDictionary * const defaultDefaultsDict = @{ - @"AppleSpacesSwitchOnActivate" : @(YES), - }; - - [defaults registerDefaults:defaultDefaultsDict]; - }); - - return defaults; -} - -+ (NSUserDefaults *)dockDefaults -{ - static dispatch_once_t once; - static NSUserDefaults *defaults; - - dispatch_once(&once, ^{ - NSString * const defaultsDomain = @"com.apple.dock"; - defaults = [[[NSUserDefaults alloc] initWithSuiteName:defaultsDomain] retain]; - - NSDictionary * const defaultDefaultsDict = @{ - @"workspaces" : @(NO), - }; - - [defaults registerDefaults:defaultDefaultsDict]; - }); - - return defaults; -} - -+ (NSUserDefaults *)xquartzDefaults -{ - static dispatch_once_t once; - static NSUserDefaults *defaults; - - dispatch_once(&once, ^{ - NSString * const defaultsDomain = @(BUNDLE_ID_PREFIX ".X11"); - NSString * const defaultDefaultsDomain = NSBundle.mainBundle.bundleIdentifier; - if ([defaultsDomain isEqualToString:defaultDefaultsDomain]) { - defaults = [NSUserDefaults.standardUserDefaults retain]; - } else { - defaults = [[[NSUserDefaults alloc] initWithSuiteName:defaultsDomain] retain]; - } - - NSString *defaultWindowItemModifiers = @"command"; - NSString * const defaultWindowItemModifiersLocalized = NSLocalizedString(@"window item modifiers", @"window item modifiers"); - if (![defaultWindowItemModifiersLocalized isEqualToString:@"window item modifiers"]) { - defaultWindowItemModifiers = defaultWindowItemModifiersLocalized; - } - - NSDictionary * const defaultDefaultsDict = @{ - XQuartzPrefKeyFakeButtons : @(NO), - // XQuartzPrefKeyFakeButton2 nil default - // XQuartzPrefKeyFakeButton3 nil default - XQuartzPrefKeyKeyEquivs : @(YES), - XQuartzPrefKeyFullscreenHotkeys : @(NO), - XQuartzPrefKeyFullscreenMenu : @(NO), - XQuartzPrefKeySyncKeymap : @(NO), - XQuartzPrefKeyDepth : @(-1), - XQuartzPrefKeyNoAuth : @(NO), - XQuartzPrefKeyNoTCP : @(NO), - XQuartzPrefKeyDoneXinitCheck : @(NO), - XQuartzPrefKeyNoQuitAlert : @(NO), - XQuartzPrefKeyNoRANDRAlert : @(NO), - XQuartzPrefKeyOptionSendsAlt : @(NO), - // XQuartzPrefKeyAppKitModifiers nil default - XQuartzPrefKeyWindowItemModifiers : defaultWindowItemModifiers, - XQuartzPrefKeyRootless : @(YES), - XQuartzPrefKeyRENDERExtension : @(YES), - XQuartzPrefKeyTESTExtension : @(NO), - XQuartzPrefKeyLoginShell : @"/bin/sh", - XQuartzPrefKeyClickThrough : @(NO), - XQuartzPrefKeyFocusFollowsMouse : @(NO), - XQuartzPrefKeyFocusOnNewWindow : @(YES), - - XQuartzPrefKeyScrollInDeviceDirection : @(NO), - XQuartzPrefKeySyncPasteboard : @(YES), - XQuartzPrefKeySyncPasteboardToClipboard : @(YES), - XQuartzPrefKeySyncPasteboardToPrimary : @(YES), - XQuartzPrefKeySyncClipboardToPasteBoard : @(YES), - XQuartzPrefKeySyncPrimaryOnSelect : @(NO), - }; - - [defaults registerDefaults:defaultDefaultsDict]; - - NSString * const systemDefaultsPlistPath = [@(XQUARTZ_DATA_DIR) stringByAppendingPathComponent:@"defaults.plist"]; - NSDictionary * const systemDefaultsDict = [NSDictionary dictionaryWithContentsOfFile:systemDefaultsPlistPath]; - [defaults registerDefaults:systemDefaultsDict]; - }); - - return defaults; -} - -@end diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h deleted file mode 100644 index 1ef98bee3..000000000 --- a/hw/xquartz/X11Application.h +++ /dev/null @@ -1,75 +0,0 @@ -/* X11Application.h -- subclass of NSApplication to multiplex events - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifndef X11APPLICATION_H -#define X11APPLICATION_H 1 - -#include - -#if __OBJC__ - -#import "X11Controller.h" - -@interface X11Application : NSApplication - -@property (nonatomic, readwrite, strong) X11Controller *controller; -@property (nonatomic, readonly, assign) OSX_BOOL x_active; - -@end - -extern X11Application * X11App; - -#endif /* __OBJC__ */ - -void -X11ApplicationSetWindowMenu(int nitems, const char **items, - const char *shortcuts); -void -X11ApplicationSetWindowMenuCheck(int idx); -void -X11ApplicationSetFrontProcess(void); -void -X11ApplicationSetCanQuit(int state); -void -X11ApplicationServerReady(void); -void -X11ApplicationShowHideMenubar(int state); -void -X11ApplicationLaunchClient(const char *cmd); - -Bool -X11ApplicationCanEnterRandR(void); - -void -X11ApplicationMain(int argc, char **argv, char **envp); - -extern Bool XQuartzScrollInDeviceDirection; - -#endif /* X11APPLICATION_H */ diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m deleted file mode 100644 index dd96e89f7..000000000 --- a/hw/xquartz/X11Application.m +++ /dev/null @@ -1,1363 +0,0 @@ -/* X11Application.m -- subclass of NSApplication to multiplex events - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#include "sanitizedCarbon.h" - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#import "X11Application.h" -#import "NSUserDefaults+XQuartzDefaults.h" - -#include "darwin.h" -#include "quartz.h" -#include "darwinEvents.h" -#include "quartzKeyboard.h" -#include -#include "micmap.h" -#include "exglobals.h" - -#include -#include - -#include - -#include - -// pbproxy/pbproxy.h -extern int -xpbproxy_run(void); - -#ifndef XSERVER_VERSION -#define XSERVER_VERSION "?" -#endif - -#include - -static dispatch_queue_t eventTranslationQueue; - -#ifndef __has_feature -#define __has_feature(x) 0 -#endif - -#ifndef CF_RETURNS_RETAINED -#if __has_feature(attribute_cf_returns_retained) -#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) -#else -#define CF_RETURNS_RETAINED -#endif -#endif - -#ifndef APPKIT_APPFLAGS_HACK -#define APPKIT_APPFLAGS_HACK 1 -#endif - -extern Bool noTestExtensions; -extern Bool noRenderExtension; - -static TISInputSourceRef last_key_layout; - -/* This preference is only tested on Lion or later as it's not relevant to - * earlier OS versions. - */ -Bool XQuartzScrollInDeviceDirection = FALSE; - -extern int darwinFakeButtons; - -/* Store the mouse location while in the background, and update X11's pointer - * location when we become the foreground application - */ -static NSPoint bgMouseLocation; -static BOOL bgMouseLocationUpdated = FALSE; - -X11Application *X11App; - -#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | \ - NSAlternateKeyMask | NSCommandKeyMask) - -#if APPKIT_APPFLAGS_HACK && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101500 -// This was removed from the SDK in 10.15 -@interface NSApplication () { -@protected - /* All instance variables are private */ - short _running; - struct __appFlags { - unsigned int _hidden:1; - unsigned int _appleEventActivationInProgress:1; - unsigned int _active:1; - unsigned int _hasBeenRun:1; - unsigned int _doingUnhide:1; - unsigned int _delegateReturnsValidRequestor:1; - unsigned int _deactPending:1; - unsigned int _invalidState:1; - unsigned int _invalidEvent:1; - unsigned int _postedWindowsNeedUpdateNote:1; - unsigned int _wantsToActivate:1; - unsigned int _doingHide:1; - unsigned int _dontSendShouldTerminate:1; - unsigned int _ignoresFullScreen:1; - unsigned int _finishedLaunching:1; - unsigned int _hasEventDelegate:1; - unsigned int _appTerminating:1; - unsigned int _didNSOpenOrPrint:1; - unsigned int _inDealloc:1; - unsigned int _pendingDidFinish:1; - unsigned int _hasKeyFocus:1; - unsigned int _panelsNonactivating:1; - unsigned int _hiddenOnLaunch:1; - unsigned int _openStatus:2; - unsigned int _batchOrdering:1; - unsigned int _waitingForTerminationReply:1; - unsigned int _unused:1; - unsigned int _enumeratingMemoryPressureHandlers:1; - unsigned int _didTryRestoringPersistentState:1; - unsigned int _windowDragging:1; - unsigned int _mightBeSwitching:1; - } _appFlags; - id _mainMenu; -} -@end -#endif - -@interface NSApplication (Internal) -- (void)_setKeyWindow:(id)window; -- (void)_setMainWindow:(id)window; -@end - -@interface X11Application (Private) -- (void) sendX11NSEvent:(NSEvent *)e; -@end - -@interface X11Application () -@property (nonatomic, readwrite, assign) OSX_BOOL x_active; -@end - -@implementation X11Application - -typedef struct message_struct message; -struct message_struct { - mach_msg_header_t hdr; - SEL selector; - NSObject *arg; -}; - -/* Quartz mode initialization routine. This is often dynamically loaded - but is statically linked into this X server. */ -Bool -QuartzModeBundleInit(void); - -- (void) dealloc -{ - self.controller = nil; - [super dealloc]; -} - -- (void) orderFrontStandardAboutPanel: (id) sender -{ - NSMutableDictionary *dict; - NSDictionary *infoDict; - NSString *tem; - - dict = [NSMutableDictionary dictionaryWithCapacity:3]; - infoDict = [[NSBundle mainBundle] infoDictionary]; - - [dict setObject: NSLocalizedString(@"The X Window System", @"About panel") - forKey:@"ApplicationName"]; - - tem = [infoDict objectForKey:@"CFBundleShortVersionString"]; - - [dict setObject:[NSString stringWithFormat:@"XQuartz %@", tem] - forKey:@"ApplicationVersion"]; - - [dict setObject:[NSString stringWithFormat:@"xorg-server %s", - XSERVER_VERSION] - forKey:@"Version"]; - - [self orderFrontStandardAboutPanelWithOptions: dict]; -} - -- (void) activateX:(OSX_BOOL)state -{ - OSX_BOOL const x_active = self.x_active; - - if (x_active == state) - return; - - DEBUG_LOG("state=%d, x_active=%d, \n", state, x_active); - if (state) { - if (bgMouseLocationUpdated) { - DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, - bgMouseLocation.x, bgMouseLocation.y, - 0.0, 0.0); - bgMouseLocationUpdated = FALSE; - } - DarwinSendDDXEvent(kXquartzActivate, 0); - } - else { - - if (darwin_all_modifier_flags) - DarwinUpdateModKeys(0); - - DarwinInputReleaseButtonsAndKeys(darwinKeyboard); - DarwinInputReleaseButtonsAndKeys(darwinPointer); - DarwinInputReleaseButtonsAndKeys(darwinTabletCursor); - DarwinInputReleaseButtonsAndKeys(darwinTabletStylus); - DarwinInputReleaseButtonsAndKeys(darwinTabletEraser); - - DarwinSendDDXEvent(kXquartzDeactivate, 0); - } - - self.x_active = state; -} - -- (void) became_key:(NSWindow *)win -{ - [self activateX:NO]; -} - -- (void) sendEvent:(NSEvent *)e -{ - /* Don't try sending to X if we haven't initialized. This can happen if AppKit takes over - * (eg: uncaught exception) early in launch. - */ - if (!eventTranslationQueue) { - [super sendEvent:e]; - return; - } - - OSX_BOOL for_appkit, for_x; - OSX_BOOL const x_active = self.x_active; - - /* By default pass down the responder chain and to X. */ - for_appkit = YES; - for_x = YES; - - switch ([e type]) { - case NSLeftMouseDown: - case NSRightMouseDown: - case NSOtherMouseDown: - case NSLeftMouseUp: - case NSRightMouseUp: - case NSOtherMouseUp: - case NSScrollWheel: - - if ([e window] != nil) { - /* Pointer event has an (AppKit) window. Probably something for the kit. */ - for_x = NO; - if (x_active) [self activateX:NO]; - } - else if ([self modalWindow] == nil) { - /* Must be an X window. Tell appkit windows to resign main/key */ - for_appkit = NO; - - if (!x_active && quartzProcs->IsX11Window([e windowNumber])) { - if ([self respondsToSelector:@selector(_setKeyWindow:)] && [self respondsToSelector:@selector(_setMainWindow:)]) { - NSWindow *keyWindow = [self keyWindow]; - if (keyWindow) { - [self _setKeyWindow:nil]; - [keyWindow resignKeyWindow]; - } - - NSWindow *mainWindow = [self mainWindow]; - if (mainWindow) { - [self _setMainWindow:nil]; - [mainWindow resignMainWindow]; - } - } else { - /* This has a side effect of causing background apps to steal focus from XQuartz. - * Unfortunately, there is no public and stable API to do what we want, but this - * is a decent fallback in the off chance that the above selectors get dropped - * in the future. - */ - [self deactivate]; - } - - [self activateX:YES]; - } - } - - /* We want to force sending to appkit if we're over the menu bar */ - 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; - } - - NSframe = [[NSScreen mainScreen] frame]; - NSvisibleFrame = [[NSScreen mainScreen] visibleFrame]; - - CGframe = CGRectMake(NSframe.origin.x, NSframe.origin.y, - NSframe.size.width, NSframe.size.height); - CGvisibleFrame = CGRectMake(NSvisibleFrame.origin.x, - NSvisibleFrame.origin.y, - NSvisibleFrame.size.width, - NSvisibleFrame.size.height); - CGlocation = CGPointMake(NSlocation.x, NSlocation.y); - - if (CGRectContainsPoint(CGframe, CGlocation) && - !CGRectContainsPoint(CGvisibleFrame, CGlocation)) - for_appkit = YES; - } - - break; - - case NSKeyDown: - case NSKeyUp: - - if (_x_active) { - static BOOL do_swallow = NO; - static int swallow_keycode; - - if ([e type] == NSKeyDown) { - /* Before that though, see if there are any global - * shortcuts bound to it. */ - - if (darwinAppKitModMask &[e modifierFlags]) { - /* Override to force sending to Appkit */ - swallow_keycode = [e keyCode]; - do_swallow = YES; - for_x = NO; - } else if (XQuartzEnableKeyEquivalents && - xp_is_symbolic_hotkey_event([e eventRef])) { - swallow_keycode = [e keyCode]; - do_swallow = YES; - for_x = NO; - } - else if (XQuartzEnableKeyEquivalents && - [[self mainMenu] performKeyEquivalent:e]) { - swallow_keycode = [e keyCode]; - do_swallow = YES; - for_appkit = NO; - for_x = NO; - } - else if (!XQuartzIsRootless - && ([e modifierFlags] & ALL_KEY_MASKS) == - (NSCommandKeyMask | NSAlternateKeyMask) - && ([e keyCode] == 0 /*a*/ || [e keyCode] == - 53 /*Esc*/)) { - /* We have this here to force processing fullscreen - * toggle even if XQuartzEnableKeyEquivalents is disabled */ - swallow_keycode = [e keyCode]; - do_swallow = YES; - for_x = NO; - for_appkit = NO; - DarwinSendDDXEvent(kXquartzToggleFullscreen, 0); - } - else { - /* No kit window is focused, so send it to X. */ - for_appkit = NO; - - /* Reset our swallow state if we're seeing the same keyCode again. - * This can happen if we become !_x_active when the keyCode we - * intended to swallow is delivered. See: - * https://bugs.freedesktop.org/show_bug.cgi?id=92648 - */ - if ([e keyCode] == swallow_keycode) { - do_swallow = NO; - } - } - } - else { /* KeyUp */ - /* If we saw a key equivalent on the down, don't pass - * the up through to X. */ - if (do_swallow && [e keyCode] == swallow_keycode) { - do_swallow = NO; - for_x = NO; - } - } - } - else { /* !_x_active */ - for_x = NO; - } - break; - - case NSFlagsChanged: - /* Don't tell X11 about modifiers changing while it's not active */ - if (!_x_active) - for_x = NO; - break; - - case NSAppKitDefined: - switch ([e subtype]) { - static BOOL x_was_active = NO; - - case NSApplicationActivatedEventType: - for_x = NO; - if ([e window] == nil && x_was_active) { - BOOL order_all_windows = YES; - for_appkit = NO; - -#if APPKIT_APPFLAGS_HACK - /* FIXME: This is a hack to avoid passing the event to AppKit which - * would result in it raising one of its windows. - */ - _appFlags._active = YES; -#endif - - [self set_front_process:nil]; - - /* Get the Spaces preference for SwitchOnActivate */ - BOOL const workspaces = [NSUserDefaults.dockDefaults boolForKey:@"workspaces"]; - if (workspaces) { - order_all_windows = [NSUserDefaults.globalDefaults boolForKey:@"AppleSpacesSwitchOnActivate"]; - } - - /* TODO: In the workspaces && !AppleSpacesSwitchOnActivate case, the windows are ordered - * correctly, but we need to activate the top window on this space if there is - * none active. - * - * If there are no active windows, and there are minimized windows, we should - * be restoring one of them. - */ - if ([e data2] & 0x10) { // 0x10 (bfCPSOrderAllWindowsForward) is set when we use cmd-tab or the dock icon - DarwinSendDDXEvent(kXquartzBringAllToFront, 1, order_all_windows); - } - } - break; - - case 18: /* ApplicationDidReactivate */ - if (XQuartzFullscreenVisible) for_appkit = NO; - break; - - case NSApplicationDeactivatedEventType: - for_x = NO; - - x_was_active = _x_active; - if (_x_active) - [self activateX:NO]; - break; - } - break; - - default: - break; /* for gcc */ - } - - if (for_appkit) { - [super sendEvent:e]; - } - - if (for_x) { - dispatch_async(eventTranslationQueue, ^{ - [self sendX11NSEvent:e]; - }); - } -} - -- (void) set_apps_menu:(NSArray *)list -{ - [self.controller set_apps_menu:list]; -} - -- (void) set_front_process:unused -{ - [NSApp activateIgnoringOtherApps:YES]; - - if ([self modalWindow] == nil) - [self activateX:YES]; -} - -- (void) show_hide_menubar:(NSNumber *)state -{ - /* Also shows/hides the dock */ - if ([state boolValue]) - SetSystemUIMode(kUIModeNormal, 0); - else - SetSystemUIMode(kUIModeAllHidden, - XQuartzFullscreenMenu ? kUIOptionAutoShowMenuBar : 0); // kUIModeAllSuppressed or kUIOptionAutoShowMenuBar can be used to allow "mouse-activation" -} - -- (void) launch_client:(NSString *)cmd -{ - (void)[self.controller application:self openFile:cmd]; -} - - -- (void) read_defaults -{ - NSUserDefaults * const defaults = NSUserDefaults.xquartzDefaults; - - XQuartzRootlessDefault = [defaults boolForKey:XQuartzPrefKeyRootless]; - XQuartzFullscreenMenu = [defaults boolForKey:XQuartzPrefKeyFullscreenMenu]; - XQuartzFullscreenDisableHotkeys = ![defaults boolForKey:XQuartzPrefKeyFullscreenHotkeys]; - - darwinFakeButtons = [defaults boolForKey:XQuartzPrefKeyFakeButtons]; - XQuartzOptionSendsAlt = [defaults boolForKey:XQuartzPrefKeyOptionSendsAlt]; - - if (darwinFakeButtons) { - NSString * const fake2 = [defaults stringForKey:XQuartzPrefKeyFakeButton2]; - if (fake2) { - darwinFakeMouse2Mask = DarwinParseModifierList(fake2.UTF8String, TRUE); - } - - NSString * const fake3 = [defaults stringForKey:XQuartzPrefKeyFakeButton3]; - if (fake3) { - darwinFakeMouse3Mask = DarwinParseModifierList(fake3.UTF8String, TRUE); - } - } - - NSString * const appKitModifiers = [defaults stringForKey:XQuartzPrefKeyAppKitModifiers]; - if (appKitModifiers) { - darwinAppKitModMask = DarwinParseModifierList(appKitModifiers.UTF8String, TRUE); - } - - NSString * const windowItemModifiers = [defaults stringForKey:XQuartzPrefKeyWindowItemModifiers]; - if (windowItemModifiers) { - windowItemModMask = DarwinParseModifierList(windowItemModifiers.UTF8String, FALSE); - } - - XQuartzEnableKeyEquivalents = [defaults boolForKey:XQuartzPrefKeyKeyEquivs]; - - darwinSyncKeymap = [defaults boolForKey:XQuartzPrefKeySyncKeymap]; - - darwinDesiredDepth = [defaults integerForKey:XQuartzPrefKeyDepth]; - - noTestExtensions = ![defaults boolForKey:XQuartzPrefKeyTESTExtension]; - noRenderExtension = ![defaults boolForKey:XQuartzPrefKeyRENDERExtension]; - - XQuartzScrollInDeviceDirection = [defaults boolForKey:XQuartzPrefKeyScrollInDeviceDirection]; -} - -/* This will end up at the end of the responder chain. */ -- (void) copy:sender -{ - DarwinSendDDXEvent(kXquartzPasteboardNotify, 1, - AppleWMCopyToPasteboard); -} - -@end - -void -X11ApplicationSetWindowMenu(int nitems, const char **items, - const char *shortcuts) -{ - @autoreleasepool { - NSMutableArray *> * const allMenuItems = [NSMutableArray array]; - - for (int i = 0; i < nitems; i++) { - NSMutableArray * const menuItem = [NSMutableArray array]; - [menuItem addObject:@(items[i])]; - - if (shortcuts[i] == 0) { - [menuItem addObject:@""]; - } else { - [menuItem addObject:[NSString stringWithFormat:@"%d", shortcuts[i]]]; - } - - [allMenuItems addObject:menuItem]; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - [X11App.controller set_window_menu:allMenuItems]; - }); - } -} - -void -X11ApplicationSetWindowMenuCheck(int idx) -{ - dispatch_async(dispatch_get_main_queue(), ^{ - [X11App.controller set_window_menu_check:@(idx)]; - }); -} - -void -X11ApplicationSetFrontProcess(void) -{ - dispatch_async(dispatch_get_main_queue(), ^{ - [X11App set_front_process:nil]; - }); -} - -void -X11ApplicationSetCanQuit(int state) -{ - dispatch_async(dispatch_get_main_queue(), ^{ - X11App.controller.can_quit = !!state; - }); -} - -void -X11ApplicationServerReady(void) -{ - dispatch_async(dispatch_get_main_queue(), ^{ - [X11App.controller server_ready]; - }); -} - -void -X11ApplicationShowHideMenubar(int state) -{ - dispatch_async(dispatch_get_main_queue(), ^{ - [X11App show_hide_menubar:@(state)]; - }); -} - -void -X11ApplicationLaunchClient(const char *cmd) -{ - @autoreleasepool { - NSString *string = @(cmd); - dispatch_async(dispatch_get_main_queue(), ^{ - [X11App launch_client:string]; - }); - } -} - -/* This is a special function in that it is run from the *SERVER* thread and - * not the AppKit thread. We want to block entering a screen-capturing RandR - * mode until we notify the user about how to get out if the X11 client crashes. - */ -Bool -X11ApplicationCanEnterRandR(void) -{ - NSString *title, *msg; - NSUserDefaults * const defaults = NSUserDefaults.xquartzDefaults; - - if ([defaults boolForKey:XQuartzPrefKeyNoRANDRAlert] || - XQuartzShieldingWindowLevel != 0) - return TRUE; - - title = NSLocalizedString(@"Enter RandR mode?", - @"Dialog title when switching to RandR"); - msg = NSLocalizedString( - @"An application has requested X11 to change the resolution of your display. X11 will restore the display to its previous state when the requesting application requests to return to the previous state. Alternatively, you can use the ⌥⌘A key sequence to force X11 to return to the previous state.", - @"Dialog when switching to RandR"); - - if (!XQuartzIsRootless) - QuartzShowFullscreen(FALSE); - - NSInteger __block alert_result; - dispatch_sync(dispatch_get_main_queue(), ^{ - alert_result = NSRunAlertPanel(title, @"%@", - NSLocalizedString(@"Allow", @""), - NSLocalizedString(@"Cancel", @""), - NSLocalizedString(@"Always Allow", @""), msg); - }); - - switch (alert_result) { - case NSAlertOtherReturn: - [defaults setBool:YES forKey:XQuartzPrefKeyNoRANDRAlert]; - - case NSAlertDefaultReturn: - return YES; - - default: - return NO; - } -} - -static void -check_xinitrc(void) -{ - char *tem, buf[1024]; - NSString *msg; - NSUserDefaults * const defaults = NSUserDefaults.xquartzDefaults; - - if ([defaults boolForKey:XQuartzPrefKeyDoneXinitCheck]) - return; - - tem = getenv("HOME"); - if (tem == NULL) goto done; - - snprintf(buf, sizeof(buf), "%s/.xinitrc", tem); - if (access(buf, F_OK) != 0) - goto done; - - msg = - NSLocalizedString( - @"You have an existing ~/.xinitrc file.\n\n\ - Windows displayed by X11 applications may not have titlebars, or may look \ - different to windows displayed by native applications.\n\n\ - Would you like to move aside the existing file and use the standard X11 \ - environment the next time you start X11?" , - @"Startup xinitrc dialog"); - - if (NSAlertDefaultReturn == - NSRunAlertPanel(nil, @"%@", NSLocalizedString(@"Yes", @""), - NSLocalizedString(@"No", @""), nil, msg)) { - char buf2[1024]; - int i = -1; - - snprintf(buf2, sizeof(buf2), "%s.old", buf); - - for (i = 1; access(buf2, F_OK) == 0; i++) - snprintf(buf2, sizeof(buf2), "%s.old.%d", buf, i); - - rename(buf, buf2); - } - -done: - [defaults setBool:YES forKey:XQuartzPrefKeyDoneXinitCheck]; -} - -static inline pthread_t -create_thread(void *(*func)(void *), void *arg) -{ - pthread_attr_t attr; - pthread_t tid; - - pthread_attr_init(&attr); - pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_create(&tid, &attr, func, arg); - pthread_attr_destroy(&attr); - - return tid; -} - -static void * -xpbproxy_x_thread(void *args) -{ - xpbproxy_run(); - - ErrorF("xpbproxy thread is terminating unexpectedly.\n"); - return NULL; -} - -void -X11ApplicationMain(int argc, char **argv, char **envp) -{ -#ifdef DEBUG - while (access("/tmp/x11-block", F_OK) == 0) sleep(1); -#endif - - @autoreleasepool { - X11App = (X11Application *)[X11Application sharedApplication]; - [X11App read_defaults]; - - [NSBundle loadNibNamed:@"main" owner:NSApp]; - [NSNotificationCenter.defaultCenter addObserver:NSApp - selector:@selector (became_key:) - name:NSWindowDidBecomeKeyNotification - object:nil]; - - /* - * The xpr Quartz mode is statically linked into this server. - * Initialize all the Quartz functions. - */ - QuartzModeBundleInit(); - - /* Calculate the height of the menubar so we can avoid it. */ - aquaMenuBarHeight = NSApp.mainMenu.menuBarHeight; - if (!aquaMenuBarHeight) { - NSScreen* primaryScreen = NSScreen.screens[0]; - aquaMenuBarHeight = NSHeight(primaryScreen.frame) - NSMaxY(primaryScreen.visibleFrame); - } - - eventTranslationQueue = dispatch_queue_create(BUNDLE_ID_PREFIX ".X11.NSEventsToX11EventsQueue", NULL); - assert(eventTranslationQueue != NULL); - - /* Set the key layout seed before we start the server */ - last_key_layout = TISCopyCurrentKeyboardLayoutInputSource(); - - if (!last_key_layout) { - ErrorF("X11ApplicationMain: Unable to determine TISCopyCurrentKeyboardLayoutInputSource() at startup.\n"); - } - - if (!QuartsResyncKeymap(FALSE)) { - ErrorF("X11ApplicationMain: Could not build a valid keymap.\n"); - } - - /* Tell the server thread that it can proceed */ - QuartzInitServer(argc, argv, envp); - - /* This must be done after QuartzInitServer because it can result in - * an mieqEnqueue() - - */ - check_xinitrc(); - - create_thread(xpbproxy_x_thread, NULL); - -#if XQUARTZ_SPARKLE - [[X11App controller] setup_sparkle]; - [[SUUpdater sharedUpdater] resetUpdateCycle]; - // [[SUUpdater sharedUpdater] checkForUpdates:X11App]; -#endif - } - - [NSApp run]; - /* not reached */ -} - -@implementation X11Application (Private) - -#ifdef NX_DEVICELCMDKEYMASK -/* This is to workaround a bug in the VNC server where we sometimes see the L - * modifier and sometimes see no "side" - */ -static inline int -ensure_flag(int flags, int device_independent, int device_dependents, - int device_dependent_default) -{ - if ((flags & device_independent) && - !(flags & device_dependents)) - flags |= device_dependent_default; - return flags; -} -#endif - -#ifdef DEBUG_UNTRUSTED_POINTER_DELTA -static const char * -untrusted_str(NSEvent *e) -{ - switch ([e type]) { - case NSScrollWheel: - return "NSScrollWheel"; - - case NSTabletPoint: - return "NSTabletPoint"; - - case NSOtherMouseDown: - return "NSOtherMouseDown"; - - case NSOtherMouseUp: - return "NSOtherMouseUp"; - - case NSLeftMouseDown: - return "NSLeftMouseDown"; - - case NSLeftMouseUp: - return "NSLeftMouseUp"; - - default: - switch ([e subtype]) { - case NSTabletPointEventSubtype: - return "NSTabletPointEventSubtype"; - - case NSTabletProximityEventSubtype: - return "NSTabletProximityEventSubtype"; - - default: - return "Other"; - } - } -} -#endif - -extern void -wait_for_mieq_init(void); - -- (void) sendX11NSEvent:(NSEvent *)e -{ - NSPoint location = NSZeroPoint; - int ev_button, ev_type; - static float pressure = 0.0; // static so ProximityOut will have the value from the previous tablet event - static NSPoint tilt; // static so ProximityOut will have the value from the previous tablet event - static DeviceIntPtr darwinTabletCurrent = NULL; - static BOOL needsProximityIn = NO; // Do we do need to handle a pending ProximityIn once we have pressure/tilt? - DeviceIntPtr pDev; - int modifierFlags; - BOOL isMouseOrTabletEvent, isTabletEvent; - - if (!darwinTabletCurrent) { - /* Ensure that the event system is initialized */ - wait_for_mieq_init(); - assert(darwinTabletStylus); - - tilt = NSZeroPoint; - darwinTabletCurrent = darwinTabletStylus; - } - - isMouseOrTabletEvent = [e type] == NSLeftMouseDown || - [e type] == NSOtherMouseDown || - [e type] == NSRightMouseDown || - [e type] == NSLeftMouseUp || - [e type] == NSOtherMouseUp || - [e type] == NSRightMouseUp || - [e type] == NSLeftMouseDragged || - [e type] == NSOtherMouseDragged || - [e type] == NSRightMouseDragged || - [e type] == NSMouseMoved || - [e type] == NSTabletPoint || - [e type] == NSScrollWheel; - - isTabletEvent = ([e type] == NSTabletPoint) || - (isMouseOrTabletEvent && - ([e subtype] == NSTabletPointEventSubtype || - [e subtype] == NSTabletProximityEventSubtype)); - - if (isMouseOrTabletEvent) { - static NSPoint lastpt; - NSWindow *window = [e window]; - NSRect screen = [[[NSScreen screens] objectAtIndex:0] frame]; - BOOL hasUntrustedPointerDelta; - - // NSEvents for tablets are not consistent wrt deltaXY between events, so we cannot rely on that - // Thus tablets will be subject to the warp-pointer bug worked around by the delta, but tablets - // are not normally used in cases where that bug would present itself, so this is a fair tradeoff - // deltaX and deltaY are incorrect for NSMouseMoved, NSTabletPointEventSubtype - // http://xquartz.macosforge.org/trac/ticket/288 - hasUntrustedPointerDelta = isTabletEvent; - - // The deltaXY for middle click events also appear erroneous after fast user switching - // deltaX and deltaY are incorrect for NSOtherMouseDown and NSOtherMouseUp after FUS - // http://xquartz.macosforge.org/trac/ticket/389 - hasUntrustedPointerDelta |= [e type] == NSOtherMouseDown || - [e type] == NSOtherMouseUp; - - // The deltaXY for scroll events correspond to the scroll delta, not the pointer delta - // deltaXY for wheel events are being sent as mouse movement - hasUntrustedPointerDelta |= [e type] == NSScrollWheel; - -#ifdef DEBUG_UNTRUSTED_POINTER_DELTA - hasUntrustedPointerDelta |= [e type] == NSLeftMouseDown || - [e type] == NSLeftMouseUp; -#endif - - if (window != nil) { - NSRect frame = [window frame]; - location = [e locationInWindow]; - location.x += frame.origin.x; - location.y += frame.origin.y; - lastpt = location; - } - else if (hasUntrustedPointerDelta) { -#ifdef DEBUG_UNTRUSTED_POINTER_DELTA - ErrorF("--- Begin Event Debug ---\n"); - ErrorF("Event type: %s\n", untrusted_str(e)); - ErrorF("old lastpt: (%0.2f, %0.2f)\n", lastpt.x, lastpt.y); - ErrorF(" delta: (%0.2f, %0.2f)\n", [e deltaX], -[e deltaY]); - ErrorF(" location: (%0.2f, %0.2f)\n", lastpt.x + [e deltaX], - lastpt.y - [e deltaY]); - ErrorF("workaround: (%0.2f, %0.2f)\n", [e locationInWindow].x, - [e locationInWindow].y); - ErrorF("--- End Event Debug ---\n"); - - location.x = lastpt.x + [e deltaX]; - location.y = lastpt.y - [e deltaY]; - lastpt = [e locationInWindow]; -#else - location = [e locationInWindow]; - lastpt = location; -#endif - } - else { - location.x = lastpt.x + [e deltaX]; - location.y = lastpt.y - [e deltaY]; - lastpt = [e locationInWindow]; - } - - /* Convert coordinate system */ - location.y = (screen.origin.y + screen.size.height) - location.y; - } - - modifierFlags = [e modifierFlags]; - -#ifdef NX_DEVICELCMDKEYMASK - /* This is to workaround a bug in the VNC server where we sometimes see the L - * modifier and sometimes see no "side" - */ - modifierFlags = ensure_flag(modifierFlags, NX_CONTROLMASK, - NX_DEVICELCTLKEYMASK | NX_DEVICERCTLKEYMASK, - NX_DEVICELCTLKEYMASK); - modifierFlags = ensure_flag(modifierFlags, NX_SHIFTMASK, - NX_DEVICELSHIFTKEYMASK | NX_DEVICERSHIFTKEYMASK, - NX_DEVICELSHIFTKEYMASK); - modifierFlags = ensure_flag(modifierFlags, NX_COMMANDMASK, - NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK, - NX_DEVICELCMDKEYMASK); - modifierFlags = ensure_flag(modifierFlags, NX_ALTERNATEMASK, - NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK, - NX_DEVICELALTKEYMASK); -#endif - - modifierFlags &= darwin_all_modifier_mask; - - /* We don't receive modifier key events while out of focus, and 3button - * emulation mucks this up, so we need to check our modifier flag state - * on every event... ugg - */ - - if (darwin_all_modifier_flags != modifierFlags) - DarwinUpdateModKeys(modifierFlags); - - switch ([e type]) { - case NSLeftMouseDown: - ev_button = 1; - ev_type = ButtonPress; - goto handle_mouse; - - case NSOtherMouseDown: - // Get the AppKit button number, and convert it from 0-based to 1-based - ev_button = [e buttonNumber] + 1; - - /* Translate middle mouse button (3 in AppKit) to button 2 in X11, - * and translate additional mouse buttons (4 and higher in AppKit) - * to buttons 8 and higher in X11, to match default behavior of X11 - * on other platforms - */ - ev_button = (ev_button == 3) ? 2 : (ev_button + 4); - - ev_type = ButtonPress; - goto handle_mouse; - - case NSRightMouseDown: - ev_button = 3; - ev_type = ButtonPress; - goto handle_mouse; - - case NSLeftMouseUp: - ev_button = 1; - ev_type = ButtonRelease; - goto handle_mouse; - - case NSOtherMouseUp: - // See above comments for NSOtherMouseDown - ev_button = [e buttonNumber] + 1; - ev_button = (ev_button == 3) ? 2 : (ev_button + 4); - ev_type = ButtonRelease; - goto handle_mouse; - - case NSRightMouseUp: - ev_button = 3; - ev_type = ButtonRelease; - goto handle_mouse; - - case NSLeftMouseDragged: - ev_button = 1; - ev_type = MotionNotify; - goto handle_mouse; - - case NSOtherMouseDragged: - // See above comments for NSOtherMouseDown - ev_button = [e buttonNumber] + 1; - ev_button = (ev_button == 3) ? 2 : (ev_button + 4); - ev_type = MotionNotify; - goto handle_mouse; - - case NSRightMouseDragged: - ev_button = 3; - ev_type = MotionNotify; - goto handle_mouse; - - case NSMouseMoved: - ev_button = 0; - ev_type = MotionNotify; - goto handle_mouse; - - case NSTabletPoint: - ev_button = 0; - ev_type = MotionNotify; - goto handle_mouse; - -handle_mouse: - pDev = darwinPointer; - - /* NSTabletPoint can have no subtype */ - if ([e type] != NSTabletPoint && - [e subtype] == NSTabletProximityEventSubtype) { - switch ([e pointingDeviceType]) { - case NSEraserPointingDevice: - darwinTabletCurrent = darwinTabletEraser; - break; - - case NSPenPointingDevice: - darwinTabletCurrent = darwinTabletStylus; - break; - - case NSCursorPointingDevice: - case NSUnknownPointingDevice: - default: - darwinTabletCurrent = darwinTabletCursor; - break; - } - - if ([e isEnteringProximity]) - needsProximityIn = YES; - else - DarwinSendTabletEvents(darwinTabletCurrent, ProximityOut, 0, - location.x, location.y, pressure, - tilt.x, tilt.y); - return; - } - - if ([e type] == NSTabletPoint || - [e subtype] == NSTabletPointEventSubtype) { - pressure = [e pressure]; - tilt = [e tilt]; - - pDev = darwinTabletCurrent; - - if (needsProximityIn) { - DarwinSendTabletEvents(darwinTabletCurrent, ProximityIn, 0, - location.x, location.y, pressure, - tilt.x, tilt.y); - - needsProximityIn = NO; - } - } - - if (!XQuartzServerVisible && noTestExtensions) { - xp_window_id wid = 0; - xp_error err; - - /* Sigh. Need to check that we're really over one of - * our windows. (We need to receive pointer events while - * not in the foreground, but we don't want to receive them - * when another window is over us or we might show a tooltip) - */ - - err = xp_find_window(location.x, location.y, 0, &wid); - - if (err != XP_Success || (err == XP_Success && wid == 0)) - { - bgMouseLocation = location; - bgMouseLocationUpdated = TRUE; - return; - } - } - - if (bgMouseLocationUpdated) { - if (!(ev_type == MotionNotify && ev_button == 0)) { - DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, - location.x, location.y, - 0.0, 0.0); - } - bgMouseLocationUpdated = FALSE; - } - - if (pDev == darwinPointer) { - DarwinSendPointerEvents(pDev, ev_type, ev_button, - location.x, location.y, - [e deltaX], [e deltaY]); - } else { - DarwinSendTabletEvents(pDev, ev_type, ev_button, - location.x, location.y, pressure, - tilt.x, tilt.y); - } - - break; - - case NSTabletProximity: - switch ([e pointingDeviceType]) { - case NSEraserPointingDevice: - darwinTabletCurrent = darwinTabletEraser; - break; - - case NSPenPointingDevice: - darwinTabletCurrent = darwinTabletStylus; - break; - - case NSCursorPointingDevice: - case NSUnknownPointingDevice: - default: - darwinTabletCurrent = darwinTabletCursor; - break; - } - - if ([e isEnteringProximity]) - needsProximityIn = YES; - else - DarwinSendTabletEvents(darwinTabletCurrent, ProximityOut, 0, - location.x, location.y, pressure, - tilt.x, tilt.y); - break; - - case NSScrollWheel: - { - CGFloat deltaX = [e deltaX]; - CGFloat deltaY = [e deltaY]; - CGEventRef cge = [e CGEvent]; - BOOL isContinuous = - CGEventGetIntegerValueField(cge, kCGScrollWheelEventIsContinuous); - -#if 0 - /* Scale the scroll value by line height */ - CGEventSourceRef source = CGEventCreateSourceFromEvent(cge); - if (source) { - double lineHeight = CGEventSourceGetPixelsPerLine(source); - CFRelease(source); - - /* There's no real reason for the 1/5 ratio here other than that - * it feels like a good ratio after some testing. - */ - - deltaX *= lineHeight / 5.0; - deltaY *= lineHeight / 5.0; - } -#endif - - if (XQuartzScrollInDeviceDirection && - [e isDirectionInvertedFromDevice]) { - deltaX *= -1; - deltaY *= -1; - } - /* This hack is in place to better deal with "clicky" scroll wheels: - * http://xquartz.macosforge.org/trac/ticket/562 - */ - if (!isContinuous) { - static NSTimeInterval lastScrollTime = 0.0; - - /* These store how much extra we have already scrolled. - * ie, this is how much we ignore on the next event. - */ - static double deficit_x = 0.0; - static double deficit_y = 0.0; - - /* If we have past a second since the last scroll, wipe the slate - * clean - */ - if ([e timestamp] - lastScrollTime > 1.0) { - deficit_x = deficit_y = 0.0; - } - lastScrollTime = [e timestamp]; - - if (deltaX != 0.0) { - /* If we changed directions, wipe the slate clean */ - if ((deficit_x < 0.0 && deltaX > 0.0) || - (deficit_x > 0.0 && deltaX < 0.0)) { - deficit_x = 0.0; - } - - /* Eat up the deficit, but ensure that something is - * always sent - */ - if (fabs(deltaX) > fabs(deficit_x)) { - deltaX -= deficit_x; - - if (deltaX > 0.0) { - deficit_x = ceil(deltaX) - deltaX; - deltaX = ceil(deltaX); - } else { - deficit_x = floor(deltaX) - deltaX; - deltaX = floor(deltaX); - } - } else { - deficit_x -= deltaX; - - if (deltaX > 0.0) { - deltaX = 1.0; - } else { - deltaX = -1.0; - } - - deficit_x += deltaX; - } - } - - if (deltaY != 0.0) { - /* If we changed directions, wipe the slate clean */ - if ((deficit_y < 0.0 && deltaY > 0.0) || - (deficit_y > 0.0 && deltaY < 0.0)) { - deficit_y = 0.0; - } - - /* Eat up the deficit, but ensure that something is - * always sent - */ - if (fabs(deltaY) > fabs(deficit_y)) { - deltaY -= deficit_y; - - if (deltaY > 0.0) { - deficit_y = ceil(deltaY) - deltaY; - deltaY = ceil(deltaY); - } else { - deficit_y = floor(deltaY) - deltaY; - deltaY = floor(deltaY); - } - } else { - deficit_y -= deltaY; - - if (deltaY > 0.0) { - deltaY = 1.0; - } else { - deltaY = -1.0; - } - - deficit_y += deltaY; - } - } - } - - DarwinSendScrollEvents(deltaX, deltaY); - 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) { - __block TISInputSourceRef key_layout; - dispatch_block_t copyCurrentKeyboardLayoutInputSource = ^{ - key_layout = TISCopyCurrentKeyboardLayoutInputSource(); - }; - /* This is an ugly ant-pattern, but it is more expedient to address the problem right now. */ - if (pthread_main_np()) { - copyCurrentKeyboardLayoutInputSource(); - } else { - dispatch_sync(dispatch_get_main_queue(), copyCurrentKeyboardLayoutInputSource); - } - - TISInputSourceRef clear; - if (CFEqual(key_layout, last_key_layout)) { - CFRelease(key_layout); - } - else { - /* Swap/free thread-safely */ - clear = last_key_layout; - last_key_layout = key_layout; - CFRelease(clear); - - /* Update keyInfo */ - if (!QuartsResyncKeymap(TRUE)) { - ErrorF( - "sendX11NSEvent: Could not build a valid keymap.\n"); - } - } - } - - ev_type = ([e type] == NSKeyDown) ? KeyPress : KeyRelease; - DarwinSendKeyboardEvents(ev_type, [e keyCode]); - break; - - default: - break; /* for gcc */ - } -} -@end diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h deleted file mode 100644 index d5be0e8b6..000000000 --- a/hw/xquartz/X11Controller.h +++ /dev/null @@ -1,123 +0,0 @@ -/* X11Controller.h -- connect the IB ui - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifndef X11CONTROLLER_H -#define X11CONTROLLER_H 1 - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#if __OBJC__ - -#include "sanitizedCocoa.h" -#include "xpr/x-list.h" - -#ifdef XQUARTZ_SPARKLE -#define BOOL OSX_BOOL -#include -#undef BOOL -#endif - -@interface X11Controller : NSObject -@property (nonatomic, readwrite, strong) IBOutlet NSPanel *prefs_panel; - -@property (nonatomic, readwrite, strong) IBOutlet NSButton *fake_buttons; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *enable_fullscreen; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *enable_fullscreen_menu; -@property (nonatomic, readwrite, strong) IBOutlet NSTextField *enable_fullscreen_menu_text; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *enable_keyequivs; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *sync_keymap; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *option_sends_alt; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *scroll_in_device_direction; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *click_through; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *focus_follows_mouse; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *focus_on_new_window; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *enable_auth; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *enable_tcp; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *sync_pasteboard; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *sync_pasteboard_to_clipboard; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *sync_pasteboard_to_primary; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *sync_clipboard_to_pasteboard; -@property (nonatomic, readwrite, strong) IBOutlet NSButton *sync_primary_immediately; -@property (nonatomic, readwrite, strong) IBOutlet NSTextField *sync_text1; -@property (nonatomic, readwrite, strong) IBOutlet NSTextField *sync_text2; -@property (nonatomic, readwrite, strong) IBOutlet NSPopUpButton *depth; - -@property (nonatomic, readwrite, strong) IBOutlet NSMenuItem *x11_about_item; -@property (nonatomic, readwrite, strong) IBOutlet NSMenuItem *dock_window_separator; -@property (nonatomic, readwrite, strong) IBOutlet NSMenuItem *apps_separator; -@property (nonatomic, readwrite, strong) IBOutlet NSMenuItem *toggle_fullscreen_item; - -@property (nonatomic, readwrite, strong) IBOutlet NSMenuItem *copy_menu_item; -@property (nonatomic, readwrite, strong) IBOutlet NSMenu *dock_apps_menu; -@property (nonatomic, readwrite, strong) IBOutlet NSTableView *apps_table; - -@property (nonatomic, readwrite, strong) IBOutlet NSMenu *dock_menu; - -@property (nonatomic, readwrite, assign) OSX_BOOL can_quit; - -- (void)set_window_menu:(NSArray *)list; -- (void)set_window_menu_check:(NSNumber *)n; -- (void)set_apps_menu:(NSArray *)list; -#ifdef XQUARTZ_SPARKLE -- (void)setup_sparkle; -- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *) - update; -#endif -- (void)server_ready; -- (OSX_BOOL)application:(NSApplication *)app openFile:(NSString *)filename; - -- (IBAction)apps_table_show:(id)sender; -- (IBAction)apps_table_done:(id)sender; -- (IBAction)apps_table_new:(id)sender; -- (IBAction)apps_table_duplicate:(id)sender; -- (IBAction)apps_table_delete:(id)sender; -- (IBAction)bring_to_front:(id)sender; -- (IBAction)close_window:(id)sender; -- (IBAction)minimize_window:(id)sender; -- (IBAction)zoom_window:(id)sender; -- (IBAction)next_window:(id)sender; -- (IBAction)previous_window:(id)sender; -- (IBAction)enable_fullscreen_changed:(id)sender; -- (IBAction)toggle_fullscreen:(id)sender; -- (IBAction)prefs_changed:(id)sender; -- (IBAction)prefs_show:(id)sender; -- (IBAction)quit:(id)sender; -- (IBAction)x11_help:(id)sender; - -@end - -#endif /* __OBJC__ */ - -void -X11ControllerMain(int argc, char **argv, char **envp); - -#endif /* X11CONTROLLER_H */ diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m deleted file mode 100644 index e21aed0d3..000000000 --- a/hw/xquartz/X11Controller.m +++ /dev/null @@ -1,923 +0,0 @@ -/* X11Controller.m -- connect the IB ui, also the NSApp delegate - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#include "sanitizedCarbon.h" - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#import "X11Controller.h" -#import "X11Application.h" -#import "NSUserDefaults+XQuartzDefaults.h" - -#include "opaque.h" -#include "darwin.h" -#include "darwinEvents.h" -#include "quartz.h" -#include "quartzKeyboard.h" -#include -#include "applewmExt.h" - -#include -#include -#include -#include -#include -#include -#include - -extern aslclient aslc; -extern char *bundle_id_prefix; - -@interface X11Controller () -#ifdef XQUARTZ_SPARKLE -@property (nonatomic, readwrite, strong) NSMenuItem *check_for_updates_item; // Programatically enabled -#endif - -@property (nonatomic, readwrite, strong) NSArray *> *apps; -@property (nonatomic, readwrite, strong) NSMutableArray *> *table_apps; -@property (nonatomic, readwrite, assign) NSInteger windows_menu_nitems; -@property (nonatomic, readwrite, assign) int checked_window_item; -@property (nonatomic, readwrite, assign) x_list *pending_apps; -@property (nonatomic, readwrite, assign) OSX_BOOL finished_launching; -@end - -@implementation X11Controller - -- (void) awakeFromNib -{ - X11Application *xapp = NSApp; - - /* Point X11Application at ourself. */ - xapp.controller = self; - - NSUserDefaults * const defaults = NSUserDefaults.xquartzDefaults; - NSArray *appsMenu = [defaults arrayForKey:XQuartzPrefKeyAppsMenu]; - - if (appsMenu) { - int count = appsMenu.count; - - /* convert from [TITLE1 COMMAND1 TITLE2 COMMAND2 ...] - to [[TITLE1 COMMAND1] [TITLE2 COMMAND2] ...] format. */ - if (count > 0 && ![appsMenu[0] isKindOfClass:NSArray.class]) { - int i; - NSMutableArray *copy, *sub; - - copy = [NSMutableArray arrayWithCapacity:(count / 2)]; - - for (i = 0; i < count / 2; i++) { - sub = [[NSMutableArray alloc] initWithCapacity:3]; - [sub addObject:appsMenu[i * 2]]; - [sub addObject:appsMenu[i * 2 + 1]]; - [sub addObject:@""]; - [copy addObject:sub]; - [sub release]; - } - - appsMenu = copy; - [defaults setObject:appsMenu forKey:XQuartzPrefKeyAppsMenu]; - } - - [self set_apps_menu:appsMenu]; - } - - [NSNotificationCenter.defaultCenter addObserver:self - selector:@selector(apps_table_done:) - name:NSWindowWillCloseNotification - object:self.apps_table.window]; -} - -- (void) item_selected:sender -{ - [NSApp activateIgnoringOtherApps:YES]; - - DarwinSendDDXEvent(kXquartzControllerNotify, 2, - AppleWMWindowMenuItem, [sender tag]); -} - -- (void) remove_apps_menu -{ - NSMenu *menu; - NSMenuItem *item; - int i; - - NSMenuItem * const apps_separator = self.apps_separator; - NSMenu * const dock_apps_menu = self.dock_apps_menu; - - if (self.apps == nil || apps_separator == nil) return; - - menu = [apps_separator menu]; - - if (menu != nil) { - for (i = [menu numberOfItems] - 1; i >= 0; i--) { - item = (NSMenuItem *)[menu itemAtIndex:i]; - if ([item tag] != 0) - [menu removeItemAtIndex:i]; - } - } - - if (dock_apps_menu != nil) { - for (i = [dock_apps_menu numberOfItems] - 1; i >= 0; i--) { - item = (NSMenuItem *)[dock_apps_menu itemAtIndex:i]; - if ([item tag] != 0) - [dock_apps_menu removeItemAtIndex:i]; - } - } - - self.apps = nil; -} - -- (void) prepend_apps_item:(NSArray *> *)list index:(int)i menu:(NSMenu *)menu -{ - NSString *title, *shortcut = @""; - NSArray *group; - NSMenuItem *item; - - group = [list objectAtIndex:i]; - title = [group objectAtIndex:0]; - if ([group count] >= 3) - shortcut = [group objectAtIndex:2]; - - if ([title length] != 0) { - item = (NSMenuItem *)[menu insertItemWithTitle:title - action:@selector ( - app_selected:) - keyEquivalent:shortcut atIndex:0]; - [item setTarget:self]; - [item setEnabled:YES]; - } - else { - item = (NSMenuItem *)[NSMenuItem separatorItem]; - [menu insertItem:item atIndex:0]; - } - - [item setTag:i + 1]; /* can't be zero, so add one */ -} - -- (void) install_apps_menu:(NSArray *> *)list -{ - NSMenu *menu; - int i, count; - - count = [list count]; - - NSMenuItem * const apps_separator = self.apps_separator; - NSMenu * const dock_apps_menu = self.dock_apps_menu; - - if (count == 0 || apps_separator == nil) return; - - menu = [apps_separator menu]; - - for (i = count - 1; i >= 0; i--) { - if (menu != nil) - [self prepend_apps_item:list index:i menu:menu]; - if (dock_apps_menu != nil) - [self prepend_apps_item:list index:i menu:dock_apps_menu]; - } - - self.apps = list; -} - -- (void) set_window_menu:(NSArray *> *)list -{ - NSMenu * const menu = X11App.windowsMenu; - NSMenu * const dock_menu = self.dock_menu; - - /* First, remove the existing items from the Window Menu */ - NSInteger itemsToRemove = self.windows_menu_nitems; - if (itemsToRemove > 0) { - NSInteger indexForRemoval = menu.numberOfItems - itemsToRemove - 1; /* we also want to remove the separator */ - - for (NSInteger i = 0 ; i < itemsToRemove + 1 ; i++) { - [menu removeItemAtIndex:indexForRemoval]; - } - - for (NSInteger i = 0 ; i < itemsToRemove; i++) { - [dock_menu removeItemAtIndex:0]; - } - } - - NSInteger const itemsToAdd = list.count; - self.windows_menu_nitems = itemsToAdd; - - if (itemsToAdd > 0) { - NSMenuItem *item; - - // Push a Separator - [menu addItem:[NSMenuItem separatorItem]]; - - for (NSInteger i = 0; i < itemsToAdd; i++) { - NSString *name, *shortcut; - - name = list[i][0]; - shortcut = list[i][1]; - - if (windowItemModMask == 0 || windowItemModMask == -1) - shortcut = @""; - - item = (NSMenuItem *)[menu addItemWithTitle:name - action:@selector(item_selected:) - keyEquivalent:shortcut]; - [item setKeyEquivalentModifierMask:(NSUInteger)windowItemModMask]; - [item setTarget:self]; - [item setTag:i]; - [item setEnabled:YES]; - - item = (NSMenuItem *)[dock_menu insertItemWithTitle:name - action:@selector(item_selected:) - keyEquivalent:shortcut - atIndex:i]; - [item setKeyEquivalentModifierMask:(NSUInteger)windowItemModMask]; - [item setTarget:self]; - [item setTag:i]; - [item setEnabled:YES]; - } - - int const checked_window_item = self.checked_window_item; - if (checked_window_item >= 0 && checked_window_item < itemsToAdd) { - NSInteger first = menu.numberOfItems - itemsToAdd; - item = (NSMenuItem *)[menu itemAtIndex:first + checked_window_item]; - [item setState:NSOnState]; - - item = (NSMenuItem *)[dock_menu itemAtIndex:checked_window_item]; - [item setState:NSOnState]; - } - } - - DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMWindowMenuNotify); -} - -- (void) set_window_menu_check:(NSNumber *)nn -{ - NSMenu * const menu = X11App.windowsMenu; - NSMenu * const dock_menu = self.dock_menu; - NSMenuItem *item; - int n = nn.intValue; - - NSInteger const count = self.windows_menu_nitems; - NSInteger const first = menu.numberOfItems - count; - - int const checked_window_item = self.checked_window_item; - - if (checked_window_item >= 0 && checked_window_item < count) { - item = (NSMenuItem *)[menu itemAtIndex:first + checked_window_item]; - [item setState:NSOffState]; - item = (NSMenuItem *)[dock_menu itemAtIndex:checked_window_item]; - [item setState:NSOffState]; - } - if (n >= 0 && n < count) { - item = (NSMenuItem *)[menu itemAtIndex:first + n]; - [item setState:NSOnState]; - item = (NSMenuItem *)[dock_menu itemAtIndex:n]; - [item setState:NSOnState]; - } - self.checked_window_item = n; -} - -- (void) set_apps_menu:(NSArray *> *)list -{ - [self remove_apps_menu]; - [self install_apps_menu:list]; -} - -#ifdef XQUARTZ_SPARKLE -- (void) setup_sparkle -{ - if (self.check_for_updates_item) - return; // already did it... - - NSMenu *menu = [self.x11_about_item menu]; - - NSMenuItem * const check_for_updates_item = - [menu insertItemWithTitle:NSLocalizedString(@"Check for X11 Updates...", @"Check for X11 Updates...") - action:@selector(checkForUpdates:) - keyEquivalent:@"" - atIndex:1]; - [check_for_updates_item setTarget:[SUUpdater sharedUpdater]]; - [check_for_updates_item setEnabled:YES]; - - self.check_for_updates_item = check_for_updates_item; - - // Set X11Controller as the delegate for the updater. - [[SUUpdater sharedUpdater] setDelegate:self]; -} - -// Sent immediately before installing the specified update. -- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update -{ - //self.can_quit = YES; -} - -#endif - -- (void) launch_client:(NSString *)filename -{ - int child1, child2 = 0; - int status; - const char *newargv[4]; - char buf[128]; - char *s; - int stdout_pipe[2]; - int stderr_pipe[2]; - - NSUserDefaults * const defaults = NSUserDefaults.xquartzDefaults; - NSString * const shell = [defaults stringForKey:XQuartzPrefKeyLoginShell]; - - newargv[0] = shell.fileSystemRepresentation; - newargv[1] = "-c"; - newargv[2] = filename.fileSystemRepresentation; - newargv[3] = NULL; - - s = getenv("DISPLAY"); - if (s == NULL || s[0] == 0) { - snprintf(buf, sizeof(buf), ":%s", display); - setenv("DISPLAY", buf, TRUE); - } - - if (&asl_log_descriptor) { - char *asl_sender; - aslmsg amsg = asl_new(ASL_TYPE_MSG); - assert(amsg); - - asprintf(&asl_sender, "%s.%s", bundle_id_prefix, newargv[2]); - assert(asl_sender); - for(s = asl_sender + strlen(bundle_id_prefix) + 1; *s; s++) { - if(! ((*s >= 'a' && *s <= 'z') || - (*s >= 'A' && *s <= 'Z') || - (*s >= '0' && *s <= '9'))) { - *s = '_'; - } - } - - (void)asl_set(amsg, ASL_KEY_SENDER, asl_sender); - free(asl_sender); - - assert(0 == pipe(stdout_pipe)); - fcntl(stdout_pipe[0], F_SETFD, FD_CLOEXEC); - fcntl(stdout_pipe[0], F_SETFL, O_NONBLOCK); - - assert(0 == pipe(stderr_pipe)); - fcntl(stderr_pipe[0], F_SETFD, FD_CLOEXEC); - fcntl(stderr_pipe[0], F_SETFL, O_NONBLOCK); - - asl_log_descriptor(aslc, amsg, ASL_LEVEL_INFO, stdout_pipe[0], ASL_LOG_DESCRIPTOR_READ); - asl_log_descriptor(aslc, amsg, ASL_LEVEL_NOTICE, stderr_pipe[0], ASL_LOG_DESCRIPTOR_READ); - - asl_free(amsg); - } - - /* Do the fork-twice trick to avoid having to reap zombies */ - child1 = fork(); - switch (child1) { - case -1: /* error */ - break; - - case 0: /* child1 */ - child2 = fork(); - - switch (child2) { - int max_files, i; - - case -1: /* error */ - _exit(1); - - case 0: /* child2 */ - if (&asl_log_descriptor) { - /* Replace our stdout/stderr */ - dup2(stdout_pipe[1], STDOUT_FILENO); - dup2(stderr_pipe[1], STDERR_FILENO); - } - - /* close all open files except for standard streams */ - max_files = sysconf(_SC_OPEN_MAX); - for (i = 3; i < max_files; i++) - close(i); - - /* ensure stdin is on /dev/null */ - close(0); - open("/dev/null", O_RDONLY); - - execvp(newargv[0], (char * *const)newargv); - _exit(2); - - default: /* parent (child1) */ - _exit(0); - } - break; - - default: /* parent */ - waitpid(child1, &status, 0); - } - - if (&asl_log_descriptor) { - /* Close the write ends of the pipe */ - close(stdout_pipe[1]); - close(stderr_pipe[1]); - } -} - -- (void) app_selected:sender -{ - int tag; - NSString *item; - NSArray *> * const apps = self.apps; - - tag = [sender tag] - 1; - if (apps == nil || tag < 0 || tag >= [apps count]) - return; - - item = [[apps objectAtIndex:tag] objectAtIndex:1]; - - [self launch_client:item]; -} - -- (IBAction) apps_table_show:sender -{ - NSArray *columns; - NSMutableArray *> * const oldapps = self.table_apps; - NSTableView * const apps_table = self.apps_table; - - NSMutableArray *> * const table_apps = [[NSMutableArray alloc] initWithCapacity:1]; - self.table_apps = table_apps; - - NSArray *> * const apps = self.apps; - if (apps != nil) { - for (NSArray * row in apps) { - [table_apps addObject:row.mutableCopy]; - } - } - - columns = [apps_table tableColumns]; - [[columns objectAtIndex:0] setIdentifier:@"0"]; - [[columns objectAtIndex:1] setIdentifier:@"1"]; - [[columns objectAtIndex:2] setIdentifier:@"2"]; - - [apps_table setDataSource:self]; - [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:0] - byExtendingSelection:NO]; - - [[apps_table window] makeKeyAndOrderFront:sender]; - [apps_table reloadData]; - if (oldapps != nil) - [oldapps release]; -} - -- (IBAction) apps_table_done:sender -{ - NSMutableArray *> * const table_apps = self.table_apps; - NSTableView * const apps_table = self.apps_table; - [apps_table deselectAll:sender]; /* flush edits? */ - - [self remove_apps_menu]; - [self install_apps_menu:table_apps]; - - NSUserDefaults * const defaults = NSUserDefaults.xquartzDefaults; - [defaults setObject:table_apps forKey:XQuartzPrefKeyAppsMenu]; - - [[apps_table window] orderOut:sender]; - - self.table_apps = nil; -} - -- (IBAction) apps_table_new:sender -{ - NSMutableArray *item; - NSMutableArray *> * const table_apps = self.table_apps; - NSTableView * const apps_table = self.apps_table; - - int row = [apps_table selectedRow], i; - - if (row < 0) row = 0; - else row = row + 1; - - i = row; - if (i > [table_apps count]) - return; /* avoid exceptions */ - - [apps_table deselectAll:sender]; - - item = [[NSMutableArray alloc] initWithCapacity:3]; - [item addObject:@""]; - [item addObject:@""]; - [item addObject:@""]; - - [table_apps insertObject:item atIndex:i]; - [item release]; - - [apps_table reloadData]; - [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:row] - byExtendingSelection:NO]; -} - -- (IBAction) apps_table_duplicate:sender -{ - NSMutableArray *> * const table_apps = self.table_apps; - NSTableView * const apps_table = self.apps_table; - int row = [apps_table selectedRow], i; - NSMutableArray *item; - - if (row < 0) { - [self apps_table_new:sender]; - return; - } - - i = row; - if (i > [table_apps count] - 1) return; /* avoid exceptions */ - - [apps_table deselectAll:sender]; - - item = [[table_apps objectAtIndex:i] mutableCopy]; - [table_apps insertObject:item atIndex:i]; - [item release]; - - [apps_table reloadData]; - [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:row + - 1] byExtendingSelection:NO]; -} - -- (IBAction) apps_table_delete:sender -{ - NSMutableArray *> * const table_apps = self.table_apps; - NSTableView * const apps_table = self.apps_table; - int row = [apps_table selectedRow]; - - if (row >= 0) { - int i = row; - - if (i > [table_apps count] - 1) return; /* avoid exceptions */ - - [apps_table deselectAll:sender]; - - [table_apps removeObjectAtIndex:i]; - } - - [apps_table reloadData]; - - row = MIN(row, [table_apps count] - 1); - if (row >= 0) - [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:row] - byExtendingSelection:NO]; -} - -- (NSInteger) numberOfRowsInTableView:(NSTableView *)tableView -{ - NSMutableArray *> * const table_apps = self.table_apps; - if (table_apps == nil) return 0; - - return [table_apps count]; -} - -- (id) tableView:(NSTableView *)tableView - objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row -{ - NSMutableArray *> * const table_apps = self.table_apps; - NSArray *item; - int col; - - if (table_apps == nil) return nil; - - col = [[tableColumn identifier] intValue]; - - item = [table_apps objectAtIndex:row]; - if ([item count] > col) - return [item objectAtIndex:col]; - else - return @""; -} - -- (void) tableView:(NSTableView *)tableView setObjectValue:(id)object - forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row -{ - NSMutableArray *> * const table_apps = self.table_apps; - NSMutableArray *item; - int col; - - if (table_apps == nil) return; - - col = [[tableColumn identifier] intValue]; - - item = [table_apps objectAtIndex:row]; - [item replaceObjectAtIndex:col withObject:object]; -} - -- (void) hide_window:sender -{ - if ([X11App x_active]) - DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideWindow); - else - NSBeep(); /* FIXME: something here */ -} - -- (IBAction)bring_to_front:sender -{ - DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMBringAllToFront); -} - -- (IBAction)close_window:sender -{ - if ([X11App x_active]) - DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMCloseWindow); - else - [[NSApp keyWindow] performClose:sender]; -} - -- (IBAction)minimize_window:sender -{ - if ([X11App x_active]) - DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMMinimizeWindow); - else - [[NSApp keyWindow] performMiniaturize:sender]; -} - -- (IBAction)zoom_window:sender -{ - if ([X11App x_active]) - DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMZoomWindow); - else - [[NSApp keyWindow] performZoom:sender]; -} - -- (IBAction) next_window:sender -{ - DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMNextWindow); -} - -- (IBAction) previous_window:sender -{ - DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMPreviousWindow); -} - -- (IBAction) enable_fullscreen_changed:sender -{ - XQuartzRootlessDefault = !self.enable_fullscreen.state; - - [self.enable_fullscreen_menu setEnabled:!XQuartzRootlessDefault]; - [self.enable_fullscreen_menu_text setTextColor:XQuartzRootlessDefault ? NSColor.disabledControlTextColor : NSColor.controlTextColor]; - - DarwinSendDDXEvent(kXquartzSetRootless, 1, XQuartzRootlessDefault); - - NSUserDefaults * const defaults = NSUserDefaults.xquartzDefaults; - [defaults setBool:XQuartzRootlessDefault forKey:XQuartzPrefKeyRootless]; -} - -- (IBAction) toggle_fullscreen:sender -{ - DarwinSendDDXEvent(kXquartzToggleFullscreen, 0); -} - -- (IBAction)prefs_changed:sender -{ - if (!sender) - return; - - NSUserDefaults * const defaults = NSUserDefaults.xquartzDefaults; - - if (sender == self.fake_buttons) { - darwinFakeButtons = !!self.fake_buttons.state; - [defaults setBool:darwinFakeButtons forKey:XQuartzPrefKeyFakeButtons]; - } else if (sender == self.enable_keyequivs) { - XQuartzEnableKeyEquivalents = !!self.enable_keyequivs.state; - [defaults setBool:XQuartzEnableKeyEquivalents forKey:XQuartzPrefKeyKeyEquivs]; - } else if (sender == self.sync_keymap) { - darwinSyncKeymap = !!self.sync_keymap.state; - [defaults setBool:darwinSyncKeymap forKey:XQuartzPrefKeySyncKeymap]; - } else if (sender == self.enable_fullscreen_menu) { - XQuartzFullscreenMenu = !!self.enable_fullscreen_menu.state; - [defaults setBool:XQuartzFullscreenMenu forKey:XQuartzPrefKeyFullscreenMenu]; - } else if (sender == self.option_sends_alt) { - BOOL prev_opt_sends_alt = XQuartzOptionSendsAlt; - - XQuartzOptionSendsAlt = !!self.option_sends_alt.state; - [defaults setBool:XQuartzOptionSendsAlt forKey:XQuartzPrefKeyOptionSendsAlt]; - - if (prev_opt_sends_alt != XQuartzOptionSendsAlt) - QuartsResyncKeymap(TRUE); - } else if (sender == self.click_through) { - [defaults setBool:!!self.click_through.state forKey:XQuartzPrefKeyClickThrough]; - } else if (sender == self.focus_follows_mouse) { - [defaults setBool:!!self.focus_follows_mouse.state forKey:XQuartzPrefKeyFocusFollowsMouse]; - } else if (sender == self.focus_on_new_window) { - [defaults setBool:!!self.focus_on_new_window.state forKey:XQuartzPrefKeyFocusOnNewWindow]; - } else if (sender == self.enable_auth) { - [defaults setBool:!self.enable_auth.state forKey:XQuartzPrefKeyNoAuth]; - } else if (sender == self.enable_tcp) { - [defaults setBool:!self.enable_tcp.state forKey:XQuartzPrefKeyNoTCP]; - } else if (sender == self.depth) { - [defaults setInteger:self.depth.selectedTag forKey:XQuartzPrefKeyDepth]; - } else if (sender == self.sync_pasteboard) { - BOOL pbproxy_active = self.sync_pasteboard.intValue; - [defaults setBool:pbproxy_active forKey:XQuartzPrefKeySyncPasteboard]; - - [self.sync_pasteboard_to_clipboard setEnabled:pbproxy_active]; - [self.sync_pasteboard_to_primary setEnabled:pbproxy_active]; - [self.sync_clipboard_to_pasteboard setEnabled:pbproxy_active]; - [self.sync_primary_immediately setEnabled:pbproxy_active]; - - // setEnabled doesn't do this... - [self.sync_text1 setTextColor:pbproxy_active ? NSColor.controlTextColor : NSColor.disabledControlTextColor]; - [self.sync_text2 setTextColor:pbproxy_active ? NSColor.controlTextColor : NSColor.disabledControlTextColor]; - } else if (sender == self.sync_pasteboard_to_clipboard) { - [defaults setBool:!!self.sync_pasteboard_to_clipboard.state forKey:XQuartzPrefKeySyncPasteboardToClipboard]; - } else if (sender == self.sync_pasteboard_to_primary) { - [defaults setBool:!!self.sync_pasteboard_to_primary.state forKey:XQuartzPrefKeySyncPasteboardToPrimary]; - } else if (sender == self.sync_clipboard_to_pasteboard) { - [defaults setBool:!!self.sync_clipboard_to_pasteboard.state forKey:XQuartzPrefKeySyncClipboardToPasteBoard]; - } else if (sender == self.sync_primary_immediately) { - [defaults setBool:!!self.sync_primary_immediately.state forKey:XQuartzPrefKeySyncPrimaryOnSelect]; - } else if (sender == self.scroll_in_device_direction) { - XQuartzScrollInDeviceDirection = !!self.scroll_in_device_direction.state; - [defaults setBool:XQuartzScrollInDeviceDirection forKey:XQuartzPrefKeyScrollInDeviceDirection]; - } - - DarwinSendDDXEvent(kXquartzReloadPreferences, 0); -} - -- (IBAction) prefs_show:sender -{ - NSUserDefaults * const defaults = NSUserDefaults.xquartzDefaults; - - BOOL pbproxy_active = [defaults boolForKey:XQuartzPrefKeySyncPasteboard]; - - [self.scroll_in_device_direction setIntValue:XQuartzScrollInDeviceDirection]; - - [self.fake_buttons setIntValue:darwinFakeButtons]; - [self.enable_keyequivs setIntValue:XQuartzEnableKeyEquivalents]; - [self.sync_keymap setIntValue:darwinSyncKeymap]; - [self.option_sends_alt setIntValue:XQuartzOptionSendsAlt]; - [self.click_through setIntValue:[defaults boolForKey:XQuartzPrefKeyClickThrough]]; - [self.focus_follows_mouse setIntValue:[defaults boolForKey:XQuartzPrefKeyFocusFollowsMouse]]; - [self.focus_on_new_window setIntValue:[defaults boolForKey:XQuartzPrefKeyFocusOnNewWindow]]; - - [self.enable_auth setIntValue:![defaults boolForKey:XQuartzPrefKeyNoAuth]]; - [self.enable_tcp setIntValue:![defaults boolForKey:XQuartzPrefKeyNoTCP]]; - - [self.depth selectItemAtIndex:[self.depth indexOfItemWithTag:[defaults integerForKey:XQuartzPrefKeyDepth]]]; - - [self.sync_pasteboard setIntValue:pbproxy_active]; - [self.sync_pasteboard_to_clipboard setIntValue:[defaults boolForKey:XQuartzPrefKeySyncPasteboardToClipboard]]; - [self.sync_pasteboard_to_primary setIntValue:[defaults boolForKey:XQuartzPrefKeySyncPasteboardToPrimary]]; - [self.sync_clipboard_to_pasteboard setIntValue:[defaults boolForKey:XQuartzPrefKeySyncClipboardToPasteBoard]]; - [self.sync_primary_immediately setIntValue:[defaults boolForKey:XQuartzPrefKeySyncPrimaryOnSelect]]; - - [self.sync_pasteboard_to_clipboard setEnabled:pbproxy_active]; - [self.sync_pasteboard_to_primary setEnabled:pbproxy_active]; - [self.sync_clipboard_to_pasteboard setEnabled:pbproxy_active]; - [self.sync_primary_immediately setEnabled:pbproxy_active]; - - // setEnabled doesn't do this... - [self.sync_text1 setTextColor:pbproxy_active ? NSColor.controlTextColor : NSColor.disabledControlTextColor]; - [self.sync_text2 setTextColor:pbproxy_active ? NSColor.controlTextColor : NSColor.disabledControlTextColor]; - - [self.enable_fullscreen setIntValue:!XQuartzRootlessDefault]; - [self.enable_fullscreen_menu setIntValue:XQuartzFullscreenMenu]; - [self.enable_fullscreen_menu setEnabled:!XQuartzRootlessDefault]; - [self.enable_fullscreen_menu_text setTextColor:XQuartzRootlessDefault ? NSColor.disabledControlTextColor : NSColor.controlTextColor]; - - [self.prefs_panel makeKeyAndOrderFront:sender]; -} - -- (IBAction) quit:sender -{ - DarwinSendDDXEvent(kXquartzQuit, 0); -} - -- (IBAction) x11_help:sender -{ - AHLookupAnchor(CFSTR("com.apple.machelp"), CFSTR("mchlp2276")); -} - -- (OSX_BOOL) validateMenuItem:(NSMenuItem *)item -{ - NSMenu *menu = [item menu]; - NSMenu * const dock_menu = self.dock_menu; - - if (item == self.toggle_fullscreen_item) - return !XQuartzIsRootless; - else if (menu == [X11App windowsMenu] || menu == dock_menu - || (menu == [self.x11_about_item menu] && [item tag] == 42)) - return (AppleWMSelectedEvents() & AppleWMControllerNotifyMask) != 0; - else - return TRUE; -} - -- (void) applicationDidHide:(NSNotification *)notify -{ - DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideAll); - - /* Toggle off fullscreen mode to leave our non-default video - * mode and hide our guard window. - */ - if (!XQuartzIsRootless && XQuartzFullscreenVisible) { - DarwinSendDDXEvent(kXquartzToggleFullscreen, 0); - } -} - -- (void) applicationDidUnhide:(NSNotification *)notify -{ - DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMShowAll); -} - -- (NSApplicationTerminateReply) applicationShouldTerminate:sender -{ - NSString *msg; - NSString *title; - - NSUserDefaults * const defaults = NSUserDefaults.xquartzDefaults; - - if (self.can_quit || [defaults boolForKey:XQuartzPrefKeyNoQuitAlert]) { - return NSTerminateNow; - } - - /* Make sure we're frontmost. */ - [NSApp activateIgnoringOtherApps:YES]; - - title = NSLocalizedString(@"Do you really want to quit X11?", - @"Dialog title when quitting"); - msg = NSLocalizedString( - @"Any open X11 applications will stop immediately, and you will lose any unsaved changes.", - @"Dialog when quitting"); - - /* FIXME: safe to run the alert in here? Or should we return Later - * and then run the alert on a timer? It seems to work here, so.. - */ - - NSInteger result = NSRunAlertPanel(title, @"%@", NSLocalizedString(@"Quit", @""), - NSLocalizedString(@"Cancel", @""), nil, msg); - return (result == NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel; -} - -- (void) applicationWillTerminate:(NSNotification *)aNotification _X_NORETURN -{ - /* shutdown the X server, it will exit () for us. */ - DarwinSendDDXEvent(kXquartzQuit, 0); - - /* In case it doesn't, exit anyway after 5s. */ - [NSThread sleepForTimeInterval:5.0]; - - exit(1); -} - -- (void) server_ready -{ - x_list *node; - - self.finished_launching = YES; - - for (node = self.pending_apps; node != NULL; node = node->next) { - NSString *filename = node->data; - [self launch_client:filename]; - [filename release]; - } - - x_list_free(self.pending_apps); - self.pending_apps = NULL; -} - -- (OSX_BOOL) application:(NSApplication *)app openFile:(NSString *)filename -{ - const char *name = [filename UTF8String]; - - if (self.finished_launching) - [self launch_client:filename]; - else if (name[0] != ':') /* ignore display names */ - self.pending_apps = x_list_prepend(self.pending_apps, [filename retain]); - - /* FIXME: report failures. */ - return YES; -} - -@end - -void -X11ControllerMain(int argc, char **argv, char **envp) -{ - X11ApplicationMain(argc, argv, envp); -} diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c deleted file mode 100644 index 8cd92f296..000000000 --- a/hw/xquartz/applewm.c +++ /dev/null @@ -1,743 +0,0 @@ -/* - * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#include "sanitizedCarbon.h" - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include "quartz.h" - -#include "misc.h" -#include "dixstruct.h" -#include "globals.h" -#include "extnsionst.h" -#include "colormapst.h" -#include "cursorstr.h" -#include "scrnintstr.h" -#include "windowstr.h" -#include "servermd.h" -#include "swaprep.h" -#include "propertyst.h" -#include -#include "darwin.h" -#define _APPLEWM_SERVER_ -#include -#include "applewmExt.h" -#include "X11Application.h" -#include "protocol-versions.h" - -#define DEFINE_ATOM_HELPER(func, atom_name) \ - static Atom func(void) { \ - static int generation; \ - static Atom atom; \ - if (generation != serverGeneration) { \ - generation = serverGeneration; \ - atom = MakeAtom(atom_name, strlen(atom_name), TRUE); \ - } \ - return atom; \ - } - -DEFINE_ATOM_HELPER(xa_native_screen_origin, "_NATIVE_SCREEN_ORIGIN") -DEFINE_ATOM_HELPER(xa_apple_no_order_in, "_APPLE_NO_ORDER_IN") - -static AppleWMProcsPtr appleWMProcs; - -static int WMErrorBase; - -static unsigned char WMReqCode = 0; -static int WMEventBase = 0; - -static RESTYPE ClientType, EventType; /* resource types for event masks */ -static XID eventResource; - -/* Currently selected events */ -static unsigned int eventMask = 0; - -static int -WMFreeClient(void *data, XID id); -static int -WMFreeEvents(void *data, XID id); -static void -SNotifyEvent(xAppleWMNotifyEvent *from, xAppleWMNotifyEvent *to); - -typedef struct _WMEvent *WMEventPtr; -typedef struct _WMEvent { - WMEventPtr next; - ClientPtr client; - XID clientResource; - unsigned int mask; -} WMEventRec; - -static inline BoxRec -make_box(int x, int y, int w, int h) -{ - BoxRec r; - r.x1 = x; - r.y1 = y; - r.x2 = x + w; - r.y2 = y + h; - return r; -} - -/* Updates the _NATIVE_SCREEN_ORIGIN property on the given root window. */ -void -AppleWMSetScreenOrigin(WindowPtr pWin) -{ - int32_t data[2]; - - data[0] = pWin->drawable.pScreen->x + darwinMainScreenX; - data[1] = pWin->drawable.pScreen->y + darwinMainScreenY; - - dixChangeWindowProperty(serverClient, pWin, xa_native_screen_origin(), - XA_INTEGER, 32, PropModeReplace, 2, data, TRUE); -} - -/* Window managers can set the _APPLE_NO_ORDER_IN property on windows - that are being genie-restored from the Dock. We want them to - be mapped but remain ordered-out until the animation - completes (when the Dock will order them in). */ -Bool -AppleWMDoReorderWindow(WindowPtr pWin) -{ - Atom atom; - PropertyPtr prop; - int rc; - - atom = xa_apple_no_order_in(); - rc = dixLookupProperty(&prop, pWin, atom, serverClient, DixReadAccess); - - if (Success == rc && prop->type == atom) - return 0; - - return 1; -} - -static int -ProcAppleWMQueryVersion(register ClientPtr client) -{ - xAppleWMQueryVersionReply rep; - - REQUEST_SIZE_MATCH(xAppleWMQueryVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = SERVER_APPLEWM_MAJOR_VERSION; - rep.minorVersion = SERVER_APPLEWM_MINOR_VERSION; - rep.patchVersion = SERVER_APPLEWM_PATCH_VERSION; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - } - WriteToClient(client, sizeof(xAppleWMQueryVersionReply),&rep); - return Success; -} - -/* events */ - -static inline void -updateEventMask(WMEventPtr *pHead) -{ - WMEventPtr pCur; - - eventMask = 0; - for (pCur = *pHead; pCur != NULL; pCur = pCur->next) - eventMask |= pCur->mask; -} - -/*ARGSUSED*/ -static int -WMFreeClient(void *data, XID id) -{ - WMEventPtr pEvent; - WMEventPtr *pHead, pCur, pPrev; - int i; - - pEvent = (WMEventPtr)data; - i = dixLookupResourceByType( - (void **)&pHead, eventResource, EventType, serverClient, - DixReadAccess | - DixWriteAccess | DixDestroyAccess); - if (i == Success && pHead) { - pPrev = 0; - for (pCur = *pHead; pCur && pCur != pEvent; pCur = pCur->next) - pPrev = pCur; - if (pCur) { - if (pPrev) - pPrev->next = pEvent->next; - else - *pHead = pEvent->next; - } - updateEventMask(pHead); - } - free((void *)pEvent); - return 1; -} - -/*ARGSUSED*/ -static int -WMFreeEvents(void *data, XID id) -{ - WMEventPtr *pHead, pCur, pNext; - - pHead = (WMEventPtr *)data; - for (pCur = *pHead; pCur; pCur = pNext) { - pNext = pCur->next; - FreeResource(pCur->clientResource, ClientType); - free((void *)pCur); - } - free((void *)pHead); - eventMask = 0; - return 1; -} - -static int -ProcAppleWMSelectInput(register ClientPtr client) -{ - REQUEST(xAppleWMSelectInputReq); - WMEventPtr pEvent, pNewEvent, *pHead; - XID clientResource; - int i; - - REQUEST_SIZE_MATCH(xAppleWMSelectInputReq); - i = - dixLookupResourceByType((void **)&pHead, eventResource, EventType, - client, - DixWriteAccess); - if (stuff->mask != 0) { - if (i == Success && pHead) { - /* check for existing entry. */ - for (pEvent = *pHead; pEvent; pEvent = pEvent->next) { - if (pEvent->client == client) { - pEvent->mask = stuff->mask; - updateEventMask(pHead); - return Success; - } - } - } - - /* build the entry */ - pNewEvent = (WMEventPtr)malloc(sizeof(WMEventRec)); - if (!pNewEvent) - return BadAlloc; - pNewEvent->next = 0; - pNewEvent->client = client; - pNewEvent->mask = stuff->mask; - /* - * add a resource that will be deleted when - * the client goes away - */ - clientResource = FakeClientID(client->index); - pNewEvent->clientResource = clientResource; - if (!AddResource(clientResource, ClientType, (void *)pNewEvent)) - return BadAlloc; - /* - * create a resource to contain a pointer to the list - * of clients selecting input. This must be indirect as - * the list may be arbitrarily rearranged which cannot be - * done through the resource database. - */ - if (i != Success || !pHead) { - pHead = (WMEventPtr *)malloc(sizeof(WMEventPtr)); - if (!pHead || - !AddResource(eventResource, EventType, (void *)pHead)) { - FreeResource(clientResource, RT_NONE); - return BadAlloc; - } - *pHead = 0; - } - pNewEvent->next = *pHead; - *pHead = pNewEvent; - updateEventMask(pHead); - } - else if (stuff->mask == 0) { - /* delete the interest */ - if (i == Success && pHead) { - pNewEvent = 0; - for (pEvent = *pHead; pEvent; pEvent = pEvent->next) { - if (pEvent->client == client) - break; - pNewEvent = pEvent; - } - if (pEvent) { - FreeResource(pEvent->clientResource, ClientType); - if (pNewEvent) - pNewEvent->next = pEvent->next; - else - *pHead = pEvent->next; - free(pEvent); - updateEventMask(pHead); - } - } - } - else { - client->errorValue = stuff->mask; - return BadValue; - } - return Success; -} - -/* - * deliver the event - */ - -void -AppleWMSendEvent(int type, unsigned int mask, int which, int arg) -{ - WMEventPtr *pHead, pEvent; - xAppleWMNotifyEvent se; - int i; - - i = - dixLookupResourceByType((void **)&pHead, eventResource, EventType, - serverClient, - DixReadAccess); - if (i != Success || !pHead) - return; - for (pEvent = *pHead; pEvent; pEvent = pEvent->next) { - if ((pEvent->mask & mask) == 0) - continue; - se.type = type + WMEventBase; - se.kind = which; - se.arg = arg; - se.time = currentTime.milliseconds; - WriteEventsToClient(pEvent->client, 1, (xEvent *)&se); - } -} - -/* Safe to call from any thread. */ -unsigned int -AppleWMSelectedEvents(void) -{ - return eventMask; -} - -/* general utility functions */ - -static int -ProcAppleWMDisableUpdate(register ClientPtr client) -{ - REQUEST_SIZE_MATCH(xAppleWMDisableUpdateReq); - - appleWMProcs->DisableUpdate(); - - return Success; -} - -static int -ProcAppleWMReenableUpdate(register ClientPtr client) -{ - REQUEST_SIZE_MATCH(xAppleWMReenableUpdateReq); - - appleWMProcs->EnableUpdate(); - - return Success; -} - -/* window functions */ - -static int -ProcAppleWMSetWindowMenu(register ClientPtr client) -{ - const char *bytes, **items; - char *shortcuts; - int max_len, nitems, i, j; - REQUEST(xAppleWMSetWindowMenuReq); - - REQUEST_AT_LEAST_SIZE(xAppleWMSetWindowMenuReq); - - nitems = stuff->nitems; - items = malloc(sizeof(char *) * nitems); - shortcuts = malloc(sizeof(char) * nitems); - - if (!items || !shortcuts) { - free(items); - free(shortcuts); - - return BadAlloc; - } - - max_len = (stuff->length << 2) - sizeof(xAppleWMSetWindowMenuReq); - bytes = (char *)&stuff[1]; - - for (i = j = 0; i < max_len && j < nitems;) { - shortcuts[j] = bytes[i++]; - items[j++] = bytes + i; - - while (i < max_len) - { - if (bytes[i++] == 0) - break; - } - } - - /* Check if we bailed out of the above loop due to a request that was too long */ - if (j < nitems) { - free(items); - free(shortcuts); - - return BadRequest; - } - - X11ApplicationSetWindowMenu(nitems, items, shortcuts); - free(items); - free(shortcuts); - - return Success; -} - -static int -ProcAppleWMSetWindowMenuCheck(register ClientPtr client) -{ - REQUEST(xAppleWMSetWindowMenuCheckReq); - - REQUEST_SIZE_MATCH(xAppleWMSetWindowMenuCheckReq); - X11ApplicationSetWindowMenuCheck(stuff->index); - return Success; -} - -static int -ProcAppleWMSetFrontProcess(register ClientPtr client) -{ - REQUEST_SIZE_MATCH(xAppleWMSetFrontProcessReq); - - X11ApplicationSetFrontProcess(); - return Success; -} - -static int -ProcAppleWMSetWindowLevel(register ClientPtr client) -{ - REQUEST(xAppleWMSetWindowLevelReq); - WindowPtr pWin; - int err; - - REQUEST_SIZE_MATCH(xAppleWMSetWindowLevelReq); - - if (Success != dixLookupWindow(&pWin, stuff->window, client, - DixReadAccess)) - return BadValue; - - if (stuff->level >= AppleWMNumWindowLevels) { - return BadValue; - } - - err = appleWMProcs->SetWindowLevel(pWin, stuff->level); - if (err != Success) { - return err; - } - - return Success; -} - -static int -ProcAppleWMSendPSN(register ClientPtr client) -{ - REQUEST(xAppleWMSendPSNReq); - int err; - - REQUEST_SIZE_MATCH(xAppleWMSendPSNReq); - - if (!appleWMProcs->SendPSN) - return BadRequest; - - err = appleWMProcs->SendPSN(stuff->psn_hi, stuff->psn_lo); - if (err != Success) { - return err; - } - - return Success; -} - -static int -ProcAppleWMAttachTransient(register ClientPtr client) -{ - WindowPtr pWinChild, pWinParent; - REQUEST(xAppleWMAttachTransientReq); - int err; - - REQUEST_SIZE_MATCH(xAppleWMAttachTransientReq); - - if (!appleWMProcs->AttachTransient) - return BadRequest; - - if (Success != - dixLookupWindow(&pWinChild, stuff->child, client, DixReadAccess)) - return BadValue; - - if (stuff->parent) { - if (Success != - dixLookupWindow(&pWinParent, stuff->parent, client, DixReadAccess)) - return BadValue; - } - else { - pWinParent = NULL; - } - - err = appleWMProcs->AttachTransient(pWinChild, pWinParent); - if (err != Success) { - return err; - } - - return Success; -} - -static int -ProcAppleWMSetCanQuit(register ClientPtr client) -{ - REQUEST(xAppleWMSetCanQuitReq); - - REQUEST_SIZE_MATCH(xAppleWMSetCanQuitReq); - - X11ApplicationSetCanQuit(stuff->state); - return Success; -} - -/* frame functions */ - -static int -ProcAppleWMFrameGetRect(register ClientPtr client) -{ - xAppleWMFrameGetRectReply rep; - BoxRec ir, or, rr; - REQUEST(xAppleWMFrameGetRectReq); - - REQUEST_SIZE_MATCH(xAppleWMFrameGetRectReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - ir = make_box(stuff->ix, stuff->iy, stuff->iw, stuff->ih); - or = make_box(stuff->ox, stuff->oy, stuff->ow, stuff->oh); - - if (appleWMProcs->FrameGetRect(stuff->frame_rect, - stuff->frame_class, - &or, &ir, &rr) != Success) { - return BadValue; - } - - rep.x = rr.x1; - rep.y = rr.y1; - rep.w = rr.x2 - rr.x1; - rep.h = rr.y2 - rr.y1; - - WriteToClient(client, sizeof(xAppleWMFrameGetRectReply),&rep); - return Success; -} - -static int -ProcAppleWMFrameHitTest(register ClientPtr client) -{ - xAppleWMFrameHitTestReply rep; - BoxRec ir, or; - int ret; - REQUEST(xAppleWMFrameHitTestReq); - - REQUEST_SIZE_MATCH(xAppleWMFrameHitTestReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - ir = make_box(stuff->ix, stuff->iy, stuff->iw, stuff->ih); - or = make_box(stuff->ox, stuff->oy, stuff->ow, stuff->oh); - - if (appleWMProcs->FrameHitTest(stuff->frame_class, stuff->px, - stuff->py, &or, &ir, &ret) != Success) { - return BadValue; - } - - rep.ret = ret; - - WriteToClient(client, sizeof(xAppleWMFrameHitTestReply),&rep); - return Success; -} - -static int -ProcAppleWMFrameDraw(register ClientPtr client) -{ - BoxRec ir, or; - unsigned int title_length, title_max; - unsigned char *title_bytes; - REQUEST(xAppleWMFrameDrawReq); - WindowPtr pWin; - - REQUEST_AT_LEAST_SIZE(xAppleWMFrameDrawReq); - - if (Success != dixLookupWindow(&pWin, stuff->window, client, - DixReadAccess)) - return BadValue; - - ir = make_box(stuff->ix, stuff->iy, stuff->iw, stuff->ih); - or = make_box(stuff->ox, stuff->oy, stuff->ow, stuff->oh); - - title_length = stuff->title_length; - title_max = (stuff->length << 2) - sizeof(xAppleWMFrameDrawReq); - - if (title_max < title_length) - return BadValue; - - title_bytes = (unsigned char *)&stuff[1]; - - errno = appleWMProcs->FrameDraw(pWin, stuff->frame_class, - stuff->frame_attr, &or, &ir, - title_length, title_bytes); - if (errno != Success) { - return errno; - } - - return Success; -} - -/* dispatch */ - -static int -ProcAppleWMDispatch(register ClientPtr client) -{ - REQUEST(xReq); - - switch (stuff->data) { - case X_AppleWMQueryVersion: - return ProcAppleWMQueryVersion(client); - } - - if (!client->local) - return WMErrorBase + AppleWMClientNotLocal; - - switch (stuff->data) { - case X_AppleWMSelectInput: - return ProcAppleWMSelectInput(client); - - case X_AppleWMDisableUpdate: - return ProcAppleWMDisableUpdate(client); - - case X_AppleWMReenableUpdate: - return ProcAppleWMReenableUpdate(client); - - case X_AppleWMSetWindowMenu: - return ProcAppleWMSetWindowMenu(client); - - case X_AppleWMSetWindowMenuCheck: - return ProcAppleWMSetWindowMenuCheck(client); - - case X_AppleWMSetFrontProcess: - return ProcAppleWMSetFrontProcess(client); - - case X_AppleWMSetWindowLevel: - return ProcAppleWMSetWindowLevel(client); - - case X_AppleWMSetCanQuit: - return ProcAppleWMSetCanQuit(client); - - case X_AppleWMFrameGetRect: - return ProcAppleWMFrameGetRect(client); - - case X_AppleWMFrameHitTest: - return ProcAppleWMFrameHitTest(client); - - case X_AppleWMFrameDraw: - return ProcAppleWMFrameDraw(client); - - case X_AppleWMSendPSN: - return ProcAppleWMSendPSN(client); - - case X_AppleWMAttachTransient: - return ProcAppleWMAttachTransient(client); - - default: - return BadRequest; - } -} - -static void -SNotifyEvent(xAppleWMNotifyEvent *from, xAppleWMNotifyEvent *to) -{ - to->type = from->type; - to->kind = from->kind; - cpswaps(from->sequenceNumber, to->sequenceNumber); - cpswapl(from->time, to->time); - cpswapl(from->arg, to->arg); -} - -static int -SProcAppleWMQueryVersion(register ClientPtr client) -{ - REQUEST(xAppleWMQueryVersionReq); - swaps(&stuff->length); - return ProcAppleWMQueryVersion(client); -} - -static int -SProcAppleWMDispatch(register ClientPtr client) -{ - REQUEST(xReq); - - /* It is bound to be non-local when there is byte swapping */ - if (!client->local) - return WMErrorBase + AppleWMClientNotLocal; - - /* only local clients are allowed WM access */ - switch (stuff->data) { - case X_AppleWMQueryVersion: - return SProcAppleWMQueryVersion(client); - - default: - return BadRequest; - } -} - -void -AppleWMExtensionInit(AppleWMProcsPtr procsPtr) -{ - ExtensionEntry* extEntry; - - ClientType = CreateNewResourceType(WMFreeClient, "WMClient"); - EventType = CreateNewResourceType(WMFreeEvents, "WMEvent"); - eventResource = FakeClientID(0); - - if (ClientType && EventType && - (extEntry = AddExtension(APPLEWMNAME, - AppleWMNumberEvents, - AppleWMNumberErrors, - ProcAppleWMDispatch, - SProcAppleWMDispatch, - NULL, - StandardMinorOpcode))) { - size_t i; - WMReqCode = (unsigned char)extEntry->base; - WMErrorBase = extEntry->errorBase; - WMEventBase = extEntry->eventBase; - for (i = 0; i < AppleWMNumberEvents; i++) - EventSwapVector[WMEventBase + i] = (EventSwapPtr)SNotifyEvent; - appleWMProcs = procsPtr; - } -} diff --git a/hw/xquartz/applewmExt.h b/hw/xquartz/applewmExt.h deleted file mode 100644 index 9a8b8d639..000000000 --- a/hw/xquartz/applewmExt.h +++ /dev/null @@ -1,86 +0,0 @@ -/* External interface for the server's AppleWM support - * - * Copyright (c) 2003-2004 Torrey T. Lyons. All Rights Reserved. - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifndef _APPLEWMEXT_H_ -#define _APPLEWMEXT_H_ - -#include "window.h" -#include - -typedef int (*DisableUpdateProc)(void); -typedef int (*EnableUpdateProc)(void); -typedef int (*SetWindowLevelProc)(WindowPtr pWin, int level); -typedef int (*FrameGetRectProc)(xp_frame_rect type, xp_frame_class class, - const BoxRec *outer, - const BoxRec *inner, BoxRec *ret); -typedef int (*FrameHitTestProc)(xp_frame_class class, int x, int y, - const BoxRec *outer, - const BoxRec *inner, int *ret); -typedef int (*FrameDrawProc)(WindowPtr pWin, xp_frame_class class, - xp_frame_attr attr, - const BoxRec *outer, const BoxRec *inner, - unsigned int title_len, - const unsigned char *title_bytes); -typedef int (*SendPSNProc)(uint32_t hi, uint32_t lo); -typedef int (*AttachTransientProc)(WindowPtr pWinChild, WindowPtr pWinParent); - -/* - * AppleWM implementation function list - */ -typedef struct _AppleWMProcs { - DisableUpdateProc DisableUpdate; - EnableUpdateProc EnableUpdate; - SetWindowLevelProc SetWindowLevel; - FrameGetRectProc FrameGetRect; - FrameHitTestProc FrameHitTest; - FrameDrawProc FrameDraw; - SendPSNProc SendPSN; - AttachTransientProc AttachTransient; -} AppleWMProcsRec, *AppleWMProcsPtr; - -void -AppleWMExtensionInit(AppleWMProcsPtr procsPtr); - -void -AppleWMSetScreenOrigin(WindowPtr pWin); - -Bool -AppleWMDoReorderWindow(WindowPtr pWin); - -void -AppleWMSendEvent(int /* type */, unsigned int /* mask */, int /* which */, - int /* arg */ - ); - -unsigned int -AppleWMSelectedEvents(void); - -#endif /* _APPLEWMEXT_H_ */ diff --git a/hw/xquartz/bundle/.gitignore b/hw/xquartz/bundle/.gitignore deleted file mode 100644 index 4e432c232..000000000 --- a/hw/xquartz/bundle/.gitignore +++ /dev/null @@ -1 +0,0 @@ -Info.plist diff --git a/hw/xquartz/bundle/Info.plist.cpp b/hw/xquartz/bundle/Info.plist.cpp deleted file mode 100644 index f576f7eb5..000000000 --- a/hw/xquartz/bundle/Info.plist.cpp +++ /dev/null @@ -1,76 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - X11 - CFBundleGetInfoString - BUNDLE_ID_PREFIX.X11 - CFBundleIconFile - X11.icns - CFBundleIdentifier - BUNDLE_ID_PREFIX.X11 - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - APPLE_APPLICATION_NAME - CFBundlePackageType - APPL - CFBundleShortVersionString - BUNDLE_VERSION_STRING - CFBundleVersion - BUNDLE_VERSION - CFBundleSignature - x11a - CSResourcesFileMapped - - NSSupportsAutomaticGraphicsSwitching - - - - NSAppleEventsUsageDescription - A process launched by APPLE_APPLICATION_NAME wants to use AppleScript. - NSCalendarsUsageDescription - A process launched by APPLE_APPLICATION_NAME wants access to your calendar data. - NSCameraUsageDescription - A process launched by APPLE_APPLICATION_NAME wants access to your camera. - NSContactsUsageDescription - A process launched by APPLE_APPLICATION_NAME wants access to your contacts. - NSLocationAlwaysUsageDescription - A process launched by APPLE_APPLICATION_NAME wants access to your location information, even when not in use. - NSLocationUsageDescription - A process launched by APPLE_APPLICATION_NAME wants access to your location information. - NSLocationWhenInUseUsageDescription - A process launched by APPLE_APPLICATION_NAME wants access to your location information when in use. - NSMicrophoneUsageDescription - A process launched by APPLE_APPLICATION_NAME wants access to your microphone. - NSRemindersUsageDescription - A process launched by APPLE_APPLICATION_NAME wants access to your reminders. - NSSystemAdministrationUsageDescription - A process launched by APPLE_APPLICATION_NAME wants admin privileges. - -#ifdef XQUARTZ_SPARKLE - SUEnableAutomaticChecks - - SUPublicEDKey - XQUARTZ_SPARKLE_PUBLIC_EDKEY - SUFeedURL - XQUARTZ_SPARKLE_FEED_URL -#endif - LSApplicationCategoryType - public.app-category.utilities - NSHumanReadableCopyright - © 2003-2023 Apple Inc. -© 2003 XFree86 Project, Inc. -© 2003-2023 X.org Foundation, Inc. - - NSMainNibFile - main - NSPrincipalClass - X11Application - - diff --git a/hw/xquartz/bundle/PkgInfo b/hw/xquartz/bundle/PkgInfo deleted file mode 100644 index b8e0aec42..000000000 --- a/hw/xquartz/bundle/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPLx11a \ No newline at end of file diff --git a/hw/xquartz/bundle/Resources/Dutch.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/Dutch.lproj/Localizable.strings deleted file mode 100644 index da1315b4f..000000000 Binary files a/hw/xquartz/bundle/Resources/Dutch.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/Dutch.lproj/locversion.plist b/hw/xquartz/bundle/Resources/Dutch.lproj/locversion.plist deleted file mode 100644 index 4e7cd8394..000000000 --- a/hw/xquartz/bundle/Resources/Dutch.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - nl - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/Dutch.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/Dutch.lproj/main.nib/designable.nib deleted file mode 100644 index fbd8bae45..000000000 --- a/hw/xquartz/bundle/Resources/Dutch.lproj/main.nib/designable.nib +++ /dev/null @@ -1,758 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Als u deze optie inschakelt, kan het gebruik van toetscombinaties voor menucommado's conflicteren met X11-programma's die de Meta-modifier gebruiken. - - - - - - - - - - Houd tijdens het klikken de Option- of Command-toets ingedrukt om de middelste muisknop of de rechtermuisknop te activeren. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Schakelt het X11-rootvenster in. Gebruik de toetscombinatie Command + Option + A om de schermvullende weergave te starten en te stoppen. - - - - - - - - - - - - - - - - - - - - - - - - - - - - Schakelt het menuonderdeel 'kopieer' in en maakt synchronisatie mogelijk tussen het klembord van OS X en de CLIPBOARD- en PRIMARY-buffer van X11. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Indien ingeschakeld, wordt bij aanmaak van een nieuw X11-venster X11.app op de voorgrond geplaatst (in plaats van Finder.app, Terminal.app, enz.). - - - - - - - - - - - - - - - - - - - - Wanneer u X11 start, worden er Xauthority-toegangscontrolesleutels aangemaakt. Als het IP-adres van het systeem wordt gewijzigd, worden deze toetsen ongeldig waardoor het mogelijk is dat X11-programma's niet kunnen worden gestart. - - - - - - - - - - Als u deze optie inschakelt, moet 'Voer identiteitscontrole uit voor verbindingen' ook worden ingeschakeld ter beveiliging van het systeem. Als deze optie is uitgeschakeld, worden verbindingen van externe programma's niet toegestaan. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/Dutch.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/Dutch.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 87b027728..000000000 Binary files a/hw/xquartz/bundle/Resources/Dutch.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/Dutch.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/Dutch.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 9dadb5681..000000000 Binary files a/hw/xquartz/bundle/Resources/Dutch.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings deleted file mode 100644 index 36ae0ffb3..000000000 Binary files a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/English.lproj/locversion.plist b/hw/xquartz/bundle/Resources/English.lproj/locversion.plist deleted file mode 100644 index ebc3a0a01..000000000 --- a/hw/xquartz/bundle/Resources/English.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 105 - LprojLocale - en - LprojRevisionLevel - 1 - LprojVersion - 105 - - diff --git a/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib deleted file mode 100644 index 9938c0f43..000000000 --- a/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib +++ /dev/null @@ -1,735 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Hold Option or Command while clicking to activate the middle or right mouse buttons. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - When enabled, clicking on an inactive window will cause that mouse click to pass through to that window in addition to activating it. - - - - - - - - - - - - - - - - - - - - - When enabled, creation of a new X11 window will cause X11.app to move to the foreground (instead of Finder.app, Terminal.app, etc.) - - - - - - - - - - - - - - - - - - - - Launching X11 will create Xauthority access-control keys. If the system's IP address changes, these keys become invalid which may prevent X11 applications from launching. - - - - - - - - - - If enabled, Authenticate connections must also be enabled to ensure system security. When disabled, connections from remote applications are not allowed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 2b14fc012..000000000 Binary files a/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 11e1d9ce8..000000000 Binary files a/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/French.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/French.lproj/Localizable.strings deleted file mode 100644 index b7ac2a825..000000000 Binary files a/hw/xquartz/bundle/Resources/French.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/French.lproj/locversion.plist b/hw/xquartz/bundle/Resources/French.lproj/locversion.plist deleted file mode 100644 index 04031c436..000000000 --- a/hw/xquartz/bundle/Resources/French.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106 - LprojLocale - fr - LprojRevisionLevel - 1 - LprojVersion - 106 - - diff --git a/hw/xquartz/bundle/Resources/French.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/French.lproj/main.nib/designable.nib deleted file mode 100644 index 8ef2213b9..000000000 --- a/hw/xquartz/bundle/Resources/French.lproj/main.nib/designable.nib +++ /dev/null @@ -1,760 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Quand cette option est activée, les raccourcis système (ex. ⌘Q) qui gênent parfois les applications X11 ne sont pas interprétés localement, mais transmis en l'état à X11. - - - - - - - - - - Maintenez la touche Option ou Commande enfoncée tout en cliquant pour activer le bouton droit ou central de la souris. - - - - - - - - - - - - - - - - - - - - - - - - Quand cette option est activée, les modifications du menu d’entrée pour remplacer la disposition des touches du clavier à prise en compte par X11. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Active la commande de menu « Copier » et permet la synchronisation entre le presse-papiers de OSX, celui de X11 (CLIPBOARD) et les mémoires tampons principales (PRIMARY). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - En cas d’activation de cette option, si vous cliquez sur une fenêtre inactive, celle-ci deviendra active et le clic sera effectif. - - - - - - - - - - - - - - - - - - - - - Lorsque cette option est activée, la création d’une nouvelle fenêtre X11 fait passer X11.app au premier plan (au lieu de Finder.app, Terminal.app, etc.) - - - - - - - - - - - - - - - - - - - - Le lancement d’X11 créera des touches de contrôle d’accès Xauthority. Si l’adresse IP du système change, ces touches ne seront plus valides, ce qui risquera d’empêcher le lancement des applications X11. - - - - - - - - - - En cas d’activation de cette option, « Authentifier les connexions » doit aussi être activée pour garantir la sécurité du système. En cas de désactivation, les connexions à partir d’applications distantes sont interdites. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index d81fadbe0..000000000 Binary files a/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index b2e1634ff..000000000 Binary files a/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/German.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/German.lproj/Localizable.strings deleted file mode 100644 index 81a88488f..000000000 Binary files a/hw/xquartz/bundle/Resources/German.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/German.lproj/locversion.plist b/hw/xquartz/bundle/Resources/German.lproj/locversion.plist deleted file mode 100644 index 62820e18b..000000000 --- a/hw/xquartz/bundle/Resources/German.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106 - LprojLocale - de - LprojRevisionLevel - 1 - LprojVersion - 106 - - diff --git a/hw/xquartz/bundle/Resources/German.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/German.lproj/main.nib/designable.nib deleted file mode 100644 index dc11b6423..000000000 --- a/hw/xquartz/bundle/Resources/German.lproj/main.nib/designable.nib +++ /dev/null @@ -1,758 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Halten Sie beim Klicken die Wahltaste oder die Befehlstaste gedrückt, um die mittlere oder die rechte Maustaste zu aktivieren. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Hiermit wird das X11-Hauptfenster aktiviert. Verwenden Sie die Tastenkombination Befehl+Wahl+A, um den Vollbildmodus ein- oder auszuschalten. - - - - - - - - - - - - - - - - - - - - - - - - - - - - Aktiviert das Menüobjekt „Kopieren“ und ermöglicht die Synchronisierung zwischen dem „OSX Pasteboard“ und den Pufferspeichern „CLIPBOARD“ und „PRIMARY“ von X11. - - - - - - - - - - - - - - Deaktivieren Sie diese Option, wenn Sie „xclipboard“, „klipper“ oder einen beliebigen anderen X11-Zwischenablage-Manager verwenden möchten. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Bei Aktivierung wird beim Erzeugen eines neuen X11-Fensters das „X11.app“ in den Vordergrund gebracht (anstelle von „Finder.app“, „Terminal.app“ usw.). - - - - - - - - - - - - - - - - - - - - Beim Starten von X11 werden Xauthority-Schlüssel zur Zugriffskontrolle erstellt. Wenn sich die IP-Adresse des Systems ändert, sind diese Schlüssel nicht mehr gültig. Möglicherweise können die X11-Programme dann nicht mehr gestartet werden. - - - - - - - - - - Bei Aktivierung muss „Verbindungen authentifizieren“ ebenfalls aktiviert sein, damit die Sicherheit des System gewährleistet ist. Bei Deaktivierung sind Verbindungen von entfernten Programmen nicht erlaubt. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index e959734f0..000000000 Binary files a/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index c7bbe16df..000000000 Binary files a/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/Italian.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/Italian.lproj/Localizable.strings deleted file mode 100644 index e4a7b16fa..000000000 Binary files a/hw/xquartz/bundle/Resources/Italian.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/Italian.lproj/locversion.plist b/hw/xquartz/bundle/Resources/Italian.lproj/locversion.plist deleted file mode 100644 index ce31174cc..000000000 --- a/hw/xquartz/bundle/Resources/Italian.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - it - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/Italian.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/Italian.lproj/main.nib/designable.nib deleted file mode 100644 index 22ccc95d1..000000000 --- a/hw/xquartz/bundle/Resources/Italian.lproj/main.nib/designable.nib +++ /dev/null @@ -1,758 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Se abilitati, gli equivalenti da tastiera della barra dei menu potrebbero interferire con le applicazioni X11 che utilizzano il modificatore Meta. - - - - - - - - - - Per attivare il pulsante destro o quello centrale del mouse, fai clic tenendo premuto il pulsante Opzione o il pulsante Comando. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Abilita la finestra root di X11. Utilizza la combinazione di tasti Comando-Opzione-A per attivare e disattivare la modalità a tutto schermo. - - - - - - - - - - La barra dei menu diventa visibile quando il cursore del mouse viene posizionato nella parte superiore dello schermo principale. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Quando il riquadro è attivato, la creazione di una nuova finestra di X11 farà spostare X11.app in primo piano (invece di Finder.app, Terminal.app, etc.) - - - - - - - - - - - - - - - - - - - - All'avvio di X11 verranno create le chiavi Xauthority per il controllo d'accesso. Se l'indirizzo IP del sistema cambia, tali chiavi non sono più valide. Questa situazione potrebbe bloccare l'avvio delle applicazioni X11. - - - - - - - - - - Se possibile, per garantire la sicurezza del sistema deve essere inoltre abilitata la funzione Autentica connessioni. Quando questa funzione non è attiva, non sono consentite le connessioni dalle applicazioni remote. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/Italian.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/Italian.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 961fb08b4..000000000 Binary files a/hw/xquartz/bundle/Resources/Italian.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/Italian.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/Italian.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index a0ecb7c20..000000000 Binary files a/hw/xquartz/bundle/Resources/Italian.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/Japanese.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/Japanese.lproj/Localizable.strings deleted file mode 100644 index 9c5e08745..000000000 Binary files a/hw/xquartz/bundle/Resources/Japanese.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/Japanese.lproj/locversion.plist b/hw/xquartz/bundle/Resources/Japanese.lproj/locversion.plist deleted file mode 100644 index 4dce0add7..000000000 --- a/hw/xquartz/bundle/Resources/Japanese.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - ja - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/designable.nib deleted file mode 100644 index 72cbd4840..000000000 --- a/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/designable.nib +++ /dev/null @@ -1,752 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Option キーを押したままクリックするとマウスの中ボタン操作になり、Command キーを押したままクリックするとマウスの右ボタン操作になります。 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 6db6eac51..000000000 Binary files a/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index e0b6c160d..000000000 Binary files a/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/Spanish.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/Spanish.lproj/Localizable.strings deleted file mode 100644 index e81452da8..000000000 Binary files a/hw/xquartz/bundle/Resources/Spanish.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/Spanish.lproj/locversion.plist b/hw/xquartz/bundle/Resources/Spanish.lproj/locversion.plist deleted file mode 100644 index fc289ea3c..000000000 --- a/hw/xquartz/bundle/Resources/Spanish.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - es - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/Spanish.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/Spanish.lproj/main.nib/designable.nib deleted file mode 100644 index 0758d9432..000000000 --- a/hw/xquartz/bundle/Resources/Spanish.lproj/main.nib/designable.nib +++ /dev/null @@ -1,758 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cuando esta opción está activada, puede que los equivalentes de teclado de la barra de menús interfieran con las aplicaciones X11 que usen el modificador Meta. - - - - - - - - - - Mantenga pulsadas las teclas Opción o Comando al hacer clic para activar el botón central o derecho del ratón. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Activa la ventana raíz de X11. Use la combinación de teclas Comando + Opción + A para entrar o salir de la modalidad de pantalla completa. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cuando está activada, al hacer clic en una ventana inactiva, la ventana se activa y además el clic del ratón se transmite a ella. - - - - - - - - - - - - - - - - - - - - - Cuando está activada, al crear una nueva ventana de X11 el archivo X11.app se sitúa en primer plano (por encima de Finder.app, Terminal.app, etc.) - - - - - - - - - - - - - - - - - - - - Al iniciar X11 se crearán unas claves de control de acceso Xauthority. Si la dirección IP del sistema cambia, estas claves dejarán de ser válidas, lo que impediría que pudiesen ejecutarse las aplicaciones X11. - - - - - - - - - - Si esta opción está activada, la opción “Autenticar conexiones” también debe estarlo para garantizar la seguridad del sistema. Si está desactivada, las conexiones de aplicaciones remotas no están permitidas. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/Spanish.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/Spanish.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index ef45ac3b1..000000000 Binary files a/hw/xquartz/bundle/Resources/Spanish.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/Spanish.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/Spanish.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 8b9993cc5..000000000 Binary files a/hw/xquartz/bundle/Resources/Spanish.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/X11.icns b/hw/xquartz/bundle/Resources/X11.icns deleted file mode 100644 index d9d2f7696..000000000 Binary files a/hw/xquartz/bundle/Resources/X11.icns and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ar.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/ar.lproj/Localizable.strings deleted file mode 100644 index c6eab3bc2..000000000 Binary files a/hw/xquartz/bundle/Resources/ar.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ar.lproj/locversion.plist b/hw/xquartz/bundle/Resources/ar.lproj/locversion.plist deleted file mode 100644 index 0279b09ec..000000000 --- a/hw/xquartz/bundle/Resources/ar.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - ar - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/ar.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/ar.lproj/main.nib/designable.nib deleted file mode 100644 index 85fa95292..000000000 --- a/hw/xquartz/bundle/Resources/ar.lproj/main.nib/designable.nib +++ /dev/null @@ -1,754 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - يؤدي بدء تشغيل X11 إلى إنشاء مفاتيح تحكم في وصول Xauthority. في حالة تغيير عنوان IP للنظام، تصبح هذه المفاتيح غير صالحة، مما قد يؤدي إلى الحيلولة دون بدء تشغيل تطبيقات X11. - - - - - - - - - - في حالة التمكين، يجب أيضًا تمكين مصادقة الاتصالات للتأكد من تأمين النظام. وفي حالة التعطيل، لا يتم السماح بالاتصالات من تطبيقات بعيدة. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - اضغط مع الاستمرار على مفتاح الاختيار أو مفتاح الأوامر أثناء النقر لتنشيط زر الماوس الأوسط أو الأيمن. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/ar.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/ar.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index b23a9017b..000000000 Binary files a/hw/xquartz/bundle/Resources/ar.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ar.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/ar.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 4748dbfa6..000000000 Binary files a/hw/xquartz/bundle/Resources/ar.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ca.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/ca.lproj/Localizable.strings deleted file mode 100644 index 5987845aa..000000000 Binary files a/hw/xquartz/bundle/Resources/ca.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ca.lproj/locversion.plist b/hw/xquartz/bundle/Resources/ca.lproj/locversion.plist deleted file mode 100644 index 3088d534c..000000000 --- a/hw/xquartz/bundle/Resources/ca.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.5 - LprojLocale - ca - LprojRevisionLevel - 1 - LprojVersion - 106.5 - - diff --git a/hw/xquartz/bundle/Resources/ca.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/ca.lproj/main.nib/designable.nib deleted file mode 100644 index d5e23a513..000000000 --- a/hw/xquartz/bundle/Resources/ca.lproj/main.nib/designable.nib +++ /dev/null @@ -1,762 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Quan aquesta opció està activada, els equivalents de teclat de la barra de menús poden interferir amb les aplicacions d’X11 que fan servir el modificador Meta. - - - - - - - - - - Manteniu premudes les tecles Opció o Ordre al fer clic per activar el botó central o dret del ratolí. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Activa la finestra arrel d’X11. Feu servir la combinació de tecles Ordre + Opció + A per entrar o sortir del mode de pantalla completa. - - - - - - - - - - - - - - - - - - - - - - - - - - - - Activa l’ítem de menú “copiar” i permet sincronitzar el porta-retalls d’OSX amb les memòries intermèdies CLIPBOARD i PRIMARY d’X11. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Quan aquesta opció està activada, un clic del ratolí en una finestra inactiva fa que el clic passi a aquesta finestra, a més d’activar-la. - - - - - - - - - - - - - - - - - - - - - Quan aquesta opció està activada, la creació d’una nova finestra d’X11 farà que X11.app es traslladi a primer pla (per damunt de Finder.app, Terminal.app, etc.) - - - - - - - - - - - - - - - - - - - - A l’iniciar X11 es crearan claus de control d’accés Xauthority. Si l’adreça IP del sistema canvia, aquestes claus deixaran de ser vàlides i això pot impedir que s’executin aplicacions d’X11. - - - - - - - - - - Si aquesta opció està activada, també ho ha d’estar l’opció “Autenticar les connexions” per garantir la seguretat del sistema. Si està desactivada, les connexions d’aplicacions remotes no estaran permeses. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/ca.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/ca.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 4b3838bf9..000000000 Binary files a/hw/xquartz/bundle/Resources/ca.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ca.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/ca.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 425307b38..000000000 Binary files a/hw/xquartz/bundle/Resources/ca.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/cs.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/cs.lproj/Localizable.strings deleted file mode 100644 index c08746ab9..000000000 Binary files a/hw/xquartz/bundle/Resources/cs.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/cs.lproj/locversion.plist b/hw/xquartz/bundle/Resources/cs.lproj/locversion.plist deleted file mode 100644 index 0fdef592c..000000000 --- a/hw/xquartz/bundle/Resources/cs.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.5 - LprojLocale - cs - LprojRevisionLevel - 1 - LprojVersion - 106.5 - - diff --git a/hw/xquartz/bundle/Resources/cs.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/cs.lproj/main.nib/designable.nib deleted file mode 100644 index 61511e9ad..000000000 --- a/hw/xquartz/bundle/Resources/cs.lproj/main.nib/designable.nib +++ /dev/null @@ -1,760 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Je-li tato volba povolena, mohou vznikat konflikty mezi klávesovými ekvivalenty řádku nabídek a aplikacemi X11, které používají modifikátor Meta. - - - - - - - - - - Prostřední a pravé tlačítko myši aktivujete přidržením klávesy Alt nebo Cmd při kliknutí. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Povoluje položku nabídky „Kopírovat“ a umožňuje synchronizaci mezi schránkou systému OS X a buffery CLIPBOARD a PRIMARY prostředí X11. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Je-li tato volba povolena, při kliknutí na neaktivní okno nebude toto okno pouze aktivováno, ale kliknutí mu navíc bude předáno. - - - - - - - - - - - - - - - - - - - - - Je-li tato volba povolena, při vytvoření nového okna prostředí X11 se do popředí dostane proces X11.app (nikoli Finder.app, Terminal.app apod.). - - - - - - - - - - - - - - - - - - - - Spuštěním prostředí X11 vytvoříte klíče řízení přístupu Xauthority. Změní-li se IP adresa systému, tyto klíče přestanou platit, což může zabránit spuštění aplikací prostředí X11. - - - - - - - - - - Je-li tato volba povolena, je třeba v zájmu bezpečnosti systému povolit také ověřování připojení. Je-li zakázána, není vzdáleným aplikacím umožněno připojit se. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/cs.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/cs.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 360b1c832..000000000 Binary files a/hw/xquartz/bundle/Resources/cs.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/cs.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/cs.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index dab78899c..000000000 Binary files a/hw/xquartz/bundle/Resources/cs.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/da.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/da.lproj/Localizable.strings deleted file mode 100644 index 5e27e7022..000000000 Binary files a/hw/xquartz/bundle/Resources/da.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/da.lproj/locversion.plist b/hw/xquartz/bundle/Resources/da.lproj/locversion.plist deleted file mode 100644 index 5208df7fe..000000000 --- a/hw/xquartz/bundle/Resources/da.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - da - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/da.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/da.lproj/main.nib/designable.nib deleted file mode 100644 index 2c0de373a..000000000 --- a/hw/xquartz/bundle/Resources/da.lproj/main.nib/designable.nib +++ /dev/null @@ -1,758 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Hold Alternativ- eller Kommandotasten nede, mens du klikker, for at aktivere den midterste eller den højre knap på musen. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Slår kommandoen "kopier" til og gør det muligt at synkronisere mellem OSX-opslagstavlen og X11-UDKLIPSHOLDEREN og de PRIMÆRE buffere. - - - - - - - - - - - - - - Slå denne indstilling fra, hvis du ikke vil bruge xclipboard, klipper eller andre X11-værktøjer til administration af udklipsholderen. - - - - - - - - - - - - - - - - - - - - - - - - - - - - Når denne mulighed er slået til, vil musen, når du klikker på et passivt vindue, klikke igennem vinduet ud over at gøre det aktivt. - - - - - - - - - - - - - - - - - - - - - Når denne mulighed er slået til, vil programmet X11, når der oprettes et nyt X11-vindue, anbringes forrest (i stedet for Finder, Terminal osv.). - - - - - - - - - - - - - - - - - - - - Når X11 startes, oprettes Xauthority-taster til adgangskontrol. Hvis systemets IP-adresse ændres, bliver disse taster ugyldige, og det kan forhindre X11-programmer i at starte. - - - - - - - - - - Hvis de er slået til, skal Godkend forbindelser også slås til for at sikre systemets sikkerhed. Når de er slået fra, tillades forbindelser fra eksterne programmer ikke. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/da.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/da.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 6cb5b698b..000000000 Binary files a/hw/xquartz/bundle/Resources/da.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/da.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/da.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 5fb42914b..000000000 Binary files a/hw/xquartz/bundle/Resources/da.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/el.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/el.lproj/Localizable.strings deleted file mode 100644 index 5ce81c0b8..000000000 Binary files a/hw/xquartz/bundle/Resources/el.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/el.lproj/locversion.plist b/hw/xquartz/bundle/Resources/el.lproj/locversion.plist deleted file mode 100644 index 337af8e75..000000000 --- a/hw/xquartz/bundle/Resources/el.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.5 - LprojLocale - el - LprojRevisionLevel - 1 - LprojVersion - 106.5 - - diff --git a/hw/xquartz/bundle/Resources/el.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/el.lproj/main.nib/designable.nib deleted file mode 100644 index 252f5b8a1..000000000 --- a/hw/xquartz/bundle/Resources/el.lproj/main.nib/designable.nib +++ /dev/null @@ -1,760 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Όταν ενεργοποιηθεί, τα ισοδύναμα πλήκτρα της γραμμής μενού ίσως να παρεμβαίνουν με εφαρμογές X11 που χρησιμοποιούν τον μετατροποποιητή. - - - - - - - - - - Πατήστε παρατεταμένα το πλήκτρο Option ή Command ενώ κάνετε κλικ για να ενεργοποιήσετε το μεσαίο ή το δεξιό κουμπί του ποντικιού. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ενεργοποιεί το παράθυρο ρίζας X11. Χρησιμοποιήστε την κίνηση πλήκτρων Command-Option-A για να εισέλθετε και να εξέλθετε από τη λειτουργία πλήρους οθόνης. - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ενεργοποιεί το στοιχείο μενού «αντιγραφή» και επιτρέπει το συγχρονισμό μεταξύ του Πίνακα επικόλλησης OSX και των ενδιάμεσων μνημών CLIPBOARD και PRIMARY του X11. - - - - - - - - - - - - - - Απενεργοποιήστε αυτή την επιλογή αν θέλετε να χρησιμοποιήσετε xclipboard, klipper ή οποιονδήποτε άλλο διαχειριστή πρόχειρου X11. - - - - - - - - - - - - - - - - - - - - - - - - - - - - Όταν ενεργοποιηθεί, αν κάνετε κλικ σε μη ενεργό παράθυρο, θα προκαλέσει αυτό το κλικ ποντικιού να διαβιβαστεί στο συγκεκριμένο παράθυρο επιπλέον της ενεργοποίησής του. - - - - - - - - - - - - - - - - - - - - - Όταν ενεργοποιηθεί, η δημιουργία νέου παραθύρου X11 θα μετακινήσει το X11.app στο προσκήνιο (αντί για το Finder.app, Terminal.app, κτλ.) - - - - - - - - - - - - - - - - - - - - Η εκκίνηση X11 θα δημιουργήσει πλήκτρα ελέγχου πρόσβασης Xauthority. Αν αλλάξει η διεύθυνση IP του συστήματος, αυτά τα πλήκτρα καθίστανται μη έγκυρα, γεγονός που ίσως να αποτρέψει την εκκίνηση των εφαρμογών X11. - - - - - - - - - - Αν ενεργοποιηθεί, πρέπει επίσης να ενεργοποιηθούν οι συνδέσεις ελέγχου ταυτότητας για να διασφαλιστεί η ασφάλεια συστήματος. Όταν απενεργοποιηθούν, δεν επιτρέπονται οι συνδέσεις από απομακρυσμένες εφαρμογές. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/el.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/el.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 24fb37cf0..000000000 Binary files a/hw/xquartz/bundle/Resources/el.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/el.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/el.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index ac3194c7a..000000000 Binary files a/hw/xquartz/bundle/Resources/el.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/fi.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/fi.lproj/Localizable.strings deleted file mode 100644 index 83cf43259..000000000 Binary files a/hw/xquartz/bundle/Resources/fi.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/fi.lproj/locversion.plist b/hw/xquartz/bundle/Resources/fi.lproj/locversion.plist deleted file mode 100644 index b7d3260e8..000000000 --- a/hw/xquartz/bundle/Resources/fi.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - fi - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/fi.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/fi.lproj/main.nib/designable.nib deleted file mode 100644 index e3edf097e..000000000 --- a/hw/xquartz/bundle/Resources/fi.lproj/main.nib/designable.nib +++ /dev/null @@ -1,755 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Aktivoi hiiren keski- tai oikea painike pitämällä Optio- tai Komento-näppäimiä painettuna osoitettaessa. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ottaa käyttöön Kopioi-valikkokohteen ja mahdollistaa synkronoinnin Mac OS X:n leikepöydän ja X11:n leikepöydän ja ensisijaisen valinnan puskurin välillä. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - X11:n avaaminen luo Xauthority-pääsynhallinta-avaimia. Jos järjestelmän IP-osoite muuttuu, näistä avaimista tulee virheellisiä, mikä saattaa estää X11-ohjelmia avautumasta. - - - - - - - - - - Jos tämä otetaan käyttöön, ”Todenna yhteydet” pitää myös ottaa käyttöön järjestelmän turvallisuuden varmistamiseksi. Kun tämä on pois käytöstä, yhteyksiä etäohjelmista ei sallita. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/fi.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/fi.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 3591949b7..000000000 Binary files a/hw/xquartz/bundle/Resources/fi.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/fi.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/fi.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 89f5b0d6d..000000000 Binary files a/hw/xquartz/bundle/Resources/fi.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/he.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/he.lproj/Localizable.strings deleted file mode 100644 index 4c0920974..000000000 Binary files a/hw/xquartz/bundle/Resources/he.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/he.lproj/locversion.plist b/hw/xquartz/bundle/Resources/he.lproj/locversion.plist deleted file mode 100644 index 6b3a4fd68..000000000 --- a/hw/xquartz/bundle/Resources/he.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.5 - LprojLocale - he - LprojRevisionLevel - 1 - LprojVersion - 106.5 - - diff --git a/hw/xquartz/bundle/Resources/he.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/he.lproj/main.nib/designable.nib deleted file mode 100644 index e56c1adbc..000000000 --- a/hw/xquartz/bundle/Resources/he.lproj/main.nib/designable.nib +++ /dev/null @@ -1,754 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - הפעלה של X11 תיצור מקשי בקרת גישה של Xauthority. אם כתובת ה-IP של המערכת משתנה, מקשים אלו הופכים לבלתי תקינים. דבר זה עלול למנוע הפעלה של יישומי X11. - - - - - - - - - - כאשר התכונה פעילה, יש להפעיל גם אימות חיבורים כדי להבטיח את אבטחת המערכת. כאשר התכונה מבוטלת, חיבורים מיישומים מרוחקים אינם מורשים. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - החזק/י את מקש Option או Command תוך כדי לחיצה כדי להפעיל את כפתור העכבר האמצעי או הימני. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/he.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/he.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 3cc693794..000000000 Binary files a/hw/xquartz/bundle/Resources/he.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/he.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/he.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 797901ca2..000000000 Binary files a/hw/xquartz/bundle/Resources/he.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/hr.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/hr.lproj/Localizable.strings deleted file mode 100644 index cdcb831b9..000000000 Binary files a/hw/xquartz/bundle/Resources/hr.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/hr.lproj/locversion.plist b/hw/xquartz/bundle/Resources/hr.lproj/locversion.plist deleted file mode 100644 index c599a1694..000000000 --- a/hw/xquartz/bundle/Resources/hr.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.5 - LprojLocale - hr - LprojRevisionLevel - 1 - LprojVersion - 106.5 - - diff --git a/hw/xquartz/bundle/Resources/hr.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/hr.lproj/main.nib/designable.nib deleted file mode 100644 index ad65bfd70..000000000 --- a/hw/xquartz/bundle/Resources/hr.lproj/main.nib/designable.nib +++ /dev/null @@ -1,758 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Držite pritisnutu tipku Option ili Command tijekom klikanja kako biste aktivirali srednju ili desnu tipku miša. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Omogućava X11 korijenski prozor. Koristite kombinaciju tipaka Command-Option-A za uključenje i isključenje prikaza preko cijelog zaslona. - - - - - - - - - - - - - - - - - - - - - - - - - - - - Omogućava stavku izbornika "kopiraj" i dozvoljava sinkronizaciju između OSX memorijskog pretinca i X11 MEMORIJSKOG PRETINCA i PRIMARNIH međumemorija. - - - - - - - - - - - - - - Onemogućite ovu opciju ako želite koristiti xclipboard, klipper ili bilo koji drugi alat za upravljanje X11 memorijskim pretincem. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Kad je omogućeno, izradom novog X11 prozora, aplikacija X11.app premjestit će se u prvi plan (umjesto Finder.app, Terminal.app, itd.) - - - - - - - - - - - - - - - - - - - - Pokrenete li X11, izradit će se Xauthority tipke za kontrolu pristupa. Promijeni li se IP adresa sustava, ove tipke postat će nevažeće i to može spriječiti pokretanje X11 aplikacija. - - - - - - - - - - Omogućite li ovu opciju, također trebate omogućiti autorizaciju povezivanja kako bi se osigurala zaštita sustava. Kad je onemogućeno, povezivanja iz udaljenih aplikacija nisu dozvoljena. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/hr.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/hr.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 135e47552..000000000 Binary files a/hw/xquartz/bundle/Resources/hr.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/hr.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/hr.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 141a29dc7..000000000 Binary files a/hw/xquartz/bundle/Resources/hr.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/hu.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/hu.lproj/Localizable.strings deleted file mode 100644 index 368e5ef1f..000000000 Binary files a/hw/xquartz/bundle/Resources/hu.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/hu.lproj/locversion.plist b/hw/xquartz/bundle/Resources/hu.lproj/locversion.plist deleted file mode 100644 index bbc165286..000000000 --- a/hw/xquartz/bundle/Resources/hu.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.5 - LprojLocale - hu - LprojRevisionLevel - 1 - LprojVersion - 106.5 - - diff --git a/hw/xquartz/bundle/Resources/hu.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/hu.lproj/main.nib/designable.nib deleted file mode 100644 index fd75ba8bb..000000000 --- a/hw/xquartz/bundle/Resources/hu.lproj/main.nib/designable.nib +++ /dev/null @@ -1,759 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Kattintás közben tartsa lenyomva az Alt vagy a Command billentyűt a középső vagy a jobb oldali egérgomb aktiválásához. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Engedélyezi az X11 gyökérablakát. A teljes képernyős módba lépéshez, illetve az abból való kilépéshez nyomja le a Command-Alt-A billentyűket. - - - - - - - - - - - - - - - - - - - - - - - - - - - - Engedélyezi a "másolás" menüelemet, és lehetővé teszi az OSX illesztőlap, illetve az X11 VÁGÓLAP és az ELSŐDLEGES pufferek közötti szinkronizálást. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ha engedélyezve van, egy új X11 ablak létrehozása az X11.app ablak előtérbe helyezését eredményezi (a Finder.app, Terminal.app stb. helyett) - - - - - - - - - - - - - - - - - - - - Az X11 elindítása Xauthority hozzáférés-vezérlő billentyűket hoz létre. Ha a rendszer IP-címe módosul, ezek a billentyűk érvénytelenné válnak, és így az X11 alkalmazások sem indulnak el. - - - - - - - - - - Ha engedélyezve van, a Kapcsolatok hitelesítése funkciót szintén engedélyezni kell a rendszerbiztonság érdekében. Ha le van tiltva, a távoli alkalmazásokról származó kapcsolatok nincsenek engedélyezve. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/hu.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/hu.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 7faea00f6..000000000 Binary files a/hw/xquartz/bundle/Resources/hu.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/hu.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/hu.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 0b497a7d7..000000000 Binary files a/hw/xquartz/bundle/Resources/hu.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ko.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/ko.lproj/Localizable.strings deleted file mode 100644 index ba3bd7e03..000000000 Binary files a/hw/xquartz/bundle/Resources/ko.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ko.lproj/locversion.plist b/hw/xquartz/bundle/Resources/ko.lproj/locversion.plist deleted file mode 100644 index 13e94c508..000000000 --- a/hw/xquartz/bundle/Resources/ko.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - ko - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/ko.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/ko.lproj/main.nib/designable.nib deleted file mode 100644 index 2b8e368b0..000000000 --- a/hw/xquartz/bundle/Resources/ko.lproj/main.nib/designable.nib +++ /dev/null @@ -1,752 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 마우스 중간 또는 오른쪽 버튼을 활성화하려면, 클릭하는 동안 Option 또는 Command 키를 함께 누르고 있으십시오. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/ko.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/ko.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 65043025b..000000000 Binary files a/hw/xquartz/bundle/Resources/ko.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ko.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/ko.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 041240a6b..000000000 Binary files a/hw/xquartz/bundle/Resources/ko.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/no.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/no.lproj/Localizable.strings deleted file mode 100644 index 9281516ac..000000000 Binary files a/hw/xquartz/bundle/Resources/no.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/no.lproj/locversion.plist b/hw/xquartz/bundle/Resources/no.lproj/locversion.plist deleted file mode 100644 index b714e1aba..000000000 --- a/hw/xquartz/bundle/Resources/no.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - no - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/no.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/no.lproj/main.nib/designable.nib deleted file mode 100644 index 077f5cf54..000000000 --- a/hw/xquartz/bundle/Resources/no.lproj/main.nib/designable.nib +++ /dev/null @@ -1,756 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Hold nede Tilvalg- eller Kommando-tasten mens du klikker for å aktivere den midtre eller høyre museknappen. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Når denne funksjonen er aktivert, registreres museklikk i inaktive vinduer når du klikker i dem, i tillegg til at vinduene aktiveres. - - - - - - - - - - - - - - - - - - - - - Når denne funksjonen er aktivert, legges X11.app øverst (i stedet for Finder.app, Terminal.app osv.) når du oppretter et nytt X11-vindu. - - - - - - - - - - - - - - - - - - - - Når du starter X11, opprettes det Xauthority-tilgangskontrolltaster. Hvis maskinens IP-adresse endres, kan ikke disse tastene brukes, noe som kan hindre X11-programmer fra å starte. - - - - - - - - - - Hvis dette er aktivert, må du for å sikre systemet, også aktivere Godkjenn tilkoblinger. Når dette ikke er aktivert, er tilkoblinger fra eksterne programmer ikke tillatt. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/no.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/no.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 4a7ff917f..000000000 Binary files a/hw/xquartz/bundle/Resources/no.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/no.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/no.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index c4c6915e0..000000000 Binary files a/hw/xquartz/bundle/Resources/no.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/pl.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/pl.lproj/Localizable.strings deleted file mode 100644 index a2b422216..000000000 Binary files a/hw/xquartz/bundle/Resources/pl.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/pl.lproj/locversion.plist b/hw/xquartz/bundle/Resources/pl.lproj/locversion.plist deleted file mode 100644 index e4b083f96..000000000 --- a/hw/xquartz/bundle/Resources/pl.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - pl - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/pl.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/pl.lproj/main.nib/designable.nib deleted file mode 100644 index c95374fbf..000000000 --- a/hw/xquartz/bundle/Resources/pl.lproj/main.nib/designable.nib +++ /dev/null @@ -1,754 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Kliknięcie z przytrzymanym klawiszem Opcja lub Command emuluje środkowy lub prawy przycisk myszy. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Uruchomienie X11 utworzy klucze kontroli dostępu Xauthority. Jeśli adres IP systemu zmieni się, klucze te stracą ważność, co może uniemożliwić uruchamianie programów X11. - - - - - - - - - - Gdy pole jest zaznaczone, dla bezpieczeństwa włączona musi być także opcja Uwierzytelniaj połączenia. Gdy pole nie jest zaznaczone, połączenia ze zdalnych programów nie są dozwolone. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/pl.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/pl.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 42d406209..000000000 Binary files a/hw/xquartz/bundle/Resources/pl.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/pl.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/pl.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 1de9a1f36..000000000 Binary files a/hw/xquartz/bundle/Resources/pl.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/pt.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/pt.lproj/Localizable.strings deleted file mode 100644 index a27251499..000000000 Binary files a/hw/xquartz/bundle/Resources/pt.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/pt.lproj/locversion.plist b/hw/xquartz/bundle/Resources/pt.lproj/locversion.plist deleted file mode 100644 index 4449f68e0..000000000 --- a/hw/xquartz/bundle/Resources/pt.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - pt - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/pt.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/pt.lproj/main.nib/designable.nib deleted file mode 100644 index 3952fc1ce..000000000 --- a/hw/xquartz/bundle/Resources/pt.lproj/main.nib/designable.nib +++ /dev/null @@ -1,757 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Mantenha pressionadas as teclas Opção ou Comando ao clicar para ativar o botão da direita ou o botão central do mouse. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ativa o item de menu "copiar" e permite a sincronização entre a Área de Colagem do OSX e a ÁREA DE TRANSFERÊNCIA e os buffers PRINCIPAIS do X11. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Quando esta opção está selecionada, a ação de clicar em uma janela inativa faz com que o clique do mouse seja ativado para essa janela, a qual também é ativada. - - - - - - - - - - - - - - - - - - - - - Quando esta opção está ativada, a criação de uma nova janela do X11 move o X11.app para o segundo plano (em vez do Finder.app, Terminal.app, etc.) - - - - - - - - - - - - - - - - - - - - A execução do X11 criará as chaves de controle de acesso Xauthority. Se mudar o endereço de IP do sistema, essas chaves tornam-se inválidas, o que pode impedir a execução dos aplicativos do X11. - - - - - - - - - - Se ativadas, as conexões Autenticar também podem ser ativadas para garantir a segurança do sistema. Se desativadas, as conexões dos aplicativos remotos não são permitidas. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/pt.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/pt.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 455342a63..000000000 Binary files a/hw/xquartz/bundle/Resources/pt.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/pt.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/pt.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index eb6133012..000000000 Binary files a/hw/xquartz/bundle/Resources/pt.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/pt_PT.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/pt_PT.lproj/Localizable.strings deleted file mode 100644 index b313d58df..000000000 Binary files a/hw/xquartz/bundle/Resources/pt_PT.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/pt_PT.lproj/locversion.plist b/hw/xquartz/bundle/Resources/pt_PT.lproj/locversion.plist deleted file mode 100644 index 951d989d4..000000000 --- a/hw/xquartz/bundle/Resources/pt_PT.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - pt_PT - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/pt_PT.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/pt_PT.lproj/main.nib/designable.nib deleted file mode 100644 index e7b50c1b4..000000000 --- a/hw/xquartz/bundle/Resources/pt_PT.lproj/main.nib/designable.nib +++ /dev/null @@ -1,757 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Se estiverem activas, as teclas equivalentes da barra de menus podem interferir nas aplicações X11 que utilizam o modificador Meta. - - - - - - - - - - Ao clicar, mantenha premidas as teclas Opção ou Comando para activar os botões central ou direito do rato. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Activa o elemento de menu "copiar" e permite a sincronização entre a área de colagem do OS X e os buffers CLIPBOARD e PRIMARY do X11. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Se assinalar esta opção, ao clicar numa janela inactiva, o clique não só a traz para a frente como activa a janela completamente. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Lançar o X11 cria chaves Xauthority de controlo de acesso. Se o endereço IP do sistema for alterado, estas chaves perdem a validade, podendo, assim, impossibilitar a execução das aplicações X11. - - - - - - - - - - Se activar esta opção, precisa igualmente de activar a opção “Autenticar ligações” para garantir a segurança do sistema. Se não activar esta opção, não são permitidas ligações a partir de aplicações remotas. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/pt_PT.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/pt_PT.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 80631f1fb..000000000 Binary files a/hw/xquartz/bundle/Resources/pt_PT.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/pt_PT.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/pt_PT.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 92950c47b..000000000 Binary files a/hw/xquartz/bundle/Resources/pt_PT.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ro.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/ro.lproj/Localizable.strings deleted file mode 100644 index 08977a35a..000000000 Binary files a/hw/xquartz/bundle/Resources/ro.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ro.lproj/locversion.plist b/hw/xquartz/bundle/Resources/ro.lproj/locversion.plist deleted file mode 100644 index 708118a56..000000000 --- a/hw/xquartz/bundle/Resources/ro.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.5 - LprojLocale - ro - LprojRevisionLevel - 1 - LprojVersion - 106.5 - - diff --git a/hw/xquartz/bundle/Resources/ro.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/ro.lproj/main.nib/designable.nib deleted file mode 100644 index 7ec5325ac..000000000 --- a/hw/xquartz/bundle/Resources/ro.lproj/main.nib/designable.nib +++ /dev/null @@ -1,759 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Când opțiunea este activată, echivalentele tastelor barei de meniu pot interfera cu aplicații X11 care utilizează modificatorul Meta. - - - - - - - - - - Apăsați Opțiune sau Comandă în timp ce faceți clic pentru a activa butonul de mijloc sau de dreapta al mausului. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Activează fereastra rădăcină X11. Utilizați combinția de taste Comandă-Opțiune-A pentru intarea și ieșirea din modul de afișare pe tot ecranul. - - - - - - - - - - - - - - - - - - - - - - - - - - - - Activează articolul de meniu "copiază" și permite sincronizarea între pasteboardul OSX și CLIPBOARDUL și tampoanele PRINCIPALE X11. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Când opțiunea este activată, clicul pe o fereastră inactivă va determina trecerea clicului de maus prin fereastra respectivă, pe lângă activarea acesteia. - - - - - - - - - - - - - - - - - - - - - Când opțiunea este activată, crearea unei ferestre X11 noi va determina aducerea X11.app în primplan (în locul Finder.app, Terminal.app etc.) - - - - - - - - - - - - - - - - - - - - Lansarea X11 va crea cheile de control al accesului Xauthority. Dacă adresa de IP a sistemului se schimbă, aceste chei devin nevalide, ceea ce poate împiedica lansarea aplicațiilor X11. - - - - - - - - - - Dacă opțiunea este activată, trebuie să fie activată și opțiunea “Efectuează autentificarea conexiunilor” pentru a asigura securitatea sistemului. Când opțiunea este dezactivată, nu sunt permise conexiunile din partea aplicațiilor de la distanță. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/ro.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/ro.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 3e2bdb9e0..000000000 Binary files a/hw/xquartz/bundle/Resources/ro.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ro.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/ro.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 012033e29..000000000 Binary files a/hw/xquartz/bundle/Resources/ro.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ru.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/ru.lproj/Localizable.strings deleted file mode 100644 index 736cd94ea..000000000 Binary files a/hw/xquartz/bundle/Resources/ru.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ru.lproj/locversion.plist b/hw/xquartz/bundle/Resources/ru.lproj/locversion.plist deleted file mode 100644 index 47ad73bb7..000000000 --- a/hw/xquartz/bundle/Resources/ru.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - ru - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/ru.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/ru.lproj/main.nib/designable.nib deleted file mode 100644 index bdf93df28..000000000 --- a/hw/xquartz/bundle/Resources/ru.lproj/main.nib/designable.nib +++ /dev/null @@ -1,758 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Если включено, эквиваленты клавиш строки меню могут пересекаться с эквивалентами в программах X11, использующих мета-модификатор. - - - - - - - - - - Удерживайте нажатыми кнопки Option или Command при активации средней или правой кнопок мыши. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Если включено, создание нового окна X11 повлечет за собой перемещение на передний план X11.app (вместо Finder.app, Terminal.app и т. д.) - - - - - - - - - - - - - - - - - - - - Запуск X11 создаст ключи доступа-контроля Xauthority. Если системный IP-адрес изменяется, эти ключи становятся недействительными, что может препятствовать запуску программ X11. - - - - - - - - - - Если включено, проверка аутентификации подключений должна быть также включена для гарантии работы системы безопасности. Если выключено, подключения из удаленных программ недоступны. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/ru.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/ru.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index bbed97423..000000000 Binary files a/hw/xquartz/bundle/Resources/ru.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/ru.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/ru.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 0b96e100f..000000000 Binary files a/hw/xquartz/bundle/Resources/ru.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/sk.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/sk.lproj/Localizable.strings deleted file mode 100644 index 857a5af73..000000000 Binary files a/hw/xquartz/bundle/Resources/sk.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/sk.lproj/locversion.plist b/hw/xquartz/bundle/Resources/sk.lproj/locversion.plist deleted file mode 100644 index 2395a469f..000000000 --- a/hw/xquartz/bundle/Resources/sk.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.5 - LprojLocale - sk - LprojRevisionLevel - 1 - LprojVersion - 106.5 - - diff --git a/hw/xquartz/bundle/Resources/sk.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/sk.lproj/main.nib/designable.nib deleted file mode 100644 index 5fd0f98cf..000000000 --- a/hw/xquartz/bundle/Resources/sk.lproj/main.nib/designable.nib +++ /dev/null @@ -1,755 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Podržte počas kliknutia Option alebo Command pre aktiváciu stredného alebo pravého tlačidla myši. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Povoľuje X11 koreňové okno. Použite klávesovú sekvenciu Command-Option-A pre aktivovanie a deaktivovanie režimu celej obrazovky. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Spustenie X11 vytvorí klávesy ochrany prístupu Xautority. Tieto klávesy sa stanú neplatnými ak sa zmení systémová IP adresa, čo môže zabrániť spusteniu X11 aplikácií. - - - - - - - - - - Ak je povolené, musí byť povolená aj funkcia Autentifikácia spojení, aby bola zaistená bezpečnosť systému. Ak nie je povolené, pripojenia zo vzdialených aplikácií nie sú povolené. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/sk.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/sk.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 42df30d2b..000000000 Binary files a/hw/xquartz/bundle/Resources/sk.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/sk.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/sk.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 9ebde46e9..000000000 Binary files a/hw/xquartz/bundle/Resources/sk.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/sv.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/sv.lproj/Localizable.strings deleted file mode 100644 index 4847b7382..000000000 Binary files a/hw/xquartz/bundle/Resources/sv.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/sv.lproj/locversion.plist b/hw/xquartz/bundle/Resources/sv.lproj/locversion.plist deleted file mode 100644 index 97f8332e5..000000000 --- a/hw/xquartz/bundle/Resources/sv.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - sv - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/sv.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/sv.lproj/main.nib/designable.nib deleted file mode 100644 index 4f1602a58..000000000 --- a/hw/xquartz/bundle/Resources/sv.lproj/main.nib/designable.nib +++ /dev/null @@ -1,756 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Håll ned alternativ- eller kommandotangenten när du klickar så aktiveras musens mitt- respektive högerknapp. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Aktiverar menyalternativet ”Kopiera” och gör det möjligt att synkronisera mellan urklipp i OSX och CLIPBOARD- och PRIMARY-buffertarna i X11. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Med det här alternativet kommer ett klick på ett inaktivt fönster både aktivera fönstret och låta musklicket påverka innehållet. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - När du öppnar X11 skapas Xauthority-nycklar som kontrollerar åtkomst. Om datorns IP-adress ändras blir nycklarna ogiltiga vilket kan förhindra att X11-program öppnas. - - - - - - - - - - Om det är aktiverat måste Autentisera anslutningar också vara aktiverat för att säkerställa säkerheten i systemet. Om det är avaktiverat tillåts inte anslutningar från fjärrprogram. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/sv.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/sv.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 9b134773a..000000000 Binary files a/hw/xquartz/bundle/Resources/sv.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/sv.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/sv.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 9bc54d9ab..000000000 Binary files a/hw/xquartz/bundle/Resources/sv.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/th.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/th.lproj/Localizable.strings deleted file mode 100644 index b7f16693f..000000000 Binary files a/hw/xquartz/bundle/Resources/th.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/th.lproj/locversion.plist b/hw/xquartz/bundle/Resources/th.lproj/locversion.plist deleted file mode 100644 index 68a934e6a..000000000 --- a/hw/xquartz/bundle/Resources/th.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.5 - LprojLocale - th - LprojRevisionLevel - 1 - LprojVersion - 106.5 - - diff --git a/hw/xquartz/bundle/Resources/th.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/th.lproj/main.nib/designable.nib deleted file mode 100644 index b7b763eaa..000000000 --- a/hw/xquartz/bundle/Resources/th.lproj/main.nib/designable.nib +++ /dev/null @@ -1,755 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - กดปุ่ม Option หรือ Command ค้างไว้ในขณะที่คลิกเพื่อเปิดใช้งานปุ่มเมาส์ขวาหรือปุ่มกลาง - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - เมื่อเปิดใช้งานแล้ว การสร้างหน้าต่าง X11 ใหม่จะส่งผลให้แอปพลิเคชัน X11 ย้ายไปที่พื้นหน้า (แทนที่แอปพลิเคชัน Finder แอปพลิเคชัน Terminal เป็นต้น) - - - - - - - - - - - - - - - - - - - - การเริ่ม X11 จะสร้างปุ่มควบคุมการเข้าถึง Xauthority ถ้าที่อยู่ IP ของระบบเปลี่ยนแปลง ปุ่มเหล่านี้จะใช้ไม่ได้ซึ่งอาจทำให้เริ่มแอปพลิเคชัน X11 ไม่ได้ - - - - - - - - - - เมื่อเปิดใช้งานแล้ว ต้องเปิดใช้งานการรับรองความถูกต้องการเชื่อมต่อด้วยเพื่อให้แน่ใจเรื่องความปลอดภับของระบบ เมื่อปิดใช้งานแล้ว จะไม่อนุญาตให้มีการเชื่อมต่อจากแอปพลิเคชันระยะไกล - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/th.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/th.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 34e5f7e77..000000000 Binary files a/hw/xquartz/bundle/Resources/th.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/th.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/th.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index 0a5a3b367..000000000 Binary files a/hw/xquartz/bundle/Resources/th.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/tr.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/tr.lproj/Localizable.strings deleted file mode 100644 index 2ef7d0ba4..000000000 Binary files a/hw/xquartz/bundle/Resources/tr.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/tr.lproj/locversion.plist b/hw/xquartz/bundle/Resources/tr.lproj/locversion.plist deleted file mode 100644 index b4852447b..000000000 --- a/hw/xquartz/bundle/Resources/tr.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.5 - LprojLocale - tr - LprojRevisionLevel - 1 - LprojVersion - 106.5 - - diff --git a/hw/xquartz/bundle/Resources/tr.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/tr.lproj/main.nib/designable.nib deleted file mode 100644 index c9d38d487..000000000 --- a/hw/xquartz/bundle/Resources/tr.lproj/main.nib/designable.nib +++ /dev/null @@ -1,757 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ortadaki veya sağdaki fare düğmelerini etkinleştirmek için tıklarken Option veya Komut tuşunu basılı tutun. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Kopyala" menü öğesini etkinleştirir ve OSX yapıştırma alanıyla X11 CLIPBOARD ve PRIMARY arabelleklerinin eşzamanlanmasına izin verir. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Etkinleştirildiğinde; etkin olmayan bir pencereyi tıklamak, pencerenin etkinleştirilmesinin yanı sıra o fare tıklamasının o pencereye geçirilmesine de neden olacaktır. - - - - - - - - - - - - - - - - - - - - - Etkinleştirildiğinde; yeni bir X11 penceresinin yaratılması, X11.app uygulamasının öne gelmesine (Finder.app, Terminal.app vb. yerine) neden olacaktır. - - - - - - - - - - - - - - - - - - - - X11’i başlatma, Xauthority erişim denetimi tuşlarını yaratacaktır. Sistemin IP adresi değiştiğinde bu tuşlar geçersiz olur ve bu durum X11 uygulamalarının başlamasını engelleyebilir. - - - - - - - - - - Etkinleştirildiğinde, sistem güvenliğini sağlamak için Bağlantılarda kimlik doğrula seçeneğinin de etkinleştirilmesi gerekir. Etkisizleştirildiğinde, uzaktaki uygulamaların bağlantılarına izin verilmez. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/tr.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/tr.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index b9ed81680..000000000 Binary files a/hw/xquartz/bundle/Resources/tr.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/tr.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/tr.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index f5663e05d..000000000 Binary files a/hw/xquartz/bundle/Resources/tr.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/uk.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/uk.lproj/Localizable.strings deleted file mode 100644 index f85c7ebd0..000000000 Binary files a/hw/xquartz/bundle/Resources/uk.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/uk.lproj/locversion.plist b/hw/xquartz/bundle/Resources/uk.lproj/locversion.plist deleted file mode 100644 index 9b66fbb2c..000000000 --- a/hw/xquartz/bundle/Resources/uk.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.5 - LprojLocale - uk - LprojRevisionLevel - 1 - LprojVersion - 106.5 - - diff --git a/hw/xquartz/bundle/Resources/uk.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/uk.lproj/main.nib/designable.nib deleted file mode 100644 index 1a87cf2b9..000000000 --- a/hw/xquartz/bundle/Resources/uk.lproj/main.nib/designable.nib +++ /dev/null @@ -1,759 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Якщо увімкнено, то клавіатурні скорочення смуги меню можуть заважати скороченням програм Х11, в яких використовується Meta-клавіша. - - - - - - - - - - Утримуйте клавіші Option і Command під час клацання, щоб активувати середню чи праву кнопки мишки. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Активує елемент меню «копіювати» та дозволяє синхронізацію між компонуванням OS X і буфером обміну Х11, а також первинними буферами. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Якщо цю функцію ввімкнено, то створення нового вікна Х11 в активному режимі призведе до того, що програма Х11 переміститься на передній план (замість програм Finder, «Термінал »тощо) - - - - - - - - - - - - - - - - - - - - Запуск X11 створить ключі контролю доступу Xauthority. У разі змінення ІР-адреси системи ці ключі втратять дійсність, що завадить запуску програм Х11. - - - - - - - - - - У разі ввімкнення цього параметру необхідно також увімкнути параметр «Аутентифікація з’єднань», щоб забезпечити захист системи. Якщо цей параметр вимкнено, під’єднання віддалених програм заборонені. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/uk.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/uk.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index 9297696fc..000000000 Binary files a/hw/xquartz/bundle/Resources/uk.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/uk.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/uk.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index d12239f61..000000000 Binary files a/hw/xquartz/bundle/Resources/uk.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/zh_CN.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/zh_CN.lproj/Localizable.strings deleted file mode 100644 index f1d930ca0..000000000 Binary files a/hw/xquartz/bundle/Resources/zh_CN.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/zh_CN.lproj/locversion.plist b/hw/xquartz/bundle/Resources/zh_CN.lproj/locversion.plist deleted file mode 100644 index b84962c75..000000000 --- a/hw/xquartz/bundle/Resources/zh_CN.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - zh_CN - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/zh_CN.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/zh_CN.lproj/main.nib/designable.nib deleted file mode 100644 index 68fd5923a..000000000 --- a/hw/xquartz/bundle/Resources/zh_CN.lproj/main.nib/designable.nib +++ /dev/null @@ -1,752 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 请按住 Option 或 Command 点按以激活中间或右边的鼠标按键。 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/zh_CN.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/zh_CN.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index e21de5b2c..000000000 Binary files a/hw/xquartz/bundle/Resources/zh_CN.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/zh_CN.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/zh_CN.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index bb8fa7e45..000000000 Binary files a/hw/xquartz/bundle/Resources/zh_CN.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/zh_TW.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/zh_TW.lproj/Localizable.strings deleted file mode 100644 index 919f9c2a5..000000000 Binary files a/hw/xquartz/bundle/Resources/zh_TW.lproj/Localizable.strings and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/zh_TW.lproj/locversion.plist b/hw/xquartz/bundle/Resources/zh_TW.lproj/locversion.plist deleted file mode 100644 index 12c5a65a4..000000000 --- a/hw/xquartz/bundle/Resources/zh_TW.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 106.3 - LprojLocale - zh_TW - LprojRevisionLevel - 1 - LprojVersion - 106.3 - - diff --git a/hw/xquartz/bundle/Resources/zh_TW.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/zh_TW.lproj/main.nib/designable.nib deleted file mode 100644 index d72ee6014..000000000 --- a/hw/xquartz/bundle/Resources/zh_TW.lproj/main.nib/designable.nib +++ /dev/null @@ -1,752 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 按住 Option 或 Command 的同時按一下,以啟用滑鼠的中間或右邊按鈕。 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hw/xquartz/bundle/Resources/zh_TW.lproj/main.nib/keyedobjects-110000.nib b/hw/xquartz/bundle/Resources/zh_TW.lproj/main.nib/keyedobjects-110000.nib deleted file mode 100644 index cfc33e07f..000000000 Binary files a/hw/xquartz/bundle/Resources/zh_TW.lproj/main.nib/keyedobjects-110000.nib and /dev/null differ diff --git a/hw/xquartz/bundle/Resources/zh_TW.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/zh_TW.lproj/main.nib/keyedobjects.nib deleted file mode 100644 index cbb1dc64d..000000000 Binary files a/hw/xquartz/bundle/Resources/zh_TW.lproj/main.nib/keyedobjects.nib and /dev/null differ diff --git a/hw/xquartz/bundle/X11.sh b/hw/xquartz/bundle/X11.sh deleted file mode 100755 index 3b8b6799c..000000000 --- a/hw/xquartz/bundle/X11.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set "$(dirname "$0")"/X11.bin "${@}" - -if [ -x ~/.x11run ]; then - exec ~/.x11run "${@}" -fi - -case $(basename "${SHELL}") in - bash) exec -l "${SHELL}" --login -c 'exec "${@}"' - "${@}" ;; - ksh|sh|zsh) exec -l "${SHELL}" -c 'exec "${@}"' - "${@}" ;; - csh|tcsh) exec -l "${SHELL}" -c 'exec $argv:q' "${@}" ;; - es|rc) exec -l "${SHELL}" -l -c 'exec $*' "${@}" ;; - *) exec "${@}" ;; -esac diff --git a/hw/xquartz/bundle/chown-bundle.sh b/hw/xquartz/bundle/chown-bundle.sh deleted file mode 100755 index ac62f289f..000000000 --- a/hw/xquartz/bundle/chown-bundle.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -BUNDLE_ROOT=$1 - -if [[ $(id -u) == 0 ]] ; then - chown -R root:admin ${BUNDLE_ROOT} -fi diff --git a/hw/xquartz/bundle/cpprules.in b/hw/xquartz/bundle/cpprules.in deleted file mode 100644 index 92a987d92..000000000 --- a/hw/xquartz/bundle/cpprules.in +++ /dev/null @@ -1,19 +0,0 @@ -# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM -# to cpp, because that trick does not work on all ANSI C preprocessors. -# Delete line numbers from the cpp output (-P is not portable, I guess). -# Allow XCOMM to be preceded by whitespace and provide a means of generating -# output lines with trailing backslashes. -# Allow XHASH to always be substituted, even in cases where XCOMM isn't. - -CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ - -e '/^\#line *[0-9][0-9]* *.*$$/d' \ - -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ - -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ - -e '/^[ ]*XHASH/s/XHASH/\#/' \ - -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \ - -e '/\@\@$$/s/\@\@$$/\\/' - -SUFFIXES = .cpp - -.cpp: - $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ diff --git a/hw/xquartz/bundle/meson.build b/hw/xquartz/bundle/meson.build deleted file mode 100644 index 22941203b..000000000 --- a/hw/xquartz/bundle/meson.build +++ /dev/null @@ -1,59 +0,0 @@ -# generate Info.plist -# https://github.com/mesonbuild/meson/issues/8434 -#cpp = find_program('cpp') -cpp = '/usr/bin/cpp' -cpp_defs = [ - '-DAPPLE_APPLICATION_NAME=@0@'.format(apple_application_name), - '-DBUNDLE_ID_PREFIX=@0@'.format(bundle_id_prefix), - '-DBUNDLE_VERSION=@0@'.format(bundle_version), - '-DBUNDLE_VERSION_STRING=@0@'.format(bundle_version_string), -] - -if build_sparkle -cpp_defs += sparkle_defs -endif - -# bundle data -localities = [ - 'Dutch', 'English', 'French', 'German', 'Italian', 'Japanese', 'Spanish', - 'ar','ca','cs','da','el','fi','he','hr','hu','ko','no','pl','pt','pt_PT', - 'ro','ru','sk','sv','th','tr','uk','zh_CN','zh_TW' -] -foreach lang : localities - install_data(join_paths('Resources', lang + '.lproj', 'Localizable.strings'), - install_dir: join_paths(bundle_root, 'Contents/Resources', lang + '.lproj'), - install_mode: 'rw-r--r--') - - install_data(join_paths('Resources', lang + '.lproj', 'main.nib/keyedobjects.nib'), - install_dir: join_paths(bundle_root, 'Contents/Resources', lang + '.lproj', 'main.nib'), - install_mode: 'rw-r--r--') -endforeach - -install_data('Resources/English.lproj/main.nib/designable.nib', - install_dir: join_paths(bundle_root, 'Contents/Resources/English.lproj/main.nib'), - install_mode: 'rw-r--r--') - -install_data('Resources/X11.icns', - install_dir: join_paths(bundle_root, 'Contents/Resources'), - install_mode: 'rw-r--r--') - -custom_target('Info.plist', - command: [cpp, '-P', cpp_defs, '@INPUT@'], - capture: true, - input: 'Info.plist.cpp', - output: 'Info.plist', - install: true, - install_dir: join_paths(bundle_root, 'Contents'), - install_mode: 'rw-r--r--', - build_by_default: true, -) - -install_data('PkgInfo', - install_dir: join_paths(bundle_root, 'Contents'), - install_mode: 'rw-r--r--') - -install_data('X11.sh', - install_dir: join_paths(bundle_root, 'Contents/MacOS'), - install_mode: 'rwxr-xr-x') - -meson.add_install_script('chown-bundle.sh', bundle_root) diff --git a/hw/xquartz/bundle/mk_bundke.sh b/hw/xquartz/bundle/mk_bundke.sh deleted file mode 100755 index f83b4da82..000000000 --- a/hw/xquartz/bundle/mk_bundke.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# 'Cause xcodebuild is hard to deal with - -SRCDIR=$1 -BUILDDIR=$2 -BUNDLE_ROOT=$3 - -localities="Dutch English French German Italian Japanese Spanish ar ca cs da el fi he hr hu ko no pl pt pt_PT ro ru sk sv th tr uk zh_CN zh_TW" -for lang in ${localities} ; do - [ -d ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj ] && rm -rf ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj - mkdir -p ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/main.nib - [ -d ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/main.nib ] || exit 1 - - for f in Localizable.strings main.nib/keyedobjects.nib main.nib/keyedobjects-110000.nib ; do - install -m 644 ${SRCDIR}/Resources/${lang}.lproj/$f ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/${f} - done -done - -install -m 644 ${SRCDIR}/Resources/English.lproj/main.nib/designable.nib ${BUNDLE_ROOT}/Contents/Resources/English.lproj/main.nib -install -m 644 ${SRCDIR}/Resources/X11.icns ${BUNDLE_ROOT}/Contents/Resources - -install -m 644 ${BUILDDIR}/Info.plist ${BUNDLE_ROOT}/Contents -install -m 644 ${SRCDIR}/PkgInfo ${BUNDLE_ROOT}/Contents - -mkdir -p ${BUNDLE_ROOT}/Contents/MacOS -install -m 755 ${SRCDIR}/X11.sh ${BUNDLE_ROOT}/Contents/MacOS - -if [[ $(id -u) == 0 ]] ; then - chown -R root:admin ${BUNDLE_ROOT} -fi diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c deleted file mode 100644 index e34994673..000000000 --- a/hw/xquartz/darwin.c +++ /dev/null @@ -1,835 +0,0 @@ -/************************************************************** - * - * Xquartz initialization code - * - * Copyright (c) 2007-2012 Apple Inc. - * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "os.h" -#include "servermd.h" -#include "inputstr.h" -#include "scrnintstr.h" -#include "mipointer.h" // mi software cursor -#include "micmap.h" // mi colormap code -#include "fb.h" // fb framebuffer code -#include "globals.h" -#include "dix.h" -#include "xkbsrv.h" - -#include -#include -#include "exevents.h" -#include "extinit.h" -#include "glx_extinit.h" -#include "xserver-properties.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#define HAS_UTSNAME 1 -#include - -#define NO_CFPLUGIN -#include - -#ifdef MITSHM -#include "shmint.h" -#endif - -#include "darwin.h" -#include "darwinEvents.h" -#include "quartzKeyboard.h" -#include "quartz.h" - -#include "X11Application.h" - -aslclient aslc; - -void -xq_asl_log(int level, const char *subsystem, const char *file, - const char *function, int line, const char *fmt, - ...) -{ - va_list args; - aslmsg msg = asl_new(ASL_TYPE_MSG); - - if (msg) { - char *_line; - - asl_set(msg, "File", file); - asl_set(msg, "Function", function); - asprintf(&_line, "%d", line); - if (_line) { - asl_set(msg, "Line", _line); - free(_line); - } - if (subsystem) - asl_set(msg, "Subsystem", subsystem); - } - - va_start(args, fmt); - asl_vlog(aslc, msg, level, fmt, args); - va_end(args); - - if (msg) - asl_free(msg); -} - -/* - * X server shared global variables - */ -int darwinScreensFound = 0; -DevPrivateKeyRec darwinScreenKeyRec; -io_connect_t darwinParamConnect = 0; -int darwinEventReadFD = -1; -int darwinEventWriteFD = -1; -// int darwinMouseAccelChange = 1; -int darwinFakeButtons = 0; - -// location of X11's (0,0) point in global screen coordinates -int darwinMainScreenX = 0; -int darwinMainScreenY = 0; - -// parameters read from the command line or user preferences -int darwinDesiredDepth = -1; -int darwinSyncKeymap = FALSE; - -// modifier masks for faking mouse buttons - ANY of these bits trigger it (not all) -#ifdef NX_DEVICELCMDKEYMASK -int darwinFakeMouse2Mask = NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK; -int darwinFakeMouse3Mask = NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK; -#else -int darwinFakeMouse2Mask = NX_ALTERNATEMASK; -int darwinFakeMouse3Mask = NX_COMMANDMASK; -#endif - -// Modifier mask for overriding event delivery to appkit (might be useful to set this to rcommand for input menu -unsigned int darwinAppKitModMask = 0; // Any of these bits - -// Modifier mask for items in the Window menu (0 and -1 cause shortcuts to be disabled) -unsigned int windowItemModMask = NX_COMMANDMASK; - -// devices -DeviceIntPtr darwinKeyboard = NULL; -DeviceIntPtr darwinPointer = NULL; -DeviceIntPtr darwinTabletStylus = NULL; -DeviceIntPtr darwinTabletCursor = NULL; -DeviceIntPtr darwinTabletEraser = NULL; - -// Common pixmap formats -static PixmapFormatRec formats[] = { - { 1, 1, BITMAP_SCANLINE_PAD }, - { 4, 8, BITMAP_SCANLINE_PAD }, - { 8, 8, BITMAP_SCANLINE_PAD }, - { 15, 16, BITMAP_SCANLINE_PAD }, - { 16, 16, BITMAP_SCANLINE_PAD }, - { 24, 32, BITMAP_SCANLINE_PAD }, - { 32, 32, BITMAP_SCANLINE_PAD } -}; - -void -DarwinPrintBanner(void) -{ - ErrorF("Xquartz starting:\n"); - ErrorF("X.Org X Server %s\n", XSERVER_VERSION); -} - -/* - * DarwinScreenInit - * This is a callback from dix during AddScreen() from InitOutput(). - * Initialize the screen and communicate information about it back to dix. - */ -static Bool -DarwinScreenInit(ScreenPtr pScreen, int argc, char **argv) -{ - int dpi; - static int foundIndex = 0; - Bool ret; - DarwinFramebufferPtr dfb; - - if (!dixRegisterPrivateKey(&darwinScreenKeyRec, PRIVATE_SCREEN, 0)) - return FALSE; - - // reset index of found screens for each server generation - if (pScreen->myNum == 0) { - foundIndex = 0; - - // reset the visual list - miClearVisualTypes(); - } - - // allocate space for private per screen storage - dfb = malloc(sizeof(DarwinFramebufferRec)); - - // SCREEN_PRIV(pScreen) = dfb; - dixSetPrivate(&pScreen->devPrivates, darwinScreenKey, dfb); - - // setup hardware/mode specific details - ret = QuartzAddScreen(foundIndex, pScreen); - foundIndex++; - if (!ret) - return FALSE; - - // setup a single visual appropriate for our pixel type - if (!miSetVisualTypesAndMasks(dfb->depth, dfb->visuals, dfb->bitsPerRGB, - dfb->preferredCVC, dfb->redMask, - dfb->greenMask, dfb->blueMask)) { - return FALSE; - } - - // TODO: Make PseudoColor visuals not suck in TrueColor mode - // if(dfb->depth > 8) - // miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0); - // - // TODO: Re-add support for 15bit - // if (dfb->depth > 15) - // miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor, - // RM_ARGB(0, 5, 5, 5), GM_ARGB(0, 5, 5, - // 5), - // BM_ARGB(0, 5, 5, 5)); - if (dfb->depth > 24) - miSetVisualTypesAndMasks(24, TrueColorMask, 8, TrueColor, - RM_ARGB(0, 8, 8, 8), GM_ARGB(0, 8, 8, - 8), - BM_ARGB(0, 8, 8, 8)); - - miSetPixmapDepths(); - - // machine independent screen init - // setup _Screen structure in pScreen - if (monitorResolution) - dpi = monitorResolution; - else - dpi = 96; - - // initialize fb - if (!fbScreenInit(pScreen, - dfb->framebuffer, // pointer to screen bitmap - dfb->width, dfb->height, // screen size in pixels - dpi, dpi, // dots per inch - dfb->pitch / (dfb->bitsPerPixel / 8), // pixel width of framebuffer - dfb->bitsPerPixel)) { // bits per pixel for screen - return FALSE; - } - - if (!fbPictureInit(pScreen, 0, 0)) { - return FALSE; - } - -#ifdef MITSHM - ShmRegisterFbFuncs(pScreen); -#endif - - // finish mode dependent screen setup including cursor support - if (!QuartzSetupScreen(pScreen->myNum, pScreen)) { - return FALSE; - } - - // create and install the default colormap and - // set pScreen->blackPixel / pScreen->white - if (!miCreateDefColormap(pScreen)) { - return FALSE; - } - - pScreen->x = dfb->x; - pScreen->y = dfb->y; - - /* ErrorF("Screen %d added: %dx%d @ (%d,%d)\n", - index, dfb->width, dfb->height, dfb->x, dfb->y); */ - - return TRUE; -} - -/* - ============================================================================= - - mouse and keyboard callbacks - - ============================================================================= - */ - -static void -DarwinInputHandlerNotify(int fd __unused, int ready __unused, void *data __unused) -{ -} - -/* - * DarwinMouseProc: Handle the initialization, etc. of a mouse - */ -static int -DarwinMouseProc(DeviceIntPtr pPointer, int what) -{ -#define NBUTTONS 3 -#define NAXES 6 - // 3 buttons: left, middle, right - CARD8 map[NBUTTONS + 1] = { 0, 1, 2, 3}; - Atom btn_labels[NBUTTONS] = { 0 }; - Atom axes_labels[NAXES] = { 0 }; - - switch (what) { - case DEVICE_INIT: - pPointer->public.on = FALSE; - - btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); - btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); - btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); - - 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_REL_X); - axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); - axes_labels[4] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_WHEEL); - axes_labels[5] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HWHEEL); - - // Set button map. - InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS, - btn_labels, - (PtrCtrlProcPtr)NoopDDA, - GetMotionHistorySize(), NAXES, - axes_labels); - InitValuatorAxisStruct(pPointer, 0, axes_labels[0], - NO_AXIS_LIMITS, NO_AXIS_LIMITS, - 0, 0, 0, Absolute); - InitValuatorAxisStruct(pPointer, 1, axes_labels[1], - NO_AXIS_LIMITS, NO_AXIS_LIMITS, - 0, 0, 0, Absolute); - InitValuatorAxisStruct(pPointer, 2, axes_labels[2], - NO_AXIS_LIMITS, NO_AXIS_LIMITS, - 1, 0, 1, Relative); - InitValuatorAxisStruct(pPointer, 3, axes_labels[3], - NO_AXIS_LIMITS, NO_AXIS_LIMITS, - 1, 0, 1, Relative); - InitValuatorAxisStruct(pPointer, 4, axes_labels[4], - NO_AXIS_LIMITS, NO_AXIS_LIMITS, - 1, 0, 1, Relative); - InitValuatorAxisStruct(pPointer, 5, axes_labels[5], - NO_AXIS_LIMITS, NO_AXIS_LIMITS, - 1, 0, 1, Relative); - - SetScrollValuator(pPointer, 4, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_PREFERRED); - SetScrollValuator(pPointer, 5, SCROLL_TYPE_HORIZONTAL, -1.0, SCROLL_FLAG_NONE); - break; - - case DEVICE_ON: - pPointer->public.on = TRUE; - SetNotifyFd(darwinEventReadFD, DarwinInputHandlerNotify, X_NOTIFY_READ, NULL); - return Success; - - case DEVICE_CLOSE: - case DEVICE_OFF: - pPointer->public.on = FALSE; - RemoveNotifyFd(darwinEventReadFD); - return Success; - } - - return Success; -#undef NBUTTONS -#undef NAXES -} - -static int -DarwinTabletProc(DeviceIntPtr pPointer, int what) -{ -#define NBUTTONS 3 -#define NAXES 5 - CARD8 map[NBUTTONS + 1] = { 0, 1, 2, 3 }; - Atom btn_labels[NBUTTONS] = { 0 }; - Atom axes_labels[NAXES] = { 0 }; - - switch (what) { - case DEVICE_INIT: - pPointer->public.on = FALSE; - - btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); - btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); - btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); - - 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, - btn_labels, - (PtrCtrlProcPtr)NoopDDA, - GetMotionHistorySize(), NAXES, - axes_labels); - InitProximityClassDeviceStruct(pPointer); - - InitValuatorAxisStruct(pPointer, 0, axes_labels[0], - 0, XQUARTZ_VALUATOR_LIMIT, - 1, 0, 1, Absolute); - InitValuatorAxisStruct(pPointer, 1, axes_labels[1], - 0, XQUARTZ_VALUATOR_LIMIT, - 1, 0, 1, Absolute); - InitValuatorAxisStruct(pPointer, 2, axes_labels[2], - 0, XQUARTZ_VALUATOR_LIMIT, - 1, 0, 1, Absolute); - InitValuatorAxisStruct(pPointer, 3, axes_labels[3], - -XQUARTZ_VALUATOR_LIMIT, - XQUARTZ_VALUATOR_LIMIT, - 1, 0, 1, Absolute); - InitValuatorAxisStruct(pPointer, 4, axes_labels[4], - -XQUARTZ_VALUATOR_LIMIT, - XQUARTZ_VALUATOR_LIMIT, - 1, 0, 1, Absolute); - - // pPointer->use = IsXExtensionDevice; - break; - - case DEVICE_ON: - pPointer->public.on = TRUE; - SetNotifyFd(darwinEventReadFD, DarwinInputHandlerNotify, X_NOTIFY_READ, NULL); - return Success; - - case DEVICE_CLOSE: - case DEVICE_OFF: - pPointer->public.on = FALSE; - RemoveNotifyFd(darwinEventReadFD); - return Success; - } - return Success; -#undef NBUTTONS -#undef NAXES -} - -/* - * DarwinKeybdProc - * Callback from X - */ -static int -DarwinKeybdProc(DeviceIntPtr pDev, int onoff) -{ - switch (onoff) { - case DEVICE_INIT: - DarwinKeyboardInit(pDev); - break; - - case DEVICE_ON: - pDev->public.on = TRUE; - SetNotifyFd(darwinEventReadFD, DarwinInputHandlerNotify, X_NOTIFY_READ, NULL); - break; - - case DEVICE_OFF: - pDev->public.on = FALSE; - RemoveNotifyFd(darwinEventReadFD); - break; - - case DEVICE_CLOSE: - break; - } - - return Success; -} - -/* - =========================================================================== - - Utility routines - - =========================================================================== - */ - -/* - * DarwinParseModifierList - * Parse a list of modifier names and return a corresponding modifier mask - */ -int -DarwinParseModifierList(const char *constmodifiers, int separatelr) -{ - int result = 0; - - if (constmodifiers) { - char *modifiers = strdup(constmodifiers); - char *modifier; - int nxkey; - char *p = modifiers; - - while (p) { - modifier = strsep(&p, " ,+&|/"); // allow lots of separators - nxkey = DarwinModifierStringToNXMask(modifier, separatelr); - if (nxkey) - result |= nxkey; - else - ErrorF("fakebuttons: Unknown modifier \"%s\"\n", modifier); - } - free(modifiers); - } - return result; -} - -/* - =========================================================================== - - Functions needed to link against device independent X - - =========================================================================== - */ - -/* - * InitInput - * Register the keyboard and mouse devices - */ -void -InitInput(int argc, char **argv) -{ - XkbRMLVOSet rmlvo = { - .rules = "base", .model = "empty", .layout = "empty", - .variant = NULL, .options = NULL - }; - - /* We need to really have rules... or something... */ - XkbSetRulesDflts(&rmlvo); - - assert(Success == AllocDevicePair(serverClient, "xquartz virtual", - &darwinPointer, &darwinKeyboard, - DarwinMouseProc, DarwinKeybdProc, FALSE)); - - /* here's the snippet from the current gdk sources: - if (!strcmp (tmp_name, "pointer")) - gdkdev->info.source = GDK_SOURCE_MOUSE; - else if (!strcmp (tmp_name, "wacom") || - !strcmp (tmp_name, "pen")) - gdkdev->info.source = GDK_SOURCE_PEN; - else if (!strcmp (tmp_name, "eraser")) - gdkdev->info.source = GDK_SOURCE_ERASER; - else if (!strcmp (tmp_name, "cursor")) - gdkdev->info.source = GDK_SOURCE_CURSOR; - else - gdkdev->info.source = GDK_SOURCE_PEN; - */ - - darwinTabletStylus = AddInputDevice(serverClient, DarwinTabletProc, TRUE); - assert(darwinTabletStylus); - darwinTabletStylus->name = strdup("pen"); - - darwinTabletCursor = AddInputDevice(serverClient, DarwinTabletProc, TRUE); - assert(darwinTabletCursor); - darwinTabletCursor->name = strdup("cursor"); - - darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, TRUE); - assert(darwinTabletEraser); - darwinTabletEraser->name = strdup("eraser"); - - DarwinEQInit(); - - QuartzInitInput(argc, argv); -} - -void -CloseInput(void) -{ - DarwinEQFini(); -} - -/* - * DarwinAdjustScreenOrigins - * Shift all screens so the X11 (0, 0) coordinate is at the top - * left of the global screen coordinates. - * - * Screens can be arranged so the top left isn't on any screen, so - * instead use the top left of the leftmost screen as (0,0). This - * may mean some screen space is in -y, but it's better that (0,0) - * be onscreen, or else default xterms disappear. It's better that - * -y be used than -x, because when popup menus are forced - * "onscreen" by dumb window managers like twm, they'll shift the - * menus down instead of left, which still looks funny but is an - * easier target to hit. - */ -void -DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo) -{ - int i, left, top; - - left = pScreenInfo->screens[0]->x; - top = pScreenInfo->screens[0]->y; - - /* Find leftmost screen. If there's a tie, take the topmost of the two. */ - for (i = 1; i < pScreenInfo->numScreens; i++) { - if (pScreenInfo->screens[i]->x < left || - (pScreenInfo->screens[i]->x == left && - pScreenInfo->screens[i]->y < top)) { - left = pScreenInfo->screens[i]->x; - top = pScreenInfo->screens[i]->y; - } - } - - darwinMainScreenX = left; - darwinMainScreenY = top; - - DEBUG_LOG("top = %d, left=%d\n", top, left); - - /* Shift all screens so that there is a screen whose top left - * is at X11 (0,0) and at global screen coordinate - * (darwinMainScreenX, darwinMainScreenY). - */ - - if (darwinMainScreenX != 0 || darwinMainScreenY != 0) { - for (i = 0; i < pScreenInfo->numScreens; i++) { - pScreenInfo->screens[i]->x -= darwinMainScreenX; - pScreenInfo->screens[i]->y -= darwinMainScreenY; - DEBUG_LOG("Screen %d placed at X11 coordinate (%d,%d).\n", - i, pScreenInfo->screens[i]->x, - pScreenInfo->screens[i]->y); - } - } - - /* Update screenInfo.x/y */ - update_desktop_dimensions(); -} - -/* - * InitOutput - * Initialize screenInfo for all actually accessible framebuffers. - * - * The display mode dependent code gets called three times. The mode - * specific InitOutput routines are expected to discover the number - * of potentially useful screens and cache routes to them internally. - * Inside DarwinScreenInit are two other mode specific calls. - * A mode specific AddScreen routine is called for each screen to - * actually initialize the screen with the ScreenPtr structure. - * After other screen setup has been done, a mode specific - * SetupScreen function can be called to finalize screen setup. - */ -void -InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) -{ - int i; - - pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; - pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; - pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; - pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; - - // List how we want common pixmap formats to be padded - pScreenInfo->numPixmapFormats = ARRAY_SIZE(formats); - for (i = 0; i < ARRAY_SIZE(formats); i++) - pScreenInfo->formats[i] = formats[i]; - - // Discover screens and do mode specific initialization - QuartzInitOutput(argc, argv); - - // Add screens - for (i = 0; i < darwinScreensFound; i++) { - AddScreen(DarwinScreenInit, argc, argv); - } - - xorgGlxCreateVendor(); - - DarwinAdjustScreenOrigins(pScreenInfo); -} - -/* - * OsVendorFatalError - */ -void -OsVendorFatalError(const char *f, va_list args) -{ -} - -/* - * OsVendorInit - * Initialization of Darwin OS support. - */ -void -OsVendorInit(void) -{ - if (serverGeneration == 1) { - char *lf; - char *home = getenv("HOME"); - assert(home); - assert(0 < asprintf(&lf, "%s/Library/Logs/X11", home)); - - /* Ignore errors. If EEXIST, we don't care. If anything else, - * LogInit will handle it for us. - */ - (void)mkdir(lf, S_IRWXU | S_IRWXG | S_IRWXO); - free(lf); - - assert(0 < - asprintf(&lf, "%s/Library/Logs/X11/%s.log", home, - bundle_id_prefix)); - LogInit(lf, ".old"); - free(lf); - - DarwinPrintBanner(); - } -} - -/* - * ddxProcessArgument - * Process device-dependent command line args. Returns 0 if argument is - * not device dependent, otherwise Count of number of elements of argv - * that are part of a device dependent commandline option. - */ -int -ddxProcessArgument(int argc, char *argv[], int i) -{ - // if ( !strcmp( argv[i], "-fullscreen" ) ) { - // ErrorF( "Running full screen in parallel with Mac OS X Quartz window server.\n" ); - // return 1; - // } - - // if ( !strcmp( argv[i], "-rootless" ) ) { - // ErrorF( "Running rootless inside Mac OS X window server.\n" ); - // return 1; - // } - - // This command line arg is passed when launched from the Aqua GUI. - if (!strncmp(argv[i], "-psn_", 5)) { - return 1; - } - - if (!strcmp(argv[i], "-fakebuttons")) { - darwinFakeButtons = TRUE; - ErrorF("Faking a three button mouse\n"); - return 1; - } - - if (!strcmp(argv[i], "-nofakebuttons")) { - darwinFakeButtons = FALSE; - ErrorF("Not faking a three button mouse\n"); - return 1; - } - - if (!strcmp(argv[i], "-fakemouse2")) { - if (i == argc - 1) { - FatalError("-fakemouse2 must be followed by a modifier list\n"); - } - if (!strcasecmp(argv[i + 1], "none") || !strcmp(argv[i + 1], "")) - darwinFakeMouse2Mask = 0; - else - darwinFakeMouse2Mask = DarwinParseModifierList(argv[i + 1], 1); - ErrorF("Modifier mask to fake mouse button 2 = 0x%x\n", - darwinFakeMouse2Mask); - return 2; - } - - if (!strcmp(argv[i], "-fakemouse3")) { - if (i == argc - 1) { - FatalError("-fakemouse3 must be followed by a modifier list\n"); - } - if (!strcasecmp(argv[i + 1], "none") || !strcmp(argv[i + 1], "")) - darwinFakeMouse3Mask = 0; - else - darwinFakeMouse3Mask = DarwinParseModifierList(argv[i + 1], 1); - ErrorF("Modifier mask to fake mouse button 3 = 0x%x\n", - darwinFakeMouse3Mask); - return 2; - } - - if (!strcmp(argv[i], "+synckeymap")) { - darwinSyncKeymap = TRUE; - return 1; - } - - if (!strcmp(argv[i], "-synckeymap")) { - darwinSyncKeymap = FALSE; - return 1; - } - - if (!strcmp(argv[i], "-depth")) { - if (i == argc - 1) { - FatalError("-depth must be followed by a number\n"); - } - darwinDesiredDepth = atoi(argv[i + 1]); - if (darwinDesiredDepth != -1 && - darwinDesiredDepth != 8 && - darwinDesiredDepth != 15 && - darwinDesiredDepth != 24) { - FatalError("Unsupported pixel depth. Use 8, 15, or 24 bits\n"); - } - - ErrorF("Attempting to use pixel depth of %i\n", darwinDesiredDepth); - return 2; - } - - if (!strcmp(argv[i], "-showconfig") || !strcmp(argv[i], "-version")) { - DarwinPrintBanner(); - exit(0); - } - - return 0; -} - -/* - * ddxUseMsg -- - * Print out correct use of device dependent commandline options. - * Maybe the user now knows what really to do ... - */ -void -ddxUseMsg(void) -{ - ErrorF("\n"); - ErrorF("\n"); - ErrorF("Device Dependent Usage:\n"); - ErrorF("\n"); - ErrorF("-depth <8,15,24> : use this bit depth.\n"); - ErrorF( - "-fakebuttons : fake a three button mouse with Command and Option keys.\n"); - ErrorF("-nofakebuttons : don't fake a three button mouse.\n"); - ErrorF( - "-fakemouse2 : fake middle mouse button with modifier keys.\n"); - ErrorF( - "-fakemouse3 : fake right mouse button with modifier keys.\n"); - ErrorF( - " ex: -fakemouse2 \"option,shift\" = option-shift-click is middle button.\n"); - ErrorF("-version : show the server version.\n"); - ErrorF("\n"); -} - -/* - * ddxGiveUp -- - * Device dependent cleanup. Called by dix before normal server death. - */ -void -ddxGiveUp(enum ExitCode error) -{ - LogClose(error); -} - -#if INPUTTHREAD -/** This function is called in Xserver/os/inputthread.c when starting - the input thread. */ -void -ddxInputThreadInit(void) -{ -} -#endif diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h deleted file mode 100644 index 3cae50b2a..000000000 --- a/hw/xquartz/darwin.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2008-2012 Apple, Inc. - * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifndef _DARWIN_H -#define _DARWIN_H - -#include -#include "inputstr.h" -#include "scrnintstr.h" -#include -#include - -#include "darwinfb.h" - -// From darwin.c -void -DarwinPrintBanner(void); -int -DarwinParseModifierList(const char *constmodifiers, int separatelr); -void -DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo); - -#define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \ - dixLookupPrivate(&pScreen->devPrivates, \ - darwinScreenKey)) - -/* - * Global variables from darwin.c - */ -extern DevPrivateKeyRec darwinScreenKeyRec; -#define darwinScreenKey (&darwinScreenKeyRec) -extern int darwinScreensFound; -extern io_connect_t darwinParamConnect; -extern int darwinEventReadFD; -extern int darwinEventWriteFD; -extern DeviceIntPtr darwinPointer; -extern DeviceIntPtr darwinTabletCursor; -extern DeviceIntPtr darwinTabletStylus; -extern DeviceIntPtr darwinTabletEraser; -extern DeviceIntPtr darwinKeyboard; - -// User preferences -extern int darwinMouseAccelChange; -extern int darwinFakeButtons; -extern int darwinFakeMouse2Mask; -extern int darwinFakeMouse3Mask; -extern unsigned int darwinAppKitModMask; -extern unsigned int windowItemModMask; -extern int darwinSyncKeymap; -extern int darwinDesiredDepth; - -// location of X11's (0,0) point in global screen coordinates -extern int darwinMainScreenX; -extern int darwinMainScreenY; - -// bundle-main.c -extern char *bundle_id_prefix; - -_X_ATTRIBUTE_PRINTF(6, 7) -extern void -xq_asl_log(int level, const char *subsystem, const char *file, - const char *function, int line, const char *fmt, - ...); - -#define ASL_LOG(level, subsystem, msg, args ...) xq_asl_log(level, subsystem, \ - __FILE__, \ - __FUNCTION__, \ - __LINE__, msg, \ - ## args) -#define DEBUG_LOG(msg, args ...) ASL_LOG(ASL_LEVEL_DEBUG, \ - "XQuartz", msg, \ - ## args) -#define TRACE() DEBUG_LOG("TRACE") - -#endif /* _DARWIN_H */ diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c deleted file mode 100644 index fd87e968b..000000000 --- a/hw/xquartz/darwinEvents.c +++ /dev/null @@ -1,647 +0,0 @@ -/* - * Darwin event queue and event handling - * - * Copyright 2007-2008 Apple Inc. - * Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved. - * Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved. - * - * This file is based on mieq.c by Keith Packard, - * which contains the following copyright: - * Copyright 1990, 1998 The Open Group - * - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#include "sanitizedCarbon.h" - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "misc.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "inputstr.h" -#include "inpututils.h" -#include "eventstr.h" -#include "mi.h" -#include "scrnintstr.h" -#include "mipointer.h" -#include "os.h" -#include "exglobals.h" - -#include "darwin.h" -#include "quartz.h" -#include "quartzKeyboard.h" -#include "quartzRandR.h" -#include "darwinEvents.h" - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include "applewmExt.h" - -/* FIXME: Abstract this better */ -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; -int darwin_x11_modifier_mask = 0; - -#define FD_ADD_MAX 128 -static int fd_add[FD_ADD_MAX]; -int fd_add_count = 0; -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 BOOL mieqInitialized; -static pthread_mutex_t mieqInitializedMutex = PTHREAD_MUTEX_INITIALIZER; -static pthread_cond_t mieqInitializedCond = PTHREAD_COND_INITIALIZER; - -_X_NOTSAN -extern inline void -wait_for_mieq_init(void) -{ - if (!mieqInitialized) { - pthread_mutex_lock(&mieqInitializedMutex); - while (!mieqInitialized) { - pthread_cond_wait(&mieqInitializedCond, &mieqInitializedMutex); - } - pthread_mutex_unlock(&mieqInitializedMutex); - } -} - -_X_NOTSAN -static inline void -signal_mieq_init(void) -{ - pthread_mutex_lock(&mieqInitializedMutex); - mieqInitialized = TRUE; - pthread_cond_broadcast(&mieqInitializedCond); - pthread_mutex_unlock(&mieqInitializedMutex); -} - -/*** Pthread Magics ***/ -static pthread_t -create_thread(void *(*func)(void *), void *arg) -{ - pthread_attr_t attr; - pthread_t tid; - - pthread_attr_init(&attr); - pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_create(&tid, &attr, func, arg); - pthread_attr_destroy(&attr); - - return tid; -} - -/* - * DarwinPressModifierKey - * Press or release the given modifier key (one of NX_MODIFIERKEY_* constants) - */ -static void -DarwinPressModifierKey(int pressed, int key) -{ - int keycode = DarwinModifierNXKeyToNXKeycode(key, 0); - - if (keycode == 0) { - ErrorF("DarwinPressModifierKey bad keycode: key=%d\n", key); - return; - } - - DarwinSendKeyboardEvents(pressed, keycode); -} - -/* - * DarwinUpdateModifiers - * Send events to update the modifier state. - */ - -static int darwin_x11_modifier_mask_list[] = { -#ifdef NX_DEVICELCMDKEYMASK - NX_DEVICELCTLKEYMASK, NX_DEVICERCTLKEYMASK, - NX_DEVICELSHIFTKEYMASK, NX_DEVICERSHIFTKEYMASK, - NX_DEVICELCMDKEYMASK, NX_DEVICERCMDKEYMASK, - NX_DEVICELALTKEYMASK, NX_DEVICERALTKEYMASK, -#else - NX_CONTROLMASK, NX_SHIFTMASK, NX_COMMANDMASK, - NX_ALTERNATEMASK, -#endif - NX_ALPHASHIFTMASK, - 0 -}; - -static int darwin_all_modifier_mask_additions[] = { NX_SECONDARYFNMASK, 0 }; - -static void -DarwinUpdateModifiers(int pressed, // KeyPress or KeyRelease - int flags) // modifier flags that have changed -{ - int *f; - int key; - - /* Capslock is special. This mask is the state of capslock (on/off), - * not the state of the button. Hopefully we can find a better solution. - */ - if (NX_ALPHASHIFTMASK & flags) { - DarwinPressModifierKey(KeyPress, NX_MODIFIERKEY_ALPHALOCK); - DarwinPressModifierKey(KeyRelease, NX_MODIFIERKEY_ALPHALOCK); - } - - for (f = darwin_x11_modifier_mask_list; *f; f++) - if (*f & flags && *f != NX_ALPHASHIFTMASK) { - key = DarwinModifierNXMaskToNXKey(*f); - if (key == -1) - ErrorF("DarwinUpdateModifiers: Unsupported NXMask: 0x%x\n", - *f); - else - DarwinPressModifierKey(pressed, key); - } -} - -/* Generic handler for Xquartz-specifc events. When possible, these should - be moved into their own individual functions and set as handlers using - mieqSetHandler. */ - -static void -DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr dev) -{ - XQuartzEvent *e = &(ie->xquartz_event); - - 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 (XQuartzIsRootless) - ErrorF( - "Ignoring kXquartzToggleFullscreen because of rootless mode."); - else - QuartzRandRToggleFullscreen(); - break; - - case kXquartzSetRootless: - DEBUG_LOG("kXquartzSetRootless\n"); - if (e->data[0]) { - QuartzRandRSetFakeRootless(); - } - else { - QuartzRandRSetFakeFullscreen(FALSE); - } - break; - - case kXquartzSetRootClip: - QuartzSetRootClip(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: - DEBUG_LOG("kXquartzDisplayChanged\n"); - QuartzUpdateScreens(); - - /* Update our RandR info */ - QuartzRandRUpdateFakeModes(TRUE); - break; - - default: - if (!QuartzModeEventHandler(screenNum, e, dev)) - ErrorF("Unknown application defined event type %d.\n", e->subtype); - } -} - -void -DarwinListenOnOpenFD(int fd) -{ - ErrorF("DarwinListenOnOpenFD: %d\n", fd); - - pthread_mutex_lock(&fd_add_lock); - if (fd_add_count < FD_ADD_MAX) - fd_add[fd_add_count++] = fd; - else - ErrorF("FD Addition buffer at max. Dropping fd addition request.\n"); - - pthread_cond_broadcast(&fd_add_ready_cond); - pthread_mutex_unlock(&fd_add_lock); -} - -static void * -DarwinProcessFDAdditionQueue_thread(void *args) -{ - /* TODO: Possibly adjust this to no longer be a race... maybe trigger this - * once a client connects and claims to be the WM. - * - * From ajax: - * There's already an internal callback chain for setting selection [in 1.5] - * ownership. See the CallSelectionCallback at the bottom of - * ProcSetSelectionOwner, and xfixes/select.c for an example of how to hook - * into it. - */ - - struct timespec sleep_for; - struct timespec sleep_remaining; - - sleep_for.tv_sec = 3; - sleep_for.tv_nsec = 0; - - ErrorF( - "X11.app: DarwinProcessFDAdditionQueue_thread: Sleeping to allow xinitrc to catchup.\n"); - while (nanosleep(&sleep_for, &sleep_remaining) != 0) { - sleep_for = sleep_remaining; - } - - pthread_mutex_lock(&fd_add_lock); - while (true) { - while (fd_add_count) { - DarwinSendDDXEvent(kXquartzListenOnOpenFD, 1, - fd_add[--fd_add_count]); - } - pthread_cond_wait(&fd_add_ready_cond, &fd_add_lock); - } - - return NULL; -} - -Bool -DarwinEQInit(void) -{ - int *p; - - for (p = darwin_x11_modifier_mask_list; *p; p++) { - darwin_x11_modifier_mask |= *p; - } - - darwin_all_modifier_mask = darwin_x11_modifier_mask; - for (p = darwin_all_modifier_mask_additions; *p; p++) { - darwin_all_modifier_mask |= *p; - } - - mieqInit(); - mieqSetHandler(ET_XQuartz, DarwinEventHandler); - - if (!fd_add_tid) - fd_add_tid = create_thread(DarwinProcessFDAdditionQueue_thread, NULL); - - signal_mieq_init(); - - return TRUE; -} - -void -DarwinEQFini(void) -{ - mieqFini(); -} - -/* - * ProcessInputEvents - * Read and process events from the event queue until it is empty. - */ -void -ProcessInputEvents(void) -{ - char nullbyte; - int x = sizeof(nullbyte); - - mieqProcessInputEvents(); - - // Empty the signaling pipe - while (x == sizeof(nullbyte)) { - x = read(darwinEventReadFD, &nullbyte, sizeof(nullbyte)); - } -} - -/* Sends a null byte down darwinEventWriteFD, which will cause the - Dispatch() event loop to check out event queue */ -static void -DarwinPokeEQ(void) -{ - char nullbyte = 0; - // oh, i ... er ... christ. - write(darwinEventWriteFD, &nullbyte, sizeof(nullbyte)); -} - -void -DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev) -{ - input_lock(); - { - int i; - if (pDev->button) { - for (i = 0; i < pDev->button->numButtons; i++) { - if (BitIsOn(pDev->button->down, i)) { - QueuePointerEvents(pDev, ButtonRelease, i, - POINTER_ABSOLUTE, - NULL); - } - } - } - - if (pDev->key) { - for (i = 0; i < NUM_KEYCODES; i++) { - if (BitIsOn(pDev->key->down, i + MIN_KEYCODE)) { - QueueKeyboardEvents(pDev, KeyRelease, i + MIN_KEYCODE); - } - } - } - DarwinPokeEQ(); - } input_unlock(); -} - -void -DarwinSendTabletEvents(DeviceIntPtr pDev, int ev_type, int ev_button, - double pointer_x, double pointer_y, - double pressure, double tilt_x, - double tilt_y) -{ - ScreenPtr screen; - ValuatorMask valuators; - - screen = miPointerGetScreen(pDev); - if (!screen) { - DEBUG_LOG("%s called before screen was initialized\n", - __FUNCTION__); - return; - } - - /* Fix offset between darwin and X screens */ - pointer_x -= darwinMainScreenX + screen->x; - pointer_y -= darwinMainScreenY + screen->y; - - /* Adjust our pointer location to the [0,1] range */ - pointer_x = pointer_x / (double)screenInfo.width; - pointer_y = pointer_y / (double)screenInfo.height; - - valuator_mask_zero(&valuators); - valuator_mask_set_double(&valuators, 0, XQUARTZ_VALUATOR_LIMIT * pointer_x); - valuator_mask_set_double(&valuators, 1, XQUARTZ_VALUATOR_LIMIT * pointer_y); - valuator_mask_set_double(&valuators, 2, XQUARTZ_VALUATOR_LIMIT * pressure); - valuator_mask_set_double(&valuators, 3, XQUARTZ_VALUATOR_LIMIT * tilt_x); - valuator_mask_set_double(&valuators, 4, XQUARTZ_VALUATOR_LIMIT * tilt_y); - - input_lock(); - { - if (ev_type == ProximityIn || ev_type == ProximityOut) { - QueueProximityEvents(pDev, ev_type, &valuators); - } else { - QueuePointerEvents(pDev, ev_type, ev_button, POINTER_ABSOLUTE, - &valuators); - } - DarwinPokeEQ(); - } input_unlock(); -} - -void -DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, - double pointer_x, double pointer_y, - double pointer_dx, double pointer_dy) -{ - static int darwinFakeMouseButtonDown = 0; - ScreenPtr screen; - ValuatorMask valuators; - - screen = miPointerGetScreen(pDev); - if (!screen) { - DEBUG_LOG("%s called before screen was initialized\n", - __FUNCTION__); - return; - } - - /* Handle fake click */ - if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) { - if (darwinFakeMouseButtonDown != 0) { - /* We're currently "down" with another button, so release it first */ - DarwinSendPointerEvents(pDev, ButtonRelease, - darwinFakeMouseButtonDown, - pointer_x, pointer_y, 0.0, 0.0); - darwinFakeMouseButtonDown = 0; - } - if (darwin_all_modifier_flags & darwinFakeMouse2Mask) { - ev_button = 2; - darwinFakeMouseButtonDown = 2; - DarwinUpdateModKeys( - darwin_all_modifier_flags & ~darwinFakeMouse2Mask); - } - else if (darwin_all_modifier_flags & darwinFakeMouse3Mask) { - ev_button = 3; - darwinFakeMouseButtonDown = 3; - DarwinUpdateModKeys( - darwin_all_modifier_flags & ~darwinFakeMouse3Mask); - } - } - - if (ev_type == ButtonRelease && ev_button == 1) { - if (darwinFakeMouseButtonDown) { - ev_button = darwinFakeMouseButtonDown; - } - - if (darwinFakeMouseButtonDown == 2) { - DarwinUpdateModKeys( - darwin_all_modifier_flags & ~darwinFakeMouse2Mask); - } - else if (darwinFakeMouseButtonDown == 3) { - DarwinUpdateModKeys( - darwin_all_modifier_flags & ~darwinFakeMouse3Mask); - } - - darwinFakeMouseButtonDown = 0; - } - - /* Fix offset between darwin and X screens */ - pointer_x -= darwinMainScreenX + screen->x; - pointer_y -= darwinMainScreenY + screen->y; - - valuator_mask_zero(&valuators); - valuator_mask_set_double(&valuators, 0, pointer_x); - valuator_mask_set_double(&valuators, 1, pointer_y); - - if (ev_type == MotionNotify) { - if (pointer_dx != 0.0) - valuator_mask_set_double(&valuators, 2, pointer_dx); - if (pointer_dy != 0.0) - valuator_mask_set_double(&valuators, 3, pointer_dy); - } - - input_lock(); - { - QueuePointerEvents(pDev, ev_type, ev_button, POINTER_ABSOLUTE, - &valuators); - DarwinPokeEQ(); - } input_unlock(); -} - -void -DarwinSendKeyboardEvents(int ev_type, int keycode) -{ - input_lock(); - { - QueueKeyboardEvents(darwinKeyboard, ev_type, keycode + MIN_KEYCODE); - DarwinPokeEQ(); - } input_unlock(); -} - -/* Send the appropriate number of button clicks to emulate scroll wheel */ -void -DarwinSendScrollEvents(double scroll_x, double scroll_y) { - ScreenPtr screen; - ValuatorMask valuators; - - screen = miPointerGetScreen(darwinPointer); - if (!screen) { - DEBUG_LOG( - "DarwinSendScrollEvents called before screen was initialized\n"); - return; - } - - valuator_mask_zero(&valuators); - valuator_mask_set_double(&valuators, 4, scroll_y); - valuator_mask_set_double(&valuators, 5, scroll_x); - - input_lock(); - { - QueuePointerEvents(darwinPointer, MotionNotify, 0, - POINTER_RELATIVE, &valuators); - DarwinPokeEQ(); - } input_unlock(); -} - -/* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to - reflect changing modifier flags (alt, control, meta, etc) */ -void -DarwinUpdateModKeys(int flags) -{ - DarwinUpdateModifiers( - KeyRelease, darwin_all_modifier_flags & ~flags & - darwin_x11_modifier_mask); - DarwinUpdateModifiers( - KeyPress, ~darwin_all_modifier_flags & flags & - darwin_x11_modifier_mask); - darwin_all_modifier_flags = flags; -} - -/* - * DarwinSendDDXEvent - * Send the X server thread a message by placing it on the event queue. - */ -void -DarwinSendDDXEvent(int type, int argc, ...) -{ - XQuartzEvent e; - int i; - va_list args; - - 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 < XQUARTZ_EVENT_MAXARGS) { - va_start(args, argc); - for (i = 0; i < argc; i++) - e.data[i] = (uint32_t)va_arg(args, uint32_t); - va_end(args); - } - - wait_for_mieq_init(); - - input_lock(); - { - mieqEnqueue(NULL, (InternalEvent *)&e); - DarwinPokeEQ(); - } input_unlock(); -} diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h deleted file mode 100644 index 448e730bc..000000000 --- a/hw/xquartz/darwinEvents.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2008 Apple, Inc. - * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifndef _DARWIN_EVENTS_H -#define _DARWIN_EVENTS_H - -/* For extra precision of our cursor and other valuators */ -#define XQUARTZ_VALUATOR_LIMIT (1 << 16) - -Bool -DarwinEQInit(void); -void -DarwinEQFini(void); -void -DarwinEQEnqueue(const xEventPtr e); -void -DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e); -void -DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX); -void -DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev); -void -DarwinSendTabletEvents(DeviceIntPtr pDev, int ev_type, int ev_button, - double pointer_x, double pointer_y, double pressure, - double tilt_x, double tilt_y); -void -DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, - double pointer_x, double pointer_y, - double pointer_dx, double pointer_dy); -void -DarwinSendKeyboardEvents(int ev_type, int keycode); -void -DarwinSendScrollEvents(double scroll_x, double scroll_y); -void -DarwinUpdateModKeys(int flags); -void -DarwinListenOnOpenFD(int fd); - -/* - * Subtypes for the ET_XQuartz event type - */ -enum { - 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 - kXquartzBringAllToFront, // bring all X windows to front - kXquartzToggleFullscreen, // Enable/Disable fullscreen mode - kXquartzSetRootless, // Set rootless mode - kXquartzSpaceChanged, // Spaces changed - kXquartzListenOnOpenFD, // Listen to the launchd fd (passed as arg) - /* - * AppleWM events - */ - kXquartzControllerNotify, // send an AppleWMControllerNotify event - kXquartzPasteboardNotify, // notify the WM to copy or paste - kXquartzReloadPreferences, // send AppleWMReloadPreferences - /* - * Xplugin notification events - */ - kXquartzDisplayChanged, // display configuration has changed - kXquartzWindowState, // window visibility state has changed - kXquartzWindowMoved, // window has moved on screen -}; - -/* Send one of the above events to the server thread. */ -void -DarwinSendDDXEvent(int type, int argc, ...); - -/* A mask of the modifiers that are in our X11 keyboard layout: - * (Fn for example is just useful for 3button mouse emulation) */ -extern int darwin_all_modifier_mask; - -/* A mask of the modifiers that are in our X11 keyboard layout: - * (Fn for example is just useful for 3button mouse emulation) */ -extern int darwin_x11_modifier_mask; - -/* The current state of the above listed modifiers */ -extern int darwin_all_modifier_flags; - -#endif /* _DARWIN_EVENTS_H */ diff --git a/hw/xquartz/darwinXinput.c b/hw/xquartz/darwinXinput.c deleted file mode 100644 index fea7e921e..000000000 --- a/hw/xquartz/darwinXinput.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * X server support of the XINPUT extension for xquartz - * - * This is currently a copy of Xi/stubs.c, but eventually this - * should include more complete XINPUT support. - */ - -/************************************************************ - - Copyright 1989, 1998 The Open Group - - 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. - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name of The Open Group shall not be - used in advertising or otherwise to promote the sale, use or other dealings - in this Software without prior written authorization from The Open Group. - - Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. - - All Rights Reserved - - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose and without fee is hereby granted, - 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 Hewlett-Packard not be - used in advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - HEWLETT-PACKARD 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_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "inputstr.h" -#include -#include -#include "XIstubs.h" -#include "darwin.h" - -/**************************************************************************** - * - * Caller: ProcXSetDeviceMode - * - * Change the mode of an extension device. - * This function is used to change the mode of a device from reporting - * relative motion to reporting absolute positional information, and - * vice versa. - * The default implementation below is that no such devices are supported. - * - */ - -int -SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode) -{ - DEBUG_LOG("SetDeviceMode(%p, %p, %d)\n", client, dev, mode); - return BadMatch; -} - -/**************************************************************************** - * - * Caller: ProcXSetDeviceValuators - * - * Set the value of valuators on an extension input device. - * This function is used to set the initial value of valuators on - * those input devices that are capable of reporting either relative - * motion or an absolute position, and allow an initial position to be set. - * The default implementation below is that no such devices are supported. - * - */ - -int -SetDeviceValuators(ClientPtr client, DeviceIntPtr dev, - int *valuators, int first_valuator, int num_valuators) -{ - DEBUG_LOG("SetDeviceValuators(%p, %p, %p, %d, %d)\n", client, - dev, valuators, first_valuator, num_valuators); - return BadMatch; -} - -/**************************************************************************** - * - * Caller: ProcXChangeDeviceControl - * - * Change the specified device controls on an extension input device. - * - */ - -int -ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, - xDeviceCtl * control) -{ - - DEBUG_LOG("ChangeDeviceControl(%p, %p, %p)\n", client, dev, control); - return BadMatch; -} - -/**************************************************************************** - * - * Caller: configAddDevice (and others) - * - * Add a new device with the specified options. - * - */ -int -NewInputDeviceRequest(InputOption *options, InputAttributes *attrs, - DeviceIntPtr *pdev) -{ - DEBUG_LOG("NewInputDeviceRequest(%p, %p)\n", options, pdev); - return BadValue; -} - -/**************************************************************************** - * - * Caller: configRemoveDevice (and others) - * - * Remove the specified device previously added. - * - */ -void -DeleteInputDeviceRequest(DeviceIntPtr dev) -{ - DEBUG_LOG("DeleteInputDeviceRequest(%p)\n", dev); -} - -/**************************************************************************** - * - * Caller: configRemoveDevice (and others) - * - * Remove any traces of the input device specified in config_info. - * This is only necessary if the ddx keeps information around beyond - * the NewInputDeviceRequest/DeleteInputDeviceRequest - * - */ -void -RemoveInputDeviceTraces(const char *config_info) -{ - DEBUG_LOG("RemoveInputDeviceTraces(%s)\n", config_info); -} diff --git a/hw/xquartz/darwinfb.h b/hw/xquartz/darwinfb.h deleted file mode 100644 index 541128b8e..000000000 --- a/hw/xquartz/darwinfb.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2009 Apple, Inc. - * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifndef _DARWIN_FB_H -#define _DARWIN_FB_H - -#include "scrnintstr.h" - -typedef struct { - void *framebuffer; - int x; - int y; - int width; - int height; - int pitch; - int depth; - int visuals; - int bitsPerRGB; - int bitsPerPixel; - int preferredCVC; - Pixel redMask; - Pixel greenMask; - Pixel blueMask; -} DarwinFramebufferRec, *DarwinFramebufferPtr; - -#define MASK_LH(l, h) (((1 << (1 + (h) - (l))) - 1) << (l)) -#define BM_ARGB(a, r, g, b) MASK_LH(0, (b) - 1) -#define GM_ARGB(a, r, g, b) MASK_LH(b, (b) + (g) - 1) -#define RM_ARGB(a, r, g, b) MASK_LH((b) + (g), (b) + (g) + (r) - 1) -#define AM_ARGB(a, r, g, b) MASK_LH((b) + (g) + (r), \ - (b) + (g) + (r) + (a) - 1) - -#endif /* _DARWIN_FB_H */ diff --git a/hw/xquartz/defaults.plist b/hw/xquartz/defaults.plist deleted file mode 100644 index 957b1e0c7..000000000 --- a/hw/xquartz/defaults.plist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - apps_menu - - - Terminal - xterm - n - - - - diff --git a/hw/xquartz/keysym2ucs.c b/hw/xquartz/keysym2ucs.c deleted file mode 100644 index 12da19d67..000000000 --- a/hw/xquartz/keysym2ucs.c +++ /dev/null @@ -1,911 +0,0 @@ -/* - * - * This module converts keysym values into the corresponding ISO 10646 - * (UCS, Unicode) values. - * - * The array keysymtab[] contains pairs of X11 keysym values for graphical - * characters and the corresponding Unicode value. The function - * keysym2ucs() maps a keysym onto a Unicode value using a binary search, - * therefore keysymtab[] must remain SORTED by keysym value. - * - * The keysym -> UTF-8 conversion will hopefully one day be provided - * by Xlib via XmbLookupString() and should ideally not have to be - * done in X applications. But we are not there yet. - * - * We allow to represent any UCS character in the range U-00000000 to - * U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff. - * This admittedly does not cover the entire 31-bit space of UCS, but - * it does cover all of the characters up to U-10FFFF, which can be - * represented by UTF-16, and more, and it is very unlikely that higher - * UCS codes will ever be assigned by ISO. So to get Unicode character - * U+ABCD you can directly use keysym 0x0100abcd. - * - * NOTE: The comments in the table below contain the actual character - * encoded in UTF-8, so for viewing and editing best use an editor in - * UTF-8 mode. - * - * Author: Markus G. Kuhn , University of Cambridge, April 2001 - * - * Special thanks to Richard Verhoeven for preparing - * an initial draft of the mapping table. - * - * This software is in the public domain. Share and enjoy! - * - * AUTOMATICALLY GENERATED FILE, DO NOT EDIT !!! (unicode/convmap.pl) - */ - -#include "keysym2ucs.h" - -#include -#include - -struct codepair { - unsigned short keysym; - unsigned short ucs; -}; - -const static struct codepair keysymtab[] = { - { 0x01a1, 0x0104 }, - { 0x01a2, 0x02d8 }, - { 0x01a3, 0x0141 }, - { 0x01a5, 0x013d }, - { 0x01a6, 0x015a }, - { 0x01a9, 0x0160 }, - { 0x01aa, 0x015e }, - { 0x01ab, 0x0164 }, - { 0x01ac, 0x0179 }, - { 0x01ae, 0x017d }, - { 0x01af, 0x017b }, - { 0x01b1, 0x0105 }, - { 0x01b2, 0x02db }, - { 0x01b3, 0x0142 }, - { 0x01b5, 0x013e }, - { 0x01b6, 0x015b }, - { 0x01b7, 0x02c7 }, - { 0x01b9, 0x0161 }, - { 0x01ba, 0x015f }, - { 0x01bb, 0x0165 }, - { 0x01bc, 0x017a }, - { 0x01bd, 0x02dd }, - { 0x01be, 0x017e }, - { 0x01bf, 0x017c }, - { 0x01c0, 0x0154 }, - { 0x01c3, 0x0102 }, - { 0x01c5, 0x0139 }, - { 0x01c6, 0x0106 }, - { 0x01c8, 0x010c }, - { 0x01ca, 0x0118 }, - { 0x01cc, 0x011a }, - { 0x01cf, 0x010e }, - { 0x01d0, 0x0110 }, - { 0x01d1, 0x0143 }, - { 0x01d2, 0x0147 }, - { 0x01d5, 0x0150 }, - { 0x01d8, 0x0158 }, - { 0x01d9, 0x016e }, - { 0x01db, 0x0170 }, - { 0x01de, 0x0162 }, - { 0x01e0, 0x0155 }, - { 0x01e3, 0x0103 }, - { 0x01e5, 0x013a }, - { 0x01e6, 0x0107 }, - { 0x01e8, 0x010d }, - { 0x01ea, 0x0119 }, - { 0x01ec, 0x011b }, - { 0x01ef, 0x010f }, - { 0x01f0, 0x0111 }, - { 0x01f1, 0x0144 }, - { 0x01f2, 0x0148 }, - { 0x01f5, 0x0151 }, - { 0x01f8, 0x0159 }, - { 0x01f9, 0x016f }, - { 0x01fb, 0x0171 }, - { 0x01fe, 0x0163 }, - { 0x01ff, 0x02d9 }, - { 0x02a1, 0x0126 }, - { 0x02a6, 0x0124 }, - { 0x02a9, 0x0130 }, - { 0x02ab, 0x011e }, - { 0x02ac, 0x0134 }, - { 0x02b1, 0x0127 }, - { 0x02b6, 0x0125 }, - { 0x02b9, 0x0131 }, - { 0x02bb, 0x011f }, - { 0x02bc, 0x0135 }, - { 0x02c5, 0x010a }, - { 0x02c6, 0x0108 }, - { 0x02d5, 0x0120 }, - { 0x02d8, 0x011c }, - { 0x02dd, 0x016c }, - { 0x02de, 0x015c }, - { 0x02e5, 0x010b }, - { 0x02e6, 0x0109 }, - { 0x02f5, 0x0121 }, - { 0x02f8, 0x011d }, - { 0x02fd, 0x016d }, - { 0x02fe, 0x015d }, - { 0x03a2, 0x0138 }, - { 0x03a3, 0x0156 }, - { 0x03a5, 0x0128 }, - { 0x03a6, 0x013b }, - { 0x03aa, 0x0112 }, - { 0x03ab, 0x0122 }, - { 0x03ac, 0x0166 }, - { 0x03b3, 0x0157 }, - { 0x03b5, 0x0129 }, - { 0x03b6, 0x013c }, - { 0x03ba, 0x0113 }, - { 0x03bb, 0x0123 }, - { 0x03bc, 0x0167 }, - { 0x03bd, 0x014a }, - { 0x03bf, 0x014b }, - { 0x03c0, 0x0100 }, - { 0x03c7, 0x012e }, - { 0x03cc, 0x0116 }, - { 0x03cf, 0x012a }, - { 0x03d1, 0x0145 }, - { 0x03d2, 0x014c }, - { 0x03d3, 0x0136 }, - { 0x03d9, 0x0172 }, - { 0x03dd, 0x0168 }, - { 0x03de, 0x016a }, - { 0x03e0, 0x0101 }, - { 0x03e7, 0x012f }, - { 0x03ec, 0x0117 }, - { 0x03ef, 0x012b }, - { 0x03f1, 0x0146 }, - { 0x03f2, 0x014d }, - { 0x03f3, 0x0137 }, - { 0x03f9, 0x0173 }, - { 0x03fd, 0x0169 }, - { 0x03fe, 0x016b }, - { 0x047e, 0x203e }, - { 0x04a1, 0x3002 }, - { 0x04a2, 0x300c }, - { 0x04a3, 0x300d }, - { 0x04a4, 0x3001 }, - { 0x04a5, 0x30fb }, - { 0x04a6, 0x30f2 }, - { 0x04a7, 0x30a1 }, - { 0x04a8, 0x30a3 }, - { 0x04a9, 0x30a5 }, - { 0x04aa, 0x30a7 }, - { 0x04ab, 0x30a9 }, - { 0x04ac, 0x30e3 }, - { 0x04ad, 0x30e5 }, - { 0x04ae, 0x30e7 }, - { 0x04af, 0x30c3 }, - { 0x04b0, 0x30fc }, - { 0x04b1, 0x30a2 }, - { 0x04b2, 0x30a4 }, - { 0x04b3, 0x30a6 }, - { 0x04b4, 0x30a8 }, - { 0x04b5, 0x30aa }, - { 0x04b6, 0x30ab }, - { 0x04b7, 0x30ad }, - { 0x04b8, 0x30af }, - { 0x04b9, 0x30b1 }, - { 0x04ba, 0x30b3 }, - { 0x04bb, 0x30b5 }, - { 0x04bc, 0x30b7 }, - { 0x04bd, 0x30b9 }, - { 0x04be, 0x30bb }, - { 0x04bf, 0x30bd }, - { 0x04c0, 0x30bf }, - { 0x04c1, 0x30c1 }, - { 0x04c2, 0x30c4 }, - { 0x04c3, 0x30c6 }, - { 0x04c4, 0x30c8 }, - { 0x04c5, 0x30ca }, - { 0x04c6, 0x30cb }, - { 0x04c7, 0x30cc }, - { 0x04c8, 0x30cd }, - { 0x04c9, 0x30ce }, - { 0x04ca, 0x30cf }, - { 0x04cb, 0x30d2 }, - { 0x04cc, 0x30d5 }, - { 0x04cd, 0x30d8 }, - { 0x04ce, 0x30db }, - { 0x04cf, 0x30de }, - { 0x04d0, 0x30df }, - { 0x04d1, 0x30e0 }, - { 0x04d2, 0x30e1 }, - { 0x04d3, 0x30e2 }, - { 0x04d4, 0x30e4 }, - { 0x04d5, 0x30e6 }, - { 0x04d6, 0x30e8 }, - { 0x04d7, 0x30e9 }, - { 0x04d8, 0x30ea }, - { 0x04d9, 0x30eb }, - { 0x04da, 0x30ec }, - { 0x04db, 0x30ed }, - { 0x04dc, 0x30ef }, - { 0x04dd, 0x30f3 }, - { 0x04de, 0x309b }, - { 0x04df, 0x309c }, - { 0x05ac, 0x060c }, - { 0x05bb, 0x061b }, - { 0x05bf, 0x061f }, - { 0x05c1, 0x0621 }, - { 0x05c2, 0x0622 }, - { 0x05c3, 0x0623 }, - { 0x05c4, 0x0624 }, - { 0x05c5, 0x0625 }, - { 0x05c6, 0x0626 }, - { 0x05c7, 0x0627 }, - { 0x05c8, 0x0628 }, - { 0x05c9, 0x0629 }, - { 0x05ca, 0x062a }, - { 0x05cb, 0x062b }, - { 0x05cc, 0x062c }, - { 0x05cd, 0x062d }, - { 0x05ce, 0x062e }, - { 0x05cf, 0x062f }, - { 0x05d0, 0x0630 }, - { 0x05d1, 0x0631 }, - { 0x05d2, 0x0632 }, - { 0x05d3, 0x0633 }, - { 0x05d4, 0x0634 }, - { 0x05d5, 0x0635 }, - { 0x05d6, 0x0636 }, - { 0x05d7, 0x0637 }, - { 0x05d8, 0x0638 }, - { 0x05d9, 0x0639 }, - { 0x05da, 0x063a }, - { 0x05e0, 0x0640 }, - { 0x05e1, 0x0641 }, - { 0x05e2, 0x0642 }, - { 0x05e3, 0x0643 }, - { 0x05e4, 0x0644 }, - { 0x05e5, 0x0645 }, - { 0x05e6, 0x0646 }, - { 0x05e7, 0x0647 }, - { 0x05e8, 0x0648 }, - { 0x05e9, 0x0649 }, - { 0x05ea, 0x064a }, - { 0x05eb, 0x064b }, - { 0x05ec, 0x064c }, - { 0x05ed, 0x064d }, - { 0x05ee, 0x064e }, - { 0x05ef, 0x064f }, - { 0x05f0, 0x0650 }, - { 0x05f1, 0x0651 }, - { 0x05f2, 0x0652 }, - { 0x06a1, 0x0452 }, - { 0x06a2, 0x0453 }, - { 0x06a3, 0x0451 }, - { 0x06a4, 0x0454 }, - { 0x06a5, 0x0455 }, - { 0x06a6, 0x0456 }, - { 0x06a7, 0x0457 }, - { 0x06a8, 0x0458 }, - { 0x06a9, 0x0459 }, - { 0x06aa, 0x045a }, - { 0x06ab, 0x045b }, - { 0x06ac, 0x045c }, - { 0x06ae, 0x045e }, - { 0x06af, 0x045f }, - { 0x06b0, 0x2116 }, - { 0x06b1, 0x0402 }, - { 0x06b2, 0x0403 }, - { 0x06b3, 0x0401 }, - { 0x06b4, 0x0404 }, - { 0x06b5, 0x0405 }, - { 0x06b6, 0x0406 }, - { 0x06b7, 0x0407 }, - { 0x06b8, 0x0408 }, - { 0x06b9, 0x0409 }, - { 0x06ba, 0x040a }, - { 0x06bb, 0x040b }, - { 0x06bc, 0x040c }, - { 0x06be, 0x040e }, - { 0x06bf, 0x040f }, - { 0x06c0, 0x044e }, - { 0x06c1, 0x0430 }, - { 0x06c2, 0x0431 }, - { 0x06c3, 0x0446 }, - { 0x06c4, 0x0434 }, - { 0x06c5, 0x0435 }, - { 0x06c6, 0x0444 }, - { 0x06c7, 0x0433 }, - { 0x06c8, 0x0445 }, - { 0x06c9, 0x0438 }, - { 0x06ca, 0x0439 }, - { 0x06cb, 0x043a }, - { 0x06cc, 0x043b }, - { 0x06cd, 0x043c }, - { 0x06ce, 0x043d }, - { 0x06cf, 0x043e }, - { 0x06d0, 0x043f }, - { 0x06d1, 0x044f }, - { 0x06d2, 0x0440 }, - { 0x06d3, 0x0441 }, - { 0x06d4, 0x0442 }, - { 0x06d5, 0x0443 }, - { 0x06d6, 0x0436 }, - { 0x06d7, 0x0432 }, - { 0x06d8, 0x044c }, - { 0x06d9, 0x044b }, - { 0x06da, 0x0437 }, - { 0x06db, 0x0448 }, - { 0x06dc, 0x044d }, - { 0x06dd, 0x0449 }, - { 0x06de, 0x0447 }, - { 0x06df, 0x044a }, - { 0x06e0, 0x042e }, - { 0x06e1, 0x0410 }, - { 0x06e2, 0x0411 }, - { 0x06e3, 0x0426 }, - { 0x06e4, 0x0414 }, - { 0x06e5, 0x0415 }, - { 0x06e6, 0x0424 }, - { 0x06e7, 0x0413 }, - { 0x06e8, 0x0425 }, - { 0x06e9, 0x0418 }, - { 0x06ea, 0x0419 }, - { 0x06eb, 0x041a }, - { 0x06ec, 0x041b }, - { 0x06ed, 0x041c }, - { 0x06ee, 0x041d }, - { 0x06ef, 0x041e }, - { 0x06f0, 0x041f }, - { 0x06f1, 0x042f }, - { 0x06f2, 0x0420 }, - { 0x06f3, 0x0421 }, - { 0x06f4, 0x0422 }, - { 0x06f5, 0x0423 }, - { 0x06f6, 0x0416 }, - { 0x06f7, 0x0412 }, - { 0x06f8, 0x042c }, - { 0x06f9, 0x042b }, - { 0x06fa, 0x0417 }, - { 0x06fb, 0x0428 }, - { 0x06fc, 0x042d }, - { 0x06fd, 0x0429 }, - { 0x06fe, 0x0427 }, - { 0x06ff, 0x042a }, - { 0x07a1, 0x0386 }, - { 0x07a2, 0x0388 }, - { 0x07a3, 0x0389 }, - { 0x07a4, 0x038a }, - { 0x07a5, 0x03aa }, - { 0x07a7, 0x038c }, - { 0x07a8, 0x038e }, - { 0x07a9, 0x03ab }, - { 0x07ab, 0x038f }, - { 0x07ae, 0x0385 }, - { 0x07af, 0x2015 }, - { 0x07b1, 0x03ac }, - { 0x07b2, 0x03ad }, - { 0x07b3, 0x03ae }, - { 0x07b4, 0x03af }, - { 0x07b5, 0x03ca }, - { 0x07b6, 0x0390 }, - { 0x07b7, 0x03cc }, - { 0x07b8, 0x03cd }, - { 0x07b9, 0x03cb }, - { 0x07ba, 0x03b0 }, - { 0x07bb, 0x03ce }, - { 0x07c1, 0x0391 }, - { 0x07c2, 0x0392 }, - { 0x07c3, 0x0393 }, - { 0x07c4, 0x0394 }, - { 0x07c5, 0x0395 }, - { 0x07c6, 0x0396 }, - { 0x07c7, 0x0397 }, - { 0x07c8, 0x0398 }, - { 0x07c9, 0x0399 }, - { 0x07ca, 0x039a }, - { 0x07cb, 0x039b }, - { 0x07cc, 0x039c }, - { 0x07cd, 0x039d }, - { 0x07ce, 0x039e }, - { 0x07cf, 0x039f }, - { 0x07d0, 0x03a0 }, - { 0x07d1, 0x03a1 }, - { 0x07d2, 0x03a3 }, - { 0x07d4, 0x03a4 }, - { 0x07d5, 0x03a5 }, - { 0x07d6, 0x03a6 }, - { 0x07d7, 0x03a7 }, - { 0x07d8, 0x03a8 }, - { 0x07d9, 0x03a9 }, - { 0x07e1, 0x03b1 }, - { 0x07e2, 0x03b2 }, - { 0x07e3, 0x03b3 }, - { 0x07e4, 0x03b4 }, - { 0x07e5, 0x03b5 }, - { 0x07e6, 0x03b6 }, - { 0x07e7, 0x03b7 }, - { 0x07e8, 0x03b8 }, - { 0x07e9, 0x03b9 }, - { 0x07ea, 0x03ba }, - { 0x07eb, 0x03bb }, - { 0x07ec, 0x03bc }, - { 0x07ed, 0x03bd }, - { 0x07ee, 0x03be }, - { 0x07ef, 0x03bf }, - { 0x07f0, 0x03c0 }, - { 0x07f1, 0x03c1 }, - { 0x07f2, 0x03c3 }, - { 0x07f3, 0x03c2 }, - { 0x07f4, 0x03c4 }, - { 0x07f5, 0x03c5 }, - { 0x07f6, 0x03c6 }, - { 0x07f7, 0x03c7 }, - { 0x07f8, 0x03c8 }, - { 0x07f9, 0x03c9 }, - { 0x08a1, 0x23b7 }, - { 0x08a2, 0x250c }, - { 0x08a3, 0x2500 }, - { 0x08a4, 0x2320 }, - { 0x08a5, 0x2321 }, - { 0x08a6, 0x2502 }, - { 0x08a7, 0x23a1 }, - { 0x08a8, 0x23a3 }, - { 0x08a9, 0x23a4 }, - { 0x08aa, 0x23a6 }, - { 0x08ab, 0x239b }, - { 0x08ac, 0x239d }, - { 0x08ad, 0x239e }, - { 0x08ae, 0x23a0 }, - { 0x08af, 0x23a8 }, - { 0x08b0, 0x23ac }, - { 0x08bc, 0x2264 }, - { 0x08bd, 0x2260 }, - { 0x08be, 0x2265 }, - { 0x08bf, 0x222b }, - { 0x08c0, 0x2234 }, - { 0x08c1, 0x221d }, - { 0x08c2, 0x221e }, - { 0x08c5, 0x2207 }, - { 0x08c8, 0x223c }, - { 0x08c9, 0x2243 }, - { 0x08cd, 0x21d4 }, - { 0x08ce, 0x21d2 }, - { 0x08cf, 0x2261 }, - { 0x08d6, 0x221a }, - { 0x08da, 0x2282 }, - { 0x08db, 0x2283 }, - { 0x08dc, 0x2229 }, - { 0x08dd, 0x222a }, - { 0x08de, 0x2227 }, - { 0x08df, 0x2228 }, - { 0x08ef, 0x2202 }, - { 0x08f6, 0x0192 }, - { 0x08fb, 0x2190 }, - { 0x08fc, 0x2191 }, - { 0x08fd, 0x2192 }, - { 0x08fe, 0x2193 }, - { 0x09e0, 0x25c6 }, - { 0x09e1, 0x2592 }, - { 0x09e2, 0x2409 }, - { 0x09e3, 0x240c }, - { 0x09e4, 0x240d }, - { 0x09e5, 0x240a }, - { 0x09e8, 0x2424 }, - { 0x09e9, 0x240b }, - { 0x09ea, 0x2518 }, - { 0x09eb, 0x2510 }, - { 0x09ec, 0x250c }, - { 0x09ed, 0x2514 }, - { 0x09ee, 0x253c }, - { 0x09ef, 0x23ba }, - { 0x09f0, 0x23bb }, - { 0x09f1, 0x2500 }, - { 0x09f2, 0x23bc }, - { 0x09f3, 0x23bd }, - { 0x09f4, 0x251c }, - { 0x09f5, 0x2524 }, - { 0x09f6, 0x2534 }, - { 0x09f7, 0x252c }, - { 0x09f8, 0x2502 }, - { 0x0aa1, 0x2003 }, - { 0x0aa2, 0x2002 }, - { 0x0aa3, 0x2004 }, - { 0x0aa4, 0x2005 }, - { 0x0aa5, 0x2007 }, - { 0x0aa6, 0x2008 }, - { 0x0aa7, 0x2009 }, - { 0x0aa8, 0x200a }, - { 0x0aa9, 0x2014 }, - { 0x0aaa, 0x2013 }, - { 0x0aae, 0x2026 }, - { 0x0aaf, 0x2025 }, - { 0x0ab0, 0x2153 }, - { 0x0ab1, 0x2154 }, - { 0x0ab2, 0x2155 }, - { 0x0ab3, 0x2156 }, - { 0x0ab4, 0x2157 }, - { 0x0ab5, 0x2158 }, - { 0x0ab6, 0x2159 }, - { 0x0ab7, 0x215a }, - { 0x0ab8, 0x2105 }, - { 0x0abb, 0x2012 }, - { 0x0abc, 0x2329 }, - { 0x0abe, 0x232a }, - { 0x0ac3, 0x215b }, - { 0x0ac4, 0x215c }, - { 0x0ac5, 0x215d }, - { 0x0ac6, 0x215e }, - { 0x0ac9, 0x2122 }, - { 0x0aca, 0x2613 }, - { 0x0acc, 0x25c1 }, - { 0x0acd, 0x25b7 }, - { 0x0ace, 0x25cb }, - { 0x0acf, 0x25af }, - { 0x0ad0, 0x2018 }, - { 0x0ad1, 0x2019 }, - { 0x0ad2, 0x201c }, - { 0x0ad3, 0x201d }, - { 0x0ad4, 0x211e }, - { 0x0ad6, 0x2032 }, - { 0x0ad7, 0x2033 }, - { 0x0ad9, 0x271d }, - { 0x0adb, 0x25ac }, - { 0x0adc, 0x25c0 }, - { 0x0add, 0x25b6 }, - { 0x0ade, 0x25cf }, - { 0x0adf, 0x25ae }, - { 0x0ae0, 0x25e6 }, - { 0x0ae1, 0x25ab }, - { 0x0ae2, 0x25ad }, - { 0x0ae3, 0x25b3 }, - { 0x0ae4, 0x25bd }, - { 0x0ae5, 0x2606 }, - { 0x0ae6, 0x2022 }, - { 0x0ae7, 0x25aa }, - { 0x0ae8, 0x25b2 }, - { 0x0ae9, 0x25bc }, - { 0x0aea, 0x261c }, - { 0x0aeb, 0x261e }, - { 0x0aec, 0x2663 }, - { 0x0aed, 0x2666 }, - { 0x0aee, 0x2665 }, - { 0x0af0, 0x2720 }, - { 0x0af1, 0x2020 }, - { 0x0af2, 0x2021 }, - { 0x0af3, 0x2713 }, - { 0x0af4, 0x2717 }, - { 0x0af5, 0x266f }, - { 0x0af6, 0x266d }, - { 0x0af7, 0x2642 }, - { 0x0af8, 0x2640 }, - { 0x0af9, 0x260e }, - { 0x0afa, 0x2315 }, - { 0x0afb, 0x2117 }, - { 0x0afc, 0x2038 }, - { 0x0afd, 0x201a }, - { 0x0afe, 0x201e }, - { 0x0ba3, 0x003c }, - { 0x0ba6, 0x003e }, - { 0x0ba8, 0x2228 }, - { 0x0ba9, 0x2227 }, - { 0x0bc0, 0x00af }, - { 0x0bc2, 0x22a5 }, - { 0x0bc3, 0x2229 }, - { 0x0bc4, 0x230a }, - { 0x0bc6, 0x005f }, - { 0x0bca, 0x2218 }, - { 0x0bcc, 0x2395 }, - { 0x0bce, 0x22a4 }, - { 0x0bcf, 0x25cb }, - { 0x0bd3, 0x2308 }, - { 0x0bd6, 0x222a }, - { 0x0bd8, 0x2283 }, - { 0x0bda, 0x2282 }, - { 0x0bdc, 0x22a2 }, - { 0x0bfc, 0x22a3 }, - { 0x0cdf, 0x2017 }, - { 0x0ce0, 0x05d0 }, - { 0x0ce1, 0x05d1 }, - { 0x0ce2, 0x05d2 }, - { 0x0ce3, 0x05d3 }, - { 0x0ce4, 0x05d4 }, - { 0x0ce5, 0x05d5 }, - { 0x0ce6, 0x05d6 }, - { 0x0ce7, 0x05d7 }, - { 0x0ce8, 0x05d8 }, - { 0x0ce9, 0x05d9 }, - { 0x0cea, 0x05da }, - { 0x0ceb, 0x05db }, - { 0x0cec, 0x05dc }, - { 0x0ced, 0x05dd }, - { 0x0cee, 0x05de }, - { 0x0cef, 0x05df }, - { 0x0cf0, 0x05e0 }, - { 0x0cf1, 0x05e1 }, - { 0x0cf2, 0x05e2 }, - { 0x0cf3, 0x05e3 }, - { 0x0cf4, 0x05e4 }, - { 0x0cf5, 0x05e5 }, - { 0x0cf6, 0x05e6 }, - { 0x0cf7, 0x05e7 }, - { 0x0cf8, 0x05e8 }, - { 0x0cf9, 0x05e9 }, - { 0x0cfa, 0x05ea }, - { 0x0da1, 0x0e01 }, - { 0x0da2, 0x0e02 }, - { 0x0da3, 0x0e03 }, - { 0x0da4, 0x0e04 }, - { 0x0da5, 0x0e05 }, - { 0x0da6, 0x0e06 }, - { 0x0da7, 0x0e07 }, - { 0x0da8, 0x0e08 }, - { 0x0da9, 0x0e09 }, - { 0x0daa, 0x0e0a }, - { 0x0dab, 0x0e0b }, - { 0x0dac, 0x0e0c }, - { 0x0dad, 0x0e0d }, - { 0x0dae, 0x0e0e }, - { 0x0daf, 0x0e0f }, - { 0x0db0, 0x0e10 }, - { 0x0db1, 0x0e11 }, - { 0x0db2, 0x0e12 }, - { 0x0db3, 0x0e13 }, - { 0x0db4, 0x0e14 }, - { 0x0db5, 0x0e15 }, - { 0x0db6, 0x0e16 }, - { 0x0db7, 0x0e17 }, - { 0x0db8, 0x0e18 }, - { 0x0db9, 0x0e19 }, - { 0x0dba, 0x0e1a }, - { 0x0dbb, 0x0e1b }, - { 0x0dbc, 0x0e1c }, - { 0x0dbd, 0x0e1d }, - { 0x0dbe, 0x0e1e }, - { 0x0dbf, 0x0e1f }, - { 0x0dc0, 0x0e20 }, - { 0x0dc1, 0x0e21 }, - { 0x0dc2, 0x0e22 }, - { 0x0dc3, 0x0e23 }, - { 0x0dc4, 0x0e24 }, - { 0x0dc5, 0x0e25 }, - { 0x0dc6, 0x0e26 }, - { 0x0dc7, 0x0e27 }, - { 0x0dc8, 0x0e28 }, - { 0x0dc9, 0x0e29 }, - { 0x0dca, 0x0e2a }, - { 0x0dcb, 0x0e2b }, - { 0x0dcc, 0x0e2c }, - { 0x0dcd, 0x0e2d }, - { 0x0dce, 0x0e2e }, - { 0x0dcf, 0x0e2f }, - { 0x0dd0, 0x0e30 }, - { 0x0dd1, 0x0e31 }, - { 0x0dd2, 0x0e32 }, - { 0x0dd3, 0x0e33 }, - { 0x0dd4, 0x0e34 }, - { 0x0dd5, 0x0e35 }, - { 0x0dd6, 0x0e36 }, - { 0x0dd7, 0x0e37 }, - { 0x0dd8, 0x0e38 }, - { 0x0dd9, 0x0e39 }, - { 0x0dda, 0x0e3a }, - { 0x0ddf, 0x0e3f }, - { 0x0de0, 0x0e40 }, - { 0x0de1, 0x0e41 }, - { 0x0de2, 0x0e42 }, - { 0x0de3, 0x0e43 }, - { 0x0de4, 0x0e44 }, - { 0x0de5, 0x0e45 }, - { 0x0de6, 0x0e46 }, - { 0x0de7, 0x0e47 }, - { 0x0de8, 0x0e48 }, - { 0x0de9, 0x0e49 }, - { 0x0dea, 0x0e4a }, - { 0x0deb, 0x0e4b }, - { 0x0dec, 0x0e4c }, - { 0x0ded, 0x0e4d }, - { 0x0df0, 0x0e50 }, - { 0x0df1, 0x0e51 }, - { 0x0df2, 0x0e52 }, - { 0x0df3, 0x0e53 }, - { 0x0df4, 0x0e54 }, - { 0x0df5, 0x0e55 }, - { 0x0df6, 0x0e56 }, - { 0x0df7, 0x0e57 }, - { 0x0df8, 0x0e58 }, - { 0x0df9, 0x0e59 }, - { 0x0ea1, 0x3131 }, - { 0x0ea2, 0x3132 }, - { 0x0ea3, 0x3133 }, - { 0x0ea4, 0x3134 }, - { 0x0ea5, 0x3135 }, - { 0x0ea6, 0x3136 }, - { 0x0ea7, 0x3137 }, - { 0x0ea8, 0x3138 }, - { 0x0ea9, 0x3139 }, - { 0x0eaa, 0x313a }, - { 0x0eab, 0x313b }, - { 0x0eac, 0x313c }, - { 0x0ead, 0x313d }, - { 0x0eae, 0x313e }, - { 0x0eaf, 0x313f }, - { 0x0eb0, 0x3140 }, - { 0x0eb1, 0x3141 }, - { 0x0eb2, 0x3142 }, - { 0x0eb3, 0x3143 }, - { 0x0eb4, 0x3144 }, - { 0x0eb5, 0x3145 }, - { 0x0eb6, 0x3146 }, - { 0x0eb7, 0x3147 }, - { 0x0eb8, 0x3148 }, - { 0x0eb9, 0x3149 }, - { 0x0eba, 0x314a }, - { 0x0ebb, 0x314b }, - { 0x0ebc, 0x314c }, - { 0x0ebd, 0x314d }, - { 0x0ebe, 0x314e }, - { 0x0ebf, 0x314f }, - { 0x0ec0, 0x3150 }, - { 0x0ec1, 0x3151 }, - { 0x0ec2, 0x3152 }, - { 0x0ec3, 0x3153 }, - { 0x0ec4, 0x3154 }, - { 0x0ec5, 0x3155 }, - { 0x0ec6, 0x3156 }, - { 0x0ec7, 0x3157 }, - { 0x0ec8, 0x3158 }, - { 0x0ec9, 0x3159 }, - { 0x0eca, 0x315a }, - { 0x0ecb, 0x315b }, - { 0x0ecc, 0x315c }, - { 0x0ecd, 0x315d }, - { 0x0ece, 0x315e }, - { 0x0ecf, 0x315f }, - { 0x0ed0, 0x3160 }, - { 0x0ed1, 0x3161 }, - { 0x0ed2, 0x3162 }, - { 0x0ed3, 0x3163 }, - { 0x0ed4, 0x11a8 }, - { 0x0ed5, 0x11a9 }, - { 0x0ed6, 0x11aa }, - { 0x0ed7, 0x11ab }, - { 0x0ed8, 0x11ac }, - { 0x0ed9, 0x11ad }, - { 0x0eda, 0x11ae }, - { 0x0edb, 0x11af }, - { 0x0edc, 0x11b0 }, - { 0x0edd, 0x11b1 }, - { 0x0ede, 0x11b2 }, - { 0x0edf, 0x11b3 }, - { 0x0ee0, 0x11b4 }, - { 0x0ee1, 0x11b5 }, - { 0x0ee2, 0x11b6 }, - { 0x0ee3, 0x11b7 }, - { 0x0ee4, 0x11b8 }, - { 0x0ee5, 0x11b9 }, - { 0x0ee6, 0x11ba }, - { 0x0ee7, 0x11bb }, - { 0x0ee8, 0x11bc }, - { 0x0ee9, 0x11bd }, - { 0x0eea, 0x11be }, - { 0x0eeb, 0x11bf }, - { 0x0eec, 0x11c0 }, - { 0x0eed, 0x11c1 }, - { 0x0eee, 0x11c2 }, - { 0x0eef, 0x316d }, - { 0x0ef0, 0x3171 }, - { 0x0ef1, 0x3178 }, - { 0x0ef2, 0x317f }, - { 0x0ef3, 0x3181 }, - { 0x0ef4, 0x3184 }, - { 0x0ef5, 0x3186 }, - { 0x0ef6, 0x318d }, - { 0x0ef7, 0x318e }, - { 0x0ef8, 0x11eb }, - { 0x0ef9, 0x11f0 }, - { 0x0efa, 0x11f9 }, - { 0x0eff, 0x20a9 }, -#if 0 - /* FIXME: there is no keysym 0x13a4? But 0x20ac is EuroSign in both - keysym and Unicode */ - { 0x13a4, 0x20ac }, -#endif - { 0x13bc, 0x0152 }, - { 0x13bd, 0x0153 }, - { 0x13be, 0x0178 }, - { 0x20ac, 0x20ac }, - - /* Special function keys. */ - - { 0xff08, 0x0008 }, /* XK_BackSpace */ - { 0xff09, 0x0009 }, /* XK_Tab */ - { 0xff0a, 0x000a }, /* XK_Linefeed */ - { 0xff0d, 0x000d }, /* XK_Return */ - { 0xff13, 0x0013 }, /* XK_Pause */ - { 0xff1b, 0x001b }, /* XK_Escape */ - { 0xff50, 0x0001 }, /* XK_Home */ - { 0xff51, 0x001c }, /* XK_Left */ - { 0xff52, 0x001e }, /* XK_Up */ - { 0xff53, 0x001d }, /* XK_Right */ - { 0xff54, 0x001f }, /* XK_Down */ - { 0xff55, 0x000b }, /* XK_Prior */ - { 0xff56, 0x000c }, /* XK_Next */ - { 0xff57, 0x0004 }, /* XK_End */ - { 0xff6a, 0x0005 }, /* XK_Help */ - { 0xffff, 0x007f }, /* XK_Delete */ -}; - -long -keysym2ucs(int keysym) -{ - int min = 0; - int max = ARRAY_SIZE(keysymtab) - 1; - int mid; - - /* first check for Latin-1 characters (1:1 mapping) */ - if ((keysym >= 0x0020 && keysym <= 0x007e) || - (keysym >= 0x00a0 && keysym <= 0x00ff)) - return keysym; - - /* also check for directly encoded 24-bit UCS characters */ - if ((keysym & 0xff000000) == 0x01000000) - return keysym & 0x00ffffff; - - /* binary search in table */ - while (max >= min) { - mid = (min + max) / 2; - if (keysymtab[mid].keysym < keysym) - min = mid + 1; - else if (keysymtab[mid].keysym > keysym) - max = mid - 1; - else { - /* found it */ - return keysymtab[mid].ucs; - } - } - - /* no matching Unicode value found */ - return -1; -} - -static int -reverse_compare(const void *a, const void *b) -{ - const struct codepair *ca = a, *cb = b; - - return ca->ucs - cb->ucs; -} - -int -ucs2keysym(long ucs) -{ - static struct codepair *reverse_keysymtab; - - int min = 0; - int max = ARRAY_SIZE(keysymtab) - 1; - int mid; - - if (reverse_keysymtab == NULL) { - reverse_keysymtab = malloc(sizeof(keysymtab)); - memcpy(reverse_keysymtab, keysymtab, sizeof(keysymtab)); - - qsort(reverse_keysymtab, - ARRAY_SIZE(keysymtab), - sizeof(struct codepair), - reverse_compare); - } - - /* first check for Latin-1 characters (1:1 mapping) */ - if ((ucs >= 0x0020 && ucs <= 0x007e) || - (ucs >= 0x00a0 && ucs <= 0x00ff)) - return ucs; - - /* binary search in table */ - while (max >= min) { - mid = (min + max) / 2; - if (reverse_keysymtab[mid].ucs < ucs) - min = mid + 1; - else if (reverse_keysymtab[mid].ucs > ucs) - max = mid - 1; - else { - /* found it */ - return reverse_keysymtab[mid].keysym; - } - } - - /* finally, assume a directly encoded 24-bit UCS character */ - return ucs | 0x01000000; -} diff --git a/hw/xquartz/keysym2ucs.h b/hw/xquartz/keysym2ucs.h deleted file mode 100644 index aedbf43bf..000000000 --- a/hw/xquartz/keysym2ucs.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This module converts keysym values into the corresponding ISO 10646 - * (UCS, Unicode) values. - * - * The array keysymtab[] contains pairs of X11 keysym values for graphical - * characters and the corresponding Unicode value. The function - * keysym2ucs() maps a keysym onto a Unicode value using a binary search, - * therefore keysymtab[] must remain SORTED by keysym value. - * - * The keysym -> UTF-8 conversion will hopefully one day be provided - * by Xlib via XmbLookupString() and should ideally not have to be - * done in X applications. But we are not there yet. - * - * We allow to represent any UCS character in the range U-00000000 to - * U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff. - * This admittedly does not cover the entire 31-bit space of UCS, but - * it does cover all of the characters up to U-10FFFF, which can be - * represented by UTF-16, and more, and it is very unlikely that higher - * UCS codes will ever be assigned by ISO. So to get Unicode character - * U+ABCD you can directly use keysym 0x0100abcd. - * - * Author: Markus G. Kuhn , University of Cambridge, April 2001 - * - * Special thanks to Richard Verhoeven for preparing - * an initial draft of the mapping table. - * - * This software is in the public domain. Share and enjoy! - */ - -#ifndef KEYSYM2UCS_H -#define KEYSYM2UCS_H 1 - -#define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0])) - -extern long -keysym2ucs(int keysym); -extern int -ucs2keysym(long ucs); - -#endif /* KEYSYM2UCS_H */ diff --git a/hw/xquartz/mach-startup/.gitignore b/hw/xquartz/mach-startup/.gitignore deleted file mode 100644 index f6a06c550..000000000 --- a/hw/xquartz/mach-startup/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Add & Override for this directory and its subdirectories -mach_startup.h -mach_startupServer.c -mach_startupServer.h -mach_startupUser.c -X11.bin -Xquartz - diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c deleted file mode 100644 index 5c5bc70ac..000000000 --- a/hw/xquartz/mach-startup/bundle-main.c +++ /dev/null @@ -1,809 +0,0 @@ -/* main.c -- X application launcher - * Copyright (c) 2007 Jeremy Huddleston - * Copyright (c) 2007-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#include - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include - -#include -#include -#include -#include "mach_startup.h" -#include "mach_startupServer.h" - -#include - -/* From darwinEvents.c ... but don't want to pull in all the server cruft */ -void -DarwinListenOnOpenFD(int fd); - -extern aslclient aslc; - -/* Ditto, from os/log.c */ -extern void -ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1, 2); -extern void -FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1, 2) _X_NORETURN; - -extern int noPanoramiXExtension; - -#ifdef COMPOSITE -extern Bool noCompositeExtension; -#endif - -#define DEFAULT_CLIENT X11BINDIR "/xterm" -#define DEFAULT_STARTX X11BINDIR "/startx -- " X11BINDIR "/Xquartz" -#define DEFAULT_SHELL "/bin/sh" - -#define _STRINGIZE(s) #s -#define STRINGIZE(s) _STRINGIZE(s) - -#ifndef XSERVER_VERSION -#define XSERVER_VERSION "?" -#endif - -static char __crashreporter_info_buff__[4096] = { 0 }; -static const char *__crashreporter_info__ __attribute__((__used__)) = - &__crashreporter_info_buff__[0]; -// This line just tells the linker to never strip this symbol (such as for space optimization) -asm (".desc ___crashreporter_info__, 0x10"); - -static const char *__crashreporter_info__base = - "X.Org X Server " XSERVER_VERSION; - -char *bundle_id_prefix = NULL; -static char *server_bootstrap_name = NULL; - -#define DEBUG 1 - -/* This is in quartzStartup.c */ -int -server_main(int argc, char **argv, char **envp); - -static int -execute(const char *command); -static char * -command_from_prefs(const char *key, const char *default_value); - -static char *pref_app_to_run; -static char *pref_login_shell; -static char *pref_startx_script; - - -/*** Mach-O IPC Stuffs ***/ - -union MaxMsgSize { - union __RequestUnion__mach_startup_subsystem req; - union __ReplyUnion__mach_startup_subsystem rep; -}; - -static mach_port_t -checkin_or_register(char *bname) -{ - kern_return_t kr; - mach_port_t mp; - - /* If we're started by launchd or the old mach_init */ - kr = bootstrap_check_in(bootstrap_port, bname, &mp); - if (kr == KERN_SUCCESS) - return mp; - - /* We probably were not started by launchd or the old mach_init */ - kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &mp); - if (kr != KERN_SUCCESS) { - ErrorF("mach_port_allocate(): %s\n", mach_error_string(kr)); - exit(EXIT_FAILURE); - } - - kr = mach_port_insert_right( - mach_task_self(), mp, mp, MACH_MSG_TYPE_MAKE_SEND); - if (kr != KERN_SUCCESS) { - ErrorF("mach_port_insert_right(): %s\n", mach_error_string(kr)); - exit(EXIT_FAILURE); - } - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" // bootstrap_register -#endif - kr = bootstrap_register(bootstrap_port, bname, mp); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - - if (kr != KERN_SUCCESS) { - ErrorF("bootstrap_register(): %s\n", mach_error_string(kr)); - exit(EXIT_FAILURE); - } - - return mp; -} - -/*** $DISPLAY handoff ***/ -static int -accept_fd_handoff(int connected_fd) -{ - int launchd_fd; - - char databuf[] = "display"; - struct iovec iov[1]; - - 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; - msg.msg_controllen = sizeof(buf); - msg.msg_name = 0; - msg.msg_namelen = 0; - msg.msg_flags = 0; - - cmsg = CMSG_FIRSTHDR(&msg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(sizeof(int)); - - msg.msg_controllen = cmsg->cmsg_len; - - *((int *)CMSG_DATA(cmsg)) = -1; - - if (recvmsg(connected_fd, &msg, 0) < 0) { - ErrorF( - "X11.app: Error receiving $DISPLAY file descriptor. recvmsg() error: %s\n", - strerror(errno)); - return -1; - } - - launchd_fd = *((int *)CMSG_DATA(cmsg)); - - return launchd_fd; -} - -typedef struct { - int fd; - string_t filename; -} socket_handoff_t; - -/* This thread accepts an incoming connection and hands off the file - * descriptor for the new connection to accept_fd_handoff() - */ -static void -socket_handoff(socket_handoff_t *handoff_data) -{ - - int launchd_fd = -1; - int connected_fd; - - /* Now actually get the passed file descriptor from this connection - * If we encounter an error, keep listening. - */ - while (launchd_fd == -1) { - connected_fd = accept(handoff_data->fd, NULL, NULL); - if (connected_fd == -1) { - ErrorF( - "X11.app: Failed to accept incoming connection on socket (fd=%d): %s\n", - handoff_data->fd, strerror(errno)); - sleep(2); - continue; - } - - launchd_fd = accept_fd_handoff(connected_fd); - if (launchd_fd == -1) - ErrorF( - "X11.app: Error receiving $DISPLAY file descriptor, no descriptor received? Waiting for another connection.\n"); - - close(connected_fd); - } - - close(handoff_data->fd); - unlink(handoff_data->filename); - free(handoff_data); - - ErrorF( - "X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n", - launchd_fd); - DarwinListenOnOpenFD(launchd_fd); - -} - -static int -create_socket(char *filename_out) -{ - struct sockaddr_un servaddr_un; - struct sockaddr *servaddr; - socklen_t servaddr_len; - int ret_fd; - size_t try, try_max; - - for (try = 0, try_max = 5; try < try_max; try++) { - tmpnam(filename_out); - - /* Setup servaddr_un */ - memset(&servaddr_un, 0, sizeof(struct sockaddr_un)); - servaddr_un.sun_family = AF_UNIX; - strlcpy(servaddr_un.sun_path, filename_out, - sizeof(servaddr_un.sun_path)); - - servaddr = (struct sockaddr *)&servaddr_un; - servaddr_len = sizeof(struct sockaddr_un) - - sizeof(servaddr_un.sun_path) + strlen(filename_out); - - ret_fd = socket(PF_UNIX, SOCK_STREAM, 0); - if (ret_fd == -1) { - ErrorF( - "X11.app: Failed to create socket (try %d / %d): %s - %s\n", - (int)try + 1, (int)try_max, filename_out, strerror(errno)); - continue; - } - - if (bind(ret_fd, servaddr, servaddr_len) != 0) { - ErrorF("X11.app: Failed to bind socket: %d - %s\n", errno, - strerror( - errno)); - close(ret_fd); - return 0; - } - - if (listen(ret_fd, 10) != 0) { - ErrorF("X11.app: Failed to listen to socket: %s - %d - %s\n", - filename_out, errno, strerror( - errno)); - close(ret_fd); - return 0; - } - -#ifdef DEBUG - ErrorF("X11.app: Listening on socket for fd handoff: (%d) %s\n", - ret_fd, - filename_out); -#endif - - return ret_fd; - } - - return 0; -} - -static int launchd_socket_handed_off = 0; - -kern_return_t -do_request_fd_handoff_socket(mach_port_t port, string_t filename) -{ - socket_handoff_t *handoff_data; - - launchd_socket_handed_off = 1; - - handoff_data = (socket_handoff_t *)calloc(1, sizeof(socket_handoff_t)); - if (!handoff_data) { - ErrorF("X11.app: Error allocating memory for handoff_data\n"); - return KERN_FAILURE; - } - - handoff_data->fd = create_socket(handoff_data->filename); - if (!handoff_data->fd) { - free(handoff_data); - return KERN_FAILURE; - } - - strlcpy(filename, handoff_data->filename, STRING_T_SIZE); - - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, - 0), ^ { - socket_handoff(handoff_data); - }); - -#ifdef DEBUG - ErrorF( - "X11.app: Thread created for handoff. Returning success to tell caller to connect and push the fd.\n"); -#endif - - return KERN_SUCCESS; -} - -kern_return_t -do_request_pid(mach_port_t port, int *my_pid) -{ - *my_pid = getpid(); - return KERN_SUCCESS; -} - -/*** Server Startup ***/ -kern_return_t -do_start_x11_server(mach_port_t port, string_array_t argv, - mach_msg_type_number_t argvCnt, - string_array_t envp, - mach_msg_type_number_t envpCnt) -{ - /* And now back to char ** */ - char **_argv = alloca((argvCnt + 1) * sizeof(char *)); - char **_envp = alloca((envpCnt + 1) * sizeof(char *)); - size_t i; - - /* If we didn't get handed a launchd DISPLAY socket, we should - * unset DISPLAY or we can run into problems with pbproxy - */ - if (!launchd_socket_handed_off) { - ErrorF("X11.app: No launchd socket handed off, unsetting DISPLAY\n"); - unsetenv("DISPLAY"); - } - - if (!_argv || !_envp) { - return KERN_FAILURE; - } - - ErrorF("X11.app: do_start_x11_server(): argc=%d\n", argvCnt); - for (i = 0; i < argvCnt; i++) { - _argv[i] = argv[i]; - ErrorF("\targv[%u] = %s\n", (unsigned)i, argv[i]); - } - _argv[argvCnt] = NULL; - - for (i = 0; i < envpCnt; i++) { - _envp[i] = envp[i]; - } - _envp[envpCnt] = NULL; - - if (server_main(argvCnt, _argv, _envp) == 0) - return KERN_SUCCESS; - else - return KERN_FAILURE; -} - -static int -startup_trigger(int argc, char **argv, char **envp) -{ - Display *display; - const char *s; - - /* Take care of the case where we're called like a normal DDX */ - if (argc > 1 && argv[1][0] == ':') { - size_t i; - kern_return_t kr; - mach_port_t mp; - string_array_t newenvp; - string_array_t newargv; - - /* We need to count envp */ - int envpc; - for (envpc = 0; envp[envpc]; envpc++) ; - - /* We have fixed-size string lengths due to limitations in IPC, - * so we need to copy our argv and envp. - */ - newargv = (string_array_t)alloca(argc * sizeof(string_t)); - newenvp = (string_array_t)alloca(envpc * sizeof(string_t)); - - if (!newargv || !newenvp) { - ErrorF("Memory allocation failure\n"); - exit(EXIT_FAILURE); - } - - for (i = 0; i < argc; i++) { - strlcpy(newargv[i], argv[i], STRING_T_SIZE); - } - for (i = 0; i < envpc; i++) { - strlcpy(newenvp[i], envp[i], STRING_T_SIZE); - } - - kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); - if (kr != KERN_SUCCESS) { - ErrorF("bootstrap_look_up(%s): %s\n", server_bootstrap_name, - bootstrap_strerror( - kr)); - exit(EXIT_FAILURE); - } - - kr = start_x11_server(mp, newargv, argc, newenvp, envpc); - if (kr != KERN_SUCCESS) { - ErrorF("start_x11_server: %s\n", mach_error_string(kr)); - exit(EXIT_FAILURE); - } - exit(EXIT_SUCCESS); - } - - /* If we have a process serial number and it's our only arg, act as if - * the user double clicked the app bundle: launch app_to_run if possible - */ - if (argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) { - /* Now, try to open a display, if so, run the launcher */ - display = XOpenDisplay(NULL); - if (display) { - /* Could open the display, start the launcher */ - XCloseDisplay(display); - - return execute(pref_app_to_run); - } - } - - /* Start the server */ - if ((s = getenv("DISPLAY"))) { - ErrorF( - "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", - s); - unsetenv("DISPLAY"); - } - else { - ErrorF( - "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n"); - } - return execute(pref_startx_script); -} - -/** Setup the environment we want our child processes to inherit */ -static void -ensure_path(const char *dir) -{ - char buf[1024], *temp; - - /* Make sure /usr/X11/bin is in the $PATH */ - temp = getenv("PATH"); - if (temp == NULL || temp[0] == 0) { - snprintf(buf, sizeof(buf), - "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:%s", - dir); - setenv("PATH", buf, TRUE); - } - else if (strnstr(temp, X11BINDIR, sizeof(temp)) == NULL) { - snprintf(buf, sizeof(buf), "%s:%s", temp, dir); - setenv("PATH", buf, TRUE); - } -} - -static void -setup_console_redirect(const char *bundle_id) -{ - char *asl_sender; - char *asl_facility; - - asprintf(&asl_sender, "%s.server", bundle_id); - assert(asl_sender); - - asl_facility = strdup(bundle_id); - assert(asl_facility); - if (strcmp(asl_facility + strlen(asl_facility) - 4, ".X11") == 0) - asl_facility[strlen(asl_facility) - 4] = '\0'; - - assert(aslc = asl_open(asl_sender, asl_facility, ASL_OPT_NO_DELAY)); - free(asl_sender); - free(asl_facility); - - asl_set_filter(aslc, ASL_FILTER_MASK_UPTO(ASL_LEVEL_WARNING)); - - asl_log_descriptor(aslc, NULL, ASL_LEVEL_INFO, STDOUT_FILENO, ASL_LOG_DESCRIPTOR_WRITE); - asl_log_descriptor(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO, ASL_LOG_DESCRIPTOR_WRITE); -} - -static void -setup_env(void) -{ - char *temp; - const char *pds = NULL; - const char *disp = getenv("DISPLAY"); - size_t len; - - /* Pass on our prefs domain to startx and its inheritors (mainly for - * quartz-wm and the Xquartz stub's MachIPC) - */ - CFBundleRef bundle = CFBundleGetMainBundle(); - if (bundle) { - CFStringRef pd = CFBundleGetIdentifier(bundle); - if (pd) { - pds = CFStringGetCStringPtr(pd, 0); - } - } - - /* fallback to hardcoded value if we can't discover it */ - if (!pds) { - pds = BUNDLE_ID_PREFIX ".X11"; - } - - setup_console_redirect(pds); - - server_bootstrap_name = strdup(pds); - if (!server_bootstrap_name) { - ErrorF("X11.app: Memory allocation error.\n"); - exit(1); - } - setenv("X11_PREFS_DOMAIN", server_bootstrap_name, 1); - - len = strlen(server_bootstrap_name); - bundle_id_prefix = malloc(sizeof(char) * (len - 3)); - if (!bundle_id_prefix) { - ErrorF("X11.app: Memory allocation error.\n"); - exit(1); - } - strlcpy(bundle_id_prefix, server_bootstrap_name, len - 3); - - /* We need to unset DISPLAY if it is not our socket */ - if (disp) { - /* s = basename(disp) */ - const char *d, *s; - for (s = NULL, d = disp; *d; d++) { - if (*d == '/') - s = d + 1; - } - - if (s && *s) { - if (strcmp(bundle_id_prefix, - "org.x") == 0 && strcmp(s, ":0") == 0) { - ErrorF( - "X11.app: Detected old style launchd DISPLAY, please update xinit.\n"); - } - else { - temp = (char *)malloc(sizeof(char) * len); - if (!temp) { - ErrorF( - "X11.app: Memory allocation error creating space for socket name test.\n"); - exit(1); - } - strlcpy(temp, bundle_id_prefix, len); - strlcat(temp, ":0", len); - - if (strcmp(temp, s) != 0) { - /* If we don't have a match, unset it. */ - ErrorF( - "X11.app: DISPLAY (\"%s\") does not match our id (\"%s\"), unsetting.\n", - disp, bundle_id_prefix); - unsetenv("DISPLAY"); - } - free(temp); - } - } - else { - /* The DISPLAY environment variable is not formatted like a launchd socket, so reset. */ - ErrorF( - "X11.app: DISPLAY does not look like a launchd set variable, unsetting.\n"); - unsetenv("DISPLAY"); - } - } - - /* Make sure PATH is right */ - ensure_path(X11BINDIR); - - /* cd $HOME */ - temp = getenv("HOME"); - if (temp != NULL && temp[0] != '\0') - chdir(temp); -} - -/*** Main ***/ -int -main(int argc, char **argv, char **envp) -{ - Bool listenOnly = FALSE; - int i; - mach_msg_size_t mxmsgsz = sizeof(union MaxMsgSize) + MAX_TRAILER_SIZE; - mach_port_t mp; - kern_return_t kr; - - /* Ignore SIGPIPE */ - signal(SIGPIPE, SIG_IGN); - - /* Setup our environment for our children */ - setup_env(); - - /* The server must not run the PanoramiX operations. */ - noPanoramiXExtension = TRUE; - -#ifdef COMPOSITE - /* https://gitlab.freedesktop.org/xorg/xserver/-/issues/1409 */ - noCompositeExtension = TRUE; -#endif - - /* Setup the initial crasherporter info */ - strlcpy(__crashreporter_info_buff__, __crashreporter_info__base, - sizeof(__crashreporter_info_buff__)); - - ErrorF("X11.app: main(): argc=%d\n", argc); - for (i = 0; i < argc; i++) { - ErrorF("\targv[%u] = %s\n", (unsigned)i, argv[i]); - if (!strcmp(argv[i], "--listenonly")) { - listenOnly = TRUE; - } - } - - mp = checkin_or_register(server_bootstrap_name); - if (mp == MACH_PORT_NULL) { - ErrorF("NULL mach service: %s", server_bootstrap_name); - return EXIT_FAILURE; - } - - /* Check if we need to do something other than listen, and make another - * thread handle it. - */ - if (!listenOnly) { - pid_t child1, child2; - int status; - - pref_app_to_run = command_from_prefs("app_to_run", DEFAULT_CLIENT); - assert(pref_app_to_run); - - pref_login_shell = command_from_prefs("login_shell", DEFAULT_SHELL); - assert(pref_login_shell); - - pref_startx_script = command_from_prefs("startx_script", - DEFAULT_STARTX); - assert(pref_startx_script); - - /* Do the fork-twice trick to avoid having to reap zombies */ - child1 = fork(); - switch (child1) { - case -1: /* error */ - FatalError("fork() failed: %s\n", strerror(errno)); - - case 0: /* child1 */ - child2 = fork(); - - switch (child2) { - int max_files; - - case -1: /* error */ - FatalError("fork() failed: %s\n", strerror(errno)); - - case 0: /* child2 */ - /* close all open files except for standard streams */ - max_files = sysconf(_SC_OPEN_MAX); - for (i = 3; i < max_files; i++) - close(i); - - /* ensure stdin is on /dev/null */ - close(0); - open("/dev/null", O_RDONLY); - - return startup_trigger(argc, argv, envp); - - default: /* parent (child1) */ - _exit(0); - } - break; - - default: /* parent */ - waitpid(child1, &status, 0); - } - - free(pref_app_to_run); - free(pref_login_shell); - free(pref_startx_script); - } - - /* Main event loop */ - ErrorF("Waiting for startup parameters via Mach IPC.\n"); - kr = mach_msg_server(mach_startup_server, mxmsgsz, mp, 0); - if (kr != KERN_SUCCESS) { - ErrorF("%s.X11(mp): %s\n", BUNDLE_ID_PREFIX, mach_error_string(kr)); - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} - -static int -execute(const char *command) -{ - const char *newargv[4]; - const char **p; - - newargv[0] = pref_login_shell; - newargv[1] = "-c"; - newargv[2] = command; - newargv[3] = NULL; - - ErrorF("X11.app: Launching %s:\n", command); - for (p = newargv; *p; p++) { - ErrorF("\targv[%ld] = %s\n", (long int)(p - newargv), *p); - } - - execvp(newargv[0], (char *const *)newargv); - perror("X11.app: Couldn't exec."); - return 1; -} - -static char * -command_from_prefs(const char *key, const char *default_value) -{ - char *command = NULL; - - CFStringRef cfKey; - CFPropertyListRef PlistRef; - - if (!key) - return NULL; - - cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII); - - if (!cfKey) - return NULL; - - PlistRef = CFPreferencesCopyAppValue(cfKey, - kCFPreferencesCurrentApplication); - - if ((PlistRef == NULL) || - (CFGetTypeID(PlistRef) != CFStringGetTypeID())) { - CFStringRef cfDefaultValue = CFStringCreateWithCString( - NULL, default_value, kCFStringEncodingASCII); - int len = strlen(default_value) + 1; - - if (!cfDefaultValue) - goto command_from_prefs_out; - - CFPreferencesSetAppValue(cfKey, cfDefaultValue, - kCFPreferencesCurrentApplication); - CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); - CFRelease(cfDefaultValue); - - command = (char *)malloc(len * sizeof(char)); - if (!command) - goto command_from_prefs_out; - strcpy(command, default_value); - } - else { - int len = CFStringGetLength((CFStringRef)PlistRef) + 1; - command = (char *)malloc(len * sizeof(char)); - if (!command) - goto command_from_prefs_out; - CFStringGetCString((CFStringRef)PlistRef, command, len, - kCFStringEncodingASCII); - } - -command_from_prefs_out: - if (PlistRef) - CFRelease(PlistRef); - if (cfKey) - CFRelease(cfKey); - return command; -} diff --git a/hw/xquartz/mach-startup/bundle_trampoline.c b/hw/xquartz/mach-startup/bundle_trampoline.c deleted file mode 100644 index f8611269b..000000000 --- a/hw/xquartz/mach-startup/bundle_trampoline.c +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright (c) 2021 Apple Inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -/* We wnt XQuartz.app to inherit a login shell environment. This is handled by the X11.sh - * script which re-execs the main binary from a login shell environment. However, recent - * versions of macOS require that the main executable of an app be Mach-O for full system - * fidelity. - * - * Failure to do so results in two problems: - * 1) bash is seen as the responsible executable for Security & Privacy, and the user doesn't - * get prompted to allow filesystem access (https://github.com/XQuartz/XQuartz/issues/6). - * 2) The process is launched under Rosetta for compatability, which results in - * the subsequent spawn of the real executable under Rosetta rather than natively. - * - * This trampoline provides the mach-o needed by LaunchServices and TCC to satisfy those - * needs and simply execs the startup script which then execs the main binary. - */ - -static char *executable_path() { - uint32_t bufsize = PATH_MAX; - char *buf = calloc(1, bufsize); - - if (_NSGetExecutablePath(buf, &bufsize) == -1) { - free(buf); - buf = calloc(1, bufsize); - assert(_NSGetExecutablePath(buf, &bufsize) == 0); - } - - return buf; -} - -int main(int argc, char **argv, char **envp) { - char const * const executable_directory = dirname(executable_path()); - char *executable = NULL; - - asprintf(&executable, "%s/X11.sh", executable_directory); - if (access(executable, X_OK) == -1) { - free(executable); - asprintf(&executable, "%s/X11", executable_directory); - } - assert(access(executable, X_OK) == 0); - - argv[0] = executable; - - posix_spawnattr_t attr; - assert(posix_spawnattr_init(&attr) == 0); - assert(posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETEXEC) == 0); - - pid_t child_pid; - assert(posix_spawn(&child_pid, executable, NULL, &attr, argv, envp) == 0); - - return EXIT_FAILURE; -} diff --git a/hw/xquartz/mach-startup/launchd_fd.c b/hw/xquartz/mach-startup/launchd_fd.c deleted file mode 100644 index 15866cc42..000000000 --- a/hw/xquartz/mach-startup/launchd_fd.c +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright (c) 2008-2012 Apple Inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include - -#include "launchd_fd.h" - -extern aslclient aslc; - -int -launchd_display_fd(void) -{ - launch_data_t sockets_dict, checkin_request, checkin_response; - launch_data_t listening_fd_array, listening_fd; - - /* Get launchd fd */ - if ((checkin_request = launch_data_new_string(LAUNCH_KEY_CHECKIN)) == - NULL) { - asl_log( - aslc, NULL, ASL_LEVEL_ERR, - "launch_data_new_string(\"" LAUNCH_KEY_CHECKIN - "\") Unable to create string.\n"); - return ERROR_FD; - } - - if ((checkin_response = launch_msg(checkin_request)) == NULL) { - asl_log(aslc, NULL, ASL_LEVEL_WARNING, - "launch_msg(\"" LAUNCH_KEY_CHECKIN "\") IPC failure: %s\n", - strerror( - errno)); - return ERROR_FD; - } - - if (LAUNCH_DATA_ERRNO == launch_data_get_type(checkin_response)) { - // ignore EACCES, which is common if we weren't started by launchd - if (launch_data_get_errno(checkin_response) != EACCES) - asl_log(aslc, NULL, ASL_LEVEL_ERR, - "launchd check-in failed: %s\n", - strerror(launch_data_get_errno( - checkin_response))); - return ERROR_FD; - } - - sockets_dict = launch_data_dict_lookup(checkin_response, - LAUNCH_JOBKEY_SOCKETS); - if (NULL == sockets_dict) { - asl_log(aslc, NULL, ASL_LEVEL_ERR, - "launchd check-in: no sockets found to answer requests on!\n"); - return ERROR_FD; - } - - if (launch_data_dict_get_count(sockets_dict) > 1) { - asl_log(aslc, NULL, ASL_LEVEL_ERR, - "launchd check-in: some sockets will be ignored!\n"); - return ERROR_FD; - } - - listening_fd_array = launch_data_dict_lookup(sockets_dict, - BUNDLE_ID_PREFIX ":0"); - if (NULL == listening_fd_array) { - listening_fd_array = launch_data_dict_lookup(sockets_dict, ":0"); - if (NULL == listening_fd_array) { - asl_log( - aslc, NULL, ASL_LEVEL_ERR, - "launchd check-in: No known sockets found to answer requests on! \"%s:0\" and \":0\" failed.\n", - BUNDLE_ID_PREFIX); - return ERROR_FD; - } - } - - if (launch_data_array_get_count(listening_fd_array) != 1) { - asl_log(aslc, NULL, ASL_LEVEL_ERR, - "launchd check-in: Expected 1 socket from launchd, got %u)\n", - (unsigned)launch_data_array_get_count( - listening_fd_array)); - return ERROR_FD; - } - - listening_fd = launch_data_array_get_index(listening_fd_array, 0); - return launch_data_get_fd(listening_fd); -} diff --git a/hw/xquartz/mach-startup/launchd_fd.h b/hw/xquartz/mach-startup/launchd_fd.h deleted file mode 100644 index 6af03a81d..000000000 --- a/hw/xquartz/mach-startup/launchd_fd.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 2008-2012 Apple Inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifndef _XQUARTZ_LAUNCHD_FD_H_ -#define _XQUARTZ_LAUNCHD_FD_H_ - -#define ERROR_FD -1 - -int -launchd_display_fd(void); - -#endif /* _XQUARTZ_LAUNCHD_FD_H_ */ diff --git a/hw/xquartz/mach-startup/mach_startup.defs b/hw/xquartz/mach-startup/mach_startup.defs deleted file mode 100644 index e47f49c3c..000000000 --- a/hw/xquartz/mach-startup/mach_startup.defs +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2008 Apple Inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#include -#include -import "mach_startup_types.h"; - -subsystem mach_startup 1000; -serverprefix do_; - -type string_t = c_string[1024]; -type string_array_t = array[] of string_t; - -routine start_x11_server( - port : mach_port_t; - argv : string_array_t; - envp : string_array_t); - -routine request_fd_handoff_socket ( - port : mach_port_t; - out socket_filename : string_t); - -routine request_pid ( - port : mach_port_t; - out pid : int); diff --git a/hw/xquartz/mach-startup/mach_startup_types.h b/hw/xquartz/mach-startup/mach_startup_types.h deleted file mode 100644 index 459c750db..000000000 --- a/hw/xquartz/mach-startup/mach_startup_types.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _MACH_STARTUP_TYPES_H_ -#define _MACH_STARTUP_TYPES_H_ - -#define STRING_T_SIZE 1024 - -typedef char string_t[STRING_T_SIZE]; -typedef string_t * string_array_t; - -#endif diff --git a/hw/xquartz/mach-startup/meson.build b/hw/xquartz/mach-startup/meson.build deleted file mode 100644 index 2f7694252..000000000 --- a/hw/xquartz/mach-startup/meson.build +++ /dev/null @@ -1,99 +0,0 @@ -# mach interface -mig = find_program('mig') -mach_startup = custom_target('mach_startup', - command: [mig, - '-sheader', '@OUTPUT0@', '-header', '@OUTPUT2@', - '-server', '@OUTPUT1@', '-user', '@OUTPUT3@', - '@INPUT@'], - input: 'mach_startup.defs', - output: ['mach_startupServer.h', - 'mach_startupServer.c', - 'mach_startup.h', - 'mach_startupUser.c'], -) - -mach_startup_dep = declare_dependency( - sources: mach_startup[2] # mach_startup.h -) - -# common defines -xquartz_defs = [ - bundle_id_def, - '-DXSERVER_VERSION="@0@"'.format(meson.project_version()), - '-DX11BINDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('bindir'))), -] - -# X11.bin -x11appdir = join_paths(bundle_root, 'Contents/MacOS') - -x11_bin_deps = [ - meson.get_compiler('c').find_library('Xplugin'), - dependency('Carbon', method: 'extraframework'), - cocoa, - dependency('CoreAudio', method: 'extraframework'), - dependency('IOKit', method: 'extraframework') -] - -if build_glx - x11_bin_deps += [dependency('OpenGL', method: 'extraframework')] -endif - -if build_sparkle - x11_bin_deps += sparkle -endif - -x11_bin_libs = [ - libXquartz, - libXquartzXpr, - libxpbproxy, - libxserver_fb, - libxserver, - libxserver_xkb_stubs, -] - -if build_glx - x11_bin_libs += [libcglcore, libxserver_glx, libglxvnd] -endif - -x11_bin = executable('X11.bin', - [ - 'bundle-main.c', - mach_startup[1], # mach_startupServer.c - mach_startup[3], # mach_startupUser.c - ], - link_with: x11_bin_libs, - dependencies: [xproto_dep, x11_bin_deps, mach_startup_dep], - include_directories: [inc, '..', top_dir_inc], - c_args: xquartz_defs, - link_args: ['-Objc'], - install: true, - install_dir: x11appdir, -) - -# X11 (Bundle trampoline) -x11 = executable('X11', - [ - 'bundle_trampoline.c', - ], - c_args: xquartz_defs, - link_args: ['-Objc'], - install: true, - install_dir: x11appdir, -) - -# Xquartz -xquartz_deps = [ - dependency('CoreServices', method: 'extraframework'), -] - -xquartz = executable('Xquartz', - [ - 'stub.c', - 'launchd_fd.c', - mach_startup[3], # mach_startupUser.c - ], - include_directories: inc, - c_args: xquartz_defs, - dependencies: [xquartz_deps, mach_startup_dep], - install: true, -) diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c deleted file mode 100644 index 83252e805..000000000 --- a/hw/xquartz/mach-startup/stub.c +++ /dev/null @@ -1,340 +0,0 @@ -/* Copyright (c) 2008-2012 Apple Inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#include - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include - -#include -#include - -#define kX11AppBundleId BUNDLE_ID_PREFIX ".X11" -#define kX11AppBundlePath "/Contents/MacOS/X11" - -#include -#include -#include -#include "mach_startup.h" - -#include - -#include "launchd_fd.h" - -static CFURLRef x11appURL; -static FSRef x11_appRef; -static pid_t x11app_pid = 0; -aslclient aslc; - -static void -set_x11_path(void) -{ - OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), - nil, &x11_appRef, &x11appURL); - - switch (osstatus) { - case noErr: - if (x11appURL == NULL) { - asl_log(aslc, NULL, ASL_LEVEL_ERR, - "Xquartz: Invalid response from LSFindApplicationForInfo(%s)", - kX11AppBundleId); - exit(1); - } - break; - - case kLSApplicationNotFoundErr: - asl_log(aslc, NULL, ASL_LEVEL_ERR, - "Xquartz: Unable to find application for %s", - kX11AppBundleId); - exit(10); - - default: - asl_log(aslc, NULL, ASL_LEVEL_ERR, - "Xquartz: Unable to find application for %s, error code = %d", - kX11AppBundleId, (int)osstatus); - exit(11); - } -} - -static int -connect_to_socket(const char *filename) -{ - struct sockaddr_un servaddr_un; - struct sockaddr *servaddr; - socklen_t servaddr_len; - int ret_fd; - - /* Setup servaddr_un */ - memset(&servaddr_un, 0, sizeof(struct sockaddr_un)); - servaddr_un.sun_family = AF_UNIX; - strlcpy(servaddr_un.sun_path, filename, sizeof(servaddr_un.sun_path)); - - servaddr = (struct sockaddr *)&servaddr_un; - servaddr_len = sizeof(struct sockaddr_un) - - sizeof(servaddr_un.sun_path) + strlen(filename); - - ret_fd = socket(PF_UNIX, SOCK_STREAM, 0); - if (ret_fd == -1) { - asl_log(aslc, NULL, ASL_LEVEL_ERR, - "Xquartz: Failed to create socket: %s - %d - %s", - filename, errno, strerror(errno)); - return -1; - } - - if (connect(ret_fd, servaddr, servaddr_len) < 0) { - asl_log(aslc, NULL, ASL_LEVEL_ERR, - "Xquartz: Failed to connect to socket: %s - %d - %s", - filename, errno, strerror(errno)); - close(ret_fd); - return -1; - } - - return ret_fd; -} - -static void -send_fd_handoff(int connected_fd, int launchd_fd) -{ - char databuf[] = "display"; - struct iovec iov[1]; - - 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; - msg.msg_controllen = sizeof(buf); - msg.msg_name = 0; - msg.msg_namelen = 0; - msg.msg_flags = 0; - - cmsg = CMSG_FIRSTHDR(&msg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(sizeof(int)); - - msg.msg_controllen = cmsg->cmsg_len; - - *((int *)CMSG_DATA(cmsg)) = launchd_fd; - - if (sendmsg(connected_fd, &msg, 0) < 0) { - asl_log(aslc, NULL, ASL_LEVEL_ERR, - "Xquartz: Error sending $DISPLAY file descriptor over fd %d: %d -- %s", - connected_fd, errno, strerror(errno)); - return; - } - - asl_log(aslc, NULL, ASL_LEVEL_DEBUG, - "Xquartz: Message sent. Closing handoff fd."); - close(connected_fd); -} - -__attribute__((__noreturn__)) -static void -signal_handler(int sig) -{ - if (x11app_pid) - kill(x11app_pid, sig); - _exit(0); -} - -int -main(int argc, char **argv, char **envp) -{ - int envpc; - kern_return_t kr; - mach_port_t mp; - string_array_t newenvp; - string_array_t newargv; - size_t i; - int launchd_fd; - string_t handoff_socket_filename; - sig_t handler; - char *asl_sender; - char *asl_facility; - char *server_bootstrap_name = kX11AppBundleId; - - if (getenv("X11_PREFS_DOMAIN")) - server_bootstrap_name = getenv("X11_PREFS_DOMAIN"); - - asprintf(&asl_sender, "%s.stub", server_bootstrap_name); - assert(asl_sender); - - asl_facility = strdup(server_bootstrap_name); - assert(asl_facility); - if (strcmp(asl_facility + strlen(asl_facility) - 4, ".X11") == 0) - asl_facility[strlen(asl_facility) - 4] = '\0'; - - assert(aslc = asl_open(asl_sender, asl_facility, ASL_OPT_NO_DELAY)); - free(asl_sender); - free(asl_facility); - - /* We don't have a mechanism in place to handle this interrupt driven - * server-start notification, so just send the signal now, so xinit doesn't - * time out waiting for it and will just poll for the server. - */ - handler = signal(SIGUSR1, SIG_IGN); - if (handler == SIG_IGN) - kill(getppid(), SIGUSR1); - signal(SIGUSR1, handler); - - /* Pass on SIGs to X11.app */ - signal(SIGINT, signal_handler); - signal(SIGTERM, signal_handler); - - /* Get the $DISPLAY FD */ - launchd_fd = launchd_display_fd(); - - kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); - if (kr != KERN_SUCCESS) { - pid_t child; - - asl_log(aslc, NULL, ASL_LEVEL_WARNING, - "Xquartz: Unable to locate waiting server: %s", - server_bootstrap_name); - set_x11_path(); - - char *listenOnlyArg = "--listenonly"; - CFStringRef silentLaunchArg = CFStringCreateWithCString(NULL, listenOnlyArg, kCFStringEncodingUTF8); - CFStringRef args[] = { silentLaunchArg }; - CFArrayRef passArgv = CFArrayCreate(NULL, (const void**) args, 1, NULL); - LSApplicationParameters params = { 0, /* CFIndex version == 0 */ - kLSLaunchDefaults, /* LSLaunchFlags flags */ - &x11_appRef, /* FSRef application */ - NULL, /* void* asyncLaunchRefCon*/ - NULL, /* CFDictionaryRef environment */ - passArgv, /* CFArrayRef arguments */ - NULL /* AppleEvent* initialEvent */ - }; - - OSStatus status = LSOpenApplication(¶ms, NULL); - if (status != noErr) { - asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Unable to launch: %d", (int)status); - return EXIT_FAILURE; - } - - /* Try connecting for 10 seconds */ - for (i = 0; i < 80; i++) { - usleep(250000); - kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); - if (kr == KERN_SUCCESS) - break; - } - - if (kr != KERN_SUCCESS) { - asl_log(aslc, NULL, ASL_LEVEL_ERR, - "Xquartz: bootstrap_look_up(): %s", bootstrap_strerror(kr)); - return EXIT_FAILURE; - } - } - - /* Get X11.app's pid */ - request_pid(mp, &x11app_pid); - - /* Handoff the $DISPLAY FD */ - if (launchd_fd != -1) { - size_t try, try_max; - int handoff_fd = -1; - - for (try = 0, try_max = 5; try < try_max; try++) { - if (request_fd_handoff_socket(mp, handoff_socket_filename) != KERN_SUCCESS) { - asl_log(aslc, NULL, ASL_LEVEL_INFO, - "Xquartz: Failed to request a socket from the server to send the $DISPLAY fd over (try %d of %d)", - (int)try + 1, (int)try_max); - continue; - } - - handoff_fd = connect_to_socket(handoff_socket_filename); - if (handoff_fd == -1) { - asl_log(aslc, NULL, ASL_LEVEL_ERR, - "Xquartz: Failed to connect to socket (try %d of %d)", - (int)try + 1, (int)try_max); - continue; - } - - asl_log(aslc, NULL, ASL_LEVEL_INFO, - "Xquartz: Handoff connection established (try %d of %d) on fd %d, \"%s\". Sending message.", - (int)try + 1, (int)try_max, handoff_fd, handoff_socket_filename); - send_fd_handoff(handoff_fd, launchd_fd); - close(handoff_fd); - break; - } - } - - /* Count envp */ - for (envpc = 0; envp[envpc]; envpc++) ; - - /* We have fixed-size string lengths due to limitations in IPC, - * so we need to copy our argv and envp. - */ - newargv = (string_array_t)calloc((1 + argc), sizeof(string_t)); - newenvp = (string_array_t)calloc((1 + envpc), sizeof(string_t)); - - if (!newargv || !newenvp) { - /* Silence the clang static analyzer */ - free(newargv); - free(newenvp); - - asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Memory allocation failure"); - return EXIT_FAILURE; - } - - for (i = 0; i < argc; i++) { - strlcpy(newargv[i], argv[i], STRING_T_SIZE); - } - for (i = 0; i < envpc; i++) { - strlcpy(newenvp[i], envp[i], STRING_T_SIZE); - } - - kr = start_x11_server(mp, newargv, argc, newenvp, envpc); - - free(newargv); - free(newenvp); - - if (kr != KERN_SUCCESS) { - asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: start_x11_server: %s", - mach_error_string(kr)); - return EXIT_FAILURE; - } - return EXIT_SUCCESS; -} diff --git a/hw/xquartz/man/Xquartz.man b/hw/xquartz/man/Xquartz.man deleted file mode 100644 index 9b01bbaf3..000000000 --- a/hw/xquartz/man/Xquartz.man +++ /dev/null @@ -1,192 +0,0 @@ -.TH XQUARTZ 1 @vendorversion@ -.SH NAME -Xquartz \- X window system server for Mac OSX -.SH SYNOPSIS -.B Xquartz -[ options ] ... -.SH DESCRIPTION -.I Xquartz -is the X window server for Mac OS X provided by Apple. -.I Xquartz -runs in parallel with Aqua in rootless mode. In rootless mode, the X -window system and Mac OS X share your display. The root window of the -X11 display is the size of the screen and contains all the other -windows. The X11 root window is not displayed in rootless mode as Mac -OS X handles the desktop background. -.SH CUSTOMIZATION -\fIXquartz\fP can be customized using the defaults(1) command. The available options are: -.TP 8 -.B defaults write @bundle_id_prefix@.X11 enable_fake_buttons -boolean true -Emulates a 3 button mouse using modifier keys. By default, the Command modifier -is used to emulate button 2 and Option is used for button 3. Thus, clicking the -first mouse button while holding down Command will act like clicking -button 2. Holding down Option will simulate button 3. -.TP 8 -.B defaults write @bundle_id_prefix@.X11 fake_button2 \fImodifiers\fP -Change the modifier keys used to emulate the second mouse button. By default, -Command is used to emulate the second button. Any combination of the following -modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn -.TP 8 -.B defaults write @bundle_id_prefix@.X11 fake_button3 \fImodifiers\fP -Change the modifier keys used to emulate the second mouse button. By default, -Command is used to emulate the second button. Any combination of the following -modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn -.TP 8 -.B defaults write @bundle_id_prefix@.X11 fullscreen_hotkeys -boolean true -Enable OSX hotkeys while in fullscreen -.TP 8 -.B defaults write @bundle_id_prefix@.X11 fullscreen_menu -boolean true -Show the OSX menu while in fullscreen -.TP 8 -.B defaults write @bundle_id_prefix@.X11 no_quit_alert -boolean true -Disables the alert dialog displayed when attempting to quit X11. -.TP 8 -.B defaults write @bundle_id_prefix@.X11 no_auth -boolean true -Stops the X server requiring that clients authenticate themselves when -connecting. See Xsecurity(@miscmansuffix@). -.TP 8 -.B defaults write @bundle_id_prefix@.X11 nolisten_tcp -boolean false -This will tell the server to listen and accept TCP connections. Doing this without enabling -xauth is a possible security concern. See Xsecurity(@miscmansuffix@). -.TP 8 -.B defaults write @bundle_id_prefix@.X11 enable_system_beep -boolean false -Don't use the standard system beep effect for X11 alerts. -.TP 8 -.B defaults write @bundle_id_prefix@.X11 enable_key_equivalents -boolean false -Disable menu keyboard equivalents while X11 windows are focused. -.TP 8 -.B defaults write @bundle_id_prefix@.X11 depth \fIdepth\fP -Specifies the color bit depth to use. Currently only 15, and 24 color -bits per pixel are supported. If not specified, or a value of -1 is specified, -defaults to the depth of the main display. -.TP 8 -.B defaults write @bundle_id_prefix@.X11 sync_keymap -boolean true -Keep the X11 keymap up to date with the OSX system keymap. -.TP 8 -.B defaults write @bundle_id_prefix@.X11 option_sends_alt -boolean true -The Option key will send Alt_L and Alt_R instead of Mode_switch. -.TP 8 -.B defaults write @bundle_id_prefix@.X11 sync_pasteboard -boolean true -Enable syncing between the OSX pasteboard and clipboard/primary selection buffers in X11. This option needs to be true for any of the other pasteboard sync options to have an effect. -.TP 8 -.B defaults write @bundle_id_prefix@.X11 sync_pasteboard_to_clipboard -boolean true -Update the X11 CLIPBOARD when the OSX NSPasteboard is updated. -.TP 8 -.B defaults write @bundle_id_prefix@.X11 sync_pasteboard_to_primary -boolean true -Update the X11 PRIMARY buffer when the OSX NSPasteboard is updated. -.TP 8 -.B defaults write @bundle_id_prefix@.X11 sync_clipboard_to_pasteboard -boolean true -Update the OSX NSPasteboard when the X11 CLIPBOARD is updated. Note that enabling this option causes the clipboard synchronization to act as a clipboard manager in X11. This makes it impossible to use xclipboard, klipper, or any other such clipboard managers. If you want to use any of these programs, you must disable this option. -.TP 8 -.B defaults write @bundle_id_prefix@.X11 sync_primary_on_select -boolean true -This option defaults to false and is provided only "for experts." It updates the NSPasteboard whenever a new X11 selection is made (rather than requiring you to hit cmd-c to copy the selection to the NSPasteboard). Since the X11 protocol does not require applications to send notification when they change selection, this might not work in all cases (if you run into this problem, try selecting text in another application first, then selecting the text you want). -.TP 8 -.B defaults write @bundle_id_prefix@.X11 enable_test_extensions -boolean true -This option defaults to false and is only accessible through the command line. Enable this option to turn on the DEC-XTRAP, RECORD, and XTEST extensions in the server. -.TP 8 -.B defaults write @bundle_id_prefix@.X11 scroll_in_device_direction -boolean true -This option defaults to false. Enable this option to ensure that X11 scroll events are always in the direction of the device. This overrides the related option in the Mouse/Trackpad section of System Preferences. -.SH OPTIONS -.PP -In addition to the normal server options described in the \fIXserver(1)\fP -manual page, \fIXquartz\fP accepts the following command line switches: -.TP 8 -.B \-fakebuttons -Same as enable_fake_buttons above with value true. -.TP 8 -.B \-nofakebuttons -Same as enable_fake_buttons above with value false. -.TP 8 -.B "\-fakemouse2 \fImodifiers\fP" -Same as fake_button2 above. -.TP 8 -.B "\-fakemouse3 \fImodifiers\fP" -Same as fake_button3 above. -.TP 8 -.B "\-depth \fIdepth\fP" -Same as depth above. -.SH LOGGING -XQuartz stores a server log at ~/Library/Logs/X11.@bundle_id_prefix@.log which -is analogous to /var/log/Xorg.#.log on systems that use the XFree86 DDX such as -Linux, BSD, and Solaris. -.PP -In addition to this server log, XQuartz sends messages to syslogd(8) using -asl(3). These logs are sent to the @bundle_id_prefix@ facility, and you can -watch these logs using the following syslog(1) command: -.TP 8 -.B $ syslog -w -k Facility eq @bundle_id_prefix@ -.PP -or you can include extra information such as the file, line, and function where the message originated: -.TP 8 -.B $ syslog -w -F '$(Time) $(Sender) <$(Level)> $(File):$(Line) $(Function) :: $(Message)' -k Facility eq @bundle_id_prefix@ -.PP -By default, XQuartz sets an ASL mask which prevents it from logging messages -below the ASL_LEVEL_WARNING level (meaning almost all logging is done strictly -to the file referenced above). To force XQuartz to send all log messages to -syslogd(8), you can adjust this mask using the following syslog(1) command: -.TP 8 -.B $ syslog -c X11.bin -d -.PP -The stdout and stderr messages printed by any process launched by XQuartz will -be redirected to this syslog facility with a priority level of ASL_LEVEL_INFO -and ASL_LEVEL_NOTICE respectively. In order to see these messages in syslog, -you will need to adjust XQuartz's asl mask as above but using -i or -n -instead of -d. -.SH "SEE ALSO" -.PP -X(@miscmansuffix@), Xserver(1), xdm(1), xinit(1), syslog(1), syslogd(8) -.PP -https://www.xquartz.org/ -.PP -.SH AUTHORS / HISTORY -X11 was originally ported to Mac OS X Server by John Carmack. Dave -Zarzycki used this as the basis of his port of XFree86 4.0 to Darwin 1.0. -Torrey T. Lyons improved and integrated this code into the XFree86 -Project's mainline for the 4.0.2 release. -.PP -The following members of the XonX Team contributed to the following -releases (in alphabetical order): -.TP 4 -XFree86 4.1.0: -.br -Rob Braun - Darwin x86 support -.br -Torrey T. Lyons - Project Lead -.br -Andreas Monitzer - Cocoa version of XDarwin front end -.br -Gregory Robert Parker - Original Quartz implementation -.br -Christoph Pfisterer - Dynamic shared X libraries -.br -Toshimitsu Tanaka - Japanese localization -.TP 4 -XFree86 4.2.0: -.br -Rob Braun - Darwin x86 support -.br -Pablo Di Noto - Spanish localization -.br -Paul Edens - Dutch localization -.br -Kyunghwan Kim - Korean localization -.br -Mario Klebsch - Non-US keyboard support -.br -Torrey T. Lyons - Project Lead -.br -Andreas Monitzer - German localization -.br -Patrik Montgomery - Swedish localization -.br -Greg Parker - Rootless support -.br -Toshimitsu Tanaka - Japanese localization -.br -Olivier Verdier - French localization -.PP -Code from Apple's X11.app (which was based on XFree86 4.1) was integrated into X.org's XDarwin DDX by Ben Byer for xorg-server-1.2. -The XDarwin DDX was renamed Xquartz to more accurately reflect its state (the pure-darwin backend was removed). -Jeremy Huddleston took over as project lead and brought the project up to the X.org 1.4 server branch. -.PP -Jeremy Huddleston is the current maintainer. diff --git a/hw/xquartz/meson.build b/hw/xquartz/meson.build deleted file mode 100644 index 83e79eae8..000000000 --- a/hw/xquartz/meson.build +++ /dev/null @@ -1,101 +0,0 @@ -add_languages('objc') - -apple_applications_dir = get_option('apple-applications-dir') -apple_application_name = get_option('apple-application-name') -bundle_id_prefix = get_option('bundle-id-prefix') -xquartz_sparkle_feed_url = get_option('sparkle-feed-url') -xquartz_sparkle_public_edkey = get_option('sparkle-public-edkey') - -bundle_version_string = get_option('bundle-version-string') # CFBundleShortVersionString -if bundle_version_string == 'auto' - bundle_version_string = meson.project_version() -endif - -bundle_version = get_option('bundle-version') # CFBundleVersion -if bundle_version == 'auto' - version_arr = bundle_version_string.split('.') - version_major = version_arr[0].to_int() - version_minor = version_arr[1].to_int() - version_tiny = version_arr[2].to_int() - bundle_version = '@0@.@1@.@2@'.format(version_major, version_minor, version_tiny) -endif - -bundle_id_def = '-DBUNDLE_ID_PREFIX="@0@"'.format(bundle_id_prefix) - -bundle_root = join_paths(apple_applications_dir, apple_application_name + '.app') -xquartz_data_dir = join_paths(get_option('prefix'), get_option('datadir'),'X11', 'XQuartz') - -# using sparkle update framework? -build_sparkle = xquartz_sparkle_feed_url != '' and xquartz_sparkle_public_edkey != '' -if build_sparkle - sparkle = dependency('Sparkle', method: 'extraframework') - - sparkle_defs = [ - '-DXQUARTZ_SPARKLE', - '-DXQUARTZ_SPARKLE_FEED_URL=@0@'.format(xquartz_sparkle_feed_url), - '-DXQUARTZ_SPARKLE_PUBLIC_EDKEY=@0@'.format(xquartz_sparkle_public_edkey), - ] -else - sparkle_defs = [] -endif - -# libxquartz -srcs_libxquartz = [ - 'NSUserDefaults+XQuartzDefaults.m', - 'X11Application.m', - 'X11Controller.m', - 'applewm.c', - 'darwin.c', - 'darwinEvents.c', - 'darwinXinput.c', - 'keysym2ucs.c', - 'quartz.c', - 'quartzKeyboard.c', - 'quartzStartup.c', - 'quartzRandR.c', - '../../mi/miinitext.c', - '../../mi/miinitext.h', -] - -libxquartz_defs = [ - '-DUSE_NEW_CLUT', - '-DXFree86Server', - '-DXQUARTZ', - '-DXQUARTZ_DATA_DIR="@0@"'.format(xquartz_data_dir), - '-DXSERVER_VERSION="@0@"'.format(meson.project_version()), - bundle_id_def, - sparkle_defs, -] - -if cc.has_function('dispatch_async') - libxquartz_defs += '-DHAVE_LIBDISPATCH' -endif - -libXquartz = static_library('Xquartz', - srcs_libxquartz, - c_args: libxquartz_defs, - objc_args: libxquartz_defs, - include_directories: [inc, '../../pseudoramiX', '../../miext/rootless', top_dir_inc], - dependencies: [xproto_dep, pixman_dep], - link_with: [libxserver_pseudoramix, libxserver_miext_rootless], -) - -subdir('bundle') -if build_glx - subdir('GL') -endif -subdir('pbproxy') -subdir('xpr') -subdir('mach-startup') - -# manpage -xquartz_man = configure_file( - input: 'man/Xquartz.man', - output: 'Xquartz.1', - configuration: manpage_config, -) -install_man(xquartz_man) - -install_data('defaults.plist', - install_dir: xquartz_data_dir, - install_mode: 'rw-r--r--') diff --git a/hw/xquartz/pbproxy/.gitignore b/hw/xquartz/pbproxy/.gitignore deleted file mode 100644 index 6684920ff..000000000 --- a/hw/xquartz/pbproxy/.gitignore +++ /dev/null @@ -1 +0,0 @@ -xpbproxy diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m deleted file mode 100644 index 825980caf..000000000 --- a/hw/xquartz/pbproxy/app-main.m +++ /dev/null @@ -1,86 +0,0 @@ -/* app-main.m - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#include "pbproxy.h" -#import "x-selection.h" - -/* Stubs */ -char *display = NULL; - -static void -signal_handler(int sig) -{ - switch (sig) { - case SIGHUP: - xpbproxy_prefs_reload = YES; - break; - - default: - _exit(EXIT_SUCCESS); - } -} - -void -ErrorF(const char * f, ...) -{ - va_list args; - - va_start(args, f); - vfprintf(stderr, f, args); - va_end(args); -} - -/* TODO: Have this actually log to ASL */ -void -xq_asl_log(int level, const char *subsystem, const char *file, - const char *function, int line, const char *fmt, - ...) -{ -#ifdef DEBUG - va_list args; - - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); -#endif -} - -int -main(int argc, const char *argv[]) -{ - xpbproxy_is_standalone = YES; - - signal(SIGINT, signal_handler); - signal(SIGTERM, signal_handler); - signal(SIGHUP, signal_handler); - signal(SIGPIPE, SIG_IGN); - - return xpbproxy_run(); -} diff --git a/hw/xquartz/pbproxy/main.m b/hw/xquartz/pbproxy/main.m deleted file mode 100644 index 92cde0437..000000000 --- a/hw/xquartz/pbproxy/main.m +++ /dev/null @@ -1,140 +0,0 @@ -/* main.m - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#include "pbproxy.h" -#import "x-selection.h" - -#include -#include -#include - -Display *xpbproxy_dpy; -int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base; -int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base; -BOOL xpbproxy_have_xfixes; - -extern char *display; - -#ifdef STANDALONE_XPBPROXY -BOOL xpbproxy_is_standalone = NO; -#endif - -x_selection *_selection_object; - -static int -x_io_error_handler(Display *dpy) -{ - /* We lost our connection to the server. */ - - TRACE(); - - /* trigger the thread to restart? - * NO - this would be to a "deeper" problem, and restarts would just - * make things worse... - */ -#ifdef STANDALONE_XPBPROXY - if (xpbproxy_is_standalone) - exit(EXIT_FAILURE); -#endif - - /* Prevent _XIOError from calling exit() */ - pthread_exit(NULL); - return 0; -} - -static int -x_error_handler(Display *dpy, XErrorEvent *errevent) -{ - return 0; -} - -int -xpbproxy_run(void) -{ - @autoreleasepool { - size_t i; - - for (i = 0, xpbproxy_dpy = NULL; !xpbproxy_dpy && i < 5; i++) { - xpbproxy_dpy = XOpenDisplay(NULL); - - if (!xpbproxy_dpy && display) { - char _display[32]; - snprintf(_display, sizeof(_display), ":%s", display); - setenv("DISPLAY", _display, TRUE); - - xpbproxy_dpy = XOpenDisplay(_display); - } - if (!xpbproxy_dpy) - sleep(1); - } - - if (xpbproxy_dpy == NULL) { - ErrorF("xpbproxy: can't open default display\n"); - return EXIT_FAILURE; - } - - XSetIOErrorHandler(x_io_error_handler); - XSetErrorHandler(x_error_handler); - - if (!XAppleWMQueryExtension(xpbproxy_dpy, &xpbproxy_apple_wm_event_base, - &xpbproxy_apple_wm_error_base)) { - ErrorF("xpbproxy: can't open AppleWM server extension\n"); - return EXIT_FAILURE; - } - - xpbproxy_have_xfixes = XFixesQueryExtension(xpbproxy_dpy, &xpbproxy_xfixes_event_base, - &xpbproxy_xfixes_error_base); - - XAppleWMSelectInput(xpbproxy_dpy, AppleWMActivationNotifyMask | AppleWMPasteboardNotifyMask); - - _selection_object = [x_selection new]; - - if (!xpbproxy_input_register()) { - return EXIT_FAILURE; - } - } - - CFRunLoopRun(); - - return EXIT_SUCCESS; -} - -id -xpbproxy_selection_object(void) -{ - return _selection_object; -} - -Time -xpbproxy_current_timestamp(void) -{ - /* FIXME: may want to fetch a timestamp from the server.. */ - return CurrentTime; -} diff --git a/hw/xquartz/pbproxy/meson.build b/hw/xquartz/pbproxy/meson.build deleted file mode 100644 index 206cbdca3..000000000 --- a/hw/xquartz/pbproxy/meson.build +++ /dev/null @@ -1,34 +0,0 @@ -build_standalone_pbproxy = get_option('xpbproxy') - -pbproxy_defs = [ - '-DXQUARTZ_DATA_DIR="@0@"'.format(xquartz_data_dir), - bundle_id_def -] -if build_standalone_pbproxy - pbproxy_defs += ['-DSTANDALONE_XPBPROXY'] -endif - -libapplewm_dep = dependency('applewm', version: '>=1.4') - -libxpbproxy = static_library('xpbproxy', - ['../NSUserDefaults+XQuartzDefaults.m', - 'main.m', - 'x-input.m', - 'x-selection.m'], - include_directories: ['..'], - dependencies: [applewmproto_dep, libapplewm_dep, dependency('xfixes'), dependency('x11')], - objc_args: pbproxy_defs, -) - -cocoa = dependency('Cocoa', method: 'extraframework') - -# standalone xpbproxy -if build_standalone_pbproxy - executable('xpbproxy', - 'app-main.m', - link_with: libxpbproxy, - dependencies: [cocoa, dependency('x11')], - objc_args: pbproxy_defs, - install: true, - ) -endif diff --git a/hw/xquartz/pbproxy/pbproxy.h b/hw/xquartz/pbproxy/pbproxy.h deleted file mode 100644 index 482f95ea6..000000000 --- a/hw/xquartz/pbproxy/pbproxy.h +++ /dev/null @@ -1,99 +0,0 @@ -/* pbproxy.h - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifndef PBPROXY_H -#define PBPROXY_H 1 - -#import - -#include - -#define Cursor X_Cursor -#undef _SHAPE_H_ -#include -#include -#undef Cursor - -#ifdef STANDALONE_XPBPROXY -/* Just used for the standalone to respond to SIGHUP to reload prefs */ -extern BOOL xpbproxy_prefs_reload; - -/* Setting this to YES (for the standalone app) causes us to ignore the - * 'sync_pasteboard' defaults preference since we assume it to be on... this is - * mainly useful for debugging/developing xpbproxy with XQuartz still running. - * Just disable the one in the server with X11's preference pane, then run - * the standalone app. - */ -extern BOOL xpbproxy_is_standalone; -#endif - -/* from main.m */ -extern void -xpbproxy_set_is_active(BOOL state); -extern BOOL -xpbproxy_get_is_active(void); -extern id -xpbproxy_selection_object(void); -extern Time -xpbproxy_current_timestamp(void); -extern int -xpbproxy_run(void); - -extern Display *xpbproxy_dpy; -extern int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base; -extern int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base; -extern BOOL xpbproxy_have_xfixes; - -/* from x-input.m */ -extern BOOL -xpbproxy_input_register(void); - -/* os/log.c or app-main.m */ -extern void -ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1, 2); - -/* from darwin.h */ -_X_ATTRIBUTE_PRINTF(6, 7) -extern void -xq_asl_log(int level, const char *subsystem, const char *file, - const char *function, int line, const char *fmt, - ...); - -#define ASL_LOG(level, subsystem, msg, args ...) xq_asl_log(level, subsystem, \ - __FILE__, \ - __FUNCTION__, \ - __LINE__, msg, \ - ## args) -#define DebugF(msg, args ...) ASL_LOG(ASL_LEVEL_DEBUG, \ - "xpbproxy", msg, \ - ## args) -#define TRACE() DebugF("TRACE") - -#endif /* PBPROXY_H */ diff --git a/hw/xquartz/pbproxy/trick_autotools.c b/hw/xquartz/pbproxy/trick_autotools.c deleted file mode 100644 index 11aff526d..000000000 --- a/hw/xquartz/pbproxy/trick_autotools.c +++ /dev/null @@ -1,5 +0,0 @@ -int -this_is_just_here_to_make_automake_work() -{ - return 0; -} diff --git a/hw/xquartz/pbproxy/x-input.m b/hw/xquartz/pbproxy/x-input.m deleted file mode 100644 index 3be9ce407..000000000 --- a/hw/xquartz/pbproxy/x-input.m +++ /dev/null @@ -1,180 +0,0 @@ -/* x-input.m -- event handling - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#include "pbproxy.h" -#import "x-selection.h" - -#include -#include - -#include -#include -#include - -#include - -static CFRunLoopSourceRef xpbproxy_dpy_source; - -#ifdef STANDALONE_XPBPROXY -BOOL xpbproxy_prefs_reload = NO; -#endif - -/* Timestamp when the X server last told us it's active */ -static Time last_activation_time; - -static void -x_event_apple_wm_notify(XAppleWMNotifyEvent *e) -{ - int type = e->type - xpbproxy_apple_wm_event_base; - int kind = e->kind; - - /* We want to reload prefs even if we're not active */ - if (type == AppleWMActivationNotify && - kind == AppleWMReloadPreferences) - [xpbproxy_selection_object ()reload_preferences]; - - if (![xpbproxy_selection_object ()is_active]) - return; - - switch (type) { - case AppleWMActivationNotify: - switch (kind) { - case AppleWMIsActive: - last_activation_time = e->time; - [xpbproxy_selection_object () x_active:e->time]; - break; - - case AppleWMIsInactive: - [xpbproxy_selection_object () x_inactive:e->time]; - break; - } - break; - - case AppleWMPasteboardNotify: - switch (kind) { - case AppleWMCopyToPasteboard: - [xpbproxy_selection_object () x_copy:e->time]; - } - break; - } -} - -static void -xpbproxy_process_xevents(void) -{ - while (XPending(xpbproxy_dpy) != 0) { @autoreleasepool { - XEvent e; - - XNextEvent(xpbproxy_dpy, &e); - - switch (e.type) { - case SelectionClear: - if ([xpbproxy_selection_object ()is_active]) - [xpbproxy_selection_object () clear_event:&e.xselectionclear]; - break; - - case SelectionRequest: - [xpbproxy_selection_object () request_event:&e.xselectionrequest]; - break; - - case SelectionNotify: - [xpbproxy_selection_object () notify_event:&e.xselection]; - break; - - case PropertyNotify: - [xpbproxy_selection_object () property_event:&e.xproperty]; - break; - - default: - if (e.type >= xpbproxy_apple_wm_event_base && - e.type < xpbproxy_apple_wm_event_base + - AppleWMNumberEvents) { - x_event_apple_wm_notify((XAppleWMNotifyEvent *)&e); - } - else if (e.type == xpbproxy_xfixes_event_base + - XFixesSelectionNotify) { - [xpbproxy_selection_object () xfixes_selection_notify:( - XFixesSelectionNotifyEvent *)&e]; - } - break; - } - - XFlush(xpbproxy_dpy); - }} -} - -static BOOL -add_input_socket(int sock, CFOptionFlags callback_types, - CFSocketCallBack callback, const CFSocketContext *ctx, - CFRunLoopSourceRef *cf_source) -{ - CFSocketRef cf_sock; - - cf_sock = CFSocketCreateWithNative(kCFAllocatorDefault, sock, - callback_types, callback, ctx); - if (cf_sock == NULL) { - close(sock); - return FALSE; - } - - *cf_source = CFSocketCreateRunLoopSource(kCFAllocatorDefault, - cf_sock, 0); - CFRelease(cf_sock); - - if (*cf_source == NULL) - return FALSE; - - CFRunLoopAddSource(CFRunLoopGetCurrent(), - *cf_source, kCFRunLoopDefaultMode); - return TRUE; -} - -static void -x_input_callback(CFSocketRef sock, CFSocketCallBackType type, - CFDataRef address, const void *data, void *info) -{ - -#ifdef STANDALONE_XPBPROXY - if (xpbproxy_prefs_reload) { - [xpbproxy_selection_object ()reload_preferences]; - xpbproxy_prefs_reload = NO; - } -#endif - - xpbproxy_process_xevents(); -} - -BOOL -xpbproxy_input_register(void) -{ - return add_input_socket(ConnectionNumber( - xpbproxy_dpy), kCFSocketReadCallBack, - x_input_callback, NULL, &xpbproxy_dpy_source); -} diff --git a/hw/xquartz/pbproxy/x-selection.h b/hw/xquartz/pbproxy/x-selection.h deleted file mode 100644 index 38967dc45..000000000 --- a/hw/xquartz/pbproxy/x-selection.h +++ /dev/null @@ -1,111 +0,0 @@ -/* x-selection.h -- proxies between NSPasteboard and X11 selections - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifndef X_SELECTION_H -#define X_SELECTION_H 1 - -#include "pbproxy.h" - -#define Cursor X_Cursor -#include -#undef Cursor - -#include - -/* This stores image data or text. */ -struct propdata { - unsigned char *data; - size_t length; - int format; -}; - -struct atom_list { - Atom primary, clipboard, text, utf8_string, string, targets, multiple, - cstring, image_png, image_jpeg, incr, atom, clipboard_manager, - compound_text, atom_pair; -}; - -@interface x_selection : NSObject -{ - @private - - /* The unmapped window we use for fetching selections. */ - Window _selection_window; - - Atom request_atom; - - struct { - struct propdata propdata; - Window requestor; - Atom selection; - } pending; - - /* - * This is the number of times the user has requested a copy. - * Once the copy is completed, we --pending_copy, and if the - * pending_copy is > 0 we do it again. - */ - int pending_copy; - /* - * This is used for the same purpose as pending_copy, but for the - * CLIPBOARD. It also prevents a race with INCR transfers. - */ - int pending_clipboard; - - struct atom_list atoms[1]; -} - -- (void)x_active:(Time)timestamp; -- (void)x_inactive:(Time)timestamp; - -- (void)x_copy:(Time)timestamp; - -- (void)clear_event:(XSelectionClearEvent *)e; -- (void)request_event:(XSelectionRequestEvent *)e; -- (void)notify_event:(XSelectionEvent *)e; -- (void)property_event:(XPropertyEvent *)e; -- (void)xfixes_selection_notify:(XFixesSelectionNotifyEvent *)e; -- (void)handle_selection:(Atom) selection type:(Atom) type propdata:(struct - propdata - *)pdata; -- (void)claim_clipboard; -- (BOOL)set_clipboard_manager_status:(BOOL)value; -- (void)own_clipboard; -- (void)copy_completed:(Atom)selection; - -- (void)reload_preferences; -- (BOOL)is_active; -- (void)send_none:(XSelectionRequestEvent *)e; -@end - -/* main.m */ -extern x_selection * _selection_object; - -#endif /* X_SELECTION_H */ diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m deleted file mode 100644 index f4f2b9a6b..000000000 --- a/hw/xquartz/pbproxy/x-selection.m +++ /dev/null @@ -1,1510 +0,0 @@ -/* x-selection.m -- proxies between NSPasteboard and X11 selections - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#import "x-selection.h" - -#include -#include -#include -#include -#import -#import -#import - -#import "NSUserDefaults+XQuartzDefaults.h" - -/* - * The basic design of the pbproxy code is as follows. - * - * When a client selects text, say from an xterm - we only copy it when the - * X11 Edit->Copy menu item is pressed or the shortcut activated. In this - * case we take the PRIMARY selection, and set it as the NSPasteboard data. - * - * When an X11 client copies something to the CLIPBOARD, pbproxy greedily grabs - * the data, sets it as the NSPasteboard data, and finally sets itself as - * owner of the CLIPBOARD. - * - * When an X11 window is activated we check to see if the NSPasteboard has - * changed. If the NSPasteboard has changed, then we set pbproxy as owner - * of the PRIMARY and CLIPBOARD and respond to requests for text and images. - * - * The behavior is now dynamic since the information above was written. - * The behavior is now dependent on the pbproxy_prefs below. - */ - -/* - * TODO: - * 1. handle MULTIPLE - I need to study the ICCCM further, and find a test app. - * 2. Handle NSPasteboard updates immediately, not on active/inactive - * - Open xterm, run 'cat readme.txt | pbcopy' - */ - -static struct { - BOOL active; - BOOL primary_on_grab; /* This is provided as an option for people who - * want it and has issues that won't ever be - * addressed to make it *always* work. - */ - BOOL clipboard_to_pasteboard; - BOOL pasteboard_to_primary; - BOOL pasteboard_to_clipboard; -} pbproxy_prefs = { YES, NO, YES, YES, YES }; - -@implementation x_selection - -static struct propdata null_propdata = { - NULL, 0, 0 -}; - -#ifdef DEBUG -static void -dump_prefs() -{ - ErrorF("pbproxy preferences:\n" - "\tactive %u\n" - "\tprimary_on_grab %u\n" - "\tclipboard_to_pasteboard %u\n" - "\tpasteboard_to_primary %u\n" - "\tpasteboard_to_clipboard %u\n", - pbproxy_prefs.active, - pbproxy_prefs.primary_on_grab, - pbproxy_prefs.clipboard_to_pasteboard, - pbproxy_prefs.pasteboard_to_primary, - pbproxy_prefs.pasteboard_to_clipboard); -} -#endif - -static void -init_propdata(struct propdata *pdata) -{ - *pdata = null_propdata; -} - -static void -free_propdata(struct propdata *pdata) -{ - free(pdata->data); - *pdata = null_propdata; -} - -/* - * Return True if an error occurs. Return False if pdata has data - * and we finished. - * The property is only deleted when bytesleft is 0 if delete is True. - */ -static Bool -get_property(Window win, Atom property, struct propdata *pdata, Bool delete, - Atom *type) -{ - long offset = 0; - unsigned long numitems, bytesleft = 0; -#ifdef TEST - /* This is used to test the growth handling. */ - unsigned long length = 4UL; -#else - unsigned long length = (100000UL + 3) / 4; -#endif - unsigned char *buf = NULL, *chunk = NULL; - size_t buflen = 0, chunkbytesize = 0; - int format; - - TRACE(); - - if (None == property) - return True; - - do { - unsigned long newbuflen = 0; - unsigned char *newbuf = NULL; - -#ifdef TEST - ErrorF("bytesleft %lu\n", bytesleft); -#endif - - if (Success != XGetWindowProperty(xpbproxy_dpy, win, property, - offset, length, delete, - AnyPropertyType, - type, &format, &numitems, - &bytesleft, &chunk)) { - DebugF("Error while getting window property.\n"); - *pdata = null_propdata; - free(buf); - return True; - } - -#ifdef TEST - ErrorF("format %d numitems %lu bytesleft %lu\n", - format, numitems, bytesleft); - - ErrorF("type %s\n", XGetAtomName(xpbproxy_dpy, *type)); -#endif - - /* Format is the number of bits. */ - if (format == 8) - chunkbytesize = numitems; - else if (format == 16) - chunkbytesize = numitems * sizeof(short); - else if (format == 32) - chunkbytesize = numitems * sizeof(long); - -#ifdef TEST - ErrorF("chunkbytesize %zu\n", chunkbytesize); -#endif - newbuflen = buflen + chunkbytesize; - if (newbuflen > 0) { - newbuf = realloc(buf, newbuflen); - - if (NULL == newbuf) { - XFree(chunk); - free(buf); - return True; - } - - memcpy(newbuf + buflen, chunk, chunkbytesize); - XFree(chunk); - buf = newbuf; - buflen = newbuflen; - /* offset is a multiple of 32 bits*/ - offset += chunkbytesize / 4; - } - else { - if (chunk) - XFree(chunk); - } - -#ifdef TEST - ErrorF("bytesleft %lu\n", bytesleft); -#endif - } while (bytesleft > 0); - - pdata->data = buf; - pdata->length = buflen; - pdata->format = format; - - return /*success*/ False; -} - -/* Implementation methods */ - -/* This finds the preferred type from a TARGETS list.*/ -- (Atom) find_preferred:(struct propdata *)pdata -{ - Atom a = None; - size_t i, step; - Bool png = False, jpeg = False, utf8 = False, string = False; - - TRACE(); - - if (pdata->format != 32) { - ErrorF( - "Atom list is expected to be formatted as an array of 32bit values.\n"); - return None; - } - - for (i = 0, step = sizeof(long); i < pdata->length; i += step) { - a = (Atom) * (long *)(pdata->data + i); - - if (a == atoms->image_png) { - png = True; - } - else if (a == atoms->image_jpeg) { - jpeg = True; - } - else if (a == atoms->utf8_string) { - utf8 = True; - } - else if (a == atoms->string) { - string = True; - } - else { - char *type = XGetAtomName(xpbproxy_dpy, a); - if (type) { - DebugF("Unhandled X11 mime type: %s", type); - XFree(type); - } - } - } - - /*We prefer PNG over strings, and UTF8 over a Latin-1 string.*/ - if (png) - return atoms->image_png; - - if (jpeg) - return atoms->image_jpeg; - - if (utf8) - return atoms->utf8_string; - - if (string) - return atoms->string; - - /* This is evidently something we don't know how to handle.*/ - return None; -} - -/* Return True if this is an INCR-style transfer. */ -- (Bool) is_incr_type:(XSelectionEvent *)e -{ - Atom seltype; - int format; - unsigned long numitems = 0UL, bytesleft = 0UL; - unsigned char *chunk; - - TRACE(); - - if (Success != XGetWindowProperty(xpbproxy_dpy, e->requestor, e->property, - /*offset*/ 0L, /*length*/ 4UL, - /*Delete*/ False, - AnyPropertyType, &seltype, &format, - &numitems, &bytesleft, &chunk)) { - return False; - } - - if (chunk) - XFree(chunk); - - return (seltype == atoms->incr) ? True : False; -} - -/* - * This should be called after a selection has been copied, - * or when the selection is unfinished before a transfer completes. - */ -- (void) release_pending -{ - TRACE(); - - free_propdata(&pending.propdata); - pending.requestor = None; - pending.selection = None; -} - -/* Return True if an error occurs during an append.*/ -/* Return False if the append succeeds. */ -- (Bool) append_to_pending:(struct propdata *)pdata requestor:(Window) - requestor -{ - unsigned char *newdata; - size_t newlength; - - TRACE(); - - if (requestor != pending.requestor) { - [self release_pending]; - pending.requestor = requestor; - } - - newlength = pending.propdata.length + pdata->length; - newdata = realloc(pending.propdata.data, newlength); - - if (NULL == newdata) { - perror("realloc propdata"); - [self release_pending]; - return True; - } - - memcpy(newdata + pending.propdata.length, pdata->data, pdata->length); - pending.propdata.data = newdata; - pending.propdata.length = newlength; - - return False; -} - -/* Called when X11 becomes active (i.e. has key focus) */ -- (void) x_active:(Time)timestamp -{ - static NSInteger changeCount; - NSInteger countNow; - NSPasteboard *pb; - - TRACE(); - - pb = [NSPasteboard generalPasteboard]; - - if (nil == pb) - return; - - countNow = [pb changeCount]; - - if (countNow != changeCount) { - DebugF("changed pasteboard!\n"); - changeCount = countNow; - - if (pbproxy_prefs.pasteboard_to_primary) { - XSetSelectionOwner(xpbproxy_dpy, atoms->primary, - _selection_window, - CurrentTime); - } - - if (pbproxy_prefs.pasteboard_to_clipboard) { - [self own_clipboard]; - } - } - -#if 0 - /*gstaplin: we should perhaps investigate something like this branch above...*/ - if ([_pasteboard availableTypeFromArray: _known_types] != nil) { - /* Pasteboard has data we should proxy; I think it makes - sense to put it on both CLIPBOARD and PRIMARY */ - - XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard, - _selection_window, timestamp); - XSetSelectionOwner(xpbproxy_dpy, atoms->primary, - _selection_window, timestamp); - } -#endif -} - -/* Called when X11 loses key focus */ -- (void) x_inactive:(Time)timestamp -{ - TRACE(); -} - -/* This requests the TARGETS list from the PRIMARY selection owner. */ -- (void) x_copy_request_targets -{ - TRACE(); - - request_atom = atoms->targets; - XConvertSelection(xpbproxy_dpy, atoms->primary, atoms->targets, - atoms->primary, _selection_window, CurrentTime); -} - -/* Called when the Edit/Copy item on the main X11 menubar is selected - * and no appkit window claims it. */ -- (void) x_copy:(Time)timestamp -{ - Window w; - - TRACE(); - - w = XGetSelectionOwner(xpbproxy_dpy, atoms->primary); - - if (None != w) { - ++pending_copy; - - if (1 == pending_copy) { - /* - * There are no other copy operations in progress, so we - * can proceed safely. Otherwise the copy_completed method - * will see that the pending_copy is > 1, and do another copy. - */ - [self x_copy_request_targets]; - } - } -} - -/* Set pbproxy as owner of the SELECTION_MANAGER selection. - * This prevents tools like xclipboard from causing havoc. - * Returns TRUE on success - */ -- (BOOL) set_clipboard_manager_status:(BOOL)value -{ - TRACE(); - - Window owner = XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager); - - if (value) { - if (owner == _selection_window) - return TRUE; - - if (owner != None) { - ErrorF( - "A clipboard manager using window 0x%lx already owns the clipboard selection. " - "pbproxy will not sync clipboard to pasteboard.\n", owner); - return FALSE; - } - - XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager, - _selection_window, - CurrentTime); - return (_selection_window == - XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager)); - } - else { - if (owner != _selection_window) - return TRUE; - - XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager, None, - CurrentTime); - return (None == - XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager)); - } - - return FALSE; -} - -/* - * This occurs when we previously owned a selection, - * and then lost it from another client. - */ -- (void) clear_event:(XSelectionClearEvent *)e -{ - - TRACE(); - - DebugF("e->selection %s\n", XGetAtomName(xpbproxy_dpy, e->selection)); - - if (e->selection == atoms->clipboard) { - /* - * We lost ownership of the CLIPBOARD. - */ - ++pending_clipboard; - - if (1 == pending_clipboard) { - /* Claim the clipboard contents from the new owner. */ - [self claim_clipboard]; - } - } - else if (e->selection == atoms->clipboard_manager) { - if (pbproxy_prefs.clipboard_to_pasteboard) { - /* Another CLIPBOARD_MANAGER has set itself as owner. Disable syncing - * to avoid a race. - */ - ErrorF("Another clipboard manager was started! " - "xpbproxy is disabling syncing with clipboard.\n"); - pbproxy_prefs.clipboard_to_pasteboard = NO; - } - } -} - -/* - * We greedily acquire the clipboard after it changes, and on startup. - */ -- (void) claim_clipboard -{ - Window owner; - - TRACE(); - - if (!pbproxy_prefs.clipboard_to_pasteboard) - return; - - owner = XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard); - if (None == owner) { - /* - * The owner probably died or we are just starting up pbproxy. - * Set pbproxy's _selection_window as the owner, and continue. - */ - DebugF("No clipboard owner.\n"); - [self copy_completed:atoms->clipboard]; - return; - } - else if (owner == _selection_window) { - [self copy_completed:atoms->clipboard]; - return; - } - - DebugF("requesting targets\n"); - - request_atom = atoms->targets; - XConvertSelection(xpbproxy_dpy, atoms->clipboard, atoms->targets, - atoms->clipboard, _selection_window, CurrentTime); - XFlush(xpbproxy_dpy); - /* Now we will get a SelectionNotify event in the future. */ -} - -/* Greedily acquire the clipboard. */ -- (void) own_clipboard -{ - - TRACE(); - - /* We should perhaps have a boundary limit on the number of iterations... */ - do { - XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard, _selection_window, - CurrentTime); - } while (_selection_window != XGetSelectionOwner(xpbproxy_dpy, - atoms->clipboard)); -} - -- (void) init_reply:(XEvent *)reply request:(XSelectionRequestEvent *)e -{ - reply->xselection.type = SelectionNotify; - reply->xselection.selection = e->selection; - reply->xselection.target = e->target; - reply->xselection.requestor = e->requestor; - reply->xselection.time = e->time; - reply->xselection.property = None; -} - -- (void) send_reply:(XEvent *)reply -{ - /* - * We are supposed to use an empty event mask, and not propagate - * the event, according to the ICCCM. - */ - DebugF("reply->xselection.requestor 0x%lx\n", reply->xselection.requestor); - - XSendEvent(xpbproxy_dpy, reply->xselection.requestor, False, 0, reply); - XFlush(xpbproxy_dpy); -} - -/* - * This responds to a TARGETS request. - * The result is a list of a ATOMs that correspond to the types available - * for a selection. - * For instance an application might provide a UTF8_STRING and a STRING - * (in Latin-1 encoding). The requestor can then make the choice based on - * the list. - */ -- (void) send_targets:(XSelectionRequestEvent *)e pasteboard:(NSPasteboard *) - pb -{ - XEvent reply; - NSArray *pbtypes; - - [self init_reply:&reply request:e]; - - pbtypes = [pb types]; - if (pbtypes) { - long list[7]; /* Don't forget to increase this if we handle more types! */ - long count = 0; - - /* - * I'm not sure if this is needed, but some toolkits/clients list - * TARGETS in response to targets. - */ - list[count] = atoms->targets; - ++count; - - if ([pbtypes containsObject:NSStringPboardType]) { - /* We have a string type that we can convert to UTF8, or Latin-1... */ - DebugF("NSStringPboardType\n"); - list[count] = atoms->utf8_string; - ++count; - list[count] = atoms->string; - ++count; - list[count] = atoms->compound_text; - ++count; - } - - /* TODO add the NSPICTPboardType back again, once we have conversion - * functionality in send_image. - */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" // NSPICTPboardType -#endif - - if ([pbtypes containsObject:NSPICTPboardType] - || [pbtypes containsObject:NSTIFFPboardType]) { - /* We can convert a TIFF to a PNG or JPEG. */ - DebugF("NSTIFFPboardType\n"); - list[count] = atoms->image_png; - ++count; - list[count] = atoms->image_jpeg; - ++count; - } - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - - if (count) { - /* We have a list of ATOMs to send. */ - XChangeProperty(xpbproxy_dpy, e->requestor, e->property, - atoms->atom, 32, - PropModeReplace, (unsigned char *)list, - count); - - reply.xselection.property = e->property; - } - } - - [self send_reply:&reply]; -} - -- (void) send_string:(XSelectionRequestEvent *)e utf8:(BOOL)utf8 pasteboard:( - NSPasteboard *)pb -{ - XEvent reply; - NSArray *pbtypes; - NSString *data; - const char *bytes; - NSUInteger length; - - TRACE(); - - [self init_reply:&reply request:e]; - - pbtypes = [pb types]; - - if (![pbtypes containsObject:NSStringPboardType]) { - [self send_reply:&reply]; - return; - } - - DebugF("pbtypes retainCount after containsObject: %lu\n", - [pbtypes retainCount]); - - data = [pb stringForType:NSStringPboardType]; - - if (nil == data) { - [self send_reply:&reply]; - return; - } - - if (utf8) { - bytes = [data UTF8String]; - /* - * We don't want the UTF-8 string length here. - * We want the length in bytes. - */ - length = strlen(bytes); - - if (length < 50) { - DebugF("UTF-8: %s\n", bytes); - DebugF("UTF-8 length: %lu\n", length); - } - } - else { - DebugF("Latin-1\n"); - bytes = [data cStringUsingEncoding:NSISOLatin1StringEncoding]; - /*WARNING: bytes is not NUL-terminated. */ - length = [data lengthOfBytesUsingEncoding:NSISOLatin1StringEncoding]; - } - - DebugF("e->target %s\n", XGetAtomName(xpbproxy_dpy, e->target)); - - XChangeProperty(xpbproxy_dpy, e->requestor, e->property, e->target, - 8, PropModeReplace, (unsigned char *)bytes, length); - - reply.xselection.property = e->property; - - [self send_reply:&reply]; -} - -- (void) send_compound_text:(XSelectionRequestEvent *)e pasteboard:( - NSPasteboard *)pb -{ - XEvent reply; - NSArray *pbtypes; - - TRACE(); - - [self init_reply:&reply request:e]; - - pbtypes = [pb types]; - - if ([pbtypes containsObject: NSStringPboardType]) { - NSString *data = [pb stringForType:NSStringPboardType]; - if (nil != data) { - /* - * Cast to (void *) to avoid a const warning. - * AFAIK Xutf8TextListToTextProperty does not modify the input memory. - */ - void *utf8 = (void *)[data UTF8String]; - char *list[] = { utf8, NULL }; - XTextProperty textprop; - - textprop.value = NULL; - - if (Success == Xutf8TextListToTextProperty(xpbproxy_dpy, list, 1, - XCompoundTextStyle, - &textprop)) { - - if (8 != textprop.format) - DebugF( - "textprop.format is unexpectedly not 8 - it's %d instead\n", - textprop.format); - - XChangeProperty(xpbproxy_dpy, e->requestor, e->property, - atoms->compound_text, textprop.format, - PropModeReplace, textprop.value, - textprop.nitems); - - reply.xselection.property = e->property; - } - - if (textprop.value) - XFree(textprop.value); - - } - } - - [self send_reply:&reply]; -} - -/* Finding a test application that uses MULTIPLE has proven to be difficult. */ -- (void) send_multiple:(XSelectionRequestEvent *)e -{ - XEvent reply; - - TRACE(); - - [self init_reply:&reply request:e]; - - if (None != e->property) {} - - [self send_reply:&reply]; -} - -/* Return nil if an error occurred. */ -/* DO NOT retain the encdata for longer than the length of an event response. - * The autorelease pool will reuse/free it. - */ -- (NSData *) encode_image_data:(NSData *)data type:(NSBitmapImageFileType) - enctype -{ - NSBitmapImageRep *bmimage = nil; - NSData *encdata = nil; - NSDictionary *dict = nil; - - bmimage = [[NSBitmapImageRep alloc] initWithData:data]; - - if (nil == bmimage) - return nil; - - dict = [[NSDictionary alloc] init]; - encdata = [bmimage representationUsingType:enctype properties:dict]; - - if (nil == encdata) { - [dict autorelease]; - [bmimage autorelease]; - return nil; - } - - [dict autorelease]; - [bmimage autorelease]; - - return encdata; -} - -/* Return YES when an error has occurred when trying to send the PICT. */ -/* The caller should send a default response with a property of None when an error occurs. */ -- (BOOL) send_image_pict_reply:(XSelectionRequestEvent *)e - pasteboard:(NSPasteboard *)pb - type:(NSBitmapImageFileType)imagetype -{ - XEvent reply; - NSImage *img = nil; - NSData *data = nil, *encdata = nil; - NSUInteger length; - const void *bytes = NULL; - - img = [[NSImage alloc] initWithPasteboard:pb]; - - if (nil == img) { - return YES; - } - - data = [img TIFFRepresentation]; - - if (nil == data) { - [img autorelease]; - ErrorF("unable to convert PICT to TIFF!\n"); - return YES; - } - - encdata = [self encode_image_data:data type:imagetype]; - if (nil == encdata) { - [img autorelease]; - return YES; - } - - [self init_reply:&reply request:e]; - - length = [encdata length]; - bytes = [encdata bytes]; - - XChangeProperty(xpbproxy_dpy, e->requestor, e->property, e->target, - 8, PropModeReplace, bytes, length); - reply.xselection.property = e->property; - - [self send_reply:&reply]; - - [img autorelease]; - - return NO; /*no error*/ -} - -/* Return YES if an error occurred. */ -/* The caller should send a reply with a property of None when an error occurs. */ -- (BOOL) send_image_tiff_reply:(XSelectionRequestEvent *)e - pasteboard:(NSPasteboard *)pb - type:(NSBitmapImageFileType)imagetype -{ - XEvent reply; - NSData *data = nil; - NSData *encdata = nil; - NSUInteger length; - const void *bytes = NULL; - - data = [pb dataForType:NSTIFFPboardType]; - - if (nil == data) - return YES; - - encdata = [self encode_image_data:data type:imagetype]; - - if (nil == encdata) - return YES; - - [self init_reply:&reply request:e]; - - length = [encdata length]; - bytes = [encdata bytes]; - - XChangeProperty(xpbproxy_dpy, e->requestor, e->property, e->target, - 8, PropModeReplace, bytes, length); - reply.xselection.property = e->property; - - [self send_reply:&reply]; - - return NO; /*no error*/ -} - -- (void) send_image:(XSelectionRequestEvent *)e pasteboard:(NSPasteboard *)pb -{ - NSArray *pbtypes = nil; - NSBitmapImageFileType imagetype = NSPNGFileType; - - TRACE(); - - if (e->target == atoms->image_png) - imagetype = NSPNGFileType; - else if (e->target == atoms->image_jpeg) - imagetype = NSJPEGFileType; - else { - ErrorF( - "internal failure in xpbproxy! imagetype being sent isn't PNG or JPEG.\n"); - } - - pbtypes = [pb types]; - - if (pbtypes) { - if ([pbtypes containsObject:NSTIFFPboardType]) { - if (NO == - [self send_image_tiff_reply:e pasteboard:pb type:imagetype]) - return; - } -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" // NSPICTPboardType -#endif - else if ([pbtypes containsObject:NSPICTPboardType]) -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - { - if (NO == - [self send_image_pict_reply:e pasteboard:pb type:imagetype]) - return; - - /* Fall through intentionally to the send_none: */ - } - } - - [self send_none:e]; -} - -- (void)send_none:(XSelectionRequestEvent *)e -{ - XEvent reply; - - TRACE(); - - [self init_reply:&reply request:e]; - [self send_reply:&reply]; -} - -/* Another client requested the data or targets of data available from the clipboard. */ -- (void)request_event:(XSelectionRequestEvent *)e -{ - NSPasteboard *pb; - - TRACE(); - - /* TODO We should also keep track of the time of the selection, and - * according to the ICCCM "refuse the request" if the event timestamp - * is before we owned it. - * What should we base the time on? How can we get the current time just - * before an XSetSelectionOwner? Is it the server's time, or the clients? - * According to the XSelectionRequestEvent manual page, the Time value - * may be set to CurrentTime or a time, so that makes it a bit different. - * Perhaps we should just punt and ignore races. - */ - - /*TODO we need a COMPOUND_TEXT test app*/ - /*TODO we need a MULTIPLE test app*/ - - pb = [NSPasteboard generalPasteboard]; - if (nil == pb) { - [self send_none:e]; - return; - } - - if (None != e->target) - DebugF("e->target %s\n", XGetAtomName(xpbproxy_dpy, e->target)); - - if (e->target == atoms->targets) { - /* The paste requestor wants to know what TARGETS we support. */ - [self send_targets:e pasteboard:pb]; - } - else if (e->target == atoms->multiple) { - /* - * This isn't finished, and may never be, unless I can find - * a good test app. - */ - [self send_multiple:e]; - } - else if (e->target == atoms->utf8_string) { - [self send_string:e utf8:YES pasteboard:pb]; - } - else if (e->target == atoms->string) { - [self send_string:e utf8:NO pasteboard:pb]; - } - else if (e->target == atoms->compound_text) { - [self send_compound_text:e pasteboard:pb]; - } - else if (e->target == atoms->multiple) { - [self send_multiple:e]; - } - else if (e->target == atoms->image_png || e->target == - atoms->image_jpeg) { - [self send_image:e pasteboard:pb]; - } - else { - [self send_none:e]; - } -} - -/* This handles the events resulting from an XConvertSelection request. */ -- (void) notify_event:(XSelectionEvent *)e -{ - Atom type; - struct propdata pdata; - - TRACE(); - - [self release_pending]; - - if (None == e->property) { - DebugF("e->property is None.\n"); - [self copy_completed:e->selection]; - /* Nothing is selected. */ - return; - } - -#if 0 - ErrorF("e->selection %s\n", XGetAtomName(xpbproxy_dpy, e->selection)); - ErrorF("e->property %s\n", XGetAtomName(xpbproxy_dpy, e->property)); -#endif - - if ([self is_incr_type:e]) { - /* - * This is an INCR-style transfer, which means that we - * will get the data after a series of PropertyNotify events. - */ - DebugF("is INCR\n"); - - if (get_property(e->requestor, e->property, &pdata, /*Delete*/ True, - &type)) { - /* - * An error occurred, so we should invoke the copy_completed:, but - * not handle_selection:type:propdata: - */ - [self copy_completed:e->selection]; - return; - } - - free_propdata(&pdata); - - pending.requestor = e->requestor; - pending.selection = e->selection; - - DebugF("set pending.requestor to 0x%lx\n", pending.requestor); - } - else { - if (get_property(e->requestor, e->property, &pdata, /*Delete*/ True, - &type)) { - [self copy_completed:e->selection]; - return; - } - - /* We have the complete selection data.*/ - [self handle_selection:e->selection type:type propdata:&pdata]; - - DebugF("handled selection with the first notify_event\n"); - } -} - -/* This is used for INCR transfers. See the ICCCM for the details. */ -/* This is used to retrieve PRIMARY and CLIPBOARD selections. */ -- (void) property_event:(XPropertyEvent *)e -{ - struct propdata pdata; - Atom type; - - TRACE(); - - if (None != e->atom) { -#ifdef DEBUG - char *name = XGetAtomName(xpbproxy_dpy, e->atom); - - if (name) { - DebugF("e->atom %s\n", name); - XFree(name); - } -#endif - } - - if (None != pending.requestor && PropertyNewValue == e->state) { - DebugF("pending.requestor 0x%lx\n", pending.requestor); - - if (get_property(e->window, e->atom, &pdata, /*Delete*/ True, - &type)) { - [self copy_completed:pending.selection]; - [self release_pending]; - return; - } - - if (0 == pdata.length) { - /* - * We completed the transfer. - * handle_selection will call copy_completed: for us. - */ - [self handle_selection:pending.selection type:type propdata:& - pending.propdata]; - free_propdata(&pdata); - pending.propdata = null_propdata; - pending.requestor = None; - pending.selection = None; - } - else { - [self append_to_pending:&pdata requestor:e->window]; - free_propdata(&pdata); - } - } -} - -- (void) xfixes_selection_notify:(XFixesSelectionNotifyEvent *)e -{ - if (!pbproxy_prefs.active) - return; - - switch (e->subtype) { - case XFixesSetSelectionOwnerNotify: - if (e->selection == atoms->primary && pbproxy_prefs.primary_on_grab) - [self x_copy:e->timestamp]; - break; - - case XFixesSelectionWindowDestroyNotify: - case XFixesSelectionClientCloseNotify: - default: - ErrorF("Unhandled XFixesSelectionNotifyEvent: subtype=%d\n", - e->subtype); - break; - } -} - -- (void) handle_targets: (Atom)selection propdata:(struct propdata *)pdata -{ - /* Find a type we can handle and prefer from the list of ATOMs. */ - Atom preferred; - char *name; - - TRACE(); - - preferred = [self find_preferred:pdata]; - - if (None == preferred) { - /* - * This isn't required by the ICCCM, but some apps apparently - * don't respond to TARGETS properly. - */ - preferred = atoms->string; - } - - (void)name; /* Avoid a warning with non-debug compiles. */ -#ifdef DEBUG - name = XGetAtomName(xpbproxy_dpy, preferred); - - if (name) { - DebugF("requesting %s\n", name); - } -#endif - request_atom = preferred; - XConvertSelection(xpbproxy_dpy, selection, preferred, selection, - _selection_window, CurrentTime); -} - -/* This handles the image type of selection (typically in CLIPBOARD). */ -/* We convert to a TIFF, so that other applications can paste more easily. */ -- (void) handle_image: (struct propdata *)pdata pasteboard:(NSPasteboard *)pb -{ - NSArray *pbtypes; - NSUInteger length; - NSData *data, *tiff; - NSBitmapImageRep *bmimage; - - TRACE(); - - length = pdata->length; - data = [[NSData alloc] initWithBytes:pdata->data length:length]; - - if (nil == data) { - DebugF("unable to create NSData object!\n"); - return; - } - - DebugF("data retainCount before NSBitmapImageRep initWithData: %lu\n", - [data retainCount]); - - bmimage = [[NSBitmapImageRep alloc] initWithData:data]; - - if (nil == bmimage) { - [data autorelease]; - DebugF("unable to create NSBitmapImageRep!\n"); - return; - } - - DebugF("data retainCount after NSBitmapImageRep initWithData: %lu\n", - [data retainCount]); - - @try - { - tiff = [bmimage TIFFRepresentation]; - } - - @catch (NSException *e) - { - DebugF("NSTIFFException!\n"); - [data autorelease]; - [bmimage autorelease]; - return; - } - - DebugF("bmimage retainCount after TIFFRepresentation %lu\n", - [bmimage retainCount]); - - pbtypes = [NSArray arrayWithObjects:NSTIFFPboardType, nil]; - - if (nil == pbtypes) { - [data autorelease]; - [bmimage autorelease]; - return; - } - - [pb declareTypes:pbtypes owner:nil]; - if (YES != [pb setData:tiff forType:NSTIFFPboardType]) { - DebugF("writing pasteboard data failed!\n"); - } - - [data autorelease]; - - DebugF("bmimage retainCount before release %lu\n", [bmimage retainCount]); - - [bmimage autorelease]; -} - -/* This handles the UTF8_STRING type of selection. */ -- (void) handle_utf8_string:(struct propdata *)pdata pasteboard:(NSPasteboard - *)pb -{ - NSString *string; - NSArray *pbtypes; - - TRACE(); - - string = - [[NSString alloc] initWithBytes:pdata->data length:pdata->length - encoding: - NSUTF8StringEncoding]; - - if (nil == string) - return; - - pbtypes = [NSArray arrayWithObjects:NSStringPboardType, nil]; - - if (nil == pbtypes) { - [string autorelease]; - return; - } - - [pb declareTypes:pbtypes owner:nil]; - - if (YES != [pb setString:string forType:NSStringPboardType]) { - ErrorF("pasteboard setString:forType: failed!\n"); - } - [string autorelease]; - DebugF("done handling utf8 string\n"); -} - -/* This handles the STRING type, which should be in Latin-1. */ -- (void) handle_string: (struct propdata *)pdata pasteboard:(NSPasteboard *) - pb -{ - NSString *string; - NSArray *pbtypes; - - TRACE(); - - string = - [[NSString alloc] initWithBytes:pdata->data length:pdata->length - encoding: - NSISOLatin1StringEncoding]; - - if (nil == string) - return; - - pbtypes = [NSArray arrayWithObjects:NSStringPboardType, nil]; - - if (nil == pbtypes) { - [string autorelease]; - return; - } - - [pb declareTypes:pbtypes owner:nil]; - if (YES != [pb setString:string forType:NSStringPboardType]) { - ErrorF("pasteboard setString:forType failed in handle_string!\n"); - } - [string autorelease]; -} - -/* This is called when the selection is completely retrieved from another client. */ -/* Warning: this frees the propdata. */ -- (void) handle_selection:(Atom)selection type:(Atom)type propdata:(struct - propdata - *)pdata -{ - NSPasteboard *pb; - - TRACE(); - - pb = [NSPasteboard generalPasteboard]; - - if (nil == pb) { - [self copy_completed:selection]; - free_propdata(pdata); - return; - } - - /* - * Some apps it seems set the type to TARGETS instead of ATOM, such as Eterm. - * These aren't ICCCM compliant apps, but we need these to work... - */ - if (request_atom == atoms->targets - && (type == atoms->atom || type == atoms->targets)) { - [self handle_targets:selection propdata:pdata]; - free_propdata(pdata); - return; - } - else if (type == atoms->image_png) { - [self handle_image:pdata pasteboard:pb]; - } - else if (type == atoms->image_jpeg) { - [self handle_image:pdata pasteboard:pb]; - } - else if (type == atoms->utf8_string) { - [self handle_utf8_string:pdata pasteboard:pb]; - } - else if (type == atoms->string) { - [self handle_string:pdata pasteboard:pb]; - } - - free_propdata(pdata); - - [self copy_completed:selection]; -} - -- (void) copy_completed:(Atom)selection -{ - TRACE(); - char *name; - - (void)name; /* Avoid warning with non-debug compiles. */ -#ifdef DEBUG - name = XGetAtomName(xpbproxy_dpy, selection); - if (name) { - DebugF("copy_completed: %s\n", name); - XFree(name); - } -#endif - - if (selection == atoms->primary && pending_copy > 0) { - --pending_copy; - if (pending_copy > 0) { - /* Copy PRIMARY again. */ - [self x_copy_request_targets]; - return; - } - } - else if (selection == atoms->clipboard && pending_clipboard > 0) { - --pending_clipboard; - if (pending_clipboard > 0) { - /* Copy CLIPBOARD. */ - [self claim_clipboard]; - return; - } - else { - /* We got the final data. Now set pbproxy as the owner. */ - [self own_clipboard]; - return; - } - } - - /* - * We had 1 or more primary in progress, and the clipboard arrived - * while we were busy. - */ - if (pending_clipboard > 0) { - [self claim_clipboard]; - } -} - -- (void) reload_preferences -{ - NSUserDefaults * const defaults = NSUserDefaults.xquartzDefaults; - -#ifdef STANDALONE_XPBPROXY - if (xpbproxy_is_standalone) - pbproxy_prefs.active = YES; - else -#endif - pbproxy_prefs.active = [defaults boolForKey:XQuartzPrefKeySyncPasteboard]; - pbproxy_prefs.primary_on_grab = [defaults boolForKey:XQuartzPrefKeySyncPrimaryOnSelect]; - pbproxy_prefs.clipboard_to_pasteboard = [defaults boolForKey:XQuartzPrefKeySyncClipboardToPasteBoard]; - pbproxy_prefs.pasteboard_to_primary = [defaults boolForKey:XQuartzPrefKeySyncPasteboardToPrimary]; - pbproxy_prefs.pasteboard_to_clipboard = [defaults boolForKey:XQuartzPrefKeySyncPasteboardToClipboard]; - - /* This is used for debugging. */ - //dump_prefs(); - - if (pbproxy_prefs.active && pbproxy_prefs.primary_on_grab && - !xpbproxy_have_xfixes) { - ErrorF( - "Disabling sync_primary_on_select functionality due to missing XFixes extension.\n"); - pbproxy_prefs.primary_on_grab = NO; - } - - /* Claim or release the CLIPBOARD_MANAGER atom */ - if (![self set_clipboard_manager_status:(pbproxy_prefs.active && - pbproxy_prefs. - clipboard_to_pasteboard)]) - pbproxy_prefs.clipboard_to_pasteboard = NO; - - if (pbproxy_prefs.active && pbproxy_prefs.clipboard_to_pasteboard) - [self claim_clipboard]; -} - -- (BOOL) is_active -{ - return pbproxy_prefs.active; -} - -/* NSPasteboard-required methods */ - -- (void) paste:(id)sender -{ - TRACE(); -} - -- (void) pasteboard:(NSPasteboard *)pb provideDataForType:(NSString *)type -{ - TRACE(); -} - -- (void) pasteboardChangedOwner:(NSPasteboard *)pb -{ - TRACE(); - - /* Right now we don't care with this. */ -} - -/* Allocation */ - -- (id) init -{ - unsigned long pixel; - - self = [super init]; - if (self == nil) - return nil; - - atoms->primary = XInternAtom(xpbproxy_dpy, "PRIMARY", False); - atoms->clipboard = XInternAtom(xpbproxy_dpy, "CLIPBOARD", False); - atoms->text = XInternAtom(xpbproxy_dpy, "TEXT", False); - atoms->utf8_string = XInternAtom(xpbproxy_dpy, "UTF8_STRING", False); - atoms->string = XInternAtom(xpbproxy_dpy, "STRING", False); - atoms->targets = XInternAtom(xpbproxy_dpy, "TARGETS", False); - atoms->multiple = XInternAtom(xpbproxy_dpy, "MULTIPLE", False); - atoms->cstring = XInternAtom(xpbproxy_dpy, "CSTRING", False); - atoms->image_png = XInternAtom(xpbproxy_dpy, "image/png", False); - atoms->image_jpeg = XInternAtom(xpbproxy_dpy, "image/jpeg", False); - atoms->incr = XInternAtom(xpbproxy_dpy, "INCR", False); - atoms->atom = XInternAtom(xpbproxy_dpy, "ATOM", False); - atoms->clipboard_manager = XInternAtom(xpbproxy_dpy, "CLIPBOARD_MANAGER", - False); - atoms->compound_text = XInternAtom(xpbproxy_dpy, "COMPOUND_TEXT", False); - atoms->atom_pair = XInternAtom(xpbproxy_dpy, "ATOM_PAIR", False); - - pixel = BlackPixel(xpbproxy_dpy, DefaultScreen(xpbproxy_dpy)); - _selection_window = - XCreateSimpleWindow(xpbproxy_dpy, DefaultRootWindow(xpbproxy_dpy), - 0, 0, 1, 1, 0, pixel, pixel); - - /* This is used to get PropertyNotify events when doing INCR transfers. */ - XSelectInput(xpbproxy_dpy, _selection_window, PropertyChangeMask); - - request_atom = None; - - init_propdata(&pending.propdata); - pending.requestor = None; - pending.selection = None; - - pending_copy = 0; - pending_clipboard = 0; - - if (xpbproxy_have_xfixes) - XFixesSelectSelectionInput(xpbproxy_dpy, _selection_window, - atoms->primary, - XFixesSetSelectionOwnerNotifyMask); - - [self reload_preferences]; - - return self; -} - -- (void) dealloc -{ - if (None != _selection_window) { - XDestroyWindow(xpbproxy_dpy, _selection_window); - _selection_window = None; - } - - free_propdata(&pending.propdata); - - [super dealloc]; -} - -@end diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c deleted file mode 100644 index 4bbe56b93..000000000 --- a/hw/xquartz/quartz.c +++ /dev/null @@ -1,554 +0,0 @@ -/* - * - * Quartz-specific support for the Darwin X Server - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * Copyright (c) 2001-2004 Greg Parker and Torrey T. Lyons. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#include "sanitizedCarbon.h" - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "quartzRandR.h" -#include "inputstr.h" -#include "quartz.h" -#include "darwin.h" -#include "darwinEvents.h" -#include "pseudoramiX.h" -#include "extension.h" -#include "nonsdk_extinit.h" -#include "glx_extinit.h" -#define _APPLEWM_SERVER_ -#include "applewmExt.h" - -#include "X11Application.h" - -#include - -// X headers -#include "scrnintstr.h" -#include "windowstr.h" -#include "colormapst.h" -#include "globals.h" -#include "mi.h" - -// System headers -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -// These are vended by the Objective-C runtime, but they are unfortunately -// not available as API in the macOS SDK. We are following suit with swift -// and clang in declaring them inline here. They canot be removed or changed -// in the OS without major bincompat ramifications. -// -// These were added in macOS 10.7. -void * _Nonnull objc_autoreleasePoolPush(void); -void objc_autoreleasePoolPop(void * _Nonnull context); - -DevPrivateKeyRec quartzScreenKeyRec; -int aquaMenuBarHeight = 0; -QuartzModeProcsPtr quartzProcs = NULL; -const char *quartzOpenGLBundle = NULL; - -/* These are initialized by X11Application with default values set in NSUserDefaults+XQuartzDefaults */ -Bool XQuartzFullscreenDisableHotkeys; -Bool XQuartzOptionSendsAlt; -Bool XQuartzEnableKeyEquivalents; -Bool XQuartzFullscreenMenu; -Bool XQuartzRootlessDefault; - -Bool XQuartzFullscreenVisible = FALSE; -Bool XQuartzIsRootless = TRUE; -Bool XQuartzServerVisible = FALSE; - -int32_t XQuartzShieldingWindowLevel = 0; - -/* - =========================================================================== - - Screen functions - - =========================================================================== - */ - -/* - * QuartzAddScreen - * Do mode dependent initialization of each screen for Quartz. - */ -Bool -QuartzAddScreen(int index, - ScreenPtr pScreen) -{ - // The clang static analyzer thinks we leak displayInfo here -#ifndef __clang_analyzer__ - // allocate space for private per screen Quartz specific storage - QuartzScreenPtr displayInfo = calloc(sizeof(QuartzScreenRec), 1); - - // QUARTZ_PRIV(pScreen) = displayInfo; - dixSetPrivate(&pScreen->devPrivates, quartzScreenKey, displayInfo); -#endif /* __clang_analyzer__ */ - - // do Quartz mode specific initialization - return quartzProcs->AddScreen(index, pScreen); -} - -/* - * QuartzSetupScreen - * Finalize mode specific setup of each screen. - */ -Bool -QuartzSetupScreen(int index, - ScreenPtr pScreen) -{ - // do Quartz mode specific setup - if (!quartzProcs->SetupScreen(index, pScreen)) - return FALSE; - - // setup cursor support - if (!quartzProcs->InitCursor(pScreen)) - return FALSE; - -#if defined(RANDR) - if (!QuartzRandRInit(pScreen)) { - DEBUG_LOG("Failed to init RandR extension.\n"); - return FALSE; - } -#endif - - return TRUE; -} - -/* - * QuartzBlockHandler - * Clean out any autoreleased objects. - */ -static void -QuartzBlockHandler(void *blockData, void *pTimeout) -{ - static void *poolToken = NULL; - - if (poolToken) { - objc_autoreleasePoolPop(poolToken); - } - poolToken = objc_autoreleasePoolPush(); -} - -/* - * QuartzWakeupHandler - */ -static void -QuartzWakeupHandler(void *blockData, int result) -{ - /* nothing here */ -} - -/* - * QuartzInitOutput - * Quartz display initialization. - */ -void -QuartzInitOutput(int argc, - char **argv) -{ - /* For XQuartz, we want to just use the default signal handler to work better with CrashTracer */ - signal(SIGSEGV, SIG_DFL); - signal(SIGABRT, SIG_DFL); - signal(SIGILL, SIG_DFL); -#ifdef SIGEMT - signal(SIGEMT, SIG_DFL); -#endif - signal(SIGFPE, SIG_DFL); -#ifdef SIGBUS - signal(SIGBUS, SIG_DFL); -#endif -#ifdef SIGSYS - signal(SIGSYS, SIG_DFL); -#endif -#ifdef SIGXCPU - signal(SIGXCPU, SIG_DFL); -#endif -#ifdef SIGXFSZ - signal(SIGXFSZ, SIG_DFL); -#endif - - if (!RegisterBlockAndWakeupHandlers(QuartzBlockHandler, - QuartzWakeupHandler, - NULL)) { - FatalError("Could not register block and wakeup handlers."); - } - - if (!dixRegisterPrivateKey(&quartzScreenKeyRec, PRIVATE_SCREEN, 0)) - FatalError("Failed to alloc quartz screen private.\n"); - - // Do display mode specific initialization - quartzProcs->DisplayInit(); -} - -/* - * QuartzInitInput - * Inform the main thread the X server is ready to handle events. - */ -void -QuartzInitInput(int argc, - char **argv) -{ - X11ApplicationSetCanQuit(0); - X11ApplicationServerReady(); - // Do final display mode specific initialization before handling events - if (quartzProcs->InitInput) - quartzProcs->InitInput(argc, argv); -} - -void -QuartzUpdateScreens(void) -{ - ScreenPtr pScreen; - WindowPtr pRoot; - int x, y, width, height, sx, sy; - xEvent e; - BoxRec bounds; - - if (noPseudoramiXExtension || screenInfo.numScreens != 1) { - /* FIXME: if not using Xinerama, we have multiple screens, and - to do this properly may need to add or remove screens. Which - isn't possible. So don't do anything. Another reason why - we default to running with Xinerama. */ - - return; - } - - pScreen = screenInfo.screens[0]; - - PseudoramiXResetScreens(); - quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height, pScreen); - - pScreen->x = x; - pScreen->y = y; - pScreen->mmWidth = pScreen->mmWidth * ((double)width / pScreen->width); - pScreen->mmHeight = pScreen->mmHeight * ((double)height / pScreen->height); - pScreen->width = width; - pScreen->height = height; - - DarwinAdjustScreenOrigins(&screenInfo); - - /* DarwinAdjustScreenOrigins or UpdateScreen may change pScreen->x/y, - * so use it rather than x/y - */ - sx = pScreen->x + darwinMainScreenX; - sy = pScreen->y + darwinMainScreenY; - - /* Adjust the root window. */ - pRoot = pScreen->root; - AppleWMSetScreenOrigin(pRoot); - pScreen->ResizeWindow(pRoot, x - sx, y - sy, width, height, NULL); - - /* pointer events are clipped to old display region after display reconfiguration - * http://xquartz.macosforge.org/trac/ticket/346 - */ - bounds.x1 = 0; - bounds.x2 = width; - bounds.y1 = 0; - bounds.y2 = height; - pScreen->ConstrainCursor(inputInfo.pointer, pScreen, &bounds); - inputInfo.pointer->spriteInfo->sprite->physLimits = bounds; - inputInfo.pointer->spriteInfo->sprite->hotLimits = bounds; - - DEBUG_LOG( - "Root Window: %dx%d @ (%d, %d) darwinMainScreen (%d, %d) xy (%d, %d) dixScreenOrigins (%d, %d)\n", - width, height, x - sx, y - sy, darwinMainScreenX, darwinMainScreenY, - x, y, - pScreen->x, pScreen->y); - - /* Send an event for the root reconfigure */ - e.u.u.type = ConfigureNotify; - e.u.configureNotify.window = pRoot->drawable.id; - e.u.configureNotify.aboveSibling = None; - e.u.configureNotify.x = x - sx; - e.u.configureNotify.y = y - sy; - e.u.configureNotify.width = width; - e.u.configureNotify.height = height; - e.u.configureNotify.borderWidth = wBorderWidth(pRoot); - e.u.configureNotify.override = pRoot->overrideRedirect; - DeliverEvents(pRoot, &e, 1, NullWindow); - - quartzProcs->UpdateScreen(pScreen); - - /* PaintWindow needs to be called after RootlessUpdateScreenPixmap (from xprUpdateScreen) */ - pScreen->PaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND); - - /* Tell RandR about the new size, so new connections get the correct info */ - RRScreenSizeNotify(pScreen); -} - -static void -pokeActivityCallback(CFRunLoopTimerRef timer, void *info) -{ - UpdateSystemActivity(OverallAct); -} - -static void -QuartzScreenSaver(int state) -{ - static CFRunLoopTimerRef pokeActivityTimer = NULL; - static CFRunLoopTimerContext pokeActivityContext = - { 0, NULL, NULL, NULL, NULL }; - static OSSpinLock pokeActivitySpinLock = OS_SPINLOCK_INIT; - - OSSpinLockLock(&pokeActivitySpinLock); - - if (state) { - if (pokeActivityTimer == NULL) - goto QuartzScreenSaverEnd; - - CFRunLoopTimerInvalidate(pokeActivityTimer); - CFRelease(pokeActivityTimer); - pokeActivityTimer = NULL; - } - else { - if (pokeActivityTimer != NULL) - goto QuartzScreenSaverEnd; - - pokeActivityTimer = CFRunLoopTimerCreate(NULL, - CFAbsoluteTimeGetCurrent(), - 30, 0, 0, - pokeActivityCallback, - &pokeActivityContext); - if (pokeActivityTimer == NULL) { - ErrorF("Unable to create pokeActivityTimer.\n"); - goto QuartzScreenSaverEnd; - } - - CFRunLoopAddTimer( - CFRunLoopGetMain(), pokeActivityTimer, kCFRunLoopCommonModes); - } -QuartzScreenSaverEnd: - OSSpinLockUnlock(&pokeActivitySpinLock); -} - -void -QuartzShowFullscreen(int state) -{ - int i; - - DEBUG_LOG("QuartzShowFullscreen: state=%d\n", state); - - if (XQuartzIsRootless) { - ErrorF("QuartzShowFullscreen called while in rootless mode.\n"); - return; - } - - QuartzScreenSaver(!state); - - if (XQuartzFullscreenVisible == state) - return; - - XQuartzFullscreenVisible = state; - - xp_disable_update(); - - if (!XQuartzFullscreenVisible) - RootlessHideAllWindows(); - - RootlessUpdateRooted(XQuartzFullscreenVisible); - - if (XQuartzFullscreenVisible) { - RootlessShowAllWindows(); - for (i = 0; i < screenInfo.numScreens; i++) { - ScreenPtr pScreen = screenInfo.screens[i]; - RootlessRepositionWindows(pScreen); - // JH: I don't think this is necessary, but keeping it here as a reminder - //RootlessUpdateScreenPixmap(pScreen); - } - } - - /* Somehow the menubar manages to interfere with our event stream - * in fullscreen mode, even though it's not visible. - */ - X11ApplicationShowHideMenubar(!XQuartzFullscreenVisible); - - xp_reenable_update(); - - if (XQuartzFullscreenDisableHotkeys) - xp_disable_hot_keys(XQuartzFullscreenVisible); -} - -void -QuartzSetRootless(Bool state) -{ - DEBUG_LOG("QuartzSetRootless state=%d\n", state); - - if (XQuartzIsRootless == state) - return; - - if (state) - QuartzShowFullscreen(FALSE); - - XQuartzIsRootless = state; - - xp_disable_update(); - - /* When in rootless, the menubar is not part of the screen, so we need to update our screens on toggle */ - QuartzUpdateScreens(); - - if (XQuartzIsRootless) { - RootlessShowAllWindows(); - } - else { - RootlessHideAllWindows(); - } - - X11ApplicationShowHideMenubar(TRUE); - - xp_reenable_update(); - - xp_disable_hot_keys(FALSE); -} - -/* - * QuartzShow - * Show the X server on screen. Does nothing if already shown. - * Calls mode specific screen resume to restore the X clip regions - * (if needed) and the X server cursor state. - */ -void -QuartzShow(void) -{ - int i; - - if (XQuartzServerVisible) - return; - - XQuartzServerVisible = TRUE; - for (i = 0; i < screenInfo.numScreens; i++) { - if (screenInfo.screens[i]) { - quartzProcs->ResumeScreen(screenInfo.screens[i]); - } - } - - if (!XQuartzIsRootless) - QuartzShowFullscreen(TRUE); -} - -/* - * QuartzHide - * Remove the X server display from the screen. Does nothing if already - * hidden. Calls mode specific screen suspend to set X clip regions to - * prevent drawing (if needed) and restore the Aqua cursor. - */ -void -QuartzHide(void) -{ - int i; - - if (XQuartzServerVisible) { - for (i = 0; i < screenInfo.numScreens; i++) { - if (screenInfo.screens[i]) { - quartzProcs->SuspendScreen(screenInfo.screens[i]); - } - } - } - - if (!XQuartzIsRootless) - QuartzShowFullscreen(FALSE); - XQuartzServerVisible = FALSE; -} - -/* - * QuartzSetRootClip - * Enable or disable rendering to the X screen. - */ -void -QuartzSetRootClip(int mode) -{ - int i; - - if (!XQuartzServerVisible) - return; - - for (i = 0; i < screenInfo.numScreens; i++) { - if (screenInfo.screens[i]) { - SetRootClip(screenInfo.screens[i], mode); - } - } -} - -/* - * QuartzSpaceChanged - * Unmap offscreen windows, map onscreen windows - */ -void -QuartzSpaceChanged(uint32_t space_id) -{ - /* Do something special here, so we don't depend on quartz-wm for spaces to work... */ - DEBUG_LOG("Space Changed (%u) ... do something interesting...\n", - space_id); -} - -/* - * QuartzCopyDisplayIDs - * Associate an X11 screen with one or more CoreGraphics display IDs by copying - * the list into a private array. Free the previously copied array, if present. - */ -void -QuartzCopyDisplayIDs(ScreenPtr pScreen, - int displayCount, CGDirectDisplayID *displayIDs) -{ - QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen); - - free(pQuartzScreen->displayIDs); - if (displayCount) { - size_t size = displayCount * sizeof(CGDirectDisplayID); - pQuartzScreen->displayIDs = malloc(size); - memcpy(pQuartzScreen->displayIDs, displayIDs, size); - } - else { - pQuartzScreen->displayIDs = NULL; - } - pQuartzScreen->displayCount = displayCount; -} - -void -NSBeep(void); -void -DDXRingBell(int volume, // volume is % of max - int pitch, // pitch is Hz - int duration) // duration is milliseconds -{ - if (volume) - NSBeep(); -} diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h deleted file mode 100644 index 3a456f573..000000000 --- a/hw/xquartz/quartz.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * quartz.h - * - * External interface of the Quartz display modes seen by the generic, mode - * independent parts of the Darwin X server. - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * Copyright (c) 2001-2003 Greg Parker and Torrey T. Lyons. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifndef _QUARTZ_H -#define _QUARTZ_H - -#include -#include "privates.h" - -#include "screenint.h" -#include "window.h" -#include "pixmap.h" - -/*------------------------------------------ - Quartz display mode function types - ------------------------------------------*/ - -/* - * Display mode initialization - */ -typedef void (*DisplayInitProc)(void); -typedef Bool (*AddScreenProc)(int index, ScreenPtr pScreen); -typedef Bool (*SetupScreenProc)(int index, ScreenPtr pScreen); -typedef void (*InitInputProc)(int argc, char **argv); - -/* - * Cursor functions - */ -typedef Bool (*InitCursorProc)(ScreenPtr pScreen); - -/* - * Suspend and resume X11 activity - */ -typedef void (*SuspendScreenProc)(ScreenPtr pScreen); -typedef void (*ResumeScreenProc)(ScreenPtr pScreen); - -/* - * Screen state change support - */ -typedef void (*AddPseudoramiXScreensProc) - (int *x, int *y, int *width, int *height, ScreenPtr pScreen); -typedef void (*UpdateScreenProc)(ScreenPtr pScreen); - -/* - * Rootless helper functions - */ -typedef Bool (*IsX11WindowProc)(int windowNumber); -typedef void (*HideWindowsProc)(Bool hide); - -/* - * Rootless functions for optional export to GLX layer - */ -typedef void * (*FrameForWindowProc)(WindowPtr pWin, Bool create); -typedef WindowPtr (*TopLevelParentProc)(WindowPtr pWindow); -typedef Bool (*CreateSurfaceProc) - (ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, - unsigned int client_id, unsigned int *surface_id, - unsigned int key[2], void (*notify)(void *arg, void *data), - void *notify_data); -typedef Bool (*DestroySurfaceProc) - (ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, - void (*notify)(void *arg, void *data), void *notify_data); - -/* - * Quartz display mode function list - */ -typedef struct _QuartzModeProcs { - DisplayInitProc DisplayInit; - AddScreenProc AddScreen; - SetupScreenProc SetupScreen; - InitInputProc InitInput; - - InitCursorProc InitCursor; - - SuspendScreenProc SuspendScreen; - ResumeScreenProc ResumeScreen; - - AddPseudoramiXScreensProc AddPseudoramiXScreens; - UpdateScreenProc UpdateScreen; - - IsX11WindowProc IsX11Window; - HideWindowsProc HideWindows; - - FrameForWindowProc FrameForWindow; - TopLevelParentProc TopLevelParent; - CreateSurfaceProc CreateSurface; - DestroySurfaceProc DestroySurface; -} QuartzModeProcsRec, *QuartzModeProcsPtr; - -extern QuartzModeProcsPtr quartzProcs; - -extern Bool XQuartzFullscreenVisible; /* Are the windows visible (predicated on !rootless) */ -extern Bool XQuartzServerVisible; /* Is the server visible ... TODO: Refactor to "active" */ -extern Bool XQuartzEnableKeyEquivalents; -extern Bool XQuartzRootlessDefault; /* Is our default mode rootless? */ -extern Bool XQuartzIsRootless; /* Is our current mode rootless (or FS)? */ -extern Bool XQuartzFullscreenMenu; /* Show the menu bar (autohide) while in FS */ -extern Bool XQuartzFullscreenDisableHotkeys; -extern Bool XQuartzOptionSendsAlt; /* Alt or Mode_switch? */ - -extern int32_t XQuartzShieldingWindowLevel; /* CGShieldingWindowLevel() or 0 */ - -// Other shared data -extern DevPrivateKeyRec quartzScreenKeyRec; -#define quartzScreenKey (&quartzScreenKeyRec) -extern int aquaMenuBarHeight; - -// Name of GLX bundle for native OpenGL -extern const char *quartzOpenGLBundle; - -Bool -QuartzAddScreen(int index, ScreenPtr pScreen); -Bool -QuartzSetupScreen(int index, ScreenPtr pScreen); -void -QuartzInitOutput(int argc, char **argv); -void -QuartzInitInput(int argc, char **argv); -void -QuartzInitServer(int argc, char **argv, char **envp); -void -QuartzGiveUp(void); -void -QuartzProcessEvent(xEvent *xe); -void -QuartzUpdateScreens(void); - -void -QuartzShow(void); -void -QuartzHide(void); -void -QuartzSetRootClip(int mode); -void -QuartzSpaceChanged(uint32_t space_id); - -void -QuartzSetRootless(Bool state); -void -QuartzShowFullscreen(Bool state); - -int -server_main(int argc, char **argv, char **envp); -#endif diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c deleted file mode 100644 index c35a2d15d..000000000 --- a/hw/xquartz/quartzKeyboard.c +++ /dev/null @@ -1,884 +0,0 @@ -/* - quartzKeyboard.c: Keyboard support for Xquartz - - Copyright (c) 2003-2012 Apple Inc. - Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. - Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved. - - Copyright (C) 1999,2000 by Eric Sunshine - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN - NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sanitizedCarbon.h" - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#define HACK_MISSING 1 -#define HACK_KEYPAD 1 -#define HACK_BLACKLIST 1 - -#include -#include -#include -#include -#include - -#include "quartz.h" -#include "darwin.h" -#include "darwinEvents.h" - -#include "quartzKeyboard.h" - -#include "X11Application.h" - -#include -#include - -#include "xkbsrv.h" -#include "exevents.h" -#include "X11/keysym.h" -#include "keysym2ucs.h" - -extern void -CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master); - -enum { - MOD_COMMAND = 256, - MOD_SHIFT = 512, - MOD_OPTION = 2048, - MOD_CONTROL = 4096, -}; - -#define UKEYSYM(u) ((u) | 0x01000000) - -#if HACK_MISSING -/* Table of keycode->keysym mappings we use to fallback on for important - keys that are often not in the Unicode mapping. */ - -const static struct { - unsigned short keycode; - KeySym keysym; -} known_keys[] = { - { 55, XK_Meta_L }, - { 56, XK_Shift_L }, - { 57, XK_Caps_Lock }, - { 58, XK_Alt_L }, - { 59, XK_Control_L }, - - { 60, XK_Shift_R }, - { 61, XK_Alt_R }, - { 62, XK_Control_R }, - { 63, XK_Meta_R }, - - { 110, XK_Menu }, - - { 122, XK_F1 }, - { 120, XK_F2 }, - { 99, XK_F3 }, - { 118, XK_F4 }, - { 96, XK_F5 }, - { 97, XK_F6 }, - { 98, XK_F7 }, - { 100, XK_F8 }, - { 101, XK_F9 }, - { 109, XK_F10 }, - { 103, XK_F11 }, - { 111, XK_F12 }, - { 105, XK_F13 }, - { 107, XK_F14 }, - { 113, XK_F15 }, - { 106, XK_F16 }, - { 64, XK_F17 }, - { 79, XK_F18 }, - { 80, XK_F19 }, - { 90, XK_F20 }, -}; -#endif - -#if HACK_KEYPAD -/* Table of keycode->old,new-keysym mappings we use to fixup the numeric - keypad entries. */ - -const static struct { - unsigned short keycode; - KeySym normal, keypad; -} known_numeric_keys[] = { - { 65, XK_period, XK_KP_Decimal }, - { 67, XK_asterisk, XK_KP_Multiply }, - { 69, XK_plus, XK_KP_Add }, - { 75, XK_slash, XK_KP_Divide }, - { 76, 0x01000003, XK_KP_Enter }, - { 78, XK_minus, XK_KP_Subtract }, - { 81, XK_equal, XK_KP_Equal }, - { 82, XK_0, XK_KP_0 }, - { 83, XK_1, XK_KP_1 }, - { 84, XK_2, XK_KP_2 }, - { 85, XK_3, XK_KP_3 }, - { 86, XK_4, XK_KP_4 }, - { 87, XK_5, XK_KP_5 }, - { 88, XK_6, XK_KP_6 }, - { 89, XK_7, XK_KP_7 }, - { 91, XK_8, XK_KP_8 }, - { 92, XK_9, XK_KP_9 }, -}; -#endif - -#if HACK_BLACKLIST -/* wine notepad produces wrong characters on shift+arrow - * http://xquartz.macosforge.org/trac/ticket/295 - * http://developer.apple.com/legacy/mac/library/documentation/mac/Text/Text-579.html - * - * legacy Mac keycodes for arrow keys that shift-modify to math symbols - */ -const static unsigned short keycode_blacklist[] = { 66, 70, 72, 77 }; -#endif - -/* Table mapping normal keysyms to their dead equivalents. - FIXME: all the unicode keysyms (apart from circumflex) were guessed. */ - -const static struct { - KeySym normal, dead; -} dead_keys[] = { - { XK_grave, XK_dead_grave }, - { XK_apostrophe, XK_dead_acute }, /* US:"=" on a Czech keyboard */ - { XK_acute, XK_dead_acute }, - { UKEYSYM(0x384), XK_dead_acute }, /* US:";" on a Greek keyboard */ - // {XK_Greek_accentdieresis, XK_dead_diaeresis}, /* US:"opt+;" on a Greek keyboard ... replace with dead_accentdieresis if there is one */ - { XK_asciicircum, XK_dead_circumflex }, - { UKEYSYM(0x2c6), XK_dead_circumflex }, /* MODIFIER LETTER CIRCUMFLEX ACCENT */ - { XK_asciitilde, XK_dead_tilde }, - { UKEYSYM(0x2dc), XK_dead_tilde }, /* SMALL TILDE */ - { XK_macron, XK_dead_macron }, - { XK_breve, XK_dead_breve }, - { XK_abovedot, XK_dead_abovedot }, - { XK_diaeresis, XK_dead_diaeresis }, - { UKEYSYM(0x2da), XK_dead_abovering }, /* DOT ABOVE */ - { XK_doubleacute, XK_dead_doubleacute }, - { XK_caron, XK_dead_caron }, - { XK_cedilla, XK_dead_cedilla }, - { XK_ogonek, XK_dead_ogonek }, - { UKEYSYM(0x269), XK_dead_iota }, /* LATIN SMALL LETTER IOTA */ - { UKEYSYM(0x2ec), XK_dead_voiced_sound }, /* MODIFIER LETTER VOICING */ - /* {XK_semivoiced_sound, XK_dead_semivoiced_sound}, */ - { UKEYSYM(0x323), XK_dead_belowdot }, /* COMBINING DOT BELOW */ - { UKEYSYM(0x309), XK_dead_hook }, /* COMBINING HOOK ABOVE */ - { UKEYSYM(0x31b), XK_dead_horn }, /* COMBINING HORN */ -}; - -typedef struct darwinKeyboardInfo_struct { - CARD8 modMap[MAP_LENGTH]; - KeySym keyMap[MAP_LENGTH * GLYPHS_PER_KEY]; - unsigned char modifierKeycodes[32][2]; -} darwinKeyboardInfo; - -darwinKeyboardInfo keyInfo; -pthread_mutex_t keyInfo_mutex = PTHREAD_MUTEX_INITIALIZER; - -static void -DarwinChangeKeyboardControl(DeviceIntPtr device, KeybdCtrl *ctrl) -{ - // FIXME: to be implemented - // keyclick, bell volume / pitch, autorepead, LED's -} - -//----------------------------------------------------------------------------- -// Utility functions to help parse Darwin keymap -//----------------------------------------------------------------------------- - -/* - * DarwinBuildModifierMaps - * Use the keyMap field of keyboard info structure to populate - * the modMap and modifierKeycodes fields. - */ -static void -DarwinBuildModifierMaps(darwinKeyboardInfo *info) -{ - int i; - KeySym *k; - - memset(info->modMap, NoSymbol, sizeof(info->modMap)); - memset(info->modifierKeycodes, 0, sizeof(info->modifierKeycodes)); - - for (i = 0; i < NUM_KEYCODES; i++) { - k = info->keyMap + i * GLYPHS_PER_KEY; - - switch (*k) { - case XK_Shift_L: - info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i; - info->modMap[MIN_KEYCODE + i] = ShiftMask; - break; - - case XK_Shift_R: -#ifdef NX_MODIFIERKEY_RSHIFT - info->modifierKeycodes[NX_MODIFIERKEY_RSHIFT][0] = i; -#else - info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i; -#endif - info->modMap[MIN_KEYCODE + i] = ShiftMask; - break; - - case XK_Control_L: - info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i; - info->modMap[MIN_KEYCODE + i] = ControlMask; - break; - - case XK_Control_R: -#ifdef NX_MODIFIERKEY_RCONTROL - info->modifierKeycodes[NX_MODIFIERKEY_RCONTROL][0] = i; -#else - info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i; -#endif - info->modMap[MIN_KEYCODE + i] = ControlMask; - break; - - case XK_Caps_Lock: - info->modifierKeycodes[NX_MODIFIERKEY_ALPHALOCK][0] = i; - info->modMap[MIN_KEYCODE + i] = LockMask; - break; - - case XK_Alt_L: - info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i; - info->modMap[MIN_KEYCODE + i] = Mod1Mask; - if (!XQuartzOptionSendsAlt) - *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor. - break; - - case XK_Alt_R: -#ifdef NX_MODIFIERKEY_RALTERNATE - info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i; -#else - info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i; -#endif - if (!XQuartzOptionSendsAlt) - *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor. - info->modMap[MIN_KEYCODE + i] = Mod1Mask; - break; - - case XK_Mode_switch: - ErrorF( - "DarwinBuildModifierMaps: XK_Mode_switch encountered, unable to determine side.\n"); - 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; - - case XK_Meta_L: - info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i; - info->modMap[MIN_KEYCODE + i] = Mod2Mask; - break; - - case XK_Meta_R: -#ifdef NX_MODIFIERKEY_RCOMMAND - info->modifierKeycodes[NX_MODIFIERKEY_RCOMMAND][0] = i; -#else - info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i; -#endif - info->modMap[MIN_KEYCODE + i] = Mod2Mask; - break; - - case XK_Num_Lock: - info->modMap[MIN_KEYCODE + i] = Mod3Mask; - break; - } - } -} - -/* - * DarwinKeyboardInit - * Get the Darwin keyboard map and compute an equivalent - * X keyboard map and modifier map. Set the new keyboard - * device structure. - */ -void -DarwinKeyboardInit(DeviceIntPtr pDev) -{ - // Open a shared connection to the HID System. - // Note that the Event Status Driver is really just a wrapper - // for a kIOHIDParamConnectType connection. - assert(darwinParamConnect = NXOpenEventStatus()); - - InitKeyboardDeviceStruct(pDev, NULL, NULL, DarwinChangeKeyboardControl); - - DarwinKeyboardReloadHandler(); - - CopyKeyClass(pDev, inputInfo.keyboard); -} - -/* Set the repeat rates based on global preferences and keycodes for modifiers. - * Precondition: Has the keyInfo_mutex lock. - */ -static void -DarwinKeyboardSetRepeat(DeviceIntPtr pDev, int initialKeyRepeatValue, - int keyRepeatValue) -{ - if (initialKeyRepeatValue == 300000) { // off - /* Turn off repeats globally */ - XkbSetRepeatKeys(pDev, -1, AutoRepeatModeOff); - } - else { - int i; - XkbControlsPtr ctrl; - XkbControlsRec old; - - /* Turn on repeats globally */ - XkbSetRepeatKeys(pDev, -1, AutoRepeatModeOn); - - /* Setup the bit mask for individual key repeats */ - ctrl = pDev->key->xkbInfo->desc->ctrls; - old = *ctrl; - - ctrl->repeat_delay = initialKeyRepeatValue * 15; - ctrl->repeat_interval = keyRepeatValue * 15; - - /* Turn off key-repeat for modifier keys, on for others */ - /* First set them all on */ - for (i = 0; i < XkbPerKeyBitArraySize; i++) - ctrl->per_key_repeat[i] = -1; - - /* Now turn off the modifiers */ - for (i = 0; i < 32; i++) { - unsigned char keycode; - - keycode = keyInfo.modifierKeycodes[i][0]; - if (keycode) - ClearBit(ctrl->per_key_repeat, keycode + MIN_KEYCODE); - - keycode = keyInfo.modifierKeycodes[i][1]; - if (keycode) - ClearBit(ctrl->per_key_repeat, keycode + MIN_KEYCODE); - } - - /* Hurray for data duplication */ - if (pDev->kbdfeed) - memcpy(pDev->kbdfeed->ctrl.autoRepeats, ctrl->per_key_repeat, - XkbPerKeyBitArraySize); - - //ErrorF("per_key_repeat =\n"); - //for(i=0; i < XkbPerKeyBitArraySize; i++) - // ErrorF("%02x%s", ctrl->per_key_repeat[i], (i + 1) & 7 ? "" : "\n"); - - /* And now we notify the puppies about the changes */ - XkbDDXChangeControls(pDev, &old, ctrl); - } -} - -void -DarwinKeyboardReloadHandler(void) -{ - KeySymsRec keySyms; - CFIndex initialKeyRepeatValue, keyRepeatValue; - BOOL ok; - DeviceIntPtr pDev; - const char *xmodmap = PROJECTROOT "/bin/xmodmap"; - const char *sysmodmap = PROJECTROOT "/lib/X11/xinit/.Xmodmap"; - const char *homedir = getenv("HOME"); - char usermodmap[PATH_MAX], cmd[PATH_MAX]; - - DEBUG_LOG("DarwinKeyboardReloadHandler\n"); - - /* Get our key repeat settings from GlobalPreferences */ - (void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences")); - - initialKeyRepeatValue = - CFPreferencesGetAppIntegerValue(CFSTR("InitialKeyRepeat"), - CFSTR(".GlobalPreferences"), &ok); - if (!ok) - initialKeyRepeatValue = 35; - - keyRepeatValue = CFPreferencesGetAppIntegerValue(CFSTR( - "KeyRepeat"), - CFSTR( - ".GlobalPreferences"), - &ok); - if (!ok) - keyRepeatValue = 6; - - pthread_mutex_lock(&keyInfo_mutex); - { - /* Initialize our keySyms */ - keySyms.map = keyInfo.keyMap; - keySyms.mapWidth = GLYPHS_PER_KEY; - keySyms.minKeyCode = MIN_KEYCODE; - keySyms.maxKeyCode = MAX_KEYCODE; - - // TODO: We should build the entire XkbDescRec and use XkbCopyKeymap - /* Apply the mappings to darwinKeyboard */ - XkbApplyMappingChange(darwinKeyboard, &keySyms, keySyms.minKeyCode, - keySyms.maxKeyCode - keySyms.minKeyCode + 1, - keyInfo.modMap, serverClient); - DarwinKeyboardSetRepeat(darwinKeyboard, initialKeyRepeatValue, - keyRepeatValue); - - /* Apply the mappings to the core keyboard */ - 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, - keyInfo.modMap, serverClient); - DarwinKeyboardSetRepeat(pDev, initialKeyRepeatValue, - keyRepeatValue); - } - } - } pthread_mutex_unlock(&keyInfo_mutex); - - /* Modify with xmodmap */ - if (access(xmodmap, F_OK) == 0) { - /* Check for system .Xmodmap */ - if (access(sysmodmap, F_OK) == 0) { - if (snprintf(cmd, sizeof(cmd), "%s %s", xmodmap, - sysmodmap) < sizeof(cmd)) { - X11ApplicationLaunchClient(cmd); - } - else { - ErrorF( - "X11.app: Unable to create / execute xmodmap command line"); - } - } - - /* Check for user's local .Xmodmap */ - if ((homedir != NULL) && - (snprintf(usermodmap, sizeof(usermodmap), "%s/.Xmodmap", - homedir) < sizeof(usermodmap))) { - if (access(usermodmap, F_OK) == 0) { - if (snprintf(cmd, sizeof(cmd), "%s %s", xmodmap, - usermodmap) < sizeof(cmd)) { - X11ApplicationLaunchClient(cmd); - } - else { - ErrorF( - "X11.app: Unable to create / execute xmodmap command line"); - } - } - } - else { - ErrorF("X11.app: Unable to determine path to user's .Xmodmap"); - } - } -} - -//----------------------------------------------------------------------------- -// Modifier translation functions -// -// There are three different ways to specify a Mac modifier key: -// keycode - specifies hardware key, read from keymapping -// key - NX_MODIFIERKEY_*, really an index -// mask - NX_*MASK, mask for modifier flags in event record -// Left and right side have different keycodes but the same key and mask. -//----------------------------------------------------------------------------- - -/* - * DarwinModifierNXKeyToNXKeycode - * Return the keycode for an NX_MODIFIERKEY_* modifier. - * side = 0 for left or 1 for right. - * Returns 0 if key+side is not a known modifier. - */ -int -DarwinModifierNXKeyToNXKeycode(int key, int side) -{ - int retval; - pthread_mutex_lock(&keyInfo_mutex); - retval = keyInfo.modifierKeycodes[key][side]; - pthread_mutex_unlock(&keyInfo_mutex); - - return retval; -} - -/* - * DarwinModifierNXKeycodeToNXKey - * Returns -1 if keycode+side is not a modifier key - * outSide may be NULL, else it gets 0 for left and 1 for right. - */ -int -DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) -{ - int key, side; - - keycode += MIN_KEYCODE; - - // search modifierKeycodes for this keycode+side - pthread_mutex_lock(&keyInfo_mutex); - for (key = 0; key < NX_NUMMODIFIERS; key++) { - for (side = 0; side <= 1; side++) { - if (keyInfo.modifierKeycodes[key][side] == keycode) break; - } - } - pthread_mutex_unlock(&keyInfo_mutex); - - if (key == NX_NUMMODIFIERS) { - return -1; - } - if (outSide) *outSide = side; - - return key; -} - -/* - * DarwinModifierNXMaskToNXKey - * Returns -1 if mask is not a known modifier mask. - */ -int -DarwinModifierNXMaskToNXKey(int mask) -{ - switch (mask) { - case NX_ALPHASHIFTMASK: - return NX_MODIFIERKEY_ALPHALOCK; - - case NX_SHIFTMASK: - return NX_MODIFIERKEY_SHIFT; - -#ifdef NX_DEVICELSHIFTKEYMASK - case NX_DEVICELSHIFTKEYMASK: - return NX_MODIFIERKEY_SHIFT; - - case NX_DEVICERSHIFTKEYMASK: - return NX_MODIFIERKEY_RSHIFT; - -#endif - case NX_CONTROLMASK: - return NX_MODIFIERKEY_CONTROL; - -#ifdef NX_DEVICELCTLKEYMASK - case NX_DEVICELCTLKEYMASK: - return NX_MODIFIERKEY_CONTROL; - - case NX_DEVICERCTLKEYMASK: - return NX_MODIFIERKEY_RCONTROL; - -#endif - case NX_ALTERNATEMASK: - return NX_MODIFIERKEY_ALTERNATE; - -#ifdef NX_DEVICELALTKEYMASK - case NX_DEVICELALTKEYMASK: - return NX_MODIFIERKEY_ALTERNATE; - - case NX_DEVICERALTKEYMASK: - return NX_MODIFIERKEY_RALTERNATE; - -#endif - case NX_COMMANDMASK: - return NX_MODIFIERKEY_COMMAND; - -#ifdef NX_DEVICELCMDKEYMASK - case NX_DEVICELCMDKEYMASK: - return NX_MODIFIERKEY_COMMAND; - - case NX_DEVICERCMDKEYMASK: - return NX_MODIFIERKEY_RCOMMAND; - -#endif - case NX_NUMERICPADMASK: - return NX_MODIFIERKEY_NUMERICPAD; - - case NX_HELPMASK: - return NX_MODIFIERKEY_HELP; - - case NX_SECONDARYFNMASK: - return NX_MODIFIERKEY_SECONDARYFN; - } - return -1; -} - -/* - * DarwinModifierNXKeyToNXMask - * Returns 0 if key is not a known modifier key. - */ -int -DarwinModifierNXKeyToNXMask(int key) -{ - switch (key) { - case NX_MODIFIERKEY_ALPHALOCK: - return NX_ALPHASHIFTMASK; - -#ifdef NX_DEVICELSHIFTKEYMASK - case NX_MODIFIERKEY_SHIFT: - return NX_DEVICELSHIFTKEYMASK; - - case NX_MODIFIERKEY_RSHIFT: - return NX_DEVICERSHIFTKEYMASK; - - case NX_MODIFIERKEY_CONTROL: - return NX_DEVICELCTLKEYMASK; - - case NX_MODIFIERKEY_RCONTROL: - return NX_DEVICERCTLKEYMASK; - - case NX_MODIFIERKEY_ALTERNATE: - return NX_DEVICELALTKEYMASK; - - case NX_MODIFIERKEY_RALTERNATE: - return NX_DEVICERALTKEYMASK; - - case NX_MODIFIERKEY_COMMAND: - return NX_DEVICELCMDKEYMASK; - - case NX_MODIFIERKEY_RCOMMAND: - return NX_DEVICERCMDKEYMASK; - -#else - case NX_MODIFIERKEY_SHIFT: - return NX_SHIFTMASK; - - case NX_MODIFIERKEY_CONTROL: - return NX_CONTROLMASK; - - case NX_MODIFIERKEY_ALTERNATE: - return NX_ALTERNATEMASK; - - case NX_MODIFIERKEY_COMMAND: - return NX_COMMANDMASK; - -#endif - case NX_MODIFIERKEY_NUMERICPAD: - return NX_NUMERICPADMASK; - - case NX_MODIFIERKEY_HELP: - return NX_HELPMASK; - - case NX_MODIFIERKEY_SECONDARYFN: - return NX_SECONDARYFNMASK; - } - return 0; -} - -/* - * DarwinModifierStringToNXMask - * Returns 0 if string is not a known modifier. - */ -int -DarwinModifierStringToNXMask(const char *str, int separatelr) -{ -#ifdef NX_DEVICELSHIFTKEYMASK - if (separatelr) { - if (!strcasecmp(str, - "shift")) return NX_DEVICELSHIFTKEYMASK | - NX_DEVICERSHIFTKEYMASK; - if (!strcasecmp(str, - "control")) return NX_DEVICELCTLKEYMASK | - NX_DEVICERCTLKEYMASK; - if (!strcasecmp(str, - "option")) return NX_DEVICELALTKEYMASK | - NX_DEVICERALTKEYMASK; - if (!strcasecmp(str, - "alt")) return NX_DEVICELALTKEYMASK | - NX_DEVICERALTKEYMASK; - if (!strcasecmp(str, - "command")) return NX_DEVICELCMDKEYMASK | - NX_DEVICERCMDKEYMASK; - if (!strcasecmp(str, "lshift")) return NX_DEVICELSHIFTKEYMASK; - if (!strcasecmp(str, "rshift")) return NX_DEVICERSHIFTKEYMASK; - if (!strcasecmp(str, "lcontrol")) return NX_DEVICELCTLKEYMASK; - if (!strcasecmp(str, "rcontrol")) return NX_DEVICERCTLKEYMASK; - if (!strcasecmp(str, "loption")) return NX_DEVICELALTKEYMASK; - if (!strcasecmp(str, "roption")) return NX_DEVICERALTKEYMASK; - if (!strcasecmp(str, "lalt")) return NX_DEVICELALTKEYMASK; - if (!strcasecmp(str, "ralt")) return NX_DEVICERALTKEYMASK; - if (!strcasecmp(str, "lcommand")) return NX_DEVICELCMDKEYMASK; - if (!strcasecmp(str, "rcommand")) return NX_DEVICERCMDKEYMASK; - } - else { -#endif - if (!strcasecmp(str, "shift")) return NX_SHIFTMASK; - if (!strcasecmp(str, "control")) return NX_CONTROLMASK; - if (!strcasecmp(str, "option")) return NX_ALTERNATEMASK; - if (!strcasecmp(str, "alt")) return NX_ALTERNATEMASK; - if (!strcasecmp(str, "command")) return NX_COMMANDMASK; - if (!strcasecmp(str, "lshift")) return NX_SHIFTMASK; - if (!strcasecmp(str, "rshift")) return NX_SHIFTMASK; - if (!strcasecmp(str, "lcontrol")) return NX_CONTROLMASK; - if (!strcasecmp(str, "rcontrol")) return NX_CONTROLMASK; - if (!strcasecmp(str, "loption")) return NX_ALTERNATEMASK; - if (!strcasecmp(str, "roption")) return NX_ALTERNATEMASK; - if (!strcasecmp(str, "lalt")) return NX_ALTERNATEMASK; - if (!strcasecmp(str, "ralt")) return NX_ALTERNATEMASK; - if (!strcasecmp(str, "lcommand")) return NX_COMMANDMASK; - if (!strcasecmp(str, "rcommand")) return NX_COMMANDMASK; -#ifdef NX_DEVICELSHIFTKEYMASK -} -#endif - if (!strcasecmp(str, "lock")) return NX_ALPHASHIFTMASK; - if (!strcasecmp(str, "fn")) return NX_SECONDARYFNMASK; - if (!strcasecmp(str, "help")) return NX_HELPMASK; - if (!strcasecmp(str, "numlock")) return NX_NUMERICPADMASK; - return 0; -} - -static KeySym -make_dead_key(KeySym in) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(dead_keys); i++) - if (dead_keys[i].normal == in) return dead_keys[i].dead; - - return in; -} - -static Bool -QuartzReadSystemKeymap(darwinKeyboardInfo *info) -{ - __block const void *chr_data = NULL; - int num_keycodes = NUM_KEYCODES; - __block UInt32 keyboard_type; - int i, j; - OSStatus err; - KeySym *k; - - dispatch_block_t getKeyboardData = ^{ - keyboard_type = LMGetKbdType(); - - TISInputSourceRef currentKeyLayoutRef = TISCopyCurrentKeyboardLayoutInputSource(); - - if (currentKeyLayoutRef) { - CFDataRef currentKeyLayoutDataRef = (CFDataRef)TISGetInputSourceProperty(currentKeyLayoutRef, - kTISPropertyUnicodeKeyLayoutData); - if (currentKeyLayoutDataRef) - chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef); - - CFRelease(currentKeyLayoutRef); - } - }; - - /* This is an ugly ant-pattern, but it is more expedient to address the problem right now. */ - if (pthread_main_np()) { - getKeyboardData(); - } else { - dispatch_sync(dispatch_get_main_queue(), getKeyboardData); - } - - if (chr_data == NULL) { - ErrorF("Couldn't get uchr or kchr resource\n"); - return FALSE; - } - - /* Scan the keycode range for the Unicode character that each - key produces in the four shift states. Then convert that to - an X11 keysym (which may just the bit that says "this is - Unicode" if it can't find the real symbol.) */ - - /* KeyTranslate is not available on 64-bit platforms; UCKeyTranslate - must be used instead. */ - - for (i = 0; i < num_keycodes; i++) { - static const int mods[4] = { - 0, MOD_SHIFT, MOD_OPTION, - MOD_OPTION | MOD_SHIFT - }; - - k = info->keyMap + i * GLYPHS_PER_KEY; - - for (j = 0; j < 4; j++) { - UniChar s[8]; - UniCharCount len; - UInt32 dead_key_state = 0, extra_dead = 0; - - err = UCKeyTranslate(chr_data, i, kUCKeyActionDown, - mods[j] >> 8, keyboard_type, 0, - &dead_key_state, 8, &len, s); - if (err != noErr) continue; - - if (len == 0 && dead_key_state != 0) { - /* Found a dead key. Work out which one it is, but - remembering that it's dead. */ - err = UCKeyTranslate(chr_data, i, kUCKeyActionDown, - mods[j] >> 8, keyboard_type, - kUCKeyTranslateNoDeadKeysMask, - &extra_dead, 8, &len, s); - if (err != noErr) continue; - } - - /* Not sure why 0x0010 is there. - * 0x0000 - 'Unicode Hex Input' ... - */ - if (len > 0 && s[0] != 0x0010 && s[0] != 0x0000) { - k[j] = ucs2keysym(s[0]); - if (dead_key_state != 0) k[j] = make_dead_key(k[j]); - } - } - - if (k[3] == k[2]) k[3] = NoSymbol; - if (k[1] == k[0]) k[1] = NoSymbol; - if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol; - if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] = NoSymbol; - } - -#if HACK_MISSING - /* Fix up some things that are normally missing.. */ - - for (i = 0; i < ARRAY_SIZE(known_keys); i++) { - k = info->keyMap + known_keys[i].keycode * GLYPHS_PER_KEY; - - if (k[0] == NoSymbol && k[1] == NoSymbol - && k[2] == NoSymbol && k[3] == NoSymbol) - k[0] = known_keys[i].keysym; - } -#endif - -#if HACK_KEYPAD - /* And some more things. We find the right symbols for the numeric - keypad, but not the KP_ keysyms. So try to convert known keycodes. */ - for (i = 0; i < ARRAY_SIZE(known_numeric_keys); i++) { - k = info->keyMap + known_numeric_keys[i].keycode * GLYPHS_PER_KEY; - - if (k[0] == known_numeric_keys[i].normal) - k[0] = known_numeric_keys[i].keypad; - } -#endif - -#if HACK_BLACKLIST - for (i = 0; i < ARRAY_SIZE(keycode_blacklist); i++) { - k = info->keyMap + keycode_blacklist[i] * GLYPHS_PER_KEY; - k[0] = k[1] = k[2] = k[3] = NoSymbol; - } -#endif - - DarwinBuildModifierMaps(info); - - return TRUE; -} - -Bool -QuartsResyncKeymap(Bool sendDDXEvent) -{ - Bool retval; - /* Update keyInfo */ - pthread_mutex_lock(&keyInfo_mutex); - memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap)); - retval = QuartzReadSystemKeymap(&keyInfo); - pthread_mutex_unlock(&keyInfo_mutex); - - /* Tell server thread to deal with new keyInfo */ - if (sendDDXEvent) - DarwinSendDDXEvent(kXquartzReloadKeymap, 0); - - return retval; -} diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h deleted file mode 100644 index 60290e658..000000000 --- a/hw/xquartz/quartzKeyboard.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * Copyright (c) 2003-2004 Torrey T. Lyons. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifndef QUARTZ_KEYBOARD_H -#define QUARTZ_KEYBOARD_H 1 - -#define XK_TECHNICAL // needed to get XK_Escape -#define XK_PUBLISHING -#include "X11/keysym.h" -#include "inputstr.h" - -// Each key can generate 4 glyphs. They are, in order: -// unshifted, shifted, modeswitch unshifted, modeswitch shifted -#define GLYPHS_PER_KEY 4 -#define NUM_KEYCODES 248 // NX_NUMKEYCODES might be better -#define MIN_KEYCODE XkbMinLegalKeyCode // unfortunately, this isn't 0... -#define MAX_KEYCODE NUM_KEYCODES + MIN_KEYCODE - 1 - -/* These functions need to be implemented by Xquartz, XDarwin, etc. */ -Bool -QuartsResyncKeymap(Bool sendDDXEvent); - -/* Provided for darwinEvents.c */ -void -DarwinKeyboardReloadHandler(void); -int -DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide); -int -DarwinModifierNXKeyToNXKeycode(int key, int side); -int -DarwinModifierNXKeyToNXMask(int key); -int -DarwinModifierNXMaskToNXKey(int mask); -int -DarwinModifierStringToNXMask(const char *string, int separatelr); - -/* Provided for darwin.c */ -void -DarwinKeyboardInit(DeviceIntPtr pDev); - -#endif /* QUARTZ_KEYBOARD_H */ diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c deleted file mode 100644 index 3ecc0e771..000000000 --- a/hw/xquartz/quartzRandR.c +++ /dev/null @@ -1,525 +0,0 @@ -/* - * Quartz-specific support for the XRandR extension - * - * Copyright (c) 2001-2004 Greg Parker and Torrey T. Lyons, - * 2010 Jan Hauffa. - * 2010-2012 Apple Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#include "sanitizedCarbon.h" - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "quartzRandR.h" -#include "quartz.h" -#include "darwin.h" - -#include "X11Application.h" - -#include -#include -#include - -/* TODO: UGLY, find a better way! - * We want to ignore kXquartzDisplayChanged which are generated by us - */ -static Bool ignore_next_fake_mode_update = FALSE; - -#define FAKE_REFRESH_ROOTLESS 1 -#define FAKE_REFRESH_FULLSCREEN 2 - -#define DEFAULT_REFRESH 60 -#define kDisplayModeUsableFlags (kDisplayModeValidFlag | kDisplayModeSafeFlag) - -#define CALLBACK_SUCCESS 0 -#define CALLBACK_CONTINUE 1 -#define CALLBACK_ERROR -1 - -typedef int (*QuartzModeCallback) - (ScreenPtr, QuartzModeInfoPtr, void *); - -static void -QuartzRandRGetModeInfo(CGDisplayModeRef modeRef, - QuartzModeInfoPtr pMode) -{ - pMode->width = CGDisplayModeGetWidth(modeRef); - pMode->height = CGDisplayModeGetHeight(modeRef); - pMode->refresh = (int)(CGDisplayModeGetRefreshRate(modeRef) + 0.5); - if (pMode->refresh == 0) - pMode->refresh = DEFAULT_REFRESH; - pMode->ref = NULL; - pMode->pSize = NULL; -} - -static Bool -QuartzRandRCopyCurrentModeInfo(CGDirectDisplayID screenId, - QuartzModeInfoPtr pMode) -{ - CGDisplayModeRef curModeRef = CGDisplayCopyDisplayMode(screenId); - if (!curModeRef) - return FALSE; - - QuartzRandRGetModeInfo(curModeRef, pMode); - pMode->ref = curModeRef; - return TRUE; -} - -static Bool -QuartzRandRSetCGMode(CGDirectDisplayID screenId, - QuartzModeInfoPtr pMode) -{ - CGDisplayModeRef modeRef = (CGDisplayModeRef)pMode->ref; - if (!modeRef) - return FALSE; - - return (CGDisplaySetDisplayMode(screenId, modeRef, - NULL) == kCGErrorSuccess); -} - -static Bool -QuartzRandREnumerateModes(ScreenPtr pScreen, - QuartzModeCallback callback, - void *data) -{ - Bool retval = FALSE; - QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen); - - /* Just an 800x600 fallback if we have no attached heads */ - if (pQuartzScreen->displayIDs) { - CGDisplayModeRef curModeRef, modeRef; - CFStringRef curPixelEnc, pixelEnc; - CFComparisonResult pixelEncEqual; - CFArrayRef modes; - QuartzModeInfo modeInfo; - int i; - CGDirectDisplayID screenId = pQuartzScreen->displayIDs[0]; - - curModeRef = CGDisplayCopyDisplayMode(screenId); - if (!curModeRef) - return FALSE; - curPixelEnc = CGDisplayModeCopyPixelEncoding(curModeRef); - CGDisplayModeRelease(curModeRef); - - modes = CGDisplayCopyAllDisplayModes(screenId, NULL); - if (!modes) { - CFRelease(curPixelEnc); - return FALSE; - } - for (i = 0; i < CFArrayGetCount(modes); i++) { - int cb; - modeRef = (CGDisplayModeRef)CFArrayGetValueAtIndex(modes, i); - - /* Skip modes that are not usable on the current display or have a - different pixel encoding than the current mode. */ - if ((CGDisplayModeGetIOFlags(modeRef) & - kDisplayModeUsableFlags) != - kDisplayModeUsableFlags) - continue; - pixelEnc = CGDisplayModeCopyPixelEncoding(modeRef); - pixelEncEqual = CFStringCompare(pixelEnc, curPixelEnc, 0); - CFRelease(pixelEnc); - if (pixelEncEqual != kCFCompareEqualTo) - continue; - - QuartzRandRGetModeInfo(modeRef, &modeInfo); - modeInfo.ref = modeRef; - cb = callback(pScreen, &modeInfo, data); - if (cb == CALLBACK_CONTINUE) { - retval = TRUE; - } - else if (cb == CALLBACK_SUCCESS) { - CFRelease(modes); - CFRelease(curPixelEnc); - return TRUE; - } - else if (cb == CALLBACK_ERROR) { - CFRelease(modes); - CFRelease(curPixelEnc); - return FALSE; - } - } - - CFRelease(modes); - CFRelease(curPixelEnc); - } - - switch (callback(pScreen, &pQuartzScreen->rootlessMode, data)) { - case CALLBACK_SUCCESS: - return TRUE; - - case CALLBACK_ERROR: - return FALSE; - - case CALLBACK_CONTINUE: - retval = TRUE; - - default: - break; - } - - switch (callback(pScreen, &pQuartzScreen->fullscreenMode, data)) { - case CALLBACK_SUCCESS: - return TRUE; - - case CALLBACK_ERROR: - return FALSE; - - case CALLBACK_CONTINUE: - retval = TRUE; - - default: - break; - } - - return retval; -} - -static Bool -QuartzRandRModesEqual(QuartzModeInfoPtr pMode1, - QuartzModeInfoPtr pMode2) -{ - return (pMode1->width == pMode2->width) && - (pMode1->height == pMode2->height) && - (pMode1->refresh == pMode2->refresh); -} - -static Bool -QuartzRandRRegisterMode(ScreenPtr pScreen, - QuartzModeInfoPtr pMode) -{ - QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen); - Bool isCurrentMode = QuartzRandRModesEqual(&pQuartzScreen->currentMode, - pMode); - - /* TODO: DPI */ - pMode->pSize = - RRRegisterSize(pScreen, pMode->width, pMode->height, pScreen->mmWidth, - pScreen->mmHeight); - if (pMode->pSize) { - //DEBUG_LOG("registering: %d x %d @ %d %s\n", (int)pMode->width, (int)pMode->height, (int)pMode->refresh, isCurrentMode ? "*" : ""); - RRRegisterRate(pScreen, pMode->pSize, pMode->refresh); - - if (isCurrentMode) - RRSetCurrentConfig(pScreen, RR_Rotate_0, pMode->refresh, - pMode->pSize); - - return TRUE; - } - return FALSE; -} - -static int -QuartzRandRRegisterModeCallback(ScreenPtr pScreen, - QuartzModeInfoPtr pMode, - void *data __unused) -{ - if (QuartzRandRRegisterMode(pScreen, pMode)) { - return CALLBACK_CONTINUE; - } - else { - return CALLBACK_ERROR; - } -} - -static Bool -QuartzRandRSetMode(ScreenPtr pScreen, QuartzModeInfoPtr pMode, - BOOL doRegister) -{ - QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen); - Bool captureDisplay = - (pMode->refresh != FAKE_REFRESH_FULLSCREEN && pMode->refresh != - FAKE_REFRESH_ROOTLESS); - CGDirectDisplayID screenId; - - if (pQuartzScreen->displayIDs == NULL) - return FALSE; - - screenId = pQuartzScreen->displayIDs[0]; - if (XQuartzShieldingWindowLevel == 0 && captureDisplay) { - if (!X11ApplicationCanEnterRandR()) - return FALSE; - CGCaptureAllDisplays(); - XQuartzShieldingWindowLevel = CGShieldingWindowLevel(); // 2147483630 - DEBUG_LOG("Display captured. ShieldWindowID: %u, Shield level: %d\n", - CGShieldingWindowID(screenId), XQuartzShieldingWindowLevel); - } - - if (pQuartzScreen->currentMode.ref && - CFEqual(pMode->ref, pQuartzScreen->currentMode.ref)) { - DEBUG_LOG("Requested RandR resolution matches current CG mode\n"); - } - if (QuartzRandRSetCGMode(screenId, pMode)) { - ignore_next_fake_mode_update = TRUE; - } - else { - DEBUG_LOG("Error while requesting CG resolution change.\n"); - return FALSE; - } - - /* If the client requested the fake rootless mode, switch to rootless. - * Otherwise, force fullscreen mode. - */ - QuartzSetRootless(pMode->refresh == FAKE_REFRESH_ROOTLESS); - if (pMode->refresh != FAKE_REFRESH_ROOTLESS) { - QuartzShowFullscreen(TRUE); - } - - if (pQuartzScreen->currentMode.ref) - CFRelease(pQuartzScreen->currentMode.ref); - pQuartzScreen->currentMode = *pMode; - if (pQuartzScreen->currentMode.ref) - CFRetain(pQuartzScreen->currentMode.ref); - - if (XQuartzShieldingWindowLevel != 0 && !captureDisplay) { - CGReleaseAllDisplays(); - XQuartzShieldingWindowLevel = 0; - } - - return TRUE; -} - -static int -QuartzRandRSetModeCallback(ScreenPtr pScreen, - QuartzModeInfoPtr pMode, - void *data) -{ - QuartzModeInfoPtr pReqMode = (QuartzModeInfoPtr)data; - - if (!QuartzRandRModesEqual(pMode, pReqMode)) - return CALLBACK_CONTINUE; /* continue enumeration */ - - DEBUG_LOG("Found a match for requested RandR resolution (%dx%d@%d).\n", - (int)pMode->width, (int)pMode->height, (int)pMode->refresh); - - if (QuartzRandRSetMode(pScreen, pMode, FALSE)) - return CALLBACK_SUCCESS; - else - return CALLBACK_ERROR; -} - -static Bool -QuartzRandRGetInfo(ScreenPtr pScreen, Rotation *rotations) -{ - *rotations = RR_Rotate_0; /* TODO: support rotation */ - - return QuartzRandREnumerateModes(pScreen, QuartzRandRRegisterModeCallback, - NULL); -} - -static Bool -QuartzRandRSetConfig(ScreenPtr pScreen, - Rotation randr, - int rate, - RRScreenSizePtr pSize) -{ - QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen); - QuartzModeInfo reqMode; - - reqMode.width = pSize->width; - reqMode.height = pSize->height; - reqMode.refresh = rate; - - /* Do not switch modes if requested mode is equal to current mode. */ - if (QuartzRandRModesEqual(&reqMode, &pQuartzScreen->currentMode)) - return TRUE; - - if (QuartzRandREnumerateModes(pScreen, QuartzRandRSetModeCallback, - &reqMode)) { - return TRUE; - } - - DEBUG_LOG("Unable to find a matching config: %d x %d @ %d\n", - (int)reqMode.width, (int)reqMode.height, - (int)reqMode.refresh); - return FALSE; -} - -static Bool -_QuartzRandRUpdateFakeModes(ScreenPtr pScreen) -{ - QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen); - QuartzModeInfo activeMode; - - if (pQuartzScreen->displayCount > 0) { - if (!QuartzRandRCopyCurrentModeInfo(pQuartzScreen->displayIDs[0], - &activeMode)) { - ErrorF("Unable to determine current display mode.\n"); - return FALSE; - } - } - else { - memset(&activeMode, 0, sizeof(activeMode)); - activeMode.width = 800; - activeMode.height = 600; - activeMode.refresh = 60; - } - - if (pQuartzScreen->fullscreenMode.ref) - CFRelease(pQuartzScreen->fullscreenMode.ref); - if (pQuartzScreen->currentMode.ref) - CFRelease(pQuartzScreen->currentMode.ref); - - if (pQuartzScreen->displayCount > 1) { - activeMode.width = pScreen->width; - activeMode.height = pScreen->height; - if (XQuartzIsRootless) - activeMode.height += aquaMenuBarHeight; - } - - pQuartzScreen->fullscreenMode = activeMode; - pQuartzScreen->fullscreenMode.refresh = FAKE_REFRESH_FULLSCREEN; - - pQuartzScreen->rootlessMode = activeMode; - pQuartzScreen->rootlessMode.refresh = FAKE_REFRESH_ROOTLESS; - pQuartzScreen->rootlessMode.height -= aquaMenuBarHeight; - - if (XQuartzIsRootless) { - pQuartzScreen->currentMode = pQuartzScreen->rootlessMode; - } - else { - pQuartzScreen->currentMode = pQuartzScreen->fullscreenMode; - } - - /* This extra retain is for currentMode's copy. - * fullscreen and rootless share a retain. - */ - if (pQuartzScreen->currentMode.ref) - CFRetain(pQuartzScreen->currentMode.ref); - - DEBUG_LOG("rootlessMode: %d x %d\n", - (int)pQuartzScreen->rootlessMode.width, - (int)pQuartzScreen->rootlessMode.height); - DEBUG_LOG("fullscreenMode: %d x %d\n", - (int)pQuartzScreen->fullscreenMode.width, - (int)pQuartzScreen->fullscreenMode.height); - DEBUG_LOG("currentMode: %d x %d\n", (int)pQuartzScreen->currentMode.width, - (int)pQuartzScreen->currentMode.height); - - return TRUE; -} - -Bool -QuartzRandRUpdateFakeModes(BOOL force_update) -{ - ScreenPtr pScreen = screenInfo.screens[0]; - - if (ignore_next_fake_mode_update) { - DEBUG_LOG( - "Ignoring update request caused by RandR resolution change.\n"); - ignore_next_fake_mode_update = FALSE; - return TRUE; - } - - if (!_QuartzRandRUpdateFakeModes(pScreen)) - return FALSE; - - if (force_update) - RRGetInfo(pScreen, TRUE); - - return TRUE; -} - -Bool -QuartzRandRInit(ScreenPtr pScreen) -{ - rrScrPrivPtr pScrPriv; - - if (!RRScreenInit(pScreen)) return FALSE; - if (!_QuartzRandRUpdateFakeModes(pScreen)) return FALSE; - - pScrPriv = rrGetScrPriv(pScreen); - pScrPriv->rrGetInfo = QuartzRandRGetInfo; - pScrPriv->rrSetConfig = QuartzRandRSetConfig; - return TRUE; -} - -void -QuartzRandRSetFakeRootless(void) -{ - int i; - - DEBUG_LOG("QuartzRandRSetFakeRootless called.\n"); - - for (i = 0; i < screenInfo.numScreens; i++) { - ScreenPtr pScreen = screenInfo.screens[i]; - QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen); - - QuartzRandRSetMode(pScreen, &pQuartzScreen->rootlessMode, TRUE); - } -} - -void -QuartzRandRSetFakeFullscreen(BOOL state) -{ - int i; - - DEBUG_LOG("QuartzRandRSetFakeFullscreen called.\n"); - - for (i = 0; i < screenInfo.numScreens; i++) { - ScreenPtr pScreen = screenInfo.screens[i]; - QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen); - - QuartzRandRSetMode(pScreen, &pQuartzScreen->fullscreenMode, TRUE); - } - - QuartzShowFullscreen(state); -} - -/* Toggle fullscreen mode. If "fake" fullscreen is the current mode, - * this will just show/hide the X11 windows. If we are in a RandR fullscreen - * mode, this will toggles us to the default fake mode and hide windows if - * it is fullscreen - */ -void -QuartzRandRToggleFullscreen(void) -{ - ScreenPtr pScreen = screenInfo.screens[0]; - QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen); - - if (pQuartzScreen->currentMode.ref == NULL) { - ErrorF( - "Ignoring QuartzRandRToggleFullscreen because don't have a current mode set.\n"); - } - else if (pQuartzScreen->currentMode.refresh == FAKE_REFRESH_ROOTLESS) { - ErrorF( - "Ignoring QuartzRandRToggleFullscreen because we are in rootless mode.\n"); - } - else if (pQuartzScreen->currentMode.refresh == FAKE_REFRESH_FULLSCREEN) { - /* Legacy fullscreen mode. Hide/Show */ - QuartzShowFullscreen(!XQuartzFullscreenVisible); - } - else { - /* RandR fullscreen mode. Return to default mode and hide if it is fullscreen. */ - if (XQuartzRootlessDefault) { - QuartzRandRSetFakeRootless(); - } - else { - QuartzRandRSetFakeFullscreen(FALSE); - } - } -} diff --git a/hw/xquartz/quartzRandR.h b/hw/xquartz/quartzRandR.h deleted file mode 100644 index 006fc4d44..000000000 --- a/hw/xquartz/quartzRandR.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * quartzRandR.h - * - * Copyright (c) 2010 Jan Hauffa. - * 2010-2012 Apple Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifndef _QUARTZRANDR_H_ -#define _QUARTZRANDR_H_ - -#include "randrstr.h" - -typedef struct { - size_t width, height; - int refresh; - RRScreenSizePtr pSize; - void *ref; /* CGDisplayModeRef or CFDictionaryRef */ -} QuartzModeInfo, *QuartzModeInfoPtr; - -// Quartz specific per screen storage structure -typedef struct { - // List of CoreGraphics displays that this X11 screen covers. - // This is more than one CG display for video mirroring and - // rootless PseudoramiX mode. - // No CG display will be covered by more than one X11 screen. - int displayCount; - CGDirectDisplayID *displayIDs; - QuartzModeInfo rootlessMode, fullscreenMode, currentMode; -} QuartzScreenRec, *QuartzScreenPtr; - -#define QUARTZ_PRIV(pScreen) \ - ((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey)) - -void -QuartzCopyDisplayIDs(ScreenPtr pScreen, int displayCount, - CGDirectDisplayID *displayIDs); - -Bool -QuartzRandRUpdateFakeModes(BOOL force_update); -Bool -QuartzRandRInit(ScreenPtr pScreen); - -/* These two functions provide functionality expected by the legacy - * mode switching. They are equivalent to a client requesting one - * of the modes corresponding to these "fake" modes. - * QuartzRandRSetFakeFullscreen takes an argument which is used to determine - * the visibility of the windows after the change. - */ -void -QuartzRandRSetFakeRootless(void); -void -QuartzRandRSetFakeFullscreen(BOOL state); - -/* Toggle fullscreen mode. If "fake" fullscreen is the current mode, - * this will just show/hide the X11 windows. If we are in a RandR fullscreen - * mode, this will toggles us to the default fake mode and hide windows if - * it is fullscreen - */ -void -QuartzRandRToggleFullscreen(void); - -#endif diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c deleted file mode 100644 index 77ff84506..000000000 --- a/hw/xquartz/quartzStartup.c +++ /dev/null @@ -1,137 +0,0 @@ -/************************************************************** - * - * Startup code for the Quartz Darwin X Server - * Copyright (c) 2008-2012 Apple Inc. All rights reserved. - * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#include "sanitizedCarbon.h" - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "X11Controller.h" -#include "darwin.h" -#include "darwinEvents.h" -#include "quartz.h" -#include "opaque.h" -#include "micmap.h" - -#include - -#include - -int -dix_main(int argc, char **argv, char **envp); - -struct arg { - int argc; - char **argv; - char **envp; -}; - -_X_NORETURN -static void -server_thread(void *arg) -{ - struct arg args = *((struct arg *)arg); - free(arg); - exit(dix_main(args.argc, args.argv, args.envp)); -} - -static pthread_t -create_thread(void *func, void *arg) -{ - pthread_attr_t attr; - pthread_t tid; - - pthread_attr_init(&attr); - pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_create(&tid, &attr, func, arg); - pthread_attr_destroy(&attr); - - return tid; -} - -void -QuartzInitServer(int argc, char **argv, char **envp) -{ - struct arg *args = (struct arg *)malloc(sizeof(struct arg)); - if (!args) - FatalError("Could not allocate memory.\n"); - - args->argc = argc; - args->argv = argv; - args->envp = envp; - - if (!create_thread(server_thread, args)) { - FatalError("can't create secondary thread\n"); - } - - /* Block signals on the AppKit thread that the X11 expects to handle on its thread */ - sigset_t set; - sigemptyset(&set); - sigaddset(&set, SIGALRM); -#ifdef HAVE_SIGACTION - sigaddset(&set, SIGBUS); -#endif - pthread_sigmask(SIG_BLOCK, &set, NULL); -} - -int -server_main(int argc, char **argv, char **envp) -{ - int i; - int fd[2]; - - /* Unset CFProcessPath, so our children don't inherit this kludge we need - * to load our nib. If an xterm gets this set, then it fails to - * 'open hi.txt' properly. - */ - unsetenv("CFProcessPath"); - - // Make a pipe to pass events - assert(pipe(fd) == 0); - darwinEventReadFD = fd[0]; - darwinEventWriteFD = fd[1]; - fcntl(darwinEventReadFD, F_SETFL, O_NONBLOCK); - - for (i = 1; i < argc; i++) { - // Display version info without starting Mac OS X UI if requested - if (!strcmp(argv[i], - "-showconfig") || !strcmp(argv[i], "-version")) { - DarwinPrintBanner(); - exit(0); - } - } - - X11ControllerMain(argc, argv, envp); - exit(0); -} diff --git a/hw/xquartz/sanitizedCarbon.h b/hw/xquartz/sanitizedCarbon.h deleted file mode 100644 index 2002a6c46..000000000 --- a/hw/xquartz/sanitizedCarbon.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Don't #include any of the AppKit, etc stuff directly since it will - * pollute the X11 namespace. - */ - -#ifndef _XQ_SANITIZED_CARBON_H_ -#define _XQ_SANITIZED_CARBON_H_ - -// QuickDraw in ApplicationServices has the following conflicts with -// the basic X server headers. Use QD_ to use the QuickDraw -// definition of any of these symbols, or the normal name for the -// X11 definition. -#define Cursor QD_Cursor -#define WindowPtr QD_WindowPtr -#define Picture QD_Picture -#define BOOL OSX_BOOL -#define EventType HIT_EventType - -#include -#include -#include -#include -#include -#include // For the NXSwap* - -#undef Cursor -#undef WindowPtr -#undef Picture -#undef BOOL -#undef EventType - -#endif /* _XQ_SANITIZED_CARBON_H_ */ diff --git a/hw/xquartz/sanitizedCocoa.h b/hw/xquartz/sanitizedCocoa.h deleted file mode 100644 index f1f1cc2e2..000000000 --- a/hw/xquartz/sanitizedCocoa.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Don't #include any of the AppKit, etc stuff directly since it will - * pollute the X11 namespace. - */ - -#ifndef _XQ_SANITIZED_COCOA_H_ -#define _XQ_SANITIZED_COCOA_H_ - -// QuickDraw in ApplicationServices has the following conflicts with -// the basic X server headers. Use QD_ to use the QuickDraw -// definition of any of these symbols, or the normal name for the -// X11 definition. -#define Cursor QD_Cursor -#define WindowPtr QD_WindowPtr -#define Picture QD_Picture -#define BOOL OSX_BOOL -#define EventType HIT_EventType - -#import -#import - -#undef Cursor -#undef WindowPtr -#undef Picture -#undef BOOL -#undef EventType - -#ifndef __has_feature -#define __has_feature(x) 0 // Compatibility with non-clang compilers. -#endif - -#ifndef NS_RETURNS_RETAINED -#if __has_feature(attribute_ns_returns_retained) -#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) -#else -#define NS_RETURNS_RETAINED -#endif -#endif - -#ifndef NS_RETURNS_NOT_RETAINED -#if __has_feature(attribute_ns_returns_not_retained) -#define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained)) -#else -#define NS_RETURNS_NOT_RETAINED -#endif -#endif - -#ifndef CF_RETURNS_RETAINED -#if __has_feature(attribute_cf_returns_retained) -#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) -#else -#define CF_RETURNS_RETAINED -#endif -#endif - -#ifndef CF_RETURNS_NOT_RETAINED -#if __has_feature(attribute_cf_returns_not_retained) -#define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained)) -#else -#define CF_RETURNS_NOT_RETAINED -#endif -#endif - -#endif /* _XQ_SANITIZED_COCOA_H_ */ diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c deleted file mode 100644 index 40422b61a..000000000 --- a/hw/xquartz/xpr/appledri.c +++ /dev/null @@ -1,528 +0,0 @@ -/************************************************************************** - - Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - Copyright 2000 VA Linux Systems, Inc. - Copyright (c) 2002, 2009-2012 Apple Inc. - All Rights Reserved. - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sub license, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial portions - of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin - * Jens Owen - * Rickard E. (Rik) Faith - * Jeremy Huddleston - * - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "misc.h" -#include "dixstruct.h" -#include "extnsionst.h" -#include "colormapst.h" -#include "cursorstr.h" -#include "scrnintstr.h" -#include "servermd.h" -#define _APPLEDRI_SERVER_ -#include "appledristr.h" -#include "swaprep.h" -#include "dri.h" -#include "dristruct.h" -#include "xpr.h" -#include "x-hash.h" -#include "protocol-versions.h" - -static int DRIErrorBase = 0; - -static void -AppleDRIResetProc(ExtensionEntry* extEntry); -static int -ProcAppleDRICreatePixmap(ClientPtr client); - -static unsigned char DRIReqCode = 0; -static int DRIEventBase = 0; - -static void -SNotifyEvent(xAppleDRINotifyEvent *from, xAppleDRINotifyEvent *to); - -typedef struct _DRIEvent *DRIEventPtr; -typedef struct _DRIEvent { - DRIEventPtr next; - ClientPtr client; - XID clientResource; - unsigned int mask; -} DRIEventRec; - -/*ARGSUSED*/ -static void -AppleDRIResetProc(ExtensionEntry* extEntry) -{ - DRIReset(); -} - -static int -ProcAppleDRIQueryVersion(register ClientPtr client) -{ - xAppleDRIQueryVersionReply rep; - - REQUEST_SIZE_MATCH(xAppleDRIQueryVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = SERVER_APPLEDRI_MAJOR_VERSION; - rep.minorVersion = SERVER_APPLEDRI_MINOR_VERSION; - rep.patchVersion = SERVER_APPLEDRI_PATCH_VERSION; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swaps(&rep.majorVersion); - swaps(&rep.minorVersion); - swapl(&rep.patchVersion); - } - WriteToClient(client, sizeof(xAppleDRIQueryVersionReply), &rep); - return Success; -} - -/* surfaces */ - -static int -ProcAppleDRIQueryDirectRenderingCapable(register ClientPtr client) -{ - xAppleDRIQueryDirectRenderingCapableReply rep; - Bool isCapable; - - REQUEST(xAppleDRIQueryDirectRenderingCapableReq); - REQUEST_SIZE_MATCH(xAppleDRIQueryDirectRenderingCapableReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - if (stuff->screen >= screenInfo.numScreens) { - return BadValue; - } - - if (!DRIQueryDirectRenderingCapable(screenInfo.screens[stuff->screen], - &isCapable)) { - return BadValue; - } - rep.isCapable = isCapable; - - if (!client->local) - rep.isCapable = 0; - - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - } - - WriteToClient(client, - sizeof(xAppleDRIQueryDirectRenderingCapableReply), - &rep); - return Success; -} - -static int -ProcAppleDRIAuthConnection(register ClientPtr client) -{ - xAppleDRIAuthConnectionReply rep; - - REQUEST(xAppleDRIAuthConnectionReq); - REQUEST_SIZE_MATCH(xAppleDRIAuthConnectionReq); - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.authenticated = 1; - - if (!DRIAuthConnection(screenInfo.screens[stuff->screen], - stuff->magic)) { - ErrorF("Failed to authenticate %u\n", (unsigned int)stuff->magic); - rep.authenticated = 0; - } - - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.authenticated); /* Yes, this is a CARD32 ... sigh */ - } - - WriteToClient(client, sizeof(xAppleDRIAuthConnectionReply), &rep); - return Success; -} - -static void -surface_notify(void *_arg, - void *data) -{ - DRISurfaceNotifyArg *arg = _arg; - int client_index = (int)x_cvt_vptr_to_uint(data); - xAppleDRINotifyEvent se; - - if (client_index < 0 || client_index >= currentMaxClients) - return; - - se.type = DRIEventBase + AppleDRISurfaceNotify; - se.kind = arg->kind; - se.arg = arg->id; - se.time = currentTime.milliseconds; - WriteEventsToClient(clients[client_index], 1, (xEvent *)&se); -} - -static int -ProcAppleDRICreateSurface(ClientPtr client) -{ - xAppleDRICreateSurfaceReply rep; - DrawablePtr pDrawable; - xp_surface_id sid; - unsigned int key[2]; - int rc; - - REQUEST(xAppleDRICreateSurfaceReq); - REQUEST_SIZE_MATCH(xAppleDRICreateSurfaceReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, - DixReadAccess); - if (rc != Success) - return rc; - - rep.key_0 = rep.key_1 = rep.uid = 0; - - if (!DRICreateSurface(screenInfo.screens[stuff->screen], - (Drawable)stuff->drawable, pDrawable, - stuff->client_id, &sid, key, - surface_notify, - x_cvt_uint_to_vptr(client->index))) { - return BadValue; - } - - rep.key_0 = key[0]; - rep.key_1 = key[1]; - rep.uid = sid; - - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.key_0); - swapl(&rep.key_1); - swapl(&rep.uid); - } - - WriteToClient(client, sizeof(xAppleDRICreateSurfaceReply), &rep); - return Success; -} - -static int -ProcAppleDRIDestroySurface(register ClientPtr client) -{ - int rc; - REQUEST(xAppleDRIDestroySurfaceReq); - DrawablePtr pDrawable; - REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq); - - rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, - DixReadAccess); - if (rc != Success) - return rc; - - if (!DRIDestroySurface(screenInfo.screens[stuff->screen], - (Drawable)stuff->drawable, - pDrawable, NULL, NULL)) { - return BadValue; - } - - return Success; -} - -static int -ProcAppleDRICreatePixmap(ClientPtr client) -{ - REQUEST(xAppleDRICreatePixmapReq); - DrawablePtr pDrawable; - int rc; - char path[PATH_MAX]; - xAppleDRICreatePixmapReply rep; - int width, height, pitch, bpp; - void *ptr; - CARD32 stringLength; - - REQUEST_SIZE_MATCH(xAppleDRICreatePixmapReq); - - rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, - DixReadAccess); - - if (rc != Success) - return rc; - - if (!DRICreatePixmap(screenInfo.screens[stuff->screen], - (Drawable)stuff->drawable, - pDrawable, - path, PATH_MAX)) { - return BadValue; - } - - if (!DRIGetPixmapData(pDrawable, &width, &height, - &pitch, &bpp, &ptr)) { - return BadValue; - } - - rep.stringLength = strlen(path) + 1; - - rep.type = X_Reply; - rep.length = bytes_to_int32(rep.stringLength); - rep.sequenceNumber = client->sequence; - rep.width = width; - rep.height = height; - rep.pitch = pitch; - rep.bpp = bpp; - rep.size = pitch * height; - - if (sizeof(rep) != sz_xAppleDRICreatePixmapReply) - ErrorF("error sizeof(rep) is %zu\n", sizeof(rep)); - - stringLength = rep.stringLength; /* save unswapped value */ - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.stringLength); - swapl(&rep.width); - swapl(&rep.height); - swapl(&rep.pitch); - swapl(&rep.bpp); - swapl(&rep.size); - } - - WriteToClient(client, sizeof(rep), &rep); - WriteToClient(client, stringLength, path); - - return Success; -} - -static int -ProcAppleDRIDestroyPixmap(ClientPtr client) -{ - DrawablePtr pDrawable; - int rc; - REQUEST(xAppleDRIDestroyPixmapReq); - REQUEST_SIZE_MATCH(xAppleDRIDestroyPixmapReq); - - rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, - DixReadAccess); - - if (rc != Success) - return rc; - - DRIDestroyPixmap(pDrawable); - - return Success; -} - -/* dispatch */ - -static int -ProcAppleDRIDispatch(register ClientPtr client) -{ - REQUEST(xReq); - - switch (stuff->data) { - case X_AppleDRIQueryVersion: - return ProcAppleDRIQueryVersion(client); - - case X_AppleDRIQueryDirectRenderingCapable: - return ProcAppleDRIQueryDirectRenderingCapable(client); - } - - if (!client->local) - return DRIErrorBase + AppleDRIClientNotLocal; - - switch (stuff->data) { - case X_AppleDRIAuthConnection: - return ProcAppleDRIAuthConnection(client); - - case X_AppleDRICreateSurface: - return ProcAppleDRICreateSurface(client); - - case X_AppleDRIDestroySurface: - return ProcAppleDRIDestroySurface(client); - - case X_AppleDRICreatePixmap: - return ProcAppleDRICreatePixmap(client); - - case X_AppleDRIDestroyPixmap: - return ProcAppleDRIDestroyPixmap(client); - - default: - return BadRequest; - } -} - -static void -SNotifyEvent(xAppleDRINotifyEvent *from, - xAppleDRINotifyEvent *to) -{ - to->type = from->type; - to->kind = from->kind; - cpswaps(from->sequenceNumber, to->sequenceNumber); - cpswapl(from->time, to->time); - cpswapl(from->arg, to->arg); -} - -static int -SProcAppleDRIQueryVersion(register ClientPtr client) -{ - REQUEST(xAppleDRIQueryVersionReq); - swaps(&stuff->length); - return ProcAppleDRIQueryVersion(client); -} - -static int -SProcAppleDRIQueryDirectRenderingCapable(register ClientPtr client) -{ - REQUEST(xAppleDRIQueryDirectRenderingCapableReq); - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xAppleDRIQueryDirectRenderingCapableReq); - swapl(&stuff->screen); - return ProcAppleDRIQueryDirectRenderingCapable(client); -} - -static int -SProcAppleDRIAuthConnection(register ClientPtr client) -{ - REQUEST(xAppleDRIAuthConnectionReq); - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xAppleDRIAuthConnectionReq); - swapl(&stuff->screen); - swapl(&stuff->magic); - return ProcAppleDRIAuthConnection(client); -} - -static int -SProcAppleDRICreateSurface(register ClientPtr client) -{ - REQUEST(xAppleDRICreateSurfaceReq); - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xAppleDRICreateSurfaceReq); - swapl(&stuff->screen); - swapl(&stuff->drawable); - swapl(&stuff->client_id); - return ProcAppleDRICreateSurface(client); -} - -static int -SProcAppleDRIDestroySurface(register ClientPtr client) -{ - REQUEST(xAppleDRIDestroySurfaceReq); - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq); - swapl(&stuff->screen); - swapl(&stuff->drawable); - return ProcAppleDRIDestroySurface(client); -} - -static int -SProcAppleDRICreatePixmap(register ClientPtr client) -{ - REQUEST(xAppleDRICreatePixmapReq); - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xAppleDRICreatePixmapReq); - swapl(&stuff->screen); - swapl(&stuff->drawable); - return ProcAppleDRICreatePixmap(client); -} - -static int -SProcAppleDRIDestroyPixmap(register ClientPtr client) -{ - REQUEST(xAppleDRIDestroyPixmapReq); - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xAppleDRIDestroyPixmapReq); - swapl(&stuff->drawable); - return ProcAppleDRIDestroyPixmap(client); -} - -static int -SProcAppleDRIDispatch(register ClientPtr client) -{ - REQUEST(xReq); - - switch (stuff->data) { - case X_AppleDRIQueryVersion: - return SProcAppleDRIQueryVersion(client); - - case X_AppleDRIQueryDirectRenderingCapable: - return SProcAppleDRIQueryDirectRenderingCapable(client); - } - - if (!client->local) - return DRIErrorBase + AppleDRIClientNotLocal; - - switch (stuff->data) { - case X_AppleDRIAuthConnection: - return SProcAppleDRIAuthConnection(client); - - case X_AppleDRICreateSurface: - return SProcAppleDRICreateSurface(client); - - case X_AppleDRIDestroySurface: - return SProcAppleDRIDestroySurface(client); - - case X_AppleDRICreatePixmap: - return SProcAppleDRICreatePixmap(client); - - case X_AppleDRIDestroyPixmap: - return SProcAppleDRIDestroyPixmap(client); - - default: - return BadRequest; - } -} - -void -AppleDRIExtensionInit(void) -{ - ExtensionEntry* extEntry; - - if (DRIExtensionInit() && - (extEntry = AddExtension(APPLEDRINAME, - AppleDRINumberEvents, - AppleDRINumberErrors, - ProcAppleDRIDispatch, - SProcAppleDRIDispatch, - AppleDRIResetProc, - StandardMinorOpcode))) { - size_t i; - DRIReqCode = (unsigned char)extEntry->base; - DRIErrorBase = extEntry->errorBase; - DRIEventBase = extEntry->eventBase; - for (i = 0; i < AppleDRINumberEvents; i++) - EventSwapVector[DRIEventBase + i] = (EventSwapPtr)SNotifyEvent; - } -} diff --git a/hw/xquartz/xpr/appledri.h b/hw/xquartz/xpr/appledri.h deleted file mode 100644 index a96c96fc8..000000000 --- a/hw/xquartz/xpr/appledri.h +++ /dev/null @@ -1,137 +0,0 @@ -/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */ -/************************************************************************** - - Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - Copyright 2000 VA Linux Systems, Inc. - Copyright (c) 2002-2012 Apple Computer, Inc. - All Rights Reserved. - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sub license, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial portions - of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin - * Jens Owen - * Rickard E. (Rik) Faith - * Jeremy Huddleston - * - */ - -#ifndef _APPLEDRI_H_ -#define _APPLEDRI_H_ - -#include - -#define X_AppleDRIQueryVersion 0 -#define X_AppleDRIQueryDirectRenderingCapable 1 -#define X_AppleDRICreateSurface 2 -#define X_AppleDRIDestroySurface 3 -#define X_AppleDRIAuthConnection 4 -#define X_AppleDRICreateSharedBuffer 5 -#define X_AppleDRISwapBuffers 6 -#define X_AppleDRICreatePixmap 7 -#define X_AppleDRIDestroyPixmap 8 - -/* Requests up to and including 18 were used in a previous version */ - -/* Events */ -#define AppleDRIObsoleteEvent1 0 -#define AppleDRIObsoleteEvent2 1 -#define AppleDRIObsoleteEvent3 2 -#define AppleDRISurfaceNotify 3 -#define AppleDRINumberEvents 4 - -/* Errors */ -#define AppleDRIClientNotLocal 0 -#define AppleDRIOperationNotSupported 1 -#define AppleDRINumberErrors (AppleDRIOperationNotSupported + 1) - -/* Kinds of SurfaceNotify events: */ -#define AppleDRISurfaceNotifyChanged 0 -#define AppleDRISurfaceNotifyDestroyed 1 - -#ifndef _APPLEDRI_SERVER_ - -typedef struct { - int type; /* of event */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came frome a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* window of event */ - Time time; /* server timestamp when event happened */ - int kind; /* subtype of event */ - int arg; -} XAppleDRINotifyEvent; - -_XFUNCPROTOBEGIN - -Bool -XAppleDRIQueryExtension(Display *dpy, int *event_base, int *error_base); - -Bool -XAppleDRIQueryVersion(Display *dpy, int *majorVersion, int *minorVersion, - int *patchVersion); - -Bool -XAppleDRIQueryDirectRenderingCapable(Display *dpy, int screen, - Bool *isCapable); - -void * -XAppleDRISetSurfaceNotifyHandler(void (*fun)(Display *dpy, unsigned uid, - int kind)); - -Bool -XAppleDRIAuthConnection(Display *dpy, int screen, unsigned int magic); - -Bool XAppleDRICreateSurface(Display * dpy, int screen, Drawable drawable, - unsigned int client_id, unsigned int key[2], - unsigned int* uid); - -Bool -XAppleDRIDestroySurface(Display *dpy, int screen, Drawable drawable); - -Bool -XAppleDRISynchronizeSurfaces(Display *dpy); - -Bool -XAppleDRICreateSharedBuffer(Display *dpy, int screen, Drawable drawable, - Bool doubleSwap, char *path, size_t pathlen, - int *width, - int *height); - -Bool -XAppleDRISwapBuffers(Display *dpy, int screen, Drawable drawable); - -Bool -XAppleDRICreatePixmap(Display *dpy, int screen, Drawable drawable, int *width, - int *height, int *pitch, int *bpp, size_t *size, - char *bufname, - size_t bufnamesize); - -Bool -XAppleDRIDestroyPixmap(Display *dpy, Pixmap pixmap); - -_XFUNCPROTOEND - -#endif /* _APPLEDRI_SERVER_ */ -#endif /* _APPLEDRI_H_ */ diff --git a/hw/xquartz/xpr/appledristr.h b/hw/xquartz/xpr/appledristr.h deleted file mode 100644 index 341d72bb4..000000000 --- a/hw/xquartz/xpr/appledristr.h +++ /dev/null @@ -1,250 +0,0 @@ -/************************************************************************** - - Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - Copyright 2000 VA Linux Systems, Inc. - Copyright (c) 2002-2012 Apple Computer, Inc. - All Rights Reserved. - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sub license, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial portions - of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin - * Jens Owen - * Rickard E. (Rik) Fiath - * Jeremy Huddleston - * - */ - -#ifndef _APPLEDRISTR_H_ -#define _APPLEDRISTR_H_ - -#include "appledri.h" - -#define APPLEDRINAME "Apple-DRI" - -#define APPLE_DRI_MAJOR_VERSION 1 /* current version numbers */ -#define APPLE_DRI_MINOR_VERSION 0 -#define APPLE_DRI_PATCH_VERSION 0 - -typedef struct _AppleDRIQueryVersion { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIQueryVersion */ - CARD16 length; -} xAppleDRIQueryVersionReq; -#define sz_xAppleDRIQueryVersionReq 4 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber; - CARD32 length; - CARD16 majorVersion; /* major version of DRI protocol */ - CARD16 minorVersion; /* minor version of DRI protocol */ - CARD32 patchVersion; /* patch version of DRI protocol */ - CARD32 pad3; - CARD32 pad4; - CARD32 pad5; - CARD32 pad6; -} xAppleDRIQueryVersionReply; -#define sz_xAppleDRIQueryVersionReply 32 - -typedef struct _AppleDRIQueryDirectRenderingCapable { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */ - CARD16 length; - CARD32 screen; -} xAppleDRIQueryDirectRenderingCapableReq; -#define sz_xAppleDRIQueryDirectRenderingCapableReq 8 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber; - CARD32 length; - BOOL isCapable; - BOOL pad2; - BOOL pad3; - BOOL pad4; - CARD32 pad5; - CARD32 pad6; - CARD32 pad7; - CARD32 pad8; - CARD32 pad9; -} xAppleDRIQueryDirectRenderingCapableReply; -#define sz_xAppleDRIQueryDirectRenderingCapableReply 32 - -typedef struct _AppleDRIAuthConnection { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRICloseConnection */ - CARD16 length; - CARD32 screen; - CARD32 magic; -} xAppleDRIAuthConnectionReq; -#define sz_xAppleDRIAuthConnectionReq 12 - -typedef struct { - BYTE type; - BOOL pad1; - CARD16 sequenceNumber; - CARD32 length; - CARD32 authenticated; - CARD32 pad2; - CARD32 pad3; - CARD32 pad4; - CARD32 pad5; - CARD32 pad6; -} xAppleDRIAuthConnectionReply; -#define zx_xAppleDRIAuthConnectionReply 32 - -typedef struct _AppleDRICreateSurface { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRICreateSurface */ - CARD16 length; - CARD32 screen; - CARD32 drawable; - CARD32 client_id; -} xAppleDRICreateSurfaceReq; -#define sz_xAppleDRICreateSurfaceReq 16 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber; - CARD32 length; - CARD32 key_0; - CARD32 key_1; - CARD32 uid; - CARD32 pad4; - CARD32 pad5; - CARD32 pad6; -} xAppleDRICreateSurfaceReply; -#define sz_xAppleDRICreateSurfaceReply 32 - -typedef struct _AppleDRIDestroySurface { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIDestroySurface */ - CARD16 length; - CARD32 screen; - CARD32 drawable; -} xAppleDRIDestroySurfaceReq; -#define sz_xAppleDRIDestroySurfaceReq 12 - -typedef struct _AppleDRINotify { - BYTE type; /* always eventBase + event type */ - BYTE kind; - CARD16 sequenceNumber; - CARD32 time; /* time of change */ - CARD32 pad1; - CARD32 arg; - CARD32 pad3; - CARD32 pad4; - CARD32 pad5; - CARD32 pad6; -} xAppleDRINotifyEvent; -#define sz_xAppleDRINotifyEvent 32 - -typedef struct { - CARD8 reqType; - CARD8 driReqType; - CARD16 length; - CARD32 screen; - CARD32 drawable; - BOOL doubleSwap; - CARD8 pad1, pad2, pad3; -} xAppleDRICreateSharedBufferReq; - -#define sz_xAppleDRICreateSharedBufferReq 16 - -typedef struct { - BYTE type; - BYTE data1; - CARD16 sequenceNumber; - CARD32 length; - CARD32 stringLength; /* 0 on error */ - CARD32 width; - CARD32 height; - CARD32 pad1; - CARD32 pad2; - CARD32 pad3; -} xAppleDRICreateSharedBufferReply; - -#define sz_xAppleDRICreateSharedBufferReply 32 - -typedef struct { - CARD8 reqType; - CARD8 driReqType; - CARD16 length; - CARD32 screen; - CARD32 drawable; -} xAppleDRISwapBuffersReq; - -#define sz_xAppleDRISwapBuffersReq 12 - -typedef struct { - CARD8 reqType; /*1 */ - CARD8 driReqType; /*2 */ - CARD16 length; /*4 */ - CARD32 screen; /*8 */ - CARD32 drawable; /*12 */ -} xAppleDRICreatePixmapReq; - -#define sz_xAppleDRICreatePixmapReq 12 - -typedef struct { - BYTE type; /*1 */ - BOOL pad1; /*2 */ - CARD16 sequenceNumber; /*4 */ - CARD32 length; /*8 */ - CARD32 width; /*12 */ - CARD32 height; /*16 */ - CARD32 pitch; /*20 */ - CARD32 bpp; /*24 */ - CARD32 size; /*28 */ - CARD32 stringLength; /*32 */ -} xAppleDRICreatePixmapReply; - -#define sz_xAppleDRICreatePixmapReply 32 - -typedef struct { - CARD8 reqType; /*1 */ - CARD8 driReqType; /*2 */ - CARD16 length; /*4 */ - CARD32 drawable; /*8 */ -} xAppleDRIDestroyPixmapReq; - -#define sz_xAppleDRIDestroyPixmapReq 8 - -#ifdef _APPLEDRI_SERVER_ - -void AppleDRISendEvent( -#if NeedFunctionPrototypes - int /* type */, - unsigned int /* mask */, - int /* which */, - int /* arg */ -#endif - ); - -#endif /* _APPLEDRI_SERVER_ */ -#endif /* _APPLEDRISTR_H_ */ diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c deleted file mode 100644 index 091418e19..000000000 --- a/hw/xquartz/xpr/dri.c +++ /dev/null @@ -1,818 +0,0 @@ -/************************************************************************** - - Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - Copyright 2000 VA Linux Systems, Inc. - Copyright (c) 2002-2012 Apple Computer, Inc. - All Rights Reserved. - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sub license, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial portions - of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Jens Owen - * Rickard E. (Rik) Faith - * Jeremy Huddleston - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include -#include "misc.h" -#include "dixstruct.h" -#include "extnsionst.h" -#include "extinit.h" -#include "colormapst.h" -#include "cursorstr.h" -#include "scrnintstr.h" -#include "windowstr.h" -#include "servermd.h" -#define _APPLEDRI_SERVER_ -#include "appledristr.h" -#include "swaprep.h" -#include "dri.h" -#include "dristruct.h" -#include "mi.h" -#include "mipointer.h" -#include "rootless.h" -#include "rootlessCommon.h" -#include "x-hash.h" -#include "x-hook.h" -#include "driWrap.h" - -static DevPrivateKeyRec DRIScreenPrivKeyRec; -#define DRIScreenPrivKey (&DRIScreenPrivKeyRec) -static DevPrivateKeyRec DRIWindowPrivKeyRec; -#define DRIWindowPrivKey (&DRIWindowPrivKeyRec) -static DevPrivateKeyRec DRIPixmapPrivKeyRec; -#define DRIPixmapPrivKey (&DRIPixmapPrivKeyRec) -static DevPrivateKeyRec DRIPixmapBufferPrivKeyRec; -#define DRIPixmapBufferPrivKey (&DRIPixmapBufferPrivKeyRec) - -static RESTYPE DRIDrawablePrivResType; - -static x_hash_table *surface_hash; /* maps surface ids -> drawablePrivs */ - -static Bool -DRIFreePixmapImp(DrawablePtr pDrawable); - -typedef struct { - DrawablePtr pDrawable; - int refCount; - int bytesPerPixel; - int width; - int height; - char shmPath[PATH_MAX]; - int fd; /* From shm_open (for now) */ - size_t length; /* length of buffer */ - void *buffer; -} DRIPixmapBuffer, *DRIPixmapBufferPtr; - -Bool -DRIScreenInit(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv; - int i; - - if (!dixRegisterPrivateKey(&DRIScreenPrivKeyRec, PRIVATE_SCREEN, 0)) - return FALSE; - if (!dixRegisterPrivateKey(&DRIWindowPrivKeyRec, PRIVATE_WINDOW, 0)) - return FALSE; - if (!dixRegisterPrivateKey(&DRIPixmapPrivKeyRec, PRIVATE_PIXMAP, 0)) - return FALSE; - if (!dixRegisterPrivateKey(&DRIPixmapBufferPrivKeyRec, PRIVATE_PIXMAP, 0)) - return FALSE; - - pDRIPriv = (DRIScreenPrivPtr)calloc(1, sizeof(DRIScreenPrivRec)); - if (!pDRIPriv) { - dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); - return FALSE; - } - - dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, pDRIPriv); - pDRIPriv->directRenderingSupport = TRUE; - pDRIPriv->nrWindows = 0; - - /* Initialize drawable tables */ - for (i = 0; i < DRI_MAX_DRAWABLES; i++) { - pDRIPriv->DRIDrawables[i] = NULL; - } - - return TRUE; -} - -Bool -DRIFinishScreenInit(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - /* Wrap DRI support */ - pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow; - pScreen->CopyWindow = DRICopyWindow; - - pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify; - pScreen->ClipNotify = DRIClipNotify; - - // ErrorF("[DRI] screen %d installation complete\n", pScreen->myNum); - - return DRIWrapInit(pScreen); -} - -void -DRICloseScreen(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - if (pDRIPriv && pDRIPriv->directRenderingSupport) { - free(pDRIPriv); - dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); - } -} - -Bool -DRIExtensionInit(void) -{ - DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete, - "DRIDrawable"); - - return DRIDrawablePrivResType != 0; -} - -void -DRIReset(void) -{ - /* - * This stub routine is called when the X Server recycles, resources - * allocated by DRIExtensionInit need to be managed here. - * - * Currently this routine is a stub because all the interesting resources - * are managed via the screen init process. - */ -} - -Bool -DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool* isCapable) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - if (pDRIPriv) - *isCapable = pDRIPriv->directRenderingSupport; - else - *isCapable = FALSE; - - return TRUE; -} - -Bool -DRIAuthConnection(ScreenPtr pScreen, unsigned int magic) -{ -#if 0 - /* FIXME: something? */ - - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - - if (drmAuthMagic(pDRIPriv->drmFD, magic)) return FALSE; -#endif - return TRUE; -} - -static void -DRIUpdateSurface(DRIDrawablePrivPtr pDRIDrawablePriv, DrawablePtr pDraw) -{ - xp_window_changes wc; - unsigned int flags = 0; - - if (pDRIDrawablePriv->sid == 0) - return; - - wc.depth = (pDraw->bitsPerPixel == 32 ? XP_DEPTH_ARGB8888 - : pDraw->bitsPerPixel == 16 ? XP_DEPTH_RGB555 : XP_DEPTH_NIL); - if (wc.depth != XP_DEPTH_NIL) - flags |= XP_DEPTH; - - if (pDraw->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr)pDraw; - WindowPtr pTopWin = TopLevelParent(pWin); - - wc.x = pWin->drawable.x - (pTopWin->drawable.x - pTopWin->borderWidth); - wc.y = pWin->drawable.y - (pTopWin->drawable.y - pTopWin->borderWidth); - wc.width = pWin->drawable.width + 2 * pWin->borderWidth; - wc.height = pWin->drawable.height + 2 * pWin->borderWidth; - wc.bit_gravity = XP_GRAVITY_NONE; - - wc.shape_nrects = RegionNumRects(&pWin->clipList); - wc.shape_rects = RegionRects(&pWin->clipList); - wc.shape_tx = -(pTopWin->drawable.x - pTopWin->borderWidth); - wc.shape_ty = -(pTopWin->drawable.y - pTopWin->borderWidth); - - flags |= XP_BOUNDS | XP_SHAPE; - - } - else if (pDraw->type == DRAWABLE_PIXMAP) { - wc.x = 0; - wc.y = 0; - wc.width = pDraw->width; - wc.height = pDraw->height; - wc.bit_gravity = XP_GRAVITY_NONE; - flags |= XP_BOUNDS; - } - - xp_configure_surface(pDRIDrawablePriv->sid, flags, &wc); -} - -/* Return NULL if an error occurs. */ -static DRIDrawablePrivPtr -CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, - xp_window_id *widPtr) -{ - DRIDrawablePrivPtr pDRIDrawablePriv; - xp_window_id wid = 0; - - *widPtr = 0; - - pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); - - if (pDRIDrawablePriv == NULL) { - xp_error err; - xp_window_changes wc; - - /* allocate a DRI Window Private record */ - if (!(pDRIDrawablePriv = malloc(sizeof(*pDRIDrawablePriv)))) { - return NULL; - } - - pDRIDrawablePriv->pDraw = (DrawablePtr)pWin; - pDRIDrawablePriv->pScreen = pScreen; - pDRIDrawablePriv->refCount = 0; - pDRIDrawablePriv->drawableIndex = -1; - pDRIDrawablePriv->notifiers = NULL; - - /* find the physical window */ - wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, TRUE)); - - if (wid == 0) { - free(pDRIDrawablePriv); - return NULL; - } - - /* allocate the physical surface */ - err = xp_create_surface(wid, &pDRIDrawablePriv->sid); - - if (err != Success) { - free(pDRIDrawablePriv); - return NULL; - } - - /* Make it visible */ - wc.stack_mode = XP_MAPPED_ABOVE; - wc.sibling = 0; - err = xp_configure_surface(pDRIDrawablePriv->sid, XP_STACKING, &wc); - - if (err != Success) { - xp_destroy_surface(pDRIDrawablePriv->sid); - free(pDRIDrawablePriv); - return NULL; - } - - /* save private off of preallocated index */ - dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, - pDRIDrawablePriv); - } - - *widPtr = wid; - - return pDRIDrawablePriv; -} - -/* Return NULL if an error occurs. */ -static DRIDrawablePrivPtr -CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) -{ - DRIDrawablePrivPtr pDRIDrawablePriv; - - pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix); - - if (pDRIDrawablePriv == NULL) { - xp_error err; - - /* allocate a DRI Window Private record */ - if (!(pDRIDrawablePriv = calloc(1, sizeof(*pDRIDrawablePriv)))) { - return NULL; - } - - pDRIDrawablePriv->pDraw = (DrawablePtr)pPix; - pDRIDrawablePriv->pScreen = pScreen; - pDRIDrawablePriv->refCount = 0; - pDRIDrawablePriv->drawableIndex = -1; - pDRIDrawablePriv->notifiers = NULL; - - /* Passing a null window id to Xplugin in 10.3+ asks for - an accelerated offscreen surface. */ - - err = xp_create_surface(0, &pDRIDrawablePriv->sid); - if (err != Success) { - free(pDRIDrawablePriv); - return NULL; - } - - /* - * The DRIUpdateSurface will be called to resize the surface - * after this function, if the export is successful. - */ - - /* save private off of preallocated index */ - dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, - pDRIDrawablePriv); - } - - return pDRIDrawablePriv; -} - -Bool -DRICreateSurface(ScreenPtr pScreen, Drawable id, - DrawablePtr pDrawable, xp_client_id client_id, - xp_surface_id *surface_id, unsigned int ret_key[2], - void (*notify)(void *arg, void *data), void *notify_data) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - xp_window_id wid = 0; - DRIDrawablePrivPtr pDRIDrawablePriv; - - if (pDrawable->type == DRAWABLE_WINDOW) { - /* - * http://bugs.winehq.org/show_bug.cgi?id=31751 - */ - RootlessStopDrawing((WindowPtr)pDrawable, FALSE); - - pDRIDrawablePriv = CreateSurfaceForWindow(pScreen, - (WindowPtr)pDrawable, &wid); - - if (NULL == pDRIDrawablePriv) - return FALSE; /*error*/ - } else if (pDrawable->type == DRAWABLE_PIXMAP) { - pDRIDrawablePriv = CreateSurfaceForPixmap(pScreen, - (PixmapPtr)pDrawable); - - if (NULL == pDRIDrawablePriv) - return FALSE; /*error*/ - } else { - /* We handle GLXPbuffers in a different way (via CGL). */ - return FALSE; - } - - /* Finish initialization of new surfaces */ - if (pDRIDrawablePriv->refCount == 0) { - unsigned int key[2] = { 0 }; - xp_error err; - - /* try to give the client access to the surface */ - if (client_id != 0) { - /* - * Xplugin accepts a 0 wid if the surface id is offscreen, such - * as for a pixmap. - */ - err = xp_export_surface(wid, pDRIDrawablePriv->sid, - client_id, key); - if (err != Success) { - xp_destroy_surface(pDRIDrawablePriv->sid); - free(pDRIDrawablePriv); - - /* - * Now set the dix privates to NULL that were previously set. - * This prevents reusing an invalid pointer. - */ - if (pDrawable->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr)pDrawable; - - dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL); - } - else if (pDrawable->type == DRAWABLE_PIXMAP) { - PixmapPtr pPix = (PixmapPtr)pDrawable; - - dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL); - } - - return FALSE; - } - } - - pDRIDrawablePriv->key[0] = key[0]; - pDRIDrawablePriv->key[1] = key[1]; - - ++pDRIPriv->nrWindows; - - /* and stash it by surface id */ - if (surface_hash == NULL) - surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL); - x_hash_table_insert(surface_hash, - x_cvt_uint_to_vptr( - pDRIDrawablePriv->sid), pDRIDrawablePriv); - - /* track this in case this window is destroyed */ - AddResource(id, DRIDrawablePrivResType, (void *)pDrawable); - - /* Initialize shape */ - DRIUpdateSurface(pDRIDrawablePriv, pDrawable); - } - - pDRIDrawablePriv->refCount++; - - *surface_id = pDRIDrawablePriv->sid; - - if (ret_key != NULL) { - ret_key[0] = pDRIDrawablePriv->key[0]; - ret_key[1] = pDRIDrawablePriv->key[1]; - } - - if (notify != NULL) { - pDRIDrawablePriv->notifiers = x_hook_add(pDRIDrawablePriv->notifiers, - notify, notify_data); - } - - return TRUE; -} - -Bool -DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, - void (*notify)(void *, void *), void *notify_data) -{ - DRIDrawablePrivPtr pDRIDrawablePriv; - - if (pDrawable->type == DRAWABLE_WINDOW) { - pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW((WindowPtr)pDrawable); - } - else if (pDrawable->type == DRAWABLE_PIXMAP) { - pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP((PixmapPtr)pDrawable); - } - else { - return FALSE; - } - - if (pDRIDrawablePriv != NULL) { - /* - * This doesn't seem to be used, because notify is NULL in all callers. - */ - - if (notify != NULL) { - pDRIDrawablePriv->notifiers = x_hook_remove( - pDRIDrawablePriv->notifiers, - notify, notify_data); - } - - --pDRIDrawablePriv->refCount; - - /* - * Check if the drawable privates still have a reference to the - * surface. - */ - - if (pDRIDrawablePriv->refCount <= 0) { - /* - * This calls back to DRIDrawablePrivDelete which - * frees the private area and dispatches events, if needed. - */ - FreeResourceByType(id, DRIDrawablePrivResType, FALSE); - } - } - - return TRUE; -} - -/* - * The assumption is that this is called when the refCount of a surface - * drops to <= 0, or the window/pixmap is destroyed. - */ -Bool -DRIDrawablePrivDelete(void *pResource, XID id) -{ - DrawablePtr pDrawable = (DrawablePtr)pResource; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen); - DRIDrawablePrivPtr pDRIDrawablePriv = NULL; - WindowPtr pWin = NULL; - PixmapPtr pPix = NULL; - - if (pDrawable->type == DRAWABLE_WINDOW) { - pWin = (WindowPtr)pDrawable; - pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); - } - else if (pDrawable->type == DRAWABLE_PIXMAP) { - pPix = (PixmapPtr)pDrawable; - pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix); - } - - if (pDRIDrawablePriv == NULL) { - /* - * We reuse __func__ and the resource type for the GLXPixmap code. - * Attempt to free a pixmap buffer associated with the resource - * if possible. - */ - return DRIFreePixmapImp(pDrawable); - } - - if (pDRIDrawablePriv->drawableIndex != -1) { - /* release drawable table entry */ - pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL; - } - - if (pDRIDrawablePriv->sid != 0) { - DRISurfaceNotify(pDRIDrawablePriv->sid, - AppleDRISurfaceNotifyDestroyed); - } - - if (pDRIDrawablePriv->notifiers != NULL) - x_hook_free(pDRIDrawablePriv->notifiers); - - free(pDRIDrawablePriv); - - if (pDrawable->type == DRAWABLE_WINDOW) { - dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL); - } - else if (pDrawable->type == DRAWABLE_PIXMAP) { - dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL); - } - - --pDRIPriv->nrWindows; - - return TRUE; -} - -void -DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIDrawablePrivPtr pDRIDrawablePriv; - - if (pDRIPriv->nrWindows > 0) { - pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); - if (pDRIDrawablePriv != NULL) { - DRIUpdateSurface(pDRIDrawablePriv, &pWin->drawable); - } - } - - /* unwrap */ - pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow; - - /* call lower layers */ - (*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc); - - /* rewrap */ - pScreen->CopyWindow = DRICopyWindow; -} - -void -DRIClipNotify(WindowPtr pWin, int dx, int dy) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIDrawablePrivPtr pDRIDrawablePriv; - - if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) { - DRIUpdateSurface(pDRIDrawablePriv, &pWin->drawable); - } - - if (pDRIPriv->wrap.ClipNotify) { - pScreen->ClipNotify = pDRIPriv->wrap.ClipNotify; - - (*pScreen->ClipNotify)(pWin, dx, dy); - - pScreen->ClipNotify = DRIClipNotify; - } -} - -/* This lets us get at the unwrapped functions so that they can correctly - * call the lower level functions, and choose whether they will be - * called at every level of recursion (eg in validatetree). - */ -DRIWrappedFuncsRec * -DRIGetWrappedFuncs(ScreenPtr pScreen) -{ - return &(DRI_SCREEN_PRIV(pScreen)->wrap); -} - -void -DRIQueryVersion(int *majorVersion, - int *minorVersion, - int *patchVersion) -{ - *majorVersion = APPLE_DRI_MAJOR_VERSION; - *minorVersion = APPLE_DRI_MINOR_VERSION; - *patchVersion = APPLE_DRI_PATCH_VERSION; -} - -/* - * Note: this also cleans up the hash table in addition to notifying clients. - * The sid/surface-id should not be used after this, because it will be - * invalid. - */ -void -DRISurfaceNotify(xp_surface_id id, int kind) -{ - DRIDrawablePrivPtr pDRIDrawablePriv = NULL; - DRISurfaceNotifyArg arg; - - arg.id = id; - arg.kind = kind; - - if (surface_hash != NULL) { - pDRIDrawablePriv = x_hash_table_lookup(surface_hash, - x_cvt_uint_to_vptr(id), NULL); - } - - if (pDRIDrawablePriv == NULL) - return; - - if (kind == AppleDRISurfaceNotifyDestroyed) { - x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(id)); - } - - x_hook_run(pDRIDrawablePriv->notifiers, &arg); - - if (kind == AppleDRISurfaceNotifyDestroyed) { - xp_error error; - - error = xp_destroy_surface(pDRIDrawablePriv->sid); - - if (error) - ErrorF("%s: xp_destroy_surface failed: %d\n", __func__, error); - - /* Guard against reuse, even though we are freeing after this. */ - pDRIDrawablePriv->sid = 0; - - FreeResourceByType(pDRIDrawablePriv->pDraw->id, - DRIDrawablePrivResType, FALSE); - } -} - -/* - * This creates a shared memory buffer for use with GLXPixmaps - * and AppleSGLX. - */ -Bool -DRICreatePixmap(ScreenPtr pScreen, Drawable id, - DrawablePtr pDrawable, char *path, - size_t pathmax) -{ - DRIPixmapBufferPtr shared; - PixmapPtr pPix; - - if (pDrawable->type != DRAWABLE_PIXMAP) - return FALSE; - - pPix = (PixmapPtr)pDrawable; - - shared = malloc(sizeof(*shared)); - if (NULL == shared) { - FatalError("failed to allocate DRIPixmapBuffer in %s\n", __func__); - } - - shared->pDrawable = pDrawable; - shared->refCount = 1; - - if (pDrawable->bitsPerPixel >= 24) { - shared->bytesPerPixel = 4; - } - else if (pDrawable->bitsPerPixel <= 16) { - shared->bytesPerPixel = 2; - } - - shared->width = pDrawable->width; - shared->height = pDrawable->height; - - if (-1 == snprintf(shared->shmPath, sizeof(shared->shmPath), - "%d_0x%lx", getpid(), - (unsigned long)id)) { - FatalError("buffer overflow in %s\n", __func__); - } - - shared->fd = shm_open(shared->shmPath, - O_RDWR | O_EXCL | O_CREAT, - S_IRUSR | S_IWUSR | S_IROTH | S_IWOTH); - - if (-1 == shared->fd) { - free(shared); - return FALSE; - } - - shared->length = shared->width * shared->height * shared->bytesPerPixel; - - if (-1 == ftruncate(shared->fd, shared->length)) { - ErrorF("failed to ftruncate (extend) file."); - shm_unlink(shared->shmPath); - close(shared->fd); - free(shared); - return FALSE; - } - - shared->buffer = mmap(NULL, shared->length, - PROT_READ | PROT_WRITE, - MAP_FILE | MAP_SHARED, shared->fd, 0); - - if (MAP_FAILED == shared->buffer) { - ErrorF("failed to mmap shared memory."); - shm_unlink(shared->shmPath); - close(shared->fd); - free(shared); - return FALSE; - } - - strlcpy(path, shared->shmPath, pathmax); - - dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, shared); - - AddResource(id, DRIDrawablePrivResType, (void *)pDrawable); - - return TRUE; -} - -Bool -DRIGetPixmapData(DrawablePtr pDrawable, int *width, int *height, - int *pitch, int *bpp, void **ptr) -{ - PixmapPtr pPix; - DRIPixmapBufferPtr shared; - - if (pDrawable->type != DRAWABLE_PIXMAP) - return FALSE; - - pPix = (PixmapPtr)pDrawable; - - shared = dixLookupPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey); - - if (NULL == shared) - return FALSE; - - assert(pDrawable->width == shared->width); - assert(pDrawable->height == shared->height); - - *width = shared->width; - *height = shared->height; - *bpp = shared->bytesPerPixel; - *pitch = shared->width * shared->bytesPerPixel; - *ptr = shared->buffer; - - return TRUE; -} - -static Bool -DRIFreePixmapImp(DrawablePtr pDrawable) -{ - DRIPixmapBufferPtr shared; - PixmapPtr pPix; - - if (pDrawable->type != DRAWABLE_PIXMAP) - return FALSE; - - pPix = (PixmapPtr)pDrawable; - - shared = dixLookupPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey); - - if (NULL == shared) - return FALSE; - - close(shared->fd); - munmap(shared->buffer, shared->length); - shm_unlink(shared->shmPath); - free(shared); - - dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, (void *)NULL); - - return TRUE; -} - -void -DRIDestroyPixmap(DrawablePtr pDrawable) -{ - if (DRIFreePixmapImp(pDrawable)) - FreeResourceByType(pDrawable->id, DRIDrawablePrivResType, FALSE); - -} diff --git a/hw/xquartz/xpr/dri.h b/hw/xquartz/xpr/dri.h deleted file mode 100644 index a4400a220..000000000 --- a/hw/xquartz/xpr/dri.h +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************** - - Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - Copyright (c) 2002-2012 Apple Computer, Inc. - All Rights Reserved. - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sub license, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial portions - of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Jens Owen - * Jeremy Huddleston - */ - -/* Prototypes for AppleDRI functions */ - -#ifndef _DRI_H_ -#define _DRI_H_ - -#include -#include "scrnintstr.h" -#define _APPLEDRI_SERVER_ -#include "appledri.h" -#include - -typedef void (*ClipNotifyPtr)(WindowPtr, int, int); - -/* - * These functions can be wrapped by the DRI. Each of these have - * generic default funcs (initialized in DRICreateInfoRec) and can be - * overridden by the driver in its [driver]DRIScreenInit function. - */ -typedef struct { - CopyWindowProcPtr CopyWindow; - ClipNotifyProcPtr ClipNotify; -} DRIWrappedFuncsRec, *DRIWrappedFuncsPtr; - -typedef struct { - xp_surface_id id; - int kind; -} DRISurfaceNotifyArg; - -extern Bool -DRIScreenInit(ScreenPtr pScreen); - -extern Bool -DRIFinishScreenInit(ScreenPtr pScreen); - -extern void -DRICloseScreen(ScreenPtr pScreen); - -extern Bool -DRIExtensionInit(void); - -extern void -DRIReset(void); - -extern Bool -DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool *isCapable); - -extern Bool -DRIAuthConnection(ScreenPtr pScreen, unsigned int magic); - -extern Bool DRICreateSurface(ScreenPtr pScreen, - Drawable id, - DrawablePtr pDrawable, - xp_client_id client_id, - xp_surface_id * surface_id, - unsigned int key[2], - void (*notify)(void *arg, void *data), - void *notify_data); - -extern Bool -DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, - void (*notify)(void *arg, - void *data), void *notify_data); - -extern Bool -DRIDrawablePrivDelete(void *pResource, XID id); - -extern DRIWrappedFuncsRec * -DRIGetWrappedFuncs(ScreenPtr pScreen); - -extern void -DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); - -extern void -DRIClipNotify(WindowPtr pWin, int dx, int dy); - -extern void -DRISurfaceNotify(xp_surface_id id, int kind); - -extern void -DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion); - -extern Bool -DRICreatePixmap(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, - char *path, - size_t pathmax); - -extern Bool -DRIGetPixmapData(DrawablePtr pDrawable, int *width, int *height, int *pitch, - int *bpp, - void **ptr); - -extern void -DRIDestroyPixmap(DrawablePtr pDrawable); - -#endif diff --git a/hw/xquartz/xpr/driWrap.c b/hw/xquartz/xpr/driWrap.c deleted file mode 100644 index f588a834d..000000000 --- a/hw/xquartz/xpr/driWrap.c +++ /dev/null @@ -1,569 +0,0 @@ -/* - * Copyright (c) 2009-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include "mi.h" -#include "scrnintstr.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "dixfontstr.h" -#include "mivalidate.h" -#include "driWrap.h" -#include "dri.h" - -#include - -typedef struct { - GCOps const *originalOps; -} DRIGCRec; - -typedef struct { - GCOps *originalOps; - CreateGCProcPtr CreateGC; -} DRIWrapScreenRec; - -typedef struct { - Bool didSave; - int devKind; - DevUnion devPrivate; -} DRISavedDrawableState; - -static DevPrivateKeyRec driGCKeyRec; -#define driGCKey (&driGCKeyRec) - -static DevPrivateKeyRec driWrapScreenKeyRec; -#define driWrapScreenKey (&driWrapScreenKeyRec) - -static GCOps driGCOps; - -#define wrap(priv, real, member, func) { \ - priv->member = real->member; \ - real->member = func; \ -} - -#define unwrap(priv, real, member) { \ - real->member = priv->member; \ -} - -static DRIGCRec * -DRIGetGCPriv(GCPtr pGC) -{ - return dixLookupPrivate(&pGC->devPrivates, driGCKey); -} - -static void -DRIUnwrapGC(GCPtr pGC) -{ - DRIGCRec *pGCPriv = DRIGetGCPriv(pGC); - - pGC->ops = pGCPriv->originalOps; -} - -static void -DRIWrapGC(GCPtr pGC) -{ - pGC->ops = &driGCOps; -} - -static void -DRISurfaceSetDrawable(DrawablePtr pDraw, - DRISavedDrawableState *saved) -{ - saved->didSave = FALSE; - - if (pDraw->type == DRAWABLE_PIXMAP) { - int pitch, width, height, bpp; - void *buffer; - - if (DRIGetPixmapData(pDraw, &width, &height, &pitch, &bpp, - &buffer)) { - PixmapPtr pPix = (PixmapPtr)pDraw; - - saved->devKind = pPix->devKind; - saved->devPrivate.ptr = pPix->devPrivate.ptr; - saved->didSave = TRUE; - - pPix->devKind = pitch; - pPix->devPrivate.ptr = buffer; - } - } -} - -static void -DRISurfaceRestoreDrawable(DrawablePtr pDraw, - DRISavedDrawableState *saved) -{ - PixmapPtr pPix = (PixmapPtr)pDraw; - - if (!saved->didSave) - return; - - pPix->devKind = saved->devKind; - pPix->devPrivate.ptr = saved->devPrivate.ptr; -} - -static void -DRIFillSpans(DrawablePtr dst, GCPtr pGC, int nInit, - DDXPointPtr pptInit, int *pwidthInit, - int sorted) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->FillSpans(dst, pGC, nInit, pptInit, pwidthInit, sorted); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static void -DRISetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc, - DDXPointPtr pptInit, int *pwidthInit, - int nspans, int sorted) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->SetSpans(dst, pGC, pSrc, pptInit, pwidthInit, nspans, sorted); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static void -DRIPutImage(DrawablePtr dst, GCPtr pGC, - int depth, int x, int y, int w, int h, - int leftPad, int format, char *pBits) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->PutImage(dst, pGC, depth, x, y, w, h, leftPad, format, pBits); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static RegionPtr -DRICopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC, - int srcx, int srcy, int w, int h, - int dstx, int dsty) -{ - RegionPtr pReg; - DRISavedDrawableState pSrcSaved, dstSaved; - - DRISurfaceSetDrawable(pSrc, &pSrcSaved); - DRISurfaceSetDrawable(dst, &dstSaved); - - DRIUnwrapGC(pGC); - - pReg = pGC->ops->CopyArea(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(pSrc, &pSrcSaved); - DRISurfaceRestoreDrawable(dst, &dstSaved); - - return pReg; -} - -static RegionPtr -DRICopyPlane(DrawablePtr pSrc, DrawablePtr dst, - GCPtr pGC, int srcx, int srcy, - int w, int h, int dstx, int dsty, - unsigned long plane) -{ - RegionPtr pReg; - DRISavedDrawableState pSrcSaved, dstSaved; - - DRISurfaceSetDrawable(pSrc, &pSrcSaved); - DRISurfaceSetDrawable(dst, &dstSaved); - - DRIUnwrapGC(pGC); - - pReg = pGC->ops->CopyPlane(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty, - plane); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(pSrc, &pSrcSaved); - DRISurfaceRestoreDrawable(dst, &dstSaved); - - return pReg; -} - -static void -DRIPolyPoint(DrawablePtr dst, GCPtr pGC, - int mode, int npt, DDXPointPtr pptInit) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->PolyPoint(dst, pGC, mode, npt, pptInit); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static void -DRIPolylines(DrawablePtr dst, GCPtr pGC, - int mode, int npt, DDXPointPtr pptInit) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->Polylines(dst, pGC, mode, npt, pptInit); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static void -DRIPolySegment(DrawablePtr dst, GCPtr pGC, - int nseg, xSegment *pSeg) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->PolySegment(dst, pGC, nseg, pSeg); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static void -DRIPolyRectangle(DrawablePtr dst, GCPtr pGC, - int nRects, xRectangle *pRects) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->PolyRectangle(dst, pGC, nRects, pRects); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} -static void -DRIPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc *parcs) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->PolyArc(dst, pGC, narcs, parcs); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static void -DRIFillPolygon(DrawablePtr dst, GCPtr pGC, - int shape, int mode, int count, - DDXPointPtr pptInit) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->FillPolygon(dst, pGC, shape, mode, count, pptInit); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static void -DRIPolyFillRect(DrawablePtr dst, GCPtr pGC, - int nRectsInit, xRectangle *pRectsInit) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->PolyFillRect(dst, pGC, nRectsInit, pRectsInit); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static void -DRIPolyFillArc(DrawablePtr dst, GCPtr pGC, - int narcsInit, xArc *parcsInit) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->PolyFillArc(dst, pGC, narcsInit, parcsInit); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static int -DRIPolyText8(DrawablePtr dst, GCPtr pGC, - int x, int y, int count, char *chars) -{ - int ret; - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - ret = pGC->ops->PolyText8(dst, pGC, x, y, count, chars); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); - - return ret; -} - -static int -DRIPolyText16(DrawablePtr dst, GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - int ret; - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - ret = pGC->ops->PolyText16(dst, pGC, x, y, count, chars); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); - - return ret; -} - -static void -DRIImageText8(DrawablePtr dst, GCPtr pGC, - int x, int y, int count, char *chars) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->ImageText8(dst, pGC, x, y, count, chars); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static void -DRIImageText16(DrawablePtr dst, GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->ImageText16(dst, pGC, x, y, count, chars); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static void -DRIImageGlyphBlt(DrawablePtr dst, GCPtr pGC, - int x, int y, unsigned int nglyphInit, - CharInfoPtr *ppciInit, void *unused) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->ImageGlyphBlt(dst, pGC, x, y, nglyphInit, ppciInit, unused); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static void -DRIPolyGlyphBlt(DrawablePtr dst, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, void *pglyphBase) -{ - DRISavedDrawableState saved; - - DRISurfaceSetDrawable(dst, &saved); - - DRIUnwrapGC(pGC); - - pGC->ops->PolyGlyphBlt(dst, pGC, x, y, nglyph, ppci, pglyphBase); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(dst, &saved); -} - -static void -DRIPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst, - int dx, int dy, int xOrg, int yOrg) -{ - DRISavedDrawableState bitMapSaved, dstSaved; - - DRISurfaceSetDrawable(&pBitMap->drawable, &bitMapSaved); - DRISurfaceSetDrawable(dst, &dstSaved); - - DRIUnwrapGC(pGC); - - pGC->ops->PushPixels(pGC, pBitMap, dst, dx, dy, xOrg, yOrg); - - DRIWrapGC(pGC); - - DRISurfaceRestoreDrawable(&pBitMap->drawable, &bitMapSaved); - DRISurfaceRestoreDrawable(dst, &dstSaved); -} - -static GCOps driGCOps = { - DRIFillSpans, - DRISetSpans, - DRIPutImage, - DRICopyArea, - DRICopyPlane, - DRIPolyPoint, - DRIPolylines, - DRIPolySegment, - DRIPolyRectangle, - DRIPolyArc, - DRIFillPolygon, - DRIPolyFillRect, - DRIPolyFillArc, - DRIPolyText8, - DRIPolyText16, - DRIImageText8, - DRIImageText16, - DRIImageGlyphBlt, - DRIPolyGlyphBlt, - DRIPushPixels -}; - -static Bool -DRICreateGC(GCPtr pGC) -{ - ScreenPtr pScreen = pGC->pScreen; - DRIWrapScreenRec *pScreenPriv; - DRIGCRec *pGCPriv; - Bool ret; - - pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, driWrapScreenKey); - - pGCPriv = DRIGetGCPriv(pGC); - - unwrap(pScreenPriv, pScreen, CreateGC); - ret = pScreen->CreateGC(pGC); - - if (ret) { - pGCPriv->originalOps = pGC->ops; - pGC->ops = &driGCOps; - } - - wrap(pScreenPriv, pScreen, CreateGC, DRICreateGC); - - return ret; -} - -/* Return false if an error occurred. */ -Bool -DRIWrapInit(ScreenPtr pScreen) -{ - DRIWrapScreenRec *pScreenPriv; - - if (!dixRegisterPrivateKey(&driGCKeyRec, PRIVATE_GC, sizeof(DRIGCRec))) - return FALSE; - - if (!dixRegisterPrivateKey(&driWrapScreenKeyRec, PRIVATE_SCREEN, - sizeof(DRIWrapScreenRec))) - return FALSE; - - pScreenPriv = dixGetPrivateAddr(&pScreen->devPrivates, - &driWrapScreenKeyRec); - pScreenPriv->CreateGC = pScreen->CreateGC; - pScreen->CreateGC = DRICreateGC; - - return TRUE; -} diff --git a/hw/xquartz/xpr/driWrap.h b/hw/xquartz/xpr/driWrap.h deleted file mode 100644 index 1bc34ee9e..000000000 --- a/hw/xquartz/xpr/driWrap.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2009-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifndef DRIWRAP_H -#include "scrnintstr.h" - -Bool -DRIWrapInit(ScreenPtr pScreen); - -#endif /*DRIWRAP_H*/ diff --git a/hw/xquartz/xpr/dristruct.h b/hw/xquartz/xpr/dristruct.h deleted file mode 100644 index 068e9a253..000000000 --- a/hw/xquartz/xpr/dristruct.h +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************** - - Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - Copyright (c) 2002-2012 Apple Computer, Inc. - All Rights Reserved. - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sub license, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial portions - of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Jens Owen - * Jeremy Huddleston - */ - -#ifndef DRI_STRUCT_H -#define DRI_STRUCT_H - -#include "dri.h" -#include "x-list.h" - -#define DRI_MAX_DRAWABLES 256 - -#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \ - dixLookupPrivate(&(pWin)-> \ - devPrivates, \ - DRIWindowPrivKey)) - -#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \ - dixLookupPrivate(&(pPix)-> \ - devPrivates, \ - DRIPixmapPrivKey)) - -typedef struct _DRIDrawablePrivRec { - xp_surface_id sid; - int drawableIndex; - DrawablePtr pDraw; - ScreenPtr pScreen; - int refCount; - unsigned int key[2]; - x_list *notifiers; /* list of (FUN . DATA) */ -} DRIDrawablePrivRec, *DRIDrawablePrivPtr; - -#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \ - dixLookupPrivate(&(pScreen) \ - -> \ - devPrivates, \ - DRIScreenPrivKey)) - -#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \ - dixLookupPrivate(&screenInfo \ - .screens[ \ - screenIndex \ - ]-> \ - devPrivates, \ - DRIScreenPrivKey)) - -typedef struct _DRIScreenPrivRec { - Bool directRenderingSupport; - int nrWindows; - DRIWrappedFuncsRec wrap; - DrawablePtr DRIDrawables[DRI_MAX_DRAWABLES]; -} DRIScreenPrivRec, *DRIScreenPrivPtr; - -#endif /* DRI_STRUCT_H */ diff --git a/hw/xquartz/xpr/meson.build b/hw/xquartz/xpr/meson.build deleted file mode 100644 index 590727f47..000000000 --- a/hw/xquartz/xpr/meson.build +++ /dev/null @@ -1,18 +0,0 @@ -libXquartzXpr = static_library('XquartzXpr', - [ - 'appledri.c', - 'dri.c', - 'driWrap.c', - 'xprAppleWM.c', - 'xprCursor.c', - 'xprEvent.c', - 'xprFrame.c', - 'xprScreen.c', - 'x-hash.c', - 'x-hook.c', - 'x-list.c', - ], - include_directories: [inc, '..', '../../../pseudoramiX', '../../../miext/rootless'], - c_args: [bundle_id_def, '-DXQUARTZ'], - dependencies: [xproto_dep, pixman_dep], -) diff --git a/hw/xquartz/xpr/x-hash.c b/hw/xquartz/xpr/x-hash.c deleted file mode 100644 index 087656d9b..000000000 --- a/hw/xquartz/xpr/x-hash.c +++ /dev/null @@ -1,321 +0,0 @@ -/* x-hash.c - basic hash tables - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "x-hash.h" -#include "x-list.h" -#include -#include - -#define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0])) - -struct x_hash_table_struct { - unsigned int bucket_index; - unsigned int total_keys; - x_list **buckets; - - x_hash_fun *hash_key; - x_compare_fun *compare_keys; - x_destroy_fun *destroy_key; - x_destroy_fun *destroy_value; -}; - -#define ITEM_NEW(k, v) X_PFX(list_prepend) ((x_list *)(k), v) -#define ITEM_FREE(i) X_PFX(list_free_1) (i) -#define ITEM_KEY(i) ((void *)(i)->next) -#define ITEM_VALUE(i) ((i)->data) - -#define SPLIT_THRESHOLD_FACTOR 2 - -/* http://planetmath.org/?op=getobj&from=objects&name=GoodHashTablePrimes */ -static const unsigned int bucket_sizes[] = { - 29, 53, 97, 193, 389, 769, 1543, - 3079, 6151, 12289, 24593, 49157, - 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, - 12582917, - 25165843, 50331653, 100663319, 201326611, 402653189, 805306457, - 1610612741 -}; - -static inline unsigned int -hash_table_total_buckets(x_hash_table *h) -{ - return bucket_sizes[h->bucket_index]; -} - -static inline void -hash_table_destroy_item(x_hash_table *h, void *k, void *v) -{ - if (h->destroy_key != 0) - (*h->destroy_key)(k); - - if (h->destroy_value != 0) - (*h->destroy_value)(v); -} - -static inline size_t -hash_table_hash_key(x_hash_table *h, void *k) -{ - if (h->hash_key != 0) - return (*h->hash_key)(k); - else - return (size_t)k; -} - -static inline int -hash_table_compare_keys(x_hash_table *h, void *k1, void *k2) -{ - if (h->compare_keys == 0) - return k1 == k2; - else - return (*h->compare_keys)(k1, k2) == 0; -} - -static void -hash_table_split(x_hash_table *h) -{ - x_list **new, **old; - x_list *node, *item, *next; - int new_size, old_size; - size_t b; - int i; - - if (h->bucket_index == ARRAY_SIZE(bucket_sizes) - 1) - return; - - old_size = hash_table_total_buckets(h); - old = h->buckets; - - h->bucket_index++; - - new_size = hash_table_total_buckets(h); - new = calloc(new_size, sizeof(x_list *)); - - if (new == 0) { - h->bucket_index--; - return; - } - - for (i = 0; i < old_size; i++) { - for (node = old[i]; node != 0; node = next) { - next = node->next; - item = node->data; - - b = hash_table_hash_key(h, ITEM_KEY(item)) % new_size; - - node->next = new[b]; - new[b] = node; - } - } - - h->buckets = new; - free(old); -} - -X_EXTERN x_hash_table * -X_PFX(hash_table_new) (x_hash_fun * hash, - x_compare_fun * compare, - x_destroy_fun * key_destroy, - x_destroy_fun * value_destroy) { - x_hash_table *h; - - h = calloc(1, sizeof(x_hash_table)); - if (h == 0) - return 0; - - h->bucket_index = 0; - h->buckets = calloc(hash_table_total_buckets(h), sizeof(x_list *)); - - if (h->buckets == 0) { - free(h); - return 0; - } - - h->hash_key = hash; - h->compare_keys = compare; - h->destroy_key = key_destroy; - h->destroy_value = value_destroy; - - return h; -} - -X_EXTERN void -X_PFX(hash_table_free) (x_hash_table * h) { - int n, i; - x_list *node, *item; - - assert(h != NULL); - - n = hash_table_total_buckets(h); - - for (i = 0; i < n; i++) { - for (node = h->buckets[i]; node != 0; node = node->next) { - item = node->data; - hash_table_destroy_item(h, ITEM_KEY(item), ITEM_VALUE(item)); - ITEM_FREE(item); - } - X_PFX(list_free) (h->buckets[i]); - } - - free(h->buckets); - free(h); -} - -X_EXTERN unsigned int -X_PFX(hash_table_size) (x_hash_table * h) { - assert(h != NULL); - - return h->total_keys; -} - -static void -hash_table_modify(x_hash_table *h, void *k, void *v, int replace) -{ - size_t hash_value; - x_list *node, *item; - - assert(h != NULL); - - hash_value = hash_table_hash_key(h, k); - - for (node = h->buckets[hash_value % hash_table_total_buckets(h)]; - node != 0; node = node->next) { - item = node->data; - - if (hash_table_compare_keys(h, ITEM_KEY(item), k)) { - if (replace) { - hash_table_destroy_item(h, ITEM_KEY(item), - ITEM_VALUE(item)); - item->next = k; - ITEM_VALUE(item) = v; - } - else { - hash_table_destroy_item(h, k, ITEM_VALUE(item)); - ITEM_VALUE(item) = v; - } - return; - } - } - - /* Key isn't already in the table. Insert it. */ - - if (h->total_keys + 1 - > hash_table_total_buckets(h) * SPLIT_THRESHOLD_FACTOR) { - hash_table_split(h); - } - - hash_value = hash_value % hash_table_total_buckets(h); - h->buckets[hash_value] = X_PFX(list_prepend) (h->buckets[hash_value], - ITEM_NEW(k, v)); - h->total_keys++; -} - -X_EXTERN void -X_PFX(hash_table_insert) (x_hash_table * h, void *k, void *v) { - hash_table_modify(h, k, v, 0); -} - -X_EXTERN void -X_PFX(hash_table_replace) (x_hash_table * h, void *k, void *v) { - hash_table_modify(h, k, v, 1); -} - -X_EXTERN void -X_PFX(hash_table_remove) (x_hash_table * h, void *k) { - size_t hash_value; - x_list **ptr, *item; - - assert(h != NULL); - - hash_value = hash_table_hash_key(h, k); - - for (ptr = &h->buckets[hash_value % hash_table_total_buckets(h)]; - *ptr != 0; ptr = &((*ptr)->next)) { - item = (*ptr)->data; - - if (hash_table_compare_keys(h, ITEM_KEY(item), k)) { - hash_table_destroy_item(h, ITEM_KEY(item), ITEM_VALUE(item)); - ITEM_FREE(item); - item = *ptr; - *ptr = item->next; - X_PFX(list_free_1) (item); - h->total_keys--; - return; - } - } -} - -X_EXTERN void * -X_PFX(hash_table_lookup) (x_hash_table * h, void *k, void **k_ret) { - size_t hash_value; - x_list *node, *item; - - assert(h != NULL); - - hash_value = hash_table_hash_key(h, k); - - for (node = h->buckets[hash_value % hash_table_total_buckets(h)]; - node != 0; node = node->next) { - item = node->data; - - if (hash_table_compare_keys(h, ITEM_KEY(item), k)) { - if (k_ret != 0) - *k_ret = ITEM_KEY(item); - - return ITEM_VALUE(item); - } - } - - if (k_ret != 0) - *k_ret = 0; - - return 0; -} - -X_EXTERN void -X_PFX(hash_table_foreach) (x_hash_table * h, - x_hash_foreach_fun * fun, void *data) { - int i, n; - x_list *node, *item; - - assert(h != NULL); - - n = hash_table_total_buckets(h); - - for (i = 0; i < n; i++) { - for (node = h->buckets[i]; node != 0; node = node->next) { - item = node->data; - (*fun)(ITEM_KEY(item), ITEM_VALUE(item), data); - } - } -} diff --git a/hw/xquartz/xpr/x-hash.h b/hw/xquartz/xpr/x-hash.h deleted file mode 100644 index 2cdae7c5d..000000000 --- a/hw/xquartz/xpr/x-hash.h +++ /dev/null @@ -1,90 +0,0 @@ -/* x-hash.h -- basic hash table class - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifndef X_HASH_H -#define X_HASH_H 1 - -#include -#include - -typedef struct x_hash_table_struct x_hash_table; - -typedef int (x_compare_fun)(const void *a, const void *b); -typedef unsigned int (x_hash_fun)(const void *k); -typedef void (x_destroy_fun)(void *x); -typedef void (x_hash_foreach_fun)(void *k, void *v, void *data); - -/* for X_PFX and X_EXTERN */ -#include "x-list.h" - -X_EXTERN x_hash_table *X_PFX(hash_table_new) (x_hash_fun * hash, - x_compare_fun * compare, - x_destroy_fun * key_destroy, - x_destroy_fun * value_destroy); -X_EXTERN void X_PFX(hash_table_free) (x_hash_table * h); - -X_EXTERN unsigned int X_PFX(hash_table_size) (x_hash_table * h); - -X_EXTERN void X_PFX(hash_table_insert) (x_hash_table * h, void *k, void *v); -X_EXTERN void X_PFX(hash_table_replace) (x_hash_table * h, void *k, void *v); -X_EXTERN void X_PFX(hash_table_remove) (x_hash_table * h, void *k); -X_EXTERN void *X_PFX(hash_table_lookup) (x_hash_table * h, - void *k, void **k_ret); -X_EXTERN void X_PFX(hash_table_foreach) (x_hash_table * h, - x_hash_foreach_fun * fun, - void *data); - -/* Conversion between unsigned int (e.g. xp_resource_id) and void pointer */ - -/* Forward declarations */ -static __inline__ void * -X_PFX(cvt_uint_to_vptr) (unsigned int val) __attribute__((always_inline)); -static __inline__ unsigned int -X_PFX(cvt_vptr_to_uint) (void * val) __attribute__((always_inline)); - -/* Implementations */ -static __inline__ void * -X_PFX(cvt_uint_to_vptr) (unsigned int val) { - return (void *)((unsigned long)(val)); -} - -static __inline__ unsigned int -X_PFX(cvt_vptr_to_uint) (void * val) { - size_t sv = (size_t)val; - unsigned int uv = (unsigned int)sv; - - /* If this assert fails, chances are val actually is a pointer, - or there's been memory corruption */ - assert(sv == uv); - - return uv; -} - -#endif /* X_HASH_H */ diff --git a/hw/xquartz/xpr/x-hook.c b/hw/xquartz/xpr/x-hook.c deleted file mode 100644 index 3922bb86c..000000000 --- a/hw/xquartz/xpr/x-hook.c +++ /dev/null @@ -1,97 +0,0 @@ -/* x-hook.c - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "x-hook.h" -#include -#include -#include "os.h" - -#define CELL_NEW(f, d) X_PFX(list_prepend) ((x_list *)(f), (d)) -#define CELL_FREE(c) X_PFX(list_free_1) (c) -#define CELL_FUN(c) ((x_hook_function *)((c)->next)) -#define CELL_DATA(c) ((c)->data) - -X_EXTERN x_list * -X_PFX(hook_add) (x_list * lst, x_hook_function * fun, void *data) { - return X_PFX(list_prepend) (lst, CELL_NEW(fun, data)); -} - -X_EXTERN x_list * -X_PFX(hook_remove) (x_list * lst, x_hook_function * fun, void *data) { - x_list *node, *cell; - x_list *to_delete = NULL; - - for (node = lst; node != NULL; node = node->next) { - cell = node->data; - if (CELL_FUN(cell) == fun && CELL_DATA(cell) == data) - to_delete = X_PFX(list_prepend) (to_delete, cell); - } - - for (node = to_delete; node != NULL; node = node->next) { - cell = node->data; - lst = X_PFX(list_remove) (lst, cell); - CELL_FREE(cell); - } - - X_PFX(list_free) (to_delete); - return lst; -} - -X_EXTERN void -X_PFX(hook_run) (x_list * lst, void *arg) { - x_list *node; - - if (!lst) - return; - - for (node = lst; node != NULL; node = node->next) { - x_list *cell = node->data; - - x_hook_function *fun = CELL_FUN(cell); - void *data = CELL_DATA(cell); - - (*fun)(arg, data); - } -} - -X_EXTERN void -X_PFX(hook_free) (x_list * lst) { - x_list *node; - - for (node = lst; node != NULL; node = node->next) { - CELL_FREE(node->data); - } - - X_PFX(list_free) (lst); -} diff --git a/hw/xquartz/xpr/x-hook.h b/hw/xquartz/xpr/x-hook.h deleted file mode 100644 index 7ba8ac9f6..000000000 --- a/hw/xquartz/xpr/x-hook.h +++ /dev/null @@ -1,45 +0,0 @@ -/* x-hook.h -- lists of function,data pairs to call. - * - * Copyright (c) 2003-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifndef X_HOOK_H -#define X_HOOK_H 1 - -#include "x-list.h" - -typedef void x_hook_function (void *arg, void *data); - -X_EXTERN x_list *X_PFX(hook_add) (x_list * lst, x_hook_function * fun, - void *data); -X_EXTERN x_list *X_PFX(hook_remove) (x_list * lst, x_hook_function * fun, - void *data); -X_EXTERN void X_PFX(hook_run) (x_list * lst, void *arg); -X_EXTERN void X_PFX(hook_free) (x_list * lst); - -#endif /* X_HOOK_H */ diff --git a/hw/xquartz/xpr/x-list.c b/hw/xquartz/xpr/x-list.c deleted file mode 100644 index 171657686..000000000 --- a/hw/xquartz/xpr/x-list.c +++ /dev/null @@ -1,315 +0,0 @@ -/* x-list.c - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "x-list.h" -#include -#include -#include - -/* Allocate in ~4k blocks */ -#define NODES_PER_BLOCK 508 - -typedef struct x_list_block_struct x_list_block; - -struct x_list_block_struct { - x_list l[NODES_PER_BLOCK]; -}; - -static x_list *freelist; - -static pthread_mutex_t freelist_lock = PTHREAD_MUTEX_INITIALIZER; - -static inline void -list_free_1(x_list *node) -{ - node->next = freelist; - freelist = node; -} - -X_EXTERN void -X_PFX(list_free_1) (x_list * node) { - assert(node != NULL); - - pthread_mutex_lock(&freelist_lock); - - list_free_1(node); - - pthread_mutex_unlock(&freelist_lock); -} - -X_EXTERN void -X_PFX(list_free) (x_list * lst) { - x_list *next; - - pthread_mutex_lock(&freelist_lock); - - for (; lst != NULL; lst = next) { - next = lst->next; - list_free_1(lst); - } - - pthread_mutex_unlock(&freelist_lock); -} - -X_EXTERN x_list * -X_PFX(list_prepend) (x_list * lst, void *data) { - x_list *node; - - pthread_mutex_lock(&freelist_lock); - - if (freelist == NULL) { - x_list_block *b; - int i; - - b = malloc(sizeof(x_list_block)); - assert(b != NULL); - - for (i = 0; i < NODES_PER_BLOCK - 1; i++) - b->l[i].next = &(b->l[i + 1]); - b->l[i].next = NULL; - - freelist = b->l; - } - - node = freelist; - freelist = node->next; - - pthread_mutex_unlock(&freelist_lock); - - node->next = lst; - node->data = data; - - return node; -} - -X_EXTERN x_list * -X_PFX(list_append) (x_list * lst, void *data) { - x_list *head = lst; - - if (lst == NULL) - return X_PFX(list_prepend) (NULL, data); - - while (lst->next != NULL) - lst = lst->next; - - lst->next = X_PFX(list_prepend) (NULL, data); - - return head; -} - -X_EXTERN x_list * -X_PFX(list_reverse) (x_list * lst) { - x_list *head = NULL, *next; - - while (lst != NULL) - { - next = lst->next; - lst->next = head; - head = lst; - lst = next; - } - - return head; -} - -X_EXTERN x_list * -X_PFX(list_find) (x_list * lst, void *data) { - for (; lst != NULL; lst = lst->next) { - if (lst->data == data) - return lst; - } - - return NULL; -} - -X_EXTERN x_list * -X_PFX(list_nth) (x_list * lst, int n) { - while (n-- > 0 && lst != NULL) - lst = lst->next; - - return lst; -} - -X_EXTERN x_list * -X_PFX(list_pop) (x_list * lst, void **data_ret) { - void *data = NULL; - - if (lst != NULL) { - x_list *tem = lst; - data = lst->data; - lst = lst->next; - X_PFX(list_free_1) (tem); - } - - if (data_ret != NULL) - *data_ret = data; - - return lst; -} - -X_EXTERN x_list * -X_PFX(list_filter) (x_list * lst, - int (*pred)(void *item, void *data), void *data) { - x_list *ret = NULL, *node; - - for (node = lst; node != NULL; node = node->next) { - if ((*pred)(node->data, data)) - ret = X_PFX(list_prepend) (ret, node->data); - } - - return X_PFX(list_reverse) (ret); -} - -X_EXTERN x_list * -X_PFX(list_map) (x_list * lst, - void *(*fun)(void *item, void *data), void *data) { - x_list *ret = NULL, *node; - - for (node = lst; node != NULL; node = node->next) { - X_PFX(list_prepend) (ret, fun(node->data, data)); - } - - return X_PFX(list_reverse) (ret); -} - -X_EXTERN x_list * -X_PFX(list_copy) (x_list * lst) { - x_list *copy = NULL; - - for (; lst != NULL; lst = lst->next) { - copy = X_PFX(list_prepend) (copy, lst->data); - } - - return X_PFX(list_reverse) (copy); -} - -X_EXTERN x_list * -X_PFX(list_remove) (x_list * lst, void *data) { - x_list **ptr, *node; - - for (ptr = &lst; *ptr != NULL;) { - node = *ptr; - - if (node->data == data) { - *ptr = node->next; - X_PFX(list_free_1) (node); - } - else - ptr = &((*ptr)->next); - } - - return lst; -} - -X_EXTERN unsigned int -X_PFX(list_length) (x_list * lst) { - unsigned int n; - - n = 0; - for (; lst != NULL; lst = lst->next) - n++; - - return n; -} - -X_EXTERN void -X_PFX(list_foreach) (x_list * lst, - void (*fun)(void *data, void *user_data), - void *user_data) { - for (; lst != NULL; lst = lst->next) { - (*fun)(lst->data, user_data); - } -} - -static x_list * -list_sort_1(x_list *lst, int length, - int (*less)(const void *, const void *)) -{ - x_list *mid, *ptr; - x_list *out_head, *out; - int mid_point, i; - - /* This is a standard (stable) list merge sort */ - - if (length < 2) - return lst; - - /* Calculate the halfway point. Split the list into two sub-lists. */ - - mid_point = length / 2; - ptr = lst; - for (i = mid_point - 1; i > 0; i--) - ptr = ptr->next; - mid = ptr->next; - ptr->next = NULL; - - /* Sort each sub-list. */ - - lst = list_sort_1(lst, mid_point, less); - mid = list_sort_1(mid, length - mid_point, less); - - /* Then merge them back together. */ - - assert(lst != NULL); - assert(mid != NULL); - - if ((*less)(mid->data, lst->data)) - out = out_head = mid, mid = mid->next; - else - out = out_head = lst, lst = lst->next; - - while (lst != NULL && mid != NULL) - { - if ((*less)(mid->data, lst->data)) - out = out->next = mid, mid = mid->next; - else - out = out->next = lst, lst = lst->next; - } - - if (lst != NULL) - out->next = lst; - else - out->next = mid; - - return out_head; -} - -X_EXTERN x_list * -X_PFX(list_sort) (x_list * lst, int (*less)(const void *, const void *)) { - int length; - - length = X_PFX(list_length) (lst); - - return list_sort_1(lst, length, less); -} diff --git a/hw/xquartz/xpr/x-list.h b/hw/xquartz/xpr/x-list.h deleted file mode 100644 index 28385fd99..000000000 --- a/hw/xquartz/xpr/x-list.h +++ /dev/null @@ -1,78 +0,0 @@ -/* x-list.h -- simple list type - * - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifndef X_LIST_H -#define X_LIST_H 1 - -/* This is just a cons. */ - -typedef struct x_list_struct x_list; - -struct x_list_struct { - void *data; - x_list *next; -}; - -#ifndef X_PFX -#define X_PFX(x) x_ ## x -#endif - -#ifndef X_EXTERN -#define X_EXTERN __private_extern__ -#endif - -X_EXTERN void X_PFX(list_free_1) (x_list * node); -X_EXTERN x_list *X_PFX(list_prepend) (x_list * lst, void *data); - -X_EXTERN x_list *X_PFX(list_append) (x_list * lst, void *data); -X_EXTERN x_list *X_PFX(list_remove) (x_list * lst, void *data); -X_EXTERN void X_PFX(list_free) (x_list * lst); -X_EXTERN x_list *X_PFX(list_pop) (x_list * lst, void **data_ret); - -X_EXTERN x_list *X_PFX(list_copy) (x_list * lst); -X_EXTERN x_list *X_PFX(list_reverse) (x_list * lst); -X_EXTERN x_list *X_PFX(list_find) (x_list * lst, void *data); -X_EXTERN x_list *X_PFX(list_nth) (x_list * lst, int n); -X_EXTERN x_list *X_PFX(list_filter) (x_list * src, - int (*pred)(void *item, void *data), - void *data); -X_EXTERN x_list *X_PFX(list_map) (x_list * src, - void *(*fun)(void *item, void *data), - void *data); - -X_EXTERN unsigned int X_PFX(list_length) (x_list * lst); -X_EXTERN void X_PFX(list_foreach) (x_list * lst, void (*fun) - (void *data, void *user_data), - void *user_data); - -X_EXTERN x_list *X_PFX(list_sort) (x_list * lst, - int (*less)(const void *, const void *)); - -#endif /* X_LIST_H */ diff --git a/hw/xquartz/xpr/xpr.h b/hw/xquartz/xpr/xpr.h deleted file mode 100644 index fc614ebc3..000000000 --- a/hw/xquartz/xpr/xpr.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Xplugin rootless implementation - * - * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. - * Copyright (c) 2002-2012 Apple Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifndef XPR_H -#define XPR_H - -#include "windowstr.h" -#include "screenint.h" -#include - -#include "darwin.h" - -#undef DEBUG_LOG -#define DEBUG_LOG(msg, args ...) ASL_LOG(ASL_LEVEL_DEBUG, "xpr", msg, ## args) - -Bool -QuartzModeBundleInit(void); - -void -AppleDRIExtensionInit(void); -void -xprAppleWMInit(void); -Bool -xprInit(ScreenPtr pScreen); -Bool -xprIsX11Window(int windowNumber); -WindowPtr -xprGetXWindow(xp_window_id wid); - -void -xprHideWindows(Bool hide); - -Bool -QuartzInitCursor(ScreenPtr pScreen); -void -QuartzSuspendXCursor(ScreenPtr pScreen); -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. - * Floating window level is 3. The rest are filled in as appropriate. - * See CGWindowLevel.h - */ - -#include -static const int normal_window_levels[AppleWMNumWindowLevels + 1] = { - 0, 3, 4, 5, INT_MIN + 30, INT_MIN + 29, -}; -static const int rooted_window_levels[AppleWMNumWindowLevels + 1] = { - 20, 21, 22, 23, 19, 18, -}; - -#endif /* XPR_H */ diff --git a/hw/xquartz/xpr/xprAppleWM.c b/hw/xquartz/xpr/xprAppleWM.c deleted file mode 100644 index 126661766..000000000 --- a/hw/xquartz/xpr/xprAppleWM.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Xplugin rootless implementation functions for AppleWM extension - * - * Copyright (c) 2002-2012 Apple Computer, Inc. All rights reserved. - * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "xpr.h" - -#include - -#include "applewmExt.h" -#include "rootless.h" -#include "rootlessCommon.h" -#include -#include -#include "quartz.h" -#include "x-hash.h" - -static int -xprSetWindowLevel(WindowPtr pWin, int level) -{ - xp_window_id wid; - xp_window_changes wc; - RootlessWindowRec *winRec; - - // AppleWMNumWindowLevels is allowed, but is only set by the server - // for the root window. - if (level < 0 || level >= AppleWMNumWindowLevels) { - return BadValue; - } - - wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, TRUE)); - if (wid == 0) - return BadWindow; - - RootlessStopDrawing(pWin, FALSE); - winRec = WINREC(pWin); - - if (!winRec) - return BadWindow; - - if (XQuartzIsRootless) - wc.window_level = normal_window_levels[level]; - else if (XQuartzShieldingWindowLevel) - wc.window_level = XQuartzShieldingWindowLevel + 1; - else - wc.window_level = rooted_window_levels[level]; - - if (xp_configure_window(wid, XP_WINDOW_LEVEL, &wc) != Success) { - return BadValue; - } - - winRec->level = level; - - return Success; -} - -static int -xprAttachTransient(WindowPtr pWinChild, WindowPtr pWinParent) -{ - xp_window_id child_wid, parent_wid; - xp_window_changes wc; - - child_wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWinChild, TRUE)); - if (child_wid == 0) - return BadWindow; - - if (pWinParent) { - parent_wid = - x_cvt_vptr_to_uint(RootlessFrameForWindow(pWinParent, TRUE)); - if (parent_wid == 0) - return BadWindow; - } - else { - parent_wid = 0; - } - - wc.transient_for = parent_wid; - - RootlessStopDrawing(pWinChild, FALSE); - - if (xp_configure_window(child_wid, XP_ATTACH_TRANSIENT, - &wc) != Success) { - return BadValue; - } - - return Success; -} - -static int -xprFrameDraw(WindowPtr pWin, - xp_frame_class class, - xp_frame_attr attr, - const BoxRec *outer, - const BoxRec *inner, - unsigned int title_len, - const unsigned char *title_bytes) -{ - xp_window_id wid; - - wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, FALSE)); - if (wid == 0) - return BadWindow; - - if (xp_frame_draw(wid, class, attr, outer, inner, - title_len, title_bytes) != Success) { - return BadValue; - } - - return Success; -} - -static AppleWMProcsRec xprAppleWMProcs = { - xp_disable_update, - xp_reenable_update, - xprSetWindowLevel, - xp_frame_get_rect, - xp_frame_hit_test, - xprFrameDraw, - xp_set_dock_proxy, - xprAttachTransient -}; - -void -xprAppleWMInit(void) -{ - AppleWMExtensionInit(&xprAppleWMProcs); -} diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c deleted file mode 100644 index ff6cf4dd0..000000000 --- a/hw/xquartz/xpr/xprCursor.c +++ /dev/null @@ -1,408 +0,0 @@ -/************************************************************** - * - * Xplugin cursor support - * - * Copyright (c) 2001 Torrey T. Lyons and Greg Parker. - * Copyright (c) 2002 Apple Computer, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#include "sanitizedCarbon.h" - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "quartz.h" -#include "xpr.h" -#include "darwinEvents.h" -#include - -#include "mi.h" -#include "scrnintstr.h" -#include "cursorstr.h" -#include "mipointrst.h" -#include "windowstr.h" -#include "globals.h" -#include "servermd.h" -#include "dixevents.h" -#include "x-hash.h" - -typedef struct { - int cursorVisible; - QueryBestSizeProcPtr QueryBestSize; - miPointerSpriteFuncPtr spriteFuncs; -} QuartzCursorScreenRec, *QuartzCursorScreenPtr; - -static DevPrivateKeyRec darwinCursorScreenKeyRec; -#define darwinCursorScreenKey (&darwinCursorScreenKeyRec) - -#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \ - dixLookupPrivate(&pScreen->devPrivates, \ - darwinCursorScreenKey)) - -static Bool -load_cursor(CursorPtr src, int screen) -{ - uint32_t *data; - Bool free_data = FALSE; - uint32_t rowbytes; - int width, height; - int hot_x, hot_y; - - uint32_t fg_color, bg_color; - uint8_t *srow, *sptr; - uint8_t *mrow, *mptr; - uint32_t *drow, *dptr; - unsigned xcount, ycount; - - xp_error err; - - width = src->bits->width; - height = src->bits->height; - hot_x = src->bits->xhot; - hot_y = src->bits->yhot; - - if (src->bits->argb != NULL) { -#if BITMAP_BIT_ORDER == MSBFirst - rowbytes = src->bits->width * sizeof(CARD32); - data = (uint32_t *)src->bits->argb; -#else - const uint32_t *be_data = (uint32_t *)src->bits->argb; - unsigned i; - rowbytes = src->bits->width * sizeof(CARD32); - data = malloc(rowbytes * src->bits->height); - free_data = TRUE; - if (!data) { - FatalError("Failed to allocate memory in %s\n", __func__); - } - for (i = 0; i < (src->bits->width * src->bits->height); i++) - data[i] = ntohl(be_data[i]); -#endif - } - else - { - fg_color = 0xFF00 | (src->foreRed >> 8); - fg_color <<= 16; - fg_color |= src->foreGreen & 0xFF00; - fg_color |= src->foreBlue >> 8; - - bg_color = 0xFF00 | (src->backRed >> 8); - bg_color <<= 16; - bg_color |= src->backGreen & 0xFF00; - bg_color |= src->backBlue >> 8; - - fg_color = htonl(fg_color); - bg_color = htonl(bg_color); - - /* round up to 8 pixel boundary so we can convert whole bytes */ - rowbytes = ((src->bits->width * 4) + 31) & ~31; - data = malloc(rowbytes * src->bits->height); - free_data = TRUE; - if (!data) { - FatalError("Failed to allocate memory in %s\n", __func__); - } - - if (!src->bits->emptyMask) { - ycount = src->bits->height; - srow = src->bits->source; - mrow = src->bits->mask; - drow = data; - - while (ycount-- > 0) - { - xcount = bits_to_bytes(src->bits->width); - sptr = srow; - mptr = mrow; - dptr = drow; - - while (xcount-- > 0) - { - uint8_t s, m; - int i; - - s = *sptr++; - m = *mptr++; - for (i = 0; i < 8; i++) { -#if BITMAP_BIT_ORDER == MSBFirst - if (m & 128) - *dptr++ = (s & 128) ? fg_color : bg_color; - else - *dptr++ = 0; - s <<= 1; - m <<= 1; -#else - if (m & 1) - *dptr++ = (s & 1) ? fg_color : bg_color; - else - *dptr++ = 0; - s >>= 1; - m >>= 1; -#endif - } - } - - srow += BitmapBytePad(src->bits->width); - mrow += BitmapBytePad(src->bits->width); - drow = (uint32_t *)((char *)drow + rowbytes); - } - } - else { - memset(data, 0, src->bits->height * rowbytes); - } - } - - err = xp_set_cursor(width, height, hot_x, hot_y, data, rowbytes); - if (free_data) - free(data); - return err == Success; -} - -/* - =========================================================================== - - Pointer sprite functions - - =========================================================================== - */ - -/* - * QuartzRealizeCursor - * Convert the X cursor representation to native format if possible. - */ -static Bool -QuartzRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) -{ - if (pCursor == NULL || pCursor->bits == NULL) - return FALSE; - - /* FIXME: cache ARGB8888 representation? */ - - return TRUE; -} - -/* - * QuartzUnrealizeCursor - * Free the storage space associated with a realized cursor. - */ -static Bool -QuartzUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -/* - * QuartzSetCursor - * Set the cursor sprite and position. - */ -static void -QuartzSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, - int x, - int y) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - if (!XQuartzServerVisible) - return; - - if (pCursor == NULL) { - if (ScreenPriv->cursorVisible) { - xp_hide_cursor(); - ScreenPriv->cursorVisible = FALSE; - } - } - else { - load_cursor(pCursor, pScreen->myNum); - - if (!ScreenPriv->cursorVisible) { - xp_show_cursor(); - ScreenPriv->cursorVisible = TRUE; - } - } -} - -/* - * QuartzMoveCursor - * Move the cursor. This is a noop for us. - */ -static void -QuartzMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) -{} - -/* - =========================================================================== - - Pointer screen functions - - =========================================================================== - */ - -/* - * QuartzCursorOffScreen - */ -static Bool -QuartzCursorOffScreen(ScreenPtr *pScreen, int *x, int *y) -{ - return FALSE; -} - -/* - * QuartzCrossScreen - */ -static void -QuartzCrossScreen(ScreenPtr pScreen, Bool entering) -{ - return; -} - -/* - * QuartzWarpCursor - * Change the cursor position without generating an event or motion history. - * The input coordinates (x,y) are in pScreen-local X11 coordinates. - * - */ -static void -QuartzWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) -{ - if (XQuartzServerVisible) { - int sx, sy; - - sx = pScreen->x + darwinMainScreenX; - sy = pScreen->y + darwinMainScreenY; - - CGWarpMouseCursorPosition(CGPointMake(sx + x, sy + y)); - } - - miPointerWarpCursor(pDev, pScreen, x, y); - miPointerUpdateSprite(pDev); -} - -static miPointerScreenFuncRec quartzScreenFuncsRec = { - QuartzCursorOffScreen, - QuartzCrossScreen, - QuartzWarpCursor, -}; - -/* - =========================================================================== - - Other screen functions - - =========================================================================== - */ - -/* - * QuartzCursorQueryBestSize - * Handle queries for best cursor size - */ -static void -QuartzCursorQueryBestSize(int class, unsigned short *width, - unsigned short *height, ScreenPtr pScreen) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - if (class == CursorShape) { - /* FIXME: query window server? */ - *width = 32; - *height = 32; - } - else { - (*ScreenPriv->QueryBestSize)(class, width, height, pScreen); - } -} - -/* - * QuartzInitCursor - * Initialize cursor support - */ -Bool -QuartzInitCursor(ScreenPtr pScreen) -{ - QuartzCursorScreenPtr ScreenPriv; - miPointerScreenPtr PointPriv; - - /* initialize software cursor handling (always needed as backup) */ - if (!miDCInitialize(pScreen, &quartzScreenFuncsRec)) - return FALSE; - - if (!dixRegisterPrivateKey(&darwinCursorScreenKeyRec, PRIVATE_SCREEN, 0)) - return FALSE; - - ScreenPriv = calloc(1, sizeof(QuartzCursorScreenRec)); - if (ScreenPriv == NULL) - return FALSE; - - /* CURSOR_PRIV(pScreen) = ScreenPriv; */ - dixSetPrivate(&pScreen->devPrivates, darwinCursorScreenKey, ScreenPriv); - - /* override some screen procedures */ - ScreenPriv->QueryBestSize = pScreen->QueryBestSize; - pScreen->QueryBestSize = QuartzCursorQueryBestSize; - - PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); - - ScreenPriv->spriteFuncs = PointPriv->spriteFuncs; - - PointPriv->spriteFuncs->RealizeCursor = QuartzRealizeCursor; - PointPriv->spriteFuncs->UnrealizeCursor = QuartzUnrealizeCursor; - PointPriv->spriteFuncs->SetCursor = QuartzSetCursor; - PointPriv->spriteFuncs->MoveCursor = QuartzMoveCursor; - - ScreenPriv->cursorVisible = TRUE; - return TRUE; -} - -/* - * QuartzSuspendXCursor - * X server is hiding. Restore the Aqua cursor. - */ -void -QuartzSuspendXCursor(ScreenPtr pScreen) -{ - xp_show_cursor(); -} - -/* - * QuartzResumeXCursor - * X server is showing. Restore the X cursor. - */ -void -QuartzResumeXCursor(ScreenPtr pScreen) -{ - WindowPtr pWin; - CursorPtr pCursor; - - /* TODO: Tablet? */ - - pWin = GetSpriteWindow(darwinPointer); - if (pWin->drawable.pScreen != pScreen) - return; - - pCursor = GetSpriteCursor(darwinPointer); - if (pCursor == NULL) - return; - - QuartzSetCursor(darwinPointer, pScreen, pCursor, /* x */ 0, /* y */ 0); -} diff --git a/hw/xquartz/xpr/xprEvent.c b/hw/xquartz/xpr/xprEvent.c deleted file mode 100644 index eb321a52f..000000000 --- a/hw/xquartz/xpr/xprEvent.c +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (c) 2008-2012 Apple Inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "xpr.h" - -#include -#include -#include -#include "misc.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "inputstr.h" -#include "eventstr.h" -#include "mi.h" -#include "scrnintstr.h" -#include "mipointer.h" - -#include "quartz.h" -#include "quartzKeyboard.h" -#include "darwinEvents.h" - -#include -#include -#include - -#include - -#include "rootlessWindow.h" -#include "xprEvent.h" - -Bool -QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev) -{ - 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"); - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - xp_window_bring_all_to_front(); - }); - - return TRUE; - - default: - return FALSE; - } -} diff --git a/hw/xquartz/xpr/xprEvent.h b/hw/xquartz/xpr/xprEvent.h deleted file mode 100644 index 4f9cc6118..000000000 --- a/hw/xquartz/xpr/xprEvent.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2008-2012 Apple Inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#ifndef __XPR_EVENT_H__ -#define __XPR_EVENT_H__ - -Bool -QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev); - -#endif diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c deleted file mode 100644 index 57d16d42f..000000000 --- a/hw/xquartz/xpr/xprFrame.c +++ /dev/null @@ -1,599 +0,0 @@ -/* - * Xplugin rootless implementation frame functions - * - * Copyright (c) 2002-2012 Apple Computer, Inc. All rights reserved. - * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "xpr.h" -#include "rootlessCommon.h" -#include -#include "x-hash.h" -#include "applewmExt.h" - -#include "propertyst.h" -#include "dix.h" -#include -#include "windowstr.h" -#include "quartz.h" - -#include - -#define DEFINE_ATOM_HELPER(func, atom_name) \ - static Atom func(void) { \ - static int generation; \ - static Atom atom; \ - if (generation != serverGeneration) { \ - generation = serverGeneration; \ - atom = MakeAtom(atom_name, strlen(atom_name), TRUE); \ - } \ - return atom; \ - } - -DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID") - -/* Maps xp_window_id -> RootlessWindowRec */ -static x_hash_table * window_hash; - -/* Need to guard window_hash since xprIsX11Window can be called from any thread. */ -static dispatch_queue_t window_hash_serial_q; - -/* Prototypes for static functions */ -static Bool -xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, int newX, - int newY, - RegionPtr pShape); -static void -xprDestroyFrame(RootlessFrameID wid); -static void -xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY); -static void -xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY, - unsigned int newW, unsigned int newH, - unsigned int gravity); -static void -xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid); -static void -xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape); -static void -xprUnmapFrame(RootlessFrameID wid); -static void -xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow); -static void -xprStopDrawing(RootlessFrameID wid, Bool flush); -static void -xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage); -static void -xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects, - int shift_x, - int shift_y); -static void -xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin); -static Bool -xprDoReorderWindow(RootlessWindowPtr pFrame); -static void -xprHideWindow(RootlessFrameID wid); -static void -xprUpdateColormap(RootlessFrameID wid, ScreenPtr pScreen); -static void -xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects, - int dx, - int dy); - -static inline xp_error -xprConfigureWindow(xp_window_id id, unsigned int mask, - const xp_window_changes *values) -{ - return xp_configure_window(id, mask, values); -} - -static void -xprSetNativeProperty(RootlessWindowPtr pFrame) -{ - xp_error err; - unsigned int native_id; - long data; - - err = xp_get_native_window(x_cvt_vptr_to_uint(pFrame->wid), &native_id); - if (err == Success) { - /* FIXME: move this to AppleWM extension */ - - data = native_id; - dixChangeWindowProperty(serverClient, pFrame->win, - xa_native_window_id(), - XA_INTEGER, 32, PropModeReplace, 1, &data, - TRUE); - } -} - -static xp_error -xprColormapCallback(void *data, int first_color, int n_colors, - uint32_t *colors) -{ - return (RootlessResolveColormap(data, first_color, n_colors, - colors) ? XP_Success : XP_BadMatch); -} - -/* - * Create and display a new frame. - */ -static Bool -xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, - int newX, int newY, RegionPtr pShape) -{ - WindowPtr pWin = pFrame->win; - xp_window_changes wc; - unsigned int mask = 0; - xp_error err; - - wc.x = newX; - wc.y = newY; - wc.width = pFrame->width; - wc.height = pFrame->height; - wc.bit_gravity = XP_GRAVITY_NONE; - mask |= XP_BOUNDS; - - if (pWin->drawable.depth == 8) { - wc.depth = XP_DEPTH_INDEX8; - wc.colormap = xprColormapCallback; - wc.colormap_data = pScreen; - mask |= XP_COLORMAP; - } - else if (pWin->drawable.depth == 15) - wc.depth = XP_DEPTH_RGB555; - else if (pWin->drawable.depth == 24) - wc.depth = XP_DEPTH_ARGB8888; - else - wc.depth = XP_DEPTH_NIL; - mask |= XP_DEPTH; - - if (pShape != NULL) { - wc.shape_nrects = RegionNumRects(pShape); - wc.shape_rects = RegionRects(pShape); - wc.shape_tx = wc.shape_ty = 0; - mask |= XP_SHAPE; - } - - pFrame->level = - !IsRoot(pWin) ? AppleWMWindowLevelNormal : AppleWMNumWindowLevels; - - if (XQuartzIsRootless) - wc.window_level = normal_window_levels[pFrame->level]; - else if (XQuartzShieldingWindowLevel) - wc.window_level = XQuartzShieldingWindowLevel + 1; - else - wc.window_level = rooted_window_levels[pFrame->level]; - mask |= XP_WINDOW_LEVEL; - - err = xp_create_window(mask, &wc, (xp_window_id *)&pFrame->wid); - - if (err != Success) { - return FALSE; - } - - dispatch_async(window_hash_serial_q, ^ { - x_hash_table_insert(window_hash, pFrame->wid, pFrame); - }); - - xprSetNativeProperty(pFrame); - - return TRUE; -} - -/* - * Destroy a frame. - */ -static void -xprDestroyFrame(RootlessFrameID wid) -{ - xp_error err; - - dispatch_async(window_hash_serial_q, ^ { - x_hash_table_remove(window_hash, wid); - }); - - err = xp_destroy_window(x_cvt_vptr_to_uint(wid)); - if (err != Success) - FatalError("Could not destroy window %d (%d).", - (int)x_cvt_vptr_to_uint( - wid), (int)err); -} - -/* - * Move a frame on screen. - */ -static void -xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY) -{ - xp_window_changes wc; - - wc.x = newX; - wc.y = newY; - // ErrorF("xprMoveFrame(%d, %p, %d, %d)\n", wid, pScreen, newX, newY); - xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_ORIGIN, &wc); -} - -/* - * Resize and move a frame. - */ -static void -xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen, - int newX, int newY, unsigned int newW, unsigned int newH, - unsigned int gravity) -{ - xp_window_changes wc; - - wc.x = newX; - wc.y = newY; - wc.width = newW; - wc.height = newH; - wc.bit_gravity = gravity; - - /* It's unlikely that being async will save us anything here. - But it can't hurt. */ - - xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_BOUNDS, &wc); -} - -/* - * Change frame stacking. - */ -static void -xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) -{ - xp_window_changes wc; - unsigned int mask = XP_STACKING; - __block - RootlessWindowRec * winRec; - - /* Stack frame below nextWid it if it exists, or raise - frame above everything otherwise. */ - - if (nextWid == NULL) { - wc.stack_mode = XP_MAPPED_ABOVE; - wc.sibling = 0; - } - else { - wc.stack_mode = XP_MAPPED_BELOW; - wc.sibling = x_cvt_vptr_to_uint(nextWid); - } - - dispatch_sync(window_hash_serial_q, ^ { - winRec = x_hash_table_lookup(window_hash, wid, NULL); - }); - - if (winRec) { - if (XQuartzIsRootless) - wc.window_level = normal_window_levels[winRec->level]; - else if (XQuartzShieldingWindowLevel) - wc.window_level = XQuartzShieldingWindowLevel + 1; - else - wc.window_level = rooted_window_levels[winRec->level]; - mask |= XP_WINDOW_LEVEL; - } - - xprConfigureWindow(x_cvt_vptr_to_uint(wid), mask, &wc); -} - -/* - * Change the frame's shape. - */ -static void -xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape) -{ - xp_window_changes wc; - - if (pShape != NULL) { - wc.shape_nrects = RegionNumRects(pShape); - wc.shape_rects = RegionRects(pShape); - } - else { - wc.shape_nrects = -1; - wc.shape_rects = NULL; - } - - wc.shape_tx = wc.shape_ty = 0; - - xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_SHAPE, &wc); -} - -/* - * Unmap a frame. - */ -static void -xprUnmapFrame(RootlessFrameID wid) -{ - xp_window_changes wc; - - wc.stack_mode = XP_UNMAPPED; - wc.sibling = 0; - - xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_STACKING, &wc); -} - -/* - * Start drawing to a frame. - * Prepare for direct access to its backing buffer. - */ -static void -xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) -{ - void *data[2]; - unsigned int rowbytes[2]; - xp_error err; - -#ifdef DEBUG_XP_LOCK_WINDOW - ErrorF("=== LOCK %d ===\n", (int)x_cvt_vptr_to_uint(wid)); - xorg_backtrace(); -#endif - - err = xp_lock_window(x_cvt_vptr_to_uint( - wid), NULL, NULL, data, rowbytes, NULL); - if (err != Success) - FatalError("Could not lock window %d for drawing (%d).", - (int)x_cvt_vptr_to_uint( - wid), (int)err); - -#ifdef DEBUG_XP_LOCK_WINDOW - ErrorF(" bits: %p\n", *data); -#endif - - *pixelData = data[0]; - *bytesPerRow = rowbytes[0]; -} - -/* - * Stop drawing to a frame. - */ -static void -xprStopDrawing(RootlessFrameID wid, Bool flush) -{ - xp_error err; - -#ifdef DEBUG_XP_LOCK_WINDOW - ErrorF("=== UNLOCK %d ===\n", (int)x_cvt_vptr_to_uint(wid)); - xorg_backtrace(); -#endif - - err = xp_unlock_window(x_cvt_vptr_to_uint(wid), flush); - /* This should be a FatalError, but we started tripping over it. Make it a - * FatalError after http://xquartz.macosforge.org/trac/ticket/482 is fixed. - */ - if (err != Success) - ErrorF("Could not unlock window %d after drawing (%d).", - (int)x_cvt_vptr_to_uint( - wid), (int)err); -} - -/* - * Flush drawing updates to the screen. - */ -static void -xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage) -{ - xp_flush_window(x_cvt_vptr_to_uint(wid)); -} - -/* - * Mark damaged rectangles as requiring redisplay to screen. - */ -static void -xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects, - int shift_x, int shift_y) -{ - xp_mark_window(x_cvt_vptr_to_uint(wid), nrects, rects, shift_x, shift_y); -} - -/* - * Called after the window associated with a frame has been switched - * to a new top-level parent. - */ -static void -xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin) -{ - DeleteProperty(serverClient, oldWin, xa_native_window_id()); - - xprSetNativeProperty(pFrame); -} - -/* - * Called to check if the frame should be reordered when it is restacked. - */ -static Bool -xprDoReorderWindow(RootlessWindowPtr pFrame) -{ - WindowPtr pWin = pFrame->win; - - return AppleWMDoReorderWindow(pWin); -} - -/* - * Copy area in frame to another part of frame. - * Used to accelerate scrolling. - */ -static void -xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects, - int dx, int dy) -{ - xp_copy_window(x_cvt_vptr_to_uint(wid), x_cvt_vptr_to_uint(wid), - dstNrects, dstRects, dx, dy); -} - -static RootlessFrameProcsRec xprRootlessProcs = { - xprCreateFrame, - xprDestroyFrame, - xprMoveFrame, - xprResizeFrame, - xprRestackFrame, - xprReshapeFrame, - xprUnmapFrame, - xprStartDrawing, - xprStopDrawing, - xprUpdateRegion, - xprDamageRects, - xprSwitchWindow, - xprDoReorderWindow, - xprHideWindow, - xprUpdateColormap, - xp_copy_bytes, - xprCopyWindow -}; - -/* - * Initialize XPR implementation - */ -Bool -xprInit(ScreenPtr pScreen) -{ - RootlessInit(pScreen, &xprRootlessProcs); - - rootless_CopyBytes_threshold = xp_copy_bytes_threshold; - rootless_CopyWindow_threshold = xp_scroll_area_threshold; - - assert((window_hash = x_hash_table_new(NULL, NULL, NULL, NULL))); - assert((window_hash_serial_q = - dispatch_queue_create(BUNDLE_ID_PREFIX ".X11.xpr_window_hash", - NULL))); - - return TRUE; -} - -/* - * Given the id of a physical window, try to find the top-level (or root) - * X window that it represents. - */ -WindowPtr -xprGetXWindow(xp_window_id wid) -{ - RootlessWindowRec *winRec __block; - dispatch_sync(window_hash_serial_q, ^ { - winRec = - x_hash_table_lookup(window_hash, - x_cvt_uint_to_vptr(wid), NULL); - }); - - return winRec != NULL ? winRec->win : NULL; -} - -/* - * The windowNumber is an AppKit window number. Returns TRUE if xpr is - * displaying a window with that number. - */ -Bool -xprIsX11Window(int windowNumber) -{ - Bool ret; - xp_window_id wid; - - if (xp_lookup_native_window(windowNumber, &wid)) - ret = xprGetXWindow(wid) != NULL; - else - ret = FALSE; - - return ret; -} - -/* - * xprHideWindows - * Hide or unhide all top level windows. This is called for application hide/ - * unhide events if the window manager is not Apple-WM aware. Xplugin windows - * do not hide or unhide themselves. - */ -void -xprHideWindows(Bool hide) -{ - int screen; - WindowPtr pRoot, pWin; - - for (screen = 0; screen < screenInfo.numScreens; screen++) { - RootlessFrameID prevWid = NULL; - pRoot = screenInfo.screens[screen]->root; - - for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) { - RootlessWindowRec *winRec = WINREC(pWin); - - if (winRec != NULL) { - if (hide) { - xprUnmapFrame(winRec->wid); - } - else { - BoxRec box; - - xprRestackFrame(winRec->wid, prevWid); - prevWid = winRec->wid; - - box.x1 = 0; - box.y1 = 0; - box.x2 = winRec->width; - box.y2 = winRec->height; - - xprDamageRects(winRec->wid, 1, &box, 0, 0); - RootlessQueueRedisplay(screenInfo.screens[screen]); - } - } - } - } -} - -// XXX: identical to x_cvt_vptr_to_uint ? -#define MAKE_WINDOW_ID(x) ((xp_window_id)((size_t)(x))) - -Bool no_configure_window; - -static inline int -configure_window(xp_window_id id, unsigned int mask, - const xp_window_changes *values) -{ - if (!no_configure_window) - return xp_configure_window(id, mask, values); - else - return XP_Success; -} - -static -void -xprUpdateColormap(RootlessFrameID wid, ScreenPtr pScreen) -{ - /* This is how we tell xp that the colormap may have changed. */ - xp_window_changes wc; - wc.colormap = xprColormapCallback; - wc.colormap_data = pScreen; - - configure_window(MAKE_WINDOW_ID(wid), XP_COLORMAP, &wc); -} - -static -void -xprHideWindow(RootlessFrameID wid) -{ - xp_window_changes wc; - wc.stack_mode = XP_UNMAPPED; - wc.sibling = 0; - configure_window(MAKE_WINDOW_ID(wid), XP_STACKING, &wc); -} diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c deleted file mode 100644 index 562d6a0c3..000000000 --- a/hw/xquartz/xpr/xprScreen.c +++ /dev/null @@ -1,518 +0,0 @@ -/* - * Xplugin rootless implementation screen functions - * - * Copyright (c) 2002-2012 Apple Computer, Inc. All Rights Reserved. - * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#include "sanitizedCarbon.h" - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "inputstr.h" -#include "quartz.h" -#include "quartzRandR.h" -#include "xpr.h" -#include "xprEvent.h" -#include "pseudoramiX.h" -#include "darwinEvents.h" -#include "rootless.h" -#include "dri.h" -#include "globals.h" -#include -#include "applewmExt.h" -#include "micmap.h" - -#include "rootlessCommon.h" - -#ifdef DAMAGE -#include "damage.h" -#endif - -#include "nonsdk_extinit.h" - -/* 10.4's deferred update makes X slower.. have to live with the tearing - * for now.. */ -#define XP_NO_DEFERRED_UPDATES 8 - -// Name of GLX bundle for native OpenGL -static const char *xprOpenGLBundle = "glxCGL.bundle"; - -/* - * eventHandler - * Callback handler for Xplugin events. - */ -static void -eventHandler(unsigned int type, const void *arg, - unsigned int arg_size, void *data) -{ - - switch (type) { - case XP_EVENT_DISPLAY_CHANGED: - DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n"); - DarwinSendDDXEvent(kXquartzDisplayChanged, 0); - break; - - case XP_EVENT_WINDOW_STATE_CHANGED: - if (arg_size >= sizeof(xp_window_state_event)) { - const xp_window_state_event *ws_arg = arg; - - DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", - ws_arg->id, - ws_arg->state); - DarwinSendDDXEvent(kXquartzWindowState, 2, - ws_arg->id, ws_arg->state); - } - else { - DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n"); - } - break; - - case XP_EVENT_WINDOW_MOVED: - DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n"); - if (arg_size == sizeof(xp_window_id)) { - xp_window_id id = *(xp_window_id *)arg; - DarwinSendDDXEvent(kXquartzWindowMoved, 1, id); - } - break; - - case XP_EVENT_SURFACE_DESTROYED: - DEBUG_LOG("XP_EVENT_SURFACE_DESTROYED\n"); - - case XP_EVENT_SURFACE_CHANGED: - DEBUG_LOG("XP_EVENT_SURFACE_CHANGED\n"); - if (arg_size == sizeof(xp_surface_id)) { - int kind; - - if (type == XP_EVENT_SURFACE_DESTROYED) - kind = AppleDRISurfaceNotifyDestroyed; - else - kind = AppleDRISurfaceNotifyChanged; - - DRISurfaceNotify(*(xp_surface_id *)arg, kind); - } - break; - -#ifdef XP_EVENT_SPACE_CHANGED - case XP_EVENT_SPACE_CHANGED: - DEBUG_LOG("XP_EVENT_SPACE_CHANGED\n"); - if (arg_size == sizeof(uint32_t)) { - uint32_t space_id = *(uint32_t *)arg; - DarwinSendDDXEvent(kXquartzSpaceChanged, 1, space_id); - } - break; - -#endif - default: - ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type); - } -} - -/* - * displayAtIndex - * Return the display ID for a particular display index. - */ -static CGDirectDisplayID -displayAtIndex(int index) -{ - CGError err; - CGDisplayCount cnt; - CGDirectDisplayID dpy[index + 1]; - - err = CGGetActiveDisplayList(index + 1, dpy, &cnt); - if (err == kCGErrorSuccess && cnt == index + 1) - return dpy[index]; - else - return kCGNullDirectDisplay; -} - -/* - * displayScreenBounds - * Return the bounds of a particular display. - */ -static CGRect -displayScreenBounds(CGDirectDisplayID id) -{ - CGRect frame; - - frame = CGDisplayBounds(id); - - DEBUG_LOG(" %dx%d @ (%d,%d).\n", - (int)frame.size.width, (int)frame.size.height, - (int)frame.origin.x, (int)frame.origin.y); - - Boolean spacePerDisplay = false; - Boolean ok; - (void)CFPreferencesAppSynchronize(CFSTR("com.apple.spaces")); - spacePerDisplay = ! CFPreferencesGetAppBooleanValue(CFSTR("spans-displays"), - CFSTR("com.apple.spaces"), - &ok); - if (!ok) - spacePerDisplay = true; - - /* Remove menubar to help standard X11 window managers. - * On Mavericks and later, the menu bar is on all displays when spans-displays is false or unset. - */ - if (XQuartzIsRootless && - (spacePerDisplay || (frame.origin.x == 0 && frame.origin.y == 0))) { - frame.origin.y += aquaMenuBarHeight; - frame.size.height -= aquaMenuBarHeight; - } - - DEBUG_LOG(" %dx%d @ (%d,%d).\n", - (int)frame.size.width, (int)frame.size.height, - (int)frame.origin.x, (int)frame.origin.y); - - return frame; -} - -/* - * xprAddPseudoramiXScreens - * Add a single virtual screen encompassing all the physical screens - * with PseudoramiX. - */ -static void -xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, - ScreenPtr pScreen) -{ - CGDisplayCount i, displayCount; - CGDirectDisplayID *displayList = NULL; - CGRect unionRect = CGRectNull, frame; - - // Find all the CoreGraphics displays - CGGetActiveDisplayList(0, NULL, &displayCount); - DEBUG_LOG("displayCount: %d\n", (int)displayCount); - - if (!displayCount) { - ErrorF( - "CoreGraphics has reported no connected displays. Creating a stub 800x600 display.\n"); - *x = *y = 0; - *width = 800; - *height = 600; - PseudoramiXAddScreen(*x, *y, *width, *height); - QuartzCopyDisplayIDs(pScreen, 0, NULL); - return; - } - - /* If the displays are captured, we are in a RandR game mode - * on the primary display, so we only want to include the first - * display. The others are covered by the shield window. - */ - if (CGDisplayIsCaptured(kCGDirectMainDisplay)) - displayCount = 1; - - displayList = malloc(displayCount * sizeof(CGDirectDisplayID)); - if (!displayList) - FatalError("Unable to allocate memory for list of displays.\n"); - CGGetActiveDisplayList(displayCount, displayList, &displayCount); - QuartzCopyDisplayIDs(pScreen, displayCount, displayList); - - /* Get the union of all screens */ - for (i = 0; i < displayCount; i++) { - CGDirectDisplayID dpy = displayList[i]; - frame = displayScreenBounds(dpy); - unionRect = CGRectUnion(unionRect, frame); - } - - /* Use unionRect as the screen size for the X server. */ - *x = unionRect.origin.x; - *y = unionRect.origin.y; - *width = unionRect.size.width; - *height = unionRect.size.height; - - DEBUG_LOG(" screen union origin: (%d,%d) size: (%d,%d).\n", - *x, *y, *width, *height); - - /* Tell PseudoramiX about the real screens. */ - for (i = 0; i < displayCount; i++) { - CGDirectDisplayID dpy = displayList[i]; - - frame = displayScreenBounds(dpy); - frame.origin.x -= unionRect.origin.x; - frame.origin.y -= unionRect.origin.y; - - DEBUG_LOG(" placed at X11 coordinate (%d,%d).\n", - (int)frame.origin.x, (int)frame.origin.y); - - PseudoramiXAddScreen(frame.origin.x, frame.origin.y, - frame.size.width, frame.size.height); - } - - free(displayList); -} - -/* - * xprDisplayInit - * Find number of CoreGraphics displays and initialize Xplugin. - */ -static void -xprDisplayInit(void) -{ - CGDisplayCount displayCount; - - TRACE(); - - CGGetActiveDisplayList(0, NULL, &displayCount); - - /* With PseudoramiX, the X server only sees one screen; only PseudoramiX - itself knows about all of the screens. */ - - if (noPseudoramiXExtension) { - darwinScreensFound = displayCount; - } else { - PseudoramiXExtensionInit(); - darwinScreensFound = 1; - } - - if (xp_init(XP_BACKGROUND_EVENTS | XP_NO_DEFERRED_UPDATES) != Success) - FatalError("Could not initialize the Xplugin library."); - - xp_select_events(XP_EVENT_DISPLAY_CHANGED - | XP_EVENT_WINDOW_STATE_CHANGED - | XP_EVENT_WINDOW_MOVED -#ifdef XP_EVENT_SPACE_CHANGED - | XP_EVENT_SPACE_CHANGED -#endif - | XP_EVENT_SURFACE_CHANGED - | XP_EVENT_SURFACE_DESTROYED, - eventHandler, NULL); - - AppleDRIExtensionInit(); - xprAppleWMInit(); - - XQuartzIsRootless = XQuartzRootlessDefault; - if (!XQuartzIsRootless) - RootlessHideAllWindows(); -} - -/* - * xprAddScreen - * Init the framebuffer and record pixmap parameters for the screen. - */ -static Bool -xprAddScreen(int index, ScreenPtr pScreen) -{ - DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen); - int depth = darwinDesiredDepth; - - DEBUG_LOG("index=%d depth=%d\n", index, depth); - - if (depth == -1) { - CGDisplayModeRef modeRef; - CFStringRef encStrRef; - - modeRef = CGDisplayCopyDisplayMode(kCGDirectMainDisplay); - if (!modeRef) - goto have_depth; - - encStrRef = CGDisplayModeCopyPixelEncoding(modeRef); - CFRelease(modeRef); - if (!encStrRef) - goto have_depth; - - if (CFStringCompare(encStrRef, CFSTR(IO32BitDirectPixels), - kCFCompareCaseInsensitive) == - kCFCompareEqualTo) { - depth = 24; - } - else if (CFStringCompare(encStrRef, CFSTR(IO16BitDirectPixels), - kCFCompareCaseInsensitive) == - kCFCompareEqualTo) { - depth = 15; - } - else if (CFStringCompare(encStrRef, CFSTR(IO8BitIndexedPixels), - kCFCompareCaseInsensitive) == - kCFCompareEqualTo) { - depth = 8; - } - - CFRelease(encStrRef); - } - -have_depth: - switch (depth) { - case 8: // pseudo-working - dfb->visuals = PseudoColorMask; - dfb->preferredCVC = PseudoColor; - dfb->depth = 8; - dfb->bitsPerRGB = 8; - dfb->bitsPerPixel = 8; - dfb->redMask = 0; - dfb->greenMask = 0; - dfb->blueMask = 0; - break; - -#if 0 - // Removed because Mountain Lion removed support for - // 15bit backing stores. We can possibly re-add - // this once libXplugin is updated to work around it. - case 15: - dfb->visuals = TrueColorMask; //LARGE_VISUALS; - dfb->preferredCVC = TrueColor; - dfb->depth = 15; - dfb->bitsPerRGB = 5; - dfb->bitsPerPixel = 16; - dfb->redMask = RM_ARGB(0, 5, 5, 5); - dfb->greenMask = GM_ARGB(0, 5, 5, 5); - dfb->blueMask = BM_ARGB(0, 5, 5, 5); - break; -#endif - - // case 24: - default: - if (depth != 24) - ErrorF( - "Unsupported color depth requested. Defaulting to 24bit. (depth=%d darwinDesiredDepth=%d)\n", - depth, darwinDesiredDepth); - dfb->visuals = TrueColorMask; //LARGE_VISUALS; - dfb->preferredCVC = TrueColor; - dfb->depth = 24; - dfb->bitsPerRGB = 8; - dfb->bitsPerPixel = 32; - dfb->redMask = RM_ARGB(0, 8, 8, 8); - dfb->greenMask = GM_ARGB(0, 8, 8, 8); - dfb->blueMask = BM_ARGB(0, 8, 8, 8); - break; - } - - if (noPseudoramiXExtension) { - CGDirectDisplayID dpy; - CGRect frame; - - ErrorF("Warning: noPseudoramiXExtension!\n"); - - dpy = displayAtIndex(index); - QuartzCopyDisplayIDs(pScreen, 1, &dpy); - - frame = displayScreenBounds(dpy); - - dfb->x = frame.origin.x; - dfb->y = frame.origin.y; - dfb->width = frame.size.width; - dfb->height = frame.size.height; - } - else { - xprAddPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height, - pScreen); - } - - /* Passing zero width (pitch) makes miCreateScreenResources set the - screen pixmap to the framebuffer pointer, i.e. NULL. The generic - rootless code takes care of making this work. */ - dfb->pitch = 0; - dfb->framebuffer = NULL; - - DRIScreenInit(pScreen); - - return TRUE; -} - -/* - * xprSetupScreen - * Setup the screen for rootless access. - */ -static Bool -xprSetupScreen(int index, ScreenPtr pScreen) -{ -#ifdef DAMAGE - // The Damage extension needs to wrap underneath the - // generic rootless layer, so do it now. - if (!DamageSetup(pScreen)) - return FALSE; -#endif - - // Initialize generic rootless code - if (!xprInit(pScreen)) - return FALSE; - - return DRIFinishScreenInit(pScreen); -} - -/* - * xprUpdateScreen - * Update screen after configuration change. - */ -static void -xprUpdateScreen(ScreenPtr pScreen) -{ - rootlessGlobalOffsetX = darwinMainScreenX; - rootlessGlobalOffsetY = darwinMainScreenY; - - AppleWMSetScreenOrigin(pScreen->root); - - RootlessRepositionWindows(pScreen); - RootlessUpdateScreenPixmap(pScreen); -} - -/* - * xprInitInput - * Finalize xpr specific setup. - */ -static void -xprInitInput(int argc, char **argv) -{ - int i; - - rootlessGlobalOffsetX = darwinMainScreenX; - rootlessGlobalOffsetY = darwinMainScreenY; - - for (i = 0; i < screenInfo.numScreens; i++) - AppleWMSetScreenOrigin(screenInfo.screens[i]->root); -} - -/* - * Quartz display mode function list. - */ -static QuartzModeProcsRec xprModeProcs = { - xprDisplayInit, - xprAddScreen, - xprSetupScreen, - xprInitInput, - QuartzInitCursor, - QuartzSuspendXCursor, - QuartzResumeXCursor, - xprAddPseudoramiXScreens, - xprUpdateScreen, - xprIsX11Window, - xprHideWindows, - RootlessFrameForWindow, - TopLevelParent, - DRICreateSurface, - DRIDestroySurface -}; - -/* - * QuartzModeBundleInit - * Initialize the display mode bundle after loading. - */ -Bool -QuartzModeBundleInit(void) -{ - quartzProcs = &xprModeProcs; - quartzOpenGLBundle = xprOpenGLBundle; - return TRUE; -} diff --git a/include/meson.build b/include/meson.build index 30f44c7d7..6ae1805f9 100644 --- a/include/meson.build +++ b/include/meson.build @@ -265,12 +265,6 @@ conf_data.set_quoted('__VENDORDWEBSUPPORT__', get_option('vendor_web')) conf_data.set_quoted('BUILDERADDR', get_option('builder_addr')) conf_data.set_quoted('BUILDERSTRING', get_option('builder_string')) -if build_rootless - conf_data.set('ROOTLESS', build_rootless ? '1' : false) - conf_data.set('ROOTLESS_WORKAROUND', 1) - conf_data.set('ROOTLESS_SAFEALPHA', 1) -endif - # # for xorg-server.h only # diff --git a/meson.build b/meson.build index 94dea6970..aa85db1b4 100644 --- a/meson.build +++ b/meson.build @@ -95,7 +95,6 @@ dri3proto_dep = dependency('dri3proto', version: '>= 1.4', fallback: ['xorgproto xineramaproto_dep = dependency('xineramaproto', fallback: ['xorgproto', 'ext_xorgproto']) xf86bigfontproto_dep = dependency('xf86bigfontproto', version: '>= 1.2.0', fallback: ['xorgproto', 'ext_xorgproto'], required: get_option('xf86bigfont')) xf86vidmodeproto_dep = dependency('xf86vidmodeproto', version: '>= 2.2.99.1', fallback: ['xorgproto', 'ext_xorgproto']) -applewmproto_dep = dependency('applewmproto', version: '>= 1.4', fallback: ['xorgproto', 'ext_xorgproto'], required: false) xshmfence_dep = dependency('xshmfence', version: xshmfence_req, required: false) xwaylandproto_dep = dependency('xwaylandproto', version: '>= 1.0', fallback: ['xorgproto', 'ext_xorgproto'], required: false) dpmsproto_dep = dependency('dpmsproto', version: '>= 1.2', required: get_option('dpms')) @@ -272,20 +271,6 @@ else build_xwin = get_option('xwin') == 'true' endif -build_xquartz = false -if get_option('xquartz') == 'auto' - if host_machine.system() == 'darwin' - build_xquartz = true - endif -else - build_xquartz = get_option('xquartz') == 'true' -endif - -build_rootless = false -if build_xquartz - build_rootless = true -endif - if get_option('ipv6') == 'auto' build_ipv6 = cc.has_function('getaddrinfo') else @@ -525,9 +510,6 @@ else endif build_dpms = get_option('dpms') -if build_xquartz - build_dpms = false -endif build_xf86bigfont = get_option('xf86bigfont') build_screensaver = get_option('screensaver') @@ -620,7 +602,6 @@ common_dep = [ xf86bigfontproto_dep, xf86dgaproto_dep, xf86vidmodeproto_dep, - applewmproto_dep, dpmsproto_dep, pixman_dep, @@ -750,11 +731,8 @@ subdir('dbe') subdir('miext/damage') subdir('miext/shadow') subdir('miext/sync') -if build_rootless - subdir('miext/rootless') -endif subdir('present') -if build_xwin or build_xquartz +if build_xwin subdir('pseudoramiX') endif subdir('randr') diff --git a/meson_options.txt b/meson_options.txt index 49407198c..9a99a91f4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,9 +14,6 @@ option('xvfb', type: 'boolean', value: true, description: 'Enable Xvfb X server') option('xwin', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', description: 'Enable XWin X server') -option('xquartz', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', - description: 'Enable Xquartz X server') - option('builder_addr', type: 'string', description: 'Builder address', value: 'xorg@lists.freedesktop.org') option('builder_string', type: 'string', description: 'Additional builder string') @@ -120,23 +117,6 @@ option('dri3', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', option('drm', type: 'boolean', value: true, description: 'Build Xorg with libdrm support') -option('apple-applications-dir', type: 'string', value: '/Applications/Utilities', - description: 'Applications directory') -option('apple-application-name', type: 'string', value: 'X11', - description: 'Application name') -option('bundle-id-prefix', type: 'string', value: 'org.x', - description: 'RDNS prefix for bundle identifier') -option('bundle-version', type: 'string', value: 'auto', - description: 'The CFBundleVersion for the application bundle') -option('bundle-version-string', type: 'string', value: 'auto', - description: 'The CFBundleShortVersionString for the application bundle') -option('sparkle-feed-url', type: 'string', - description: 'Feed URL for autoupdating with the Sparkle Framework (default: disabled)') -option('sparkle-public-edkey', type: 'string', - description: 'Public EdDSA key for verifying updates from the Sparkle feed (default: disabled)') -option('xpbproxy', type: 'boolean', value: false, - description: 'Build a standalone X pasteboard proxy') - option('libunwind', type: 'boolean', value: false, description: 'Use libunwind for backtrace reporting') diff --git a/miext/rootless/README.txt b/miext/rootless/README.txt deleted file mode 100644 index 8a3b2bedf..000000000 --- a/miext/rootless/README.txt +++ /dev/null @@ -1,326 +0,0 @@ - Generic Rootless Layer - Version 1.0 - July 13, 2004 - - Torrey T. Lyons - torrey@xfree86.org - - -Introduction - - The generic rootless layer allows an X server to be implemented -on top of another window server in a cooperative manner. This allows the -X11 windows and native windows of the underlying window server to -coexist on the same screen. The layer is called "rootless" because the root -window of the X server is generally not drawn. Instead, each top-level -child of the root window is represented as a separate on-screen window by -the underlying window server. The layer is referred to as "generic" -because it abstracts away the details of the underlying window system and -contains code that is useful for any rootless X server. The code for the -generic rootless layer is located in xc/programs/Xserver/miext/rootless. To -build a complete rootless X server requires a specific rootless -implementation, which provides functions that allow the generic rootless -layer to interact with the underlying window system. - - -Concepts - - In the context of a rootless X server the term window is used to -mean many fundamentally different things. For X11 a window is a DDX -resource that describes a visible, or potentially visible, rectangle on the -screen. A top-level window is a direct child of the root window. To avoid -confusion, an on-screen native window of the underlying window system -is referred to as a "frame". The generic rootless layer associates each -mapped top-level X11 window with a frame. An X11 window may be said -to be "framed" if it or its top-level parent is represented by a frame. - - The generic rootless layer models each frame as being backed at -all times by a backing buffer, which is periodically flushed to the screen. -If the underlying window system does not provide a backing buffer for -frames, this must be done by the rootless implementation. The generic -rootless layer model does not assume it always has access to the frames' -backing buffers. Any drawing to the buffer will be proceeded by a call to -the rootless implementation's StartDrawing() function and StopDrawing() -will be called when the drawing is concluded. The address of the frame's -backing buffer is returned by the StartDrawing() function and it can -change between successive calls. - - Because each frame is assumed to have a backing buffer, the -generic rootless layer will stop Expose events being generated when the -regions of visibility of a frame change on screen. This is similar to backing -store, but backing buffers are different in that they always store a copy of -the entire window contents, not just the obscured portions. The price paid -in increased memory consumption is made up by the greatly decreased -complexity in not having to track and record regions as they are obscured. - - -Rootless Implementation - - The specifics of the underlying window system are provided to the -generic rootless layer through rootless implementation functions, compile- -time options, and runtime parameters. The rootless implementation -functions are a list of functions that allow the generic rootless layer to -perform operations such as creating, destroying, moving, and resizing -frames. Some of the implementation functions are optional. A detailed -description of the rootless implementation functions is provided in -Appendix A. - - By design, a rootless implementation should only have to include -the rootless.h header file. The rootlessCommon.h file contains definitions -internal to the generic rootless layer. (If you find you need to use -rootlessCommon.h in your implementation, let the generic rootless layer -maintainers know. This could be an area where the generic rootless layer -should be generalized.) A rootless implementation should also modify -rootlessConfig.h to specify compile time options for its platform. - - The following compile-time options are defined in -rootlessConfig.h: - - o ROOTLESS_PROTECT_ALPHA: By default for a color bit depth of 24 and - 32 bits per pixel, fb will overwrite the "unused" 8 bits to optimize - drawing speed. If this is true, the alpha channel of frames is - protected and is not modified when drawing to them. The bits - containing the alpha channel are defined by the macro - RootlessAlphaMask(bpp), which should return a bit mask for - various bits per pixel. - - o ROOTLESS_REDISPLAY_DELAY: Time in milliseconds between updates to - the underlying window server. Most operations will be buffered until - this time has expired. - - The following runtime options are defined in rootless.h: - - o rootlessGlobalOffsetX, rootlessGlobalOffsetY: These specify the global - offset that is applied to all screens when converting from - screen-local to global coordinates. - - o rootless_CopyBytes_threshold, rootless_CopyWindow_threshold: - The minimum number of bytes or pixels for which to use the rootless - implementation's respective acceleration function. The rootless - acceleration functions are all optional so these will only be used - if the respective acceleration function pointer is not NULL. - - -Accelerated Drawing - - The rootless implementation typically does not have direct access -to the hardware. Its access to the graphics hardware is generally through -the API of the underlying window system. This underlying API may not -overlap well with the X11 drawing primitives. The generic rootless layer -falls back to using fb for all its 2-D drawing. Providing optional rootless -implementation acceleration functions can accelerate some graphics -primitives and some window functions. Typically calling through to the -underlying window systems API will not speed up these operations for -small enough areas. The rootless_*_threshold runtime options allow the -rootless implementation to provide hints for when the acceleration -functions should be used instead of fb. - - -Alpha Channel Protection - - If the bits per pixel is greater then the color bit depth, the contents -of the extra bits are undefined by the X11 protocol. Some window systems -will use these extra bits as an alpha channel. The generic rootless layer can -be configured to protect these bits and make sure they are not modified by -other parts of the X server. To protect the alpha channel -ROOTLESS_PROTECT_ALPHA and RootlessAlphaMask(bpp) must be -set appropriately as described under the compile time options. This -ensures that the X11 graphics primitives do not overwrite the alpha -channel in an attempt to optimize drawing. In addition, the window -functions PaintWindow() and Composite() must be replaced by alpha -channel safe variants. These are provided in rootless/safeAlpha. - - -Credits - - The generic rootless layer was originally conceived and developed -by Greg Parker as part of the XDarwin X server on Mac OS X. John -Harper made later optimizations to this code but removed its generic -independence of the underlying window system. Torrey T. Lyons -reintroduced the generic abstractions and made the rootless code suitable -for use by other X servers. - - -Appendix A: Rootless Implementation Functions - - The rootless implementation functions are defined in rootless.h. It -is intended that rootless.h contains the complete interface that is needed by -rootless implementations. The definitions contained in rootlessCommon.h -are intended for internal use by the generic rootless layer and are more -likely to change. - - Most of these functions take a RootlessFrameID as a parameter. -The RootlessFrameID is an opaque object that is returned by the -implementation's CreateFrame() function. The generic rootless layer does -not use this frame id other than to pass it back to the rootless -implementation to indicate the frame to operate on. - -/* - * Create a new frame. - * The frame is created unmapped. - * - * pFrame RootlessWindowPtr for this frame should be completely - * initialized before calling except for pFrame->wid, which - * is set by this function. - * pScreen Screen on which to place the new frame - * newX, newY Position of the frame. - * pNewShape Shape for the frame (in frame-local coordinates). NULL for - * unshaped frames. - */ -typedef Bool (*RootlessCreateFrameProc) - (RootlessWindowPtr pFrame, ScreenPtr pScreen, int newX, int newY, - RegionPtr pNewShape); - -/* - * Destroy a frame. - * Drawing is stopped and all updates are flushed before this is called. - * - * wid Frame id - */ -typedef void (*RootlessDestroyFrameProc) - (RootlessFrameID wid); - -/* - * Move a frame on screen. - * Drawing is stopped and all updates are flushed before this is called. - * - * wid Frame id - * pScreen Screen to move the new frame to - * newX, newY New position of the frame - */ -typedef void (*RootlessMoveFrameProc) - (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY); - -/* - * Resize and move a frame. - * Drawing is stopped and all updates are flushed before this is called. - * - * wid Frame id - * pScreen Screen to move the new frame to - * newX, newY New position of the frame - * newW, newH New size of the frame - * gravity Gravity for window contents (rl_gravity_enum). This is always - * RL_GRAVITY_NONE unless ROOTLESS_RESIZE_GRAVITY is set. - */ -typedef void (*RootlessResizeFrameProc) - (RootlessFrameID wid, ScreenPtr pScreen, - int newX, int newY, unsigned int newW, unsigned int newH, - unsigned int gravity); - -/* - * Change frame ordering (AKA stacking, layering). - * Drawing is stopped before this is called. Unmapped frames are mapped by - * setting their ordering. - * - * wid Frame id - * nextWid Frame id of frame that is now above this one or NULL if this - * frame is at the top. - */ -typedef void (*RootlessRestackFrameProc) - (RootlessFrameID wid, RootlessFrameID nextWid); - -/* - * Change frame's shape. - * Drawing is stopped before this is called. - * - * wid Frame id - * pNewShape New shape for the frame (in frame-local coordinates) - * or NULL if now unshaped. - */ -typedef void (*RootlessReshapeFrameProc) - (RootlessFrameID wid, RegionPtr pNewShape); - -/* - * Unmap a frame. - * - * wid Frame id - */ -typedef void (*RootlessUnmapFrameProc) - (RootlessFrameID wid); - -/* - * Start drawing to a frame. - * Prepare a frame for direct access to its backing buffer. - * - * wid Frame id - * pixelData Address of the backing buffer (returned) - * bytesPerRow Width in bytes of the backing buffer (returned) - */ -typedef void (*RootlessStartDrawingProc) - (RootlessFrameID wid, char **pixelData, int *bytesPerRow); - -/* - * Stop drawing to a frame. - * No drawing to the frame's backing buffer will occur until drawing - * is started again. - * - * wid Frame id - * flush Flush drawing updates for this frame to the screen. - */ -typedef void (*RootlessStopDrawingProc) - (RootlessFrameID wid, Bool flush); - -/* - * Flush drawing updates to the screen. - * Drawing is stopped before this is called. - * - * wid Frame id - * pDamage Region containing all the changed pixels in frame-local - * coordinates. This is clipped to the window's clip. - */ -typedef void (*RootlessUpdateRegionProc) - (RootlessFrameID wid, RegionPtr pDamage); - -/* - * Mark damaged rectangles as requiring redisplay to screen. - * - * wid Frame id - * nrects Number of damaged rectangles - * rects Array of damaged rectangles in frame-local coordinates - * shift_x, Vector to shift rectangles by - * shift_y - */ -typedef void (*RootlessDamageRectsProc) - (RootlessFrameID wid, int nrects, const BoxRec *rects, - int shift_x, int shift_y); - -/* - * Switch the window associated with a frame. (Optional) - * When a framed window is reparented, the frame is resized and set to - * use the new top-level parent. If defined this function will be called - * afterwards for implementation specific bookkeeping. - * - * pFrame Frame whose window has switched - * oldWin Previous window wrapped by this frame - */ -typedef void (*RootlessSwitchWindowProc) - (RootlessWindowPtr pFrame, WindowPtr oldWin); - -/* - * Copy bytes. (Optional) - * Source and destinate may overlap and the right thing should happen. - * - * width Bytes to copy per row - * height Number of rows - * src Source data - * srcRowBytes Width of source in bytes - * dst Destination data - * dstRowBytes Width of destination in bytes - */ -typedef void (*RootlessCopyBytesProc) - (unsigned int width, unsigned int height, - const void *src, unsigned int srcRowBytes, - void *dst, unsigned int dstRowBytes); - -/* - * Copy area in frame to another part of frame. (Optional) - * - * wid Frame id - * dstNrects Number of rectangles to copy - * dstRects Array of rectangles to copy - * dx, dy Number of pixels away to copy area - */ -typedef void (*RootlessCopyWindowProc) - (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects, - int dx, int dy); - diff --git a/miext/rootless/meson.build b/miext/rootless/meson.build deleted file mode 100644 index 66b9f06cf..000000000 --- a/miext/rootless/meson.build +++ /dev/null @@ -1,13 +0,0 @@ -srcs_miext_rootless = [ - 'rootlessCommon.c', - 'rootlessGC.c', - 'rootlessScreen.c', - 'rootlessValTree.c', - 'rootlessWindow.c', -] - -libxserver_miext_rootless = static_library('libxserver_miext_rootless', - srcs_miext_rootless, - include_directories: inc, - dependencies: common_dep, -) diff --git a/miext/rootless/rootless.h b/miext/rootless/rootless.h deleted file mode 100644 index b375731bf..000000000 --- a/miext/rootless/rootless.h +++ /dev/null @@ -1,362 +0,0 @@ -/* - * External interface to generic rootless mode - */ -/* - * Copyright (c) 2001 Greg Parker. All Rights Reserved. - * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#ifndef _ROOTLESS_H -#define _ROOTLESS_H - -#include "rootlessConfig.h" -#include "mi.h" -#include "gcstruct.h" - -/* - Each top-level rootless window has a one-to-one correspondence to a physical - on-screen window. The physical window is referred to as a "frame". - */ - -typedef void *RootlessFrameID; - -/* - * RootlessWindowRec - * This structure stores the per-frame data used by the rootless code. - * Each top-level X window has one RootlessWindowRec associated with it. - */ -typedef struct _RootlessWindowRec { - // Position and size includes the window border - // Position is in per-screen coordinates - int x, y; - unsigned int width, height; - unsigned int borderWidth; - int level; - - RootlessFrameID wid; // implementation specific frame id - WindowPtr win; // underlying X window - - // Valid only when drawing (ie. is_drawing is set) - char *pixelData; - int bytesPerRow; - - PixmapPtr pixmap; - - unsigned int is_drawing:1; // Currently drawing? - unsigned int is_reorder_pending:1; - unsigned int is_offscreen:1; - unsigned int is_obscured:1; -} RootlessWindowRec, *RootlessWindowPtr; - -/* Offset for screen-local to global coordinate transforms */ -extern int rootlessGlobalOffsetX; -extern int rootlessGlobalOffsetY; - -/* The minimum number of bytes or pixels for which to use the - implementation's accelerated functions. */ -extern unsigned int rootless_CopyBytes_threshold; -extern unsigned int rootless_CopyWindow_threshold; - -/* Gravity for window contents during resizing */ -enum rl_gravity_enum { - RL_GRAVITY_NONE = 0, /* no gravity, fill everything */ - RL_GRAVITY_NORTH_WEST = 1, /* anchor to top-left corner */ - RL_GRAVITY_NORTH_EAST = 2, /* anchor to top-right corner */ - RL_GRAVITY_SOUTH_EAST = 3, /* anchor to bottom-right corner */ - RL_GRAVITY_SOUTH_WEST = 4, /* anchor to bottom-left corner */ -}; - -/*------------------------------------------ - Rootless Implementation Functions - ------------------------------------------*/ - -/* - * Create a new frame. - * The frame is created unmapped. - * - * pFrame RootlessWindowPtr for this frame should be completely - * initialized before calling except for pFrame->wid, which - * is set by this function. - * pScreen Screen on which to place the new frame - * newX, newY Position of the frame. - * pNewShape Shape for the frame (in frame-local coordinates). NULL for - * unshaped frames. - */ -typedef Bool (*RootlessCreateFrameProc) - (RootlessWindowPtr pFrame, ScreenPtr pScreen, int newX, int newY, - RegionPtr pNewShape); - -/* - * Destroy a frame. - * Drawing is stopped and all updates are flushed before this is called. - * - * wid Frame id - */ -typedef void (*RootlessDestroyFrameProc) - (RootlessFrameID wid); - -/* - * Move a frame on screen. - * Drawing is stopped and all updates are flushed before this is called. - * - * wid Frame id - * pScreen Screen to move the new frame to - * newX, newY New position of the frame - */ -typedef void (*RootlessMoveFrameProc) - (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY); - -/* - * Resize and move a frame. - * Drawing is stopped and all updates are flushed before this is called. - * - * wid Frame id - * pScreen Screen to move the new frame to - * newX, newY New position of the frame - * newW, newH New size of the frame - * gravity Gravity for window contents (rl_gravity_enum). - */ -typedef void (*RootlessResizeFrameProc) - (RootlessFrameID wid, ScreenPtr pScreen, - int newX, int newY, unsigned int newW, unsigned int newH, - unsigned int gravity); - -/* - * Change frame ordering (AKA stacking, layering). - * Drawing is stopped before this is called. Unmapped frames are mapped by - * setting their ordering. - * - * wid Frame id - * nextWid Frame id of frame that is now above this one or NULL if this - * frame is at the top. - */ -typedef void (*RootlessRestackFrameProc) - (RootlessFrameID wid, RootlessFrameID nextWid); - -/* - * Change frame's shape. - * Drawing is stopped before this is called. - * - * wid Frame id - * pNewShape New shape for the frame (in frame-local coordinates) - * or NULL if now unshaped. - */ -typedef void (*RootlessReshapeFrameProc) - (RootlessFrameID wid, RegionPtr pNewShape); - -/* - * Unmap a frame. - * - * wid Frame id - */ -typedef void (*RootlessUnmapFrameProc) - (RootlessFrameID wid); - -/* - * Start drawing to a frame. - * Prepare a frame for direct access to its backing buffer. - * - * wid Frame id - * pixelData Address of the backing buffer (returned) - * bytesPerRow Width in bytes of the backing buffer (returned) - */ -typedef void (*RootlessStartDrawingProc) - (RootlessFrameID wid, char **pixelData, int *bytesPerRow); - -/* - * Stop drawing to a frame. - * No drawing to the frame's backing buffer will occur until drawing - * is started again. - * - * wid Frame id - * flush Flush drawing updates for this frame to the screen. - */ -typedef void (*RootlessStopDrawingProc) - (RootlessFrameID wid, Bool flush); - -/* - * Flush drawing updates to the screen. - * Drawing is stopped before this is called. - * - * wid Frame id - * pDamage Region containing all the changed pixels in frame-lcoal - * coordinates. This is clipped to the window's clip. - */ -typedef void (*RootlessUpdateRegionProc) - (RootlessFrameID wid, RegionPtr pDamage); - -/* - * Mark damaged rectangles as requiring redisplay to screen. - * - * wid Frame id - * nrects Number of damaged rectangles - * rects Array of damaged rectangles in frame-local coordinates - * shift_x, Vector to shift rectangles by - * shift_y - */ -typedef void (*RootlessDamageRectsProc) - (RootlessFrameID wid, int nrects, const BoxRec * rects, - int shift_x, int shift_y); - -/* - * Switch the window associated with a frame. (Optional) - * When a framed window is reparented, the frame is resized and set to - * use the new top-level parent. If defined this function will be called - * afterwards for implementation specific bookkeeping. - * - * pFrame Frame whose window has switched - * oldWin Previous window wrapped by this frame - */ -typedef void (*RootlessSwitchWindowProc) - (RootlessWindowPtr pFrame, WindowPtr oldWin); - -/* - * Check if window should be reordered. (Optional) - * The underlying window system may animate windows being ordered in. - * We want them to be mapped but remain ordered out until the animation - * completes. If defined this function will be called to check if a - * framed window should be reordered now. If this function returns - * FALSE, the window will still be mapped from the X11 perspective, but - * the RestackFrame function will not be called for its frame. - * - * pFrame Frame to reorder - */ -typedef Bool (*RootlessDoReorderWindowProc) - (RootlessWindowPtr pFrame); - -/* - * Copy bytes. (Optional) - * Source and destinate may overlap and the right thing should happen. - * - * width Bytes to copy per row - * height Number of rows - * src Source data - * srcRowBytes Width of source in bytes - * dst Destination data - * dstRowBytes Width of destination in bytes - */ -typedef void (*RootlessCopyBytesProc) - (unsigned int width, unsigned int height, - const void *src, unsigned int srcRowBytes, - void *dst, unsigned int dstRowBytes); - -/* - * Copy area in frame to another part of frame. (Optional) - * - * wid Frame id - * dstNrects Number of rectangles to copy - * dstRects Array of rectangles to copy - * dx, dy Number of pixels away to copy area - */ -typedef void (*RootlessCopyWindowProc) - (RootlessFrameID wid, int dstNrects, const BoxRec * dstRects, int dx, int dy); - -typedef void (*RootlessHideWindowProc) - (RootlessFrameID wid); - -typedef void (*RootlessUpdateColormapProc) - (RootlessFrameID wid, ScreenPtr pScreen); - -/* - * Rootless implementation function list - */ -typedef struct _RootlessFrameProcs { - RootlessCreateFrameProc CreateFrame; - RootlessDestroyFrameProc DestroyFrame; - - RootlessMoveFrameProc MoveFrame; - RootlessResizeFrameProc ResizeFrame; - RootlessRestackFrameProc RestackFrame; - RootlessReshapeFrameProc ReshapeFrame; - RootlessUnmapFrameProc UnmapFrame; - - RootlessStartDrawingProc StartDrawing; - RootlessStopDrawingProc StopDrawing; - RootlessUpdateRegionProc UpdateRegion; - RootlessDamageRectsProc DamageRects; - - /* Optional frame functions */ - RootlessSwitchWindowProc SwitchWindow; - RootlessDoReorderWindowProc DoReorderWindow; - RootlessHideWindowProc HideWindow; - RootlessUpdateColormapProc UpdateColormap; - - /* Optional acceleration functions */ - RootlessCopyBytesProc CopyBytes; - RootlessCopyWindowProc CopyWindow; -} RootlessFrameProcsRec, *RootlessFrameProcsPtr; - -/* - * Initialize rootless mode on the given screen. - */ -Bool RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs); - -/* - * Return the frame ID for the physical window displaying the given window. - * - * create If true and the window has no frame, attempt to create one - */ -RootlessFrameID RootlessFrameForWindow(WindowPtr pWin, Bool create); - -/* - * Return the top-level parent of a window. - * The root is the top-level parent of itself, even though the root is - * not otherwise considered to be a top-level window. - */ -WindowPtr TopLevelParent(WindowPtr pWindow); - -/* - * Prepare a window for direct access to its backing buffer. - */ -void RootlessStartDrawing(WindowPtr pWindow); - -/* - * Finish drawing to a window's backing buffer. - * - * flush If true, damaged areas are flushed to the screen. - */ -void RootlessStopDrawing(WindowPtr pWindow, Bool flush); - -/* - * Allocate a new screen pixmap. - * miCreateScreenResources does not do this properly with a null - * framebuffer pointer. - */ -void RootlessUpdateScreenPixmap(ScreenPtr pScreen); - -/* - * Reposition all windows on a screen to their correct positions. - */ -void RootlessRepositionWindows(ScreenPtr pScreen); - -/* - * Bring all windows to the front of the native stack - */ -void RootlessOrderAllWindows(Bool include_unhitable); -#endif /* _ROOTLESS_H */ diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c deleted file mode 100644 index 44c2c3789..000000000 --- a/miext/rootless/rootlessCommon.c +++ /dev/null @@ -1,498 +0,0 @@ -/* - * Common rootless definitions and code - */ -/* - * Copyright (c) 2001 Greg Parker. All Rights Reserved. - * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved. - * Copyright (c) 2002 Apple Computer, Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include /* For NULL */ -#include /* For CHAR_BIT */ - -#include "rootlessCommon.h" -#include "colormapst.h" - -unsigned int rootless_CopyBytes_threshold = 0; -unsigned int rootless_CopyWindow_threshold = 0; -int rootlessGlobalOffsetX = 0; -int rootlessGlobalOffsetY = 0; - -RegionRec rootlessHugeRoot = { {-32767, -32767, 32767, 32767}, NULL }; - -/* Following macro from miregion.c */ - -/* true iff two Boxes overlap */ -#define EXTENTCHECK(r1,r2) \ - (!( ((r1)->x2 <= (r2)->x1) || \ - ((r1)->x1 >= (r2)->x2) || \ - ((r1)->y2 <= (r2)->y1) || \ - ((r1)->y1 >= (r2)->y2) ) ) - -/* - * TopLevelParent - * Returns the top-level parent of pWindow. - * The root is the top-level parent of itself, even though the root is - * not otherwise considered to be a top-level window. - */ -WindowPtr -TopLevelParent(WindowPtr pWindow) -{ - WindowPtr top; - - if (IsRoot(pWindow)) - return pWindow; - - top = pWindow; - while (top && !IsTopLevel(top)) - top = top->parent; - - return top; -} - -/* - * IsFramedWindow - * Returns TRUE if this window is visible inside a frame - * (e.g. it is visible and has a top-level or root parent) - */ -Bool -IsFramedWindow(WindowPtr pWin) -{ - WindowPtr top; - - if (!dixPrivateKeyRegistered(&rootlessWindowPrivateKeyRec)) - return FALSE; - - if (!pWin->realized) - return FALSE; - top = TopLevelParent(pWin); - - return (top && WINREC(top)); -} - -Bool -RootlessResolveColormap(ScreenPtr pScreen, int first_color, - int n_colors, uint32_t * colors) -{ - int last, i; - ColormapPtr map; - - map = RootlessGetColormap(pScreen); - if (map == NULL || map->class != PseudoColor) - return FALSE; - - last = min(map->pVisual->ColormapEntries, first_color + n_colors); - for (i = max(0, first_color); i < last; i++) { - Entry *ent = map->red + i; - uint16_t red, green, blue; - - if (!ent->refcnt) - continue; - if (ent->fShared) { - red = ent->co.shco.red->color; - green = ent->co.shco.green->color; - blue = ent->co.shco.blue->color; - } - else { - red = ent->co.local.red; - green = ent->co.local.green; - blue = ent->co.local.blue; - } - - colors[i - first_color] = (0xFF000000UL - | ((uint32_t) red & 0xff00) << 8 - | (green & 0xff00) - | (blue >> 8)); - } - - return TRUE; -} - -unsigned long RootlessWID(WindowPtr pWindow) { - ScreenPtr pScreen = pWindow->drawable.pScreen; - WindowPtr top = TopLevelParent(pWindow); - RootlessWindowRec *winRec; - PixmapPtr curPixmap; - - if (top == NULL) { - return 0; - } - winRec = WINREC(top); - if (winRec == NULL) { - return 0; - } - - return (unsigned long)(uintptr_t)winRec->wid; -} - -/* - * RootlessStartDrawing - * Prepare a window for direct access to its backing buffer. - * Each top-level parent has a Pixmap representing its backing buffer, - * which all of its children inherit. - */ -void -RootlessStartDrawing(WindowPtr pWindow) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - WindowPtr top = TopLevelParent(pWindow); - RootlessWindowRec *winRec; - PixmapPtr curPixmap; - - if (top == NULL) { - RL_DEBUG_MSG("RootlessStartDrawing is a no-op because top == NULL.\n"); - return; - } - winRec = WINREC(top); - if (winRec == NULL) { - RL_DEBUG_MSG("RootlessStartDrawing is a no-op because winRec == NULL.\n"); - return; - } - - // Make sure the window's top-level parent is prepared for drawing. - if (!winRec->is_drawing) { - int bw = wBorderWidth(top); - - SCREENREC(pScreen)->imp->StartDrawing(winRec->wid, &winRec->pixelData, - &winRec->bytesPerRow); - - winRec->pixmap = - GetScratchPixmapHeader(pScreen, winRec->width, winRec->height, - top->drawable.depth, - top->drawable.bitsPerPixel, - winRec->bytesPerRow, winRec->pixelData); - - RL_DEBUG_MSG("GetScratchPixmapHeader gave us %p %p (%d,%d %dx%d %d) for wid=%lu\n", - winRec->pixmap, winRec->pixmap->devPrivate.ptr, winRec->pixmap->drawable.x, - winRec->pixmap->drawable.y, winRec->pixmap->drawable.width, winRec->pixmap->drawable.height, - winRec->pixmap->drawable.bitsPerPixel, RootlessWID(pWindow)); - - SetPixmapBaseToScreen(winRec->pixmap, - top->drawable.x - bw, top->drawable.y - bw); - - RL_DEBUG_MSG("After SetPixmapBaseToScreen(%d %d %d): %p (%d,%d %dx%d %d) for wid=%lu\n", - top->drawable.x, top->drawable.y, bw, winRec->pixmap->devPrivate.ptr, winRec->pixmap->drawable.x, - winRec->pixmap->drawable.y, winRec->pixmap->drawable.width, winRec->pixmap->drawable.height, - winRec->pixmap->drawable.bitsPerPixel, RootlessWID(pWindow)); - - winRec->is_drawing = TRUE; - } else { - RL_DEBUG_MSG("Skipped call to xprStartDrawing (wid: %lu) because winRec->is_drawing says we already did.\n", RootlessWID(pWindow)); - } - - curPixmap = pScreen->GetWindowPixmap(pWindow); - if (curPixmap == winRec->pixmap) { - RL_DEBUG_MSG("Window %p already has winRec->pixmap %p; not pushing\n", - pWindow, winRec->pixmap); - } - else { - PixmapPtr oldPixmap = - dixLookupPrivate(&pWindow->devPrivates, - rootlessWindowOldPixmapPrivateKey); - - RL_DEBUG_MSG("curPixmap is %p %p for wid=%lu\n", curPixmap, curPixmap ? curPixmap->devPrivate.ptr : NULL, RootlessWID(pWindow)); - RL_DEBUG_MSG("oldPixmap is %p %p for wid=%lu\n", oldPixmap, oldPixmap ? oldPixmap->devPrivate.ptr : NULL, RootlessWID(pWindow)); - - if (oldPixmap != NULL) { - if (oldPixmap == curPixmap) - RL_DEBUG_MSG - ("Window %p's curPixmap %p is the same as its oldPixmap; strange\n", - pWindow, curPixmap); - else - RL_DEBUG_MSG("Window %p's existing oldPixmap %p being lost!\n", - pWindow, oldPixmap); - } - dixSetPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey, - curPixmap); - pScreen->SetWindowPixmap(pWindow, winRec->pixmap); - } -} - -/* - * RootlessStopDrawing - * Stop drawing to a window's backing buffer. If flush is true, - * damaged regions are flushed to the screen. - */ -static int -RestorePreDrawingPixmapVisitor(WindowPtr pWindow, void *data) -{ - RootlessWindowRec *winRec = (RootlessWindowRec *) data; - ScreenPtr pScreen = pWindow->drawable.pScreen; - PixmapPtr exPixmap = pScreen->GetWindowPixmap(pWindow); - PixmapPtr oldPixmap = - dixLookupPrivate(&pWindow->devPrivates, - rootlessWindowOldPixmapPrivateKey); - if (oldPixmap == NULL) { - if (exPixmap == winRec->pixmap) - RL_DEBUG_MSG - ("Window %p appears to be in drawing mode (ex-pixmap %p equals winRec->pixmap, which is being freed) but has no oldPixmap!\n", - pWindow, exPixmap); - } - else { - if (exPixmap != winRec->pixmap) - RL_DEBUG_MSG - ("Window %p appears to be in drawing mode (oldPixmap %p) but ex-pixmap %p not winRec->pixmap %p!\n", - pWindow, oldPixmap, exPixmap, winRec->pixmap); - if (oldPixmap == winRec->pixmap) - RL_DEBUG_MSG - ("Window %p's oldPixmap %p is winRec->pixmap, which has just been freed!\n", - pWindow, oldPixmap); - pScreen->SetWindowPixmap(pWindow, oldPixmap); - dixSetPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey, - NULL); - } - return WT_WALKCHILDREN; -} - -void -RootlessStopDrawing(WindowPtr pWindow, Bool flush) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - WindowPtr top = TopLevelParent(pWindow); - RootlessWindowRec *winRec; - - if (top == NULL) - return; - winRec = WINREC(top); - if (winRec == NULL) - return; - - if (winRec->is_drawing) { - SCREENREC(pScreen)->imp->StopDrawing(winRec->wid, flush); - - FreeScratchPixmapHeader(winRec->pixmap); - TraverseTree(top, RestorePreDrawingPixmapVisitor, (void *) winRec); - winRec->pixmap = NULL; - - winRec->is_drawing = FALSE; - } - else if (flush) { - SCREENREC(pScreen)->imp->UpdateRegion(winRec->wid, NULL); - } - - if (flush && winRec->is_reorder_pending) { - winRec->is_reorder_pending = FALSE; - RootlessReorderWindow(pWindow); - } -} - -/* - * RootlessDamageRegion - * Mark a damaged region as requiring redisplay to screen. - * pRegion is in GLOBAL coordinates. - */ -void -RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion) -{ - RootlessWindowRec *winRec; - RegionRec clipped; - WindowPtr pTop; - BoxPtr b1, b2; - - RL_DEBUG_MSG("Damaged win %p\n", pWindow); - - pTop = TopLevelParent(pWindow); - if (pTop == NULL) - return; - - winRec = WINREC(pTop); - if (winRec == NULL) - return; - - /* We need to intersect the drawn region with the clip of the window - to avoid marking places we didn't actually draw (which can cause - problems when the window has an extra client-side backing store) - - But this is a costly operation and since we'll normally just be - drawing inside the clip, go to some lengths to avoid the general - case intersection. */ - - b1 = RegionExtents(&pWindow->borderClip); - b2 = RegionExtents(pRegion); - - if (EXTENTCHECK(b1, b2)) { - /* Regions may overlap. */ - - if (RegionNumRects(pRegion) == 1) { - int in; - - /* Damaged region only has a single rect, so we can - just compare that against the region */ - - in = RegionContainsRect(&pWindow->borderClip, RegionRects(pRegion)); - if (in == rgnIN) { - /* clip totally contains pRegion */ - - SCREENREC(pWindow->drawable.pScreen)->imp->DamageRects(winRec-> - wid, - RegionNumRects - (pRegion), - RegionRects - (pRegion), - -winRec-> - x, - -winRec-> - y); - - RootlessQueueRedisplay(pTop->drawable.pScreen); - goto out; - } - else if (in == rgnOUT) { - /* clip doesn't contain pRegion */ - - goto out; - } - } - - /* clip overlaps pRegion, need to intersect */ - - RegionNull(&clipped); - RegionIntersect(&clipped, &pWindow->borderClip, pRegion); - - SCREENREC(pWindow->drawable.pScreen)->imp->DamageRects(winRec->wid, - RegionNumRects - (&clipped), - RegionRects - (&clipped), - -winRec->x, - -winRec->y); - - RegionUninit(&clipped); - - RootlessQueueRedisplay(pTop->drawable.pScreen); - } - - out: -#ifdef ROOTLESSDEBUG - { - BoxRec *box = RegionRects(pRegion), *end; - int numBox = RegionNumRects(pRegion); - - for (end = box + numBox; box < end; box++) { - RL_DEBUG_MSG("Damage rect: %i, %i, %i, %i\n", - box->x1, box->x2, box->y1, box->y2); - } - } -#endif - return; -} - -/* - * RootlessDamageBox - * Mark a damaged box as requiring redisplay to screen. - * pRegion is in GLOBAL coordinates. - */ -void -RootlessDamageBox(WindowPtr pWindow, BoxPtr pBox) -{ - RegionRec region; - - RegionInit(®ion, pBox, 1); - - RootlessDamageRegion(pWindow, ®ion); - - RegionUninit(®ion); /* no-op */ -} - -/* - * RootlessDamageRect - * Mark a damaged rectangle as requiring redisplay to screen. - * (x, y, w, h) is in window-local coordinates. - */ -void -RootlessDamageRect(WindowPtr pWindow, int x, int y, int w, int h) -{ - BoxRec box; - RegionRec region; - - x += pWindow->drawable.x; - y += pWindow->drawable.y; - - box.x1 = x; - box.x2 = x + w; - box.y1 = y; - box.y2 = y + h; - - RegionInit(®ion, &box, 1); - - RootlessDamageRegion(pWindow, ®ion); - - RegionUninit(®ion); /* no-op */ -} - -/* - * RootlessRedisplay - * Stop drawing and redisplay the damaged region of a window. - */ -void -RootlessRedisplay(WindowPtr pWindow) -{ - RootlessStopDrawing(pWindow, TRUE); -} - -/* - * RootlessRepositionWindows - * Reposition all windows on a screen to their correct positions. - */ -void -RootlessRepositionWindows(ScreenPtr pScreen) -{ - WindowPtr root = pScreen->root; - WindowPtr win; - - if (root != NULL) { - RootlessRepositionWindow(root); - - for (win = root->firstChild; win; win = win->nextSib) { - if (WINREC(win) != NULL) - RootlessRepositionWindow(win); - } - } -} - -/* - * RootlessRedisplayScreen - * Walk every window on a screen and redisplay the damaged regions. - */ -void -RootlessRedisplayScreen(ScreenPtr pScreen) -{ - WindowPtr root = pScreen->root; - - if (root != NULL) { - WindowPtr win; - - RootlessRedisplay(root); - for (win = root->firstChild; win; win = win->nextSib) { - if (WINREC(win) != NULL) { - RootlessRedisplay(win); - } - } - } -} diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h deleted file mode 100644 index 40400b395..000000000 --- a/miext/rootless/rootlessCommon.h +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Common internal rootless definitions and code - */ -/* - * Copyright (c) 2001 Greg Parker. All Rights Reserved. - * Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#ifndef _ROOTLESSCOMMON_H -#define _ROOTLESSCOMMON_H - -#include "misc.h" -#include "rootless.h" -#include "fb.h" - -#include "scrnintstr.h" - -#include "picturestr.h" - -// Debug output, or not. -#ifdef ROOTLESSDEBUG -#define RL_DEBUG_MSG ErrorF -#else -#define RL_DEBUG_MSG(a, ...) -#endif - -// Global variables -extern DevPrivateKeyRec rootlessGCPrivateKeyRec; - -#define rootlessGCPrivateKey (&rootlessGCPrivateKeyRec) - -extern DevPrivateKeyRec rootlessScreenPrivateKeyRec; - -#define rootlessScreenPrivateKey (&rootlessScreenPrivateKeyRec) - -extern DevPrivateKeyRec rootlessWindowPrivateKeyRec; - -#define rootlessWindowPrivateKey (&rootlessWindowPrivateKeyRec) - -extern DevPrivateKeyRec rootlessWindowOldPixmapPrivateKeyRec; - -#define rootlessWindowOldPixmapPrivateKey (&rootlessWindowOldPixmapPrivateKeyRec) - -// RootlessGCRec: private per-gc data -typedef struct { - const GCFuncs *originalFuncs; - const GCOps *originalOps; -} RootlessGCRec; - -// RootlessScreenRec: per-screen private data -typedef struct _RootlessScreenRec { - // Rootless implementation functions - RootlessFrameProcsPtr imp; - - // Wrapped screen functions - CreateScreenResourcesProcPtr CreateScreenResources; - CloseScreenProcPtr CloseScreen; - - CreateWindowProcPtr CreateWindow; - DestroyWindowProcPtr DestroyWindow; - RealizeWindowProcPtr RealizeWindow; - UnrealizeWindowProcPtr UnrealizeWindow; - MoveWindowProcPtr MoveWindow; - ResizeWindowProcPtr ResizeWindow; - RestackWindowProcPtr RestackWindow; - ReparentWindowProcPtr ReparentWindow; - ChangeBorderWidthProcPtr ChangeBorderWidth; - PositionWindowProcPtr PositionWindow; - ChangeWindowAttributesProcPtr ChangeWindowAttributes; - PaintWindowProcPtr PaintWindow; - - CreateGCProcPtr CreateGC; - CopyWindowProcPtr CopyWindow; - GetImageProcPtr GetImage; - SourceValidateProcPtr SourceValidate; - - MarkOverlappedWindowsProcPtr MarkOverlappedWindows; - ValidateTreeProcPtr ValidateTree; - - SetShapeProcPtr SetShape; - - CompositeProcPtr Composite; - GlyphsProcPtr Glyphs; - - InstallColormapProcPtr InstallColormap; - UninstallColormapProcPtr UninstallColormap; - StoreColorsProcPtr StoreColors; - - void *pixmap_data; - unsigned int pixmap_data_size; - - ColormapPtr colormap; - - void *redisplay_timer; - unsigned int redisplay_timer_set:1; - unsigned int redisplay_queued:1; - unsigned int redisplay_expired:1; - unsigned int colormap_changed:1; -} RootlessScreenRec, *RootlessScreenPtr; - -// "Definition of the Porting Layer for the X11 Sample Server" says -// unwrap and rewrap of screen functions is unnecessary, but -// screen->CreateGC changes after a call to cfbCreateGC. - -#define SCREEN_UNWRAP(screen, fn) \ - screen->fn = SCREENREC(screen)->fn; - -#define SCREEN_WRAP(screen, fn) \ - SCREENREC(screen)->fn = screen->fn; \ - screen->fn = Rootless##fn - -// Accessors for screen and window privates - -#define SCREENREC(pScreen) ((RootlessScreenRec *) \ - dixLookupPrivate(&(pScreen)->devPrivates, rootlessScreenPrivateKey)) - -#define SETSCREENREC(pScreen, v) \ - dixSetPrivate(&(pScreen)->devPrivates, rootlessScreenPrivateKey, v) - -#define WINREC(pWin) ((RootlessWindowRec *) \ - dixLookupPrivate(&(pWin)->devPrivates, rootlessWindowPrivateKey)) - -#define SETWINREC(pWin, v) \ - dixSetPrivate(&(pWin)->devPrivates, rootlessWindowPrivateKey, v) - -// Call a rootless implementation function. -// Many rootless implementation functions are allowed to be NULL. -#define CallFrameProc(pScreen, proc, params) \ - if (SCREENREC(pScreen)->frameProcs.proc) { \ - RL_DEBUG_MSG("calling frame proc " #proc " "); \ - SCREENREC(pScreen)->frameProcs.proc params; \ - } - -// BoxRec manipulators -// Copied from shadowfb - -#define TRIM_BOX(box, pGC) { \ - BoxPtr extents = &pGC->pCompositeClip->extents;\ - if(box.x1 < extents->x1) box.x1 = extents->x1; \ - if(box.x2 > extents->x2) box.x2 = extents->x2; \ - if(box.y1 < extents->y1) box.y1 = extents->y1; \ - if(box.y2 > extents->y2) box.y2 = extents->y2; \ -} - -#define TRANSLATE_BOX(box, pDraw) { \ - box.x1 += pDraw->x; \ - box.x2 += pDraw->x; \ - box.y1 += pDraw->y; \ - box.y2 += pDraw->y; \ -} - -#define TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC) { \ - TRANSLATE_BOX(box, pDraw); \ - TRIM_BOX(box, pGC); \ -} - -#define BOX_NOT_EMPTY(box) \ - (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0)) - -// HUGE_ROOT and NORMAL_ROOT -// We don't want to clip windows to the edge of the screen. -// HUGE_ROOT temporarily makes the root window really big. -// This is needed as a wrapper around any function that calls -// SetWinSize or SetBorderSize which clip a window against its -// parents, including the root. - -extern RegionRec rootlessHugeRoot; - -#define HUGE_ROOT(pWin) \ - do { \ - WindowPtr _w = pWin; \ - while (_w->parent) \ - _w = _w->parent; \ - saveRoot = _w->winSize; \ - _w->winSize = rootlessHugeRoot; \ - } while (0) - -#define NORMAL_ROOT(pWin) \ - do { \ - WindowPtr _w = pWin; \ - while (_w->parent) \ - _w = _w->parent; \ - _w->winSize = saveRoot; \ - } while (0) - -// Returns TRUE if this window is a top-level window (i.e. child of the root) -// The root is not a top-level window. -#define IsTopLevel(pWin) \ - ((pWin) && (pWin)->parent && !(pWin)->parent->parent) - -// Returns TRUE if this window is a root window -#define IsRoot(pWin) \ - ((pWin) == (pWin)->drawable.pScreen->root) - -/* - * SetPixmapBaseToScreen - * Move the given pixmap's base address to where pixel (0, 0) - * would be if the pixmap's actual data started at (x, y). - * Can't access the bits before the first word of the drawable's data in - * rootless mode, so make sure our base address is always 32-bit aligned. - */ -#define SetPixmapBaseToScreen(pix, _x, _y) do { \ - pix->screen_x = _x; \ - pix->screen_y = _y; \ -} while(0) - -// Returns TRUE if this window is visible inside a frame -// (e.g. it is visible and has a top-level or root parent) -Bool IsFramedWindow(WindowPtr pWin); - -// Routines that cause regions to get redrawn. -// DamageRegion and DamageRect are in global coordinates. -// DamageBox is in window-local coordinates. -void RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion); -void RootlessDamageRect(WindowPtr pWindow, int x, int y, int w, int h); -void RootlessDamageBox(WindowPtr pWindow, BoxPtr pBox); -void RootlessRedisplay(WindowPtr pWindow); -void RootlessRedisplayScreen(ScreenPtr pScreen); - -void RootlessQueueRedisplay(ScreenPtr pScreen); - -/* Return the colormap currently installed on the given screen. */ -ColormapPtr RootlessGetColormap(ScreenPtr pScreen); - -/* Convert colormap to ARGB. */ -Bool RootlessResolveColormap(ScreenPtr pScreen, int first_color, - int n_colors, uint32_t * colors); - -void RootlessFlushWindowColormap(WindowPtr pWin); -void RootlessFlushScreenColormaps(ScreenPtr pScreen); - -// Move a window to its proper location on the screen. -void RootlessRepositionWindow(WindowPtr pWin); - -// Move the window to its correct place in the physical stacking order. -void RootlessReorderWindow(WindowPtr pWin); - -void RootlessScreenExpose(ScreenPtr pScreen); -void RootlessHideAllWindows(void); -void RootlessShowAllWindows(void); -void RootlessUpdateRooted(Bool state); - -void RootlessEnableRoot(ScreenPtr pScreen); -void RootlessDisableRoot(ScreenPtr pScreen); - -void RootlessSetPixmapOfAncestors(WindowPtr pWin); - -unsigned long RootlessWID(WindowPtr pWindow); -#endif /* _ROOTLESSCOMMON_H */ diff --git a/miext/rootless/rootlessConfig.h b/miext/rootless/rootlessConfig.h deleted file mode 100644 index 80c2f6d8a..000000000 --- a/miext/rootless/rootlessConfig.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Platform specific rootless configuration - */ -/* - * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#ifndef _ROOTLESSCONFIG_H -#define _ROOTLESSCONFIG_H - -/*# define ROOTLESSDEBUG*/ - -#define ROOTLESS_PROTECT_ALPHA TRUE -#define ROOTLESS_REDISPLAY_DELAY 10 - -/* Bit mask for alpha channel with a particular number of bits per - pixel. Note that we only care for 32bpp data. Mac OS X uses planar - alpha for 16bpp. */ -#define RootlessAlphaMask(bpp) ((bpp) == 32 ? 0xFF000000 : 0) - -#endif /* _ROOTLESSCONFIG_H */ diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c deleted file mode 100644 index 5af18a4a0..000000000 --- a/miext/rootless/rootlessGC.c +++ /dev/null @@ -1,1481 +0,0 @@ -/* - * Graphics Context support for generic rootless X server - */ -/* - * Copyright (c) 2001 Greg Parker. All Rights Reserved. - * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved. - * Copyright (c) 2002 Apple Computer, Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include /* For NULL */ -#include "mi.h" -#include "scrnintstr.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "dixfontstr.h" -#include "mivalidate.h" -#include "fb.h" - -#include -#include -#include - -#include "rootlessCommon.h" - -// GC functions -static void RootlessValidateGC(GCPtr pGC, unsigned long changes, - DrawablePtr pDrawable); -static void RootlessChangeGC(GCPtr pGC, unsigned long mask); -static void RootlessCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); -static void RootlessDestroyGC(GCPtr pGC); -static void RootlessChangeClip(GCPtr pGC, int type, void *pvalue, int nrects); -static void RootlessDestroyClip(GCPtr pGC); -static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc); - -Bool RootlessCreateGC(GCPtr pGC); - -GCFuncs rootlessGCFuncs = { - RootlessValidateGC, - RootlessChangeGC, - RootlessCopyGC, - RootlessDestroyGC, - RootlessChangeClip, - RootlessDestroyClip, - RootlessCopyClip, -}; - -// GC operations -static void RootlessFillSpans(DrawablePtr dst, GCPtr pGC, int nInit, - DDXPointPtr pptInit, int *pwidthInit, int sorted); -static void RootlessSetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc, - DDXPointPtr pptInit, int *pwidthInit, - int nspans, int sorted); -static void RootlessPutImage(DrawablePtr dst, GCPtr pGC, - int depth, int x, int y, int w, int h, - int leftPad, int format, char *pBits); -static RegionPtr RootlessCopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC, - int srcx, int srcy, int w, int h, - int dstx, int dsty); -static RegionPtr RootlessCopyPlane(DrawablePtr pSrc, DrawablePtr dst, - GCPtr pGC, int srcx, int srcy, - int w, int h, int dstx, int dsty, - unsigned long plane); -static void RootlessPolyPoint(DrawablePtr dst, GCPtr pGC, - int mode, int npt, DDXPointPtr pptInit); -static void RootlessPolylines(DrawablePtr dst, GCPtr pGC, - int mode, int npt, DDXPointPtr pptInit); -static void RootlessPolySegment(DrawablePtr dst, GCPtr pGC, - int nseg, xSegment * pSeg); -static void RootlessPolyRectangle(DrawablePtr dst, GCPtr pGC, - int nRects, xRectangle *pRects); -static void RootlessPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, - xArc * parcs); -static void RootlessFillPolygon(DrawablePtr dst, GCPtr pGC, int shape, int mode, - int count, DDXPointPtr pptInit); -static void RootlessPolyFillRect(DrawablePtr dst, GCPtr pGC, int nRectsInit, - xRectangle *pRectsInit); -static void RootlessPolyFillArc(DrawablePtr dst, GCPtr pGC, int narcsInit, - xArc * parcsInit); -static int RootlessPolyText8(DrawablePtr dst, GCPtr pGC, int x, int y, - int count, char *chars); -static int RootlessPolyText16(DrawablePtr dst, GCPtr pGC, int x, int y, - int count, unsigned short *chars); -static void RootlessImageText8(DrawablePtr dst, GCPtr pGC, int x, int y, - int count, char *chars); -static void RootlessImageText16(DrawablePtr dst, GCPtr pGC, int x, int y, - int count, unsigned short *chars); -static void RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y, - unsigned int nglyphInit, - CharInfoPtr * ppciInit, void *unused); -static void RootlessPolyGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr * ppci, - void *pglyphBase); -static void RootlessPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst, - int dx, int dy, int xOrg, int yOrg); - -static GCOps rootlessGCOps = { - RootlessFillSpans, - RootlessSetSpans, - RootlessPutImage, - RootlessCopyArea, - RootlessCopyPlane, - RootlessPolyPoint, - RootlessPolylines, - RootlessPolySegment, - RootlessPolyRectangle, - RootlessPolyArc, - RootlessFillPolygon, - RootlessPolyFillRect, - RootlessPolyFillArc, - RootlessPolyText8, - RootlessPolyText16, - RootlessImageText8, - RootlessImageText16, - RootlessImageGlyphBlt, - RootlessPolyGlyphBlt, - RootlessPushPixels -}; - -/* - If ROOTLESS_PROTECT_ALPHA is set, we have to make sure that the alpha - channel of the on screen windows is always opaque. fb makes this harder - than it would otherwise be by noticing that a planemask of 0x00ffffff - includes all bits when depth==24, and so it "optimizes" the planemask to - 0xffffffff. We work around this by temporarily setting depth=bpp while - changing the GC. - - So the normal situation (in 32 bit mode) is that the planemask is - 0x00ffffff and thus fb leaves the alpha channel alone. The rootless - implementation is responsible for setting the alpha channel opaque - initially. - - Unfortunately drawing with a planemask that doesn't have all bits set - normally causes fb to fall off its fastest paths when blitting and - filling. So we try to recognize when we can relax the planemask back to - 0xffffffff, and do that for the duration of the drawing operation, - setting the alpha channel in fg/bg pixels to opaque at the same time. We - can do this when drawing op is GXcopy. We can also do this when copying - from another window since its alpha channel must also be opaque. - - The three macros below are used to implement this. Drawing ops that can - potentially have their planemask relaxed look like: - - OP { - GC_SAVE(gc); - GCOP_UNWRAP(gc); - - ... - - if (canAccelxxx(..) && otherwise-suitable) - GC_UNSET_PM(gc, dst); - - gc->funcs->OP(gc, ...); - - GC_RESTORE(gc, dst); - GCOP_WRAP(gc); - } - - */ - -#define GC_SAVE(pGC) \ - unsigned long _save_fg = (pGC)->fgPixel; \ - unsigned long _save_bg = (pGC)->bgPixel; \ - unsigned long _save_pm = (pGC)->planemask; \ - Bool _changed = FALSE - -#define GC_RESTORE(pGC, pDraw) \ - do { \ - if (_changed) { \ - unsigned int depth = (pDraw)->depth; \ - (pGC)->fgPixel = _save_fg; \ - (pGC)->bgPixel = _save_bg; \ - (pGC)->planemask = _save_pm; \ - (pDraw)->depth = (pDraw)->bitsPerPixel; \ - VALIDATE_GC(pGC, GCForeground | GCBackground | \ - GCPlaneMask, pDraw); \ - (pDraw)->depth = depth; \ - } \ - } while (0) - -#define GC_UNSET_PM(pGC, pDraw) \ - do { \ - unsigned int mask = RootlessAlphaMask ((pDraw)->bitsPerPixel); \ - if (((pGC)->planemask & mask) != mask) { \ - unsigned int depth = (pDraw)->depth; \ - (pGC)->fgPixel |= mask; \ - (pGC)->bgPixel |= mask; \ - (pGC)->planemask |= mask; \ - (pDraw)->depth = (pDraw)->bitsPerPixel; \ - VALIDATE_GC(pGC, GCForeground | \ - GCBackground | GCPlaneMask, pDraw); \ - (pDraw)->depth = depth; \ - _changed = TRUE; \ - } \ - } while (0) - -#define VALIDATE_GC(pGC, changes, pDrawable) \ - do { \ - pGC->funcs->ValidateGC(pGC, changes, pDrawable); \ - if (((WindowPtr) pDrawable)->viewable) { \ - gcrec->originalOps = pGC->ops; \ - } \ - } while(0) - -static RootlessWindowRec * -canAccelBlit(DrawablePtr pDraw, GCPtr pGC) -{ - WindowPtr pTop; - RootlessWindowRec *winRec; - unsigned int pm; - - if (pGC->alu != GXcopy) - return NULL; - - if (pDraw->type != DRAWABLE_WINDOW) - return NULL; - - pm = ~RootlessAlphaMask(pDraw->bitsPerPixel); - if ((pGC->planemask & pm) != pm) - return NULL; - - pTop = TopLevelParent((WindowPtr) pDraw); - if (pTop == NULL) - return NULL; - - winRec = WINREC(pTop); - if (winRec == NULL) - return NULL; - - return winRec; -} - -static inline RootlessWindowRec * -canAccelFill(DrawablePtr pDraw, GCPtr pGC) -{ - if (pGC->fillStyle != FillSolid) - return NULL; - - return canAccelBlit(pDraw, pGC); -} - -/* - * Screen function to create a graphics context - */ -Bool -RootlessCreateGC(GCPtr pGC) -{ - RootlessGCRec *gcrec; - RootlessScreenRec *s; - Bool result; - - SCREEN_UNWRAP(pGC->pScreen, CreateGC); - s = SCREENREC(pGC->pScreen); - result = s->CreateGC(pGC); - - gcrec = (RootlessGCRec *) - dixLookupPrivate(&pGC->devPrivates, rootlessGCPrivateKey); - gcrec->originalOps = NULL; // don't wrap ops yet - gcrec->originalFuncs = pGC->funcs; - pGC->funcs = &rootlessGCFuncs; - - SCREEN_WRAP(pGC->pScreen, CreateGC); - return result; -} - -/* - * GC funcs - * - * These wrap lower level GC funcs. - * ValidateGC wraps the GC ops iff dest is viewable. - * All the others just unwrap and call. - */ - -// GCFUNC_UNRAP assumes funcs have been wrapped and -// does not assume ops have been wrapped -#define GCFUNC_UNWRAP(pGC) \ - RootlessGCRec *gcrec = (RootlessGCRec *) \ - dixLookupPrivate(&(pGC)->devPrivates, rootlessGCPrivateKey); \ - (pGC)->funcs = gcrec->originalFuncs; \ - if (gcrec->originalOps) { \ - (pGC)->ops = gcrec->originalOps; \ -} - -#define GCFUNC_WRAP(pGC) \ - gcrec->originalFuncs = (pGC)->funcs; \ - (pGC)->funcs = &rootlessGCFuncs; \ - if (gcrec->originalOps) { \ - gcrec->originalOps = (pGC)->ops; \ - (pGC)->ops = &rootlessGCOps; \ -} - -static void -RootlessValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) -{ - GCFUNC_UNWRAP(pGC); - - gcrec->originalOps = NULL; - - if (pDrawable->type == DRAWABLE_WINDOW) { -#ifdef ROOTLESS_PROTECT_ALPHA - unsigned int depth = pDrawable->depth; - - // We force a planemask so fb doesn't overwrite the alpha channel. - // Left to its own devices, fb will optimize away the planemask. - pDrawable->depth = pDrawable->bitsPerPixel; - pGC->planemask &= ~RootlessAlphaMask(pDrawable->bitsPerPixel); - VALIDATE_GC(pGC, changes | GCPlaneMask, pDrawable); - pDrawable->depth = depth; -#else - VALIDATE_GC(pGC, changes, pDrawable); -#endif - } - else { - pGC->funcs->ValidateGC(pGC, changes, pDrawable); - } - - GCFUNC_WRAP(pGC); -} - -static void -RootlessChangeGC(GCPtr pGC, unsigned long mask) -{ - GCFUNC_UNWRAP(pGC); - pGC->funcs->ChangeGC(pGC, mask); - GCFUNC_WRAP(pGC); -} - -static void -RootlessCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) -{ - GCFUNC_UNWRAP(pGCDst); - pGCDst->funcs->CopyGC(pGCSrc, mask, pGCDst); - GCFUNC_WRAP(pGCDst); -} - -static void -RootlessDestroyGC(GCPtr pGC) -{ - GCFUNC_UNWRAP(pGC); - pGC->funcs->DestroyGC(pGC); - GCFUNC_WRAP(pGC); -} - -static void -RootlessChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) -{ - GCFUNC_UNWRAP(pGC); - pGC->funcs->ChangeClip(pGC, type, pvalue, nrects); - GCFUNC_WRAP(pGC); -} - -static void -RootlessDestroyClip(GCPtr pGC) -{ - GCFUNC_UNWRAP(pGC); - pGC->funcs->DestroyClip(pGC); - GCFUNC_WRAP(pGC); -} - -static void -RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc) -{ - GCFUNC_UNWRAP(pgcDst); - pgcDst->funcs->CopyClip(pgcDst, pgcSrc); - GCFUNC_WRAP(pgcDst); -} - -/* - * GC ops - * - * We can't use shadowfb because shadowfb assumes one pixmap - * and our root window is a special case. - * However, much of this code is copied from shadowfb. - */ - -// assumes both funcs and ops are wrapped -#define GCOP_UNWRAP(pGC) \ - RootlessGCRec *gcrec = (RootlessGCRec *) \ - dixLookupPrivate(&(pGC)->devPrivates, rootlessGCPrivateKey); \ - const GCFuncs *saveFuncs = pGC->funcs; \ - (pGC)->funcs = gcrec->originalFuncs; \ - (pGC)->ops = gcrec->originalOps; - -#define GCOP_WRAP(pGC) \ - gcrec->originalOps = (pGC)->ops; \ - (pGC)->funcs = saveFuncs; \ - (pGC)->ops = &rootlessGCOps; - -static void -RootlessFillSpans(DrawablePtr dst, GCPtr pGC, int nInit, - DDXPointPtr pptInit, int *pwidthInit, int sorted) -{ - GC_SAVE(pGC); - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("fill spans start "); - - if (nInit <= 0) { - pGC->ops->FillSpans(dst, pGC, nInit, pptInit, pwidthInit, sorted); - } - else { - DDXPointPtr ppt = pptInit; - int *pwidth = pwidthInit; - int i = nInit; - BoxRec box; - - box.x1 = ppt->x; - box.x2 = box.x1 + *pwidth; - box.y2 = box.y1 = ppt->y; - - while (--i) { - ppt++; - pwidth++; - if (box.x1 > ppt->x) - box.x1 = ppt->x; - if (box.x2 < (ppt->x + *pwidth)) - box.x2 = ppt->x + *pwidth; - if (box.y1 > ppt->y) - box.y1 = ppt->y; - else if (box.y2 < ppt->y) - box.y2 = ppt->y; - } - - box.y2++; - - RootlessStartDrawing((WindowPtr) dst); - - if (canAccelFill(dst, pGC)) { - GC_UNSET_PM(pGC, dst); - } - - pGC->ops->FillSpans(dst, pGC, nInit, pptInit, pwidthInit, sorted); - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - - GC_RESTORE(pGC, dst); - GCOP_WRAP(pGC); - RL_DEBUG_MSG("fill spans end\n"); -} - -static void -RootlessSetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc, - DDXPointPtr pptInit, int *pwidthInit, int nspans, int sorted) -{ - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("set spans start "); - - if (nspans <= 0) { - pGC->ops->SetSpans(dst, pGC, pSrc, pptInit, pwidthInit, nspans, sorted); - } - else { - DDXPointPtr ppt = pptInit; - int *pwidth = pwidthInit; - int i = nspans; - BoxRec box; - - box.x1 = ppt->x; - box.x2 = box.x1 + *pwidth; - box.y2 = box.y1 = ppt->y; - - while (--i) { - ppt++; - pwidth++; - if (box.x1 > ppt->x) - box.x1 = ppt->x; - if (box.x2 < (ppt->x + *pwidth)) - box.x2 = ppt->x + *pwidth; - if (box.y1 > ppt->y) - box.y1 = ppt->y; - else if (box.y2 < ppt->y) - box.y2 = ppt->y; - } - - box.y2++; - - RootlessStartDrawing((WindowPtr) dst); - pGC->ops->SetSpans(dst, pGC, pSrc, pptInit, pwidthInit, nspans, sorted); - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - GCOP_WRAP(pGC); - RL_DEBUG_MSG("set spans end\n"); -} - -static void -RootlessPutImage(DrawablePtr dst, GCPtr pGC, - int depth, int x, int y, int w, int h, - int leftPad, int format, char *pBits) -{ - BoxRec box; - - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("put image start "); - - RootlessStartDrawing((WindowPtr) dst); - pGC->ops->PutImage(dst, pGC, depth, x, y, w, h, leftPad, format, pBits); - - box.x1 = x + dst->x; - box.x2 = box.x1 + w; - box.y1 = y + dst->y; - box.y2 = box.y1 + h; - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("put image end\n"); -} - -/* changed area is *dest* rect */ -static RegionPtr -RootlessCopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC, - int srcx, int srcy, int w, int h, int dstx, int dsty) -{ - RegionPtr result; - BoxRec box; - - GC_SAVE(pGC); - GCOP_UNWRAP(pGC); - - RL_DEBUG_MSG("copy area start (src %p, dst %p)", pSrc, dst); - - if (pSrc->type == DRAWABLE_WINDOW && IsFramedWindow((WindowPtr) pSrc)) { - /* If both source and dest are windows, and we're doing - a simple copy operation, we can remove the alpha-protecting - planemask (since source has opaque alpha as well) */ - - if (canAccelBlit(pSrc, pGC)) { - GC_UNSET_PM(pGC, dst); - } - - RootlessStartDrawing((WindowPtr) pSrc); - } - RootlessStartDrawing((WindowPtr) dst); - result = pGC->ops->CopyArea(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty); - - box.x1 = dstx + dst->x; - box.x2 = box.x1 + w; - box.y1 = dsty + dst->y; - box.y2 = box.y1 + h; - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - - GC_RESTORE(pGC, dst); - GCOP_WRAP(pGC); - RL_DEBUG_MSG("copy area end\n"); - return result; -} - -/* changed area is *dest* rect */ -static RegionPtr -RootlessCopyPlane(DrawablePtr pSrc, DrawablePtr dst, - GCPtr pGC, int srcx, int srcy, - int w, int h, int dstx, int dsty, unsigned long plane) -{ - RegionPtr result; - BoxRec box; - - GCOP_UNWRAP(pGC); - - RL_DEBUG_MSG("copy plane start "); - - if (pSrc->type == DRAWABLE_WINDOW && IsFramedWindow((WindowPtr) pSrc)) { - RootlessStartDrawing((WindowPtr) pSrc); - } - RootlessStartDrawing((WindowPtr) dst); - result = pGC->ops->CopyPlane(pSrc, dst, pGC, srcx, srcy, w, h, - dstx, dsty, plane); - - box.x1 = dstx + dst->x; - box.x2 = box.x1 + w; - box.y1 = dsty + dst->y; - box.y2 = box.y1 + h; - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("copy plane end\n"); - return result; -} - -// Options for size of changed area: -// 0 = box per point -// 1 = big box around all points -// 2 = accumulate point in 20 pixel radius -#define ROOTLESS_CHANGED_AREA 1 -#define abs(a) ((a) > 0 ? (a) : -(a)) - -/* changed area is box around all points */ -static void -RootlessPolyPoint(DrawablePtr dst, GCPtr pGC, - int mode, int npt, DDXPointPtr pptInit) -{ - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("polypoint start "); - - RootlessStartDrawing((WindowPtr) dst); - pGC->ops->PolyPoint(dst, pGC, mode, npt, pptInit); - - if (npt > 0) { -#if ROOTLESS_CHANGED_AREA==0 - // box per point - BoxRec box; - - while (npt) { - box.x1 = pptInit->x; - box.y1 = pptInit->y; - box.x2 = box.x1 + 1; - box.y2 = box.y1 + 1; - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - - npt--; - pptInit++; - } - -#elif ROOTLESS_CHANGED_AREA==1 - // one big box - BoxRec box; - - box.x2 = box.x1 = pptInit->x; - box.y2 = box.y1 = pptInit->y; - while (--npt) { - pptInit++; - if (box.x1 > pptInit->x) - box.x1 = pptInit->x; - else if (box.x2 < pptInit->x) - box.x2 = pptInit->x; - if (box.y1 > pptInit->y) - box.y1 = pptInit->y; - else if (box.y2 < pptInit->y) - box.y2 = pptInit->y; - } - - box.x2++; - box.y2++; - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - -#elif ROOTLESS_CHANGED_AREA==2 - // clever(?) method: accumulate point in 20-pixel radius - BoxRec box; - int firstx, firsty; - - box.x2 = box.x1 = firstx = pptInit->x; - box.y2 = box.y1 = firsty = pptInit->y; - while (--npt) { - pptInit++; - if (abs(pptInit->x - firstx) > 20 || abs(pptInit->y - firsty) > 20) { - box.x2++; - box.y2++; - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - box.x2 = box.x1 = firstx = pptInit->x; - box.y2 = box.y1 = firsty = pptInit->y; - } - else { - if (box.x1 > pptInit->x) - box.x1 = pptInit->x; - else if (box.x2 < pptInit->x) - box.x2 = pptInit->x; - if (box.y1 > pptInit->y) - box.y1 = pptInit->y; - else if (box.y2 < pptInit->y) - box.y2 = pptInit->y; - } - } - box.x2++; - box.y2++; - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); -#endif /* ROOTLESS_CHANGED_AREA */ - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("polypoint end\n"); -} - -#undef ROOTLESS_CHANGED_AREA - -/* changed area is box around each line */ -static void -RootlessPolylines(DrawablePtr dst, GCPtr pGC, - int mode, int npt, DDXPointPtr pptInit) -{ - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("poly lines start "); - - RootlessStartDrawing((WindowPtr) dst); - pGC->ops->Polylines(dst, pGC, mode, npt, pptInit); - - if (npt > 0) { - BoxRec box; - int extra = pGC->lineWidth >> 1; - - box.x2 = box.x1 = pptInit->x; - box.y2 = box.y1 = pptInit->y; - - if (npt > 1) { - if (pGC->joinStyle == JoinMiter) - extra = 6 * pGC->lineWidth; - else if (pGC->capStyle == CapProjecting) - extra = pGC->lineWidth; - } - - if (mode == CoordModePrevious) { - int x = box.x1; - int y = box.y1; - - while (--npt) { - pptInit++; - x += pptInit->x; - y += pptInit->y; - if (box.x1 > x) - box.x1 = x; - else if (box.x2 < x) - box.x2 = x; - if (box.y1 > y) - box.y1 = y; - else if (box.y2 < y) - box.y2 = y; - } - } - else { - while (--npt) { - pptInit++; - if (box.x1 > pptInit->x) - box.x1 = pptInit->x; - else if (box.x2 < pptInit->x) - box.x2 = pptInit->x; - if (box.y1 > pptInit->y) - box.y1 = pptInit->y; - else if (box.y2 < pptInit->y) - box.y2 = pptInit->y; - } - } - - box.x2++; - box.y2++; - - if (extra) { - box.x1 -= extra; - box.x2 += extra; - box.y1 -= extra; - box.y2 += extra; - } - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("poly lines end\n"); -} - -/* changed area is box around each line segment */ -static void -RootlessPolySegment(DrawablePtr dst, GCPtr pGC, int nseg, xSegment * pSeg) -{ - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("poly segment start (dst %p)", dst); - - RootlessStartDrawing((WindowPtr) dst); - pGC->ops->PolySegment(dst, pGC, nseg, pSeg); - - if (nseg > 0) { - BoxRec box; - int extra = pGC->lineWidth; - - if (pGC->capStyle != CapProjecting) - extra >>= 1; - - if (pSeg->x2 > pSeg->x1) { - box.x1 = pSeg->x1; - box.x2 = pSeg->x2; - } - else { - box.x2 = pSeg->x1; - box.x1 = pSeg->x2; - } - - if (pSeg->y2 > pSeg->y1) { - box.y1 = pSeg->y1; - box.y2 = pSeg->y2; - } - else { - box.y2 = pSeg->y1; - box.y1 = pSeg->y2; - } - - while (--nseg) { - pSeg++; - if (pSeg->x2 > pSeg->x1) { - if (pSeg->x1 < box.x1) - box.x1 = pSeg->x1; - if (pSeg->x2 > box.x2) - box.x2 = pSeg->x2; - } - else { - if (pSeg->x2 < box.x1) - box.x1 = pSeg->x2; - if (pSeg->x1 > box.x2) - box.x2 = pSeg->x1; - } - if (pSeg->y2 > pSeg->y1) { - if (pSeg->y1 < box.y1) - box.y1 = pSeg->y1; - if (pSeg->y2 > box.y2) - box.y2 = pSeg->y2; - } - else { - if (pSeg->y2 < box.y1) - box.y1 = pSeg->y2; - if (pSeg->y1 > box.y2) - box.y2 = pSeg->y1; - } - } - - box.x2++; - box.y2++; - - if (extra) { - box.x1 -= extra; - box.x2 += extra; - box.y1 -= extra; - box.y2 += extra; - } - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("poly segment end\n"); -} - -/* changed area is box around each line (not entire rects) */ -static void -RootlessPolyRectangle(DrawablePtr dst, GCPtr pGC, - int nRects, xRectangle *pRects) -{ - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("poly rectangle start "); - - RootlessStartDrawing((WindowPtr) dst); - pGC->ops->PolyRectangle(dst, pGC, nRects, pRects); - - if (nRects > 0) { - BoxRec box; - int offset1, offset2, offset3; - - offset2 = pGC->lineWidth; - if (!offset2) - offset2 = 1; - offset1 = offset2 >> 1; - offset3 = offset2 - offset1; - - while (nRects--) { - box.x1 = pRects->x - offset1; - box.y1 = pRects->y - offset1; - box.x2 = box.x1 + pRects->width + offset2; - box.y2 = box.y1 + offset2; - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - - box.x1 = pRects->x - offset1; - box.y1 = pRects->y + offset3; - box.x2 = box.x1 + offset2; - box.y2 = box.y1 + pRects->height - offset2; - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - - box.x1 = pRects->x + pRects->width - offset1; - box.y1 = pRects->y + offset3; - box.x2 = box.x1 + offset2; - box.y2 = box.y1 + pRects->height - offset2; - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - - box.x1 = pRects->x - offset1; - box.y1 = pRects->y + pRects->height - offset1; - box.x2 = box.x1 + pRects->width + offset2; - box.y2 = box.y1 + offset2; - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - - pRects++; - } - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("poly rectangle end\n"); -} - -/* changed area is box around each arc (assumes all arcs are 360 degrees) */ -static void -RootlessPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc * parcs) -{ - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("poly arc start "); - - RootlessStartDrawing((WindowPtr) dst); - pGC->ops->PolyArc(dst, pGC, narcs, parcs); - - if (narcs > 0) { - int extra = pGC->lineWidth >> 1; - BoxRec box; - - box.x1 = parcs->x; - box.x2 = box.x1 + parcs->width; - box.y1 = parcs->y; - box.y2 = box.y1 + parcs->height; - - /* should I break these up instead ? */ - - while (--narcs) { - parcs++; - if (box.x1 > parcs->x) - box.x1 = parcs->x; - if (box.x2 < (parcs->x + parcs->width)) - box.x2 = parcs->x + parcs->width; - if (box.y1 > parcs->y) - box.y1 = parcs->y; - if (box.y2 < (parcs->y + parcs->height)) - box.y2 = parcs->y + parcs->height; - } - - if (extra) { - box.x1 -= extra; - box.x2 += extra; - box.y1 -= extra; - box.y2 += extra; - } - - box.x2++; - box.y2++; - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("poly arc end\n"); -} - -/* changed area is box around each poly */ -static void -RootlessFillPolygon(DrawablePtr dst, GCPtr pGC, - int shape, int mode, int count, DDXPointPtr pptInit) -{ - GC_SAVE(pGC); - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("fill poly start (dst %p, fillStyle 0x%x)", dst, - pGC->fillStyle); - - if (count <= 2) { - pGC->ops->FillPolygon(dst, pGC, shape, mode, count, pptInit); - } - else { - DDXPointPtr ppt = pptInit; - int i = count; - BoxRec box; - - box.x2 = box.x1 = ppt->x; - box.y2 = box.y1 = ppt->y; - - if (mode != CoordModeOrigin) { - int x = box.x1; - int y = box.y1; - - while (--i) { - ppt++; - x += ppt->x; - y += ppt->y; - if (box.x1 > x) - box.x1 = x; - else if (box.x2 < x) - box.x2 = x; - if (box.y1 > y) - box.y1 = y; - else if (box.y2 < y) - box.y2 = y; - } - } - else { - while (--i) { - ppt++; - if (box.x1 > ppt->x) - box.x1 = ppt->x; - else if (box.x2 < ppt->x) - box.x2 = ppt->x; - if (box.y1 > ppt->y) - box.y1 = ppt->y; - else if (box.y2 < ppt->y) - box.y2 = ppt->y; - } - } - - box.x2++; - box.y2++; - - RootlessStartDrawing((WindowPtr) dst); - - if (canAccelFill(dst, pGC)) { - GC_UNSET_PM(pGC, dst); - } - - pGC->ops->FillPolygon(dst, pGC, shape, mode, count, pptInit); - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - - GC_RESTORE(pGC, dst); - GCOP_WRAP(pGC); - RL_DEBUG_MSG("fill poly end\n"); -} - -/* changed area is the rects */ -static void -RootlessPolyFillRect(DrawablePtr dst, GCPtr pGC, - int nRectsInit, xRectangle *pRectsInit) -{ - GC_SAVE(pGC); - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("fill rect start (dst %p, fillStyle 0x%x)", dst, - pGC->fillStyle); - - if (nRectsInit <= 0) { - pGC->ops->PolyFillRect(dst, pGC, nRectsInit, pRectsInit); - } - else { - BoxRec box; - xRectangle *pRects = pRectsInit; - int nRects = nRectsInit; - - box.x1 = pRects->x; - box.x2 = box.x1 + pRects->width; - box.y1 = pRects->y; - box.y2 = box.y1 + pRects->height; - - while (--nRects) { - pRects++; - if (box.x1 > pRects->x) - box.x1 = pRects->x; - if (box.x2 < (pRects->x + pRects->width)) - box.x2 = pRects->x + pRects->width; - if (box.y1 > pRects->y) - box.y1 = pRects->y; - if (box.y2 < (pRects->y + pRects->height)) - box.y2 = pRects->y + pRects->height; - } - - RootlessStartDrawing((WindowPtr) dst); - - if (canAccelFill(dst, pGC)) { - GC_UNSET_PM(pGC, dst); - } - - pGC->ops->PolyFillRect(dst, pGC, nRectsInit, pRectsInit); - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - - GC_RESTORE(pGC, dst); - GCOP_WRAP(pGC); - RL_DEBUG_MSG("fill rect end\n"); -} - -/* changed area is box around each arc (assuming arcs are all 360 degrees) */ -static void -RootlessPolyFillArc(DrawablePtr dst, GCPtr pGC, int narcsInit, xArc * parcsInit) -{ - GC_SAVE(pGC); - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("fill arc start "); - - if (narcsInit > 0) { - BoxRec box; - int narcs = narcsInit; - xArc *parcs = parcsInit; - - box.x1 = parcs->x; - box.x2 = box.x1 + parcs->width; - box.y1 = parcs->y; - box.y2 = box.y1 + parcs->height; - - /* should I break these up instead ? */ - - while (--narcs) { - parcs++; - if (box.x1 > parcs->x) - box.x1 = parcs->x; - if (box.x2 < (parcs->x + parcs->width)) - box.x2 = parcs->x + parcs->width; - if (box.y1 > parcs->y) - box.y1 = parcs->y; - if (box.y2 < (parcs->y + parcs->height)) - box.y2 = parcs->y + parcs->height; - } - - RootlessStartDrawing((WindowPtr) dst); - - if (canAccelFill(dst, pGC)) { - GC_UNSET_PM(pGC, dst); - } - - pGC->ops->PolyFillArc(dst, pGC, narcsInit, parcsInit); - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - else { - pGC->ops->PolyFillArc(dst, pGC, narcsInit, parcsInit); - } - - GC_RESTORE(pGC, dst); - GCOP_WRAP(pGC); - RL_DEBUG_MSG("fill arc end\n"); -} - -static void -RootlessImageText8(DrawablePtr dst, GCPtr pGC, - int x, int y, int count, char *chars) -{ - GC_SAVE(pGC); - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("imagetext8 start "); - - if (count > 0) { - int top, bot, Min, Max; - BoxRec box; - - top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); - bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); - - Min = count * FONTMINBOUNDS(pGC->font, characterWidth); - if (Min > 0) - Min = 0; - Max = count * FONTMAXBOUNDS(pGC->font, characterWidth); - if (Max < 0) - Max = 0; - - /* ugh */ - box.x1 = dst->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = dst->x + x + Max + FONTMAXBOUNDS(pGC->font, rightSideBearing); - - box.y1 = dst->y + y - top; - box.y2 = dst->y + y + bot; - - RootlessStartDrawing((WindowPtr) dst); - - if (canAccelFill(dst, pGC)) { - GC_UNSET_PM(pGC, dst); - } - - pGC->ops->ImageText8(dst, pGC, x, y, count, chars); - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - else { - pGC->ops->ImageText8(dst, pGC, x, y, count, chars); - } - - GC_RESTORE(pGC, dst); - GCOP_WRAP(pGC); - RL_DEBUG_MSG("imagetext8 end\n"); -} - -static int -RootlessPolyText8(DrawablePtr dst, GCPtr pGC, - int x, int y, int count, char *chars) -{ - int width; // the result, sorta - - GCOP_UNWRAP(pGC); - - RL_DEBUG_MSG("polytext8 start "); - - RootlessStartDrawing((WindowPtr) dst); - width = pGC->ops->PolyText8(dst, pGC, x, y, count, chars); - width -= x; - - if (width > 0) { - BoxRec box; - - /* ugh */ - box.x1 = dst->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = dst->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing); - - if (count > 1) { - box.x2 += width; - } - - box.y1 = dst->y + y - FONTMAXBOUNDS(pGC->font, ascent); - box.y2 = dst->y + y + FONTMAXBOUNDS(pGC->font, descent); - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("polytext8 end\n"); - return width + x; -} - -static void -RootlessImageText16(DrawablePtr dst, GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - GC_SAVE(pGC); - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("imagetext16 start "); - - if (count > 0) { - int top, bot, Min, Max; - BoxRec box; - - top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); - bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); - - Min = count * FONTMINBOUNDS(pGC->font, characterWidth); - if (Min > 0) - Min = 0; - Max = count * FONTMAXBOUNDS(pGC->font, characterWidth); - if (Max < 0) - Max = 0; - - /* ugh */ - box.x1 = dst->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = dst->x + x + Max + FONTMAXBOUNDS(pGC->font, rightSideBearing); - - box.y1 = dst->y + y - top; - box.y2 = dst->y + y + bot; - - RootlessStartDrawing((WindowPtr) dst); - - if (canAccelFill(dst, pGC)) { - GC_UNSET_PM(pGC, dst); - } - - pGC->ops->ImageText16(dst, pGC, x, y, count, chars); - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - else { - pGC->ops->ImageText16(dst, pGC, x, y, count, chars); - } - - GC_RESTORE(pGC, dst); - GCOP_WRAP(pGC); - RL_DEBUG_MSG("imagetext16 end\n"); -} - -static int -RootlessPolyText16(DrawablePtr dst, GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - int width; // the result, sorta - - GCOP_UNWRAP(pGC); - - RL_DEBUG_MSG("polytext16 start "); - - RootlessStartDrawing((WindowPtr) dst); - width = pGC->ops->PolyText16(dst, pGC, x, y, count, chars); - width -= x; - - if (width > 0) { - BoxRec box; - - /* ugh */ - box.x1 = dst->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = dst->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing); - - if (count > 1) { - box.x2 += width; - } - - box.y1 = dst->y + y - FONTMAXBOUNDS(pGC->font, ascent); - box.y2 = dst->y + y + FONTMAXBOUNDS(pGC->font, descent); - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("polytext16 end\n"); - return width + x; -} - -static void -RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC, - int x, int y, unsigned int nglyphInit, - CharInfoPtr * ppciInit, void *unused) -{ - GC_SAVE(pGC); - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("imageglyph start "); - - if (nglyphInit > 0) { - int top, bot, width = 0; - BoxRec box; - unsigned int nglyph = nglyphInit; - CharInfoPtr *ppci = ppciInit; - - top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); - bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); - - box.x1 = ppci[0]->metrics.leftSideBearing; - if (box.x1 > 0) - box.x1 = 0; - box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing - - ppci[nglyph - 1]->metrics.characterWidth; - if (box.x2 < 0) - box.x2 = 0; - - box.x2 += dst->x + x; - box.x1 += dst->x + x; - - while (nglyph--) { - width += (*ppci)->metrics.characterWidth; - ppci++; - } - - if (width > 0) - box.x2 += width; - else - box.x1 += width; - - box.y1 = dst->y + y - top; - box.y2 = dst->y + y + bot; - - RootlessStartDrawing((WindowPtr) dst); - - if (canAccelFill(dst, pGC)) { - GC_UNSET_PM(pGC, dst); - } - - pGC->ops->ImageGlyphBlt(dst, pGC, x, y, nglyphInit, ppciInit, unused); - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - else { - pGC->ops->ImageGlyphBlt(dst, pGC, x, y, nglyphInit, ppciInit, unused); - } - - GC_RESTORE(pGC, dst); - GCOP_WRAP(pGC); - RL_DEBUG_MSG("imageglyph end\n"); -} - -static void -RootlessPolyGlyphBlt(DrawablePtr dst, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, void *pglyphBase) -{ - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("polyglyph start "); - - RootlessStartDrawing((WindowPtr) dst); - pGC->ops->PolyGlyphBlt(dst, pGC, x, y, nglyph, ppci, pglyphBase); - - if (nglyph > 0) { - BoxRec box; - - /* ugh */ - box.x1 = dst->x + x + ppci[0]->metrics.leftSideBearing; - box.x2 = dst->x + x + ppci[nglyph - 1]->metrics.rightSideBearing; - - if (nglyph > 1) { - int width = 0; - - while (--nglyph) { - width += (*ppci)->metrics.characterWidth; - ppci++; - } - - if (width > 0) - box.x2 += width; - else - box.x1 += width; - } - - box.y1 = dst->y + y - FONTMAXBOUNDS(pGC->font, ascent); - box.y2 = dst->y + y + FONTMAXBOUNDS(pGC->font, descent); - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("polyglyph end\n"); -} - -/* changed area is in dest */ -static void -RootlessPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst, - int dx, int dy, int xOrg, int yOrg) -{ - BoxRec box; - - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("push pixels start "); - - RootlessStartDrawing((WindowPtr) dst); - pGC->ops->PushPixels(pGC, pBitMap, dst, dx, dy, xOrg, yOrg); - - box.x1 = xOrg + dst->x; - box.x2 = box.x1 + dx; - box.y1 = yOrg + dst->y; - box.y2 = box.y1 + dy; - - TRIM_BOX(box, pGC); - if (BOX_NOT_EMPTY(box)) - RootlessDamageBox((WindowPtr) dst, &box); - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("push pixels end\n"); -} diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c deleted file mode 100644 index 79fe3507b..000000000 --- a/miext/rootless/rootlessScreen.c +++ /dev/null @@ -1,745 +0,0 @@ -/* - * Screen routines for generic rootless X server - */ -/* - * Copyright (c) 2001 Greg Parker. All Rights Reserved. - * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved. - * Copyright (c) 2002 Apple Computer, Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "mi.h" -#include "scrnintstr.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "propertyst.h" -#include "mivalidate.h" -#include "picturestr.h" -#include "colormapst.h" - -#include -#include -#include -#include - -#include "rootlessCommon.h" -#include "rootlessWindow.h" - -extern int RootlessMiValidateTree(WindowPtr pRoot, WindowPtr pChild, - VTKind kind); -extern Bool RootlessCreateGC(GCPtr pGC); - -// Initialize globals -DevPrivateKeyRec rootlessGCPrivateKeyRec; -DevPrivateKeyRec rootlessScreenPrivateKeyRec; -DevPrivateKeyRec rootlessWindowPrivateKeyRec; -DevPrivateKeyRec rootlessWindowOldPixmapPrivateKeyRec; - -/* - * RootlessUpdateScreenPixmap - * miCreateScreenResources does not like a null framebuffer pointer, - * it leaves the screen pixmap with an uninitialized data pointer. - * Thus, rootless implementations typically set the framebuffer width - * to zero so that miCreateScreenResources does not allocate a screen - * pixmap for us. We allocate our own screen pixmap here since we need - * the screen pixmap to be valid (e.g. CopyArea from the root window). - */ -void -RootlessUpdateScreenPixmap(ScreenPtr pScreen) -{ - RootlessScreenRec *s = SCREENREC(pScreen); - PixmapPtr pPix; - unsigned int rowbytes; - - pPix = (*pScreen->GetScreenPixmap) (pScreen); - if (pPix == NULL) { - pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, pScreen->rootDepth, 0); - (*pScreen->SetScreenPixmap) (pPix); - } - - rowbytes = PixmapBytePad(pScreen->width, pScreen->rootDepth); - - if (s->pixmap_data_size < rowbytes) { - free(s->pixmap_data); - - s->pixmap_data_size = rowbytes; - s->pixmap_data = malloc(s->pixmap_data_size); - if (s->pixmap_data == NULL) - return; - - memset(s->pixmap_data, 0xFF, s->pixmap_data_size); - - pScreen->ModifyPixmapHeader(pPix, pScreen->width, pScreen->height, - pScreen->rootDepth, - BitsPerPixel(pScreen->rootDepth), - 0, s->pixmap_data); - /* ModifyPixmapHeader ignores zero arguments, so install rowbytes - by hand. */ - pPix->devKind = 0; - } -} - -/* - * RootlessCreateScreenResources - * Rootless implementations typically set a null framebuffer pointer, which - * causes problems with miCreateScreenResources. We fix things up here. - */ -static Bool -RootlessCreateScreenResources(ScreenPtr pScreen) -{ - Bool ret = TRUE; - - SCREEN_UNWRAP(pScreen, CreateScreenResources); - - if (pScreen->CreateScreenResources != NULL) - ret = (*pScreen->CreateScreenResources) (pScreen); - - SCREEN_WRAP(pScreen, CreateScreenResources); - - if (!ret) - return ret; - - /* Make sure we have a valid screen pixmap. */ - - RootlessUpdateScreenPixmap(pScreen); - - return ret; -} - -static Bool -RootlessCloseScreen(ScreenPtr pScreen) -{ - RootlessScreenRec *s; - - s = SCREENREC(pScreen); - - // fixme unwrap everything that was wrapped? - pScreen->CloseScreen = s->CloseScreen; - - if (s->pixmap_data != NULL) { - free(s->pixmap_data); - s->pixmap_data = NULL; - s->pixmap_data_size = 0; - } - - free(s); - return pScreen->CloseScreen(pScreen); -} - -static void -RootlessGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, - unsigned int format, unsigned long planeMask, char *pdstLine) -{ - ScreenPtr pScreen = pDrawable->pScreen; - - SCREEN_UNWRAP(pScreen, GetImage); - - if (pDrawable->type == DRAWABLE_WINDOW) { - int x0, y0, x1, y1; - RootlessWindowRec *winRec; - - // Many apps use GetImage to sync with the visible frame buffer - // FIXME: entire screen or just window or all screens? - RootlessRedisplayScreen(pScreen); - - // RedisplayScreen stops drawing, so we need to start it again - RootlessStartDrawing((WindowPtr) pDrawable); - - /* Check that we have some place to read from. */ - winRec = WINREC(TopLevelParent((WindowPtr) pDrawable)); - if (winRec == NULL) - goto out; - - /* Clip to top-level window bounds. */ - /* FIXME: fbGetImage uses the width parameter to calculate the - stride of the destination pixmap. If w is clipped, the data - returned will be garbage, although we will not crash. */ - - x0 = pDrawable->x + sx; - y0 = pDrawable->y + sy; - x1 = x0 + w; - y1 = y0 + h; - - x0 = max(x0, winRec->x); - y0 = max(y0, winRec->y); - x1 = min(x1, winRec->x + winRec->width); - y1 = min(y1, winRec->y + winRec->height); - - sx = x0 - pDrawable->x; - sy = y0 - pDrawable->y; - w = x1 - x0; - h = y1 - y0; - - if (w <= 0 || h <= 0) - goto out; - } - - pScreen->GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); - - out: - SCREEN_WRAP(pScreen, GetImage); -} - -/* - * RootlessSourceValidate - * CopyArea and CopyPlane use a GC tied to the destination drawable. - * StartDrawing/StopDrawing wrappers won't be called if source is - * a visible window but the destination isn't. So, we call StartDrawing - * here and leave StopDrawing for the block handler. - */ -static void -RootlessSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h, - unsigned int subWindowMode) -{ - SCREEN_UNWRAP(pDrawable->pScreen, SourceValidate); - if (pDrawable->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr) pDrawable; - - RootlessStartDrawing(pWin); - } - pDrawable->pScreen->SourceValidate(pDrawable, x, y, w, h, - subWindowMode); - SCREEN_WRAP(pDrawable->pScreen, SourceValidate); -} - -static void -RootlessComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, - INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, - INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - PictureScreenPtr ps = GetPictureScreen(pScreen); - WindowPtr srcWin, dstWin, maskWin = NULL; - - if (pMask) { // pMask can be NULL - maskWin = (pMask->pDrawable && - pMask->pDrawable->type == - DRAWABLE_WINDOW) ? (WindowPtr) pMask->pDrawable : NULL; - } - srcWin = (pSrc->pDrawable && pSrc->pDrawable->type == DRAWABLE_WINDOW) ? - (WindowPtr) pSrc->pDrawable : NULL; - dstWin = (pDst->pDrawable->type == DRAWABLE_WINDOW) ? - (WindowPtr) pDst->pDrawable : NULL; - - // SCREEN_UNWRAP(ps, Composite); - ps->Composite = SCREENREC(pScreen)->Composite; - - if (srcWin && IsFramedWindow(srcWin)) - RootlessStartDrawing(srcWin); - if (maskWin && IsFramedWindow(maskWin)) - RootlessStartDrawing(maskWin); - if (dstWin && IsFramedWindow(dstWin)) - RootlessStartDrawing(dstWin); - - ps->Composite(op, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); - - if (dstWin && IsFramedWindow(dstWin)) { - RootlessDamageRect(dstWin, xDst, yDst, width, height); - } - - ps->Composite = RootlessComposite; - // SCREEN_WRAP(ps, Composite); -} - -static void -RootlessGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, - int nlist, GlyphListPtr list, GlyphPtr * glyphs) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - PictureScreenPtr ps = GetPictureScreen(pScreen); - int x, y; - int n; - GlyphPtr glyph; - WindowPtr srcWin, dstWin; - - srcWin = (pSrc->pDrawable && pSrc->pDrawable->type == DRAWABLE_WINDOW) ? - (WindowPtr) pSrc->pDrawable : NULL; - dstWin = (pDst->pDrawable->type == DRAWABLE_WINDOW) ? - (WindowPtr) pDst->pDrawable : NULL; - - if (srcWin && IsFramedWindow(srcWin)) - RootlessStartDrawing(srcWin); - if (dstWin && IsFramedWindow(dstWin)) - RootlessStartDrawing(dstWin); - - //SCREEN_UNWRAP(ps, Glyphs); - ps->Glyphs = SCREENREC(pScreen)->Glyphs; - ps->Glyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); - ps->Glyphs = RootlessGlyphs; - //SCREEN_WRAP(ps, Glyphs); - - if (dstWin && IsFramedWindow(dstWin)) { - x = xSrc; - y = ySrc; - - while (nlist--) { - x += list->xOff; - y += list->yOff; - n = list->len; - - /* Calling DamageRect for the bounding box of each glyph is - inefficient. So compute the union of all glyphs in a list - and damage that. */ - - if (n > 0) { - BoxRec box; - - glyph = *glyphs++; - - box.x1 = x - glyph->info.x; - box.y1 = y - glyph->info.y; - box.x2 = box.x1 + glyph->info.width; - box.y2 = box.y1 + glyph->info.height; - - x += glyph->info.xOff; - y += glyph->info.yOff; - - while (--n > 0) { - short x1, y1, x2, y2; - - glyph = *glyphs++; - - x1 = x - glyph->info.x; - y1 = y - glyph->info.y; - x2 = x1 + glyph->info.width; - y2 = y1 + glyph->info.height; - - box.x1 = max(box.x1, x1); - box.y1 = max(box.y1, y1); - box.x2 = max(box.x2, x2); - box.y2 = max(box.y2, y2); - - x += glyph->info.xOff; - y += glyph->info.yOff; - } - - RootlessDamageBox(dstWin, &box); - } - list++; - } - } -} - -/* - * RootlessValidateTree - * ValidateTree is modified in two ways: - * - top-level windows don't clip each other - * - windows aren't clipped against root. - * These only matter when validating from the root. - */ -static int -RootlessValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) -{ - int result; - RegionRec saveRoot; - ScreenPtr pScreen = pParent->drawable.pScreen; - - SCREEN_UNWRAP(pScreen, ValidateTree); - RL_DEBUG_MSG("VALIDATETREE start "); - - // Use our custom version to validate from root - if (IsRoot(pParent)) { - RL_DEBUG_MSG("custom "); - result = RootlessMiValidateTree(pParent, pChild, kind); - } - else { - HUGE_ROOT(pParent); - result = pScreen->ValidateTree(pParent, pChild, kind); - NORMAL_ROOT(pParent); - } - - SCREEN_WRAP(pScreen, ValidateTree); - RL_DEBUG_MSG("VALIDATETREE end\n"); - - return result; -} - -/* - * RootlessMarkOverlappedWindows - * MarkOverlappedWindows is modified to ignore overlapping - * top-level windows. - */ -static Bool -RootlessMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst, - WindowPtr *ppLayerWin) -{ - RegionRec saveRoot; - Bool result; - ScreenPtr pScreen = pWin->drawable.pScreen; - - SCREEN_UNWRAP(pScreen, MarkOverlappedWindows); - RL_DEBUG_MSG("MARKOVERLAPPEDWINDOWS start "); - - HUGE_ROOT(pWin); - if (IsRoot(pWin)) { - // root - mark nothing - RL_DEBUG_MSG("is root not marking "); - result = FALSE; - } - else if (!IsTopLevel(pWin)) { - // not top-level window - mark normally - result = pScreen->MarkOverlappedWindows(pWin, pFirst, ppLayerWin); - } - else { - //top-level window - mark children ONLY - NO overlaps with sibs (?) - // This code copied from miMarkOverlappedWindows() - - register WindowPtr pChild; - Bool anyMarked = FALSE; - MarkWindowProcPtr MarkWindow = pScreen->MarkWindow; - - RL_DEBUG_MSG("is top level! "); - /* single layered systems are easy */ - if (ppLayerWin) - *ppLayerWin = pWin; - - if (pWin == pFirst) { - /* Blindly mark pWin and all of its inferiors. This is a slight - * overkill if there are mapped windows that outside pWin's border, - * but it's better than wasting time on RectIn checks. - */ - pChild = pWin; - while (1) { - if (pChild->viewable) { - if (RegionBroken(&pChild->winSize)) - SetWinSize(pChild); - if (RegionBroken(&pChild->borderSize)) - SetBorderSize(pChild); - (*MarkWindow) (pChild); - if (pChild->firstChild) { - pChild = pChild->firstChild; - continue; - } - } - while (!pChild->nextSib && (pChild != pWin)) - pChild = pChild->parent; - if (pChild == pWin) - break; - pChild = pChild->nextSib; - } - anyMarked = TRUE; - } - if (anyMarked) - (*MarkWindow) (pWin->parent); - result = anyMarked; - } - NORMAL_ROOT(pWin); - SCREEN_WRAP(pScreen, MarkOverlappedWindows); - RL_DEBUG_MSG("MARKOVERLAPPEDWINDOWS end\n"); - - return result; -} - -static void -expose_1(WindowPtr pWin) -{ - WindowPtr pChild; - - if (!pWin->realized) - return; - - pWin->drawable.pScreen->PaintWindow(pWin, &pWin->borderClip, PW_BACKGROUND); - - /* FIXME: comments in windowstr.h indicate that borderClip doesn't - include subwindow visibility. But I'm not so sure.. so we may - be exposing too much.. */ - - miSendExposures(pWin, &pWin->borderClip, - pWin->drawable.x, pWin->drawable.y); - - for (pChild = pWin->firstChild; pChild != NULL; pChild = pChild->nextSib) - expose_1(pChild); -} - -void -RootlessScreenExpose(ScreenPtr pScreen) -{ - expose_1(pScreen->root); -} - -ColormapPtr -RootlessGetColormap(ScreenPtr pScreen) -{ - RootlessScreenRec *s = SCREENREC(pScreen); - - return s->colormap; -} - -static void -RootlessInstallColormap(ColormapPtr pMap) -{ - ScreenPtr pScreen = pMap->pScreen; - RootlessScreenRec *s = SCREENREC(pScreen); - - SCREEN_UNWRAP(pScreen, InstallColormap); - - if (s->colormap != pMap) { - s->colormap = pMap; - s->colormap_changed = TRUE; - RootlessQueueRedisplay(pScreen); - } - - pScreen->InstallColormap(pMap); - - SCREEN_WRAP(pScreen, InstallColormap); -} - -static void -RootlessUninstallColormap(ColormapPtr pMap) -{ - ScreenPtr pScreen = pMap->pScreen; - RootlessScreenRec *s = SCREENREC(pScreen); - - SCREEN_UNWRAP(pScreen, UninstallColormap); - - if (s->colormap == pMap) - s->colormap = NULL; - - pScreen->UninstallColormap(pMap); - - SCREEN_WRAP(pScreen, UninstallColormap); -} - -static void -RootlessStoreColors(ColormapPtr pMap, int ndef, xColorItem * pdef) -{ - ScreenPtr pScreen = pMap->pScreen; - RootlessScreenRec *s = SCREENREC(pScreen); - - SCREEN_UNWRAP(pScreen, StoreColors); - - if (s->colormap == pMap && ndef > 0) { - s->colormap_changed = TRUE; - RootlessQueueRedisplay(pScreen); - } - - pScreen->StoreColors(pMap, ndef, pdef); - - SCREEN_WRAP(pScreen, StoreColors); -} - -static CARD32 -RootlessRedisplayCallback(OsTimerPtr timer, CARD32 time, void *arg) -{ - RootlessScreenRec *screenRec = arg; - - if (!screenRec->redisplay_queued) { - /* No update needed. Stop the timer. */ - - screenRec->redisplay_timer_set = FALSE; - return 0; - } - - screenRec->redisplay_queued = FALSE; - - /* Mark that we should redisplay before waiting for I/O next time */ - screenRec->redisplay_expired = TRUE; - - /* Reinstall the timer immediately, so we get as close to our - redisplay interval as possible. */ - - return ROOTLESS_REDISPLAY_DELAY; -} - -/* - * RootlessQueueRedisplay - * Queue a redisplay after a timer delay to ensure we do not redisplay - * too frequently. - */ -void -RootlessQueueRedisplay(ScreenPtr pScreen) -{ - RootlessScreenRec *screenRec = SCREENREC(pScreen); - - screenRec->redisplay_queued = TRUE; - - if (screenRec->redisplay_timer_set) - return; - - screenRec->redisplay_timer = TimerSet(screenRec->redisplay_timer, - 0, ROOTLESS_REDISPLAY_DELAY, - RootlessRedisplayCallback, screenRec); - screenRec->redisplay_timer_set = TRUE; -} - -/* - * RootlessBlockHandler - * If the redisplay timer has expired, flush drawing before blocking - * on select(). - */ -static void -RootlessBlockHandler(void *pbdata, void *ptimeout) -{ - ScreenPtr pScreen = pbdata; - RootlessScreenRec *screenRec = SCREENREC(pScreen); - - if (screenRec->redisplay_expired) { - screenRec->redisplay_expired = FALSE; - - RootlessRedisplayScreen(pScreen); - } -} - -static void -RootlessWakeupHandler(void *data, int result) -{ - // nothing here -} - -static Bool -RootlessAllocatePrivates(ScreenPtr pScreen) -{ - RootlessScreenRec *s; - - if (!dixRegisterPrivateKey - (&rootlessGCPrivateKeyRec, PRIVATE_GC, sizeof(RootlessGCRec))) - return FALSE; - if (!dixRegisterPrivateKey(&rootlessScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) - return FALSE; - if (!dixRegisterPrivateKey(&rootlessWindowPrivateKeyRec, PRIVATE_WINDOW, 0)) - return FALSE; - if (!dixRegisterPrivateKey - (&rootlessWindowOldPixmapPrivateKeyRec, PRIVATE_WINDOW, 0)) - return FALSE; - - s = malloc(sizeof(RootlessScreenRec)); - if (!s) - return FALSE; - SETSCREENREC(pScreen, s); - - s->pixmap_data = NULL; - s->pixmap_data_size = 0; - - s->redisplay_timer = NULL; - s->redisplay_timer_set = FALSE; - - return TRUE; -} - -static void -RootlessWrap(ScreenPtr pScreen) -{ - RootlessScreenRec *s = SCREENREC(pScreen); - -#define WRAP(a) \ - if (pScreen->a) { \ - s->a = pScreen->a; \ - } else { \ - RL_DEBUG_MSG("null screen fn " #a "\n"); \ - s->a = NULL; \ - } \ - pScreen->a = Rootless##a - - WRAP(CreateScreenResources); - WRAP(CloseScreen); - WRAP(CreateGC); - WRAP(CopyWindow); - WRAP(PaintWindow); - WRAP(GetImage); - WRAP(SourceValidate); - WRAP(CreateWindow); - WRAP(DestroyWindow); - WRAP(RealizeWindow); - WRAP(UnrealizeWindow); - WRAP(MoveWindow); - WRAP(PositionWindow); - WRAP(ResizeWindow); - WRAP(RestackWindow); - WRAP(ReparentWindow); - WRAP(ChangeBorderWidth); - WRAP(MarkOverlappedWindows); - WRAP(ValidateTree); - WRAP(ChangeWindowAttributes); - WRAP(InstallColormap); - WRAP(UninstallColormap); - WRAP(StoreColors); - - WRAP(SetShape); - - { - // Composite and Glyphs don't use normal screen wrapping - PictureScreenPtr ps = GetPictureScreen(pScreen); - - s->Composite = ps->Composite; - ps->Composite = RootlessComposite; - s->Glyphs = ps->Glyphs; - ps->Glyphs = RootlessGlyphs; - } - - // WRAP(ClearToBackground); fixme put this back? useful for shaped wins? - -#undef WRAP -} - -/* - * RootlessInit - * Called by the rootless implementation to initialize the rootless layer. - * Rootless wraps lots of stuff and needs a bunch of devPrivates. - */ -Bool -RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs) -{ - RootlessScreenRec *s; - - if (!RootlessAllocatePrivates(pScreen)) - return FALSE; - - s = SCREENREC(pScreen); - - s->imp = procs; - s->colormap = NULL; - s->redisplay_expired = FALSE; - - RootlessWrap(pScreen); - - if (!RegisterBlockAndWakeupHandlers(RootlessBlockHandler, - RootlessWakeupHandler, - (void *) pScreen)) { - return FALSE; - } - - return TRUE; -} - -void -RootlessUpdateRooted(Bool state) -{ - int i; - - if (!state) { - for (i = 0; i < screenInfo.numScreens; i++) - RootlessDisableRoot(screenInfo.screens[i]); - } - else { - for (i = 0; i < screenInfo.numScreens; i++) - RootlessEnableRoot(screenInfo.screens[i]); - } -} diff --git a/miext/rootless/rootlessValTree.c b/miext/rootless/rootlessValTree.c deleted file mode 100644 index 409e6a092..000000000 --- a/miext/rootless/rootlessValTree.c +++ /dev/null @@ -1,529 +0,0 @@ -/* - * Calculate window clip lists for rootless mode - * - * This file is very closely based on mivaltree.c. - */ - -/* - * mivaltree.c -- - * Functions for recalculating window clip lists. Main function - * is miValidateTree. - * - -Copyright 1987, 1988, 1989, 1998 The Open Group - -All Rights Reserved. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - * - * Copyright 1987, 1988, 1989 by - * Digital Equipment Corporation, Maynard, Massachusetts, - * - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * 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 Digital not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * DIGITAL 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. - * - ******************************************************************/ - -/* The panoramix components contained the following notice */ -/***************************************************************** - -Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Digital Equipment Corporation -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from Digital -Equipment Corporation. - -******************************************************************/ - /* - * Aug '86: Susan Angebranndt -- original code - * July '87: Adam de Boor -- substantially modified and commented - * Summer '89: Joel McCormack -- so fast you wouldn't believe it possible. - * In particular, much improved code for window mapping and - * circulating. - * Bob Scheifler -- avoid miComputeClips for unmapped windows, - * valdata changes - */ -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include /* For NULL */ -#include -#include "scrnintstr.h" -#include "validate.h" -#include "windowstr.h" -#include "mi.h" -#include "regionstr.h" -#include "mivalidate.h" - -#include "globals.h" - -int RootlessMiValidateTree(WindowPtr pRoot, WindowPtr pChild, VTKind kind); - -#define HasParentRelativeBorder(w) (!(w)->borderIsPixel && \ - HasBorder(w) && \ - (w)->backgroundState == ParentRelative) - -/* - *----------------------------------------------------------------------- - * RootlessComputeClips -- - * Recompute the clipList, borderClip, exposed and borderExposed - * regions for pParent and its children. Only viewable windows are - * taken into account. - * - * Results: - * None. - * - * Side Effects: - * clipList, borderClip, exposed and borderExposed are altered. - * A VisibilityNotify event may be generated on the parent window. - * - *----------------------------------------------------------------------- - */ -static void -RootlessComputeClips(WindowPtr pParent, ScreenPtr pScreen, - RegionPtr universe, VTKind kind, RegionPtr exposed) -{ - int dx, dy; - RegionRec childUniverse; - register WindowPtr pChild; - int oldVis, newVis; - BoxRec borderSize; - RegionRec childUnion; - Bool overlap; - RegionPtr borderVisible; - - /* - * Figure out the new visibility of this window. - * The extent of the universe should be the same as the extent of - * the borderSize region. If the window is unobscured, this rectangle - * will be completely inside the universe (the universe will cover it - * completely). If the window is completely obscured, none of the - * universe will cover the rectangle. - */ - borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent); - borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent); - dx = (int) pParent->drawable.x + (int) pParent->drawable.width + - wBorderWidth(pParent); - if (dx > 32767) - dx = 32767; - borderSize.x2 = dx; - dy = (int) pParent->drawable.y + (int) pParent->drawable.height + - wBorderWidth(pParent); - if (dy > 32767) - dy = 32767; - borderSize.y2 = dy; - - oldVis = pParent->visibility; - switch (RegionContainsRect(universe, &borderSize)) { - case rgnIN: - newVis = VisibilityUnobscured; - break; - case rgnPART: - newVis = VisibilityPartiallyObscured; - { - RegionPtr pBounding; - - if ((pBounding = wBoundingShape(pParent))) { - switch (miShapedWindowIn(universe, pBounding, &borderSize, - pParent->drawable.x, - pParent->drawable.y)) { - case rgnIN: - newVis = VisibilityUnobscured; - break; - case rgnOUT: - newVis = VisibilityFullyObscured; - break; - } - } - } - break; - default: - newVis = VisibilityFullyObscured; - break; - } - - pParent->visibility = newVis; - if (oldVis != newVis && - ((pParent-> - eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask)) - SendVisibilityNotify(pParent); - - dx = pParent->drawable.x - pParent->valdata->before.oldAbsCorner.x; - dy = pParent->drawable.y - pParent->valdata->before.oldAbsCorner.y; - - /* - * avoid computations when dealing with simple operations - */ - - switch (kind) { - case VTMap: - case VTStack: - case VTUnmap: - break; - case VTMove: - if ((oldVis == newVis) && - ((oldVis == VisibilityFullyObscured) || - (oldVis == VisibilityUnobscured))) { - pChild = pParent; - while (1) { - if (pChild->viewable) { - if (pChild->visibility != VisibilityFullyObscured) { - RegionTranslate(&pChild->borderClip, dx, dy); - RegionTranslate(&pChild->clipList, dx, dy); - pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER; - if (pScreen->ClipNotify) - (*pScreen->ClipNotify) (pChild, dx, dy); - - } - if (pChild->valdata) { - RegionNull(&pChild->valdata->after.borderExposed); - if (HasParentRelativeBorder(pChild)) { - RegionSubtract(&pChild->valdata->after. - borderExposed, &pChild->borderClip, - &pChild->winSize); - } - RegionNull(&pChild->valdata->after.exposed); - } - if (pChild->firstChild) { - pChild = pChild->firstChild; - continue; - } - } - while (!pChild->nextSib && (pChild != pParent)) - pChild = pChild->parent; - if (pChild == pParent) - break; - pChild = pChild->nextSib; - } - return; - } - /* fall through */ - default: - /* - * To calculate exposures correctly, we have to translate the old - * borderClip and clipList regions to the window's new location so there - * is a correspondence between pieces of the new and old clipping regions. - */ - if (dx || dy) { - /* - * We translate the old clipList because that will be exposed or copied - * if gravity is right. - */ - RegionTranslate(&pParent->borderClip, dx, dy); - RegionTranslate(&pParent->clipList, dx, dy); - } - break; - case VTBroken: - RegionEmpty(&pParent->borderClip); - RegionEmpty(&pParent->clipList); - break; - } - - borderVisible = pParent->valdata->before.borderVisible; - RegionNull(&pParent->valdata->after.borderExposed); - RegionNull(&pParent->valdata->after.exposed); - - /* - * Since the borderClip must not be clipped by the children, we do - * the border exposure first... - * - * 'universe' is the window's borderClip. To figure the exposures, remove - * the area that used to be exposed from the new. - * This leaves a region of pieces that weren't exposed before. - */ - - if (HasBorder(pParent)) { - if (borderVisible) { - /* - * when the border changes shape, the old visible portions - * of the border will be saved by DIX in borderVisible -- - * use that region and destroy it - */ - RegionSubtract(exposed, universe, borderVisible); - RegionDestroy(borderVisible); - } - else { - RegionSubtract(exposed, universe, &pParent->borderClip); - } - if (HasParentRelativeBorder(pParent) && (dx || dy)) { - RegionSubtract(&pParent->valdata->after.borderExposed, - universe, &pParent->winSize); - } - else { - RegionSubtract(&pParent->valdata->after.borderExposed, - exposed, &pParent->winSize); - } - - RegionCopy(&pParent->borderClip, universe); - - /* - * To get the right clipList for the parent, and to make doubly sure - * that no child overlaps the parent's border, we remove the parent's - * border from the universe before proceeding. - */ - - RegionIntersect(universe, universe, &pParent->winSize); - } - else - RegionCopy(&pParent->borderClip, universe); - - if ((pChild = pParent->firstChild) && pParent->mapped) { - RegionNull(&childUniverse); - RegionNull(&childUnion); - if ((pChild->drawable.y < pParent->lastChild->drawable.y) || - ((pChild->drawable.y == pParent->lastChild->drawable.y) && - (pChild->drawable.x < pParent->lastChild->drawable.x))) { - for (; pChild; pChild = pChild->nextSib) { - if (pChild->viewable) - RegionAppend(&childUnion, &pChild->borderSize); - } - } - else { - for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib) { - if (pChild->viewable) - RegionAppend(&childUnion, &pChild->borderSize); - } - } - RegionValidate(&childUnion, &overlap); - - for (pChild = pParent->firstChild; pChild; pChild = pChild->nextSib) { - if (pChild->viewable) { - /* - * If the child is viewable, we want to remove its extents - * from the current universe, but we only re-clip it if - * it's been marked. - */ - if (pChild->valdata) { - /* - * Figure out the new universe from the child's - * perspective and recurse. - */ - RegionIntersect(&childUniverse, - universe, &pChild->borderSize); - RootlessComputeClips(pChild, pScreen, &childUniverse, - kind, exposed); - } - /* - * Once the child has been processed, we remove its extents - * from the current universe, thus denying its space to any - * other sibling. - */ - if (overlap) - RegionSubtract(universe, universe, &pChild->borderSize); - } - } - if (!overlap) - RegionSubtract(universe, universe, &childUnion); - RegionUninit(&childUnion); - RegionUninit(&childUniverse); - } /* if any children */ - - /* - * 'universe' now contains the new clipList for the parent window. - * - * To figure the exposure of the window we subtract the old clip from the - * new, just as for the border. - */ - - if (oldVis == VisibilityFullyObscured || oldVis == VisibilityNotViewable) { - RegionCopy(&pParent->valdata->after.exposed, universe); - } - else if (newVis != VisibilityFullyObscured && - newVis != VisibilityNotViewable) { - RegionSubtract(&pParent->valdata->after.exposed, - universe, &pParent->clipList); - } - - /* HACK ALERT - copying contents of regions, instead of regions */ - { - RegionRec tmp; - - tmp = pParent->clipList; - pParent->clipList = *universe; - *universe = tmp; - } - -#ifdef NOTDEF - RegionCopy(&pParent->clipList, universe); -#endif - - pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; - - if (pScreen->ClipNotify) - (*pScreen->ClipNotify) (pParent, dx, dy); -} - -static void -RootlessTreeObscured(WindowPtr pParent) -{ - register WindowPtr pChild; - register int oldVis; - - pChild = pParent; - while (1) { - if (pChild->viewable) { - oldVis = pChild->visibility; - if (oldVis != (pChild->visibility = VisibilityFullyObscured) && - ((pChild-> - eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask)) - SendVisibilityNotify(pChild); - if (pChild->firstChild) { - pChild = pChild->firstChild; - continue; - } - } - while (!pChild->nextSib && (pChild != pParent)) - pChild = pChild->parent; - if (pChild == pParent) - break; - pChild = pChild->nextSib; - } -} - -/* - *----------------------------------------------------------------------- - * RootlessMiValidateTree -- - * Recomputes the clip list for pParent and all its inferiors. - * - * Results: - * Always returns 1. - * - * Side Effects: - * The clipList, borderClip, exposed, and borderExposed regions for - * each marked window are altered. - * - * Notes: - * This routine assumes that all affected windows have been marked - * (valdata created) and their winSize and borderSize regions - * adjusted to correspond to their new positions. The borderClip and - * clipList regions should not have been touched. - * - * The top-most level is treated differently from all lower levels - * because pParent is unchanged. For the top level, we merge the - * regions taken up by the marked children back into the clipList - * for pParent, thus forming a region from which the marked children - * can claim their areas. For lower levels, where the old clipList - * and borderClip are invalid, we can't do this and have to do the - * extra operations done in miComputeClips, but this is much faster - * e.g. when only one child has moved... - * - *----------------------------------------------------------------------- - */ -/* - Quartz version: used for validate from root in rootless mode. - We need to make sure top-level windows don't clip each other, - and that top-level windows aren't clipped to the root window. -*/ - /*ARGSUSED*/ -// fixme this is ugly -// Xprint/ValTree.c doesn't work, but maybe that method can? - int -RootlessMiValidateTree(WindowPtr pRoot, /* Parent to validate */ - WindowPtr pChild, /* First child of pRoot that was - * affected */ - VTKind kind /* What kind of configuration caused call */ - ) -{ - RegionRec childClip; /* The new borderClip for the current - * child */ - RegionRec exposed; /* For intermediate calculations */ - register ScreenPtr pScreen; - register WindowPtr pWin; - - pScreen = pRoot->drawable.pScreen; - if (pChild == NullWindow) - pChild = pRoot->firstChild; - - RegionNull(&childClip); - RegionNull(&exposed); - - if (RegionBroken(&pRoot->clipList) && !RegionBroken(&pRoot->borderClip)) { - // fixme this might not work, but hopefully doesn't happen anyway. - kind = VTBroken; - RegionNull(&pRoot->clipList); - ErrorF("ValidateTree: BUSTED!\n"); - } - - /* - * Recursively compute the clips for all children of the root. - * They don't clip against each other or the root itself, so - * childClip is always reset to that child's size. - */ - - for (pWin = pChild; pWin != NullWindow; pWin = pWin->nextSib) { - if (pWin->viewable) { - if (pWin->valdata) { - RegionCopy(&childClip, &pWin->borderSize); - RootlessComputeClips(pWin, pScreen, &childClip, kind, &exposed); - } - else if (pWin->visibility == VisibilityNotViewable) { - RootlessTreeObscured(pWin); - } - } - else { - if (pWin->valdata) { - RegionEmpty(&pWin->clipList); - if (pScreen->ClipNotify) - (*pScreen->ClipNotify) (pWin, 0, 0); - RegionEmpty(&pWin->borderClip); - pWin->valdata = NULL; - } - } - } - - RegionUninit(&childClip); - - /* The root is never clipped by its children, so nothing on the root - is ever exposed by moving or mapping its children. */ - RegionNull(&pRoot->valdata->after.exposed); - RegionNull(&pRoot->valdata->after.borderExposed); - - return 1; -} diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c deleted file mode 100644 index 643dedff6..000000000 --- a/miext/rootless/rootlessWindow.c +++ /dev/null @@ -1,1352 +0,0 @@ -/* - * Rootless window management - */ -/* - * Copyright (c) 2001 Greg Parker. All Rights Reserved. - * Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved. - * Copyright (c) 2002 Apple Computer, Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include /* For NULL */ -#include /* For CHAR_BIT */ -#include -#include -#ifdef __APPLE__ -#include -#include "mi.h" -#include "pixmapstr.h" -#include "windowstr.h" -//#include -extern int darwinMainScreenX, darwinMainScreenY; -extern Bool no_configure_window; -#endif -#include "fb.h" - -#include "rootlessCommon.h" -#include "rootlessWindow.h" - -#define SCREEN_TO_GLOBAL_X \ - (pScreen->x + rootlessGlobalOffsetX) -#define SCREEN_TO_GLOBAL_Y \ - (pScreen->y + rootlessGlobalOffsetY) - -#define DEFINE_ATOM_HELPER(func,atom_name) \ - static Atom func (void) { \ - static unsigned int generation = 0; \ - static Atom atom; \ - if (generation != serverGeneration) { \ - generation = serverGeneration; \ - atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \ - } \ - return atom; \ - } - -DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID") - -static Bool windows_hidden; - -// TODO - abstract xp functions - -#ifdef __APPLE__ - -// XXX: identical to x_cvt_vptr_to_uint ? -#define MAKE_WINDOW_ID(x) ((xp_window_id)((size_t)(x))) - -void -RootlessNativeWindowStateChanged(WindowPtr pWin, unsigned int state) -{ - RootlessWindowRec *winRec; - - if (pWin == NULL) - return; - - winRec = WINREC(pWin); - if (winRec == NULL) - return; - - winRec->is_offscreen = ((state & XP_WINDOW_STATE_OFFSCREEN) != 0); - winRec->is_obscured = ((state & XP_WINDOW_STATE_OBSCURED) != 0); - pWin->unhittable = winRec->is_offscreen; -} - -void -RootlessNativeWindowMoved(WindowPtr pWin) -{ - xp_box bounds; - int sx, sy, err; - XID vlist[2]; - Mask mask; - ClientPtr pClient; - RootlessWindowRec *winRec; - - winRec = WINREC(pWin); - - if (xp_get_window_bounds(MAKE_WINDOW_ID(winRec->wid), &bounds) != Success) - return; - - sx = pWin->drawable.pScreen->x + darwinMainScreenX; - sy = pWin->drawable.pScreen->y + darwinMainScreenY; - - /* Fake up a ConfigureWindow packet to resize the window to the current bounds. */ - vlist[0] = (INT16) bounds.x1 - sx; - vlist[1] = (INT16) bounds.y1 - sy; - mask = CWX | CWY; - - /* pretend we're the owner of the window! */ - err = - dixLookupClient(&pClient, pWin->drawable.id, serverClient, - DixUnknownAccess); - if (err != Success) { - ErrorF("RootlessNativeWindowMoved(): Failed to lookup window: 0x%x\n", - (unsigned int) pWin->drawable.id); - return; - } - - /* Don't want to do anything to the physical window (avoids - notification-response feedback loops) */ - - no_configure_window = TRUE; - ConfigureWindow(pWin, mask, vlist, pClient); - no_configure_window = FALSE; -} - -#endif /* __APPLE__ */ - -/* - * RootlessCreateWindow - * For now, don't create a physical window until either the window is - * realized, or we really need it (e.g. to attach VRAM surfaces to). - * Do reset the window size so it's not clipped by the root window. - */ -Bool -RootlessCreateWindow(WindowPtr pWin) -{ - Bool result; - RegionRec saveRoot; - - SETWINREC(pWin, NULL); - dixSetPrivate(&pWin->devPrivates, rootlessWindowOldPixmapPrivateKey, NULL); - - SCREEN_UNWRAP(pWin->drawable.pScreen, CreateWindow); - - if (!IsRoot(pWin)) { - /* win/border size set by DIX, not by wrapped CreateWindow, so - correct it here. Don't HUGE_ROOT when pWin is the root! */ - - HUGE_ROOT(pWin); - SetWinSize(pWin); - SetBorderSize(pWin); - } - - result = pWin->drawable.pScreen->CreateWindow(pWin); - - if (pWin->parent) { - NORMAL_ROOT(pWin); - } - - SCREEN_WRAP(pWin->drawable.pScreen, CreateWindow); - - return result; -} - -/* - * RootlessDestroyFrame - * Destroy the physical window associated with the given window. - */ -static void -RootlessDestroyFrame(WindowPtr pWin, RootlessWindowPtr winRec) -{ - SCREENREC(pWin->drawable.pScreen)->imp->DestroyFrame(winRec->wid); - free(winRec); - SETWINREC(pWin, NULL); -} - -/* - * RootlessDestroyWindow - * Destroy the physical window associated with the given window. - */ -Bool -RootlessDestroyWindow(WindowPtr pWin) -{ - RootlessWindowRec *winRec = WINREC(pWin); - Bool result; - - if (winRec != NULL) { - RootlessDestroyFrame(pWin, winRec); - } - - SCREEN_UNWRAP(pWin->drawable.pScreen, DestroyWindow); - result = pWin->drawable.pScreen->DestroyWindow(pWin); - SCREEN_WRAP(pWin->drawable.pScreen, DestroyWindow); - - return result; -} - -static Bool -RootlessGetShape(WindowPtr pWin, RegionPtr pShape) -{ - if (wBoundingShape(pWin) == NULL) - return FALSE; - - /* wBoundingShape is relative to *inner* origin of window. - Translate by borderWidth to get the outside-relative position. */ - - RegionNull(pShape); - RegionCopy(pShape, wBoundingShape(pWin)); - RegionTranslate(pShape, pWin->borderWidth, pWin->borderWidth); - - return TRUE; -} - -/* - * RootlessReshapeFrame - * Set the frame shape. - */ -static void -RootlessReshapeFrame(WindowPtr pWin) -{ - RootlessWindowRec *winRec = WINREC(pWin); - RegionRec newShape; - RegionPtr pShape; - - // If the window is not yet framed, do nothing - if (winRec == NULL) - return; - - if (IsRoot(pWin)) - return; - - RootlessStopDrawing(pWin, FALSE); - - pShape = RootlessGetShape(pWin, &newShape) ? &newShape : NULL; - -#ifdef ROOTLESSDEBUG - RL_DEBUG_MSG("reshaping..."); - if (pShape != NULL) { - RL_DEBUG_MSG("numrects %d, extents %d %d %d %d ", - RegionNumRects(&newShape), - newShape.extents.x1, newShape.extents.y1, - newShape.extents.x2, newShape.extents.y2); - } - else { - RL_DEBUG_MSG("no shape "); - } -#endif - - SCREENREC(pWin->drawable.pScreen)->imp->ReshapeFrame(winRec->wid, pShape); - - if (pShape != NULL) - RegionUninit(&newShape); -} - -/* - * RootlessSetShape - * Shape is usually set before a window is mapped and the window will - * not have a frame associated with it. In this case, the frame will be - * shaped when the window is framed. - */ -void -RootlessSetShape(WindowPtr pWin, int kind) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - - SCREEN_UNWRAP(pScreen, SetShape); - pScreen->SetShape(pWin, kind); - SCREEN_WRAP(pScreen, SetShape); - - RootlessReshapeFrame(pWin); -} - -/* Disallow ParentRelative background on top-level windows - because the root window doesn't really have the right background. - */ -Bool -RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask) -{ - Bool result; - ScreenPtr pScreen = pWin->drawable.pScreen; - - RL_DEBUG_MSG("change window attributes start "); - - SCREEN_UNWRAP(pScreen, ChangeWindowAttributes); - result = pScreen->ChangeWindowAttributes(pWin, vmask); - SCREEN_WRAP(pScreen, ChangeWindowAttributes); - - if (WINREC(pWin)) { - // disallow ParentRelative background state - if (pWin->backgroundState == ParentRelative) { - XID pixel = 0; - - ChangeWindowAttributes(pWin, CWBackPixel, &pixel, serverClient); - } - } - - RL_DEBUG_MSG("change window attributes end\n"); - return result; -} - -/* - * RootlessPositionWindow - * This is a hook for when DIX moves or resizes a window. - * Update the frame position now although the physical window is moved - * in RootlessMoveWindow. (x, y) are *inside* position. After this, - * mi and fb are expecting the pixmap to be at the new location. - */ -Bool -RootlessPositionWindow(WindowPtr pWin, int x, int y) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - RootlessWindowRec *winRec = WINREC(pWin); - Bool result; - - RL_DEBUG_MSG("positionwindow start (win %p (%lu) @ %i, %i)\n", pWin, RootlessWID(pWin), x, y); - - if (winRec) { - if (winRec->is_drawing) { - // Reset frame's pixmap and move it to the new position. - int bw = wBorderWidth(pWin); - - winRec->pixmap->devPrivate.ptr = winRec->pixelData; - SetPixmapBaseToScreen(winRec->pixmap, x - bw, y - bw); - } - } - - SCREEN_UNWRAP(pScreen, PositionWindow); - result = pScreen->PositionWindow(pWin, x, y); - SCREEN_WRAP(pScreen, PositionWindow); - - RL_DEBUG_MSG("positionwindow end\n"); - return result; -} - -/* - * RootlessInitializeFrame - * Initialize some basic attributes of the frame. Note that winRec - * may already have valid data in it, so don't overwrite anything - * valuable. - */ -static void -RootlessInitializeFrame(WindowPtr pWin, RootlessWindowRec * winRec) -{ - DrawablePtr d = &pWin->drawable; - int bw = wBorderWidth(pWin); - - winRec->win = pWin; - - winRec->x = d->x - bw; - winRec->y = d->y - bw; - winRec->width = d->width + 2 * bw; - winRec->height = d->height + 2 * bw; - winRec->borderWidth = bw; -} - -/* - * RootlessEnsureFrame - * Make sure the given window is framed. If the window doesn't have a - * physical window associated with it, attempt to create one. If that - * is unsuccessful, return NULL. - */ -static RootlessWindowRec * -RootlessEnsureFrame(WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - RootlessWindowRec *winRec; - RegionRec shape; - RegionPtr pShape = NULL; - - if (WINREC(pWin) != NULL) - return WINREC(pWin); - - if (!IsTopLevel(pWin) && !IsRoot(pWin)) - return NULL; - - if (pWin->drawable.class != InputOutput) - return NULL; - - winRec = malloc(sizeof(RootlessWindowRec)); - - if (!winRec) - return NULL; - - RootlessInitializeFrame(pWin, winRec); - - winRec->is_drawing = FALSE; - winRec->is_reorder_pending = FALSE; - winRec->pixmap = NULL; - winRec->wid = NULL; - winRec->level = 0; - - SETWINREC(pWin, winRec); - - // Set the frame's shape if the window is shaped - if (RootlessGetShape(pWin, &shape)) - pShape = &shape; - - RL_DEBUG_MSG("creating frame "); - - if (!SCREENREC(pScreen)->imp->CreateFrame(winRec, pScreen, - winRec->x + SCREEN_TO_GLOBAL_X, - winRec->y + SCREEN_TO_GLOBAL_Y, - pShape)) { - RL_DEBUG_MSG("implementation failed to create frame!\n"); - free(winRec); - SETWINREC(pWin, NULL); - return NULL; - } - - if (pWin->drawable.depth == 8) - RootlessFlushWindowColormap(pWin); - - if (pShape != NULL) - RegionUninit(&shape); - - return winRec; -} - -/* - * RootlessRealizeWindow - * The frame is usually created here and not in CreateWindow so that - * windows do not eat memory until they are realized. - */ -Bool -RootlessRealizeWindow(WindowPtr pWin) -{ - Bool result; - RegionRec saveRoot; - ScreenPtr pScreen = pWin->drawable.pScreen; - - RL_DEBUG_MSG("realizewindow start (win %p (%lu)) ", pWin, RootlessWID(pWin)); - - if ((IsTopLevel(pWin) && pWin->drawable.class == InputOutput)) { - RootlessWindowRec *winRec; - - winRec = RootlessEnsureFrame(pWin); - if (winRec == NULL) - return FALSE; - - winRec->is_reorder_pending = TRUE; - - RL_DEBUG_MSG("Top level window "); - - // Disallow ParentRelative background state on top-level windows. - // This might have been set before the window was mapped. - if (pWin->backgroundState == ParentRelative) { - XID pixel = 0; - - ChangeWindowAttributes(pWin, CWBackPixel, &pixel, serverClient); - } - } - - if (!IsRoot(pWin)) - HUGE_ROOT(pWin); - SCREEN_UNWRAP(pScreen, RealizeWindow); - result = pScreen->RealizeWindow(pWin); - SCREEN_WRAP(pScreen, RealizeWindow); - if (!IsRoot(pWin)) - NORMAL_ROOT(pWin); - - RL_DEBUG_MSG("realizewindow end\n"); - return result; -} - -/* - * RootlessFrameForWindow - * Returns the frame ID for the physical window displaying the given window. - * If CREATE is true and the window has no frame, attempt to create one. - */ -RootlessFrameID -RootlessFrameForWindow(WindowPtr pWin, Bool create) -{ - WindowPtr pTopWin; - RootlessWindowRec *winRec; - - pTopWin = TopLevelParent(pWin); - if (pTopWin == NULL) - return NULL; - - winRec = WINREC(pTopWin); - - if (winRec == NULL && create && pWin->drawable.class == InputOutput) { - winRec = RootlessEnsureFrame(pTopWin); - } - - if (winRec == NULL) - return NULL; - - return winRec->wid; -} - -/* - * RootlessUnrealizeWindow - * Unmap the physical window. - */ -Bool -RootlessUnrealizeWindow(WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - RootlessWindowRec *winRec = WINREC(pWin); - Bool result; - - RL_DEBUG_MSG("unrealizewindow start "); - - if (winRec) { - RootlessStopDrawing(pWin, FALSE); - - SCREENREC(pScreen)->imp->UnmapFrame(winRec->wid); - - winRec->is_reorder_pending = FALSE; - } - - SCREEN_UNWRAP(pScreen, UnrealizeWindow); - result = pScreen->UnrealizeWindow(pWin); - SCREEN_WRAP(pScreen, UnrealizeWindow); - - RL_DEBUG_MSG("unrealizewindow end\n"); - return result; -} - -/* - * RootlessReorderWindow - * Reorder the frame associated with the given window so that it's - * physically above the window below it in the X stacking order. - */ -void -RootlessReorderWindow(WindowPtr pWin) -{ - RootlessWindowRec *winRec = WINREC(pWin); - - if (pWin->realized && winRec != NULL && !winRec->is_reorder_pending && - !windows_hidden) { - WindowPtr newPrevW; - RootlessWindowRec *newPrev; - RootlessFrameID newPrevID; - ScreenPtr pScreen = pWin->drawable.pScreen; - - /* Check if the implementation wants the frame to not be reordered - even though the X11 window is restacked. This can be useful if - frames are ordered-in with animation so that the reordering is not - done until the animation is complete. */ - if (SCREENREC(pScreen)->imp->DoReorderWindow) { - if (!SCREENREC(pScreen)->imp->DoReorderWindow(winRec)) - return; - } - - RootlessStopDrawing(pWin, FALSE); - - /* Find the next window above this one that has a mapped frame. - * Only include cases where the windows are in the same category of - * hittability to ensure offscreen windows don't get restacked - * relative to onscreen ones (but that the offscreen ones maintain - * their stacking order if they are explicitly asked to Reorder). - */ - - newPrevW = pWin->prevSib; - while (newPrevW && - (WINREC(newPrevW) == NULL || !newPrevW->realized || - newPrevW->unhittable != pWin->unhittable)) - newPrevW = newPrevW->prevSib; - - newPrev = newPrevW != NULL ? WINREC(newPrevW) : NULL; - newPrevID = newPrev != NULL ? newPrev->wid : 0; - - /* If it exists, reorder the frame above us first. */ - - if (newPrev && newPrev->is_reorder_pending) { - newPrev->is_reorder_pending = FALSE; - RootlessReorderWindow(newPrevW); - } - - SCREENREC(pScreen)->imp->RestackFrame(winRec->wid, newPrevID); - } -} - -/* - * RootlessRestackWindow - * This is a hook for when DIX changes the window stacking order. - * The window has already been inserted into its new position in the - * DIX window stack. We need to change the order of the physical - * window to match. - */ -void -RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib) -{ - RegionRec saveRoot; - RootlessWindowRec *winRec = WINREC(pWin); - ScreenPtr pScreen = pWin->drawable.pScreen; - - RL_DEBUG_MSG("restackwindow start "); - if (winRec) - RL_DEBUG_MSG("restack top level \n"); - - HUGE_ROOT(pWin); - SCREEN_UNWRAP(pScreen, RestackWindow); - - if (pScreen->RestackWindow) - pScreen->RestackWindow(pWin, pOldNextSib); - - SCREEN_WRAP(pScreen, RestackWindow); - NORMAL_ROOT(pWin); - - if (winRec && pWin->viewable) { - RootlessReorderWindow(pWin); - } - - RL_DEBUG_MSG("restackwindow end\n"); -} - -/* - * Specialized window copy procedures - */ - -// Globals needed during window resize and move. -static CopyWindowProcPtr gResizeOldCopyWindowProc = NULL; - -/* - * RootlessNoCopyWindow - * CopyWindow() that doesn't do anything. For MoveWindow() of - * top-level windows. - */ -static void -RootlessNoCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - // some code expects the region to be translated - int dx = ptOldOrg.x - pWin->drawable.x; - int dy = ptOldOrg.y - pWin->drawable.y; - - RL_DEBUG_MSG("ROOTLESSNOCOPYWINDOW "); - - RegionTranslate(prgnSrc, -dx, -dy); -} - -/* - * RootlessCopyWindow - * Update *new* location of window. Old location is redrawn with - * PaintWindow. Cloned from fbCopyWindow. - * The original always draws on the root pixmap, which we don't have. - * Instead, draw on the parent window's pixmap. - */ -void -RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - RegionRec rgnDst; - int dx, dy; - BoxPtr extents; - int area; - - RL_DEBUG_MSG("copywindowFB start (win %p (%lu)) ", pWin, RootlessWID(pWin)); - - SCREEN_UNWRAP(pScreen, CopyWindow); - - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - RegionTranslate(prgnSrc, -dx, -dy); - - RegionNull(&rgnDst); - RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); - - extents = RegionExtents(&rgnDst); - area = (extents->x2 - extents->x1) * (extents->y2 - extents->y1); - - /* If the area exceeds threshold, use the implementation's - accelerated version. */ - if (area > rootless_CopyWindow_threshold && - SCREENREC(pScreen)->imp->CopyWindow) { - RootlessWindowRec *winRec; - WindowPtr top; - - top = TopLevelParent(pWin); - if (top == NULL) { - RL_DEBUG_MSG("no parent\n"); - goto out; - } - - winRec = WINREC(top); - if (winRec == NULL) { - RL_DEBUG_MSG("not framed\n"); - goto out; - } - - /* Move region to window local coords */ - RegionTranslate(&rgnDst, -winRec->x, -winRec->y); - - RootlessStopDrawing(pWin, FALSE); - - SCREENREC(pScreen)->imp->CopyWindow(winRec->wid, - RegionNumRects(&rgnDst), - RegionRects(&rgnDst), dx, dy); - } - else { - RootlessStartDrawing(pWin); - - PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin); - DrawablePtr pDrawable = &pPixmap->drawable; - - if (pPixmap->screen_x || pPixmap->screen_y) { - RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y); - } - - miCopyRegion(pDrawable, pDrawable, - 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0); - - RootlessDamageRegion(pWin, &rgnDst); - } - - out: - RegionUninit(&rgnDst); - fbValidateDrawable(&pWin->drawable); - - SCREEN_WRAP(pScreen, CopyWindow); - - RL_DEBUG_MSG("copywindowFB end\n"); -} - -void -RootlessPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - - if (IsFramedWindow(pWin)) { - RootlessStartDrawing(pWin); - RootlessDamageRegion(pWin, prgn); - - if (pWin->backgroundState == ParentRelative) { - if ((what == PW_BACKGROUND) || - (what == PW_BORDER && !pWin->borderIsPixel)) - RootlessSetPixmapOfAncestors(pWin); - } - } - - SCREEN_UNWRAP(pScreen, PaintWindow); - pScreen->PaintWindow(pWin, prgn, what); - SCREEN_WRAP(pScreen, PaintWindow); -} - -/* - * Window resize procedures - */ - -enum { - WIDTH_SMALLER = 1, - HEIGHT_SMALLER = 2, -}; - -/* - * ResizeWeighting - * Choose gravity to avoid local copies. Do that by looking for - * a corner that doesn't move _relative to the screen_. - */ -static inline unsigned int -ResizeWeighting(int oldX1, int oldY1, int oldX2, int oldY2, int oldBW, - int newX1, int newY1, int newX2, int newY2, int newBW) -{ - if (newBW != oldBW) - return RL_GRAVITY_NONE; - - if (newX1 == oldX1 && newY1 == oldY1) - return RL_GRAVITY_NORTH_WEST; - else if (newX1 == oldX1 && newY2 == oldY2) - return RL_GRAVITY_SOUTH_WEST; - else if (newX2 == oldX2 && newY2 == oldY2) - return RL_GRAVITY_SOUTH_EAST; - else if (newX2 == oldX2 && newY1 == oldY1) - return RL_GRAVITY_NORTH_EAST; - else - return RL_GRAVITY_NORTH_WEST; -} - -/* - * StartFrameResize - * Prepare to resize a top-level window. The old window's pixels are - * saved and the implementation is told to change the window size. - * (x,y,w,h) is outer frame of window (outside border) - */ -static void -StartFrameResize(WindowPtr pWin, Bool gravity, - int oldX, int oldY, int oldW, int oldH, int oldBW, - int newX, int newY, int newW, int newH, int newBW) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - RootlessWindowRec *winRec = WINREC(pWin); - - BoxRec rect; - int oldX2, newX2; - int oldY2, newY2; - unsigned int weight; - - oldX2 = oldX + oldW, newX2 = newX + newW; - oldY2 = oldY + oldH, newY2 = newY + newH; - - /* Decide which resize weighting to use */ - weight = ResizeWeighting(oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - - /* Compute intersection between old and new rects */ - rect.x1 = max(oldX, newX); - rect.y1 = max(oldY, newY); - rect.x2 = min(oldX2, newX2); - rect.y2 = min(oldY2, newY2); - - RL_DEBUG_MSG("RESIZE TOPLEVEL WINDOW with gravity %i ", gravity); - RL_DEBUG_MSG("%d %d %d %d %d %d %d %d %d %d\n", - oldX, oldY, oldW, oldH, oldBW, newX, newY, newW, newH, newBW); - - RootlessRedisplay(pWin); - - winRec->x = newX; - winRec->y = newY; - winRec->width = newW; - winRec->height = newH; - winRec->borderWidth = newBW; - - SCREENREC(pScreen)->imp->ResizeFrame(winRec->wid, pScreen, - newX + SCREEN_TO_GLOBAL_X, - newY + SCREEN_TO_GLOBAL_Y, - newW, newH, weight); - - RootlessStartDrawing(pWin); - - /* Use custom CopyWindow when moving gravity bits around - ResizeWindow assumes the old window contents are in the same - pixmap, but here they're in deathPix instead. */ - - if (gravity) { - gResizeOldCopyWindowProc = pScreen->CopyWindow; - pScreen->CopyWindow = RootlessNoCopyWindow; - } -} - -static void -FinishFrameResize(WindowPtr pWin, Bool gravity, int oldX, int oldY, - unsigned int oldW, unsigned int oldH, unsigned int oldBW, - int newX, int newY, unsigned int newW, unsigned int newH, - unsigned int newBW) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - RootlessWindowRec *winRec = WINREC(pWin); - int i; - - /* Redraw everything. FIXME: there must be times when we don't need - to do this. Perhaps when top-left weighting and no gravity? */ - - RootlessDamageRect(pWin, -newBW, -newBW, newW, newH); - - if (gravity) { - pScreen->CopyWindow = gResizeOldCopyWindowProc; - } -} - -/* - * RootlessMoveWindow - * If kind==VTOther, window border is resizing (and borderWidth is - * already changed!!@#$) This case works like window resize, not move. - */ -void -RootlessMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind) -{ - RootlessWindowRec *winRec = WINREC(pWin); - ScreenPtr pScreen = pWin->drawable.pScreen; - CopyWindowProcPtr oldCopyWindowProc = NULL; - int oldX = 0, oldY = 0, newX = 0, newY = 0; - unsigned int oldW = 0, oldH = 0, oldBW = 0; - unsigned int newW = 0, newH = 0, newBW = 0; - RegionRec saveRoot; - - RL_DEBUG_MSG("movewindow start \n"); - - if (winRec) { - if (kind == VTMove) { - oldX = winRec->x; - oldY = winRec->y; - RootlessRedisplay(pWin); - RootlessStartDrawing(pWin); - } - else { - RL_DEBUG_MSG("movewindow border resizing "); - - oldBW = winRec->borderWidth; - oldX = winRec->x; - oldY = winRec->y; - oldW = winRec->width; - oldH = winRec->height; - - newBW = wBorderWidth(pWin); - newX = x; - newY = y; - newW = pWin->drawable.width + 2 * newBW; - newH = pWin->drawable.height + 2 * newBW; - - StartFrameResize(pWin, FALSE, - oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - } - } - - HUGE_ROOT(pWin); - SCREEN_UNWRAP(pScreen, MoveWindow); - - if (winRec) { - oldCopyWindowProc = pScreen->CopyWindow; - pScreen->CopyWindow = RootlessNoCopyWindow; - } - pScreen->MoveWindow(pWin, x, y, pSib, kind); - if (winRec) { - pScreen->CopyWindow = oldCopyWindowProc; - } - - NORMAL_ROOT(pWin); - SCREEN_WRAP(pScreen, MoveWindow); - - if (winRec) { - if (kind == VTMove) { - winRec->x = x; - winRec->y = y; - RootlessStopDrawing(pWin, FALSE); - SCREENREC(pScreen)->imp->MoveFrame(winRec->wid, pScreen, - x + SCREEN_TO_GLOBAL_X, - y + SCREEN_TO_GLOBAL_Y); - } - else { - FinishFrameResize(pWin, FALSE, - oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - } - } - - RL_DEBUG_MSG("movewindow end\n"); -} - -/* - * RootlessResizeWindow - * Note: (x, y, w, h) as passed to this procedure don't match the frame - * definition. (x,y) is corner of very outer edge, *outside* border. - * w,h is width and height *inside* border, *ignoring* border width. - * The rect (x, y, w, h) doesn't mean anything. (x, y, w+2*bw, h+2*bw) - * is total rect and (x+bw, y+bw, w, h) is inner rect. - */ -void -RootlessResizeWindow(WindowPtr pWin, int x, int y, - unsigned int w, unsigned int h, WindowPtr pSib) -{ - RootlessWindowRec *winRec = WINREC(pWin); - ScreenPtr pScreen = pWin->drawable.pScreen; - int oldX = 0, oldY = 0, newX = 0, newY = 0; - unsigned int oldW = 0, oldH = 0, oldBW = 0, newW = 0, newH = 0, newBW = 0; - RegionRec saveRoot; - - RL_DEBUG_MSG("resizewindow start (win %p (%lu)) ", pWin, RootlessWID(pWin)); - - if (pWin->parent) { - if (winRec) { - oldBW = winRec->borderWidth; - oldX = winRec->x; - oldY = winRec->y; - oldW = winRec->width; - oldH = winRec->height; - - newBW = oldBW; - newX = x; - newY = y; - newW = w + 2 * newBW; - newH = h + 2 * newBW; - - StartFrameResize(pWin, TRUE, - oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - } - - HUGE_ROOT(pWin); - SCREEN_UNWRAP(pScreen, ResizeWindow); - pScreen->ResizeWindow(pWin, x, y, w, h, pSib); - SCREEN_WRAP(pScreen, ResizeWindow); - NORMAL_ROOT(pWin); - - if (winRec) { - FinishFrameResize(pWin, TRUE, - oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - } - } - else { - /* Special case for resizing the root window */ - BoxRec box; - - pWin->drawable.x = x; - pWin->drawable.y = y; - pWin->drawable.width = w; - pWin->drawable.height = h; - - box.x1 = x; - box.y1 = y; - box.x2 = x + w; - box.y2 = y + h; - RegionUninit(&pWin->winSize); - RegionInit(&pWin->winSize, &box, 1); - RegionCopy(&pWin->borderSize, &pWin->winSize); - RegionCopy(&pWin->clipList, &pWin->winSize); - RegionCopy(&pWin->borderClip, &pWin->winSize); - - if (winRec) { - SCREENREC(pScreen)->imp->ResizeFrame(winRec->wid, pScreen, - x + SCREEN_TO_GLOBAL_X, - y + SCREEN_TO_GLOBAL_Y, - w, h, RL_GRAVITY_NONE); - } - - miSendExposures(pWin, &pWin->borderClip, - pWin->drawable.x, pWin->drawable.y); - } - - RL_DEBUG_MSG("resizewindow end\n"); -} - -/* - * RootlessRepositionWindow - * Called by the implementation when a window needs to be repositioned to - * its correct location on the screen. This routine is typically needed - * due to changes in the underlying window system, such as a screen layout - * change. - */ -void -RootlessRepositionWindow(WindowPtr pWin) -{ - RootlessWindowRec *winRec = WINREC(pWin); - ScreenPtr pScreen = pWin->drawable.pScreen; - - if (winRec == NULL) - return; - - RootlessStopDrawing(pWin, FALSE); - SCREENREC(pScreen)->imp->MoveFrame(winRec->wid, pScreen, - winRec->x + SCREEN_TO_GLOBAL_X, - winRec->y + SCREEN_TO_GLOBAL_Y); - - RootlessReorderWindow(pWin); -} - -/* - * RootlessReparentWindow - * Called after a window has been reparented. Generally windows are not - * framed until they are mapped. However, a window may be framed early by the - * implementation calling RootlessFrameForWindow. (e.g. this could be needed - * to attach a VRAM surface to it.) If the window is subsequently reparented - * by the window manager before being mapped, we need to give the frame to - * the new top-level window. - */ -void -RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - RootlessWindowRec *winRec = WINREC(pWin); - WindowPtr pTopWin; - - /* Check that window is not top-level now, but used to be. */ - if (IsRoot(pWin) || IsRoot(pWin->parent) - || IsTopLevel(pWin) || winRec == NULL) { - goto out; - } - - /* If the formerly top-level window has a frame, we want to give the - frame to its new top-level parent. If we can't do that, we'll just - have to jettison it... */ - - pTopWin = TopLevelParent(pWin); - assert(pTopWin != pWin); - - pWin->unhittable = FALSE; - - DeleteProperty(serverClient, pWin, xa_native_window_id()); - - if (WINREC(pTopWin) != NULL) { - /* We're screwed. */ - RootlessDestroyFrame(pWin, winRec); - } - else { - if (!pTopWin->realized && pWin->realized) { - SCREENREC(pScreen)->imp->UnmapFrame(winRec->wid); - } - - /* Switch the frame record from one to the other. */ - - SETWINREC(pWin, NULL); - SETWINREC(pTopWin, winRec); - - RootlessInitializeFrame(pTopWin, winRec); - RootlessReshapeFrame(pTopWin); - - SCREENREC(pScreen)->imp->ResizeFrame(winRec->wid, pScreen, - winRec->x + SCREEN_TO_GLOBAL_X, - winRec->y + SCREEN_TO_GLOBAL_Y, - winRec->width, winRec->height, - RL_GRAVITY_NONE); - - if (SCREENREC(pScreen)->imp->SwitchWindow) { - SCREENREC(pScreen)->imp->SwitchWindow(winRec, pWin); - } - - if (pTopWin->realized && !pWin->realized) - winRec->is_reorder_pending = TRUE; - } - - out: - if (SCREENREC(pScreen)->ReparentWindow) { - SCREEN_UNWRAP(pScreen, ReparentWindow); - pScreen->ReparentWindow(pWin, pPriorParent); - SCREEN_WRAP(pScreen, ReparentWindow); - } -} - -void -RootlessFlushWindowColormap(WindowPtr pWin) -{ - RootlessWindowRec *winRec = WINREC(pWin); - ScreenPtr pScreen = pWin->drawable.pScreen; - - if (winRec == NULL) - return; - - RootlessStopDrawing(pWin, FALSE); - - if (SCREENREC(pScreen)->imp->UpdateColormap) - SCREENREC(pScreen)->imp->UpdateColormap(winRec->wid, pScreen); -} - -/* - * RootlessChangeBorderWidth - * FIXME: untested! - * pWin inside corner stays the same; pWin->drawable.[xy] stays the same - * Frame moves and resizes. - */ -void -RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width) -{ - RegionRec saveRoot; - - RL_DEBUG_MSG("change border width "); - - if (width != wBorderWidth(pWin)) { - RootlessWindowRec *winRec = WINREC(pWin); - int oldX = 0, oldY = 0, newX = 0, newY = 0; - unsigned int oldW = 0, oldH = 0, oldBW = 0; - unsigned int newW = 0, newH = 0, newBW = 0; - - if (winRec) { - oldBW = winRec->borderWidth; - oldX = winRec->x; - oldY = winRec->y; - oldW = winRec->width; - oldH = winRec->height; - - newBW = width; - newX = pWin->drawable.x - newBW; - newY = pWin->drawable.y - newBW; - newW = pWin->drawable.width + 2 * newBW; - newH = pWin->drawable.height + 2 * newBW; - - StartFrameResize(pWin, FALSE, - oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - } - - HUGE_ROOT(pWin); - SCREEN_UNWRAP(pWin->drawable.pScreen, ChangeBorderWidth); - pWin->drawable.pScreen->ChangeBorderWidth(pWin, width); - SCREEN_WRAP(pWin->drawable.pScreen, ChangeBorderWidth); - NORMAL_ROOT(pWin); - - if (winRec) { - FinishFrameResize(pWin, FALSE, - oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - } - } - - RL_DEBUG_MSG("change border width end\n"); -} - -/* - * RootlessOrderAllWindows - * Brings all X11 windows to the top of the window stack - * (i.e in front of Aqua windows) -- called when X11.app is given focus - */ -void -RootlessOrderAllWindows(Bool include_unhitable) -{ - int i; - WindowPtr pWin; - - if (windows_hidden) - return; - - RL_DEBUG_MSG("RootlessOrderAllWindows() "); - for (i = 0; i < screenInfo.numScreens; i++) { - if (screenInfo.screens[i] == NULL) - continue; - pWin = screenInfo.screens[i]->root; - if (pWin == NULL) - continue; - - for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) { - if (!pWin->realized) - continue; - if (RootlessEnsureFrame(pWin) == NULL) - continue; - if (!include_unhitable && pWin->unhittable) - continue; - RootlessReorderWindow(pWin); - } - } - RL_DEBUG_MSG("RootlessOrderAllWindows() done"); -} - -void -RootlessEnableRoot(ScreenPtr pScreen) -{ - WindowPtr pRoot; - - pRoot = pScreen->root; - - RootlessEnsureFrame(pRoot); - (*pScreen->ClearToBackground) (pRoot, 0, 0, 0, 0, TRUE); - RootlessReorderWindow(pRoot); -} - -void -RootlessDisableRoot(ScreenPtr pScreen) -{ - WindowPtr pRoot; - RootlessWindowRec *winRec; - - pRoot = pScreen->root; - winRec = WINREC(pRoot); - - if (NULL == winRec) - return; - - RootlessDestroyFrame(pRoot, winRec); - DeleteProperty(serverClient, pRoot, xa_native_window_id()); -} - -void -RootlessHideAllWindows(void) -{ - int i; - ScreenPtr pScreen; - WindowPtr pWin; - RootlessWindowRec *winRec; - - if (windows_hidden) - return; - - windows_hidden = TRUE; - - for (i = 0; i < screenInfo.numScreens; i++) { - pScreen = screenInfo.screens[i]; - if (pScreen == NULL) - continue; - pWin = pScreen->root; - if (pWin == NULL) - continue; - - for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) { - if (!pWin->realized) - continue; - - RootlessStopDrawing(pWin, FALSE); - - winRec = WINREC(pWin); - if (winRec != NULL) { - if (SCREENREC(pScreen)->imp->HideWindow) - SCREENREC(pScreen)->imp->HideWindow(winRec->wid); - } - } - } -} - -void -RootlessShowAllWindows(void) -{ - int i; - ScreenPtr pScreen; - WindowPtr pWin; - RootlessWindowRec *winRec; - - if (!windows_hidden) - return; - - windows_hidden = FALSE; - - for (i = 0; i < screenInfo.numScreens; i++) { - pScreen = screenInfo.screens[i]; - if (pScreen == NULL) - continue; - pWin = pScreen->root; - if (pWin == NULL) - continue; - - for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) { - if (!pWin->realized) - continue; - - winRec = RootlessEnsureFrame(pWin); - if (winRec == NULL) - continue; - - RootlessReorderWindow(pWin); - } - - RootlessScreenExpose(pScreen); - } -} - -/* - * SetPixmapOfAncestors - * Set the Pixmaps on all ParentRelative windows up the ancestor chain. - */ -void -RootlessSetPixmapOfAncestors(WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - WindowPtr topWin = TopLevelParent(pWin); - RootlessWindowRec *topWinRec = WINREC(topWin); - - while (pWin->backgroundState == ParentRelative) { - if (pWin == topWin) { - // disallow ParentRelative background state on top level - XID pixel = 0; - - ChangeWindowAttributes(pWin, CWBackPixel, &pixel, serverClient); - RL_DEBUG_MSG("Cleared ParentRelative on %p (%lu).\n", pWin, RootlessWID(pWin)); - break; - } - - pWin = pWin->parent; - pScreen->SetWindowPixmap(pWin, topWinRec->pixmap); - } -} diff --git a/miext/rootless/rootlessWindow.h b/miext/rootless/rootlessWindow.h deleted file mode 100644 index 4fd34d54d..000000000 --- a/miext/rootless/rootlessWindow.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Rootless window management - */ -/* - * Copyright (c) 2001 Greg Parker. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#ifndef _ROOTLESSWINDOW_H -#define _ROOTLESSWINDOW_H - -#include "rootlessCommon.h" - -Bool RootlessCreateWindow(WindowPtr pWin); -Bool RootlessDestroyWindow(WindowPtr pWin); - -void RootlessSetShape(WindowPtr pWin, int kind); - -Bool RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask); -Bool RootlessPositionWindow(WindowPtr pWin, int x, int y); -Bool RootlessRealizeWindow(WindowPtr pWin); -Bool RootlessUnrealizeWindow(WindowPtr pWin); -void RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib); -void RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, - RegionPtr prgnSrc); -void RootlessPaintWindow(WindowPtr pWin, RegionPtr prgn, int what); -void RootlessMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, - VTKind kind); -void RootlessResizeWindow(WindowPtr pWin, int x, int y, unsigned int w, - unsigned int h, WindowPtr pSib); -void RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent); -void RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width); - -#ifdef __APPLE__ -void RootlessNativeWindowMoved(WindowPtr pWin); -void RootlessNativeWindowStateChanged(WindowPtr pWin, unsigned int state); -#endif - -#endif diff --git a/test/scripts/build-travis-osx.sh b/test/scripts/build-travis-osx.sh deleted file mode 100755 index d9632490d..000000000 --- a/test/scripts/build-travis-osx.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -set -e -set -x - -# -# based on instructions for building xorg-server in https://www.xquartz.org/Developer-Info.html -# - -# install XQuartz for libraries, headers, etc. -XQUARTZ_VERSION="2.7.11" -wget -nv https://dl.bintray.com/xquartz/downloads/XQuartz-${XQUARTZ_VERSION}.dmg -hdiutil attach XQuartz-${XQUARTZ_VERSION}.dmg -sudo installer -pkg /Volumes/XQuartz-${XQUARTZ_VERSION}/XQuartz.pkg -target / -hdiutil detach /Volumes/XQuartz-${XQUARTZ_VERSION} - -# build environment -export PATH="/opt/X11/bin:${PATH}" -export PKG_CONFIG_PATH="/opt/X11/share/pkgconfig:/opt/X11/lib/pkgconfig:${PKG_CONFIG_PATH}" -export ACLOCAL="aclocal -I /opt/X11/share/aclocal -I /usr/local/share/aclocal" -export CFLAGS="-Wall -O2 -ggdb3 -arch x86_64 -pipe -Wno-typedef-redefinition -Wno-deprecated-declarations" -export CXXFLAGS=$CFLAGS -export OBJCFLAGS=$CFLAGS -export LDFLAGS=$CFLAGS - -# travis currently requires explicit ccache setup on OSX -export PATH="/usr/local/opt/ccache/libexec:$PATH" - -# need newer xorgproto -pushd $HOME -git clone git://anongit.freedesktop.org/git/xorg/proto/xorgproto -cd xorgproto -if [[ "$1" == "autotools" ]]; then - autoreconf -fvi - ./configure --prefix=/opt/X11 - sudo make install -elif [[ "$1" == "meson" ]]; then - meson _build/ -Dprefix=/opt/X11 - ninja -C _build/ - sudo ninja -C _build/ install -else - echo "Unknown build tool $1" - exit 1 -fi -popd - -# build -meson _build/ -Dprefix=/opt/X11 -Dsecure-rpc=false -DESTDIR=$(pwd)/staging ninja -C _build/ install -ninja -C _build/ test