aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2008-12-22 09:40:33 +0000
committerMartin Rudalics2008-12-22 09:40:33 +0000
commit56f2de103fd8ee430ae3d2f6a1b83d4aa2012f90 (patch)
tree4dcbba9b999a65c7919278eb93fd5b821f9b5b2d
parentcaf857eb7c7815e1d11ed706fb4a789bc92c3924 (diff)
downloademacs-56f2de103fd8ee430ae3d2f6a1b83d4aa2012f90.tar.gz
emacs-56f2de103fd8ee430ae3d2f6a1b83d4aa2012f90.zip
* frame.c (delete_frame): New function derived from
Fdelete_frame to handle Qnoelisp value for FORCE argument. Delete last frame iff FORCE equals Qnoelisp. (Bug#1450) (Fdelete_frame): Call delete_frame. Remove line from doc-string saying that FORCE non-nil doesn't run `delete-frame-functions'. * frame.h: Extern delete_frame. * window.c (window_loop): * terminal.c (delete_terminal): * xterm.c (x_connection_closed): * xfns.c (Fx_hide_tip): * w32fns.c (Fx_hide_tip): Call delete_frame instead of Fdelete_frame.
-rw-r--r--src/ChangeLog15
-rw-r--r--src/frame.c60
-rw-r--r--src/frame.h1
-rw-r--r--src/terminal.c12
-rw-r--r--src/w32fns.c2
-rw-r--r--src/window.c6
-rw-r--r--src/xfns.c2
-rw-r--r--src/xterm.c24
8 files changed, 74 insertions, 48 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 015f8f3dc7c..844b641d696 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
12008-12-22 Martin Rudalics <rudalics@gmx.at>
2
3 * frame.c (delete_frame): New function derived from
4 Fdelete_frame to handle Qnoelisp value for FORCE argument.
5 Delete last frame iff FORCE equals Qnoelisp. (Bug#1450)
6 (Fdelete_frame): Call delete_frame. Remove line from doc-string
7 saying that FORCE non-nil doesn't run `delete-frame-functions'.
8 * frame.h: Extern delete_frame.
9 * window.c (window_loop):
10 * terminal.c (delete_terminal):
11 * xterm.c (x_connection_closed):
12 * xfns.c (Fx_hide_tip):
13 * w32fns.c (Fx_hide_tip): Call delete_frame instead of
14 Fdelete_frame.
15
12008-12-21 Jason Rumney <jasonr@gnu.org> 162008-12-21 Jason Rumney <jasonr@gnu.org>
2 17
3 * w32uniscribe.c (uniscribe_encode_char): Return FONT_INVALID_CHAR 18 * w32uniscribe.c (uniscribe_encode_char): Return FONT_INVALID_CHAR
diff --git a/src/frame.c b/src/frame.c
index a21bacc80da..307e68bdb01 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1322,20 +1322,13 @@ delete_frame_handler (Lisp_Object arg)
1322 1322
1323extern Lisp_Object Qrun_hook_with_args; 1323extern Lisp_Object Qrun_hook_with_args;
1324 1324
1325DEFUN ("delete-frame", Fdelete_frame, Sdelete_frame, 0, 2, "", 1325/* Delete FRAME. When FORCE equals Qnoelisp, delete FRAME
1326 doc: /* Delete FRAME, permanently eliminating it from use. 1326 unconditionally. x_connection_closed and delete_terminal use
1327If omitted, FRAME defaults to the selected frame. 1327 this. Any other value of FORCE implements the semantics
1328A frame may not be deleted if its minibuffer is used by other frames. 1328 described for Fdelete_frame. */
1329Normally, you may not delete a frame if all other frames are invisible, 1329Lisp_Object
1330but if the second optional argument FORCE is non-nil, you may do so. 1330delete_frame (frame, force)
1331 1331 register Lisp_Object frame, force;
1332This function runs `delete-frame-functions' before actually deleting the
1333frame, unless the frame is a tooltip.
1334The functions are run with one arg, the frame to be deleted.
1335But FORCE inhibits this too. */)
1336/* FORCE is non-nil when handling a disconnected terminal. */
1337 (frame, force)
1338 Lisp_Object frame, force;
1339{ 1332{
1340 struct frame *f; 1333 struct frame *f;
1341 struct frame *sf = SELECTED_FRAME (); 1334 struct frame *sf = SELECTED_FRAME ();
@@ -1360,12 +1353,10 @@ But FORCE inhibits this too. */)
1360 if (NILP (force) && !other_visible_frames (f)) 1353 if (NILP (force) && !other_visible_frames (f))
1361 error ("Attempt to delete the sole visible or iconified frame"); 1354 error ("Attempt to delete the sole visible or iconified frame");
1362 1355
1363#if 0 1356 /* x_connection_closed must have set FORCE to `noelisp' in order
1364 /* This is a nice idea, but x_connection_closed needs to be able
1365 to delete the last frame, if it is gone. */ 1357 to delete the last frame, if it is gone. */
1366 if (NILP (XCDR (Vframe_list))) 1358 if (NILP (XCDR (Vframe_list)) && !EQ (force, Qnoelisp))
1367 error ("Attempt to delete the only frame"); 1359 error ("Attempt to delete the only frame");
1368#endif
1369 1360
1370 /* Does this frame have a minibuffer, and is it the surrogate 1361 /* Does this frame have a minibuffer, and is it the surrogate
1371 minibuffer for any other frame? */ 1362 minibuffer for any other frame? */
@@ -1385,19 +1376,20 @@ But FORCE inhibits this too. */)
1385 WINDOW_FRAME (XWINDOW 1376 WINDOW_FRAME (XWINDOW
1386 (FRAME_MINIBUF_WINDOW (XFRAME (this)))))) 1377 (FRAME_MINIBUF_WINDOW (XFRAME (this))))))
1387 { 1378 {
1388 /* If we MUST delete this frame, delete the other first. */ 1379 /* If we MUST delete this frame, delete the other first.
1389 if (!NILP (force)) 1380 But do this only if FORCE equals `noelisp'. */
1390 Fdelete_frame (this, force); 1381 if (EQ (force, Qnoelisp))
1382 delete_frame (this, Qnoelisp);
1391 else 1383 else
1392 error ("Attempt to delete a surrogate minibuffer frame"); 1384 error ("Attempt to delete a surrogate minibuffer frame");
1393 } 1385 }
1394 } 1386 }
1395 } 1387 }
1396 1388
1397 /* Run `delete-frame-functions' 1389 /* Run `delete-frame-functions' unless FORCE is `noelisp' or
1398 unless FORCE is `noelisp' or frame is a tooltip. 1390 frame is a tooltip. FORCE is set to `noelisp' when handling
1399 FORCE is set to `noelisp' when handling a disconnect from the terminal, 1391 a disconnect from the terminal, so we don't dare call Lisp
1400 so we don't dare call Lisp code. */ 1392 code. */
1401 if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip")))) 1393 if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip"))))
1402 ; 1394 ;
1403 if (EQ (force, Qnoelisp)) 1395 if (EQ (force, Qnoelisp))
@@ -1641,6 +1633,24 @@ But FORCE inhibits this too. */)
1641 1633
1642 return Qnil; 1634 return Qnil;
1643} 1635}
1636
1637DEFUN ("delete-frame", Fdelete_frame, Sdelete_frame, 0, 2, "",
1638 doc: /* Delete FRAME, permanently eliminating it from use.
1639FRAME defaults to the selected frame.
1640
1641A frame may not be deleted if its minibuffer is used by other frames.
1642Normally, you may not delete a frame if all other frames are invisible,
1643but if the second optional argument FORCE is non-nil, you may do so.
1644
1645This function runs `delete-frame-functions' before actually
1646deleting the frame, unless the frame is a tooltip.
1647The functions are run with one argument, the frame to be deleted. */)
1648 (frame, force)
1649 Lisp_Object frame, force;
1650{
1651 return delete_frame (frame, !NILP (force) ? Qt : Qnil);
1652}
1653
1644 1654
1645/* Return mouse position in character cell units. */ 1655/* Return mouse position in character cell units. */
1646 1656
diff --git a/src/frame.h b/src/frame.h
index 5cab1f42c5d..32f60f8f0e1 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1115,6 +1115,7 @@ extern Lisp_Object display_x_get_resource (Display_Info *,
1115 Lisp_Object component, 1115 Lisp_Object component,
1116 Lisp_Object subclass); 1116 Lisp_Object subclass);
1117 1117
1118extern Lisp_Object delete_frame P_ ((Lisp_Object, Lisp_Object));
1118 1119
1119#endif /* HAVE_WINDOW_SYSTEM */ 1120#endif /* HAVE_WINDOW_SYSTEM */
1120 1121
diff --git a/src/terminal.c b/src/terminal.c
index 6b6edf14316..0b1e9f32576 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -256,7 +256,7 @@ delete_terminal (struct terminal *terminal)
256 struct terminal **tp; 256 struct terminal **tp;
257 Lisp_Object tail, frame; 257 Lisp_Object tail, frame;
258 258
259 /* Protect against recursive calls. Fdelete_frame calls the 259 /* Protect against recursive calls. delete_frame calls the
260 delete_terminal_hook when we delete our last frame. */ 260 delete_terminal_hook when we delete our last frame. */
261 if (!terminal->name) 261 if (!terminal->name)
262 return; 262 return;
@@ -269,8 +269,8 @@ delete_terminal (struct terminal *terminal)
269 struct frame *f = XFRAME (frame); 269 struct frame *f = XFRAME (frame);
270 if (FRAME_LIVE_P (f) && f->terminal == terminal) 270 if (FRAME_LIVE_P (f) && f->terminal == terminal)
271 { 271 {
272 /* Maybe this should pass Qnoelisp rather than Qt? */ 272 /* Pass Qnoelisp rather than Qt. */
273 Fdelete_frame (frame, Qt); 273 delete_frame (frame, Qnoelisp);
274 } 274 }
275 } 275 }
276 276
@@ -283,7 +283,7 @@ delete_terminal (struct terminal *terminal)
283 terminal->keyboard_coding = NULL; 283 terminal->keyboard_coding = NULL;
284 xfree (terminal->terminal_coding); 284 xfree (terminal->terminal_coding);
285 terminal->terminal_coding = NULL; 285 terminal->terminal_coding = NULL;
286 286
287 if (terminal->kboard && --terminal->kboard->reference_count == 0) 287 if (terminal->kboard && --terminal->kboard->reference_count == 0)
288 { 288 {
289 delete_kboard (terminal->kboard); 289 delete_kboard (terminal->kboard);
@@ -315,7 +315,7 @@ but if the second argument FORCE is non-nil, you may do so. */)
315 struct terminal *p = terminal_list; 315 struct terminal *p = terminal_list;
316 while (p && (p == t || !TERMINAL_ACTIVE_P (p))) 316 while (p && (p == t || !TERMINAL_ACTIVE_P (p)))
317 p = p->next_terminal; 317 p = p->next_terminal;
318 318
319 if (!p) 319 if (!p)
320 error ("Attempt to delete the sole active display terminal"); 320 error ("Attempt to delete the sole active display terminal");
321 } 321 }
@@ -376,7 +376,7 @@ possible return values. */)
376 Lisp_Object object; 376 Lisp_Object object;
377{ 377{
378 struct terminal *t; 378 struct terminal *t;
379 379
380 t = get_terminal (object, 0); 380 t = get_terminal (object, 0);
381 381
382 if (!t) 382 if (!t)
diff --git a/src/w32fns.c b/src/w32fns.c
index 2c932017239..237299c4379 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -5944,7 +5944,7 @@ Value is t if tooltip was open, nil otherwise. */)
5944 5944
5945 if (FRAMEP (frame)) 5945 if (FRAMEP (frame))
5946 { 5946 {
5947 Fdelete_frame (frame, Qnil); 5947 delete_frame (frame, Qnil);
5948 deleted = Qt; 5948 deleted = Qt;
5949 } 5949 }
5950 5950
diff --git a/src/window.c b/src/window.c
index c74b163cb9f..81fb70a17fd 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2273,7 +2273,7 @@ window_loop (type, obj, mini, frames)
2273 windows = XCDR (windows); 2273 windows = XCDR (windows);
2274 2274
2275 /* Now we can safely delete the frame. */ 2275 /* Now we can safely delete the frame. */
2276 Fdelete_frame (w->frame, Qnil); 2276 delete_frame (w->frame, Qnil);
2277 } 2277 }
2278 else if (NILP (w->parent)) 2278 else if (NILP (w->parent))
2279 { 2279 {
@@ -2334,7 +2334,7 @@ window_loop (type, obj, mini, frames)
2334 windows = XCDR (windows); 2334 windows = XCDR (windows);
2335 2335
2336 /* Now we can safely delete the frame. */ 2336 /* Now we can safely delete the frame. */
2337 Fdelete_frame (w->frame, Qnil); 2337 delete_frame (w->frame, Qnil);
2338 } 2338 }
2339 else if (!NILP (w->dedicated) && !NILP (w->parent)) 2339 else if (!NILP (w->dedicated) && !NILP (w->parent))
2340 { 2340 {
@@ -6909,7 +6909,7 @@ foreach_window (f, fn, user_data)
6909 int (* fn) P_ ((struct window *, void *)); 6909 int (* fn) P_ ((struct window *, void *));
6910 void *user_data; 6910 void *user_data;
6911{ 6911{
6912 /* Fdelete_frame may set FRAME_ROOT_WINDOW (f) to Qnil. */ 6912 /* delete_frame may set FRAME_ROOT_WINDOW (f) to Qnil. */
6913 if (WINDOWP (FRAME_ROOT_WINDOW (f))) 6913 if (WINDOWP (FRAME_ROOT_WINDOW (f)))
6914 foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, user_data); 6914 foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, user_data);
6915} 6915}
diff --git a/src/xfns.c b/src/xfns.c
index 5b4d40100c2..d9e2cef30af 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5248,7 +5248,7 @@ Value is t if tooltip was open, nil otherwise. */)
5248 5248
5249 if (FRAMEP (frame)) 5249 if (FRAMEP (frame))
5250 { 5250 {
5251 Fdelete_frame (frame, Qnil); 5251 delete_frame (frame, Qnil);
5252 deleted = Qt; 5252 deleted = Qt;
5253 5253
5254#ifdef USE_LUCID 5254#ifdef USE_LUCID
diff --git a/src/xterm.c b/src/xterm.c
index 505100c6488..37c187486d8 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4017,7 +4017,7 @@ x_window_to_scroll_bar (display, window_id)
4017 4017
4018 if (! FRAME_X_P (XFRAME (frame))) 4018 if (! FRAME_X_P (XFRAME (frame)))
4019 continue; 4019 continue;
4020 4020
4021 /* Scan this frame's scroll bar list for a scroll bar with the 4021 /* Scan this frame's scroll bar list for a scroll bar with the
4022 right window ID. */ 4022 right window ID. */
4023 condemned = FRAME_CONDEMNED_SCROLL_BARS (XFRAME (frame)); 4023 condemned = FRAME_CONDEMNED_SCROLL_BARS (XFRAME (frame));
@@ -6467,7 +6467,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6467 inev.ie.code = XFASTINT (c); 6467 inev.ie.code = XFASTINT (c);
6468 goto done_keysym; 6468 goto done_keysym;
6469 } 6469 }
6470 6470
6471 /* Random non-modifier sorts of keysyms. */ 6471 /* Random non-modifier sorts of keysyms. */
6472 if (((keysym >= XK_BackSpace && keysym <= XK_Escape) 6472 if (((keysym >= XK_BackSpace && keysym <= XK_Escape)
6473 || keysym == XK_Delete 6473 || keysym == XK_Delete
@@ -7172,7 +7172,7 @@ XTread_socket (terminal, expected, hold_quit)
7172 XTread_socket_fake_io_error = 0; 7172 XTread_socket_fake_io_error = 0;
7173 x_io_error_quitter (terminal->display_info.x->display); 7173 x_io_error_quitter (terminal->display_info.x->display);
7174 } 7174 }
7175 7175
7176#if 0 /* This loop is a noop now. */ 7176#if 0 /* This loop is a noop now. */
7177 /* Find the display we are supposed to read input for. 7177 /* Find the display we are supposed to read input for.
7178 It's the one communicating on descriptor SD. */ 7178 It's the one communicating on descriptor SD. */
@@ -7871,7 +7871,7 @@ x_connection_closed (dpy, error_message)
7871 dpyinfo->reference_count++; 7871 dpyinfo->reference_count++;
7872 dpyinfo->terminal->reference_count++; 7872 dpyinfo->terminal->reference_count++;
7873 } 7873 }
7874 7874
7875 /* First delete frames whose mini-buffers are on frames 7875 /* First delete frames whose mini-buffers are on frames
7876 that are on the dead display. */ 7876 that are on the dead display. */
7877 FOR_EACH_FRAME (tail, frame) 7877 FOR_EACH_FRAME (tail, frame)
@@ -7883,7 +7883,7 @@ x_connection_closed (dpy, error_message)
7883 && FRAME_X_P (XFRAME (minibuf_frame)) 7883 && FRAME_X_P (XFRAME (minibuf_frame))
7884 && ! EQ (frame, minibuf_frame) 7884 && ! EQ (frame, minibuf_frame)
7885 && FRAME_X_DISPLAY_INFO (XFRAME (minibuf_frame)) == dpyinfo) 7885 && FRAME_X_DISPLAY_INFO (XFRAME (minibuf_frame)) == dpyinfo)
7886 Fdelete_frame (frame, Qnoelisp); 7886 delete_frame (frame, Qnoelisp);
7887 } 7887 }
7888 7888
7889 /* Now delete all remaining frames on the dead display. 7889 /* Now delete all remaining frames on the dead display.
@@ -7893,10 +7893,10 @@ x_connection_closed (dpy, error_message)
7893 if (FRAME_X_P (XFRAME (frame)) 7893 if (FRAME_X_P (XFRAME (frame))
7894 && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo) 7894 && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo)
7895 { 7895 {
7896 /* Set this to t so that Fdelete_frame won't get confused 7896 /* Set this to t so that delete_frame won't get confused
7897 trying to find a replacement. */ 7897 trying to find a replacement. */
7898 FRAME_KBOARD (XFRAME (frame))->Vdefault_minibuffer_frame = Qt; 7898 FRAME_KBOARD (XFRAME (frame))->Vdefault_minibuffer_frame = Qt;
7899 Fdelete_frame (frame, Qnoelisp); 7899 delete_frame (frame, Qnoelisp);
7900 } 7900 }
7901 7901
7902 /* We have to close the display to inform Xt that it doesn't 7902 /* We have to close the display to inform Xt that it doesn't
@@ -10170,7 +10170,7 @@ x_term_init (display_name, xrm_option, resource_name)
10170 terminal->name = (char *) xmalloc (SBYTES (display_name) + 1); 10170 terminal->name = (char *) xmalloc (SBYTES (display_name) + 1);
10171 strncpy (terminal->name, SDATA (display_name), SBYTES (display_name)); 10171 strncpy (terminal->name, SDATA (display_name), SBYTES (display_name));
10172 terminal->name[SBYTES (display_name)] = 0; 10172 terminal->name[SBYTES (display_name)] = 0;
10173 10173
10174#if 0 10174#if 0
10175 XSetAfterFunction (x_current_display, x_trace_wire); 10175 XSetAfterFunction (x_current_display, x_trace_wire);
10176#endif /* ! 0 */ 10176#endif /* ! 0 */
@@ -10622,7 +10622,7 @@ x_delete_terminal (struct terminal *terminal)
10622 struct x_display_info *dpyinfo = terminal->display_info.x; 10622 struct x_display_info *dpyinfo = terminal->display_info.x;
10623 int i; 10623 int i;
10624 10624
10625 /* Protect against recursive calls. Fdelete_frame in 10625 /* Protect against recursive calls. delete_frame in
10626 delete_terminal calls us back when it deletes our last frame. */ 10626 delete_terminal calls us back when it deletes our last frame. */
10627 if (!terminal->name) 10627 if (!terminal->name)
10628 return; 10628 return;
@@ -10664,7 +10664,7 @@ static struct terminal *
10664x_create_terminal (struct x_display_info *dpyinfo) 10664x_create_terminal (struct x_display_info *dpyinfo)
10665{ 10665{
10666 struct terminal *terminal; 10666 struct terminal *terminal;
10667 10667
10668 terminal = create_terminal (); 10668 terminal = create_terminal ();
10669 10669
10670 terminal->type = output_x_window; 10670 terminal->type = output_x_window;
@@ -10672,7 +10672,7 @@ x_create_terminal (struct x_display_info *dpyinfo)
10672 dpyinfo->terminal = terminal; 10672 dpyinfo->terminal = terminal;
10673 10673
10674 /* kboard is initialized in x_term_init. */ 10674 /* kboard is initialized in x_term_init. */
10675 10675
10676 terminal->clear_frame_hook = x_clear_frame; 10676 terminal->clear_frame_hook = x_clear_frame;
10677 terminal->ins_del_lines_hook = x_ins_del_lines; 10677 terminal->ins_del_lines_hook = x_ins_del_lines;
10678 terminal->delete_glyphs_hook = x_delete_glyphs; 10678 terminal->delete_glyphs_hook = x_delete_glyphs;
@@ -10695,7 +10695,7 @@ x_create_terminal (struct x_display_info *dpyinfo)
10695 10695
10696 terminal->delete_frame_hook = x_destroy_window; 10696 terminal->delete_frame_hook = x_destroy_window;
10697 terminal->delete_terminal_hook = x_delete_terminal; 10697 terminal->delete_terminal_hook = x_delete_terminal;
10698 10698
10699 terminal->rif = &x_redisplay_interface; 10699 terminal->rif = &x_redisplay_interface;
10700 terminal->scroll_region_ok = 1; /* We'll scroll partial frames. */ 10700 terminal->scroll_region_ok = 1; /* We'll scroll partial frames. */
10701 terminal->char_ins_del_ok = 1; 10701 terminal->char_ins_del_ok = 1;