SetShellWindow()

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

 



Changelog:
* Implement SetShellWindow(), SetShellWindowEx() and GetShellWindow()

-- 
Martin Fuchs
martin-fuchs@gmx.net
Index: dlls/user/focus.c
===================================================================
RCS file: /home/wine/wine/dlls/user/focus.c,v
retrieving revision 1.4
diff -u -r1.4 focus.c
--- dlls/user/focus.c	22 Nov 2002 21:22:16 -0000	1.4
+++ dlls/user/focus.c	15 Aug 2003 15:32:46 -0000
@@ -81,6 +81,12 @@
         return TRUE;
     }
 
+	if (hwnd == GetShellWindow())
+	{
+		TRACE("set_active_window(%p): ignored for desktop window\n", hwnd);
+		return TRUE;
+	}
+
     /* call CBT hook chain */
     cbt.fMouse     = mouse;
     cbt.hWndActive = previous;
@@ -341,3 +347,57 @@
     SERVER_END_REQ;
     return ret;
 }
+
+
+/***********************************************************************
+*      SetShellWindowEx (USER32.@)
+* hwndShell =    Progman[Program Manager]
+*                |-> SHELLDLL_DefView
+* hwndListView = |   |-> SysListView32
+*                |   |   |-> tooltips_class32
+*                |   |
+*                |   |-> SysHeader32
+*                |
+*                |-> ProxyTarget
+*/
+BOOL WINAPI SetShellWindowEx(HWND hwndShell, HWND hwndListView)
+{
+	BOOL ret;
+
+    SERVER_START_REQ(set_shell_windows)
+    {
+        req->shell_window = hwndShell;
+        req->shell_listview = hwndListView;
+
+        ret = !wine_server_call_err(req);
+    }
+    SERVER_END_REQ;
+
+	return ret;
+}
+
+/*******************************************************************
+*      SetShellWindow (USER32.@)
+*/
+BOOL WINAPI SetShellWindow(HWND hwndShell)
+{  
+	return SetShellWindowEx(hwndShell, hwndShell);
+}
+
+/*******************************************************************
+*      GetShellWindow (USER32.@)
+*/
+HWND WINAPI GetShellWindow()
+{
+	HWND hwndShell = 0;
+
+    SERVER_START_REQ(get_shell_windows)
+    {
+        if (!wine_server_call_err(req))
+			hwndShell = reply->shell_window;
+    }
+    SERVER_END_REQ;
+
+	return hwndShell;
+}
+
Index: include/wine/server_protocol.h
===================================================================
RCS file: /home/wine/wine/include/wine/server_protocol.h,v
retrieving revision 1.78
diff -u -r1.78 server_protocol.h
--- include/wine/server_protocol.h	26 Jul 2003 20:36:43 -0000	1.78
+++ include/wine/server_protocol.h	15 Aug 2003 15:32:49 -0000
@@ -3100,6 +3100,32 @@
 #define OPEN_TOKEN_AS_SELF  2
 
 
+
+struct set_shell_windows_request
+{
+    struct request_header __header;
+    user_handle_t	shell_window;
+    user_handle_t	shell_listview;
+};
+struct set_shell_windows_reply
+{
+    struct reply_header __header;
+};
+
+
+struct get_shell_windows_request
+{
+    struct request_header __header;
+};
+struct get_shell_windows_reply
+{
+    struct reply_header __header;
+    user_handle_t	shell_window;
+	user_handle_t	shell_listview;
+};
+
+
+
 enum request
 {
     REQ_new_process,
@@ -3279,6 +3305,8 @@
     REQ_get_next_hook,
     REQ_set_clipboard_info,
     REQ_open_token,
+    REQ_set_shell_windows,
+    REQ_get_shell_windows,
     REQ_NB_REQUESTS
 };
 
@@ -3463,6 +3491,8 @@
     struct get_next_hook_request get_next_hook_request;
     struct set_clipboard_info_request set_clipboard_info_request;
     struct open_token_request open_token_request;
