Fix e22b1e2a73, size was set too late, and fix memory leak with *si

This commit is contained in:
Julien Danjou 2007-10-11 19:29:34 +02:00
parent 1fa1ce1c93
commit f840f532e3
1 changed files with 8 additions and 5 deletions

View File

@ -190,6 +190,9 @@ initstatusbar(Display *disp, int screen, Statusbar *statusbar, Cursor cursor, Xf
statusbar->screen = screen; statusbar->screen = screen;
si = get_screen_info(disp, screen, NULL); si = get_screen_info(disp, screen, NULL);
statusbar->width = si[screen].width;
statusbar->height = font->height + 2;
p_delete(&si);
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask; | EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
@ -197,19 +200,19 @@ initstatusbar(Display *disp, int screen, Statusbar *statusbar, Cursor cursor, Xf
wa.override_redirect = 1; wa.override_redirect = 1;
wa.background_pixmap = ParentRelative; wa.background_pixmap = ParentRelative;
wa.event_mask = ButtonPressMask | ExposureMask; wa.event_mask = ButtonPressMask | ExposureMask;
statusbar->window = XCreateWindow(disp, RootWindow(disp, phys_screen), 0, 0, si[screen].width, statusbar->window = XCreateWindow(disp, RootWindow(disp, phys_screen), 0, 0,
statusbar->height, 0, DefaultDepth(disp, phys_screen), CopyFromParent, statusbar->width,
statusbar->height,
0, DefaultDepth(disp, phys_screen), CopyFromParent,
DefaultVisual(disp, phys_screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); DefaultVisual(disp, phys_screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
XDefineCursor(disp, statusbar->window, cursor); XDefineCursor(disp, statusbar->window, cursor);
updatebarpos(disp, *statusbar); updatebarpos(disp, *statusbar);
XMapRaised(disp, statusbar->window); XMapRaised(disp, statusbar->window);
statusbar->drawable = XCreatePixmap(disp, statusbar->drawable = XCreatePixmap(disp,
RootWindow(disp, phys_screen), RootWindow(disp, phys_screen),
si[screen].width, statusbar->width,
statusbar->height, statusbar->height,
DefaultDepth(disp, phys_screen)); DefaultDepth(disp, phys_screen));
statusbar->width = si[screen].width;
statusbar->height = font->height + 2;
} }
void void