all: Fix tag bug, add wmfs hint (_WMFS_TAG_NAMES, _WMFS_CURRENT_LAYOUT...)

This commit is contained in:
Martin Duquesnoy 2008-12-19 20:08:22 +01:00
parent 4904011168
commit aba1d341f8
9 changed files with 48 additions and 18 deletions

View File

@ -420,7 +420,7 @@ client_manage(Window w, XWindowAttributes *wa)
setwinstate(c->win, NormalState);
ewmh_get_client_list();
ewmh_manage_window_type(c);
arrange();
arrange(c->screen);
return;
}
@ -670,7 +670,7 @@ client_unmanage(Client *c)
XSync(dpy, False);
XUngrabServer(dpy);
ewmh_get_client_list();
arrange();
arrange(c->screen);
XFree(c->title);
free(c);

View File

@ -120,7 +120,6 @@ clientmessageevent(XClientMessageEvent *ev)
else if(mess_t == net_active_window)
if((c = client_gb_win((Window)ev->data.l[0])))
client_focus(c);
}
/* Manage _NET_WM_STATE */
@ -131,6 +130,11 @@ clientmessageevent(XClientMessageEvent *ev)
if(mess_t == net_close_window)
if((c = client_gb_win(ev->window)))
client_kill(c);
/* Manage _NET_WM_DESKTOP */
if(mess_t == net_wm_desktop)
if((c = client_gb_win(ev->window)))
tag_transfert(c, ev->data.l[0]);
return;
}
@ -360,7 +364,7 @@ propertynotify(XPropertyEvent *ev)
case XA_WM_TRANSIENT_FOR:
XGetTransientForHint(dpy, c->win, &trans);
if((c->tile || c->max) && (c->hint = (client_gb_win(trans) != NULL)))
arrange();
arrange(c->screen);
break;
case XA_WM_NORMAL_HINTS:
client_size_hints(c);

View File

@ -42,17 +42,18 @@
void
ewmh_init_hints(void)
{
/* EWMH hints */
net_atom[net_supported] = ATOM("_NET_SUPPORTED");
net_atom[net_client_list] = ATOM("_NET_CLIENT_LIST");
net_atom[net_number_of_desktops] = ATOM("_NET_NUMBER_OF_DESKTOPS");
net_atom[net_current_desktop] = ATOM("_NET_CURRENT_DESKTOP");
net_atom[net_desktop_names] = ATOM("_NET_DESKTOP_NAMES");
net_atom[net_desktop_names_string] = ATOM("_NET_DESKTOP_NAMES_STRING");
net_atom[net_desktop_geometry] = ATOM("_NET_DESKTOP_GEOMETRY");
net_atom[net_workarea] = ATOM("_NET_WORKAREA");
net_atom[net_active_window] = ATOM("_NET_ACTIVE_WINDOW");
net_atom[net_close_window] = ATOM("_NET_CLOSE_WINDOW");
net_atom[net_wm_name] = ATOM("_NET_WM_NAME");
net_atom[net_wm_desktop] = ATOM("_NET_WM_DESKTOP");
net_atom[net_wm_icon_name] = ATOM("_NET_WM_ICON_NAME");
net_atom[net_wm_window_type] = ATOM("_NET_WM_WINDOW_TYPE");
net_atom[net_wm_window_type_normal] = ATOM("_NET_WM_WINDOW_TYPE_NORMAL");
@ -66,6 +67,9 @@ ewmh_init_hints(void)
net_atom[net_wm_state_fullscreen] = ATOM("_NET_WM_STATE_FULLSCREEN");
net_atom[net_wm_state_demands_attention] = ATOM("_NET_WM_STATE_DEMANDS_ATTENTION");
net_atom[utf8_string] = ATOM("UTF8_STRING");
/* WMFS hints */
net_atom[wmfs_tag_names] = ATOM("_WMFS_TAG_NAMES");
net_atom[wmfs_current_layout] = ATOM("_WMFS_CURRENT_LAYOUT");
XChangeProperty(dpy, ROOT, net_atom[net_supported], XA_ATOM, 32,
PropModeReplace, (uchar*)net_atom, net_last);
@ -106,6 +110,19 @@ ewmh_get_current_desktop(void)
return;
}
/** Manage _WMFS_CURRENT_LAYOUT
*/
void
ewmh_get_current_layout(void)
{
XChangeProperty(dpy, ROOT, net_atom[wmfs_current_layout], XA_STRING, 8,
PropModeReplace, (uchar*)tags[selscreen][seltag[selscreen]].layout.symbol,
strlen(tags[selscreen][seltag[selscreen]].layout.symbol));
return;
}
/** Get _NET_CLIENT_LIST
*/
void
@ -154,7 +171,8 @@ ewmh_get_desktop_names(void)
XChangeProperty(dpy, ROOT, net_atom[net_desktop_names], net_atom[utf8_string], 8,
PropModeReplace, (uchar*)str, pos);
XChangeProperty(dpy, ROOT, net_atom[net_desktop_names_string], XA_STRING, 8,
/* _WMFS_TAG_NAMES */
XChangeProperty(dpy, ROOT, net_atom[wmfs_tag_names], XA_STRING, 8,
PropModeReplace, (uchar*)str, pos);
free(str);

View File

@ -206,7 +206,7 @@ uicb_infobar_togglepos(uicb_t cmd)
infobar_draw(selscreen);
ewmh_set_workarea();
arrange();
arrange(selscreen);
return;
}

