summaryrefslogtreecommitdiff
path: root/lisp/term/haiku-win.el
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-04-27 05:18:50 +0000
committerPo Lu <luangruo@yahoo.com>2022-04-27 05:19:15 +0000
commit0bea75c95a7e59c50be437956916cc0835655575 (patch)
tree0540633d8e9fdce6428c99755a366dc094327c7a /lisp/term/haiku-win.el
parentf1e11deca641c3fd6d571afb6b8618143a16d226 (diff)
downloademacs-0bea75c95a7e59c50be437956916cc0835655575.tar.gz
emacs-0bea75c95a7e59c50be437956916cc0835655575.tar.bz2
emacs-0bea75c95a7e59c50be437956916cc0835655575.zip
Add simple session management support to Haiku
* lisp/term/common-win.el (emacs-save-session-functions): Move from x-win.el to common-win.el. * lisp/term/haiku-win.el (haiku-save-session-reply) (emacs-session-save, handle-save-session): New functions. * lisp/term/x-win.el (emacs-save-session-functions): Delete. * src/haiku_font_support.cc (font_style_to_flags): * src/haiku_support.h (enum haiku_font_weight): Turn weight macros into enum. (struct haiku_font_pattern): Likewise. (struct haiku_session_manager_reply): New struct. * src/haiku_io.c (haiku_io_init): Create sm port. * src/haiku_support.cc (QuitRequested): Wait for reply from sm port. * src/haikufns.c (Fhaiku_save_session_reply): New function. (syms_of_haikufns): Define new subr. * src/haikuterm.c (haiku_read_socket): Send session management events. (haiku_term_init): Check new port.
Diffstat (limited to 'lisp/term/haiku-win.el')
-rw-r--r--lisp/term/haiku-win.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/lisp/term/haiku-win.el b/lisp/term/haiku-win.el
index c83e0a5c3da..51a6c3c501e 100644
--- a/lisp/term/haiku-win.el
+++ b/lisp/term/haiku-win.el
@@ -358,6 +358,28 @@ take effect on menu items until the menu bar is updated again."
(add-variable-watcher 'use-system-tooltips #'haiku-use-system-tooltips-watcher)
+
+;;;; Session management.
+
+(declare-function haiku-save-session-reply "haikufns.c")
+
+(defun emacs-session-save ()
+ "SKIP: real doc in x-win.el."
+ (with-temp-buffer ; Saving sessions is not yet supported.
+ (condition-case nil
+ ;; A return of t means cancel the shutdown.
+ (run-hook-with-args-until-success
+ 'emacs-save-session-functions)
+ (error t))))
+
+(defun handle-save-session (_event)
+ "SKIP: real doc in xsmfns.c."
+ (interactive "e")
+ (let ((cancel-shutdown t))
+ (unwind-protect
+ (setq cancel-shutdown (emacs-session-save))
+ (haiku-save-session-reply (not cancel-shutdown)))))
+
(provide 'haiku-win)
(provide 'term/haiku-win)