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