View File

@ -35,14 +35,12 @@
/** Arrange All
*/
void
arrange(void)
arrange(int screen)
{
Client *c;
screen_get_sel();
for(c = clients; c; c = c->next)
if(c->screen == selscreen)
if(c->screen == screen)
{
if(!ishide(c))
client_unhide(c);
@ -50,8 +48,9 @@ arrange(void)
client_hide(c);
}
tags[selscreen][seltag[selscreen]].layout.func();
infobar_draw(selscreen);
tags[screen][seltag[screen]].layout.func();
infobar_draw(screen);
ewmh_get_current_layout();
return;
}
@ -100,6 +99,7 @@ layoutswitch(Bool b)
break;
}
}
ewmh_get_current_layout();
tags[selscreen][seltag[selscreen]].layout.func();
infobar_draw(selscreen);

View File

@ -57,7 +57,6 @@ enum
net_number_of_desktops,
net_current_desktop,
net_desktop_names,
net_desktop_names_string,
net_desktop_geometry,
net_workarea,
net_active_window,
@ -68,6 +67,7 @@ enum
net_wm_window_type_dock,
net_wm_window_type_splash,
net_wm_window_type_dialog,
net_wm_desktop,
net_wm_icon,
net_wm_state,
net_wm_state_sticky,
@ -75,6 +75,9 @@ enum
net_wm_state_fullscreen,
net_wm_state_demands_attention,
utf8_string,
/* WMFS HINTS */
wmfs_tag_names,
wmfs_current_layout,
net_last
};
typedef enum { Top, Bottom, Right, Left, Center, PositionLast } Position;

View File

@ -61,7 +61,7 @@ tag_set(int tag)
seltag[selscreen] = tag;
}
ewmh_get_current_desktop();
arrange();
arrange(selscreen);
client_focus(NULL);
return;
@ -84,7 +84,7 @@ tag_transfert(Client *c, int tag)
c->tag = tag;
arrange();
arrange(c->screen);
if(c == sel)
client_focus(NULL);
@ -114,6 +114,8 @@ uicb_tag(uicb_t cmd)
void
uicb_tag_next(uicb_t cmd)
{
screen_get_sel();
tag_set(seltag[selscreen] + 1);
return;
@ -125,6 +127,8 @@ uicb_tag_next(uicb_t cmd)
void
uicb_tag_prev(uicb_t cmd)
{
screen_get_sel();
tag_set(seltag[selscreen] - 1);
return;

View File

@ -206,7 +206,7 @@ scan(void)
&& wa.map_state == IsViewable)
client_manage(w[i], &wa);
XFree(w);
arrange();
arrange(screen_get_sel());
return;
}

View File

@ -144,6 +144,7 @@ void uicb_client_kill(uicb_t);
void ewmh_init_hints(void);
void ewmh_get_number_of_desktop(void);
void ewmh_get_current_desktop(void);
void ewmh_get_current_layout(void);
void ewmh_get_client_list(void);
void ewmh_get_desktop_names(void);
void ewmh_set_desktop_geometry(void);
@ -224,7 +225,7 @@ void uicb_screen_next(uicb_t cmd);
void uicb_screen_prev(uicb_t cmd);
/* layout.c */
void arrange(void);
void arrange(int screen);
void freelayout(void);
void layoutswitch(Bool b);
void maxlayout(void);