Skip to content

Commit

Permalink
Fix hwcursor re-enabling when reducing window size
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm committed May 21, 2023
1 parent afd01a0 commit 346ff44
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Source/DiabloUI/diabloui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,12 @@ void UiHandleEvents(SDL_Event *event)
} else if (IsAnyOf(event->window.event, SDL_WINDOWEVENT_HIDDEN, SDL_WINDOWEVENT_MINIMIZED)) {
gbActive = false;
} else if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
ReinitializeHardwareCursor();
// We reinitialize immediately (by calling `DoReinitializeHardwareCursor` instead of `ReinitializeHardwareCursor`)
// because the cursor's Enabled state may have changed, resulting in changes to visibility.
//
// For example, if the previous size was too large for a hardware cursor then it was invisible
// but may now become visible.
DoReinitializeHardwareCursor();
} else if (event->window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
music_mute();
} else if (event->window.event == SDL_WINDOWEVENT_FOCUS_GAINED) {
Expand Down

0 comments on commit 346ff44

Please sign in to comment.