Make xinerama mandatory

Fixes #116

Also tweaks the usage message a bit.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-02-18 21:04:01 +00:00
parent b2750b26e0
commit 2a41847aa6
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
8 changed files with 26 additions and 68 deletions

View File

@ -1,5 +1,4 @@
option('sanitize', type: 'boolean', value: false, description: 'Compile compton with sanitizers')
option('xinerama', type: 'boolean', value: true, description: 'Enable XINERAMA support')
option('config_file', type: 'boolean', value: true, description: 'Enable config file support')
option('regex', type: 'boolean', value: true, description: 'Enable regex support in window conditions')

View File

@ -118,7 +118,6 @@ static void compose(void *backend_data, session_t *ps, win *w, void *win_data, i
// content, and destroying it.
pixman_region32_intersect(&reg_tmp, &reg_tmp, (region_t *)reg_paint);
#ifdef CONFIG_XINERAMA
if (ps->o.xinerama_shadow_crop && w->xinerama_scr >= 0 && w->xinerama_scr < ps->xinerama_nscrs)
// There can be a window where number of screens is updated,
// but the screen number attached to the windows have not.
@ -127,7 +126,6 @@ static void compose(void *backend_data, session_t *ps, win *w, void *win_data, i
// just check to make sure we don't access out of bounds.
pixman_region32_intersect(
&reg_tmp, &reg_tmp, &ps->xinerama_scr_regs[w->xinerama_scr]);
#endif
// Mask out the body of the window from the shadow
// Doing it here instead of in make_shadow() for saving GPU

View File

@ -45,10 +45,7 @@
#include <xcb/randr.h>
#include <xcb/shape.h>
#include <xcb/sync.h>
#ifdef CONFIG_XINERAMA
#include <xcb/xinerama.h>
#endif
#include <ev.h>
#include <pixman.h>
@ -489,7 +486,6 @@ typedef struct session {
/// Error base number for X GLX extension.
int glx_error;
#endif
#ifdef CONFIG_XINERAMA
/// Whether X Xinerama extension exists.
bool xinerama_exists;
/// Xinerama screen info.
@ -498,7 +494,6 @@ typedef struct session {
region_t *xinerama_scr_regs;
/// Number of Xinerama screens.
int xinerama_nscrs;
#endif
/// Whether X Sync extension exists.
bool xsync_exists;
/// Event base number for X Sync extension.

View File

@ -15,7 +15,7 @@ cflags = []
required_package = [
'x11', 'x11-xcb', 'xcb-renderutil',
'xcb-render', 'xcb-damage', 'xcb-randr', 'xcb-sync',
'xcb-composite', 'xcb-shape', 'xcb-image',
'xcb-composite', 'xcb-shape', 'xcb-image', 'xcb-xinerama',
'xcb-xfixes', 'xcb-present', 'xext', 'pixman-1'
]
@ -25,11 +25,6 @@ endforeach
deps = []
if get_option('xinerama')
deps += [dependency('xcb-xinerama', required: true)]
cflags += ['-DCONFIG_XINERAMA']
endif
if get_option('config_file')
deps += [dependency('libconfig', version: '>=1.4', required: true),
dependency('libxdg-basedir', required: true)]

View File

@ -24,7 +24,6 @@
*/
static void usage(int ret) {
#define WARNING_DISABLED " (DISABLED AT COMPILE TIME)"
#define WARNING
static const char *usage_text =
"compton (" COMPTON_VERSION ")\n"
"This is the maintenance fork of compton, please report\n"
@ -87,16 +86,13 @@ static void usage(int ret) {
"--show-all-xerrors\n"
" Show all X errors (for debugging).\n"
"\n"
#undef WARNING
#ifndef CONFIG_LIBCONFIG
#define WARNING WARNING_DISABLED
#else
#define WARNING
#endif
"--config path\n"
" Look for configuration file at the path. Use /dev/null to avoid\n"
" loading configuration file." WARNING "\n"
"\n"
" loading configuration file."
#ifndef CONFIG_LIBCONFIG
WARNING_DISABLED
#endif
"\n\n"
"--write-pid-path path\n"
" Write process ID to a file.\n"
"\n"
@ -162,15 +158,12 @@ static void usage(int ret) {
" Set VSync method. There are (up to) 5 VSync methods currently\n"
" available:\n"
" none = No VSync\n"
#undef WARNING
#ifndef CONFIG_VSYNC_DRM
#define WARNING WARNING_DISABLED
#else
#define WARNING
#endif
" drm = VSync with DRM_IOCTL_WAIT_VBLANK. May only work on some\n"
" (DRI-based) drivers." WARNING "\n"
#undef WARNING
" (DRI-based) drivers."
#ifndef CONFIG_VSYNC_DRM
WARNING_DISABLED
#endif
"\n\n"
#ifndef CONFIG_OPENGL
#define WARNING WARNING_DISABLED
#else
@ -182,7 +175,7 @@ static void usage(int ret) {
" Only work on some drivers." WARNING "\n"
" opengl-swc = Enable driver-level VSync. Works only with GLX "
"backend." WARNING "\n"
" opengl-mswc = Deprecated, use opengl-swc instead." WARNING "\n"
#undef WARNING
"\n"
"--vsync-aggressive\n"
" Attempt to send painting request before VBlank and do XFlush()\n"
@ -291,27 +284,18 @@ static void usage(int ret) {
" should not be painted in, such as a dock window region.\n"
" Use --shadow-exclude-reg \'x10+0-0\', for example, if the 10 pixels\n"
" on the bottom of the screen should not have shadows painted on.\n"
#undef WARNING
#ifndef CONFIG_XINERAMA
#define WARNING WARNING_DISABLED
#else
#define WARNING
#endif
"\n"
"--xinerama-shadow-crop\n"
" Crop shadow of a window fully on a particular Xinerama screen to the\n"
" screen." WARNING "\n"
" screen.\n"
"\n"
#undef WARNING
#ifndef CONFIG_OPENGL
#define WARNING "(GLX BACKENDS DISABLED AT COMPILE TIME)"
#else
#define WARNING
#endif
"--backend backend\n"
" Choose backend. Possible choices are xrender, glx, and\n"
" xr_glx_hybrid" WARNING ".\n"
"\n"
" xr_glx_hybrid."
#ifndef CONFIG_OPENGL
" (GLX BACKENDS DISABLED AT COMPILE TIME)"
#endif
"\n\n"
"--glx-no-stencil\n"
" GLX backend: Avoid using stencil buffer. Might cause issues\n"
" when rendering transparent content. My tests show a 15% performance\n"
@ -338,27 +322,22 @@ static void usage(int ret) {
"--xrender-sync\n"
" Attempt to synchronize client applications' draw calls with XSync(),\n"
" used on GLX backend to ensure up-to-date window content is painted.\n"
#undef WARNING
#define WARNING
"\n"
"--xrender-sync-fence\n"
" Additionally use X Sync fence to sync clients' draw calls. Needed\n"
" on nvidia-drivers with GLX backend for some users." WARNING "\n"
" on nvidia-drivers with GLX backend for some users.\n"
"\n"
"--force-win-blend\n"
" Force all windows to be painted with blending. Useful if you have a\n"
" --glx-fshader-win that could turn opaque pixels transparent.\n"
"\n"
#undef WARNING
#ifndef CONFIG_DBUS
#define WARNING WARNING_DISABLED
#else
#define WARNING
#endif
"--dbus\n"
" Enable remote control via D-Bus. See the D-BUS API section in the\n"
" man page for more details." WARNING "\n"
"\n"
" man page for more details."
#ifndef CONFIG_DBUS
WARNING_DISABLED
#endif
"\n\n"
"--benchmark cycles\n"
" Benchmark mode. Repeatedly paint until reaching the specified cycles.\n"
"\n"
@ -370,7 +349,6 @@ static void usage(int ret) {
" backend only.\n";
FILE *f = (ret ? stderr : stdout);
fputs(usage_text, f);
#undef WARNING
#undef WARNING_DISABLED
}

View File

@ -897,7 +897,6 @@ void paint_all(session_t *ps, win *const t, bool ignore_damage) {
if (!ps->o.wintype_option[w->window_type].full_shadow)
pixman_region32_subtract(&reg_tmp, &reg_tmp, &bshape);
#ifdef CONFIG_XINERAMA
if (ps->o.xinerama_shadow_crop && w->xinerama_scr >= 0 &&
w->xinerama_scr < ps->xinerama_nscrs)
// There can be a window where number of screens
@ -910,7 +909,6 @@ void paint_all(session_t *ps, win *const t, bool ignore_damage) {
pixman_region32_intersect(
&reg_tmp, &reg_tmp,
&ps->xinerama_scr_regs[w->xinerama_scr]);
#endif
// Detect if the region is empty before painting
if (pixman_region32_not_empty(&reg_tmp)) {

View File

@ -778,9 +778,7 @@ bool add_win(session_t *ps, xcb_window_t id, xcb_window_t prev) {
.id = XCB_NONE,
.a = {},
#ifdef CONFIG_XINERAMA
.xinerama_scr = -1,
#endif
.pictfmt = NULL,
.mode = WMODE_TRANS,
.ever_damaged = false,
@ -1464,10 +1462,10 @@ win_check_fade_finished(session_t *ps, win **_w) {
*
* Return an index >= 0, or -1 if not found.
*
* XXX move to x.c
* TODO move to x.c
* TODO use xrandr
*/
void win_update_screen(session_t *ps, win *w) {
#ifdef CONFIG_XINERAMA
w->xinerama_scr = -1;
if (!ps->xinerama_scrs)
@ -1484,7 +1482,6 @@ void win_update_screen(session_t *ps, win *w) {
return;
}
}
#endif
}
// TODO remove this

View File

@ -134,10 +134,8 @@ struct win {
/// Window attributes.
xcb_get_window_attributes_reply_t a;
xcb_get_geometry_reply_t g;
#ifdef CONFIG_XINERAMA
/// Xinerama screen this window is on.
int xinerama_scr;
#endif
/// Window visual pict format;
const xcb_render_pictforminfo_t *pictfmt;
/// Window painting mode.