+    struct set_shell_windows_request set_shell_windows_request;
+    struct get_shell_windows_request get_shell_windows_request;
 };
 union generic_reply
 {
@@ -3645,8 +3675,10 @@
     struct get_next_hook_reply get_next_hook_reply;
     struct set_clipboard_info_reply set_clipboard_info_reply;
     struct open_token_reply open_token_reply;
+    struct set_shell_windows_reply set_shell_windows_reply;
+    struct get_shell_windows_reply get_shell_windows_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 118
+#define SERVER_PROTOCOL_VERSION 119
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
Index: server/protocol.def
===================================================================
RCS file: /home/wine/wine/server/protocol.def,v
retrieving revision 1.78
diff -u -r1.78 protocol.def
--- server/protocol.def	26 Jul 2003 20:36:43 -0000	1.78
+++ server/protocol.def	15 Aug 2003 15:32:55 -0000
@@ -2173,3 +2173,18 @@
 @END
 #define OPEN_TOKEN_THREAD   1
 #define OPEN_TOKEN_AS_SELF  2
+
+
+/* Set the shell windows */
+@REQ(set_shell_windows)
+    user_handle_t	shell_window;	/* handle to the new shell window */
+    user_handle_t	shell_listview;	/* handle to the new shell listview window */
+@END
+
+/* Get the shell windows */
+@REQ(get_shell_windows)
+@REPLY
+    user_handle_t	shell_window;	/* handle to the shell window */
+	user_handle_t	shell_listview;	/* handle to the shell listview window */
+@END
+
Index: server/queue.c
===================================================================
RCS file: /home/wine/wine/server/queue.c,v
retrieving revision 1.42
diff -u -r1.42 queue.c
--- server/queue.c	26 Jul 2003 20:36:43 -0000	1.42
+++ server/queue.c	15 Aug 2003 15:32:57 -0000
@@ -1807,3 +1807,42 @@
         else input->caret_state = !!req->state;
     }
 }
+
+
+/* globally stored shell window handles */
+
+static HWND hwndShellWindow = 0;
+static HWND hwndShellListView = 0;
+
+/* id of the process, which currently owns the shell window */
+static DWORD pidShellWindow = 0;
+
+
+/* set the shell windows */
+DECL_HANDLER(set_shell_windows)
+{
+	/* test if we are permitted to change the shell window */
+	if (pidShellWindow && current->process->id!=pidShellWindow)
+	{
+		set_error(STATUS_ACCESS_DENIED);
+	}
+	else
+	{
+		hwndShellWindow = req->shell_window;
+		hwndShellListView = req->shell_listview;
+
+		if (hwndShellWindow)
+			pidShellWindow = current->process->id;	/* request shell window for the calling process */
+		else
+			pidShellWindow = 0;						/* shell window is now free for other processes. */
+	}
+}
+
+
+/* get the shell windows */
+DECL_HANDLER(get_shell_windows)
+{
+	reply->shell_window = hwndShellWindow;
+	reply->shell_listview = hwndShellListView;
+}
+
Index: server/request.h
===================================================================
RCS file: /home/wine/wine/server/request.h,v
retrieving revision 1.87
diff -u -r1.87 request.h
--- server/request.h	24 Jul 2003 00:07:00 -0000	1.87
+++ server/request.h	15 Aug 2003 15:32:57 -0000
@@ -280,6 +280,8 @@
 DECL_HANDLER(get_next_hook);
 DECL_HANDLER(set_clipboard_info);
 DECL_HANDLER(open_token);
+DECL_HANDLER(set_shell_windows);
+DECL_HANDLER(get_shell_windows);
 
 #ifdef WANT_REQUEST_HANDLERS
 
@@ -463,6 +465,8 @@
     (req_handler)req_get_next_hook,
     (req_handler)req_set_clipboard_info,
     (req_handler)req_open_token,
+    (req_handler)req_set_shell_windows,
+    (req_handler)req_get_shell_windows,
 };
 #endif  /* WANT_REQUEST_HANDLERS */
 
Index: server/trace.c
===================================================================
RCS file: /home/wine/wine/server/trace.c,v
retrieving revision 1.175
diff -u -r1.175 trace.c
--- server/trace.c	26 Jul 2003 20:36:43 -0000	1.175
+++ server/trace.c	15 Aug 2003 15:32:59 -0000
@@ -2498,6 +2498,22 @@
     fprintf( stderr, " token=%p", req->token );
 }
 
