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:
119
configure
vendored
119
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,10 +33574,69 @@ 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; }
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
{ echo "$as_me:$LINENO: WARNING: Xinerama not found; disabling wxDisplay" >&5
|
||||
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 $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
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <windows.h>
|
||||
|
||||
#include <ddraw.h>
|
||||
_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
|
||||
ac_cv_header_ddraw_h=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_header_ddraw_h=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_header_ddraw_h" >&5
|
||||
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; }
|
||||
|
||||
@@ -33660,61 +33722,6 @@ done
|
||||
{ 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; }
|
||||
{ echo "$as_me:$LINENO: WARNING: Xinerama not found; disabling wxDisplay" >&5
|
||||
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 $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
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <windows.h>
|
||||
|
||||
#include <ddraw.h>
|
||||
_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
|
||||
ac_cv_header_ddraw_h=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_header_ddraw_h=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_header_ddraw_h" >&5
|
||||
echo "${ECHO_T}$ac_cv_header_ddraw_h" >&6; }
|
||||
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
36
configure.in
36
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,9 +3728,23 @@ 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])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_WARN([Xinerama not found; disabling wxDisplay])
|
||||
wxUSE_DISPLAY="no"
|
||||
fi
|
||||
elif test "$wxUSE_MSW" = 1; then
|
||||
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
|
||||
@@ -3747,17 +3762,6 @@ dnl ---------------------------------------------------------------------------
|
||||
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 ---------------------------------------------------------------------------
|
||||
AC_CHECK_HEADER([ddraw.h], [], [], [#include <windows.h>])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -39,6 +39,21 @@
|
||||
|
||||
#include "wx/display_impl.h"
|
||||
|
||||
#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"
|
||||
@@ -52,11 +67,58 @@ extern "C"
|
||||
#endif
|
||||
}
|
||||
|
||||
typedef XineramaScreenInfo ScreenInfo;
|
||||
#endif // GTK+/Xinerama
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// helper class to automatically free XineramaQueryScreens() return value
|
||||
// helper class storing information about all screens
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ScreensInfo
|
||||
// the base class provides access to ScreenInfo array, derived class
|
||||
// initializes it using either GTK+ or Xinerama functions
|
||||
class ScreensInfoBase
|
||||
{
|
||||
public:
|
||||
operator const ScreenInfo *() const { return m_screens; }
|
||||
|
||||
unsigned GetCount() const { return static_cast<unsigned>(m_num); }
|
||||
|
||||
protected:
|
||||
ScreenInfo *m_screens;
|
||||
int m_num;
|
||||
};
|
||||
|
||||
#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 wxDisplayFactoryX11;
|
||||
}
|
||||
|
||||
#endif /* wxUSE_DISPLAY */
|
||||
|
Reference in New Issue
Block a user