[mouse] Fix uninitialized vars

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-03-28 13:22:26 +01:00
parent 18117e8495
commit ffe6186fa4
1 changed files with 43 additions and 38 deletions

81
mouse.c
View File

@ -161,10 +161,10 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
ocy = geometry.y; ocy = geometry.y;
c->ismax = False; c->ismax = False;
style = globalconf.screens[c->screen].styles.focus;
if(c->isfloating || layout->arrange == layout_floating) if(c->isfloating || layout->arrange == layout_floating)
{ {
style = globalconf.screens[c->screen].styles.focus;
sw = simplewindow_new(globalconf.display, c->phys_screen, 0, 0, sw = simplewindow_new(globalconf.display, c->phys_screen, 0, 0,
draw_textwidth(globalconf.display, draw_textwidth(globalconf.display,
globalconf.screens[c->screen].styles.focus.font, globalconf.screens[c->screen].styles.focus.font,
@ -257,50 +257,51 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
Client *c = globalconf.focus->client; Client *c = globalconf.focus->client;
Tag **curtags = tags_get_current(screen); Tag **curtags = tags_get_current(screen);
Layout *layout = curtags[0]->layout; Layout *layout = curtags[0]->layout;
area_t area = { 0, 0, 0, 0, NULL, NULL }, geometry; area_t area = { 0, 0, 0, 0, NULL, NULL }, geometry = { 0, 0, 0, 0, NULL, NULL };
double mwfact; double mwfact;
SimpleWindow *sw = NULL; SimpleWindow *sw = NULL;
DrawCtx *ctx = NULL; DrawCtx *ctx = NULL;
style_t style; style_t style;
/* only handle floating and tiled layouts */ /* only handle floating and tiled layouts */
if(c && !c->isfixed) if(!c || c->isfixed)
return;
style = globalconf.screens[c->screen].styles.focus;
if(layout->arrange == layout_floating || c->isfloating)
{ {
if(layout->arrange == layout_floating || c->isfloating) ocx = c->geometry.x;
{ ocy = c->geometry.y;
ocx = c->geometry.x; c->ismax = False;
ocy = c->geometry.y;
c->ismax = False;
style = globalconf.screens[c->screen].styles.focus;
sw = simplewindow_new(globalconf.display, c->phys_screen, 0, 0, sw = simplewindow_new(globalconf.display, c->phys_screen, 0, 0,
draw_textwidth(globalconf.display, draw_textwidth(globalconf.display,
globalconf.screens[c->screen].styles.focus.font, globalconf.screens[c->screen].styles.focus.font,
"0000x0000+0000+0000") + style.font->height, "0000x0000+0000+0000") + style.font->height,
1.5 * style.font->height, 0); 1.5 * style.font->height, 0);
ctx = draw_context_new(globalconf.display, sw->phys_screen, ctx = draw_context_new(globalconf.display, sw->phys_screen,
sw->geometry.width, sw->geometry.height, sw->geometry.width, sw->geometry.height,
sw->drawable); sw->drawable);
XMapRaised(globalconf.display, sw->window); XMapRaised(globalconf.display, sw->window);
mouse_resizebar_update(ctx, style, sw, geometry, c->border); mouse_resizebar_update(ctx, style, sw, geometry, c->border);
} }
else if (layout->arrange == layout_tile || layout->arrange == layout_tileleft else if (layout->arrange == layout_tile || layout->arrange == layout_tileleft
|| layout->arrange == layout_tilebottom || layout->arrange == layout_tiletop) || layout->arrange == layout_tilebottom || layout->arrange == layout_tiletop)
{ {
for(n = 0, c = globalconf.clients; c; c = c->next) for(n = 0, c = globalconf.clients; c; c = c->next)
if(IS_TILED(c, screen)) if(IS_TILED(c, screen))
n++; n++;
if(n <= curtags[0]->nmaster) return; if(n <= curtags[0]->nmaster) return;
for(c = globalconf.clients; c && !IS_TILED(c, screen); c = c->next); for(c = globalconf.clients; c && !IS_TILED(c, screen); c = c->next);
if(!c) return; if(!c) return;
area = screen_get_area(screen, area = screen_get_area(screen,
globalconf.screens[c->screen].statusbar, globalconf.screens[c->screen].statusbar,
&globalconf.screens[c->screen].padding); &globalconf.screens[c->screen].padding);
}
} }
else else
return; return;
@ -313,13 +314,17 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
return; return;
if(curtags[0]->layout->arrange == layout_tileleft) if(curtags[0]->layout->arrange == layout_tileleft)
XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0, 0, c->geometry.height + c->border - 1); XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0, 0,
c->geometry.height + c->border - 1);
else if(curtags[0]->layout->arrange == layout_tilebottom) else if(curtags[0]->layout->arrange == layout_tilebottom)
XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0, c->geometry.width + c->border - 1, c->geometry.height + c->border - 1); XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0,
c->geometry.width + c->border - 1, c->geometry.height + c->border - 1);
else if(curtags[0]->layout->arrange == layout_tiletop) else if(curtags[0]->layout->arrange == layout_tiletop)
XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0, c->geometry.width + c->border - 1, 0); XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0,
c->geometry.width + c->border - 1, 0);
else else
XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0, c->geometry.width + c->border - 1, c->geometry.height + c->border - 1); XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0,
c->geometry.width + c->border - 1, c->geometry.height + c->border - 1);
for(;;) for(;;)
{ {