- +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__.
/* 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
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"
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"
-
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])
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
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
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)
{
display = GET_R->display; //HACK: TODO
- xim = XOpenIM (display->display, NULL, NULL, NULL);
+ xim = XOpenIM (display->display, 0, 0, 0);
if (!xim)
return false;
ximcallback.client_data = (XPointer)this;
ximcallback.callback = im_destroy_cb;
- XSetIMValues (xim, XNDestroyCallback, &ximcallback, NULL);
+ XSetIMValues (xim, XNDestroyCallback, &ximcallback, 0);
return true;
}
}
XrmDatabase
-rxvt_display::get_resources ()
+rxvt_display::get_resources (bool refresh)
{
char *homedir = (char *)getenv ("HOME");
char fname[1024];
* 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
// 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);
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 */
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;
// 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 ()
#endif
rxvt_display (const char *id);
- XrmDatabase get_resources ();
+ XrmDatabase get_resources (bool refresh);
bool ref_init ();
void ref_next ();
~rxvt_display ();