diff options
| author | Eli Zaretskii | 2013-03-23 21:40:43 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-03-23 21:40:43 +0200 |
| commit | cdc0d0bdbd039dd8c826568123b7ae53bc848373 (patch) | |
| tree | 3bb7bdca35bd13d2862c6b2c56d49b3cfa8c3be8 /src | |
| parent | b3082f497c788948254b21ce87ea3eba8b801e80 (diff) | |
| download | emacs-cdc0d0bdbd039dd8c826568123b7ae53bc848373.tar.gz emacs-cdc0d0bdbd039dd8c826568123b7ae53bc848373.zip | |
Fix fullscreen resizing of multiple frames on MS-Windows.
src/w32term.h (struct w32_output): New members normal_width,
normal_height, normal_top, normal_left, and prev_fsmode.
(FRAME_NORMAL_WIDTH, FRAME_NORMAL_HEIGHT, FRAME_NORMAL_TOP)
(FRAME_NORMAL_LEFT, FRAME_PREV_FSMODE): New macros to access these
members of a frame.
src/w32term.c (w32fullscreen_hook): Use FRAME_NORMAL_WIDTH,
FRAME_NORMAL_HEIGHT, and FRAME_PREV_FSMODE, instead of static
variables, to save and restore frame dimensions. Use
FRAME_NORMAL_LEFT and FRAME_NORMAL_TOP to restore frame position
after returning from a 'fullscreen' configuration. use
SendMessage instead of PostMessage to send the SC_RESTORE message,
to avoid races between the main thread and the input thread.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/w32term.c | 47 | ||||
| -rw-r--r-- | src/w32term.h | 13 |
3 files changed, 50 insertions, 24 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c60ff058e9d..62f210583ee 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,19 @@ | |||
| 1 | 2013-03-23 Eli Zaretskii <eliz@gnu.org> | 1 | 2013-03-23 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * w32term.c (w32fullscreen_hook): Use FRAME_NORMAL_WIDTH, | ||
| 4 | FRAME_NORMAL_HEIGHT, and FRAME_PREV_FSMODE, instead of static | ||
| 5 | variables, to save and restore frame dimensions. Use | ||
| 6 | FRAME_NORMAL_LEFT and FRAME_NORMAL_TOP to restore frame position | ||
| 7 | after returning from a 'fullscreen' configuration. use | ||
| 8 | SendMessage instead of PostMessage to send the SC_RESTORE message, | ||
| 9 | to avoid races between the main thread and the input thread. | ||
| 10 | |||
| 11 | * w32term.h (struct w32_output): New members normal_width, | ||
| 12 | normal_height, normal_top, normal_left, and prev_fsmode. | ||
| 13 | (FRAME_NORMAL_WIDTH, FRAME_NORMAL_HEIGHT, FRAME_NORMAL_TOP) | ||
| 14 | (FRAME_NORMAL_LEFT, FRAME_PREV_FSMODE): New macros to access these | ||
| 15 | members of a frame. | ||
| 16 | |||
| 3 | * w32term.c (w32fullscreen_hook): Record last value of the frame's | 17 | * w32term.c (w32fullscreen_hook): Record last value of the frame's |
| 4 | 'fullscreen' parameter. Always record previous width and height | 18 | 'fullscreen' parameter. Always record previous width and height |
| 5 | of the frame, except when switching out of maximized modes, so | 19 | of the frame, except when switching out of maximized modes, so |
diff --git a/src/w32term.c b/src/w32term.c index 3fe16b956bd..66d11164594 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -5660,9 +5660,6 @@ x_check_fullscreen (struct frame *f) | |||
| 5660 | static void | 5660 | static void |
| 5661 | w32fullscreen_hook (FRAME_PTR f) | 5661 | w32fullscreen_hook (FRAME_PTR f) |
| 5662 | { | 5662 | { |
| 5663 | static int normal_width, normal_height; | ||
| 5664 | static Lisp_Object prev_full; | ||
| 5665 | |||
| 5666 | if (FRAME_VISIBLE_P (f)) | 5663 | if (FRAME_VISIBLE_P (f)) |
| 5667 | { | 5664 | { |
| 5668 | int width, height, top_pos, left_pos, pixel_height, pixel_width; | 5665 | int width, height, top_pos, left_pos, pixel_height, pixel_width; |
| @@ -5670,17 +5667,23 @@ w32fullscreen_hook (FRAME_PTR f) | |||
| 5670 | RECT workarea_rect; | 5667 | RECT workarea_rect; |
| 5671 | 5668 | ||
| 5672 | block_input (); | 5669 | block_input (); |
| 5673 | if (!( EQ (prev_full, Qfullscreen) | 5670 | /* Record current "normal" dimensions for restoring later. */ |
| 5674 | || EQ (prev_full, Qfullboth) | 5671 | if (!( FRAME_PREV_FSMODE (f) == FULLSCREEN_BOTH |
| 5675 | || EQ (prev_full, Qmaximized))) | 5672 | || FRAME_PREV_FSMODE (f) == FULLSCREEN_MAXIMIZED)) |
| 5676 | { | 5673 | { |
| 5677 | if (!EQ (prev_full, Qfullheight)) | 5674 | if (FRAME_PREV_FSMODE (f) != FULLSCREEN_HEIGHT) |
| 5678 | normal_height = cur_h; | 5675 | { |
| 5679 | if (!EQ (prev_full, Qfullwidth)) | 5676 | FRAME_NORMAL_HEIGHT (f) = cur_h; |
| 5680 | normal_width = cur_w; | 5677 | FRAME_NORMAL_TOP (f) = f->top_pos; |
| 5678 | } | ||
| 5679 | if (FRAME_PREV_FSMODE (f) != FULLSCREEN_WIDTH) | ||
| 5680 | { | ||
| 5681 | FRAME_NORMAL_WIDTH (f) = cur_w; | ||
| 5682 | FRAME_NORMAL_LEFT (f) = f->left_pos; | ||
| 5683 | } | ||
| 5681 | } | 5684 | } |
| 5682 | eassert (normal_height > 0); | 5685 | eassert (FRAME_NORMAL_HEIGHT (f) > 0); |
| 5683 | eassert (normal_width > 0); | 5686 | eassert (FRAME_NORMAL_WIDTH (f) > 0); |
| 5684 | x_real_positions (f, &f->left_pos, &f->top_pos); | 5687 | x_real_positions (f, &f->left_pos, &f->top_pos); |
| 5685 | x_fullscreen_adjust (f, &width, &height, &top_pos, &left_pos); | 5688 | x_fullscreen_adjust (f, &width, &height, &top_pos, &left_pos); |
| 5686 | 5689 | ||
| @@ -5693,16 +5696,15 @@ w32fullscreen_hook (FRAME_PTR f) | |||
| 5693 | mouse pointer hovers over the window edges, becaise the WM | 5696 | mouse pointer hovers over the window edges, becaise the WM |
| 5694 | will still think the window is maximized. */ | 5697 | will still think the window is maximized. */ |
| 5695 | if (f->want_fullscreen != FULLSCREEN_BOTH) | 5698 | if (f->want_fullscreen != FULLSCREEN_BOTH) |
| 5696 | PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_RESTORE, 0); | 5699 | SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_RESTORE, 0); |
| 5697 | 5700 | ||
| 5701 | FRAME_PREV_FSMODE (f) = f->want_fullscreen; | ||
| 5698 | switch (f->want_fullscreen) | 5702 | switch (f->want_fullscreen) |
| 5699 | { | 5703 | { |
| 5700 | case FULLSCREEN_BOTH: | 5704 | case FULLSCREEN_BOTH: |
| 5701 | prev_full = Qfullboth; | ||
| 5702 | PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MAXIMIZE, 0); | 5705 | PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MAXIMIZE, 0); |
| 5703 | break; | 5706 | break; |
| 5704 | case FULLSCREEN_MAXIMIZED: | 5707 | case FULLSCREEN_MAXIMIZED: |
| 5705 | prev_full = Qmaximized; | ||
| 5706 | height = | 5708 | height = |
| 5707 | FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height) | 5709 | FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height) |
| 5708 | - XINT (Ftool_bar_lines_needed (selected_frame)) | 5710 | - XINT (Ftool_bar_lines_needed (selected_frame)) |
| @@ -5714,28 +5716,25 @@ w32fullscreen_hook (FRAME_PTR f) | |||
| 5714 | top_pos = workarea_rect.top; | 5716 | top_pos = workarea_rect.top; |
| 5715 | break; | 5717 | break; |
| 5716 | case FULLSCREEN_WIDTH: | 5718 | case FULLSCREEN_WIDTH: |
| 5717 | prev_full = Qfullwidth; | ||
| 5718 | width = | 5719 | width = |
| 5719 | FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width) | 5720 | FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width) |
| 5720 | - FRAME_SCROLL_BAR_COLS (f); | 5721 | - FRAME_SCROLL_BAR_COLS (f); |
| 5721 | height = normal_height; | 5722 | height = FRAME_NORMAL_HEIGHT (f); |
| 5722 | left_pos = workarea_rect.left; | 5723 | left_pos = workarea_rect.left; |
| 5723 | break; | 5724 | break; |
| 5724 | case FULLSCREEN_HEIGHT: | 5725 | case FULLSCREEN_HEIGHT: |
| 5725 | prev_full = Qfullheight; | ||
| 5726 | height = | 5726 | height = |
| 5727 | FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height) | 5727 | FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height) |
| 5728 | - XINT (Ftool_bar_lines_needed (selected_frame)) | 5728 | - XINT (Ftool_bar_lines_needed (selected_frame)) |
| 5729 | + (NILP (Vmenu_bar_mode) ? 1 : 0); | 5729 | + (NILP (Vmenu_bar_mode) ? 1 : 0); |
| 5730 | width = normal_width; | 5730 | width = FRAME_NORMAL_WIDTH (f); |
| 5731 | top_pos = workarea_rect.top; | 5731 | top_pos = workarea_rect.top; |
| 5732 | break; | 5732 | break; |
| 5733 | case FULLSCREEN_NONE: | 5733 | case FULLSCREEN_NONE: |
| 5734 | prev_full = Qnil; | 5734 | height = FRAME_NORMAL_HEIGHT (f); |
| 5735 | height = normal_height; | 5735 | width = FRAME_NORMAL_WIDTH (f); |
| 5736 | width = normal_width; | 5736 | left_pos = FRAME_NORMAL_LEFT (f); |
| 5737 | /* FIXME: Should restore the original position of the frame. */ | 5737 | top_pos = FRAME_NORMAL_TOP (f); |
| 5738 | top_pos = left_pos = 0; | ||
| 5739 | break; | 5738 | break; |
| 5740 | } | 5739 | } |
| 5741 | 5740 | ||
diff --git a/src/w32term.h b/src/w32term.h index a31c5de193d..b319f0ca592 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -359,6 +359,12 @@ struct w32_output | |||
| 359 | /* The background for which the above relief GCs were set up. | 359 | /* The background for which the above relief GCs were set up. |
| 360 | They are changed only when a different background is involved. */ | 360 | They are changed only when a different background is involved. */ |
| 361 | unsigned long relief_background; | 361 | unsigned long relief_background; |
| 362 | |||
| 363 | /* Frame geometry and full-screen mode before it was resized by | ||
| 364 | specifying the 'fullscreen' frame parameter. Used to restore the | ||
| 365 | geometry when 'fullscreen' is reset to nil. */ | ||
| 366 | int normal_width, normal_height, normal_top, normal_left; | ||
| 367 | int prev_fsmode; | ||
| 362 | }; | 368 | }; |
| 363 | 369 | ||
| 364 | extern struct w32_output w32term_display; | 370 | extern struct w32_output w32term_display; |
| @@ -390,6 +396,13 @@ extern struct w32_output w32term_display; | |||
| 390 | 396 | ||
| 391 | #define FRAME_SMALLEST_FONT_HEIGHT(F) \ | 397 | #define FRAME_SMALLEST_FONT_HEIGHT(F) \ |
| 392 | FRAME_W32_DISPLAY_INFO(F)->smallest_font_height | 398 | FRAME_W32_DISPLAY_INFO(F)->smallest_font_height |
| 399 | |||
| 400 | #define FRAME_NORMAL_WIDTH(F) ((F)->output_data.w32->normal_width) | ||
| 401 | #define FRAME_NORMAL_HEIGHT(F) ((F)->output_data.w32->normal_height) | ||
| 402 | #define FRAME_NORMAL_TOP(F) ((F)->output_data.w32->normal_top) | ||
| 403 | #define FRAME_NORMAL_LEFT(F) ((F)->output_data.w32->normal_left) | ||
| 404 | #define FRAME_PREV_FSMODE(F) ((F)->output_data.w32->prev_fsmode) | ||
| 405 | |||
| 393 | 406 | ||
| 394 | /* W32-specific scroll bar stuff. */ | 407 | /* W32-specific scroll bar stuff. */ |
| 395 | 408 | ||