From 2a41847aa666d728099743a5f1353e0a8b5613a0 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Mon, 18 Feb 2019 21:04:01 +0000 Subject: [PATCH] Make xinerama mandatory Fixes #116 Also tweaks the usage message a bit. Signed-off-by: Yuxuan Shui --- meson_options.txt | 1 - src/backend/xrender.c | 2 -- src/common.h | 5 ---- src/meson.build | 7 +---- src/options.c | 68 +++++++++++++++---------------------------- src/render.c | 2 -- src/win.c | 7 ++--- src/win.h | 2 -- 8 files changed, 26 insertions(+), 68 deletions(-) diff --git a/meson_options.txt b/meson_options.txt index c2dd63d..1672344 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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') diff --git a/src/backend/xrender.c b/src/backend/xrender.c index b03fc55..79bbf63 100644 --- a/src/backend/xrender.c +++ b/src/backend/xrender.c @@ -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(®_tmp, ®_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( ®_tmp, ®_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 diff --git a/src/common.h b/src/common.h index d6f0ab0..788b28c 100644 --- a/src/common.h +++ b/src/common.h @@ -45,10 +45,7 @@ #include #include #include - -#ifdef CONFIG_XINERAMA #include -#endif #include #include @@ -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. diff --git a/src/meson.build b/src/meson.build index 86cafee..9d73bc3 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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)] diff --git a/src/options.c b/src/options.c index ed83078..7b199bb 100644 --- a/src/options.c +++ b/src/options.c @@ -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 } diff --git a/src/render.c b/src/render.c index edf440b..db8292d 100644 --- a/src/render.c +++ b/src/render.c @@ -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(®_tmp, ®_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( ®_tmp, ®_tmp, &ps->xinerama_scr_regs[w->xinerama_scr]); -#endif // Detect if the region is empty before painting if (pixman_region32_not_empty(®_tmp)) { diff --git a/src/win.c b/src/win.c index 2f78fe3..4124a3f 100644 --- a/src/win.c +++ b/src/win.c @@ -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 diff --git a/src/win.h b/src/win.h index 391f384..7f94b4b 100644 --- a/src/win.h +++ b/src/win.h @@ -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.