Project

General

Profile

Actions

Bug #819

closed

Mouse-events with right click -> dragging bug

Added by Rob Van Dyck over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
05/10/2011
Due date:
% Done:

0%

Estimated time:

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:

  1. left button down
  2. right button down
  3. right button up
  4. left button up
  5. 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

Actions #1

Updated by Rob Van Dyck over 13 years ago

I'm using wt-3.1.9

Actions #2

Updated by Koen Deforche over 13 years ago

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche
Actions #3

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

Actions #4

Updated by Koen Deforche over 13 years ago

  • Target version set to 3.1.10
Actions #5

Updated by Koen Deforche over 13 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF