1998-10-20 01:39:29 +04:00
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// "$Id$"
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
|
|
|
// X11 header file for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2012-03-18 22:48:29 +04:00
|
|
|
// Copyright 1998-2012 by Bill Spitzak and others.
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/COPYING.php
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
2005-04-16 04:13:17 +04:00
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.php
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// These are internal fltk symbols that are necessary or useful for
|
|
|
|
// calling Xlib. You should include this file if (and ONLY if) you
|
|
|
|
// need to call Xlib directly. These symbols may not exist on non-X
|
|
|
|
// systems.
|
|
|
|
|
2011-02-06 13:24:23 +03:00
|
|
|
/** \class Fl_Mac_App_Menu
|
|
|
|
Mac OS-specific class allowing to localize the application menu.
|
|
|
|
|
|
|
|
These character strings are used to build the application menu. They can be localized
|
|
|
|
at run time to any UTF-8 text by placing instructions such as this \e very
|
|
|
|
early in the program:
|
|
|
|
\verbatim
|
|
|
|
Fl_Mac_App_Menu::print = "Imprimer la fenêtre";
|
|
|
|
\endverbatim
|
|
|
|
*/
|
|
|
|
|
2008-09-18 23:09:34 +04:00
|
|
|
#if !defined(Fl_X_H) && !defined(FL_DOXYGEN)
|
2001-11-27 20:44:08 +03:00
|
|
|
# define Fl_X_H
|
|
|
|
|
|
|
|
# include "Enumerations.H"
|
|
|
|
|
|
|
|
# ifdef WIN32
|
|
|
|
# include "win32.H"
|
|
|
|
# elif defined(__APPLE__)
|
|
|
|
# include "mac.H"
|
|
|
|
# else
|
|
|
|
# if defined(_ABIN32) || defined(_ABI64) // fix for broken SGI Irix X .h files
|
|
|
|
# pragma set woff 3322
|
|
|
|
# endif
|
|
|
|
# include <X11/Xlib.h>
|
|
|
|
# include <X11/Xutil.h>
|
|
|
|
# if defined(_ABIN32) || defined(_ABI64)
|
|
|
|
# pragma reset woff 3322
|
|
|
|
# endif
|
|
|
|
# include <X11/Xatom.h>
|
|
|
|
# include "Fl_Window.H"
|
2008-09-11 03:56:49 +04:00
|
|
|
# include "Xutf8.h"
|
2001-11-27 20:44:08 +03:00
|
|
|
// Mirror X definition of Region to Fl_Region, for portability...
|
2001-11-27 20:48:16 +03:00
|
|
|
typedef Region Fl_Region;
|
1998-10-06 22:21:25 +04:00
|
|
|
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_open_display();
|
2000-02-23 12:23:53 +03:00
|
|
|
FL_EXPORT void fl_open_display(Display*);
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void fl_close_display();
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// constant info about the X server connection:
|
1999-02-17 01:00:04 +03:00
|
|
|
extern FL_EXPORT Display *fl_display;
|
|
|
|
extern FL_EXPORT int fl_screen;
|
|
|
|
extern FL_EXPORT XVisualInfo *fl_visual;
|
|
|
|
extern FL_EXPORT Colormap fl_colormap;
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2010-04-09 20:46:45 +04:00
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
// drawing functions:
|
1999-02-17 01:00:04 +03:00
|
|
|
extern FL_EXPORT GC fl_gc;
|
|
|
|
extern FL_EXPORT Window fl_window;
|
|
|
|
FL_EXPORT ulong fl_xpixel(Fl_Color i);
|
|
|
|
FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b);
|
2001-11-27 20:44:08 +03:00
|
|
|
FL_EXPORT void fl_clip_region(Fl_Region);
|
2002-03-06 21:11:01 +03:00
|
|
|
FL_EXPORT Fl_Region fl_clip_region();
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// feed events into fltk:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT int fl_handle(const XEvent&);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// you can use these in Fl::add_handler() to look at events:
|
1999-02-17 01:00:04 +03:00
|
|
|
extern FL_EXPORT const XEvent* fl_xevent;
|
|
|
|
extern FL_EXPORT ulong fl_event_time;
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// off-screen pixmaps: create, destroy, draw into, copy to window:
|
2001-11-18 23:52:28 +03:00
|
|
|
typedef ulong Fl_Offscreen;
|
2010-07-09 21:31:33 +04:00
|
|
|
# define fl_create_offscreen(w,h) \
|
|
|
|
XCreatePixmap(fl_display, \
|
2012-03-18 22:48:29 +04:00
|
|
|
(Fl_Surface_Device::surface() == Fl_Display_Device::display_device() ? \
|
2010-07-09 21:31:33 +04:00
|
|
|
fl_window : fl_xid(Fl::first_window()) ) , \
|
|
|
|
w, h, fl_visual->depth)
|
1998-10-15 18:06:16 +04:00
|
|
|
// begin/end are macros that save the old state in local variables:
|
2001-11-27 20:44:08 +03:00
|
|
|
# define fl_begin_offscreen(pixmap) \
|
2010-07-09 21:31:33 +04:00
|
|
|
Window _sw=fl_window; fl_window=pixmap; \
|
2011-02-02 15:42:47 +03:00
|
|
|
Fl_Surface_Device *_ss = Fl_Surface_Device::surface(); Fl_Display_Device::display_device()->set_current(); \
|
2010-07-09 21:31:33 +04:00
|
|
|
fl_push_no_clip()
|
2001-11-27 20:44:08 +03:00
|
|
|
# define fl_end_offscreen() \
|
2010-07-09 21:31:33 +04:00
|
|
|
fl_pop_clip(); fl_window = _sw; _ss->set_current()
|
1998-10-15 18:06:16 +04:00
|
|
|
|
2010-07-09 21:31:33 +04:00
|
|
|
extern void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
|
2001-11-27 20:44:08 +03:00
|
|
|
# define fl_delete_offscreen(pixmap) XFreePixmap(fl_display, pixmap)
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2001-11-18 23:52:28 +03:00
|
|
|
// Bitmap masks
|
|
|
|
typedef ulong Fl_Bitmask;
|
|
|
|
|
|
|
|
extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
|
2002-04-15 16:19:01 +04:00
|
|
|
extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
|
2001-11-18 23:52:28 +03:00
|
|
|
extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
|
|
|
|
|
2011-01-18 02:52:32 +03:00
|
|
|
#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
|
2011-01-12 12:24:03 +03:00
|
|
|
extern FL_EXPORT Window fl_message_window;
|
|
|
|
extern FL_EXPORT void *fl_xftfont;
|
|
|
|
FL_EXPORT Fl_Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.cxx
|
|
|
|
|
|
|
|
// access to core fonts:
|
|
|
|
// This class provides a "smart pointer" that returns a pointer to an XFontStruct.
|
|
|
|
// The global variable fl_xfont can be called wherever a bitmap "core" font is
|
|
|
|
// needed, e.g. when rendering to a GL context under X11.
|
|
|
|
// With Xlib / X11 fonts, fl_xfont will return the current selected font.
|
|
|
|
// With XFT / X11 fonts, fl_xfont will attempt to return the bitmap "core" font most
|
|
|
|
// similar to (usually the same as) the current XFT font.
|
|
|
|
class Fl_XFont_On_Demand
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Fl_XFont_On_Demand(XFontStruct* p = NULL) : ptr(p) { }
|
|
|
|
Fl_XFont_On_Demand& operator=(const Fl_XFont_On_Demand& x)
|
|
|
|
{ ptr = x.ptr; return *this; }
|
|
|
|
Fl_XFont_On_Demand& operator=(XFontStruct* p)
|
|
|
|
{ ptr = p; return *this; }
|
|
|
|
XFontStruct* value();
|
|
|
|
operator XFontStruct*() { return value(); }
|
|
|
|
XFontStruct& operator*() { return *value(); }
|
|
|
|
XFontStruct* operator->() { return value(); }
|
|
|
|
bool operator==(const Fl_XFont_On_Demand& x) { return ptr == x.ptr; }
|
|
|
|
bool operator!=(const Fl_XFont_On_Demand& x) { return ptr != x.ptr; }
|
|
|
|
private:
|
|
|
|
XFontStruct *ptr;
|
|
|
|
};
|
|
|
|
extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
// this object contains all X-specific stuff about a window:
|
2011-01-14 01:00:11 +03:00
|
|
|
// Warning: this object is highly subject to change!
|
2011-01-18 02:52:32 +03:00
|
|
|
// FL_LIBRARY or FL_INTERNALS must be defined to access this class.
|
2002-08-14 20:49:38 +04:00
|
|
|
class FL_EXPORT Fl_X {
|
1998-10-06 22:21:25 +04:00
|
|
|
public:
|
|
|
|
Window xid;
|
|
|
|
Window other_xid;
|
|
|
|
Fl_Window *w;
|
2001-11-27 20:44:08 +03:00
|
|
|
Fl_Region region;
|
1998-10-06 22:21:25 +04:00
|
|
|
Fl_X *next;
|
1998-11-05 19:04:53 +03:00
|
|
|
char wait_for_expose;
|
|
|
|
char backbuffer_bad; // used for XDBE
|
2002-08-14 20:49:38 +04:00
|
|
|
static Fl_X* first;
|
|
|
|
static Fl_X* i(const Fl_Window* wi) {return wi->i;}
|
|
|
|
void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
|
|
|
|
void sendxjunk();
|
|
|
|
static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);
|
|
|
|
static Fl_X* set_xid(Fl_Window*, Window);
|
1998-10-06 22:21:25 +04:00
|
|
|
// kludges to get around protection:
|
2002-08-14 20:49:38 +04:00
|
|
|
void flush() {w->flush();}
|
|
|
|
static void x(Fl_Window* wi, int X) {wi->x(X);}
|
|
|
|
static void y(Fl_Window* wi, int Y) {wi->y(Y);}
|
2012-03-23 20:47:53 +04:00
|
|
|
static int ewmh_supported();
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
|
2011-01-12 12:24:03 +03:00
|
|
|
extern FL_EXPORT char fl_override_redirect; // hack into Fl_X::make_xid()
|
|
|
|
extern FL_EXPORT int fl_background_pixel; // hack into Fl_X::make_xid()
|
|
|
|
|
2011-10-02 10:25:13 +04:00
|
|
|
inline Window fl_xid(const Fl_Window* w) { Fl_X *xTemp = Fl_X::i(w); return xTemp ? xTemp->xid : 0; }
|
2011-01-20 16:22:30 +03:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
extern Window fl_xid_(const Fl_Window* w);
|
|
|
|
#define fl_xid(w) fl_xid_(w)
|
|
|
|
|
2011-01-18 02:52:32 +03:00
|
|
|
#endif // FL_LIBRARY || FL_INTERNALS
|
2011-01-12 12:24:03 +03:00
|
|
|
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT Fl_Window* fl_find(Window xid);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
|
2003-06-01 04:31:32 +04:00
|
|
|
// Dummy function to register a function for opening files via the window manager...
|
|
|
|
inline void fl_open_callback(void (*)(const char *)) {}
|
|
|
|
|
2002-01-01 16:11:29 +03:00
|
|
|
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
|
|
|
|
|
2001-11-27 20:44:08 +03:00
|
|
|
# endif
|
1998-10-06 22:21:25 +04:00
|
|
|
#endif
|
1998-10-20 01:39:29 +04:00
|
|
|
|
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// End of "$Id$".
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|