]> code.delx.au - gnu-emacs/blobdiff - src/xftfont.c
src/dispextern.h: Fix commentary to it's hpos member.
[gnu-emacs] / src / xftfont.c
index 37b33b3ead8cf9d39a7f97b25617a5a9b513f60c..18c180f906a0a46fb376c3b37cff67d13713b60b 100644 (file)
@@ -1,5 +1,5 @@
 /* xftfont.c -- XFT font driver.
 /* xftfont.c -- XFT font driver.
-   Copyright (C) 2006-2013 Free Software Foundation, Inc.
+   Copyright (C) 2006-2014 Free Software Foundation, Inc.
    Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H13PRO009
    Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H13PRO009
@@ -42,7 +42,7 @@ Lisp_Object Qxft;
 static Lisp_Object QChinting, QCautohint, QChintstyle, QCrgba, QCembolden,
   QClcdfilter;
 
 static Lisp_Object QChinting, QCautohint, QChintstyle, QCrgba, QCembolden,
   QClcdfilter;
 
-/* The actual structure for Xft font that can be casted to struct
+/* The actual structure for Xft font that can be cast to struct
    font.  */
 
 struct xftfont_info
    font.  */
 
 struct xftfont_info
@@ -59,6 +59,7 @@ struct xftfont_info
   FT_Matrix matrix;
   Display *display;
   XftFont *xftfont;
   FT_Matrix matrix;
   Display *display;
   XftFont *xftfont;
+  unsigned x_display_id;
 };
 
 /* Structure pointed by (struct face *)->extra  */
 };
 
 /* Structure pointed by (struct face *)->extra  */
@@ -372,6 +373,7 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
   xftfont_info = (struct xftfont_info *) font;
   xftfont_info->display = display;
   xftfont_info->xftfont = xftfont;
   xftfont_info = (struct xftfont_info *) font;
   xftfont_info->display = display;
   xftfont_info->xftfont = xftfont;
+  xftfont_info->x_display_id = FRAME_DISPLAY_INFO (f)->x_id;
   /* This means that there's no need of transformation.  */
   xftfont_info->matrix.xx = 0;
   if (FcPatternGetMatrix (xftfont->pattern, FC_MATRIX, 0, &matrix)
   /* This means that there's no need of transformation.  */
   xftfont_info->matrix.xx = 0;
   if (FcPatternGetMatrix (xftfont->pattern, FC_MATRIX, 0, &matrix)
@@ -481,6 +483,7 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
 static void
 xftfont_close (struct font *font)
 {
 static void
 xftfont_close (struct font *font)
 {
+  struct x_display_info *xdi;
   struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
 
 #ifdef HAVE_LIBOTF
   struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
 
 #ifdef HAVE_LIBOTF
@@ -491,7 +494,10 @@ xftfont_close (struct font *font)
     }
 #endif
 
     }
 #endif
 
-  if (xftfont_info->xftfont)
+  /* See comment in xfont_close.  */
+  if (xftfont_info->xftfont
+      && ((xdi = x_display_info_for_display (xftfont_info->display))
+         && xftfont_info->x_display_id == xdi->x_id))
     {
       block_input ();
       XftUnlockFace (xftfont_info->xftfont);
     {
       block_input ();
       XftUnlockFace (xftfont_info->xftfont);