|
@@ -5,7 +5,7 @@ from threading import Thread
|
|
|
from math import pi, tan
|
|
from math import pi, tan
|
|
|
|
|
|
|
|
import src as mt
|
|
import src as mt
|
|
|
-from utils import BoundingBoxArea, Flick, FlickThread
|
|
|
|
|
|
|
+from utils import BoundingBoxArea, Flick, FlickThread, GtkEventWindow
|
|
|
|
|
|
|
|
|
|
|
|
|
RED = 1, 0, 0
|
|
RED = 1, 0, 0
|
|
@@ -120,11 +120,9 @@ def create_context_window(w, h, callback):
|
|
|
cr = area.window.cairo_create()
|
|
cr = area.window.cairo_create()
|
|
|
draw()
|
|
draw()
|
|
|
|
|
|
|
|
- def move_window(win, event):
|
|
|
|
|
- """Synchronize root multi-touch area with GTK window."""
|
|
|
|
|
- root.set_position(*event.get_coords())
|
|
|
|
|
- root.set_size(event.width, event.height)
|
|
|
|
|
- overlay.set_size(event.width, event.height)
|
|
|
|
|
|
|
+ def update_window():
|
|
|
|
|
+ """Synchronize overlay with GTK window."""
|
|
|
|
|
+ overlay.set_size(*window.get_size())
|
|
|
refresh()
|
|
refresh()
|
|
|
|
|
|
|
|
def handle_key(win, event):
|
|
def handle_key(win, event):
|
|
@@ -151,18 +149,18 @@ def create_context_window(w, h, callback):
|
|
|
quit()
|
|
quit()
|
|
|
|
|
|
|
|
# Root area (will be synchronized with GTK window)
|
|
# Root area (will be synchronized with GTK window)
|
|
|
- global root, overlay
|
|
|
|
|
- root = mt.RectangularArea(0, 0, w, h)
|
|
|
|
|
|
|
+ global overlay
|
|
|
overlay = mt.RectangularArea(0, 0, w, h)
|
|
overlay = mt.RectangularArea(0, 0, w, h)
|
|
|
|
|
|
|
|
# GTK window
|
|
# GTK window
|
|
|
- global window
|
|
|
|
|
- window = gtk.Window()
|
|
|
|
|
|
|
+ global window, root
|
|
|
|
|
+ window = GtkEventWindow()
|
|
|
window.set_title('Cairo test')
|
|
window.set_title('Cairo test')
|
|
|
window.connect('destroy', quit)
|
|
window.connect('destroy', quit)
|
|
|
window.connect('key-press-event', handle_key)
|
|
window.connect('key-press-event', handle_key)
|
|
|
- window.connect('configure-event', move_window)
|
|
|
|
|
window.connect('show', callback)
|
|
window.connect('show', callback)
|
|
|
|
|
+ window.on_update(update_window)
|
|
|
|
|
+ root = window.get_area()
|
|
|
|
|
|
|
|
if fullscreen:
|
|
if fullscreen:
|
|
|
window.fullscreen()
|
|
window.fullscreen()
|