Fixed a crash in my own tooltip code

This commit is contained in:
pelya
2016-05-20 23:27:32 +03:00
committed by Sergii Pylypenko
parent be8d17f217
commit c0f71fb65c

View File

@@ -687,11 +687,8 @@ struct TooltipsWindow : public Window
// Move it to the top of the screen, away from mouse cursor, so it won't steal screen taps on Android
pt.y = GetMainViewTop();
pt.x = _cursor.pos.x > _screen.width / 2 ?
FindWindowById(WC_MAIN_TOOLBAR, 0)->width :
_screen.width - sm_width - FindWindowById(WC_MAIN_TOOLBAR, 0)->width;
if (_cursor.pos.y > pt.y + GetMinSizing(NWST_STEP)) {
pt.x = sm_width >= _screen.width ? 0 : Clamp(_cursor.pos.x - (sm_width >> 1), 0, _screen.width - sm_width);
if (_cursor.pos.y < pt.y + GetMinSizing(NWST_STEP)) {
pt.x = _cursor.pos.x > _screen.width / 2 ? GetMinSizing(NWST_STEP) : _screen.width - sm_width - GetMinSizing(NWST_STEP);
}
return pt;