Fix for dragging windows with thin frames

Pavel Roskin proski at gnu.org
Sun Sep 7 12:12:04 CDT 2003


Hello!

Dialogs and windows with thin frames (e.g. winemine) are not redrawn
correctly when they are moved.  Debugging shows that the use of
DrawFocusRect() in dlls/x11drv/winpos.c is a problem.

The patch uses system values for thickness of dialog frames for dialogs
and thin-framed windows (SM_CXDLGFRAME and SM_CYDLGFRAME).  The code for
drawing the inverted rectangle is now shared with the code used for normal
windows.

The patch has been tested in Win31 and Win95 look in the managed,
non-managed and desktop modes.  Only the managed mode didn't have a
problem.  The non-managed and the desktop modes had the problem in both
looks, and it's fixed now.

The patch is attached.

-- 
Regards,
Pavel Roskin
-------------- next part --------------
--- dlls/x11drv/winpos.c
+++ dlls/x11drv/winpos.c
@@ -1737,23 +1737,29 @@ int X11DRV_SetWindowRgn( HWND hwnd, HRGN
  */
 static void draw_moving_frame( HDC hdc, RECT *rect, BOOL thickframe )
 {
+    int width, height;
+
     if (thickframe)
     {
-        const int width = GetSystemMetrics(SM_CXFRAME);
-        const int height = GetSystemMetrics(SM_CYFRAME);
-
-        HBRUSH hbrush = SelectObject( hdc, GetStockObject( GRAY_BRUSH ) );
-        PatBlt( hdc, rect->left, rect->top,
-                rect->right - rect->left - width, height, PATINVERT );
-        PatBlt( hdc, rect->left, rect->top + height, width,
-                rect->bottom - rect->top - height, PATINVERT );
-        PatBlt( hdc, rect->left + width, rect->bottom - 1,
-                rect->right - rect->left - width, -height, PATINVERT );
-        PatBlt( hdc, rect->right - 1, rect->top, -width,
-                rect->bottom - rect->top - height, PATINVERT );
-        SelectObject( hdc, hbrush );
+        width = GetSystemMetrics(SM_CXFRAME);
+        height = GetSystemMetrics(SM_CYFRAME);
+    }
+    else
+    {
+        width = GetSystemMetrics(SM_CXDLGFRAME);
+        height = GetSystemMetrics(SM_CYDLGFRAME);
     }
-    else DrawFocusRect( hdc, rect );
+
+    HBRUSH hbrush = SelectObject( hdc, GetStockObject( GRAY_BRUSH ) );
+    PatBlt( hdc, rect->left, rect->top,
+            rect->right - rect->left - width, height, PATINVERT );
+    PatBlt( hdc, rect->left, rect->top + height, width,
+            rect->bottom - rect->top - height, PATINVERT );
+    PatBlt( hdc, rect->left + width, rect->bottom - 1,
+            rect->right - rect->left - width, -height, PATINVERT );
+    PatBlt( hdc, rect->right - 1, rect->top, -width,
+            rect->bottom - rect->top - height, PATINVERT );
+    SelectObject( hdc, hbrush );
 }
 
 


More information about the wine-patches mailing list