Fix atlas clicking following 8f36ca47a1
/ D326 by adding the missing clicks property to the wxWidgets SDL event construction.
Differential Revision: https://code.wildfiregames.com/D452 Fixes #4557 Patch By: causative This was SVN commit r19589.
This commit is contained in:
parent
2599d0374e
commit
90beda96f8
@ -51,6 +51,11 @@
|
||||
|
||||
static HighResTimer g_Timer;
|
||||
|
||||
/**
|
||||
* wxWidgets only registers the double click on mousedown.
|
||||
*/
|
||||
static int g_Clicks = 1;
|
||||
|
||||
using namespace AtlasMessage;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -272,9 +277,12 @@ private:
|
||||
// Button down and double click appear to be mutually exclusive events,
|
||||
// meaning a second button down event is not sent before a double click
|
||||
if (evt.ButtonDown() || evt.ButtonDClick())
|
||||
POST_MESSAGE(GuiMouseButtonEvent, (evt.GetButton(), true, evt.GetPosition()));
|
||||
{
|
||||
g_Clicks = evt.ButtonDClick() ? 2 : 1;
|
||||
POST_MESSAGE(GuiMouseButtonEvent, (evt.GetButton(), true, evt.GetPosition(), g_Clicks));
|
||||
}
|
||||
else if (evt.ButtonUp())
|
||||
POST_MESSAGE(GuiMouseButtonEvent, (evt.GetButton(), false, evt.GetPosition()));
|
||||
POST_MESSAGE(GuiMouseButtonEvent, (evt.GetButton(), false, evt.GetPosition(), g_Clicks));
|
||||
else if (evt.GetEventType() == wxEVT_MOTION)
|
||||
POST_MESSAGE(GuiMouseMotionEvent, (evt.GetPosition()));
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2014 Wildfire Games.
|
||||
/* Copyright (C) 2017 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -170,6 +170,7 @@ MESSAGEHANDLER(GuiMouseButtonEvent)
|
||||
ev.ev.type = msg->pressed ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP;
|
||||
ev.ev.button.button = msg->button;
|
||||
ev.ev.button.state = msg->pressed ? SDL_PRESSED : SDL_RELEASED;
|
||||
ev.ev.button.clicks = msg->clicks;
|
||||
float x, y;
|
||||
msg->pos->GetScreenSpace(x, y);
|
||||
ev.ev.button.x = (u16)clamp((int)x, 0, g_xres);
|
||||
|
@ -90,6 +90,7 @@ MESSAGE(GuiMouseButtonEvent,
|
||||
((int, button))
|
||||
((bool, pressed))
|
||||
((Position, pos))
|
||||
((int, clicks))
|
||||
);
|
||||
|
||||
MESSAGE(GuiMouseMotionEvent,
|
||||
|
Loading…
Reference in New Issue
Block a user