*** empty log message ***
authorroot <root>
Thu, 2 Feb 2006 14:40:59 +0000 (14:40 +0000)
committerroot <root>
Thu, 2 Feb 2006 14:40:59 +0000 (14:40 +0000)
Changes
config.h.in
configure
configure.ac
src/rxvttoolkit.C
src/rxvttoolkit.h

diff --git a/Changes b/Changes
index 95f48f0afa5f19e835fbf14eb1df92e3cfaaba69..ebcbc28bbd562b67b9cdb4333575b0c37b43d6f2 100644 (file)
--- a/Changes
+++ b/Changes
@@ -19,6 +19,7 @@ TODO: xim "how to" faq entry
         - +option now really sets the option to default, instead of using the
           resource value.
         - options that require an argument now really _require_ an argument.
+        - force refresh of XA_RESOURCE_STRING on virtual reconnect.
         - return exit status 2 in urxvtc when urxvtd couldn't be contacted.
         - the linux yield hack is back, now using usleep, and enabled only on
           __linux__.
index 32d7316dad5d5c6655c5def9be9f0212dcaa5e72..674f175934a6012f99cdbe18f7ec236326107c18 100644 (file)
 /* Define if your XIMCallback specifies XIC as first type. */
 #undef XIMCB_PROTO_BROKEN
 
+/* Define ONLY iff Xlib.h supports it */
+#undef XLIB_ILLEGAL_ACCESS
+
 /* Define if you want to have sexy-looking background pixmaps. Needs libXpm */
 #undef XPM_BACKGROUND
 
index bdb40761f7087b715c485172ba5badcf8e29d25b..f5666bb35742e231499026cf9b638067d937f80f 100755 (executable)
--- a/configure
+++ b/configure
@@ -3291,12 +3291,6 @@ fi
 LINKER=$LINKER
 
 
-ac_ext=cc
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
 if test -z "$orig_CXXFLAGS"; then
   if test x$GCC = xyes && test "x$GXX" = xyes; then
      CXXFLAGS="-g -O3 -fno-threadsafe-statics -fno-enforce-eh-specs"
@@ -7340,6 +7334,72 @@ fi
 LIBS=$ac_save_LIBS
 CFLAGS=$ac_save_CFLAGS
 
