Wednesday, January 25, 2012

In OS X, SDL only delivers messages to the first thread?

I was trying to get a Rockbox simulator working in OS X. After dealing with a bunch of other issues, I got an executable which displays a beachball cursor and doesn't respond to input.  I found a post that claimed events sent to the app are only dispatched to the main thread. Then I rearranged code so the main thread initializes the video and handles messages and input worked properly.

The SDL documentation claims SDL_WaitEvent() can only be called from "thread that set the video mode". This is apparently not a sufficient condition for OS X.

Tuesday, January 24, 2012

The Linux desktop still dissapoints

I used to use Linux as my main OS from 1995 to 1999. Back then, Windows was an unstable piece of garbage, and I liked Linux. In Linux I faced relatively few problems, and it was possible to solve those and have a good stable system.

Windows became good starting with Windows 2000. It was stable, it ran software that had no Linux equivalents, and it had a decently designed GUI. Windows continued to get better, and I'm now very happy with Windows 7.

Starting about a year ago, I tried out various Linux distributions including Mint 10, Mint Debian Edition, Debian Testing, Xubuntu and Ubuntu. Overall, I'm disappointed. The Linux desktop still can't compete with Windows.

I used to think that free software had great potential because the ability to reuse components and code makes software development much more efficient. Instead, I see countless alternatives for the same thing, and re-implementations which replace good software with works in progress. As a result, the Linux desktop doesn't improve very much and new problems appear constantly.

The best current example is Gnome. Version 2 was inferior to Windows in some ways, but it was good enough and usable. Then, it was dramatically changed, stripping out many features, and even removing the ability to use other software such as XScreenSaver and Compiz. Some parts of the Gnome 3 user experience are an improvement, but overall it is not an improvement because of what was removed. This resulted in Gnome forks, and maybe also Unity.

Here's a list of some other things I encountered in Linux:
  • Linux Mint is not upgradeable, or maybe it's upgradeable but a clean install is highly recommended
  • Linux Mint Debian Edition has been holding back updates for months, despite claiming to offer a "rolling distribution based on Debian Testing".
  • Writes to slow USB devices hang other file system accesses
  • Gnome 3 won't automount devices in Debian Wheezy
  • The suspend button suddenly stopped working in Xubuntu
  • Compiz crashes a few times at startup
  • Thunar won't warn when copying files into a destination with insufficient space
  • Thunar shows errors when unmounting removable devices
  • Debian Wheezy comes with ugly default configurations and horrible font rendering
  • The XScreenSaver screen unlock dialog locks up, requiring a kill -9 from another console. The dialog is also ugly and primitive.
  • Sometimes XScreenSaver locks the screen even when told not to
  • The Xfce applications menu is worse than Windows 95. It doesn't have editing functionality, and it silently ignores *.desktop files that are accepted by other parts of the system.
  • In Debian and Ubuntu, Audacious comes without the ffaudio plugin, so it doesn't support APE and some other formats.
  • Audacious changed the plugin API, so it can't use plugins written for an old version
  • Compiling things is a pain because of all the dependencies. For example, Audacious 3.2 requires very recent versions of libavcodec and huge numbers of other stuff
  • Several distributions choose and integrate Empathy as the IM client, even though it lacks important features.
  • Several distributions won't automatically disable the nouveau driver when installing the Nvidia driver, leading to a lockup
  • The Xfce desktop icons aren't managed by the file manager, leading to all sorts of inconsistencies
  • mintMenu has various bugs and bad design choices which make it harder to use
  • The Gnome 3 time setting dialog won't report time sync problems
  • Xfce doesn't seem to offer a way to change default PulseAudio devices
  • Many less popular packages are old or broken
  • Many things don't work in OpenJDK, which is the default, and Oracle Java locks up Firefox when Adblock Plus is enabled.
  • Shutdown and restart doesn't work from the Xubuntu login screen
  • Distributions may silently insert customizations into my Firefox profile even if I copy the profile from Windows.
  • Improper display of some partially transparent images in Firefox
  • Package setups which make it hard to uninstall applications which were installed by default
  • Default application setting screens which don't work
  • Ability to customize the same thing separately in two different places, resulting in a conflict
  • Limited drag and drop support and context menu support
  • Debian still prompts in the middle of the install process
  • A bunch of programs can automatically change desktop backgrounds, but none are as nice as what's built into Windows and OS X
  • Trash can't be disabled on a device
  • Mysterious Samba failures
  • The r8169 driver is broken in Linux Mint Debian Edition, requiring a manual install of the r8168 driver from Realtek, with some Makefile editing
  • In every distribution I tried, the fonts installed by default make many websites look terrible
  • Gnash is installed by default, even though it doesn't work very well and Flash is is used in many places on the web
  • In Thunar, the there's a very subtle difference in appearance between mounted and unmounted volumes. Unmounted volumes even have the eject icon.
  • When unmounting, Xfce notifications that data still needs to be written sometimes remain on the screen.
  • Ubuntu Software Centre shows some applications twice
  • I can't drag things to the Xfce Quicklauncher. Also, it crashes.
  • Xfce theming is not coordinated, so for example some themes make tray icons almost dissapear.
  • Samba sometimes fails to see or talk to shares which work from Windows. It even had problems talking to an older version of Samba.
  • KDE can't properly set GTK themes. They can be set manually, but KDE will overwrite the configuration file. GTK apps look very ugly in KDE without an appropriate theme.
  • Font kerning is sometimes crazy. For example, Tr can be too close together.
  • Font hinting is bad. Full hinting looks ugly in some popular fonts.
  • The KDE bouncing icon animation sometimes continues for far too long
  • I told Ark to extract to an smb:// path and it instead extracted elsewhere
  • Synaptic doesn't allow custom filters to be removed
  • Aptitude concludes a package conflicts with itself because it provides something it conflicts with. As a result, Aptitude wants to uninstall most things.
  • fsck.vfat is "unable to create unique name" unless certain options are given, and it may not fix all problems on the first run.

