Bug #819
closedMouse-events with right click -> dragging bug
0%
Description
After a certain series of clicks Wt informs me that I'm dragging while I don't have any mouse buttons pressed in.
The series:
- left button down
- right button down
- right button up
- left button up
- move mouse (no buttons pressed)
[You should perform these without moving your mouse]
To reproduce this:
void HelloApplication::create()
{
WContainerWidget *container = new WContainerWidget();
container->resize(500,500);
container->mouseDragged().connect(bind(&HelloApplication::print, this, "drag"));
container->mouseWentUp().connect(bind(&HelloApplication::print, this, "up"));
container->mouseWentDown().connect(bind(&HelloApplication::print, this, "down"));
root()->addWidget(container);
}
void HelloApplication::print(std::string str)
{
cout << str << "\n";
}
gives me the following output on:
- chrome [no up events!]:
down
down
drag
- firefox [up events! but still not correct]:
down
down
up
up
up [-> extra click because we have to click away the pop-up from the right click]
drag
Updated by Koen Deforche over 13 years ago
- Status changed from New to InProgress
- Assignee set to Koen Deforche
Updated by Koen Deforche over 13 years ago
- Status changed from InProgress to Resolved
Hey Rob,
There was an issue with recording the mouseup event. This has been fixed in latest git.
Nevertheless, the problem persists when the context menu pops up --- then the mouse up event is lost to the context menu itself.
To use this reliably you need to disable the context menu. See this test case:
#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <iostream>
using namespace Wt;
class Test : public WApplication{
private:
WVBoxLayout *vBox;
public:
Test(const WEnvironment& env)
: WApplication(env)
{
WContainerWidget *container = new WContainerWidget();
container->resize(500,500);
container->mouseDragged()
.connect(boost::bind(&Test::print, this, "drag"));
container->mouseWentUp()
.connect(boost::bind(&Test::print, this, "up"));
container->mouseWentDown()
.connect(boost::bind(&Test::print, this, "down"));
root()->addWidget(container);
container->setAttributeValue
("oncontextmenu",
"event.cancelBubble = true; event.returnValue = false; return false;");
}
void print(std::string str) {
std::cerr << str << "\n";
}
};
WApplication *createApplication(const WEnvironment& env){
return new Test(env);
}
int main(int argc, char *argv[]){
return WRun(argc, argv, createApplication);
}
Regards,
koen
Updated by Koen Deforche over 13 years ago
- Status changed from Resolved to Closed