Recommit r668, which got undone accidentally by r673.

Review URL: http://codereview.appspot.com/4589043

git-svn-id: https://angleproject.googlecode.com/svn/trunk@683 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/common/version.h b/src/common/version.h
index 63eb5b5..c2de131 100644
--- a/src/common/version.h
+++ b/src/common/version.h
@@ -1,7 +1,7 @@
 #define MAJOR_VERSION 0
 #define MINOR_VERSION 0
 #define BUILD_VERSION 0
-#define BUILD_REVISION 682
+#define BUILD_REVISION 683
 
 #define STRINGIFY(x) #x
 #define MACRO_STRINGIFY(x) STRINGIFY(x)
diff --git a/src/libEGL/Surface.cpp b/src/libEGL/Surface.cpp
index 118bfbb..e9c02af 100644
--- a/src/libEGL/Surface.cpp
+++ b/src/libEGL/Surface.cpp
@@ -167,6 +167,16 @@
 
     bool useFlipEx = (LOWORD(GetVersion()) >= 0x61) && mDisplay->isD3d9ExDevice();
 
+    // FlipEx causes unseemly stretching when resizing windows AND when one

+    // draws outside of the WM_PAINT callback. While this is seldom a problem in

+    // single process applications, it is particuarly noticeable in multiprocess

+    // applications. Therefore, if the creator process of our window is not in

+    // the current process, disable use of FlipEx.

+    DWORD windowPID;

+    GetWindowThreadProcessId(mWindow, &windowPID);

+    if(windowPID != GetCurrentProcessId())

+      useFlipEx = false;
+
     presentParameters.AutoDepthStencilFormat = mConfig->mDepthStencilFormat;
     // We set BackBufferCount = 1 even when we use D3DSWAPEFFECT_FLIPEX.
     // We do this because DirectX docs are a bit vague whether to set this to 1