Skip to content

Commit

Permalink
Fix clobbering of monitor capture subregion values
Browse files Browse the repository at this point in the history
  • Loading branch information
kc5nra committed Sep 29, 2014
1 parent c5e98b9 commit 0ef092a
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions Source/DesktopImageSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1753,24 +1753,26 @@ INT_PTR CALLBACK ConfigDesktopSourceProc(HWND hwnd, UINT message, WPARAM wParam,

case IDC_MONITOR:
{
UINT id = (UINT)SendMessage(GetDlgItem(hwnd, IDC_MONITOR), CB_GETCURSEL, 0, 0);
const MonitorInfo &monitor = App->GetMonitor(id);

UINT x, y, cx, cy;
x = monitor.rect.left;
y = monitor.rect.top;
cx = monitor.rect.right-monitor.rect.left;
cy = monitor.rect.bottom-monitor.rect.top;

if(cx < 16)
cx = 16;
if(cy < 16)
cy = 16;

SetWindowText(GetDlgItem(hwnd, IDC_POSX), IntString(x).Array());
SetWindowText(GetDlgItem(hwnd, IDC_POSY), IntString(y).Array());
SetWindowText(GetDlgItem(hwnd, IDC_SIZEX), IntString(cx).Array());
SetWindowText(GetDlgItem(hwnd, IDC_SIZEY), IntString(cy).Array());
if (!lParam) {
UINT id = (UINT) SendMessage(GetDlgItem(hwnd, IDC_MONITOR), CB_GETCURSEL, 0, 0);
const MonitorInfo &monitor = App->GetMonitor(id);

UINT x, y, cx, cy;
x = monitor.rect.left;
y = monitor.rect.top;
cx = monitor.rect.right - monitor.rect.left;
cy = monitor.rect.bottom - monitor.rect.top;

if (cx < 16)
cx = 16;
if (cy < 16)
cy = 16;

SetWindowText(GetDlgItem(hwnd, IDC_POSX), IntString(x).Array());
SetWindowText(GetDlgItem(hwnd, IDC_POSY), IntString(y).Array());
SetWindowText(GetDlgItem(hwnd, IDC_SIZEX), IntString(cx).Array());
SetWindowText(GetDlgItem(hwnd, IDC_SIZEY), IntString(cy).Array());
}
break;
}

Expand Down

0 comments on commit 0ef092a

Please sign in to comment.