mirror of https://github.com/fltk/fltk
Create FL/x11.H holding declarations specific to X11 platform.
This commit is contained in:
parent
3f2166ea91
commit
fc1efc7957
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Platform header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
// Copyright 1998-2022 by Bill Spitzak and others.
|
||||
//
|
||||
// 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
|
||||
|
@ -40,72 +40,8 @@ class Fl_Window;
|
|||
# elif defined(__ANDROID__)
|
||||
# include "android.H"
|
||||
# elif defined(FLTK_USE_X11)
|
||||
# include <FL/fl_types.h>
|
||||
# include <FL/Enumerations.H>
|
||||
# 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>
|
||||
|
||||
// constant info about the X server connection:
|
||||
extern FL_EXPORT Display *fl_display;
|
||||
extern FL_EXPORT int fl_screen;
|
||||
extern FL_EXPORT XVisualInfo *fl_visual;
|
||||
extern FL_EXPORT Colormap fl_colormap;
|
||||
|
||||
// drawing functions:
|
||||
extern FL_EXPORT GC fl_gc;
|
||||
FL_EXPORT ulong fl_xpixel(Fl_Color i);
|
||||
FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b);
|
||||
|
||||
// feed events into fltk:
|
||||
FL_EXPORT int fl_handle(const XEvent&);
|
||||
|
||||
// you can use these in Fl::add_handler() to look at events:
|
||||
extern FL_EXPORT const XEvent* fl_xevent;
|
||||
extern FL_EXPORT ulong fl_event_time;
|
||||
|
||||
#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
|
||||
extern FL_EXPORT Window fl_message_window;
|
||||
extern FL_EXPORT void *fl_xftfont;
|
||||
|
||||
// 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_EXPORT 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;
|
||||
|
||||
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()
|
||||
|
||||
#endif // FL_LIBRARY || FL_INTERNALS
|
||||
|
||||
# endif // X11
|
||||
# include "x11.H"
|
||||
# endif // _WIN32
|
||||
|
||||
//
|
||||
// cross-platform declarations
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
//
|
||||
// X11 platform header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2022 by Bill Spitzak and others.
|
||||
//
|
||||
// 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:
|
||||
//
|
||||
// https://www.fltk.org/COPYING.php
|
||||
//
|
||||
// Please see the following page on how to report bugs and issues:
|
||||
//
|
||||
// https://www.fltk.org/bugs.php
|
||||
//
|
||||
|
||||
// Do not directly include this file, instead use <FL/platform.H>. It will
|
||||
// include this file if FLTK_USE_X11 is defined. This is to encourage
|
||||
// portability of even the system-specific code...
|
||||
|
||||
#ifndef FL_DOXYGEN
|
||||
|
||||
#ifndef FL_PLATFORM_H
|
||||
# error "Never use <FL/x11.H> directly; include <FL/platform.H> instead."
|
||||
#endif // !FL_PLATFORM_H
|
||||
|
||||
#include <FL/Enumerations.H>
|
||||
|
||||
#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>
|
||||
|
||||
// constant info about the X server connection:
|
||||
extern FL_EXPORT Display *fl_display;
|
||||
extern FL_EXPORT int fl_screen;
|
||||
extern FL_EXPORT XVisualInfo *fl_visual;
|
||||
extern FL_EXPORT Colormap fl_colormap;
|
||||
|
||||
// drawing functions:
|
||||
extern FL_EXPORT GC fl_gc;
|
||||
FL_EXPORT ulong fl_xpixel(Fl_Color i);
|
||||
FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b);
|
||||
|
||||
// feed events into fltk:
|
||||
FL_EXPORT int fl_handle(const XEvent&);
|
||||
|
||||
// you can use these in Fl::add_handler() to look at events:
|
||||
extern FL_EXPORT const XEvent* fl_xevent;
|
||||
extern FL_EXPORT ulong fl_event_time;
|
||||
|
||||
#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
|
||||
extern FL_EXPORT Window fl_message_window;
|
||||
extern FL_EXPORT void *fl_xftfont;
|
||||
|
||||
// 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_EXPORT 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;
|
||||
|
||||
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()
|
||||
|
||||
#endif // FL_LIBRARY || FL_INTERNALS
|
||||
|
||||
#endif // FL_DOXYGEN
|
Loading…
Reference in New Issue