44 #if !defined(Fl_X_H) && !defined(FL_DOXYGEN)
51 # elif defined(__APPLE__)
54 # if defined(_ABIN32) || defined(_ABI64) // fix for broken SGI Irix X .h files
55 # pragma set woff 3322
57 # include <X11/Xlib.h>
58 # include <X11/Xutil.h>
59 # if defined(_ABIN32) || defined(_ABI64)
60 # pragma reset woff 3322
62 # include <X11/Xatom.h>
63 # include "Fl_Window.H"
66 typedef Region Fl_Region;
68 FL_EXPORT
void fl_open_display();
69 FL_EXPORT
void fl_open_display(Display*);
70 FL_EXPORT
void fl_close_display();
73 extern FL_EXPORT Display *fl_display;
74 extern FL_EXPORT
int fl_screen;
75 extern FL_EXPORT XVisualInfo *fl_visual;
76 extern FL_EXPORT Colormap fl_colormap;
80 extern FL_EXPORT GC fl_gc;
81 extern FL_EXPORT Window fl_window;
88 FL_EXPORT
int fl_handle(
const XEvent&);
91 extern FL_EXPORT
const XEvent* fl_xevent;
92 extern FL_EXPORT
ulong fl_event_time;
95 typedef ulong Fl_Offscreen;
96 # define fl_create_offscreen(w,h) \
97 XCreatePixmap(fl_display, \
98 (Fl_Surface_Device::surface()->class_name() == Fl_Display_Device::class_id ? \
99 fl_window : fl_xid(Fl::first_window()) ) , \
100 w, h, fl_visual->depth)
102 # define fl_begin_offscreen(pixmap) \
103 Window _sw=fl_window; fl_window=pixmap; \
104 Fl_Surface_Device *_ss = Fl_Surface_Device::surface(); Fl_Display_Device::display_device()->set_current(); \
106 # define fl_end_offscreen() \
107 fl_pop_clip(); fl_window = _sw; _ss->set_current()
109 extern void fl_copy_offscreen(
int x,
int y,
int w,
int h, Fl_Offscreen pixmap,
int srcx,
int srcy);
110 # define fl_delete_offscreen(pixmap) XFreePixmap(fl_display, pixmap)
113 typedef ulong Fl_Bitmask;
115 extern FL_EXPORT Fl_Bitmask fl_create_bitmask(
int w,
int h,
const uchar *data);
116 extern FL_EXPORT Fl_Bitmask fl_create_alphamask(
int w,
int h,
int d,
int ld,
const uchar *data);
117 extern FL_EXPORT
void fl_delete_bitmask(Fl_Bitmask bm);
119 #if defined(FL_LIBRARY) || defined(FL_INTERNALS)
120 extern FL_EXPORT Window fl_message_window;
121 extern FL_EXPORT
void *fl_xftfont;
122 FL_EXPORT Fl_Region XRectangleRegion(
int x,
int y,
int w,
int h);
131 class Fl_XFont_On_Demand
134 Fl_XFont_On_Demand(XFontStruct* p = NULL) : ptr(p) { }
135 Fl_XFont_On_Demand& operator=(
const Fl_XFont_On_Demand& x)
136 { ptr = x.ptr;
return *
this; }
137 Fl_XFont_On_Demand& operator=(XFontStruct* p)
138 { ptr = p;
return *
this; }
139 XFontStruct* value();
140 operator XFontStruct*() {
return value(); }
141 XFontStruct& operator*() {
return *value(); }
142 XFontStruct* operator->() {
return value(); }
143 bool operator==(
const Fl_XFont_On_Demand& x) {
return ptr == x.ptr; }
144 bool operator!=(
const Fl_XFont_On_Demand& x) {
return ptr != x.ptr; }
148 extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
153 class FL_EXPORT Fl_X {
160 char wait_for_expose;
163 static Fl_X* i(
const Fl_Window* wi) {
return wi->i;}
164 void setwindow(
Fl_Window* wi) {w=wi; wi->i=
this;}
166 static void make_xid(
Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);
167 static Fl_X* set_xid(
Fl_Window*, Window);
169 void flush() {w->flush();}
170 static void x(
Fl_Window* wi,
int X) {wi->
x(X);}
171 static void y(
Fl_Window* wi,
int Y) {wi->
y(Y);}
174 extern FL_EXPORT
char fl_override_redirect;
175 extern FL_EXPORT
int fl_background_pixel;
177 inline Window fl_xid(
const Fl_Window* w) { Fl_X *temp = Fl_X::i(w);
return temp ? temp->xid : 0; }
181 extern Window fl_xid_(
const Fl_Window* w);
182 #define fl_xid(w) fl_xid_(w)
184 #endif // FL_LIBRARY || FL_INTERNALS
186 FL_EXPORT
Fl_Window* fl_find(Window xid);
192 extern FL_EXPORT
int fl_parse_color(
const char* p,
uchar& r,
uchar& g,
uchar& b);