ttydrv fix

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

 



Resubmitted.

This patch adds the missing functionality in the ttydriver.
Apps like FreeSolitaire and WineMine now start and wait in their main loop.

Eric LaForest

? log
? dlls/avicap32
? dlls/msrle32
? dlls/netapi32
? programs/wineconsole
Index: dlls/ttydrv/ttydrv.spec
===================================================================
RCS file: /home/wine/wine/dlls/ttydrv/ttydrv.spec,v
retrieving revision 1.19
diff -u -r1.19 ttydrv.spec
--- dlls/ttydrv/ttydrv.spec	2001/11/30 23:15:32	1.19
+++ dlls/ttydrv/ttydrv.spec	2001/12/08 09:13:58
@@ -67,3 +67,4 @@
 @ cdecl IsClipboardFormatAvailable(long) TTYDRV_IsClipboardFormatAvailable
 @ cdecl RegisterClipboardFormat(str) TTYDRV_RegisterClipboardFormat
 @ cdecl IsSelectionOwner() TTYDRV_IsSelectionOwner
+@ cdecl ShowWindow(long long) TTYDRV_ShowWindow
Index: dlls/ttydrv/wnd.c
===================================================================
RCS file: /home/wine/wine/dlls/ttydrv/wnd.c,v
retrieving revision 1.18
diff -u -r1.18 wnd.c
--- dlls/ttydrv/wnd.c	2001/11/06 22:28:18	1.18
+++ dlls/ttydrv/wnd.c	2001/12/08 09:13:58
@@ -645,3 +645,164 @@
     WIN_ReleaseWndPtr(wndPtr);
     return retvalue;
 }
