Esempio n. 1
0
    def eventFilter(self, obj, e):
        e_ex = [QEvent.WindowDeactivate, QEvent.Leave]
        if e.type() in e_ex:
            # NOTE: rgn object must be derived only once at initialization.
            rgn = self.frameGeometry() if self.mask().isEmpty() else self.mask()
            if not rgn.contains(QtGui.QCursor.pos()):
                action.sysClose()

        ## Move window in specified position again, to deal with i3wm workspace.
        if e.type() == QEvent.Show:
            self._bFirstMove = True
        if self._bFirstMove and e.type() == QEvent.Move:
            self.centerOnCursor()
            self._bFirstMove = False
            # print(e.type(), self.geometry())

        # if self.layout().indexOf(obj) != -1:
        #     if event.type() == event.MouseButtonPress:
        #         print("Widget click", obj)

        # return super().eventFilter(obj, e)  # default
        return False
Esempio n. 2
0
 def mouseReleaseEvent(self, e):
     if e.button() == Qt.LeftButton and not e.modifiers() == Qt.ControlModifier:
         action.sysClose()
     self._bM3 = False  # must drop flag on any mouse button