From: Karoly.Lorentey@cern.ch (Lőrentey Károly)
Cc: "Jan D." <jan.h.d@swipnet.se>, Richard Stallman <rms@gnu.org>,
Kenichi Handa <handa@m17n.org>
Subject: Re: x-create-frame is sluggish
Date: Mon, 25 Oct 2004 15:07:18 +0200 [thread overview]
Message-ID: <lorentey.g.e.devel.87ekjnt08p.elte@eris.elte.hu> (raw)
In-Reply-To: <lorentey.m.other.87fz4ljogj.elte@eris.elte.hu> (Károly Lőrentey's message of "Mon, 11 Oct 2004 16:53:32 +0200")
[-- Attachment #1.1: Type: text/plain, Size: 6507 bytes --]
Does the new patch look all right to you? If there are no objections,
I will proceed with installing it. I've been using it for a few weeks
without problems.
Lőrentey Károly <Karoly.Lorentey@cern.ch> writes:
> 2004-10-11 Károly Lőrentey <lorentey@elte.hu>
>
> * src/xterm.h (x_output): New member `xic_base_fontname'.
> (FRAME_XIC_BASE_FONTNAME): New macro.
> (xic_delete_xfontset): Declare.
>
> * src/xfns.c (xic_create_xfontset): Share fontsets between frames
> based on base_fontname.
> (create_frame_xic): Set the frame's xic_base_fontname.
> (xic_delete_xfontset): New function.
> (free_frame_xic): Use it. Free xic_base_fontname.
> (xic_set_xfontset): Ditto.
>
> * src/xterm.c (xim_destroy_callback): Ditto.
>
> *** orig/src/xfns.c
> --- mod/src/xfns.c
> ***************
> *** 1953,1959 ****
> --- 1953,1971 ----
> char **missing_list;
> int missing_count;
> char *def_string;
> + Lisp_Object rest, frame;
>
> + /* See if there is another frame already using same fontset. */
> + FOR_EACH_FRAME (rest, frame)
> + {
> + struct frame *cf = XFRAME (frame);
> + if (cf != f && FRAME_LIVE_P (f) && FRAME_X_P (cf)
> + && FRAME_X_DISPLAY_INFO (cf) == FRAME_X_DISPLAY_INFO (f)
> + && !strcmp (FRAME_XIC_BASE_FONTNAME (cf), base_fontname))
> + return FRAME_XIC_FONTSET (cf);
> + }
> +
> + /* New fontset. */
> xfs = XCreateFontSet (FRAME_X_DISPLAY (f),
> base_fontname, &missing_list,
> &missing_count, &def_string);
> ***************
> *** 1964,1969 ****
> --- 1976,2005 ----
> return xfs;
> }
>
> + /* Free the X fontset of frame F if it is the last frame using it. */
> +
> + void
> + xic_delete_xfontset (f)
> + struct frame *f;
> + {
> + Lisp_Object rest, frame;
> +
> + if (!FRAME_XIC_FONTSET (f))
> + return;
> +
> + /* See if there is another frame sharing the same fontset. */
> + FOR_EACH_FRAME (rest, frame)
> + {
> + struct frame *cf = XFRAME (frame);
> + if (cf != f && FRAME_LIVE_P (f) && FRAME_X_P (cf)
> + && FRAME_X_DISPLAY_INFO (cf) == FRAME_X_DISPLAY_INFO (f)
> + && FRAME_XIC_FONTSET (cf) == FRAME_XIC_FONTSET (f))
> + return;
> + }
> + /* The fontset is not used anymore. It is safe to free it. */
> + XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f));
> + }
> +
>
> /* Value is the best input style, given user preferences USER (already
> checked to be supported by Emacs), and styles supported by the
> ***************
> *** 1996,2001 ****
> --- 2032,2038 ----
> XIM xim;
> XIC xic = NULL;
> XFontSet xfs = NULL;
> + char *base_fontname = NULL;
>
> if (FRAME_XIC (f))
> return;
> ***************
> *** 2007,2013 ****
> XPoint spot;
> XVaNestedList preedit_attr;
> XVaNestedList status_attr;
> - char *base_fontname;
> int fontset;
>
> s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1;
> --- 2044,2049 ----
> ***************
> *** 2101,2106 ****
> --- 2137,2143 ----
> FRAME_XIC (f) = xic;
> FRAME_XIC_STYLE (f) = xic_style;
> FRAME_XIC_FONTSET (f) = xfs;
> + FRAME_XIC_BASE_FONTNAME (f) = xstrdup (base_fontname);
> }
>
>
> ***************
> *** 2114,2124 ****
> return;
>
> XDestroyIC (FRAME_XIC (f));
> ! if (FRAME_XIC_FONTSET (f))
> ! XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f));
>
> FRAME_XIC (f) = NULL;
> FRAME_XIC_FONTSET (f) = NULL;
> }
>
>
> --- 2151,2163 ----
> return;
>
> XDestroyIC (FRAME_XIC (f));
> ! xic_delete_xfontset (f);
> ! if (FRAME_XIC_BASE_FONTNAME (f))
> ! xfree (FRAME_XIC_BASE_FONTNAME (f));
>
> FRAME_XIC (f) = NULL;
> FRAME_XIC_FONTSET (f) = NULL;
> + FRAME_XIC_BASE_FONTNAME (f) = NULL;
> }
>
>
> ***************
> *** 2207,2214 ****
> XFree (attr);
>
> if (FRAME_XIC_FONTSET (f))
> ! XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f));
> FRAME_XIC_FONTSET (f) = xfs;
> }
>
> #endif /* HAVE_X_I18N */
> --- 2246,2258 ----
> XFree (attr);
>
> if (FRAME_XIC_FONTSET (f))
> ! xic_delete_xfontset (f);
> !
> ! if (FRAME_XIC_BASE_FONTNAME (f))
> ! xfree (FRAME_XIC_BASE_FONTNAME (f));
> !
> FRAME_XIC_FONTSET (f) = xfs;
> + FRAME_XIC_BASE_FONTNAME (f) = xstrdup (base_fontname);
> }
>
> #endif /* HAVE_X_I18N */
> *** orig/src/xterm.c
> --- mod/src/xterm.c
> ***************
> *** 8024,8031 ****
> FRAME_XIC (f) = NULL;
> if (FRAME_XIC_FONTSET (f))
> {
> ! XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f));
> FRAME_XIC_FONTSET (f) = NULL;
> }
> }
> }
> --- 8024,8033 ----
> FRAME_XIC (f) = NULL;
> if (FRAME_XIC_FONTSET (f))
> {
> ! xic_delete_xfontset (f);
> ! xfree (FRAME_XIC_BASE_FONTNAME (f));
> FRAME_XIC_FONTSET (f) = NULL;
> + FRAME_XIC_BASE_FONTNAME (f) = NULL;
> }
> }
> }
> *** orig/src/xterm.h
> --- mod/src/xterm.h
> ***************
> *** 593,598 ****
> --- 593,599 ----
> XIC xic;
> XIMStyle xic_style;
> XFontSet xic_xfs;
> + char *xic_base_fontname;
> #endif
>
> /* Relief GCs, colors etc. */
> ***************
> *** 727,732 ****
> --- 728,734 ----
> #define FRAME_X_XIM_STYLES(f) (FRAME_X_DISPLAY_INFO (f)->xim_styles)
> #define FRAME_XIC_STYLE(f) ((f)->output_data.x->xic_style)
> #define FRAME_XIC_FONTSET(f) ((f)->output_data.x->xic_xfs)
> + #define FRAME_XIC_BASE_FONTNAME(f) ((f)->output_data.x->xic_base_fontname)
>
> /* Value is the smallest width of any character in any font on frame F. */
>
> ***************
> *** 1036,1041 ****
> --- 1038,1044 ----
> extern unsigned char * x_encode_text P_ ((Lisp_Object, Lisp_Object, int,
> int *, int *));
> extern void x_implicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
> + extern void xic_delete_xfontset P_ ((struct frame *));
> extern void create_frame_xic P_ ((struct frame *));
> extern void destroy_frame_xic P_ ((struct frame *));
> extern void xic_set_preeditarea P_ ((struct window *, int, int));
--
Károly
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2004-10-25 13:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-23 14:15 x-create-frame is sluggish Lőrentey Károly
2004-09-24 12:08 ` Richard Stallman
2004-09-25 2:39 ` Kenichi Handa
2004-09-25 15:36 ` Richard Stallman
2004-10-01 1:26 ` Kenichi Handa
2004-10-01 8:51 ` Károly Lőrentey
2004-10-10 22:45 ` Lőrentey Károly
2004-10-11 7:54 ` Jan D.
2004-10-11 14:53 ` Károly Lőrentey
2004-10-11 19:51 ` Jan D.
2004-10-11 20:03 ` Jan D.
2004-10-25 13:07 ` Lőrentey Károly [this message]
2004-10-25 13:16 ` Jan D.
2004-10-03 14:32 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=lorentey.g.e.devel.87ekjnt08p.elte@eris.elte.hu \
--to=karoly.lorentey@cern.ch \
--cc=handa@m17n.org \
--cc=jan.h.d@swipnet.se \
--cc=rms@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).