Send WM_STYLECHANGING/WM_STYLECHANGED when setting GWL_STYLE or GWL_EXSTYLE.

svn path=/trunk/; revision=4841
This commit is contained in:
Marty Dill 2003-06-05 03:55:36 +00:00
parent 56bcfe5420
commit 55c6517e00
6 changed files with 152 additions and 8 deletions

View file

@ -9,7 +9,9 @@
#define USER32_CALLBACK_SENDGETMINMAXINFO (5)
#define USER32_CALLBACK_SENDWINDOWPOSCHANGING (6)
#define USER32_CALLBACK_SENDWINDOWPOSCHANGED (7)
#define USER32_CALLBACK_MAXIMUM (7)
#define USER32_CALLBACK_SENDSTYLECHANGING (8)
#define USER32_CALLBACK_SENDSTYLECHANGED (9)
#define USER32_CALLBACK_MAXIMUM (9)
typedef struct _WINDOWPROC_CALLBACK_ARGUMENTS
{
@ -56,7 +58,7 @@ typedef struct _SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT
LRESULT Result;
RECT Rect;
NCCALCSIZE_PARAMS Params;
} SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT,
} SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT,
*PSENDNCCALCSIZEMESSAGE_CALLBACK_RESULT;
typedef struct _SENDGETMINMAXINFO_CALLBACK_ARGUMENTS
@ -83,6 +85,20 @@ typedef struct _SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS
WINDOWPOS WindowPos;
} SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS, *PSENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS;
typedef struct _SENDSTYLECHANGING_CALLBACK_ARGUMENTS
{
HWND Wnd;
STYLESTRUCT Style;
DWORD WhichStyle;
} SENDSTYLECHANGING_CALLBACK_ARGUMENTS, *PSENDSTYLECHANGING_CALLBACK_ARGUMENTS;
typedef struct _SENDSTYLECHANGED_CALLBACK_ARGUMENTS
{
HWND Wnd;
STYLESTRUCT Style;
DWORD WhichStyle;
} SENDSTYLECHANGED_CALLBACK_ARGUMENTS, *PSENDSTYLECHANGED_CALLBACK_ARGUMENTS;
NTSTATUS STDCALL
User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength);
NTSTATUS STDCALL
@ -99,5 +115,9 @@ NTSTATUS STDCALL
User32SendWINDOWPOSCHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
NTSTATUS STDCALL
User32SendWINDOWPOSCHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
NTSTATUS STDCALL
User32SendSTYLECHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
NTSTATUS STDCALL
User32SendSTYLECHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
#endif /* __INCLUDE_USER32_CALLBACK_H */

View file

