wmi

git clone git://oldgit.suckless.org/wmi/
Log | Files | Refs | LICENSE

atoms.cpp (2193B)


      1 // Copyright (c) 2003 - 2009 Anselm R Garbe <anselm@garbe.us>
      2 // See LICENSE for license details.
      3 
      4 extern "C" {
      5 #include "X11/Xatom.h"
      6 }
      7 #include <sstream>
      8 
      9 #include "atoms.h"
     10 
     11 #include "logger.h"
     12 #include "kernel.h"
     13 #include "wmi.h"
     14 #include "xcore.h"
     15 
     16 Atom Atoms::WM_STATE = 0;
     17 Atom Atoms::WM_CHANGE_STATE = 0;
     18 Atom Atoms::WM_PROTOCOLS = 0;
     19 Atom Atoms::WM_DELETE = 0;
     20 Atom Atoms::WM_TAKE_FOCUS = 0;
     21 Atom Atoms::WM_COLORMAPS = 0;
     22 
     23 Atom Atoms::MWM_HINTS = 0;
     24 
     25 Atom Atoms::NET_WM_DESKTOP = 0;
     26 
     27 Atom Atoms::WMI_ACTIONCMD = 0;
     28 Atom Atoms::WMI_STATUSTEXT = 0;
     29 Atom Atoms::WMI_METERTEXT = 0;
     30 Atom Atoms::WMI_PRETTYPRINT_REQUEST = 0;
     31 Atom Atoms::WMI_PRETTYPRINT_RESPONSE = 0;
     32 
     33 bool Atoms::initialized_ = false;
     34 
     35 void Atoms::initAtoms()
     36 {
     37     if (initialized_) {
     38         return;
     39     }
     40 
     41     ostringstream oss;
     42 
     43     // ICCCM
     44     WM_STATE = XCORE->internAtom("WM_STATE");
     45     oss << "WM_STATE: " << WM_STATE << endl;
     46     WM_CHANGE_STATE = XCORE->internAtom("WM_CHANGE_STATE");
     47     oss << "WM_CHANGE_STATE: " << WM_CHANGE_STATE << endl;
     48     WM_PROTOCOLS = XCORE->internAtom("WM_PROTOCOLS");
     49     oss << "WM_PROTOCOLS: " << WM_PROTOCOLS << endl;
     50     WM_DELETE = XCORE->internAtom("WM_DELETE_WINDOW");
     51     oss << "WM_DELETE_WINDOW: " << WM_DELETE << endl;
     52     WM_TAKE_FOCUS = XCORE->internAtom("WM_TAKE_FOCUS");
     53     oss << "WM_TAKE_FOCUS: " << WM_TAKE_FOCUS << endl;
     54     WM_COLORMAPS = XCORE->internAtom("WM_COLORMAP_WINDOWS");
     55     oss << "WM_COLORMAP_WINDOWS: " << WM_COLORMAPS << endl;
     56     oss << "XA_WM_ICON_NAME: " << XA_WM_ICON_NAME << endl;
     57     oss << "XA_WM_NAME: " << XA_WM_NAME << endl;
     58     oss << "XA_WM_TRANSIENT_FOR: " << XA_WM_TRANSIENT_FOR;
     59 
     60     LOGDEBUG(oss.str());
     61 
     62     // MOTIF
     63     MWM_HINTS = XCORE->internAtom("_MOTIF_WM_HINTS");
     64 
     65     // NETWM
     66     NET_WM_DESKTOP = XCORE->internAtom("_NET_WM_DESKTOP");
     67 
     68     // WMI
     69     WMI_ACTIONCMD = XCORE->internAtom("_WMI_ACTIONCMD");
     70     WMI_STATUSTEXT = XCORE->internAtom("_WMI_STATUSTEXT");
     71     WMI_METERTEXT = XCORE->internAtom("_WMI_METERTEXT");
     72     WMI_PRETTYPRINT_REQUEST =
     73         XCORE->internAtom("_WMI_PRETTYPRINT_REQUEST");
     74     WMI_PRETTYPRINT_RESPONSE =
     75         XCORE->internAtom("_WMI_PRETTYPRINT_RESPONSE");
     76 
     77     initialized_ = true;
     78 }