-
Notifications
You must be signed in to change notification settings - Fork 25
Preparations for migration to gtk3 #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
I'll get the CI passing, hopefully later today. Probably need to set a higher gtk2 version that has the new widgets that replace the deprecated ones. Edit: No, it was just a mistake 😄. |
1ace716
to
a797f66
Compare
Hey, thanks for picking up this longstanding todo item! I've never really worked with gtk either (well, apart from patching things around in this project), and I think I started once or twice a "gtk3" branch, but as you said it's not just about replacing old funcs with new ones, some concepts are completely different between gtk2 and gtk3, and need to be rebuilt from the ground up. You seem to be further that I've ever been in my past attempts, so let's do it!
Sure, I think I might even have a few "test" CDs/DVDs on which I did put dvdisaster recovery data then physically damaged them to be able to test properly. I'll not have much time today but'll give it a go tomorrow. About the CI, don't hesitate to push/force-push as much as you need to trigger the workflows. Currently the Linux one seems to be passing, but not the Windows or mac ones. For Windows it's using msys2/mingw-w64 to be able to produce a .exe, and figuring the dependencies is indeed a PITA. If you have something that compiles under Linux, which seems to be the case so far, don't bother too much with the Windows or macos parts, I'll handle those if needed. |
Thank you! I can probably figure out the CI this evening. |
d114b9b
to
d5d5268
Compare
I've booted an Ubuntu 22.04 live usb, compiled your branch and tried several things. Most of the panels & windows seem to behave correctly, which is excellent news! I only pinpointed two issues so far. I'm having a weird behaviour on the "read" (and "scan") tabs, linked to the spiral and its labels. At each refresh, the spiral and the labels go up a few pixels, until they're not visible anymore. It seems to happen because in dvdisaster/src/read-linear-window.c Line 293 in 3be61f4
I'm also getting some SIGSEGVs with different backtraces each time, when enabling "read and analyse raw sectors" and running a scan on a disc with a lot of C2 errors. I suspect this is linked to the label text updates on the bottom of the window, which is updated a lot in this case (EDIT: probably not, it still crashes when commenting C2-specific labeling code). It looks like the memory is silently corrupted and at some point it ends up crashing. I haven't looked at it too much yet, but here are some backtraces for reference:
If you want, you may also remove the Thanks a lot! |
9d9fafd
to
99ff794
Compare
Thank you so much for testing!
Oops, the function responsible for updating the geometry of the curve was changing the spiral center. And the re-use of
I can not reproduce the segfaults reliably, bud did manage it at least once and also got a few suspicious error messages. I suspect it was caused by a call to update the spiral widget from a different thread than the main thread, and is hopefully fixed now.
Wow! Ca. 4000 lines of warning output. With the later commits I've got it down to 1200 lines by now, still some more to go. |
Can confirm this is fixed!
I can no longer trigger the SIGSEGVs with the method I previously used. It would usually crash in less than 5 seconds after the scanning started, but now I can't trigger a single one with 10+ minutes of scanning, so it sounds pretty good.
Oops, I didn't remember there were so many! That's probably why I silenced them and focused on fixing all the other warnings that came with the upstream version... Thanks for making the codebase better! About the "raw editor" you referenced in an earlier comment, it's actually hidden, you have to start the program with the In the next few days I'll try to test the GUI more extensively (i.e. creating all ECC types, repairing all types, etc.). I might just have stumbled upon the somehow random segfaults you mentioned:
But I wasn't running under gdb... I'll try to reproduce that better. (sorry about the PR close/open, just a misclick) |
Ah, cool. The dialog seems quite happy to read unitialized memory or segfault if you don't have any raw sectors (on the main branch). |
I suspect the upstream dev was the main user of this dialog!
Well, I have an iHAS324 F CL8N, and a WH16NS58 with the famous vinpower firmware 1.V5 (which supports PIF/POF PIE/POE C2 scans & co, it's actually a crossflashed WH16NS55). None of them seem to support raw reads either, with 0x20 or 0x21 read modes. I also have an external USB one, but there's zero chance it does support it either. So, I crafted a fake file which we can use to test this dialog, it has 10 sectors filled with random data, with the header that dvdisaster expects. I suspect drives supporting raw reads are now very rare, so, well, I guess the file will have to do the trick! |
4b715c8
to
95fa3f4
Compare
Sorry for the little communication. Is PR is getting into shape, but is not quite there yet. The warnings for deprecated items in gtk3 are mostly taken care of, mostly a few icon-related ones are left. What do you think about splitting this up to make it more manageable? Then I'll make a separate PR with all the preparations that are not drawing-related. One other question: We currently have a preference to switch the Ok/Cancel button order of dialogs. That does not seem like something people get exited about, and uses deprecated functions (and has become impossible for the file picker in gtk3. Remove it? |
No worries, take the time you need!
This is probably a good idea. In any case, I'll NOT squash the PR, keeping all your commits is clearly better for future readability of the changes you made. Obviously this will also help a lot my review. Maybe we need a
Yes. Before your changes, I was trying to limit the number of changes I made to ease rebasing over potential future upstream commits, but even if upstream development shortly resumed in 2021 (mainly upstreaming some of my changes), nothing happened since, so I think the balance between "keeping the changes minimal to ease rebasing" versus "making the necessary changes to ease future maintenance" now clearly tilts over the second option. If some commits appear upstream in the future, I suspect they wouldn't be dramatic changes anyway, so I'll still be able to reapply them more "manually" than just using This is also the reason why I didn't use a C formatting tool to standardize the spaces/tabs (you probably noticed there's a mix of both) and the somehow exotic indentations. I'll probably end up doing that sometime in the future as "keeping the diff with upstream minimal" is no longer a thing with your PR porting the codebase to gtk3. |
Great, I'll open a first PR tomorrow. I think just a gtk3 branch is not really needed because except for the the commit to switch to gtk3 and the one after that everything is incremental and builds and runs like it should. |
And I've noticed the indentation 😄. My editor doesn't like it and works against me. |
I've spent way too many hours this weekend into making the AppImage work under gtk3. I also fixed a few related shenanigans here and there, and hopefully also fixed #92 in the process. I had to heavily intervene into the AppImage bundling procedure, even going as far as hex-patching the gio lib has it has hardcoded paths that point to the host and it can't be changed at runtime. Anyway, I have something that works quite nicely on top of this PR, tested under Ubuntu 18.04, 20.04, 22.04 and 24.04, so I'm quite confident this AppImage version will be quite resilient. I also added a continous build version that will push a pre-release with pre-built binaries under all OSes each time a new commit is pushed to master. Once you have your first PR up and after it's merged, I'll rebase my own PR on top of it, merge it, and you should be able to rebase on top of that one. I'm not expecting conflicts as I'm almost not touching the code itself. |
d0faf00
to
a0b622d
Compare
Nice! This should finally be ready. To add some comments to the commits:
|
Oops, interesting. On first run |
`kIOMasterPortDefault` is deprecated since macOS 12.0. One alternative is to use named constant `kIOMainPortDefault` which is not available before macOS 12.0. Both named constants are just an alias for `NULL`, so it is simpler to use it directly instead.
a0b622d
to
0458425
Compare
I don't really know how to properly work with |
Thanks, hopefully it'll be a minor quirk, one from the "oh, dammit!" quirks category. On a somehow unrelated note, as we're now very close to complete the switch to gtk3, and given the amount of work we're talking about, would you be ok with me referencing you in the https://github.com/speed47/dvdisaster/blob/master/CREDITS.en file? I never added my own name (I'm not that narcissistic), at some point upstream did, and as their return is unknown, I feel like this should be done. I'm asking because I don't want to add your name without having your permission first, so, just tell me whether you would NOT have your name added to it. :) |
O, thank you 😄. And for being patient above all. I don't mind either way, I just code for hobby and not for any recognition. |
You already made an edit, but just in case: I choose to go with the gresources route because it should work like before with an appimage; no extra files that need to be included. |
The tricky part is that you had to rename Your fix seems to do the trick indeed, pushing to |
So, I have something that is somehow cleaner, or at least that doesn't require to modify the files during the I've rebuilt binaries with this change, it seems to work even when swapping between "gui" and "cli" during the I've noticed however that the "read" button doesn't appear correctly, it seems that you named the file (and the resource) The Windows version doesn't show any icons either, even with both these fixes, but it seems to be a Windows thing. I found some references online indicating that the icons are searched in the current directory (different pathnames are tried), so maybe we'll need to include the icons in some way in the Windows zip, but it's non-blocking for this PR. |
Thank you, great!
As a little trick I made this one a symbolic icon, following the documentation in https://developer.gnome.org/documentation/tutorials/themed-icons.html#symbolic-icons. In a dark theme the text will turn white. Can you tell me in what way it doesn't appear correctly?
Strange. I am not sure what to do, it works on my Windows setup. Because the icons are compiled in paths should not matter. |
0458425
to
67e9868
Compare
Ah, interesting! I'll try that again to have something that can be reproduced (also, see below).
Well, I've gone into the rabbit hole of icon themes under gtk3, such as using an |
It has been a dozen years since I last wrote more than a couple of lines in C, and this is my first time working with gtk...
But just for fun I would like to make dvdisaster look ok on high-dpi monitors, and migrating to gtk3 is a first step.
This follows migration the guide https://docs.gtk.org/gtk3/migrating-2to3.html
The first couple of commits switch from deprecated to new widgets. Then two commits to use accessor functions instead of direct access.
In 8774d3d I couldn't find a replacement to disable line wrapping for message dialogs, and thought this is not the most critical thing to keep.
Next is the harder part: switching drawing operations to cairo. The problem is not translating the old methods to their replacements. We have to switch to a different model where drawing only happens inside the
expose
callback.The existing code expected to be able to draw to an area whenever there was something to update, and it had efficient update routines that draw on top of the already drawn curve/spiral. The new gtk3 model expects widgets to just completely redraw their contents when they need to update, and to do so during the callback. I removed the update routines and only kept the functions that redraw the entire curve/spiral. I doubt this code was performance-critical even back when it was written. And it doesn't play very nice with anti-aliasing.
One change I did make to not have the drawing operations be too wasteful is to split the drawing area of the curve and spiral in the read linear window. When the spiral has to be redrawn we don't need to redraw the curve and visa-versa.
All of this still compiles with gtk2 and every commit should compile on its own. All other changes have to happen all at once with the switch to gtk3. I have not figured out that part yet 🤣. For the next PR.
Setting as draft for now because I would like to test it some more. But when it comes to testing I have a problem: I don't really use dvdisaster for its intended purpose. I don't even have writable media and don't know what window the raw editor is. Could you help test that all tabs/windows look ok? For the graph area I did compare screenshots to make sure the axis where a pixel-perfect match.