Use GTK+ functions for wxDisplay implementation.
There is no need to use Xinerama for what GDK can do itself (see #11053). Also don't check for Xinerama in configure when using wxGTK2. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64384 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
185
configure
vendored
185
configure
vendored
@@ -3606,8 +3606,10 @@ echo "$as_me: error: Please specify at most one toolkit" >&2;}
|
||||
# to be removed when --disable-gtk2 isn't needed
|
||||
if test "x$wxUSE_GTK2" = "xyes"; then
|
||||
wxGTK_VERSION=2
|
||||
wxUSE_GTK1=0
|
||||
elif test "x$wxUSE_GTK2" = "xno"; then
|
||||
wxGTK_VERSION=1
|
||||
wxUSE_GTK1=1
|
||||
fi
|
||||
|
||||
for toolkit in $ALL_TOOLKITS; do
|
||||
@@ -33538,8 +33540,9 @@ fi
|
||||
|
||||
|
||||
|
||||
USE_XINERAMA=0
|
||||
if test "$wxUSE_DISPLAY" = "yes"; then
|
||||
if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_MAC" != 1 -a "$wxUSE_OLD_COCOA" != 1; then
|
||||
if test "$wxUSE_MOTIF" = 1 -o "$wxUSE_X11" = 1 -o "$wxUSE_GTK1" = 1; then
|
||||
{ echo "$as_me:$LINENO: checking for Xinerama" >&5
|
||||
echo $ECHO_N "checking for Xinerama... $ECHO_C" >&6; }
|
||||
|
||||
@@ -33571,96 +33574,10 @@ echo $ECHO_N "checking for Xinerama... $ECHO_C" >&6; }
|
||||
if test "$ac_path_to_link" != " -L/usr/lib" ; then
|
||||
LDFLAGS="$LDFLAGS $ac_path_to_link"
|
||||
fi
|
||||
USE_XINERAMA=1
|
||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXinerama"
|
||||
{ echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6; }
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for Xxf86vm extension" >&5
|
||||
echo $ECHO_N "checking for Xxf86vm extension... $ECHO_C" >&6; }
|
||||
|
||||
ac_find_libraries=
|
||||
for ac_dir in $SEARCH_LIB;
|
||||
do
|
||||
for ac_extension in a so sl dylib dll.a; do
|
||||
if test -f "$ac_dir/libXxf86vm.$ac_extension"; then
|
||||
ac_find_libraries=$ac_dir
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if test "$ac_find_libraries" != "" ; then
|
||||
{ echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6; }
|
||||
|
||||
for ac_header in X11/extensions/xf86vmode.h
|
||||
do
|
||||
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
#if HAVE_X11_XLIB_H
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
eval "$as_ac_Header=yes"
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
eval "$as_ac_Header=no"
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
ac_res=`eval echo '${'$as_ac_Header'}'`
|
||||
{ echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
echo "${ECHO_T}$ac_res" >&6; }
|
||||
if test `eval echo '${'$as_ac_Header'}'` = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXxf86vm"
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
fi
|
||||
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
@@ -33669,7 +33586,7 @@ echo "$as_me: WARNING: Xinerama not found; disabling wxDisplay" >&2;}
|
||||
wxUSE_DISPLAY="no"
|
||||
fi
|
||||
elif test "$wxUSE_MSW" = 1; then
|
||||
{ echo "$as_me:$LINENO: checking for ddraw.h" >&5
|
||||
{ echo "$as_me:$LINENO: checking for ddraw.h" >&5
|
||||
echo $ECHO_N "checking for ddraw.h... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_header_ddraw_h+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
@@ -33718,6 +33635,96 @@ echo "${ECHO_T}$ac_cv_header_ddraw_h" >&6; }
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_DISPLAY" = "yes"; then
|
||||
if test "$USE_XINERAMA" = 1 -o "$wxUSE_GTK" = 1; then
|
||||
{ echo "$as_me:$LINENO: checking for Xxf86vm extension" >&5
|
||||
echo $ECHO_N "checking for Xxf86vm extension... $ECHO_C" >&6; }
|
||||
|
||||
ac_find_libraries=
|
||||
for ac_dir in $SEARCH_LIB;
|
||||
do
|
||||
for ac_extension in a so sl dylib dll.a; do
|
||||
if test -f "$ac_dir/libXxf86vm.$ac_extension"; then
|
||||
ac_find_libraries=$ac_dir
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if test "$ac_find_libraries" != "" ; then
|
||||
{ echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6; }
|
||||
|
||||
for ac_header in X11/extensions/xf86vmode.h
|
||||
do
|
||||
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
#if HAVE_X11_XLIB_H
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
eval "$as_ac_Header=yes"
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
eval "$as_ac_Header=no"
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
ac_res=`eval echo '${'$as_ac_Header'}'`
|
||||
{ echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
echo "${ECHO_T}$ac_res" >&6; }
|
||||
if test `eval echo '${'$as_ac_Header'}'` = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXxf86vm"
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_DETECT_SM" = "yes"; then
|
||||
if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_MAC" != 1 -a "$wxUSE_OLD_COCOA" != 1; then
|
||||
{ echo "$as_me:$LINENO: checking for -lSM - X11 session management" >&5
|
||||
|
58
configure.in
58
configure.in
@@ -563,8 +563,10 @@ if test "$wxUSE_GUI" = "yes"; then
|
||||
# to be removed when --disable-gtk2 isn't needed
|
||||
if test "x$wxUSE_GTK2" = "xyes"; then
|
||||
wxGTK_VERSION=2
|
||||
wxUSE_GTK1=0
|
||||
elif test "x$wxUSE_GTK2" = "xno"; then
|
||||
wxGTK_VERSION=1
|
||||
wxUSE_GTK1=1
|
||||
fi
|
||||
|
||||
for toolkit in $ALL_TOOLKITS; do
|
||||
@@ -3712,14 +3714,13 @@ fi
|
||||
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl wxDisplay Sanity checks
|
||||
dnl wxDisplay checks
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
USE_XINERAMA=0
|
||||
if test "$wxUSE_DISPLAY" = "yes"; then
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Xinerama (for unix ) - Brian Victor
|
||||
dnl ---------------------------------------------------------------------------
|
||||
if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_MAC" != 1 -a "$wxUSE_OLD_COCOA" != 1; then
|
||||
dnl Xinerama is used for wxGTK1/wxX11/wxMotif only
|
||||
if test "$wxUSE_MOTIF" = 1 -o "$wxUSE_X11" = 1 -o "$wxUSE_GTK1" = 1; then
|
||||
AC_MSG_CHECKING([for Xinerama])
|
||||
WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],Xinerama)
|
||||
if test "$ac_find_libraries" != "" ; then
|
||||
@@ -3727,40 +3728,43 @@ dnl ---------------------------------------------------------------------------
|
||||
if test "$ac_path_to_link" != " -L/usr/lib" ; then
|
||||
LDFLAGS="$LDFLAGS $ac_path_to_link"
|
||||
fi
|
||||
USE_XINERAMA=1
|
||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXinerama"
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
AC_MSG_CHECKING([for Xxf86vm extension])
|
||||
WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],Xxf86vm)
|
||||
if test "$ac_find_libraries" != "" ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_CHECK_HEADERS([X11/extensions/xf86vmode.h],
|
||||
[
|
||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXxf86vm"
|
||||
],
|
||||
[],
|
||||
[
|
||||
#if HAVE_X11_XLIB_H
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_WARN([Xinerama not found; disabling wxDisplay])
|
||||
wxUSE_DISPLAY="no"
|
||||
fi
|
||||
elif test "$wxUSE_MSW" = 1; then
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl DirectDraw for MSW - optionally used by WxDisplay.
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl DirectDraw for MSW - optionally used by WxDisplay.
|
||||
AC_CHECK_HEADER([ddraw.h], [], [], [#include <windows.h>])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_DISPLAY" = "yes"; then
|
||||
dnl wxGTK2 needs Xxf86vm as well as Xinerama-using ports from above
|
||||
if test "$USE_XINERAMA" = 1 -o "$wxUSE_GTK" = 1; then
|
||||
AC_MSG_CHECKING([for Xxf86vm extension])
|
||||
WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],Xxf86vm)
|
||||
if test "$ac_find_libraries" != "" ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_CHECK_HEADERS([X11/extensions/xf86vmode.h],
|
||||
[
|
||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXxf86vm"
|
||||
],
|
||||
[],
|
||||
[
|
||||
#if HAVE_X11_XLIB_H
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl X11 session management
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
@@ -39,24 +39,86 @@
|
||||
|
||||
#include "wx/display_impl.h"
|
||||
|
||||
/* These must be included after the wx files. Otherwise the Data macro in
|
||||
* Xlibint.h conflicts with a function declaration in wx/list.h. */
|
||||
extern "C"
|
||||
#ifdef __WXGTK20__
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
// define the struct with the same fields as XineramaScreenInfo (except for
|
||||
// screen number which we don't need) but which we can use without
|
||||
// including Xinerama headers
|
||||
struct ScreenInfo
|
||||
{
|
||||
short x_org;
|
||||
short y_org;
|
||||
short width;
|
||||
short height;
|
||||
};
|
||||
#else // use raw Xinerama functions
|
||||
/* These must be included after the wx files. Otherwise the Data macro in
|
||||
* Xlibint.h conflicts with a function declaration in wx/list.h. */
|
||||
extern "C"
|
||||
{
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xlibint.h>
|
||||
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
#endif
|
||||
}
|
||||
|
||||
typedef XineramaScreenInfo ScreenInfo;
|
||||
#endif // GTK+/Xinerama
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// helper class storing information about all screens
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// the base class provides access to ScreenInfo array, derived class
|
||||
// initializes it using either GTK+ or Xinerama functions
|
||||
class ScreensInfoBase
|
||||
{
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xlibint.h>
|
||||
public:
|
||||
operator const ScreenInfo *() const { return m_screens; }
|
||||
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
#endif
|
||||
}
|
||||
unsigned GetCount() const { return static_cast<unsigned>(m_num); }
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// helper class to automatically free XineramaQueryScreens() return value
|
||||
// ----------------------------------------------------------------------------
|
||||
protected:
|
||||
ScreenInfo *m_screens;
|
||||
int m_num;
|
||||
};
|
||||
|
||||
class ScreensInfo
|
||||
#ifdef __WXGTK20__
|
||||
|
||||
class ScreensInfo : public ScreensInfoBase
|
||||
{
|
||||
public:
|
||||
ScreensInfo()
|
||||
{
|
||||
GdkScreen * const screen = gdk_screen_get_default();
|
||||
|
||||
m_num = gdk_screen_get_n_monitors(screen);
|
||||
m_screens = new ScreenInfo[m_num];
|
||||
for ( int i = 0; i < m_num; i++ )
|
||||
{
|
||||
GdkRectangle rect;
|
||||
gdk_screen_get_monitor_geometry(screen, i, &rect);
|
||||
m_screens[i].x_org = rect.x;
|
||||
m_screens[i].y_org = rect.y;
|
||||
m_screens[i].width = rect.width;
|
||||
m_screens[i].height = rect.height;
|
||||
}
|
||||
}
|
||||
|
||||
~ScreensInfo()
|
||||
{
|
||||
delete [] m_screens;
|
||||
}
|
||||
};
|
||||
|
||||
#else // Xinerama
|
||||
|
||||
class ScreensInfo : public ScreensInfoBase
|
||||
{
|
||||
public:
|
||||
ScreensInfo()
|
||||
@@ -68,16 +130,10 @@ public:
|
||||
{
|
||||
XFree(m_screens);
|
||||
}
|
||||
|
||||
operator const XineramaScreenInfo *() const { return m_screens; }
|
||||
|
||||
unsigned GetCount() const { return static_cast<unsigned>(m_num); }
|
||||
|
||||
private:
|
||||
XineramaScreenInfo *m_screens;
|
||||
int m_num;
|
||||
};
|
||||
|
||||
#endif // GTK+/Xinerama
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// display and display factory classes
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -85,7 +141,7 @@ private:
|
||||
class WXDLLEXPORT wxDisplayImplX11 : public wxDisplayImpl
|
||||
{
|
||||
public:
|
||||
wxDisplayImplX11(unsigned n, const XineramaScreenInfo& info)
|
||||
wxDisplayImplX11(unsigned n, const ScreenInfo& info)
|
||||
: wxDisplayImpl(n),
|
||||
m_rect(info.x_org, info.y_org, info.width, info.height)
|
||||
{
|
||||
@@ -142,7 +198,7 @@ int wxDisplayFactoryX11::GetFromPoint(const wxPoint& p)
|
||||
const unsigned numscreens(screens.GetCount());
|
||||
for ( unsigned i = 0; i < numscreens; ++i )
|
||||
{
|
||||
const XineramaScreenInfo& s = screens[i];
|
||||
const ScreenInfo& s = screens[i];
|
||||
if ( p.x >= s.x_org && p.x < s.x_org + s.width &&
|
||||
p.y >= s.y_org && p.y < s.y_org + s.height )
|
||||
{
|
||||
@@ -314,12 +370,13 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& WXUNUSED(mode))
|
||||
|
||||
/* static */ wxDisplayFactory *wxDisplay::CreateFactory()
|
||||
{
|
||||
if ( XineramaIsActive((Display*)wxGetDisplay()) )
|
||||
{
|
||||
return new wxDisplayFactoryX11;
|
||||
}
|
||||
// GTK+ screen functions are always available, no need to check for them
|
||||
#ifndef __WXGTK20__
|
||||
if ( !XineramaIsActive((Display*)wxGetDisplay()) )
|
||||
return new wxDisplayFactorySingle;
|
||||
#endif
|
||||
|
||||
return new wxDisplayFactorySingle;
|
||||
return new wxDisplayFactoryX11;
|
||||
}
|
||||
|
||||
#endif /* wxUSE_DISPLAY */
|
||||
|
Reference in New Issue
Block a user