introduce Layout var

This commit is contained in:
Julien Danjou 2008-01-12 23:25:36 +01:00
parent e0d87ae0d9
commit 641d5fb9b1
1 changed files with 8 additions and 11 deletions

19
mouse.c
View File

@ -48,19 +48,17 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
XEvent ev; XEvent ev;
Area area, geometry; Area area, geometry;
Client *c = globalconf.focus->client; Client *c = globalconf.focus->client;
Tag **curtags = get_current_tags(screen); Layout *layout = get_current_layout(screen);
if(!c) if(!c)
return; return;
if((curtags[0]->layout->arrange != layout_floating) if(layout->arrange != layout_floating
&& !c->isfloating) && !c->isfloating)
uicb_client_togglefloating(screen, (char *) "be nice"); uicb_client_togglefloating(screen, (char *) "be nice");
else else
restack(screen); restack(screen);
p_delete(&curtags);
area = get_screen_area(c->screen, area = get_screen_area(c->screen,
globalconf.screens[screen].statusbar, globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding); &globalconf.screens[screen].padding);
@ -126,21 +124,21 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
XEvent ev; XEvent ev;
Client *c = globalconf.focus->client; Client *c = globalconf.focus->client;
Tag **curtags = get_current_tags(screen); Tag **curtags = get_current_tags(screen);
Layout *layout = curtags[0]->layout;
Area area = { 0, 0, 0, 0 }, geometry; Area area = { 0, 0, 0, 0 }, geometry;
double mwfact; double mwfact;
/* only handle floating and tiled layouts */ /* only handle floating and tiled layouts */
if(c && !c->isfixed) if(c && !c->isfixed)
{ {
if((curtags[0]->layout->arrange == layout_floating) || c->isfloating) if(layout->arrange == layout_floating || c->isfloating)
{ {
restack(screen); restack(screen);
ocx = c->geometry.x; ocx = c->geometry.x;
ocy = c->geometry.y; ocy = c->geometry.y;
c->ismax = False; c->ismax = False;
} }
else if (curtags[0]->layout->arrange == layout_tile else if (layout->arrange == layout_tile || layout->arrange == layout_tileleft)
|| curtags[0]->layout->arrange == layout_tileleft)
{ {
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))
@ -188,7 +186,7 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
handle_event_maprequest(&ev); handle_event_maprequest(&ev);
break; break;
case MotionNotify: case MotionNotify:
if(curtags[0]->layout->arrange == layout_floating || c->isfloating) if(layout->arrange == layout_floating || c->isfloating)
{ {
if((geometry.width = ev.xmotion.x - ocx - 2 * c->border + 1) <= 0) if((geometry.width = ev.xmotion.x - ocx - 2 * c->border + 1) <= 0)
geometry.width = 1; geometry.width = 1;
@ -198,10 +196,9 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
geometry.y = c->geometry.y; geometry.y = c->geometry.y;
client_resize(c, geometry, True); client_resize(c, geometry, True);
} }
else if(curtags[0]->layout->arrange == layout_tile else if(layout->arrange == layout_tile || layout->arrange == layout_tileleft)
|| curtags[0]->layout->arrange == layout_tileleft)
{ {
if(curtags[0]->layout->arrange == layout_tile) if(layout->arrange == layout_tile)
mwfact = (double) (ev.xmotion.x - area.x) / area.width; mwfact = (double) (ev.xmotion.x - area.x) / area.width;
else else
mwfact = 1 - (double) (ev.xmotion.x - area.x) / area.width; mwfact = 1 - (double) (ev.xmotion.x - area.x) / area.width;