From 6352cdbc3ec05df36dd9087aaf59ddecdcb0031a Mon Sep 17 00:00:00 2001 From: Reginald Kennedy Date: Fri, 29 Nov 2019 16:19:39 +0800 Subject: [PATCH] Cleanup unneeded get_screen() calls. --- spectrwm.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/spectrwm.c b/spectrwm.c index 26f2e0d..eebd3fe 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -5,7 +5,7 @@ * Copyright (c) 2009 Pierre-Yves Ritschard * Copyright (c) 2010 Tuukka Kataja * Copyright (c) 2011 Jason L. Wright - * Copyright (c) 2011-2018 Reginald Kennedy + * Copyright (c) 2011-2019 Reginald Kennedy * Copyright (c) 2011-2012 Lawrence Teo * Copyright (c) 2011-2012 Tiago Cunha * Copyright (c) 2012-2015 David Hill @@ -861,7 +861,6 @@ struct cursors { {"top_right_corner", XC_top_right_corner, XCB_CURSOR_NONE}, }; - #define SWM_TEXTFRAGS_MAX (SWM_BAR_MAX/4) struct text_fragment { char *text; @@ -2021,10 +2020,6 @@ debug_refresh(struct ws_win *win) if (debug_enabled) { /* Create debug window if it doesn't exist. */ if (win->debug == XCB_WINDOW_NONE) { - if (get_screen(win->s->idx) == NULL) - errx(1, "ERROR: can't get screen %d.", - win->s->idx); - win->debug = xcb_generate_id(conn); wc[0] = win->s->c[SWM_S_COLOR_BAR].pixel; wc[1] = win->s->c[SWM_S_COLOR_BAR_BORDER].pixel; @@ -3740,9 +3735,6 @@ bar_setup(struct swm_region *r) DNPRINTF(SWM_D_BAR, "screen %d.\n", r->s->idx); - if (get_screen(r->s->idx) == NULL) - errx(1, "ERROR: can't get screen %d.", r->s->idx); - if (r->bar != NULL) return; @@ -6849,7 +6841,6 @@ search_win(struct binding *bp, struct swm_region *r, union arg *args) struct search_window *sw = NULL; xcb_window_t w; uint32_t wa[3]; - xcb_screen_t *screen; int i, width, height; char s[11]; FILE *lfile; @@ -6872,9 +6863,6 @@ search_win(struct binding *bp, struct swm_region *r, union arg *args) if ((lfile = fdopen(select_list_pipe[1], "w")) == NULL) return; - if ((screen = get_screen(r->s->idx)) == NULL) - errx(1, "ERROR: can't get screen %d.", r->s->idx); - i = 1; TAILQ_FOREACH(win, &r->ws->winlist, entry) { if (ICONIC(win)) @@ -6932,7 +6920,6 @@ search_win(struct binding *bp, struct swm_region *r, union arg *args) XFreeGC(display, l_draw); } else { - draw = XftDrawCreate(display, w, r->s->xvisual, r->s->colormap); @@ -10773,6 +10760,7 @@ get_ws_idx(struct ws_win *win) void reparent_window(struct ws_win *win) { + xcb_screen_t *s; xcb_void_cookie_t c; xcb_generic_error_t *error; uint32_t wa[3]; @@ -10781,7 +10769,6 @@ reparent_window(struct ws_win *win) DNPRINTF(SWM_D_MISC, "win %#x, frame: %#x\n", win->id, win->frame); - struct xcb_screen_t *s; if ((s = get_screen(win->s->idx)) == NULL) errx(1, "ERROR: can't get screen %d.", win->s->idx); wa[0] = s->black_pixel;