From d5e3a25bbcf444c62b8372ce56deaa9865c5cb73 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 30 Sep 2009 15:59:02 +0200 Subject: [PATCH] xwindow: check that window exists before setting opacity Signed-off-by: Julien Danjou --- xwindow.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/xwindow.c b/xwindow.c index c35b23ea..a8704b35 100644 --- a/xwindow.c +++ b/xwindow.c @@ -183,14 +183,17 @@ xwindow_get_opacity_from_reply(xcb_get_property_reply_t *prop_r) void xwindow_set_opacity(xcb_window_t win, double opacity) { - if(opacity >= 0 && opacity <= 1) + if(win) { - uint32_t real_opacity = opacity * 0xffffffff; - xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, win, - _NET_WM_WINDOW_OPACITY, CARDINAL, 32, 1L, &real_opacity); + if(opacity >= 0 && opacity <= 1) + { + uint32_t real_opacity = opacity * 0xffffffff; + xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, win, + _NET_WM_WINDOW_OPACITY, CARDINAL, 32, 1L, &real_opacity); + } + else + xcb_delete_property(globalconf.connection, win, _NET_WM_WINDOW_OPACITY); } - else - xcb_delete_property(globalconf.connection, win, _NET_WM_WINDOW_OPACITY); } /** Send WM_TAKE_FOCUS client message to window