Bug fix #137: Auto-detect screen changes
Attempt to auto-detect screen changes to address the issue reported by Feltzer.
This commit is contained in:
parent
5d4ed8f43f
commit
4600f435dd
|
@ -4114,12 +4114,15 @@ ev_shape_notify(session_t *ps, XShapeEvent *ev) {
|
||||||
static void
|
static void
|
||||||
ev_screen_change_notify(session_t *ps,
|
ev_screen_change_notify(session_t *ps,
|
||||||
XRRScreenChangeNotifyEvent __attribute__((unused)) *ev) {
|
XRRScreenChangeNotifyEvent __attribute__((unused)) *ev) {
|
||||||
if (!ps->o.refresh_rate) {
|
if (ps->o.xinerama_shadow_crop)
|
||||||
|
cxinerama_upd_scrs(ps);
|
||||||
|
|
||||||
|
if (ps->o.sw_opti && !ps->o.refresh_rate) {
|
||||||
update_refresh_rate(ps);
|
update_refresh_rate(ps);
|
||||||
if (!ps->refresh_rate) {
|
if (!ps->refresh_rate) {
|
||||||
fprintf(stderr, "ev_screen_change_notify(): Refresh rate detection "
|
fprintf(stderr, "ev_screen_change_notify(): Refresh rate detection "
|
||||||
"failed, software VSync disabled.");
|
"failed, --sw-opti disabled.");
|
||||||
ps->o.vsync = VSYNC_NONE;
|
ps->o.sw_opti = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5714,11 +5717,6 @@ swopti_init(session_t *ps) {
|
||||||
if (!ps->refresh_rate)
|
if (!ps->refresh_rate)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Monitor screen changes only if vsync_sw is enabled and we are using
|
|
||||||
// an auto-detected refresh rate
|
|
||||||
if (ps->randr_exists && !ps->o.refresh_rate)
|
|
||||||
XRRSelectInput(ps->dpy, ps->root, RRScreenChangeNotify);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6710,11 +6708,11 @@ session_init(session_t *ps_old, int argc, char **argv) {
|
||||||
get_cfg(ps, argc, argv, false);
|
get_cfg(ps, argc, argv, false);
|
||||||
|
|
||||||
// Query X RandR
|
// Query X RandR
|
||||||
if (ps->o.sw_opti && !ps->o.refresh_rate) {
|
if ((ps->o.sw_opti && !ps->o.refresh_rate) || ps->o.xinerama_shadow_crop) {
|
||||||
if (XRRQueryExtension(ps->dpy, &ps->randr_event, &ps->randr_error))
|
if (XRRQueryExtension(ps->dpy, &ps->randr_event, &ps->randr_error))
|
||||||
ps->randr_exists = true;
|
ps->randr_exists = true;
|
||||||
else
|
else
|
||||||
printf_errf("(): No XRandR extension, automatic refresh rate "
|
printf_errf("(): No XRandR extension, automatic screen change "
|
||||||
"detection impossible.");
|
"detection impossible.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6775,6 +6773,12 @@ session_init(session_t *ps_old, int argc, char **argv) {
|
||||||
if (ps->o.sw_opti)
|
if (ps->o.sw_opti)
|
||||||
ps->o.sw_opti = swopti_init(ps);
|
ps->o.sw_opti = swopti_init(ps);
|
||||||
|
|
||||||
|
// Monitor screen changes if vsync_sw is enabled and we are using
|
||||||
|
// an auto-detected refresh rate, or when Xinerama features are enabled
|
||||||
|
if (ps->randr_exists && ((ps->o.sw_opti && !ps->o.refresh_rate)
|
||||||
|
|| ps->o.xinerama_shadow_crop))
|
||||||
|
XRRSelectInput(ps->dpy, ps->root, RRScreenChangeNotifyMask);
|
||||||
|
|
||||||
// Initialize VSync
|
// Initialize VSync
|
||||||
if (!vsync_init(ps))
|
if (!vsync_init(ps))
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -1233,6 +1233,9 @@ cxinerama_win_upd_scr(session_t *ps, win *w) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cxinerama_upd_scrs(session_t *ps);
|
||||||
|
|
||||||
static session_t *
|
static session_t *
|
||||||
session_init(session_t *ps_old, int argc, char **argv);
|
session_init(session_t *ps_old, int argc, char **argv);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue