XDisplay.h 1.45 KB
#ifndef __XDisplay_h__
#define __XDisplay_h__

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>

class XDisplay {
    private:
        //alles zum Display und screen
        Display* display;
        int screen_num;

        int argc;
        char** argv;

        unsigned int display_width;
        unsigned int display_height;
        char* display_name;

        XFontStruct* font_info;
        XEvent report;
        Colormap default_cm;

    public:
        //Konstruktoren und Destruktoren
        /* Displayname=NULL -> Wert der DISPLAY env-var nutzen */
        XDisplay(int argc, char** argv, char* name=NULL);
        ~XDisplay();

        //Inline Funktionen
        unsigned int getWidth(void)  { return display_width; }
        unsigned int getHeight(void) { return display_height; }
        XFontStruct* getFont(void)   { return font_info; }
        Display* getDisplay(void)    { return display; }
        int getScreen(void)          { return screen_num; }
        Colormap getDefaultCm(void)  { return default_cm; }
        int getArgc(void)            { return argc; }
        char** getArgv(void)         { return argv; }

        // weitere Funktionen
        unsigned long getColor(unsigned short, unsigned short, unsigned short);
        void loadFont(char* name="9x15");
        Window getRootWindow(void);
        unsigned long getBlackPixel(void);
        unsigned long getWhitePixel(void);
};

#endif /*__XDisplay_h__*/