AC_SUBST(XDBE_CFLAGS)
AC_SUBST(XDBE_LIBS)
+### Use Xcomposite (-lXcomposite) if available
+HAVE_XCOMPOSITE=no
+if test "${HAVE_X11}" = "yes"; then
+ AC_CHECK_HEADER(X11/extensions/Xcomposite.h,
+ [AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, HAVE_XCOMPOSITE=yes)],
+ [],
+ [#include <X11/extensions/Xcomposite.h>
+ ])
+ if test $HAVE_XCOMPOSITE = yes; then
+ XCOMPOSITE_LIBS=-lXcomposite
+ fi
+ if test $HAVE_XCOMPOSITE = yes; then
+ AC_DEFINE(HAVE_XCOMPOSITE, 1, [Define to 1 if you have the XCOMPOSITE extension.])
+ fi
+fi
+AC_SUBST(XCOMPOSITE_CFLAGS)
+AC_SUBST(XCOMPOSITE_LIBS)
+
### Use libxml (-lxml2) if available
### mingw32 doesn't use -lxml2, since it loads the library dynamically.
HAVE_LIBXML2=no
XDBE_LIBS = @XDBE_LIBS@
XDBE_CFLAGS = @XDBE_CFLAGS@
+XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
+XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
+
## widget.o if USE_X_TOOLKIT, otherwise empty.
WIDGET_OBJ=@WIDGET_OBJ@
$(HARFBUZZ_CFLAGS) $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \
$(LIBSYSTEMD_CFLAGS) $(JSON_CFLAGS) $(XSYNC_CFLAGS) \
$(LIBGNUTLS_CFLAGS) $(NOTIFY_CFLAGS) $(CAIRO_CFLAGS) \
- $(WERROR_CFLAGS) $(HAIKU_CFLAGS)
+ $(WERROR_CFLAGS) $(HAIKU_CFLAGS) $(XCOMPOSITE_CFLAGS)
ALL_CFLAGS = $(EMACS_CFLAGS) $(WARN_CFLAGS) $(CFLAGS)
ALL_OBJC_CFLAGS = $(EMACS_CFLAGS) \
$(filter-out $(NON_OBJC_CFLAGS),$(WARN_CFLAGS)) $(CFLAGS) \
$(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(GETADDRINFO_A_LIBS) $(LCMS2_LIBS) \
$(NOTIFY_LIBS) $(LIB_MATH) $(LIBZ) $(LIBMODULES) $(LIBSYSTEMD_LIBS) \
$(JSON_LIBS) $(LIBGMP) $(LIBGCCJIT_LIBS) $(XINPUT_LIBS) $(HAIKU_LIBS) \
- $(SQLITE3_LIBS)
+ $(SQLITE3_LIBS) $(XCOMPOSITE_LIBS)
## FORCE it so that admin/unidata can decide whether this file is
## up-to-date. Although since charprop depends on bootstrap-emacs,
#include <X11/extensions/Xinerama.h>
#endif
+#ifdef HAVE_XCOMPOSITE
+#include <X11/extensions/Xcomposite.h>
+#endif
+
/* Load sys/types.h if not already loaded.
In some systems loading it twice is suicidal. */
#ifndef makedev
{
Window child_return, child, dummy, proxy;
int dest_x_return, dest_y_return, rc, proto;
+#if defined HAVE_XCOMPOSITE && (XCOMPOSITE_MAJOR > 0 || XCOMPOSITE_MINOR > 2)
+ Window overlay_window;
+ XWindowAttributes attrs;
+#endif
child_return = dpyinfo->root_window;
dest_x_return = root_x;
dest_y_return = root_y;
{
*proto_out = proto;
- x_uncatch_errors_after_check ();
+ x_uncatch_errors ();
return proxy;
}
}
if (proto != -1)
{
*proto_out = proto;
- x_uncatch_errors_after_check ();
+ x_uncatch_errors ();
return child_return;
}
x_uncatch_errors_after_check ();
}
+#if defined HAVE_XCOMPOSITE && (XCOMPOSITE_MAJOR > 0 || XCOMPOSITE_MINOR > 2)
+ if (child != dpyinfo->root_window)
+ {
+#endif
+ *proto_out = x_dnd_get_window_proto (dpyinfo, child);
+ return child;
+#if defined HAVE_XCOMPOSITE && (XCOMPOSITE_MAJOR > 0 || XCOMPOSITE_MINOR > 2)
+ }
+ else if (dpyinfo->composite_supported_p
+ && (dpyinfo->composite_major > 0
+ || dpyinfo->composite_minor > 2))
+ {
+ /* Only do this if a compositing manager is present. */
+ if (XGetSelectionOwner (dpyinfo->display,
+ dpyinfo->Xatom_NET_WM_CM_Sn) != None)
+ {
+ overlay_window = XCompositeGetOverlayWindow (dpyinfo->display,
+ dpyinfo->root_window);
+ XCompositeReleaseOverlayWindow (dpyinfo->display,
+ dpyinfo->root_window);
+ XGetWindowAttributes (dpyinfo->display, overlay_window, &attrs);
+
+ if (attrs.map_state == IsViewable)
+ {
+ proxy = x_dnd_get_window_proxy (dpyinfo, overlay_window);
+
+ if (proxy != None)
+ {
+ proto = x_dnd_get_window_proto (dpyinfo, proxy);
+
+ if (proto != -1)
+ {
+ *proto_out = proto;
+ return proxy;
+ }
+ }
+ }
+ }
+ }
+
*proto_out = x_dnd_get_window_proto (dpyinfo, child);
return child;
+#endif
}
static Window
#ifdef USE_XCB
xcb_connection_t *xcb_conn;
#endif
+ char *cm_atom_sprintf;
block_input ();
&dpyinfo->xrender_minor);
#endif
+ /* This must come after XRenderQueryVersion! */
+#ifdef HAVE_XCOMPOSITE
+ int composite_event_base, composite_error_base;
+ dpyinfo->composite_supported_p = XCompositeQueryExtension (dpyinfo->display,
+ &composite_event_base,
+ &composite_error_base);
+
+ if (dpyinfo->composite_supported_p)
+ dpyinfo->composite_supported_p
+ = XCompositeQueryVersion (dpyinfo->display,
+ &dpyinfo->composite_major,
+ &dpyinfo->composite_minor);
+#endif
+
/* Put the rdb where we can find it in a way that works on
all versions. */
dpyinfo->rdb = xrdb;
dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm;
}
+ {
+ int n = snprintf (NULL, 0, "_NET_WM_CM_S%d",
+ XScreenNumberOfScreen (dpyinfo->screen));
+ cm_atom_sprintf = alloca (n + 1);
+
+ snprintf (cm_atom_sprintf, n + 1, "_NET_WM_CM_S%d",
+ XScreenNumberOfScreen (dpyinfo->screen));
+ }
+
{
static const struct
{
int i;
enum { atom_count = ARRAYELTS (atom_refs) };
/* 1 for _XSETTINGS_SN. */
- enum { total_atom_count = 1 + atom_count };
+ enum { total_atom_count = 2 + atom_count };
Atom atoms_return[total_atom_count];
char *atom_names[total_atom_count];
static char const xsettings_fmt[] = "_XSETTINGS_S%d";
sprintf (xsettings_atom_name, xsettings_fmt,
XScreenNumberOfScreen (dpyinfo->screen));
atom_names[i] = xsettings_atom_name;
+ atom_names[i + 1] = cm_atom_sprintf;
XInternAtoms (dpyinfo->display, atom_names, total_atom_count,
False, atoms_return);
for (i = 0; i < atom_count; i++)
*(Atom *) ((char *) dpyinfo + atom_refs[i].offset) = atoms_return[i];
- /* Manually copy last atom. */
+ /* Manually copy last two atoms. */
dpyinfo->Xatom_xsettings_sel = atoms_return[i];
+ dpyinfo->Xatom_NET_WM_CM_Sn = atoms_return[i + 1];
}
#ifdef HAVE_XKB