aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorPo Lu2022-05-21 11:17:34 +0800
committerPo Lu2022-05-21 11:17:34 +0800
commitedf9700c3ca65d92bdfca59306845ffc0717d690 (patch)
treeb00568cd7c0875f4ff23c3e6dc613c2d3c25a5b6 /src/keyboard.c
parent1cbabe973be88bed5a21d77defc3220034f7c91f (diff)
downloademacs-edf9700c3ca65d92bdfca59306845ffc0717d690.tar.gz
emacs-edf9700c3ca65d92bdfca59306845ffc0717d690.zip
Add a hook run upon monitor configuration changes
* doc/lispref/frames.texi (Multiple Terminals): Document new hook `display-monitors-changed-functions'. * etc/NEWS: Announce new abnormal hook. * src/keyboard.c (kbd_buffer_get_event): Handle MONITORS_CHANGED_EVENT. (syms_of_keyboard): New hook and defsyms. * src/termhooks.h (enum event_kind): Add new event `MONITORS_CHANGED_EVENT'. * src/xterm.c (handle_one_xevent): Handle RRNotify and RRScreenChangeNotify events. (x_term_init): Select for RRScreenChange, RRCrtcChange and RROutputChange. * src/xterm.h (struct x_display_info): Improve RandR version detection.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 481633f92fe..a2322f1b49d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -4058,6 +4058,18 @@ kbd_buffer_get_event (KBOARD **kbp,
4058 } 4058 }
4059#endif 4059#endif
4060 4060
4061 case MONITORS_CHANGED_EVENT:
4062 {
4063 kbd_fetch_ptr = next_kbd_event (event);
4064 input_pending = readable_events (0);
4065
4066 CALLN (Frun_hook_with_args,
4067 Qdisplay_monitors_changed_functions,
4068 event->ie.arg);
4069
4070 break;
4071 }
4072
4061#ifdef HAVE_EXT_MENU_BAR 4073#ifdef HAVE_EXT_MENU_BAR
4062 case MENU_BAR_ACTIVATE_EVENT: 4074 case MENU_BAR_ACTIVATE_EVENT:
4063 { 4075 {
@@ -12609,6 +12621,8 @@ See also `pre-command-hook'. */);
12609 DEFSYM (Qtouchscreen_end, "touchscreen-end"); 12621 DEFSYM (Qtouchscreen_end, "touchscreen-end");
12610 DEFSYM (Qtouchscreen_update, "touchscreen-update"); 12622 DEFSYM (Qtouchscreen_update, "touchscreen-update");
12611 DEFSYM (Qpinch, "pinch"); 12623 DEFSYM (Qpinch, "pinch");
12624 DEFSYM (Qdisplay_monitors_changed_functions,
12625 "display-monitors-changed-functions");
12612 12626
12613 DEFSYM (Qcoding, "coding"); 12627 DEFSYM (Qcoding, "coding");
12614 12628
@@ -12953,6 +12967,15 @@ Otherwise, a wheel event will be sent every time the mouse wheel is
12953moved. */); 12967moved. */);
12954 mwheel_coalesce_scroll_events = true; 12968 mwheel_coalesce_scroll_events = true;
12955 12969
12970 DEFVAR_LISP ("display-monitors-changed-functions", Vdisplay_monitors_changed_functions,
12971 doc: /* Abnormal hook run when the monitor configuration changes.
12972This can happen if a monitor is rotated, moved, plugged in or removed
12973from a multi-monitor setup, if the primary monitor changes, or if the
12974resolution of a monitor changes. The hook should accept a single
12975argument, which is the terminal on which the monitor configuration
12976changed. */);
12977 Vdisplay_monitors_changed_functions = Qnil;
12978
12956 pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper); 12979 pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper);
12957} 12980}
12958 12981