What Really Grinds My Gears
As many of you loyal readers are aware, gadgets have always been a bit of a sore spot with me. The reasons for this are many and varied, which is great since I need something to rant about this week. If you’re a normal citizen of the internet who claims to have ADD but really just doesn’t like to read past an introductory level, skip to the bottom for the executive summary.
“Gadgets” in E are insanely complex, and there is no real reason that I can determine as the sole cause (aside from gradual feature creep). Part of this complexity stems from the fact that we have three different types of gadget containers, also known as gadcons: shelves, toolbars (only used in EFM windows), and my eternal nemesis, gadman (desktop/overlay gadgets). Gadcon has a number of interfaces which allow it to theoretically work fine across all three of these, but what really happens is that it turns into a giant kludgefest–everything is propped up by toothpicks to create the illusion that it actually works.
While this awfulness may be transparent to the user, aside from the random crashes here and there and the inability to accurately move gadgets on a shelf (hint: this isn’t going to be fixed), the big downside is that it makes everything gadget-related a huge pain in the ass. Fixing gadget-related bugs is terrible because a tiny change that fixes a bug in one container, such as gadman, could cause a huge change in functionality somewhere else. As an example, I recently did some tweaking to iBar and gadman to make them play more nicely together because iBar didn’t really do that whole “resizing” thing as a desktop gadget, where “resizing” is defined in this case as the ability to make a gadget smaller. The process for fixing this was as follows:
- Test current iBar-gadman functionality
- Determine that iBar doesn’t correctly update its size unless it’s in a shelf
- Try making it update its size normally (min size)
- Desktop iBar fixed, shelf iBar covers my entire screen
- Try alternate method for updating size (aspect)
- Shelf iBar works normally, desktop iBar resizes spastically
- Try adding evas size hints to base gadcon sizing methods
- Shelf iBar works normally, desktop iBar doesn’t appear at all (wtf.)
- I don’t remember the next hour because I blacked out in a coding rage, but the end result is that I had to add max size values to gadget objects which only get set/used by iBar and gadman
So now, to fix a pretty trivial/innocent bug, yet another hack has been added, another toothpick to hold up the tower. Great. I’m sure it will make total sense to anyone else who wants to work on gadgets why iBar is special and uses a max size like this.
Sadly, this isn’t even the worst part of the current gadget debacle. No, the worst part is actually trying to write a gadget using the current system. What may have started out as a cohesive and logical API has had so many bullshit features tacked on that it’s a total nightmare.
Want to get your gadget to size a certain way? Don’t worry, we’ve got 35 different gadget-specific methods and struct members you can try in various combinations, along with all the normal evas object functions, until you get that magical sequence which lets it show up how you want it. On the desktop. Oh, you want it to work on a shelf, too? Better budget out another week of your life if it’s not a simple, non-resizable image!
Cool, you’re going to add menus to your gadget. Remember to feed a mouse up to the evas in your button callback so you don’t break every other mouse click callback and have to restart E! Also have fun with figuring out how to get your gadget menus to have the hierarchy you want.
Remember that time you tried to drag a gadget around? Did it work? If yes, a miracle occurred and the weeks of time that I’ve spent on gadget DND over the past year have paid off. If no, I can’t really say that I’m surprised. Whereas more sane uses of DND in E (see border/iBar/EFM) have single handlers for each of the DND callbacks, gadgets have a DND interface which relies on the gadcon to apply as many hacks as necessary to wrangle the dragged gadget into the position/size that you may or may not expect. In shelf, this majestic failure results in the long-lasting (and not-going-to-be-fixed-any-time-soon) bugs where you lose gadget position when dragging gadgets around. In gadman, you’ll probably get random crashes/flickering if you drag a gadget back and forth to the desktop, because we have to completely delete and then re-create the gadget every time it leaves/enters a gadcon, not to mention the luck involved with anything related to the hover layer (AKA ‘the bane of my existence’). Toolbar seems to not be widely used, or maybe people are just not trying to put anything other than the EFM toolbar into it; these are the most likely answers to why I don’t have a constant stream of bug reports about it.
In closing, as of the year 2013, systray is the worst piece of specification garbage in existence for free desktops. I imagine the meeting where it was invented went something like this:
Year 1905, a cold, deserted shipyard. A small cluster of figures huddle around a typewriter.
Nefarious Supervillain: Let’s make all the desktop environments put an XWindow into a gadget! GTK already uses XWindows for every widget, so it’ll be easy for everyone else, too!
Incompetent Developer: This is a great idea, and I support it. We’ll ship with this as a standard in all applications by next year.
Semi-competent Developer: Won’t this cause problems with input?
Incompetent Developer: Balderdash! GTKWidget has separate event handlers for everything, so we’re sure to get all those events.
Semi-competent Developer: But what if we weren’t using XWindows for every widget, or if we had a different display server which didn’t work in the same way as X?
Nefarious Supervillain picks up the typewriter and smashes Semi-competent Developer over the head with it. Semi-competent Developer falls to the ground.
Nefarious Supervillain: Anyone else want to question my evil genius?
The remaining developers cower in fear. Some poke nervously at their Palm Pilots.
Nefarious Supervillain: Excellent.
Executive summary of current E gadgets and systray: