diff options
author | John Ankarström <john@ankarstrom.se> | 2022-09-07 00:40:26 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-09-07 00:40:26 +0200 |
commit | 2f7b69d6d4cf18ca9ca04d9a44aaa6871ce51160 (patch) | |
tree | d016a9456621b91ca902f0c1caf48468e899a553 /c/drag.cpp | |
parent | 5b1a07607ba593050e37598f731f833b6faabee4 (diff) | |
download | EpisodeBrowser-2f7b69d6d4cf18ca9ca04d9a44aaa6871ce51160.tar.gz |
Improve error handling.
Diffstat (limited to 'c/drag.cpp')
-rw-r--r-- | c/drag.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -24,7 +24,8 @@ bool Dragger::IsDown() const bool Dragger::HandleLButtonDown() { POINT pt; - Require(GetRelativeCursorPos(parent.hWnd, &pt)); + if (!GetRelativeCursorPos(parent.hWnd, &pt)) + throw Err(WINDOWS, L"Mouse cursor position could not be retrieved: %s"); if (!InDragArea(pt.x, pt.y)) return false; if (IsDouble(GetMessageTime(), pt)) { @@ -39,7 +40,8 @@ bool Dragger::HandleLButtonDown() bool Dragger::HandleSetCursor() { POINT pt; - Require(GetRelativeCursorPos(parent.hWnd, &pt)); + if (!GetRelativeCursorPos(parent.hWnd, &pt)) + throw Err(WINDOWS, L"Mouse cursor position could not be retrieved: %s"); extern HCURSOR g_hcSizeNs; bool r = true; @@ -60,7 +62,8 @@ bool Dragger::HandleSetCursor() bool DlvDragger::InDragArea(const int x, const int y) const { RECT rrDlv; - Require(GetRelativeRect(parent.dlv.hWnd, &rrDlv)); + if (!GetRelativeRect(parent.dlv.hWnd, &rrDlv)) + throw Err(WINDOWS, L"Data list view rectangle could not be retrieved: %s"); const int pad = EBIsThemeActive()? Dpi(6): 0; const int extra = EBIsThemeActive()? 0: Dpi(2); @@ -72,7 +75,8 @@ bool DlvDragger::InDragArea(const int x, const int y) const void DlvDragger::Drag(const int, const int y) const { RECT rrDlv; - Require(GetRelativeRect(parent.dlv.hWnd, &rrDlv)); + if (!GetRelativeRect(parent.dlv.hWnd, &rrDlv)) + throw Err(WINDOWS, L"Data list view rectangle could not be retrieved: %s"); if (y < Dpi(50) || y > rrDlv.bottom-Dpi(20)) return; |