def getOutputs(self): outputs = [] self.queryCurrent() for rroutput in self.resources.outputs: cookie = conn.randr.GetOutputInfo(rroutput, self.resources.config_timestamp) info = cookie.reply() name = "".join(map(chr, info.name)) output = Output(name) output.randrInfo = info try: cookie = conn.randr.GetCrtcInfo( info.crtc, self.resources.config_timestamp) output.crtcInfo = cookie.reply() except xcb.randr.BadCrtc: output.crtcInfo = None if info.connection == xcb.randr.Connection.Connected: output.connection = Output.Connected elif info.connection == xcb.randr.Connection.Disconnected: output.connection = Output.Disconnected else: output.connection = Output.Unknown outputs.append(output) return outputs
def getOutputs(self): outputs = [] self.queryCurrent() for rroutput in self.resources.outputs: cookie = conn.randr.GetOutputInfo(rroutput, self.resources.config_timestamp) info = cookie.reply() name = "".join(map(chr, info.name)) output = Output(name) output.randrInfo = info try: cookie = conn.randr.GetCrtcInfo(info.crtc, self.resources.config_timestamp) output.crtcInfo = cookie.reply() except xcb.randr.BadCrtc: output.crtcInfo = None if info.connection == xcb.randr.Connection.Connected: output.connection = Output.Connected elif info.connection == xcb.randr.Connection.Disconnected: output.connection = Output.Disconnected else: output.connection = Output.Unknown outputs.append(output) return outputs
def query(self): # dpy, screen, display_mask, attribute cookie = conn.nv.QueryAttribute(0, 0, 0, xcb.nvctrl.Attributes.PROBE_DISPLAYS) reply = cookie.reply() display_mask = reply.value mask = 1 self.__outputs = [] n = 0 while mask < (1 << 24): if display_mask & mask: if mask & 0xff: dtype = "CRT" elif mask & 0xff00: dtype = "TV" else: dtype = "DFP" name = "%s-%d" % (dtype, n) output = Output(name) self.__outputs.append(output) output.connection = Output.Connected mask <<= 1 n = (n + 1) % 8