Two days later: EVERYTHING IS A PIECE OF SHIT

(This post is mostly a long rant about my computing woes. Feel free to skim over it.)

The linuxwacom project website says most modern Linux distributions come with Wacom tablet input drivers already enabled. Ubuntu is supposed to be included in this. So I look around on my system, and sure enough, there's already a package installed that's called xserver-xorg-input-wacom. So I plug in my tablet and try using it. Does it work? Nope!

So I download the linuxwacom drivers manually. I have to install a lot new stuff that they rely on. That's pretty normal. One of the things they need is the latest version of xorg-macros. I check on my system, and I have 1.3. I check my package manager, and sure enough, there's an update available, so I update to 1.5. Wait a minute... linuxwacom needs 1.8! And Ubuntu's “current version” is 1.5!

PIECES OF SHIT COUNTER

  1. Ubuntu

So I download and install that, manually, which isn't very difficult, just annoying. And I finish installing linuxwacom, and then restart my computer and... YES! The tablet actually works at giving input equivalent to mouse cursor input. So I go and open up some graphics-editing programs that I know are supposed to accept tablet input – GIMP and Inkscape – and sure enough, they also accept tablet input for themselves. Nice!

ACTUALLY DECENT SOFTWARE COUNTER

  1. linuxwacom

And then I spend about 15 minutes messing around in GIMP.

A stylized drawing of a person charging with a sword or something, out of a bright, open doorway.

Messing around in GIMP is pretty nice. GIMP is a bit like a canvas: You can draw on it with a variety of “tools”, and you have the extra advantage of being able to undo your actions, but the internal substance is just that: The pixels on the screen. Inkscape is different: Inkscape records ideal approximations of the paths you draw, and you can go back and edit those paths later. So, essentially, GIMP is for drawing pictures and Inkscape is for designing pictures. But I want to be able to draw and design pictures, so neither really has the feature-set that I want, and since I'm probably going to be using this medium a lot, for a long time, I want to have absolute control over my own abilities; both Inkscape and GIMP have a lot of configuration options, but they aren't nearly as versatile as they could be if I had direct control at the source level. I need to write my own programs.

So I look at the source code of GIMP and Inkscape, to see how they use tablet input. Their source code is incredibly complicated and confusing, and doesn't have good documentation. Both of them are built using GTK, a graphical-user-interface library. I ask the Internet about GTK tablet input, and it says that GTK has some long-standing, significant bugs relating to tablet input, which haven't been fixed for some reason. Plus, what I want to do (for the moment) is just add tablet input to an existing program, and using GTK for that would be like buying a giant toolbox just to use a screwdriver.

PIECES OF SHIT COUNTER

  1. Ubuntu
  2. GTK

So I go to Google and search for information about how to use tablet input in C++ programs. I use a lot of combinations of the following search terms: tablet, wacom, input, c++, programming, linux... But if you search for “tablet” you get information about tablet PCs, and if you don't search for “linux” then you only get info about how to do it on Windows, and if you do search for “linux” then you only get information about linuxwacom, which is just the driver. And if you search for “c” or “c++” then you get information about parts of linuxwacom that are written in C, and if you search for “input” then you get lots of pages about how to set up Wacom tablet input from the user-end perspective, which I've already done, but if you don't search for “input” then you don't get the right information! I did discover that there's, apparently, a fairly simple system for getting tablet input in Haskell, but I don't want to use Haskell for this stage of the project; I'll be saying “Go screw with this” and Haskell will say “Excuse me, I'm sure you mean 'Please show me the results of executing this list of screwing operations'”. Haskell just isn't a good language for doing stupid stuff in!

You know what's another interesting thing about a Google search for Haskell tablet input? This website is in the first page of Google results. Which is... kinda flattering, but completely useless to me!

PIECES OF SHIT COUNTER

  1. Ubuntu
  2. GTK
  3. Google

Okay, so I've been using SDL. SDL has its own event system, which gives you mouse and keyboard input and stuff; let's see if it has a way to get tablet input. So I go to Google again and ask it about SDL tablet input. Turns out, SDL has no built-in way of accepting tablet input. Yuck! On the other hand, it is supposed to have a way to ask the X Window Manager for its own events. And I know X is receiving my tablet events, because X is the entity that makes it function as a mouse. (Also I checked with the utility program “xev”.) So I spend another few hours looking up what X events are and how they're stored, and I finally find some convenient example code that reads the X events directly. And so I compile that code, and IT WORKS. YES!

So then I go back and try to include that in my SDL code, by using SDL's “SYSWMEVENT” construct (short for system window manager event; it is supposed to cover every kind of event that SDL doesn't cover by default). I successfully enable SYSWMEVENTS... but it doesn't work at all, because SDL only reports MOUSEMOTION events for my tablet input, not any SYSWMEVENTS.

PIECES OF SHIT COUNTER

  1. Ubuntu
  2. GTK
  3. Google
  4. SDL

Okay, that doesn't seem like TOO much of a setback, because I already have this code that takes the input, so I can just use it and SDL, even if that seems kind of stupid. So I try that. It seems to work pretty well! The only problem is, the position of the cursor in the window isn't the same as the coordinates that the tablet gives. SDL mouse motion events give you coordinates based in the window – the top left corner of the window is (0, 0) – but X events give you coordinates based on the screen size, where the top left corner of the screen is (0, 0). That shouldn't be too hard to deal with, though, because all I have to do is subtract the window's position within the screen, and then I get the position I want.

It turns out that SDL has no way of knowing where its window is.

PIECES OF SHIT COUNTER

  1. Ubuntu
  2. GTK
  3. Google
  4. SDL
  5. SDL

(And I can't compute it based on the difference between the SDL event coordinates and the X event coordinates, because the events don't come at exactly the same times.)

I guess I'm gonna ditch SDL. But first, I think I'm going to take a break. I've spent the better part of two days trying to work around the fact that I have to deal with shitty, badly documented systems, and that's pretty stressful, so I should probably take a break from it. (Be glad it didn't take you two days to read this rant!)

Maybe I'll work on my little game some more, or start cutting into my TODO list for this website.

– Eli

Approximate readability: 7.54 (5420 characters, 1265 words, 72 sentences, 4.28 characters per word, 17.57 words per sentence)