Mercurial > hg > xemacs-beta
comparison src/frame-msw.c @ 371:cc15677e0335 r21-2b1
Import from CVS: tag r21-2b1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:03:08 +0200 |
parents | 4f79e16b1112 |
children | d883f39b8495 |
comparison
equal
deleted
inserted
replaced
370:bd866891f083 | 371:cc15677e0335 |
---|---|
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. | |
30 */ | 29 */ |
31 | 30 |
32 #include <config.h> | 31 #include <config.h> |
33 #include "lisp.h" | 32 #include "lisp.h" |
34 | 33 |
302 mswindows_make_frame_visible (struct frame *f) | 301 mswindows_make_frame_visible (struct frame *f) |
303 { | 302 { |
304 if (f->iconified) | 303 if (f->iconified) |
305 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_RESTORE); | 304 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_RESTORE); |
306 else | 305 else |
307 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_SHOW); | 306 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_SHOWNORMAL); |
308 f->visible = 1; | 307 f->visible = 1; |
309 f->iconified = 0; | 308 f->iconified = 0; |
310 } | 309 } |
311 | 310 |
312 static void | 311 static void |
391 if (IMAGE_INSTANCEP (f->pointer) | 390 if (IMAGE_INSTANCEP (f->pointer) |
392 && IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (f->pointer)) == IMAGE_POINTER) | 391 && IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (f->pointer)) == IMAGE_POINTER) |
393 { | 392 { |
394 SetClassLong (FRAME_MSWINDOWS_HANDLE (f), GCL_HCURSOR, | 393 SetClassLong (FRAME_MSWINDOWS_HANDLE (f), GCL_HCURSOR, |
395 (LONG) XIMAGE_INSTANCE_MSWINDOWS_ICON (f->pointer)); | 394 (LONG) XIMAGE_INSTANCE_MSWINDOWS_ICON (f->pointer)); |
396 /* we only have to do this because GC doesn't cause a mouse | |
397 event and doesn't give time to event processing even if it | |
398 did. */ | |
399 SetCursor (XIMAGE_INSTANCE_MSWINDOWS_ICON (f->pointer)); | |
400 } | 395 } |
401 } | 396 } |
402 | 397 |
403 static void | 398 static void |
404 mswindows_set_mouse_position (struct window *w, int x, int y) | 399 mswindows_set_mouse_position (struct window *w, int x, int y) |
454 | 449 |
455 static void | 450 static void |
456 mswindows_raise_frame (struct frame *f) | 451 mswindows_raise_frame (struct frame *f) |
457 { | 452 { |
458 BringWindowToTop (FRAME_MSWINDOWS_HANDLE(f)); | 453 BringWindowToTop (FRAME_MSWINDOWS_HANDLE(f)); |
454 /* XXX Should we do SetWindowForeground too ? */ | |
459 } | 455 } |
460 | 456 |
461 static void | 457 static void |
462 mswindows_lower_frame (struct frame *f) | 458 mswindows_lower_frame (struct frame *f) |
463 { | 459 { |
596 { | 592 { |
597 RECT rect; | 593 RECT rect; |
598 int pixel_width, pixel_height; | 594 int pixel_width, pixel_height; |
599 int size_p = (dest->width >=0 || dest->height >=0); | 595 int size_p = (dest->width >=0 || dest->height >=0); |
600 int move_p = (dest->top >=0 || dest->left >=0); | 596 int move_p = (dest->top >=0 || dest->left >=0); |
601 struct device* d = XDEVICE (FRAME_DEVICE (f)); | 597 |
602 char_to_real_pixel_size (f, dest->width, dest->height, &pixel_width, &pixel_height); | 598 char_to_real_pixel_size (f, dest->width, dest->height, &pixel_width, &pixel_height); |
603 | 599 |
604 if (dest->width < 0) | 600 if (dest->width < 0) |
605 pixel_width = FRAME_PIXWIDTH (f); | 601 pixel_width = FRAME_PIXWIDTH (f); |
606 if (dest->height < 0) | 602 if (dest->height < 0) |
609 GetWindowRect (FRAME_MSWINDOWS_HANDLE(f), &rect); | 605 GetWindowRect (FRAME_MSWINDOWS_HANDLE(f), &rect); |
610 if (dest->left < 0) | 606 if (dest->left < 0) |
611 dest->left = rect.left; | 607 dest->left = rect.left; |
612 if (dest->top < 0) | 608 if (dest->top < 0) |
613 dest->top = rect.top; | 609 dest->top = rect.top; |
614 | 610 |
615 rect.left = rect.top = 0; | 611 rect.left = rect.top = 0; |
616 rect.right = pixel_width; | 612 rect.right = pixel_width; |
617 rect.bottom = pixel_height; | 613 rect.bottom = pixel_height; |
618 | 614 |
619 AdjustWindowRectEx (&rect, | 615 AdjustWindowRectEx (&rect, |
620 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_STYLE), | 616 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_STYLE), |
621 GetMenu (FRAME_MSWINDOWS_HANDLE(f)) != NULL, | 617 GetMenu (FRAME_MSWINDOWS_HANDLE(f)) != NULL, |
622 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_EXSTYLE)); | 618 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_EXSTYLE)); |
623 | 619 |
624 /* resize and move the window so that it fits on the screen. This is | |
625 not restrictive since this will happen later anyway in WM_SIZE. We | |
626 have to do this after adjusting the rect to account for menubar | |
627 etc. */ | |
628 pixel_width = rect.right - rect.left; | |
629 pixel_height = rect.bottom - rect.top; | |
630 if (pixel_width > DEVICE_MSWINDOWS_HORZRES(d)) | |
631 { | |
632 pixel_width = DEVICE_MSWINDOWS_HORZRES(d); | |
633 size_p=1; | |
634 } | |
635 if (pixel_height > DEVICE_MSWINDOWS_VERTRES(d)) | |
636 { | |
637 pixel_height = DEVICE_MSWINDOWS_VERTRES(d); | |
638 size_p=1; | |
639 } | |
640 | |
641 /* adjust position so window is on screen */ | |
642 if (dest->left + pixel_width > DEVICE_MSWINDOWS_HORZRES(d)) | |
643 { | |
644 dest->left = DEVICE_MSWINDOWS_HORZRES(d) - pixel_width; | |
645 move_p=1; | |
646 } | |
647 if (dest->top + pixel_height > DEVICE_MSWINDOWS_VERTRES(d)) | |
648 { | |
649 dest->top = DEVICE_MSWINDOWS_VERTRES(d) - pixel_height; | |
650 move_p=1; | |
651 } | |
652 | |
653 if (IsIconic (FRAME_MSWINDOWS_HANDLE(f)) | 620 if (IsIconic (FRAME_MSWINDOWS_HANDLE(f)) |
654 || IsZoomed (FRAME_MSWINDOWS_HANDLE(f))) | 621 || IsZoomed (FRAME_MSWINDOWS_HANDLE(f))) |
655 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_RESTORE); | 622 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_RESTORE); |
656 | 623 |
657 SetWindowPos (FRAME_MSWINDOWS_HANDLE(f), NULL, | 624 SetWindowPos (FRAME_MSWINDOWS_HANDLE(f), NULL, |
658 dest->left, dest->top, pixel_width, pixel_height, | 625 dest->left, dest->top, rect.right - rect.left, rect.bottom - rect.top, |
659 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING | 626 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING |
660 | (size_p ? 0 : SWP_NOSIZE) | 627 | (size_p ? 0 : SWP_NOSIZE) |
661 | (move_p ? 0 : SWP_NOMOVE)); | 628 | (move_p ? 0 : SWP_NOMOVE)); |
662 } | 629 } |
663 | 630 |