1
2 package xfixes
3
4
5
6 import (
7 "github.com/jezek/xgb"
8
9 "github.com/jezek/xgb/render"
10 "github.com/jezek/xgb/shape"
11 "github.com/jezek/xgb/xproto"
12 )
13
14
15 func Init(c *xgb.Conn) error {
16 reply, err := xproto.QueryExtension(c, 6, "XFIXES").Reply()
17 switch {
18 case err != nil:
19 return err
20 case !reply.Present:
21 return xgb.Errorf("No extension named XFIXES could be found on on the server.")
22 }
23
24 c.ExtLock.Lock()
25 c.Extensions["XFIXES"] = reply.MajorOpcode
26 c.ExtLock.Unlock()
27 for evNum, fun := range xgb.NewExtEventFuncs["XFIXES"] {
28 xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun
29 }
30 for errNum, fun := range xgb.NewExtErrorFuncs["XFIXES"] {
31 xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun
32 }
33 return nil
34 }
35
36 func init() {
37 xgb.NewExtEventFuncs["XFIXES"] = make(map[int]xgb.NewEventFun)
38 xgb.NewExtErrorFuncs["XFIXES"] = make(map[int]xgb.NewErrorFun)
39 }
40
41
42 const BadBadRegion = 0
43
44 type BadRegionError struct {
45 Sequence uint16
46 NiceName string
47 }
48
49
50 func BadRegionErrorNew(buf []byte) xgb.Error {
51 v := BadRegionError{}
52 v.NiceName = "BadRegion"
53
54 b := 1
55 b += 1
56
57 v.Sequence = xgb.Get16(buf[b:])
58 b += 2
59
60 return v
61 }
62
63
64
65 func (err BadRegionError) SequenceId() uint16 {
66 return err.Sequence
67 }
68
69
70 func (err BadRegionError) BadId() uint32 {
71 return 0
72 }
73
74
75
76 func (err BadRegionError) Error() string {
77 fieldVals := make([]string, 0, 0)
78 fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
79 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
80 return "BadBadRegion {" + xgb.StringsJoin(fieldVals, ", ") + "}"
81 }
82
83 func init() {
84 xgb.NewExtErrorFuncs["XFIXES"][0] = BadRegionErrorNew
85 }
86
87 type Barrier uint32
88
89 func NewBarrierId(c *xgb.Conn) (Barrier, error) {
90 id, err := c.NewId()
91 if err != nil {
92 return 0, err
93 }
94 return Barrier(id), nil
95 }
96
97 const (
98 BarrierDirectionsPositiveX = 1
99 BarrierDirectionsPositiveY = 2
100 BarrierDirectionsNegativeX = 4
101 BarrierDirectionsNegativeY = 8
102 )
103
104
105 const CursorNotify = 1
106
107 type CursorNotifyEvent struct {
108 Sequence uint16
109 Subtype byte
110 Window xproto.Window
111 CursorSerial uint32
112 Timestamp xproto.Timestamp
113 Name xproto.Atom
114
115 }
116
117
118 func CursorNotifyEventNew(buf []byte) xgb.Event {
119 v := CursorNotifyEvent{}
120 b := 1
121
122 v.Subtype = buf[b]
123 b += 1
124
125 v.Sequence = xgb.Get16(buf[b:])
126 b += 2
127
128 v.Window = xproto.Window(xgb.Get32(buf[b:]))
129 b += 4
130
131 v.CursorSerial = xgb.Get32(buf[b:])
132 b += 4
133
134 v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
135 b += 4
136
137 v.Name = xproto.Atom(xgb.Get32(buf[b:]))
138 b += 4
139
140 b += 12
141
142 return v
143 }
144
145
146 func (v CursorNotifyEvent) Bytes() []byte {
147 buf := make([]byte, 32)
148 b := 0
149
150
151 buf[b] = 1
152 b += 1
153
154 buf[b] = v.Subtype
155 b += 1
156
157 b += 2
158
159 xgb.Put32(buf[b:], uint32(v.Window))
160 b += 4
161
162 xgb.Put32(buf[b:], v.CursorSerial)
163 b += 4
164
165 xgb.Put32(buf[b:], uint32(v.Timestamp))
166 b += 4
167
168 xgb.Put32(buf[b:], uint32(v.Name))
169 b += 4
170
171 b += 12
172
173 return buf
174 }
175
176
177
178
179 func (v CursorNotifyEvent) SequenceId() uint16 {
180 return v.Sequence
181 }
182
183
184 func (v CursorNotifyEvent) String() string {
185 fieldVals := make([]string, 0, 6)
186 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
187 fieldVals = append(fieldVals, xgb.Sprintf("Subtype: %d", v.Subtype))
188 fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
189 fieldVals = append(fieldVals, xgb.Sprintf("CursorSerial: %d", v.CursorSerial))
190 fieldVals = append(fieldVals, xgb.Sprintf("Timestamp: %d", v.Timestamp))
191 fieldVals = append(fieldVals, xgb.Sprintf("Name: %d", v.Name))
192 return "CursorNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
193 }
194
195 func init() {
196 xgb.NewExtEventFuncs["XFIXES"][1] = CursorNotifyEventNew
197 }
198
199 const (
200 CursorNotifyDisplayCursor = 0
201 )
202
203 const (
204 CursorNotifyMaskDisplayCursor = 1
205 )
206
207 type Region uint32
208
209 func NewRegionId(c *xgb.Conn) (Region, error) {
210 id, err := c.NewId()
211 if err != nil {
212 return 0, err
213 }
214 return Region(id), nil
215 }
216
217 const (
218 RegionNone = 0
219 )
220
221 const (
222 SaveSetMappingMap = 0
223 SaveSetMappingUnmap = 1
224 )
225
226 const (
227 SaveSetModeInsert = 0
228 SaveSetModeDelete = 1
229 )
230
231 const (
232 SaveSetTargetNearest = 0
233 SaveSetTargetRoot = 1
234 )
235
236 const (
237 SelectionEventSetSelectionOwner = 0
238 SelectionEventSelectionWindowDestroy = 1
239 SelectionEventSelectionClientClose = 2
240 )
241
242 const (
243 SelectionEventMaskSetSelectionOwner = 1
244 SelectionEventMaskSelectionWindowDestroy = 2
245 SelectionEventMaskSelectionClientClose = 4
246 )
247
248
249 const SelectionNotify = 0
250
251 type SelectionNotifyEvent struct {
252 Sequence uint16
253 Subtype byte
254 Window xproto.Window
255 Owner xproto.Window
256 Selection xproto.Atom
257 Timestamp xproto.Timestamp
258 SelectionTimestamp xproto.Timestamp
259
260 }
261
262
263 func SelectionNotifyEventNew(buf []byte) xgb.Event {
264 v := SelectionNotifyEvent{}
265 b := 1
266
267 v.Subtype = buf[b]
268 b += 1
269
270 v.Sequence = xgb.Get16(buf[b:])
271 b += 2
272
273 v.Window = xproto.Window(xgb.Get32(buf[b:]))
274 b += 4
275
276 v.Owner = xproto.Window(xgb.Get32(buf[b:]))
277 b += 4
278
279 v.Selection = xproto.Atom(xgb.Get32(buf[b:]))
280 b += 4
281
282 v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
283 b += 4
284
285 v.SelectionTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
286 b += 4
287
288 b += 8
289
290 return v
291 }
292
293
294 func (v SelectionNotifyEvent) Bytes() []byte {
295 buf := make([]byte, 32)
296 b := 0
297
298
299 buf[b] = 0
300 b += 1
301
302 buf[b] = v.Subtype
303 b += 1
304
305 b += 2
306
307 xgb.Put32(buf[b:], uint32(v.Window))
308 b += 4
309
310 xgb.Put32(buf[b:], uint32(v.Owner))
311 b += 4
312
313 xgb.Put32(buf[b:], uint32(v.Selection))
314 b += 4
315
316 xgb.Put32(buf[b:], uint32(v.Timestamp))
317 b += 4
318
319 xgb.Put32(buf[b:], uint32(v.SelectionTimestamp))
320 b += 4
321
322 b += 8
323
324 return buf
325 }
326
327
328
329
330 func (v SelectionNotifyEvent) SequenceId() uint16 {
331 return v.Sequence
332 }
333
334
335 func (v SelectionNotifyEvent) String() string {
336 fieldVals := make([]string, 0, 7)
337 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
338 fieldVals = append(fieldVals, xgb.Sprintf("Subtype: %d", v.Subtype))
339 fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
340 fieldVals = append(fieldVals, xgb.Sprintf("Owner: %d", v.Owner))
341 fieldVals = append(fieldVals, xgb.Sprintf("Selection: %d", v.Selection))
342 fieldVals = append(fieldVals, xgb.Sprintf("Timestamp: %d", v.Timestamp))
343 fieldVals = append(fieldVals, xgb.Sprintf("SelectionTimestamp: %d", v.SelectionTimestamp))
344 return "SelectionNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
345 }
346
347 func init() {
348 xgb.NewExtEventFuncs["XFIXES"][0] = SelectionNotifyEventNew
349 }
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376 type ChangeCursorCookie struct {
377 *xgb.Cookie
378 }
379
380
381
382 func ChangeCursor(c *xgb.Conn, Source xproto.Cursor, Destination xproto.Cursor) ChangeCursorCookie {
383 c.ExtLock.RLock()
384 defer c.ExtLock.RUnlock()
385 if _, ok := c.Extensions["XFIXES"]; !ok {
386 panic("Cannot issue request 'ChangeCursor' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
387 }
388 cookie := c.NewCookie(false, false)
389 c.NewRequest(changeCursorRequest(c, Source, Destination), cookie)
390 return ChangeCursorCookie{cookie}
391 }
392
393
394
395 func ChangeCursorChecked(c *xgb.Conn, Source xproto.Cursor, Destination xproto.Cursor) ChangeCursorCookie {
396 c.ExtLock.RLock()
397 defer c.ExtLock.RUnlock()
398 if _, ok := c.Extensions["XFIXES"]; !ok {
399 panic("Cannot issue request 'ChangeCursor' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
400 }
401 cookie := c.NewCookie(true, false)
402 c.NewRequest(changeCursorRequest(c, Source, Destination), cookie)
403 return ChangeCursorCookie{cookie}
404 }
405
406
407
408 func (cook ChangeCursorCookie) Check() error {
409 return cook.Cookie.Check()
410 }
411
412
413
414 func changeCursorRequest(c *xgb.Conn, Source xproto.Cursor, Destination xproto.Cursor) []byte {
415 size := 12
416 b := 0
417 buf := make([]byte, size)
418
419 c.ExtLock.RLock()
420 buf[b] = c.Extensions["XFIXES"]
421 c.ExtLock.RUnlock()
422 b += 1
423
424 buf[b] = 26
425 b += 1
426
427 xgb.Put16(buf[b:], uint16(size/4))
428 b += 2
429
430 xgb.Put32(buf[b:], uint32(Source))
431 b += 4
432
433 xgb.Put32(buf[b:], uint32(Destination))
434 b += 4
435
436 return buf
437 }
438
439
440 type ChangeCursorByNameCookie struct {
441 *xgb.Cookie
442 }
443
444
445
446 func ChangeCursorByName(c *xgb.Conn, Src xproto.Cursor, Nbytes uint16, Name string) ChangeCursorByNameCookie {
447 c.ExtLock.RLock()
448 defer c.ExtLock.RUnlock()
449 if _, ok := c.Extensions["XFIXES"]; !ok {
450 panic("Cannot issue request 'ChangeCursorByName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
451 }
452 cookie := c.NewCookie(false, false)
453 c.NewRequest(changeCursorByNameRequest(c, Src, Nbytes, Name), cookie)
454 return ChangeCursorByNameCookie{cookie}
455 }
456
457
458
459 func ChangeCursorByNameChecked(c *xgb.Conn, Src xproto.Cursor, Nbytes uint16, Name string) ChangeCursorByNameCookie {
460 c.ExtLock.RLock()
461 defer c.ExtLock.RUnlock()
462 if _, ok := c.Extensions["XFIXES"]; !ok {
463 panic("Cannot issue request 'ChangeCursorByName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
464 }
465 cookie := c.NewCookie(true, false)
466 c.NewRequest(changeCursorByNameRequest(c, Src, Nbytes, Name), cookie)
467 return ChangeCursorByNameCookie{cookie}
468 }
469
470
471
472 func (cook ChangeCursorByNameCookie) Check() error {
473 return cook.Cookie.Check()
474 }
475
476
477
478 func changeCursorByNameRequest(c *xgb.Conn, Src xproto.Cursor, Nbytes uint16, Name string) []byte {
479 size := xgb.Pad((12 + xgb.Pad((int(Nbytes) * 1))))
480 b := 0
481 buf := make([]byte, size)
482
483 c.ExtLock.RLock()
484 buf[b] = c.Extensions["XFIXES"]
485 c.ExtLock.RUnlock()
486 b += 1
487
488 buf[b] = 27
489 b += 1
490
491 xgb.Put16(buf[b:], uint16(size/4))
492 b += 2
493
494 xgb.Put32(buf[b:], uint32(Src))
495 b += 4
496
497 xgb.Put16(buf[b:], Nbytes)
498 b += 2
499
500 b += 2
501
502 copy(buf[b:], Name[:Nbytes])
503 b += int(Nbytes)
504
505 return buf
506 }
507
508
509 type ChangeSaveSetCookie struct {
510 *xgb.Cookie
511 }
512
513
514
515 func ChangeSaveSet(c *xgb.Conn, Mode byte, Target byte, Map byte, Window xproto.Window) ChangeSaveSetCookie {
516 c.ExtLock.RLock()
517 defer c.ExtLock.RUnlock()
518 if _, ok := c.Extensions["XFIXES"]; !ok {
519 panic("Cannot issue request 'ChangeSaveSet' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
520 }
521 cookie := c.NewCookie(false, false)
522 c.NewRequest(changeSaveSetRequest(c, Mode, Target, Map, Window), cookie)
523 return ChangeSaveSetCookie{cookie}
524 }
525
526
527
528 func ChangeSaveSetChecked(c *xgb.Conn, Mode byte, Target byte, Map byte, Window xproto.Window) ChangeSaveSetCookie {
529 c.ExtLock.RLock()
530 defer c.ExtLock.RUnlock()
531 if _, ok := c.Extensions["XFIXES"]; !ok {
532 panic("Cannot issue request 'ChangeSaveSet' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
533 }
534 cookie := c.NewCookie(true, false)
535 c.NewRequest(changeSaveSetRequest(c, Mode, Target, Map, Window), cookie)
536 return ChangeSaveSetCookie{cookie}
537 }
538
539
540
541 func (cook ChangeSaveSetCookie) Check() error {
542 return cook.Cookie.Check()
543 }
544
545
546
547 func changeSaveSetRequest(c *xgb.Conn, Mode byte, Target byte, Map byte, Window xproto.Window) []byte {
548 size := 12
549 b := 0
550 buf := make([]byte, size)
551
552 c.ExtLock.RLock()
553 buf[b] = c.Extensions["XFIXES"]
554 c.ExtLock.RUnlock()
555 b += 1
556
557 buf[b] = 1
558 b += 1
559
560 xgb.Put16(buf[b:], uint16(size/4))
561 b += 2
562
563 buf[b] = Mode
564 b += 1
565
566 buf[b] = Target
567 b += 1
568
569 buf[b] = Map
570 b += 1
571
572 b += 1
573
574 xgb.Put32(buf[b:], uint32(Window))
575 b += 4
576
577 return buf
578 }
579
580
581 type CopyRegionCookie struct {
582 *xgb.Cookie
583 }
584
585
586
587 func CopyRegion(c *xgb.Conn, Source Region, Destination Region) CopyRegionCookie {
588 c.ExtLock.RLock()
589 defer c.ExtLock.RUnlock()
590 if _, ok := c.Extensions["XFIXES"]; !ok {
591 panic("Cannot issue request 'CopyRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
592 }
593 cookie := c.NewCookie(false, false)
594 c.NewRequest(copyRegionRequest(c, Source, Destination), cookie)
595 return CopyRegionCookie{cookie}
596 }
597
598
599
600 func CopyRegionChecked(c *xgb.Conn, Source Region, Destination Region) CopyRegionCookie {
601 c.ExtLock.RLock()
602 defer c.ExtLock.RUnlock()
603 if _, ok := c.Extensions["XFIXES"]; !ok {
604 panic("Cannot issue request 'CopyRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
605 }
606 cookie := c.NewCookie(true, false)
607 c.NewRequest(copyRegionRequest(c, Source, Destination), cookie)
608 return CopyRegionCookie{cookie}
609 }
610
611
612
613 func (cook CopyRegionCookie) Check() error {
614 return cook.Cookie.Check()
615 }
616
617
618
619 func copyRegionRequest(c *xgb.Conn, Source Region, Destination Region) []byte {
620 size := 12
621 b := 0
622 buf := make([]byte, size)
623
624 c.ExtLock.RLock()
625 buf[b] = c.Extensions["XFIXES"]
626 c.ExtLock.RUnlock()
627 b += 1
628
629 buf[b] = 12
630 b += 1
631
632 xgb.Put16(buf[b:], uint16(size/4))
633 b += 2
634
635 xgb.Put32(buf[b:], uint32(Source))
636 b += 4
637
638 xgb.Put32(buf[b:], uint32(Destination))
639 b += 4
640
641 return buf
642 }
643
644
645 type CreatePointerBarrierCookie struct {
646 *xgb.Cookie
647 }
648
649
650
651 func CreatePointerBarrier(c *xgb.Conn, Barrier Barrier, Window xproto.Window, X1 uint16, Y1 uint16, X2 uint16, Y2 uint16, Directions uint32, NumDevices uint16, Devices []uint16) CreatePointerBarrierCookie {
652 c.ExtLock.RLock()
653 defer c.ExtLock.RUnlock()
654 if _, ok := c.Extensions["XFIXES"]; !ok {
655 panic("Cannot issue request 'CreatePointerBarrier' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
656 }
657 cookie := c.NewCookie(false, false)
658 c.NewRequest(createPointerBarrierRequest(c, Barrier, Window, X1, Y1, X2, Y2, Directions, NumDevices, Devices), cookie)
659 return CreatePointerBarrierCookie{cookie}
660 }
661
662
663
664 func CreatePointerBarrierChecked(c *xgb.Conn, Barrier Barrier, Window xproto.Window, X1 uint16, Y1 uint16, X2 uint16, Y2 uint16, Directions uint32, NumDevices uint16, Devices []uint16) CreatePointerBarrierCookie {
665 c.ExtLock.RLock()
666 defer c.ExtLock.RUnlock()
667 if _, ok := c.Extensions["XFIXES"]; !ok {
668 panic("Cannot issue request 'CreatePointerBarrier' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
669 }
670 cookie := c.NewCookie(true, false)
671 c.NewRequest(createPointerBarrierRequest(c, Barrier, Window, X1, Y1, X2, Y2, Directions, NumDevices, Devices), cookie)
672 return CreatePointerBarrierCookie{cookie}
673 }
674
675
676
677 func (cook CreatePointerBarrierCookie) Check() error {
678 return cook.Cookie.Check()
679 }
680
681
682
683 func createPointerBarrierRequest(c *xgb.Conn, Barrier Barrier, Window xproto.Window, X1 uint16, Y1 uint16, X2 uint16, Y2 uint16, Directions uint32, NumDevices uint16, Devices []uint16) []byte {
684 size := xgb.Pad((28 + xgb.Pad((int(NumDevices) * 2))))
685 b := 0
686 buf := make([]byte, size)
687
688 c.ExtLock.RLock()
689 buf[b] = c.Extensions["XFIXES"]
690 c.ExtLock.RUnlock()
691 b += 1
692
693 buf[b] = 31
694 b += 1
695
696 xgb.Put16(buf[b:], uint16(size/4))
697 b += 2
698
699 xgb.Put32(buf[b:], uint32(Barrier))
700 b += 4
701
702 xgb.Put32(buf[b:], uint32(Window))
703 b += 4
704
705 xgb.Put16(buf[b:], X1)
706 b += 2
707
708 xgb.Put16(buf[b:], Y1)
709 b += 2
710
711 xgb.Put16(buf[b:], X2)
712 b += 2
713
714 xgb.Put16(buf[b:], Y2)
715 b += 2
716
717 xgb.Put32(buf[b:], Directions)
718 b += 4
719
720 b += 2
721
722 xgb.Put16(buf[b:], NumDevices)
723 b += 2
724
725 for i := 0; i < int(NumDevices); i++ {
726 xgb.Put16(buf[b:], Devices[i])
727 b += 2
728 }
729
730 return buf
731 }
732
733
734 type CreateRegionCookie struct {
735 *xgb.Cookie
736 }
737
738
739
740 func CreateRegion(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) CreateRegionCookie {
741 c.ExtLock.RLock()
742 defer c.ExtLock.RUnlock()
743 if _, ok := c.Extensions["XFIXES"]; !ok {
744 panic("Cannot issue request 'CreateRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
745 }
746 cookie := c.NewCookie(false, false)
747 c.NewRequest(createRegionRequest(c, Region, Rectangles), cookie)
748 return CreateRegionCookie{cookie}
749 }
750
751
752
753 func CreateRegionChecked(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) CreateRegionCookie {
754 c.ExtLock.RLock()
755 defer c.ExtLock.RUnlock()
756 if _, ok := c.Extensions["XFIXES"]; !ok {
757 panic("Cannot issue request 'CreateRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
758 }
759 cookie := c.NewCookie(true, false)
760 c.NewRequest(createRegionRequest(c, Region, Rectangles), cookie)
761 return CreateRegionCookie{cookie}
762 }
763
764
765
766 func (cook CreateRegionCookie) Check() error {
767 return cook.Cookie.Check()
768 }
769
770
771
772 func createRegionRequest(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) []byte {
773 size := xgb.Pad((8 + xgb.Pad((len(Rectangles) * 8))))
774 b := 0
775 buf := make([]byte, size)
776
777 c.ExtLock.RLock()
778 buf[b] = c.Extensions["XFIXES"]
779 c.ExtLock.RUnlock()
780 b += 1
781
782 buf[b] = 5
783 b += 1
784
785 xgb.Put16(buf[b:], uint16(size/4))
786 b += 2
787
788 xgb.Put32(buf[b:], uint32(Region))
789 b += 4
790
791 b += xproto.RectangleListBytes(buf[b:], Rectangles)
792
793 return buf
794 }
795
796
797 type CreateRegionFromBitmapCookie struct {
798 *xgb.Cookie
799 }
800
801
802
803 func CreateRegionFromBitmap(c *xgb.Conn, Region Region, Bitmap xproto.Pixmap) CreateRegionFromBitmapCookie {
804 c.ExtLock.RLock()
805 defer c.ExtLock.RUnlock()
806 if _, ok := c.Extensions["XFIXES"]; !ok {
807 panic("Cannot issue request 'CreateRegionFromBitmap' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
808 }
809 cookie := c.NewCookie(false, false)
810 c.NewRequest(createRegionFromBitmapRequest(c, Region, Bitmap), cookie)
811 return CreateRegionFromBitmapCookie{cookie}
812 }
813
814
815
816 func CreateRegionFromBitmapChecked(c *xgb.Conn, Region Region, Bitmap xproto.Pixmap) CreateRegionFromBitmapCookie {
817 c.ExtLock.RLock()
818 defer c.ExtLock.RUnlock()
819 if _, ok := c.Extensions["XFIXES"]; !ok {
820 panic("Cannot issue request 'CreateRegionFromBitmap' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
821 }
822 cookie := c.NewCookie(true, false)
823 c.NewRequest(createRegionFromBitmapRequest(c, Region, Bitmap), cookie)
824 return CreateRegionFromBitmapCookie{cookie}
825 }
826
827
828
829 func (cook CreateRegionFromBitmapCookie) Check() error {
830 return cook.Cookie.Check()
831 }
832
833
834
835 func createRegionFromBitmapRequest(c *xgb.Conn, Region Region, Bitmap xproto.Pixmap) []byte {
836 size := 12
837 b := 0
838 buf := make([]byte, size)
839
840 c.ExtLock.RLock()
841 buf[b] = c.Extensions["XFIXES"]
842 c.ExtLock.RUnlock()
843 b += 1
844
845 buf[b] = 6
846 b += 1
847
848 xgb.Put16(buf[b:], uint16(size/4))
849 b += 2
850
851 xgb.Put32(buf[b:], uint32(Region))
852 b += 4
853
854 xgb.Put32(buf[b:], uint32(Bitmap))
855 b += 4
856
857 return buf
858 }
859
860
861 type CreateRegionFromGCCookie struct {
862 *xgb.Cookie
863 }
864
865
866
867 func CreateRegionFromGC(c *xgb.Conn, Region Region, Gc xproto.Gcontext) CreateRegionFromGCCookie {
868 c.ExtLock.RLock()
869 defer c.ExtLock.RUnlock()
870 if _, ok := c.Extensions["XFIXES"]; !ok {
871 panic("Cannot issue request 'CreateRegionFromGC' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
872 }
873 cookie := c.NewCookie(false, false)
874 c.NewRequest(createRegionFromGCRequest(c, Region, Gc), cookie)
875 return CreateRegionFromGCCookie{cookie}
876 }
877
878
879
880 func CreateRegionFromGCChecked(c *xgb.Conn, Region Region, Gc xproto.Gcontext) CreateRegionFromGCCookie {
881 c.ExtLock.RLock()
882 defer c.ExtLock.RUnlock()
883 if _, ok := c.Extensions["XFIXES"]; !ok {
884 panic("Cannot issue request 'CreateRegionFromGC' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
885 }
886 cookie := c.NewCookie(true, false)
887 c.NewRequest(createRegionFromGCRequest(c, Region, Gc), cookie)
888 return CreateRegionFromGCCookie{cookie}
889 }
890
891
892
893 func (cook CreateRegionFromGCCookie) Check() error {
894 return cook.Cookie.Check()
895 }
896
897
898
899 func createRegionFromGCRequest(c *xgb.Conn, Region Region, Gc xproto.Gcontext) []byte {
900 size := 12
901 b := 0
902 buf := make([]byte, size)
903
904 c.ExtLock.RLock()
905 buf[b] = c.Extensions["XFIXES"]
906 c.ExtLock.RUnlock()
907 b += 1
908
909 buf[b] = 8
910 b += 1
911
912 xgb.Put16(buf[b:], uint16(size/4))
913 b += 2
914
915 xgb.Put32(buf[b:], uint32(Region))
916 b += 4
917
918 xgb.Put32(buf[b:], uint32(Gc))
919 b += 4
920
921 return buf
922 }
923
924
925 type CreateRegionFromPictureCookie struct {
926 *xgb.Cookie
927 }
928
929
930
931 func CreateRegionFromPicture(c *xgb.Conn, Region Region, Picture render.Picture) CreateRegionFromPictureCookie {
932 c.ExtLock.RLock()
933 defer c.ExtLock.RUnlock()
934 if _, ok := c.Extensions["XFIXES"]; !ok {
935 panic("Cannot issue request 'CreateRegionFromPicture' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
936 }
937 cookie := c.NewCookie(false, false)
938 c.NewRequest(createRegionFromPictureRequest(c, Region, Picture), cookie)
939 return CreateRegionFromPictureCookie{cookie}
940 }
941
942
943
944 func CreateRegionFromPictureChecked(c *xgb.Conn, Region Region, Picture render.Picture) CreateRegionFromPictureCookie {
945 c.ExtLock.RLock()
946 defer c.ExtLock.RUnlock()
947 if _, ok := c.Extensions["XFIXES"]; !ok {
948 panic("Cannot issue request 'CreateRegionFromPicture' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
949 }
950 cookie := c.NewCookie(true, false)
951 c.NewRequest(createRegionFromPictureRequest(c, Region, Picture), cookie)
952 return CreateRegionFromPictureCookie{cookie}
953 }
954
955
956
957 func (cook CreateRegionFromPictureCookie) Check() error {
958 return cook.Cookie.Check()
959 }
960
961
962
963 func createRegionFromPictureRequest(c *xgb.Conn, Region Region, Picture render.Picture) []byte {
964 size := 12
965 b := 0
966 buf := make([]byte, size)
967
968 c.ExtLock.RLock()
969 buf[b] = c.Extensions["XFIXES"]
970 c.ExtLock.RUnlock()
971 b += 1
972
973 buf[b] = 9
974 b += 1
975
976 xgb.Put16(buf[b:], uint16(size/4))
977 b += 2
978
979 xgb.Put32(buf[b:], uint32(Region))
980 b += 4
981
982 xgb.Put32(buf[b:], uint32(Picture))
983 b += 4
984
985 return buf
986 }
987
988
989 type CreateRegionFromWindowCookie struct {
990 *xgb.Cookie
991 }
992
993
994
995 func CreateRegionFromWindow(c *xgb.Conn, Region Region, Window xproto.Window, Kind shape.Kind) CreateRegionFromWindowCookie {
996 c.ExtLock.RLock()
997 defer c.ExtLock.RUnlock()
998 if _, ok := c.Extensions["XFIXES"]; !ok {
999 panic("Cannot issue request 'CreateRegionFromWindow' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1000 }
1001 cookie := c.NewCookie(false, false)
1002 c.NewRequest(createRegionFromWindowRequest(c, Region, Window, Kind), cookie)
1003 return CreateRegionFromWindowCookie{cookie}
1004 }
1005
1006
1007
1008 func CreateRegionFromWindowChecked(c *xgb.Conn, Region Region, Window xproto.Window, Kind shape.Kind) CreateRegionFromWindowCookie {
1009 c.ExtLock.RLock()
1010 defer c.ExtLock.RUnlock()
1011 if _, ok := c.Extensions["XFIXES"]; !ok {
1012 panic("Cannot issue request 'CreateRegionFromWindow' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1013 }
1014 cookie := c.NewCookie(true, false)
1015 c.NewRequest(createRegionFromWindowRequest(c, Region, Window, Kind), cookie)
1016 return CreateRegionFromWindowCookie{cookie}
1017 }
1018
1019
1020
1021 func (cook CreateRegionFromWindowCookie) Check() error {
1022 return cook.Cookie.Check()
1023 }
1024
1025
1026
1027 func createRegionFromWindowRequest(c *xgb.Conn, Region Region, Window xproto.Window, Kind shape.Kind) []byte {
1028 size := 16
1029 b := 0
1030 buf := make([]byte, size)
1031
1032 c.ExtLock.RLock()
1033 buf[b] = c.Extensions["XFIXES"]
1034 c.ExtLock.RUnlock()
1035 b += 1
1036
1037 buf[b] = 7
1038 b += 1
1039
1040 xgb.Put16(buf[b:], uint16(size/4))
1041 b += 2
1042
1043 xgb.Put32(buf[b:], uint32(Region))
1044 b += 4
1045
1046 xgb.Put32(buf[b:], uint32(Window))
1047 b += 4
1048
1049 buf[b] = byte(Kind)
1050 b += 1
1051
1052 b += 3
1053
1054 return buf
1055 }
1056
1057
1058 type DeletePointerBarrierCookie struct {
1059 *xgb.Cookie
1060 }
1061
1062
1063
1064 func DeletePointerBarrier(c *xgb.Conn, Barrier Barrier) DeletePointerBarrierCookie {
1065 c.ExtLock.RLock()
1066 defer c.ExtLock.RUnlock()
1067 if _, ok := c.Extensions["XFIXES"]; !ok {
1068 panic("Cannot issue request 'DeletePointerBarrier' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1069 }
1070 cookie := c.NewCookie(false, false)
1071 c.NewRequest(deletePointerBarrierRequest(c, Barrier), cookie)
1072 return DeletePointerBarrierCookie{cookie}
1073 }
1074
1075
1076
1077 func DeletePointerBarrierChecked(c *xgb.Conn, Barrier Barrier) DeletePointerBarrierCookie {
1078 c.ExtLock.RLock()
1079 defer c.ExtLock.RUnlock()
1080 if _, ok := c.Extensions["XFIXES"]; !ok {
1081 panic("Cannot issue request 'DeletePointerBarrier' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1082 }
1083 cookie := c.NewCookie(true, false)
1084 c.NewRequest(deletePointerBarrierRequest(c, Barrier), cookie)
1085 return DeletePointerBarrierCookie{cookie}
1086 }
1087
1088
1089
1090 func (cook DeletePointerBarrierCookie) Check() error {
1091 return cook.Cookie.Check()
1092 }
1093
1094
1095
1096 func deletePointerBarrierRequest(c *xgb.Conn, Barrier Barrier) []byte {
1097 size := 8
1098 b := 0
1099 buf := make([]byte, size)
1100
1101 c.ExtLock.RLock()
1102 buf[b] = c.Extensions["XFIXES"]
1103 c.ExtLock.RUnlock()
1104 b += 1
1105
1106 buf[b] = 32
1107 b += 1
1108
1109 xgb.Put16(buf[b:], uint16(size/4))
1110 b += 2
1111
1112 xgb.Put32(buf[b:], uint32(Barrier))
1113 b += 4
1114
1115 return buf
1116 }
1117
1118
1119 type DestroyRegionCookie struct {
1120 *xgb.Cookie
1121 }
1122
1123
1124
1125 func DestroyRegion(c *xgb.Conn, Region Region) DestroyRegionCookie {
1126 c.ExtLock.RLock()
1127 defer c.ExtLock.RUnlock()
1128 if _, ok := c.Extensions["XFIXES"]; !ok {
1129 panic("Cannot issue request 'DestroyRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1130 }
1131 cookie := c.NewCookie(false, false)
1132 c.NewRequest(destroyRegionRequest(c, Region), cookie)
1133 return DestroyRegionCookie{cookie}
1134 }
1135
1136
1137
1138 func DestroyRegionChecked(c *xgb.Conn, Region Region) DestroyRegionCookie {
1139 c.ExtLock.RLock()
1140 defer c.ExtLock.RUnlock()
1141 if _, ok := c.Extensions["XFIXES"]; !ok {
1142 panic("Cannot issue request 'DestroyRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1143 }
1144 cookie := c.NewCookie(true, false)
1145 c.NewRequest(destroyRegionRequest(c, Region), cookie)
1146 return DestroyRegionCookie{cookie}
1147 }
1148
1149
1150
1151 func (cook DestroyRegionCookie) Check() error {
1152 return cook.Cookie.Check()
1153 }
1154
1155
1156
1157 func destroyRegionRequest(c *xgb.Conn, Region Region) []byte {
1158 size := 8
1159 b := 0
1160 buf := make([]byte, size)
1161
1162 c.ExtLock.RLock()
1163 buf[b] = c.Extensions["XFIXES"]
1164 c.ExtLock.RUnlock()
1165 b += 1
1166
1167 buf[b] = 10
1168 b += 1
1169
1170 xgb.Put16(buf[b:], uint16(size/4))
1171 b += 2
1172
1173 xgb.Put32(buf[b:], uint32(Region))
1174 b += 4
1175
1176 return buf
1177 }
1178
1179
1180 type ExpandRegionCookie struct {
1181 *xgb.Cookie
1182 }
1183
1184
1185
1186 func ExpandRegion(c *xgb.Conn, Source Region, Destination Region, Left uint16, Right uint16, Top uint16, Bottom uint16) ExpandRegionCookie {
1187 c.ExtLock.RLock()
1188 defer c.ExtLock.RUnlock()
1189 if _, ok := c.Extensions["XFIXES"]; !ok {
1190 panic("Cannot issue request 'ExpandRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1191 }
1192 cookie := c.NewCookie(false, false)
1193 c.NewRequest(expandRegionRequest(c, Source, Destination, Left, Right, Top, Bottom), cookie)
1194 return ExpandRegionCookie{cookie}
1195 }
1196
1197
1198
1199 func ExpandRegionChecked(c *xgb.Conn, Source Region, Destination Region, Left uint16, Right uint16, Top uint16, Bottom uint16) ExpandRegionCookie {
1200 c.ExtLock.RLock()
1201 defer c.ExtLock.RUnlock()
1202 if _, ok := c.Extensions["XFIXES"]; !ok {
1203 panic("Cannot issue request 'ExpandRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1204 }
1205 cookie := c.NewCookie(true, false)
1206 c.NewRequest(expandRegionRequest(c, Source, Destination, Left, Right, Top, Bottom), cookie)
1207 return ExpandRegionCookie{cookie}
1208 }
1209
1210
1211
1212 func (cook ExpandRegionCookie) Check() error {
1213 return cook.Cookie.Check()
1214 }
1215
1216
1217
1218 func expandRegionRequest(c *xgb.Conn, Source Region, Destination Region, Left uint16, Right uint16, Top uint16, Bottom uint16) []byte {
1219 size := 20
1220 b := 0
1221 buf := make([]byte, size)
1222
1223 c.ExtLock.RLock()
1224 buf[b] = c.Extensions["XFIXES"]
1225 c.ExtLock.RUnlock()
1226 b += 1
1227
1228 buf[b] = 28
1229 b += 1
1230
1231 xgb.Put16(buf[b:], uint16(size/4))
1232 b += 2
1233
1234 xgb.Put32(buf[b:], uint32(Source))
1235 b += 4
1236
1237 xgb.Put32(buf[b:], uint32(Destination))
1238 b += 4
1239
1240 xgb.Put16(buf[b:], Left)
1241 b += 2
1242
1243 xgb.Put16(buf[b:], Right)
1244 b += 2
1245
1246 xgb.Put16(buf[b:], Top)
1247 b += 2
1248
1249 xgb.Put16(buf[b:], Bottom)
1250 b += 2
1251
1252 return buf
1253 }
1254
1255
1256 type FetchRegionCookie struct {
1257 *xgb.Cookie
1258 }
1259
1260
1261
1262 func FetchRegion(c *xgb.Conn, Region Region) FetchRegionCookie {
1263 c.ExtLock.RLock()
1264 defer c.ExtLock.RUnlock()
1265 if _, ok := c.Extensions["XFIXES"]; !ok {
1266 panic("Cannot issue request 'FetchRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1267 }
1268 cookie := c.NewCookie(true, true)
1269 c.NewRequest(fetchRegionRequest(c, Region), cookie)
1270 return FetchRegionCookie{cookie}
1271 }
1272
1273
1274
1275 func FetchRegionUnchecked(c *xgb.Conn, Region Region) FetchRegionCookie {
1276 c.ExtLock.RLock()
1277 defer c.ExtLock.RUnlock()
1278 if _, ok := c.Extensions["XFIXES"]; !ok {
1279 panic("Cannot issue request 'FetchRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1280 }
1281 cookie := c.NewCookie(false, true)
1282 c.NewRequest(fetchRegionRequest(c, Region), cookie)
1283 return FetchRegionCookie{cookie}
1284 }
1285
1286
1287 type FetchRegionReply struct {
1288 Sequence uint16
1289 Length uint32
1290
1291 Extents xproto.Rectangle
1292
1293 Rectangles []xproto.Rectangle
1294 }
1295
1296
1297 func (cook FetchRegionCookie) Reply() (*FetchRegionReply, error) {
1298 buf, err := cook.Cookie.Reply()
1299 if err != nil {
1300 return nil, err
1301 }
1302 if buf == nil {
1303 return nil, nil
1304 }
1305 return fetchRegionReply(buf), nil
1306 }
1307
1308
1309 func fetchRegionReply(buf []byte) *FetchRegionReply {
1310 v := new(FetchRegionReply)
1311 b := 1
1312
1313 b += 1
1314
1315 v.Sequence = xgb.Get16(buf[b:])
1316 b += 2
1317
1318 v.Length = xgb.Get32(buf[b:])
1319 b += 4
1320
1321 v.Extents = xproto.Rectangle{}
1322 b += xproto.RectangleRead(buf[b:], &v.Extents)
1323
1324 b += 16
1325
1326 v.Rectangles = make([]xproto.Rectangle, (int(v.Length) / 2))
1327 b += xproto.RectangleReadList(buf[b:], v.Rectangles)
1328
1329 return v
1330 }
1331
1332
1333
1334 func fetchRegionRequest(c *xgb.Conn, Region Region) []byte {
1335 size := 8
1336 b := 0
1337 buf := make([]byte, size)
1338
1339 c.ExtLock.RLock()
1340 buf[b] = c.Extensions["XFIXES"]
1341 c.ExtLock.RUnlock()
1342 b += 1
1343
1344 buf[b] = 19
1345 b += 1
1346
1347 xgb.Put16(buf[b:], uint16(size/4))
1348 b += 2
1349
1350 xgb.Put32(buf[b:], uint32(Region))
1351 b += 4
1352
1353 return buf
1354 }
1355
1356
1357 type GetCursorImageCookie struct {
1358 *xgb.Cookie
1359 }
1360
1361
1362
1363 func GetCursorImage(c *xgb.Conn) GetCursorImageCookie {
1364 c.ExtLock.RLock()
1365 defer c.ExtLock.RUnlock()
1366 if _, ok := c.Extensions["XFIXES"]; !ok {
1367 panic("Cannot issue request 'GetCursorImage' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1368 }
1369 cookie := c.NewCookie(true, true)
1370 c.NewRequest(getCursorImageRequest(c), cookie)
1371 return GetCursorImageCookie{cookie}
1372 }
1373
1374
1375
1376 func GetCursorImageUnchecked(c *xgb.Conn) GetCursorImageCookie {
1377 c.ExtLock.RLock()
1378 defer c.ExtLock.RUnlock()
1379 if _, ok := c.Extensions["XFIXES"]; !ok {
1380 panic("Cannot issue request 'GetCursorImage' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1381 }
1382 cookie := c.NewCookie(false, true)
1383 c.NewRequest(getCursorImageRequest(c), cookie)
1384 return GetCursorImageCookie{cookie}
1385 }
1386
1387
1388 type GetCursorImageReply struct {
1389 Sequence uint16
1390 Length uint32
1391
1392 X int16
1393 Y int16
1394 Width uint16
1395 Height uint16
1396 Xhot uint16
1397 Yhot uint16
1398 CursorSerial uint32
1399
1400 CursorImage []uint32
1401 }
1402
1403
1404 func (cook GetCursorImageCookie) Reply() (*GetCursorImageReply, error) {
1405 buf, err := cook.Cookie.Reply()
1406 if err != nil {
1407 return nil, err
1408 }
1409 if buf == nil {
1410 return nil, nil
1411 }
1412 return getCursorImageReply(buf), nil
1413 }
1414
1415
1416 func getCursorImageReply(buf []byte) *GetCursorImageReply {
1417 v := new(GetCursorImageReply)
1418 b := 1
1419
1420 b += 1
1421
1422 v.Sequence = xgb.Get16(buf[b:])
1423 b += 2
1424
1425 v.Length = xgb.Get32(buf[b:])
1426 b += 4
1427
1428 v.X = int16(xgb.Get16(buf[b:]))
1429 b += 2
1430
1431 v.Y = int16(xgb.Get16(buf[b:]))
1432 b += 2
1433
1434 v.Width = xgb.Get16(buf[b:])
1435 b += 2
1436
1437 v.Height = xgb.Get16(buf[b:])
1438 b += 2
1439
1440 v.Xhot = xgb.Get16(buf[b:])
1441 b += 2
1442
1443 v.Yhot = xgb.Get16(buf[b:])
1444 b += 2
1445
1446 v.CursorSerial = xgb.Get32(buf[b:])
1447 b += 4
1448
1449 b += 8
1450
1451 v.CursorImage = make([]uint32, (int(v.Width) * int(v.Height)))
1452 for i := 0; i < int((int(v.Width) * int(v.Height))); i++ {
1453 v.CursorImage[i] = xgb.Get32(buf[b:])
1454 b += 4
1455 }
1456
1457 return v
1458 }
1459
1460
1461
1462 func getCursorImageRequest(c *xgb.Conn) []byte {
1463 size := 4
1464 b := 0
1465 buf := make([]byte, size)
1466
1467 c.ExtLock.RLock()
1468 buf[b] = c.Extensions["XFIXES"]
1469 c.ExtLock.RUnlock()
1470 b += 1
1471
1472 buf[b] = 4
1473 b += 1
1474
1475 xgb.Put16(buf[b:], uint16(size/4))
1476 b += 2
1477
1478 return buf
1479 }
1480
1481
1482 type GetCursorImageAndNameCookie struct {
1483 *xgb.Cookie
1484 }
1485
1486
1487
1488 func GetCursorImageAndName(c *xgb.Conn) GetCursorImageAndNameCookie {
1489 c.ExtLock.RLock()
1490 defer c.ExtLock.RUnlock()
1491 if _, ok := c.Extensions["XFIXES"]; !ok {
1492 panic("Cannot issue request 'GetCursorImageAndName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1493 }
1494 cookie := c.NewCookie(true, true)
1495 c.NewRequest(getCursorImageAndNameRequest(c), cookie)
1496 return GetCursorImageAndNameCookie{cookie}
1497 }
1498
1499
1500
1501 func GetCursorImageAndNameUnchecked(c *xgb.Conn) GetCursorImageAndNameCookie {
1502 c.ExtLock.RLock()
1503 defer c.ExtLock.RUnlock()
1504 if _, ok := c.Extensions["XFIXES"]; !ok {
1505 panic("Cannot issue request 'GetCursorImageAndName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1506 }
1507 cookie := c.NewCookie(false, true)
1508 c.NewRequest(getCursorImageAndNameRequest(c), cookie)
1509 return GetCursorImageAndNameCookie{cookie}
1510 }
1511
1512
1513 type GetCursorImageAndNameReply struct {
1514 Sequence uint16
1515 Length uint32
1516
1517 X int16
1518 Y int16
1519 Width uint16
1520 Height uint16
1521 Xhot uint16
1522 Yhot uint16
1523 CursorSerial uint32
1524 CursorAtom xproto.Atom
1525 Nbytes uint16
1526
1527 Name string
1528
1529 CursorImage []uint32
1530 }
1531
1532
1533 func (cook GetCursorImageAndNameCookie) Reply() (*GetCursorImageAndNameReply, error) {
1534 buf, err := cook.Cookie.Reply()
1535 if err != nil {
1536 return nil, err
1537 }
1538 if buf == nil {
1539 return nil, nil
1540 }
1541 return getCursorImageAndNameReply(buf), nil
1542 }
1543
1544
1545 func getCursorImageAndNameReply(buf []byte) *GetCursorImageAndNameReply {
1546 v := new(GetCursorImageAndNameReply)
1547 b := 1
1548
1549 b += 1
1550
1551 v.Sequence = xgb.Get16(buf[b:])
1552 b += 2
1553
1554 v.Length = xgb.Get32(buf[b:])
1555 b += 4
1556
1557 v.X = int16(xgb.Get16(buf[b:]))
1558 b += 2
1559
1560 v.Y = int16(xgb.Get16(buf[b:]))
1561 b += 2
1562
1563 v.Width = xgb.Get16(buf[b:])
1564 b += 2
1565
1566 v.Height = xgb.Get16(buf[b:])
1567 b += 2
1568
1569 v.Xhot = xgb.Get16(buf[b:])
1570 b += 2
1571
1572 v.Yhot = xgb.Get16(buf[b:])
1573 b += 2
1574
1575 v.CursorSerial = xgb.Get32(buf[b:])
1576 b += 4
1577
1578 v.CursorAtom = xproto.Atom(xgb.Get32(buf[b:]))
1579 b += 4
1580
1581 v.Nbytes = xgb.Get16(buf[b:])
1582 b += 2
1583
1584 b += 2
1585
1586 {
1587 byteString := make([]byte, v.Nbytes)
1588 copy(byteString[:v.Nbytes], buf[b:])
1589 v.Name = string(byteString)
1590 b += int(v.Nbytes)
1591 }
1592
1593 b = (b + 3) & ^3
1594
1595 v.CursorImage = make([]uint32, (int(v.Width) * int(v.Height)))
1596 for i := 0; i < int((int(v.Width) * int(v.Height))); i++ {
1597 v.CursorImage[i] = xgb.Get32(buf[b:])
1598 b += 4
1599 }
1600
1601 return v
1602 }
1603
1604
1605
1606 func getCursorImageAndNameRequest(c *xgb.Conn) []byte {
1607 size := 4
1608 b := 0
1609 buf := make([]byte, size)
1610
1611 c.ExtLock.RLock()
1612 buf[b] = c.Extensions["XFIXES"]
1613 c.ExtLock.RUnlock()
1614 b += 1
1615
1616 buf[b] = 25
1617 b += 1
1618
1619 xgb.Put16(buf[b:], uint16(size/4))
1620 b += 2
1621
1622 return buf
1623 }
1624
1625
1626 type GetCursorNameCookie struct {
1627 *xgb.Cookie
1628 }
1629
1630
1631
1632 func GetCursorName(c *xgb.Conn, Cursor xproto.Cursor) GetCursorNameCookie {
1633 c.ExtLock.RLock()
1634 defer c.ExtLock.RUnlock()
1635 if _, ok := c.Extensions["XFIXES"]; !ok {
1636 panic("Cannot issue request 'GetCursorName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1637 }
1638 cookie := c.NewCookie(true, true)
1639 c.NewRequest(getCursorNameRequest(c, Cursor), cookie)
1640 return GetCursorNameCookie{cookie}
1641 }
1642
1643
1644
1645 func GetCursorNameUnchecked(c *xgb.Conn, Cursor xproto.Cursor) GetCursorNameCookie {
1646 c.ExtLock.RLock()
1647 defer c.ExtLock.RUnlock()
1648 if _, ok := c.Extensions["XFIXES"]; !ok {
1649 panic("Cannot issue request 'GetCursorName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1650 }
1651 cookie := c.NewCookie(false, true)
1652 c.NewRequest(getCursorNameRequest(c, Cursor), cookie)
1653 return GetCursorNameCookie{cookie}
1654 }
1655
1656
1657 type GetCursorNameReply struct {
1658 Sequence uint16
1659 Length uint32
1660
1661 Atom xproto.Atom
1662 Nbytes uint16
1663
1664 Name string
1665 }
1666
1667
1668 func (cook GetCursorNameCookie) Reply() (*GetCursorNameReply, error) {
1669 buf, err := cook.Cookie.Reply()
1670 if err != nil {
1671 return nil, err
1672 }
1673 if buf == nil {
1674 return nil, nil
1675 }
1676 return getCursorNameReply(buf), nil
1677 }
1678
1679
1680 func getCursorNameReply(buf []byte) *GetCursorNameReply {
1681 v := new(GetCursorNameReply)
1682 b := 1
1683
1684 b += 1
1685
1686 v.Sequence = xgb.Get16(buf[b:])
1687 b += 2
1688
1689 v.Length = xgb.Get32(buf[b:])
1690 b += 4
1691
1692 v.Atom = xproto.Atom(xgb.Get32(buf[b:]))
1693 b += 4
1694
1695 v.Nbytes = xgb.Get16(buf[b:])
1696 b += 2
1697
1698 b += 18
1699
1700 {
1701 byteString := make([]byte, v.Nbytes)
1702 copy(byteString[:v.Nbytes], buf[b:])
1703 v.Name = string(byteString)
1704 b += int(v.Nbytes)
1705 }
1706
1707 return v
1708 }
1709
1710
1711
1712 func getCursorNameRequest(c *xgb.Conn, Cursor xproto.Cursor) []byte {
1713 size := 8
1714 b := 0
1715 buf := make([]byte, size)
1716
1717 c.ExtLock.RLock()
1718 buf[b] = c.Extensions["XFIXES"]
1719 c.ExtLock.RUnlock()
1720 b += 1
1721
1722 buf[b] = 24
1723 b += 1
1724
1725 xgb.Put16(buf[b:], uint16(size/4))
1726 b += 2
1727
1728 xgb.Put32(buf[b:], uint32(Cursor))
1729 b += 4
1730
1731 return buf
1732 }
1733
1734
1735 type HideCursorCookie struct {
1736 *xgb.Cookie
1737 }
1738
1739
1740
1741 func HideCursor(c *xgb.Conn, Window xproto.Window) HideCursorCookie {
1742 c.ExtLock.RLock()
1743 defer c.ExtLock.RUnlock()
1744 if _, ok := c.Extensions["XFIXES"]; !ok {
1745 panic("Cannot issue request 'HideCursor' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1746 }
1747 cookie := c.NewCookie(false, false)
1748 c.NewRequest(hideCursorRequest(c, Window), cookie)
1749 return HideCursorCookie{cookie}
1750 }
1751
1752
1753
1754 func HideCursorChecked(c *xgb.Conn, Window xproto.Window) HideCursorCookie {
1755 c.ExtLock.RLock()
1756 defer c.ExtLock.RUnlock()
1757 if _, ok := c.Extensions["XFIXES"]; !ok {
1758 panic("Cannot issue request 'HideCursor' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1759 }
1760 cookie := c.NewCookie(true, false)
1761 c.NewRequest(hideCursorRequest(c, Window), cookie)
1762 return HideCursorCookie{cookie}
1763 }
1764
1765
1766
1767 func (cook HideCursorCookie) Check() error {
1768 return cook.Cookie.Check()
1769 }
1770
1771
1772
1773 func hideCursorRequest(c *xgb.Conn, Window xproto.Window) []byte {
1774 size := 8
1775 b := 0
1776 buf := make([]byte, size)
1777
1778 c.ExtLock.RLock()
1779 buf[b] = c.Extensions["XFIXES"]
1780 c.ExtLock.RUnlock()
1781 b += 1
1782
1783 buf[b] = 29
1784 b += 1
1785
1786 xgb.Put16(buf[b:], uint16(size/4))
1787 b += 2
1788
1789 xgb.Put32(buf[b:], uint32(Window))
1790 b += 4
1791
1792 return buf
1793 }
1794
1795
1796 type IntersectRegionCookie struct {
1797 *xgb.Cookie
1798 }
1799
1800
1801
1802 func IntersectRegion(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) IntersectRegionCookie {
1803 c.ExtLock.RLock()
1804 defer c.ExtLock.RUnlock()
1805 if _, ok := c.Extensions["XFIXES"]; !ok {
1806 panic("Cannot issue request 'IntersectRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1807 }
1808 cookie := c.NewCookie(false, false)
1809 c.NewRequest(intersectRegionRequest(c, Source1, Source2, Destination), cookie)
1810 return IntersectRegionCookie{cookie}
1811 }
1812
1813
1814
1815 func IntersectRegionChecked(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) IntersectRegionCookie {
1816 c.ExtLock.RLock()
1817 defer c.ExtLock.RUnlock()
1818 if _, ok := c.Extensions["XFIXES"]; !ok {
1819 panic("Cannot issue request 'IntersectRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1820 }
1821 cookie := c.NewCookie(true, false)
1822 c.NewRequest(intersectRegionRequest(c, Source1, Source2, Destination), cookie)
1823 return IntersectRegionCookie{cookie}
1824 }
1825
1826
1827
1828 func (cook IntersectRegionCookie) Check() error {
1829 return cook.Cookie.Check()
1830 }
1831
1832
1833
1834 func intersectRegionRequest(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) []byte {
1835 size := 16
1836 b := 0
1837 buf := make([]byte, size)
1838
1839 c.ExtLock.RLock()
1840 buf[b] = c.Extensions["XFIXES"]
1841 c.ExtLock.RUnlock()
1842 b += 1
1843
1844 buf[b] = 14
1845 b += 1
1846
1847 xgb.Put16(buf[b:], uint16(size/4))
1848 b += 2
1849
1850 xgb.Put32(buf[b:], uint32(Source1))
1851 b += 4
1852
1853 xgb.Put32(buf[b:], uint32(Source2))
1854 b += 4
1855
1856 xgb.Put32(buf[b:], uint32(Destination))
1857 b += 4
1858
1859 return buf
1860 }
1861
1862
1863 type InvertRegionCookie struct {
1864 *xgb.Cookie
1865 }
1866
1867
1868
1869 func InvertRegion(c *xgb.Conn, Source Region, Bounds xproto.Rectangle, Destination Region) InvertRegionCookie {
1870 c.ExtLock.RLock()
1871 defer c.ExtLock.RUnlock()
1872 if _, ok := c.Extensions["XFIXES"]; !ok {
1873 panic("Cannot issue request 'InvertRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1874 }
1875 cookie := c.NewCookie(false, false)
1876 c.NewRequest(invertRegionRequest(c, Source, Bounds, Destination), cookie)
1877 return InvertRegionCookie{cookie}
1878 }
1879
1880
1881
1882 func InvertRegionChecked(c *xgb.Conn, Source Region, Bounds xproto.Rectangle, Destination Region) InvertRegionCookie {
1883 c.ExtLock.RLock()
1884 defer c.ExtLock.RUnlock()
1885 if _, ok := c.Extensions["XFIXES"]; !ok {
1886 panic("Cannot issue request 'InvertRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1887 }
1888 cookie := c.NewCookie(true, false)
1889 c.NewRequest(invertRegionRequest(c, Source, Bounds, Destination), cookie)
1890 return InvertRegionCookie{cookie}
1891 }
1892
1893
1894
1895 func (cook InvertRegionCookie) Check() error {
1896 return cook.Cookie.Check()
1897 }
1898
1899
1900
1901 func invertRegionRequest(c *xgb.Conn, Source Region, Bounds xproto.Rectangle, Destination Region) []byte {
1902 size := 20
1903 b := 0
1904 buf := make([]byte, size)
1905
1906 c.ExtLock.RLock()
1907 buf[b] = c.Extensions["XFIXES"]
1908 c.ExtLock.RUnlock()
1909 b += 1
1910
1911 buf[b] = 16
1912 b += 1
1913
1914 xgb.Put16(buf[b:], uint16(size/4))
1915 b += 2
1916
1917 xgb.Put32(buf[b:], uint32(Source))
1918 b += 4
1919
1920 {
1921 structBytes := Bounds.Bytes()
1922 copy(buf[b:], structBytes)
1923 b += len(structBytes)
1924 }
1925
1926 xgb.Put32(buf[b:], uint32(Destination))
1927 b += 4
1928
1929 return buf
1930 }
1931
1932
1933 type QueryVersionCookie struct {
1934 *xgb.Cookie
1935 }
1936
1937
1938
1939 func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie {
1940 c.ExtLock.RLock()
1941 defer c.ExtLock.RUnlock()
1942 if _, ok := c.Extensions["XFIXES"]; !ok {
1943 panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1944 }
1945 cookie := c.NewCookie(true, true)
1946 c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
1947 return QueryVersionCookie{cookie}
1948 }
1949
1950
1951
1952 func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie {
1953 c.ExtLock.RLock()
1954 defer c.ExtLock.RUnlock()
1955 if _, ok := c.Extensions["XFIXES"]; !ok {
1956 panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
1957 }
1958 cookie := c.NewCookie(false, true)
1959 c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
1960 return QueryVersionCookie{cookie}
1961 }
1962
1963
1964 type QueryVersionReply struct {
1965 Sequence uint16
1966 Length uint32
1967
1968 MajorVersion uint32
1969 MinorVersion uint32
1970
1971 }
1972
1973
1974 func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
1975 buf, err := cook.Cookie.Reply()
1976 if err != nil {
1977 return nil, err
1978 }
1979 if buf == nil {
1980 return nil, nil
1981 }
1982 return queryVersionReply(buf), nil
1983 }
1984
1985
1986 func queryVersionReply(buf []byte) *QueryVersionReply {
1987 v := new(QueryVersionReply)
1988 b := 1
1989
1990 b += 1
1991
1992 v.Sequence = xgb.Get16(buf[b:])
1993 b += 2
1994
1995 v.Length = xgb.Get32(buf[b:])
1996 b += 4
1997
1998 v.MajorVersion = xgb.Get32(buf[b:])
1999 b += 4
2000
2001 v.MinorVersion = xgb.Get32(buf[b:])
2002 b += 4
2003
2004 b += 16
2005
2006 return v
2007 }
2008
2009
2010
2011 func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) []byte {
2012 size := 12
2013 b := 0
2014 buf := make([]byte, size)
2015
2016 c.ExtLock.RLock()
2017 buf[b] = c.Extensions["XFIXES"]
2018 c.ExtLock.RUnlock()
2019 b += 1
2020
2021 buf[b] = 0
2022 b += 1
2023
2024 xgb.Put16(buf[b:], uint16(size/4))
2025 b += 2
2026
2027 xgb.Put32(buf[b:], ClientMajorVersion)
2028 b += 4
2029
2030 xgb.Put32(buf[b:], ClientMinorVersion)
2031 b += 4
2032
2033 return buf
2034 }
2035
2036
2037 type RegionExtentsCookie struct {
2038 *xgb.Cookie
2039 }
2040
2041
2042
2043 func RegionExtents(c *xgb.Conn, Source Region, Destination Region) RegionExtentsCookie {
2044 c.ExtLock.RLock()
2045 defer c.ExtLock.RUnlock()
2046 if _, ok := c.Extensions["XFIXES"]; !ok {
2047 panic("Cannot issue request 'RegionExtents' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2048 }
2049 cookie := c.NewCookie(false, false)
2050 c.NewRequest(regionExtentsRequest(c, Source, Destination), cookie)
2051 return RegionExtentsCookie{cookie}
2052 }
2053
2054
2055
2056 func RegionExtentsChecked(c *xgb.Conn, Source Region, Destination Region) RegionExtentsCookie {
2057 c.ExtLock.RLock()
2058 defer c.ExtLock.RUnlock()
2059 if _, ok := c.Extensions["XFIXES"]; !ok {
2060 panic("Cannot issue request 'RegionExtents' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2061 }
2062 cookie := c.NewCookie(true, false)
2063 c.NewRequest(regionExtentsRequest(c, Source, Destination), cookie)
2064 return RegionExtentsCookie{cookie}
2065 }
2066
2067
2068
2069 func (cook RegionExtentsCookie) Check() error {
2070 return cook.Cookie.Check()
2071 }
2072
2073
2074
2075 func regionExtentsRequest(c *xgb.Conn, Source Region, Destination Region) []byte {
2076 size := 12
2077 b := 0
2078 buf := make([]byte, size)
2079
2080 c.ExtLock.RLock()
2081 buf[b] = c.Extensions["XFIXES"]
2082 c.ExtLock.RUnlock()
2083 b += 1
2084
2085 buf[b] = 18
2086 b += 1
2087
2088 xgb.Put16(buf[b:], uint16(size/4))
2089 b += 2
2090
2091 xgb.Put32(buf[b:], uint32(Source))
2092 b += 4
2093
2094 xgb.Put32(buf[b:], uint32(Destination))
2095 b += 4
2096
2097 return buf
2098 }
2099
2100
2101 type SelectCursorInputCookie struct {
2102 *xgb.Cookie
2103 }
2104
2105
2106
2107 func SelectCursorInput(c *xgb.Conn, Window xproto.Window, EventMask uint32) SelectCursorInputCookie {
2108 c.ExtLock.RLock()
2109 defer c.ExtLock.RUnlock()
2110 if _, ok := c.Extensions["XFIXES"]; !ok {
2111 panic("Cannot issue request 'SelectCursorInput' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2112 }
2113 cookie := c.NewCookie(false, false)
2114 c.NewRequest(selectCursorInputRequest(c, Window, EventMask), cookie)
2115 return SelectCursorInputCookie{cookie}
2116 }
2117
2118
2119
2120 func SelectCursorInputChecked(c *xgb.Conn, Window xproto.Window, EventMask uint32) SelectCursorInputCookie {
2121 c.ExtLock.RLock()
2122 defer c.ExtLock.RUnlock()
2123 if _, ok := c.Extensions["XFIXES"]; !ok {
2124 panic("Cannot issue request 'SelectCursorInput' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2125 }
2126 cookie := c.NewCookie(true, false)
2127 c.NewRequest(selectCursorInputRequest(c, Window, EventMask), cookie)
2128 return SelectCursorInputCookie{cookie}
2129 }
2130
2131
2132
2133 func (cook SelectCursorInputCookie) Check() error {
2134 return cook.Cookie.Check()
2135 }
2136
2137
2138
2139 func selectCursorInputRequest(c *xgb.Conn, Window xproto.Window, EventMask uint32) []byte {
2140 size := 12
2141 b := 0
2142 buf := make([]byte, size)
2143
2144 c.ExtLock.RLock()
2145 buf[b] = c.Extensions["XFIXES"]
2146 c.ExtLock.RUnlock()
2147 b += 1
2148
2149 buf[b] = 3
2150 b += 1
2151
2152 xgb.Put16(buf[b:], uint16(size/4))
2153 b += 2
2154
2155 xgb.Put32(buf[b:], uint32(Window))
2156 b += 4
2157
2158 xgb.Put32(buf[b:], EventMask)
2159 b += 4
2160
2161 return buf
2162 }
2163
2164
2165 type SelectSelectionInputCookie struct {
2166 *xgb.Cookie
2167 }
2168
2169
2170
2171 func SelectSelectionInput(c *xgb.Conn, Window xproto.Window, Selection xproto.Atom, EventMask uint32) SelectSelectionInputCookie {
2172 c.ExtLock.RLock()
2173 defer c.ExtLock.RUnlock()
2174 if _, ok := c.Extensions["XFIXES"]; !ok {
2175 panic("Cannot issue request 'SelectSelectionInput' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2176 }
2177 cookie := c.NewCookie(false, false)
2178 c.NewRequest(selectSelectionInputRequest(c, Window, Selection, EventMask), cookie)
2179 return SelectSelectionInputCookie{cookie}
2180 }
2181
2182
2183
2184 func SelectSelectionInputChecked(c *xgb.Conn, Window xproto.Window, Selection xproto.Atom, EventMask uint32) SelectSelectionInputCookie {
2185 c.ExtLock.RLock()
2186 defer c.ExtLock.RUnlock()
2187 if _, ok := c.Extensions["XFIXES"]; !ok {
2188 panic("Cannot issue request 'SelectSelectionInput' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2189 }
2190 cookie := c.NewCookie(true, false)
2191 c.NewRequest(selectSelectionInputRequest(c, Window, Selection, EventMask), cookie)
2192 return SelectSelectionInputCookie{cookie}
2193 }
2194
2195
2196
2197 func (cook SelectSelectionInputCookie) Check() error {
2198 return cook.Cookie.Check()
2199 }
2200
2201
2202
2203 func selectSelectionInputRequest(c *xgb.Conn, Window xproto.Window, Selection xproto.Atom, EventMask uint32) []byte {
2204 size := 16
2205 b := 0
2206 buf := make([]byte, size)
2207
2208 c.ExtLock.RLock()
2209 buf[b] = c.Extensions["XFIXES"]
2210 c.ExtLock.RUnlock()
2211 b += 1
2212
2213 buf[b] = 2
2214 b += 1
2215
2216 xgb.Put16(buf[b:], uint16(size/4))
2217 b += 2
2218
2219 xgb.Put32(buf[b:], uint32(Window))
2220 b += 4
2221
2222 xgb.Put32(buf[b:], uint32(Selection))
2223 b += 4
2224
2225 xgb.Put32(buf[b:], EventMask)
2226 b += 4
2227
2228 return buf
2229 }
2230
2231
2232 type SetCursorNameCookie struct {
2233 *xgb.Cookie
2234 }
2235
2236
2237
2238 func SetCursorName(c *xgb.Conn, Cursor xproto.Cursor, Nbytes uint16, Name string) SetCursorNameCookie {
2239 c.ExtLock.RLock()
2240 defer c.ExtLock.RUnlock()
2241 if _, ok := c.Extensions["XFIXES"]; !ok {
2242 panic("Cannot issue request 'SetCursorName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2243 }
2244 cookie := c.NewCookie(false, false)
2245 c.NewRequest(setCursorNameRequest(c, Cursor, Nbytes, Name), cookie)
2246 return SetCursorNameCookie{cookie}
2247 }
2248
2249
2250
2251 func SetCursorNameChecked(c *xgb.Conn, Cursor xproto.Cursor, Nbytes uint16, Name string) SetCursorNameCookie {
2252 c.ExtLock.RLock()
2253 defer c.ExtLock.RUnlock()
2254 if _, ok := c.Extensions["XFIXES"]; !ok {
2255 panic("Cannot issue request 'SetCursorName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2256 }
2257 cookie := c.NewCookie(true, false)
2258 c.NewRequest(setCursorNameRequest(c, Cursor, Nbytes, Name), cookie)
2259 return SetCursorNameCookie{cookie}
2260 }
2261
2262
2263
2264 func (cook SetCursorNameCookie) Check() error {
2265 return cook.Cookie.Check()
2266 }
2267
2268
2269
2270 func setCursorNameRequest(c *xgb.Conn, Cursor xproto.Cursor, Nbytes uint16, Name string) []byte {
2271 size := xgb.Pad((12 + xgb.Pad((int(Nbytes) * 1))))
2272 b := 0
2273 buf := make([]byte, size)
2274
2275 c.ExtLock.RLock()
2276 buf[b] = c.Extensions["XFIXES"]
2277 c.ExtLock.RUnlock()
2278 b += 1
2279
2280 buf[b] = 23
2281 b += 1
2282
2283 xgb.Put16(buf[b:], uint16(size/4))
2284 b += 2
2285
2286 xgb.Put32(buf[b:], uint32(Cursor))
2287 b += 4
2288
2289 xgb.Put16(buf[b:], Nbytes)
2290 b += 2
2291
2292 b += 2
2293
2294 copy(buf[b:], Name[:Nbytes])
2295 b += int(Nbytes)
2296
2297 return buf
2298 }
2299
2300
2301 type SetGCClipRegionCookie struct {
2302 *xgb.Cookie
2303 }
2304
2305
2306
2307 func SetGCClipRegion(c *xgb.Conn, Gc xproto.Gcontext, Region Region, XOrigin int16, YOrigin int16) SetGCClipRegionCookie {
2308 c.ExtLock.RLock()
2309 defer c.ExtLock.RUnlock()
2310 if _, ok := c.Extensions["XFIXES"]; !ok {
2311 panic("Cannot issue request 'SetGCClipRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2312 }
2313 cookie := c.NewCookie(false, false)
2314 c.NewRequest(setGCClipRegionRequest(c, Gc, Region, XOrigin, YOrigin), cookie)
2315 return SetGCClipRegionCookie{cookie}
2316 }
2317
2318
2319
2320 func SetGCClipRegionChecked(c *xgb.Conn, Gc xproto.Gcontext, Region Region, XOrigin int16, YOrigin int16) SetGCClipRegionCookie {
2321 c.ExtLock.RLock()
2322 defer c.ExtLock.RUnlock()
2323 if _, ok := c.Extensions["XFIXES"]; !ok {
2324 panic("Cannot issue request 'SetGCClipRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2325 }
2326 cookie := c.NewCookie(true, false)
2327 c.NewRequest(setGCClipRegionRequest(c, Gc, Region, XOrigin, YOrigin), cookie)
2328 return SetGCClipRegionCookie{cookie}
2329 }
2330
2331
2332
2333 func (cook SetGCClipRegionCookie) Check() error {
2334 return cook.Cookie.Check()
2335 }
2336
2337
2338
2339 func setGCClipRegionRequest(c *xgb.Conn, Gc xproto.Gcontext, Region Region, XOrigin int16, YOrigin int16) []byte {
2340 size := 16
2341 b := 0
2342 buf := make([]byte, size)
2343
2344 c.ExtLock.RLock()
2345 buf[b] = c.Extensions["XFIXES"]
2346 c.ExtLock.RUnlock()
2347 b += 1
2348
2349 buf[b] = 20
2350 b += 1
2351
2352 xgb.Put16(buf[b:], uint16(size/4))
2353 b += 2
2354
2355 xgb.Put32(buf[b:], uint32(Gc))
2356 b += 4
2357
2358 xgb.Put32(buf[b:], uint32(Region))
2359 b += 4
2360
2361 xgb.Put16(buf[b:], uint16(XOrigin))
2362 b += 2
2363
2364 xgb.Put16(buf[b:], uint16(YOrigin))
2365 b += 2
2366
2367 return buf
2368 }
2369
2370
2371 type SetPictureClipRegionCookie struct {
2372 *xgb.Cookie
2373 }
2374
2375
2376
2377 func SetPictureClipRegion(c *xgb.Conn, Picture render.Picture, Region Region, XOrigin int16, YOrigin int16) SetPictureClipRegionCookie {
2378 c.ExtLock.RLock()
2379 defer c.ExtLock.RUnlock()
2380 if _, ok := c.Extensions["XFIXES"]; !ok {
2381 panic("Cannot issue request 'SetPictureClipRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2382 }
2383 cookie := c.NewCookie(false, false)
2384 c.NewRequest(setPictureClipRegionRequest(c, Picture, Region, XOrigin, YOrigin), cookie)
2385 return SetPictureClipRegionCookie{cookie}
2386 }
2387
2388
2389
2390 func SetPictureClipRegionChecked(c *xgb.Conn, Picture render.Picture, Region Region, XOrigin int16, YOrigin int16) SetPictureClipRegionCookie {
2391 c.ExtLock.RLock()
2392 defer c.ExtLock.RUnlock()
2393 if _, ok := c.Extensions["XFIXES"]; !ok {
2394 panic("Cannot issue request 'SetPictureClipRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2395 }
2396 cookie := c.NewCookie(true, false)
2397 c.NewRequest(setPictureClipRegionRequest(c, Picture, Region, XOrigin, YOrigin), cookie)
2398 return SetPictureClipRegionCookie{cookie}
2399 }
2400
2401
2402
2403 func (cook SetPictureClipRegionCookie) Check() error {
2404 return cook.Cookie.Check()
2405 }
2406
2407
2408
2409 func setPictureClipRegionRequest(c *xgb.Conn, Picture render.Picture, Region Region, XOrigin int16, YOrigin int16) []byte {
2410 size := 16
2411 b := 0
2412 buf := make([]byte, size)
2413
2414 c.ExtLock.RLock()
2415 buf[b] = c.Extensions["XFIXES"]
2416 c.ExtLock.RUnlock()
2417 b += 1
2418
2419 buf[b] = 22
2420 b += 1
2421
2422 xgb.Put16(buf[b:], uint16(size/4))
2423 b += 2
2424
2425 xgb.Put32(buf[b:], uint32(Picture))
2426 b += 4
2427
2428 xgb.Put32(buf[b:], uint32(Region))
2429 b += 4
2430
2431 xgb.Put16(buf[b:], uint16(XOrigin))
2432 b += 2
2433
2434 xgb.Put16(buf[b:], uint16(YOrigin))
2435 b += 2
2436
2437 return buf
2438 }
2439
2440
2441 type SetRegionCookie struct {
2442 *xgb.Cookie
2443 }
2444
2445
2446
2447 func SetRegion(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) SetRegionCookie {
2448 c.ExtLock.RLock()
2449 defer c.ExtLock.RUnlock()
2450 if _, ok := c.Extensions["XFIXES"]; !ok {
2451 panic("Cannot issue request 'SetRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2452 }
2453 cookie := c.NewCookie(false, false)
2454 c.NewRequest(setRegionRequest(c, Region, Rectangles), cookie)
2455 return SetRegionCookie{cookie}
2456 }
2457
2458
2459
2460 func SetRegionChecked(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) SetRegionCookie {
2461 c.ExtLock.RLock()
2462 defer c.ExtLock.RUnlock()
2463 if _, ok := c.Extensions["XFIXES"]; !ok {
2464 panic("Cannot issue request 'SetRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2465 }
2466 cookie := c.NewCookie(true, false)
2467 c.NewRequest(setRegionRequest(c, Region, Rectangles), cookie)
2468 return SetRegionCookie{cookie}
2469 }
2470
2471
2472
2473 func (cook SetRegionCookie) Check() error {
2474 return cook.Cookie.Check()
2475 }
2476
2477
2478
2479 func setRegionRequest(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) []byte {
2480 size := xgb.Pad((8 + xgb.Pad((len(Rectangles) * 8))))
2481 b := 0
2482 buf := make([]byte, size)
2483
2484 c.ExtLock.RLock()
2485 buf[b] = c.Extensions["XFIXES"]
2486 c.ExtLock.RUnlock()
2487 b += 1
2488
2489 buf[b] = 11
2490 b += 1
2491
2492 xgb.Put16(buf[b:], uint16(size/4))
2493 b += 2
2494
2495 xgb.Put32(buf[b:], uint32(Region))
2496 b += 4
2497
2498 b += xproto.RectangleListBytes(buf[b:], Rectangles)
2499
2500 return buf
2501 }
2502
2503
2504 type SetWindowShapeRegionCookie struct {
2505 *xgb.Cookie
2506 }
2507
2508
2509
2510 func SetWindowShapeRegion(c *xgb.Conn, Dest xproto.Window, DestKind shape.Kind, XOffset int16, YOffset int16, Region Region) SetWindowShapeRegionCookie {
2511 c.ExtLock.RLock()
2512 defer c.ExtLock.RUnlock()
2513 if _, ok := c.Extensions["XFIXES"]; !ok {
2514 panic("Cannot issue request 'SetWindowShapeRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2515 }
2516 cookie := c.NewCookie(false, false)
2517 c.NewRequest(setWindowShapeRegionRequest(c, Dest, DestKind, XOffset, YOffset, Region), cookie)
2518 return SetWindowShapeRegionCookie{cookie}
2519 }
2520
2521
2522
2523 func SetWindowShapeRegionChecked(c *xgb.Conn, Dest xproto.Window, DestKind shape.Kind, XOffset int16, YOffset int16, Region Region) SetWindowShapeRegionCookie {
2524 c.ExtLock.RLock()
2525 defer c.ExtLock.RUnlock()
2526 if _, ok := c.Extensions["XFIXES"]; !ok {
2527 panic("Cannot issue request 'SetWindowShapeRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2528 }
2529 cookie := c.NewCookie(true, false)
2530 c.NewRequest(setWindowShapeRegionRequest(c, Dest, DestKind, XOffset, YOffset, Region), cookie)
2531 return SetWindowShapeRegionCookie{cookie}
2532 }
2533
2534
2535
2536 func (cook SetWindowShapeRegionCookie) Check() error {
2537 return cook.Cookie.Check()
2538 }
2539
2540
2541
2542 func setWindowShapeRegionRequest(c *xgb.Conn, Dest xproto.Window, DestKind shape.Kind, XOffset int16, YOffset int16, Region Region) []byte {
2543 size := 20
2544 b := 0
2545 buf := make([]byte, size)
2546
2547 c.ExtLock.RLock()
2548 buf[b] = c.Extensions["XFIXES"]
2549 c.ExtLock.RUnlock()
2550 b += 1
2551
2552 buf[b] = 21
2553 b += 1
2554
2555 xgb.Put16(buf[b:], uint16(size/4))
2556 b += 2
2557
2558 xgb.Put32(buf[b:], uint32(Dest))
2559 b += 4
2560
2561 buf[b] = byte(DestKind)
2562 b += 1
2563
2564 b += 3
2565
2566 xgb.Put16(buf[b:], uint16(XOffset))
2567 b += 2
2568
2569 xgb.Put16(buf[b:], uint16(YOffset))
2570 b += 2
2571
2572 xgb.Put32(buf[b:], uint32(Region))
2573 b += 4
2574
2575 return buf
2576 }
2577
2578
2579 type ShowCursorCookie struct {
2580 *xgb.Cookie
2581 }
2582
2583
2584
2585 func ShowCursor(c *xgb.Conn, Window xproto.Window) ShowCursorCookie {
2586 c.ExtLock.RLock()
2587 defer c.ExtLock.RUnlock()
2588 if _, ok := c.Extensions["XFIXES"]; !ok {
2589 panic("Cannot issue request 'ShowCursor' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2590 }
2591 cookie := c.NewCookie(false, false)
2592 c.NewRequest(showCursorRequest(c, Window), cookie)
2593 return ShowCursorCookie{cookie}
2594 }
2595
2596
2597
2598 func ShowCursorChecked(c *xgb.Conn, Window xproto.Window) ShowCursorCookie {
2599 c.ExtLock.RLock()
2600 defer c.ExtLock.RUnlock()
2601 if _, ok := c.Extensions["XFIXES"]; !ok {
2602 panic("Cannot issue request 'ShowCursor' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2603 }
2604 cookie := c.NewCookie(true, false)
2605 c.NewRequest(showCursorRequest(c, Window), cookie)
2606 return ShowCursorCookie{cookie}
2607 }
2608
2609
2610
2611 func (cook ShowCursorCookie) Check() error {
2612 return cook.Cookie.Check()
2613 }
2614
2615
2616
2617 func showCursorRequest(c *xgb.Conn, Window xproto.Window) []byte {
2618 size := 8
2619 b := 0
2620 buf := make([]byte, size)
2621
2622 c.ExtLock.RLock()
2623 buf[b] = c.Extensions["XFIXES"]
2624 c.ExtLock.RUnlock()
2625 b += 1
2626
2627 buf[b] = 30
2628 b += 1
2629
2630 xgb.Put16(buf[b:], uint16(size/4))
2631 b += 2
2632
2633 xgb.Put32(buf[b:], uint32(Window))
2634 b += 4
2635
2636 return buf
2637 }
2638
2639
2640 type SubtractRegionCookie struct {
2641 *xgb.Cookie
2642 }
2643
2644
2645
2646 func SubtractRegion(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) SubtractRegionCookie {
2647 c.ExtLock.RLock()
2648 defer c.ExtLock.RUnlock()
2649 if _, ok := c.Extensions["XFIXES"]; !ok {
2650 panic("Cannot issue request 'SubtractRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2651 }
2652 cookie := c.NewCookie(false, false)
2653 c.NewRequest(subtractRegionRequest(c, Source1, Source2, Destination), cookie)
2654 return SubtractRegionCookie{cookie}
2655 }
2656
2657
2658
2659 func SubtractRegionChecked(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) SubtractRegionCookie {
2660 c.ExtLock.RLock()
2661 defer c.ExtLock.RUnlock()
2662 if _, ok := c.Extensions["XFIXES"]; !ok {
2663 panic("Cannot issue request 'SubtractRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2664 }
2665 cookie := c.NewCookie(true, false)
2666 c.NewRequest(subtractRegionRequest(c, Source1, Source2, Destination), cookie)
2667 return SubtractRegionCookie{cookie}
2668 }
2669
2670
2671
2672 func (cook SubtractRegionCookie) Check() error {
2673 return cook.Cookie.Check()
2674 }
2675
2676
2677
2678 func subtractRegionRequest(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) []byte {
2679 size := 16
2680 b := 0
2681 buf := make([]byte, size)
2682
2683 c.ExtLock.RLock()
2684 buf[b] = c.Extensions["XFIXES"]
2685 c.ExtLock.RUnlock()
2686 b += 1
2687
2688 buf[b] = 15
2689 b += 1
2690
2691 xgb.Put16(buf[b:], uint16(size/4))
2692 b += 2
2693
2694 xgb.Put32(buf[b:], uint32(Source1))
2695 b += 4
2696
2697 xgb.Put32(buf[b:], uint32(Source2))
2698 b += 4
2699
2700 xgb.Put32(buf[b:], uint32(Destination))
2701 b += 4
2702
2703 return buf
2704 }
2705
2706
2707 type TranslateRegionCookie struct {
2708 *xgb.Cookie
2709 }
2710
2711
2712
2713 func TranslateRegion(c *xgb.Conn, Region Region, Dx int16, Dy int16) TranslateRegionCookie {
2714 c.ExtLock.RLock()
2715 defer c.ExtLock.RUnlock()
2716 if _, ok := c.Extensions["XFIXES"]; !ok {
2717 panic("Cannot issue request 'TranslateRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2718 }
2719 cookie := c.NewCookie(false, false)
2720 c.NewRequest(translateRegionRequest(c, Region, Dx, Dy), cookie)
2721 return TranslateRegionCookie{cookie}
2722 }
2723
2724
2725
2726 func TranslateRegionChecked(c *xgb.Conn, Region Region, Dx int16, Dy int16) TranslateRegionCookie {
2727 c.ExtLock.RLock()
2728 defer c.ExtLock.RUnlock()
2729 if _, ok := c.Extensions["XFIXES"]; !ok {
2730 panic("Cannot issue request 'TranslateRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2731 }
2732 cookie := c.NewCookie(true, false)
2733 c.NewRequest(translateRegionRequest(c, Region, Dx, Dy), cookie)
2734 return TranslateRegionCookie{cookie}
2735 }
2736
2737
2738
2739 func (cook TranslateRegionCookie) Check() error {
2740 return cook.Cookie.Check()
2741 }
2742
2743
2744
2745 func translateRegionRequest(c *xgb.Conn, Region Region, Dx int16, Dy int16) []byte {
2746 size := 12
2747 b := 0
2748 buf := make([]byte, size)
2749
2750 c.ExtLock.RLock()
2751 buf[b] = c.Extensions["XFIXES"]
2752 c.ExtLock.RUnlock()
2753 b += 1
2754
2755 buf[b] = 17
2756 b += 1
2757
2758 xgb.Put16(buf[b:], uint16(size/4))
2759 b += 2
2760
2761 xgb.Put32(buf[b:], uint32(Region))
2762 b += 4
2763
2764 xgb.Put16(buf[b:], uint16(Dx))
2765 b += 2
2766
2767 xgb.Put16(buf[b:], uint16(Dy))
2768 b += 2
2769
2770 return buf
2771 }
2772
2773
2774 type UnionRegionCookie struct {
2775 *xgb.Cookie
2776 }
2777
2778
2779
2780 func UnionRegion(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) UnionRegionCookie {
2781 c.ExtLock.RLock()
2782 defer c.ExtLock.RUnlock()
2783 if _, ok := c.Extensions["XFIXES"]; !ok {
2784 panic("Cannot issue request 'UnionRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2785 }
2786 cookie := c.NewCookie(false, false)
2787 c.NewRequest(unionRegionRequest(c, Source1, Source2, Destination), cookie)
2788 return UnionRegionCookie{cookie}
2789 }
2790
2791
2792
2793 func UnionRegionChecked(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) UnionRegionCookie {
2794 c.ExtLock.RLock()
2795 defer c.ExtLock.RUnlock()
2796 if _, ok := c.Extensions["XFIXES"]; !ok {
2797 panic("Cannot issue request 'UnionRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.")
2798 }
2799 cookie := c.NewCookie(true, false)
2800 c.NewRequest(unionRegionRequest(c, Source1, Source2, Destination), cookie)
2801 return UnionRegionCookie{cookie}
2802 }
2803
2804
2805
2806 func (cook UnionRegionCookie) Check() error {
2807 return cook.Cookie.Check()
2808 }
2809
2810
2811
2812 func unionRegionRequest(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) []byte {
2813 size := 16
2814 b := 0
2815 buf := make([]byte, size)
2816
2817 c.ExtLock.RLock()
2818 buf[b] = c.Extensions["XFIXES"]
2819 c.ExtLock.RUnlock()
2820 b += 1
2821
2822 buf[b] = 13
2823 b += 1
2824
2825 xgb.Put16(buf[b:], uint16(size/4))
2826 b += 2
2827
2828 xgb.Put32(buf[b:], uint32(Source1))
2829 b += 4
2830
2831 xgb.Put32(buf[b:], uint32(Source2))
2832 b += 4
2833
2834 xgb.Put32(buf[b:], uint32(Destination))
2835 b += 4
2836
2837 return buf
2838 }
2839
View as plain text