diff options
| author | Martin Rudalics | 2014-01-04 10:31:30 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2014-01-04 10:31:30 +0100 |
| commit | 5159d5902f0a6f48b354bc568f086d99c2e64ea0 (patch) | |
| tree | b12715cf886b6906d1953a02b21a812658d26f43 /src | |
| parent | a71324ccb69f9e3af5b1c613a60111c8f3885ce0 (diff) | |
| download | emacs-5159d5902f0a6f48b354bc568f086d99c2e64ea0.tar.gz emacs-5159d5902f0a6f48b354bc568f086d99c2e64ea0.zip | |
Fix maximization behavior on Windows (Bug#16300).
Fix maximization behavior on Windows (Bug#16300).
* w32fns.c (w32_fullscreen_rect): Don't handle
FULLSCREEN_MAXIMIZED and FULLSCREEN_NONE specially.
* w32term.c (w32fullscreen_hook): Use SetWindowPlacement instead
of SetWindowPos. Restore last placement also when leaving
FULLSCREEN_HEIGHT and FULLSCREEN_WIDTH. Call ShowWindow in all
but the FULLSCREEN_BOTH case.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/w32fns.c | 7 | ||||
| -rw-r--r-- | src/w32term.c | 23 |
3 files changed, 25 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0a4bd05bc06..2c4c7921147 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2014-01-04 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | Fix maximization behavior on Windows (Bug#16300). | ||
| 4 | * w32fns.c (w32_fullscreen_rect): Don't handle | ||
| 5 | FULLSCREEN_MAXIMIZED and FULLSCREEN_NONE specially. | ||
| 6 | * w32term.c (w32fullscreen_hook): Use SetWindowPlacement instead | ||
| 7 | of SetWindowPos. Restore last placement also when leaving | ||
| 8 | FULLSCREEN_HEIGHT and FULLSCREEN_WIDTH. Call ShowWindow in all | ||
| 9 | but the FULLSCREEN_BOTH case. | ||
| 10 | |||
| 1 | 2014-01-03 Paul Eggert <eggert@cs.ucla.edu> | 11 | 2014-01-03 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 12 | ||
| 3 | Port to C89. | 13 | Port to C89. |
diff --git a/src/w32fns.c b/src/w32fns.c index 25dad980aa7..03779be036c 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -402,12 +402,6 @@ w32_fullscreen_rect (HWND hwnd, int fsmode, RECT normal, RECT *rect) | |||
| 402 | rect->right = mi.rcMonitor.right; | 402 | rect->right = mi.rcMonitor.right; |
| 403 | rect->bottom = mi.rcMonitor.bottom; | 403 | rect->bottom = mi.rcMonitor.bottom; |
| 404 | break; | 404 | break; |
| 405 | case FULLSCREEN_MAXIMIZED: | ||
| 406 | rect->left = mi.rcWork.left; | ||
| 407 | rect->top = mi.rcWork.top; | ||
| 408 | rect->right = mi.rcWork.right; | ||
| 409 | rect->bottom = mi.rcWork.bottom; | ||
| 410 | break; | ||
| 411 | case FULLSCREEN_WIDTH: | 405 | case FULLSCREEN_WIDTH: |
| 412 | rect->left = mi.rcWork.left; | 406 | rect->left = mi.rcWork.left; |
| 413 | rect->top = normal.top; | 407 | rect->top = normal.top; |
| @@ -420,7 +414,6 @@ w32_fullscreen_rect (HWND hwnd, int fsmode, RECT normal, RECT *rect) | |||
| 420 | rect->right = normal.right; | 414 | rect->right = normal.right; |
| 421 | rect->bottom = mi.rcWork.bottom; | 415 | rect->bottom = mi.rcWork.bottom; |
| 422 | break; | 416 | break; |
| 423 | case FULLSCREEN_NONE: | ||
| 424 | default: | 417 | default: |
| 425 | *rect = normal; | 418 | *rect = normal; |
| 426 | break; | 419 | break; |
diff --git a/src/w32term.c b/src/w32term.c index 91235507b21..a59d5d6edc0 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -5564,18 +5564,22 @@ w32fullscreen_hook (struct frame *f) | |||
| 5564 | if (FRAME_PREV_FSMODE (f) == FULLSCREEN_BOTH) | 5564 | if (FRAME_PREV_FSMODE (f) == FULLSCREEN_BOTH) |
| 5565 | { | 5565 | { |
| 5566 | SetWindowLong (hwnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW); | 5566 | SetWindowLong (hwnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW); |
| 5567 | SetWindowPos (hwnd, NULL, 0, 0, 0, 0, | 5567 | SetWindowPlacement (hwnd, &FRAME_NORMAL_PLACEMENT (f)); |
| 5568 | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | | 5568 | } |
| 5569 | SWP_NOOWNERZORDER | SWP_FRAMECHANGED); | 5569 | else if (FRAME_PREV_FSMODE (f) == FULLSCREEN_HEIGHT |
| 5570 | } | 5570 | || FRAME_PREV_FSMODE (f) == FULLSCREEN_WIDTH) |
| 5571 | SetWindowPlacement (hwnd, &FRAME_NORMAL_PLACEMENT (f)); | ||
| 5571 | 5572 | ||
| 5572 | w32_fullscreen_rect (hwnd, f->want_fullscreen, | ||
| 5573 | FRAME_NORMAL_PLACEMENT (f).rcNormalPosition, &rect); | ||
| 5574 | FRAME_PREV_FSMODE (f) = f->want_fullscreen; | 5573 | FRAME_PREV_FSMODE (f) = f->want_fullscreen; |
| 5575 | if (f->want_fullscreen == FULLSCREEN_MAXIMIZED) | 5574 | |
| 5576 | PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, 0xf030, 0); | 5575 | if (f->want_fullscreen == FULLSCREEN_NONE) |
| 5576 | ShowWindow (hwnd, SW_SHOWNORMAL); | ||
| 5577 | else if (f->want_fullscreen == FULLSCREEN_MAXIMIZED) | ||
| 5578 | ShowWindow (hwnd, SW_MAXIMIZE); | ||
| 5577 | else if (f->want_fullscreen == FULLSCREEN_BOTH) | 5579 | else if (f->want_fullscreen == FULLSCREEN_BOTH) |
| 5578 | { | 5580 | { |
| 5581 | w32_fullscreen_rect (hwnd, f->want_fullscreen, | ||
| 5582 | FRAME_NORMAL_PLACEMENT (f).rcNormalPosition, &rect); | ||
| 5579 | SetWindowLong (hwnd, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW); | 5583 | SetWindowLong (hwnd, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW); |
| 5580 | SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top, | 5584 | SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top, |
| 5581 | rect.right - rect.left, rect.bottom - rect.top, | 5585 | rect.right - rect.left, rect.bottom - rect.top, |
| @@ -5583,6 +5587,9 @@ w32fullscreen_hook (struct frame *f) | |||
| 5583 | } | 5587 | } |
| 5584 | else | 5588 | else |
| 5585 | { | 5589 | { |
| 5590 | ShowWindow (hwnd, SW_SHOWNORMAL); | ||
| 5591 | w32_fullscreen_rect (hwnd, f->want_fullscreen, | ||
| 5592 | FRAME_NORMAL_PLACEMENT (f).rcNormalPosition, &rect); | ||
| 5586 | SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top, | 5593 | SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top, |
| 5587 | rect.right - rect.left, rect.bottom - rect.top, 0); | 5594 | rect.right - rect.left, rect.bottom - rect.top, 0); |
| 5588 | } | 5595 | } |