+echo "$as_me:$LINENO: checking for XLIB_ILLEGAL_ACCESS" >&5
+echo $ECHO_N "checking for XLIB_ILLEGAL_ACCESS... $ECHO_C" >&6
+if test "${rxvt_xlib_illegal_access+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#define XLIB_ILLEGAL_ACCESS
+#include <X11/Xlib.h>
+
+int
+main ()
+{
+
+      Display *dpy;
+      dpy->xdefaults = (char *)0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rxvt_xlib_illegal_access=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+rxvt_xlib_illegal_access=no
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $rxvt_xlib_illegal_access" >&5
+echo "${ECHO_T}$rxvt_xlib_illegal_access" >&6
+if test x$rxvt_xlib_illegal_access = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define XLIB_ILLEGAL_ACCESS 1
+_ACEOF
+
+fi
 
 echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
 
 
 
+     cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <EXTERN.h>
+#include <perl.h>
+#include <XSUB.h>
+
+int
+main ()
+{
+
+     PerlInterpreter *perl = perl_alloc ();
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rxvt_perl_link=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+rxvt_perl_link=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 if test x$support_perl = xyes; then
    support_frills=yes
 fi
 
 
-CFLAGS=${CFLAGS--O}
-LDFLAGS=${LDFLAGS--O}
-
-CPPFLAGS="$CPPFLAGS"
-
 
 
 
index 39b517c33dd5afbece9e101208ae17bb42391c17..52c966d025e21a708922d604ae6b0c5360b28092 100644 (file)
@@ -47,7 +47,7 @@ if test x$GCC = xyes && test x$GXX = xyes; then
    LIBS="$LIBS -lsupc++"
    LINKER="$CC"
    AC_LINK_IFELSE(
-      [AC_LANG_PROGRAM([struct test { }; void f() try { throw new test; } catch (...) { throw; }])],
+      [AC_LANG_PROGRAM([struct test { }; void f() try { throw new test; } catch (...) { throw; }],[])],
       [AC_MSG_RESULT(ok)],
       [
          AC_MSG_RESULT([no, making everything bigger and slower])
@@ -59,14 +59,13 @@ if test x$GCC = xyes && test x$GXX = xyes; then
 fi
 AC_SUBST(LINKER,[$LINKER])
 
-AC_LANG(C++)
 dnl# --------------------------------------------------------------------------
 dnl# Supply default CXXFLAGS, if not specified by `CXXFLAGS=flags ./configure'
 dnl#
 if test -z "$orig_CXXFLAGS"; then
   if test x$GCC = xyes && test "x$GXX" = xyes; then
      CXXFLAGS="-g -O3 -fno-threadsafe-statics -fno-enforce-eh-specs"
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [], [CXXFLAGS="-g -O3"])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], [], [CXXFLAGS="-g -O3"])
   else
     CXXFLAGS="-O"
   fi
@@ -534,6 +533,20 @@ fi
 LIBS=$ac_save_LIBS
 CFLAGS=$ac_save_CFLAGS
 
+AC_CACHE_CHECK([for XLIB_ILLEGAL_ACCESS], rxvt_xlib_illegal_access,
+[AC_COMPILE_IFELSE(
+   [AC_LANG_PROGRAM([
+#define XLIB_ILLEGAL_ACCESS
+#include <X11/Xlib.h>
+   ],[
+      Display *dpy;
+      dpy->xdefaults = (char *)0;
+   ])],
+   [rxvt_xlib_illegal_access=yes],[rxvt_xlib_illegal_access=no]
+)])
+if test x$rxvt_xlib_illegal_access = xyes; then
+   AC_DEFINE(XLIB_ILLEGAL_ACCESS, 1, Define ONLY iff Xlib.h supports it)
+fi
 
 AC_C_CONST
 AC_C_INLINE
@@ -879,16 +892,17 @@ AC_SUBST(PERL)
 AC_SUBST(IF_PERL)
 AC_SUBST(PERL_O)
 
+     AC_TRY_LINK([
+#include <EXTERN.h>
+#include <perl.h>
+#include <XSUB.h>
+],[
+     PerlInterpreter *perl = perl_alloc ();
+],[rxvt_perl_link=yes],[rxvt_perl_link=no])
 if test x$support_perl = xyes; then
    support_frills=yes
 fi
 
-dnl> AC_CHECK_FUNCS(gettimeofday putenv select socket)
-
-CFLAGS=${CFLAGS--O}
-LDFLAGS=${LDFLAGS--O}
-
-CPPFLAGS="$CPPFLAGS"
 AC_SUBST(DEBUG)
 AC_SUBST(DINCLUDE)
 AC_SUBST(CFLAGS)
index 06ad759d5233ecf1308766515fa24d3b8bebd3d8..8e5ce55a4ca8efa9dc97038ea79d490774ef4081 100644 (file)
@@ -179,7 +179,7 @@ rxvt_xim::ref_init ()
 {
   display = GET_R->display; //HACK: TODO
 
-  xim = XOpenIM (display->display, NULL, NULL, NULL);
+  xim = XOpenIM (display->display, 0, 0, 0);
 
   if (!xim)
     return false;
@@ -188,7 +188,7 @@ rxvt_xim::ref_init ()
   ximcallback.client_data = (XPointer)this;
   ximcallback.callback = im_destroy_cb;
 
-  XSetIMValues (xim, XNDestroyCallback, &ximcallback, NULL);
+  XSetIMValues (xim, XNDestroyCallback, &ximcallback, 0);
 
   return true;
 }
@@ -250,7 +250,7 @@ rxvt_display::rxvt_display (const char *id)
 }
 
 XrmDatabase
