             [seesaw.keymap :as keymap])
   (:import [java.awt Color Component KeyboardFocusManager KeyEventDispatcher
             Toolkit]
-           [java.awt.event ActionEvent KeyEvent]
+           [java.awt.event ActionEvent InputEvent KeyEvent]
            [javax.swing JComponent]
            [net.java.balloontip BalloonTip]
            [net.java.balloontip.positioners CenteredPositioner]

(defn run-shortcut!
  "Runs shortcut command if applicable, returning a boolean indicating success."
  [target func e]
  (if (and @down?
           (not (.isShiftDown e))
           (= (.getID e) KeyEvent/KEY_PRESSED))
    (func (.getKeyCode e))
    false))


  [target e]
  (let [modifier (.getMenuShortcutKeyMask (Toolkit/getDefaultToolkit))
        current-modifier (.getModifiers e)]
    (reset! down? (and (= (bit-and modifier current-modifier) modifier)
                       (contains? #{InputEvent/CTRL_MASK InputEvent/META_MASK}
                                  current-modifier)))
    (when (or (contains? #{KeyEvent/VK_CONTROL KeyEvent/VK_META}
                         (.getKeyCode e))
              @down?)
      (toggle-hints! target @down?))))

