WIP
This commit is contained in:
@@ -146,14 +146,25 @@ class MainWindow(Handy.ApplicationWindow):
|
|||||||
mobile_handle = player_controls.MobileHandle(self.player_manager)
|
mobile_handle = player_controls.MobileHandle(self.player_manager)
|
||||||
|
|
||||||
# Toggle drawer when handle is pressed
|
# Toggle drawer when handle is pressed
|
||||||
def toggle_drawer(handle, event):
|
mobile_handle_events = Gtk.EventBox()
|
||||||
if event.get_click_count() != (True, 1) or not drawer.get_swipe_to_open() or event.device.get_source() == Gdk.InputSource.TOUCHSCREEN:
|
mobile_handle_events.set_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK)
|
||||||
|
|
||||||
|
click_gesture = Gtk.GestureMultiPress.new(mobile_handle_events)
|
||||||
|
click_gesture.set_propagation_phase(Gtk.PropagationPhase.BUBBLE)
|
||||||
|
def toggle_drawer(gesture, num, x, y):
|
||||||
|
if (num != 1 or not drawer.get_swipe_to_open() or
|
||||||
|
x < 0 or x > mobile_handle_events.get_allocated_width() or
|
||||||
|
y < 0 or y > mobile_handle_events.get_allocated_height()):
|
||||||
return
|
return
|
||||||
|
|
||||||
drawer.set_reveal_flap(not drawer.get_reveal_flap())
|
drawer.set_reveal_flap(not drawer.get_reveal_flap())
|
||||||
mobile_handle.connect("button-press-event", toggle_drawer)
|
click_gesture.connect('released', toggle_drawer)
|
||||||
|
|
||||||
squeezer.add(mobile_handle)
|
# Need to keep the gesture object alive
|
||||||
|
mobile_handle_events._gesture = click_gesture
|
||||||
|
|
||||||
|
mobile_handle_events.add(mobile_handle)
|
||||||
|
squeezer.add(mobile_handle_events)
|
||||||
|
|
||||||
# Only show the handle on desktop
|
# Only show the handle on desktop
|
||||||
def squeezer_changed(squeezer, _):
|
def squeezer_changed(squeezer, _):
|
||||||
|
Reference in New Issue
Block a user