@ -37,6 +37,10 @@ Init(VOID)
(PVOID)User32SendWINDOWPOSCHANGINGMessageForKernel;
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDWINDOWPOSCHANGED] =
(PVOID)User32SendWINDOWPOSCHANGEDMessageForKernel;
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDSTYLECHANGING] =
(PVOID)User32SendSTYLECHANGINGMessageForKernel;
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDSTYLECHANGED] =
(PVOID)User32SendSTYLECHANGEDMessageForKernel;
UserSetupInternalPos();

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.35 2003/05/23 17:07:12 rcampbell Exp $
/* $Id: window.c,v 1.36 2003/06/05 03:55:36 mdill Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -177,6 +177,52 @@ User32SendWINDOWPOSCHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
}
NTSTATUS STDCALL
User32SendSTYLECHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
{
PSENDSTYLECHANGING_CALLBACK_ARGUMENTS CallbackArgs;
WNDPROC Proc;
LRESULT Result;
DPRINT("User32SendSTYLECHANGINGMessageForKernel.\n");
CallbackArgs = (PSENDSTYLECHANGING_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(SENDSTYLECHANGING_CALLBACK_ARGUMENTS))
{
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_STYLECHANGING, CallbackArgs->WhichStyle,
(LPARAM)&CallbackArgs->Style);
DPRINT("Returning result %d.\n", Result);
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
}
NTSTATUS STDCALL
User32SendSTYLECHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
{
PSENDSTYLECHANGED_CALLBACK_ARGUMENTS CallbackArgs;
WNDPROC Proc;
LRESULT Result;
DPRINT("User32SendSTYLECHANGEDGMessageForKernel.\n");
CallbackArgs = (PSENDSTYLECHANGED_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(SENDSTYLECHANGED_CALLBACK_ARGUMENTS))
{
DPRINT("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
DPRINT("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_STYLECHANGED, CallbackArgs->WhichStyle,
(LPARAM)&CallbackArgs->Style);
DPRINT("Returning result %d.\n", Result);
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
}
NTSTATUS STDCALL
User32CallSendAsyncProcForKernel(PVOID Arguments, ULONG ArgumentLength)
{

View file

@ -35,4 +35,10 @@ W32kSendWINDOWPOSCHANGINGMessage(HWND Wnd, WINDOWPOS* WindowPos);
LRESULT STDCALL
W32kSendWINDOWPOSCHANGEDMessage(HWND Wnd, WINDOWPOS* WindowPos);
LRESULT STDCALL
W32kSendSTYLECHANGINGMessage(HWND Wnd, DWORD WhichStyle, STYLESTRUCT* Style);
LRESULT STDCALL
W32kSendSTYLECHANGEDMessage(HWND Wnd, DWORD WhichStyle, STYLESTRUCT* Style);
#endif /* __SUBSYS_WIN32K_INCLUDE_CALLBACK_H */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: callback.c,v 1.9 2003/05/18 17:16:17 ea Exp $
/* $Id: callback.c,v 1.10 2003/06/05 03:55:36 mdill Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -276,6 +276,59 @@ W32kSendWINDOWPOSCHANGEDMessage(HWND Wnd, WINDOWPOS* WindowPos)
return(Result);
}
LRESULT STDCALL
W32kSendSTYLECHANGINGMessage(HWND Wnd, DWORD WhichStyle, STYLESTRUCT* Style)
{
SENDSTYLECHANGING_CALLBACK_ARGUMENTS Arguments;
LRESULT Result;
NTSTATUS Status;
PVOID ResultPointer;
ULONG ResultLength;
Arguments.Wnd = Wnd;
Arguments.Style = *Style;
Arguments.WhichStyle = WhichStyle;
ResultPointer = &Result;
ResultLength = sizeof(LRESULT);
Status = NtW32Call(USER32_CALLBACK_SENDSTYLECHANGING,
&Arguments,
sizeof(SENDSTYLECHANGING_CALLBACK_ARGUMENTS),
&ResultPointer,
&ResultLength);
if (!NT_SUCCESS(Status))
{
return(0);
}
*Style = Arguments.Style;
return(Result);
}
LRESULT STDCALL
W32kSendSTYLECHANGEDMessage(HWND Wnd, DWORD WhichStyle, STYLESTRUCT* Style)
{
SENDSTYLECHANGED_CALLBACK_ARGUMENTS Arguments;
LRESULT Result;
NTSTATUS Status;
PVOID ResultPointer;
ULONG ResultLength;
Arguments.Wnd = Wnd;
Arguments.Style = *Style;
Arguments.WhichStyle = WhichStyle;
ResultPointer = &Result;
ResultLength = sizeof(LRESULT);
Status = NtW32Call(USER32_CALLBACK_SENDSTYLECHANGED,
&Arguments,
sizeof(SENDSTYLECHANGED_CALLBACK_ARGUMENTS),
&ResultPointer,
&ResultLength);
if (!NT_SUCCESS(Status))
{
return(0);
}
return(Result);
}
LRESULT STDCALL
W32kCallTrampolineWindowProc(WNDPROC Proc,
HWND Wnd,
@ -306,13 +359,19 @@ W32kCallTrampolineWindowProc(WNDPROC Proc,
return W32kSendNCCALCSIZEMessage(Wnd, FALSE, (RECT*)lParam, NULL);
}
}
case WM_WINDOWPOSCHANGING:
return W32kSendWINDOWPOSCHANGINGMessage(Wnd, (WINDOWPOS*) lParam);
case WM_WINDOWPOSCHANGED:
return W32kSendWINDOWPOSCHANGEDMessage(Wnd, (WINDOWPOS*) lParam);
case WM_STYLECHANGING:
return W32kSendSTYLECHANGINGMessage(Wnd, wParam, (STYLESTRUCT*) lParam);
case WM_STYLECHANGED:
return W32kSendSTYLECHANGEDMessage(Wnd, wParam, (STYLESTRUCT*) lParam);
default:
return(W32kCallWindowProc(Proc, Wnd, Message, wParam, lParam));
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: window.c,v 1.52 2003/06/03 15:43:57 jvangael Exp $
/* $Id: window.c,v 1.53 2003/06/05 03:55:36 mdill Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -1246,6 +1246,7 @@ NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
PWINDOW_OBJECT WindowObject;
NTSTATUS Status;
LONG OldValue;
STYLESTRUCT Style;
W32kGuiCheck();
@ -1277,12 +1278,20 @@ NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
{
case GWL_EXSTYLE:
OldValue = (LONG) WindowObject->ExStyle;
WindowObject->ExStyle = (DWORD) NewValue;
Style.styleOld = OldValue;
Style.styleNew = NewValue;
W32kSendSTYLECHANGINGMessage(hWnd, GWL_EXSTYLE, &Style);
WindowObject->ExStyle = (DWORD)Style.styleNew;
W32kSendSTYLECHANGEDMessage(hWnd, GWL_EXSTYLE, &Style);
break;
case GWL_STYLE:
OldValue = (LONG) WindowObject->Style;
WindowObject->Style = (DWORD) NewValue;
Style.styleOld = OldValue;
Style.styleNew = NewValue;
W32kSendSTYLECHANGINGMessage(hWnd, GWL_STYLE, &Style);
WindowObject->Style = (DWORD)Style.styleNew;
W32kSendSTYLECHANGEDMessage(hWnd, GWL_STYLE, &Style);
break;
case GWL_WNDPROC: