Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions GUI/EventsView.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
) where

import GHC.RTS.Events
import Debug.Trace

import Graphics.UI.Gtk hiding (rectangle)
import Graphics.Rendering.Cairo
import qualified GUI.GtkExtras as GtkExt
import GUI.ViewerColours

import Control.Monad
import Control.Monad.Reader
import Data.Array
import Data.Monoid
import Data.IORef
Expand Down Expand Up @@ -68,8 +66,6 @@
vScrollbar <- getWidget castToVScrollbar ("eventsVScroll" :: T.Text)
adj <- get vScrollbar rangeAdjustment

-- make the background white
widgetModifyBg drawArea StateNormal (Color 0xffff 0xffff 0xffff)
widgetSetCanFocus drawArea True
--TODO: needs to be reset on each style change ^^

Expand Down Expand Up @@ -291,7 +287,7 @@


(Rectangle _ _ width _) <- widgetGetAllocation drawArea
let clipRect = Rectangle 0 0 0 0

Check warning on line 290 in GUI/EventsView.hs

View workflow job for this annotation

GitHub Actions / GHC 9.2 on ubuntu-latest

Defined but not used: ‘clipRect’

Check warning on line 290 in GUI/EventsView.hs

View workflow job for this annotation

GitHub Actions / GHC 9.6 on ubuntu-latest

Defined but not used: ‘clipRect’

Check warning on line 290 in GUI/EventsView.hs

View workflow job for this annotation

GitHub Actions / GHC 9.4 on ubuntu-latest

Defined but not used: ‘clipRect’

let -- With average char width, timeWidth is enough for 24 hours of logs
-- (way more than TS can handle, currently). Aligns nicely with
Expand All @@ -306,8 +302,7 @@
sequence_
[ do when (inside || selected) $
renderWithDrawWindow win $ do
-- TODO: figure out how I can grab the correct color from GTK's style
setSourceRGBA 0.2 1 1 0.2
setSourceRGBAForStyle styleGetBackground style state1
rectangle 0 y (fromIntegral width) lineHeight
fill

Expand All @@ -316,6 +311,7 @@
layoutSetAlignment layout AlignRight
layoutSetWidth layout (Just (fromIntegral timeWidth))
renderWithDrawWindow win $ do
setForegroundColor style state2
moveTo 0 y
showLayout layout

Expand All @@ -324,6 +320,7 @@
layoutSetAlignment layout AlignLeft
layoutSetWidth layout (Just (fromIntegral descrWidth))
renderWithDrawWindow win $ do
setForegroundColor style state2
moveTo (fromIntegral $ timeWidth + columnGap) y
showLayout layout

Expand All @@ -333,7 +330,7 @@
inside = maybe False (\ (s, e) -> s <= n && n <= e) mrange
selected = cursorPos == n
(state1, state2)
| inside = (StatePrelight, StatePrelight)
| inside = (StateSelected, StateSelected)
| selected = (state, state)
| otherwise = (state, StateNormal)
]
Expand All @@ -349,6 +346,7 @@
Message msg -> TB.fromText msg
UserMessage msg -> TB.fromText msg
_ -> buildEventInfo spec
setForegroundColor = setSourceRGBAForStyle styleGetForeground

-------------------------------------------------------------------------------

Expand Down
8 changes: 8 additions & 0 deletions GUI/ViewerColours.hs
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,11 @@ setSourceRGBAhex (Color r g b) t
(fromIntegral b/0xFFFF) t

-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
setSourceRGBAForStyle :: (Style -> StateType -> IO Color) -> Style -> StateType -> Render ()
setSourceRGBAForStyle getColor style state = do
color <- liftIO $ getColor style state
setSourceRGBAhex color 1

-------------------------------------------------------------------------------
Loading