6 //These must be included here so that important types and functions aren't
7 //dragged into the X namespace, but left undefined in the global namespace.
11 # include <sys/types.h>
15 // Unfortunately, many common X calls are actually macros and the X::
16 // prefix must be avoided when using them. Still, it is nice to use
17 // a separate namespace whenever possible.
19 // the next line ensures that X macros are expanded correctly into functions
20 // in the X namespace, since _XPrivDisplay appears to be the only
21 // real X object used by all X macros:
22 # define _XPrivDisplay X::_XPrivDisplay
24 // this is just so I can easily see which identifiers are macros from Xlib
25 // that can't be prefixed by "X::"
26 # define X_MACRO(x) (x)
30 # include <X11/Xlib.h>
32 # include <X11/extensions/shape.h>
36 // forward declaration for rectangle
43 X::XpmAttributes attr
;
47 extern X::Window wActiveWin
, wProgramWin
;
48 extern X::Atom deleteWin
, _XA_GNUSTEP_WM_FUNC
;
52 X::Display
* xDisplay
;
53 X::Window xRootWindow
;
54 X::XWindowAttributes xAttributes
;
57 unsigned long color_to_xcolor(Color
) const;
58 void set_GC(X::GC
, Color
) const;
64 X::Display
* xdisplay() const;
65 const X::Window
xrootwin() const;
68 bool create_pixmap(WMPixmap
& dest
, char * pixmap_bytes
[]) const;
69 bool create_pixmap(WMPixmap
& dest
, const WMPixmap
& source
) const;
70 bool create_pixmap(WMPixmap
& dest
, const WMPixmap
* source
) const;
71 bool create_pixmap(WMPixmap
& dest
, int width
, int height
) const;
72 bool create_pixmap(WMPixmap
& dest
, int width
, int height
, int depth
) const;
74 void free_pixmap(WMPixmap
& dest
) const;
76 Color
get_point(const WMPixmap
& src
, int x
, int y
) const;
78 void draw_point(WMPixmap
& dest
, int x
, int y
, Color c
) const;
79 void draw_line(WMPixmap
& dest
, int x1
, int y1
, int x2
, int y2
, Color c
)
81 void draw_arc(WMPixmap
& dest
, int x
, int y
, int width
, int height
,
82 int angle1
, int angle2
, Color c
); //angles are in units of degrees * 64
83 void draw_lines(WMPixmap
& dest
, const X::XPoint
* points
, int npoints
,
84 Color c
) const; //X::XPoint is simply a struct { short x, y };
86 // draws a color gradient from left to right or bottom to top from color1
87 // to color2. amount is the proportion of the gradient to draw i.e. 0.5
88 // draws half the gradient. It should always be at least 2 pixels wide.
89 void draw_horizontal_gradient(WMPixmap
& dest
, int x1
, int y1
, int x2
, int y2
, Color c1
, Color c2
, double amount
= 1.0);
90 void draw_vertical_gradient(WMPixmap
& dest
, int x1
, int y1
, int x2
, int y2
, Color c1
, Color c2
, double amount
= 1.0);
92 void draw_border(WMPixmap
& dest
, int x
, int y
, int width
, int height
,
93 int thickness
, Color topleft
, Color botright
, Color corner
)
95 void draw_border(WMPixmap
& dest
, const WMRectangle
& posn
, int thickness
,
96 Color topleft
, Color botright
, Color corner
) const;
98 void fill_rectangle(WMPixmap
& dest
, int x
, int y
, int width
, int height
,
100 void fill_rectangle(WMPixmap
& dest
, const WMRectangle
& posn
, Color c
)
103 void fill_arc(WMPixmap
& dest
, int x
, int y
, int width
, int height
,
104 int angle1
, int angle2
, Color c
); //angles are in units of degrees * 64
106 enum XShape
{ complex = X_MACRO(Complex
), convex
= X_MACRO(Convex
),
107 nonconvex
= X_MACRO(Nonconvex
) };
108 void fill_polygon(WMPixmap
& dest
, const X::XPoint
* points
, int npoints
,
109 Color c
, XShape shape
= complex) const;
110 //shape is simply a hint to the X server about what type of shape is
111 //being drawn. See XFillPolygon(3) for a complete description.
113 void clear_rectangle(WMPixmap
& dest
, int x
, int y
, int width
, int height
)
115 void clear_rectangle(WMPixmap
& dest
, const WMRectangle
& posn
) const;
117 void copy_rectangle(const WMPixmap
& source
, WMPixmap
& dest
,
118 int source_x
, int source_y
, int source_w
, int source_h
,
119 int dest_x
= 0, int dest_y
= 0) const;
120 void copy_rectangle(const WMPixmap
& source
, WMPixmap
& dest
,
121 const WMRectangle
& posn
, int dest_x
= 0, int dest_y
= 0)
123 void copy_rectangle(const WMPixmap
& source
, X::Drawable
& dest
,
124 int source_x
, int source_y
, int source_w
, int source_h
,
125 int dest_x
= 0, int dest_y
= 0) const;
126 void copy_rectangle(const WMPixmap
& source
, X::Drawable
& dest
,
127 const WMRectangle
& posn
, int dest_x
= 0, int dest_y
= 0)
132 Xwrapper::xdisplay() const { return xDisplay
; }
134 inline const X::Window
135 Xwrapper::xrootwin() const { return xRootWindow
; }
138 Xwrapper::get_GC() const { return xGC
; }