[xmonad/f16] backport xmonad-basic subpackage and WM_TAKE_FOCUS fix for Java apps

Jens Petersen petersen at fedoraproject.org
Fri Dec 7 04:54:44 UTC 2012


commit f10d05d7558f1bd08874b8afc028e6a42af7df00
Author: Jens Petersen <petersen at redhat.com>
Date:   Fri Dec 7 13:54:28 2012 +0900

    backport xmonad-basic subpackage and WM_TAKE_FOCUS fix for Java apps
    
    - patch for ICCCM event tracking to fix focus for Java apps (#874855)
    - update to cabal-rpm packaging
    - allow building with X11-1.6

 ...KE_FOCUS-track-currently-processing-event.patch |  105 ++++++++++++++++++
 xmonad-0.10-X11-1.6.patch                          |   12 ++
 xmonad-0.9.1-ghc7-base4.patch                      |  116 --------------------
 xmonad.spec                                        |   77 +++++++++----
 4 files changed, 171 insertions(+), 139 deletions(-)
---
diff --git a/xmonad-0.10-WM_TAKE_FOCUS-track-currently-processing-event.patch b/xmonad-0.10-WM_TAKE_FOCUS-track-currently-processing-event.patch
new file mode 100644
index 0000000..2523bf1
--- /dev/null
+++ b/xmonad-0.10-WM_TAKE_FOCUS-track-currently-processing-event.patch
@@ -0,0 +1,105 @@
+Mon Feb 22 06:45:12 PST 2010  Adam Vogt <vogt.adam at gmail.com>
+  * Resolve conflicts Geoff Reedy's window focus hack.
+Sat Oct 10 16:19:07 PDT 2009  Geoff Reedy <geoff at programmer-monk.net>
+  * Give focus to windows that don't set the input hint
+Sun Jun 21 22:19:11 PDT 2009  Geoff Reedy <geoff at programmer-monk.net>
+  * implement the ICCCM WM_TAKE_FOCUS protocol
+Sun Jun 21 20:56:49 PDT 2009  Geoff Reedy <geoff at programmer-monk.net>
+  * track currently processing event
+diff -rN -u old-xmonad/XMonad/Core.hs new-xmonad/XMonad/Core.hs
+--- old-xmonad/XMonad/Core.hs	2012-11-14 22:40:50.637523085 -0800
++++ new-xmonad/XMonad/Core.hs	2012-11-14 22:40:50.649523104 -0800
+@@ -26,7 +26,7 @@
+     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, ManageHook, Query(..), runQuery
++    atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, atom_WM_TAKE_FOCUS, ManageHook, Query(..), runQuery
+   ) where
+ 
+ import XMonad.StackSet hiding (modify)
+@@ -86,6 +86,8 @@
+     , mousePosition :: !(Maybe (Position, Position))
+                                       -- ^ position of the mouse according to
+                                       -- the event currently being processed
++    , currentEvent :: !(Maybe Event)
++                                      -- ^ event currently being processed
+     }
+ 
+ -- todo, better name
+@@ -202,10 +204,11 @@
+ getAtom str = withDisplay $ \dpy -> io $ internAtom dpy str False
+ 
+ -- | Common non-predefined atoms
+-atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, atom_WM_STATE :: X Atom
++atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, atom_WM_STATE, atom_WM_TAKE_FOCUS :: X Atom
+ atom_WM_PROTOCOLS       = getAtom "WM_PROTOCOLS"
+ atom_WM_DELETE_WINDOW   = getAtom "WM_DELETE_WINDOW"
+ atom_WM_STATE           = getAtom "WM_STATE"
++atom_WM_TAKE_FOCUS      = getAtom "WM_TAKE_FOCUS"
+ 
+ ------------------------------------------------------------------------
+ -- LayoutClass handling. See particular instances in Operations.hs
+diff -rN -u old-xmonad/XMonad/Main.hsc new-xmonad/XMonad/Main.hsc
+--- old-xmonad/XMonad/Main.hsc	2012-11-14 22:40:50.636523083 -0800
++++ new-xmonad/XMonad/Main.hsc	2012-11-14 22:40:50.652523110 -0800
+@@ -121,7 +121,8 @@
+             , keyActions    = keys xmc xmc
+             , buttonActions = mouseBindings xmc xmc
+             , mouseFocused  = False
+-            , mousePosition = Nothing }
++            , mousePosition = Nothing
++            , currentEvent  = Nothing }
+ 
+         st = XState
+             { windowset       = initialWinset
+@@ -163,7 +164,7 @@
+         prehandle e = let mouse = do guard (ev_event_type e `elem` evs)
+                                      return (fromIntegral (ev_x_root e)
+                                             ,fromIntegral (ev_y_root e))
+-                      in local (\c -> c { mousePosition = mouse }) (handleWithHook e)
++                      in local (\c -> c { mousePosition = mouse, currentEvent = Just e }) (handleWithHook e)
+         evs = [ keyPress, keyRelease, enterNotify, leaveNotify
+               , buttonPress, buttonRelease]
+ 
+diff -rN -u old-xmonad/XMonad/Operations.hs new-xmonad/XMonad/Operations.hs
+--- old-xmonad/XMonad/Operations.hs	2012-11-14 22:40:50.630523074 -0800
++++ new-xmonad/XMonad/Operations.hs	2012-11-14 22:40:50.654523114 -0800
+@@ -24,7 +24,7 @@
+ import Data.Maybe
+ import Data.Monoid          (Endo(..))
+ import Data.List            (nub, (\\), find)
+-import Data.Bits            ((.|.), (.&.), complement)
++import Data.Bits            ((.|.), (.&.), complement, testBit)
+ import Data.Ratio
+ import qualified Data.Map as M
+ import qualified Data.Set as S
+@@ -325,7 +325,27 @@
+ 
+     -- If we ungrab buttons on the root window, we lose our mouse bindings.
+     whenX (not <$> isRoot w) $ setButtonGrab False w
+-    io $ setInputFocus dpy w revertToPointerRoot 0
++
++    hints <- io $ getWMHints dpy w
++    protocols <- io $ getWMProtocols dpy w
++    wmprot <- atom_WM_PROTOCOLS
++    wmtf <- atom_WM_TAKE_FOCUS
++    currevt <- asks currentEvent
++    let inputHintSet = wmh_flags hints `testBit` inputHintBit
++
++    when ((inputHintSet && wmh_input hints) || (not inputHintSet)) $
++      io $ do setInputFocus dpy w revertToPointerRoot 0
++    when (wmtf `elem` protocols) $
++      io $ allocaXEvent $ \ev -> do
++        setEventType ev clientMessage
++        setClientMessageEvent ev w wmprot 32 wmtf $ maybe currentTime event_time currevt
++        sendEvent dpy w False noEventMask ev
++        where event_time ev =
++                if (ev_event_type ev) `elem` timedEvents then
++                  ev_time ev
++                else
++                  currentTime
++              timedEvents = [ keyPress, keyRelease, buttonPress, buttonRelease, enterNotify, leaveNotify, selectionRequest ]
+ 
+ ------------------------------------------------------------------------
+ -- Message handling
diff --git a/xmonad-0.10-X11-1.6.patch b/xmonad-0.10-X11-1.6.patch
new file mode 100644
index 0000000..fe0f6b7
--- /dev/null
+++ b/xmonad-0.10-X11-1.6.patch
@@ -0,0 +1,12 @@
+diff -u xmonad-0.10/xmonad.cabal\~ xmonad-0.10/xmonad.cabal
+--- xmonad-0.10/xmonad.cabal~	2011-11-19 08:14:36.000000000 +0900
++++ xmonad-0.10/xmonad.cabal	2012-06-11 10:46:59.925650241 +0900
+@@ -46,7 +46,7 @@
+         build-depends: base < 5 && >=3, containers, directory, process, filepath, extensible-exceptions
+     else
+         build-depends: base < 3
+-    build-depends: X11>=1.5.0.0 && < 1.6, mtl, unix,
++    build-depends: X11>=1.5.0.0 && < 1.7, mtl, unix,
+                    utf8-string >= 0.3 && < 0.4
+ 
+     if true
diff --git a/xmonad.spec b/xmonad.spec
index 14f3eaf..bd15563 100644
--- a/xmonad.spec
+++ b/xmonad.spec
@@ -1,10 +1,9 @@
-# cabal2spec-0.25.2
 # https://fedoraproject.org/wiki/Packaging:Haskell
 # https://fedoraproject.org/wiki/PackagingDrafts/Haskell
 
 %global pkg_name xmonad
 
-%global common_summary xmonad tiling window manager
+%global common_summary XMonad tiling window manager
 
 %global common_description xmonad is a tiling window manager for X. Windows are arranged\
 automatically to tile the screen without gaps or overlap, maximising\
@@ -18,18 +17,12 @@ on several screens.
 
 Name:           %{pkg_name}
 Version:        0.10
-Release:        3.7%{?dist}
+Release:        3.8%{?dist}
 Summary:        A tiling window manager
 
-Group:          User Interface/X
 License:        BSD
-# BEGIN cabal2spec
 URL:            http://hackage.haskell.org/package/%{name}
 Source0:        http://hackage.haskell.org/packages/archive/%{name}/%{version}/%{name}-%{version}.tar.gz
-ExclusiveArch:  %{ghc_arches}
-BuildRequires:  ghc-Cabal-devel
-BuildRequires:  ghc-rpm-macros %{!?without_hscolour:hscolour}
-# END cabal2spec
 Source1:        xmonad-session.desktop
 Source2:        xmonad-start
 Source3:        xmonad.desktop
@@ -37,37 +30,62 @@ Source4:        README.fedora
 Source5:        xmonad-gnome-session.desktop
 Source6:        xmonad.session
 Source7:        xmonad.hs
+Patch1:         xmonad-0.10-X11-1.6.patch
+Patch2:         xmonad-0.10-WM_TAKE_FOCUS-track-currently-processing-event.patch
+
+BuildRequires:  ghc-Cabal-devel
+BuildRequires:  ghc-rpm-macros
+# Begin cabal-rpm deps:
+BuildRequires:  ghc-X11-devel
+BuildRequires:  ghc-containers-devel
+BuildRequires:  ghc-directory-devel
+BuildRequires:  ghc-extensible-exceptions-devel
+BuildRequires:  ghc-filepath-devel
+BuildRequires:  ghc-mtl-devel
+BuildRequires:  ghc-process-devel
+BuildRequires:  ghc-unix-devel
+BuildRequires:  ghc-utf8-string-devel
+# End cabal-rpm deps
 BuildRequires:  desktop-file-utils
-BuildRequires:  ghc-X11-prof
-BuildRequires:  ghc-containers-prof
-BuildRequires:  ghc-mtl-prof
-BuildRequires:  ghc-extensible-exceptions-prof
-BuildRequires:  ghc-process-prof
-BuildRequires:  ghc-unix-prof
-BuildRequires:  ghc-utf8-string-prof
+Requires:       %{pkg_name}-basic = %{version}-%{release}
 Requires:       %{pkg_name}-config = %{version}-%{release}
 
 %description
 %{common_description}
 
-This is a meta-package that installs xmonad-core and ghc-xmonad-contrib-devel,
-allowing xmonad to be configured with "~/.xmonad/xmonad.hs".
+This is a meta-package that installs xmonad-basic and ghc-xmonad-contrib-devel,
+allowing xmonad to be customized with "~/.xmonad/xmonad.hs".
 
 To use xmonad with GNOME, please install xmonad-gnome.
 
 
-%package core
+%package basic
 Summary:        A tiling window manager
+Requires:       %{pkg_name}-core = %{version}-%{release}
 # required until there is a command to open a system-default xterminal
 Requires:       xterm
 Requires:       dmenu
+Obsoletes:      %{pkg_name}-core < 0.10-3.8
+
+%description basic
+%{common_description}
+
+This meta-package allows running the default basic upstream xmonad
+configuration with xterm and dmenu.
+
+If you want to customize xmonad, please install xmonad or xmonad-gnome.
+
+
+%package core
+Summary:        A tiling window manager
 # for xmessage
 Requires:       xorg-x11-apps
 
 %description core
-This package contains the core xmonad window manager.
+This package just provides the core xmonad window manager program.
 
-If you want to configure xmonad please also install either xmonad or xmonad-gnome.
+To run the default xmonad configuration you should install xmonad-basic.
+If you want to customize xmonad please install either xmonad or xmonad-gnome.
 
 
 %package config
@@ -77,7 +95,7 @@ Requires:       ghc-%{pkg_name}-devel = %{version}-%{release}
 Requires:       ghc-xmonad-contrib-devel
 
 %description config
-This package adds desktop configuration for xmonad.
+This package provides a basic desktop configuration for xmonad.
 
 
 %package gnome
@@ -95,6 +113,8 @@ in a GNOME session.
 
 %prep
 %setup -q
+%patch1 -p1 -b .orig
+%patch2 -p1 -b .orig
 cp -p %SOURCE4 .
 
 
@@ -134,13 +154,16 @@ rm %{buildroot}%{_docdir}/%{name}-%{version}/LICENSE
 %files
 
 
+%files basic
+%{_datadir}/xsessions/%{name}.desktop
+
+
 %files core
 %doc CONFIG LICENSE README man/%{name}.hs README.fedora
 %attr(755,root,root) %{_bindir}/%{name}
 %attr(755,root,root) %{_bindir}/%{name}-start
 %{_mandir}/man1/%{name}.1*
 %{_datadir}/applications/%{name}.desktop
-%{_datadir}/xsessions/%{name}.desktop
 
 
 %files config
@@ -157,6 +180,14 @@ rm %{buildroot}%{_docdir}/%{name}-%{version}/LICENSE
 
 
 %changelog
+* Fri Dec  7 2012 Jens Petersen <petersen at redhat.com> - 0.10-3.8
+- add upstream patches for ICCCM WM_TAKE_FOCUS protocol and
+  tracking currently processing event to fix focus for Java apps:
+  see http://code.google.com/p/xmonad/issues/detail?id=177 (#874855)
+- update to cabal-rpm packaging
+- allow building with X11-1.6
+- backport xmonad-basic subpackaging
+
 * Thu May 31 2012 Jens Petersen <petersen at redhat.com> - 0.10-3.7
 - really fix xmonad-start to use hardware-platform correctly
 


More information about the scm-commits mailing list