Skip to content

Commit 33204b6

Browse files
committed
extensions: randr: fix missing export and errors
RR-SET-CRTC-CONFIG was unexported, and the extension's errors (and conditions) were undefined. Additionally, conform the order of the exports and function definitions to that of the opcodes, unexport some undefined functions, wrap some overlong lines, and clean up some comments and whitespace.
1 parent bfed9f0 commit 33204b6

File tree

1 file changed

+88
-91
lines changed

1 file changed

+88
-91
lines changed

extensions/randr.lisp

Lines changed: 88 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
(in-package :xlib)
2121

2222
(export '(rr-query-version
23-
rr-get-screen-info
2423
rr-set-screen-config
24+
rr-select-input
25+
rr-get-screen-info
2526

26-
;; 1.2
27-
27+
;; Version 1.2
2828
rr-get-screen-size-range
2929
rr-set-screen-size
3030
rr-get-screen-resources
@@ -40,38 +40,41 @@
4040
rr-add-output-mode
4141
rr-delete-output-mode
4242
rr-get-crtc-info
43+
rr-set-crtc-config
4344
rr-get-crtc-gamma-size
4445
rr-get-crtc-gamma
4546
rr-set-crtc-gamma
4647

47-
;; 1.3
48-
48+
;; Version 1.3
4949
rr-get-screen-resources-current
50-
rr-set-crtc-transform
50+
;; rr-set-crtc-transform
5151
rr-get-crtc-transform
52-
rr-get-panning
53-
rr-set-panning
52+
;; rr-get-panning
53+
;; rr-set-panning
5454
rr-set-output-primary
55-
rr-get-output-primary
56-
57-
;; 1.4
55+
rr-get-output-primary
5856

57+
;; Version 1.4
5958
rr-get-providers
6059
rr-get-provider-info
61-
rr-set-provider-output-source
6260
rr-set-provider-offload-sink
61+
rr-set-provider-output-source
6362
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
6568

66-
;; mask related
69+
;; Mask-related
6770
make-mode-flag-keys
6871
make-mode-flag-mask
6972
make-rr-select-mask
7073
make-rr-select-keys
7174
make-rotation-keys
7275
make-rotation-mask
7376

74-
;; struct related
77+
;; Struct-related
7578
rr-panning-top
7679
rr-panning-left
7780
rr-panning-width
@@ -95,75 +98,73 @@
9598
:rr-crtc-change-notify
9699
:rr-output-change-notify
97100
: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)
101112

102113
(defun randr-opcode (display)
103114
(extension-opcode display "RANDR"))
104115

116+
(defconstant +rr-major+ 1)
117+
(defconstant +rr-minor+ 4)
105118

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)
164124

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)
166166

167+
;;; status returns
167168

168169
(eval-when (:compile-toplevel :load-toplevel :execute)
169170
(defconstant +rr-config-status+ '#(:success :invalid-config-time :invalid-time :failed))
@@ -516,7 +517,6 @@
516517
:finally (setf rates-location (+ offset 8 2)))
517518
(sequence-get :format card16 :length num-rates :index rates-location :result-type result-type))))))
518519

519-
520520
;; Version 1.2
521521

522522
(defun rr-get-screen-size-range (window &optional (result-type 'list))
@@ -528,7 +528,6 @@
528528
(values
529529
(sequence-get :format card16 :length 4 :index 8 :result-type result-type)))))
530530

531-
532531
;; doesn't work, asynchronous match error. set screen config works fine.
533532

534533
(defun rr-set-screen-size (window width height width-mm height-mm)
@@ -822,8 +821,7 @@
822821
(pad16)
823822
((sequence :format card16) seq))))
824823

825-
;; version 1.3
826-
824+
;; Version 1.3
827825

828826
(defun rr-get-screen-resources-current (window &optional (result-type 'list ))
829827
"Unlike RRGetScreenResources, this merely returns the current configuration, and does not poll for hardware changes."
@@ -950,8 +948,7 @@
950948
(card32-get 8)
951949
))))
952950

953-
954-
951+
;; Version 1.4
955952

956953
(defun rr-get-providers (window)
957954
""
@@ -980,22 +977,22 @@
980977
(card16-get 20) ; num associated providers
981978
(string-get (card16-get 22) 56))))
982979

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)
984982
(with-buffer-request (display (randr-opcode display))
985-
(data +rr-setprovideroutputsource+)
983+
(data +rr-setprovideroffloadsink+)
986984
(card32 provider)
987-
(card32 source-provider)
985+
(card32 sink-provider)
988986
(card32 config-timestamp)))
989987

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)
991990
(with-buffer-request (display (randr-opcode display))
992-
(data +rr-setprovideroffloadsink+)
991+
(data +rr-setprovideroutputsource+)
993992
(card32 provider)
994-
(card32 sink-provider)
993+
(card32 source-provider)
995994
(card32 config-timestamp)))
996995

997-
998-
999996
(defun rr-list-provider-properties (display provider)
1000997
""
1001998
(with-buffer-request-and-reply (display (randr-opcode display) nil :sizes (8 16 32))

0 commit comments

Comments
 (0)