mirror of
https://github.com/Raymo111/i3lock-color.git
synced 2024-11-11 13:50:52 -05:00
Properly free the reply of xcb_get_geometry
This commit is contained in:
parent
57585bef70
commit
6ea3fbdc21
1 changed files with 11 additions and 7 deletions
18
i3lock.c
18
i3lock.c
|
@ -391,20 +391,24 @@ static void handle_mapping_notify(xcb_mapping_notify_event_t *event) {
|
||||||
* and also redraw the image, if any.
|
* and also redraw the image, if any.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void handle_screen_resize(xcb_window_t win, uint32_t* last_resolution) {
|
void handle_screen_resize() {
|
||||||
xcb_get_geometry_cookie_t geomc;
|
xcb_get_geometry_cookie_t geomc;
|
||||||
xcb_get_geometry_reply_t *geom;
|
xcb_get_geometry_reply_t *geom;
|
||||||
geomc = xcb_get_geometry(conn, screen->root);
|
geomc = xcb_get_geometry(conn, screen->root);
|
||||||
if ((geom = xcb_get_geometry_reply(conn, geomc, 0)) == NULL) {
|
if ((geom = xcb_get_geometry_reply(conn, geomc, 0)) == NULL)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (last_resolution[0] == geom->width && last_resolution[1] == geom->height)
|
if (last_resolution[0] == geom->width &&
|
||||||
return;
|
last_resolution[1] == geom->height) {
|
||||||
|
free(geom);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
last_resolution[0] = geom->width;
|
last_resolution[0] = geom->width;
|
||||||
last_resolution[1] = geom->height;
|
last_resolution[1] = geom->height;
|
||||||
|
|
||||||
|
free(geom);
|
||||||
|
|
||||||
#ifndef NOLIBCAIRO
|
#ifndef NOLIBCAIRO
|
||||||
redraw_screen();
|
redraw_screen();
|
||||||
#endif
|
#endif
|
||||||
|
@ -523,7 +527,7 @@ static void xcb_check_cb(EV_P_ ev_check *w, int revents) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == XCB_CONFIGURE_NOTIFY) {
|
if (type == XCB_CONFIGURE_NOTIFY) {
|
||||||
handle_screen_resize(win, last_resolution);
|
handle_screen_resize();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue