MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / OnMouseLoop

Method OnMouseLoop

src/misc_gui.cpp:663–684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

661 }
662
663 void OnMouseLoop() override
664 {
665 /* Always close tooltips when the cursor is not in our window. */
666 if (!_cursor.in_window) {
667 this->Close();
668 return;
669 }
670
671 /* We can show tooltips while dragging tools. These are shown as long as
672 * we are dragging the tool. Normal tooltips work with hover or rmb. */
673 switch (this->close_cond) {
674 case TCC_RIGHT_CLICK: if (!_right_button_down) this->Close(); break;
675 case TCC_HOVER: if (!_mouse_hovering) this->Close(); break;
676 case TCC_NONE: break;
677
678 case TCC_EXIT_VIEWPORT: {
679 Window *w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y);
680 if (w == nullptr || IsPtInWindowViewport(w, _cursor.pos.x, _cursor.pos.y) == nullptr) this->Close();
681 break;
682 }
683 }
684 }
685};
686
687/**

Callers

nothing calls this directly

Calls 3

FindWindowFromPtFunction · 0.85
IsPtInWindowViewportFunction · 0.85
CloseMethod · 0.45

Tested by

no test coverage detected