X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Fdisplay.hh;h=25c1b45af074efe32341d7a58025466204f526a9;hb=648c55b829e09c66222a9bbf08d10434622feae2;hp=5f658cd3a71a8770a531f1505b4853e6f7c7ae0b;hpb=00bc993775b916de76772bdc5e31618076194797;p=chaz%2Fopenbox diff --git a/otk/display.hh b/otk/display.hh index 5f658cd3..25c1b45a 100644 --- a/otk/display.hh +++ b/otk/display.hh @@ -6,12 +6,9 @@ extern "C" { #include } -#include - namespace otk { -class ScreenInfo; -class GCCache; +class RenderControl; class Display; @@ -21,10 +18,6 @@ extern Display *display; //! Manages a single X11 display. class Display { -public: - //! A List of ScreenInfo instances - typedef std::vector ScreenInfoList; - private: //! The X display ::Display *_display; @@ -53,53 +46,33 @@ private: //! The value of the mask for the ScrollLock modifier unsigned int _scroll_lock_mask; + //! The key codes for the modifier keys + XModifierKeymap *_modmap; + //! The number of requested grabs on the display int _grab_count; - //! A list of information for all screens on the display - ScreenInfoList _screenInfoList; + //! When true, X errors will be ignored. Use with care. + bool _ignore_errors; - //! A cache for re-using GCs, used by the drawing objects - /*! - @see Pen - @see Font - @see Image - @see ImageControl - @see Texture - */ - GCCache *_gccache; + //! The optimal visual for the display + Visual *_visual; - // Handles X errors on the display - /* - Displays the error if compiled for debugging. - */ - //int xerrorHandler(::Display *d, XErrorEvent *e); + //! Our colormap built for the optimal visual + Colormap _colormap; + //! The depth of our optimal visual + int _depth; + public: - //! Initializes the class, opens the X display + //! Wraps an open Display connection /*! - The DISPLAY environment variable is used to choose the display. - @see Display::display + @param d An open Display connection. */ - Display(); + Display(::Display *d); //! Destroys the class, closes the X display ~Display(); - //! Returns the GC cache for the application - inline GCCache *gcCache() const { return _gccache; } - - //! Gets information on a specific screen - /*! - Returns a ScreenInfo class, which contains information for a screen on the - display. - @param snum The screen number of the screen to retrieve info on - @return Info on the requested screen, in a ScreenInfo class - */ - const ScreenInfo* screenInfo(int snum); - - //! Find a ScreenInfo based on a root window - const ScreenInfo* findScreen(Window root); - //! Returns if the display has the xkb extension available inline bool xkb() const { return _xkb; } //! Returns the xkb extension's event base @@ -114,9 +87,15 @@ public: inline unsigned int numLockMask() const { return _num_lock_mask; } inline unsigned int scrollLockMask() const { return _scroll_lock_mask; } + const XModifierKeymap *modifierMap() const { return _modmap; } inline ::Display* operator*() const { return _display; } + //! When true, X errors will be ignored. + inline bool ignoreErrors() const { return _ignore_errors; } + //! Set whether X errors should be ignored. Use with care. + void setIgnoreErrors(bool t); + //! Grabs the display void grab(); @@ -139,6 +118,7 @@ public: bool allow_scroll_lock) const; void ungrabKey(unsigned int keycode, unsigned int modifiers, Window grab_window) const; + void ungrabAllKeys(Window grab_window) const; }; }