+ /* resize and move the window so that it fits on the screen. This is
+ not restrictive since this will happen later anyway in WM_SIZE. We
+ have to do this after adjusting the rect to account for menubar
+ etc. */
+ pixel_width = rect.right - rect.left;
+ pixel_height = rect.bottom - rect.top;
+ if (pixel_width > DEVICE_MSWINDOWS_HORZRES(d))
+ {
+ pixel_width = DEVICE_MSWINDOWS_HORZRES(d);
+ size_p=1;
+ }
+ if (pixel_height > DEVICE_MSWINDOWS_VERTRES(d))
+ {
+ pixel_height = DEVICE_MSWINDOWS_VERTRES(d);
+ size_p=1;
+ }
+
+ /* adjust position so window is on screen */
+ if (dest->left + pixel_width > DEVICE_MSWINDOWS_HORZRES(d))
+ {
+ dest->left = DEVICE_MSWINDOWS_HORZRES(d) - pixel_width;
+ move_p=1;
+ }
+ if (dest->top + pixel_height > DEVICE_MSWINDOWS_VERTRES(d))
+ {
+ dest->top = DEVICE_MSWINDOWS_VERTRES(d) - pixel_height;
+ move_p=1;
+ }
+