Exemplo n.º 1
0
 def cleanup(self):
     WindowRectTracker.cleanup(self)
     KbdWindowBase.cleanup(self)
     if self.icp:
         self.icp.cleanup()
         self.icp.destroy()
         self.icp = None
Exemplo n.º 2
0
    def on_screen_size_changed(self, screen):
        """ Screen rotation, etc. """
        if config.is_docking_enabled():
            # Can't correctly position the window while struts are active
            # -> turn them off for a moment
            self.clear_struts()
            self._was_visible = self.is_visible()
            keyboard_widget = self.keyboard_widget
            if keyboard_widget:
                keyboard_widget.transition_visible_to(False, 0.0)
                keyboard_widget.commit_transition()

        WindowRectTracker.on_screen_size_changed(self, screen)
Exemplo n.º 3
0
    def __init__(self, keyboard_widget, icp):
        self._last_ignore_configure_time = None
        self._last_configures = []

        Gtk.Window.__init__(self,
                            urgency_hint = False,
                            width_request=self.MINIMUM_SIZE,
                            height_request=self.MINIMUM_SIZE)

        KbdWindowBase.__init__(self, keyboard_widget, icp)

        WindowRectTracker.__init__(self)

        GObject.signal_new("quit-onboard", KbdWindow,
                           GObject.SIGNAL_RUN_LAST,
                           GObject.TYPE_BOOLEAN, ())

        self._auto_position_poll_timer = Timer()

        self.restore_window_rect(startup = True)

        self.connect("map",                     self._on_map_event)
        self.connect("unmap",                   self._on_unmap_event)
        self.connect("delete-event", self._on_delete_event)
        self.connect("configure-event", self._on_configure_event)
        # Connect_after seems broken in Quantal, the callback is never called.
        #self.connect_after("configure-event", self._on_configure_event_after)

        self._osk_util.connect_root_property_notify(["_NET_WORKAREA"],
                                                self._on_root_property_notify)

        once = CallOnce(100).enqueue  # call at most once per 100ms

        if 0: #FIXME
            rect_changed = lambda x: once(self._on_config_rect_changed)
            config.window.position_notify_add(rect_changed)
            config.window.size_notify_add(rect_changed)

            dock_size_changed = lambda x: once(self._on_config_dock_size_changed)
            config.window.dock_size_notify_add(dock_size_changed)
Exemplo n.º 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)
        if 0:  # FIXME
            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()
Exemplo n.º 5
0
 def cleanup(self):
     WindowRectTracker.cleanup(self)