use p_delete instead of XFree for our own pointers

This commit is contained in:
Julien Danjou 2007-10-11 23:44:35 +02:00
parent 17cf2c230d
commit 863714f501
6 changed files with 24 additions and 17 deletions

View File

@ -112,7 +112,7 @@ getstate(Display *disp, Window w)
return -1; return -1;
if(n != 0) if(n != 0)
result = *p; result = *p;
XFree(p); p_delete(&p);
return result; return result;
} }

View File

@ -407,7 +407,7 @@ manage(Display *disp, Window w, XWindowAttributes *wa, awesome_config *awesomeco
c->y = c->ry = si->y_org; c->y = c->ry = si->y_org;
c->border = awesomeconf->borderpx; c->border = awesomeconf->borderpx;
} }
XFree(si); p_delete(&si);
wc.border_width = c->border; wc.border_width = c->border;
XConfigureWindow(disp, w, CWBorderWidth, &wc); XConfigureWindow(disp, w, CWBorderWidth, &wc);
XSetWindowBorder(disp, w, awesomeconf->colors_normal[ColBorder].pixel); 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; x = si->width - w - 2 * c->border;
if(y > si->height) if(y > si->height)
y = si->height - h - 2 * c->border; y = si->height - h - 2 * c->border;
XFree(si); p_delete(&si);
if(x + w + 2 * c->border < 0) if(x + w + 2 * c->border < 0)
x = 0; x = 0;
if(y + h + 2 * c->border < 0) if(y + h + 2 * c->border < 0)

19
event.c
View File

@ -97,7 +97,7 @@ movemouse(Client * c, awesome_config *awesomeconf)
break; break;
} }
} }
XFree(si); p_delete(&si);
} }
static void static void
@ -311,15 +311,22 @@ handle_event_configurenotify(XEvent * e, awesome_config *awesomeconf)
DisplayWidth(e->xany.display, screen) = ev->width; DisplayWidth(e->xany.display, screen) = ev->width;
DisplayHeight(e->xany.display, screen) = ev->height; 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); 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), awesomeconf[screen].statusbar.drawable = XCreatePixmap(e->xany.display, RootWindow(e->xany.display, screen),
si[screen].width, awesomeconf[screen].statusbar.width,
awesomeconf[screen].statusbar.height, awesomeconf[screen].statusbar.height,
DefaultDepth(e->xany.display, screen)); DefaultDepth(e->xany.display, screen));
XResizeWindow(e->xany.display, awesomeconf[screen].statusbar.window, XResizeWindow(e->xany.display,
si[screen].width, awesomeconf[screen].statusbar.height); awesomeconf[screen].statusbar.window,
XFree(si); awesomeconf[screen].statusbar.width,
awesomeconf[screen].statusbar.height);
updatebarpos(e->xany.display, awesomeconf[screen].statusbar); updatebarpos(e->xany.display, awesomeconf[screen].statusbar);
arrange(e->xany.display, &awesomeconf[screen]); arrange(e->xany.display, &awesomeconf[screen]);
} }

View File

@ -237,7 +237,7 @@ uicb_togglemax(awesome_config *awesomeconf,
si[awesomeconf->screen].width - 2 * awesomeconf->borderpx, si[awesomeconf->screen].width - 2 * awesomeconf->borderpx,
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx, si[awesomeconf->screen].height - 2 * awesomeconf->borderpx,
awesomeconf); awesomeconf);
XFree(si); p_delete(&si);
} }
void void
@ -252,7 +252,7 @@ uicb_toggleverticalmax(awesome_config *awesomeconf,
(*awesomeconf->client_sel)->w, (*awesomeconf->client_sel)->w,
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx, si[awesomeconf->screen].height - 2 * awesomeconf->borderpx,
awesomeconf); awesomeconf);
XFree(si); p_delete(&si);
} }
@ -268,7 +268,7 @@ uicb_togglehorizontalmax(awesome_config *awesomeconf,
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx, si[awesomeconf->screen].height - 2 * awesomeconf->borderpx,
(*awesomeconf->client_sel)->h, (*awesomeconf->client_sel)->h,
awesomeconf); awesomeconf);
XFree(si); p_delete(&si);
} }
void void

View File

@ -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 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) && y >= si[i].y_org && y < si[i].y_org + si[i].height)
{ {
XFree(si); p_delete(&si);
return i; return i;
} }
XFree(si); p_delete(&si);
return DefaultScreen(disp); 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; c->ry = si[c->screen].y_org;
if(doresize) if(doresize)
resize(c, c->rx, c->ry, c->rw, c->rh, acf_new, True); 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 /** 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); 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); XWarpPointer(disp, None, DefaultRootWindow(disp), 0, 0, 0, 0, si[screen].x_org, si[screen].y_org);
XFree(si); p_delete(&si);
} }
else else
XWarpPointer(disp, None, RootWindow(disp, screen), 0, 0, 0, 0, 0, 0); XWarpPointer(disp, None, RootWindow(disp, screen), 0, 0, 0, 0, 0, 0);

View File

@ -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); XMoveWindow(disp, statusbar.window, si[statusbar.screen].x_org, si[statusbar.screen].y_org - statusbar.height);
break; break;
} }
XFree(si); p_delete(&si);
XSync(disp, False); XSync(disp, False);
while(XCheckMaskEvent(disp, EnterWindowMask, &ev)); while(XCheckMaskEvent(disp, EnterWindowMask, &ev));
} }