Check if Xrandr extension is present.

This commit is contained in:
Volker Ruppert 2019-04-21 20:08:32 +00:00
parent 662b252507
commit dbf7da542f
4 changed files with 28 additions and 5 deletions

View File

@ -128,6 +128,7 @@
#define BX_HAVE_MKSTEMP 0
#define BX_HAVE_SYS_MMAN_H 0
#define BX_HAVE_XPM_H 0
#define BX_HAVE_XRANDR_H 0
#define BX_HAVE_TIMELOCAL 0
#define BX_HAVE_GMTIME 0
#define BX_HAVE_MKTIME 0

17
bochs/configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Id: configure.in 13419 2017-12-30 14:56:54Z vruppert .
# From configure.in Id: configure.in 13425 2018-01-05 17:43:51Z vruppert .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@ -24515,6 +24515,7 @@ use_gui_console=0
# handled later.
XPM_LIB=''
XRANDR_LIB=''
if test "$with_x11" = yes; then
display_libs="$display_libs X11"
if test "$no_x" = yes; then
@ -24558,12 +24559,22 @@ fi
fi
ac_fn_c_check_header_mongrel "$LINENO" "X11/extensions/Xrandr.h" "ac_cv_header_X11_extensions_Xrandr_h" "$ac_includes_default"
if test "x$ac_cv_header_X11_extensions_Xrandr_h" = xyes; then :
$as_echo "#define BX_HAVE_XRANDR_H 1" >>confdefs.h
XRANDR_LIB='-lXrandr'
fi
if test "$PKGCONFIG" != not_found; then
X_CFLAGS="`pkg-config --cflags x11`"
X_LIBS="`pkg-config --libs x11` $XPM_LIB -lXrandr"
X_LIBS="`pkg-config --libs x11` $XPM_LIB $XRANDR_LIB"
else
X_LIBS="$X_LIBS -lX11 $XPM_LIB -lXrandr"
X_LIBS="$X_LIBS -lX11 $XPM_LIB $XRANDR_LIB"
fi
$as_echo "#define BX_WITH_X11 1" >>confdefs.h

View File

@ -2328,6 +2328,7 @@ use_gui_console=0
# handled later.
XPM_LIB=''
XRANDR_LIB=''
if test "$with_x11" = yes; then
display_libs="$display_libs X11"
if test "$no_x" = yes; then
@ -2358,12 +2359,16 @@ if test "$with_x11" = yes; then
XPM_LIB='-lXpm'
])
fi
AC_CHECK_HEADER(X11/extensions/Xrandr.h, [
AC_DEFINE(BX_HAVE_XRANDR_H)
XRANDR_LIB='-lXrandr'
])
if test "$PKGCONFIG" != not_found; then
X_CFLAGS="`pkg-config --cflags x11`"
X_LIBS="`pkg-config --libs x11` $XPM_LIB -lXrandr"
X_LIBS="`pkg-config --libs x11` $XPM_LIB $XRANDR_LIB"
else
X_LIBS="$X_LIBS -lX11 $XPM_LIB -lXrandr"
X_LIBS="$X_LIBS -lX11 $XPM_LIB $XRANDR_LIB"
fi
AC_DEFINE(BX_WITH_X11, 1)

View File

@ -39,7 +39,9 @@ extern "C" {
#include <X11/Xos.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
#if BX_HAVE_XRANDR_H
#include <X11/extensions/Xrandr.h>
#endif
#if BX_HAVE_XPM_H
#include <X11/xpm.h>
#endif
@ -60,7 +62,9 @@ public:
DECLARE_GUI_NEW_VIRTUAL_METHODS()
virtual void beep_on(float frequency);
virtual void beep_off();
#if BX_HAVE_XRANDR_H
virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);
#endif
virtual void set_display_mode(disp_mode_t newmode);
virtual void set_mouse_mode_absxy(bx_bool mode);
#if BX_SHOW_IPS
@ -1800,6 +1804,7 @@ void bx_x_gui_c::beep_off()
BX_INFO(("X11 Beep OFF"));
}
#if BX_HAVE_XRANDR_H
void bx_x_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp)
{
int num_sizes;
@ -1829,6 +1834,7 @@ void bx_x_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp)
// always return 32 bit depth
*bpp = 32;
}
#endif
void bx_x_gui_c::set_display_mode(disp_mode_t newmode)
{