24 #if !defined(Fl_X_H) && !defined(FL_DOXYGEN)
31 # elif defined(__APPLE__)
34 # if defined(_ABIN32) || defined(_ABI64) // fix for broken SGI Irix X .h files
35 # pragma set woff 3322
37 # include <X11/Xlib.h>
38 # include <X11/Xutil.h>
39 # if defined(_ABIN32) || defined(_ABI64)
40 # pragma reset woff 3322
42 # include <X11/Xatom.h>
45 typedef Region Fl_Region;
47 FL_EXPORT
void fl_open_display();
48 FL_EXPORT
void fl_open_display(Display*);
49 FL_EXPORT
void fl_close_display();
52 extern FL_EXPORT Display *fl_display;
53 extern FL_EXPORT
int fl_screen;
54 extern FL_EXPORT XVisualInfo *fl_visual;
55 extern FL_EXPORT Colormap fl_colormap;
59 extern FL_EXPORT GC fl_gc;
60 extern FL_EXPORT Window fl_window;
67 FL_EXPORT
int fl_handle(
const XEvent&);
70 extern FL_EXPORT
const XEvent* fl_xevent;
71 extern FL_EXPORT
ulong fl_event_time;
74 typedef ulong Fl_Offscreen;
75 # define fl_create_offscreen(w,h) XCreatePixmap(fl_display, RootWindow(fl_display, fl_screen), w, h, fl_visual->depth)
76 # define fl_create_offscreen_with_alpha(w,h) XCreatePixmap(fl_display, RootWindow(fl_display, fl_screen), w, h, 32)
78 # define fl_begin_offscreen(pixmap) \
79 Window _sw=fl_window; fl_window=pixmap; \
80 Fl_Surface_Device *_ss = Fl_Surface_Device::surface(); Fl_Display_Device::display_device()->set_current(); \
82 # define fl_end_offscreen() \
83 fl_pop_clip(); fl_window = _sw; _ss->set_current()
85 extern FL_EXPORT
void fl_copy_offscreen(
int x,
int y,
int w,
int h, Fl_Offscreen pixmap,
int srcx,
int srcy);
86 # define fl_delete_offscreen(pixmap) XFreePixmap(fl_display, pixmap)
89 typedef ulong Fl_Bitmask;
91 extern FL_EXPORT Fl_Bitmask fl_create_bitmask(
int w,
int h,
const uchar *data);
92 extern FL_EXPORT Fl_Bitmask fl_create_alphamask(
int w,
int h,
int d,
int ld,
const uchar *data);
93 extern FL_EXPORT
void fl_delete_bitmask(Fl_Bitmask bm);
95 #if defined(FL_LIBRARY) || defined(FL_INTERNALS)
96 extern FL_EXPORT Window fl_message_window;
97 extern FL_EXPORT
void *fl_xftfont;
98 FL_EXPORT Fl_Region XRectangleRegion(
int x,
int y,
int w,
int h);
107 class FL_EXPORT Fl_XFont_On_Demand
110 Fl_XFont_On_Demand(XFontStruct* p = NULL) : ptr(p) { }
111 Fl_XFont_On_Demand& operator=(
const Fl_XFont_On_Demand& x)
112 { ptr = x.ptr;
return *
this; }
113 Fl_XFont_On_Demand& operator=(XFontStruct* p)
114 { ptr = p;
return *
this; }
115 XFontStruct* value();
116 operator XFontStruct*() {
return value(); }
117 XFontStruct& operator*() {
return *value(); }
118 XFontStruct* operator->() {
return value(); }
119 bool operator==(
const Fl_XFont_On_Demand& x) {
return ptr == x.ptr; }
120 bool operator!=(
const Fl_XFont_On_Demand& x) {
return ptr != x.ptr; }
124 extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
125 extern FL_EXPORT XFontStruct* fl_X_core_font();
130 class FL_EXPORT Fl_X {
137 char wait_for_expose;
140 static Fl_X* i(
const Fl_Window* wi) {
return wi->i;}
141 void setwindow(
Fl_Window* wi) {w=wi; wi->i=
this;}
143 static void set_default_icons(
const Fl_RGB_Image*[],
int);
147 static void make_xid(
Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);
148 static Fl_X* set_xid(
Fl_Window*, Window);
150 void flush() {w->flush();}
151 static void x(
Fl_Window* wi,
int X) {wi->
x(X);}
152 static void y(
Fl_Window* wi,
int Y) {wi->
y(Y);}
153 static int ewmh_supported();
154 static int xrender_supported();
155 static void activate_window(Window w);
158 extern FL_EXPORT
char fl_override_redirect;
159 extern FL_EXPORT
int fl_background_pixel;
161 inline Window fl_xid(
const Fl_Window* w) { Fl_X *xTemp = Fl_X::i(w);
return xTemp ? xTemp->xid : 0; }
165 extern FL_EXPORT Window fl_xid_(
const Fl_Window* w);
166 #define fl_xid(w) fl_xid_(w)
168 #endif // FL_LIBRARY || FL_INTERNALS
170 FL_EXPORT
Fl_Window* fl_find(Window xid);
176 extern FL_EXPORT
int fl_parse_color(
const char* p,
uchar& r,
uchar& g,
uchar& b);