Subject: bug#9366: Display geometry change hook

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 19 Sep 2020 17:28:48 +0200

David De La Harpe Golden <[email-masked]> writes:

> Attached is an initial x11-only stab at an implementation that calls
> window-configuration-change-hook when display geometry changes, though
> a separate hook would be another design option.
>
> For ns, Edward also mentioned:
>
> "On GNUStep and Mac OS X, applications can listen for
> NSApplicationDidChangeScreenParametersNotification for this sort of
> thing"
>
> Dunno about w32 as yet, but presumably it has something similar.

This was nine years ago, but this didn't get much attention at the time.

[...]

> +if test "${HAVE_X11}" = "yes"; then
> +  if test "${with_xrandr}" != "no"; then
> +    PKG_CHECK_MODULES(XRANDR, xrandr > 1.0, HAVE_XRANDR=yes, HAVE_XRANDR=no)
> +    if test "${HAVE_XRANDR}" = "yes"; then
> +      AC_DEFINE(HAVE_XRANDR, 1, [Define to 1 if you have the Xrandr library (-lXrandr).])
> +    fi

Emacs is now built with xrandr support by default (on the relevant
systems)...

[...]

> +#ifdef HAVE_XRANDR
> +    /* xrandr extension may or may not be present on a display =>
> +       can't check for it as a constant C "case" arg, hence "if" here  */
> +    if (dpyinfo->xrandr_present &&
> +        (event.type == (dpyinfo->xrandr_event_base + RRScreenChangeNotify)))
> +      {
> +        /* FIXME: is XRRUpdateConfiguration actually called by the toolkit/gtk+?

But looking through the code, it doesn't seem like Emacs has grown this
capability over the years?  But I may be looking in the wrong places.

In any case, it sounds useful?  I haven't tried applying the patch,
though, so I don't know how much work that would be to bring it up to
date.

Anybody got any opinions here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no