Page 1 of 1

Gtkdialog: Child window always on top of parent

Posted: Thu 13 Feb 2014, 09:04
by thanius
Gtkdialog should really have some decent documentation, but I'm greatful this forum is here to help!

Anyways, is there any way to keep a child window launched from parent to stay on top layer above parent? In this case, an ABOUT window launched from MAIN window. Clicking on MAIN window should do nothing. When closing child parent regains consciousness.
Possible?
Cheers.

Posted: Thu 13 Feb 2014, 10:14
by SFR
Yep, for child window use:

Code: Select all

<window modal="true">
https://developer.gnome.org/gtk2/2.24/G ... dow--modal

Greetings!

Posted: Thu 13 Feb 2014, 10:41
by thanius
Thanks, that worked for the parent sleep part, but still the child loses focus when clicking on parent. There's a function in gtk for this, but how to apply it with gtkdialog?

https://developer.gnome.org/gtk2/2.24/G ... nsient-for

Posted: Thu 13 Feb 2014, 11:55
by SFR
Hmm, no idea actually...
I tested it under Compiz/Emerald and the child window was staying above the parent there...

Anyway, a partial workaround that works also under (at least) JWM/IceWM, could be something like this:

Code: Select all

#!/bin/sh

export GUI_ABOUT='
<window modal="true">
  <vbox>
    <text><label>about</label></text>
    <button ok>
      <action>closewindow:GUI_ABOUT</action>
    </button>
  </vbox>
  
  <variable>GUI_ABOUT</variable>
  <action signal="focus-out-event">presentwindow:GUI_ABOUT</action>
</window>'

export GUI_MAIN='
<window width-request="300" height-request="300">

  <vbox homogeneous="true">
    <text><label>Main GUI</label></text>
    <button>
      <input file stock="gtk-about"></input>
      <label>About</label>
      <action>launch:GUI_ABOUT</action>
    </button>
  </vbox>

</window>'

gtkdialog -cp GUI_MAIN
However, the child will be above every window, not only its parent.
Also, presentwindow requires Gtkdialog >= 0.8.1.

Greetings!