[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xorg-server: Changes to 'upstream-experimental'



 Xext/shm.c                             |    2 
 Xext/xace.c                            |    4 +
 Xi/exevents.c                          |   20 ++---
 Xi/xiproperty.c                        |    2 
 configure.ac                           |   15 ++--
 dix/dispatch.c                         |   14 ++-
 dix/dixutils.c                         |   17 +++-
 dix/enterleave.c                       |    9 +-
 dix/eventconvert.c                     |    4 +
 dix/events.c                           |    5 -
 dix/getevents.c                        |   19 +++--
 dix/grabs.c                            |    3 
 dix/property.c                         |    2 
 glx/glxscreens.c                       |    9 --
 hw/xfree86/Makefile.am                 |    2 
 hw/xfree86/common/compiler.h           |   19 -----
 hw/xfree86/common/xf86Xinput.c         |   11 +-
 hw/xfree86/ddc/ddcProperty.c           |   47 +-----------
 hw/xfree86/dixmods/Makefile.am         |    1 
 hw/xfree86/int10/helper_exec.c         |    2 
 hw/xfree86/loader/loadmod.c            |    3 
 hw/xfree86/man/xorg.conf.man           |    8 +-
 hw/xfree86/os-support/linux/lnx_init.c |   19 +++--
 hw/xfree86/sdksyms.sh                  |    1 
 hw/xfree86/vgahw/vgaHW.h               |    8 +-
 hw/xfree86/xaa/Makefile.am             |    4 +
 hw/xquartz/GL/indirect.c               |    3 
 hw/xquartz/bundle/Info.plist.cpp       |    8 +-
 hw/xwin/InitInput.c                    |    6 -
 hw/xwin/InitOutput.c                   |   31 +++++++-
 hw/xwin/Makefile.am                    |    3 
 hw/xwin/man/XWin.man                   |    3 
 hw/xwin/win.h                          |    2 
 hw/xwin/winclipboard.h                 |    3 
 hw/xwin/winclipboardthread.c           |   95 +++++++++++++++++++++----
 hw/xwin/winclipboardunicode.c          |    4 -
 hw/xwin/winclipboardwndproc.c          |   23 +-----
 hw/xwin/winclipboardwrappers.c         |  122 ---------------------------------
 hw/xwin/winengine.c                    |   21 -----
 hw/xwin/winglobals.c                   |    2 
 hw/xwin/winkeybd.c                     |   95 +++++++++++++++----------
 hw/xwin/winkeybd.h                     |    6 +
 hw/xwin/winkeynames.h                  |    2 
 hw/xwin/winmouse.c                     |    5 -
 hw/xwin/winmultiwindowclass.h          |   10 ++
 hw/xwin/winmultiwindowwindow.c         |    2 
 hw/xwin/winmultiwindowwm.c             |   84 ++++++++++++++++------
 hw/xwin/winmultiwindowwndproc.c        |   25 +++++-
 hw/xwin/winnativegdi.c                 |    7 +
 hw/xwin/winpfbdd.c                     |    6 -
 hw/xwin/winprefs.c                     |   74 +++++++++++++++-----
 hw/xwin/winprefslex.l                  |   10 +-
 hw/xwin/winprocarg.c                   |   15 +++-
 hw/xwin/winrandr.c                     |    2 
 hw/xwin/winshadgdi.c                   |    1 
 hw/xwin/winwin32rootless.c             |    4 -
 hw/xwin/winwin32rootlesswindow.c       |    3 
 hw/xwin/winwindow.h                    |   11 +-
 hw/xwin/winwndproc.c                   |   12 ++-
 include/exevents.h                     |    2 
 include/inputstr.h                     |    2 
 include/misc.h                         |    3 
 mi/mibitblt.c                          |    2 
 os/backtrace.c                         |   14 ++-
 os/client.c                            |   43 +++++++++++
 os/connection.c                        |    2 
 os/io.c                                |    2 
 os/osdep.h                             |    4 -
 render/animcur.c                       |    3 
 test/Makefile.am                       |   57 ++++++++++++++-
 test/ddxstubs.c                        |   91 ++++++++++++++++++++++++
 xkb/xkbActions.c                       |    2 
 72 files changed, 716 insertions(+), 461 deletions(-)

New commits:
commit 052ca3f22eadd0aa60dd24ac7d5d76137273926f
Author: Keith Packard <keithp@keithp.com>
Date:   Fri Jan 27 22:08:08 2012 -0800

    Bump version to 1.11.99.902 (1.12 RC2)
    
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/configure.ac b/configure.ac
index b0bb9bb..6241119 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.11.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2011-12-27"
+AC_INIT([xorg-server], 1.11.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-01-27"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE

commit bafedb7e9bcff31e2963eeb54669b2492214fae7
Author: Jeremy Huddleston <jeremyhu@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@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@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@virgin.net>
    Reviewed-by: Jon TURNEY <jon.turney@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@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@virgin.net>
    Reviewed-by: Jon TURNEY <jon.turney@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@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@virgin.net>
    Reviewed-by: Jon TURNEY <jon.turney@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@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@dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison@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@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@dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison@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@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@dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison@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@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@dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison@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@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@dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison@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@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@dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison@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@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@dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison@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@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@dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison@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@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@dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison@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;


Reply to: