void mons_colsplit(void);
void mons_coljoin(void);
void mons_coladjust(Monitor* mon, Column* col, int wdiff);
+void mons_tilemove(Location* loc, int hdiff);
/* client.c */
extern Client* Focused;
void client_readprops(Client* c);
void client_shade(Client* c);
void client_setshade(Client* c, int shade);
+void client_warpmouse(Client* c);
/* mouse.c */
void mouse_down(XButtonEvent* ev, Location* loc);
XUnmapWindow(X.disp, c->win);
}
}
+
+void client_warpmouse(Client* c)
+{
+ XWarpPointer(X.disp, None, c->frame, 0, 0, 0, 0, (c->w/2), (MIN_HEIGHT/2));
+}
{
Monitor* mon = pickmon();
add_client(mon, c, PtrX);
+ client_warpmouse(c);
}
void mons_delclient(Client* c)
}
}
+void mons_tilemove(Location* loc, int hdiff)
+{
+ Monitor* mon = pickmon();
+ Column* col = pickcol(mon->cspace->columns, PtrX);
+ if (loc->monitor != mon || loc->column != col)
+ {
+ remove_client(loc, loc->client);
+ client_setshade(loc->client, 0);
+ if (col->focused)
+ {
+ monocled_add(mon, col,loc->client);
+ }
+ else
+ {
+ stacked_add(mon, col, loc->client);
+ }
+ }
+ else
+ {
+ stacked_addheight(loc->monitor, loc->column, loc->client, hdiff);
+ }
+ client_warpmouse(loc->client);
+ client_focus(loc->client);
+}
+
static Monitor* pickmon(void)
{
get_mouse(&PtrX, &PtrY);
break;
}
}
- assert(mon);
+ mon = (mon ? mon : Monitors);
return mon;
}
for (; col && col->clients; col = col->next);
if (!col)
{
- /* otherwise pick the current column */
+ /* otherwise pick the column to the right or current column */
col = pickcol(mon->cspace->columns, ptrx - mon->x);
+ if (col->next)
+ {
+ col = col->next;
+ }
}
/* add in monocled or stacked mode */
if (col->focused)
}
else if (ev->button == Button3)
{
- monocled_set(loc->monitor, loc->column, loc->client);
+ if (PRESSED(ev->state, Button1))
+ {
+ /* TODO: implement expand in place */
+ puts("expand in place");
+ }
+ else
+ {
+ monocled_set(loc->monitor, loc->column, loc->client);
+ }
}
}
/* TODO: handle button 1 drag to resize, reposition, and move windows */
if (X.mode == M_TILE_RESIZE)
{
- stacked_addheight(loc->monitor, loc->column, loc->client, ev->y_root - X.start_y);
+ mons_tilemove(loc, ev->y_root - X.start_y);
}
else if (X.mode == M_COL_RESIZE)
{
mons_coladjust(loc->monitor, loc->column, ev->x_root - X.start_x);
}
+ else if (loc->column)
+ {
+ }
X.mode = M_IDLE;
}
for (; prev && prev->next != c; prev = prev->next);
if (prev)
{
- amount = (amount == 0 ? (int)(-c->h * 0.25) : amount);
+ amount = (amount == 0 ? min((int)(-c->h * 0.25), -2*MIN_HEIGHT) : amount);
int miny = (prev->y + MIN_HEIGHT);
int maxy = min((mon->y + mon->h) , (c->y + c->h)) - MIN_HEIGHT;
c->y = max(miny, min(maxy, c->y + amount));