diff options
| author | Dmitry Antipov | 2013-01-24 09:41:28 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-01-24 09:41:28 +0400 |
| commit | edfa7fa092c303265edeb2a0b530463cdfe63ab7 (patch) | |
| tree | 509264878099f61ea1290ca65f93401a1bdf9926 /src/w32term.c | |
| parent | 5ad86e34d86173f6495b38336d377de5b69da853 (diff) | |
| download | emacs-edfa7fa092c303265edeb2a0b530463cdfe63ab7.tar.gz emacs-edfa7fa092c303265edeb2a0b530463cdfe63ab7.zip | |
Drop async_visible and async_iconified fields of struct frame.
This is possible because async input is gone; for details, see
http://lists.gnu.org/archive/html/emacs-devel/2012-12/msg00734.html.
* frame.h (struct frame): Remove async_visible and async_iconified
members, convert garbaged to unsigned bitfield. Adjust comments.
(FRAME_SAMPLE_VISIBILITY): Remove. Adjust all users.
(SET_FRAME_VISIBLE, SET_FRAME_ICONIFIED): New macros.
* frame.c, gtkutil.c, term.c, w32fns.c, window.c, xdisp.c:
Consistently use SET_FRAME_VISIBLE, SET_FRAME_ICONIFIED,
FRAME_VISIBLE_P and FRAME_ICONIFIED_P macros where appropriate.
* w32term.c: Ditto.
(w32_read_socket): Save iconified state to generate DEICONIFY_EVENT
properly. Likewise for obscured.
* xterm.c: Ditto.
(handle_one_xevent): Save visible state go generate ICONIFY_EVENT
properly.
* nsterm.m: Ditto.
(windowDidDeminiaturize): Generate DEICONIFY_EVENT.
Diffstat (limited to 'src/w32term.c')
| -rw-r--r-- | src/w32term.c | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/src/w32term.c b/src/w32term.c index 0cb2effcda1..c83ee31d200 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -4319,24 +4319,25 @@ w32_read_socket (struct terminal *terminal, | |||
| 4319 | DebPrint (("clipped frame %p (%s) got WM_PAINT - ignored\n", f, | 4319 | DebPrint (("clipped frame %p (%s) got WM_PAINT - ignored\n", f, |
| 4320 | SDATA (f->name))); | 4320 | SDATA (f->name))); |
| 4321 | } | 4321 | } |
| 4322 | else if (f->async_visible != 1) | 4322 | else if (FRAME_VISIBLE_P (f) != 1) |
| 4323 | { | 4323 | { |
| 4324 | bool iconified = FRAME_ICONIFIED_P (f); | ||
| 4325 | |||
| 4324 | /* Definitely not obscured, so mark as visible. */ | 4326 | /* Definitely not obscured, so mark as visible. */ |
| 4325 | f->async_visible = 1; | 4327 | SET_FRAME_VISIBLE (f, 1); |
| 4326 | f->async_iconified = 0; | 4328 | SET_FRAME_ICONIFIED (f, 0); |
| 4327 | SET_FRAME_GARBAGED (f); | 4329 | SET_FRAME_GARBAGED (f); |
| 4328 | DebPrint (("frame %p (%s) reexposed by WM_PAINT\n", f, | 4330 | DebPrint (("frame %p (%s) reexposed by WM_PAINT\n", f, |
| 4329 | SDATA (f->name))); | 4331 | SDATA (f->name))); |
| 4330 | 4332 | ||
| 4331 | /* WM_PAINT serves as MapNotify as well, so report | 4333 | /* WM_PAINT serves as MapNotify as well, so report |
| 4332 | visibility changes properly. */ | 4334 | visibility changes properly. */ |
| 4333 | if (f->iconified) | 4335 | if (iconified) |
| 4334 | { | 4336 | { |
| 4335 | inev.kind = DEICONIFY_EVENT; | 4337 | inev.kind = DEICONIFY_EVENT; |
| 4336 | XSETFRAME (inev.frame_or_window, f); | 4338 | XSETFRAME (inev.frame_or_window, f); |
| 4337 | } | 4339 | } |
| 4338 | else if (! NILP (Vframe_list) | 4340 | else if (!NILP (Vframe_list) && !NILP (XCDR (Vframe_list))) |
| 4339 | && ! NILP (XCDR (Vframe_list))) | ||
| 4340 | /* Force a redisplay sooner or later to update the | 4341 | /* Force a redisplay sooner or later to update the |
| 4341 | frame titles in case this is the second frame. */ | 4342 | frame titles in case this is the second frame. */ |
| 4342 | record_asynch_buffer_change (); | 4343 | record_asynch_buffer_change (); |
| @@ -4379,7 +4380,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 4379 | case WM_SYSKEYDOWN: | 4380 | case WM_SYSKEYDOWN: |
| 4380 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 4381 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
| 4381 | 4382 | ||
| 4382 | if (f && !f->iconified) | 4383 | if (f && !FRAME_ICONIFIED_P (f)) |
| 4383 | { | 4384 | { |
| 4384 | if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) | 4385 | if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) |
| 4385 | && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) | 4386 | && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) |
| @@ -4404,7 +4405,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 4404 | case WM_CHAR: | 4405 | case WM_CHAR: |
| 4405 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 4406 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
| 4406 | 4407 | ||
| 4407 | if (f && !f->iconified) | 4408 | if (f && !FRAME_ICONIFIED_P (f)) |
| 4408 | { | 4409 | { |
| 4409 | if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) | 4410 | if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) |
| 4410 | && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) | 4411 | && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) |
| @@ -4482,7 +4483,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 4482 | case WM_APPCOMMAND: | 4483 | case WM_APPCOMMAND: |
| 4483 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 4484 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
| 4484 | 4485 | ||
| 4485 | if (f && !f->iconified) | 4486 | if (f && !FRAME_ICONIFIED_P (f)) |
| 4486 | { | 4487 | { |
| 4487 | if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) | 4488 | if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) |
| 4488 | && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) | 4489 | && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) |
| @@ -4722,7 +4723,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 4722 | case WM_MOVE: | 4723 | case WM_MOVE: |
| 4723 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 4724 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
| 4724 | 4725 | ||
| 4725 | if (f && !f->async_iconified) | 4726 | if (f && !FRAME_ICONIFIED_P (f)) |
| 4726 | { | 4727 | { |
| 4727 | int x, y; | 4728 | int x, y; |
| 4728 | 4729 | ||
| @@ -4770,8 +4771,8 @@ w32_read_socket (struct terminal *terminal, | |||
| 4770 | switch (msg.msg.wParam) | 4771 | switch (msg.msg.wParam) |
| 4771 | { | 4772 | { |
| 4772 | case SIZE_MINIMIZED: | 4773 | case SIZE_MINIMIZED: |
| 4773 | f->async_visible = 0; | 4774 | SET_FRAME_VISIBLE (f, 0); |
| 4774 | f->async_iconified = 1; | 4775 | SET_FRAME_ICONIFIED (f, 1); |
| 4775 | 4776 | ||
| 4776 | inev.kind = ICONIFY_EVENT; | 4777 | inev.kind = ICONIFY_EVENT; |
| 4777 | XSETFRAME (inev.frame_or_window, f); | 4778 | XSETFRAME (inev.frame_or_window, f); |
| @@ -4779,40 +4780,44 @@ w32_read_socket (struct terminal *terminal, | |||
| 4779 | 4780 | ||
| 4780 | case SIZE_MAXIMIZED: | 4781 | case SIZE_MAXIMIZED: |
| 4781 | case SIZE_RESTORED: | 4782 | case SIZE_RESTORED: |
| 4782 | f->async_visible = 1; | 4783 | { |
| 4783 | f->async_iconified = 0; | 4784 | bool iconified = FRAME_ICONIFIED_P (f); |
| 4784 | 4785 | ||
| 4785 | /* wait_reading_process_output will notice this and update | 4786 | SET_FRAME_VISIBLE (f, 1); |
| 4786 | the frame's display structures. */ | 4787 | SET_FRAME_ICONIFIED (f, 0); |
| 4787 | SET_FRAME_GARBAGED (f); | ||
| 4788 | 4788 | ||
| 4789 | if (f->iconified) | 4789 | /* wait_reading_process_output will notice this |
| 4790 | { | 4790 | and update the frame's display structures. */ |
| 4791 | int x, y; | 4791 | SET_FRAME_GARBAGED (f); |
| 4792 | |||
| 4793 | /* Reset top and left positions of the Window | ||
| 4794 | here since Windows sends a WM_MOVE message | ||
| 4795 | BEFORE telling us the Window is minimized | ||
| 4796 | when the Window is iconified, with 3000,3000 | ||
| 4797 | as the co-ords. */ | ||
| 4798 | x_real_positions (f, &x, &y); | ||
| 4799 | f->left_pos = x; | ||
| 4800 | f->top_pos = y; | ||
| 4801 | 4792 | ||
| 4802 | inev.kind = DEICONIFY_EVENT; | 4793 | if (iconified) |
| 4803 | XSETFRAME (inev.frame_or_window, f); | 4794 | { |
| 4804 | } | 4795 | int x, y; |
| 4805 | else if (! NILP (Vframe_list) | 4796 | |
| 4806 | && ! NILP (XCDR (Vframe_list))) | 4797 | /* Reset top and left positions of the Window |
| 4807 | /* Force a redisplay sooner or later | 4798 | here since Windows sends a WM_MOVE message |
| 4808 | to update the frame titles | 4799 | BEFORE telling us the Window is minimized |
| 4809 | in case this is the second frame. */ | 4800 | when the Window is iconified, with 3000,3000 |
| 4810 | record_asynch_buffer_change (); | 4801 | as the co-ords. */ |
| 4802 | x_real_positions (f, &x, &y); | ||
| 4803 | f->left_pos = x; | ||
| 4804 | f->top_pos = y; | ||
| 4805 | |||
| 4806 | inev.kind = DEICONIFY_EVENT; | ||
| 4807 | XSETFRAME (inev.frame_or_window, f); | ||
| 4808 | } | ||
| 4809 | else if (! NILP (Vframe_list) | ||
| 4810 | && ! NILP (XCDR (Vframe_list))) | ||
| 4811 | /* Force a redisplay sooner or later | ||
| 4812 | to update the frame titles | ||
| 4813 | in case this is the second frame. */ | ||
| 4814 | record_asynch_buffer_change (); | ||
| 4815 | } | ||
| 4811 | break; | 4816 | break; |
| 4812 | } | 4817 | } |
| 4813 | } | 4818 | } |
| 4814 | 4819 | ||
| 4815 | if (f && !f->async_iconified && msg.msg.wParam != SIZE_MINIMIZED) | 4820 | if (f && !FRAME_ICONIFIED_P (f) && msg.msg.wParam != SIZE_MINIMIZED) |
| 4816 | { | 4821 | { |
| 4817 | RECT rect; | 4822 | RECT rect; |
| 4818 | int rows; | 4823 | int rows; |
| @@ -5040,12 +5045,13 @@ w32_read_socket (struct terminal *terminal, | |||
| 5040 | continue; | 5045 | continue; |
| 5041 | 5046 | ||
| 5042 | /* Check "visible" frames and mark each as obscured or not. | 5047 | /* Check "visible" frames and mark each as obscured or not. |
| 5043 | Note that async_visible is nonzero for unobscured and | 5048 | Note that visible is nonzero for unobscured and obscured |
| 5044 | obscured frames, but zero for hidden and iconified frames. */ | 5049 | frames, but zero for hidden and iconified frames. */ |
| 5045 | if (FRAME_W32_P (f) && f->async_visible) | 5050 | if (FRAME_W32_P (f) && FRAME_VISIBLE_P (f)) |
| 5046 | { | 5051 | { |
| 5047 | RECT clipbox; | 5052 | RECT clipbox; |
| 5048 | HDC hdc; | 5053 | HDC hdc; |
| 5054 | bool obscured; | ||
| 5049 | 5055 | ||
| 5050 | enter_crit (); | 5056 | enter_crit (); |
| 5051 | /* Query clipping rectangle for the entire window area | 5057 | /* Query clipping rectangle for the entire window area |
| @@ -5059,31 +5065,28 @@ w32_read_socket (struct terminal *terminal, | |||
| 5059 | ReleaseDC (FRAME_W32_WINDOW (f), hdc); | 5065 | ReleaseDC (FRAME_W32_WINDOW (f), hdc); |
| 5060 | leave_crit (); | 5066 | leave_crit (); |
| 5061 | 5067 | ||
| 5062 | if (clipbox.right == clipbox.left | 5068 | obscured = FRAME_OBSCURED_P (f); |
| 5063 | || clipbox.bottom == clipbox.top) | 5069 | |
| 5070 | if (clipbox.right == clipbox.left || clipbox.bottom == clipbox.top) | ||
| 5064 | { | 5071 | { |
| 5065 | /* Frame has become completely obscured so mark as | 5072 | /* Frame has become completely obscured so mark as such (we |
| 5066 | such (we do this by setting async_visible to 2 so | 5073 | do this by setting visible to 2 so that FRAME_VISIBLE_P |
| 5067 | that FRAME_VISIBLE_P is still true, but redisplay | 5074 | is still true, but redisplay will skip it). */ |
| 5068 | will skip it). */ | 5075 | SET_FRAME_VISIBLE (f, 2); |
| 5069 | f->async_visible = 2; | ||
| 5070 | 5076 | ||
| 5071 | if (!FRAME_OBSCURED_P (f)) | 5077 | if (!obscured) |
| 5072 | { | 5078 | DebPrint (("frame %p (%s) obscured\n", f, SDATA (f->name))); |
| 5073 | DebPrint (("frame %p (%s) obscured\n", f, | ||
| 5074 | SDATA (f->name))); | ||
| 5075 | } | ||
| 5076 | } | 5079 | } |
| 5077 | else | 5080 | else |
| 5078 | { | 5081 | { |
| 5079 | /* Frame is not obscured, so mark it as such. */ | 5082 | /* Frame is not obscured, so mark it as such. */ |
| 5080 | f->async_visible = 1; | 5083 | SET_FRAME_VISIBLE (f, 1); |
| 5081 | 5084 | ||
| 5082 | if (FRAME_OBSCURED_P (f)) | 5085 | if (obscured) |
| 5083 | { | 5086 | { |
| 5084 | SET_FRAME_GARBAGED (f); | 5087 | SET_FRAME_GARBAGED (f); |
| 5085 | DebPrint (("obscured frame %p (%s) found to be visible\n", f, | 5088 | DebPrint (("obscured frame %p (%s) found to be visible\n", |
| 5086 | SDATA (f->name))); | 5089 | f, SDATA (f->name))); |
| 5087 | 5090 | ||
| 5088 | /* Force a redisplay sooner or later. */ | 5091 | /* Force a redisplay sooner or later. */ |
| 5089 | record_asynch_buffer_change (); | 5092 | record_asynch_buffer_change (); |
| @@ -5654,7 +5657,7 @@ w32fullscreen_hook (FRAME_PTR f) | |||
| 5654 | { | 5657 | { |
| 5655 | static int normal_width, normal_height; | 5658 | static int normal_width, normal_height; |
| 5656 | 5659 | ||
| 5657 | if (f->async_visible) | 5660 | if (FRAME_VISIBLE_P (f)) |
| 5658 | { | 5661 | { |
| 5659 | int width, height, top_pos, left_pos, pixel_height, pixel_width; | 5662 | int width, height, top_pos, left_pos, pixel_height, pixel_width; |
| 5660 | int cur_w = FRAME_COLS (f), cur_h = FRAME_LINES (f); | 5663 | int cur_w = FRAME_COLS (f), cur_h = FRAME_LINES (f); |
| @@ -6023,11 +6026,11 @@ x_make_frame_visible (struct frame *f) | |||
| 6023 | causes unexpected behavior when unminimizing frames that were | 6026 | causes unexpected behavior when unminimizing frames that were |
| 6024 | previously maximized. But only SW_SHOWNORMAL works properly for | 6027 | previously maximized. But only SW_SHOWNORMAL works properly for |
| 6025 | frames that were truely hidden (using make-frame-invisible), so | 6028 | frames that were truely hidden (using make-frame-invisible), so |
| 6026 | we need it to avoid Bug#5482. It seems that async_iconified | 6029 | we need it to avoid Bug#5482. It seems that iconified is only |
| 6027 | is only set for minimized windows that are still visible, so | 6030 | set for minimized windows that are still visible, so use that to |
| 6028 | use that to determine the appropriate flag to pass ShowWindow. */ | 6031 | determine the appropriate flag to pass ShowWindow. */ |
| 6029 | my_show_window (f, FRAME_W32_WINDOW (f), | 6032 | my_show_window (f, FRAME_W32_WINDOW (f), |
| 6030 | f->async_iconified ? SW_RESTORE : SW_SHOWNORMAL); | 6033 | FRAME_ICONIFIED_P (f) ? SW_RESTORE : SW_SHOWNORMAL); |
| 6031 | } | 6034 | } |
| 6032 | 6035 | ||
| 6033 | /* Synchronize to ensure Emacs knows the frame is visible | 6036 | /* Synchronize to ensure Emacs knows the frame is visible |
| @@ -6066,7 +6069,6 @@ x_make_frame_visible (struct frame *f) | |||
| 6066 | poll_suppress_count = old_poll_suppress_count; | 6069 | poll_suppress_count = old_poll_suppress_count; |
| 6067 | } | 6070 | } |
| 6068 | } | 6071 | } |
| 6069 | FRAME_SAMPLE_VISIBILITY (f); | ||
| 6070 | } | 6072 | } |
| 6071 | } | 6073 | } |
| 6072 | 6074 | ||
| @@ -6090,10 +6092,8 @@ x_make_frame_invisible (struct frame *f) | |||
| 6090 | So we can't win using the usual strategy of letting | 6092 | So we can't win using the usual strategy of letting |
| 6091 | FRAME_SAMPLE_VISIBILITY set this. So do it by hand, | 6093 | FRAME_SAMPLE_VISIBILITY set this. So do it by hand, |
| 6092 | and synchronize with the server to make sure we agree. */ | 6094 | and synchronize with the server to make sure we agree. */ |
| 6093 | f->visible = 0; | 6095 | SET_FRAME_VISIBLE (f, 0); |
| 6094 | FRAME_ICONIFIED_P (f) = 0; | 6096 | SET_FRAME_ICONIFIED (f, 0); |
| 6095 | f->async_visible = 0; | ||
| 6096 | f->async_iconified = 0; | ||
| 6097 | 6097 | ||
| 6098 | unblock_input (); | 6098 | unblock_input (); |
| 6099 | } | 6099 | } |
| @@ -6109,7 +6109,7 @@ x_iconify_frame (struct frame *f) | |||
| 6109 | if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f) | 6109 | if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f) |
| 6110 | FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame = 0; | 6110 | FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame = 0; |
| 6111 | 6111 | ||
| 6112 | if (f->async_iconified) | 6112 | if (FRAME_ICONIFIED_P (f)) |
| 6113 | return; | 6113 | return; |
| 6114 | 6114 | ||
| 6115 | block_input (); | 6115 | block_input (); |