-rxvt_display::get_resources ()
+rxvt_display::get_resources (bool refresh)
 {
   char *homedir = (char *)getenv ("HOME");
   char fname[1024];
@@ -259,9 +259,7 @@ rxvt_display::get_resources ()
    * get resources using the X library function
    */
   char *displayResource, *xe;
-  XrmDatabase database, rdb1;
-
-  database = NULL;
+  XrmDatabase rdb1, database = 0;
 
   // for ordering, see for example http://www.faqs.org/faqs/Xt-FAQ/ Subject: 20
 
@@ -281,9 +279,42 @@ rxvt_display::get_resources ()
 
   // 4. User's defaults file.
   /* Get any Xserver defaults */
-  displayResource = XResourceManagerString (display);
+  if (refresh)
+    {
+      // fucking xlib keeps a copy of the rm string
+      Atom actual_type;
+      int actual_format;
+      unsigned long nitems, nremaining;
+      char *val = 0;
+
+#if XLIB_ILLEGAL_ACCESS
+      if (display->xdefaults)
+        XFree (display->xdefaults);
+#endif
 
-  if (displayResource != NULL)
+      if (XGetWindowProperty (display, root, XA_RESOURCE_MANAGER,
+                              0L, 100000000L, False,
+                              XA_STRING, &actual_type, &actual_format,
+                              &nitems, &nremaining,
+                              (unsigned char **)&val) == Success
+          && actual_type == XA_STRING
+          && actual_format == 8)
+         displayResource = val;
+       else
+         {
+           displayResource = 0;
+           if (val)
+             XFree(val);
+         }
+
+#if XLIB_ILLEGAL_ACCESS
+      display->xdefaults = displayResource;
+#endif
+    }
+  else
+    displayResource = XResourceManagerString (display);
+
+  if (displayResource)
     {
       if ((rdb1 = XrmGetStringDatabase (displayResource)))
         XrmMergeDatabases (rdb1, &database);
@@ -296,10 +327,15 @@ rxvt_display::get_resources ()
         XrmMergeDatabases (rdb1, &database);
     }
 
+#if !XLIB_ILLEGAL_ACCESS
+  if (refresh && displayResource)
+    XFree (displayResource);
+#endif
+
   /* Get screen specific resources */
   displayResource = XScreenResourceString (ScreenOfDisplay (display, screen));
 
-  if (displayResource != NULL)
+  if (displayResource)
     {
       if ((rdb1 = XrmGetStringDatabase (displayResource)))
         /* Merge with screen-independent resources */
@@ -350,13 +386,13 @@ bool rxvt_display::ref_init ()
   if (!display)
     return false;
 
-  screen = DefaultScreen (display);
+  screen = DefaultScreen     (display);
   root   = DefaultRootWindow (display);
 
   assert (sizeof (xa_names) / sizeof (char *) == NUM_XA);
   XInternAtoms (display, (char **)xa_names, NUM_XA, False, xa);
 
-  XrmSetDatabase (display, get_resources ());
+  XrmSetDatabase (display, get_resources (false));
 
 #ifdef POINTER_BLANK
   XColor blackcolour;
@@ -399,7 +435,7 @@ rxvt_display::ref_next ()
   // TODO: somehow check wether the database files/resources changed
   // before affording re-loading/parsing
   XrmDestroyDatabase (XrmGetDatabase (display));
-  XrmSetDatabase (display, get_resources ());
+  XrmSetDatabase (display, get_resources (true));
 }
 
 rxvt_display::~rxvt_display ()
index 9908ca75d1b312031e06e9b7780e94b2d5d8826a..d5c63aefcde52fc9f0e5c453184d6ed33d91a4a8 100644 (file)
@@ -160,7 +160,7 @@ struct rxvt_display : refcounted {
 #endif
 
   rxvt_display (const char *id);
-  XrmDatabase get_resources ();
+  XrmDatabase get_resources (bool refresh);
   bool ref_init ();
   void ref_next ();
   ~rxvt_display ();