[Xquartz-changes] xserver: Branch 'server-1.12-apple' - 28 commits
Jeremy Huddleston
jeremyhu at freedesktop.org
Fri Jan 27 21:40:47 PST 2012
Rebased ref, commits from common ancestor:
commit 3f83658758ef475e9395fe63af739af3c68c0e5e
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Fri Feb 12 19:48:52 2010 -0800
fb: Revert fb changes that broke XQuartz
http://bugs.freedesktop.org/show_bug.cgi?id=26124
Revert "Fix source pictures getting random transforms after 2d6a8f668342a5190cdf43b5."
Revert "fb: Adjust transform or composite coordinates for pixman operations"
http://bugs.freedesktop.org/26124
This reverts commit a72c65e9176c51de95db2fdbf4c5d946a4911695.
This reverts commit a6bd5d2e482a5aa84acb3d4932e2a166d8670ef1.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/fb/fb.h b/fb/fb.h
index eaa21ad..e65a1c0 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2049,11 +2049,8 @@ fbFillRegionSolid (DrawablePtr pDrawable,
FbBits xor);
extern _X_EXPORT pixman_image_t *
-image_from_pict (PicturePtr pict,
- Bool has_clip,
- int *xoff,
- int *yoff);
-
+image_from_pict (PicturePtr pict,
+ Bool has_clip);
extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
#endif /* _FB_H_ */
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 57c93fd..127e5c7 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -50,24 +50,19 @@ fbComposite (CARD8 op,
CARD16 height)
{
pixman_image_t *src, *mask, *dest;
- int src_xoff, src_yoff;
- int msk_xoff, msk_yoff;
- int dst_xoff, dst_yoff;
miCompositeSourceValidate (pSrc);
if (pMask)
miCompositeSourceValidate (pMask);
- src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
- mask = image_from_pict (pMask, FALSE, &msk_xoff, &msk_yoff);
- dest = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+ src = image_from_pict (pSrc, TRUE);
+ mask = image_from_pict (pMask, TRUE);
+ dest = image_from_pict (pDst, TRUE);
if (src && dest && !(pMask && !mask))
{
pixman_image_composite (op, src, mask, dest,
- xSrc + src_xoff, ySrc + src_yoff,
- xMask + msk_xoff, yMask + msk_yoff,
- xDst + dst_xoff, yDst + dst_yoff,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
width, height);
}
@@ -146,22 +141,22 @@ create_conical_gradient_image (PictGradient *gradient)
static pixman_image_t *
create_bits_picture (PicturePtr pict,
- Bool has_clip,
- int *xoff,
- int *yoff)
+ Bool has_clip)
{
- PixmapPtr pixmap;
FbBits *bits;
FbStride stride;
- int bpp;
+ int bpp, xoff, yoff;
pixman_image_t *image;
- fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
- fbGetPixmapBitsData(pixmap, bits, stride, bpp);
+ fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
+
+ bits = (FbBits*)((CARD8*)bits +
+ (pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
+ (pict->pDrawable->x + xoff) * (bpp / 8));
image = pixman_image_create_bits (
(pixman_format_code_t)pict->format,
- pixmap->drawable.width, pixmap->drawable.height,
+ pict->pDrawable->width, pict->pDrawable->height,
(uint32_t *)bits, stride * sizeof (FbStride));
if (!image)
@@ -189,55 +184,33 @@ create_bits_picture (PicturePtr pict,
if (pict->clientClipType != CT_NONE)
pixman_image_set_has_client_clip (image, TRUE);
- if (*xoff || *yoff)
- pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
+ pixman_region_translate (pict->pCompositeClip, - pict->pDrawable->x, - pict->pDrawable->y);
pixman_image_set_clip_region (image, pict->pCompositeClip);
- if (*xoff || *yoff)
- pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
+ pixman_region_translate (pict->pCompositeClip, pict->pDrawable->x, pict->pDrawable->y);
}
/* Indexed table */
if (pict->pFormat->index.devPrivate)
pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
- /* Add in drawable origin to position within the image */
- *xoff += pict->pDrawable->x;
- *yoff += pict->pDrawable->y;
-
return image;
}
static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map);
+image_from_pict_internal (PicturePtr pict, Bool has_clip, Bool is_alpha_map);
static void
-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+set_image_properties (pixman_image_t *image, PicturePtr pict, Bool is_alpha_map)
{
pixman_repeat_t repeat;
pixman_filter_t filter;
if (pict->transform)
{
- /* For source images, adjust the transform to account
- * for the drawable offset within the pixman image,
- * then set the offset to 0 as it will be used
- * to compute positions within the transformed image.
- */
- if (!has_clip) {
- struct pixman_transform adjusted;
-
- adjusted = *pict->transform;
- pixman_transform_translate(&adjusted,
- NULL,
- pixman_int_to_fixed(*xoff),
- pixman_int_to_fixed(*yoff));
- pixman_image_set_transform (image, &adjusted);
- *xoff = 0;
- *yoff = 0;
- } else
- pixman_image_set_transform (image, pict->transform);
+ pixman_image_set_transform (
+ image, (pixman_transform_t *)pict->transform);
}
switch (pict->repeatType)
@@ -267,8 +240,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
*/
if (pict->alphaMap && !is_alpha_map)
{
- int alpha_xoff, alpha_yoff;
- pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff, TRUE);
+ pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, TRUE, TRUE);
pixman_image_set_alpha_map (
image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
@@ -301,7 +273,8 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
}
static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+image_from_pict_internal (PicturePtr pict,
+ Bool has_clip, Bool is_alpha_map)
{
pixman_image_t *image = NULL;
@@ -310,7 +283,7 @@ image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
if (pict->pDrawable)
{
- image = create_bits_picture (pict, has_clip, xoff, yoff);
+ image = create_bits_picture (pict, has_clip);
}
else if (pict->pSourcePict)
{
@@ -331,19 +304,18 @@ image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
else if (sp->type == SourcePictTypeConical)
image = create_conical_gradient_image (gradient);
}
- *xoff = *yoff = 0;
}
if (image)
- set_image_properties (image, pict, has_clip, xoff, yoff, is_alpha_map);
+ set_image_properties (image, pict, is_alpha_map);
return image;
}
pixman_image_t *
-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+image_from_pict (PicturePtr pict, Bool has_clip)
{
- return image_from_pict_internal (pict, has_clip, xoff, yoff, FALSE);
+ return image_from_pict_internal (pict, has_clip, FALSE);
}
void
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 0b5a638..fbe2647 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -39,12 +39,11 @@ fbAddTraps (PicturePtr pPicture,
xTrap *traps)
{
pixman_image_t *image;
- int dst_xoff, dst_yoff;
- if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+ if (!(image = image_from_pict (pPicture, FALSE)))
return;
- pixman_add_traps (image, x_off + dst_xoff, y_off + dst_yoff,
+ pixman_add_traps (image, x_off, y_off,
ntrap, (pixman_trap_t *)traps);
free_pixman_pict (pPicture, image);
@@ -57,14 +56,13 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
int y_off)
{
pixman_image_t *image;
- int dst_xoff, dst_yoff;
- if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+ if (!(image = image_from_pict (pPicture, FALSE)))
return;
pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap,
- x_off + dst_xoff,
- y_off + dst_yoff);
+ x_off,
+ y_off);
free_pixman_pict (pPicture, image);
}
@@ -77,13 +75,12 @@ fbAddTriangles (PicturePtr pPicture,
xTriangle *tris)
{
pixman_image_t *image;
- int dst_xoff, dst_yoff;
- if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+ if (!(image = image_from_pict (pPicture, FALSE)))
return;
pixman_add_triangles (image,
- dst_xoff + x_off, dst_yoff + y_off,
+ x_off, y_off,
ntri, (pixman_triangle_t *)tris);
free_pixman_pict (pPicture, image);
@@ -110,13 +107,11 @@ fbShapes (CompositeShapesFunc composite,
const uint8_t * shapes)
{
pixman_image_t *src, *dst;
- int src_xoff, src_yoff;
- int dst_xoff, dst_yoff;
miCompositeSourceValidate (pSrc);
- src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
- dst = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+ src = image_from_pict (pSrc, FALSE);
+ dst = image_from_pict (pDst, TRUE);
if (src && dst)
{
@@ -136,10 +131,10 @@ fbShapes (CompositeShapesFunc composite,
for (i = 0; i < nshapes; ++i)
{
composite (op, src, dst, format,
- xSrc + src_xoff,
- ySrc + src_yoff,
- dst_xoff,
- dst_yoff,
+ xSrc,
+ ySrc,
+ 0,
+ 0,
1, shapes + i * shape_size);
}
}
@@ -162,10 +157,10 @@ fbShapes (CompositeShapesFunc composite,
}
composite (op, src, dst, format,
- xSrc + src_xoff,
- ySrc + src_yoff,
- dst_xoff,
- dst_yoff,
+ xSrc,
+ ySrc,
+ 0,
+ 0,
nshapes, shapes);
}
commit 87f1fc4b7cb70571641804a18eb2e1454455aef4
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Fri Apr 30 13:08:25 2010 -0700
Workaround the GC clipping problem in miPaintWindow and add some debugging output.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/mi/miexpose.c b/mi/miexpose.c
index 0f1ebe5..dcbfe1c 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -521,6 +521,7 @@ void RootlessSetPixmapOfAncestors(WindowPtr pWin);
void RootlessStartDrawing(WindowPtr pWin);
void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
Bool IsFramedWindow(WindowPtr pWin);
+#include "../fb/fb.h"
#endif
void
@@ -548,24 +549,37 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
Bool solid = TRUE;
DrawablePtr drawable = &pWin->drawable;
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF("START %d BS %d (pR = %ld)\n", what, pWin->backgroundState, ParentRelative);
+ ErrorF(" Rgn: %d %d %d %d\n", prgn->extents.x1, prgn->extents.y1,
+ prgn->extents.x2 - prgn->extents.x1,
+ prgn->extents.y2 - prgn->extents.y1);
+ ErrorF(" Win: %d %d (%d %d) %d %d\n", pWin->origin.x, pWin->origin.y,
+ pWin->winSize.extents.x1, pWin->winSize.extents.y1,
+ pWin->winSize.extents.x2 - pWin->winSize.extents.x1,
+ pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
+ ErrorF(" Draw: %d %d %d %d\n", pWin->drawable.x, pWin->drawable.y,
+ pWin->drawable.width, pWin->drawable.height);
+#endif
+
#ifdef ROOTLESS
if(!drawable || drawable->type == UNDRAWABLE_WINDOW)
return;
-
- if(IsFramedWindow(pWin)) {
- RootlessStartDrawing(pWin);
- RootlessDamageRegion(pWin, prgn);
-
- if(pWin->backgroundState == ParentRelative) {
- if((what == PW_BACKGROUND) ||
- (what == PW_BORDER && !pWin->borderIsPixel))
- RootlessSetPixmapOfAncestors(pWin);
- }
- }
#endif
if (what == PW_BACKGROUND)
{
+#ifdef ROOTLESS
+ if(IsFramedWindow(pWin)) {
+ RootlessStartDrawing(pWin);
+ RootlessDamageRegion(pWin, prgn);
+
+ if(pWin->backgroundState == ParentRelative) {
+ RootlessSetPixmapOfAncestors(pWin);
+ }
+ }
+#endif
+
while (pWin->backgroundState == ParentRelative)
pWin = pWin->parent;
@@ -591,6 +605,18 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
{
PixmapPtr pixmap;
+#ifdef ROOTLESS
+ if(IsFramedWindow(pWin)) {
+ RootlessStartDrawing(pWin);
+ RootlessDamageRegion(pWin, prgn);
+
+ if(!pWin->borderIsPixel &&
+ pWin->backgroundState == ParentRelative) {
+ RootlessSetPixmapOfAncestors(pWin);
+ }
+ }
+#endif
+
tile_x_off = drawable->x;
tile_y_off = drawable->y;
@@ -599,6 +625,12 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
return;
pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
drawable = &pixmap->drawable;
+
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF(" Draw: %d %d %d %d\n",
+ drawable->x, drawable->y, drawable->width, drawable->height);
+#endif
+
#ifdef COMPOSITE
draw_x_off = pixmap->screen_x;
draw_y_off = pixmap->screen_y;
@@ -661,6 +693,57 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
ChangeGC (NullClient, pGC, gcmask, gcval);
ValidateGC (drawable, pGC);
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF(" GC: %d %d %d %d\n",
+ pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+ pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+ pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
+#endif
+
+#ifdef XQUARTZ
+ /* Looks like our clipping isn't set right for some reason:
+ * http://xquartz.macosforge.org/trac/ticket/290
+ */
+ if(what == PW_BORDER) {
+
+#if 0
+ if(solid) {
+#if 1
+ fbFillRegionSolid(&pWin->drawable,
+ prgn,
+ 0,
+ fbReplicatePixel(fill.pixel,
+ pWin->drawable.bitsPerPixel));
+#else
+ fbFillRegionSolid(drawable,
+ prgn,
+ 0,
+ fbReplicatePixel(fill.pixel,
+ drawable->bitsPerPixel));
+#endif
+ return;
+ }
+#endif
+
+ pGC->pCompositeClip->extents.x1 += prgn->extents.x1;
+ pGC->pCompositeClip->extents.y1 += prgn->extents.y1;
+ pGC->pCompositeClip->extents.x2 += prgn->extents.x1;
+ pGC->pCompositeClip->extents.y2 += prgn->extents.y1;
+
+ if(pGC->pCompositeClip->extents.x2 > drawable->pScreen->width)
+ pGC->pCompositeClip->extents.x2 = drawable->pScreen->width;
+ if(pGC->pCompositeClip->extents.y2 > drawable->pScreen->height)
+ pGC->pCompositeClip->extents.y2 = drawable->pScreen->height;
+ }
+#endif
+
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF(" GC: %d %d %d %d\n",
+ pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+ pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+ pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
+#endif
+
numRects = RegionNumRects(prgn);
pbox = RegionRects(prgn);
for (i= numRects; --i >= 0; pbox++, prect++)
commit 205833afcc23a995e0cb96ad71f410baae767a0e
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Fri Jan 13 12:00:57 2012 -0800
sdksyms.sh: Use CPPFLAGS, not CFLAGS
CFLAGS can include flags which are not useful to the preprocessor
or can even cause it to fail. This fixes a build issue on darwin
when building for more than one architecture.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Keith Packard <keithp at keithp.com>
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 72be889..c0b81c3 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -38,7 +38,7 @@ DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
bin_PROGRAMS = Xorg
nodist_Xorg_SOURCES = sdksyms.c
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+AM_CPPFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
INCLUDES = $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \
-I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac
@@ -109,7 +109,7 @@ CLEANFILES = sdksyms.c sdksyms.dep
EXTRA_DIST += sdksyms.sh
sdksyms.dep sdksyms.c: sdksyms.sh
- CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(INCLUDES)
+ CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CPPFLAGS) $(AM_CPPFLAGS) $(INCLUDES)
SDKSYMS_DEP = sdksyms.dep
include $(SDKSYMS_DEP)
commit bafedb7e9bcff31e2963eeb54669b2492214fae7
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Wed Jan 18 11:52:04 2012 -0800
XQuartz: Bump bundle version to 2.7.2
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/bundle/Info.plist.cpp b/hw/xquartz/bundle/Info.plist.cpp
index a4b8e19..4b6d9d1 100644
--- a/hw/xquartz/bundle/Info.plist.cpp
+++ b/hw/xquartz/bundle/Info.plist.cpp
@@ -19,9 +19,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>2.7.0</string>
+ <string>2.7.2</string>
<key>CFBundleVersion</key>
- <string>2.7.0</string>
+ <string>2.7.2</string>
<key>CFBundleSignature</key>
<string>x11a</string>
<key>CSResourcesFileMapped</key>
@@ -37,9 +37,9 @@
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>NSHumanReadableCopyright</key>
- <string>© 2003-2011 Apple Inc.
+ <string>© 2003-2012 Apple Inc.
© 2003 XFree86 Project, Inc.
-© 2003-2011 X.org Foundation, Inc.
+© 2003-2012 X.org Foundation, Inc.
</string>
<key>NSMainNibFile</key>
<string>main</string>
commit 8e78bbb2d2dc5b18f127540b63b45ba293bbdd25
Author: Colin Harrison <colin.harrison at virgin.net>
Date: Thu Jan 26 13:28:24 2012 +0000
hw/xwin: Fix spelling of 'Canadian' in winkeybd.h
The Mounties always get their typo
Signed-off-by: Colin Harrison <colin.harrison at virgin.net>
Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
diff --git a/hw/xwin/winkeybd.h b/hw/xwin/winkeybd.h
index 5135e9c..e4df260 100644
--- a/hw/xwin/winkeybd.h
+++ b/hw/xwin/winkeybd.h
@@ -268,7 +268,7 @@ g_iKeyMap [] = {
/* 220 */ 0, 0, 0,
/* 221 */ 0, 0, 0,
/* 222 */ 0, 0, 0,
- /* 223 */ VK_OEM_8, 0, KEY_RCtrl, /* at least on Candian Multilingual Standard layout */
+ /* 223 */ VK_OEM_8, 0, KEY_RCtrl, /* at least on Canadian Multilingual Standard layout */
/* 224 */ 0, 0, 0,
/* 225 */ 0, 0, 0,
/* 226 */ 0, 0, 0,
commit 80c073352a276bad3722263629de3cd61df758ab
Author: Colin Harrison <colin.harrison at virgin.net>
Date: Wed Jan 4 17:16:36 2012 +0000
hw/xwin: Fix winEnqueueMotion() for change in miPointerSetPosition()
Commit 3b36fd1b49030ead44358945f62e5abe7f4609ce changed miPointerSetPosition()
to take co-ordinates as doubles, not ints, so this code as it stands is now wrong
(if it ever was correct in the first place :-))
It's unclear that we can safely promote x,y to doubles, apply miPointerSetPosition()
which potentially constrains the cursor, and then convert back to ints.
Fortunately, this whole dance seems to be unnecessary, and we can simply remove the
call to miPointerSetPosition() entirely, and just QueuePointerEvents() like any other
input driver.
Signed-off-by: Colin Harrison <colin.harrison at virgin.net>
Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c
index 3193e3e..99509f2 100644
--- a/hw/xwin/winmouse.c
+++ b/hw/xwin/winmouse.c
@@ -356,15 +356,12 @@ winMouseButtonsHandle (ScreenPtr pScreen,
/**
* Enqueue a motion event.
*
- * XXX: miPointerMove does exactly this, but is static :-( (and uses a static buffer)
- *
*/
void winEnqueueMotion(int x, int y)
{
int valuators[2];
ValuatorMask mask;
- miPointerSetPosition(g_pwinPointer, POINTER_RELATIVE, &x, &y);
valuators[0] = x;
valuators[1] = y;
commit ced9db65950e402d7ddc663225b888e8482b8c57
Author: Colin Harrison <colin.harrison at virgin.net>
Date: Wed Jan 25 01:37:16 2012 +0000
hw/xwin: Ignore WM_DISPLAYCHANGE messages with 0 bpp
Ignore WM_DISPLAYCHANGE messages which indicate bpp is changing to 0.
That has no defined meaning I can find, but some graphics card drivers
appear to generate it on suspend/resume or screensaver activate/deactivate.
Signed-off-by: Colin Harrison <colin.harrison at virgin.net>
Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index ae284b7..88b5068 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -182,6 +182,10 @@ winWindowProc (HWND hwnd, UINT message,
"new height: %d new bpp: %d\n",
LOWORD (lParam), HIWORD (lParam), wParam);
+ /* 0 bpp has no defined meaning, ignore this message */
+ if (wParam == 0)
+ break;
+
/*
* Check for a disruptive change in depth.
* We can only display a message for a disruptive depth change,
commit bea6fb6c7af551778cfe1c0e8412ef4ccf560808
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Sun Jan 22 19:31:51 2012 +0000
hw/xwin: Avoid WIN_WINDOW_PROP races during Windows window destruction
The WIN_WINDOW_PROP is removed during WM_DESTROY handling, so it is not neccessary to
remove it in winDestroyWindowsWindow(), and doing so opens a race condition, as we may
attempt to access that property in the wndproc before the WM_DESTROY has completed.
A specific example of that race is if a WM_KILLFOCUS occurs in the window between property
removal and WM_DESTROY processing, where we will attempt to apply DeleteWindowFromAnyEvents()
on an invalid (null) WindowPtr.
Also guard against null WindowPtr in the WM_KILLFOCUS handler
See http://cygwin.com/ml/cygwin-xfree/2012-01/msg00009.html
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index 2329d16..aabde6b 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -638,8 +638,6 @@ winDestroyWindowsWindow (WindowPtr pWin)
hIcon = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
hIconSm = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
- SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, NULL);
-
/* Destroy the Windows window */
DestroyWindow (pWinPriv->hWnd);
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index 1d57a51..19dad57 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -713,9 +713,11 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
/* Remove our keyboard hook if it is installed */
winRemoveKeyboardHookLL ();
- if (!wParam)
- /* Revert the X focus as well, but only if the Windows focus is going to another window */
- DeleteWindowFromAnyEvents(pWin, FALSE);
+
+ /* Revert the X focus as well, but only if the Windows focus is going to another window */
+ if (!wParam && pWin)
+ DeleteWindowFromAnyEvents(pWin, FALSE);
+
return 0;
case WM_SYSDEADCHAR:
commit 9a709d5028094fcbeb7a49f47cb85e22cd772f36
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Thu Sep 29 15:05:27 2011 +0100
hw/xwin: Handle more motif window decoration hinting
Handle the MWM_DECOR_MINIMIZE, MWM_DECOR_MAXIMIZE and MWM_DECOR_MENU
decoration hints in a _MOTIF_WM_HINTS window property
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index c82ffa5..70f5385 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -1582,6 +1582,8 @@ winDeinitMultiWindowWM (void)
#define HINT_SIZEBOX (1l<<2)
#define HINT_CAPTION (1l<<3)
#define HINT_NOMAXIMIZE (1L<<4)
+#define HINT_NOMINIMIZE (1L<<5)
+#define HINT_NOSYSMENU (1L<<6)
/* These two are used on their own */
#define HINT_MAX (1L<<0)
#define HINT_MIN (1L<<1)
@@ -1640,6 +1642,16 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
if (mwm_hint->decorations & MwmDecorBorder) hint |= HINT_BORDER;
if (mwm_hint->decorations & MwmDecorHandle) hint |= HINT_SIZEBOX;
if (mwm_hint->decorations & MwmDecorTitle) hint |= HINT_CAPTION;
+ if (!(mwm_hint->decorations & MwmDecorMenu)) hint |= HINT_NOSYSMENU;
+ if (!(mwm_hint->decorations & MwmDecorMinimize)) hint |= HINT_NOMINIMIZE;
+ if (!(mwm_hint->decorations & MwmDecorMaximize)) hint |= HINT_NOMAXIMIZE;
+ }
+ else
+ {
+ /*
+ MwmDecorAll means all decorations *except* those specified by other flag
+ bits that are set. Not yet implemented.
+ */
}
}
if (mwm_hint) XFree(mwm_hint);
@@ -1738,6 +1750,12 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
if (hint & HINT_NOMAXIMIZE)
style = style & ~WS_MAXIMIZEBOX;
+ if (hint & HINT_NOMINIMIZE)
+ style = style & ~WS_MINIMIZEBOX;
+
+ if (hint & HINT_NOSYSMENU)
+ style = style & ~WS_SYSMENU;
+
SetWindowLongPtr (hWnd, GWL_STYLE, style);
}
diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h
index a6c8e05..229696a 100644
--- a/hw/xwin/winwindow.h
+++ b/hw/xwin/winwindow.h
@@ -127,10 +127,13 @@ typedef struct _winWMMessageRec{
#define MwmHintsDecorations (1L << 1)
-#define MwmDecorAll (1l << 0)
-#define MwmDecorBorder (1l << 1)
-#define MwmDecorHandle (1l << 2)
-#define MwmDecorTitle (1l << 3)
+#define MwmDecorAll (1L << 0)
+#define MwmDecorBorder (1L << 1)
+#define MwmDecorHandle (1L << 2)
+#define MwmDecorTitle (1L << 3)
+#define MwmDecorMenu (1L << 4)
+#define MwmDecorMinimize (1L << 5)
+#define MwmDecorMaximize (1L << 6)
/* This structure only contains 3 elements... the Motif 2.0 structure
contains 5... we only need the first 3... so that is all we will define */
commit b8b0b841a0e7cfcecaf0b6a5aa67e1b4499374d9
Author: Oliver Schmidt <oschmidt-mailinglists at gmx.de>
Date: Mon Sep 5 13:32:01 2011 +0100
hw/xwin: Fix AltGr key sometimes firing an additional Ctrl-L key
I also had problems with the AltGr key. These could reliably
be reproduced by holding the AltGr for some seconds (causing
Windows generating auto repeat events)
I discovered that the mechanism in winkeybd.c function
winIsFakeCtrl_L had a problem if PeekMessage cannot obtain
the next Alt_R message because it is not there yet.
I prepared a patch that remembers the last Ctrl_L event and
reacts on a later Alt_R.
It was also necessary to alter the order in winWindowProc() in
winwndproc.c: the invocation of winIsFakeCtrl_L had to be done
before discarding auto-repeated key presses, as winIsFakeCtrl_L()
now has an internal state which must be updated by all key events.
Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index a3112ff..0496c40 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -328,8 +328,12 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
LONG lTime;
Bool fReturn;
+ static Bool lastWasControlL = FALSE;
+ static UINT lastMessage;
+ static LONG lastTime;
+
/*
- * Fake Ctrl_L presses will be followed by an Alt_R keypress
+ * Fake Ctrl_L presses will be followed by an Alt_R press
* with the same timestamp as the Ctrl_L press.
*/
if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
@@ -341,34 +345,31 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
/* Get time of current message */
lTime = GetMessageTime ();
- /* Look for fake Ctrl_L preceeding an Alt_R press. */
+ /* Look for next press message */
fReturn = PeekMessage (&msgNext, NULL,
WM_KEYDOWN, WM_SYSKEYDOWN,
PM_NOREMOVE);
- /*
- * Try again if the first call fails.
- * NOTE: This usually happens when TweakUI is enabled.
- */
- if (!fReturn)
- {
- /* Voodoo to make sure that the Alt_R message has posted */
- Sleep (0);
-
- /* Look for fake Ctrl_L preceeding an Alt_R press. */
- fReturn = PeekMessage (&msgNext, NULL,
- WM_KEYDOWN, WM_SYSKEYDOWN,
- PM_NOREMOVE);
- }
- if (msgNext.message != WM_KEYDOWN && msgNext.message != WM_SYSKEYDOWN)
+ if (fReturn && msgNext.message != WM_KEYDOWN && msgNext.message != WM_SYSKEYDOWN)
fReturn = 0;
+ if (!fReturn)
+ {
+ lastWasControlL = TRUE;
+ lastMessage = message;
+ lastTime = lTime;
+ }
+ else
+ {
+ lastWasControlL = FALSE;
+ }
+
/* Is next press an Alt_R with the same timestamp? */
if (fReturn && msgNext.wParam == VK_MENU
&& msgNext.time == lTime
&& (HIWORD (msgNext.lParam) & KF_EXTENDED))
{
- /*
+ /*
* Next key press is Alt_R with same timestamp as current
* Ctrl_L message. Therefore, this Ctrl_L press is a fake
* event, so discard it.
@@ -376,12 +377,35 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
return TRUE;
}
}
+ /*
+ * Sometimes, the Alt_R press message is not yet posted when the
+ * fake Ctrl_L press message arrives (even though it has the
+ * same timestamp), so check for an Alt_R press message that has
+ * arrived since the last Ctrl_L message.
+ */
+ else if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
+ && wParam == VK_MENU
+ && (HIWORD (lParam) & KF_EXTENDED))
+ {
+ /* Got a Alt_R press */
- /*
+ if (lastWasControlL)
+ {
+ lTime = GetMessageTime ();
+
+ if (lastTime == lTime)
+ {
+ /* Undo the fake Ctrl_L press by sending a fake Ctrl_L release */
+ winSendKeyEvent (KEY_LCtrl, FALSE);
+ }
+ lastWasControlL = FALSE;
+ }
+ }
+ /*
* Fake Ctrl_L releases will be followed by an Alt_R release
* with the same timestamp as the Ctrl_L release.
*/
- if ((message == WM_KEYUP || message == WM_SYSKEYUP)
+ else if ((message == WM_KEYUP || message == WM_SYSKEYUP)
&& wParam == VK_CONTROL
&& (HIWORD (lParam) & KF_EXTENDED) == 0)
{
@@ -390,29 +414,16 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
/* Get time of current message */
lTime = GetMessageTime ();
- /* Look for fake Ctrl_L release preceeding an Alt_R release. */
+ /* Look for next release message */
fReturn = PeekMessage (&msgNext, NULL,
- WM_KEYUP, WM_SYSKEYUP,
+ WM_KEYUP, WM_SYSKEYUP,
PM_NOREMOVE);
- /*
- * Try again if the first call fails.
- * NOTE: This usually happens when TweakUI is enabled.
- */
- if (!fReturn)
- {
- /* Voodoo to make sure that the Alt_R message has posted */
- Sleep (0);
+ if (fReturn && msgNext.message != WM_KEYUP && msgNext.message != WM_SYSKEYUP)
+ fReturn = 0;
- /* Look for fake Ctrl_L release preceeding an Alt_R release. */
- fReturn = PeekMessage (&msgNext, NULL,
- WM_KEYUP, WM_SYSKEYUP,
- PM_NOREMOVE);
- }
+ lastWasControlL = FALSE;
- if (msgNext.message != WM_KEYUP && msgNext.message != WM_SYSKEYUP)
- fReturn = 0;
-
/* Is next press an Alt_R with the same timestamp? */
if (fReturn
&& (msgNext.message == WM_KEYUP
@@ -429,7 +440,13 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
return TRUE;
}
}
-
+ else
+ {
+ /* On any other press or release message, we don't have a
+ potentially fake Ctrl_L to worry about anymore... */
+ lastWasControlL = FALSE;
+ }
+
/* Not a fake control left press/release */
return FALSE;
}
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index a89857a..ae284b7 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -1060,6 +1060,10 @@ winWindowProc (HWND hwnd, UINT message,
if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
break;
+ /* Discard fake Ctrl_L events that precede AltGR on non-US keyboards */
+ if (winIsFakeCtrl_L (message, wParam, lParam))
+ return 0;
+
/*
* Discard presses generated from Windows auto-repeat
*/
@@ -1080,10 +1084,6 @@ winWindowProc (HWND hwnd, UINT message,
}
}
- /* Discard fake Ctrl_L presses that precede AltGR on non-US keyboards */
- if (winIsFakeCtrl_L (message, wParam, lParam))
- return 0;
-
/* Translate Windows key code to X scan code */
winTranslateKey (wParam, lParam, &iScanCode);
commit 3d3114d55a2a323f8d49c3549a0dfdf9d4acf89d
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Thu Jun 30 14:19:01 2011 +0100
hw/xwin: Handle the virtual key code generated by the Fn key on IBM Lenovo laptops
Apparently, IBM Leonovo laptops can generate a key-press event for the Fn
key, with virtual key code 0xFF and scan code extended 0x63
Handle this specially, rather than just passing on key code 0x63 (delete),
so you don't delete what you just typed when you adjust the screen brightness,
etc. :-)
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winkeybd.h b/hw/xwin/winkeybd.h
index 4e4c35c..5135e9c 100644
--- a/hw/xwin/winkeybd.h
+++ b/hw/xwin/winkeybd.h
@@ -35,6 +35,8 @@
*/
#include "winkeynames.h"
+#define VK_FN 0xFF
+
#define WIN_KEYMAP_COLS 3
/* Rows 160 through 165 correspond to software-generated codes, which
@@ -298,7 +300,7 @@ g_iKeyMap [] = {
/* 252 */ 0, 0, 0,
/* 253 */ 0, 0, 0,
/* 254 */ 0, 0, 0,
- /* 255 */ 0, 0, 0
+ /* 255 */ VK_FN, 0, KEY_Fn /* Most keyboards don't generate a scancode for Fn, but a few do... */
};
#endif /* WINKEYBD_H */
diff --git a/hw/xwin/winkeynames.h b/hw/xwin/winkeynames.h
index 914016a..75e172e 100644
--- a/hw/xwin/winkeynames.h
+++ b/hw/xwin/winkeynames.h
@@ -144,7 +144,7 @@
#define KEY_KP_0 /* 0 Insert 0x52 */ 82
#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
#define KEY_SysReqest /* SysReqest 0x54 */ 84
- /* NOTUSED 0x55 */
+#define KEY_Fn /* Fn 0x55 */ 85
#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86
#define KEY_F11 /* F11 0x57 */ 87
#define KEY_F12 /* F12 0x58 */ 88
commit 74af860f9a59332f6ed1ac9b3e7867fbbb3d7305
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Wed Mar 24 22:41:22 2010 +0000
hw/xwin: turn on -emulate3buttons if less than 3 mouse buttons are reported
Try to be more intelligent with default options, turn on -emulate3buttons by
default if less than 3 mouse buttons are reported by Windows
Also, add -noemulate3buttons option so this default setting can be reversed
if desired
Also, correctly report the number of mouse buttons windows is reporting, rather
than always at least 3
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 7704392..4a601b2 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -673,8 +673,35 @@ OsVendorInit (void)
/* We have to flag this as an explicit screen, even though it isn't */
g_ScreenInfo[0].fExplicitScreen = TRUE;
}
-}
+ /* Work out what the default emulate3buttons setting should be, and apply
+ it if nothing was explicitly specified */
+ {
+ int mouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
+ int j;
+
+ for (j = 0; j < g_iNumScreens; j++)
+ {
+ if (g_ScreenInfo[j].iE3BTimeout == WIN_E3B_DEFAULT)
+ {
+ if (mouseButtons < 3)
+ {
+ static Bool reportOnce = TRUE;
+ g_ScreenInfo[j].iE3BTimeout = WIN_DEFAULT_E3B_TIME;
+ if (reportOnce)
+ {
+ reportOnce = FALSE;
+ winMsg(X_PROBED, "Windows reports only %d mouse buttons, defaulting to -emulate3buttons\n", mouseButtons);
+ }
+ }
+ else
+ {
+ g_ScreenInfo[j].iE3BTimeout = WIN_E3B_OFF;
+ }
+ }
+ }
+ }
+}
static void
winUseMsg (void)
@@ -706,7 +733,7 @@ winUseMsg (void)
"\tSpecify an optional bitdepth to use in fullscreen mode\n"
"\twith a DirectDraw engine.\n");
- ErrorF ("-emulate3buttons [timeout]\n"
+ ErrorF ("-[no]emulate3buttons [timeout]\n"
"\tEmulate 3 button mouse with an optional timeout in\n"
"\tmilliseconds.\n");
diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man
index 6e69a18..d03a365 100644
--- a/hw/xwin/man/XWin.man
+++ b/hw/xwin/man/XWin.man
@@ -176,7 +176,8 @@ milliseconds causes an emulated middle button press. The default
.I timeout
is 50 milliseconds. Note that most mice with scroll wheel have middle
button functionality, usually you will need this option only if you have
-a two button mouse without scroll wheel.
+a two button mouse without scroll wheel. Default is to enable this
+option if \fIWindows\fP reports a two button mouse, disabled otherwise.
.TP 8
.B \-[no]keyhook
Enable [disable] a low-level keyboard hook for catching
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index ac26d01..5839064 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -102,6 +102,8 @@
#define MOUSE_POLLING_INTERVAL 50
#define WIN_E3B_OFF -1
+#define WIN_E3B_DEFAULT 0
+
#define WIN_FD_INVALID -1
#define WIN_SERVER_NONE 0x0L /* 0 */
diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c
index 752334a..3193e3e 100644
--- a/hw/xwin/winmouse.c
+++ b/hw/xwin/winmouse.c
@@ -79,6 +79,7 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
case DEVICE_INIT:
/* Get number of mouse buttons */
lngMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
+ winMsg(X_PROBED, "%d mouse buttons found\n", lngMouseButtons);
/* Mapping of windows events to X events:
* LEFT:1 MIDDLE:2 RIGHT:3
@@ -89,7 +90,6 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
*/
if (lngMouseButtons < 3)
lngMouseButtons = 3;
- winMsg(X_PROBED, "%d mouse buttons found\n", lngMouseButtons);
/* allocate memory:
* number of buttons + 2x mouse wheel event + 1 extra (offset for map)
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 6553e72..9bec841 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -141,7 +141,7 @@ winInitializeScreenDefaults(void)
defaultScreenInfo.fLessPointer = FALSE;
defaultScreenInfo.iResizeMode = notAllowed;
defaultScreenInfo.fNoTrayIcon = FALSE;
- defaultScreenInfo.iE3BTimeout = WIN_E3B_OFF;
+ defaultScreenInfo.iE3BTimeout = WIN_E3B_DEFAULT;
defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL;
defaultScreenInfo.fIgnoreInput = FALSE;
@@ -789,6 +789,17 @@ ddxProcessArgument (int argc, char *argv[], int i)
}
/*
+ * Look for the '-noemulate3buttons' argument
+ */
+ if (IS_OPTION ("-noemulate3buttons"))
+ {
+ screenInfoPtr->iE3BTimeout = WIN_E3B_OFF;
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+ /*
* Look for the '-depth n' argument
*/
if (IS_OPTION ("-depth"))
commit c0f3709501a0afd3bf77e783f11d2c2e5f489d3b
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Thu Mar 24 20:19:47 2011 +0000
hw/xwin: In multiwindow mode, don't grab native input focus for new windows which hint they don't want it
In multiwindow mode, avoid grabbing the input focus for newly
created windows which have InputHint FALSE
(this is used by e.g. glean to avoid every test window grabbing
the focus)
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winmultiwindowclass.h b/hw/xwin/winmultiwindowclass.h
index c635ab2..1c9a5e5 100644
--- a/hw/xwin/winmultiwindowclass.h
+++ b/hw/xwin/winmultiwindowclass.h
@@ -47,6 +47,16 @@ typedef struct {
/* this structure may be extended in the future */
} WinXWMHints;
+/* Window manager hints mask bits */
+#define InputHint (1L << 0)
+#define StateHint (1L << 1)
+#define IconPixmapHint (1L << 2)
+#define IconWindowHint (1L << 3)
+#define IconPositionHint (1L << 4)
+#define IconMaskHint (1L << 5)
+#define WindowGroupHint (1L << 6)
+#define UrgencyHint (1L << 8)
+#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint|IconPositionHint|IconMaskHint|WindowGroupHint)
/*
* new version containing base_width, base_height, and win_gravity fields;
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index 3d23e97..1d57a51 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -898,7 +898,22 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
& ~WS_CAPTION & ~WS_SIZEBOX);
winUpdateWindowPosition (hwnd, FALSE, &zstyle);
- SetForegroundWindow (hwnd);
+
+ {
+ WinXWMHints hints;
+ if (winMultiWindowGetWMHints(pWin, &hints))
+ {
+ /*
+ Give the window focus, unless it has an InputHint
+ which is FALSE (this is used by e.g. glean to
+ avoid every test window grabbing the focus)
+ */
+ if (!((hints.flags & InputHint) && (!hints.input)))
+ {
+ SetForegroundWindow (hwnd);
+ }
+ }
+ }
}
wmMsg.msg = WM_WM_MAP3;
}
commit 25caa8565d7d10f4c254bca5bb9efa05a77542ad
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Wed Jan 25 13:33:39 2012 +0000
hw/xwin: Remove some redundant OS version reporting
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winclipboardunicode.c b/hw/xwin/winclipboardunicode.c
index ba86915..a297bf2 100644
--- a/hw/xwin/winclipboardunicode.c
+++ b/hw/xwin/winclipboardunicode.c
@@ -44,7 +44,7 @@ winClipboardDetectUnicodeSupport (void)
{
Bool fReturn = FALSE;
OSVERSIONINFO osvi = {0};
-
+
/* Get operating system version information */
osvi.dwOSVersionInfoSize = sizeof (osvi);
GetVersionEx (&osvi);
@@ -54,13 +54,11 @@ winClipboardDetectUnicodeSupport (void)
{
case VER_PLATFORM_WIN32_NT:
/* Unicode supported on NT only */
- ErrorF ("DetectUnicodeSupport - Windows NT/2000/XP\n");
fReturn = TRUE;
break;
case VER_PLATFORM_WIN32_WINDOWS:
/* Unicode is not supported on non-NT */
- ErrorF ("DetectUnicodeSupport - Windows 95/98/Me\n");
fReturn = FALSE;
break;
}
diff --git a/hw/xwin/winengine.c b/hw/xwin/winengine.c
index 752c4fe..bf5187b 100644
--- a/hw/xwin/winengine.c
+++ b/hw/xwin/winengine.c
@@ -68,20 +68,6 @@ winDetectSupportedEngines (void)
osvi.dwOSVersionInfoSize = sizeof (osvi);
GetVersionEx (&osvi);
- /* Branch on platform ID */
- switch (osvi.dwPlatformId)
- {
- case VER_PLATFORM_WIN32_NT:
- /* Engine 4 is supported on NT only */
- winErrorFVerb (2, "winDetectSupportedEngines - Windows NT/2000/XP\n");
- break;
-
- case VER_PLATFORM_WIN32_WINDOWS:
- /* Engine 4 is supported on NT only */
- winErrorFVerb (2, "winDetectSupportedEngines - Windows 95/98/Me\n");
- break;
- }
-
/* Do we have DirectDraw? */
if (g_hmodDirectDraw != NULL)
{
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 2b6949e..6553e72 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -1209,7 +1209,7 @@ winLogCommandLine (int argc, char *argv[])
/*
- * winLogVersionInfo - Log Cygwin/X version information
+ * winLogVersionInfo - Log version information
*/
void
commit a9aca218f557c723e637287272819a7c17174e1e
Author: Roland Cassard <roland.cassard at gmail.com>
Date: Sat Oct 23 18:12:36 2010 +0100
hw/xwin: Don't assume we'll always have converted the clipboard selection after 2 attempts
Rather than knowing we have to call winProcessXEventsTimeout() for up to 2 WIN_XEVENTS_CONVERT messages, process
all messages in winProcessXEventsTimeout() until either: (i) the time out expired, (ii) an error occurred, or
(iii) received a WIN_XEVENTS_NOTIFY messaage indicating the data has been to put on the clipboard.
Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winclipboardwndproc.c b/hw/xwin/winclipboardwndproc.c
index 03da7f4..02347ff 100644
--- a/hw/xwin/winclipboardwndproc.c
+++ b/hw/xwin/winclipboardwndproc.c
@@ -42,7 +42,6 @@
* Constants
*/
-#define WIN_CLIPBOARD_PROP "cyg_clipboard_prop"
#define WIN_POLL_TIMEOUT 1
@@ -124,10 +123,9 @@ winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
iWindow,
pDisplay,
fUseUnicode);
- if (WIN_XEVENTS_NOTIFY == iReturn
- || WIN_XEVENTS_CONVERT == iReturn)
+ if (WIN_XEVENTS_NOTIFY == iReturn)
{
- /* Bail out if convert or notify processed */
+ /* Bail out if notify processed */
return iReturn;
}
}
@@ -503,22 +501,9 @@ winClipboardWindowProc (HWND hwnd, UINT message,
pDisplay,
fConvertToUnicode,
WIN_POLL_TIMEOUT);
- if (WIN_XEVENTS_CONVERT == iReturn)
- {
- /*
- * The selection was offered for conversion first, so we have
- * to process a second SelectionNotify event to get the actual
- * data in the selection.
- */
- iReturn = winProcessXEventsTimeout (hwnd,
- iWindow,
- pDisplay,
- fConvertToUnicode,
- WIN_POLL_TIMEOUT);
- }
-
+
/*
- * The last of the up-to two calls to winProcessXEventsTimeout
+ * The last call to winProcessXEventsTimeout
* from above had better have seen a notify event, or else we
* are dealing with a buggy or old X11 app. In these cases we
* have to paste some fake data to the Win32 clipboard to
commit 75fe336b6c903133ae386f5cb8d308a0e9e2768e
Author: Michel Hummel <hummel.michel at gmail.com>
Date: Fri Aug 6 15:23:52 2010 +0100
hw/xwin: Mitigate a race condition in clipboard thread initialization
Remove the variables g_fClipboardLaunched and g_fClipboardStarted from
winInitializeGlobals(), as their re-initialization is handled in the
file hw/xwin/InitOutput.c.
Re-initializing g_fClipboardLaunched and g_fClipboardStarted during
the server reset procedure can lead to the clipboard thread being
launched two times and sometimes leads to a crash of the X server...
Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index 631f12e..655cdb1 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -114,8 +114,6 @@ winInitializeGlobals (void)
{
g_dwCurrentThreadID = GetCurrentThreadId ();
#ifdef XWIN_CLIPBOARD
- g_fClipboardLaunched = FALSE;
- g_fClipboardStarted = FALSE;
g_iClipboardWindow = None;
g_pClipboardDisplay = NULL;
g_atomLastOwnedSelection = None;
commit 95b1391fe3d3192abdfbad4140513b2112cfa02a
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Mon Apr 5 13:57:24 2010 +0100
hw/xwin: Chain IOError handlers to avoid longjmp across threads
Avoid crashes on shutdown due to the undefined behaviour of calling longjmp() on the
result of setjmp() from a different thread, by chaining IOError handlers and only
jumping back up to the frame for this thread
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winclipboardthread.c b/hw/xwin/winclipboardthread.c
index 890a15b..bc4bc30 100644
--- a/hw/xwin/winclipboardthread.c
+++ b/hw/xwin/winclipboardthread.c
@@ -63,6 +63,8 @@ extern Window g_iClipboardWindow;
static jmp_buf g_jmpEntry;
static int clipboardRestarts = 0;
+static XIOErrorHandler g_winClipboardOldIOErrorHandler;
+static pthread_t g_winClipboardProcThread;
Bool g_fUnicodeSupport = FALSE;
Bool g_fUseUnicode = FALSE;
@@ -128,6 +130,11 @@ winClipboardProc (void *pvNotUsed)
ErrorF ("winClipboardProc - Warning: Locale not supported by X.\n");
}
+ /* Set error handler */
+ XSetErrorHandler (winClipboardErrorHandler);
+ g_winClipboardProcThread = pthread_self();
+ g_winClipboardOldIOErrorHandler = XSetIOErrorHandler (winClipboardIOErrorHandler);
+
/* Set jump point for Error exits */
iReturn = setjmp (g_jmpEntry);
@@ -150,10 +157,6 @@ winClipboardProc (void *pvNotUsed)
/* Use our generated cookie for authentication */
winSetAuthorization();
- /* Set error handler */
- XSetErrorHandler (winClipboardErrorHandler);
- XSetIOErrorHandler (winClipboardIOErrorHandler);
-
/* Initialize retry count */
iRetries = 0;
@@ -511,8 +514,14 @@ winClipboardIOErrorHandler (Display *pDisplay)
{
ErrorF ("winClipboardIOErrorHandler!\n\n");
- /* Restart at the main entry point */
- longjmp (g_jmpEntry, WIN_JMP_ERROR_IO);
-
+ if (pthread_equal(pthread_self(),g_winClipboardProcThread))
+ {
+ /* Restart at the main entry point */
+ longjmp (g_jmpEntry, WIN_JMP_ERROR_IO);
+ }
+
+ if (g_winClipboardOldIOErrorHandler)
+ g_winClipboardOldIOErrorHandler(pDisplay);
+
return 0;
}
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 7c40563..c82ffa5 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -204,7 +204,11 @@ winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle);
*/
static jmp_buf g_jmpWMEntry;
+static XIOErrorHandler g_winMultiWindowWMOldIOErrorHandler;
+static pthread_t g_winMultiWindowWMThread;
static jmp_buf g_jmpXMsgProcEntry;
+static XIOErrorHandler g_winMultiWindowXMsgProcOldIOErrorHandler;
+static pthread_t g_winMultiWindowXMsgProcThread;
static Bool g_shutdown = FALSE;
static Bool redirectError = FALSE;
static Bool g_fAnotherWMRunning = FALSE;
@@ -901,9 +905,14 @@ winMultiWindowXMsgProc (void *pArg)
ErrorF ("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n");
+ /* Install our error handler */
+ XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
+ g_winMultiWindowXMsgProcThread = pthread_self();
+ g_winMultiWindowXMsgProcOldIOErrorHandler = XSetIOErrorHandler (winMultiWindowXMsgProcIOErrorHandler);
+
/* Set jump point for IO Error exits */
iReturn = setjmp (g_jmpXMsgProcEntry);
-
+
/* Check if we should continue operations */
if (iReturn != WIN_JMP_ERROR_IO
&& iReturn != WIN_JMP_OKAY)
@@ -919,10 +928,6 @@ winMultiWindowXMsgProc (void *pArg)
pthread_exit (NULL);
}
- /* Install our error handler */
- XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
- XSetIOErrorHandler (winMultiWindowXMsgProcIOErrorHandler);
-
/* Setup the display connection string x */
snprintf (pszDisplay,
512, "127.0.0.1:%s.%d", display, (int)pProcArg->dwScreen);
@@ -1310,9 +1315,14 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
ErrorF ("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n");
+ /* Install our error handler */
+ XSetErrorHandler (winMultiWindowWMErrorHandler);
+ g_winMultiWindowWMThread = pthread_self();
+ g_winMultiWindowWMOldIOErrorHandler = XSetIOErrorHandler (winMultiWindowWMIOErrorHandler);
+
/* Set jump point for IO Error exits */
iReturn = setjmp (g_jmpWMEntry);
-
+
/* Check if we should continue operations */
if (iReturn != WIN_JMP_ERROR_IO
&& iReturn != WIN_JMP_OKAY)
@@ -1328,10 +1338,6 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
pthread_exit (NULL);
}
- /* Install our error handler */
- XSetErrorHandler (winMultiWindowWMErrorHandler);
- XSetIOErrorHandler (winMultiWindowWMIOErrorHandler);
-
/* Setup the display connection string x */
snprintf (pszDisplay,
512,
@@ -1458,12 +1464,18 @@ winMultiWindowWMIOErrorHandler (Display *pDisplay)
{
ErrorF ("winMultiWindowWMIOErrorHandler!\n\n");
- if (g_shutdown)
- pthread_exit(NULL);
+ if (pthread_equal(pthread_self(),g_winMultiWindowWMThread))
+ {
+ if (g_shutdown)
+ pthread_exit(NULL);
+
+ /* Restart at the main entry point */
+ longjmp (g_jmpWMEntry, WIN_JMP_ERROR_IO);
+ }
+
+ if (g_winMultiWindowWMOldIOErrorHandler)
+ g_winMultiWindowWMOldIOErrorHandler(pDisplay);
- /* Restart at the main entry point */
- longjmp (g_jmpWMEntry, WIN_JMP_ERROR_IO);
-
return 0;
}
@@ -1498,9 +1510,15 @@ winMultiWindowXMsgProcIOErrorHandler (Display *pDisplay)
{
ErrorF ("winMultiWindowXMsgProcIOErrorHandler!\n\n");
- /* Restart at the main entry point */
- longjmp (g_jmpXMsgProcEntry, WIN_JMP_ERROR_IO);
-
+ if (pthread_equal(pthread_self(),g_winMultiWindowXMsgProcThread))
+ {
+ /* Restart at the main entry point */
+ longjmp (g_jmpXMsgProcEntry, WIN_JMP_ERROR_IO);
+ }
+
+ if (g_winMultiWindowXMsgProcOldIOErrorHandler)
+ g_winMultiWindowXMsgProcOldIOErrorHandler(pDisplay);
+
return 0;
}
commit 0659437f5ec0e3f646373394f5f9c5461e2170f3
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date: Sat Feb 20 23:40:53 2010 -0600
hw/xwin: Improve XWinrc loading and error recovery
If $HOME/.XWinrc is present but badly formed, ignore it and try
system.XWinrc instead. If neither file is present or both are badly
formed, provide a built-in default which gives the user the chance to
load their new or fixed configuration without restarting.
Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c
index d941c51..76c30e9 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -51,8 +51,8 @@
extern const char *winGetBaseDir(void);
-/* From winmultiwindowflex.l, the real parser */
-extern void parse_file (FILE *fp);
+/* From winprefslex.l, the real parser */
+extern int parse_file (FILE *fp);
/* Currently in use command ID, incremented each new menu item created */
@@ -710,6 +710,54 @@ winIconIsOverride(unsigned hiconIn)
/*
+ * Open and parse the XWinrc config file @path.
+ * If @path is NULL, use the built-in default.
+ */
+static int
+winPrefsLoadPreferences (char *path)
+{
+ FILE *prefFile = NULL;
+
+ if (path)
+ prefFile = fopen (path, "r");
+ else
+ {
+ char defaultPrefs[] =
+ "MENU rmenu {\n"
+ " \"How to customize this menu\" EXEC \"xterm +tb -e man XWinrc\"\n"
+ " \"Launch xterm\" EXEC xterm\n"
+ " \"Load .XWinrc\" RELOAD\n"
+ " SEPARATOR\n"
+ "}\n"
+ "\n"
+ "ROOTMENU rmenu\n";
+
+ path = "built-in default";
+ prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r");
+ }
+
+ if (!prefFile)
+ {
+ ErrorF ("LoadPreferences: %s not found\n", path);
+ return FALSE;
+ }
+
+ ErrorF ("LoadPreferences: Loading %s\n", path);
+
+ if((parse_file (prefFile)) != 0)
+ {
+ ErrorF ("LoadPreferences: %s is badly formed!\n", path);
+ fclose (prefFile);
+ return FALSE;
+ }
+
+ fclose (prefFile);
+ return TRUE;
+}
+
+
+
+/*
* Try and open ~/.XWinrc and system.XWinrc
* Load it into prefs structure for use by other functions
*/
@@ -718,16 +766,15 @@ LoadPreferences (void)
{
char *home;
char fname[PATH_MAX+NAME_MAX+2];
- FILE *prefFile;
char szDisplay[512];
char *szEnvDisplay;
int i, j;
char param[PARAM_MAX+1];
char *srcParam, *dstParam;
+ int parsed = FALSE;
/* First, clear all preference settings */
memset (&pref, 0, sizeof(pref));
- prefFile = NULL;
/* Now try and find a ~/.xwinrc file */
home = getenv ("HOME");
@@ -737,14 +784,11 @@ LoadPreferences (void)
if (fname[strlen(fname)-1]!='/')
strcat (fname, "/");
strcat (fname, ".XWinrc");
-
- prefFile = fopen (fname, "r");
- if (prefFile)
- ErrorF ("winPrefsLoadPreferences: %s\n", fname);
+ parsed = winPrefsLoadPreferences(fname);
}
/* No home file found, check system default */
- if (!prefFile)
+ if (!parsed)
{
char buffer[MAX_PATH];
#ifdef RELOCATE_PROJECTROOT
@@ -753,16 +797,14 @@ LoadPreferences (void)
strncpy(buffer, SYSCONFDIR"/X11/system.XWinrc", sizeof(buffer));
#endif
buffer[sizeof(buffer)-1] = 0;
- prefFile = fopen (buffer, "r");
- if (prefFile)
- ErrorF ("winPrefsLoadPreferences: %s\n", buffer);
+ parsed = winPrefsLoadPreferences(buffer);
}
- /* If we could open it, then read the settings and close it */
- if (prefFile)
+ /* Neither user nor system configuration found, or were badly formed */
+ if (!parsed)
{
- parse_file (prefFile);
- fclose (prefFile);
+ ErrorF ("LoadPreferences: See \"man XWinrc\" to customize the XWin menu.\n");
+ parsed = winPrefsLoadPreferences(NULL);
}
/* Setup a DISPLAY environment variable, need to allocate on heap */
diff --git a/hw/xwin/winprefslex.l b/hw/xwin/winprefslex.l
index 463dff4..ba8aea6 100644
--- a/hw/xwin/winprefslex.l
+++ b/hw/xwin/winprefslex.l
@@ -113,14 +113,18 @@ yywrap (void)
/*
* Run a file through the yacc parser
*/
-void
+int
parse_file (FILE *file)
{
+ int ret;
+
if (!file)
- return;
+ return 1;
yylineno = 1;
yyin = file;
- yyparse ();
+ ret = yyparse ();
+ yylex_destroy ();
+ return ret;
}
commit 47c7b6d3e626497747ae2780f259a15b8e6c846f
Author: Michel Hummel <hummel.michel at gmail.com>
Date: Sat Oct 23 18:35:57 2010 +0100
hw/xwin: Remove no-longer needed tricks used to prevent the clipboard client from being killed
Remove no-longer needed tricks used to hide the clipboard client from XDM to prevent
it from being killed
- Delete XQuery wrapper used to hide clipboard client
- Delete XDMCP mode heuristic which waits until some magic number of connections have
been established before starting the clipboard
We still need the EstablishConnection wrapper to ensure that the clipboard client isn't
the first client (causing a server restart if it disconnects)
Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/InitInput.c b/hw/xwin/InitInput.c
index bc48a93..9cf5735 100644
--- a/hw/xwin/InitInput.c
+++ b/hw/xwin/InitInput.c
@@ -112,12 +112,6 @@ InitInput (int argc, char *argv[])
winProcEstablishConnectionOrig = InitialVector[2];
InitialVector[2] = winProcEstablishConnection;
}
- if (g_fXdmcpEnabled
- && ProcVector[X_QueryTree] != winProcQueryTree)
- {
- winProcQueryTreeOrig = ProcVector[X_QueryTree];
- ProcVector[X_QueryTree] = winProcQueryTree;
- }
#endif
g_pwinPointer = AddInputDevice (serverClient, winMouseProc, TRUE);
diff --git a/hw/xwin/winclipboardwrappers.c b/hw/xwin/winclipboardwrappers.c
index bdacefb..ec6e95a 100644
--- a/hw/xwin/winclipboardwrappers.c
+++ b/hw/xwin/winclipboardwrappers.c
@@ -42,7 +42,6 @@
* Constants
*/
-#define CLIP_NUM_CALLS 4
#define CLIP_NUM_SELECTIONS 2
#define CLIP_OWN_PRIMARY 0
#define CLIP_OWN_CLIPBOARD 1
@@ -55,6 +54,8 @@
int winProcEstablishConnection(ClientPtr /* client */);
int winProcQueryTree(ClientPtr /* client */);
int winProcSetSelectionOwner(ClientPtr /* client */);
+DISPATCH_PROC(winProcEstablishConnection);
+DISPATCH_PROC(winProcSetSelectionOwner);
/*
@@ -79,104 +80,6 @@ extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
/*
- * Wrapper for internal QueryTree function.
- * Hides the clipboard client when it is the only client remaining.
- */
-
-int
-winProcQueryTree (ClientPtr client)
-{
- int iReturn;
-
- ErrorF ("winProcQueryTree - Hello\n");
-
- /*
- * This procedure is only used for initialization.
- * We can unwrap the original procedure at this point
- * so that this function is no longer called until the
- * server resets and the function is wrapped again.
- */
- ProcVector[X_QueryTree] = winProcQueryTreeOrig;
-
- /*
- * Call original function and bail if it fails.
- * NOTE: We must do this first, since we need XdmcpOpenDisplay
- * to be called before we initialize our clipboard client.
- */
- iReturn = (*winProcQueryTreeOrig) (client);
- if (iReturn != 0)
- {
- ErrorF ("winProcQueryTree - ProcQueryTree failed, bailing.\n");
- return iReturn;
- }
-
- /* Make errors more obvious */
- winProcQueryTreeOrig = NULL;
-
- /* Do nothing if clipboard is not enabled */
- if (!g_fClipboard)
- {
- ErrorF ("winProcQueryTree - Clipboard is not enabled, "
- "returning.\n");
- return iReturn;
- }
-
- /* If the clipboard client has already been started, abort */
- if (g_fClipboardLaunched)
- {
- ErrorF ("winProcQueryTree - Clipboard client already "
- "launched, returning.\n");
- return iReturn;
- }
-
- /* Startup the clipboard client if clipboard mode is being used */
- if (g_fXdmcpEnabled && g_fClipboard)
- {
- /*
- * NOTE: The clipboard client is started here for a reason:
- * 1) Assume you are using XDMCP (e.g. XWin -query %hostname%)
- * 2) If the clipboard client attaches during X Server startup,
- * then it becomes the "magic client" that causes the X Server
- * to reset if it exits.
- * 3) XDMCP calls KillAllClients when it starts up.
- * 4) The clipboard client is a client, so it is killed.
- * 5) The clipboard client is the "magic client", so the X Server
- * resets itself.
- * 6) This repeats ad infinitum.
- * 7) We avoid this by waiting until at least one client (could
- * be XDM, could be another client) connects, which makes it
- * almost certain that the clipboard client will not connect
- * until after XDM when using XDMCP.
- * 8) Unfortunately, there is another problem.
- * 9) XDM walks the list of windows with XQueryTree,
- * killing any client it finds with a window.
- * 10)Thus, when using XDMCP we wait until the first call
- * to ProcQueryTree before we startup the clipboard client.
- * This should prevent XDM from finding the clipboard client,
- * since it has not yet created a window.
- * 11)Startup when not using XDMCP is handled in
- * winProcEstablishConnection.
- */
-
- /* Create the clipboard client thread */
- if (!winInitClipboard ())
- {
- ErrorF ("winProcQueryTree - winClipboardInit "
- "failed.\n");
- return iReturn;
- }
-
- ErrorF ("winProcQueryTree - winInitClipboard returned.\n");
- }
-
- /* Flag that clipboard client has been launched */
- g_fClipboardLaunched = TRUE;
-
- return iReturn;
-}
-
-
-/*
* Wrapper for internal EstablishConnection function.
* Initializes internal clients that must not be started until
* an external client has connected.
@@ -189,7 +92,7 @@ winProcEstablishConnection (ClientPtr client)
static int s_iCallCount = 0;
static unsigned long s_ulServerGeneration = 0;
- if (s_iCallCount == 0 || s_iCallCount == CLIP_NUM_CALLS) ErrorF ("winProcEstablishConnection - Hello\n");
+ if (s_iCallCount == 0) ErrorF ("winProcEstablishConnection - Hello\n");
/* Do nothing if clipboard is not enabled */
if (!g_fClipboard)
@@ -217,18 +120,6 @@ winProcEstablishConnection (ClientPtr client)
/* Increment call count */
++s_iCallCount;
- /* Wait for CLIP_NUM_CALLS when Xdmcp is enabled */
- if (g_fXdmcpEnabled
- && !g_fClipboardLaunched
- && s_iCallCount < CLIP_NUM_CALLS)
- {
- if (s_iCallCount == 1) ErrorF ("winProcEstablishConnection - Xdmcp, waiting to "
- "start clipboard client until %dth call", CLIP_NUM_CALLS);
- if (s_iCallCount == CLIP_NUM_CALLS - 1) ErrorF (".\n");
- else ErrorF (".");
- return (*winProcEstablishConnectionOrig) (client);
- }
-
/*
* This procedure is only used for initialization.
* We can unwrap the original procedure at this point
@@ -279,13 +170,6 @@ winProcEstablishConnection (ClientPtr client)
* be XDM, could be another client) connects, which makes it
* almost certain that the clipboard client will not connect
* until after XDM when using XDMCP.
- * 8) Unfortunately, there is another problem.
- * 9) XDM walks the list of windows with XQueryTree,
- * killing any client it finds with a window.
- * 10)Thus, when using XDMCP we wait until CLIP_NUM_CALLS
- * to ProcEstablishCeonnection before we startup the clipboard
- * client. This should prevent XDM from finding the clipboard
- * client, since it has not yet created a window.
*/
/* Create the clipboard client thread */
commit c1bf3baa44fbd8af33a2b3ce045324485b85a7a7
Author: Michel Hummel <hummel.michel at gmail.com>
Date: Sun Oct 31 14:53:02 2010 +0000
hw/xwin: Automatically restart clipboard thread
Automatically restart clipboard thread on unexpected exit
Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winclipboard.h b/hw/xwin/winclipboard.h
index 6b5249f..b655f16 100644
--- a/hw/xwin/winclipboard.h
+++ b/hw/xwin/winclipboard.h
@@ -70,6 +70,8 @@
#define WIN_XEVENTS_SHUTDOWN 1
#define WIN_XEVENTS_CONVERT 2
#define WIN_XEVENTS_NOTIFY 3
+#define WIN_CLIPBOARD_RETRIES 40
+#define WIN_CLIPBOARD_DELAY 1
#define WM_WM_REINIT (WM_USER + 1)
diff --git a/hw/xwin/winclipboardthread.c b/hw/xwin/winclipboardthread.c
index 4cffa80..890a15b 100644
--- a/hw/xwin/winclipboardthread.c
+++ b/hw/xwin/winclipboardthread.c
@@ -50,6 +50,8 @@
extern Bool g_fUnicodeClipboard;
extern unsigned long serverGeneration;
extern Bool g_fClipboardStarted;
+extern Bool g_fClipboardLaunched;
+extern Bool g_fClipboard;
extern HWND g_hwndClipboard;
extern void *g_pClipboardDisplay;
extern Window g_iClipboardWindow;
@@ -60,6 +62,8 @@ extern Window g_iClipboardWindow;
*/
static jmp_buf g_jmpEntry;
+static int clipboardRestarts = 0;
+
Bool g_fUnicodeSupport = FALSE;
Bool g_fUseUnicode = FALSE;
@@ -74,7 +78,6 @@ winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr);
static int
winClipboardIOErrorHandler (Display *pDisplay);
-
/*
* Main thread function
*/
@@ -101,6 +104,7 @@ winClipboardProc (void *pvNotUsed)
int iSelectError;
ErrorF ("winClipboardProc - Hello\n");
+ ++clipboardRestarts;
/* Do we have Unicode support? */
g_fUnicodeSupport = winClipboardDetectUnicodeSupport ();
@@ -115,7 +119,7 @@ winClipboardProc (void *pvNotUsed)
if (XInitThreads () == 0)
{
ErrorF ("winClipboardProc - XInitThreads failed.\n");
- pthread_exit (NULL);
+ goto winClipboardProc_Exit;
}
/* See if X supports the current locale */
@@ -134,7 +138,7 @@ winClipboardProc (void *pvNotUsed)
/* setjmp returned an unknown value, exit */
ErrorF ("winClipboardProc - setjmp returned: %d exiting\n",
iReturn);
- pthread_exit (NULL);
+ goto winClipboardProc_Exit;
}
else if (iReturn == WIN_JMP_ERROR_IO)
{
@@ -191,7 +195,7 @@ winClipboardProc (void *pvNotUsed)
if (pDisplay == NULL)
{
ErrorF ("winClipboardProc - Failed opening the display, giving up\n");
- pthread_exit (NULL);
+ goto winClipboardProc_Done;
}
/* Save the display in the screen privates */
@@ -209,7 +213,7 @@ winClipboardProc (void *pvNotUsed)
if (fdMessageQueue == -1)
{
ErrorF ("winClipboardProc - Failed opening %s\n", WIN_MSG_QUEUE_FNAME);
- pthread_exit (NULL);
+ goto winClipboardProc_Done;
}
/* Find max of our file descriptors */
@@ -233,7 +237,7 @@ winClipboardProc (void *pvNotUsed)
if (iWindow == 0)
{
ErrorF ("winClipboardProc - Could not create an X window.\n");
- pthread_exit (NULL);
+ goto winClipboardProc_Done;
}
XStoreName(pDisplay, iWindow, "xwinclip");
@@ -264,7 +268,7 @@ winClipboardProc (void *pvNotUsed)
XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow)
{
ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
- pthread_exit (NULL);
+ goto winClipboardProc_Done;
}
/* CLIPBOARD */
@@ -274,7 +278,7 @@ winClipboardProc (void *pvNotUsed)
XGetSelectionOwner (pDisplay, atomClipboard) != iWindow)
{
ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n");
- pthread_exit (NULL);
+ goto winClipboardProc_Done;
}
}
@@ -381,6 +385,20 @@ winClipboardProc (void *pvNotUsed)
}
}
+winClipboardProc_Exit:
+ /* disable the clipboard, which means the thread will die */
+ g_fClipboard = FALSE;
+
+winClipboardProc_Done:
+ /* Close our Windows window */
+ if (g_hwndClipboard )
+ {
+ /* Destroy the Window window (hwnd) */
+ winDebug("winClipboardProc - Destroy Windows window\n");
+ PostMessage(g_hwndClipboard, WM_DESTROY, 0, 0);
+ winClipboardFlushWindowsMessageQueue(g_hwndClipboard);
+ }
+
/* Close our X window */
if (pDisplay && iWindow)
{
@@ -419,10 +437,44 @@ winClipboardProc (void *pvNotUsed)
}
#endif
+ /* global clipboard variable reset */
+ g_fClipboardLaunched = FALSE;
+ g_fClipboardStarted = FALSE;
g_iClipboardWindow = None;
g_pClipboardDisplay = NULL;
g_hwndClipboard = NULL;
+ /* checking if we need to restart */
+ if (clipboardRestarts >= WIN_CLIPBOARD_RETRIES)
+ {
+ /* terminates clipboard thread but the main server still lives */
+ ErrorF("winClipboardProc - the clipboard thread has restarted %d times and seems to be unstable, disabling clipboard integration\n", clipboardRestarts);
+ g_fClipboard = FALSE;
+ return;
+ }
+
+ if (g_fClipboard)
+ {
+ sleep(WIN_CLIPBOARD_DELAY);
+ ErrorF("winClipboardProc - trying to restart clipboard thread \n");
+ /* Create the clipboard client thread */
+ if (!winInitClipboard ())
+ {
+ ErrorF ("winClipboardProc - winClipboardInit failed.\n");
+ return;
+ }
+
+ winDebug ("winClipboardProc - winInitClipboard returned.\n");
+ /* Flag that clipboard client has been launched */
+ g_fClipboardLaunched = TRUE;
+ }
+ else
+ {
+ ErrorF ("winClipboardProc - Clipboard disabled - Exit from server \n");
+ /* clipboard thread has exited, stop server as well */
+ kill(getpid(), SIGTERM);
+ }
+
return NULL;
}
commit ae981341a98f7a1ee5d6f3bc8ebde04e42042dc5
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Mon Feb 8 22:37:30 2010 +0000
hw/xwin: Give the X window for the clipboard integration client a name
This makes it a bit easier to find when staring at the output of
'xwininfo -tree -root'
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winclipboardthread.c b/hw/xwin/winclipboardthread.c
index 908dfce..4cffa80 100644
--- a/hw/xwin/winclipboardthread.c
+++ b/hw/xwin/winclipboardthread.c
@@ -236,6 +236,8 @@ winClipboardProc (void *pvNotUsed)
pthread_exit (NULL);
}
+ XStoreName(pDisplay, iWindow, "xwinclip");
+
/* Select event types to watch */
if (XSelectInput (pDisplay,
iWindow,
commit b1093241f3e28223a139e7cb5c3ae85182bdf545
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Tue Oct 19 20:47:21 2010 +0100
Xext: Warning fix for shm.c
shm.c: In function 'CheckForShmSyscall':
shm.c:182:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/Xext/shm.c b/Xext/shm.c
index 7ca027a..37900fe 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -179,7 +179,7 @@ SigSysHandler(int signo)
static Bool CheckForShmSyscall(void)
{
- void (*oldHandler)();
+ void (*oldHandler)(int);
int shmid = -1;
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
commit 02775efb8930291cc62fc84086c97da75b912a55
Author: Adam Jackson <ajax at redhat.com>
Date: Tue Jan 24 17:35:04 2012 -0500
int10: Fix unmapping of the BIOS scratch area
342f3eac8460fc48cfad1f1d7be939d671e6e1cd introduced a bug, 'base' is
incremented before use. The old code corrected this when unmapping, so
the new code should too.
Signed-off-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
index 638f566..03f9f7d 100644
--- a/hw/xfree86/int10/helper_exec.c
+++ b/hw/xfree86/int10/helper_exec.c
@@ -726,7 +726,7 @@ xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save)
}
}
- pci_device_unmap_legacy(pInt->dev, base, pagesize);
+ pci_device_unmap_legacy(pInt->dev, base - BIOS_SCRATCH_OFF, pagesize);
}
#endif
commit e1085a0da0b9299f48b3dc41dee5e33bf022bea5
Author: Chase Douglas <chase.douglas at canonical.com>
Date: Wed Jan 18 19:09:21 2012 -0800
Don't set X and Y valuators for indirect touch events
For expediency, it made sense to always have the X and Y axes set for
direct touch device event propagation. The last X and Y values are
stored internally. However, indirect device touch event propagation
does not depend on the touch's X and Y values. Thus, we don't need to
set the values for every indirect touch event.
On top of this, the previous X and Y values aren't stored for indirect
touches, so without this change the axes get erroneously set to 0.
Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/dix/getevents.c b/dix/getevents.c
index 1547059..7678aa1 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1836,7 +1836,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
default:
return 0;
}
- if (!(flags & TOUCH_CLIENT_ID))
+ if (t->mode == XIDirectTouch && !(flags & TOUCH_CLIENT_ID))
{
if (!valuator_mask_isset(&mask, 0))
valuator_mask_set_double(&mask, 0, valuator_mask_get_double(touchpoint.ti->valuators, 0));
commit 5201310559fe8708ba8278bdef77cdc1673fff71
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Jan 19 22:40:32 2012 +1100
UngrabAllDevices: Don't kill clients if not told to
The kill_client argument to UngrabAllClients specifies if we want to
kill the client holding the grab or just deactivate the grab.
Signed-off-by: Daniel Stone <daniel at fooishbar.org>
Reported-by: Julien Cristau <jcristau at debian.org>
Reviewed-by: Cyril Brulebois <kibi at debian.org>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/dix/grabs.c b/dix/grabs.c
index 701470c..cc2c946 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -195,7 +195,8 @@ UngrabAllDevices(Bool kill_client)
client = clients[CLIENT_ID(dev->deviceGrab.grab->resource)];
if (!client || client->clientGone)
dev->deviceGrab.DeactivateGrab(dev);
- CloseDownClient(client);
+ if (kill_client)
+ CloseDownClient(client);
}
ErrorF("End list of ungrabbed devices\n");
commit 9b1e18f42a05a79d9ebec372a37b47442e397ca9
Author: Chase Douglas <chase.douglas at canonical.com>
Date: Wed Jan 18 18:04:14 2012 -0800
Only update pointer motion data for pointer emulated touch events
Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/dix/getevents.c b/dix/getevents.c
index 2946b16..1547059 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1878,9 +1878,13 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
&devx, &devy, &screenx, &screeny);
/* see fill_pointer_events for coordinate systems */
- updateHistory(dev, &mask, ms);
+ if (emulate_pointer)
+ updateHistory(dev, &mask, ms);
+
clipValuators(dev, &mask);
- storeLastValuators(dev, &mask, 0, 1, devx, devy);
+
+ if (emulate_pointer)
+ storeLastValuators(dev, &mask, 0, 1, devx, devy);
event->root = scr->root->drawable.id;
commit f00e5b02f5d9928cd88961e761da91b5faff1b32
Author: Chase Douglas <chase.douglas at canonical.com>
Date: Wed Jan 18 18:04:13 2012 -0800
Only scale direct device touch coordinates
Indirect touch devices provide valuator values in pure device
coordinates. They also don't need to be fixed up for screen crossings.
Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/dix/getevents.c b/dix/getevents.c
index d0014e6..2946b16 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1867,7 +1867,12 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
if (need_rawevent)
set_raw_valuators(raw, &mask, raw->valuators.data);
- scr = scale_to_desktop(dev, &mask, &devx, &devy, &screenx, &screeny);
+ /* Indirect device touch coordinates are not used for cursor positioning.
+ * They are merely informational, and are provided in device coordinates.
+ * The device sprite is used for positioning instead, and it is already
+ * scaled. */
+ if (t->mode == XIDirectTouch)
+ scr = scale_to_desktop(dev, &mask, &devx, &devy, &screenx, &screeny);
if (emulate_pointer)
scr = positionSprite(dev, Absolute, &mask,
&devx, &devy, &screenx, &screeny);
commit 24dc0389da3970e83e4908039957567e55f9ea05
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Mon Jan 16 12:53:39 2012 +1000
include: Fix comment typo
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/include/inputstr.h b/include/inputstr.h
index 518e2f4..c3297db 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -544,7 +544,7 @@ typedef struct _DeviceIntRec {
DeviceRec public;
DeviceIntPtr next;
Bool startup; /* true if needs to be turned on at
- server intialization time */
+ server initialization time */
DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is
used to initialize, turn on, or
turn off the device */
More information about the Xquartz-changes
mailing list