aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorDmitry Antipov2013-01-24 09:41:28 +0400
committerDmitry Antipov2013-01-24 09:41:28 +0400
commitedfa7fa092c303265edeb2a0b530463cdfe63ab7 (patch)
tree509264878099f61ea1290ca65f93401a1bdf9926 /src/xterm.c
parent5ad86e34d86173f6495b38336d377de5b69da853 (diff)
downloademacs-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/xterm.c')
-rw-r--r--src/xterm.c98
1 files changed, 42 insertions, 56 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 26d40859ed3..eef4edf17f6 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6102,16 +6102,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6102 last_user_time = event.xproperty.time; 6102 last_user_time = event.xproperty.time;
6103 f = x_top_window_to_frame (dpyinfo, event.xproperty.window); 6103 f = x_top_window_to_frame (dpyinfo, event.xproperty.window);
6104 if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state) 6104 if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state)
6105 if (x_handle_net_wm_state (f, &event.xproperty) && f->iconified 6105 if (x_handle_net_wm_state (f, &event.xproperty)
6106 && f->output_data.x->net_wm_state_hidden_seen) 6106 && FRAME_ICONIFIED_P (f)
6107 && f->output_data.x->net_wm_state_hidden_seen)
6107 { 6108 {
6108 /* Gnome shell does not iconify us when C-z is pressed. It hides 6109 /* Gnome shell does not iconify us when C-z is pressed.
6109 the frame. So if our state says we aren't hidden anymore, 6110 It hides the frame. So if our state says we aren't
6110 treat it as deiconified. */ 6111 hidden anymore, treat it as deiconified. */
6111 if (! f->async_iconified) 6112 SET_FRAME_VISIBLE (f, 1);
6112 SET_FRAME_GARBAGED (f); 6113 SET_FRAME_ICONIFIED (f, 0);
6113 f->async_visible = 1;
6114 f->async_iconified = 0;
6115 f->output_data.x->has_been_visible = 1; 6114 f->output_data.x->has_been_visible = 1;
6116 f->output_data.x->net_wm_state_hidden_seen = 0; 6115 f->output_data.x->net_wm_state_hidden_seen = 0;
6117 inev.ie.kind = DEICONIFY_EVENT; 6116 inev.ie.kind = DEICONIFY_EVENT;
@@ -6152,10 +6151,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6152 event.xexpose.width, event.xexpose.height, 6151 event.xexpose.width, event.xexpose.height,
6153 FALSE); 6152 FALSE);
6154#endif 6153#endif
6155 if (f->async_visible == 0) 6154 if (!FRAME_VISIBLE_P (f))
6156 { 6155 {
6157 f->async_visible = 1; 6156 SET_FRAME_VISIBLE (f, 1);
6158 f->async_iconified = 0; 6157 SET_FRAME_ICONIFIED (f, 0);
6159 f->output_data.x->has_been_visible = 1; 6158 f->output_data.x->has_been_visible = 1;
6160 SET_FRAME_GARBAGED (f); 6159 SET_FRAME_GARBAGED (f);
6161 } 6160 }
@@ -6232,20 +6231,20 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6232 if (f) /* F may no longer exist if 6231 if (f) /* F may no longer exist if
6233 the frame was deleted. */ 6232 the frame was deleted. */
6234 { 6233 {
6234 bool visible = FRAME_VISIBLE_P (f);
6235 /* While a frame is unmapped, display generation is 6235 /* While a frame is unmapped, display generation is
6236 disabled; you don't want to spend time updating a 6236 disabled; you don't want to spend time updating a
6237 display that won't ever be seen. */ 6237 display that won't ever be seen. */
6238 f->async_visible = 0; 6238 SET_FRAME_VISIBLE (f, 0);
6239 /* We can't distinguish, from the event, whether the window 6239 /* We can't distinguish, from the event, whether the window
6240 has become iconified or invisible. So assume, if it 6240 has become iconified or invisible. So assume, if it
6241 was previously visible, than now it is iconified. 6241 was previously visible, than now it is iconified.
6242 But x_make_frame_invisible clears both 6242 But x_make_frame_invisible clears both
6243 the visible flag and the iconified flag; 6243 the visible flag and the iconified flag;
6244 and that way, we know the window is not iconified now. */ 6244 and that way, we know the window is not iconified now. */
6245 if (FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f)) 6245 if (visible || FRAME_ICONIFIED_P (f))
6246 { 6246 {
6247 f->async_iconified = 1; 6247 SET_FRAME_ICONIFIED (f, 1);
6248
6249 inev.ie.kind = ICONIFY_EVENT; 6248 inev.ie.kind = ICONIFY_EVENT;
6250 XSETFRAME (inev.ie.frame_or_window, f); 6249 XSETFRAME (inev.ie.frame_or_window, f);
6251 } 6250 }
@@ -6264,13 +6263,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6264 f = x_top_window_to_frame (dpyinfo, event.xmap.window); 6263 f = x_top_window_to_frame (dpyinfo, event.xmap.window);
6265 if (f) 6264 if (f)
6266 { 6265 {
6266 bool iconified = FRAME_ICONIFIED_P (f);
6267 /* wait_reading_process_output will notice this and update 6267 /* wait_reading_process_output will notice this and update
6268 the frame's display structures. 6268 the frame's display structures.
6269 If we where iconified, we should not set garbaged, 6269 If we where iconified, we should not set garbaged,
6270 because that stops redrawing on Expose events. This looks 6270 because that stops redrawing on Expose events. This looks
6271 bad if we are called from a recursive event loop 6271 bad if we are called from a recursive event loop
6272 (x_dispatch_event), for example when a dialog is up. */ 6272 (x_dispatch_event), for example when a dialog is up. */
6273 if (! f->async_iconified) 6273 if (!iconified)
6274 SET_FRAME_GARBAGED (f); 6274 SET_FRAME_GARBAGED (f);
6275 6275
6276 /* Check if fullscreen was specified before we where mapped the 6276 /* Check if fullscreen was specified before we where mapped the
@@ -6278,20 +6278,18 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6278 if (!f->output_data.x->has_been_visible) 6278 if (!f->output_data.x->has_been_visible)
6279 x_check_fullscreen (f); 6279 x_check_fullscreen (f);
6280 6280
6281 f->async_visible = 1; 6281 SET_FRAME_VISIBLE (f, 1);
6282 f->async_iconified = 0; 6282 SET_FRAME_ICONIFIED (f, 0);
6283 f->output_data.x->has_been_visible = 1; 6283 f->output_data.x->has_been_visible = 1;
6284 6284
6285 if (f->iconified) 6285 if (iconified)
6286 { 6286 {
6287 inev.ie.kind = DEICONIFY_EVENT; 6287 inev.ie.kind = DEICONIFY_EVENT;
6288 XSETFRAME (inev.ie.frame_or_window, f); 6288 XSETFRAME (inev.ie.frame_or_window, f);
6289 } 6289 }
6290 else if (! NILP (Vframe_list) 6290 else if (! NILP (Vframe_list) && ! NILP (XCDR (Vframe_list)))
6291 && ! NILP (XCDR (Vframe_list))) 6291 /* Force a redisplay sooner or later to update the
6292 /* Force a redisplay sooner or later 6292 frame titles in case this is the second frame. */
6293 to update the frame titles
6294 in case this is the second frame. */
6295 record_asynch_buffer_change (); 6293 record_asynch_buffer_change ();
6296 6294
6297#ifdef USE_GTK 6295#ifdef USE_GTK
@@ -8417,7 +8415,7 @@ get_current_wm_state (struct frame *f,
8417 if (tmp_data) XFree (tmp_data); 8415 if (tmp_data) XFree (tmp_data);
8418 x_uncatch_errors (); 8416 x_uncatch_errors ();
8419 unblock_input (); 8417 unblock_input ();
8420 return ! f->iconified; 8418 return !FRAME_ICONIFIED_P (f);
8421 } 8419 }
8422 8420
8423 x_uncatch_errors (); 8421 x_uncatch_errors ();
@@ -8529,7 +8527,7 @@ do_ewmh_fullscreen (struct frame *f)
8529static void 8527static void
8530XTfullscreen_hook (FRAME_PTR f) 8528XTfullscreen_hook (FRAME_PTR f)
8531{ 8529{
8532 if (f->async_visible) 8530 if (FRAME_VISIBLE_P (f))
8533 { 8531 {
8534 block_input (); 8532 block_input ();
8535 x_check_fullscreen (f); 8533 x_check_fullscreen (f);
@@ -8793,7 +8791,7 @@ x_set_window_size_1 (struct frame *f, int change_gravity, int cols, int rows)
8793 /* But the ConfigureNotify may in fact never arrive, and then this is 8791 /* But the ConfigureNotify may in fact never arrive, and then this is
8794 not right if the frame is visible. Instead wait (with timeout) 8792 not right if the frame is visible. Instead wait (with timeout)
8795 for the ConfigureNotify. */ 8793 for the ConfigureNotify. */
8796 if (f->async_visible) 8794 if (FRAME_VISIBLE_P (f))
8797 x_wait_for_event (f, ConfigureNotify); 8795 x_wait_for_event (f, ConfigureNotify);
8798 else 8796 else
8799 { 8797 {
@@ -8905,9 +8903,8 @@ void
8905x_raise_frame (struct frame *f) 8903x_raise_frame (struct frame *f)
8906{ 8904{
8907 block_input (); 8905 block_input ();
8908 if (f->async_visible) 8906 if (FRAME_VISIBLE_P (f))
8909 XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); 8907 XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
8910
8911 XFlush (FRAME_X_DISPLAY (f)); 8908 XFlush (FRAME_X_DISPLAY (f));
8912 unblock_input (); 8909 unblock_input ();
8913} 8910}
@@ -8917,7 +8914,7 @@ x_raise_frame (struct frame *f)
8917static void 8914static void
8918x_lower_frame (struct frame *f) 8915x_lower_frame (struct frame *f)
8919{ 8916{
8920 if (f->async_visible) 8917 if (FRAME_VISIBLE_P (f))
8921 { 8918 {
8922 block_input (); 8919 block_input ();
8923 XLowerWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); 8920 XLowerWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
@@ -8933,7 +8930,7 @@ xembed_request_focus (FRAME_PTR f)
8933{ 8930{
8934 /* See XEmbed Protocol Specification at 8931 /* See XEmbed Protocol Specification at
8935 http://freedesktop.org/wiki/Specifications/xembed-spec */ 8932 http://freedesktop.org/wiki/Specifications/xembed-spec */
8936 if (f->async_visible) 8933 if (FRAME_VISIBLE_P (f))
8937 xembed_send_message (f, CurrentTime, 8934 xembed_send_message (f, CurrentTime,
8938 XEMBED_REQUEST_FOCUS, 0, 0, 0); 8935 XEMBED_REQUEST_FOCUS, 0, 0, 0);
8939} 8936}
@@ -8947,7 +8944,8 @@ x_ewmh_activate_frame (FRAME_PTR f)
8947 http://freedesktop.org/wiki/Specifications/wm-spec */ 8944 http://freedesktop.org/wiki/Specifications/wm-spec */
8948 8945
8949 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 8946 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8950 if (f->async_visible && wm_supports (f, dpyinfo->Xatom_net_active_window)) 8947
8948 if (FRAME_VISIBLE_P (f) && wm_supports (f, dpyinfo->Xatom_net_active_window))
8951 { 8949 {
8952 Lisp_Object frame; 8950 Lisp_Object frame;
8953 XSETFRAME (frame, f); 8951 XSETFRAME (frame, f);
@@ -9159,9 +9157,6 @@ x_make_frame_visible (struct frame *f)
9159 poll_for_input_1 (); 9157 poll_for_input_1 ();
9160 poll_suppress_count = old_poll_suppress_count; 9158 poll_suppress_count = old_poll_suppress_count;
9161 } 9159 }
9162
9163 /* See if a MapNotify event has been processed. */
9164 FRAME_SAMPLE_VISIBILITY (f);
9165 } 9160 }
9166 9161
9167 /* 2000-09-28: In 9162 /* 2000-09-28: In
@@ -9229,10 +9224,8 @@ x_make_frame_invisible (struct frame *f)
9229 So we can't win using the usual strategy of letting 9224 So we can't win using the usual strategy of letting
9230 FRAME_SAMPLE_VISIBILITY set this. So do it by hand, 9225 FRAME_SAMPLE_VISIBILITY set this. So do it by hand,
9231 and synchronize with the server to make sure we agree. */ 9226 and synchronize with the server to make sure we agree. */
9232 f->visible = 0; 9227 SET_FRAME_VISIBLE (f, 0);
9233 FRAME_ICONIFIED_P (f) = 0; 9228 SET_FRAME_ICONIFIED (f, 0);
9234 f->async_visible = 0;
9235 f->async_iconified = 0;
9236 9229
9237 x_sync (f); 9230 x_sync (f);
9238 9231
@@ -9253,13 +9246,11 @@ x_iconify_frame (struct frame *f)
9253 if (FRAME_X_DISPLAY_INFO (f)->x_highlight_frame == f) 9246 if (FRAME_X_DISPLAY_INFO (f)->x_highlight_frame == f)
9254 FRAME_X_DISPLAY_INFO (f)->x_highlight_frame = 0; 9247 FRAME_X_DISPLAY_INFO (f)->x_highlight_frame = 0;
9255 9248
9256 if (f->async_iconified) 9249 if (FRAME_ICONIFIED_P (f))
9257 return; 9250 return;
9258 9251
9259 block_input (); 9252 block_input ();
9260 9253
9261 FRAME_SAMPLE_VISIBILITY (f);
9262
9263 type = x_icon_type (f); 9254 type = x_icon_type (f);
9264 if (!NILP (type)) 9255 if (!NILP (type))
9265 x_bitmap_icon (f, type); 9256 x_bitmap_icon (f, type);
@@ -9271,10 +9262,8 @@ x_iconify_frame (struct frame *f)
9271 gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f)); 9262 gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f));
9272 9263
9273 gtk_window_iconify (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f))); 9264 gtk_window_iconify (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
9274 f->iconified = 1; 9265 SET_FRAME_VISIBLE (f, 0);
9275 f->visible = 1; 9266 SET_FRAME_ICONIFIED (f, 1);
9276 f->async_iconified = 1;
9277 f->async_visible = 0;
9278 unblock_input (); 9267 unblock_input ();
9279 return; 9268 return;
9280 } 9269 }
@@ -9291,10 +9280,8 @@ x_iconify_frame (struct frame *f)
9291 /* The server won't give us any event to indicate 9280 /* The server won't give us any event to indicate
9292 that an invisible frame was changed to an icon, 9281 that an invisible frame was changed to an icon,
9293 so we have to record it here. */ 9282 so we have to record it here. */
9294 f->iconified = 1; 9283 SET_FRAME_VISIBLE (f, 0);
9295 f->visible = 1; 9284 SET_FRAME_ICONIFIED (f, 1);
9296 f->async_iconified = 1;
9297 f->async_visible = 0;
9298 unblock_input (); 9285 unblock_input ();
9299 return; 9286 return;
9300 } 9287 }
@@ -9307,9 +9294,8 @@ x_iconify_frame (struct frame *f)
9307 if (!result) 9294 if (!result)
9308 error ("Can't notify window manager of iconification"); 9295 error ("Can't notify window manager of iconification");
9309 9296
9310 f->async_iconified = 1; 9297 SET_FRAME_ICONIFIED (f, 1);
9311 f->async_visible = 0; 9298 SET_FRAME_VISIBLE (f, 0);
9312
9313 9299
9314 block_input (); 9300 block_input ();
9315 XFlush (FRAME_X_DISPLAY (f)); 9301 XFlush (FRAME_X_DISPLAY (f));
@@ -9358,8 +9344,8 @@ x_iconify_frame (struct frame *f)
9358 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); 9344 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
9359 } 9345 }
9360 9346
9361 f->async_iconified = 1; 9347 SET_FRAME_ICONIFIED (f, 1);
9362 f->async_visible = 0; 9348 SET_FRAME_VISIBLE (f, 0);
9363 9349
9364 XFlush (FRAME_X_DISPLAY (f)); 9350 XFlush (FRAME_X_DISPLAY (f));
9365 unblock_input (); 9351 unblock_input ();