Mercurial > hg > xemacs-beta
comparison src/frame-msw.c @ 377:d883f39b8495 r21-2b4
Import from CVS: tag r21-2b4
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:05:42 +0200 |
parents | cc15677e0335 |
children | 8626e4521993 |
comparison
equal
deleted
inserted
replaced
376:e2295b4d9f2e | 377:d883f39b8495 |
---|---|
24 /* Authorship: | 24 /* Authorship: |
25 | 25 |
26 Ultimately based on FSF. | 26 Ultimately based on FSF. |
27 Substantially rewritten for XEmacs by Ben Wing. | 27 Substantially rewritten for XEmacs by Ben Wing. |
28 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0. | 28 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0. |
29 Graphics features added and frame resizing fiddled with by Andy Piper. | |
29 */ | 30 */ |
30 | 31 |
31 #include <config.h> | 32 #include <config.h> |
32 #include "lisp.h" | 33 #include "lisp.h" |
33 | 34 |
592 { | 593 { |
593 RECT rect; | 594 RECT rect; |
594 int pixel_width, pixel_height; | 595 int pixel_width, pixel_height; |
595 int size_p = (dest->width >=0 || dest->height >=0); | 596 int size_p = (dest->width >=0 || dest->height >=0); |
596 int move_p = (dest->top >=0 || dest->left >=0); | 597 int move_p = (dest->top >=0 || dest->left >=0); |
597 | 598 struct device* d = XDEVICE (FRAME_DEVICE (f)); |
598 char_to_real_pixel_size (f, dest->width, dest->height, &pixel_width, &pixel_height); | 599 char_to_real_pixel_size (f, dest->width, dest->height, &pixel_width, &pixel_height); |
599 | 600 |
600 if (dest->width < 0) | 601 if (dest->width < 0) |
601 pixel_width = FRAME_PIXWIDTH (f); | 602 pixel_width = FRAME_PIXWIDTH (f); |
602 if (dest->height < 0) | 603 if (dest->height < 0) |
605 GetWindowRect (FRAME_MSWINDOWS_HANDLE(f), &rect); | 606 GetWindowRect (FRAME_MSWINDOWS_HANDLE(f), &rect); |
606 if (dest->left < 0) | 607 if (dest->left < 0) |
607 dest->left = rect.left; | 608 dest->left = rect.left; |
608 if (dest->top < 0) | 609 if (dest->top < 0) |
609 dest->top = rect.top; | 610 dest->top = rect.top; |
610 | 611 |
611 rect.left = rect.top = 0; | 612 rect.left = rect.top = 0; |
612 rect.right = pixel_width; | 613 rect.right = pixel_width; |
613 rect.bottom = pixel_height; | 614 rect.bottom = pixel_height; |
614 | 615 |
615 AdjustWindowRectEx (&rect, | 616 AdjustWindowRectEx (&rect, |
616 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_STYLE), | 617 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_STYLE), |
617 GetMenu (FRAME_MSWINDOWS_HANDLE(f)) != NULL, | 618 GetMenu (FRAME_MSWINDOWS_HANDLE(f)) != NULL, |
618 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_EXSTYLE)); | 619 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_EXSTYLE)); |
619 | 620 |
621 /* resize and move the window so that it fits on the screen. This is | |
622 not restrictive since this will happen later anyway in WM_SIZE. We | |
623 have to do this after adjusting the rect to account for menubar | |
624 etc. */ | |
625 pixel_width = rect.right - rect.left; | |
626 pixel_height = rect.bottom - rect.top; | |
627 if (pixel_width > DEVICE_MSWINDOWS_HORZRES(d)) | |
628 { | |
629 pixel_width = DEVICE_MSWINDOWS_HORZRES(d); | |
630 size_p=1; | |
631 } | |
632 if (pixel_height > DEVICE_MSWINDOWS_VERTRES(d)) | |
633 { | |
634 pixel_height = DEVICE_MSWINDOWS_VERTRES(d); | |
635 size_p=1; | |
636 } | |
637 | |
638 /* adjust position so window is on screen */ | |
639 if (dest->left + pixel_width > DEVICE_MSWINDOWS_HORZRES(d)) | |
640 { | |
641 dest->left = DEVICE_MSWINDOWS_HORZRES(d) - pixel_width; | |
642 move_p=1; | |
643 } | |
644 if (dest->top + pixel_height > DEVICE_MSWINDOWS_VERTRES(d)) | |
645 { | |
646 dest->top = DEVICE_MSWINDOWS_VERTRES(d) - pixel_height; | |
647 move_p=1; | |
648 } | |
649 | |
620 if (IsIconic (FRAME_MSWINDOWS_HANDLE(f)) | 650 if (IsIconic (FRAME_MSWINDOWS_HANDLE(f)) |
621 || IsZoomed (FRAME_MSWINDOWS_HANDLE(f))) | 651 || IsZoomed (FRAME_MSWINDOWS_HANDLE(f))) |
622 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_RESTORE); | 652 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_RESTORE); |
623 | 653 |
624 SetWindowPos (FRAME_MSWINDOWS_HANDLE(f), NULL, | 654 SetWindowPos (FRAME_MSWINDOWS_HANDLE(f), NULL, |
625 dest->left, dest->top, rect.right - rect.left, rect.bottom - rect.top, | 655 dest->left, dest->top, pixel_width, pixel_height, |
626 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING | 656 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING |
627 | (size_p ? 0 : SWP_NOSIZE) | 657 | (size_p ? 0 : SWP_NOSIZE) |
628 | (move_p ? 0 : SWP_NOMOVE)); | 658 | (move_p ? 0 : SWP_NOMOVE)); |
629 } | 659 } |
630 | 660 |