Example #1
0
	def __init__( self, parent ):
		super().__init__()

		self.parent = parent

		QCoreApplication.instance().installNativeEventFilter( self )
		
		# First, we need to convert Qt's SIP-wrapped xcb_connection_t to an xcffib Connection.
		self.connection = xcffib.wrap( sip.unwrapinstance( QX11Info.connection() ) )
		self.connection.ensure_connected()
Example #2
0
 def init(self):
     # Get the X11 connection and update keyboard mappings
     qt_conn = QX11Info.connection()
     ptr = sip.unwrapinstance(qt_conn)
     self.conn = xcffib.wrap(ptr)
     update_keyboard_mapping(self.conn, None)
Example #3
0
 def init(self):
     # Get the X11 connection and update keyboard mappings
     qt_conn = QX11Info.connection()
     ptr = sip.unwrapinstance(qt_conn)
     self.conn = xcffib.wrap(ptr)
     update_keyboard_mapping(self.conn, None)
 def test_wrap(self):
     c = xcffib.connect()
     c.invalid()
     c2 = xcffib.wrap(xcffib.ffi.cast("long", c._conn))
     c2.invalid()
     c2.disconnect()
Example #5
0
    def __init__(self, **kwargs):
        """ Initialize the main Caw class."""

        self.connection_c = cawc.xcb_connect()
        self.screen_c = cawc.xcb_screen(self.connection_c)
        self.visualtype_c = cawc.xcb_visualtype(self.screen_c)

        self.connection = xcb.wrap(self.connection_c)
        self.screen = self.connection.get_setup().roots[0]

        self.border_width = kwargs.get('border_width', 2)
        self.xoffset = kwargs.get('xoffset', 0)
        if 0 < self.xoffset < 1:
            self.xoffset = int(self.screen.width_in_pixels * self.xoffset)
        self.yoffset = kwargs.get('yoffset', 0)
        self.x = self.xoffset
        self.height = kwargs.get('height', 10) + 2*self.border_width
        self.width = kwargs.get('width', self.screen.width_in_pixels)
        if self.width < 0:
            self.width += self.screen.width_in_pixels
        elif self.width < 1:
            self.width = int(self.screen.width_in_pixels * self.width)

        self.edge = kwargs.get('edge', 1)
        if self.edge:
            self.y = self.yoffset + self.screen.height_in_pixels - self.height
        else:
            self.y = self.yoffset

        self.above = kwargs.get('above', True)
        self.fg = kwargs.get('fg', 0x000000)
        self.bg = kwargs.get('bg', 0xd6d6d6)
        self.border = kwargs.get('border', 0x606060)
        self.shading = kwargs.get('shading', 100)

        self.font_face = kwargs.get('font_face', 'Terminus')
        self.font_bold = kwargs.get('font_bold', False)
        self.font_size = kwargs.get('font_size', 8)
        self.font_yoffset = kwargs.get('font_yoffset', 0)
        self.dpi = kwargs.get('dpi', -1)

        self.widgets = kwargs.get('widgets', [])
        self._mtime = os.path.getmtime(sys.argv[0])
        #print self.widgets
        #print '----'
        #print kwargs
        self._timers = []
        self.events = collections.defaultdict(list)
        self.atoms = collections.defaultdict(list)
        self._dirty = False
        self._dirty_widgets = []

        # poll object for polling file descriptors
        self._poll = select.poll()
        self._fdhandlers = {}

        self._init_window()
        self._init_atoms()
        self._init_cairo()
        self._init_pango()

        print "Window:", self.window
        print "X:", self.x
        print "Y:", self.y
        print "Width:", self.width
        print "Height:", self.height
        self._set_properties()
        self._update_struts()
        self._update_background()

        self.connection.core.MapWindow(self.window)
        self.connection.flush()

        self.events[xproto.ExposeEvent].append(self.redraw)
        self.events[xproto.PropertyNotifyEvent].append(self._property_notify)
        self.events[xproto.ButtonPressEvent].append(self._button_press)
        self.atoms[self._XROOTPMAP_ID].append(self._update_background)
Example #6
0
 def test_wrap(self):
     c = xcffib.connect()
     c.invalid()
     c2 = xcffib.wrap(xcffib.ffi.cast("long", c._conn))
     c2.invalid()
     c2.disconnect()