PATCH[1/6] user32.dll:SwitchDesktop API Implementation

shanmukha sainath addepalli sainath.addepalli at gmail.com
Sat Aug 29 00:51:49 CDT 2009


Hi,

       These are the series of patches for SwitchDesktop and
OpenInputDesktop API implementation in user32.dll

       SwitchDesktop API when called switches to another desktop and makes
it active.

       First patch is the implementation of SwitchDesktop API in
user32/win.c.This function calls the Declaration handler for the
switchdesktop.

*Change Log:* Implemented SwitchDesktop API

---
Regards
Sainath A
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20090829/3739a562/attachment-0001.htm>
-------------- next part --------------
From 9914f47d88127f25aa9ad154ed971a5ee5e3f5de Mon Sep 17 00:00:00 2001
From: Sainath Addepalli <sainath.addepalli at gmail.com>
Date: Fri, 28 Aug 2009 18:22:50 +0530
Subject: SwithcDesktop API

---
 dlls/user32/win.c |   44 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 44b15b1..0537180 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -3402,8 +3402,48 @@ BOOL WINAPI GetWindowInfo( HWND hwnd, PWINDOWINFO pwi)
  */
 BOOL WINAPI SwitchDesktop( HDESK hDesktop)
 {
-    FIXME("SwitchDesktop(hwnd %p) stub!\n", hDesktop);
-    return TRUE;
+    BOOL ret = 0;
+    DWORD thread = GetCurrentThreadId();
+    HWND *list_old = NULL, *list_new = NULL, *list = NULL;
+    int size = 128, count_old = 0, count_new = 0, i = 0, j = 0;
+
+    TRACE( "Switching to Desktop %p\n", hDesktop );
+
+    if (!(list = HeapAlloc( GetProcessHeap(), 0, size * sizeof(HWND) ))) return ret;
+    if (!(list_old = HeapAlloc( GetProcessHeap(), 0, size * sizeof(HWND) ))) goto end1;
+    if (!(list_new = HeapAlloc( GetProcessHeap(), 0, size * sizeof(HWND) ))) goto end2;
+    SERVER_START_REQ( switch_desktop )
+    {
+	req->handle = wine_server_obj_handle( hDesktop );
+	req->tid    = thread;
+	wine_server_add_data( req, list, (size-1) * sizeof(user_handle_t) );
+	wine_server_set_reply( req, list_old, (size-1) * sizeof(user_handle_t) );
+	ret = !wine_server_call( req );
+	count_old = reply->old_desktop_count;
+	count_new = reply->new_desktop_count;
+    }
+    SERVER_END_REQ;
+
+    if (count_old)
+    {
+	for (i = count_old-1; i>=0; i--)
+	    list_old[i] = wine_server_ptr_handle( ((user_handle_t *)list_old) [i] );
+	for (i = 0; i < count_old; i++)
+	    ret = ShowWindowAsync( list_old[i], SW_HIDE );
+    }
+    if (count_new)
+    {
+	for (i = count_old,j = 0; i < count_old+count_new; i++, j++)
+	    list_new[j] = wine_server_ptr_handle( ((user_handle_t *)list_old) [i] );
+	for (i = 0; i < count_new; i++)
+	    ret = ShowWindowAsync( list_new[i], SW_SHOW );
+    }
+
+    HeapFree( GetProcessHeap(), 0, list_new );
+    end2:HeapFree( GetProcessHeap(), 0, list_old );
+    end1:HeapFree( GetProcessHeap(), 0, list );
+
+    return ret;
 }
 
 /*****************************************************************************
-- 
1.6.0.4


More information about the wine-patches mailing list