Thursday, January 19, 2012

Clutterbar fix for n3ON - v 1.0 skin for Winamp

n3ON is my favourite Winamp skin. I've used it for several years, and I'm not getting bored with it. I still feel it's attractive and even beautiful.

When I tried to use it with Audacious 3.1.2 in Linux, I got a white box to the left of the time display and visualization area. This is because n3ON does not provide an image for when the Clutterbar is hidden. The problem can be reproduced in Winamp by unchecking: Preferences -> Skins -> Classic Skins -> Classic Skin Options -> Always
show Winamp "Clutterbar" in main window. This part of the skin is documented on the Winamp wiki. (There it is called the CuttleBar.)

You can download a fixed n3ON skin.

I also created an alternate fix which keeps the same appearance even when the Clutterbar is hidden. It is not useful for Winamp, but it could be useful for other applications which can't show the Clutterbar. To use it, extract the .wsz (which is just a zip file) and replace TITLEBAR.bmp with the one from the alternate fix zip. You can then simply move the n3ON directory into the Skins directory.

n30N was created by deaddreamer, Wilhelm Steiner. He gave me permission to distribute this fix. Note that what I did is just a tiny bit of work; all the credit for this skin goes to him.

Wednesday, January 18, 2012

Don't try prelink in Debian

Prelink modifies executables and shared libraries on disk so they don't have to be modified every time they're loaded into memory. This should speed up program startup.

Unfortunately, I just tried it in Wheezy on amd64 and it's very broken. An attempt to do a prelink stops with an assertion failure. This could be avoided, if you figure out the what packages need to be excluded. In any case, you're left with an even more serious error: it can't undo many changes because it finds overlapping sections.

I'm disappointed that such a package is available in testing. The same package version can even be found in stable! If someone really wants to play with something this broken, they ought to have to get it from experimental.

Fortunately, this is easy to fix using debsums: simply find modified packages and reinstall them. I used: sudo debsums --changed --no-prelink | xargs dpkg --search | sed "s/:.*//" | sort | uniq | xargs sudo apt-get --reinstall install

Tuesday, January 17, 2012

