title: X11: input focus for popups
body: <p>For some fun and self-education, I'm tinkering with writing my own X11 toolkit. Here's something that's stumping me.</p>
  
  <p>I have a traditional combo box display element, a typical combo box with a dropdown popup list, like all popular toolkits have.</p>
  
  <p>For the dropdown popup list, I'm creating a new window, a child of the root window, appropriately positioned below the main combo-box display element.</p>
  
  <p>The dropdown popup list is a window in its own full right, that implements keyboard-based navigation, to select the individual entries in the dropdown list.</p>
  
  <p>So, I'm using SetInputFocus to set the input focus to the popup after it opens.</p>
  
  <p>What I find is that when I do that, the window manager then redraws the frame of the main window to indicate that it no longer has input focus. Which is technically true, but I don't see the same results with the more mainstream toolkits, where, in the comparable situation, the main window's frame shows that it still has input focus.</p>
  
  <p>For the pop-up window, in addition to setting override-redirect, I'm also doing everything I can think of, to tell the window manager what's going on: setting the window group leader ID in the popup window's WM_HINTS, setting WM_TRANSIENT_FOR, and setting _NET_WM_WINDOW_TYPE to _NET_WM_WINDOW_TYPE_COMBO; none of that seems to work (I verified that the properties are approriately set, via xprop).</p>
  
  <p>It seems like I have to keep the input focus in the combo box window, and forward keypress and keyrelease events to the display elements in the dropdown popup, which feels clunky. Am I overlooking some property that would tell the window manager that the popup's input focus is linked to the main window's (besides the ones that I've mentioned), that would keep the main window's frame drawn to show that it has input focus, when the input focus is actually in the popup?</p>