From bcbc410c927bf1f7b72b3536911b3c9621ba92fc Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Mon, 24 Jan 2022 18:35:45 +0000 Subject: [PATCH] Deprecate the refresh-rate options It's meaningless without the sw-opti option, which has been deprecated since v6. Signed-off-by: Yuxuan Shui --- man/picom.1.asciidoc | 3 --- picom.sample.conf | 6 ------ src/common.h | 4 ---- src/config.c | 1 - src/config.h | 2 -- src/config_libconfig.c | 16 +++++++--------- src/dbus.c | 2 +- src/options.c | 10 ++++------ src/picom.c | 21 --------------------- src/picom.h | 2 -- 10 files changed, 12 insertions(+), 55 deletions(-) diff --git a/man/picom.1.asciidoc b/man/picom.1.asciidoc index cb830770..e885de97 100644 --- a/man/picom.1.asciidoc +++ b/man/picom.1.asciidoc @@ -130,9 +130,6 @@ OPTIONS *--detect-client-opacity*:: Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows. -*--refresh-rate* 'REFRESH_RATE':: - Specify refresh rate of the screen. If not specified or 0, picom will try detecting this with X RandR extension. - *--vsync*, *--no-vsync*:: Enable/disable VSync. diff --git a/picom.sample.conf b/picom.sample.conf index e62251e4..777cf0d0 100644 --- a/picom.sample.conf +++ b/picom.sample.conf @@ -241,12 +241,6 @@ detect-rounded-corners = true; # detect-client-opacity = false detect-client-opacity = true; -# Specify refresh rate of the screen. If not specified or 0, picom will -# try detecting this with X RandR extension. -# -# refresh-rate = 60 -refresh-rate = 0; - # Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window, # rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, # provided that the WM supports it. diff --git a/src/common.h b/src/common.h index 1b11c276..f6353b0d 100644 --- a/src/common.h +++ b/src/common.h @@ -295,10 +295,6 @@ typedef struct session { region_t shadow_exclude_reg; // === Software-optimization-related === - /// Currently used refresh rate. - int refresh_rate; - /// Interval between refresh in nanoseconds. - long refresh_intv; /// Nanosecond offset of the first painting. long paint_tm_offset; diff --git a/src/config.c b/src/config.c index 3fd11b48..90324778 100644 --- a/src/config.c +++ b/src/config.c @@ -527,7 +527,6 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable, .benchmark_wid = XCB_NONE, .logpath = NULL, - .refresh_rate = 0, .use_damage = true, .shadow_red = 0.0, diff --git a/src/config.h b/src/config.h index 1c317949..03ef74b3 100644 --- a/src/config.h +++ b/src/config.h @@ -130,8 +130,6 @@ typedef struct options { win_option_t wintype_option[NUM_WINTYPES]; // === VSync & software optimization === - /// User-specified refresh rate. - int refresh_rate; /// VSync method to use; bool vsync; /// Whether to use glFinish() instead of glFlush() for (possibly) better diff --git a/src/config_libconfig.c b/src/config_libconfig.c index ada4b96c..da4d2afd 100644 --- a/src/config_libconfig.c +++ b/src/config_libconfig.c @@ -303,6 +303,11 @@ static inline void parse_wintype_config(const config_t *cfg, const char *member_ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shadow_enable, bool *fading_enable, bool *conv_kern_hasneg, win_option_mask_t *winopt_mask) { + + const char *deprecation_message = + "option has been deprecated. Please remove it from your configuration file. " + "If you encounter any problems without this feature, please feel free to " + "open a bug report"; char *path = NULL; FILE *f; config_t cfg; @@ -451,11 +456,8 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad // --detect-client-opacity lcfg_lookup_bool(&cfg, "detect-client-opacity", &opt->detect_client_opacity); // --refresh-rate - if (config_lookup_int(&cfg, "refresh-rate", &opt->refresh_rate)) { - if (opt->refresh_rate < 0) { - log_warn("Invalid refresh rate %d, fallback to 0", opt->refresh_rate); - opt->refresh_rate = 0; - } + if (config_lookup_int(&cfg, "refresh-rate", &ival)) { + log_warn("The refresh-rate %s", deprecation_message); } // --vsync if (config_lookup_string(&cfg, "vsync", &sval)) { @@ -620,10 +622,6 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad log_warn("\"clear-shadow\" is removed as an option, and is always" " enabled now. Consider removing it from your config file"); - const char *deprecation_message attr_unused = - "has been removed. If you encounter problems " - "without this feature, please feel free to open a bug report"; - config_setting_t *blur_cfg = config_lookup(&cfg, "blur"); if (blur_cfg) { if (config_setting_lookup_string(blur_cfg, "method", &sval)) { diff --git a/src/dbus.c b/src/dbus.c index 5b2468cf..e3f79b18 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -1005,7 +1005,7 @@ static bool cdbus_process_opts_get(session_t *ps, DBusMessage *msg) { cdbus_m_opts_get_do(stoppaint_force, cdbus_reply_enum); cdbus_m_opts_get_do(logpath, cdbus_reply_string); - cdbus_m_opts_get_do(refresh_rate, cdbus_reply_int32); + cdbus_m_opts_get_stub(refresh_rate, cdbus_reply_int32, 0); cdbus_m_opts_get_stub(sw_opti, cdbus_reply_bool, false); cdbus_m_opts_get_do(vsync, cdbus_reply_bool); if (!strcmp("backend", target)) { diff --git a/src/options.c b/src/options.c index ccd45b64..5ab443fe 100644 --- a/src/options.c +++ b/src/options.c @@ -160,10 +160,6 @@ static void usage(const char *argv0, int ret) { " managers not passing _NET_WM_WINDOW_OPACITY of client windows to frame\n" " windows.\n" "\n" - "--refresh-rate val\n" - " Specify refresh rate of the screen. If not specified or 0, we\n" - " will try detecting this with X RandR extension.\n" - "\n" "--vsync\n" " Enable VSync\n" "\n" @@ -641,7 +637,10 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, P_CASEBOOL(266, shadow_ignore_shaped); P_CASEBOOL(267, detect_rounded_corners); P_CASEBOOL(268, detect_client_opacity); - P_CASEINT(269, refresh_rate); + case 269: + log_warn("--refresh-rate has been deprecated, please remove it from" + "your command line options"); + break; case 270: if (optarg) { opt->vsync = parse_vsync(optarg); @@ -912,7 +911,6 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, opt->inactive_dim = normalize_d(opt->inactive_dim); opt->frame_opacity = normalize_d(opt->frame_opacity); opt->shadow_opacity = normalize_d(opt->shadow_opacity); - opt->refresh_rate = normalize_i_range(opt->refresh_rate, 0, 300); opt->max_brightness = normalize_d(opt->max_brightness); if (opt->max_brightness < 1.0) { diff --git a/src/picom.c b/src/picom.c index 56deb7ef..12d8b385 100644 --- a/src/picom.c +++ b/src/picom.c @@ -1084,24 +1084,6 @@ static inline bool write_pid(session_t *ps) { return true; } -/** - * Update refresh rate info with X Randr extension. - */ -void update_refresh_rate(session_t *ps) { - xcb_randr_get_screen_info_reply_t *randr_info = xcb_randr_get_screen_info_reply( - ps->c, xcb_randr_get_screen_info(ps->c, ps->root), NULL); - - if (!randr_info) - return; - ps->refresh_rate = randr_info->rate; - free(randr_info); - - if (ps->refresh_rate) - ps->refresh_intv = US_PER_SEC / ps->refresh_rate; - else - ps->refresh_intv = 0; -} - /** * Initialize X composite overlay window. */ @@ -1592,9 +1574,6 @@ static session_t *session_init(int argc, char **argv, Display *dpy, .white_picture = XCB_NONE, .gaussian_map = NULL, - .refresh_rate = 0, - .refresh_intv = 0UL, - #ifdef CONFIG_VSYNC_DRM .drm_fd = -1, #endif diff --git a/src/picom.h b/src/picom.h index 25f75806..0ba04dda 100644 --- a/src/picom.h +++ b/src/picom.h @@ -40,8 +40,6 @@ uint32_t determine_evmask(session_t *ps, xcb_window_t wid, win_evmode_t mode); void circulate_win(session_t *ps, xcb_circulate_notify_event_t *ce); -void update_refresh_rate(session_t *ps); - void root_damaged(session_t *ps); void cxinerama_upd_scrs(session_t *ps);