Wednesday, March 14, 2007

It was finally getting to me how I would have to press the "o" key four
times just to see where I was in the program. So, I hacked the
source. This is why free software is so important, sometimes, your
freedom includes not having to type the "o" key four times. Your
freedom is also how you interact with the world, and having to do that
over and over was getting to me. Ok, rant over, code begins:

I looked through the code until I found the code that deals with the
keypresses and found the relvant section, and just hacked it brutally
to do what I want. osd_level can be 0..3, and I wanted it to cycle
between level 1, which is the osd enabled, and level 3, which is full
osd display. So I changed the code to say:


if(v < 0)
if (osd_level == 1) {
osd_level = 3;
} else {
osd_level = 1;
}


Then, I didn't want the "OSD:enabled" message to display when I went
back to OSD mode, so I just commented out the offending code:


/* if (v == -1 && osd_level <= 1)
set_osd_msg(OSD_MSG_OSD_STATUS,0,osd_duration,
MSGTR_OSDosd, osd_level ? MSGTR_OSDenabled :
MSGTR_OSDdisabled);
else
rm_osd_msg(OSD_MSG_OSD_STATUS); */


Simple. No fuss, no muss. I was in and out in 10 minutes. It could have
been prettier, but part of the beauty was that it does exactly what I want
and it took almost no time to code.