prevent popup deactivation while button_down
[goodguy/history.git] / cinelerra-5.0 / guicast / bcpopupmenu.C
index 59688e6cbbf3124604d469a88945620c590fdd5f..3b7407d5408c4caafde4ecdb0176a3f925bfe711 100644 (file)
@@ -86,7 +86,7 @@ BC_PopupMenu::BC_PopupMenu(int x,
                images[i] = 0;
        }
        this->data = data;
-       this->w_argument = 0;
+       this->w_argument = -1;
        status = BUTTON_UP;
 }
 
@@ -166,7 +166,7 @@ int BC_PopupMenu::set_images(VFrame **data)
                images[i] = new BC_Pixmap(parent_window, data[i], PIXMAP_ALPHA);
        }
 
-       if(w_argument > 0)
+       if(w_argument >= 0)
                w = w_argument +
                        margin +
                        resources->popupmenu_triangle_margin;
@@ -257,9 +257,9 @@ int BC_PopupMenu::draw_title(int flush)
                        get_h() / 2 - icon->get_h() / 2 + offset);
        }
 
-       draw_triangle_down_flat(get_w() - margin - resources->popupmenu_triangle_margin,
-               get_h() / 2 - TRIANGLE_H / 2,
-               TRIANGLE_W, TRIANGLE_H);
+       if( use_title >= 0 )
+               draw_triangle_down_flat(get_w() - margin - resources->popupmenu_triangle_margin,
+                       get_h() / 2 - TRIANGLE_H / 2, TRIANGLE_W, TRIANGLE_H);
 
        flash(flush);
        return 0;
@@ -330,7 +330,8 @@ int BC_PopupMenu::reposition_window(int x, int y)
 
 int BC_PopupMenu::focus_out_event()
 {
-       if( popup_down && !menu_popup->cursor_inside() )
+       if( popup_down && !get_button_down() &&
+           !cursor_inside() && !menu_popup->cursor_inside() )
                deactivate();
        return 0;
 }
@@ -507,8 +508,9 @@ int BC_PopupMenu::cursor_leave_event()
        }
 
 // dispatch to popup
-       if(popup_down)
-       {
+       if( popup_down ) {
+               if( !get_button_down() && !menu_popup->cursor_inside() )
+                       deactivate_menu();
                menu_popup->dispatch_cursor_leave();
        }