added iconify, maximize
modified client selection with show-clients
This commit is contained in:
		
							parent
							
								
									985b20dcb2
								
							
						
					
					
						commit
						553fc1c5d5
					
				|  | @ -1,5 +1,6 @@ | ||||||
| (define-options-spec manager-options-spec | (define-options-spec manager-options-spec | ||||||
|   (focus-policy symbol-list '(enter)) ;; enter, click |   (focus-policy symbol-list '(enter)) ;; enter, click | ||||||
|  |   (client-cursor cursor xc-X-cursor) | ||||||
|   ) |   ) | ||||||
| 
 | 
 | ||||||
| ;; TODO: focus-policy click does not work yet | ;; TODO: focus-policy click does not work yet | ||||||
|  | @ -84,6 +85,7 @@ | ||||||
| 	       (event-mask structure-notify | 	       (event-mask structure-notify | ||||||
| 			   enter-window | 			   enter-window | ||||||
| 			   focus-change | 			   focus-change | ||||||
|  | 			   button-press | ||||||
| 			   exposure) | 			   exposure) | ||||||
| 	       (lambda (event-channel) | 	       (lambda (event-channel) | ||||||
| 		 (call-with-current-continuation | 		 (call-with-current-continuation | ||||||
|  | @ -142,15 +144,22 @@ | ||||||
| 		  (time (cadr (property:data p)))) | 		  (time (cadr (property:data p)))) | ||||||
| 	      (if (equal? name (intern-atom dpy "WM_TAKE_FOCUS" #f)) | 	      (if (equal? name (intern-atom dpy "WM_TAKE_FOCUS" #f)) | ||||||
| 		  (begin | 		  (begin | ||||||
| 		    (set-input-focus dpy main-window (revert-to parent) time) | 		    (if (window-viewable? dpy main-window) | ||||||
|  | 			(set-input-focus dpy main-window (revert-to parent) | ||||||
|  | 					 current-time)) | ||||||
| 		    (send internal-out-channel | 		    (send internal-out-channel | ||||||
| 			  (list 'manager-focused time)))) | 			  (list 'manager-focused current-time)))) | ||||||
| 	      (if (equal? name (intern-atom dpy "WM_DELETE_WINDOW" #f)) | 	      (if (equal? name (intern-atom dpy "WM_DELETE_WINDOW" #f)) | ||||||
| 		  (if (null? (wm:clients wm)) | 		  (if (null? (wm:clients wm)) | ||||||
| 		      ;; (destroy-wm wm) would dead-lock | 		      ;; (destroy-wm wm) would dead-lock | ||||||
| 		      (handle-external-message wm exit '(destroy-manager)) | 		      (handle-external-message wm exit '(destroy-manager)) | ||||||
| 		      (bell dpy 100))) | 		      (bell dpy 100))) | ||||||
| 	      )))) | 	      )))) | ||||||
|  | 
 | ||||||
|  |      ((button-event? xevent) | ||||||
|  |       (if (eq? (event-type button-press) (button-event-type xevent)) | ||||||
|  | 	  (take-focus dpy main-window (button-event-time xevent)))) | ||||||
|  | 
 | ||||||
|      ((destroy-window-event? xevent) |      ((destroy-window-event? xevent) | ||||||
|       (exit 'destroy)) |       (exit 'destroy)) | ||||||
|      ))) |      ))) | ||||||
|  | @ -187,6 +196,24 @@ | ||||||
| 	 (if client | 	 (if client | ||||||
| 	     (reparent-to-root dpy window)))) | 	     (reparent-to-root dpy window)))) | ||||||
| 
 | 
 | ||||||
|  |       ((iconify-window) | ||||||
|  |        (let* ((window (second msg)) | ||||||
|  | 	      (client (find (lambda (c) | ||||||
|  | 			      (eq? window (client:window c))) | ||||||
|  | 			    (wm:clients wm)))) | ||||||
|  | 	 (if client | ||||||
|  | 	     (send internal-out-channel | ||||||
|  | 		   (list 'iconify-client client))))) | ||||||
|  | 
 | ||||||
|  |       ((maximize-window) | ||||||
|  |        (let* ((window (second msg)) | ||||||
|  | 	      (client (find (lambda (c) | ||||||
|  | 			      (eq? window (client:window c))) | ||||||
|  | 			    (wm:clients wm)))) | ||||||
|  | 	 (if client | ||||||
|  | 	     (send internal-out-channel | ||||||
|  | 		   (list 'maximize-client client))))) | ||||||
|  |        | ||||||
|       ((destroy-manager) |       ((destroy-manager) | ||||||
|        (send-message+wait internal-out-channel '(deinit-manager)) |        (send-message+wait internal-out-channel '(deinit-manager)) | ||||||
|        (if (window-exists? dpy (wm:window wm)) |        (if (window-exists? dpy (wm:window wm)) | ||||||
|  | @ -196,23 +223,24 @@ | ||||||
|        (let ((client (second msg))) |        (let ((client (second msg))) | ||||||
| 	 (set-wm:clients! wm (filter (lambda (c) (not (eq? c client))) | 	 (set-wm:clients! wm (filter (lambda (c) (not (eq? c client))) | ||||||
| 				     (wm:clients wm))) | 				     (wm:clients wm))) | ||||||
| 	 (if (eq? (wm:current-client wm) client) |  | ||||||
| 	     ;; select-client ?? |  | ||||||
| 	     (set-wm:current-client! wm (and (not (null? (wm:clients wm))) |  | ||||||
| 					     (car (wm:clients wm))))) |  | ||||||
| 	 (send-message+wait (wm:internal-out-channel wm) | 	 (send-message+wait (wm:internal-out-channel wm) | ||||||
| 			    (list 'deinit-client client)) | 			    (list 'deinit-client client)) | ||||||
|  | 	 (if (eq? client (wm:current-client wm)) | ||||||
|  | 	     (set-wm:current-client! wm #f)) | ||||||
| 	 (destroy-window dpy (client:client-window client)))) | 	 (destroy-window dpy (client:client-window client)))) | ||||||
|        |        | ||||||
|       ((select-client) |       ((select-client) | ||||||
|        (let ((client (second msg)) |        (let* ((client (second msg)) | ||||||
| 	     (time (third msg))) | 	      (time (third msg)) | ||||||
| 	 (for-each (lambda (client) | 	      (all (cons client (transients-for-client wm client))) | ||||||
| 		     (set-wm:current-client! wm client) | 	      (top (last all))) | ||||||
| 		     (raise-window dpy (client:client-window client)) | 	 (if (not (eq? top (wm:current-client wm))) | ||||||
| 		     (if (window-exists? dpy (client:window client)) | 	     (begin | ||||||
| 			 (take-focus dpy (client:window client) time))) | 	       (send-message+wait (wm:internal-out-channel wm) | ||||||
| 		   (cons client (transients-for-client wm client))))) | 				  (list 'show-clients all)) | ||||||
|  | 	       (set-wm:current-client! wm top))) | ||||||
|  | 	 (if (window-exists? dpy (client:window top)) | ||||||
|  | 	     (take-focus dpy (client:window top) time)))) | ||||||
|        |        | ||||||
|       (else (warn "unhandled manager message" wm msg))))) |       (else (warn "unhandled manager message" wm msg))))) | ||||||
| 
 | 
 | ||||||
|  | @ -235,6 +263,12 @@ | ||||||
| (define (wm-unmanage-window wm window) | (define (wm-unmanage-window wm window) | ||||||
|   (send (wm:in-channel wm) (list 'unmanage-window window))) |   (send (wm:in-channel wm) (list 'unmanage-window window))) | ||||||
| 
 | 
 | ||||||
|  | (define (wm-iconify-window wm window) | ||||||
|  |   (send (wm:in-channel wm) (list 'iconify-window window))) | ||||||
|  | 
 | ||||||
|  | (define (wm-maximize-window wm window) | ||||||
|  |   (send (wm:in-channel wm) (list 'maximize-window window))) | ||||||
|  | 
 | ||||||
| (define (wm-select-client wm client time) | (define (wm-select-client wm client time) | ||||||
|   (spawn (lambda () |   (spawn (lambda () | ||||||
| 	   (send (wm:in-channel wm) (list 'select-client client time))))) | 	   (send (wm:in-channel wm) (list 'select-client client time))))) | ||||||
|  | @ -279,6 +313,8 @@ | ||||||
| 					      (black-pixel dpy))) | 					      (black-pixel dpy))) | ||||||
| 	 (in-channel (make-channel)) | 	 (in-channel (make-channel)) | ||||||
| 	 (client (make-client window client-window in-channel #f #f))) | 	 (client (make-client window client-window in-channel #f #f))) | ||||||
|  |     (define-cursor dpy client-window | ||||||
|  |       (get-option-value (wm:options wm) 'client-cursor)) | ||||||
|     (reparent-window dpy window client-window 0 0) |     (reparent-window dpy window client-window 0 0) | ||||||
|     (create-client-handler wm client) |     (create-client-handler wm client) | ||||||
|     client)) |     client)) | ||||||
|  | @ -378,7 +414,10 @@ | ||||||
| ;;     ((circulate-event? xevent) | ;;     ((circulate-event? xevent) | ||||||
| ;;      (send internal-out-channel (list 'update-client-state client))) | ;;      (send internal-out-channel (list 'update-client-state client))) | ||||||
|      ((eq? (event-type enter-notify) type) |      ((eq? (event-type enter-notify) type) | ||||||
|       (if (memq 'enter (get-option-value (wm:options wm) 'focus-policy)) |       (if (and (memq 'enter (get-option-value (wm:options wm) 'focus-policy)) | ||||||
|  | 	       (window-exists? dpy (client:window client)) | ||||||
|  | 	       (not (eq? client (wm-current-client wm))) | ||||||
|  | 	       (not (window-contains-focus? dpy (client:window client)))) | ||||||
| 	  (wm-select-client wm client (crossing-event-time xevent)))) | 	  (wm-select-client wm client (crossing-event-time xevent)))) | ||||||
| 
 | 
 | ||||||
| ;;     ((eq? (event-type button-press) type) | ;;     ((eq? (event-type button-press) type) | ||||||
|  | @ -434,6 +473,14 @@ | ||||||
| 	  (begin | 	  (begin | ||||||
| 	    (wm-deinit-client wm client) | 	    (wm-deinit-client wm client) | ||||||
| 	    (exit 'destroy)))) | 	    (exit 'destroy)))) | ||||||
|  | 
 | ||||||
|  |      ((map-event? xevent) | ||||||
|  |       (let* ((s.i (get-wm-state dpy (client:window client))) | ||||||
|  | 	     (s (and s.i (car s.i)))) | ||||||
|  | 	(if (eq? (wm-state iconic) s) | ||||||
|  | 	    ;; iconic -> normal transition | ||||||
|  | 	    (send (wm:internal-out-channel wm) | ||||||
|  | 		  (list 'normalize-client client))))) | ||||||
|      ))) |      ))) | ||||||
| 
 | 
 | ||||||
| (define (transients-for-client wm client) | (define (transients-for-client wm client) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 frese
						frese