emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117244: * xlwmenu.c (openXftFont): Do not load regu


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r117244: * xlwmenu.c (openXftFont): Do not load regular X font here.
Date: Tue, 03 Jun 2014 04:18:42 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117244
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2014-06-03 08:17:53 +0400
message:
  * xlwmenu.c (openXftFont): Do not load regular X font here.
  (XlwMenuInitialize): Remove ancient #if 0 code.
  (XlwMenuDestroy): Likewise.  Free regular X font here.
modified:
  lwlib/ChangeLog                changelog-20091113204419-o5vbwnq5f7feedwu-1447
  lwlib/xlwmenu.c                xlwmenu.c-20091113204419-o5vbwnq5f7feedwu-674
=== modified file 'lwlib/ChangeLog'
--- a/lwlib/ChangeLog   2014-06-02 18:01:21 +0000
+++ b/lwlib/ChangeLog   2014-06-03 04:17:53 +0000
@@ -1,3 +1,9 @@
+2014-06-03  Dmitry Antipov  <address@hidden>
+
+       * xlwmenu.c (openXftFont): Do not load regular X font here.
+       (XlwMenuInitialize): Remove ancient #if 0 code.
+       (XlwMenuDestroy): Likewise.  Free regular X font here.
+
 2014-06-02  Dmitry Antipov  <address@hidden>
 
        Use common memory management functions for widgets.

=== modified file 'lwlib/xlwmenu.c'
--- a/lwlib/xlwmenu.c   2014-01-01 07:43:34 +0000
+++ b/lwlib/xlwmenu.c   2014-06-03 04:17:53 +0000
@@ -1863,16 +1863,9 @@
           fname[i] = '-';
         }
 
-      mw->menu.font = XLoadQueryFont (XtDisplay (mw), fname);
-      if (!mw->menu.font)
-        {
-          mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname);
-          if (!mw->menu.xft_font)
-            {
-              fprintf (stderr, "Can't find font '%s'\n", fname);
-              mw->menu.xft_font = getDefaultXftFont (mw);
-            }
-        }
+      mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname);
+      if (!mw->menu.xft_font)
+       mw->menu.xft_font = getDefaultXftFont (mw);
     }
 
   if (fname != mw->menu.fontName) xfree (fname);
@@ -1889,15 +1882,6 @@
   Window window = RootWindowOfScreen (DefaultScreenOfDisplay (XtDisplay (mw)));
   Display* display = XtDisplay (mw);
 
-#if 0
-  widget_value *tem = (widget_value *) XtMalloc (sizeof (widget_value));
-
-  /* _XtCreate is freeing the object that was passed to us,
-     so make a copy that we will actually keep.  */
-  memcpy (tem, mw->menu.contents, sizeof (widget_value));
-  mw->menu.contents = tem;
-#endif
-
   /*  mw->menu.cursor = XCreateFontCursor (display, mw->menu.cursor_shape); */
   mw->menu.cursor = mw->menu.cursor_shape;
 
@@ -2074,19 +2058,15 @@
   XFreePixmap (XtDisplay (mw), mw->menu.gray_pixmap);
   mw->menu.gray_pixmap = (Pixmap) -1;
 
-#if 0
-  /* Do free mw->menu.contents because nowadays we copy it
-     during initialization.  */
-  XtFree (mw->menu.contents);
-#endif
-
   /* Don't free mw->menu.contents because that comes from our creator.
      The `*_stack' elements are just pointers into `contents' so leave
      that alone too.  But free the stacks themselves. */
   if (mw->menu.old_stack) XtFree ((char *) mw->menu.old_stack);
   if (mw->menu.new_stack) XtFree ((char *) mw->menu.new_stack);
 
-  /* Remember, you can't free anything that came from the resource
+  /* Original comment was:
+
+     Remember, you can't free anything that came from the resource
      database.  This includes:
          mw->menu.cursor
          mw->menu.top_shadow_pixmap
@@ -2095,7 +2075,11 @@
      Also the color cells of top_shadow_color, bottom_shadow_color,
      foreground, and button_foreground will never be freed until this
      client exits.  Nice, eh?
-   */
+
+     But now I can free font without any visible glitches.  */
+
+  if (mw->menu.font)
+    XFreeFont (XtDisplay (mw), mw->menu.font);
 
 #ifdef HAVE_XFT
   if (mw->menu.windows [0].xft_draw)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]