diff --git a/configure.ac b/configure.ac index 4331c587..0496427c 100644 --- a/configure.ac +++ b/configure.ac @@ -294,6 +294,16 @@ if test "x$enable_composite" = "xyes"; then fi AM_CONDITIONAL(ENABLE_COMPOSITE, test "x$enable_composite" = "xyes") +AC_ARG_ENABLE(xpresent, + AC_HELP_STRING([--enable-xpresent], [compile with Present support (experimental) @<:@default=no@:>@]),, + enable_xpresent=no) +if test "x$enable_xpresent" = "xyes"; then + PKG_CHECK_MODULES(XPRESENT, xpresent, + AC_DEFINE(USE_XPRESENT, 1, [Present support]), + enable_xpresent=no + AC_MSG_WARN([Present support was requested but not found]) ) +fi + AC_ARG_ENABLE(zoom, AC_HELP_STRING([--enable-zoom], [compile with zoom support @<:@default=yes@:>@]),, enable_zoom=yes) @@ -514,6 +524,7 @@ echo " GLX .......................... $enable_glx" echo " ScreenSaver .................. $enable_xscrnsaver" echo " D-Bus ........................ $enable_dbus" echo " XI2 .......................... $enable_xi2" +echo " Present....................... $enable_xpresent" echo " Use container window ......... $enable_container" echo echo "Installation path .............. $prefix" diff --git a/src/E.h b/src/E.h index 9409fea3..13b9d420 100644 --- a/src/E.h +++ b/src/E.h @@ -126,6 +126,7 @@ #define XEXT_RENDER 8 #define XEXT_GLX 9 #define XEXT_XI 10 +#define XEXT_PRESENT 11 #define XEXT_CM_ALL 16 diff --git a/src/Makefile.am b/src/Makefile.am index 2b670eff..df029084 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -135,6 +135,7 @@ e16_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(XI_CFLAGS) \ $(XRANDR_CFLAGS) \ + $(XPRESENT_CFLAGS) \ $(X_CFLAGS) LDADD = \ @@ -145,6 +146,7 @@ LDADD = \ $(GLX_LIBS) \ $(XI_LIBS) \ $(XRANDR_LIBS) \ + $(XPRESENT_LIBS) \ $(X_LIBS) \ $(SM_LIBS) \ $(XINERAMA_LIBS) \ diff --git a/src/edebug.h b/src/edebug.h index 2fd70f6d..3d1d820b 100644 --- a/src/edebug.h +++ b/src/edebug.h @@ -57,6 +57,7 @@ #define EDBUG_TYPE_XI2 153 #define EDBUG_TYPE_ZOOM 154 #define EDBUG_TYPE_ANIM 155 +#define EDBUG_TYPE_PRESENT 156 #define EDBUG_TYPE_COMPMGR 161 #define EDBUG_TYPE_COMPMGR2 162 diff --git a/src/events.c b/src/events.c index 8a0179f6..52a83627 100644 --- a/src/events.c +++ b/src/events.c @@ -50,13 +50,16 @@ #include #include #endif +#if USE_XPRESENT +#include +#endif #if USE_GLX #include #endif #if USE_XI2 #include #endif -#define USE_GENERIC defined(USE_XI2) +#define USE_GENERIC defined(USE_XI2) || defined(USE_XPRESENT) #if ENABLE_DEBUG_EVENTS static const char *EventName(unsigned int type); @@ -78,7 +81,7 @@ typedef struct { void (*init) (int avaliable); } EServerExt; -static EServerExtData ExtData[11]; +static EServerExtData ExtData[12]; #define event_base_shape ExtData[XEXT_SHAPE].event_base #define event_base_randr ExtData[XEXT_RANDR].event_base @@ -249,6 +252,21 @@ ExtInitInput(int available) } #endif +#if USE_XPRESENT +static void +ExtInitPresent(int available) +{ + if (!available) + return; + + if (EDebug(EDBUG_TYPE_VERBOSE)) + { + Eprintf(" Capabilities: %#x\n", + XPresentQueryCapabilities(disp, WinGetXwin(VROOT))); + } +} +#endif + static const EServerExt Extensions[] = { {"SHAPE", XEXT_SHAPE, XShapeQueryVersion, ExtInitShape}, #if USE_XSYNC @@ -275,6 +293,9 @@ static const EServerExt Extensions[] = { #if USE_XI2 {"XInputExtension", XEXT_XI, EInputQueryVersion, ExtInitInput}, #endif +#if USE_XPRESENT + {"Present", XEXT_PRESENT, XPresentQueryVersion, ExtInitPresent}, +#endif }; static void @@ -888,6 +909,25 @@ _EventFetchXI2(XEvent * ev) } #endif /* USE_XI2 */ +#if USE_XPRESENT +typedef union { + XPresentEvent xpe; + XPresentConfigureNotifyEvent conf; + XPresentCompleteNotifyEvent cmpl; + XPresentIdleNotifyEvent idle; +} xpe_t; + +static void +_EventFetchPresent(XEvent * ev) +{ + xpe_t *xpe = (xpe_t *) ev->xcookie.data; + + if (EDebug(EDBUG_TYPE_PRESENT)) + Eprintf("%s: %#lx: type=%d\n", + __func__, xpe->idle.window, xpe->xpe.evtype); +} +#endif /* USE_XPRESENT */ + static void _EventFetchGeneric(XEvent * ev) { @@ -904,6 +944,13 @@ _EventFetchGeneric(XEvent * ev) _EventFetchXI2(ev); goto done; } +#endif +#if USE_XPRESENT + if (ev->xcookie.extension == ExtData[XEXT_PRESENT].major_op) + { + _EventFetchPresent(ev); + goto done; + } #endif /* We should never go here */ Eprintf("*** %s: ext=%d type=%d\n", __func__,