#ifndef RXVT_COLOR_H #define RXVT_COLOR_H #include #if XFT # include #endif #include "iom.h" #include "rxvtlib.h" #include "rxvtstl.h" #include "callback.h" struct rxvt_term; struct xevent_watcher; struct rxvt_display { int referenced; char *name; rxvt_term *selection_owner; io_manager_vec xw; io_watcher x_watcher; void x_event (io_watcher &w, short revents); //public Display *display; int depth; int screen; Visual *visual; Colormap cmap; Window root; bool open (); void close (); void reg (xevent_watcher *w); void unreg (xevent_watcher *w); rxvt_display (const char *name); ~rxvt_display (); void set_selection_owner (rxvt_term *owner); }; struct xevent_watcher : watcher, callback1 { Window window; template xevent_watcher (O1 *object, void (O2::*method)(XEvent &)) : callback1(object,method) { } void start (rxvt_display *display, Window window) { this->window = window; display->reg (this); } void stop (rxvt_display *display) { display->unreg (this); } }; struct rxvt_displays { vector list; rxvt_display *get (const char *name); void release (rxvt_display *display); }; extern rxvt_displays displays; typedef unsigned long Pixel; struct rxvt_color { #if XFT XftColor c; operator Pixel() const { return c.pixel; } #else Pixel p; operator Pixel() const { return p; } #endif bool operator == (const rxvt_color &b) const { return Pixel(*this) == Pixel(b); } bool operator != (const rxvt_color &b) const { return Pixel(*this) != Pixel(b); } void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb); bool set (rxvt_display *display, Pixel p); bool set (rxvt_display *display, const char *name); bool set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb); void free (rxvt_display *display); }; #endif