Commit af50cfac authored by Philippe Brochard's avatar Philippe Brochard
Browse files

Better handler for xlib:access-errors

parent ac139afe
......@@ -25,6 +25,7 @@
(in-package :clfswm)
(defparameter *clfswm-initializing* nil)
(define-handler main-mode :key-press (code state)
(funcall-key-from-code *main-keys* code state))
......@@ -150,8 +151,12 @@
(find error-key '(xlib:window-error xlib:drawable-error xlib:match-error)))
#+:xlib-debug (format t "~&Ignoring XLib asynchronous error: ~s~%" error-key))
((eq error-key 'xlib:access-error)
(write-line "~&Another window manager is running.")
(throw 'exit-clfswm nil))
(if *clfswm-initializing*
(progn
(format t "~3&Another window manager is running. Exiting...~%")
(throw 'exit-clfswm nil))
#+:xlib-debug
(format t "~&Ignoring XLib asynchronous access error: ~s~%" error-key)))
;; all other asynchronous errors are printed.
(asynchronous
#+:xlib-debug (format t "~&Caught Asynchronous X Error: ~s ~s" error-key key-vals))
......@@ -161,6 +166,8 @@
(apply 'error error-key :display display :error-key error-key key-vals))))
(defun main-loop ()
(loop
(with-xlib-protect (:main-loop nil)
......@@ -272,6 +279,7 @@
(defun main-unprotected (&key (display (or (getenv "DISPLAY") ":0")) protocol
(read-conf-file-p t) (alternate-conf nil)
error-msg)
(setf *clfswm-initializing* t)
(conf-file-name alternate-conf)
(when read-conf-file-p
(read-conf-file))
......@@ -294,6 +302,7 @@
(exit-clfswm)))
(when error-msg
(info-mode error-msg))
(setf *clfswm-initializing* nil)
(catch 'exit-main-loop
(unwind-protect
(main-loop)
......
......@@ -164,11 +164,11 @@ It is particulary useful with CLISP/MIT-CLX.")
(forced-managed-window :initarg :forced-managed-window
:accessor frame-forced-managed-window
:initform nil
:documentation "A list of forced managed windows (wm-name or window)")
:documentation "A list of forced managed windows (xlib:wm-name or window)")
(forced-unmanaged-window :initarg :forced-unmanaged-window
:accessor frame-forced-unmanaged-window
:initform nil
:documentation "A list of forced unmanaged windows (wm-name or window)")
:documentation "A list of forced unmanaged windows (xlib:wm-name or window)")
(show-window-p :initarg :show-window-p :accessor frame-show-window-p :initform t)
(hidden-children :initarg :hidden-children :accessor frame-hidden-children :initform nil
:documentation "A list of hidden children")
......
......@@ -103,6 +103,7 @@ Features: ~A"
;; `(progn
;; ,@body))
(declaim (inline screen-width screen-height))
(defun screen-width ()
;;(xlib:screen-width *screen*))
......@@ -1017,9 +1018,8 @@ they should be windows. So use this function to make a window out of them."
;;; Windows wm class and name tests
(defmacro defun-equal-wm-class (symbol class)
`(defun ,symbol (window)
(ignore-errors ;; Ignore incompliant wm-class strings
(when (xlib:window-p window)
(string-equal (xlib:get-wm-class window) ,class)))))
(when (xlib:window-p window)
(string-equal (xlib:get-wm-class window) ,class))))
(defmacro defun-equal-wm-name (symbol name)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment