/* * ewmh.c - EWMH support functions * * Copyright © 2007 Julien Danjou * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include "ewmh.h" #include "config.h" extern AwesomeConf globalconf; static Atom net_supported; static Atom net_client_list; static Atom net_wm_name; static Atom net_wm_icon; typedef struct { const char *name; Atom *atom; } AtomItem; static AtomItem AtomNames[] = { { "_NET_SUPPORTED", &net_supported }, { "_NET_CLIENT_LIST", &net_client_list }, { "_NET_WM_NAME", &net_wm_name }, { "_NET_WM_ICON", &net_wm_icon }, }; #define ATOM_NUMBER (sizeof(AtomNames)/sizeof(AtomItem)) void ewmh_init_atoms(void) { unsigned int i; char *names[ATOM_NUMBER]; Atom atoms[ATOM_NUMBER]; for(i = 0; i < ATOM_NUMBER; i++) names[i] = (char *) AtomNames[i].name; XInternAtoms(globalconf.display, names, ATOM_NUMBER, False, atoms); for(i = 0; i < ATOM_NUMBER; i++) *AtomNames[i].atom = atoms[i]; } void ewmh_set_supported_hints(int phys_screen) { Atom atom[ATOM_NUMBER]; int i = 0; atom[i++] = net_supported; atom[i++] = net_client_list; atom[i++] = net_wm_name; atom[i++] = net_wm_icon; XChangeProperty(globalconf.display, RootWindow(globalconf.display, phys_screen), net_supported, XA_ATOM, 32, PropModeReplace, (unsigned char *) atom, i); } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80