I spend far too much time inside window managers than can be good for anybody’s mental health; among those I blame for my ticks is the myriad of application developers who create non-transient (i.e., parentless) dialogues. This usually involves passing NULL into APIs like gtk_dialog_new_with_buttons() (pure laziness) or not calling gtk_window_set_transient_for() when creating dialogues with gtk_dialog_new() (carelessness bordering on disregard for human life). My advice on this matter to anybody concerned would be:
- If you are ever considering creating a parentless dialogue, go and ask someone to slap you hard in the face; then review your decision,
- If you still feel like creating a parentless dialogue, go back and ask the person to stop pulling their punches (they either have a crush on you, or would benefit from a subscription to a gym),
- If you still feel like creating a parentless dialogue, consider working on the kernel, device drivers, or some such (that too can be a valid contribution to humanity, you know).
Non-transient dialogue means that the semantic scope of your dialogue is the whole system, rather than your application; this is virtually never appropriate!
Add modality into the mix, and it becomes positively volatile; by marking a dialogue modal, you are saying to the window manager that the user is not allowed to interact with anything in the semantic scope the dialogue belongs to until that dialogue goes away. So, there is only one application developer in the whole world who has a legitimate reason to create a dialogue that is both non-transient and modal; that guy is working on the POTUS nuclear missile launch app. Therefore, the next time you are considering creating a system-modal dialogue, ask yourself this question: AM I THE GUY? (BTW, if the answer is yes, please, please, make sure that the ‘Yes’ button does not have the default focus! Not even the window manager can save us on this one.)
Actually, I blame Gtk+ for my neurosis. gtk_dialog_new() should take a parent parameter, and, together with its mutations, should abort if that parameter is NULL (just after instigating a hate mail campaign against the author — I KNOW WHO YOU ARE! I know all about git blame).
For the one legitimate case above, there should be a special API:
gtk_dialog_new_without_parent_RSI_is_the_least_of_your_worries_my_friend__if_you_see this_function_in_the_wild_without_a_convincing_comment_why_it_is_used_act_NOW the_future_of_the_human_race_depends_on_you().
Here, after all the years of bottling this up, I finally said it. And I did not hit anyone. Or break anything. My therapist will be SOO pleased this week.