Saturday, November 29, 2014

Yesterday a Genius passed away

First thing, sorry for this completely non-technical post going to technical planets. If you don't want to ready about a completely emotional stuff, just stop reading now.

I'm a Brazilian that was born in the end of the 80's and grew up in the beginning of the 90's. Took me some time to have a telly at home, my parents were not so in favor of it. till the time they gave up following the religious rules ...
I remember the telly installed in a up corner of the room, it was a small one (14"). At that point I was experimenting a new world of four non-paid channels that we had access to. News, movies (from the 70's), culinary programs ... but one thing, in special, got my attention. It was a TV show about a "guy", with no name, with no family, living in a villa with: a poor widower dad and his smart daughter (the mom died during the birth), a middle-class widow mother and her spoiled son (the dad was a sailor that died in one of his travels), an old single woman (that loves the single dad), a teacher of the kids' school (in love with the single mom) and the owner of the villa, a rich and generous fat man that shows up every now and then to collect the rent, never paid by the widower dad. It was amazing, goddamn, it *is* amazing. A ~30 minutes episode (in Brazil we never had access to more than ~100 episodes), right after lunch, about this villa and the central character. The original name of the show is "El Chavo del 8". Episodes of "El Chavo del 8" where interleaved with episodes of "El Chapulín Colorado", a not strong, not smart, not fast, not powerful and not handsome hero, that always showed up to help anyone who asked for, usually in the most jumbled way, causing more confusion than actually helping. He was a perfect anti-hero. Goddamn, I cannot say how much I like these stupid TV shows. I remember my family sitting together and watching the Christmas special, the same one, for 10 years in a row. And it was better than the Christmas itself. Yesterday the genius who wrote these TV shows, and played the main character of both, passed way. Latino Americans with my age (+/- 10) are, for sure, sad today.
If you don't know this genius but are interested in: http://en.wikipedia.org/wiki/Chespirito
For those who feel the same pain, let's think that the man died, the legend will always be alive in our memories/hearts.



Buenas noches, maestro Bolaños!

Thursday, November 27, 2014

virt-viewer (using gtk3) for Windows

For the last few weeks I've been spending some time to have virt-viewer,
using gtk3, running on Windows. And it finally works!

Here is a not so brief description about the projects that I've hacked on (and the problems I've faced out during the process). if you're not interested in the process, just scroll down till the end of the email, where you will find the installer and a few instructions about what you need to generate the installer by yourself.

- msitools:
Apart from the broken build system on F21[0] and the wixl-heat generating the same ID for dirs used by other libraries/components[1] I have added .wxi files for the virt-viewer dependencies in order to have a build using gtk3. The dependencies are basically 3: 
- gtk3 itself[2]
- spice-gtk3[3]
- gtk-vnc2[4].
All the .wxi files were generated following the "How To" in the msitools webpage[5].
[0]: https://git.gnome.org/browse/msitools/commit/?id=c4c397438b797de4e68bb6d7fb891872db9e7bab
[1]: https://git.gnome.org/browse/msitools/commit/?id=41db587bae5a6c4cbc8f40a52bf2d6f25416653f
[2]: https://git.gnome.org/browse/msitools/commit/?id=c03676f95a348fd7da511355398f3a073400f819
[3]: https://git.gnome.org/browse/msitools/commit/?id=08cdc65a46f9eaaf49cd0acde0c3aaead341973d
[4]: https://git.gnome.org/browse/msitools/commit/?id=19c465b9f89583cdc905609abfd9cfb2c6beb26f
[5]: https://wiki.gnome.org/msitools/HowTo/CreateLibraryWxi

- virt-viewer:
Once that msitools has all the necessary bits included, it is time to hack a bit on virt-viewer and provide a way to generate the .msi file for virt-viewer using gtk3[6]. It is quite simple and basically a copy and paste from the file we already have been using for gtk2. just changing the dependencies and installation folder (just to avoid myself getting confused with the versions and so on).
[6]: https://fedorapeople.org/cgit/fidencio/public_git/virt-viewer.git/commit/?h=wip/msi-gtk3&id=4495b42a23ba5a795185bea0cadc540126b58751

After generate and install the .msi file on my Windows VM I crossed my fingers and ran remote-viewer!
Well, the results were not exactly the expected ones. A crash in libGdk-3.0.dll with no more info could be seen and also a lack of icons.

Okay, okay. First things first. Let me try to hunt this crash. Where can I start from? Hmmm. What about getting a debugger? :-)

- gdb:
Just got the binary from the mingw sourceforge webpage[7]
[7]: http://sourceforge.net/projects/mingw/files/MinGW/Extension/gdb/

Now I have the gdb, let me hunt the crash!
gdb.exe remote-viewer.exe ... and more problems! There were no debug-symbols in any of the packages I've been using ... and I need them!

- debugging:
 - approach 1 - -debug packages are your friends: well, not always. I've
installed the -debug packages and have added the new installed files
into the respective .wxi files. Then I've generated a new build and ... same crash, same poor info I had before (and nothing more). :-(
 - approach 2 - compile everything by yourself: this is what worked for me, but we have to agree that it's not exactly the most handy thing to do when you just want to debug something. Also, it inserted new bugs when launching the application, something about missing files that, for sure, were in the correct path. Anyways, it helped me to debug and I found that the Gdk crash could be avoided with a simple patch on spice-gtk[8].
[8]: http://cgit.freedesktop.org/spice/spice-gtk/commit/?id=b0703419bf15facc0527a81afbb3b07e67de909b

Yay! Now I have the virt-viewer working, but still no icons (apart from
the ones provided by virt-viewer itself).

For the icons problem, here is the basic solution:
- Build the .msi file using only the needed icons from the system installed adwaita-icon-theme. It works pretty well for virt-viewer, but if any other app tries to take advantage of the gtk3 on Windows, the app *must* have to do the same.

Yay, again! virt-viewer shows all the icons! Let's do some tests ... I've started by clicking in the menu options. The first one: "File -> Screenshot" ... and then crash!
Okay, this is an easy one. Basically I had to include the schemas.compiled[9] and schemas.dtd[10] into our gtk3 .wxi file, They are not being included because these files are not distributed with the .rpm, they are generated during the rpm's installation process.
[9]: https://fedorapeople.org/cgit/fidencio/public_git/msitools.git/commit/?h=wip/gtk3&id=e8990a125537ead4fad5d1adedc028cd72f5c932
[10]: https://fedorapeople.org/cgit/fidencio/public_git/msitools.git/commit/?h=wip/gtk3&id=97eefd9a3279a1766c81e54b0eb0e5660fece737

And now, finally, we are able to have a functional build of virt-viewer for windows using gtk3!

Do you want to try the build?
https://fidencio.fedorapeople.org/virt-viewer-gtk3-x86-2.0.msi
https://fidencio.fedorapeople.org/virt-viewer-gtk3-x64-2.0.msi

Do you want to build it by your self?
Okay, you'll need to:
- mingw-spice-gtk with my patch (build already pushed to f21):
https://fidencio.fedorapeople.org/mingw-spice-gtk/

- virt-viewer with my patches:
https://fedorapeople.org/cgit/fidencio/public_git/virt-viewer.git/log/?h=wip/msi-gtk3

Compile and install msitools from git. Install mingw-spice-gtk and gtk-vnc2 packages. Then, inside the virt-viewer folder, do:
 $ mingw32-configure --with-spice-gtk --with-gtk=3.0
 $ make
 $ make -C data/ msi-gtk3

Next steps:
- generate the gtk2 or gtk3 build according to the configure options.
- add support for foreign menu for Windows.