SFML/SFML

macbook air m2 left mouse button.

TinyProbe opened this issue ยท 2 comments

Thanks for raising your issue here! ๐Ÿ™‚

Before you submit the issue however, we'd like you to consider the follow points.

  • We like to use the issue tracker for confirmed issues.
  • If you're stuck with SFML, please use the forum to get help.

Subject of the issue

The left mouse button event occurs abnormally.

Your environment

  • macbook air m2 chip
  • 2.6.0
  • Apple clang version 15.0.0 (clang-1500.0.40.1)
    Target: arm64-apple-darwin23.0.0
    Thread model: posix

Steps to reproduce

Tell us how to reproduce this issue. Please provide a minimal, complete and verifiable example, you can use the follow template as a start:

  ...
  // MouseMap
  MouseManager::ButtonMap bmap(sf::Mouse::ButtonCount);
  MouseManager::setButtonMap(&bmap);
  MouseManager::setMouseEventCallback(
      MouseManager::kVerScrollUp, [&](int x, int y) {
    snd2.play();
  });
  MouseManager::setMouseEventCallback(
      MouseManager::kVerScrollDown, [&](int x, int y) {
    snd2.play();
  });
  bmap.setButtonCallback(
      sf::Mouse::Left, MouseManager::kPress, [&](int x, int y) {
    snd2.play();
  });

  sf::Event event;
  while (window.isOpen()) {
    // update
    while (window.pollEvent(event)) {
      if (event.type == sf::Event::Closed) {
        window.close();
      } else if (event.type >= sf::Event::KeyPressed &&
                 event.type <= sf::Event::KeyReleased) {
        KeyManager::eventProcess(event);
      } else if (event.type >= sf::Event::MouseWheelScrolled &&
                 event.type <= sf::Event::MouseLeft) {
        MouseManager::eventProcess(event);
      }
    }
    KeyManager::framework();
    MouseManager::framework(window);
    txt1.setString(std::to_string(FPSManager::getCurrentFPS()));
    
    spr1.setRotation(usize(spr1.getRotation() + 1.0f) % 360);

    // render
    window.draw(rts1);
    window.draw(rts2);
    window.draw(spr1);
    window.draw(txt1);
    window.display();

    // fps managing
    FPSManager::framePulse();
  }
  ...

Expected behavior

After building and running, there are times when the left mouse button click event does not randomly occur when I press the left mouse button. All other mouse events occur normally. It worked fine on Windows.

Actual behavior

When this phenomenon occurs, double-clicking the left mouse button causes two events to occur at once. However, if you do not double-click, the event is lost.

The code you posted is not complete. We cannot compile it to reproduce the problem and investigate.
Please provide a minimal, complete and verifiable example.

While checking, I found something new, so I think I'll check the problem some more and raise the issue again.