comparison src/xfaces.c @ 2875:cd410e9ac4ab

* xfaces.c (free_frame_faces): Don't free the resources from the first two faces.
author Jim Blandy <jimb@redhat.com>
date Tue, 18 May 1993 22:46:17 +0000
parents 5f6a2d52d2ef
children b8a3b11892dc
comparison
equal deleted inserted replaced
2874:80805283464a 2875:cd410e9ac4ab
433 XGetGCValues (x_current_display, f->display.x->normal_gc, 433 XGetGCValues (x_current_display, f->display.x->normal_gc,
434 GCForeground | GCBackground | GCFont, &gcv); 434 GCForeground | GCBackground | GCFont, &gcv);
435 face->gc = f->display.x->normal_gc; 435 face->gc = f->display.x->normal_gc;
436 face->foreground = gcv.foreground; 436 face->foreground = gcv.foreground;
437 face->background = gcv.background; 437 face->background = gcv.background;
438 face->font = XQueryFont (x_current_display, gcv.font); 438 face->font = f->display.x->font;
439 face->stipple = 0; 439 face->stipple = 0;
440 face->underline = 0; 440 face->underline = 0;
441 } 441 }
442 442
443 ensure_face_ready (f, 1); 443 ensure_face_ready (f, 1);
448 XGetGCValues (x_current_display, f->display.x->reverse_gc, 448 XGetGCValues (x_current_display, f->display.x->reverse_gc,
449 GCForeground | GCBackground | GCFont, &gcv); 449 GCForeground | GCBackground | GCFont, &gcv);
450 face->gc = f->display.x->reverse_gc; 450 face->gc = f->display.x->reverse_gc;
451 face->foreground = gcv.foreground; 451 face->foreground = gcv.foreground;
452 face->background = gcv.background; 452 face->background = gcv.background;
453 face->font = XQueryFont (x_current_display, gcv.font); 453 face->font = f->display.x->font;
454 face->stipple = 0; 454 face->stipple = 0;
455 face->underline = 0; 455 face->underline = 0;
456 } 456 }
457 } 457 }
458 458
459 #if 0
460 void
461 init_frame_faces (f)
462 struct frame *f;
463 {
464 struct frame *other_frame = 0;
465 Lisp_Object rest;
466
467 for (rest = Vframe_list; !NILP (rest); rest = Fcdr (rest))
468 {
469 struct frame *f2 = XFRAME (Fcar (rest));
470 if (f2 != f && FRAME_X_P (f2))
471 {
472 other_frame = f2;
473 break;
474 }
475 }
476
477 if (other_frame)
478 {
479 /* Make sure this frame's face vector is as big as the others. */
480 FRAME_N_FACES (f) = FRAME_N_FACES (other_frame);
481 FRAME_FACES (f)
482 = (struct face **) xmalloc (FRAME_N_FACES (f) * sizeof (struct face *));
483
484 /* Make sure the frame has the two basic faces. */
485 FRAME_DEFAULT_FACE (f)
486 = copy_face (FRAME_DEFAULT_FACE (other_frame));
487 FRAME_MODE_LINE_FACE (f)
488 = copy_face (FRAME_MODE_LINE_FACE (other_frame));
489 }
490 }
491 #endif
492
493
494 /* Called from Fdelete_frame. */ 459 /* Called from Fdelete_frame. */
495 void 460 void
496 free_frame_faces (f) 461 free_frame_faces (f)
497 struct frame *f; 462 struct frame *f;
498 { 463 {
499 Display *dpy = x_current_display; 464 Display *dpy = x_current_display;
500 int i; 465 int i;
501 466
502 for (i = 0; i < FRAME_N_FACES (f); i++) 467 /* The first two faces on the frame are just made of resources which
468 we borrowed from the frame's GC's, so don't free them. Let
469 them get freed by the x_destroy_window code. */
470 for (i = 2; i < FRAME_N_FACES (f); i++)
503 { 471 {
504 struct face *face = FRAME_FACES (f) [i]; 472 struct face *face = FRAME_FACES (f) [i];
505 if (! face) 473 if (! face)
506 continue; 474 continue;
507 if (face->gc) 475 if (face->gc)