Mandate XRandR libraries and headers.

This commit is contained in:
Brandon Wright 2018-05-02 16:53:54 -05:00
parent 070d5e5dbf
commit d726c6a8dd
7 changed files with 3 additions and 46 deletions

View File

@ -63,12 +63,6 @@ AC_ARG_WITH(xv,
[], [],
[with_xv=yes]) [with_xv=yes])
AC_ARG_WITH(xrandr,
[AS_HELP_STRING([--with(out)-xrandr],
[Enable XRandR support on GTK (default: with)])],
[],
[with_xrandr=yes])
AC_ARG_WITH(portaudio, AC_ARG_WITH(portaudio,
[AS_HELP_STRING([--with(out)-portaudio], [AS_HELP_STRING([--with(out)-portaudio],
[Enable PortAudio sound driver support (default: with)])], [Enable PortAudio sound driver support (default: with)])],
@ -206,6 +200,7 @@ fi
PKG_CHECK_MODULES([GTK], ["$GTK_VERSION"]) PKG_CHECK_MODULES([GTK], ["$GTK_VERSION"])
PKG_CHECK_MODULES([GLIB], [gthread-2.0 >= 2.6 gobject-2.0 >= 2.6]) PKG_CHECK_MODULES([GLIB], [gthread-2.0 >= 2.6 gobject-2.0 >= 2.6])
PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.0]) PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.0])
PKG_CHECK_MODULES([XRANDR], [xrandr])
if test yes = "$with_opengl" ; then if test yes = "$with_opengl" ; then
@ -303,19 +298,6 @@ if test yes = "$with_pulseaudio" ; then
]) ])
fi fi
XRANDR=0
XRANDR_CFLAGS=""
XRANDR_LIBS=""
if test yes = "$with_xrandr" ; then
PKG_CHECK_MODULES([XRANDR],[xrandr],[
XRANDR=yes
CFLAGS="$CFLAGS -DUSE_XRANDR"
],[
echo "Cannot find libXrandr. Make sure the X11 development headers are installed."
echo "--> Disabling Xrandr support."
])
fi
LIBPNG_CFLAGS="" LIBPNG_CFLAGS=""
LIBPNG_LIBS="" LIBPNG_LIBS=""
if test yes = "$with_screenshot"; then if test yes = "$with_screenshot"; then

View File

@ -189,6 +189,7 @@ Snes9xConfig::load_defaults (void)
sound_buffer_size = 32; sound_buffer_size = 32;
sound_playback_rate = 5; sound_playback_rate = 5;
sound_input_rate = 31950; sound_input_rate = 31950;
auto_input_rate = TRUE;
last_directory[0] = '\0'; last_directory[0] = '\0';
window_width = -1; window_width = -1;
window_height = -1; window_height = -1;

View File

@ -4,9 +4,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#ifdef USE_XRANDR
#include <X11/extensions/Xrandr.h> #include <X11/extensions/Xrandr.h>
#endif
#include "gtk_control.h" #include "gtk_control.h"
#include "snes_ntsc.h" #include "snes_ntsc.h"
@ -120,6 +118,7 @@ class Snes9xConfig
int mute_sound_turbo; int mute_sound_turbo;
int sound_buffer_size; int sound_buffer_size;
int sound_playback_rate; int sound_playback_rate;
int auto_input_rate;
int sound_input_rate; int sound_input_rate;
int rom_loaded; int rom_loaded;
int window_width, window_height; int window_width, window_height;
@ -135,12 +134,10 @@ class Snes9xConfig
unsigned int rewind_granularity; unsigned int rewind_granularity;
unsigned int rewind_buffer_size; unsigned int rewind_buffer_size;
#ifdef USE_XRANDR
XRRScreenResources *xrr_screen_resources; XRRScreenResources *xrr_screen_resources;
XRROutputInfo *xrr_output_info; XRROutputInfo *xrr_output_info;
XRRCrtcInfo *xrr_crtc_info; XRRCrtcInfo *xrr_crtc_info;
RROutput xrr_output; RROutput xrr_output;
#endif
#ifdef USE_OPENGL #ifdef USE_OPENGL
unsigned char sync_to_vblank; unsigned char sync_to_vblank;

