add support for _NET_NUMBER_OF_DESKTOPS

This commit is contained in:
Julien Danjou 2007-12-27 18:18:12 +01:00
parent e335b32e5f
commit 502f502e23
4 changed files with 24 additions and 3 deletions

View File

@ -331,6 +331,8 @@ main(int argc, char *argv[])
XSync(dpy, False);
globalconf.display = dpy;
ewmh_init_atoms();
globalconf.screens = p_new(VirtScreen, get_screen_count());
focus_add_client(NULL);
/* store display */
@ -344,8 +346,6 @@ main(int argc, char *argv[])
statusbar_draw(screen);
}
ewmh_init_atoms();
/* do this only for real screen */
for(screen = 0; screen < ScreenCount(dpy); screen++)
{

View File

@ -32,6 +32,7 @@
#include "screen.h"
#include "widget.h"
#include "xutil.h"
#include "ewmh.h"
#include "defconfig.h"
#define AWESOME_CONFIG_FILE ".awesomerc"
@ -638,6 +639,8 @@ config_parse(const char *confpatharg)
else
eprint("fatal: no tags found in configuration file\n");
ewmh_update_net_numbers_of_desktop(get_phys_screen(screen));
/* select first tag by default */
virtscreen->tags[0].selected = True;
virtscreen->tags[0].was_selected = True;

19
ewmh.c
View File

@ -19,7 +19,8 @@
*
*/
#include <X11/Xatom.h>
#include <X11/Xatom.h>
#include <X11/Xmd.h>
#include "ewmh.h"
#include "util.h"
@ -28,6 +29,7 @@ extern AwesomeConf globalconf;
static Atom net_supported;
static Atom net_client_list;
static Atom net_number_of_desktops;
static Atom net_wm_name;
static Atom net_wm_icon;
@ -42,6 +44,7 @@ static AtomItem AtomNames[] =
{
{ "_NET_SUPPORTED", &net_supported },
{ "_NET_CLIENT_LIST", &net_client_list },
{ "_NET_NUMBER_OF_DESKTOPS", &net_number_of_desktops },
{ "_NET_WM_NAME", &net_wm_name },
{ "_NET_WM_ICON", &net_wm_icon },
@ -71,6 +74,7 @@ ewmh_set_supported_hints(int phys_screen)
atom[i++] = net_supported;
atom[i++] = net_client_list;
atom[i++] = net_number_of_desktops;
atom[i++] = net_wm_name;
atom[i++] = net_wm_icon;
@ -104,4 +108,17 @@ ewmh_update_net_client_list(int phys_screen)
XFlush(globalconf.display);
}
void
ewmh_update_net_numbers_of_desktop(int phys_screen)
{
CARD32 count = 0;
Tag *tag;
for(tag = globalconf.screens[phys_screen].tags; tag; tag = tag->next)
count++;
XChangeProperty(globalconf.display, RootWindow(globalconf.display, phys_screen),
net_number_of_desktops, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &count, 1);
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

1
ewmh.h
View File

@ -25,6 +25,7 @@
void ewmh_init_atoms(void);
void ewmh_set_supported_hints(int);
void ewmh_update_net_client_list(int);
void ewmh_update_net_numbers_of_desktop(int);
#endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80