Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bug#9366: Display geometry change hook

22 views
Skip to first unread message

David De La Harpe Golden

unread,
Aug 25, 2011, 1:16:58 AM8/25/11
to 93...@debbugs.gnu.org
Severity: wishlist

Raised by Edward O'Connor in emacs-devel thread [1], filing in
bugtracker so it doesn't get lost over the feature freeze period.

Emacs doesn't appear to currently provide a hook that is reliably called
when the _display_ geometry changes on graphical window systems. e.g.
screen resolution changed by user, monitor hotplugging.

Emacs frame/window geometry might sometimes be considered to remain the
same by the window system terms despite changing overall display
geometry, so e.g. window-configuration-change-hook is not always run
when the display geometry changes.

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.


[1] http://lists.gnu.org/archive/html/emacs-devel/2011-08/msg00544.html
From: "Edward O'Connor" <...>
Date: Fri, 12 Aug 2011 10:51:25 -0700
Message-ID:
<CAME3nGLnjLXixmSY45BWFX6qtCp2_XBR4x6a281hO6Mu=rn...@mail.gmail.com>
Subject: is there a hook run when display geometry changes?

xrandr_monitoring_r1.diff

Eli Zaretskii

unread,
Aug 25, 2011, 1:55:09 AM8/25/11
to David De La Harpe Golden, 93...@debbugs.gnu.org
> Date: Thu, 25 Aug 2011 06:16:58 +0100
> From: David De La Harpe Golden <da...@harpegolden.net>

>
> Dunno about w32 as yet, but presumably it has something similar.

On MS-Windows there's the WM_DISPLAYCHANGE message sent to the message
pump. Emacs already accepts that message (see w32term.c), but
currently does nothing with it except announcing the change to the
attached debugger.

However, on Windows the message also specifies the new resolution, so
this:

> + inev.ie.kind = SCREEN_CHANGE_NOTIFY_EVENT;
> + inev.ie.frame_or_window = XCAR(dpyinfo->name_list_element);

is not general enough: there should be a way to provide the new
dimensions to the event queue. It also means that a "normal" hook is
insufficient to handle this event, it should be a -functions style
hook.

David De La Harpe Golden

unread,
Aug 25, 2011, 8:42:29 AM8/25/11
to Eli Zaretskii, 93...@debbugs.gnu.org
On 25/08/11 06:55, Eli Zaretskii wrote:
>> Date: Thu, 25 Aug 2011 06:16:58 +0100
>> From: David De La Harpe Golden<da...@harpegolden.net>
>>
>> Dunno about w32 as yet, but presumably it has something similar.
>
> On MS-Windows there's the WM_DISPLAYCHANGE message sent to the message
> pump. Emacs already accepts that message (see w32term.c), but
> currently does nothing with it except announcing the change to the
> attached debugger.
>
> However, on Windows the message also specifies the new resolution, so
> this:
>

Technically the incoming x11 event does too, but as you can re-query
with the existing #'display-pixel-width etc. functions (and get the new
values) anyway by the time the hook actually runs (on x11), wasn't sure
we needed to allow for propagation of the info really.

Edward O'Connor

unread,
Aug 31, 2011, 1:43:16 PM8/31/11
to 93...@debbugs.gnu.org
I apologize for the noise; the normal way of CCing oneself apparently
doesn't work[1].


Ted

1. http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5439

0 new messages