[arch-commits] Commit in xmonad/trunk (4 files)
Jelle van der Waa
jelle at archlinux.org
Wed Jan 18 19:47:16 UTC 2017
Date: Wednesday, January 18, 2017 @ 19:47:15
Author: jelle
Revision: 207912
upgpkg: xmonad 0.12-12
Added:
xmonad/trunk/202e239ea48d56882bb4ad226ad3a4042ebf12bd.patch
xmonad/trunk/dc078490d0c244af1d0d5370799b83f42dcb7d43.patch
Modified:
xmonad/trunk/PKGBUILD
Deleted:
xmonad/trunk/x11.patch
------------------------------------------------+
202e239ea48d56882bb4ad226ad3a4042ebf12bd.patch | 79 ++++++++++
PKGBUILD | 11 -
dc078490d0c244af1d0d5370799b83f42dcb7d43.patch | 179 +++++++++++++++++++++++
x11.patch | 12 -
4 files changed, 265 insertions(+), 16 deletions(-)
Added: 202e239ea48d56882bb4ad226ad3a4042ebf12bd.patch
===================================================================
--- 202e239ea48d56882bb4ad226ad3a4042ebf12bd.patch (rev 0)
+++ 202e239ea48d56882bb4ad226ad3a4042ebf12bd.patch 2017-01-18 19:47:15 UTC (rev 207912)
@@ -0,0 +1,79 @@
+From 202e239ea48d56882bb4ad226ad3a4042ebf12bd Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones at devalot.com>
+Date: Tue, 22 Nov 2016 18:46:28 -0700
+Subject: [PATCH] Refactor xmonad/xmonad#9 and remove explicit exception
+ handling
+
+---
+ src/XMonad/Operations.hs | 23 +++++++++++++++++++++--
+ xmonad.cabal | 2 +-
+ 2 files changed, 22 insertions(+), 3 deletions(-)
+
+diff --git a/src/XMonad/Operations.hs b/src/XMonad/Operations.hs
+index 153b5a2..cd33974 100644
+--- a/src/XMonad/Operations.hs
++++ b/src/XMonad/Operations.hs
+@@ -34,6 +34,7 @@ import Control.Monad.Reader
+ import Control.Monad.State
+ import qualified Control.Exception.Extensible as C
+
++import System.IO
+ import System.Posix.Process (executeFile)
+ import Graphics.X11.Xlib
+ import Graphics.X11.Xinerama (getScreenInfo)
+@@ -111,7 +112,10 @@ windows f = do
+
+ mapM_ setInitialProperties newwindows
+
+- whenJust (W.peek old) $ \otherw -> io $ setWindowBorder d otherw nbc
++ whenJust (W.peek old) $ \otherw -> do
++ nbs <- asks (normalBorderColor . config)
++ setWindowBorderWithFallback d otherw nbs nbc
++
+ modify (\s -> s { windowset = ws })
+
+ -- notify non visibility
+@@ -151,7 +155,9 @@ windows f = do
+
+ mapM_ (uncurry tileWindow) rects
+
+- whenJust (W.peek ws) $ \w -> io $ setWindowBorder d w fbc
++ whenJust (W.peek ws) $ \w -> do
++ fbs <- asks (focusedBorderColor . config)
++ setWindowBorderWithFallback d w fbs fbc
+
+ mapM_ reveal visible
+ setTopFocus
+@@ -181,6 +187,19 @@ setWMState w v = withDisplay $ \dpy -> do
+ a <- atom_WM_STATE
+ io $ changeProperty32 dpy w a a propModeReplace [fromIntegral v, fromIntegral none]
+
++-- | Set the border color using the window's color map, if possible,
++-- otherwise use fallback.
++setWindowBorderWithFallback :: Display -> Window -> String -> Pixel -> X ()
++setWindowBorderWithFallback dpy w color basic = io $
++ C.handle fallback $ do
++ wa <- getWindowAttributes dpy w
++ pixel <- color_pixel . fst <$> allocNamedColor dpy (wa_colormap wa) color
++ setWindowBorder dpy w pixel
++ where
++ fallback :: C.SomeException -> IO ()
++ fallback e = do hPrint stderr e >> hFlush stderr
++ setWindowBorder dpy w basic
++
+ -- | hide. Hide a window by unmapping it, and setting Iconified.
+ hide :: Window -> X ()
+ hide w = whenX (gets (S.member w . mapped)) $ withDisplay $ \d -> do
+diff --git a/xmonad.cabal b/xmonad.cabal
+index 0de4277..ed77fe7 100644
+--- a/xmonad.cabal
++++ b/xmonad.cabal
+@@ -78,7 +78,7 @@ library
+ process,
+ unix,
+ utf8-string >= 0.3 && < 1.1,
+- X11>=1.5 && < 1.7
++ X11>=1.7 && < 1.8
+
+ if true
+ ghc-options: -funbox-strict-fields -Wall
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2017-01-18 19:25:36 UTC (rev 207911)
+++ PKGBUILD 2017-01-18 19:47:15 UTC (rev 207912)
@@ -6,7 +6,7 @@
pkgname=xmonad
pkgver=0.12
-pkgrel=11
+pkgrel=12
pkgdesc="Lightweight X11 tiled window manager written in Haskell"
arch=('i686' 'x86_64')
url="http://xmonad.org/"
@@ -17,17 +17,20 @@
makedepends=('gendesk')
optdepends=('xorg-xmessage: for displaying visual error messages')
source=("$pkgname-$pkgver.tar.gz::https://github.com/xmonad/xmonad/archive/v${pkgver}.tar.gz"
- "xmonad.svg" "x11.patch")
+ "xmonad.svg" "202e239ea48d56882bb4ad226ad3a4042ebf12bd.patch"
+ "dc078490d0c244af1d0d5370799b83f42dcb7d43.patch")
md5sums=('c81d688c51fa50aea0e421f4755ee2fc'
'72bfa5e62e4e44fe7fa59b6a7593d993'
- '0209d1b5c47ad765b2143046874fa247')
+ '18242b7792e06d63866e06821396220b'
+ '5e7c2833126b8c6658586ca4b647ac6f')
prepare() {
gendesk --pkgname "$pkgname" --pkgdesc "$pkgdesc"
cd $srcdir/$pkgname-$pkgver
- patch -Np1 -i $srcdir/x11.patch
+ patch -Np1 -i "$srcdir/202e239ea48d56882bb4ad226ad3a4042ebf12bd.patch"
+ patch -Np1 -i "$srcdir/dc078490d0c244af1d0d5370799b83f42dcb7d43.patch"
}
build() {
Added: dc078490d0c244af1d0d5370799b83f42dcb7d43.patch
===================================================================
--- dc078490d0c244af1d0d5370799b83f42dcb7d43.patch (rev 0)
+++ dc078490d0c244af1d0d5370799b83f42dcb7d43.patch 2017-01-18 19:47:15 UTC (rev 207912)
@@ -0,0 +1,179 @@
+From dc078490d0c244af1d0d5370799b83f42dcb7d43 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones at devalot.com>
+Date: Wed, 23 Nov 2016 16:30:27 -0700
+Subject: [PATCH] Guard most calls to getWindowAttributes since it may throw an
+ exception
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is a continuation of the work done by Adam Sjøgren (@asjo) to
+resolve an issue where RGBA windows have transparent borders. It also
+fixes bugs related to windows suddenly disappearing right before
+xmonad calls getWindowAttributes.
+
+For more information see xmonad/xmonad#9
+---
+ src/XMonad/Core.hs | 11 +++++++++--
+ src/XMonad/Main.hs | 18 ++++++++++--------
+ src/XMonad/Operations.hs | 37 ++++++++++++++++++++++---------------
+ 3 files changed, 41 insertions(+), 25 deletions(-)
+
+diff --git a/src/XMonad/Core.hs b/src/XMonad/Core.hs
+index a6387fd..3a96954 100644
+--- a/src/XMonad/Core.hs
++++ b/src/XMonad/Core.hs
+@@ -26,7 +26,8 @@ module XMonad.Core (
+ runX, catchX, userCode, userCodeDef, io, catchIO, installSignalHandlers, uninstallSignalHandlers,
+ withDisplay, withWindowSet, isRoot, runOnWorkspaces,
+ getAtom, spawn, spawnPID, xfork, getXMonadDir, recompile, trace, whenJust, whenX,
+- atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, atom_WM_TAKE_FOCUS, ManageHook, Query(..), runQuery
++ atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, atom_WM_TAKE_FOCUS, withWindowAttributes,
++ ManageHook, Query(..), runQuery
+ ) where
+
+ import XMonad.StackSet hiding (modify)
+@@ -49,7 +50,7 @@ import System.Process
+ import System.Directory
+ import System.Exit
+ import Graphics.X11.Xlib
+-import Graphics.X11.Xlib.Extras (Event)
++import Graphics.X11.Xlib.Extras (getWindowAttributes, WindowAttributes, Event)
+ import Data.Typeable
+ import Data.List ((\\))
+ import Data.Maybe (isJust,fromMaybe)
+@@ -207,6 +208,12 @@ withDisplay f = asks display >>= f
+ withWindowSet :: (WindowSet -> X a) -> X a
+ withWindowSet f = gets windowset >>= f
+
++-- | Safely access window attributes.
++withWindowAttributes :: Display -> Window -> (WindowAttributes -> X ()) -> X ()
++withWindowAttributes dpy win f = do
++ wa <- userCode (io $ getWindowAttributes dpy win)
++ catchX (whenJust wa f) (return ())
++
+ -- | True if the given window is the root window
+ isRoot :: Window -> X Bool
+ isRoot w = (w==) <$> asks theRoot
+diff --git a/src/XMonad/Main.hs b/src/XMonad/Main.hs
+index 3da7bb4..57c13c8 100644
+--- a/src/XMonad/Main.hs
++++ b/src/XMonad/Main.hs
+@@ -17,6 +17,7 @@ module XMonad.Main (xmonad) where
+
+ import System.Locale.SetLocale
+ import Control.Arrow (second)
++import qualified Control.Exception.Extensible as E
+ import Data.Bits
+ import Data.List ((\\))
+ import Data.Function
+@@ -290,10 +291,10 @@ handle (KeyEvent {ev_event_type = t, ev_state = m, ev_keycode = code})
+
+ -- manage a new window
+ handle (MapRequestEvent {ev_window = w}) = withDisplay $ \dpy -> do
+- wa <- io $ getWindowAttributes dpy w -- ignore override windows
+- -- need to ignore mapping requests by managed windows not on the current workspace
+- managed <- isClient w
+- when (not (wa_override_redirect wa) && not managed) $ do manage w
++ withWindowAttributes dpy w $ \wa -> do -- ignore override windows
++ -- need to ignore mapping requests by managed windows not on the current workspace
++ managed <- isClient w
++ when (not (wa_override_redirect wa) && not managed) $ manage w
+
+ -- window destroyed, unmanage it
+ -- window gone, unmanage it
+@@ -367,8 +368,6 @@ handle e@(CrossingEvent {ev_event_type = t})
+ -- configure a window
+ handle e@(ConfigureRequestEvent {ev_window = w}) = withDisplay $ \dpy -> do
+ ws <- gets windowset
+- wa <- io $ getWindowAttributes dpy w
+-
+ bw <- asks (borderWidth . config)
+
+ if M.member w (floating ws)
+@@ -382,7 +381,7 @@ handle e@(ConfigureRequestEvent {ev_window = w}) = withDisplay $ \dpy -> do
+ , wc_sibling = ev_above e
+ , wc_stack_mode = ev_detail e }
+ when (member w ws) (float w)
+- else io $ allocaXEvent $ \ev -> do
++ else withWindowAttributes dpy w $ \wa -> io $ allocaXEvent $ \ev -> do
+ setEventType ev configureNotify
+ setConfigureEvent ev w w
+ (wa_x wa) (wa_y wa) (wa_width wa)
+@@ -416,7 +415,7 @@ handle e = broadcastMessage e -- trace (eventName e) -- ignoring
+ scan :: Display -> Window -> IO [Window]
+ scan dpy rootw = do
+ (_, _, ws) <- queryTree dpy rootw
+- filterM ok ws
++ filterM (\w -> ok w `E.catch` skip) ws
+ -- TODO: scan for windows that are either 'IsViewable' or where WM_STATE ==
+ -- Iconic
+ where ok w = do wa <- getWindowAttributes dpy w
+@@ -428,6 +427,9 @@ scan dpy rootw = do
+ return $ not (wa_override_redirect wa)
+ && (wa_map_state wa == waIsViewable || ic)
+
++ skip :: E.SomeException -> IO Bool
++ skip _ = return False
++
+ setNumlockMask :: X ()
+ setNumlockMask = do
+ dpy <- asks display
+diff --git a/src/XMonad/Operations.hs b/src/XMonad/Operations.hs
+index cd33974..390f553 100644
+--- a/src/XMonad/Operations.hs
++++ b/src/XMonad/Operations.hs
+@@ -252,10 +252,10 @@ clearEvents mask = withDisplay $ \d -> io $ do
+ -- | tileWindow. Moves and resizes w such that it fits inside the given
+ -- rectangle, including its border.
+ tileWindow :: Window -> Rectangle -> X ()
+-tileWindow w r = withDisplay $ \d -> do
+- bw <- (fromIntegral . wa_border_width) <$> io (getWindowAttributes d w)
++tileWindow w r = withDisplay $ \d -> withWindowAttributes d w $ \wa -> do
+ -- give all windows at least 1x1 pixels
+- let least x | x <= bw*2 = 1
++ let bw = fromIntegral $ wa_border_width wa
++ least x | x <= bw*2 = 1
+ | otherwise = x - bw*2
+ io $ moveResizeWindow d w (rect_x r) (rect_y r)
+ (least $ rect_width r) (least $ rect_height r)
+@@ -463,20 +463,27 @@ restart prog resume = do
+ -- | Given a window, find the screen it is located on, and compute
+ -- the geometry of that window wrt. that screen.
+ floatLocation :: Window -> X (ScreenId, W.RationalRect)
+-floatLocation w = withDisplay $ \d -> do
+- ws <- gets windowset
+- wa <- io $ getWindowAttributes d w
+- let bw = (fromIntegral . wa_border_width) wa
+- sc <- fromMaybe (W.current ws) <$> pointScreen (fi $ wa_x wa) (fi $ wa_y wa)
+-
+- let sr = screenRect . W.screenDetail $ sc
+- rr = W.RationalRect ((fi (wa_x wa) - fi (rect_x sr)) % fi (rect_width sr))
+- ((fi (wa_y wa) - fi (rect_y sr)) % fi (rect_height sr))
+- (fi (wa_width wa + bw*2) % fi (rect_width sr))
+- (fi (wa_height wa + bw*2) % fi (rect_height sr))
++floatLocation w =
++ catchX go $ do
++ -- Fallback solution if `go' fails. Which it might, since it
++ -- calls `getWindowAttributes'.
++ sc <- W.current <$> gets windowset
++ return (W.screen sc, W.RationalRect 0 0 1 1)
+
+- return (W.screen sc, rr)
+ where fi x = fromIntegral x
++ go = withDisplay $ \d -> do
++ ws <- gets windowset
++ wa <- io $ getWindowAttributes d w
++ let bw = (fromIntegral . wa_border_width) wa
++ sc <- fromMaybe (W.current ws) <$> pointScreen (fi $ wa_x wa) (fi $ wa_y wa)
++
++ let sr = screenRect . W.screenDetail $ sc
++ rr = W.RationalRect ((fi (wa_x wa) - fi (rect_x sr)) % fi (rect_width sr))
++ ((fi (wa_y wa) - fi (rect_y sr)) % fi (rect_height sr))
++ (fi (wa_width wa + bw*2) % fi (rect_width sr))
++ (fi (wa_height wa + bw*2) % fi (rect_height sr))
++
++ return (W.screen sc, rr)
+
+ -- | Given a point, determine the screen (if any) that contains it.
+ pointScreen :: Position -> Position
Deleted: x11.patch
===================================================================
--- x11.patch 2017-01-18 19:25:36 UTC (rev 207911)
+++ x11.patch 2017-01-18 19:47:15 UTC (rev 207912)
@@ -1,12 +0,0 @@
-diff -aur xmonad-0.12/xmonad.cabal xmonad-0.12.new/xmonad.cabal
---- xmonad-0.12/xmonad.cabal 2015-12-18 21:23:38.000000000 +0100
-+++ xmonad-0.12.new/xmonad.cabal 2017-01-08 12:08:19.195824197 +0100
-@@ -71,7 +71,7 @@
- process,
- unix,
- utf8-string >= 0.3 && < 1.1,
-- X11>=1.5 && < 1.7
-+ X11>=1.5 && < 1.8
-
- if true
- ghc-options: -funbox-strict-fields -Wall
More information about the arch-commits
mailing list