Implement activation modes. Do not hide when sticky because

activated by single frame key press.
This commit is contained in:
Marco Pesenti Gritti 2006-09-22 11:14:33 +02:00
parent 5e55efe9d5
commit 2d8c9a3310

View File

@ -100,10 +100,16 @@ class EventFrame(gobject.GObject):
window.window.raise_()
class Frame:
INACTIVE = 0
TEMPORARY = 1
STICKY = 2
HIDE_ON_LEAVE = 3
AUTOMATIC = 4
def __init__(self, shell):
self._windows = []
self._shell = shell
self._sticky = False
self._mode = Frame.INACTIVE
self._timeline = Timeline(self)
self._timeline.add_tag('slide_in', 6, 12)
@ -160,38 +166,48 @@ class Frame:
self._timeline.goto('slide_in', True)
def _menu_shell_deactivated_cb(self, menu_shell):
self._timeline.play('before_slide_out', 'slide_out')
if self._mode != Frame.STICKY:
self._timeline.play('before_slide_out', 'slide_out')
def _enter_notify_cb(self, window, event):
self._timeline.goto('slide_in', True)
def _leave_notify_cb(self, window, event):
if not self._menu_shell.is_active():
# FIXME for some reason every click cause also a leave-notify
if event.state == gtk.gdk.BUTTON1_MASK:
return
if not self._menu_shell.is_active() and \
self._mode == Frame.HIDE_ON_LEAVE:
self._timeline.play('before_slide_out', 'slide_out')
def _enter_edge_cb(self, event_frame):
self._mode = Frame.HIDE_ON_LEAVE
self._timeline.play(None, 'slide_in')
def _enter_corner_cb(self, event_frame):
self._mode = Frame.HIDE_ON_LEAVE
self._timeline.play('slide_in', 'slide_in')
def _event_frame_leave_cb(self, event_frame):
self._timeline.goto('slide_out', True)
if self._mode != Frame.STICKY:
self._timeline.goto('slide_out', True)
def show_and_hide(self, seconds):
self._mode = Frame.AUTOMATIC
self._timeline.play()
def notify_key_press(self):
if self._timeline.on_tag('slide_in'):
self._timeline.play('before_slide_out', 'slide_out')
elif self._timeline.on_tag('before_slide_out'):
self._sticky = True
self._mode = Frame.TEMPORARY
else:
self._sticky = False
self._mode = Frame.STICKY
self._timeline.play('slide_in', 'slide_in')
def notify_key_release(self):
if self._sticky:
if self._mode == Frame.TEMPORARY:
self._timeline.play('before_slide_out', 'slide_out')
def do_slide_in(self, current, n_frames):