mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[0.4.9][NTUSER][USER32][OSK] Initial support of WS_EX_NOACTIVATE flag (#4731)
WS_EX_NOACTIVATE flag forbids the window to be activated fix picked from 0.4.15-dev-5137-g826bd41d88
(1 of 3 commits for CORE-18417) My reason for picking it is that it fixes CORE-13257 'Reboot leaving Evernote 5.9.8 in tray causes WIN32K BSOD 0x50' I also had to pick together with it the 0.4.15-dev-5491-g1fbed1710e
to prevent it from introducing (+2 failures in user32:msg_focus) unittests. ---------------- The above patch allows/encourages us to pick then also: 0.4.15-dev-5492-g47f3a4e144
[OSK] Delete WS_EX_NOACTIVATE workaround code (which referenced CORE-18528, but is not fixing this minor GUI glitch yet, it just removes workaround-code that is no longer needed, I just mention the ticket here, because the commit on master did that as well) ---------------- ---------------- The following 2 things were small *unrelated* improvements nearby, and I decided to take them with me: 0.4.15-dev-4323-g9f5cde9cbe
[WIN32K:NTUSER] window.c Remove broken assert in NtUserCreateWindowEx. CORE-18123 fixed and a tiny part of 0.4.15-dev-3476-g55a1c29341
[WIN32K] appswitch.c: delete unused func DWORD wtodw(const WCHAR *psz) ---------------- and also backport a few whitespace improvements in the files touched.
This commit is contained in:
parent
4f64a0cde3
commit
87ce8a9a83
7 changed files with 36 additions and 58 deletions
|
@ -1,7 +1,6 @@
|
|||
/*
|
||||
* PROJECT: ReactOS On-Screen Keyboard
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/applications/osk/main.c
|
||||
* PURPOSE: On-screen keyboard.
|
||||
* PROGRAMMERS: Denis ROBERT
|
||||
*/
|
||||
|
@ -66,7 +65,7 @@ int OSK_SetImage(int IdDlgItem, int IdResource)
|
|||
*/
|
||||
int OSK_DlgInitDialog(HWND hDlg)
|
||||
{
|
||||
HMONITOR monitor;
|
||||
HMONITOR monitor;
|
||||
MONITORINFO info;
|
||||
POINT Pt;
|
||||
RECT rcWindow;
|
||||
|
@ -76,7 +75,7 @@ int OSK_DlgInitDialog(HWND hDlg)
|
|||
|
||||
/* Get screen info */
|
||||
memset(&Pt, 0, sizeof(Pt));
|
||||
monitor = MonitorFromPoint(Pt, MONITOR_DEFAULTTOPRIMARY );
|
||||
monitor = MonitorFromPoint(Pt, MONITOR_DEFAULTTOPRIMARY);
|
||||
info.cbSize = sizeof(info);
|
||||
GetMonitorInfoW(monitor, &info);
|
||||
|
||||
|
@ -150,15 +149,6 @@ int OSK_DlgClose(void)
|
|||
*/
|
||||
int OSK_DlgTimer(void)
|
||||
{
|
||||
/* FIXME: To be deleted when ReactOS will support WS_EX_NOACTIVATE */
|
||||
HWND hWndActiveWindow;
|
||||
|
||||
hWndActiveWindow = GetForegroundWindow();
|
||||
if (hWndActiveWindow != NULL && hWndActiveWindow != Globals.hMainWnd)
|
||||
{
|
||||
Globals.hActiveWnd = hWndActiveWindow;
|
||||
}
|
||||
|
||||
/* Always redraw leds because it can be changed by the real keyboard) */
|
||||
InvalidateRect(GetDlgItem(Globals.hMainWnd, IDC_LED_NUM), NULL, TRUE);
|
||||
InvalidateRect(GetDlgItem(Globals.hMainWnd, IDC_LED_CAPS), NULL, TRUE);
|
||||
|
@ -182,19 +172,6 @@ BOOL OSK_DlgCommand(WPARAM wCommand, HWND hWndControl)
|
|||
BOOL bKeyUp;
|
||||
LONG WindowStyle;
|
||||
|
||||
/* FIXME: To be deleted when ReactOS will support WS_EX_NOACTIVATE */
|
||||
if (Globals.hActiveWnd)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
SetForegroundWindow(Globals.hActiveWnd);
|
||||
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
/* KeyDown and/or KeyUp ? */
|
||||
WindowStyle = GetWindowLong(hWndControl, GWL_STYLE);
|
||||
if ((WindowStyle & BS_AUTOCHECKBOX) == BS_AUTOCHECKBOX)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/*
|
||||
* PROJECT: ReactOS On-Screen Keyboard
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/applications/osk/main.h
|
||||
* PURPOSE: On screen keyboard.
|
||||
* PROGRAMMERS: Denis ROBERT
|
||||
*/
|
||||
|
@ -21,8 +20,6 @@ typedef struct
|
|||
HWND hMainWnd;
|
||||
HBRUSH hBrushGreenLed;
|
||||
UINT_PTR iTimer;
|
||||
/* FIXME: To be deleted when ReactOS will support WS_EX_NOACTIVATE */
|
||||
HWND hActiveWnd;
|
||||
} OSK_GLOBALS;
|
||||
|
||||
/* DEFINES ********************************************************************/
|
||||
|
|
|
@ -622,7 +622,7 @@ IsAllowedFGActive(PTHREADINFO pti, PWND Wnd)
|
|||
pti->rpdesk != gpdeskInputDesktop || // not current Desktop,
|
||||
pti->MessageQueue == gpqForeground || // if already the queue foreground,
|
||||
IsFGLocked() || // foreground is locked,
|
||||
Wnd->ExStyle & WS_EX_NOACTIVATE ) // or,,, does not become the foreground window when the user clicks it.
|
||||
(Wnd->ExStyle & WS_EX_NOACTIVATE)) // or, does not become the foreground window when the user clicks it.
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -929,9 +929,8 @@ co_IntSetActiveWindow(
|
|||
ThreadQueue = pti->MessageQueue;
|
||||
ASSERT(ThreadQueue != 0);
|
||||
|
||||
hWndPrev = ThreadQueue->spwndActive ? UserHMGetHandle(ThreadQueue->spwndActive) : NULL;
|
||||
|
||||
pWndChg = ThreadQueue->spwndActive; // Keep to notify of a preemptive switch.
|
||||
hWndPrev = (pWndChg ? UserHMGetHandle(pWndChg) : NULL);
|
||||
|
||||
if ( !Wnd || Wnd == UserGetDesktopWindow() )
|
||||
{
|
||||
|
@ -943,6 +942,9 @@ co_IntSetActiveWindow(
|
|||
hWnd = UserHMGetHandle(Wnd);
|
||||
//ERR("co_IntSetActiveWindow 2 hWnd 0x%p\n",hWnd);
|
||||
|
||||
if (Wnd->ExStyle & WS_EX_NOACTIVATE)
|
||||
return TRUE;
|
||||
|
||||
/* check if the specified window can be set in the input data of a given queue */
|
||||
if ( ThreadQueue != Wnd->head.pti->MessageQueue )
|
||||
{
|
||||
|
@ -1136,9 +1138,12 @@ BOOL FASTCALL
|
|||
co_IntMouseActivateWindow(PWND Wnd)
|
||||
{
|
||||
TRACE("Mouse Active\n");
|
||||
if (Wnd && (Wnd->ExStyle & WS_EX_NOACTIVATE))
|
||||
return TRUE;
|
||||
return co_IntSetForegroundAndFocusWindow(Wnd, TRUE, TRUE);
|
||||
}
|
||||
|
||||
/* Win: PWND xxxSetActiveWindow(Wnd) */
|
||||
BOOL FASTCALL
|
||||
UserSetActiveWindow( _In_opt_ PWND Wnd )
|
||||
{
|
||||
|
@ -1547,7 +1552,7 @@ NtUserSetActiveWindow(HWND hWnd)
|
|||
{
|
||||
USER_REFERENCE_ENTRY Ref;
|
||||
HWND hWndPrev;
|
||||
PWND Window;
|
||||
PWND Window, pwndPrev;
|
||||
DECLARE_RETURN(HWND);
|
||||
|
||||
TRACE("Enter NtUserSetActiveWindow(%p)\n", hWnd);
|
||||
|
@ -1566,11 +1571,12 @@ NtUserSetActiveWindow(HWND hWnd)
|
|||
if (!Window ||
|
||||
Window->head.pti->MessageQueue == gptiCurrent->MessageQueue)
|
||||
{
|
||||
hWndPrev = gptiCurrent->MessageQueue->spwndActive ? UserHMGetHandle(gptiCurrent->MessageQueue->spwndActive) : NULL;
|
||||
pwndPrev = gptiCurrent->MessageQueue->spwndActive;
|
||||
hWndPrev = (pwndPrev ? UserHMGetHandle(pwndPrev) : NULL);
|
||||
if (Window) UserRefObjectCo(Window, &Ref);
|
||||
UserSetActiveWindow(Window);
|
||||
if (Window) UserDerefObjectCo(Window);
|
||||
RETURN( hWndPrev ? (IntIsWindow(hWndPrev) ? hWndPrev : 0) : 0 );
|
||||
RETURN(hWndPrev ? (IntIsWindow(hWndPrev) ? hWndPrev : NULL) : NULL);
|
||||
}
|
||||
RETURN( NULL);
|
||||
|
||||
|
|
|
@ -481,13 +481,13 @@ DefWndDoSizeMove(PWND pwnd, WORD wParam)
|
|||
|
||||
//// This causes the mdi child window to jump up when it is moved.
|
||||
//IntMapWindowPoints( 0, pWndParent, (POINT *)&rect, 2 );
|
||||
co_WinPosSetWindowPos( pwnd,
|
||||
0,
|
||||
newRect.left,
|
||||
newRect.top,
|
||||
newRect.right - newRect.left,
|
||||
newRect.bottom - newRect.top,
|
||||
( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
|
||||
co_WinPosSetWindowPos(pwnd,
|
||||
NULL,
|
||||
newRect.left,
|
||||
newRect.top,
|
||||
newRect.right - newRect.left,
|
||||
newRect.bottom - newRect.top,
|
||||
SWP_NOACTIVATE | ((hittest == HTCAPTION) ? SWP_NOSIZE : 0));
|
||||
|
||||
hrgnNew = GreCreateRectRgnIndirect(&pwnd->rcWindow);
|
||||
if (pwnd->hrgnClip != NULL)
|
||||
|
@ -1462,7 +1462,8 @@ NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
|
|||
TopWnd = parent;
|
||||
}
|
||||
|
||||
if ( co_IntSetForegroundWindowMouse(TopWnd) ||
|
||||
if ( (pWnd && (pWnd->ExStyle & WS_EX_NOACTIVATE)) ||
|
||||
co_IntSetForegroundWindowMouse(TopWnd) ||
|
||||
//NtUserCallHwndLock(hTopWnd, HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE) ||
|
||||
UserGetActiveWindow() == UserHMGetHandle(TopWnd))
|
||||
{
|
||||
|
@ -1600,6 +1601,7 @@ LRESULT NC_HandleNCRButtonDown( PWND pwnd, WPARAM wParam, LPARAM lParam )
|
|||
if (UserHMGetHandle(pwnd) != IntGetCapture()) return 0;
|
||||
}
|
||||
IntReleaseCapture();
|
||||
|
||||
if (hittest == HTCAPTION || hittest == HTSYSMENU || hittest == HTHSCROLL || hittest == HTVSCROLL)
|
||||
{
|
||||
TRACE("Msg pt %x and Msg.lParam %x and lParam %x\n",MAKELONG(msg.pt.x,msg.pt.y),msg.lParam,lParam);
|
||||
|
|
|
@ -2248,7 +2248,11 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
|||
|
||||
SwFlag = co_WinPosMinMaximize(Window, SwFlag, &NewPos);
|
||||
SwFlag |= SWP_NOZORDER|SWP_FRAMECHANGED; /* Frame always gets changed */
|
||||
if (!(style & WS_VISIBLE) || (style & WS_CHILD) || UserGetActiveWindow()) SwFlag |= SWP_NOACTIVATE;
|
||||
if (!(style & WS_VISIBLE) || (style & WS_CHILD) || UserGetActiveWindow() ||
|
||||
(Window->ExStyle & WS_EX_NOACTIVATE))
|
||||
{
|
||||
SwFlag |= SWP_NOACTIVATE;
|
||||
}
|
||||
co_WinPosSetWindowPos(Window, 0, NewPos.left, NewPos.top,
|
||||
NewPos.right, NewPos.bottom, SwFlag);
|
||||
}
|
||||
|
@ -2429,8 +2433,6 @@ NtUserCreateWindowEx(
|
|||
lstrClassName.Buffer = NULL;
|
||||
lstrClsVersion.Buffer = NULL;
|
||||
|
||||
ASSERT(plstrWindowName);
|
||||
|
||||
if ( (dwStyle & (WS_POPUP|WS_CHILD)) != WS_CHILD)
|
||||
{
|
||||
/* check hMenu is valid handle */
|
||||
|
@ -4396,7 +4398,6 @@ IntShowOwnedPopups(PWND OwnerWnd, BOOL fShow )
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
ExFreePoolWithTag(win_array, USERTAG_WINDOWLIST);
|
||||
TRACE("Leave ShowOwnedPopups\n");
|
||||
|
|
|
@ -379,6 +379,7 @@ BOOL FASTCALL can_activate_window( PWND Wnd OPTIONAL)
|
|||
if (!(style & WS_VISIBLE)) return FALSE;
|
||||
if (style & WS_MINIMIZE) return FALSE;
|
||||
if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
|
||||
if (Wnd->ExStyle & WS_EX_NOACTIVATE) return FALSE;
|
||||
return TRUE;
|
||||
/* FIXME: This window could be disable because the child that closed
|
||||
was a popup. */
|
||||
|
|
|
@ -71,18 +71,6 @@ int CoolSwitchColumns = 7;
|
|||
const DWORD Style = WS_POPUP | WS_BORDER | WS_DISABLED;
|
||||
const DWORD ExStyle = WS_EX_TOPMOST | WS_EX_DLGMODALFRAME | WS_EX_TOOLWINDOW;
|
||||
|
||||
DWORD wtodw(const WCHAR *psz)
|
||||
{
|
||||
const WCHAR *pch = psz;
|
||||
DWORD Value = 0;
|
||||
while ('0' <= *pch && *pch <= '9')
|
||||
{
|
||||
Value *= 10;
|
||||
Value += *pch - L'0';
|
||||
}
|
||||
return Value;
|
||||
}
|
||||
|
||||
BOOL LoadCoolSwitchSettings(void)
|
||||
{
|
||||
CoolSwitch = TRUE;
|
||||
|
@ -165,12 +153,18 @@ void CompleteSwitch(BOOL doSwitch)
|
|||
BOOL CALLBACK EnumerateCallback(HWND window, LPARAM lParam)
|
||||
{
|
||||
HICON hIcon;
|
||||
DWORD ExStyle;
|
||||
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
|
||||
if (!IsWindowVisible(window))
|
||||
return TRUE;
|
||||
|
||||
// must not be WS_EX_TOOLWINDOW nor WS_EX_NOACTIVATE
|
||||
ExStyle = GetWindowLongPtrW(window, GWL_EXSTYLE);
|
||||
if (ExStyle & (WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE))
|
||||
return TRUE;
|
||||
|
||||
GetClassNameW(window, windowText, _countof(windowText));
|
||||
if ((wcscmp(L"Shell_TrayWnd", windowText)==0) ||
|
||||
(wcscmp(L"Progman", windowText)==0) )
|
||||
|
|
Loading…
Reference in a new issue