Project

General

Profile

Actions

Bug #819

closed
RV KD

Mouse-events with right click -> dragging bug

Bug #819: Mouse-events with right click -> dragging bug

Added by Rob Van Dyck over 15 years ago. Updated about 15 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

RV Updated by Rob Van Dyck over 15 years ago Actions #1

I'm using wt-3.1.9

KD Updated by Koen Deforche over 15 years ago Actions #2

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche

KD Updated by Koen Deforche over 15 years ago Actions #3

  • 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

KD Updated by Koen Deforche about 15 years ago Actions #4

  • Target version set to 3.1.10

KD Updated by Koen Deforche about 15 years ago Actions #5

  • Status changed from Resolved to Closed
Actions

Also available in: PDF Atom