Add Fl::screen_count() and Fl::screen_xywh() APIs to support multi-
screen displays (currently only X11 support with Xinerama) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4223 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
81fd6777b2
commit
cc593f6b64
2
CHANGES
2
CHANGES
@ -2,6 +2,8 @@ CHANGES IN FLTK 1.1.7
|
||||
|
||||
- Documentation fixes (STR #648, STR #692, STR #730, STR
|
||||
#744, STR #745)
|
||||
- Added Fl::screen_count() and Fl::screen_xywh() APIs to
|
||||
support multi-screen displays.
|
||||
- FLUID now supports direct creation of widget classes.
|
||||
- Fl_File_Chooser now correctly handles multiple
|
||||
selections that are a mix of files and directories.
|
||||
|
12
FL/Fl.H
12
FL/Fl.H
@ -20,7 +20,9 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA.
|
||||
//
|
||||
// Please report all bugs and problems to "fltk-bugs@fltk.org".
|
||||
// Please report all bugs and problems on the following page:
|
||||
//
|
||||
// http://www.fltk.org/str.php
|
||||
//
|
||||
|
||||
#ifndef Fl_H
|
||||
@ -199,6 +201,14 @@ public:
|
||||
static int w();
|
||||
static int h();
|
||||
|
||||
// multi-head support:
|
||||
static int screen_count();
|
||||
static void screen_xywh(int &x, int &y, int &w, int &h) {
|
||||
screen_xywh(x, y, w, h, e_x_root, e_y_root);
|
||||
}
|
||||
static void screen_xywh(int &x, int &y, int &w, int &h, int mx, int my);
|
||||
static void screen_xywh(int &x, int &y, int &w, int &h, int n);
|
||||
|
||||
// color map:
|
||||
static void set_color(Fl_Color, uchar, uchar, uchar);
|
||||
static void set_color(Fl_Color, unsigned);
|
||||
|
12
configh.in
12
configh.in
@ -21,7 +21,9 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "fltk-bugs@fltk.org".
|
||||
* Please report all bugs and problems on the following page:
|
||||
*
|
||||
* http://www.fltk.org/str.php
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -74,6 +76,14 @@
|
||||
|
||||
#define USE_COLORMAP 1
|
||||
|
||||
/*
|
||||
* HAVE_XINERAMA
|
||||
*
|
||||
* Do we have the Xinerama library to support multi-head displays?
|
||||
*/
|
||||
|
||||
#define HAVE_XINERAMA 0
|
||||
|
||||
/*
|
||||
* USE_XFT
|
||||
*
|
||||
|
@ -607,6 +607,15 @@ case $uname in
|
||||
GLDEMOS=""
|
||||
fi
|
||||
|
||||
dnl Check for Xinerama support unless disabled...
|
||||
AC_ARG_ENABLE(xinerama, [ --enable-xinerama turn on Xinerama support [default=no]])
|
||||
|
||||
if test x$enable_xinerama = xyes; then
|
||||
AC_CHECK_LIB(Xinerama,XineramaIsActive,
|
||||
AC_DEFINE(HAVE_XINERAMA)
|
||||
LIBS="-lXinerama $LIBS")
|
||||
fi
|
||||
|
||||
dnl Check for the Xft library unless disabled...
|
||||
AC_ARG_ENABLE(xft, [ --enable-xft turn on Xft support [default=no]])
|
||||
|
||||
|
@ -59,7 +59,7 @@ dynamically linked applications.
|
||||
%setup
|
||||
|
||||
%build
|
||||
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --mandir=%{_mandir} --enable-shared --enable-xft --enable-xdbe
|
||||
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --mandir=%{_mandir} --enable-shared --enable-xft --enable-xdbe --enable-xinerama
|
||||
|
||||
# If we got this far, all prerequisite libraries must be here.
|
||||
make
|
||||
|
@ -146,7 +146,8 @@ CPPFILES = \
|
||||
fl_shortcut.cxx \
|
||||
fl_show_colormap.cxx \
|
||||
fl_symbols.cxx \
|
||||
fl_vertex.cxx
|
||||
fl_vertex.cxx \
|
||||
screen_xywh.cxx
|
||||
|
||||
FLCPPFILES = \
|
||||
forms_compatability.cxx \
|
||||
|
147
src/screen_xywh.cxx
Normal file
147
src/screen_xywh.cxx
Normal file
@ -0,0 +1,147 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// Screen/monitor bounding box API for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2005 by Bill Spitzak and others.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Please report all bugs and problems on the following page:
|
||||
//
|
||||
// http://www.fltk.org/str.php
|
||||
//
|
||||
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <config.h>
|
||||
|
||||
#ifdef HAVE_XINERAMA
|
||||
# include <X11/extensions/Xinerama.h>
|
||||
#endif // HAVE_XINERAMA
|
||||
|
||||
|
||||
// Return the number of screens...
|
||||
int Fl::screen_count() {
|
||||
}
|
||||
|
||||
// Return the screen bounding rect for the given mouse position...
|
||||
void Fl::screen_xywh(int &x, int &y, int &w, int &h, int mx, int my) {
|
||||
#ifdef WIN32
|
||||
#elif defined(__APPLE__)
|
||||
#elif defined(HAVE_XINERAMA)
|
||||
if (!fl_display) fl_open_display();
|
||||
|
||||
if (XineramaIsActive(fl_display)) {
|
||||
int i,
|
||||
num_rects;
|
||||
XineramaScreenInfo *rects;
|
||||
|
||||
|
||||
rects = XineramaQueryScreens(fl_display, &num_rects);
|
||||
|
||||
# ifdef DEBUG
|
||||
printf("num_rects = %d\n", num_rects);
|
||||
printf("window_->x_root() = %d, y_root() = %d\n",
|
||||
window_->x_root(), window_->y_root());
|
||||
# endif // DEBUG
|
||||
|
||||
for (i = 0; i < num_rects; i ++) {
|
||||
# ifdef DEBUG
|
||||
printf("rects[%d] = [%d %d %d %d]\n", i,
|
||||
rects[i].x_org, rects[i].y_org, rects[i].width,
|
||||
rects[i].height);
|
||||
# endif // DEBUG
|
||||
|
||||
if (mx >= rects[i].x_org &&
|
||||
mx < (rects[i].x_org + rects[i].width) &&
|
||||
my >= rects[i].y_org &&
|
||||
my < (rects[i].y_org + rects[i].height))
|
||||
{
|
||||
x = rects[i].x_org;
|
||||
y = rects[i].y_org;
|
||||
w = rects[i].width;
|
||||
h = rects[i].height;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(rects);
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
x = Fl::x();
|
||||
y = Fl::y();
|
||||
w = Fl::w();
|
||||
h = Fl::h();
|
||||
}
|
||||
|
||||
// Return the screen bounding rect for the given screen...
|
||||
void Fl::screen_xywh(int &x, int &y, int &w, int &h, int n) {
|
||||
#ifdef WIN32
|
||||
#elif defined(__APPLE__)
|
||||
#elif defined(HAVE_XINERAMA)
|
||||
if (!fl_display) fl_open_display();
|
||||
|
||||
if (XineramaIsActive(fl_display)) {
|
||||
int i,
|
||||
num_rects;
|
||||
XineramaScreenInfo *rects;
|
||||
|
||||
|
||||
rects = XineramaQueryScreens(fl_display, &num_rects);
|
||||
|
||||
# ifdef DEBUG
|
||||
printf("num_rects = %d\n", num_rects);
|
||||
printf("window_->x_root() = %d, y_root() = %d\n",
|
||||
window_->x_root(), window_->y_root());
|
||||
# endif // DEBUG
|
||||
|
||||
for (i = 0; i < num_rects; i ++) {
|
||||
# ifdef DEBUG
|
||||
printf("rects[%d] = [%d %d %d %d]\n", i,
|
||||
rects[i].x_org, rects[i].y_org, rects[i].width,
|
||||
rects[i].height);
|
||||
# endif // DEBUG
|
||||
|
||||
if (mx >= rects[i].x_org &&
|
||||
mx < (rects[i].x_org + rects[i].width) &&
|
||||
my >= rects[i].y_org &&
|
||||
my < (rects[i].y_org + rects[i].height))
|
||||
{
|
||||
x = rects[i].x_org;
|
||||
y = rects[i].y_org;
|
||||
w = rects[i].width;
|
||||
h = rects[i].height;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(rects);
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
x = Fl::x();
|
||||
y = Fl::y();
|
||||
w = Fl::w();
|
||||
h = Fl::h();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
@ -2635,6 +2635,26 @@
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\screen_xywh.cxx">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
FavorSizeOrSpeed="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
@ -2774,6 +2774,24 @@
|
||||
PreprocessorDefinitions="FL_DLL;FL_LIBRARY;WIN32;_DEBUG;_WINDOWS;WIN32_LEAN_AND_MEAN;VC_EXTRA_LEAN;WIN32_EXTRA_LEAN;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\screen_xywh.cxx">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="FL_DLL;FL_LIBRARY;WIN32;NDEBUG;_WINDOWS;WIN32_LEAN_AND_MEAN;VC_EXTRA_LEAN;WIN32_EXTRA_LEAN;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="FL_DLL;FL_LIBRARY;WIN32;_DEBUG;_WINDOWS;WIN32_LEAN_AND_MEAN;VC_EXTRA_LEAN;WIN32_EXTRA_LEAN;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
@ -589,5 +589,9 @@ SOURCE=..\src\scandir.c
|
||||
|
||||
SOURCE=..\src\vsnprintf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\screen_xywh.cxx
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
|
@ -2632,6 +2632,10 @@ DEP_CPP_VSNPR=\
|
||||
".\config.h"\
|
||||
{$(INCLUDE)}"fl\fl_export.h"\
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\screen_xywh.cxx
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
|
Loading…
Reference in New Issue
Block a user