00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef X11_DISPLAY_HPP
00026 #define X11_DISPLAY_HPP
00027
00028 #include <X11/Xlib.h>
00029 #include <X11/Xatom.h>
00030 #include "../src/skin_common.hpp"
00031
00032
00033 #define XDISPLAY m_rDisplay.getDisplay()
00034 #define XVISUAL m_rDisplay.getVisual()
00035 #define XPIXELSIZE m_rDisplay.getPixelSize()
00036 #define XGC m_rDisplay.getGC()
00037
00038 #define NET_WM_SUPPORTED m_rDisplay.m_net_wm_supported
00039 #define NET_WM_STATE m_rDisplay.m_net_wm_state
00040 #define NET_WM_STATE_FULLSCREEN m_rDisplay.m_net_wm_state_fullscreen
00041 #define NET_WM_STATE_ABOVE m_rDisplay.m_net_wm_state_above
00042
00043 #define NET_WM_STAYS_ON_TOP m_rDisplay.m_net_wm_stays_on_top
00044 #define NET_WM_WINDOW_OPACITY m_rDisplay.m_net_wm_window_opacity
00045
00046 #define NET_WM_PID m_rDisplay.m_net_wm_pid
00047
00048
00049 class X11Display: public SkinObject
00050 {
00051 public:
00052 X11Display( intf_thread_t *pIntf );
00053 virtual ~X11Display();
00054
00055
00056 Display *getDisplay() const { return m_pDisplay; }
00057
00058
00059 Visual *getVisual() const { return m_pVisual; }
00060
00061
00062 int getPixelSize() const { return m_pixelSize; }
00063
00064
00065 GC getGC() const { return m_gc; }
00066
00067
00068 Colormap getColormap() const { return m_colormap; }
00069
00070
00071 typedef void (X11Display::*MakePixelFunc_t)( uint8_t *pPixel,
00072 uint8_t r, uint8_t g, uint8_t b, uint8_t a ) const;
00073
00074
00075 MakePixelFunc_t getBlendPixel() const { return blendPixelImpl; }
00076
00077
00078 MakePixelFunc_t getPutPixel() const { return putPixelImpl; }
00079
00080
00081 unsigned long getPixelValue( uint8_t r, uint8_t g, uint8_t b ) const;
00082
00083
00084 Window getMainWindow() const { return m_mainWindow; }
00085
00086
00087
00088
00089
00090 Atom m_net_wm_supported;
00091 Atom m_net_wm_state;
00092 Atom m_net_wm_state_above;
00093 Atom m_net_wm_state_fullscreen;
00094
00095 Atom m_net_wm_stays_on_top;
00096 Atom m_net_wm_window_opacity;
00097
00098 Atom m_net_wm_pid;
00099
00100
00101 void testEWMH();
00102
00103 private:
00104
00105 Window m_mainWindow;
00106
00107 Display *m_pDisplay;
00108 Visual *m_pVisual;
00109 int m_pixelSize;
00110 GC m_gc;
00111 Colormap m_colormap;
00112 int m_redLeftShift, m_redRightShift;
00113 int m_greenLeftShift, m_greenRightShift;
00114 int m_blueLeftShift, m_blueRightShift;
00115
00116 MakePixelFunc_t blendPixelImpl;
00117
00118 MakePixelFunc_t putPixelImpl;
00119
00120 template<class type> type putPixel(type r, type g, type b) const;
00121 template<class type>
00122 type blendPixel(type v,type r, type g, type b,type a) const;
00123
00124
00125 static void getShifts( uint32_t mask, int &rLeftShift, int &rRightShift );
00126
00127
00128 void blendPixel8( uint8_t *pPixel, uint8_t r, uint8_t g, uint8_t b,
00129 uint8_t a ) const;
00130
00131
00132 void blendPixel16MSB( uint8_t *pPixel, uint8_t r, uint8_t g, uint8_t b,
00133 uint8_t a ) const;
00134
00135
00136 void blendPixel16LSB( uint8_t *pPixel, uint8_t r, uint8_t g, uint8_t b,
00137 uint8_t a ) const;
00138
00139
00140 void blendPixel32MSB( uint8_t *pPixel, uint8_t r, uint8_t g, uint8_t b,
00141 uint8_t a ) const;
00142
00143
00144 void blendPixel32LSB( uint8_t *pPixel, uint8_t r, uint8_t g, uint8_t b,
00145 uint8_t a ) const;
00146
00147
00148 void putPixel8( uint8_t *pPixel, uint8_t r, uint8_t g, uint8_t b,
00149 uint8_t a ) const;
00150
00151
00152 void putPixel16MSB( uint8_t *pPixel, uint8_t r, uint8_t g, uint8_t b,
00153 uint8_t a ) const;
00154
00155
00156 void putPixel16LSB( uint8_t *pPixel, uint8_t r, uint8_t g, uint8_t b,
00157 uint8_t a ) const;
00158
00159
00160 void putPixel32MSB( uint8_t *pPixel, uint8_t r, uint8_t g, uint8_t b,
00161 uint8_t a ) const;
00162
00163
00164 void putPixel32LSB( uint8_t *pPixel, uint8_t r, uint8_t g, uint8_t b,
00165 uint8_t a ) const;
00166
00167 };
00168
00169 #endif