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

View file

@ -32,6 +32,7 @@
#include "screen.h" #include "screen.h"
#include "widget.h" #include "widget.h"
#include "xutil.h" #include "xutil.h"
#include "ewmh.h"
#include "defconfig.h" #include "defconfig.h"
#define AWESOME_CONFIG_FILE ".awesomerc" #define AWESOME_CONFIG_FILE ".awesomerc"
@ -638,6 +639,8 @@ config_parse(const char *confpatharg)
else else
eprint("fatal: no tags found in configuration file\n"); eprint("fatal: no tags found in configuration file\n");
ewmh_update_net_numbers_of_desktop(get_phys_screen(screen));
/* select first tag by default */ /* select first tag by default */
virtscreen->tags[0].selected = True; virtscreen->tags[0].selected = True;
virtscreen->tags[0].was_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 "ewmh.h"
#include "util.h" #include "util.h"
@ -28,6 +29,7 @@ extern AwesomeConf globalconf;
static Atom net_supported; static Atom net_supported;
static Atom net_client_list; static Atom net_client_list;
static Atom net_number_of_desktops;
static Atom net_wm_name; static Atom net_wm_name;
static Atom net_wm_icon; static Atom net_wm_icon;
@ -42,6 +44,7 @@ static AtomItem AtomNames[] =
{ {
{ "_NET_SUPPORTED", &net_supported }, { "_NET_SUPPORTED", &net_supported },
{ "_NET_CLIENT_LIST", &net_client_list }, { "_NET_CLIENT_LIST", &net_client_list },
{ "_NET_NUMBER_OF_DESKTOPS", &net_number_of_desktops },
{ "_NET_WM_NAME", &net_wm_name }, { "_NET_WM_NAME", &net_wm_name },
{ "_NET_WM_ICON", &net_wm_icon }, { "_NET_WM_ICON", &net_wm_icon },
@ -71,6 +74,7 @@ ewmh_set_supported_hints(int phys_screen)
atom[i++] = net_supported; atom[i++] = net_supported;
atom[i++] = net_client_list; atom[i++] = net_client_list;
atom[i++] = net_number_of_desktops;
atom[i++] = net_wm_name; atom[i++] = net_wm_name;
atom[i++] = net_wm_icon; atom[i++] = net_wm_icon;
@ -104,4 +108,17 @@ ewmh_update_net_client_list(int phys_screen)
XFlush(globalconf.display); 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 // 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_init_atoms(void);
void ewmh_set_supported_hints(int); void ewmh_set_supported_hints(int);
void ewmh_update_net_client_list(int); void ewmh_update_net_client_list(int);
void ewmh_update_net_numbers_of_desktop(int);
#endif #endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80