summaryrefslogtreecommitdiffstats
path: root/twin
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2014-04-07 02:00:35 +0400
committerSlávek Banko <slavek.banko@axis.cz>2014-04-29 02:00:29 +0200
commit7c55134dee71ab9a2f916ed2f61d33c45a7681df (patch)
treea5f3c915ce6f08071b51ea22bc4d8c026b38d71e /twin
parent30252262ce90415f09232c51724a393c8dd6a7fe (diff)
downloadtdebase-7c55134dee71ab9a2f916ed2f61d33c45a7681df.tar.gz
tdebase-7c55134dee71ab9a2f916ed2f61d33c45a7681df.zip
twin/compton-tde: make XRandR support optional in compot-tde
Diffstat (limited to 'twin')
-rw-r--r--twin/compton-tde/CMakeLists.txt13
-rw-r--r--twin/compton-tde/common.h7
-rw-r--r--twin/compton-tde/compton.c45
-rw-r--r--twin/compton-tde/compton_config.h.cmake2
4 files changed, 53 insertions, 14 deletions
diff --git a/twin/compton-tde/CMakeLists.txt b/twin/compton-tde/CMakeLists.txt
index 6a2d71339..1f6d6e682 100644
--- a/twin/compton-tde/CMakeLists.txt
+++ b/twin/compton-tde/CMakeLists.txt
@@ -12,8 +12,6 @@
if( NOT WITH_XRENDER )
tde_message_fatal( "xrender support is needed to build compton-tde.\n Pass -DWITH_XRENDER=ON to cmake arguments." )
-elseif( NOT WITH_XRANDR )
- tde_message_fatal( "xrandr support is needed to build compton-tde.\n Pass -DWITH_XRANDR=ON to cmake arguments." )
elseif( NOT WITH_XFIXES )
tde_message_fatal( "xfixes support is needed to build compton-tde.\n Pass -DWITH_XFIXES=ON to cmake arguments." )
endif( )
@@ -29,6 +27,7 @@ include_directories(
# TDE to compton config option map
# WITH_XINNERAMA -> CONFIG_XINERAMA
+# WITH_XRANDR -> CONFIG_XANDR
# WITH_OPENGL -> CONFIG_VSYNC_OPENGL
# WITH_OPENGL -> CONFIG_VSYNC_OPENGL_GLSL
# WITH_OPENGL -> CONFIG_VSYNC_OPENGL_FBO
@@ -68,6 +67,11 @@ if( WITH_XINERAMA )
list( APPEND compton_LIBRARIES ${XINERAMA_LIBRARIES} )
endif( )
+if( WITH_XRANDR )
+ set( CONFIG_XRANDR ${WITH_XRANDR} )
+ list( APPEND compton_LIBRARIES ${XRANDR_LIBRARIES} )
+endif( )
+
if( WITH_PCRE )
set( CONFIG_REGEX_PCRE ${WITH_PCRE} )
set( CONFIG_REGEX_PCRE_JIT ${WITH_PCRE} )
@@ -82,8 +86,7 @@ list( APPEND compton_LIBRARIES ${DBUS_LIBRARIES} )
tde_add_executable( compton-tde
SOURCES ${compton_SRCS}
- LINK m ${compton_LIBRARIES} ${XRENDER_LIBRARIES}
- ${XRANDR_LIBRARIES} ${XFIXES_LIBRARIES} ${XDAMAGE_LIBRARIES}
- ${XEXT_LIBRARIES} ${XCOMPOSITE_LIBRARIES}
+ LINK m ${compton_LIBRARIES} ${XRENDER_LIBRARIES} ${XFIXES_LIBRARIES}
+ ${XDAMAGE_LIBRARIES} ${XEXT_LIBRARIES} ${XCOMPOSITE_LIBRARIES}
DESTINATION ${BIN_INSTALL_DIR}
)
diff --git a/twin/compton-tde/common.h b/twin/compton-tde/common.h
index 44be226a5..6f61e7822 100644
--- a/twin/compton-tde/common.h
+++ b/twin/compton-tde/common.h
@@ -106,12 +106,15 @@
#include <X11/extensions/Xdamage.h>
#include <X11/extensions/Xrender.h>
#include <X11/extensions/shape.h>
-#include <X11/extensions/Xrandr.h>
#include <X11/extensions/Xdbe.h>
#ifdef CONFIG_XSYNC
#include <X11/extensions/sync.h>
#endif
+#ifdef CONFIG_XRANDR
+#include <X11/extensions/Xrandr.h>
+#endif
+
#ifdef CONFIG_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
@@ -921,12 +924,14 @@ typedef struct _session_t {
int shape_event;
/// Error base number for X Shape extension.
int shape_error;
+#ifdef CONFIG_XRANDR
/// Whether X RandR extension exists.
bool randr_exists;
/// Event base number for X RandR extension.
int randr_event;
/// Error base number for X RandR extension.
int randr_error;
+#endif // CONFIG_XRANDR
#ifdef CONFIG_VSYNC_OPENGL
/// Whether X GLX extension exists.
bool glx_exists;
diff --git a/twin/compton-tde/compton.c b/twin/compton-tde/compton.c
index 123703a19..2c467e2c4 100644
--- a/twin/compton-tde/compton.c
+++ b/twin/compton-tde/compton.c
@@ -4543,6 +4543,7 @@ ev_shape_notify(session_t *ps, XShapeEvent *ev) {
update_reg_ignore_expire(ps, w);
}
+#ifdef CONFIG_XRANDR
/**
* Handle ScreenChangeNotify events from X RandR extension.
*/
@@ -4561,6 +4562,7 @@ ev_screen_change_notify(session_t *ps,
}
}
}
+#endif // CONFIG_XRANDR
#if defined(DEBUG_EVENTS) || defined(DEBUG_RESTACK)
/**
@@ -4659,10 +4661,12 @@ ev_handle(session_t *ps, XEvent *ev) {
ev_shape_notify(ps, (XShapeEvent *) ev);
break;
}
+#ifdef CONFIG_XRANDR
if (ps->randr_exists && ev->type == (ps->randr_event + RRScreenChangeNotify)) {
ev_screen_change_notify(ps, (XRRScreenChangeNotifyEvent *) ev);
break;
}
+#endif // CONFIG_XRANDR
if (isdamagenotify(ps, ev)) {
ev_damage_notify(ps, (XDamageNotifyEvent *) ev);
break;
@@ -4762,9 +4766,14 @@ usage(int ret) {
" Detect _NET_WM_OPACITY on client windows, useful for window\n"
" managers not passing _NET_WM_OPACITY of client windows to frame\n"
" windows.\n"
+#ifndef CONFIG_XRANDR
+#define WARNING " (AUTODETECTION DISABLED AT COMPILE TIME)"
+#else
+#define WARNING
+#endif
"--refresh-rate val\n"
" Specify refresh rate of the screen. If not specified or 0, compton\n"
- " will try detecting this with X RandR extension.\n"
+ " will try detecting this with X RandR extension."WARNING"\n"
"--vsync vsync-method\n"
" Set VSync method. There are up to 4 VSync methods currently available.\n"
" none = No VSync\n"
@@ -6259,6 +6268,7 @@ init_atoms(session_t *ps) {
ps->atom_win_type_tde_transparent_to_desktop = get_atom(ps, "_TDE_TRANSPARENT_TO_DESKTOP");
}
+#ifdef CONFIG_XRANDR
/**
* Update refresh rate info with X Randr extension.
*/
@@ -6277,6 +6287,7 @@ update_refresh_rate(session_t *ps) {
else
ps->refresh_intv = 0;
}
+#endif // CONFIG_XRANDR
/**
* Initialize refresh-rated based software optimization.
@@ -6291,10 +6302,12 @@ swopti_init(session_t *ps) {
if (ps->refresh_rate)
ps->refresh_intv = US_PER_SEC / ps->refresh_rate;
+#ifdef CONFIG_XRANDR
// Auto-detect refresh rate otherwise
if (!ps->refresh_rate && ps->randr_exists) {
update_refresh_rate(ps);
}
+#endif // CONFIG_XRANDR
// Turn off vsync_sw if we can't get the refresh rate
if (!ps->refresh_rate)
@@ -7196,9 +7209,11 @@ session_init(session_t *ps_old, int argc, char **argv) {
.shape_exists = false,
.shape_event = 0,
.shape_error = 0,
+#ifdef CONFIG_XRANDR
.randr_exists = 0,
.randr_event = 0,
.randr_error = 0,
+#endif // CONFIG_XRANDR
#ifdef CONFIG_VSYNC_OPENGL
.glx_exists = false,
.glx_event = 0,
@@ -7371,11 +7386,15 @@ session_init(session_t *ps_old, int argc, char **argv) {
// Query X RandR
if ((ps->o.sw_opti && !ps->o.refresh_rate) || ps->o.xinerama_shadow_crop) {
- if (XRRQueryExtension(ps->dpy, &ps->randr_event, &ps->randr_error))
- ps->randr_exists = true;
- else
- printf_errf("(): No XRandR extension, automatic screen change "
- "detection impossible.");
+#ifdef CONFIG_XRANDR
+ if (XRRQueryExtension(ps->dpy, &ps->randr_event, &ps->randr_error))
+ ps->randr_exists = true;
+ else
+ printf_errf("(): No XRandR extension, automatic screen change "
+ "detection impossible.");
+#else // CONFIG_XRANDR
+ printf_errf("(): Xrandr support not compiled in.");
+#endif // CONFIG_XRANDR
}
// Query X DBE extension
@@ -7435,11 +7454,21 @@ session_init(session_t *ps_old, int argc, char **argv) {
if (ps->o.sw_opti)
ps->o.sw_opti = swopti_init(ps);
+#ifdef CONFIG_XRANDR
// Monitor screen changes if vsync_sw is enabled and we are using
// an auto-detected refresh rate, or when Xinerama features are enabled
if (ps->randr_exists && ((ps->o.sw_opti && !ps->o.refresh_rate)
- || ps->o.xinerama_shadow_crop))
- XRRSelectInput(ps->dpy, ps->root, RRScreenChangeNotifyMask);
+ || ps->o.xinerama_shadow_crop))
+ XRRSelectInput(ps->dpy, ps->root, RRScreenChangeNotifyMask);
+#else
+ if( (ps->o.sw_opti && !ps->o.refresh_rate) ) {
+ printf_errf("(): Xrandr support not compiled in. Plese specify --refrash-rate manually");
+ }
+ if (ps->o.xinerama_shadow_crop) {
+ printf_errf("(): due to Xrandr support not compiled in."
+ " Xinerama features may malfunction on changing screen size.");
+ }
+#endif // CONFIG_XRANDR
// Initialize VSync
if (!vsync_init(ps))
diff --git a/twin/compton-tde/compton_config.h.cmake b/twin/compton-tde/compton_config.h.cmake
index 06db4caf4..a77d93b57 100644
--- a/twin/compton-tde/compton_config.h.cmake
+++ b/twin/compton-tde/compton_config.h.cmake
@@ -32,5 +32,7 @@
// Whether to enable GLX Sync support.
#cmakedefine CONFIG_GLX_XSYNC 1
+// Whether to enable Xranr support
+#cmakedefine CONFIG_XRANDR 1
// Whether to enable Xinerama support
#cmakedefine CONFIG_XINERAMA 1