Bläddra i källkod

LibGUI: Always reset pressed close button index on mouse up in TabWidget

Previously it would only do this if the mouse was over the close 
button.

If you released the mouse outside the close button, the close button
would appear permanently depressed afterwards.
Luke 4 år sedan
förälder
incheckning
b9d51b8601
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      Userland/Libraries/LibGUI/TabWidget.cpp

+ 1 - 1
Userland/Libraries/LibGUI/TabWidget.cpp

@@ -362,6 +362,7 @@ void TabWidget::mouseup_event(MouseEvent& event)
         return;
         return;
 
 
     auto close_button_rect = this->close_button_rect(m_pressed_close_button_index);
     auto close_button_rect = this->close_button_rect(m_pressed_close_button_index);
+    m_pressed_close_button_index = -1;
 
 
     if (close_button_rect.contains(event.position())) {
     if (close_button_rect.contains(event.position())) {
         auto* widget = m_tabs[m_pressed_close_button_index].widget;
         auto* widget = m_tabs[m_pressed_close_button_index].widget;
@@ -369,7 +370,6 @@ void TabWidget::mouseup_event(MouseEvent& event)
             if (on_tab_close_click && widget)
             if (on_tab_close_click && widget)
                 on_tab_close_click(*widget);
                 on_tab_close_click(*widget);
         });
         });
-        m_pressed_close_button_index = -1;
         return;
         return;
     }
     }
 }
 }