+static void dump_set_shell_windows_request( const struct set_shell_windows_request *req )
+{
+    fprintf( stderr, " shell_window=%p,", req->shell_window );
+    fprintf( stderr, " shell_listview=%p", req->shell_listview );
+}
+
+static void dump_get_shell_windows_request( const struct get_shell_windows_request *req )
+{
+}
+
+static void dump_get_shell_windows_reply( const struct get_shell_windows_reply *req )
+{
+    fprintf( stderr, " shell_window=%p,", req->shell_window );
+    fprintf( stderr, " shell_listview=%p", req->shell_listview );
+}
+
 static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
     (dump_func)dump_new_process_request,
     (dump_func)dump_get_new_process_info_request,
@@ -2676,6 +2692,8 @@
     (dump_func)dump_get_next_hook_request,
     (dump_func)dump_set_clipboard_info_request,
     (dump_func)dump_open_token_request,
+    (dump_func)dump_set_shell_windows_request,
+    (dump_func)dump_get_shell_windows_request,
 };
 
 static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
@@ -2856,6 +2874,8 @@
     (dump_func)dump_get_next_hook_reply,
     (dump_func)dump_set_clipboard_info_reply,
     (dump_func)dump_open_token_reply,
+    (dump_func)0,
+    (dump_func)dump_get_shell_windows_reply,
 };
 
 static const char * const req_names[REQ_NB_REQUESTS] = {
@@ -3036,6 +3056,8 @@
     "get_next_hook",
     "set_clipboard_info",
     "open_token",
+    "set_shell_windows",
+    "get_shell_windows",
 };
 
 /* ### make_requests end ### */
Index: windows/winpos.c
===================================================================
RCS file: /home/wine/wine/windows/winpos.c,v
retrieving revision 1.145
diff -u -r1.145 winpos.c
--- windows/winpos.c	19 May 2003 19:00:02 -0000	1.145
+++ windows/winpos.c	15 Aug 2003 15:33:01 -0000
@@ -65,7 +65,6 @@
 
 /* ----- internal variables ----- */
 
-static HWND hGlobalShellWindow=0; /*the shell*/
 static HWND hGlobalTaskmanWindow=0;
 static HWND hGlobalProgmanWindow=0;
 
@@ -630,27 +629,6 @@
 }
 
 
-/*******************************************************************
- *		SetShellWindow (USER32.@)
- */
-HWND WINAPI SetShellWindow(HWND hwndshell)
-{   WARN("(hWnd=%p) semi stub\n",hwndshell );
-
-    hGlobalShellWindow = WIN_GetFullHandle( hwndshell );
-    return hGlobalShellWindow;
-}
-
-
-/*******************************************************************
- *		GetShellWindow (USER32.@)
- */
-HWND WINAPI GetShellWindow(void)
-{   WARN("(hWnd=%p) semi stub\n",hGlobalShellWindow );
-
-    return hGlobalShellWindow;
-}
-
-
 /***********************************************************************
  *		BringWindowToTop (USER32.@)
  */
@@ -1360,25 +1338,6 @@
 HWND WINAPI GetProgmanWindow(void)
 {
 	return hGlobalProgmanWindow;
-}
-
-/***********************************************************************
- *		SetShellWindowEx (USER32.@)
- * hwndProgman =  Progman[Program Manager]
- *                |-> SHELLDLL_DefView
- * hwndListView = |   |-> SysListView32
- *                |   |   |-> tooltips_class32
- *                |   |
- *                |   |-> SysHeader32
- *                |
- *                |-> ProxyTarget
- */
-HWND WINAPI SetShellWindowEx ( HWND hwndProgman, HWND hwndListView )
-{
-	FIXME("%p %p stub\n",hwndProgman ,hwndListView );
-	hGlobalShellWindow = hwndProgman;
-	return hGlobalShellWindow;
-
 }
 
 /***********************************************************************

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

  Powered by Linux