Skip to content

Commit

Permalink
XRandR: make core dependency
Browse files Browse the repository at this point in the history
RandR is sufficiently ubiquitous across Linux distributions and BSDs
that trying to maintain compatibility without it is not worth the
effort.

Although this might upset some people with very old SPARC machines or
ailing VAX machines, other even older WMs (FVWM1x/OLVWM) are available.
  • Loading branch information
ThomasAdam committed Jun 9, 2020
1 parent ee5eae8 commit 6e646e6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 46 deletions.
34 changes: 9 additions & 25 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -525,31 +525,16 @@ AH_TEMPLATE([HAVE_TAILQ],[Check if tailq is present.])
AC_CHECK_HEADER(queue.h, AC_DEFINE(HAVE_TAILQ))

# ********* XRandR
problem_xrandr=""

AC_ARG_ENABLE(xrandr,
AS_HELP_STRING([--disable-xrandr],[disable XRandR support]),
[ if test x"$enableval" = xyes; then
with_xrandr="yes, check"
else
with_xrandr="no"
problem_xrandr=": Explicitly disabled"
fi ],
[ with_xrandr="not specified, check" ]
)

AH_TEMPLATE([HAVE_XRANDR],[Define if XRandR library is used.])
if test ! x"$with_xrandr" = xno; then
if $PKG_CONFIG --exists "xrandr >= 1.5.0"; then
AC_DEFINE(HAVE_XRANDR)
with_xrandr=yes
XRandR_LIBS=-lXrandr
else
with_xrandr=no
problem_xrandr="Couldn't detect libxrandr, or version < 1.5.0"
fi
#],[$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
fi
AC_MSG_CHECKING([for XRandR...])
PKG_CHECK_MODULES([xrandr], [xrandr >= 1.5],
[
AC_DEFINE(HAVE_XRANDR)
XRandR_LIBS=-lXrandr
],
[
AC_MSG_ERROR([*** XRandR not found. Install its header files. ***])
])

AC_SUBST(XRandR_LIBS)
AC_SUBST(XRandR_CFLAGS)
Expand Down Expand Up @@ -1727,7 +1712,6 @@ Fvwm3 Configuration:
With Session Management support? $with_sm$problem_sm
With SVG image support? $with_rsvg$problem_rsvg
With Xcursor support? $with_xcursor$problem_xcursor
With XRandR support? $with_xrandr$problem_xrandr
With Xft anti-alias font support? $with_xft$problem_xft
With XPM image support? $with_xpm$problem_xpm
With Xrender image support? $with_xrender$problem_xrender
Expand Down
30 changes: 9 additions & 21 deletions libs/FScreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ scan_screens(Display *dpy)
rrm = XRRGetMonitors(dpy, root, false, &n);
if (n <= 0) {
fvwm_debug(__func__, "get monitors failed\n");
return;
exit(101);
}

for (i = 0; i < n; i++) {
Expand Down Expand Up @@ -390,9 +390,8 @@ void FScreenInit(Display *dpy)

if (!XRRQueryExtension(dpy, &randr_event, &err_base) ||
!XRRQueryVersion (dpy, &major, &minor)) {
fvwm_debug(__func__,
"RandR not present, falling back to single screen\n");
goto single_screen;
fvwm_debug(__func__, "RandR not present");
goto randr_fail;
}

if (major == 1 && minor >= 5)
Expand All @@ -403,9 +402,7 @@ void FScreenInit(Display *dpy)
/* Something went wrong. */
fvwm_debug(__func__, "Couldn't initialise XRandR: %s\n",
strerror(errno));
fvwm_debug(__func__, "Falling back to single screen...\n");

goto single_screen;
goto randr_fail;
}

fvwm_debug(__func__, "Using RandR %d.%d\n", major, minor);
Expand All @@ -415,9 +412,8 @@ void FScreenInit(Display *dpy)

if (res == NULL || (res != NULL && res->noutput == 0)) {
XRRFreeScreenResources(res);
fvwm_debug(__func__, "RandR present, yet no ouputs found. "
"Using single screen...\n");
goto single_screen;
fvwm_debug(__func__, "RandR present, yet no ouputs found.");
goto randr_fail;
}
XRRFreeScreenResources(res);

Expand All @@ -435,17 +431,9 @@ void FScreenInit(Display *dpy)

return;

single_screen:
m = monitor_new();
m->si->name = fxstrdup(GLOBAL_SCREEN_NAME);
m->si->rr_output = -1;
m->si->x = 0,
m->si->y = 0,
m->si->w = DisplayWidth(disp, DefaultScreen(disp)),
m->si->h = DisplayHeight(disp, DefaultScreen(disp));
m->flags |= MONITOR_NEW|MONITOR_PRIMARY;

TAILQ_INSERT_TAIL(&monitor_q, m, entry);
randr_fail:
fprintf(stderr, "Unable to initialise RandR\n");
exit(101);
}

void
Expand Down

0 comments on commit 6e646e6

Please sign in to comment.