summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-06-26 17:10:29 +0200
committerDave Davenport <qball@gmpclient.org>2016-06-26 17:10:29 +0200
commit4af69764116262697d6c3d4f91b1748308c50daf (patch)
tree7e40cd5fda7bde51ace15f707a91eb8b76c59705
parent6e2d0b63191996b3d247cb535aa9c100c13c7464 (diff)
Fix piece of weird code to fetch background image.
-rw-r--r--source/x11-helper.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/source/x11-helper.c b/source/x11-helper.c
index 55ebd49e..94762172 100644
--- a/source/x11-helper.c
+++ b/source/x11-helper.c
@@ -90,7 +90,7 @@ static xcb_pixmap_t get_root_pixmap ( xcb_connection_t *c,
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
- xcb_pixmap_t *rootpixmap = NULL;
+ xcb_pixmap_t rootpixmap = XCB_NONE;
cookie = xcb_get_property ( c,
0,
@@ -102,17 +102,14 @@ static xcb_pixmap_t get_root_pixmap ( xcb_connection_t *c,
reply = xcb_get_property_reply ( c, cookie, NULL );
- if ( reply &&
- ( xcb_get_property_value_length ( reply ) == sizeof ( xcb_pixmap_t ) ) ) {
- rootpixmap = (xcb_pixmap_t *) xcb_get_property_value ( reply );
- }
- else {
- rootpixmap = XCB_NONE;
+ if ( reply ) {
+ if ( xcb_get_property_value_length ( reply ) == sizeof ( xcb_pixmap_t ) ) {
+ memcpy ( &rootpixmap, xcb_get_property_value ( reply ), sizeof ( xcb_pixmap_t ) );
+ }
+ free ( reply );
}
- free ( reply );
-
- return *rootpixmap;
+ return rootpixmap;
}
cairo_surface_t * x11_helper_get_bg_surface ( void )