comparison win/dw.c @ 1493:ac43d9a9eee7

Initial obstacles support on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 25 Dec 2011 03:29:10 +0000
parents 5e4ced521696
children f8b4d6075cac
comparison
equal deleted inserted replaced
1492:1608c2a9c2b8 1493:ac43d9a9eee7
6672 newy = dw_screen_height() - height - *y; 6672 newy = dw_screen_height() - height - *y;
6673 6673
6674 /* Save the new values */ 6674 /* Save the new values */
6675 *x = newx; 6675 *x = newx;
6676 *y = newy; 6676 *y = newy;
6677
6678 /* Adjust the values to avoid Taskbar if requested */
6679 if((horz | vert) & DW_GRAV_OBSTACLES)
6680 {
6681 POINT pt = { 0, 0 };
6682 HMONITOR mon = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
6683 MONITORINFO mi;
6684
6685 mi.cbSize = sizeof(MONITORINFO);
6686
6687 GetMonitorInfo(mon, &mi);
6688
6689 if(horz & DW_GRAV_OBSTACLES)
6690 {
6691 if((horz & 0xf) == DW_GRAV_LEFT)
6692 *x += (mi.rcWork.left - mi.rcMonitor.left);
6693 else if((horz & 0xf) == DW_GRAV_RIGHT)
6694 *x -= (mi.rcMonitor.right - mi.rcWork.right);
6695 }
6696 if(vert & DW_GRAV_OBSTACLES)
6697 {
6698 if((vert & 0xf) == DW_GRAV_TOP)
6699 *y += (mi.rcWork.top - mi.rcMonitor.top);
6700 else if((vert & 0xf) == DW_GRAV_BOTTOM)
6701 *y -= (mi.rcMonitor.bottom - mi.rcWork.bottom);
6702 }
6703 }
6677 } 6704 }
6678 } 6705 }
6679 6706
6680 /* 6707 /*
6681 * Sets the position of a given window (widget). 6708 * Sets the position of a given window (widget).