Mercurial > dwindows
changeset 1493:ac43d9a9eee7
Initial obstacles support on Windows.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 25 Dec 2011 03:29:10 +0000 |
parents | 1608c2a9c2b8 |
children | cf960e266444 |
files | win/dw.c |
diffstat | 1 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/win/dw.c Sun Dec 25 02:59:51 2011 +0000 +++ b/win/dw.c Sun Dec 25 03:29:10 2011 +0000 @@ -6674,6 +6674,33 @@ /* Save the new values */ *x = newx; *y = newy; + + /* Adjust the values to avoid Taskbar if requested */ + if((horz | vert) & DW_GRAV_OBSTACLES) + { + POINT pt = { 0, 0 }; + HMONITOR mon = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY); + MONITORINFO mi; + + mi.cbSize = sizeof(MONITORINFO); + + GetMonitorInfo(mon, &mi); + + if(horz & DW_GRAV_OBSTACLES) + { + if((horz & 0xf) == DW_GRAV_LEFT) + *x += (mi.rcWork.left - mi.rcMonitor.left); + else if((horz & 0xf) == DW_GRAV_RIGHT) + *x -= (mi.rcMonitor.right - mi.rcWork.right); + } + if(vert & DW_GRAV_OBSTACLES) + { + if((vert & 0xf) == DW_GRAV_TOP) + *y += (mi.rcWork.top - mi.rcMonitor.top); + else if((vert & 0xf) == DW_GRAV_BOTTOM) + *y -= (mi.rcMonitor.bottom - mi.rcWork.bottom); + } + } } }