Compiling Audacious 3.1.2 for Debian Wheezy

I'm used to organizing my music into folders the way I want, and playing it via a simple player. In Windows I use Winamp, and in Linux I used to use XMMS. Currently, the best choice in Linux seems to be Audacious. Unfortunately, Debian only has version 2.4.4, while the latest version is 3.1.2. Fortunately, it's not too hard to compile Audacious.

Almost all the build dependencies are available in Debian Wheezy. What's needed for building 2.4.4 can be obtained via "apt-get build-dep". In addition, libmpg123-dev is a must have, for MP3 playback. It's also a good idea to install libmodplug-dev and libbs2b-dev. You may also want libnotify-dev, but watch out: the libnotify plugin I built crashes things so badly I get back to the login prompt.

The only dependency which must be built is a newer version libmowgli. I configured it using the --prefix which I intended to use for Audacious. The other dependency you may want to build is libguess, for character set detection. It depends on libmowgli.

To deal with the dependencies, I simply used "export PKG_CONFIG_PATH=/opt/audacious/lib/pkgconfig" at the start of building. That causes pkg-config to automatically find what I install into /opt/audacious. There was just one problem with the installations: the directories created in /opt/audacious were only accessible for root. I ended up fixing that with "sudo find /opt/audacious -type d -print0 | sudo xargs -0 chmod a+rx" after each install.

After building and installing Audacious, you must build and install audacious-plugins. Like Winamp, Audacious is modular, and some plugins are required to actually do stuff with it. When the audacious-plugins configure script finishes, it gives you a long list showing what features will be compiled. That can be used to check if additional dependencies need to be installed.

If you have your own plugins in ~/.local/share/audacious/Plugins/ you may need to update them because the plugin API changed. Skins should just work, though I found a problem with my favourite skin, n3ON. The column in the top right of TITLEBAR.bmp had to be copied into the clear space beside it, so there are two columns side-by-side.

So far, the only problem I see is that the Desktop Notifications (libnotify) plugin totally crashes something and gets me back to the login prompt. That might just be a bug in something else.

You can download the amd64 binary of Audacious 3.1.2 for Debian Wheezy from Dropbox. It's not an actual package; just untar it in the root to create /opt/audacious, and then run /opt/audacious/bin/audacious. There is no need to add that to the path, and the right libmowgli is loaded automatically.

I don't intend to make a habit of this. It's just an experiment and a learning experience. It reminds me of the importance of Linux distributions and package maintainers, but it also reminds me how in Windows, if you want an application you can simply download it and install it.

Monday, January 16, 2012

A quick hack to make Synaesthesia work using PulseAudio

Synaesthesia is my favourite music visualization program. It can input audio that's being played using the EsounD esd_monitor_stream() function. That's broken when using PulseAudio in Debian Wheezy.  The call stops playback and the file descriptor never returns data. Here's a simple solution.

Comment out the EsounD opening code in openSound(), and just use pipeIn = 0 instead. This gets sound data from standard input. You can then provide input from the ALSA stereo monitor using something like: parec --latency=1 --format=s16le --device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor | synaesthesia esd

If your stereo monitor source is different, you may need to find it using pacmd. You may also need to unmute it. The --latency=1 stops parec from buffering a lot of data and then outputting it at once. The result works, though the high frame rate makes it a bit weird. Perhaps synaesthesia needs a frame rate cap?

Monday, January 09, 2012

Editing iPod partitions with GParted

The 5th generation (Video) iPod has two partitions: a proprietary firmware partition followed by a FAT32 data partition. In the MBR of iPods formatted for Windows, the firmware partition has type 0. GParted considers it to be unallocated space. Because of that, it can easily overwrite the firmware partition or its partition table entry. That would be bad, because the firmware partition is needed, even when booting Rockbox or iPodLinux.

I first used fdisk to change the firmware partition type to a non-zero value. Then I could safely work with GParted without any danger of overwriting the firmware partition. Finally, when I was done, I set the type back to zero. Fdisk warns that you probably shouldn't set the type to zero, but it's really supposed to be zero.