Gtkdialog: Child window always on top of parent

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
thanius
Posts: 10
Joined: Tue 04 Feb 2014, 17:19

Gtkdialog: Child window always on top of parent

#1 Post 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.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#2 Post by SFR »

Yep, for child window use:

Code: Select all

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

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

thanius
Posts: 10
Joined: Tue 04 Feb 2014, 17:19

#3 Post 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

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#4 Post 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!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

Post Reply