]> code.delx.au - gnu-emacs/commitdiff
(w32_get_rdb_resource): New function.
authorJuanma Barranquero <lekktu@gmail.com>
Thu, 6 Mar 2003 13:07:24 +0000 (13:07 +0000)
committerJuanma Barranquero <lekktu@gmail.com>
Thu, 6 Mar 2003 13:07:24 +0000 (13:07 +0000)
(x_get_string_resource): Use it, so resources passed with -xrm supercede the
ones in the registry.

src/ChangeLog
src/w32reg.c

index 5d33debc93d491bb8baea76f5fd1a673915359fc..711f99351baa81ec1faf2b56585aa7d75d5981d8 100644 (file)
@@ -1,3 +1,19 @@
+2003-03-06  Juanma Barranquero  <lektu@terra.es>
+
+       * w32term.h (struct w32_display_info): Add xrdb member to support
+       passing resources via -xrm on Windows.
+
+       * w32term.c (w32_make_rdb): New function.
+       (w32_term_init): Use it to initialize xrdb member of w32_display_info
+       struct.  Delete leftover code.
+
+       * w32fns.c (Fx_get_resource, x_get_resource_string): Pass xrdb to check
+       for resources passed on the command line.
+
+       * w32reg.c (w32_get_rdb_resource): New function.
+       (x_get_string_resource): Use it, so resources passed with -xrm
+       supercede the ones in the registry.
+
 2003-03-04  Jan Dj\e,Ad\e(Brv  <jan.h.d@swipnet.se>
 
        * xterm.c (x_detect_focus_change): Call x_any_window_to_frame
index 3a2bd1b68d94f0341565ea376ee70d8d75736bc3..73214d787d50ab1a0ebd251ad9916b9b738c62c4 100644 (file)
@@ -30,6 +30,26 @@ Boston, MA 02111-1307, USA.  */
 
 #define REG_ROOT "SOFTWARE\\GNU\\Emacs"
 
+static char *
+w32_get_rdb_resource (rdb, resource)
+     char *rdb;
+     char *resource;
+{
+  char *value = rdb;
+  int len = strlen (resource);
+
+  while (*value)
+    {
+      /* Comparison is case-insensitive because registry searches are too.  */
+      if ((strnicmp (value, resource, len) == 0) && (value[len] == ':'))
+        return xstrdup (&value[len + 1]);
+
+      value = strchr (value, '\0') + 1;
+    }
+
+  return NULL;
+}
+
 LPBYTE
 w32_get_string_resource (name, class, dwexptype)
      char *name, *class;
@@ -99,8 +119,18 @@ w32_get_string_resource (name, class, dwexptype)
 
 char *
 x_get_string_resource (rdb, name, class)
-     int rdb;
+     char *rdb;
      char *name, *class;
 {
+  if (rdb)
+    {
+      char *resource;
+
+      if (resource = w32_get_rdb_resource (rdb, name))
+        return resource;
+      if (resource = w32_get_rdb_resource (rdb, class))
+        return resource;
+    }
+
   return (w32_get_string_resource (name, class, REG_SZ));
 }