From 863714f501fe0e219553b861ffd7e0acceef080e Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 11 Oct 2007 23:44:35 +0200 Subject: [PATCH] use p_delete instead of XFree for our own pointers --- awesome.c | 2 +- client.c | 4 ++-- event.c | 19 +++++++++++++------ layout.c | 6 +++--- screen.c | 8 ++++---- statusbar.c | 2 +- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/awesome.c b/awesome.c index ea1fb937..0935ecc3 100644 --- a/awesome.c +++ b/awesome.c @@ -112,7 +112,7 @@ getstate(Display *disp, Window w) return -1; if(n != 0) result = *p; - XFree(p); + p_delete(&p); return result; } diff --git a/client.c b/client.c index 2c71e77c..aa77266e 100644 --- a/client.c +++ b/client.c @@ -407,7 +407,7 @@ manage(Display *disp, Window w, XWindowAttributes *wa, awesome_config *awesomeco c->y = c->ry = si->y_org; c->border = awesomeconf->borderpx; } - XFree(si); + p_delete(&si); wc.border_width = c->border; XConfigureWindow(disp, w, CWBorderWidth, &wc); XSetWindowBorder(disp, w, awesomeconf->colors_normal[ColBorder].pixel); @@ -493,7 +493,7 @@ resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf, Bool x = si->width - w - 2 * c->border; if(y > si->height) y = si->height - h - 2 * c->border; - XFree(si); + p_delete(&si); if(x + w + 2 * c->border < 0) x = 0; if(y + h + 2 * c->border < 0) diff --git a/event.c b/event.c index 4737b9c9..bc1d3885 100644 --- a/event.c +++ b/event.c @@ -97,7 +97,7 @@ movemouse(Client * c, awesome_config *awesomeconf) break; } } - XFree(si); + p_delete(&si); } static void @@ -311,15 +311,22 @@ handle_event_configurenotify(XEvent * e, awesome_config *awesomeconf) DisplayWidth(e->xany.display, screen) = ev->width; DisplayHeight(e->xany.display, screen) = ev->height; - si = get_screen_info(e->xany.display, screen, NULL); + /* update statusbar */ XFreePixmap(e->xany.display, awesomeconf[screen].statusbar.drawable); + + si = get_screen_info(e->xany.display, screen, NULL); + awesomeconf[screen].statusbar.width = si[screen].width; + p_delete(&si); + awesomeconf[screen].statusbar.drawable = XCreatePixmap(e->xany.display, RootWindow(e->xany.display, screen), - si[screen].width, + awesomeconf[screen].statusbar.width, awesomeconf[screen].statusbar.height, DefaultDepth(e->xany.display, screen)); - XResizeWindow(e->xany.display, awesomeconf[screen].statusbar.window, - si[screen].width, awesomeconf[screen].statusbar.height); - XFree(si); + XResizeWindow(e->xany.display, + awesomeconf[screen].statusbar.window, + awesomeconf[screen].statusbar.width, + awesomeconf[screen].statusbar.height); + updatebarpos(e->xany.display, awesomeconf[screen].statusbar); arrange(e->xany.display, &awesomeconf[screen]); } diff --git a/layout.c b/layout.c index ab7c62a8..4c462097 100644 --- a/layout.c +++ b/layout.c @@ -237,7 +237,7 @@ uicb_togglemax(awesome_config *awesomeconf, si[awesomeconf->screen].width - 2 * awesomeconf->borderpx, si[awesomeconf->screen].height - 2 * awesomeconf->borderpx, awesomeconf); - XFree(si); + p_delete(&si); } void @@ -252,7 +252,7 @@ uicb_toggleverticalmax(awesome_config *awesomeconf, (*awesomeconf->client_sel)->w, si[awesomeconf->screen].height - 2 * awesomeconf->borderpx, awesomeconf); - XFree(si); + p_delete(&si); } @@ -268,7 +268,7 @@ uicb_togglehorizontalmax(awesome_config *awesomeconf, si[awesomeconf->screen].height - 2 * awesomeconf->borderpx, (*awesomeconf->client_sel)->h, awesomeconf); - XFree(si); + p_delete(&si); } void diff --git a/screen.c b/screen.c index e79c998c..da179c8f 100644 --- a/screen.c +++ b/screen.c @@ -106,11 +106,11 @@ get_screen_bycoord(Display *disp, int x, int y) if(x >= si[i].x_org && x < si[i].x_org + si[i].width && y >= si[i].y_org && y < si[i].y_org + si[i].height) { - XFree(si); + p_delete(&si); return i; } - XFree(si); + p_delete(&si); return DefaultScreen(disp); } @@ -167,7 +167,7 @@ move_client_to_screen(Client *c, awesome_config *acf_new, Bool doresize) c->ry = si[c->screen].y_org; if(doresize) resize(c, c->rx, c->ry, c->rw, c->rh, acf_new, True); - XFree(si); + p_delete(&si); } /** Move mouse pointer to x_org and y_xorg of specified screen @@ -181,7 +181,7 @@ move_mouse_pointer_to_screen(Display *disp, int screen) { ScreenInfo *si = get_screen_info(disp, screen, NULL); XWarpPointer(disp, None, DefaultRootWindow(disp), 0, 0, 0, 0, si[screen].x_org, si[screen].y_org); - XFree(si); + p_delete(&si); } else XWarpPointer(disp, None, RootWindow(disp, screen), 0, 0, 0, 0, 0, 0); diff --git a/statusbar.c b/statusbar.c index 806ebb32..0cd10c1e 100644 --- a/statusbar.c +++ b/statusbar.c @@ -231,7 +231,7 @@ updatebarpos(Display *disp, Statusbar statusbar) XMoveWindow(disp, statusbar.window, si[statusbar.screen].x_org, si[statusbar.screen].y_org - statusbar.height); break; } - XFree(si); + p_delete(&si); XSync(disp, False); while(XCheckMaskEvent(disp, EnterWindowMask, &ev)); }