Logs: liberachat/#xmonad
| 2023-04-17 23:13:15 | <JonathanWatson[m> | oh get_window probably |
| 2023-04-17 23:13:21 | <geekosaur> | every event has an `ev_window` |
| 2023-04-17 23:15:11 | <JonathanWatson[m> | when we get a mapNotify event, what mask do we give the window? |
| 2023-04-17 23:15:36 | <geekosaur> | structureNotifyMask .|. exposureMask |
| 2023-04-17 23:15:48 | <geekosaur> | same as for the existing windows when you start up |
| 2023-04-17 23:16:55 | <geekosaur> | anyway an event is a Haskell record which has multiple fields that you can access in the usual way |
| 2023-04-17 23:17:29 | <JonathanWatson[m> | ok so this is my new code... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/8de1961fc197cb923ba05f03d0cae1c24793a2e5>) |
| 2023-04-17 23:17:40 | <geekosaur> | https://hackage.haskell.org/package/X11-1.10.3/docs/Graphics-X11-Xlib-Extras.html look for MapNotifyEvent |
| 2023-04-17 23:18:40 | <JonathanWatson[m> | oh i see |
| 2023-04-17 23:20:38 | <JonathanWatson[m> | > <@jjw:matrix.org> ok so this is my new code... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/1fa31d40d7ff8269f48c039938c897c9961c3406>) |
| 2023-04-17 23:20:38 | <JonathanWatson[m> | but its not giving anything anymore |
| 2023-04-17 23:20:40 | <lambdabot> | <hint>:1:1: error: parse error on input ‘<@’ |
| 2023-04-17 23:20:59 | <geekosaur> | did you do something like switching workspaces? |
| 2023-04-17 23:21:55 | <JonathanWatson[m> | i run it in workspace 1 every time and stay in there |
| 2023-04-17 23:23:15 | <JonathanWatson[m> | very strange |
| 2023-04-17 23:23:36 | <JonathanWatson[m> | > <@jjw:matrix.org> ok this is my code now... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/0769027e9da25bf11d789efaf2e9714ae49a67e4>) |
| 2023-04-17 23:23:37 | <lambdabot> | <hint>:1:1: error: parse error on input ‘<@’ |
| 2023-04-17 23:23:51 | <JonathanWatson[m> | well it printed some of the expose events |
| 2023-04-17 23:25:00 | <geekosaur> | you won't see anything |
| 2023-04-17 23:25:11 | <geekosaur> | as I said, you don't get events at all just for draws |
| 2023-04-17 23:25:28 | <geekosaur> | Expose means a new (region of a) window has become visible |
| 2023-04-17 23:25:56 | <geekosaur> | in a tiling wm, you don't get many Expose events unless you close a floating window |
| 2023-04-17 23:26:17 | <geekosaur> | you will pretty much only get events for opening a new window, closing an existing window, or switching workspaces |
| 2023-04-17 23:26:25 | <geekosaur> | this is pretty much the nature of tiling wms |
| 2023-04-17 23:26:43 | <JonathanWatson[m> | well it ran sometimes when i did next layout (alt+space) |
| 2023-04-17 23:26:58 | <geekosaur> | and when it comes down to it, if your intent is to benchmark a window manager, that's all you really care about |
| 2023-04-17 23:27:15 | <geekosaur> | right, that'll alter what windows are visible and how |
| 2023-04-17 23:27:36 | <geekosaur> | but no expose events because we pretty much show either all or none of a window |
| 2023-04-17 23:27:48 | <geekosaur> | and an expose event is about part of a window |
| 2023-04-17 23:28:55 | <geekosaur> | well, not entirely true, Tabbed layouts will produce whole-window expose events. but Full won't because it unmaps instead of hiding |
| 2023-04-17 23:31:32 | <JonathanWatson[m> | oh ok |
| 2023-04-17 23:31:44 | → | malook joins (~Thunderbi@46.52.55.36) |
| 2023-04-17 23:32:08 | <JonathanWatson[m> | so i think i should also detect unmaps |
| 2023-04-17 23:33:11 | <JonathanWatson[m> | i have checkTypedEvent display mapRequest xEventPointer but its never true |
| 2023-04-17 23:33:46 | <JonathanWatson[m> | i suppose i want to check for unmapNotify |
| 2023-04-17 23:36:51 | <JonathanWatson[m> | i think there is a flaw in my code |
| 2023-04-17 23:36:56 | <JonathanWatson[m> | "The XCheckTypedEvent() function searches the event queue and then any events available on the server connection for the first event that matches the specified type. If it finds a match, XCheckTypedEvent() removes that event, copies it into the specified XEvent structure, and returns True . The other events in the queue are not discarded. If the event is not available, XCheckTypedEvent() returns False , and the output buffer will have |
| 2023-04-17 23:36:56 | <JonathanWatson[m> | been flushed." |
| 2023-04-17 23:37:15 | <JonathanWatson[m> | so it doesn't actually check the event from nextevent but actually checks the whole queue |
| 2023-04-17 23:37:44 | <JonathanWatson[m> | and the second checkTypedEvent never happens if there's an expose event at any point in the queue |
| 2023-04-17 23:39:12 | <geekosaur> | hm, right |
| 2023-04-17 23:40:44 | <geekosaur> | well, except the second part is wrong, it will first look for expose events and give you the first it finds, then it will look for MapNotify, then you want to look for UnmapNotify, then you want to nextEvent to clear the topmost event which is apparently none of the above |
| 2023-04-17 23:40:46 | <geekosaur> | then loop |
| 2023-04-17 23:41:00 | → | catman joins (~catman@user/catman) |
| 2023-04-17 23:42:51 | <JonathanWatson[m> | this is my latest iteration... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/d5fe7d114c25baed420f096ac9133a7a25259a64>) |
| 2023-04-17 23:43:09 | <JonathanWatson[m> | i don't think nextEvent is needed at all |
| 2023-04-17 23:43:16 | <JonathanWatson[m> | ? |
| 2023-04-17 23:43:45 | <JonathanWatson[m> | not sure what "output buffer will have been flushed" means |
| 2023-04-17 23:45:16 | <geekosaur> | if none of the `checkTypedEvent`s gave you an event then you need to possibly discard an event |
| 2023-04-17 23:45:34 | <geekosaur> | because there are other events you might receive that aren't the ones you're looking for |
| 2023-04-17 23:46:32 | <JonathanWatson[m> | yeah i'm thinking i can just run flush if all of them return false |
| 2023-04-17 23:49:27 | <geekosaur> | o.O I wonder if they actually mean the input queue; there's no "output buffer" |
| 2023-04-17 23:52:07 | <geekosaur> | actually, hm, in that case you would in fact not be able to do the second check (and the whole thing becomes difficult at best) |
| 2023-04-17 23:52:21 | <JonathanWatson[m> | yes |
| 2023-04-17 23:53:03 | <geekosaur> | https://tronche.com/gui/x/xlib/event-handling/manipulating-event-queue/XMaskEvent.html |
| 2023-04-17 23:54:07 | <JonathanWatson[m> | probably better |
| 2023-04-17 23:54:13 | <geekosaur> | and, well, I don't think you so much care about the actual event tyepe except insofar as you need to XSelectInput on a MapNotify |
| 2023-04-17 23:54:54 | <geekosaur> | any of the StructureNotifyMask/SubstructureNotifyMask/ExposureMask events indicate window manager activity |
| 2023-04-17 23:55:34 | <JonathanWatson[m> | i am wondering what is the difference between XMaskEvent and XCheckMaskEvent |
| 2023-04-17 23:55:54 | <geekosaur> | https://tronche.com/gui/x/xlib/event-handling/manipulating-event-queue/selecting-using-window-or-event-mask.html |
| 2023-04-17 23:58:07 | <geekosaur> | the remaining issue is finding out when activity from xmonad has ended. the classic but not really Haskell solution is you select() on the server socket with a timeout, and track the time when each select() returns so you know when all the activity finished |
| 2023-04-17 23:59:07 | <geekosaur> | the more Haskelly equivalent is to do the X stuff in a thread with results posted to a Chan, and the main program kills the thread after the timeout (see the async library) |
| 2023-04-18 00:00:44 | <geekosaur> | (use race, thread 1 does threadDelay 5000000 and exits, thread 2 opens the display and records events and timestamps in the Chan) |
| 2023-04-18 00:01:23 | <geekosaur> | then the main thread harvests from the Chan and the timestamp of the last event read is when xmonad finished |
| 2023-04-18 00:03:11 | × | malook quits (~Thunderbi@46.52.55.36) (Quit: malook) |
| 2023-04-18 00:04:17 | <JonathanWatson[m> | sounds good i'll give that a go |
| 2023-04-18 00:07:35 | <JonathanWatson[m> | <geekosaur> "(use race, thread 1 does..." <- although ideally thread 1 would restart the timer every time the Chan is posted to |
| 2023-04-18 00:08:18 | <geekosaur> | I wouldn't say so, a timeout of 5-10 seconds should be fine |
| 2023-04-18 00:08:29 | <JonathanWatson[m> | fair enough |
| 2023-04-18 00:08:41 | <JonathanWatson[m> | also since we only care about the last timeout wouldn't it be better to use an MVar? |
| 2023-04-18 00:08:46 | <geekosaur> | unless you're testing with 10000 windows in which case you will discover that the StackSet was a bit of a mistake 🙂 |
| 2023-04-18 00:09:04 | <geekosaur> | mm, probably |
| 2023-04-18 00:09:07 | <JonathanWatson[m> | well actually |
| 2023-04-18 00:09:26 | <geekosaur> | (the StackSet is backed by a pair of lists. large lists are slow |
| 2023-04-18 00:09:28 | <geekosaur> | ) |
| 2023-04-18 00:09:47 | <JonathanWatson[m> | that's a good point i'm more going for a small number of windows but lots of operations |
| 2023-04-18 00:11:06 | <JonathanWatson[m> | but ideally i would want the time to be nearer the 1 minute mark so its easier to see the differences when the program gets slower |
| 2023-04-18 00:11:21 | <JonathanWatson[m> | and i get nicer error bars |
| 2023-04-18 00:18:30 | × | catman quits (~catman@user/catman) (Ping timeout: 255 seconds) |
| 2023-04-18 00:25:34 | × | hightower3 quits (~hightower@213.149.61.95) (Read error: Connection reset by peer) |
| 2023-04-18 00:25:59 | → | hightower3 joins (~hightower@213.149.61.95) |
| 2023-04-18 00:40:25 | × | ft quits (~ft@i59F54987.versanet.de) (Ping timeout: 240 seconds) |
| 2023-04-18 00:42:23 | → | ft joins (~ft@87.122.11.39) |
| 2023-04-18 00:53:58 | <JonathanWatson[m> | i've been stuck on this for a while... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/1e233b4267194150308a715065a48e7cc1186a71>) |
| 2023-04-18 00:54:24 | <JonathanWatson[m> | timeout 1000000 (takeMVar lastTimestampVar) doesn't seem to actually timeout |
| 2023-04-18 00:55:02 | <JonathanWatson[m> | i have to press alt+space before it actually decides to go down the Nothing branch |
| 2023-04-18 00:55:12 | <JonathanWatson[m> | * i've been stuck on this for a while... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/9ed66cf078b16abf1bc4ff6f74d586a7ec266be2>) |
| 2023-04-18 00:55:30 | <JonathanWatson[m> | which is very ood |
| 2023-04-18 00:55:40 | <JonathanWatson[m> | * which is very odd |
| 2023-04-18 00:56:06 | <JonathanWatson[m> | * i've been stuck on this for a while... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/f0b49a02c3153aa5faee4c1c6c4edbb360a9f87c>) |
| 2023-04-18 00:56:59 | <JonathanWatson[m> | this is despite the print t not doing anything after the benchmark |
| 2023-04-18 00:58:56 | <JonathanWatson[m> | i can only assume something to do with async |
| 2023-04-18 01:12:12 | <JonathanWatson[m> | ok i think `False -> return ()` was running too often |
| 2023-04-18 01:12:28 | <JonathanWatson[m> | and also i didn't put flush in it which is probably fine but it definitely needs a sleep |
| 2023-04-18 01:14:35 | <JonathanWatson[m> | well i have a benchmark now |
| 2023-04-18 01:14:44 | <JonathanWatson[m> | @geekosaur thank you so much for the help |
| 2023-04-18 01:14:45 | <lambdabot> | Unknown command, try @list |
| 2023-04-18 01:15:21 | → | catman joins (~catman@user/catman) |
| 2023-04-18 02:08:25 | × | td_ quits (~td@i53870920.versanet.de) (Ping timeout: 240 seconds) |
| 2023-04-18 02:10:31 | → | td_ joins (~td@i53870902.versanet.de) |
All times are in UTC.