# HG changeset patch # User Jeff Sparkes # Date 1277294658 14400 # Node ID 6466bc9ebf15c4feacba67c6ade3f4da905cbd65 # Parent 0f7d483cff5a8248eac3af5e1be666f871dd72f7 * console-x-impl.h (DEVICE_X_XFTDRAW): Define, instead of FRAME_X_FTDRAW. (struct x_device): Add XftDraw field. (struct x_frame): Remove XftDraw field. Move XftDraw from frame to device for improved caching. * device-x.c (x_delete_device): Free XftDraw here. * frame-x.c (x_delete_frame): Remove freeing of XftDraw. * redisplay-xlike-inc.c (XLIKE_output_string): Use DEVICE_X_XFTDRAW instead of FRAME_X_XFTDRAW when lazily creating XftDraw structure. diff -r 0f7d483cff5a -r 6466bc9ebf15 lisp/gtk-widget-accessors.el --- a/lisp/gtk-widget-accessors.el Sun Jun 13 23:54:13 2010 +0900 +++ b/lisp/gtk-widget-accessors.el Wed Jun 23 08:04:18 2010 -0400 @@ -20,28 +20,28 @@ (require 'gtk-ffi) -(defconst GTK_TYPE_INVALID 0) -(defconst GTK_TYPE_NONE 1) -(defconst GTK_TYPE_CHAR 2) -(defconst GTK_TYPE_UCHAR 3) -(defconst GTK_TYPE_BOOL 4) -(defconst GTK_TYPE_INT 5) -(defconst GTK_TYPE_UINT 6) -(defconst GTK_TYPE_LONG 7) -(defconst GTK_TYPE_ULONG 8) -(defconst GTK_TYPE_FLOAT 9) -(defconst GTK_TYPE_DOUBLE 10) -(defconst GTK_TYPE_STRING 11) -(defconst GTK_TYPE_ENUM 12) -(defconst GTK_TYPE_FLAGS 13) -(defconst GTK_TYPE_BOXED 14) -(defconst GTK_TYPE_POINTER 15) -(defconst GTK_TYPE_SIGNAL 16) -(defconst GTK_TYPE_ARGS 17) -(defconst GTK_TYPE_CALLBACK 18) -(defconst GTK_TYPE_C_CALLBACK 19) -(defconst GTK_TYPE_FOREIGN 20) -(defconst GTK_TYPE_OBJECT 21) +(defconst G_TYPE_INVALID 0) +(defconst G_TYPE_NONE 1) +(defconst G_TYPE_CHAR 2) +(defconst G_TYPE_UCHAR 3) +(defconst G_TYPE_BOOL 4) +(defconst G_TYPE_INT 5) +(defconst G_TYPE_UINT 6) +(defconst G_TYPE_LONG 7) +(defconst G_TYPE_ULONG 8) +(defconst G_TYPE_FLOAT 9) +(defconst G_TYPE_DOUBLE 10) +(defconst G_TYPE_STRING 11) +(defconst G_TYPE_ENUM 12) +(defconst G_TYPE_FLAGS 13) +(defconst G_TYPE_BOXED 14) +(defconst G_TYPE_POINTER 15) +(defconst G_TYPE_SIGNAL 16) +(defconst G_TYPE_ARGS 17) +(defconst G_TYPE_CALLBACK 18) +(defconst G_TYPE_C_CALLBACK 19) +(defconst G_TYPE_FOREIGN 20) +(defconst G_TYPE_OBJECT 21) (defconst gtk-value-accessor-names '("INVALID" "NONE" "CHAR" "UCHAR" "BOOL" "INT" "UINT" "LONG" "ULONG" "FLOAT" "DOUBLE" @@ -88,8 +88,8 @@ "\n" (format "\tthe_obj = GTK_%s (XGTK_OBJECT (obj)->object);\n" wrapper) - (format "\targ.type = gtk_type_from_name (\"%s\");\n" (symbol-name (car arg)))) -; (format "\targ.type = GTK_TYPE_%s;\n" (or + (format "\targ.type = g_type_from_name (\"%s\");\n" (symbol-name (car arg)))) +; (format "\targ.type = G_TYPE_%s;\n" (or ; (nth (gtk-fundamental-type (car arg)) ; gtk-value-accessor-names) ; (case (car arg) @@ -100,12 +100,12 @@ (setq base-arg-type (gtk-fundamental-type (car arg))) (cond - ((= base-arg-type GTK_TYPE_OBJECT) + ((= base-arg-type G_TYPE_OBJECT) (insert (format "\tGTK_VALUE_OBJECT (arg) = GTK_OBJECT (the_obj->%s);" (cdr arg)))) - ((or (= base-arg-type GTK_TYPE_POINTER) - (= base-arg-type GTK_TYPE_BOXED)) + ((or (= base-arg-type G_TYPE_POINTER) + (= base-arg-type G_TYPE_BOXED)) (insert (format "\tGTK_VALUE_%s (arg) = (void *)the_obj->%s;" (nth (gtk-fundamental-type (car arg)) gtk-value-accessor-names) @@ -117,7 +117,7 @@ (cdr arg))))) (insert "\n" - "\treturn (gtk_type_to_lisp (&arg));\n" + "\treturn (g_type_to_lisp (&arg));\n" "}\n\n") (push c-func-name func-names)) func-names)) diff -r 0f7d483cff5a -r 6466bc9ebf15 src/ChangeLog --- a/src/ChangeLog Sun Jun 13 23:54:13 2010 +0900 +++ b/src/ChangeLog Wed Jun 23 08:04:18 2010 -0400 @@ -1,3 +1,19 @@ +2010-06-21 Jeff Sparkes + + * console-x-impl.h (DEVICE_X_XFTDRAW): Define, instead of + FRAME_X_FTDRAW. + (struct x_device): Add XftDraw field. + (struct x_frame): Remove XftDraw field. + Move XftDraw from frame to device for improved caching. + + * device-x.c (x_delete_device): Free XftDraw here. + + * frame-x.c (x_delete_frame): Remove freeing of XftDraw. + + * redisplay-xlike-inc.c (XLIKE_output_string): Use + DEVICE_X_XFTDRAW instead of FRAME_X_XFTDRAW when lazily creating + XftDraw structure. + 2010-06-13 Stephen J. Turnbull * elhash.c: diff -r 0f7d483cff5a -r 6466bc9ebf15 src/console-x-impl.h --- a/src/console-x-impl.h Sun Jun 13 23:54:13 2010 +0900 +++ b/src/console-x-impl.h Wed Jun 23 08:04:18 2010 -0400 @@ -68,6 +68,17 @@ /* Used by x_bevel_modeline in redisplay-x.c */ Pixmap gray_pixmap; +#ifdef HAVE_XFT + /* The Xft Drawable wrapper for this device. */ + /* This is persistent to take advantage of the ability of Xft's glyph + cache in the server, and avoid rendering the font again and again... + + This is created the first time through redisplay, and destroyed when our + connection to the X display is destroyed. */ + XftDraw *xftDraw; +#endif + + /* Atoms associated with this device. */ /* allocated in Xatoms_of_device_x */ Atom Xatom_WM_PROTOCOLS; @@ -187,6 +198,7 @@ #define DEVICE_XT_APP_SHELL(d) (DEVICE_X_DATA (d)->Xt_app_shell) #define DEVICE_X_GC_CACHE(d) (DEVICE_X_DATA (d)->gc_cache) #define DEVICE_X_GRAY_PIXMAP(d) (DEVICE_X_DATA (d)->gray_pixmap) +#define DEVICE_X_XFTDRAW(d) (DEVICE_X_DATA (d)->xftDraw) #define DEVICE_X_WM_COMMAND_FRAME(d) (DEVICE_X_DATA (d)->WM_COMMAND_frame) #define DEVICE_X_MOUSE_TIMESTAMP(d) (DEVICE_X_DATA (d)->mouse_timestamp) #define DEVICE_X_GLOBAL_MOUSE_TIMESTAMP(d) (DEVICE_X_DATA (d)->global_mouse_timestamp) @@ -319,17 +331,6 @@ #endif /* XIM_XLIB */ #endif /* HAVE_XIM */ -#ifdef HAVE_XFT - /* The Xft Drawable wrapper for this device. - #### Should this be per-device, or per-frame? */ - /* This is persistent to take advantage of the ability of Xft's glyph - cache in the server, and avoid rendering the font again and again... - - This is created the first time through redisplay, and destroyed when our - connection to the X display is destroyed. */ - XftDraw *xftDraw; -#endif - /* 1 if the frame is completely visible on the display, 0 otherwise. if 0 the frame may have been iconified or may be totally or partially hidden by another X window */ @@ -391,10 +392,6 @@ #define FRAME_X_GEOM_FREE_ME_PLEASE(f) (FRAME_X_DATA (f)->geom_free_me_please) -#ifdef HAVE_XFT -#define FRAME_X_XFTDRAW(f) (FRAME_X_DATA (f)->xftDraw) -#endif - #define FRAME_X_TOTALLY_VISIBLE_P(f) (FRAME_X_DATA (f)->totally_visible_p) #define FRAME_X_TOP_LEVEL_FRAME_P(f) (FRAME_X_DATA (f)->top_level_frame_p) diff -r 0f7d483cff5a -r 6466bc9ebf15 src/device-x.c --- a/src/device-x.c Sun Jun 13 23:54:13 2010 +0900 +++ b/src/device-x.c Wed Jun 23 08:04:18 2010 -0400 @@ -946,6 +946,18 @@ int checking_free; #endif +#ifdef HAVE_XFT + /* If we have an XftDraw structure, we need to free it here. + We can't ever have an XftDraw without a Display, so we are safe + to free it in here, and we avoid too much playing around with the + malloc checking hooks this way. */ + if (DEVICE_X_XFTDRAW (d)) + { + XftDrawDestroy (DEVICE_X_XFTDRAW (d)); + DEVICE_X_XFTDRAW (d) = NULL; + } +#endif + display = DEVICE_X_DISPLAY (d); if (display) diff -r 0f7d483cff5a -r 6466bc9ebf15 src/frame-x.c --- a/src/frame-x.c Sun Jun 13 23:54:13 2010 +0900 +++ b/src/frame-x.c Wed Jun 23 08:04:18 2010 -0400 @@ -2614,19 +2614,6 @@ DtDndDropUnregister (FRAME_X_TEXT_WIDGET (f)); #endif /* HAVE_CDE */ -#ifdef HAVE_XFT - /* If we have an XftDraw structure, we need to free it here. - We can't ever have an XftDraw without a Display, so we are safe - to free it in here, and we avoid too much playing around with the - malloc checking hooks this way. */ - if (FRAME_X_XFTDRAW (f)) - { - XftDrawDestroy (FRAME_X_XFTDRAW (f)); - FRAME_X_XFTDRAW (f) = NULL; - } -#endif - - assert (FRAME_X_SHELL_WIDGET (f) != 0); dpy = XtDisplay (FRAME_X_SHELL_WIDGET (f)); diff -r 0f7d483cff5a -r 6466bc9ebf15 src/redisplay-xlike-inc.c --- a/src/redisplay-xlike-inc.c Sun Jun 13 23:54:13 2010 +0900 +++ b/src/redisplay-xlike-inc.c Wed Jun 23 08:04:18 2010 -0400 @@ -1028,10 +1028,10 @@ XftDraw *xftDraw; /* Lazily initialize frame's xftDraw member. */ - if (!FRAME_X_XFTDRAW (f)) { - FRAME_X_XFTDRAW (f) = XftDrawCreate (dpy, x_win, visual, cmap); + if (!DEVICE_X_XFTDRAW (d)) { + DEVICE_X_XFTDRAW (d) = XftDrawCreate (dpy, x_win, visual, cmap); } - xftDraw = FRAME_X_XFTDRAW (f); + xftDraw = DEVICE_X_XFTDRAW (d); /* #### This will probably cause asserts when passed a Lisp integer for a color. See ca. line 759 this file.