00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if !defined(Fl_X_H) && !defined(FL_DOXYGEN)
00025 # define Fl_X_H
00026
00027 # include "Enumerations.H"
00028
00029 # ifdef WIN32
00030 # include "win32.H"
00031 # elif defined(__APPLE__)
00032 # include "mac.H"
00033 # else
00034 # if defined(_ABIN32) || defined(_ABI64) // fix for broken SGI Irix X .h files
00035 # pragma set woff 3322
00036 # endif
00037 # include <X11/Xlib.h>
00038 # include <X11/Xutil.h>
00039 # if defined(_ABIN32) || defined(_ABI64)
00040 # pragma reset woff 3322
00041 # endif
00042 # include <X11/Xatom.h>
00043 # include "Fl_Window.H"
00044
00045 typedef Region Fl_Region;
00046
00047 FL_EXPORT void fl_open_display();
00048 FL_EXPORT void fl_open_display(Display*);
00049 FL_EXPORT void fl_close_display();
00050
00051
00052 extern FL_EXPORT Display *fl_display;
00053 extern FL_EXPORT int fl_screen;
00054 extern FL_EXPORT XVisualInfo *fl_visual;
00055 extern FL_EXPORT Colormap fl_colormap;
00056
00057
00058
00059 extern FL_EXPORT GC fl_gc;
00060 extern FL_EXPORT Window fl_window;
00061 FL_EXPORT ulong fl_xpixel(Fl_Color i);
00062 FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b);
00063 FL_EXPORT void fl_clip_region(Fl_Region);
00064 FL_EXPORT Fl_Region fl_clip_region();
00065
00066
00067 FL_EXPORT int fl_handle(const XEvent&);
00068
00069
00070 extern FL_EXPORT const XEvent* fl_xevent;
00071 extern FL_EXPORT ulong fl_event_time;
00072
00073
00074 typedef ulong Fl_Offscreen;
00075 # define fl_create_offscreen(w,h) XCreatePixmap(fl_display, RootWindow(fl_display, fl_screen), w, h, fl_visual->depth)
00076 # define fl_create_offscreen_with_alpha(w,h) XCreatePixmap(fl_display, RootWindow(fl_display, fl_screen), w, h, 32)
00077
00078 # define fl_begin_offscreen(pixmap) \
00079 Window _sw=fl_window; fl_window=pixmap; \
00080 Fl_Surface_Device *_ss = Fl_Surface_Device::surface(); Fl_Display_Device::display_device()->set_current(); \
00081 fl_push_no_clip()
00082 # define fl_end_offscreen() \
00083 fl_pop_clip(); fl_window = _sw; _ss->set_current()
00084
00085 extern FL_EXPORT void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
00086 # define fl_delete_offscreen(pixmap) XFreePixmap(fl_display, pixmap)
00087
00088
00089 typedef ulong Fl_Bitmask;
00090
00091 extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
00092 extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
00093 extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
00094
00095 #if defined(FL_LIBRARY) || defined(FL_INTERNALS)
00096 extern FL_EXPORT Window fl_message_window;
00097 extern FL_EXPORT void *fl_xftfont;
00098 FL_EXPORT Fl_Region XRectangleRegion(int x, int y, int w, int h);
00099
00100
00101
00102
00103
00104
00105
00106
00107 class Fl_XFont_On_Demand
00108 {
00109 public:
00110 Fl_XFont_On_Demand(XFontStruct* p = NULL) : ptr(p) { }
00111 Fl_XFont_On_Demand& operator=(const Fl_XFont_On_Demand& x)
00112 { ptr = x.ptr; return *this; }
00113 Fl_XFont_On_Demand& operator=(XFontStruct* p)
00114 { ptr = p; return *this; }
00115 XFontStruct* value();
00116 operator XFontStruct*() { return value(); }
00117 XFontStruct& operator*() { return *value(); }
00118 XFontStruct* operator->() { return value(); }
00119 bool operator==(const Fl_XFont_On_Demand& x) { return ptr == x.ptr; }
00120 bool operator!=(const Fl_XFont_On_Demand& x) { return ptr != x.ptr; }
00121 private:
00122 XFontStruct *ptr;
00123 };
00124 extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
00125 extern FL_EXPORT XFontStruct* fl_X_core_font();
00126
00127
00128
00129
00130 class FL_EXPORT Fl_X {
00131 public:
00132 Window xid;
00133 Window other_xid;
00134 Fl_Window *w;
00135 Fl_Region region;
00136 Fl_X *next;
00137 char wait_for_expose;
00138 char backbuffer_bad;
00139 static Fl_X* first;
00140 static Fl_X* i(const Fl_Window* wi) {return wi->i;}
00141 void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
00142 void sendxjunk();
00143 static void set_default_icons(const Fl_RGB_Image*[], int);
00144 void set_icons();
00145 int set_cursor(Fl_Cursor);
00146 int set_cursor(const Fl_RGB_Image*, int, int);
00147 static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);
00148 static Fl_X* set_xid(Fl_Window*, Window);
00149
00150 void flush() {w->flush();}
00151 static void x(Fl_Window* wi, int X) {wi->x(X);}
00152 static void y(Fl_Window* wi, int Y) {wi->y(Y);}
00153 static int ewmh_supported();
00154 static int xrender_supported();
00155 static void activate_window(Window w);
00156 };
00157
00158 extern FL_EXPORT char fl_override_redirect;
00159 extern FL_EXPORT int fl_background_pixel;
00160
00161 inline Window fl_xid(const Fl_Window* w) { Fl_X *xTemp = Fl_X::i(w); return xTemp ? xTemp->xid : 0; }
00162
00163 #else
00164
00165 extern FL_EXPORT Window fl_xid_(const Fl_Window* w);
00166 #define fl_xid(w) fl_xid_(w)
00167
00168 #endif // FL_LIBRARY || FL_INTERNALS
00169
00170 FL_EXPORT Fl_Window* fl_find(Window xid);
00171
00172
00173
00174 inline void fl_open_callback(void (*)(const char *)) {}
00175
00176 extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
00177
00178 # endif
00179 #endif
00180
00181
00182
00183