Closed j1warren closed 2 years ago
Ah. I use double-click behaviour (because why would you want it going to single tweet view when you just wanted to focus the window? 😁) so I hadn't noticed. But yeah, I can imagine that it might do that if we don't handle it correctly.
Looks like I need to implement something based on "States of a sequence" - https://valadoc.org/gtk+-3.0/Gtk.Gesture.html
Hm. Don't think it was fixed. I'm on 1.5 now. Still the same behavior. [ubuntu 20.04 / gnome 3.36] Looks like the button is below some 'tweet' overlay and it actually doesn't even get clicked upon. Seems like Clicking = Opening the tweet makes it try to download the image again for Tweet view and then it's cached everywhere.
Huh, odd. I'll check again, but I wasn't getting any "open the tweet" behaviour (although I did have to fake the "failed to load" situation)
Ah. Apparently the issue is that toggling the single vs double click behaviour doesn't change it straight away, so I was still testing with double-click behaviour and assumed it was okay.
Apparently going to the Tweet Info view is handled by a different event that isn't cancelled in the same way. I added a bit of logging and got:
(cawbird:22502): cawbird-WARNING **: 20:19:43.718: Forcing invalid media
(cawbird:22502): cawbird-DEBUG: 20:19:43.718: Message with type 34 on stream @IBBoard: null
(cawbird:22502): cawbird-DEBUG: 20:19:46.580: TweetListBox.vala:61: Gesture pressed in TweetListBox
(cawbird:22502): cawbird-DEBUG: 20:19:46.580: TweetListBox.vala:64: Got last in sequence
(cawbird:22502): cawbird-DEBUG: 20:19:46.740: MediaButton.vala:520: Claiming event sequence in MediaButton
(cawbird:22502): cawbird-WARNING **: 20:19:46.741: Forcing invalid media
(cawbird:22502): cawbird-DEBUG: 20:19:46.741: MainWindow.vala:60: Focus widget now: TweetListEntry 0x55f1515ff1c0
(cawbird:22502): cawbird-DEBUG: 20:19:46.741: DefaultTimeline.vala:71: Row activated
So it fakes an invalid image, the media button reloads the media (which is invalid again) and THEN the row gets activated, which makes it load the single tweet view.
This may require some restructuring of the code and events.
I've had to ask on the GTK forums, because this is a non-obvious mix of new and old style events.
Nothing on the GTK forum yet. I've just bumped it and asked some related questions about whether I'm doing it wrong (because maybe people won't know the right way but will know that it doesn't work nicely together)
My post on the forum was closed because either no-one knows how to fix it, or no-one cares about people struggling with events in GTK 😕
I'll have to see if there's anything else that I can work out. Hopefully the event handling from #170 might give me a clue.
Nowadays Cawbird 75% of the time looks like this in countries where it's semi-blocked (tweets are eventually loaded, but there are only so much retries for images), so it's important :)
Okay, I've FINALLY got this restructured so that it works. And fixed various segfaults and other issues from that rearchitect because some of the original design choices were weird. Just need to fix a layout issue and we should be fixed.
The answer to my GTK question appears to be "you can't cancel the events, but if you use the right combination of widgets (rather than trying to kludge too much into your own widget) then it all just magically works".
That is a massive commit!
Thank you for looking into it
It's mostly just cutting and pasting code into a new file 😁
I think it's mostly correct now. I'm going to run it on Cawbird Unstable to see how it does.
Oooops. I left some debugging code in there 😁 Might still need to work on the layout as well. I thought I'd fixed that, but not in the OBS builds 😕
Okay, I think this is done now. Just need to use it for a while and make sure there's no issues.
And I fixed Instagram loading while I was at it 🙂
Not had any issues yet. But then I don't remember the last time that I had an image not load!
I'll assume it's okay.
When the image in a tweet is not loaded there's a "Reload image" button.
Pressing it makes the Cawbird open the tweet that this image is in. Getting back shows that the button was activated on click.
So the bug is clicking that button shouldn't behave like a user also clicked on a tweet itself.