comparison src/xterm.c @ 34526:0da25e792d3e

(x_free_frame_resources): New function. (x_destroy_window): Use it.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 13 Dec 2000 20:27:52 +0000
parents 1f69c833e2af
children 0a811c1d7a1d
comparison
equal deleted inserted replaced
34525:6a10bf66e0c5 34526:0da25e792d3e
12404 12404
12405 XFlush (FRAME_X_DISPLAY (f)); 12405 XFlush (FRAME_X_DISPLAY (f));
12406 UNBLOCK_INPUT; 12406 UNBLOCK_INPUT;
12407 #endif /* not USE_X_TOOLKIT */ 12407 #endif /* not USE_X_TOOLKIT */
12408 } 12408 }
12409
12409 12410
12410 /* Destroy the X window of frame F. */ 12411 /* Free X resources of frame F. */
12411 12412
12412 void 12413 void
12413 x_destroy_window (f) 12414 x_free_frame_resources (f)
12414 struct frame *f; 12415 struct frame *f;
12415 { 12416 {
12416 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 12417 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
12417 12418
12418 BLOCK_INPUT; 12419 BLOCK_INPUT;
12419 12420
12420 /* If a display connection is dead, don't try sending more 12421 /* If a display connection is dead, don't try sending more
12421 commands to the X server. */ 12422 commands to the X server. */
12422 if (dpyinfo->display != 0) 12423 if (dpyinfo->display)
12423 { 12424 {
12424 if (f->output_data.x->icon_desc != 0) 12425 if (f->output_data.x->icon_desc)
12425 XDestroyWindow (FRAME_X_DISPLAY (f), f->output_data.x->icon_desc); 12426 XDestroyWindow (FRAME_X_DISPLAY (f), f->output_data.x->icon_desc);
12427
12426 #ifdef HAVE_X_I18N 12428 #ifdef HAVE_X_I18N
12427 if (FRAME_XIC (f)) 12429 if (FRAME_XIC (f))
12428 free_frame_xic (f); 12430 free_frame_xic (f);
12429 #endif 12431 #endif
12432
12430 if (FRAME_X_WINDOW (f)) 12433 if (FRAME_X_WINDOW (f))
12431 { 12434 XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
12432 XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); 12435
12433 FRAME_X_WINDOW (f) = 0;
12434 }
12435 #ifdef USE_X_TOOLKIT 12436 #ifdef USE_X_TOOLKIT
12436 if (f->output_data.x->widget) 12437 if (f->output_data.x->widget)
12437 XtDestroyWidget (f->output_data.x->widget); 12438 XtDestroyWidget (f->output_data.x->widget);
12438 free_frame_menubar (f); 12439 free_frame_menubar (f);
12439 #endif /* USE_X_TOOLKIT */ 12440 #endif /* USE_X_TOOLKIT */
12442 unload_color (f, f->output_data.x->background_pixel); 12443 unload_color (f, f->output_data.x->background_pixel);
12443 unload_color (f, f->output_data.x->cursor_pixel); 12444 unload_color (f, f->output_data.x->cursor_pixel);
12444 unload_color (f, f->output_data.x->cursor_foreground_pixel); 12445 unload_color (f, f->output_data.x->cursor_foreground_pixel);
12445 unload_color (f, f->output_data.x->border_pixel); 12446 unload_color (f, f->output_data.x->border_pixel);
12446 unload_color (f, f->output_data.x->mouse_pixel); 12447 unload_color (f, f->output_data.x->mouse_pixel);
12448
12447 if (f->output_data.x->scroll_bar_background_pixel != -1) 12449 if (f->output_data.x->scroll_bar_background_pixel != -1)
12448 unload_color (f, f->output_data.x->scroll_bar_background_pixel); 12450 unload_color (f, f->output_data.x->scroll_bar_background_pixel);
12449 if (f->output_data.x->scroll_bar_foreground_pixel != -1) 12451 if (f->output_data.x->scroll_bar_foreground_pixel != -1)
12450 unload_color (f, f->output_data.x->scroll_bar_foreground_pixel); 12452 unload_color (f, f->output_data.x->scroll_bar_foreground_pixel);
12451 if (f->output_data.x->white_relief.allocated_p) 12453 if (f->output_data.x->white_relief.allocated_p)
12452 unload_color (f, f->output_data.x->white_relief.pixel); 12454 unload_color (f, f->output_data.x->white_relief.pixel);
12453 if (f->output_data.x->black_relief.allocated_p) 12455 if (f->output_data.x->black_relief.allocated_p)
12454 unload_color (f, f->output_data.x->black_relief.pixel); 12456 unload_color (f, f->output_data.x->black_relief.pixel);
12455 12457
12456 free_frame_faces (f); 12458 if (FRAME_FACE_CACHE (f))
12459 free_frame_faces (f);
12460
12457 x_free_gcs (f); 12461 x_free_gcs (f);
12458 XFlush (FRAME_X_DISPLAY (f)); 12462 XFlush (FRAME_X_DISPLAY (f));
12459 } 12463 }
12460 12464
12461 if (f->output_data.x->saved_menu_event) 12465 if (f->output_data.x->saved_menu_event)
12462 xfree (f->output_data.x->saved_menu_event); 12466 xfree (f->output_data.x->saved_menu_event);
12463 12467
12464 xfree (f->output_data.x); 12468 xfree (f->output_data.x);
12465 f->output_data.x = 0; 12469 f->output_data.x = NULL;
12470
12466 if (f == dpyinfo->x_focus_frame) 12471 if (f == dpyinfo->x_focus_frame)
12467 dpyinfo->x_focus_frame = 0; 12472 dpyinfo->x_focus_frame = 0;
12468 if (f == dpyinfo->x_focus_event_frame) 12473 if (f == dpyinfo->x_focus_event_frame)
12469 dpyinfo->x_focus_event_frame = 0; 12474 dpyinfo->x_focus_event_frame = 0;
12470 if (f == dpyinfo->x_highlight_frame) 12475 if (f == dpyinfo->x_highlight_frame)
12471 dpyinfo->x_highlight_frame = 0; 12476 dpyinfo->x_highlight_frame = 0;
12472
12473 dpyinfo->reference_count--;
12474 12477
12475 if (f == dpyinfo->mouse_face_mouse_frame) 12478 if (f == dpyinfo->mouse_face_mouse_frame)
12476 { 12479 {
12477 dpyinfo->mouse_face_beg_row 12480 dpyinfo->mouse_face_beg_row
12478 = dpyinfo->mouse_face_beg_col = -1; 12481 = dpyinfo->mouse_face_beg_col = -1;
12483 dpyinfo->mouse_face_mouse_frame = 0; 12486 dpyinfo->mouse_face_mouse_frame = 0;
12484 } 12487 }
12485 12488
12486 UNBLOCK_INPUT; 12489 UNBLOCK_INPUT;
12487 } 12490 }
12491
12492
12493 /* Destroy the X window of frame F. */
12494
12495 void
12496 x_destroy_window (f)
12497 struct frame *f;
12498 {
12499 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
12500
12501 /* If a display connection is dead, don't try sending more
12502 commands to the X server. */
12503 if (dpyinfo->display != 0)
12504 x_free_frame_resources (f);
12505
12506 dpyinfo->reference_count--;
12507 }
12508
12488 12509
12489 /* Setting window manager hints. */ 12510 /* Setting window manager hints. */
12490 12511
12491 /* Set the normal size hints for the window manager, for frame F. 12512 /* Set the normal size hints for the window manager, for frame F.
12492 FLAGS is the flags word to use--or 0 meaning preserve the flags 12513 FLAGS is the flags word to use--or 0 meaning preserve the flags