comparison win/dw.c @ 1498:f8b4d6075cac

Added auto-size support during dw_window_set_pos() on OS/2, Mac and Windows. Since dw_window_set_pos() can have unexpected results on unsized windows... if a window is unsized attempt to auto-size at that point. Auto-sizing during dw_window_set_pos() will cause auto-sizing not to happen during dw_window_show() so make sure it is completely packed before setting the position.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 25 Dec 2011 13:56:30 +0000
parents ac43d9a9eee7
children 97002721c4ca
comparison
equal deleted inserted replaced
1497:99a53823079f 1498:f8b4d6075cac
6712 * y: Y location from the bottom left. 6712 * y: Y location from the bottom left.
6713 */ 6713 */
6714 void API dw_window_set_pos(HWND handle, long x, long y) 6714 void API dw_window_set_pos(HWND handle, long x, long y)
6715 { 6715 {
6716 unsigned long width, height; 6716 unsigned long width, height;
6717 6717 RECT rect;
6718
6719 GetClientRect(handle, &rect);
6720
6721 /* Can't position an unsized window, so attempt to auto-size */
6722 if((rect.bottom - rect.top) == 0 || (rect.right - rect.left) == 0)
6723 dw_window_set_size(handle, 0, 0);
6724
6718 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); 6725 dw_window_get_pos_size(handle, NULL, NULL, &width, &height);
6719 _handle_gravity(handle, &x, &y, width, height); 6726 _handle_gravity(handle, &x, &y, width, height);
6720 SetWindowPos(handle, (HWND)NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 6727 SetWindowPos(handle, (HWND)NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
6721 } 6728 }
6722 6729