Modal dialog broken on Unity

Bug #1078694 reported by raananb
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
appmenu-gtk (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

An application, developed with wxWidgets (2.9.4), which works on Windows, MacOSX, Ubuntu-Gnome & Ubuntu-XFCE is broken when it is executed under Unity.

Essentially, the application is a wxFrame with a menu, and a menu item displays a dialog using ShowModal() (see below).

In Ubuntu-Gnome and in Ubuntu-XFCE (and Win & MacOSX), the menu is disabled as long as the dialog is displayed, which is the expected behavior.

Under Unity (Ubuntu 12.04.1 LTS & 12.10) the menu is not disabled while the dialog is displayed: each subsequent click on the menu item displays a new dialog window on top of the former dialog windows. Other active elements (buttons) on the wxFrame are disabled while the dialog is displayed, as they should be. The menu should be disabled under Unity as well.

class myFrame: public wxFrame
{
...
}

void myframe::OnMenuitemClick( wxCommandEvent& event )
{
  myDialog* dp = new myDialog(this);

  dp->ShowModal();
}

class myDialog: public wxDialog
{
....
};

Tags: bot-comment
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1078694/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
raananb (raanan)
affects: ubuntu → unity (Ubuntu)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Sorry, but we can't help with this until we can reproduce it. Please provide a test program to help us reproduce the problem, or detailed instructions for how to.

affects: unity (Ubuntu) → compiz (Ubuntu)
Changed in compiz (Ubuntu):
status: New → Incomplete
Revision history for this message
raananb (raanan) wrote :

To reproduce this bug, use the sample provided with wxWidgets (2.9.4). Build wxWidgets, then 'make' the sample 'dialogs' under the resuting build (GCCBuildReleaseGTKUnicode & GCCBuildDebugGTKUnicode in my case).

When the resulting 'dialogs' application is launched, select any entry in the Dialogs menu. You will notice that you can continue to select the same or other entries at will, while normally the menu should be disabled after the first dialog is displayed.

Revision history for this message
Vadim Zeitlin (vadim-wxwidgets) wrote :

The relevant code inside wxWidgets is in http://trac.wxwidgets.org/browser/wxWidgets/trunk/src/gtk/dialog.cpp#L102 and uses gtk_window_set_transient_for() and gtk_window_set_modal() which doesn't seem to be enough when using Ubuntu global menu bar. Presumably gtk_dialog_run() works (otherwise more people would have complained about this already) but it's not flexible enough to be used in wxWidgets.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for compiz (Ubuntu) because there has been no activity for 60 days.]

Changed in compiz (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Vadim Zeitlin (vadim-wxwidgets) wrote :

This bug is absolutely trivial to reproduce, here is a minimal GTK+ program which shows it:

#include <gtk/gtk.h>

static void activate_test(GtkMenuItem*, GtkWindow* window)
{
    GtkWidget* dialog = gtk_message_dialog_new(window, GTK_DIALOG_MODAL,
        GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "a message", NULL);
    gtk_dialog_run(GTK_DIALOG(dialog));
    gtk_widget_destroy(dialog);
}

int main(int argc, char** argv)
{
    gtk_init(&argc, &argv);
    GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    GtkWidget* menu = gtk_menu_new();
    GtkWidget* mi = gtk_menu_item_new_with_mnemonic("_Test");
    g_signal_connect(mi, "activate", G_CALLBACK(activate_test), window);
    gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);

    mi = gtk_menu_item_new_with_mnemonic("E_xit");
    g_signal_connect(mi, "activate", G_CALLBACK (gtk_main_quit), NULL);
    gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
    mi = gtk_menu_item_new_with_mnemonic("_File");
    gtk_menu_item_set_submenu(GTK_MENU_ITEM(mi), menu);

    GtkWidget* menubar = gtk_menu_bar_new();
    gtk_menu_shell_append(GTK_MENU_SHELL(menubar), mi);
    gtk_widget_show_all(menubar);
    gtk_container_add(GTK_CONTAINER(window), menubar);

    g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
    gtk_widget_show(window);
    gtk_main();
    return 0;
}

The menu stays enabled while the message box is shown and so multiple message boxes can be opened.

Ubuntu behaviour here totally breaks the application logic and is incompatible with GTK+ on all the other systems. It's amazing that this is apparently not considered to be a problem at all.

Changed in compiz (Ubuntu):
status: Expired → Confirmed
Revision history for this message
Vadim Zeitlin (vadim-wxwidgets) wrote :

This is related to the global menu and not compiz.

affects: compiz (Ubuntu) → appmenu-gtk (Ubuntu)
Revision history for this message
Lars Karlitski (larsu) wrote :

Thanks for reporting this bug. I'm marking it as a duplicate of bug #674605

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.