# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1324783750 0 # Node ID ac43d9a9eee76a9ea1903151c0951697ad279038 # Parent 1608c2a9c2b8dc6298d9268dbc5cc82880985c63 Initial obstacles support on Windows. diff -r 1608c2a9c2b8 -r ac43d9a9eee7 win/dw.c --- 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); + } + } } }