check that loadawesomeprops() set view on at least one tag

This commit is contained in:
Julien Danjou 2008-02-12 15:30:48 +01:00
parent a84eae2700
commit 83e58a3a73
3 changed files with 14 additions and 4 deletions

View file

@ -52,6 +52,7 @@
#include "client.h"
#include "focus.h"
#include "ewmh.h"
#include "tag.h"
#include "common/awclient.h"
#include "common/util.h"
#include "common/awesome-version.h"
@ -309,7 +310,9 @@ main(int argc, char *argv[])
/* do this only for real screen */
for(screen = 0; screen < ScreenCount(dpy); screen++)
{
loadawesomeprops(screen);
/* if loadawesomeprops fails, set view on first tag */
if(!loadawesomeprops(screen))
tag_view(globalconf.screens[screen].tags, True);
ewmh_set_supported_hints(screen);
/* call this to at least grab root window clicks */
window_root_grabbuttons(screen);

View file

@ -111,12 +111,13 @@ layout_get_current(int screen)
return l;
}
void
Bool
loadawesomeprops(int screen)
{
int i, ntags = 0;
char *prop;
Tag *tag;
Bool ret = False;
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
ntags++;
@ -127,9 +128,15 @@ loadawesomeprops(int screen)
XInternAtom(globalconf.display, "_AWESOME_PROPERTIES", False),
prop, ntags + 1))
for(i = 0, tag = globalconf.screens[screen].tags; tag && prop[i]; i++, tag = tag->next)
if(prop[i] == '1')
{
tag_view_byindex(screen, i, prop[i] == '1');
ret = True;
}
p_delete(&prop);
return ret;
}
void

View file

@ -42,7 +42,7 @@ DO_SLIST(Layout, layout, p_delete);
int layout_refresh(void);
Layout * layout_get_current(int);
void loadawesomeprops(int);
Bool loadawesomeprops(int);
void saveawesomeprops(int);
Uicb uicb_tag_setlayout;