Most UI elements already have something to indicate if they have key focus... a blinking cursor, 'selection rectangle' around button text, highlight (rollover) colors, etc. Is your application different from those?
I've expended large amounts of time and effort on these kinds of problems in the development of a commercial package. Managing Z-plane, activation and focus in an envrionment with arbitrary windows from arbitrary threads (and in some cases, processes!) isn't trivial. It looks like you're doing 'the right thing' in your code. Even in the case of a 'topmost' window, the title bar should show 'active' or not.
But, don't forget the 'focus-follows-mouse' scenario! :P Then, you can't simply rely on activation -- I *hate* that. And of course, in X, your user might be running who-knows-what flavor-of-the-month buggy as bat-sh*t window manager with random features and adherance to quasi-"standards" over a 300 baud modem and blame you (or Qt) for failing to operate perfectly. Go figure. Me, bitter about that kind of thing? Where'd you get that idea!?
BTW, the reasons for the policy in Windows w.r.t. window / focus 'stealing' are actually sound -- and if you dig around in MSDN you can find ways to circumvent the policy. Consider this scenario:
Bob is violating company policy, and decides to type an email to his girlfriend while he's supposed to be monitoring a manufacturing process that makes chocolate chip cookies.
While he's typing, an alarm from the cookie dough monitoring system pops up that has an 'OK' button on it. The dialog reports: "Dang! We're out of chocolate chips! Re-fill the chocolate chip hopper and press 'OK' to resume making cookie dough."
Well, that dialog pops in right when Bob hits the <spacebar> between two words in the email to his girlfriend. He thinks he saw something funny on the screen, but doesn't think anything of it.
A few days later, you buy a bag of chocolate chip cookies from the Vendo while you wait for your über Qt app to compile, walk back to your desk and open it. %^*&@!#$ cookies don't have any chocolate chips in them! WTF?!
OK, it's a little hokey, and you'd *think* that this kind of thing wouldn't happen. It has, and it does. Hell, it happened to me all the time when Lotus Notes would pop up some meeting reminder while I was coding, and I'd promise to attend some worthless random meeting and have to go clean up the mess later. Certainly, more serious Bad Things than these examples have happened, and probably are the reason for the change. It can sure be annoying, I agree, but the reasoning behind it is certainly not BS.
Bookmarks