Example #1
0
    def __init__(self):

        self._visible = False
        self._force_to_top = False
        self._last_pos = None

        Gtk.Window.__init__(self,
                            skip_taskbar_hint=True,
                            skip_pager_hint=True,
                            urgency_hint=False,
                            decorated=False,
                            accept_focus=False,
                            opacity=0.75,
                            width_request=self.MINIMUM_SIZE,
                            height_request=self.MINIMUM_SIZE)

        WindowRectTracker.__init__(self)
        WindowManipulator.__init__(self)

        self.set_keep_above(True)
        self.set_has_resize_grip(False)

        # use transparency if available
        visual = Gdk.Screen.get_default().get_rgba_visual()
        if visual:
            self.set_visual(visual)

        # set up event handling
        self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK |
                        Gdk.EventMask.BUTTON_RELEASE_MASK |
                        Gdk.EventMask.POINTER_MOTION_MASK)

        self.connect("button-press-event",   self._on_button_press_event)
        self.connect("motion-notify-event",  self._on_motion_notify_event)
        self.connect("button-release-event", self._on_button_release_event)
        self.connect("draw",                 self._on_draw)
        self.connect("configure-event",      self._on_configure_event)

        # default coordinates of the iconpalette on the screen
        self.restore_window_rect()

        # create Gdk resources before moving or resizing the window
        self.update_window_options()
        self.hide()

        once = CallOnce(100).enqueue  # call at most once per 100ms
        rect_changed = lambda x: once(self._on_config_rect_changed)
        config.icp.position_notify_add(rect_changed)
        config.icp.size_notify_add(rect_changed)

        config.icp.resize_handles_notify_add(lambda x: self.update_resize_handles())

        self.update_sticky_state()
        self.update_resize_handles()
Example #2
0
    def __init__(self, keyboard):
        self._visible = False
        self._force_to_top = False
        self._last_pos = None

        self._dwell_progress = DwellProgress()
        self._dwell_begin_timer = None
        self._dwell_timer = None
        self._no_more_dwelling = False

        self._menu = ContextMenu(keyboard)

        args = {
            "type_hint" : self._get_window_type_hint(),
            "skip_taskbar_hint" : True,
            "skip_pager_hint" : True,
            "urgency_hint" : False,
            "decorated" : False,
            "accept_focus" : False,
            "width_request" : self.MINIMUM_SIZE,
            "height_request" : self.MINIMUM_SIZE,
            "app_paintable" : True,
        }
        if gtk_has_resize_grip_support():
            args["has_resize_grip"] = False

        Gtk.Window.__init__(self, **args)

        WindowRectPersist.__init__(self)
        WindowManipulator.__init__(self)

        self.set_keep_above(True)

        self.drawing_area = Gtk.DrawingArea()
        self.add(self.drawing_area)
        self.drawing_area.connect("draw", self._on_draw)
        self.drawing_area.show()

        # use transparency if available
        visual = Gdk.Screen.get_default().get_rgba_visual()
        if visual:
            self.set_visual(visual)
            self.drawing_area.set_visual(visual)

        # set up event handling
        self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK |
                        Gdk.EventMask.BUTTON_RELEASE_MASK |
                        Gdk.EventMask.POINTER_MOTION_MASK)

        # self.connect("draw", self._on_draw)
        self.connect("button-press-event", self._on_button_press_event)
        self.connect("motion-notify-event", self._on_motion_notify_event)
        self.connect("button-release-event", self._on_button_release_event)
        self.connect("configure-event", self._on_configure_event)
        self.connect("realize", self._on_realize_event)
        self.connect("unrealize", self._on_unrealize_event)
        self.connect("enter-notify-event", self._on_mouse_enter)
        self.connect("leave-notify-event", self._on_mouse_leave)

        # default coordinates of the iconpalette on the screen
        self.set_min_window_size(self.MINIMUM_SIZE, self.MINIMUM_SIZE)
        # no flashing on left screen edge in unity
        # self.set_default_size(1, 1)
        self.restore_window_rect()

        # Realize the window. Test changes to this in all supported
        # environments. It's all too easy to have the icp not show up reliably.
        self.update_window_options()
        self.hide()

        once = CallOnce(100).enqueue  # call at most once per 100ms
        config.icp.position_notify_add(
            lambda x: once(self._on_config_rect_changed))
        config.icp.size_notify_add(
            lambda x: once(self._on_config_rect_changed))
        config.icp.window_handles_notify_add(
            lambda x: self.update_window_handles())

        self.update_sticky_state()
        self.update_window_handles()
Example #3
0
    def __init__(self, keyboard):
        self._visible = False
        self._force_to_top = False
        self._last_pos = None

        self._dwell_progress = DwellProgress()
        self._dwell_begin_timer = None
        self._dwell_timer = None
        self._no_more_dwelling = False

        self._menu = ContextMenu(keyboard)

        args = {
            "type_hint": self._get_window_type_hint(),
            "skip_taskbar_hint": True,
            "skip_pager_hint": True,
            "urgency_hint": False,
            "decorated": False,
            "accept_focus": False,
            "width_request": self.MINIMUM_SIZE,
            "height_request": self.MINIMUM_SIZE,
            "app_paintable": True,
        }
        if gtk_has_resize_grip_support():
            args["has_resize_grip"] = False

        Gtk.Window.__init__(self, **args)

        WindowRectPersist.__init__(self)
        WindowManipulator.__init__(self)

        self.set_keep_above(True)

        self.drawing_area = Gtk.DrawingArea()
        self.add(self.drawing_area)
        self.drawing_area.connect("draw", self._on_draw)
        self.drawing_area.show()

        # use transparency if available
        visual = Gdk.Screen.get_default().get_rgba_visual()
        if visual:
            self.set_visual(visual)
            self.drawing_area.set_visual(visual)

        # set up event handling
        self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK
                        | Gdk.EventMask.BUTTON_RELEASE_MASK
                        | Gdk.EventMask.POINTER_MOTION_MASK)

        # self.connect("draw", self._on_draw)
        self.connect("button-press-event", self._on_button_press_event)
        self.connect("motion-notify-event", self._on_motion_notify_event)
        self.connect("button-release-event", self._on_button_release_event)
        self.connect("configure-event", self._on_configure_event)
        self.connect("realize", self._on_realize_event)
        self.connect("unrealize", self._on_unrealize_event)
        self.connect("enter-notify-event", self._on_mouse_enter)
        self.connect("leave-notify-event", self._on_mouse_leave)

        # default coordinates of the iconpalette on the screen
        self.set_min_window_size(self.MINIMUM_SIZE, self.MINIMUM_SIZE)
        # no flashing on left screen edge in unity
        # self.set_default_size(1, 1)
        self.restore_window_rect()

        # Realize the window. Test changes to this in all supported
        # environments. It's all too easy to have the icp not show up reliably.
        self.update_window_options()
        self.hide()

        once = CallOnce(100).enqueue  # call at most once per 100ms
        config.icp.position_notify_add(
            lambda x: once(self._on_config_rect_changed))
        config.icp.size_notify_add(
            lambda x: once(self._on_config_rect_changed))
        config.icp.window_handles_notify_add(
            lambda x: self.update_window_handles())

        self.update_sticky_state()
        self.update_window_handles()
Example #4
0
    def __init__(self):

        self._visible = False
        self._force_to_top = False
        self._last_pos = None

        self._dwell_progress = DwellProgress()
        self._dwell_begin_timer = None
        self._dwell_timer = None
        self._no_more_dwelling = False

        Gtk.Window.__init__(
            self,
            type_hint=self._get_window_type_hint(),
            skip_taskbar_hint=True,
            skip_pager_hint=True,
            has_resize_grip=False,
            urgency_hint=False,
            decorated=False,
            accept_focus=False,
            opacity=0.75,
            width_request=self.MINIMUM_SIZE,
            height_request=self.MINIMUM_SIZE,
        )

        WindowRectTracker.__init__(self)
        WindowManipulator.__init__(self)

        self.set_keep_above(True)

        # use transparency if available
        visual = Gdk.Screen.get_default().get_rgba_visual()
        if visual:
            self.set_visual(visual)

        # set up event handling
        self.add_events(
            Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.POINTER_MOTION_MASK
        )

        self.connect("button-press-event", self._on_button_press_event)
        self.connect("motion-notify-event", self._on_motion_notify_event)
        self.connect("button-release-event", self._on_button_release_event)
        self.connect("draw", self._on_draw)
        self.connect("configure-event", self._on_configure_event)
        self.connect("realize", self._on_realize_event)
        self.connect("unrealize", self._on_unrealize_event)
        self.connect("enter-notify-event", self._on_mouse_enter)
        self.connect("leave-notify-event", self._on_mouse_leave)

        # default coordinates of the iconpalette on the screen
        self.set_min_window_size(self.MINIMUM_SIZE, self.MINIMUM_SIZE)
        # self.set_default_size(1, 1)  # no flashing on left screen edge in unity
        self.restore_window_rect()

        # Realize the window. Test changes to this in all supported
        # environments. It's all too easy to have the icp not show up reliably.
        self.update_window_options()
        self.hide()

        once = CallOnce(100).enqueue  # call at most once per 100ms
        rect_changed = lambda x: once(self._on_config_rect_changed)
        config.icp.position_notify_add(rect_changed)
        config.icp.size_notify_add(rect_changed)

        config.icp.resize_handles_notify_add(lambda x: self.update_resize_handles())

        self.update_sticky_state()
        self.update_resize_handles()
Example #5
0
    def __init__(self):
        Gtk.DrawingArea.__init__(self)
        WindowManipulator.__init__(self)

        self.active_key = None

        self._active_event_type = None
        self._last_click_time = 0
        self._last_click_key = None

        self._outside_click_timer = Timer()
        self._outside_click_detected = False
        self._outside_click_start_time = None

        self._long_press_timer = Timer()
        self._auto_release_timer = AutoReleaseTimer(self)

        self.dwell_timer = None
        self.dwell_key = None
        self.last_dwelled_key = None

        self._window_fade = FadeTimer()
        self._last_transition = None
        self.inactivity_timer = InactivityTimer(self)
        self.auto_show = AtspiAutoShow(self)
        self.auto_show.enable(config.is_auto_show_enabled())

        self.touch_handles = TouchHandles()
        self.touch_handles_hide_timer = Timer()
        self.touch_handles_fade = FadeTimer()
        self.touch_handles_auto_hide = True

        self._aspect_ratio = None
        self._first_draw = True

        # self.set_double_buffered(False)
        self.set_app_paintable(True)

        # no tooltips when embedding, gnome-screen-saver flickers (Oneiric)
        if not config.xid_mode:
            self.set_has_tooltip(True) # works only at window creation -> always on

        self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK
                        | Gdk.EventMask.BUTTON_RELEASE_MASK
                        | Gdk.EventMask.POINTER_MOTION_MASK
                        | Gdk.EventMask.LEAVE_NOTIFY_MASK
                        | Gdk.EventMask.ENTER_NOTIFY_MASK
                        )

        self.connect("parent-set",           self._on_parent_set)
        self.connect("draw",                 self._on_draw)
        self.connect("button-press-event",   self._on_mouse_button_press)
        self.connect("button_release_event", self._on_mouse_button_release)
        self.connect("motion-notify-event",  self._on_motion)
        self.connect("query-tooltip",        self._on_query_tooltip)
        self.connect("enter-notify-event",   self._on_mouse_enter)
        self.connect("leave-notify-event",   self._on_mouse_leave)
        self.connect("configure-event",      self._on_configure_event)

        self.update_resize_handles()

        self.show()
Example #6
0
 def hit_test_move_resize(self, point):
     hit = self.touch_handles.hit_test(point)
     if hit is None:
         hit = WindowManipulator.hit_test_move_resize(self, point)
     return hit
Example #7
0
    def __init__(self):

        self._visible = False
        self._force_to_top = False
        self._last_pos = None

        self._dwell_progress = DwellProgress()
        self._dwell_begin_timer = None
        self._dwell_timer = None
        self._no_more_dwelling = False

        Gtk.Window.__init__(self,
                            type_hint=self._get_window_type_hint(),
                            skip_taskbar_hint=True,
                            skip_pager_hint=True,
                            has_resize_grip=False,
                            urgency_hint=False,
                            decorated=False,
                            accept_focus=False,
                            opacity=0.75,
                            width_request=self.MINIMUM_SIZE,
                            height_request=self.MINIMUM_SIZE)

        WindowRectTracker.__init__(self)
        WindowManipulator.__init__(self)

        self.set_keep_above(True)

        # use transparency if available
        visual = Gdk.Screen.get_default().get_rgba_visual()
        if visual:
            self.set_visual(visual)

        # set up event handling
        self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK
                        | Gdk.EventMask.BUTTON_RELEASE_MASK
                        | Gdk.EventMask.POINTER_MOTION_MASK)

        self.connect("button-press-event", self._on_button_press_event)
        self.connect("motion-notify-event", self._on_motion_notify_event)
        self.connect("button-release-event", self._on_button_release_event)
        self.connect("draw", self._on_draw)
        self.connect("configure-event", self._on_configure_event)
        self.connect("realize", self._on_realize_event)
        self.connect("unrealize", self._on_unrealize_event)
        self.connect("enter-notify-event", self._on_mouse_enter)
        self.connect("leave-notify-event", self._on_mouse_leave)

        # default coordinates of the iconpalette on the screen
        self.set_min_window_size(self.MINIMUM_SIZE, self.MINIMUM_SIZE)
        #self.set_default_size(1, 1)  # no flashing on left screen edge in unity
        self.restore_window_rect()

        # Realize the window. Test changes to this in all supported
        # environments. It's all too easy to have the icp not show up reliably.
        self.update_window_options()
        self.hide()

        once = CallOnce(100).enqueue  # call at most once per 100ms
        rect_changed = lambda x: once(self._on_config_rect_changed)
        config.icp.position_notify_add(rect_changed)
        config.icp.size_notify_add(rect_changed)

        config.icp.resize_handles_notify_add(
            lambda x: self.update_resize_handles())

        self.update_sticky_state()
        self.update_resize_handles()