GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Oct 02, 2014 12:20 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Modal Problem with Top window menu interaction
PostPosted: Sun Dec 30, 2012 2:09 am 
Offline

Joined: Thu Dec 27, 2012 4:08 pm
Posts: 3
I have implemented a modal dialog that seems to work as far as not allowing interaction with buttons or other items on the main window of the program but it does allow interaction with the main window menu and minimize/maximize/close buttons. Here is my code:

Code:
   gtk_builder_add_from_file (builder, whichdialog, NULL);
   dialog = GTK_WIDGET (gtk_builder_get_object (builder, cObjectname));
   g_object_unref (G_OBJECT (builder));
       gtk_window_set_transient_for(GTK_WINDOW (dialog), GTK_WINDOW (window));
   gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
   gtk_window_set_keep_above(GTK_WINDOW (dialog), TRUE);
   
   gtk_window_set_position(GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ON_PARENT);

   gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
      gtk_widget_show_all (dialog);
      gtk_dialog_run (GTK_DIALOG (dialog));
   
      gtk_widget_destroy (dialog);


I'm using GTK+ 3, C, Ubuntu 12.04.
Am I doing something wrong or is this normal behavior?
Thanks

_________________
http://www.levantense.com


Top
 Profile  
 
 Post subject: Re: Modal Problem with Top window menu interaction
PostPosted: Sun Dec 30, 2012 10:31 pm 
Offline

Joined: Thu Dec 27, 2012 4:08 pm
Posts: 3
Well from doing an exhaustive search on the internet, I couldn't come up with anything, except from someone who had the similar problem almost a year ago. I think it might have something to do with Ubuntu/Unity so I just created a menu object and disabled the one menu item that would cause a problem, and I'm now moving on.

_________________
http://www.levantense.com


Top
 Profile  
 
 Post subject: Re: Modal Problem with Top window menu interaction
PostPosted: Wed Jan 09, 2013 12:46 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
The Minimise/Maximise/Close buttons are meant to be still available even if the dialog is modal. The menu is a different matter. Yes, this is an Ubuntu/Unity thing as a result of relocating the menu bar to a unified location. It's not specific to GTK; you can even see some of the oddities of the behaviour in firefox, etc. I would probably avoid manually disabling the menu items as this could cause problems when used in non-Unity systems. If this does make your code buggy then there's not much you can do and disabling's probably your best option; though I'd also report it as a bug in Unity and don't let them railroad you with "it's not a bug it's a quirk" arguments.


Top
 Profile  
 
 Post subject: Re: Modal Problem with Top window menu interaction
PostPosted: Wed Jan 16, 2013 5:58 pm 
Offline

Joined: Thu Dec 27, 2012 4:08 pm
Posts: 3
Thanks for your answer. I think as long as I handle disabling then re-enabling the menu when necessary it should work on all systems.

_________________
http://www.levantense.com


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


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