add support for _NET_CURRENT_DESKTOP messages

This commit is contained in:
Julien Danjou 2007-12-28 22:16:27 +01:00
parent 9ec91d37c0
commit f8300c5523
3 changed files with 30 additions and 17 deletions

6
ewmh.c
View File

@ -265,6 +265,12 @@ void
ewmh_process_client_message(XClientMessageEvent *ev)
{
Client *c;
int screen;
if(ev->message_type == net_current_desktop)
for(screen = 0; screen < ScreenCount(globalconf.display); screen++)
if(ev->window == RootWindow(globalconf.display, screen))
tag_view(screen, ev->data.l[0]);
if(ev->message_type == net_close_window)
{

40
tag.c
View File

@ -301,6 +301,27 @@ uicb_tag_toggleview(int screen, char *arg)
ewmh_update_net_current_desktop(get_phys_screen(screen));
}
void
tag_view(int screen, int dindex)
{
Tag *target_tag, *tag;
if(dindex < 0)
return;
for(target_tag = globalconf.screens[screen].tags; target_tag && dindex > 0;
target_tag = target_tag->next, dindex--);
if(target_tag)
{
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
tag->selected = False;
target_tag->selected = True;
}
saveawesomeprops(screen);
arrange(screen);
ewmh_update_net_current_desktop(get_phys_screen(screen));
}
/** View tag
* \param screen Screen ID
* \param arg tag to view
@ -309,28 +330,13 @@ uicb_tag_toggleview(int screen, char *arg)
void
uicb_tag_view(int screen, char *arg)
{
int i;
Tag *tag, *target_tag;
Tag *tag;
if(arg)
{
i = atoi(arg) - 1;
for(target_tag = globalconf.screens[screen].tags; target_tag && i > 0;
target_tag = target_tag->next, i--);
if(target_tag)
{
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
tag->selected = False;
target_tag->selected = True;
}
}
tag_view(screen, atoi(arg) - 1);
else
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
tag->selected = True;
saveawesomeprops(screen);
arrange(screen);
ewmh_update_net_current_desktop(get_phys_screen(screen));
}
/** View previously selected tags

1
tag.h
View File

@ -33,6 +33,7 @@ void untag_client(Client *, Tag *);
Bool is_client_tagged(Client *, Tag *);
void tag_client_with_current_selected(Client *);
void tag_client_with_rules(Client *);
void tag_view(int, int);
UICB_PROTO(uicb_client_tag);
UICB_PROTO(uicb_client_togglefloating);