+ (let ((button (gdk-event-button:button event)))
+ (cond
+ ((= button 1)
+ (if (null? (gdk-event-button:modifiers event))
+ (let ((x (gdk-event-button:x event))
+ (y (gdk-event-button:y event)))
+ (stderr "CLICK at: ~S ~S\n" x y)
+ (set! (dragging go) (hashq-ref (item-grobs go) item #f))
+ (set! (drag-origin go) (cons x y))
+ (set! (drag-location go) (cons x y)))
+ (begin
+ (stderr "CLICK WITH MODIFIERS: ~S\n"
+ (gdk-event-button:modifiers event))
+
+ ;; some modifier, do jump to source
+ (and-let* ((grob (hashq-ref (item-grobs go) item #f))
+ (location (get-location grob)))
+ (location-callback location)))))
+ ((= button 2)
+ (and-let* ((grob (hashq-ref (item-grobs go) item #f)))
+
+ (let ((properties (ly:grob-properties grob))
+ (basic-properties (ly:grob-basic-properties grob))
+ (x (inexact->exact (gdk-event-button:x-root event)))
+ (y (inexact->exact (gdk-event-button:y-root event))))
+
+ (debugf "GROB: ~S\n" grob)
+ (debugf "PROPERTIES: ~S\n" properties)
+ (debugf "BASIC PROPERTIES: ~S\n" basic-properties)
+
+ ;; FIXME: dialog iso window?
+ ;; http://www.gtk.org/tutorial/sec-textentries.html
+ (let ((window (make <gtk-window>))
+ (vbox (make <gtk-vbox>))
+ (ok (make <gtk-button> #:label "Ok")))
+
+ (add window vbox)
+ (connect ok 'clicked (lambda (b) (destroy window)))
+
+ (for-each
+ (lambda (x)
+ (let ((label (make <gtk-label>
+ ;;#:label (symbol->string (car x))))
+ #:label (format #f "~S" (car x))))
+ ;;(symbol->string (car x))))
+ (entry (make <gtk-entry>
+ #:text (format #f "~S" (cdr x))))
+ (hbox (make <gtk-hbox>)))
+ (add hbox label)
+ (add hbox entry)
+ (set-size-request label 150 BUTTON-HEIGHT)
+ (add vbox hbox)))
+ (append properties basic-properties))
+ (add vbox ok)
+
+ (show-all window)
+ (move window x y))))))))
+
+ ((2button-press) (gobject-set-property item 'fill-color "green"))
+ ((key-press)
+ (let ((keyval (gdk-event-key:keyval event))
+ (mods (gdk-event-key:modifiers event))
+ (step (quotient (pixels-per-unit go) 2)))
+ (cond ((and (null? mods)
+ (eq? keyval gdk:Up))
+ (tweak go item (cons 0 (- 0 step))))
+ ((and (null? mods)
+ (eq? keyval gdk:Down))
+ (tweak go item (cons 0 step)))
+ ((and (null? mods)
+ (eq? keyval gdk:Left))
+ (tweak go item (cons (- 0 step) 0)))
+ ((and (null? mods)
+ (eq? keyval gdk:Right))
+ (tweak go item (cons step 0)))))))