1998-10-20 01:39:29 +04:00
|
|
|
//
|
2001-01-22 18:13:41 +03:00
|
|
|
// "$Id: x.H,v 1.10.2.8 2001/01/22 15:13:38 easysw Exp $"
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
|
|
|
// X11 header file for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2001-01-22 18:13:41 +03:00
|
|
|
// Copyright 1998-2001 by Bill Spitzak and others.
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Library General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Library General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Library General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
// USA.
|
|
|
|
//
|
2000-06-06 01:21:24 +04:00
|
|
|
// Please report all bugs and problems to "fltk-bugs@fltk.org".
|
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.
|
|
|
|
|
|
|
|
#ifndef Fl_X_H
|
|
|
|
#define Fl_X_H
|
|
|
|
|
|
|
|
#include "Enumerations.H"
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
|
|
|
|
#include "win32.H"
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
1999-10-16 23:58:22 +04:00
|
|
|
#if defined(_ABIN32) || defined(_ABI64) // fix for broken SGI Irix X .h files
|
1999-10-14 08:58:13 +04:00
|
|
|
#pragma set woff 3322
|
|
|
|
#endif
|
1998-10-06 22:21:25 +04:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
1999-10-16 23:58:22 +04:00
|
|
|
#if defined(_ABIN32) || defined(_ABI64)
|
1999-10-14 08:58:13 +04:00
|
|
|
#pragma reset woff 3322
|
|
|
|
#endif
|
1998-10-06 22:21:25 +04:00
|
|
|
#include <X11/Xatom.h>
|
|
|
|
#include "Fl_Window.H"
|
|
|
|
|
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
|
|
|
|
|
|
|
// drawing functions:
|
1999-02-17 01:00:04 +03:00
|
|
|
extern FL_EXPORT GC fl_gc;
|
|
|
|
extern FL_EXPORT Window fl_window;
|
|
|
|
extern FL_EXPORT XFontStruct* fl_xfont;
|
|
|
|
FL_EXPORT ulong fl_xpixel(Fl_Color i);
|
|
|
|
FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b);
|
|
|
|
FL_EXPORT void fl_clip_region(Region);
|
|
|
|
FL_EXPORT Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.cxx
|
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:
|
|
|
|
#define Fl_Offscreen ulong
|
|
|
|
#define fl_create_offscreen(w,h) \
|
1998-10-15 18:06:16 +04:00
|
|
|
XCreatePixmap(fl_display, fl_window, w, h, fl_visual->depth)
|
|
|
|
// begin/end are macros that save the old state in local variables:
|
|
|
|
#define fl_begin_offscreen(pixmap) \
|
|
|
|
Window _sw=fl_window; fl_window=pixmap; fl_push_no_clip()
|
|
|
|
#define fl_end_offscreen() \
|
|
|
|
fl_pop_clip(); fl_window = _sw
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
#define fl_copy_offscreen(x,y,w,h,pixmap,srcx,srcy) \
|
|
|
|
XCopyArea(fl_display, pixmap, fl_window, fl_gc, srcx, srcy, w, h, x, y)
|
|
|
|
#define fl_delete_offscreen(pixmap) XFreePixmap(fl_display, pixmap)
|
|
|
|
|
|
|
|
// this object contains all X-specific stuff about a window:
|
|
|
|
// Warning: this object is highly subject to change! It's definition
|
|
|
|
// is only here so that fl_xid can be declared inline:
|
|
|
|
class Fl_X {
|
|
|
|
public:
|
|
|
|
Window xid;
|
|
|
|
Window other_xid;
|
|
|
|
Fl_Window *w;
|
|
|
|
Region region;
|
|
|
|
Fl_X *next;
|
1998-11-05 19:04:53 +03:00
|
|
|
char wait_for_expose;
|
|
|
|
char backbuffer_bad; // used for XDBE
|
1999-02-17 01:00:04 +03:00
|
|
|
static FL_EXPORT Fl_X* first;
|
|
|
|
static FL_EXPORT Fl_X* i(const Fl_Window* w) {return w->i;}
|
|
|
|
FL_EXPORT void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
|
|
|
|
FL_EXPORT void sendxjunk();
|
|
|
|
static FL_EXPORT void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);
|
|
|
|
static FL_EXPORT Fl_X* set_xid(Fl_Window*, Window);
|
1998-10-06 22:21:25 +04:00
|
|
|
// kludges to get around protection:
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void flush() {w->flush();}
|
|
|
|
static FL_EXPORT void x(Fl_Window* w, int X) {w->x(X);}
|
|
|
|
static FL_EXPORT void y(Fl_Window* w, int Y) {w->y(Y);}
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// convert xid <-> Fl_Window:
|
|
|
|
inline Window fl_xid(const Fl_Window*w) {return Fl_X::i(w)->xid;}
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT Fl_Window* fl_find(Window xid);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
1999-02-17 01:00:04 +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()
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
1998-10-20 01:39:29 +04:00
|
|
|
|
|
|
|
//
|
2001-01-22 18:13:41 +03:00
|
|
|
// End of "$Id: x.H,v 1.10.2.8 2001/01/22 15:13:38 easysw Exp $".
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|