2002-10-12 01:41:06 +02:00
|
|
|
/*
|
|
|
|
* Focus and activation functions
|
|
|
|
*
|
|
|
|
* Copyright 1993 David Metcalfe
|
|
|
|
* Copyright 1995 Alex Korobka
|
|
|
|
* Copyright 1994, 2002 Alexandre Julliard
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-10-12 01:41:06 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
2002-10-12 01:41:06 +02:00
|
|
|
#include "winbase.h"
|
2012-09-27 18:13:01 +02:00
|
|
|
#include "wingdi.h"
|
2002-10-12 01:41:06 +02:00
|
|
|
#include "winuser.h"
|
|
|
|
#include "win.h"
|
2021-10-16 21:21:13 +02:00
|
|
|
#include "imm.h"
|
2004-12-08 19:06:14 +01:00
|
|
|
#include "user_private.h"
|
2002-10-12 01:41:06 +02:00
|
|
|
#include "wine/server.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
* FOCUS_MouseActivate
|
|
|
|
*
|
|
|
|
* Activate a window as a result of a mouse click
|
|
|
|
*/
|
|
|
|
BOOL FOCUS_MouseActivate( HWND hwnd )
|
|
|
|
{
|
2022-04-13 15:08:21 +02:00
|
|
|
return NtUserSetForegroundWindow( hwnd, TRUE );
|
2002-10-12 01:41:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
* SetForegroundWindow (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SetForegroundWindow( HWND hwnd )
|
|
|
|
{
|
2022-04-13 15:08:21 +02:00
|
|
|
return NtUserSetForegroundWindow( hwnd, FALSE );
|
2002-10-12 01:41:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
* GetActiveWindow (USER32.@)
|
|
|
|
*/
|
|
|
|
HWND WINAPI GetActiveWindow(void)
|
|
|
|
{
|
2022-02-24 01:28:38 +01:00
|
|
|
GUITHREADINFO info;
|
|
|
|
info.cbSize = sizeof(info);
|
|
|
|
return NtUserGetGUIThreadInfo( GetCurrentThreadId(), &info ) ? info.hwndActive : 0;
|
2002-10-12 01:41:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
* GetFocus (USER32.@)
|
|
|
|
*/
|
|
|
|
HWND WINAPI GetFocus(void)
|
|
|
|
{
|
2022-02-24 01:28:44 +01:00
|
|
|
GUITHREADINFO info;
|
|
|
|
info.cbSize = sizeof(info);
|
|
|
|
return NtUserGetGUIThreadInfo( GetCurrentThreadId(), &info ) ? info.hwndFocus : 0;
|
2002-10-12 01:41:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-07 05:40:23 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* SetShellWindowEx (USER32.@)
|
|
|
|
* hwndShell = Progman[Program Manager]
|
|
|
|
* |-> SHELLDLL_DefView
|
|
|
|
* hwndListView = | |-> SysListView32
|
|
|
|
* | | |-> tooltips_class32
|
|
|
|
* | |
|
|
|
|
* | |-> SysHeader32
|
|
|
|
* |
|
|
|
|
* |-> ProxyTarget
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SetShellWindowEx(HWND hwndShell, HWND hwndListView)
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
|
2003-11-18 01:13:34 +01:00
|
|
|
if (GetShellWindow())
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (GetWindowLongW(hwndShell, GWL_EXSTYLE) & WS_EX_TOPMOST)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (hwndListView != hwndShell)
|
|
|
|
if (GetWindowLongW(hwndListView, GWL_EXSTYLE) & WS_EX_TOPMOST)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (hwndListView && hwndListView!=hwndShell)
|
2022-03-15 14:27:14 +01:00
|
|
|
NtUserSetWindowPos( hwndListView, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE );
|
2003-11-18 01:13:34 +01:00
|
|
|
|
2022-03-15 14:27:14 +01:00
|
|
|
NtUserSetWindowPos( hwndShell, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE );
|
2003-11-18 01:13:34 +01:00
|
|
|
|
2003-10-07 05:40:23 +02:00
|
|
|
SERVER_START_REQ(set_global_windows)
|
|
|
|
{
|
|
|
|
req->flags = SET_GLOBAL_SHELL_WINDOWS;
|
2008-12-08 16:58:20 +01:00
|
|
|
req->shell_window = wine_server_user_handle( hwndShell );
|
|
|
|
req->shell_listview = wine_server_user_handle( hwndListView );
|
2003-10-07 05:40:23 +02:00
|
|
|
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(void)
|
|
|
|
{
|
|
|
|
HWND hwndShell = 0;
|
|
|
|
|
|
|
|
SERVER_START_REQ(set_global_windows)
|
|
|
|
{
|
|
|
|
req->flags = 0;
|
|
|
|
if (!wine_server_call_err(req))
|
2008-12-08 16:58:20 +01:00
|
|
|
hwndShell = wine_server_ptr_handle( reply->old_shell_window );
|
2003-10-07 05:40:23 +02:00
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
|
|
|
|
return hwndShell;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SetProgmanWindow (USER32.@)
|
|
|
|
*/
|
|
|
|
HWND WINAPI SetProgmanWindow ( HWND hwnd )
|
|
|
|
{
|
|
|
|
SERVER_START_REQ(set_global_windows)
|
|
|
|
{
|
|
|
|
req->flags = SET_GLOBAL_PROGMAN_WINDOW;
|
2008-12-08 16:58:20 +01:00
|
|
|
req->progman_window = wine_server_user_handle( hwnd );
|
2003-10-07 05:40:23 +02:00
|
|
|
if (wine_server_call_err( req )) hwnd = 0;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return hwnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetProgmanWindow (USER32.@)
|
|
|
|
*/
|
|
|
|
HWND WINAPI GetProgmanWindow(void)
|
|
|
|
{
|
|
|
|
HWND ret = 0;
|
|
|
|
|
|
|
|
SERVER_START_REQ(set_global_windows)
|
|
|
|
{
|
|
|
|
req->flags = 0;
|
2008-12-08 16:58:20 +01:00
|
|
|
if (!wine_server_call_err(req))
|
|
|
|
ret = wine_server_ptr_handle( reply->old_progman_window );
|
2003-10-07 05:40:23 +02:00
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SetTaskmanWindow (USER32.@)
|
|
|
|
* NOTES
|
|
|
|
* hwnd = MSTaskSwWClass
|
|
|
|
* |-> SysTabControl32
|
|
|
|
*/
|
|
|
|
HWND WINAPI SetTaskmanWindow ( HWND hwnd )
|
|
|
|
{
|
|
|
|
SERVER_START_REQ(set_global_windows)
|
|
|
|
{
|
|
|
|
req->flags = SET_GLOBAL_TASKMAN_WINDOW;
|
2008-12-08 16:58:20 +01:00
|
|
|
req->taskman_window = wine_server_user_handle( hwnd );
|
2003-10-07 05:40:23 +02:00
|
|
|
if (wine_server_call_err( req )) hwnd = 0;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return hwnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetTaskmanWindow (USER32.@)
|
|
|
|
*/
|
|
|
|
HWND WINAPI GetTaskmanWindow(void)
|
|
|
|
{
|
|
|
|
HWND ret = 0;
|
|
|
|
|
|
|
|
SERVER_START_REQ(set_global_windows)
|
|
|
|
{
|
|
|
|
req->flags = 0;
|
2008-12-08 16:58:20 +01:00
|
|
|
if (!wine_server_call_err(req))
|
|
|
|
ret = wine_server_ptr_handle( reply->old_taskman_window );
|
2003-10-07 05:40:23 +02:00
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
|
|
|
}
|