localspl: Add unixname port extension.
[wine.git] / dlls / user32 / focus.c
blob2d15aa9c6e79c7345575eba5ec4826e64e2be947
1 /*
2 * Focus and activation functions
4 * Copyright 1993 David Metcalfe
5 * Copyright 1995 Alex Korobka
6 * Copyright 1994, 2002 Alexandre Julliard
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "user_private.h"
24 #include "wine/server.h"
27 /*******************************************************************
28 * SetForegroundWindow (USER32.@)
30 BOOL WINAPI SetForegroundWindow( HWND hwnd )
32 return NtUserSetForegroundWindow( hwnd );
36 /*******************************************************************
37 * GetActiveWindow (USER32.@)
39 HWND WINAPI GetActiveWindow(void)
41 GUITHREADINFO info;
42 info.cbSize = sizeof(info);
43 return NtUserGetGUIThreadInfo( GetCurrentThreadId(), &info ) ? info.hwndActive : 0;
47 /*****************************************************************
48 * GetFocus (USER32.@)
50 HWND WINAPI GetFocus(void)
52 GUITHREADINFO info;
53 info.cbSize = sizeof(info);
54 return NtUserGetGUIThreadInfo( GetCurrentThreadId(), &info ) ? info.hwndFocus : 0;
58 /***********************************************************************
59 * SetShellWindowEx (USER32.@)
60 * hwndShell = Progman[Program Manager]
61 * |-> SHELLDLL_DefView
62 * hwndListView = | |-> SysListView32
63 * | | |-> tooltips_class32
64 * | |
65 * | |-> SysHeader32
66 * |
67 * |-> ProxyTarget
69 BOOL WINAPI SetShellWindowEx(HWND hwndShell, HWND hwndListView)
71 BOOL ret;
73 if (GetShellWindow())
74 return FALSE;
76 if (GetWindowLongW(hwndShell, GWL_EXSTYLE) & WS_EX_TOPMOST)
77 return FALSE;
79 if (hwndListView != hwndShell)
80 if (GetWindowLongW(hwndListView, GWL_EXSTYLE) & WS_EX_TOPMOST)
81 return FALSE;
83 if (hwndListView && hwndListView!=hwndShell)
84 NtUserSetWindowPos( hwndListView, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE );
86 NtUserSetWindowPos( hwndShell, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE );
88 SERVER_START_REQ(set_global_windows)
90 req->flags = SET_GLOBAL_SHELL_WINDOWS;
91 req->shell_window = wine_server_user_handle( hwndShell );
92 req->shell_listview = wine_server_user_handle( hwndListView );
93 ret = !wine_server_call_err(req);
95 SERVER_END_REQ;
97 return ret;
101 /*******************************************************************
102 * SetShellWindow (USER32.@)
104 BOOL WINAPI SetShellWindow(HWND hwndShell)
106 return SetShellWindowEx(hwndShell, hwndShell);
110 /*******************************************************************
111 * GetShellWindow (USER32.@)
113 HWND WINAPI GetShellWindow(void)
115 HWND hwndShell = 0;
117 SERVER_START_REQ(set_global_windows)
119 req->flags = 0;
120 if (!wine_server_call_err(req))
121 hwndShell = wine_server_ptr_handle( reply->old_shell_window );
123 SERVER_END_REQ;
125 return hwndShell;
129 /***********************************************************************
130 * SetProgmanWindow (USER32.@)
132 HWND WINAPI SetProgmanWindow ( HWND hwnd )
134 SERVER_START_REQ(set_global_windows)
136 req->flags = SET_GLOBAL_PROGMAN_WINDOW;
137 req->progman_window = wine_server_user_handle( hwnd );
138 if (wine_server_call_err( req )) hwnd = 0;
140 SERVER_END_REQ;
141 return hwnd;
145 /***********************************************************************
146 * GetProgmanWindow (USER32.@)
148 HWND WINAPI GetProgmanWindow(void)
150 HWND ret = 0;
152 SERVER_START_REQ(set_global_windows)
154 req->flags = 0;
155 if (!wine_server_call_err(req))
156 ret = wine_server_ptr_handle( reply->old_progman_window );
158 SERVER_END_REQ;
159 return ret;
163 /***********************************************************************
164 * SetTaskmanWindow (USER32.@)
165 * NOTES
166 * hwnd = MSTaskSwWClass
167 * |-> SysTabControl32
169 HWND WINAPI SetTaskmanWindow ( HWND hwnd )
171 SERVER_START_REQ(set_global_windows)
173 req->flags = SET_GLOBAL_TASKMAN_WINDOW;
174 req->taskman_window = wine_server_user_handle( hwnd );
175 if (wine_server_call_err( req )) hwnd = 0;
177 SERVER_END_REQ;
178 return hwnd;
181 /***********************************************************************
182 * GetTaskmanWindow (USER32.@)
184 HWND WINAPI GetTaskmanWindow(void)
186 HWND ret = 0;
188 SERVER_START_REQ(set_global_windows)
190 req->flags = 0;
191 if (!wine_server_call_err(req))
192 ret = wine_server_ptr_handle( reply->old_taskman_window );
194 SERVER_END_REQ;
195 return ret;