diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,15 @@
+5.17
+API changes:
+ - Add support for terminal focus events. This change adds a new mode
+   usable with setMode, Focus, that requests that the terminal send
+   events on focus lose/gain. This change also adds two new Event
+   constructors, EvLostFocus and EvGainedFocus.
+ - No longer enable UTF8 mouse event encoding. This encoding was not
+   working properly with Terminal.app, and using the other modes (SGR,
+   etc.) work.
+ - Graphics.Vty.Attributes: escape backticks in Haddock comment (fixes
+   #131)
+
 5.16
 API changes:
   - Added support for mouse wheel events while in mouse mode. The Button
diff --git a/dist/build/verify-attribute-opsStub/verify-attribute-opsStub-tmp/verify-attribute-opsStub.hs b/dist/build/verify-attribute-opsStub/verify-attribute-opsStub-tmp/verify-attribute-opsStub.hs
deleted file mode 100644
--- a/dist/build/verify-attribute-opsStub/verify-attribute-opsStub-tmp/verify-attribute-opsStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifyAttributeOps ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/dist/build/verify-crop-span-generationStub/verify-crop-span-generationStub-tmp/verify-crop-span-generationStub.hs b/dist/build/verify-crop-span-generationStub/verify-crop-span-generationStub-tmp/verify-crop-span-generationStub.hs
deleted file mode 100644
--- a/dist/build/verify-crop-span-generationStub/verify-crop-span-generationStub-tmp/verify-crop-span-generationStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifyCropSpanGeneration ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/dist/build/verify-display-attributesStub/verify-display-attributesStub-tmp/verify-display-attributesStub.hs b/dist/build/verify-display-attributesStub/verify-display-attributesStub-tmp/verify-display-attributesStub.hs
deleted file mode 100644
--- a/dist/build/verify-display-attributesStub/verify-display-attributesStub-tmp/verify-display-attributesStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifyDisplayAttributes ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/dist/build/verify-empty-image-propsStub/verify-empty-image-propsStub-tmp/verify-empty-image-propsStub.hs b/dist/build/verify-empty-image-propsStub/verify-empty-image-propsStub-tmp/verify-empty-image-propsStub.hs
deleted file mode 100644
--- a/dist/build/verify-empty-image-propsStub/verify-empty-image-propsStub-tmp/verify-empty-image-propsStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifyEmptyImageProps ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/dist/build/verify-eval-terminfo-capsStub/verify-eval-terminfo-capsStub-tmp/verify-eval-terminfo-capsStub.hs b/dist/build/verify-eval-terminfo-capsStub/verify-eval-terminfo-capsStub-tmp/verify-eval-terminfo-capsStub.hs
deleted file mode 100644
--- a/dist/build/verify-eval-terminfo-capsStub/verify-eval-terminfo-capsStub-tmp/verify-eval-terminfo-capsStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifyEvalTerminfoCaps ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/dist/build/verify-image-opsStub/verify-image-opsStub-tmp/verify-image-opsStub.hs b/dist/build/verify-image-opsStub/verify-image-opsStub-tmp/verify-image-opsStub.hs
deleted file mode 100644
--- a/dist/build/verify-image-opsStub/verify-image-opsStub-tmp/verify-image-opsStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifyImageOps ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/dist/build/verify-image-transStub/verify-image-transStub-tmp/verify-image-transStub.hs b/dist/build/verify-image-transStub/verify-image-transStub-tmp/verify-image-transStub.hs
deleted file mode 100644
--- a/dist/build/verify-image-transStub/verify-image-transStub-tmp/verify-image-transStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifyImageTrans ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/dist/build/verify-inlineStub/verify-inlineStub-tmp/verify-inlineStub.hs b/dist/build/verify-inlineStub/verify-inlineStub-tmp/verify-inlineStub.hs
deleted file mode 100644
--- a/dist/build/verify-inlineStub/verify-inlineStub-tmp/verify-inlineStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifyInline ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/dist/build/verify-layers-span-generationStub/verify-layers-span-generationStub-tmp/verify-layers-span-generationStub.hs b/dist/build/verify-layers-span-generationStub/verify-layers-span-generationStub-tmp/verify-layers-span-generationStub.hs
deleted file mode 100644
--- a/dist/build/verify-layers-span-generationStub/verify-layers-span-generationStub-tmp/verify-layers-span-generationStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifyLayersSpanGeneration ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/dist/build/verify-parse-terminfo-capsStub/verify-parse-terminfo-capsStub-tmp/verify-parse-terminfo-capsStub.hs b/dist/build/verify-parse-terminfo-capsStub/verify-parse-terminfo-capsStub-tmp/verify-parse-terminfo-capsStub.hs
deleted file mode 100644
--- a/dist/build/verify-parse-terminfo-capsStub/verify-parse-terminfo-capsStub-tmp/verify-parse-terminfo-capsStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifyParseTerminfoCaps ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/dist/build/verify-simple-span-generationStub/verify-simple-span-generationStub-tmp/verify-simple-span-generationStub.hs b/dist/build/verify-simple-span-generationStub/verify-simple-span-generationStub-tmp/verify-simple-span-generationStub.hs
deleted file mode 100644
--- a/dist/build/verify-simple-span-generationStub/verify-simple-span-generationStub-tmp/verify-simple-span-generationStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifySimpleSpanGeneration ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/dist/build/verify-terminalStub/verify-terminalStub-tmp/verify-terminalStub.hs b/dist/build/verify-terminalStub/verify-terminalStub-tmp/verify-terminalStub.hs
deleted file mode 100644
--- a/dist/build/verify-terminalStub/verify-terminalStub-tmp/verify-terminalStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifyOutput ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/dist/build/verify-using-mock-terminalStub/verify-using-mock-terminalStub-tmp/verify-using-mock-terminalStub.hs b/dist/build/verify-using-mock-terminalStub/verify-using-mock-terminalStub-tmp/verify-using-mock-terminalStub.hs
deleted file mode 100644
--- a/dist/build/verify-using-mock-terminalStub/verify-using-mock-terminalStub-tmp/verify-using-mock-terminalStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifyUsingMockTerminal ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/dist/build/verify-utf8-widthStub/verify-utf8-widthStub-tmp/verify-utf8-widthStub.hs b/dist/build/verify-utf8-widthStub/verify-utf8-widthStub-tmp/verify-utf8-widthStub.hs
deleted file mode 100644
--- a/dist/build/verify-utf8-widthStub/verify-utf8-widthStub-tmp/verify-utf8-widthStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import VerifyUtf8Width ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/src/Graphics/Vty/Attributes.hs b/src/Graphics/Vty/Attributes.hs
--- a/src/Graphics/Vty/Attributes.hs
+++ b/src/Graphics/Vty/Attributes.hs
@@ -10,14 +10,14 @@
 -- 'withForeColor', 'withBackColor', and 'withStyle', e.g.,
 --
 -- @
---     defAttr `withForeColor` red
+--     defAttr \`withForeColor\` red
 -- @
 --
 -- 'Image' constructors often require an 'Attr' to indicate the
 -- attributes used in the image, e.g.,
 --
 -- @
---     string (defAttr `withForeColor` red) "this text will be red"
+--     string (defAttr \`withForeColor\` red) "this text will be red"
 -- @
 --
 -- The appearance of 'Image's using 'defAttr' is determined by the The
diff --git a/src/Graphics/Vty/Input/Classify.hs b/src/Graphics/Vty/Input/Classify.hs
--- a/src/Graphics/Vty/Input/Classify.hs
+++ b/src/Graphics/Vty/Input/Classify.hs
@@ -10,6 +10,7 @@
 
 import Graphics.Vty.Input.Events
 import Graphics.Vty.Input.Mouse
+import Graphics.Vty.Input.Focus
 import Graphics.Vty.Input.Paste
 import Graphics.Vty.Input.Classify.Types
 
@@ -59,6 +60,7 @@
             then parseBracketedPaste s
             else Prefix
         _ | isMouseEvent s   -> classifyMouseEvent s
+        _ | isFocusEvent s   -> classifyFocusEvent s
         c:cs | ord c >= 0xC2 -> classifyUtf8 c cs
         _                    -> standardClassifier s
 
diff --git a/src/Graphics/Vty/Input/Events.hs b/src/Graphics/Vty/Input/Events.hs
--- a/src/Graphics/Vty/Input/Events.hs
+++ b/src/Graphics/Vty/Input/Events.hs
@@ -56,6 +56,10 @@
     -- input (which is probably bad, so beware!) Note that the data is
     -- provided in raw form and you'll have to decode (e.g. as UTF-8) if
     -- that's what your application expects.
+    | EvLostFocus
+    -- ^ The terminal running the application lost input focus.
+    | EvGainedFocus
+    -- ^ The terminal running the application gained input focus.
     deriving (Eq,Show,Read,Ord,Generic)
 
 type ClassifyMap = [(String,Event)]
diff --git a/src/Graphics/Vty/Input/Focus.hs b/src/Graphics/Vty/Input/Focus.hs
new file mode 100644
--- /dev/null
+++ b/src/Graphics/Vty/Input/Focus.hs
@@ -0,0 +1,47 @@
+module Graphics.Vty.Input.Focus
+  ( requestFocusEvents
+  , disableFocusEvents
+  , isFocusEvent
+  , classifyFocusEvent
+  )
+where
+
+import Graphics.Vty.Input.Events
+import Graphics.Vty.Input.Classify.Types
+import Graphics.Vty.Input.Classify.Parse
+
+import Control.Monad.State
+import Data.List (isPrefixOf)
+
+-- | These sequences set xterm-based terminals to send focus event
+-- sequences.
+requestFocusEvents :: String
+requestFocusEvents = "\ESC[?1004h"
+
+-- | These sequences disable focus events.
+disableFocusEvents :: String
+disableFocusEvents = "\ESC[?1004l"
+
+-- | Does the specified string begin with a focus event?
+isFocusEvent :: String -> Bool
+isFocusEvent s = isPrefixOf focusIn s ||
+                 isPrefixOf focusOut s
+
+focusIn :: String
+focusIn = "\ESC[I"
+
+focusOut :: String
+focusOut = "\ESC[O"
+
+-- | Attempt to classify an input string as a focus event.
+classifyFocusEvent :: String -> KClass
+classifyFocusEvent s = runParser s $ do
+    when (not $ isFocusEvent s) failParse
+
+    expectChar '\ESC'
+    expectChar '['
+    ty <- readChar
+    case ty of
+        'I' -> return EvGainedFocus
+        'O' -> return EvLostFocus
+        _   -> failParse
diff --git a/src/Graphics/Vty/Input/Mouse.hs b/src/Graphics/Vty/Input/Mouse.hs
--- a/src/Graphics/Vty/Input/Mouse.hs
+++ b/src/Graphics/Vty/Input/Mouse.hs
@@ -33,11 +33,11 @@
 -- | These sequences set xterm-based terminals to send mouse event
 -- sequences.
 requestMouseEvents :: String
-requestMouseEvents = "\ESC[?1000h\ESC[?1002h\ESC[?1006h\ESC[?1005h"
+requestMouseEvents = "\ESC[?1000h\ESC[?1002h\ESC[?1006h"
 
 -- | These sequences disable mouse events.
 disableMouseEvents :: String
-disableMouseEvents = "\ESC[?1000l\ESC[?1002l\ESC[?1006l\ESC[?1005l"
+disableMouseEvents = "\ESC[?1000l\ESC[?1002l\ESC[?1006l"
 
 -- | Does the specified string begin with a mouse event?
 isMouseEvent :: String -> Bool
diff --git a/src/Graphics/Vty/Output/Interface.hs b/src/Graphics/Vty/Output/Interface.hs
--- a/src/Graphics/Vty/Output/Interface.hs
+++ b/src/Graphics/Vty/Output/Interface.hs
@@ -44,6 +44,9 @@
           | BracketedPaste
           -- ^ Paste mode (whether the terminal is configured to provide
           -- events on OS pastes)
+          | Focus
+          -- ^ Focus-in/focus-out events (whether the terminal is
+          -- configured to provide events on focus change)
           deriving (Eq, Read, Show)
 
 -- | The Vty terminal output interface.
diff --git a/src/Graphics/Vty/Output/XTermColor.hs b/src/Graphics/Vty/Output/XTermColor.hs
--- a/src/Graphics/Vty/Output/XTermColor.hs
+++ b/src/Graphics/Vty/Output/XTermColor.hs
@@ -8,6 +8,7 @@
 
 import Graphics.Vty.Output.Interface
 import Graphics.Vty.Input.Mouse
+import Graphics.Vty.Input.Focus
 import qualified Graphics.Vty.Output.TerminfoBased as TerminfoBased
 
 import Blaze.ByteString.Builder (writeToByteString)
@@ -38,12 +39,18 @@
     t <- TerminfoBased.reserveTerminal variant' outFd
 
     mouseModeStatus <- newIORef False
+    focusModeStatus <- newIORef False
     pasteModeStatus <- newIORef False
 
     let xtermSetMode t' m newStatus = do
           curStatus <- getModeStatus t' m
           when (newStatus /= curStatus) $
               case m of
+                  Focus -> liftIO $ do
+                      case newStatus of
+                          True -> flushedPut requestFocusEvents
+                          False -> flushedPut disableFocusEvents
+                      writeIORef focusModeStatus newStatus
                   Mouse -> liftIO $ do
                       case newStatus of
                           True -> flushedPut requestMouseEvents
@@ -56,6 +63,7 @@
                       writeIORef pasteModeStatus newStatus
 
         xtermGetMode Mouse = liftIO $ readIORef mouseModeStatus
+        xtermGetMode Focus = liftIO $ readIORef focusModeStatus
         xtermGetMode BracketedPaste = liftIO $ readIORef pasteModeStatus
 
     let t' = t
@@ -64,6 +72,7 @@
                  when (not utf8a) $ liftIO $ flushedPut setDefaultCharSet
                  setMode t' BracketedPaste False
                  setMode t' Mouse False
+                 setMode t' Focus False
                  releaseTerminal t
              , mkDisplayContext = \tActual r -> do
                 dc <- mkDisplayContext t tActual r
diff --git a/vty.cabal b/vty.cabal
--- a/vty.cabal
+++ b/vty.cabal
@@ -1,5 +1,5 @@
 name:                vty
-version:             5.16
+version:             5.17
 license:             BSD3
 license-file:        LICENSE
 author:              AUTHORS
@@ -85,6 +85,7 @@
                        Graphics.Vty.Input.Classify.Parse
                        Graphics.Vty.Input.Loop
                        Graphics.Vty.Input.Mouse
+                       Graphics.Vty.Input.Focus
                        Graphics.Vty.Input.Paste
                        Graphics.Vty.Input.Terminfo
                        Graphics.Vty.PictureToSpans
