GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Apr 25, 2014 5:08 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Blocking toplevel window titlebar controls
PostPosted: Tue Jul 10, 2012 9:30 am 
Offline
GTK+ Guru

Joined: Sun Jan 17, 2010 6:48 pm
Posts: 102
When a dialog window is displayed, how can I 'fix' the position of the parent widget so that it can't be moved or resized using the parent windows frame decorations?

Thanks

WJG

_________________
"If you don't stand for something, then you'll fall for anything."


Top
 Profile  
 
 Post subject: Re: Blocking toplevel window titlebar controls
PostPosted: Tue Jul 10, 2012 3:25 pm 
Offline
GTK+ Guru

Joined: Fri Mar 25, 2011 5:16 pm
Posts: 176
Location: USA
Use: gtk_window_set_modal
http://developer.gnome.org/gtk3/3.2/GtkWindow.html#gtk-window-set-modal


Top
 Profile  
 
 Post subject: Re: Blocking toplevel window titlebar controls
PostPosted: Tue Jul 10, 2012 4:12 pm 
Offline
GTK+ Guru

Joined: Sun Jan 17, 2010 6:48 pm
Posts: 102
I'm already using this function. It prevents interaction with the parent, but the parent can still be moved around, iconized etc..

WJG

_________________
"If you don't stand for something, then you'll fall for anything."


Top
 Profile  
 
 Post subject: Re: Blocking toplevel window titlebar controls
PostPosted: Tue Jul 10, 2012 5:42 pm 
Offline
GTK+ Guru

Joined: Fri Mar 25, 2011 5:16 pm
Posts: 176
Location: USA
Sorry that's right. I forgot about that.

I think you could use gtk_signal_handler_block() or one of it's variants to block the signal for the parent while the dialog is being shown. The "set-focus" I think? but I'm not sure.


Top
 Profile  
 
 Post subject: Re: Blocking toplevel window titlebar controls
PostPosted: Tue Jul 10, 2012 5:49 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 709
Location: UK
Hi,

I am not sure that you can fix the position of a window and make sure that it can not be moved. Window positioning is up to the window manager and not the application. The application can only suggest window positions and the window manager can ignore these requests.

_________________
E.


Top
 Profile  
 
 Post subject: Re: Blocking toplevel window titlebar controls ** SOLVED **
PostPosted: Wed Jul 11, 2012 9:04 am 
Offline
GTK+ Guru

Joined: Sun Jan 17, 2010 6:48 pm
Posts: 102
It looks as though I needed to re-think what I wanted to do.

The parent of my transient window (a custom dialog) should not respond pointer events. As there are no controls within the Gtk API to do this at a GtkWindow level, so I had to 'dig-deeper' using the GDK. I can now achieve my goal using the following code snippet:

Code:
GtkWindow *window
guint32 activate_time;

...

gdk_pointer_grab ( GTL_WIDGET(window)->window ,
TRUE, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, NULL, NULL, GDK_CURRENT_TIME );


When my custom dialog is closed, pointer control is returned to the parent.

WJG

_________________
"If you don't stand for something, then you'll fall for anything."


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group