Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 21 Dec 2014, 20:02
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Gtkdialog: Child window always on top of parent
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
thanius

Joined: 04 Feb 2014
Posts: 8

PostPosted: Thu 13 Feb 2014, 05:04    Post_subject:  Gtkdialog: Child window always on top of parent  

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.
Back to top
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1118

PostPosted: Thu 13 Feb 2014, 06:14    Post_subject:  

Yep, for child window use:
Code:
<window modal="true">

https://developer.gnome.org/gtk2/2.24/GtkWindow.html#GtkWindow--modal

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send_private_message 
thanius

Joined: 04 Feb 2014
Posts: 8

PostPosted: Thu 13 Feb 2014, 06:41    Post_subject:  

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/GtkWindow.html#gtk-window-set-transient-for
Back to top
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1118

PostPosted: Thu 13 Feb 2014, 07:55    Post_subject:  

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:
#!/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!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0497s ][ Queries: 11 (0.0066s) ][ GZIP on ]