Add screen_next/prev uicb function, fix CCOL & screen update at client manage

This commit is contained in:
Martin Duquesnoy 2012-01-17 00:14:33 +01:00
parent 4c06d00be7
commit 334d2d47e3
6 changed files with 52 additions and 3 deletions

View File

@ -825,7 +825,7 @@ client_new(Window w, XWindowAttributes *wa, bool scan)
/* C attributes */
c->win = w;
c->flags = 0;
c->screen = W->screen;
c->screen = screen_update_sel();
c->theme = THEME_DEFAULT;
c->tag = NULL;
c->tabmaster = NULL;

View File

@ -21,7 +21,7 @@ struct client *client_gb_titlebar(Window w);
struct client *client_next_with_pos(struct client *bc, enum position p);
void client_swap2(struct client *c1, struct client *c2);
void client_swap(struct client *c, enum position p);
#define CCOL(c) (c == c->tag->sel ? &c->scol : &c->ncol)
#define CCOL(c) (c == W->client ? &c->scol : &c->ncol)
void client_frame_update(struct client *c, struct colpair *cp);
void client_tab_pull(struct client *c);
void _client_tab(struct client *c, struct client *cm);

View File

@ -16,6 +16,7 @@
#include "client.h"
#include "status.h"
#include "mouse.h"
#include "screen.h"
#define THEME_DEFAULT (SLIST_FIRST(&W->h.theme))
@ -76,6 +77,10 @@ static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
{ "mouse_swap", uicb_mouse_move },
{ "mouse_tab", uicb_mouse_tab },
/* Screen */
{ "screen_next", uicb_screen_next },
{ "screen_prev", uicb_screen_prev },
{ NULL, NULL }
};

View File

@ -88,6 +88,44 @@ screen_update_sel(void)
return W->screen;
}
static void
screen_select(struct screen *s)
{
XWarpPointer(W->dpy, None, W->root, 0, 0, 0, 0,
s->ugeo.x + (s->ugeo.w >> 1),
s->ugeo.y + (s->ugeo.h >> 1));
W->screen = s;
}
void
uicb_screen_next(Uicb cmd)
{
struct screen *s;
(void)cmd;
if(!(s = SLIST_NEXT(W->screen, next)))
s = SLIST_FIRST(&W->h.screen);
screen_select(s);
}
void
uicb_screen_prev(Uicb cmd)
{
struct screen *s;
(void)cmd;
SLIST_FOREACH(s, &W->h.screen, next)
if(SLIST_NEXT(W->screen, next) == s)
{
screen_select(s);
return;
}
screen_select(SLIST_FIRST(&W->h.screen));
}
void
screen_free(void)
{

View File

@ -43,5 +43,8 @@ screen_gb_mouse(void)
void screen_init(void);
struct screen* screen_update_sel(void);
void screen_free(void);
void uicb_screen_next(Uicb cmd);
void uicb_screen_prev(Uicb cmd);
#endif /* SCREEN_H */

5
wmfsrc
View File

@ -130,7 +130,10 @@
#[key] mod = {"Super"} key = "z" func = "tag" cmd = "2" [/key]
[key] mod = {"Control"} key = "Right" func = "tag_next" [/key]
[key] mod = {"Control"} key = "Left" func = "tag_prev" [/key]
[key] mod = {"Control"} key = "Left" func = "tag_prev" [/key]
[key] mod = {"Control"} key = "Up" func = "screen_next" [/key]
[key] mod = {"Control"} key = "Down" func = "screen_prev" [/key]
[key] mod = {"Super"} key = "q" func = "client_close" [/key]