Delay in Menu Pop-Up when I have the focus on DrawingArea

0

I have a Gtk :: ApplicationWindow class which is the main window and in a certain place I am painting a Gtk :: DrawingArea area. To handle the keyboard in the drawing area, I will pass the focus from the main window as follows:

drawArea.grab_focus();

And in the drawing area code, I say I can focus:

this->set_can_focus(true);

This way I get the correct operation of the keyboard in the drawing area. The problem comes when I try to pop up the menu I created for the drawing area, which is managed from the main window as follows:

drawArea.signal_button_press_event().connect_notify(
    sigc::mem_fun(*this, &MainWindow::on_drawArea_clicked));

//Fill popup menu:
auto item = Gtk::manage(new Gtk::MenuItem("_Edit", true));
item->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::edit) );
m_Menu_Popup.append(*item);
...
m_Menu_Popup.accelerate(*this);
m_Menu_Popup.show_all(); 

.

void MainWindow::on_drawArea_clicked(GdkEventButton* button_event)
{
  if( (button_event->type == GDK_BUTTON_PRESS) && (button_event->button == 3) )
  {
      m_MenuDrawArea_Popup.popup(button_event->button, button_event->time);
  }
}

Having the focus in the drawing area and right clicking on that area, the menu comes out but with a certain delay. This delay is not there when the focus area is not drawn. To solve this what should I do?

    
asked by David Moreno 27.11.2018 в 13:27
source

0 answers