+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>
* insdel.c (prepare_to_modify_buffer): Revert last change as suggested
tty_frame_count = 1;
fset_name (f, build_pure_c_string ("F1"));
- f->visible = 1;
- f->async_visible = 1;
+ SET_FRAME_VISIBLE (f, 1);
f->output_method = terminal->type;
f->terminal = terminal;
fset_name (f, make_formatted_string (name, "F%"pMd, ++tty_frame_count));
- f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */
- f->async_visible = 1; /* Don't let visible be cleared later. */
+ SET_FRAME_VISIBLE (f, 1);
+
f->terminal = terminal;
f->terminal->reference_count++;
#ifdef MSDOS
/* Set the top frame to the newly created frame. */
if (FRAMEP (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;
{
if (FRAMEP (FRAME_TTY (XFRAME (frame))->top_frame))
/* Mark previously displayed frame as now obscured. */
- XFRAME (FRAME_TTY (XFRAME (frame))->top_frame)->async_visible = 2;
- XFRAME (frame)->async_visible = 1;
+ SET_FRAME_VISIBLE (XFRAME (FRAME_TTY (XFRAME (frame))->top_frame), 2);
+ SET_FRAME_VISIBLE (XFRAME (frame), 1);
FRAME_TTY (XFRAME (frame))->top_frame = frame;
}
}
else if (EQ (minibuf, Qvisible))
{
- FRAME_SAMPLE_VISIBILITY (c);
if (FRAME_VISIBLE_P (c))
return candidate;
}
}
else if (XFASTINT (minibuf) == 0)
{
- FRAME_SAMPLE_VISIBILITY (c);
if (FRAME_VISIBLE_P (c) || FRAME_ICONIFIED_P (c))
return candidate;
}
and note any recent change in visibility. */
#ifdef HAVE_WINDOW_SYSTEM
if (FRAME_WINDOW_P (XFRAME (this)))
- {
- x_sync (XFRAME (this));
- FRAME_SAMPLE_VISIBILITY (XFRAME (this));
- }
+ x_sync (XFRAME (this));
#endif
if (FRAME_VISIBLE_P (XFRAME (this))
fset_root_window (f, Qnil);
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
garbage collection. The frame object itself may not be garbage
/* I think this should be done with a hook. */
#ifdef HAVE_WINDOW_SYSTEM
if (FRAME_WINDOW_P (f))
- {
- FRAME_SAMPLE_VISIBILITY (f);
- x_make_frame_visible (f);
- }
+ x_make_frame_visible (f);
#endif
make_frame_visible_1 (f->root_window);
{
CHECK_LIVE_FRAME (frame);
- FRAME_SAMPLE_VISIBILITY (XFRAME (frame));
-
if (FRAME_VISIBLE_P (XFRAME (frame)))
return Qt;
if (FRAME_ICONIFIED_P (XFRAME (frame)))
make_formatted_string (buf, "%"pMu, w));
#endif
store_in_alist (alistptr, Qicon_name, f->icon_name);
- FRAME_SAMPLE_VISIBILITY (f);
store_in_alist (alistptr, Qvisibility,
(FRAME_VISIBLE_P (f) ? Qt
: FRAME_ICONIFIED_P (f) ? Qicon : Qnil));
unsigned int external_menu_bar : 1;
#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.
- DON'T SET IT DIRECTLY; instead, use FRAME_SET_VISIBLE.
Note that, since invisible frames aren't updated, whenever a
- frame becomes visible again, it must be marked as garbaged. The
- FRAME_SAMPLE_VISIBILITY macro takes care of this.
+ frame becomes visible again, it must be marked as garbaged.
On ttys and on Windows NT/9X, to avoid wasting effort updating
visible frames that are actually completely obscured by other
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
updating it. We must take care to garbage the frame when it
- ceases to be obscured though.
-
- 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. */
+ ceases to be obscured though. See SET_FRAME_VISIBLE below. */
unsigned visible : 2;
- unsigned iconified : 1;
-
- /* Let's not use bitfields for volatile variables. */
- /* Asynchronous input handlers change these, and
- FRAME_SAMPLE_VISIBILITY copies them into visible and iconified.
- See FRAME_SAMPLE_VISIBILITY, below. */
- volatile char async_visible, async_iconified;
+ /* Nonzero if the frame is currently iconified. Do not
+ set this directly, use SET_FRAME_ICONIFIED instead. */
+ unsigned iconified : 1;
/* Nonzero if this frame should be redrawn. */
- volatile char garbaged;
+ unsigned garbaged : 1;
/* True if frame actually has a minibuffer window on it.
0 if using a minibuffer window that isn't on this frame. */
#else
#define FRAME_EXTERNAL_MENU_BAR(f) 0
#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. */
#define FRAME_OBSCURED_P(f) ((f)->visible > 1)
/* Nonzero if frame F is currently iconified. */
#define FRAME_ICONIFIED_P(f) (f)->iconified
-#define FRAME_SET_VISIBLE(f,p) \
- ((f)->async_visible = (p), FRAME_SAMPLE_VISIBILITY (f))
+/* Mark frame F as currently garbaged. */
#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
/* Nonzero means do not allow splitting this frame's window. */
#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) \
CHECK_TYPE (FRAMEP (x), Qframep, x)
block_input (); \
if (hlinfo->mouse_face_mouse_frame) \
note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
- hlinfo->mouse_face_mouse_x, \
- hlinfo->mouse_face_mouse_y); \
+ hlinfo->mouse_face_mouse_x, \
+ hlinfo->mouse_face_mouse_y); \
unblock_input (); \
} \
} 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 Qtty, Qtty_type;
extern Lisp_Object Qtty_color_mode;
size as fast as possible.
For unmapped windows, we can set rows/cols. When
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 */
(void)gtk_events_pending ();
NSView *view = FRAME_NS_VIEW (f);
check_ns ();
block_input ();
- FRAME_SAMPLE_VISIBILITY (f);
if (FRAME_VISIBLE_P (f))
- {
- [[view window] makeKeyAndOrderFront: NSApp];
- }
+ [[view window] makeKeyAndOrderFront: NSApp];
unblock_input ();
}
if (!FRAME_VISIBLE_P (f))
{
EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
- f->async_visible = 1;
+
+ SET_FRAME_VISIBLE (f, 1);
ns_raise_frame (f);
#ifdef NEW_STYLE_FS
NSTRACE (x_make_frame_invisible);
check_ns ();
[[view window] orderOut: NSApp];
- f->async_visible = 0;
- f->async_iconified = 0;
+ SET_FRAME_VISIBLE (f, 0);
+ SET_FRAME_ICONIFIED (f, 0);
}
{
EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
- if (! f->async_visible) return;
+ if (!FRAME_VISIBLE_P (f))
+ return;
+
#ifndef NEW_STYLE_FS
if (f->want_fullscreen == FULLSCREEN_BOTH)
{
NSTRACE (windowDidDeminiaturize);
if (!emacsframe->output_data.ns)
return;
- emacsframe->async_iconified = 0;
- emacsframe->async_visible = 1;
+
+ SET_FRAME_ICONIFIED (emacsframe, 0);
+ SET_FRAME_VISIBLE (emacsframe, 1);
windows_or_buffers_changed++;
if (emacs_event)
{
- emacs_event->kind = ICONIFY_EVENT;
+ emacs_event->kind = DEICONIFY_EVENT;
EV_TRAILER ((id)nil);
}
}
NSTRACE (windowDidExpose);
if (!emacsframe->output_data.ns)
return;
- emacsframe->async_visible = 1;
+
+ SET_FRAME_VISIBLE (emacsframe, 1);
SET_FRAME_GARBAGED (emacsframe);
if (send_appdefined)
if (!emacsframe->output_data.ns)
return;
- emacsframe->async_iconified = 1;
- emacsframe->async_visible = 0;
+ SET_FRAME_ICONIFIED (emacsframe, 1);
+ SET_FRAME_VISIBLE (emacsframe, 0);
if (emacs_event)
{
t->display_info.tty->output = 0;
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);
}
get_tty_size (fileno (t->display_info.tty->input), &width, &height);
if (width != old_width || height != old_height)
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);
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
/* 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);
}
DebPrint (("clipped frame %p (%s) got WM_PAINT - ignored\n", f,
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. */
- f->async_visible = 1;
- f->async_iconified = 0;
+ SET_FRAME_VISIBLE (f, 1);
+ SET_FRAME_ICONIFIED (f, 0);
SET_FRAME_GARBAGED (f);
DebPrint (("frame %p (%s) reexposed by WM_PAINT\n", f,
SDATA (f->name)));
/* WM_PAINT serves as MapNotify as well, so report
visibility changes properly. */
- if (f->iconified)
+ if (iconified)
{
inev.kind = DEICONIFY_EVENT;
XSETFRAME (inev.frame_or_window, f);
}
- else if (! NILP (Vframe_list)
- && ! NILP (XCDR (Vframe_list)))
+ else if (!NILP (Vframe_list) && !NILP (XCDR (Vframe_list)))
/* Force a redisplay sooner or later to update the
frame titles in case this is the second frame. */
record_asynch_buffer_change ();
case WM_SYSKEYDOWN:
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)
&& !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
case WM_CHAR:
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)
&& !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
case WM_APPCOMMAND:
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)
&& !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
case WM_MOVE:
f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
- if (f && !f->async_iconified)
+ if (f && !FRAME_ICONIFIED_P (f))
{
int x, y;
switch (msg.msg.wParam)
{
case SIZE_MINIMIZED:
- f->async_visible = 0;
- f->async_iconified = 1;
+ SET_FRAME_VISIBLE (f, 0);
+ SET_FRAME_ICONIFIED (f, 1);
inev.kind = ICONIFY_EVENT;
XSETFRAME (inev.frame_or_window, f);
case SIZE_MAXIMIZED:
case SIZE_RESTORED:
- f->async_visible = 1;
- f->async_iconified = 0;
+ {
+ bool iconified = FRAME_ICONIFIED_P (f);
- /* wait_reading_process_output will notice this and update
- the frame's display structures. */
- SET_FRAME_GARBAGED (f);
+ SET_FRAME_VISIBLE (f, 1);
+ SET_FRAME_ICONIFIED (f, 0);
- if (f->iconified)
- {
- int x, y;
-
- /* Reset top and left positions of the Window
- here since Windows sends a WM_MOVE message
- BEFORE telling us the Window is minimized
- when the Window is iconified, with 3000,3000
- as the co-ords. */
- x_real_positions (f, &x, &y);
- f->left_pos = x;
- f->top_pos = y;
+ /* wait_reading_process_output will notice this
+ and update the frame's display structures. */
+ SET_FRAME_GARBAGED (f);
- inev.kind = DEICONIFY_EVENT;
- XSETFRAME (inev.frame_or_window, f);
- }
- else if (! NILP (Vframe_list)
- && ! NILP (XCDR (Vframe_list)))
- /* Force a redisplay sooner or later
- to update the frame titles
- in case this is the second frame. */
- record_asynch_buffer_change ();
+ if (iconified)
+ {
+ int x, y;
+
+ /* Reset top and left positions of the Window
+ here since Windows sends a WM_MOVE message
+ BEFORE telling us the Window is minimized
+ when the Window is iconified, with 3000,3000
+ as the co-ords. */
+ x_real_positions (f, &x, &y);
+ f->left_pos = x;
+ f->top_pos = y;
+
+ inev.kind = DEICONIFY_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
+ }
+ else if (! NILP (Vframe_list)
+ && ! NILP (XCDR (Vframe_list)))
+ /* Force a redisplay sooner or later
+ to update the frame titles
+ in case this is the second frame. */
+ record_asynch_buffer_change ();
+ }
break;
}
}
- if (f && !f->async_iconified && msg.msg.wParam != SIZE_MINIMIZED)
+ if (f && !FRAME_ICONIFIED_P (f) && msg.msg.wParam != SIZE_MINIMIZED)
{
RECT rect;
int rows;
continue;
/* Check "visible" frames and mark each as obscured or not.
- Note that async_visible is nonzero for unobscured and
- obscured frames, but zero for hidden and iconified frames. */
- if (FRAME_W32_P (f) && f->async_visible)
+ Note that visible is nonzero for unobscured and obscured
+ frames, but zero for hidden and iconified frames. */
+ if (FRAME_W32_P (f) && FRAME_VISIBLE_P (f))
{
RECT clipbox;
HDC hdc;
+ bool obscured;
enter_crit ();
/* Query clipping rectangle for the entire window area
ReleaseDC (FRAME_W32_WINDOW (f), hdc);
leave_crit ();
- if (clipbox.right == clipbox.left
- || clipbox.bottom == clipbox.top)
+ obscured = FRAME_OBSCURED_P (f);
+
+ if (clipbox.right == clipbox.left || clipbox.bottom == clipbox.top)
{
- /* Frame has become completely obscured so mark as
- such (we do this by setting async_visible to 2 so
- that FRAME_VISIBLE_P is still true, but redisplay
- will skip it). */
- f->async_visible = 2;
+ /* Frame has become completely obscured so mark as such (we
+ do this by setting visible to 2 so that FRAME_VISIBLE_P
+ is still true, but redisplay will skip it). */
+ SET_FRAME_VISIBLE (f, 2);
- if (!FRAME_OBSCURED_P (f))
- {
- DebPrint (("frame %p (%s) obscured\n", f,
- SDATA (f->name)));
- }
+ if (!obscured)
+ DebPrint (("frame %p (%s) obscured\n", f, SDATA (f->name)));
}
else
{
/* Frame is not obscured, so mark it as such. */
- f->async_visible = 1;
+ SET_FRAME_VISIBLE (f, 1);
- if (FRAME_OBSCURED_P (f))
+ if (obscured)
{
SET_FRAME_GARBAGED (f);
- DebPrint (("obscured frame %p (%s) found to be visible\n", f,
- SDATA (f->name)));
+ DebPrint (("obscured frame %p (%s) found to be visible\n",
+ f, SDATA (f->name)));
/* Force a redisplay sooner or later. */
record_asynch_buffer_change ();
{
static int normal_width, normal_height;
- if (f->async_visible)
+ if (FRAME_VISIBLE_P (f))
{
int width, height, top_pos, left_pos, pixel_height, pixel_width;
int cur_w = FRAME_COLS (f), cur_h = FRAME_LINES (f);
causes unexpected behavior when unminimizing frames that were
previously maximized. But only SW_SHOWNORMAL works properly for
frames that were truely hidden (using make-frame-invisible), so
- we need it to avoid Bug#5482. It seems that async_iconified
- is only set for minimized windows that are still visible, so
- use that to determine the appropriate flag to pass ShowWindow. */
+ we need it to avoid Bug#5482. It seems that iconified is only
+ set for minimized windows that are still visible, so use that to
+ determine the appropriate flag to pass ShowWindow. */
my_show_window (f, FRAME_W32_WINDOW (f),
- f->async_iconified ? SW_RESTORE : SW_SHOWNORMAL);
+ FRAME_ICONIFIED_P (f) ? SW_RESTORE : SW_SHOWNORMAL);
}
/* Synchronize to ensure Emacs knows the frame is visible
poll_suppress_count = old_poll_suppress_count;
}
}
- FRAME_SAMPLE_VISIBILITY (f);
}
}
So we can't win using the usual strategy of letting
FRAME_SAMPLE_VISIBILITY set this. So do it by hand,
and synchronize with the server to make sure we agree. */
- f->visible = 0;
- FRAME_ICONIFIED_P (f) = 0;
- f->async_visible = 0;
- f->async_iconified = 0;
+ SET_FRAME_VISIBLE (f, 0);
+ SET_FRAME_ICONIFIED (f, 0);
unblock_input ();
}
if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f)
FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame = 0;
- if (f->async_iconified)
+ if (FRAME_ICONIFIED_P (f))
return;
block_input ();
}
else if (EQ (all_frames, Qvisible))
{
- FRAME_SAMPLE_VISIBILITY (f);
candidate_p = FRAME_VISIBLE_P (f)
&& (FRAME_TERMINAL (XFRAME (w->frame))
== FRAME_TERMINAL (XFRAME (selected_frame)));
}
else if (INTEGERP (all_frames) && XINT (all_frames) == 0)
{
- FRAME_SAMPLE_VISIBILITY (f);
candidate_p = (FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f)
#ifdef HAVE_X_WINDOWS
/* Yuck!! If we've just created the frame and the
/* Error messages get reported properly by cmd_error, so this must be just an
informative message; if the frame hasn't really been initialized yet, just
toss it. */
- else if (INTERACTIVE
- && sf->glyphs_initialized_p)
+ else if (INTERACTIVE && sf->glyphs_initialized_p)
{
/* Get the frame containing the mini-buffer
that the selected frame is using. */
Lisp_Object frame = XWINDOW (mini_window)->frame;
struct frame *f = XFRAME (frame);
- FRAME_SAMPLE_VISIBILITY (f);
- if (FRAME_VISIBLE_P (sf)
- && !FRAME_VISIBLE_P (f))
+ if (FRAME_VISIBLE_P (sf) && !FRAME_VISIBLE_P (f))
Fmake_frame_visible (frame);
if (STRINGP (m) && SCHARS (m) > 0)
{
struct frame *f = XFRAME (frame);
- FRAME_SAMPLE_VISIBILITY (f);
if (FRAME_VISIBLE_P (f))
++number_of_visible_frames;
clear_desired_matrices (f);
{
int this_is_visible = 0;
- if (XFRAME (frame)->visible)
- this_is_visible = 1;
- FRAME_SAMPLE_VISIBILITY (XFRAME (frame));
if (XFRAME (frame)->visible)
this_is_visible = 1;
last_user_time = event.xproperty.time;
f = x_top_window_to_frame (dpyinfo, event.xproperty.window);
if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state)
- if (x_handle_net_wm_state (f, &event.xproperty) && f->iconified
- && f->output_data.x->net_wm_state_hidden_seen)
+ if (x_handle_net_wm_state (f, &event.xproperty)
+ && FRAME_ICONIFIED_P (f)
+ && f->output_data.x->net_wm_state_hidden_seen)
{
- /* Gnome shell does not iconify us when C-z is pressed. It hides
- the frame. So if our state says we aren't hidden anymore,
- treat it as deiconified. */
- if (! f->async_iconified)
- SET_FRAME_GARBAGED (f);
- f->async_visible = 1;
- f->async_iconified = 0;
+ /* Gnome shell does not iconify us when C-z is pressed.
+ It hides the frame. So if our state says we aren't
+ hidden anymore, treat it as deiconified. */
+ SET_FRAME_VISIBLE (f, 1);
+ SET_FRAME_ICONIFIED (f, 0);
f->output_data.x->has_been_visible = 1;
f->output_data.x->net_wm_state_hidden_seen = 0;
inev.ie.kind = DEICONIFY_EVENT;
event.xexpose.width, event.xexpose.height,
FALSE);
#endif
- if (f->async_visible == 0)
+ if (!FRAME_VISIBLE_P (f))
{
- f->async_visible = 1;
- f->async_iconified = 0;
+ SET_FRAME_VISIBLE (f, 1);
+ SET_FRAME_ICONIFIED (f, 0);
f->output_data.x->has_been_visible = 1;
SET_FRAME_GARBAGED (f);
}
if (f) /* F may no longer exist if
the frame was deleted. */
{
+ bool visible = FRAME_VISIBLE_P (f);
/* While a frame is unmapped, display generation is
disabled; you don't want to spend time updating a
display that won't ever be seen. */
- f->async_visible = 0;
+ SET_FRAME_VISIBLE (f, 0);
/* We can't distinguish, from the event, whether the window
has become iconified or invisible. So assume, if it
was previously visible, than now it is iconified.
But x_make_frame_invisible clears both
the visible flag and the iconified flag;
and that way, we know the window is not iconified now. */
- if (FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f))
+ if (visible || FRAME_ICONIFIED_P (f))
{
- f->async_iconified = 1;
-
+ SET_FRAME_ICONIFIED (f, 1);
inev.ie.kind = ICONIFY_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
}
f = x_top_window_to_frame (dpyinfo, event.xmap.window);
if (f)
{
+ bool iconified = FRAME_ICONIFIED_P (f);
/* wait_reading_process_output will notice this and update
the frame's display structures.
If we where iconified, we should not set garbaged,
because that stops redrawing on Expose events. This looks
bad if we are called from a recursive event loop
(x_dispatch_event), for example when a dialog is up. */
- if (! f->async_iconified)
+ if (!iconified)
SET_FRAME_GARBAGED (f);
/* Check if fullscreen was specified before we where mapped the
if (!f->output_data.x->has_been_visible)
x_check_fullscreen (f);
- f->async_visible = 1;
- f->async_iconified = 0;
+ SET_FRAME_VISIBLE (f, 1);
+ SET_FRAME_ICONIFIED (f, 0);
f->output_data.x->has_been_visible = 1;
- if (f->iconified)
+ if (iconified)
{
inev.ie.kind = DEICONIFY_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
}
- else if (! NILP (Vframe_list)
- && ! NILP (XCDR (Vframe_list)))
- /* Force a redisplay sooner or later
- to update the frame titles
- in case this is the second frame. */
+ else if (! NILP (Vframe_list) && ! NILP (XCDR (Vframe_list)))
+ /* Force a redisplay sooner or later to update the
+ frame titles in case this is the second frame. */
record_asynch_buffer_change ();
#ifdef USE_GTK
if (tmp_data) XFree (tmp_data);
x_uncatch_errors ();
unblock_input ();
- return ! f->iconified;
+ return !FRAME_ICONIFIED_P (f);
}
x_uncatch_errors ();
static void
XTfullscreen_hook (FRAME_PTR f)
{
- if (f->async_visible)
+ if (FRAME_VISIBLE_P (f))
{
block_input ();
x_check_fullscreen (f);
/* But the ConfigureNotify may in fact never arrive, and then this is
not right if the frame is visible. Instead wait (with timeout)
for the ConfigureNotify. */
- if (f->async_visible)
+ if (FRAME_VISIBLE_P (f))
x_wait_for_event (f, ConfigureNotify);
else
{
x_raise_frame (struct frame *f)
{
block_input ();
- if (f->async_visible)
+ if (FRAME_VISIBLE_P (f))
XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
-
XFlush (FRAME_X_DISPLAY (f));
unblock_input ();
}
static void
x_lower_frame (struct frame *f)
{
- if (f->async_visible)
+ if (FRAME_VISIBLE_P (f))
{
block_input ();
XLowerWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
{
/* See XEmbed Protocol Specification at
http://freedesktop.org/wiki/Specifications/xembed-spec */
- if (f->async_visible)
+ if (FRAME_VISIBLE_P (f))
xembed_send_message (f, CurrentTime,
XEMBED_REQUEST_FOCUS, 0, 0, 0);
}
http://freedesktop.org/wiki/Specifications/wm-spec */
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
- if (f->async_visible && wm_supports (f, dpyinfo->Xatom_net_active_window))
+
+ if (FRAME_VISIBLE_P (f) && wm_supports (f, dpyinfo->Xatom_net_active_window))
{
Lisp_Object frame;
XSETFRAME (frame, f);
poll_for_input_1 ();
poll_suppress_count = old_poll_suppress_count;
}
-
- /* See if a MapNotify event has been processed. */
- FRAME_SAMPLE_VISIBILITY (f);
}
/* 2000-09-28: In
So we can't win using the usual strategy of letting
FRAME_SAMPLE_VISIBILITY set this. So do it by hand,
and synchronize with the server to make sure we agree. */
- f->visible = 0;
- FRAME_ICONIFIED_P (f) = 0;
- f->async_visible = 0;
- f->async_iconified = 0;
+ SET_FRAME_VISIBLE (f, 0);
+ SET_FRAME_ICONIFIED (f, 0);
x_sync (f);
if (FRAME_X_DISPLAY_INFO (f)->x_highlight_frame == f)
FRAME_X_DISPLAY_INFO (f)->x_highlight_frame = 0;
- if (f->async_iconified)
+ if (FRAME_ICONIFIED_P (f))
return;
block_input ();
- FRAME_SAMPLE_VISIBILITY (f);
-
type = x_icon_type (f);
if (!NILP (type))
x_bitmap_icon (f, type);
gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f));
gtk_window_iconify (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
- f->iconified = 1;
- f->visible = 1;
- f->async_iconified = 1;
- f->async_visible = 0;
+ SET_FRAME_VISIBLE (f, 0);
+ SET_FRAME_ICONIFIED (f, 1);
unblock_input ();
return;
}
/* The server won't give us any event to indicate
that an invisible frame was changed to an icon,
so we have to record it here. */
- f->iconified = 1;
- f->visible = 1;
- f->async_iconified = 1;
- f->async_visible = 0;
+ SET_FRAME_VISIBLE (f, 0);
+ SET_FRAME_ICONIFIED (f, 1);
unblock_input ();
return;
}
if (!result)
error ("Can't notify window manager of iconification");
- f->async_iconified = 1;
- f->async_visible = 0;
-
+ SET_FRAME_ICONIFIED (f, 1);
+ SET_FRAME_VISIBLE (f, 0);
block_input ();
XFlush (FRAME_X_DISPLAY (f));
XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
}
- f->async_iconified = 1;
- f->async_visible = 0;
+ SET_FRAME_ICONIFIED (f, 1);
+ SET_FRAME_VISIBLE (f, 0);
XFlush (FRAME_X_DISPLAY (f));
unblock_input ();