Client/Layout: Remove tile_switch uicb function; add client_swap_{next, prev}.

This commit is contained in:
Martin Duquesnoy
2009-07-14 22:59:24 +02:00
parent fe8eba8c54
commit daae7d4764
6 changed files with 82 additions and 18 deletions

View File

@@ -135,6 +135,61 @@ uicb_client_next(uicb_t cmd)
return; return;
} }
/** Swap the current client with the next one
*\param cmd uicb_t type unused
*/
void
uicb_client_swap_next(uicb_t cmd)
{
Client *c = NULL;
if(!sel && !sel->tile)
return;
/* Find the next client */
for(c = sel->next; c && ishide(c, selscreen); c = c->next);
if(!c)
for(c = clients; c && ishide(c, selscreen); c = c->next);
if(c)
{
client_swap(sel, c);
client_focus(c);
}
return;
}
/** Swap the current client with the previous one
*\param cmd uicb_t type unused
*/
void
uicb_client_swap_prev(uicb_t cmd)
{
Client *c = NULL, *d;
if(!sel && !sel->tile)
return;
/* Find the previous client */
for(d = clients; d != sel; d = d->next)
if(!ishide(d, selscreen))
c = d;
if(!c)
for(; d; d = d->next)
if(!ishide(d, selscreen))
c = d;
if(c)
{
client_swap(sel, c);
client_focus(c);
}
return;
}
/** Set the focus to a client /** Set the focus to a client
* \param c Client pointer * \param c Client pointer
*/ */
@@ -570,8 +625,8 @@ client_moveresize(Client *c, XRectangle geo, Bool r)
frame_moveresize(c, c->geo); frame_moveresize(c, c->geo);
XMoveResizeWindow(dpy, c->win, BORDH, TBARH, c->geo.width, XMoveResizeWindow(dpy, c->win, BORDH, TBARH,
c->geo.height); c->geo.width, c->geo.height);
client_configure(c); client_configure(c);
client_update_attributes(c); client_update_attributes(c);
@@ -628,7 +683,7 @@ client_size_hints(Client *c)
c->baseh = size.min_height; c->baseh = size.min_height;
} }
else else
c->basew = c->baseh = 0; c->basew = c->baseh = 1;
/* inc */ /* inc */
if(size.flags & PResizeInc) if(size.flags & PResizeInc)
@@ -637,7 +692,7 @@ client_size_hints(Client *c)
c->inch = size.height_inc; c->inch = size.height_inc;
} }
else else
c->incw = c->inch = 0; c->incw = c->inch = 1;
/* max */ /* max */
if(size.flags & PMaxSize) if(size.flags & PMaxSize)
@@ -646,7 +701,7 @@ client_size_hints(Client *c)
c->maxh = size.max_height; c->maxh = size.max_height;
} }
else else
c->maxw = c->maxh = 0; c->maxw = c->maxh = 1;
/* min */ /* min */
if(size.flags & PMinSize) if(size.flags & PMinSize)
@@ -690,8 +745,7 @@ client_swap(Client *c1, Client *c2)
CHECK(!c1->free); CHECK(!c1->free);
CHECK(!c2->free); CHECK(!c2->free);
if((c1->screen == c2->screen if(c1 == c2 || (c1->screen == c2->screen && c1->tag != c2->tag))
&& c1->tag != c2->tag))
return; return;
/* Swap only the windows */ /* Swap only the windows */

View File

@@ -44,6 +44,8 @@ conf_init_func_list(void)
{"client_kill", uicb_client_kill }, {"client_kill", uicb_client_kill },
{"client_prev", uicb_client_prev }, {"client_prev", uicb_client_prev },
{"client_next", uicb_client_next }, {"client_next", uicb_client_next },
{"client_swap_next", uicb_client_swap_next },
{"client_swap_prev", uicb_client_swap_prev },
{"client_screen_next", uicb_client_screen_next }, {"client_screen_next", uicb_client_screen_next },
{"client_screen_prev", uicb_client_screen_prev }, {"client_screen_prev", uicb_client_screen_prev },
{"toggle_max", uicb_togglemax }, {"toggle_max", uicb_togglemax },
@@ -61,7 +63,6 @@ conf_init_func_list(void)
{"mouse_move", uicb_mouse_move }, {"mouse_move", uicb_mouse_move },
{"mouse_resize", uicb_mouse_resize }, {"mouse_resize", uicb_mouse_resize },
{"client_raise", uicb_client_raise }, {"client_raise", uicb_client_raise },
{"tile_switch", uicb_tile_switch },
{"toggle_free", uicb_togglefree }, {"toggle_free", uicb_togglefree },
{"screen_select", uicb_screen_select }, {"screen_select", uicb_screen_select },
{"screen_next", uicb_screen_next }, {"screen_next", uicb_screen_next },

