summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2000-12-07 11:45:33 +0000
committerGerd Moellmann <gerd@gnu.org>2000-12-07 11:45:33 +0000
commit959e647dcff6744bab020f8005b59981ed56c18c (patch)
tree04d806a6ff1335c468ade78f32c13364283d3ca6
parentbd637d692d1ccfc43fb52727c59f1f49c19435c8 (diff)
downloademacs-959e647dcff6744bab020f8005b59981ed56c18c.tar.gz
(x_free_gcs): New function.
-rw-r--r--src/ChangeLog12
-rw-r--r--src/xfns.c59
2 files changed, 61 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bd087232997..340222b56fb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
+2000-12-07 Gerd Moellmann <gerd@gnu.org>
+
+ * xfns.c (x_free_gcs): New function.
+
+ * xterm.h (x_free_gcs): Add prototype.
+
+ * widget.c (EmacsFrameDestroy): Call x_free_gcs instead of
+ freeing GCs here.
+
+ * xterm.c (x_destroy_window): Call x_free_gcs so that
+ resources of non-toolkit X windows will be freed.
+
2000-12-07 Andrew Innes <andrewi@gnu.org>
* w32fns.c (xlfd_charset_of_font): Fix last change.
diff --git a/src/xfns.c b/src/xfns.c
index 65e917cf4c5..5cb5f2901f2 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3936,20 +3936,20 @@ x_make_gc (f)
gc_values.foreground = f->output_data.x->foreground_pixel;
gc_values.background = f->output_data.x->background_pixel;
gc_values.line_width = 0; /* Means 1 using fast algorithm. */
- f->output_data.x->normal_gc = XCreateGC (FRAME_X_DISPLAY (f),
- FRAME_X_WINDOW (f),
- GCLineWidth | GCFont
- | GCForeground | GCBackground,
- &gc_values);
+ f->output_data.x->normal_gc
+ = XCreateGC (FRAME_X_DISPLAY (f),
+ FRAME_X_WINDOW (f),
+ GCLineWidth | GCFont | GCForeground | GCBackground,
+ &gc_values);
/* Reverse video style. */
gc_values.foreground = f->output_data.x->background_pixel;
gc_values.background = f->output_data.x->foreground_pixel;
- f->output_data.x->reverse_gc = XCreateGC (FRAME_X_DISPLAY (f),
- FRAME_X_WINDOW (f),
- GCFont | GCForeground | GCBackground
- | GCLineWidth,
- &gc_values);
+ f->output_data.x->reverse_gc
+ = XCreateGC (FRAME_X_DISPLAY (f),
+ FRAME_X_WINDOW (f),
+ GCFont | GCForeground | GCBackground | GCLineWidth,
+ &gc_values);
/* Cursor has cursor-color background, background-color foreground. */
gc_values.foreground = f->output_data.x->background_pixel;
@@ -3984,6 +3984,45 @@ x_make_gc (f)
UNBLOCK_INPUT;
}
+
+/* Free what was was allocated in x_make_gc. */
+
+void
+x_free_gcs (f)
+ struct frame *f;
+{
+ Display *dpy = FRAME_X_DISPLAY (f);
+
+ BLOCK_INPUT;
+
+ if (f->output_data.x->normal_gc)
+ {
+ XFreeGC (dpy, f->output_data.x->normal_gc);
+ f->output_data.x->normal_gc = 0;
+ }
+
+ if (f->output_data.x->reverse_gc)
+ {
+ XFreeGC (dpy, f->output_data.x->reverse_gc);
+ f->output_data.x->reverse_gc = 0;
+ }
+
+ if (f->output_data.x->cursor_gc)
+ {
+ XFreeGC (dpy, f->output_data.x->cursor_gc);
+ f->output_data.x->cursor_gc = 0;
+ }
+
+ if (f->output_data.x->border_tile)
+ {
+ XFreePixmap (dpy, f->output_data.x->border_tile);
+ f->output_data.x->border_tile = 0;
+ }
+
+ UNBLOCK_INPUT;
+}
+
+
DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
1, 1, 0,
"Make a new X window, which is called a \"frame\" in Emacs terms.\n\