Maintenance: [forced, user-approved] Family G19: remove WindowOrdering, WindowDropDown, WindowMouseHit and the dead WindowMouseCaptur

Batch #10231 by ragnarok-clanker: forced by an admin (5 lower score(s), 39 changed function(s)); checked with 495 compiled unit(s), including every includer of Source/Client/Mode/ModeTooltip.h, Source/UI/AdventureGuide/UIAdventureGuide.h, Source/UI/Lists/UIDropDownBox.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/UIWindowMgr.inl, Source/UI/Window/WindowMouseHit.h, Source/UI/Window/WindowOrdering.h.
Deletes: Source/UI/Window/WindowOrdering.h
This commit is contained in:
ragnarok-clanker 2026-11-03 10:07:55 +00:00
commit 70f3e36c88
29 changed files with 95 additions and 353 deletions

View file

@ -12,7 +12,6 @@
#include "UI/Layout/WindowCoordinates.h"
#include "UI/Window/WindowManagerWindows.h"
#include "UI/Window/WindowMouseHit.h"
#include "UI/Window/WindowOrdering.h"
// GLOBAL: gl_24656
int g_alternateDoubleClickGate;
@ -55,7 +54,7 @@ static void PromoteWindow(UIWindowMgr& mgr, UIWindow* window) {
}
// INLINED
static void CloseDropDown(UIWindowMgr& mgr) {
static void HideDropDown(UIWindowMgr& mgr) {
CUIDropDownBox* popup = static_cast<CUIDropDownBox*>(mgr.window_0A30);
if (popup && popup->geometry.visible != 0) {
popup->Detach();
@ -65,7 +64,7 @@ static void CloseDropDown(UIWindowMgr& mgr) {
// OFFSET: 0x00A91B30
// FUNCTION: fn_17168
UIWindow* WindowMouseHit::FindUid(std::uint32_t uid) {
UIWindow* UIWindowMgr::FindRenderedUid(std::uint32_t uid) {
for (UIWindow* window : this->rendered) {
if (UIWindow* found = window->FindUid(uid)) {
return found;
@ -77,17 +76,17 @@ UIWindow* WindowMouseHit::FindUid(std::uint32_t uid) {
// OFFSET: 0x00A91C70
// FUNCTION: fn_17171
UIWindow* WindowMouseHit::HitTest(int x, int y) {
UIWindow* UIWindowMgr::HitTestWindows(int x, int y) {
while (!this->rendered.empty()) {
UIWindow* hit = this->rendered.back()->HitTest(x, y);
y = static_cast<int>(static_cast<std::uint32_t>(reinterpret_cast<std::uintptr_t>(hit)));
if (hit && hit->geometry.visible != 0) {
this->previous = this->current;
this->current = hit->Uid();
if (this->previous != this->current) {
this->previousHitUid = this->currentHitUid;
this->currentHitUid = hit->Uid();
if (this->previousHitUid != this->currentHitUid) {
hit->Slot47();
if (UIWindow* old = this->FindUid(this->previous)) {
if (UIWindow* old = this->FindRenderedUid(this->previousHitUid)) {
old->Slot48();
}
}
@ -103,10 +102,10 @@ UIWindow* WindowMouseHit::HitTest(int x, int y) {
}
}
this->previous = this->current;
this->current = 0;
if (this->previous != 0) {
if (UIWindow* old = this->FindUid(this->previous)) {
this->previousHitUid = this->currentHitUid;
this->currentHitUid = 0;
if (this->previousHitUid != 0) {
if (UIWindow* old = this->FindRenderedUid(this->previousHitUid)) {
old->Slot48();
}
}
@ -114,169 +113,6 @@ UIWindow* WindowMouseHit::HitTest(int x, int y) {
return nullptr;
}
// INLINED
bool WindowMouseCapture::Dispatch() {
if (!this->capture) {
return false;
}
const int x = this->mouse.x;
const int y = this->mouse.y;
int left;
int top;
UIWindow* window = this->capture;
WindowScreenPosition(window, left, top);
const int localX = x - left;
const int localY = y - top;
if (this->mouse.buttons[0] == 1) {
UIWindow* root = window->Root();
if (root && root->Slot02()) {
this->ordering.Promote(root);
}
this->capture->Slot25(localX, localY);
}
if (this->mouse.buttons[0] == 4 && (this->doubleClickGate == 0 || this->alternateDoubleClickGate == 0)) {
this->capture->Slot25(localX, localY);
this->capture->Slot26(localX, localY);
}
this->capture->ResetCursor(localX, localY);
if (this->previousX == x && this->previousY == y) {
this->capture->Slot28(localX, localY);
} else {
this->capture->Slot27(localX, localY);
}
if (this->mouse.wheel != 0) {
this->capture->Slot35(this->mouse.wheel);
}
if (this->mouse.buttons[0] == 3) {
this->capture->Slot31(localX, localY);
}
return true;
}
// INLINED
int WindowMouseUncaptured::Dispatch() {
const int x = this->mouse.x;
const int y = this->mouse.y;
UIWindow* window = this->hit.HitTest(x, y);
if (!this->modal.empty() && this->modal.back() && window && window != this->modal.back() && !window->IsDescendantOf(this->modal.back())) {
window = nullptr;
}
if (this->mouse.buttons[0] == 1) {
SetPressedWindowRoot(this->pressedRoot, window);
}
int handled = 0;
if (window) {
handled = window->Slot08() ? 2 : 1;
int left;
int top;
WindowScreenPosition(window, left, top);
const int localX = x - left;
const int localY = y - top;
if (this->mouse.buttons[0] == 4 && (this->doubleClickGate == 0 || this->alternateDoubleClickGate == 0)) {
window->Slot26(localX, localY);
}
if (this->mouse.buttons[1] == 4) {
window->Slot34(localX, localY);
}
if (this->mouse.buttons[0] == 1) {
UIWindow* root = window->Root();
if (root && root->Slot02()) {
this->ordering.Promote(root);
}
CUIDropDownBox* popup = this->dropdown.popup;
if (popup && window != popup && root != popup && !popup->HasOwnerChild(window)) {
this->dropdown.Close();
}
window->Slot25(localX, localY);
}
if (this->mouse.buttons[1] == 1) {
UIWindow* root = window->Root();
if (root && root->Slot02()) {
this->ordering.Promote(root);
}
window->Slot32(localX, localY);
}
window->ResetCursor(localX, localY);
if (this->previousX == x && this->previousY == y) {
window->Slot28(localX, localY);
} else {
window->Slot27(localX, localY);
}
if (this->mouse.wheel != 0) {
window->Slot35(this->mouse.wheel);
}
if (this->mouse.buttons[1] == 3) {
window->Slot33(localX, localY);
}
if (this->mouse.buttons[0] == 3) {
window->Slot31(localX, localY);
}
}
if (this->mouse.buttons[0] == 1) {
if (this->dismiss26 && (!window || (window != this->dismiss26 && !window->IsDescendantOf(this->dismiss26)))) {
this->windows.CloseWindow(26);
}
if (this->dismiss260) {
if (!window || (window != this->dismiss260 && !window->IsDescendantOf(this->dismiss260))) {
this->windows.CloseWindow(260);
if (!window) {
this->dropdown.Close();
}
}
} else if (!window) {
this->dropdown.Close();
}
}
for (unsigned index = 0; index < this->refresh.size(); ++index) {
UIWindow* refreshed = *this->refresh[index];
if (refreshed && (index != 5 || this->refreshGate == 0)) {
refreshed->Invalidate();
}
}
if (window) {
if (this->hover && this->hover != window) {
int left;
int top;
WindowScreenPosition(this->hover, left, top);
const int localX = x - left;
const int localY = y - top;
this->hover->Slot27(localX, localY);
this->hover->ResetCursor(localX, localY);
}
this->hover = window;
}
return handled;
}
// OFFSET: 0x00AA4730
// FUNCTION: fn_17222
int UIWindowMgr::ProcessMouse() {
@ -381,7 +217,7 @@ int UIWindowMgr::ProcessMouse() {
this->inputWindow->Slot31(localX, localY);
}
} else {
UIWindow* window = reinterpret_cast<WindowMouseHit*>(this)->HitTest(x, y);
UIWindow* window = this->HitTestWindows(x, y);
if (!this->modalWindows.empty() && this->modalWindows.back() && window) {
UIWindow* modalWindow = this->modalWindows.back();
@ -418,7 +254,7 @@ int UIWindowMgr::ProcessMouse() {
CUIDropDownBox* popup = static_cast<CUIDropDownBox*>(this->window_0A30);
if (popup && window != popup && root != popup && !popup->HasOwnerChild(window)) {
CloseDropDown(*this);
HideDropDown(*this);
}
window->Slot25(localX, localY);
@ -461,12 +297,12 @@ int UIWindowMgr::ProcessMouse() {
if (this->unknown_021C) {
if (!window) {
this->CloseWindow(260);
CloseDropDown(*this);
HideDropDown(*this);
} else if (window != this->unknown_021C && !window->IsDescendantOf(this->unknown_021C)) {
this->CloseWindow(260);
}
} else if (!window) {
CloseDropDown(*this);
HideDropDown(*this);
}
}