View File

@@ -79,7 +79,7 @@ mouse_move(Client *c)
xgc.function = GXinvert; xgc.function = GXinvert;
xgc.subwindow_mode = IncludeInferiors; xgc.subwindow_mode = IncludeInferiors;
xgc.line_width = BORDH; xgc.line_width = BORDH;
gci = XCreateGC(dpy, ROOT, GCFunction|GCSubwindowMode|GCLineWidth, &xgc); gci = XCreateGC(dpy, ROOT, GCFunction | GCSubwindowMode | GCLineWidth, &xgc);
if(!c->tile && !c->lmax) if(!c->tile && !c->lmax)
mouse_dragborder(c->geo, gci); mouse_dragborder(c->geo, gci);
@@ -105,7 +105,7 @@ mouse_move(Client *c)
if(c != sclient) if(c != sclient)
{ {
client_swap(c, sclient); client_swap(c, sclient);
break; /* break; */
} }
} }
@@ -199,7 +199,7 @@ mouse_resize(Client *c)
xgc.function = GXinvert; xgc.function = GXinvert;
xgc.subwindow_mode = IncludeInferiors; xgc.subwindow_mode = IncludeInferiors;
xgc.line_width = BORDH; xgc.line_width = BORDH;
gci = XCreateGC(dpy, ROOT, GCFunction|GCSubwindowMode|GCLineWidth, &xgc); gci = XCreateGC(dpy, ROOT, GCFunction | GCSubwindowMode | GCLineWidth, &xgc);
if(!c->tile) if(!c->tile)
{ {

View File

@@ -164,11 +164,13 @@ void client_unmap(Client *c);
void client_set_wanted_tag(Client *c); void client_set_wanted_tag(Client *c);
void client_update_attributes(Client *c); void client_update_attributes(Client *c);
void uicb_client_raise(uicb_t); void uicb_client_raise(uicb_t);
void uicb_client_prev(uicb_t);
void uicb_client_next(uicb_t); void uicb_client_next(uicb_t);
void uicb_client_prev(uicb_t);
void uicb_client_swap_next(uicb_t);
void uicb_client_swap_prev(uicb_t);
void uicb_client_kill(uicb_t); void uicb_client_kill(uicb_t);
void uicb_client_screen_next(uicb_t cmd); void uicb_client_screen_next(uicb_t);
void uicb_client_screen_prev(uicb_t cmd); void uicb_client_screen_prev(uicb_t);
/* ewmh.c */ /* ewmh.c */
void ewmh_init_hints(void); void ewmh_init_hints(void);
@@ -291,7 +293,6 @@ Client *tiled_client(int screen, Client *c);
void mirror_vertical(int screen); void mirror_vertical(int screen);
void mirror_horizontal(int screen); void mirror_horizontal(int screen);
/* }}} */ /* }}} */
void uicb_tile_switch(uicb_t);
void uicb_togglemax(uicb_t); void uicb_togglemax(uicb_t);
void uicb_togglefree(uicb_t); void uicb_togglefree(uicb_t);
void uicb_layout_prev(uicb_t); void uicb_layout_prev(uicb_t);

7
wmfs.1
View File

@@ -133,7 +133,12 @@ Decrease the nmaster (-1)\fR
.PP .PP
\fBAlt + t\fR \fBAlt + t\fR
.RS 4 .RS 4
Switch the current client with the master client\fR Swap the current client with the next\fR
.RE
.PP
\fBAlt\-Shift + t\fR
.RS 4
Swap the current client with the previous\fR
.RE .RE
.PP .PP
\fBAlt + p\fR \fBAlt + p\fR

View File

@@ -186,8 +186,11 @@ keys
# Quit wmfs. # Quit wmfs.
key { mod = {"Control", "Alt", "Shift"} key = "q" func = "quit" } key { mod = {"Control", "Alt", "Shift"} key = "q" func = "quit" }
# Switch current client with master client. # Swap current client with the next.
key { mod = {"Alt"} key = "t" func = "tile_switch" } key { mod = {"Alt"} key = "t" func = "client_swap_next" }
# Swap current client with the previous.
key { mod = {"Alt", "Shift"} key = "t" func = "client_swap_prev" }
# Toggle maximum the selected client. # Toggle maximum the selected client.
key { mod = {"Alt"} key = "m" func = "toggle_max" } key { mod = {"Alt"} key = "m" func = "toggle_max" }