-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathzxdg-toplevel-v6-impl.lisp
63 lines (53 loc) · 2.32 KB
/
zxdg-toplevel-v6-impl.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(in-package :ulubis)
(def-wl-callback set-title (client toplevel (title :string))
)
(def-wl-callback move (client toplevel (seat :pointer) (serial :uint32))
(setf (moving-surface *compositor*) (make-move-op :surface toplevel
:surface-x (x toplevel)
:surface-y (y toplevel)
:pointer-x (pointer-x *compositor*)
:pointer-y (pointer-y *compositor*))))
(def-wl-callback resize (client toplevel (seat :pointer) (serial :uint32) (edges :uint32))
(setf (resizing-surface *compositor*)
(make-resize-op :surface toplevel
:pointer-x (pointer-x *compositor*)
:pointer-y (pointer-y *compositor*)
:surface-width (effective-width toplevel)
:surface-height (effective-height toplevel)
:direction edges)))
(def-wl-callback zxdg-toplevel-destroy (client toplevel)
(setf (role (wl-surface toplevel)) nil)
(remove-surface toplevel *compositor*)
(setf (render-needed *compositor*) t))
(def-wl-delete zxdg-toplevel-delete (toplevel)
(when toplevel
(setf (role (wl-surface toplevel)) nil)
(remove-surface toplevel *compositor*)
(setf (render-needed *compositor*) t)))
(defimplementation zxdg-toplevel-v6 (isurface ianimatable)
((:move move)
(:resize resize)
(:destroy zxdg-toplevel-destroy)
(:set-title set-title))
((zxdg-surface-v6 :accessor zxdg-surface-v6
:initarg :zxdg-surface-v6
:initform nil)))
(defmethod activate ((surface zxdg-toplevel-v6) active-surface mods)
(call-next-method)
(with-wl-array array
(setf (mem-aref (wl-array-add array 4) :int32) 4)
(zxdg-toplevel-v6-send-configure (->resource surface) 0 0 array)
(zxdg-surface-v6-send-configure (->resource (zxdg-surface-v6 surface)) 0))
surface)
(defmethod deactivate ((surface zxdg-toplevel-v6))
(call-next-method)
(with-wl-array array
(zxdg-toplevel-v6-send-configure (->resource surface) 0 0 array)
(zxdg-surface-v6-send-configure (->resource (zxdg-surface-v6 surface)) 0)))
(defmethod resize ((surface zxdg-toplevel-v6) width height time &key (activate? t))
(with-wl-array array
(setf (mem-aref (wl-array-add array 4) :int32) 3)
(when activate?
(setf (mem-aref (wl-array-add array 4) :int32) 4))
(zxdg-toplevel-v6-send-configure (->resource surface) (round width) (round height) array)
(zxdg-surface-v6-send-configure (->resource (zxdg-surface-v6 surface)) 0)))