+
+
+/***********************************************************************
+ *              WINPOS_MinMaximize   (internal)
+ *
+ *Lifted from x11 driver	
+ */
+UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
+{
+    WND *wndPtr;
+    UINT swpFlags = 0;
+    POINT size;
+    LONG old_style;
+    WINDOWPLACEMENT wpl;
+
+    TRACE("0x%04x %u\n", hwnd, cmd );
+    FIXME("(%x): stub\n", hwnd);
+
+    wpl.length = sizeof(wpl);
+    GetWindowPlacement( hwnd, &wpl );
+
+    /* If I glark this right, yields an immutable window*/
+    swpFlags = SWP_NOSIZE | SWP_NOMOVE;
+
+    if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
+
+    /*cmd handling goes here.  see dlls/x1drv/winpos.c*/
+
+    WIN_ReleaseWndPtr( wndPtr );
+    return swpFlags;
+}
+
+/***********************************************************************
+ *              ShowWindow   (TTYDRV.@)
+ *
+ *Lifted from x11 driver
+ *Sets the specified windows' show state.	
+ */
+BOOL TTYDRV_ShowWindow( HWND hwnd, INT cmd )
+{
+    WND* 	wndPtr = WIN_FindWndPtr( hwnd );
+    BOOL 	wasVisible, showFlag;
+    RECT 	newPos = {0, 0, 0, 0};
+    UINT 	swp = 0;
+
+    if (!wndPtr) return FALSE;
+    hwnd = wndPtr->hwndSelf;  /* make it a full handle */
+
+    TRACE("hwnd=%04x, cmd=%d\n", hwnd, cmd);
+
+    wasVisible = (wndPtr->dwStyle & WS_VISIBLE) != 0;
+
+    switch(cmd)
+    {
+        case SW_HIDE:
+            if (!wasVisible) goto END;;
+	    swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE |
+		        SWP_NOACTIVATE | SWP_NOZORDER;
+	    break;
+
+	case SW_SHOWMINNOACTIVE:
+            swp |= SWP_NOACTIVATE | SWP_NOZORDER;
+            /* fall through */
+	case SW_SHOWMINIMIZED:
+            swp |= SWP_SHOWWINDOW;
+            /* fall through */
+	case SW_MINIMIZE:
+            swp |= SWP_FRAMECHANGED;
+            if( !(wndPtr->dwStyle & WS_MINIMIZE) )
+		 swp |= WINPOS_MinMaximize( hwnd, SW_MINIMIZE, &newPos );
+            else swp |= SWP_NOSIZE | SWP_NOMOVE;
+	    break;
+
+	case SW_SHOWMAXIMIZED: /* same as SW_MAXIMIZE */
+            swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;
+            if( !(wndPtr->dwStyle & WS_MAXIMIZE) )
+		 swp |= WINPOS_MinMaximize( hwnd, SW_MAXIMIZE, &newPos );
+            else swp |= SWP_NOSIZE | SWP_NOMOVE;
+            break;
+
+	case SW_SHOWNA:
+            swp |= SWP_NOACTIVATE | SWP_NOZORDER;
+            /* fall through */
+	case SW_SHOW:
+	    swp |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
+
+	    /*
+	     * ShowWindow has a little peculiar behavior that if the
+	     * window is already the topmost window, it will not
+	     * activate it.
+	     */
+	    if (GetTopWindow((HWND)0)==hwnd && (wasVisible || GetActiveWindow() == hwnd))
+	      swp |= SWP_NOACTIVATE;
+
+	    break;
+
+	case SW_SHOWNOACTIVATE:
+            swp |= SWP_NOZORDER;
+            if (GetActiveWindow()) swp |= SWP_NOACTIVATE;
+            /* fall through */
+	case SW_SHOWNORMAL:  /* same as SW_NORMAL: */
+	case SW_SHOWDEFAULT: /* FIXME: should have its own handler */
+	case SW_RESTORE:
+	    swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;
+
+            if( wndPtr->dwStyle & (WS_MINIMIZE | WS_MAXIMIZE) )
+		 swp |= WINPOS_MinMaximize( hwnd, SW_RESTORE, &newPos );
+            else swp |= SWP_NOSIZE | SWP_NOMOVE;
+	    break;
+    }
+
+    showFlag = (cmd != SW_HIDE);
+    if (showFlag != wasVisible)
+    {
+        SendMessageA( hwnd, WM_SHOWWINDOW, showFlag, 0 );
+        if (!IsWindow( hwnd )) goto END;
+    }
+
+    /* We can't activate a child window */
+    if ((wndPtr->dwStyle & WS_CHILD) &&
+        !(wndPtr->dwExStyle & WS_EX_MDICHILD))
+        swp |= SWP_NOACTIVATE | SWP_NOZORDER;
+
+    SetWindowPos( hwnd, HWND_TOP, newPos.left, newPos.top,
+                  newPos.right, newPos.bottom, LOWORD(swp) );
+    if (cmd == SW_HIDE)
+    {
+        /* FIXME: This will cause the window to be activated irrespective
+         * of whether it is owned by the same thread. Has to be done
+         * asynchronously.
+         */
+
+        if (hwnd == GetActiveWindow())
+            WINPOS_ActivateOtherWindow(hwnd);
+
+        /* Revert focus to parent */
+        if (hwnd == GetFocus() || IsChild(hwnd, GetFocus()))
+            SetFocus( GetParent(hwnd) );
+    }
+    if (!IsWindow( hwnd )) goto END;
+    else if( wndPtr->dwStyle & WS_MINIMIZE ) WINPOS_ShowIconTitle( hwnd, TRUE );
+
+    if (wndPtr->flags & WIN_NEED_SIZE)
+    {
+        /* should happen only in CreateWindowEx() */
+	int wParam = SIZE_RESTORED;
+
+	wndPtr->flags &= ~WIN_NEED_SIZE;
+	if (wndPtr->dwStyle & WS_MAXIMIZE) wParam = SIZE_MAXIMIZED;
+	else if (wndPtr->dwStyle & WS_MINIMIZE) wParam = SIZE_MINIMIZED;
+	SendMessageA( hwnd, WM_SIZE, wParam,
+		     MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left,
+			    wndPtr->rectClient.bottom-wndPtr->rectClient.top));
+	SendMessageA( hwnd, WM_MOVE, 0,
+		   MAKELONG(wndPtr->rectClient.left, wndPtr->rectClient.top) );
+    }
+
+END:
+    WIN_ReleaseWndPtr(wndPtr);
+    return wasVisible;
+}

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux