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()
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()