From e142993bb51047f84773531ed58963b600c0e799 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sat, 3 Nov 2018 14:04:18 +0000 Subject: [PATCH] Enable paint-on-overlay whenever possible Signed-off-by: Yuxuan Shui --- src/common.h | 5 +---- src/compton.c | 14 ++++++-------- src/config_libconfig.c | 5 +++-- src/dbus.c | 2 +- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/common.h b/src/common.h index d8538630..a601b449 100644 --- a/src/common.h +++ b/src/common.h @@ -465,9 +465,6 @@ typedef struct options_t { bool fork_after_register; /// Whether to detect rounded corners. bool detect_rounded_corners; - /// Whether to paint on X Composite overlay window instead of root - /// window. - bool paint_on_overlay; /// Force painting of window content with blending. bool force_win_blend; /// Resize damage for a specific number of pixels. @@ -1371,7 +1368,7 @@ get_atom(session_t *ps, const char *atom_name) { */ static inline Window get_tgt_window(session_t *ps) { - return ps->o.paint_on_overlay ? ps->overlay: ps->root; + return ps->overlay != XCB_NONE ? ps->overlay: ps->root; } /** diff --git a/src/compton.c b/src/compton.c index f086eb5b..ab777ed7 100644 --- a/src/compton.c +++ b/src/compton.c @@ -3869,7 +3869,9 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) { case 272: printf_errf("(): use of --dbe is deprecated"); break; - P_CASEBOOL(273, paint_on_overlay); + case 273: + printf_errf("(): --paint-on-overlay is removed, and is enabled when possible"); + break; P_CASEBOOL(274, sw_opti); P_CASEBOOL(275, vsync_aggressive); P_CASEBOOL(276, use_ewmh_active_win); @@ -4494,11 +4496,9 @@ init_overlay(session_t *ps) { // xcb_unmap_window(c, ps->overlay); // XFlush(ps->dpy); } - else { + else fprintf(stderr, "Cannot get X Composite overlay window. Falling " "back to painting on root window.\n"); - ps->o.paint_on_overlay = false; - } #ifdef DEBUG_REDIR printf_dbgf("(): overlay = %#010lx\n", ps->overlay); #endif @@ -4842,7 +4842,6 @@ session_init(session_t *ps_old, int argc, char **argv) { .fork_after_register = false, .synchronize = false, .detect_rounded_corners = false, - .paint_on_overlay = false, .resize_damage = 0, .unredir_if_possible = false, .unredir_if_possible_blacklist = NULL, @@ -5160,8 +5159,7 @@ session_init(session_t *ps_old, int argc, char **argv) { // Overlay must be initialized before double buffer, and before creation // of OpenGL context. - if (ps->o.paint_on_overlay) - init_overlay(ps); + init_overlay(ps); // Initialize OpenGL as early as possible if (bkend_use_glx(ps)) { @@ -5217,7 +5215,7 @@ session_init(session_t *ps_old, int argc, char **argv) { ps->root_picture = x_create_picture_with_visual_and_pixmap(ps, ps->vis, ps->root, XCB_RENDER_CP_SUBWINDOW_MODE, &pa); - if (ps->o.paint_on_overlay) { + if (ps->overlay != XCB_NONE) { ps->tgt_picture = x_create_picture_with_visual_and_pixmap(ps, ps->vis, ps->overlay, XCB_RENDER_CP_SUBWINDOW_MODE, &pa); } else diff --git a/src/config_libconfig.c b/src/config_libconfig.c index 13d612a2..e50bea24 100644 --- a/src/config_libconfig.c +++ b/src/config_libconfig.c @@ -297,8 +297,6 @@ parse_config(session_t *ps, struct options_tmp *pcfgtmp) { exit(1); // --alpha-step config_lookup_float(&cfg, "alpha-step", &ps->o.alpha_step); - // --paint-on-overlay - lcfg_lookup_bool(&cfg, "paint-on-overlay", &ps->o.paint_on_overlay); // --sw-opti lcfg_lookup_bool(&cfg, "sw-opti", &ps->o.sw_opti); // --use-ewmh-active-win @@ -359,6 +357,9 @@ parse_config(session_t *ps, struct options_tmp *pcfgtmp) { if (lcfg_lookup_bool(&cfg, "clear-shadow", &bval)) printf_errf("(): \"clear-shadow\" is removed as an option, and is always" " enabled now. Consider removing it from your config file"); + if (lcfg_lookup_bool(&cfg, "paint-on-overlay", &bval)) + printf_errf("(): \"paint-on-overlay\" has been removed as an option, and " + "is enabled whenever possible"); const char *deprecation_message = "has been removed. If you encounter problems " "without this feature, please feel free to open a bug report."; diff --git a/src/dbus.c b/src/dbus.c index a226c056..fe453e06 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -885,7 +885,7 @@ cdbus_process_opts_get(session_t *ps, DBusMessage *msg) { cdbus_m_opts_get_do(mark_ovredir_focused, cdbus_reply_bool); cdbus_m_opts_get_do(fork_after_register, cdbus_reply_bool); cdbus_m_opts_get_do(detect_rounded_corners, cdbus_reply_bool); - cdbus_m_opts_get_do(paint_on_overlay, cdbus_reply_bool); + cdbus_m_opts_get_stub(paint_on_overlay, cdbus_reply_bool, ps->overlay != XCB_NONE); // paint_on_overlay_id: Get ID of the X composite overlay window if (!strcmp("paint_on_overlay_id", target)) { cdbus_reply_uint32(ps, msg, ps->overlay);