* Dispatch right mouse-button click in window. * @param w Window to dispatch event in * @param x X coordinate of the click * @param y Y coordinate of the click */
| 761 | * @param y Y coordinate of the click |
| 762 | */ |
| 763 | static void DispatchRightClickEvent(Window *w, int x, int y) |
| 764 | { |
| 765 | NWidgetCore *wid = w->nested_root->GetWidgetFromPos(x, y); |
| 766 | if (wid == nullptr) return; |
| 767 | |
| 768 | Point pt = { x, y }; |
| 769 | |
| 770 | /* No widget to handle, or the window is not interested in it. */ |
| 771 | if (wid->GetIndex() >= 0) { |
| 772 | if (w->OnRightClick(pt, wid->GetIndex())) return; |
| 773 | } |
| 774 | |
| 775 | /* Right-click close is enabled and there is a closebox. */ |
| 776 | if (_settings_client.gui.right_click_wnd_close == RCC_YES && !w->window_desc.flags.Test(WindowDefaultFlag::NoClose)) { |
| 777 | w->Close(); |
| 778 | } else if (_settings_client.gui.right_click_wnd_close == RCC_YES_EXCEPT_STICKY && !w->flags.Test(WindowFlag::Sticky) && !w->window_desc.flags.Test(WindowDefaultFlag::NoClose)) { |
| 779 | /* Right-click close is enabled, but excluding sticky windows. */ |
| 780 | w->Close(); |
| 781 | } else if (_settings_client.gui.hover_delay_ms == 0 && !w->OnTooltip(pt, wid->GetIndex(), TCC_RIGHT_CLICK) && wid->GetToolTip() != STR_NULL) { |
| 782 | GuiShowTooltips(w, GetEncodedString(wid->GetToolTip()), TCC_RIGHT_CLICK); |
| 783 | } |
| 784 | } |
| 785 | |
| 786 | /** |
| 787 | * Dispatch hover of the mouse over a window. |
no test coverage detected