View File

@ -1705,7 +1705,6 @@ S9xQueryDrivers (void)
gui_config->allow_xrandr = 0; gui_config->allow_xrandr = 0;
#ifdef USE_XRANDR
int error_base_p, event_base_p; int error_base_p, event_base_p;
int major_version, minor_version; int major_version, minor_version;
Display *dpy = gdk_x11_display_get_xdisplay (gtk_widget_get_display (GTK_WIDGET (top_level->get_window()))); Display *dpy = gdk_x11_display_get_xdisplay (gtk_widget_get_display (GTK_WIDGET (top_level->get_window())));
@ -1732,7 +1731,6 @@ S9xQueryDrivers (void)
gui_config->xrr_output = XRRGetOutputPrimary (dpy, xid); gui_config->xrr_output = XRRGetOutputPrimary (dpy, xid);
gui_config->xrr_output_info = XRRGetOutputInfo (dpy, gui_config->xrr_screen_resources, gui_config->xrr_output); gui_config->xrr_output_info = XRRGetOutputInfo (dpy, gui_config->xrr_screen_resources, gui_config->xrr_output);
gui_config->xrr_crtc_info = XRRGetCrtcInfo (dpy, gui_config->xrr_screen_resources, gui_config->xrr_output_info->crtc); gui_config->xrr_crtc_info = XRRGetCrtcInfo (dpy, gui_config->xrr_screen_resources, gui_config->xrr_output_info->crtc);
#endif
return; return;
} }

View File

