|
20 | 20 | (in-package :xlib) |
21 | 21 |
|
22 | 22 | (export '(rr-query-version |
23 | | - rr-get-screen-info |
24 | 23 | rr-set-screen-config |
| 24 | + rr-select-input |
| 25 | + rr-get-screen-info |
25 | 26 |
|
26 | | - ;; 1.2 |
27 | | - |
| 27 | + ;; Version 1.2 |
28 | 28 | rr-get-screen-size-range |
29 | 29 | rr-set-screen-size |
30 | 30 | rr-get-screen-resources |
|
40 | 40 | rr-add-output-mode |
41 | 41 | rr-delete-output-mode |
42 | 42 | rr-get-crtc-info |
| 43 | + rr-set-crtc-config |
43 | 44 | rr-get-crtc-gamma-size |
44 | 45 | rr-get-crtc-gamma |
45 | 46 | rr-set-crtc-gamma |
46 | 47 |
|
47 | | - ;; 1.3 |
48 | | - |
| 48 | + ;; Version 1.3 |
49 | 49 | rr-get-screen-resources-current |
50 | | - rr-set-crtc-transform |
| 50 | + ;; rr-set-crtc-transform |
51 | 51 | rr-get-crtc-transform |
52 | | - rr-get-panning |
53 | | - rr-set-panning |
| 52 | + ;; rr-get-panning |
| 53 | + ;; rr-set-panning |
54 | 54 | rr-set-output-primary |
55 | | - rr-get-output-primary |
56 | | - |
57 | | - ;; 1.4 |
| 55 | + rr-get-output-primary |
58 | 56 |
|
| 57 | + ;; Version 1.4 |
59 | 58 | rr-get-providers |
60 | 59 | rr-get-provider-info |
61 | | - rr-set-provider-output-source |
62 | 60 | rr-set-provider-offload-sink |
| 61 | + rr-set-provider-output-source |
63 | 62 | rr-list-provider-properties |
64 | | - rr-select-input |
| 63 | + ;; rr-query-provider-property |
| 64 | + ;; rr-configure-provider-property |
| 65 | + ;; rr-change-provider-property |
| 66 | + ;; rr-delete-provider-property |
| 67 | + ;; rr-get-provider-property |
65 | 68 |
|
66 | | - ;; mask related |
| 69 | + ;; Mask-related |
67 | 70 | make-mode-flag-keys |
68 | 71 | make-mode-flag-mask |
69 | 72 | make-rr-select-mask |
70 | 73 | make-rr-select-keys |
71 | 74 | make-rotation-keys |
72 | 75 | make-rotation-mask |
73 | 76 |
|
74 | | - ;; struct related |
| 77 | + ;; Struct-related |
75 | 78 | rr-panning-top |
76 | 79 | rr-panning-left |
77 | 80 | rr-panning-width |
|
95 | 98 | :rr-crtc-change-notify |
96 | 99 | :rr-output-change-notify |
97 | 100 | :rr-output-property-notify) |
98 | | - :errors (output |
99 | | - crtc |
100 | | - mode)) |
| 101 | + :errors (rr-bad-output |
| 102 | + rr-bad-crtc |
| 103 | + rr-bad-mode)) |
| 104 | + |
| 105 | +(define-condition rr-bad-output (request-error) ()) |
| 106 | +(define-condition rr-bad-crtc (request-error) ()) |
| 107 | +(define-condition rr-bad-mode (request-error) ()) |
| 108 | + |
| 109 | +(define-error rr-bad-output decode-core-error) |
| 110 | +(define-error rr-bad-crtc decode-core-error) |
| 111 | +(define-error rr-bad-mode decode-core-error) |
101 | 112 |
|
102 | 113 | (defun randr-opcode (display) |
103 | 114 | (extension-opcode display "RANDR")) |
104 | 115 |
|
| 116 | +(defconstant +rr-major+ 1) |
| 117 | +(defconstant +rr-minor+ 4) |
105 | 118 |
|
106 | | -(defconstant +rr-major+ 1) |
107 | | -(defconstant +rr-minor+ 4) |
108 | | - |
109 | | -(defconstant +rr-QueryVersion+ 0) |
110 | | - ;; we skip 1 to make old clients fail pretty immediately */ |
111 | | - |
112 | | - |
113 | | -(defconstant +rr-SetScreenConfig+ 2) |
114 | | -(defconstant +rr-OldScreenChangeSelectInput+ 3) ;; 3 used to be ScreenChangeSelectInput; deprecated */ |
115 | | - |
116 | | -(defconstant +rr-SelectInput+ 4) |
117 | | -(defconstant +rr-GetScreenInfo+ 5) |
118 | | - |
119 | | - ;; * V1.2 additions */ |
120 | | - |
121 | | -(defconstant +rr-GetScreenSizeRange+ 6) |
122 | | -(defconstant +rr-SetScreenSize+ 7) |
123 | | -(defconstant +rr-GetScreenResources+ 8) |
124 | | -(defconstant +rr-GetOutputInfo+ 9) |
125 | | -(defconstant +rr-ListOutputProperties+ 10) |
126 | | -(defconstant +rr-QueryOutputProperty+ 11) |
127 | | -(defconstant +rr-ConfigureOutputProperty+ 12) |
128 | | -(defconstant +rr-ChangeOutputProperty+ 13) |
129 | | -(defconstant +rr-DeleteOutputProperty+ 14) |
130 | | -(defconstant +rr-GetOutputProperty+ 15) |
131 | | -(defconstant +rr-CreateMode+ 16) |
132 | | -(defconstant +rr-DestroyMode+ 17) |
133 | | -(defconstant +rr-AddOutputMode+ 18) |
134 | | -(defconstant +rr-DeleteOutputMode+ 19) |
135 | | -(defconstant +rr-GetCrtcInfo+ 20) |
136 | | -(defconstant +rr-SetCrtcConfig+ 21) |
137 | | -(defconstant +rr-GetCrtcGammaSize+ 22) |
138 | | -(defconstant +rr-GetCrtcGamma+ 23) |
139 | | -(defconstant +rr-SetCrtcGamma+ 24) |
140 | | - |
141 | | - ;; /* V1.3 additions */ |
142 | | - |
143 | | -(defconstant +rr-GetScreenResourcesCurrent+ 25) |
144 | | -(defconstant +rr-SetCrtcTransform+ 26) |
145 | | -(defconstant +rr-GetCrtcTransform+ 27) |
146 | | -(defconstant +rr-GetPanning+ 28) |
147 | | -(defconstant +rr-SetPanning+ 29) |
148 | | -(defconstant +rr-SetOutputPrimary+ 30) |
149 | | -(defconstant +rr-GetOutputPrimary+ 31) |
150 | | - |
151 | | - ;; 1.4 additions |
152 | | - |
153 | | - |
154 | | -(defconstant +rr-GetProviders+ 32) |
155 | | -(defconstant +rr-GetProviderInfo+ 33) |
156 | | -(defconstant +rr-SetProviderOffloadSink+ 34) |
157 | | -(defconstant +rr-SetProviderOutputSource+ 35) |
158 | | -(defconstant +rr-ListProviderProperties+ 36) |
159 | | -(defconstant +rr-QueryProviderProperty+ 37) |
160 | | -(defconstant +rr-ConfigureProviderProperty+ 38) |
161 | | -(defconstant +rr-ChangeProviderProperty+ 39) |
162 | | -(defconstant +rr-DeleteProviderProperty+ 40) |
163 | | -(defconstant +rr-GetProviderProperty+ 41) |
| 119 | +;; Version 1.0 and later exclude opcodes 1 and 3. |
| 120 | +(defconstant +rr-QueryVersion+ 0) |
| 121 | +(defconstant +rr-SetScreenConfig+ 2) |
| 122 | +(defconstant +rr-SelectInput+ 4) |
| 123 | +(defconstant +rr-GetScreenInfo+ 5) |
164 | 124 |
|
165 | | -;;; status returns |
| 125 | +;; Version 1.2 |
| 126 | +(defconstant +rr-GetScreenSizeRange+ 6) |
| 127 | +(defconstant +rr-SetScreenSize+ 7) |
| 128 | +(defconstant +rr-GetScreenResources+ 8) |
| 129 | +(defconstant +rr-GetOutputInfo+ 9) |
| 130 | +(defconstant +rr-ListOutputProperties+ 10) |
| 131 | +(defconstant +rr-QueryOutputProperty+ 11) |
| 132 | +(defconstant +rr-ConfigureOutputProperty+ 12) |
| 133 | +(defconstant +rr-ChangeOutputProperty+ 13) |
| 134 | +(defconstant +rr-DeleteOutputProperty+ 14) |
| 135 | +(defconstant +rr-GetOutputProperty+ 15) |
| 136 | +(defconstant +rr-CreateMode+ 16) |
| 137 | +(defconstant +rr-DestroyMode+ 17) |
| 138 | +(defconstant +rr-AddOutputMode+ 18) |
| 139 | +(defconstant +rr-DeleteOutputMode+ 19) |
| 140 | +(defconstant +rr-GetCrtcInfo+ 20) |
| 141 | +(defconstant +rr-SetCrtcConfig+ 21) |
| 142 | +(defconstant +rr-GetCrtcGammaSize+ 22) |
| 143 | +(defconstant +rr-GetCrtcGamma+ 23) |
| 144 | +(defconstant +rr-SetCrtcGamma+ 24) |
| 145 | + |
| 146 | +;; Version 1.3 |
| 147 | +(defconstant +rr-GetScreenResourcesCurrent+ 25) |
| 148 | +(defconstant +rr-SetCrtcTransform+ 26) |
| 149 | +(defconstant +rr-GetCrtcTransform+ 27) |
| 150 | +(defconstant +rr-GetPanning+ 28) |
| 151 | +(defconstant +rr-SetPanning+ 29) |
| 152 | +(defconstant +rr-SetOutputPrimary+ 30) |
| 153 | +(defconstant +rr-GetOutputPrimary+ 31) |
| 154 | + |
| 155 | +;; Version 1.4 |
| 156 | +(defconstant +rr-GetProviders+ 32) |
| 157 | +(defconstant +rr-GetProviderInfo+ 33) |
| 158 | +(defconstant +rr-SetProviderOffloadSink+ 34) |
| 159 | +(defconstant +rr-SetProviderOutputSource+ 35) |
| 160 | +(defconstant +rr-ListProviderProperties+ 36) |
| 161 | +(defconstant +rr-QueryProviderProperty+ 37) |
| 162 | +(defconstant +rr-ConfigureProviderProperty+ 38) |
| 163 | +(defconstant +rr-ChangeProviderProperty+ 39) |
| 164 | +(defconstant +rr-DeleteProviderProperty+ 40) |
| 165 | +(defconstant +rr-GetProviderProperty+ 41) |
166 | 166 |
|
| 167 | +;;; status returns |
167 | 168 |
|
168 | 169 | (eval-when (:compile-toplevel :load-toplevel :execute) |
169 | 170 | (defconstant +rr-config-status+ '#(:success :invalid-config-time :invalid-time :failed)) |
|
516 | 517 | :finally (setf rates-location (+ offset 8 2))) |
517 | 518 | (sequence-get :format card16 :length num-rates :index rates-location :result-type result-type)))))) |
518 | 519 |
|
519 | | - |
520 | 520 | ;; Version 1.2 |
521 | 521 |
|
522 | 522 | (defun rr-get-screen-size-range (window &optional (result-type 'list)) |
|
528 | 528 | (values |
529 | 529 | (sequence-get :format card16 :length 4 :index 8 :result-type result-type))))) |
530 | 530 |
|
531 | | - |
532 | 531 | ;; doesn't work, asynchronous match error. set screen config works fine. |
533 | 532 |
|
534 | 533 | (defun rr-set-screen-size (window width height width-mm height-mm) |
|
822 | 821 | (pad16) |
823 | 822 | ((sequence :format card16) seq)))) |
824 | 823 |
|
825 | | -;; version 1.3 |
826 | | - |
| 824 | +;; Version 1.3 |
827 | 825 |
|
828 | 826 | (defun rr-get-screen-resources-current (window &optional (result-type 'list )) |
829 | 827 | "Unlike RRGetScreenResources, this merely returns the current configuration, and does not poll for hardware changes." |
|
950 | 948 | (card32-get 8) |
951 | 949 | )))) |
952 | 950 |
|
953 | | - |
954 | | - |
| 951 | +;; Version 1.4 |
955 | 952 |
|
956 | 953 | (defun rr-get-providers (window) |
957 | 954 | "" |
|
980 | 977 | (card16-get 20) ; num associated providers |
981 | 978 | (string-get (card16-get 22) 56)))) |
982 | 979 |
|
983 | | -(defun rr-set-provider-output-source (display provider source-provider config-timestamp) |
| 980 | +(defun rr-set-provider-offload-sink (display provider sink-provider |
| 981 | + config-timestamp) |
984 | 982 | (with-buffer-request (display (randr-opcode display)) |
985 | | - (data +rr-setprovideroutputsource+) |
| 983 | + (data +rr-setprovideroffloadsink+) |
986 | 984 | (card32 provider) |
987 | | - (card32 source-provider) |
| 985 | + (card32 sink-provider) |
988 | 986 | (card32 config-timestamp))) |
989 | 987 |
|
990 | | -(defun rr-set-provider-offload-sink (display provider sink-provider config-timestamp) |
| 988 | +(defun rr-set-provider-output-source (display provider source-provider |
| 989 | + config-timestamp) |
991 | 990 | (with-buffer-request (display (randr-opcode display)) |
992 | | - (data +rr-setprovideroffloadsink+) |
| 991 | + (data +rr-setprovideroutputsource+) |
993 | 992 | (card32 provider) |
994 | | - (card32 sink-provider) |
| 993 | + (card32 source-provider) |
995 | 994 | (card32 config-timestamp))) |
996 | 995 |
|
997 | | - |
998 | | - |
999 | 996 | (defun rr-list-provider-properties (display provider) |
1000 | 997 | "" |
1001 | 998 | (with-buffer-request-and-reply (display (randr-opcode display) nil :sizes (8 16 32)) |
|
0 commit comments