|
@@ -253,9 +253,9 @@ static void StartWindowSizing(Window *w,
|
|
|
* @param w Window to dispatch event in
|
|
|
* @param x X coordinate of the click
|
|
|
* @param y Y coordinate of the click
|
|
|
* @param double_click Was it a double click?
|
|
|
* @param click_count Number of fast consecutive clicks at same position
|
|
|
*/
|
|
|
static void DispatchLeftClickEvent(Window *w, int x, int y, bool double_click)
|
|
|
static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count)
|
|
|
{
|
|
|
const NWidgetCore *nw = w->nested_root->GetWidgetFromPos(x, y);
|
|
|
WidgetType widget_type = (nw != NULL) ? nw->type : WWT_EMPTY;
|
|
@@ -283,8 +283,6 @@ static void DispatchLeftClickEvent(Windo
|
|
|
|
|
|
int widget_index = nw->index; ///< Index of the widget
|
|
|
|
|
|
/* Process special buttons (only single clicks) */
|
|
|
if (!double_click) {
|
|
|
/* Clicked on a widget that is not disabled.
|
|
|
* So unless the clicked widget is the caption bar, change focus to this widget */
|
|
|
if (widget_type != WWT_CAPTION) {
|
|
@@ -361,18 +359,12 @@ static void DispatchLeftClickEvent(Windo
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* Widget has no index, so the window is not interested in it. */
|
|
|
if (widget_index < 0) return;
|
|
|
|
|
|
Point pt = { x, y };
|
|
|
|
|
|
if (double_click) {
|
|
|
w->OnDoubleClick(pt, widget_index);
|
|
|
} else {
|
|
|
w->OnClick(pt, widget_index);
|
|
|
}
|
|
|
w->OnClick(pt, widget_index, click_count);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2127,11 +2119,7 @@ static void MouseLoop(MouseClick click,
|
|
|
switch (click) {
|
|
|
case MC_LEFT:
|
|
|
case MC_DOUBLE_LEFT:
|
|
|
DispatchLeftClickEvent(w, x - w->left, y - w->top, false);
|
|
|
if (click == MC_DOUBLE_LEFT && _mouseover_last_w != NULL) {
|
|
|
/* Issue the doubleclick, if the window was not removed */
|
|
|
DispatchLeftClickEvent(w, x - w->left, y - w->top, true);
|
|
|
}
|
|
|
DispatchLeftClickEvent(w, x - w->left, y - w->top, click == MC_DOUBLE_LEFT ? 2 : 1);
|
|
|
break;
|
|
|
|
|
|
default:
|