added the X classes to the build process though they aren't sued by anything else yet. They now compile too.

This commit is contained in:
Dana Jansens 2002-05-16 18:39:03 +00:00
parent c17256d745
commit 91a7ca7d20
7 changed files with 133 additions and 89 deletions

View file

@ -30,7 +30,7 @@ CPPFLAGS= @CPPFLAGS@ @SHAPE@ @SLIT@ @INTERLACE@ @ORDEREDPSEUDO@ \
bin_PROGRAMS= openbox bin_PROGRAMS= openbox
openbox_SOURCES= BaseDisplay.cc Basemenu.cc Clientmenu.cc Configmenu.cc Geometry.cc Iconmenu.cc Image.cc Netizen.cc Resource.cc Rootmenu.cc Screen.cc Slit.cc Timer.cc Toolbar.cc Window.cc Windowmenu.cc Workspace.cc Workspacemenu.cc openbox.cc bsd-snprintf.c i18n.cc main.cc openbox_SOURCES= BaseDisplay.cc Basemenu.cc Clientmenu.cc Configmenu.cc Geometry.cc Iconmenu.cc Image.cc Netizen.cc Resource.cc Rootmenu.cc Screen.cc Slit.cc Timer.cc Toolbar.cc Window.cc Windowmenu.cc Workspace.cc Workspacemenu.cc XAtom.cc XDisplay.cc XScreen.cc openbox.cc bsd-snprintf.c i18n.cc main.cc
MAINTAINERCLEANFILES= Makefile.in MAINTAINERCLEANFILES= Makefile.in
@ -82,6 +82,9 @@ Toolbar.o: Toolbar.cc i18n.h openbox.h BaseDisplay.h \
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \ Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
Clientmenu.h Workspace.h Rootmenu.h Screen.h Configmenu.h \ Clientmenu.h Workspace.h Rootmenu.h Screen.h Configmenu.h \
Netizen.h Workspacemenu.h Toolbar.h Resource.h Geometry.h Netizen.h Workspacemenu.h Toolbar.h Resource.h Geometry.h
XAtom.o: XAtom.cc XAtom.h XDisplay.h XScreen.h Geometry.h Util.h
XDisplay.o: XDisplay.cc XDisplay.h XAtom.h XScreen.h Geometry.h Util.h
XScreen.o: XScreen.cc XScreen.h Geometry.h XDisplay.h XAtom.h
Window.o: Window.cc i18n.h openbox.h BaseDisplay.h \ Window.o: Window.cc i18n.h openbox.h BaseDisplay.h \
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \ Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.h \ Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.h \

View file

