From 018c5e19a5a0c8ef4b361a8230dca2db6c804fb3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 16 Apr 2011 01:36:41 -0700 Subject: [PATCH] * frame.c, frame.h (x_get_resource_string): Bring this back, but only if HAVE_X_WINDOWS && !USE_X_TOOLKIT. --- src/ChangeLog | 3 +++ src/frame.c | 25 +++++++++++++++++++++++++ src/frame.h | 4 ++++ 3 files changed, 32 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index f7ed1023afc..6cf4b23dd87 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-04-16 Paul Eggert + * frame.c, frame.h (x_get_resource_string): Bring this back, but + only if HAVE_X_WINDOWS && !USE_X_TOOLKIT. + * bitmaps: Change bitmaps from unsigned char back to the X11 compatible char. Avoid the old compiler warnings about out-of-range initializers by using, for example, '\xab' rather diff --git a/src/frame.c b/src/frame.c index cafcd149503..9024a2fb5e2 100644 --- a/src/frame.c +++ b/src/frame.c @@ -3845,6 +3845,31 @@ display_x_get_resource (Display_Info *dpyinfo, Lisp_Object attribute, Lisp_Objec attribute, class, component, subclass); } +#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT +/* Used when C code wants a resource value. */ +/* Called from oldXMenu/Create.c. */ +char * +x_get_resource_string (const char *attribute, const char *class) +{ + char *name_key; + char *class_key; + struct frame *sf = SELECTED_FRAME (); + + /* Allocate space for the components, the dots which separate them, + and the final '\0'. */ + name_key = (char *) alloca (SBYTES (Vinvocation_name) + + strlen (attribute) + 2); + class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) + + strlen (class) + 2); + + sprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute); + sprintf (class_key, "%s.%s", EMACS_CLASS, class); + + return x_get_string_resource (FRAME_X_DISPLAY_INFO (sf)->xrdb, + name_key, class_key); +} +#endif + /* Return the value of parameter PARAM. First search ALIST, then Vdefault_frame_alist, then the X defaults diff --git a/src/frame.h b/src/frame.h index 1f176f6f900..944a3270ae5 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1133,6 +1133,10 @@ extern Lisp_Object display_x_get_resource (Display_Info *, Lisp_Object component, Lisp_Object subclass); +#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT +extern char *x_get_resource_string (const char *, const char *); +#endif + /* In xmenu.c */ extern void set_frame_menubar (FRAME_PTR, int, int);