Commit edfa7fa0 authored by Dmitry Antipov's avatar Dmitry Antipov

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.
parent 5ad86e34
2013-01-24 Dmitry Antipov <dmantipov@yandex.ru>
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.
2013-01-24 Dmitry Antipov <dmantipov@yandex.ru> 2013-01-24 Dmitry Antipov <dmantipov@yandex.ru>
* insdel.c (prepare_to_modify_buffer): Revert last change as suggested * insdel.c (prepare_to_modify_buffer): Revert last change as suggested
......
...@@ -500,8 +500,7 @@ make_initial_frame (void) ...@@ -500,8 +500,7 @@ make_initial_frame (void)
tty_frame_count = 1; tty_frame_count = 1;
fset_name (f, build_pure_c_string ("F1")); fset_name (f, build_pure_c_string ("F1"));
f->visible = 1; SET_FRAME_VISIBLE (f, 1);
f->async_visible = 1;
f->output_method = terminal->type; f->output_method = terminal->type;
f->terminal = terminal; f->terminal = terminal;
...@@ -540,8 +539,8 @@ make_terminal_frame (struct terminal *terminal) ...@@ -540,8 +539,8 @@ make_terminal_frame (struct terminal *terminal)
fset_name (f, make_formatted_string (name, "F%"pMd, ++tty_frame_count)); fset_name (f, make_formatted_string (name, "F%"pMd, ++tty_frame_count));
f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */ SET_FRAME_VISIBLE (f, 1);
f->async_visible = 1; /* Don't let visible be cleared later. */
f->terminal = terminal; f->terminal = terminal;
f->terminal->reference_count++; f->terminal->reference_count++;
#ifdef MSDOS #ifdef MSDOS
...@@ -565,7 +564,7 @@ make_terminal_frame (struct terminal *terminal) ...@@ -565,7 +564,7 @@ make_terminal_frame (struct terminal *terminal)
/* Set the top frame to the newly created frame. */ /* Set the top frame to the newly created frame. */
if (FRAMEP (FRAME_TTY (f)->top_frame) if (FRAMEP (FRAME_TTY (f)->top_frame)
&& FRAME_LIVE_P (XFRAME (FRAME_TTY (f)->top_frame))) && FRAME_LIVE_P (XFRAME (FRAME_TTY (f)->top_frame)))
XFRAME (FRAME_TTY (f)->top_frame)->async_visible = 2; /* obscured */ SET_FRAME_VISIBLE (XFRAME (FRAME_TTY (f)->top_frame), 2); /* obscured */
FRAME_TTY (f)->top_frame = frame; FRAME_TTY (f)->top_frame = frame;
...@@ -806,8 +805,8 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor ...@@ -806,8 +805,8 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
{ {
if (FRAMEP (FRAME_TTY (XFRAME (frame))->top_frame)) if (FRAMEP (FRAME_TTY (XFRAME (frame))->top_frame))
/* Mark previously displayed frame as now obscured. */ /* Mark previously displayed frame as now obscured. */
XFRAME (FRAME_TTY (XFRAME (frame))->top_frame)->async_visible = 2; SET_FRAME_VISIBLE (XFRAME (FRAME_TTY (XFRAME (frame))->top_frame), 2);
XFRAME (frame)->async_visible = 1; SET_FRAME_VISIBLE (XFRAME (frame), 1);
FRAME_TTY (XFRAME (frame))->top_frame = frame; FRAME_TTY (XFRAME (frame))->top_frame = frame;
} }
...@@ -914,7 +913,6 @@ candidate_frame (Lisp_Object candidate, Lisp_Object frame, Lisp_Object minibuf) ...@@ -914,7 +913,6 @@ candidate_frame (Lisp_Object candidate, Lisp_Object frame, Lisp_Object minibuf)
} }
else if (EQ (minibuf, Qvisible)) else if (EQ (minibuf, Qvisible))
{ {
FRAME_SAMPLE_VISIBILITY (c);
if (FRAME_VISIBLE_P (c)) if (FRAME_VISIBLE_P (c))
return candidate; return candidate;
} }
...@@ -928,7 +926,6 @@ candidate_frame (Lisp_Object candidate, Lisp_Object frame, Lisp_Object minibuf) ...@@ -928,7 +926,6 @@ candidate_frame (Lisp_Object candidate, Lisp_Object frame, Lisp_Object minibuf)
} }
else if (XFASTINT (minibuf) == 0) else if (XFASTINT (minibuf) == 0)
{ {
FRAME_SAMPLE_VISIBILITY (c);
if (FRAME_VISIBLE_P (c) || FRAME_ICONIFIED_P (c)) if (FRAME_VISIBLE_P (c) || FRAME_ICONIFIED_P (c))
return candidate; return candidate;
} }
...@@ -1052,10 +1049,7 @@ other_visible_frames (FRAME_PTR f) ...@@ -1052,10 +1049,7 @@ other_visible_frames (FRAME_PTR f)
and note any recent change in visibility. */ and note any recent change in visibility. */
#ifdef HAVE_WINDOW_SYSTEM #ifdef HAVE_WINDOW_SYSTEM
if (FRAME_WINDOW_P (XFRAME (this))) if (FRAME_WINDOW_P (XFRAME (this)))
{ x_sync (XFRAME (this));
x_sync (XFRAME (this));
FRAME_SAMPLE_VISIBILITY (XFRAME (this));
}
#endif #endif
if (FRAME_VISIBLE_P (XFRAME (this)) if (FRAME_VISIBLE_P (XFRAME (this))
...@@ -1231,7 +1225,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) ...@@ -1231,7 +1225,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
fset_root_window (f, Qnil); fset_root_window (f, Qnil);
Vframe_list = Fdelq (frame, Vframe_list); Vframe_list = Fdelq (frame, Vframe_list);
FRAME_SET_VISIBLE (f, 0); SET_FRAME_VISIBLE (f, 0);
/* Allow the vector of menu bar contents to be freed in the next /* Allow the vector of menu bar contents to be freed in the next
garbage collection. The frame object itself may not be garbage garbage collection. The frame object itself may not be garbage
...@@ -1579,10 +1573,7 @@ If omitted, FRAME defaults to the currently selected frame. */) ...@@ -1579,10 +1573,7 @@ If omitted, FRAME defaults to the currently selected frame. */)
/* I think this should be done with a hook. */ /* I think this should be done with a hook. */
#ifdef HAVE_WINDOW_SYSTEM #ifdef HAVE_WINDOW_SYSTEM
if (FRAME_WINDOW_P (f)) if (FRAME_WINDOW_P (f))
{ x_make_frame_visible (f);
FRAME_SAMPLE_VISIBILITY (f);
x_make_frame_visible (f);
}
#endif #endif
make_frame_visible_1 (f->root_window); make_frame_visible_1 (f->root_window);
...@@ -1705,8 +1696,6 @@ currently being displayed on the terminal. */) ...@@ -1705,8 +1696,6 @@ currently being displayed on the terminal. */)
{ {
CHECK_LIVE_FRAME (frame); CHECK_LIVE_FRAME (frame);
FRAME_SAMPLE_VISIBILITY (XFRAME (frame));
if (FRAME_VISIBLE_P (XFRAME (frame))) if (FRAME_VISIBLE_P (XFRAME (frame)))
return Qt; return Qt;
if (FRAME_ICONIFIED_P (XFRAME (frame))) if (FRAME_ICONIFIED_P (XFRAME (frame)))
...@@ -2891,7 +2880,6 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr) ...@@ -2891,7 +2880,6 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr)
make_formatted_string (buf, "%"pMu, w)); make_formatted_string (buf, "%"pMu, w));
#endif #endif
store_in_alist (alistptr, Qicon_name, f->icon_name); store_in_alist (alistptr, Qicon_name, f->icon_name);
FRAME_SAMPLE_VISIBILITY (f);
store_in_alist (alistptr, Qvisibility, store_in_alist (alistptr, Qvisibility,
(FRAME_VISIBLE_P (f) ? Qt (FRAME_VISIBLE_P (f) ? Qt
: FRAME_ICONIFIED_P (f) ? Qicon : Qnil)); : FRAME_ICONIFIED_P (f) ? Qicon : Qnil));
......
...@@ -353,46 +353,30 @@ struct frame ...@@ -353,46 +353,30 @@ struct frame
unsigned int external_menu_bar : 1; unsigned int external_menu_bar : 1;
#endif #endif
/* visible is nonzero if the frame is currently displayed; we check /* Next two bitfields are mutually exclusive. They might both be
zero if the frame has been made invisible without an icon. */
/* Nonzero if the frame is currently displayed; we check
it to see if we should bother updating the frame's contents. it to see if we should bother updating the frame's contents.
DON'T SET IT DIRECTLY; instead, use FRAME_SET_VISIBLE.
Note that, since invisible frames aren't updated, whenever a Note that, since invisible frames aren't updated, whenever a
frame becomes visible again, it must be marked as garbaged. The frame becomes visible again, it must be marked as garbaged.
FRAME_SAMPLE_VISIBILITY macro takes care of this.
On ttys and on Windows NT/9X, to avoid wasting effort updating On ttys and on Windows NT/9X, to avoid wasting effort updating
visible frames that are actually completely obscured by other visible frames that are actually completely obscured by other
windows on the display, we bend the meaning of visible slightly: windows on the display, we bend the meaning of visible slightly:
if greater than 1, then the frame is obscured - we still consider if equal to 2, then the frame is obscured - we still consider
it to be "visible" as seen from lisp, but we don't bother it to be "visible" as seen from lisp, but we don't bother
updating it. We must take care to garbage the frame when it updating it. We must take care to garbage the frame when it
ceases to be obscured though. ceases to be obscured though. See SET_FRAME_VISIBLE below. */
iconified is nonzero if the frame is currently iconified.
Asynchronous input handlers should NOT change these directly;
instead, they should change async_visible or async_iconified, and
let the FRAME_SAMPLE_VISIBILITY macro set visible and iconified
at the next redisplay.
These should probably be considered read-only by everyone except
FRAME_SAMPLE_VISIBILITY.
These two are mutually exclusive. They might both be zero, if the
frame has been made invisible without an icon. */
unsigned visible : 2; unsigned visible : 2;
unsigned iconified : 1;
/* Let's not use bitfields for volatile variables. */
/* Asynchronous input handlers change these, and /* Nonzero if the frame is currently iconified. Do not
FRAME_SAMPLE_VISIBILITY copies them into visible and iconified. set this directly, use SET_FRAME_ICONIFIED instead. */
See FRAME_SAMPLE_VISIBILITY, below. */ unsigned iconified : 1;
volatile char async_visible, async_iconified;
/* Nonzero if this frame should be redrawn. */ /* Nonzero if this frame should be redrawn. */
volatile char garbaged; unsigned garbaged : 1;
/* True if frame actually has a minibuffer window on it. /* True if frame actually has a minibuffer window on it.
0 if using a minibuffer window that isn't on this frame. */ 0 if using a minibuffer window that isn't on this frame. */
...@@ -711,7 +695,7 @@ typedef struct frame *FRAME_PTR; ...@@ -711,7 +695,7 @@ typedef struct frame *FRAME_PTR;
#else #else
#define FRAME_EXTERNAL_MENU_BAR(f) 0 #define FRAME_EXTERNAL_MENU_BAR(f) 0
#endif #endif
#define FRAME_VISIBLE_P(f) ((f)->visible != 0) #define FRAME_VISIBLE_P(f) (f)->visible
/* Nonzero if frame F is currently visible but hidden. */ /* Nonzero if frame F is currently visible but hidden. */
#define FRAME_OBSCURED_P(f) ((f)->visible > 1) #define FRAME_OBSCURED_P(f) ((f)->visible > 1)
...@@ -719,9 +703,10 @@ typedef struct frame *FRAME_PTR; ...@@ -719,9 +703,10 @@ typedef struct frame *FRAME_PTR;
/* Nonzero if frame F is currently iconified. */ /* Nonzero if frame F is currently iconified. */
#define FRAME_ICONIFIED_P(f) (f)->iconified #define FRAME_ICONIFIED_P(f) (f)->iconified
#define FRAME_SET_VISIBLE(f,p) \ /* Mark frame F as currently garbaged. */
((f)->async_visible = (p), FRAME_SAMPLE_VISIBILITY (f))
#define SET_FRAME_GARBAGED(f) (frame_garbaged = 1, f->garbaged = 1) #define SET_FRAME_GARBAGED(f) (frame_garbaged = 1, f->garbaged = 1)
/* Nonzero if frame F is currently garbaged. */
#define FRAME_GARBAGED_P(f) (f)->garbaged #define FRAME_GARBAGED_P(f) (f)->garbaged
/* Nonzero means do not allow splitting this frame's window. */ /* Nonzero means do not allow splitting this frame's window. */
...@@ -866,39 +851,6 @@ typedef struct frame *FRAME_PTR; ...@@ -866,39 +851,6 @@ typedef struct frame *FRAME_PTR;
#define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4) #define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4)
/* Emacs's redisplay code could become confused if a frame's
visibility changes at arbitrary times. For example, if a frame is
visible while the desired glyphs are being built, but becomes
invisible before they are updated, then some rows of the
desired_glyphs will be left marked as enabled after redisplay is
complete, which should never happen. The next time the frame
becomes visible, redisplay will probably barf.
Currently, there are no similar situations involving iconified, but
the principle is the same.
So instead of having asynchronous input handlers directly set and
clear the frame's visibility and iconification flags, they just set
the async_visible and async_iconified flags; the redisplay code
calls the FRAME_SAMPLE_VISIBILITY macro before doing any redisplay,
which sets visible and iconified from their asynchronous
counterparts.
Synchronous code must use the FRAME_SET_VISIBLE macro.
Also, if a frame used to be invisible, but has just become visible,
it must be marked as garbaged, since redisplay hasn't been keeping
up its contents.
Note that a tty frame is visible if and only if it is the topmost
frame. */
#define FRAME_SAMPLE_VISIBILITY(f) \
(((f)->async_visible && (f)->visible != (f)->async_visible) ? \
SET_FRAME_GARBAGED (f) : 0, \
(f)->visible = (f)->async_visible, \
(f)->iconified = (f)->async_iconified)
#define CHECK_FRAME(x) \ #define CHECK_FRAME(x) \
CHECK_TYPE (FRAMEP (x), Qframep, x) CHECK_TYPE (FRAMEP (x), Qframep, x)
...@@ -932,12 +884,24 @@ typedef struct frame *FRAME_PTR; ...@@ -932,12 +884,24 @@ typedef struct frame *FRAME_PTR;
block_input (); \ block_input (); \
if (hlinfo->mouse_face_mouse_frame) \ if (hlinfo->mouse_face_mouse_frame) \
note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \ note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
hlinfo->mouse_face_mouse_x, \ hlinfo->mouse_face_mouse_x, \
hlinfo->mouse_face_mouse_y); \ hlinfo->mouse_face_mouse_y); \
unblock_input (); \ unblock_input (); \
} \ } \
} while (0) } while (0)
/* Set visibility of frame F, marking F as garbaged if needed. */
#define SET_FRAME_VISIBLE(f, v) \
(((f)->visible == 0 || ((f)->visible == 2)) \
&& ((v) == 1) ? SET_FRAME_GARBAGED (f) : 0, \
(f)->visible = (eassert (0 <= (v) && (v) <= 2), (v)))
/* Set iconify of frame F. */
#define SET_FRAME_ICONIFIED(f, i) \
(f)->iconified = (eassert (0 <= (i) && (i) <= 1), (i))
extern Lisp_Object Qframep, Qframe_live_p; extern Lisp_Object Qframep, Qframe_live_p;
extern Lisp_Object Qtty, Qtty_type; extern Lisp_Object Qtty, Qtty_type;
extern Lisp_Object Qtty_color_mode; extern Lisp_Object Qtty_color_mode;
......
...@@ -983,7 +983,7 @@ xg_frame_set_char_size (FRAME_PTR f, int cols, int rows) ...@@ -983,7 +983,7 @@ xg_frame_set_char_size (FRAME_PTR f, int cols, int rows)
size as fast as possible. size as fast as possible.
For unmapped windows, we can set rows/cols. When For unmapped windows, we can set rows/cols. When
the frame is mapped again we will (hopefully) get the correct size. */ the frame is mapped again we will (hopefully) get the correct size. */
if (f->async_visible) if (FRAME_VISIBLE_P (f))
{ {
/* Must call this to flush out events */ /* Must call this to flush out events */
(void)gtk_events_pending (); (void)gtk_events_pending ();
......
...@@ -1000,11 +1000,8 @@ Free a pool and temporary objects it refers to (callable from C) ...@@ -1000,11 +1000,8 @@ Free a pool and temporary objects it refers to (callable from C)
NSView *view = FRAME_NS_VIEW (f); NSView *view = FRAME_NS_VIEW (f);
check_ns (); check_ns ();
block_input (); block_input ();
FRAME_SAMPLE_VISIBILITY (f);
if (FRAME_VISIBLE_P (f)) if (FRAME_VISIBLE_P (f))
{ [[view window] makeKeyAndOrderFront: NSApp];
[[view window] makeKeyAndOrderFront: NSApp];
}
unblock_input (); unblock_input ();
} }
...@@ -1093,7 +1090,8 @@ Free a pool and temporary objects it refers to (callable from C) ...@@ -1093,7 +1090,8 @@ Free a pool and temporary objects it refers to (callable from C)
if (!FRAME_VISIBLE_P (f)) if (!FRAME_VISIBLE_P (f))
{ {
EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
f->async_visible = 1;
SET_FRAME_VISIBLE (f, 1);
ns_raise_frame (f); ns_raise_frame (f);
#ifdef NEW_STYLE_FS #ifdef NEW_STYLE_FS
...@@ -1123,8 +1121,8 @@ Free a pool and temporary objects it refers to (callable from C) ...@@ -1123,8 +1121,8 @@ Free a pool and temporary objects it refers to (callable from C)
NSTRACE (x_make_frame_invisible); NSTRACE (x_make_frame_invisible);
check_ns (); check_ns ();
[[view window] orderOut: NSApp]; [[view window] orderOut: NSApp];
f->async_visible = 0; SET_FRAME_VISIBLE (f, 0);
f->async_iconified = 0; SET_FRAME_ICONIFIED (f, 0);
} }
...@@ -1354,7 +1352,9 @@ Free a pool and temporary objects it refers to (callable from C) ...@@ -1354,7 +1352,9 @@ Free a pool and temporary objects it refers to (callable from C)
{ {
EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
if (! f->async_visible) return; if (!FRAME_VISIBLE_P (f))
return;
#ifndef NEW_STYLE_FS #ifndef NEW_STYLE_FS
if (f->want_fullscreen == FULLSCREEN_BOTH) if (f->want_fullscreen == FULLSCREEN_BOTH)
{ {
...@@ -5824,13 +5824,14 @@ - (void)windowDidDeminiaturize: sender ...@@ -5824,13 +5824,14 @@ - (void)windowDidDeminiaturize: sender
NSTRACE (windowDidDeminiaturize); NSTRACE (windowDidDeminiaturize);
if (!emacsframe->output_data.ns) if (!emacsframe->output_data.ns)
return; return;
emacsframe->async_iconified = 0;
emacsframe->async_visible = 1; SET_FRAME_ICONIFIED (emacsframe, 0);
SET_FRAME_VISIBLE (emacsframe, 1);
windows_or_buffers_changed++; windows_or_buffers_changed++;
if (emacs_event) if (emacs_event)
{ {
emacs_event->kind = ICONIFY_EVENT; emacs_event->kind = DEICONIFY_EVENT;
EV_TRAILER ((id)nil); EV_TRAILER ((id)nil);
} }
} }
...@@ -5841,7 +5842,8 @@ - (void)windowDidExpose: sender ...@@ -5841,7 +5842,8 @@ - (void)windowDidExpose: sender
NSTRACE (windowDidExpose); NSTRACE (windowDidExpose);
if (!emacsframe->output_data.ns) if (!emacsframe->output_data.ns)
return; return;
emacsframe->async_visible = 1;
SET_FRAME_VISIBLE (emacsframe, 1);
SET_FRAME_GARBAGED (emacsframe); SET_FRAME_GARBAGED (emacsframe);
if (send_appdefined) if (send_appdefined)
...@@ -5855,8 +5857,8 @@ - (void)windowDidMiniaturize: sender ...@@ -5855,8 +5857,8 @@ - (void)windowDidMiniaturize: sender
if (!emacsframe->output_data.ns) if (!emacsframe->output_data.ns)
return; return;
emacsframe->async_iconified = 1; SET_FRAME_ICONIFIED (emacsframe, 1);
emacsframe->async_visible = 0; SET_FRAME_VISIBLE (emacsframe, 0);
if (emacs_event) if (emacs_event)
{ {
......
...@@ -2374,7 +2374,7 @@ A suspended tty may be resumed by calling `resume-tty' on it. */) ...@@ -2374,7 +2374,7 @@ A suspended tty may be resumed by calling `resume-tty' on it. */)
t->display_info.tty->output = 0; t->display_info.tty->output = 0;
if (FRAMEP (t->display_info.tty->top_frame)) if (FRAMEP (t->display_info.tty->top_frame))
FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 0); SET_FRAME_VISIBLE (XFRAME (t->display_info.tty->top_frame), 0);
} }
...@@ -2444,7 +2444,7 @@ frame's terminal). */) ...@@ -2444,7 +2444,7 @@ frame's terminal). */)
get_tty_size (fileno (t->display_info.tty->input), &width, &height); get_tty_size (fileno (t->display_info.tty->input), &width, &height);
if (width != old_width || height != old_height) if (width != old_width || height != old_height)
change_frame_size (f, height, width, 0, 0, 0); change_frame_size (f, height, width, 0, 0, 0);
FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1); SET_FRAME_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1);
} }
set_tty_hooks (t); set_tty_hooks (t);
......
...@@ -5943,7 +5943,7 @@ Text larger than the specified size is clipped. */) ...@@ -5943,7 +5943,7 @@ Text larger than the specified size is clipped. */)
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
/* Let redisplay know that we have made the frame visible already. */ /* Let redisplay know that we have made the frame visible already. */
f->async_visible = 1; SET_FRAME_VISIBLE (f, 1);
ShowWindow (FRAME_W32_WINDOW (f), SW_SHOWNOACTIVATE); ShowWindow (FRAME_W32_WINDOW (f), SW_SHOWNOACTIVATE);
} }
......
...@@ -4319,24 +4319,25 @@ w32_read_socket (struct terminal *terminal, ...@@ -4319,24 +4319,25 @@ w32_read_socket (struct terminal *terminal,
DebPrint (("clipped frame %p (%s) got WM_PAINT - ignored\n", f, DebPrint (("clipped frame %p (%s) got WM_PAINT - ignored\n", f,
SDATA (f->name))); SDATA (f->name)));
} }
else if (f->async_visible != 1) else if (FRAME_VISIBLE_P (f) != 1)
{ {
bool iconified = FRAME_ICONIFIED_P (f);
/* Definitely not obscured, so mark as visible. */ /* Definitely not obscured, so mark as visible. */
f->async_visible = 1; SET_FRAME_VISIBLE (f, 1);
f->async_iconified = 0; SET_FRAME_ICONIFIED (f, 0);
SET_FRAME_GARBAGED (f); SET_FRAME_GARBAGED (f);
DebPrint (("frame %p (%s) reexposed by WM_PAINT\n", f, DebPrint (("frame %p (%s) reexposed by WM_PAINT\n", f,
SDATA (f->name))); SDATA (f->name)));
/* WM_PAINT serves as MapNotify as well, so report /* WM_PAINT serves as MapNotify as well, so report
visibility changes properly. */ visibility changes properly. */
if (f->iconified) if (iconified)
{ {
inev.kind = DEICONIFY_EVENT; inev.kind = DEICONIFY_EVENT;
XSETFRAME (inev.frame_or_window, f); XSETFRAME (inev.frame_or_window, f);
} }
else if (! NILP (Vframe_list) else if (!NILP (Vframe_list) && !NILP (XCDR (Vframe_list)))
&& ! NILP (XCDR (Vframe_list)))
/* Force a redisplay sooner or later to update the /* Force a redisplay sooner or later to update the
frame titles in case this is the second frame. */ frame titles in case this is the second frame. */
record_asynch_buffer_change (); record_asynch_buffer_change ();
...@@ -4379,7 +4380,7 @@ w32_read_socket (struct terminal *terminal, ...@@ -4379,7 +4380,7 @@ w32_read_socket (struct terminal *terminal,
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
f = x_window_to_frame (dpyinfo, msg.msg.hwnd); f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
if (f && !f->iconified) if (f && !FRAME_ICONIFIED_P (f))
{ {
if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
&& !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
...@@ -4404,7 +4405,7 @@ w32_read_socket (struct terminal *terminal, ...@@ -4404,7 +4405,7 @@ w32_read_socket (struct terminal *terminal,
case WM_CHAR: case WM_CHAR:
f = x_window_to_frame (dpyinfo, msg.msg.hwnd); f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
if (f && !f->iconified) if (f && !FRAME_ICONIFIED_P (f))
{ {
if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
&& !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
...@@ -4482,7 +4483,7 @@ w32_read_socket (struct terminal *terminal, ...@@ -4482,7 +4483,7 @@ w32_read_socket (struct terminal *terminal,
case WM_APPCOMMAND: case WM_APPCOMMAND:
f = x_window_to_frame (dpyinfo, msg.msg.hwnd); f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
if (f && !f->iconified) if (f && !FRAME_ICONIFIED_P (f))
{ {
if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
&& !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
...@@ -4722,7 +4723,7 @@ w32_read_socket (struct terminal *terminal, ...@@ -4722,7 +4723,7 @@ w32_read_socket (struct terminal *terminal,
case WM_MOVE: case WM_MOVE:
f = x_window_to_frame (dpyinfo, msg.msg.hwnd); f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
if (f && !f->async_iconified) if (f && !FRAME_ICONIFIED_P (f))
{ {
int x, y; int x, y;
...@@ -4770,8 +4771,8 @@ w32_read_socket (struct terminal *terminal, ...@@ -4770,8 +4771,8 @@ w32_read_socket (struct terminal *terminal,
switch (msg.msg.wParam) switch (msg.msg.wParam)
{ {
case SIZE_MINIMIZED: case SIZE_MINIMIZED:
f->async_visible = 0; SET_FRAME_VISIBLE (f, 0);
f->async_iconified = 1; SET_FRAME_ICONIFIED (f, 1);
inev.kind = ICONIFY_EVENT;