github.com/rajveermalviya/gamen@v0.1.2-0.20220930195403-9be15877c1aa/internal/xcb/output.go (about)

     1  //go:build linux && !android
     2  
     3  package xcb
     4  
     5  /*
     6  
     7  #include <xcb/xcb.h>
     8  #include <xcb/randr.h>
     9  
    10  */
    11  import "C"
    12  
    13  type Output struct {
    14  	xcbScreen *C.xcb_screen_t
    15  	number    int
    16  }
    17  
    18  func (d *Display) initializeOutputs(setup *C.struct_xcb_setup_t) {
    19  	for it := d.l.xcb_setup_roots_iterator(setup); it.rem > 0; d.l.xcb_screen_next(&it) {
    20  		d.screens = append(d.screens, &Output{
    21  			xcbScreen: it.data,
    22  			number:    len(d.screens),
    23  		})
    24  
    25  		d.l.xcb_randr_select_input(d.xcbConn,
    26  			it.data.root,
    27  			C.XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE|
    28  				C.XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE|
    29  				C.XCB_RANDR_NOTIFY_MASK_CRTC_CHANGE|
    30  				C.XCB_RANDR_NOTIFY_MASK_OUTPUT_PROPERTY,
    31  		)
    32  	}
    33  }