mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-23 01:21:57 -05:00
Don't redraw when launcher window when focus is lost/gained
Fixes launcher window contents getting drawn over another window when you try to switch to another app on ReactOS
This commit is contained in:
parent
996b13436f
commit
18e780ae2e
2 changed files with 3 additions and 18 deletions
|
@ -88,11 +88,6 @@ bool Launcher_ConnectToServer(const String* hash) {
|
|||
/*########################################################################################################################*
|
||||
*---------------------------------------------------------Event handler---------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static void Launcher_MaybeRedraw(void* obj) {
|
||||
/* Only redraw when launcher has been initialised */
|
||||
if (Launcher_Screen && Window_Exists) Launcher_Redraw();
|
||||
}
|
||||
|
||||
static void Launcher_ReqeustRedraw(void* obj) {
|
||||
/* We may get multiple Redraw events in short timespan */
|
||||
/* So we just request a redraw at next launcher tick */
|
||||
|
@ -170,7 +165,6 @@ static void Launcher_Init(void) {
|
|||
|
||||
Event_RegisterVoid(&WindowEvents.Resized, NULL, Launcher_OnResize);
|
||||
Event_RegisterVoid(&WindowEvents.StateChanged, NULL, Launcher_OnResize);
|
||||
Event_RegisterVoid(&WindowEvents.FocusChanged, NULL, Launcher_MaybeRedraw);
|
||||
Event_RegisterVoid(&WindowEvents.Redraw, NULL, Launcher_ReqeustRedraw);
|
||||
|
||||
Event_RegisterInput(&KeyEvents.Down, NULL, Launcher_KeyDown);
|
||||
|
@ -193,7 +187,6 @@ static void Launcher_Init(void) {
|
|||
static void Launcher_Free(void) {
|
||||
Event_UnregisterVoid(&WindowEvents.Resized, NULL, Launcher_OnResize);
|
||||
Event_UnregisterVoid(&WindowEvents.StateChanged, NULL, Launcher_OnResize);
|
||||
Event_UnregisterVoid(&WindowEvents.FocusChanged, NULL, Launcher_MaybeRedraw);
|
||||
Event_UnregisterVoid(&WindowEvents.Redraw, NULL, Launcher_ReqeustRedraw);
|
||||
|
||||
Event_UnregisterInput(&KeyEvents.Down, NULL, Launcher_KeyDown);
|
||||
|
|
14
src/Window.c
14
src/Window.c
|
@ -228,17 +228,12 @@ static void Window_RefreshBounds(void) {
|
|||
|
||||
static LRESULT CALLBACK Window_Procedure(HWND handle, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
char keyChar;
|
||||
bool wasFocused;
|
||||
float wheelDelta;
|
||||
|
||||
switch (message) {
|
||||
case WM_ACTIVATE:
|
||||
wasFocused = Window_Focused;
|
||||
Window_Focused = LOWORD(wParam) != 0;
|
||||
|
||||
if (Window_Focused != wasFocused) {
|
||||
Event_RaiseVoid(&WindowEvents.FocusChanged);
|
||||
}
|
||||
Event_RaiseVoid(&WindowEvents.FocusChanged);
|
||||
break;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
|
@ -1138,12 +1133,9 @@ void Window_ProcessEvents(void) {
|
|||
case FocusOut:
|
||||
/* Don't lose focus when another app grabs key or mouse */
|
||||
if (e.xfocus.mode == NotifyGrab || e.xfocus.mode == NotifyUngrab) break;
|
||||
wasFocused = Window_Focused;
|
||||
Window_Focused = e.type == FocusIn;
|
||||
|
||||
if (Window_Focused != wasFocused) {
|
||||
Event_RaiseVoid(&WindowEvents.FocusChanged);
|
||||
}
|
||||
Window_Focused = e.type == FocusIn;
|
||||
Event_RaiseVoid(&WindowEvents.FocusChanged);
|
||||
/* TODO: Keep track of keyboard when focus is lost */
|
||||
if (!Window_Focused) Key_Clear();
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue