|
32 | 32 | (defvar *current-event-time* nil)
|
33 | 33 |
|
34 | 34 | (defmacro define-thesis-event-handler (event keys &body body)
|
35 |
| - (let ((fn-name (gensym)) |
36 |
| - (event-slots (gensym))) |
| 35 | + (let ((event-slots (gensym))) |
37 | 36 | (multiple-value-bind (body declarations docstring)
|
38 | 37 | (parse-body body :documentation t)
|
39 |
| - `(labels ((,fn-name (&rest ,event-slots &key ,@keys &allow-other-keys) |
40 |
| - (declare (ignore ,event-slots)) |
41 |
| - ,@(when docstring |
42 |
| - (list docstring)) |
43 |
| - ,@declarations |
44 |
| - ,@body)) |
45 |
| - (setf (gethash ,event *event-fn-table*) #',fn-name))))) |
| 38 | + `(setf (gethash ,event *event-fn-table*) |
| 39 | + (lambda (&rest ,event-slots &key ,@keys &allow-other-keys) |
| 40 | + (declare (ignore ,event-slots) |
| 41 | + ,@(cdar declarations)) |
| 42 | + ,@(when docstring |
| 43 | + (list docstring)) |
| 44 | + ,@body))))) |
46 | 45 |
|
47 | 46 | ;;; Configure request
|
48 | 47 |
|
@@ -390,6 +389,20 @@ converted to an atom is removed."
|
390 | 389 | (define-thesis-event-handler :selection-clear (selection)
|
391 | 390 | (setf (getf *x-selection* selection) nil))
|
392 | 391 |
|
| 392 | +(define-thesis-event-handler :selection-notify (window property selection) |
| 393 | + (dformat 2 "selection-notify: ~s ~s ~s~%" window property selection) |
| 394 | + (when property |
| 395 | + (let* ((selection (or selection :primary)) |
| 396 | + (sel-string (utf8-to-string |
| 397 | + (xlib:get-property window |
| 398 | + property |
| 399 | + :type :utf8_string |
| 400 | + :result-type 'vector |
| 401 | + :delete-p t)))) |
| 402 | + (when (< 0 (length sel-string)) |
| 403 | + (setf (getf *x-selection* selection) sel-string) |
| 404 | + (run-hook-with-args *selection-notify-hook* sel-string))))) |
| 405 | + |
393 | 406 | (defun find-message-window-screen (win)
|
394 | 407 | "Return the screen, if any, that message window WIN belongs."
|
395 | 408 | (dolist (screen *screen-list*)
|
@@ -471,9 +484,8 @@ converted to an atom is removed."
|
471 | 484 | (echo-string (window-screen window) (format nil "'~a' denied map request" (window-name window)))
|
472 | 485 | (echo-string (window-screen window) (format nil "'~a' denied map request in group ~a" (window-name window) (group-name (window-group window))))))
|
473 | 486 | (frame-raise-window (window-group window) (window-frame window) window
|
474 |
| - (if (eq (window-frame window) |
475 |
| - (tile-group-current-frame (window-group window))) |
476 |
| - t nil)))) |
| 487 | + (eq (window-frame window) |
| 488 | + (tile-group-current-frame (window-group window)))))) |
477 | 489 |
|
478 | 490 | (defun maybe-raise-window (window)
|
479 | 491 | (if (deny-request-p window *deny-raise-request*)
|
@@ -599,8 +611,9 @@ the window in it's frame."
|
599 | 611 | (defun make-xlib-window (drawable)
|
600 | 612 | "For some reason the CLX xid cache screws up returns pixmaps when
|
601 | 613 | they should be windows. So use this function to make a window out of DRAWABLE."
|
602 |
| - (xlib::make-window :id (xlib:drawable-id drawable) |
603 |
| - :display *display*)) |
| 614 | + (make-instance 'xlib:window |
| 615 | + :id (xlib:drawable-id drawable) |
| 616 | + :display *display*)) |
604 | 617 |
|
605 | 618 | (defun handle-event (&rest event-slots &key display event-key &allow-other-keys)
|
606 | 619 | (declare (ignore display))
|
|
0 commit comments