diff --git a/gtk/src/gtk_config.h b/gtk/src/gtk_config.h index cb6156de..9ef0d471 100644 --- a/gtk/src/gtk_config.h +++ b/gtk/src/gtk_config.h @@ -135,9 +135,7 @@ class Snes9xConfig unsigned int rewind_buffer_size; XRRScreenResources *xrr_screen_resources; - XRROutputInfo *xrr_output_info; XRRCrtcInfo *xrr_crtc_info; - RROutput xrr_output; #ifdef USE_OPENGL unsigned char sync_to_vblank; diff --git a/gtk/src/gtk_display.cpp b/gtk/src/gtk_display.cpp index d9e09611..0458b0fc 100644 --- a/gtk/src/gtk_display.cpp +++ b/gtk/src/gtk_display.cpp @@ -1596,9 +1596,9 @@ S9xQueryDrivers (void) gui_config->allow_xrandr = 1; gui_config->xrr_screen_resources = XRRGetScreenResources (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_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_screen_resources->crtcs[0]); return; } diff --git a/gtk/src/gtk_preferences.cpp b/gtk/src/gtk_preferences.cpp index 7ad74a0b..f512fa5c 100644 --- a/gtk/src/gtk_preferences.cpp +++ b/gtk/src/gtk_preferences.cpp @@ -1055,18 +1055,9 @@ Snes9xPreferences::show (void) combo = get_widget ("resolution_combo"); - mode_indices = new unsigned int[config->xrr_output_info->nmode]; - for (int i = 0; i < config->xrr_output_info->nmode; i++) + for (int i = 0; i < config->xrr_screen_resources->nmode; i++) { - for (int j = 0; j < config->xrr_screen_resources->nmode; j++) - { - if (config->xrr_screen_resources->modes[j].id == config->xrr_output_info->modes[i]) - { - mode_indices[i] = j; - } - } - - XRRModeInfo *m = &config->xrr_screen_resources->modes[mode_indices[i]]; + XRRModeInfo *m = &config->xrr_screen_resources->modes[i]; unsigned long dotClock = m->dotClock; if (m->modeFlags & RR_ClockDivideBy2) dotClock /= 2; @@ -1085,7 +1076,7 @@ Snes9xPreferences::show (void) combo_box_append (GTK_COMBO_BOX (combo), size_string); } - if (config->xrr_index > config->xrr_output_info->nmode) + if (config->xrr_index > config->xrr_screen_resources->nmode) config->xrr_index = 0; } else diff --git a/gtk/src/gtk_s9xwindow.cpp b/gtk/src/gtk_s9xwindow.cpp index 7bd46373..b553edc4 100644 --- a/gtk/src/gtk_s9xwindow.cpp +++ b/gtk/src/gtk_s9xwindow.cpp @@ -1532,9 +1532,7 @@ Snes9xWindow::toggle_fullscreen_mode (void) static double XRRGetExactRefreshRate (Display *dpy, Window window) { XRRScreenResources *resources = NULL; - XRROutputInfo *output_info = NULL; XRRCrtcInfo *crtc_info = NULL; - RROutput output; int event_base; int error_base; int version_major; @@ -1548,10 +1546,11 @@ static double XRRGetExactRefreshRate (Display *dpy, Window window) return refresh_rate; } - resources = XRRGetScreenResources (dpy, window); - output = XRRGetOutputPrimary (dpy, window); - output_info = XRRGetOutputInfo (dpy, resources, output); - crtc_info = XRRGetCrtcInfo (dpy, resources, output_info->crtc); + if (version_minor < 3) + return refresh_rate; + + resources = XRRGetScreenResourcesCurrent (dpy, window); + crtc_info = XRRGetCrtcInfo (dpy, resources, resources->crtcs[0]); for (i = 0; i < resources->nmode; i++) { @@ -1569,7 +1568,6 @@ static double XRRGetExactRefreshRate (Display *dpy, Window window) } XRRFreeCrtcInfo (crtc_info); - XRRFreeOutputInfo (output_info); XRRFreeScreenResources (resources); return refresh_rate; @@ -1626,13 +1624,13 @@ Snes9xWindow::enter_fullscreen_mode (void) gdk_display_sync (gdk_display); if (XRRSetCrtcConfig (dpy, config->xrr_screen_resources, - config->xrr_output_info->crtc, + config->xrr_screen_resources->crtcs[0], CurrentTime, config->xrr_crtc_info->x, config->xrr_crtc_info->y, - config->xrr_output_info->modes[config->xrr_index], + config->xrr_screen_resources->modes[config->xrr_index].id, config->xrr_crtc_info->rotation, - &config->xrr_output, + &config->xrr_crtc_info->outputs[0], 1) != 0) { config->change_display_resolution = 0; @@ -1683,19 +1681,19 @@ Snes9xWindow::leave_fullscreen_mode (void) GdkDisplay *gdk_display = gtk_widget_get_display (window); Display *dpy = gdk_x11_display_get_xdisplay (gdk_display); - if (config->xrr_index > config->xrr_output_info->nmode) + if (config->xrr_index > config->xrr_screen_resources->nmode) config->xrr_index = 0; gdk_display_sync (gdk_display); XRRSetCrtcConfig (dpy, config->xrr_screen_resources, - config->xrr_output_info->crtc, + config->xrr_screen_resources->crtcs[0], CurrentTime, config->xrr_crtc_info->x, config->xrr_crtc_info->y, config->xrr_crtc_info->mode, config->xrr_crtc_info->rotation, - &config->xrr_output, + &config->xrr_crtc_info->outputs[0], 1); if (gui_config->auto_input_rate)