fixed license, construtor and moved motif_wm_hints atom to getWMHints in FluxboxWindow instead

This commit is contained in:
fluxgen 2003-04-15 11:59:02 +00:00
parent f679d372d3
commit 78d4f8f610
2 changed files with 22 additions and 20 deletions

View file

@ -1,5 +1,5 @@
// FbAtom.cc // FbAtom.cc
// Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org) // Copyright (c) 2002 - 2003 Henrik Kinnunen (fluxgen(at)linuxmail.org)
// //
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"), // copy of this software and associated documentation files (the "Software"),
@ -13,30 +13,30 @@
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: FbAtoms.cc,v 1.5 2002/12/01 13:41:56 rathnor Exp $ // $Id: FbAtoms.cc,v 1.6 2003/04/15 11:59:02 fluxgen Exp $
#include "FbAtoms.hh" #include "FbAtoms.hh"
#include "App.hh"
#include <string> #include <string>
#include <cassert>
using namespace std; using namespace std;
FbAtoms *FbAtoms::s_singleton = 0; FbAtoms *FbAtoms::s_singleton = 0;
FbAtoms::FbAtoms(Display *display):m_init(false) { FbAtoms::FbAtoms():m_init(false) {
if (s_singleton != 0) if (s_singleton != 0)
throw string("You can only create one instance of FbAtoms"); throw string("You can only create one instance of FbAtoms");
if (display == 0)
throw string("Must supply FbAtoms with an valid display connection");
s_singleton = this; s_singleton = this;
initAtoms(display); initAtoms();
} }
FbAtoms::~FbAtoms() { FbAtoms::~FbAtoms() {
@ -44,11 +44,14 @@ FbAtoms::~FbAtoms() {
} }
FbAtoms *FbAtoms::instance() { FbAtoms *FbAtoms::instance() {
assert(s_singleton); if (s_singleton == 0)
throw string("Create one instance of FbAtoms first!");
return s_singleton; return s_singleton;
} }
void FbAtoms::initAtoms(Display *display) { void FbAtoms::initAtoms() {
Display *display = FbTk::App::instance()->display();
xa_wm_colormap_windows = xa_wm_colormap_windows =
XInternAtom(display, "WM_COLORMAP_WINDOWS", False); XInternAtom(display, "WM_COLORMAP_WINDOWS", False);
@ -57,7 +60,6 @@ void FbAtoms::initAtoms(Display *display) {
xa_wm_change_state = XInternAtom(display, "WM_CHANGE_STATE", False); xa_wm_change_state = XInternAtom(display, "WM_CHANGE_STATE", False);
xa_wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False); xa_wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False);
xa_wm_take_focus = XInternAtom(display, "WM_TAKE_FOCUS", False); xa_wm_take_focus = XInternAtom(display, "WM_TAKE_FOCUS", False);
motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False);
blackbox_hints = XInternAtom(display, "_BLACKBOX_HINTS", False); blackbox_hints = XInternAtom(display, "_BLACKBOX_HINTS", False);
blackbox_attributes = XInternAtom(display, "_BLACKBOX_ATTRIBUTES", False); blackbox_attributes = XInternAtom(display, "_BLACKBOX_ATTRIBUTES", False);

View file

@ -1,5 +1,5 @@
// FbAtom.hh // FbAtom.hh
// Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org) // Copyright (c) 2002 - 2003 Henrik Kinnunen (fluxgen(at)fluxbox.org)
// //
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"), // copy of this software and associated documentation files (the "Software"),
@ -13,13 +13,13 @@
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: FbAtoms.hh,v 1.8 2002/12/01 13:41:56 rathnor Exp $ // $Id: FbAtoms.hh,v 1.9 2003/04/15 11:57:34 fluxgen Exp $
#ifndef FBATOMS_HH #ifndef FBATOMS_HH
#define FBATOMS_HH #define FBATOMS_HH
@ -31,8 +31,9 @@
*/ */
class FbAtoms { class FbAtoms {
public: public:
explicit FbAtoms(Display *display); FbAtoms();
virtual ~FbAtoms(); ~FbAtoms();
static FbAtoms *instance(); static FbAtoms *instance();
@ -42,7 +43,6 @@ public:
inline Atom getWMProtocolsAtom() const { return xa_wm_protocols; } inline Atom getWMProtocolsAtom() const { return xa_wm_protocols; }
inline Atom getWMTakeFocusAtom() const { return xa_wm_take_focus; } inline Atom getWMTakeFocusAtom() const { return xa_wm_take_focus; }
inline Atom getWMColormapAtom() const { return xa_wm_colormap_windows; } inline Atom getWMColormapAtom() const { return xa_wm_colormap_windows; }
inline Atom getMotifWMHintsAtom() const { return motif_wm_hints; }
// this atom is for normal app->WM hints about decorations, stacking, // this atom is for normal app->WM hints about decorations, stacking,
// starting workspace etc... // starting workspace etc...
@ -77,7 +77,7 @@ public:
inline Atom getFluxboxCycleWindowFocusAtom() const { return blackbox_cycle_window_focus; } inline Atom getFluxboxCycleWindowFocusAtom() const { return blackbox_cycle_window_focus; }
private: private:
void initAtoms(Display *disp); void initAtoms();
// NETAttributes // NETAttributes
Atom blackbox_attributes, blackbox_change_attributes, blackbox_hints; Atom blackbox_attributes, blackbox_change_attributes, blackbox_hints;
@ -93,8 +93,8 @@ private:
blackbox_cycle_window_focus; blackbox_cycle_window_focus;
Atom xa_wm_colormap_windows, xa_wm_protocols, xa_wm_state, Atom xa_wm_colormap_windows, xa_wm_protocols, xa_wm_state,
xa_wm_delete_window, xa_wm_take_focus, xa_wm_change_state, xa_wm_delete_window, xa_wm_take_focus, xa_wm_change_state;
motif_wm_hints;
bool m_init; bool m_init;
static FbAtoms *s_singleton; static FbAtoms *s_singleton;
}; };