Ejemplo n.º 1
0
 def get_gtk_window_frame_extents(self, winId):
     '''@process frame for gtk window.'''
     window_frame_extents = get_property(winId, "_GTK_FRAME_EXTENTS")
     window_frame_rect = get_property_value(window_frame_extents.reply())
     if window_frame_rect:
         return [window_frame_rect[0], window_frame_rect[1],
         window_frame_rect[2], window_frame_rect[3]]
     else:
         return [0, 0, 0, 0]
Ejemplo n.º 2
0
 def get_deepin_window_shadow_width(self, winId):
     '''@process shadow value for deepin-ui window.'''
     window_shadow = get_property(winId, "DEEPIN_WINDOW_SHADOW")
     deepin_window_shadow_value = get_property_value(window_shadow.reply())
     if deepin_window_shadow_value:
         deepin_window_shadow_width = int(deepin_window_shadow_value)
     else:
         deepin_window_shadow_width = 0
     return deepin_window_shadow_width
Ejemplo n.º 3
0
 def get_deepin_window_shadow_width(self, winId):
     '''@process shadow value for deepin-ui window.'''
     window_shadow = get_property(winId, "DEEPIN_WINDOW_SHADOW")
     deepin_window_shadow_value = get_property_value(window_shadow.reply())
     if deepin_window_shadow_value:
         deepin_window_shadow_width = int(deepin_window_shadow_value)
     else:
         deepin_window_shadow_width = 0
     return deepin_window_shadow_width
Ejemplo n.º 4
0
 def get_gtk_window_frame_extents(self, winId):
     '''@process frame for gtk window.'''
     window_frame_extents = get_property(winId, "_GTK_FRAME_EXTENTS")
     window_frame_rect = get_property_value(window_frame_extents.reply())
     if window_frame_rect:
         return [
             window_frame_rect[0], window_frame_rect[1],
             window_frame_rect[2], window_frame_rect[3]
         ]
     else:
         return [0, 0, 0, 0]
Ejemplo n.º 5
0
    def get_windows_info(self):
        '''
        @return: all windows' coordinate in this workspace
        @rtype: a list, each in the list is a tuple which containing x and y and width and height
        '''
        screenshot_window_info = []
        self.wnck_screen.force_update()
        win_list = self.wnck_screen.get_windows_stacked()
        self.wnck_workspace = self.wnck_screen.get_active_workspace()
        if not self.wnck_workspace:      # there is no active workspace in some wm.
            self.wnck_workspace = self.wnck_screen.get_workspaces()[0]
        for w in win_list:
            if not w.is_on_workspace(self.wnck_workspace):
                continue
            try:    # some environment has not WINDOW_STATE_MINIMIZED property
                if w.get_state() & wnck.WINDOW_STATE_MINIMIZED or\
                        w.get_state() & wnck.WINDOW_STATE_HIDDEN or\
                        w.get_window_type() == wnck.WINDOW_DESKTOP:
                    continue
            except:
                pass
            (x, y, width, height) = w.get_geometry()                # with frame

            # Get shadow value for deepin-ui window.
            cookie = get_property(w.get_xid(), "DEEPIN_WINDOW_SHADOW")
            deepin_window_shadow_value = get_property_value(cookie.reply())
            if deepin_window_shadow_value:
                deepin_window_shadow_size = int(deepin_window_shadow_value)
            else:
                deepin_window_shadow_size = 0

            if w.get_window_type() == wnck.WINDOW_DOCK and\
                    width >= self.screen_width and height >= self.screen_height:
                continue

            (wx, wy, ww, wh) = self.convert_coord(
                x + deepin_window_shadow_size,
                y + deepin_window_shadow_size,
                width - deepin_window_shadow_size * 2,
                height - deepin_window_shadow_size * 2)

            if ww != 0 and wh != 0:
              screenshot_window_info.insert(0, (wx, wy, ww, wh))
        return screenshot_window_info
Ejemplo n.º 6
0
    def get_windows_info(self):
        '''
        @return: all windows' coordinate in this workspace
        @rtype: a list, each in the list is a tuple which containing x and y and width and height
        '''
        screenshot_window_info = []
        self.wnck_screen.force_update()
        win_list = self.wnck_screen.get_windows_stacked()
        self.wnck_workspace = self.wnck_screen.get_active_workspace()
        if not self.wnck_workspace:  # there is no active workspace in some wm.
            self.wnck_workspace = self.wnck_screen.get_workspaces()[0]
        for w in win_list:
            if not w.is_on_workspace(self.wnck_workspace):
                continue
            try:  # some environment has not WINDOW_STATE_MINIMIZED property
                if w.get_state() & wnck.WINDOW_STATE_MINIMIZED or\
                        w.get_state() & wnck.WINDOW_STATE_HIDDEN or\
                        w.get_window_type() == wnck.WINDOW_DESKTOP:
                    continue
            except:
                pass
            (x, y, width, height) = w.get_geometry()  # with frame

            # Get shadow value for deepin-ui window.
            cookie = get_property(w.get_xid(), "DEEPIN_WINDOW_SHADOW")
            deepin_window_shadow_value = get_property_value(cookie.reply())
            if deepin_window_shadow_value:
                deepin_window_shadow_size = int(deepin_window_shadow_value)
            else:
                deepin_window_shadow_size = 0

            if w.get_window_type() == wnck.WINDOW_DOCK and\
                    width >= self.screen_width and height >= self.screen_height:
                continue

            (wx, wy, ww,
             wh) = self.convert_coord(x + deepin_window_shadow_size,
                                      y + deepin_window_shadow_size,
                                      width - deepin_window_shadow_size * 2,
                                      height - deepin_window_shadow_size * 2)

            if ww != 0 and wh != 0:
                screenshot_window_info.insert(0, (wx, wy, ww, wh))
        return screenshot_window_info