From e55c0d48fab32daba096b61d0b63b2fcbfa49ed7 Mon Sep 17 00:00:00 2001 From: okan Date: Sun, 10 Mar 2019 22:53:11 +0000 Subject: use screen_find() for xrandr crtc changes --- xevents.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/xevents.c b/xevents.c index 15f7e10..c5a2aad 100644 --- a/xevents.c +++ b/xevents.c @@ -431,20 +431,17 @@ xev_handle_clientmessage(XEvent *ee) static void xev_handle_randr(XEvent *ee) { - XRRScreenChangeNotifyEvent *rev = (XRRScreenChangeNotifyEvent *)ee; + XRRScreenChangeNotifyEvent *e = (XRRScreenChangeNotifyEvent *)ee; struct screen_ctx *sc; - int i; - LOG_DEBUG3("new size: %d/%d", rev->width, rev->height); + LOG_DEBUG3("size: %d/%d", e->width, e->height); - i = XRRRootToScreen(X_Dpy, rev->root); - TAILQ_FOREACH(sc, &Screenq, entry) { - if (sc->which == i) { - XRRUpdateConfiguration(ee); - screen_update_geometry(sc); - screen_assert_clients_within(sc); - } - } + if ((sc = screen_find(e->root)) == NULL) + return; + + XRRUpdateConfiguration(ee); + screen_update_geometry(sc); + screen_assert_clients_within(sc); } /* -- cgit 1.4.1