@ -21,8 +21,10 @@
#include "XAtom.h" #include "XAtom.h"
#include "XDisplay.h" #include "XDisplay.h"
#include "XScreen.h"
#include "Util.h"
XAtom::XAtom(XDisplay *display) { XAtom::XAtom(const XDisplay *display) {
_display = display->_display; _display = display->_display;
wm_colormap_windows = getAtom("WM_COLORMAP_WINDOWS"); wm_colormap_windows = getAtom("WM_COLORMAP_WINDOWS");
@ -30,7 +32,7 @@ XAtom::XAtom(XDisplay *display) {
wm_state = getAtom("WM_STATE"); wm_state = getAtom("WM_STATE");
wm_change_state = getAtom("WM_CHANGE_STATE"); wm_change_state = getAtom("WM_CHANGE_STATE");
wm_delete_window = getAtom("WM_DELETE_WINDOW"); wm_delete_window = getAtom("WM_DELETE_WINDOW");
wm_take_focus = getAtom("WM_TAKE_FOCUS") wm_take_focus = getAtom("WM_TAKE_FOCUS");
motif_wm_hints = getAtom("_MOTIF_WM_HINTS"); motif_wm_hints = getAtom("_MOTIF_WM_HINTS");
openbox_hints = getAtom("_BLACKBOX_HINTS"); openbox_hints = getAtom("_BLACKBOX_HINTS");
openbox_attributes = getAtom("_BLACKBOX_ATTRIBUTES"); openbox_attributes = getAtom("_BLACKBOX_ATTRIBUTES");
@ -90,9 +92,10 @@ XAtom::XAtom(XDisplay *display) {
*/ */
XAtom::~XAtom() { XAtom::~XAtom() {
while (!_support_windows.empty()) { while (!_support_windows.empty()) {
Window w = _support_windows.pop_back(); // make sure we aren't fucking with this somewhere
ASSERT(w != None); // make sure we aren't fucking with this somewhere ASSERT(_support_windows.back() != None);
XDestroyWindow(_display, w); XDestroyWindow(_display, _support_windows.back());
_support_windows.pop_back();
} }
} }
@ -111,7 +114,7 @@ Atom XAtom::getAtom(const char *name) const {
void XAtom::setSupported(const XScreen *screen) { void XAtom::setSupported(const XScreen *screen) {
// create the netwm support window // create the netwm support window
Window w = XCreateSimpleWindow(_display, screen->rootWindow(), Window w = XCreateSimpleWindow(_display, screen->rootWindow(),
0, 0, 1, 1, 0, 0, 0) 0, 0, 1, 1, 0, 0, 0);
ASSERT(w != None); ASSERT(w != None);
_support_windows.push_back(w); _support_windows.push_back(w);
@ -125,7 +128,7 @@ void XAtom::setSupported(const XScreen *screen) {
* value. * value.
*/ */
void XAtom::setValue(Window win, Atom atom, Atom type, unsigned char* data, void XAtom::setValue(Window win, Atom atom, Atom type, unsigned char* data,
int size, int nelements, bool append) { int size, int nelements, bool append) const {
ASSERT(win != None); ASSERT(atom != None); ASSERT(type != None); ASSERT(win != None); ASSERT(atom != None); ASSERT(type != None);
ASSERT(data != (unsigned char *) 0); ASSERT(data != (unsigned char *) 0);
ASSERT(size == 8 || size == 16 || size == 32); ASSERT(size == 8 || size == 16 || size == 32);
@ -139,44 +142,46 @@ void XAtom::setValue(Window win, Atom atom, Atom type, unsigned char* data,
/* /*
* Set a 32-bit CARDINAL property value on a window. * Set a 32-bit CARDINAL property value on a window.
*/ */
void XAtom::setValue(Window win, Atom atom, long value) const { void XAtom::setCardValue(Window win, Atom atom, long value) const {
setValue(win, atom, XA_CARDINAL, static_cast<unsigned char*>(&value), setValue(win, atom, XA_CARDINAL, reinterpret_cast<unsigned char*>(&value),
sizeof(long), 1, false); 32, 1, false);
} }
/* /*
* Set an Atom property value on a window. * Set an Atom property value on a window.
*/ */
void XAtom::setValue(Window win, Atom atom, Atom value) { void XAtom::setAtomValue(Window win, Atom atom, Atom value) const {
setValue(win, atom, XA_ATOM, static_cast<unsigned char*>(&value), setValue(win, atom, XA_ATOM, reinterpret_cast<unsigned char*>(&value),
sizeof(Atom), 1, false); 32, 1, false);
} }
/* /*
* Set a Window property value on a window. * Set a Window property value on a window.
*/ */
void XAtom::setValue(Window win, Atom atom, Window value) { void XAtom::setWindowValue(Window win, Atom atom, Window value) const {
setValue(win, atom, XA_WINDOW, static_cast<unsigned char*>(&value), setValue(win, atom, XA_WINDOW, reinterpret_cast<unsigned char*>(&value),
sizeof(Window), 1, false); 32, 1, false);
} }
/* /*
* Set a Pixmap property value on a window. * Set a Pixmap property value on a window.
*/ */
void XAtom::setValue(Window win, Atom atom, Pixmap value) { void XAtom::setPixmapValue(Window win, Atom atom, Pixmap value) const {
setValue(win, atom, XA_PIXMAP, static_cast<unsigned char*>(&value), setValue(win, atom, XA_PIXMAP, reinterpret_cast<unsigned char*>(&value),
sizeof(Pixmap), 1, false); 32, 1, false);
} }
/* /*
* Set a string property value on a window. * Set a string property value on a window.
*/ */
void XAtom::setValue(Window win, Atom atom, std::string &value) { void XAtom::setStringValue(Window win, Atom atom, std::string &value) const {
setValue(win, atom, XA_STRING, static_cast<unsigned char*>(value.c_str()), setValue(win, atom, XA_STRING,
const_cast<unsigned char*>
(reinterpret_cast<const unsigned char*>(value.c_str())),
8, value.size(), false); 8, value.size(), false);
} }
@ -184,44 +189,47 @@ void XAtom::setValue(Window win, Atom atom, std::string &value) {
/* /*
* Add elements to a 32-bit CARDINAL property value on a window. * Add elements to a 32-bit CARDINAL property value on a window.
*/ */
void XAtom::addValue(Window win, Atom atom, long value) const { void XAtom::addCardValue(Window win, Atom atom, long value) const {
setValue(win, atom, XA_CARDINAL, static_cast<unsigned char*>(&value), setValue(win, atom, XA_CARDINAL, reinterpret_cast<unsigned char*>(&value),
sizeof(long), 1, true); 32, 1, true);
} }
/* /*
* Add elements to an Atom property value on a window. * Add elements to an Atom property value on a window.
*/ */
void XAtom::addValue(Window win, Atom atom, Atom value) const { void XAtom::addAtomValue(Window win, Atom atom, Atom value) const {
setValue(win, atom, XA_ATOM, static_cast<unsigned char*>(&value), setValue(win, atom, XA_ATOM, reinterpret_cast<unsigned char*>(&value),
sizeof(Atom), 1, true); 32, 1, true);
} }
/* /*
* Add elements to a Window property value on a window. * Add elements to a Window property value on a window.
*/ */
void XAtom::addValue(Window win, Atom atom, Window value) const { void XAtom::addWindowValue(Window win, Atom atom, Window value) const {
setValue(win, atom, XA_WINDOW, static_cast<unsigned char*>(&value), setValue(win, atom, XA_WINDOW, reinterpret_cast<unsigned char*>(&value),
sizeof(Window), 1, true); 32, 1, true);
} }
/* /*
* Add elements to a Pixmap property value on a window. * Add elements to a Pixmap property value on a window.
*/ */
void XAtom::addValue(Window win, Atom atom, Pixmap value) const { void XAtom::addPixmapValue(Window win, Atom atom, Pixmap value) const {
setValue(win, atom, XA_PIXMAP, static_cast<unsigned char*>(&value), setValue(win, atom, XA_PIXMAP, reinterpret_cast<unsigned char*>(&value),
sizeof(Pixmap), 1, true); 32, 1, true);
} }
/* /*
* Add characters to a string property value on a window. * Add characters to a string property value on a window.
*/ */
void XAtom::addValue(Window win, Atom atom, std::string &value) const { void XAtom::addStringValue(Window win, Atom atom, std::string &value) const {
setValue(win, atom, XA_STRING, static_cast<unsigned char*>(value.c_str()), setValue(win, atom, XA_STRING,
const_cast<unsigned char*>
(reinterpret_cast<const unsigned char *>
(value.c_str())),
8, value.size(), true); 8, value.size(), true);
} }
@ -276,52 +284,52 @@ bool XAtom::getValue(Window win, Atom atom, Atom type, unsigned long *nelements,
/* /*
* Gets a 32-bit Cardinal property's value from a window. * Gets a 32-bit Cardinal property's value from a window.
*/ */
bool XAtom::getValue(Window win, Atom atom, unsigned long *nelements, bool XAtom::getCardValue(Window win, Atom atom, unsigned long *nelements,
long **value) const { long **value) const {
return XAtom::getValue(win, atom, XA_CARDINAL, nelements, return XAtom::getValue(win, atom, XA_CARDINAL, nelements,
static_cast<unsigned char **>(value), sizeof(long)); reinterpret_cast<unsigned char **>(value), 32);
} }
/* /*
* Gets an Atom property's value from a window. * Gets an Atom property's value from a window.
*/ */
bool XAtom::getValue(Window win, Atom atom, unsigned long *nelements, bool XAtom::getAtomValue(Window win, Atom atom, unsigned long *nelements,
Atom **value) const { Atom **value) const {
return XAtom::getValue(win, atom, XA_ATOM, nelements, return XAtom::getValue(win, atom, XA_ATOM, nelements,
static_cast<unsigned char **>(value), sizeof(Atom)); reinterpret_cast<unsigned char **>(value), 32);
} }
/* /*
* Gets an Window property's value from a window. * Gets an Window property's value from a window.
*/ */
bool XAtom::getValue(Window win, Atom atom, unsigned long *nelements, bool XAtom::getWindowValue(Window win, Atom atom, unsigned long *nelements,
Window **value) const { Window **value) const {
return XAtom::getValue(win, atom, XA_WINDOW, nelements, return XAtom::getValue(win, atom, XA_WINDOW, nelements,
static_cast<unsigned char **>(value), sizeof(Window)); reinterpret_cast<unsigned char **>(value), 32);
} }
/* /*
* Gets an Pixmap property's value from a window. * Gets an Pixmap property's value from a window.
*/ */
bool XAtom::getValue(Window win, Atom atom, unsigned long *nelements, bool XAtom::getPixmapValue(Window win, Atom atom, unsigned long *nelements,
Pixmap **value) const { Pixmap **value) const {
return XAtom::getValue(win, atom, XA_PIXMAP, nelements, return XAtom::getValue(win, atom, XA_PIXMAP, nelements,
static_cast<unsigned char **>(value), sizeof(Pixmap)); reinterpret_cast<unsigned char **>(value), 32);
} }
/* /*
* Gets an string property's value from a window. * Gets an string property's value from a window.
*/ */
bool XAtom::getValue(Window win, Atom atom, unsigned long *nelements, bool XAtom::getStringValue(Window win, Atom atom, unsigned long *nelements,
std::string &value) const { std::string &value) const {
unsigned char *data; unsigned char *data;
bool ret = XAtom::getValue(win, atom, XA_STRING, nelements, &data, 8); bool ret = XAtom::getValue(win, atom, XA_STRING, nelements, &data, 8);
if (ret) if (ret)
value = data; value = reinterpret_cast<char*>(data);
return ret; return ret;
} }

View file

@ -27,6 +27,7 @@
#include <vector> #include <vector>
class XDisplay; class XDisplay;
class XScreen;
class XAtom { class XAtom {
typedef std::vector<Window> SupportWindows; typedef std::vector<Window> SupportWindows;
@ -46,7 +47,7 @@ class XAtom {
motif_wm_hints, motif_wm_hints,
openbox_attributes, openbox_attributes,
openbox_change_attributes, openbox_change_attributes,
openbox_hints; openbox_hints,
// blackbox-protocol atoms (wm -> client) // blackbox-protocol atoms (wm -> client)
openbox_structure_messages, openbox_structure_messages,
@ -57,7 +58,7 @@ class XAtom {
openbox_notify_current_workspace, openbox_notify_current_workspace,
openbox_notify_workspace_count, openbox_notify_workspace_count,
openbox_notify_window_raise, openbox_notify_window_raise,
openbox_notify_window_lower; openbox_notify_window_lower,
// blackbox-protocol atoms (client -> wm) // blackbox-protocol atoms (client -> wm)
openbox_change_workspace, openbox_change_workspace,
openbox_change_window_focus, openbox_change_window_focus,
@ -95,10 +96,10 @@ class XAtom {
net_wm_ping; net_wm_ping;
Atom getAtom(const char *name) const; Atom getAtom(const char *name) const;
void setSupported(const XScreen *screen) const; void setSupported(const XScreen *screen);
void setValue(Window win, Atom atom, Atom type, unsigned char *data, int size, void setValue(Window win, Atom atom, Atom type, unsigned char *data,
int nelements, bool append); int size, int nelements, bool append) const;
bool getValue(Window win, Atom atom, Atom type, unsigned long *nelements, bool getValue(Window win, Atom atom, Atom type, unsigned long *nelements,
unsigned char **value, int size) const; unsigned char **value, int size) const;
@ -107,34 +108,34 @@ class XAtom {
XAtom& operator=(const XAtom&); XAtom& operator=(const XAtom&);
public: public:
XAtom(XDisplay *display); XAtom(const XDisplay *display);
virtual ~XAtom(); virtual ~XAtom();
void setValue(Window win, Atom atom, long value) const; // a 32-bit CARDINAL void setCardValue(Window win, Atom atom, long value) const; // 32-bit CARDINAL
void setValue(Window win, Atom atom, Atom value) const; void setAtomValue(Window win, Atom atom, Atom value) const;
void setValue(Window win, Atom atom, Window value) const; void setWindowValue(Window win, Atom atom, Window value) const;
void setValue(Window win, Atom atom, Pixmap value) const; void setPixmapValue(Window win, Atom atom, Pixmap value) const;
void setValue(Window win, Atom atom, std::string &value) const; void setStringValue(Window win, Atom atom, std::string &value) const;
void addValue(Window win, Atom atom, long value) const; // a 32-bit CARDINAL void addCardValue(Window win, Atom atom, long value) const; // 32-bit CARDINAL
void addValue(Window win, Atom atom, Atom value) const; void addAtomValue(Window win, Atom atom, Atom value) const;
void addValue(Window win, Atom atom, Window value) const; void addWindowValue(Window win, Atom atom, Window value) const;
void addValue(Window win, Atom atom, Pixmap value) const; void addPixmapValue(Window win, Atom atom, Pixmap value) const;
void addValue(Window win, Atom atom, std::string &value) const; void addStringValue(Window win, Atom atom, std::string &value) const;
// the 'value' is allocated inside the function and // the 'value' is allocated inside the function and
// delete [] value needs to be called when you are done with it. // delete [] value needs to be called when you are done with it.
// teh 'value' array returned is null terminated, and has 'nelements' // teh 'value' array returned is null terminated, and has 'nelements'
// elements in it plus the null. // elements in it plus the null.
bool getValue(Window win, Atom atom, unsigned long *nelements, bool getCardValue(Window win, Atom atom, unsigned long *nelements,
long **value) const; // a 32-bit CARDINAL long **value) const; // 32-bit CARDINAL
bool getValue(Window win, Atom atom, unsigned long *nelements, bool getAtomValue(Window win, Atom atom, unsigned long *nelements,
Atom **value) const; Atom **value) const;
bool getValue(Window win, Atom atom, unsigned long *nelements, bool getWindowValue(Window win, Atom atom, unsigned long *nelements,
Window **value) const; Window **value) const;
bool getValue(Window win, Atom atom, unsigned long *nelements, bool getPixmapValue(Window win, Atom atom, unsigned long *nelements,
Pixmap **value) const; Pixmap **value) const;
bool getValue(Window win, Atom atom, unsigned long *nelements, bool getStringValue(Window win, Atom atom, unsigned long *nelements,
std::string &value) const; std::string &value) const;
void eraseValue(Window win, Atom atom) const; void eraseValue(Window win, Atom atom) const;

View file

@ -19,7 +19,23 @@
// 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.
#include "Xdisplay.h" #ifdef HAVE_CONFIG_H
# include "../config.h"
#endif
#ifdef HAVE_UNNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef SHAPE
# include <X11/extensions/shape.h>
#endif
#include "XDisplay.h"
#include "XScreen.h" #include "XScreen.h"
#include "Util.h" #include "Util.h"
#include <iostream> #include <iostream>
@ -27,16 +43,22 @@
using std::cerr; using std::cerr;
Xdisplay::Xdisplay(const char *dpyname) { int XDisplay::XErrorHandler(Display *d, XErrorEvent *e) {
d=d;e=e;
return 0;
}
XDisplay::XDisplay(const char *dpyname) {
_grabs = 0; _grabs = 0;
_hasshape = false; _hasshape = false;
_display = XOpenDisplay(dpy_name); _display = XOpenDisplay(dpyname);
if (_display == NULL) { if (_display == NULL) {
cerr << "Could not open display. Connection to X server failed.\n"; cerr << "Could not open display. Connection to X server failed.\n";
::exit(2); ::exit(2);
} }
if (-1 == fcntl(ConnectionNumber(display), F_SETFD, 1)) { if (-1 == fcntl(ConnectionNumber(_display), F_SETFD, 1)) {
cerr << "Could not mark display connection as close-on-exec.\n"; cerr << "Could not mark display connection as close-on-exec.\n";
::exit(2); ::exit(2);
} }
@ -52,11 +74,11 @@ Xdisplay::Xdisplay(const char *dpyname) {
const unsigned int scount = ScreenCount(_display); const unsigned int scount = ScreenCount(_display);
_screens.reserve(scount); _screens.reserve(scount);
for (unsigned int s = 0; s < scount; s++) for (unsigned int s = 0; s < scount; s++)
_screens.push_back(new XScreen(_display, s)); _screens.push_back(new XScreen(this, s));
} }
Xdisplay::~Xdisplay() { XDisplay::~XDisplay() {
std::for_each(_screens.begin(), _screens.end(), PointerAssassin()); std::for_each(_screens.begin(), _screens.end(), PointerAssassin());
XCloseDisplay(_display); XCloseDisplay(_display);
} }
@ -65,7 +87,7 @@ Xdisplay::~Xdisplay() {
/* /*
* Return information about a screen. * Return information about a screen.
*/ */
XScreen *Xdisplay::screen(unsigned int s) const { XScreen *XDisplay::screen(unsigned int s) const {
ASSERT(s < _screens.size()); ASSERT(s < _screens.size());
return _screens[s]; return _screens[s];
} }

View file

@ -25,10 +25,12 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include "XAtom.h"
#include "XScreen.h"
class Xdisplay { class XDisplay {
friend XAtom::XAtom(); friend XAtom::XAtom(const XDisplay *);
//friend class XAtom; friend XScreen::XScreen(const XDisplay *, const unsigned int);
private: private:
Display *_display; Display *_display;
@ -40,7 +42,7 @@ private:
typedef std::vector<XScreen*> XScreenList; typedef std::vector<XScreen*> XScreenList;
XScreenList _screens; XScreenList _screens;
int XErrorHandler(Display *d, XErrorEvent *e); static int XErrorHandler(Display *d, XErrorEvent *e);
// no copying!! // no copying!!
XDisplay(const XDisplay &); XDisplay(const XDisplay &);
@ -50,18 +52,18 @@ protected:
virtual void process_event(XEvent *) = 0; virtual void process_event(XEvent *) = 0;
public: public:
Xdisplay(const char *dpyname = 0); XDisplay(const char *dpyname = 0);
virtual ~Xdisplay(); virtual ~XDisplay();
XScreen *screen(unsigned int s) const; XScreen *screen(unsigned int s) const;
inline unsigned int screenCount() const { return _screens.size(); } inline unsigned int screenCount() const { return _screens.size(); }
inline bool hasShape() const { return _hasshape; } inline bool hasShape() const { return _hasshape; }
inline int shapeEventBase() const { return shape.event_basep; } inline int shapeEventBase() const { return _shape_event_base; }
//inline Display *display() const { return _display; } //inline Display *display() const { return _display; }
inline std::string name() const { return name; } inline std::string name() const { return _name; }
// these belong in Xwindow // these belong in Xwindow
//const bool validateWindow(Window); //const bool validateWindow(Window);

View file

@ -19,11 +19,13 @@
// 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.
#include <X11/Xutil.h>
#include "XScreen.h" #include "XScreen.h"
#include "XDisplay.h"
#include "Geometry.h" #include "Geometry.h"
XScreen::XScreen(const Display *display, const unsigned int number) { XScreen::XScreen(const XDisplay *display, const unsigned int number) {
_display = display; _display = display->_display;
_number = number; _number = number;
_root = RootWindow(_display, _number); _root = RootWindow(_display, _number);
@ -33,6 +35,10 @@ XScreen::XScreen(const Display *display, const unsigned int number) {
} }
XScreen::~XScreen() {
}
/* /*
* This sets up the _depth, _visual, and _colormap properties. * This sets up the _depth, _visual, and _colormap properties.
*/ */
@ -58,7 +64,7 @@ void XScreen::setColorData() {
} }
XFree(vinfo_return); XFree(vinfo_return);
} }
if (visual) if (_visual)
_colormap = XCreateColormap(_display, _root, _visual, AllocNone); _colormap = XCreateColormap(_display, _root, _visual, AllocNone);
else { else {
_visual = DefaultVisual(_display, _number); _visual = DefaultVisual(_display, _number);

View file

@ -23,8 +23,9 @@
#define __XScreen_h #define __XScreen_h
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include "Geometry.h"
class Size; class XDisplay;
class XScreen { class XScreen {
private: private:
@ -33,7 +34,7 @@ private:
Visual *_visual; Visual *_visual;
Window _root; Window _root;
Colormap _colormap; Colormap _colormap;
unsigned int _depth; int _depth;
Size _size; Size _size;
void setColorData(); void setColorData();
@ -43,7 +44,8 @@ private:
XScreen& operator=(const XScreen&); XScreen& operator=(const XScreen&);
public: public:
XScreen(const Display *display, const unsigned int number); XScreen(const XDisplay *display, const unsigned int number);
virtual ~XScreen();
inline Visual *visual() const { return _visual; } inline Visual *visual() const { return _visual; }
inline Window rootWindow() const { return _root; } inline Window rootWindow() const { return _root; }