@ -465,7 +465,6 @@ event_input_rate_changed (GtkRange *range, gpointer data)
return; return;
} }
#ifdef USE_XRANDR
static double XRRGetExactRefreshRate (Display *dpy, Window window) static double XRRGetExactRefreshRate (Display *dpy, Window window)
{ {
XRRScreenResources *resources = NULL; XRRScreenResources *resources = NULL;
@ -511,12 +510,10 @@ static double XRRGetExactRefreshRate (Display *dpy, Window window)
return refresh_rate; return refresh_rate;
} }
#endif
static void static void
event_set_input_rate (GtkButton *widget, gpointer data) event_set_input_rate (GtkButton *widget, gpointer data)
{ {
#ifdef USE_XRANDR
Snes9xPreferences *preferences = (Snes9xPreferences *) data; Snes9xPreferences *preferences = (Snes9xPreferences *) data;
GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET(top_level->get_window())); GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET(top_level->get_window()));
Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_window_get_display (gdk_window)); Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_window_get_display (gdk_window));
@ -525,7 +522,6 @@ event_set_input_rate (GtkButton *widget, gpointer data)
if (rate != 0.0) if (rate != 0.0)
preferences->set_slider("sound_input_rate", (int) (rate * 32040 / 60.09881389744051 + 0.5)); preferences->set_slider("sound_input_rate", (int) (rate * 32040 / 60.09881389744051 + 0.5));
#endif
} }
@ -553,9 +549,6 @@ event_about_clicked (GtkButton *widget, gpointer data)
#ifdef USE_XV #ifdef USE_XV
version_string += _(" XVideo"); version_string += _(" XVideo");
#endif #endif
#ifdef USE_XRANDR
version_string += _(" XRandR");
#endif
#ifdef USE_JOYSTICK #ifdef USE_JOYSTICK
version_string += _(" Joystick"); version_string += _(" Joystick");
#endif #endif
@ -637,9 +630,7 @@ Snes9xPreferences::Snes9xPreferences (Snes9xConfig *config) :
last_toggled = NULL; last_toggled = NULL;
this->config = config; this->config = config;
#ifdef USE_XRANDR
mode_indices = NULL; mode_indices = NULL;
#endif
gtk_widget_realize (window); gtk_widget_realize (window);
@ -657,9 +648,7 @@ Snes9xPreferences::Snes9xPreferences (Snes9xConfig *config) :
Snes9xPreferences::~Snes9xPreferences (void) Snes9xPreferences::~Snes9xPreferences (void)
{ {
#ifdef USE_XRANDR
delete[] mode_indices; delete[] mode_indices;
#endif
return; return;
} }
@ -851,7 +840,6 @@ Snes9xPreferences::get_settings_from_dialog (void)
sound_needs_restart = 1; sound_needs_restart = 1;
} }
#ifdef USE_XRANDR
if ((config->change_display_resolution != get_check ("change_display_resolution") || if ((config->change_display_resolution != get_check ("change_display_resolution") ||
(config->change_display_resolution && (config->change_display_resolution &&
(config->xrr_index != get_combo ("resolution_combo")))) && (config->xrr_index != get_combo ("resolution_combo")))) &&
@ -866,7 +854,6 @@ Snes9xPreferences::get_settings_from_dialog (void)
{ {
config->xrr_index = get_combo ("resolution_combo"); config->xrr_index = get_combo ("resolution_combo");
} }
#endif
config->change_display_resolution = get_check ("change_display_resolution"); config->change_display_resolution = get_check ("change_display_resolution");
@ -1105,7 +1092,6 @@ Snes9xPreferences::show (void)
if (config->allow_xrandr) if (config->allow_xrandr)
{ {
#ifdef USE_XRANDR
char size_string[256]; char size_string[256];
combo = get_widget ("resolution_combo"); combo = get_widget ("resolution_combo");
@ -1142,7 +1128,6 @@ Snes9xPreferences::show (void)
if (config->xrr_index > config->xrr_output_info->nmode) if (config->xrr_index > config->xrr_output_info->nmode)
config->xrr_index = 0; config->xrr_index = 0;
#endif
} }
else else
{ {

View File

@ -41,9 +41,7 @@ class Snes9xPreferences : public GtkBuilderWindow
void get_settings_from_dialog (void); void get_settings_from_dialog (void);
void move_settings_to_dialog (void); void move_settings_to_dialog (void);
#ifdef USE_XRANDR
unsigned int *mode_indices; unsigned int *mode_indices;
#endif
}; };
#endif /* __GTK_PREFERENCES_H */ #endif /* __GTK_PREFERENCES_H */

View File

@ -1550,7 +1550,6 @@ Snes9xWindow::enter_fullscreen_mode (void)
gtk_window_get_position (GTK_WINDOW (window), &nfs_x, &nfs_y); gtk_window_get_position (GTK_WINDOW (window), &nfs_x, &nfs_y);
#ifdef USE_XRANDR
if (config->change_display_resolution) if (config->change_display_resolution)
{ {
GdkDisplay *gdk_display = gtk_widget_get_display (window); GdkDisplay *gdk_display = gtk_widget_get_display (window);
@ -1571,7 +1570,6 @@ Snes9xWindow::enter_fullscreen_mode (void)
config->change_display_resolution = 0; config->change_display_resolution = 0;
} }
} }
#endif
/* Make sure everything is done synchronously */ /* Make sure everything is done synchronously */
gdk_display_sync (gdk_display_get_default ()); gdk_display_sync (gdk_display_get_default ());
@ -1606,7 +1604,6 @@ Snes9xWindow::leave_fullscreen_mode (void)
config->rom_loaded = 0; config->rom_loaded = 0;
#ifdef USE_XRANDR
if (config->change_display_resolution) if (config->change_display_resolution)
{ {
GdkDisplay *gdk_display = gtk_widget_get_display (window); GdkDisplay *gdk_display = gtk_widget_get_display (window);
@ -1627,7 +1624,6 @@ Snes9xWindow::leave_fullscreen_mode (void)
&config->xrr_output, &config->xrr_output,
1); 1);
} }
#endif
gtk_window_unfullscreen (GTK_WINDOW (window)); gtk_window_unfullscreen (GTK_WINDOW (window));