Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Strange error "Unhandled event type: 0"  (Read 2608 times)

0 Members and 2 Guests are viewing this topic.

mvlabat

  • Newbie
  • *
  • Posts: 7
    • View Profile
Strange error "Unhandled event type: 0"
« on: June 21, 2015, 10:54:21 am »
Hello!

I'm using QSFMLWidget from 1.x turorual which I have got working with SFML2.3.
On implementing event handling system I've faced a strange error.

X Extensions:
        Generic Event Extension - First event: 0
        SHAPE - First event: 64
        MIT-SHM - First event: 65
        XInputExtension - First event: 66
        XTEST - First event: 0
        BIG-REQUESTS - First event: 0
        SYNC - First event: 83
        XKEYBOARD - First event: 85
        XC-MISC - First event: 0
        XFIXES - First event: 86
        RENDER - First event: 0
        RANDR - First event: 88
        XINERAMA - First event: 0
        Composite - First event: 0
        DAMAGE - First event: 90
        MIT-SCREEN-SAVER - First event: 91
        DOUBLE-BUFFER - First event: 0
        RECORD - First event: 0
        DPMS - First event: 0
        Present - First event: 0
        DRI3 - First event: 0
        X-Resource - First event: 0
        XVideo - First event: 92
        XFree86-VidModeExtension - First event: 0
        XFree86-DGA - First event: 94
        DRI2 - First event: 101
        GLX - First event: 103
        NV-GLX - First event: 0
        NV-CONTROL - First event: 120
Unhandled event type: 0
Report this to the SFML maintainers if possible

Here is my function:
void QSFMLCanvas::OnUpdate()
{
    sf::Event event;
    while (pollEvent(event)) {
        switch(event.type)
        {
            case (sf::Event::MouseButtonPressed) :
                qDebug() << "mouse clicked"; // Event never handled
                //mousePressedEventHandling(event);
                break;
            case (sf::Event::MouseMoved) :
                qDebug() << "mouse moved"; // Event handled
                //mouseMovedEventHandling(event);
                break;
            case (sf::Event::KeyPressed) :
                qDebug() << "key pressed"; // Event handled
                break;
            default:
                break;
        }

    }
    // Clear screen
    clear(sf::Color(0, 0, 0));
    engine.render();
}

As I can see in my console, none of the events are handled.
I'm using Linux.
« Last Edit: June 21, 2015, 10:56:40 am by mvlabat »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Strange error "Unhandled event type: 0"
« Reply #1 on: June 21, 2015, 05:31:01 pm »
Can you provide more code (including the section where you create the window) and state which version of Qt you are using?
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).


binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Strange error "Unhandled event type: 0"
« Reply #3 on: June 22, 2015, 12:26:18 pm »
When you say "As I can see in my console, none of the events are handled." what do you mean? Are you just misinterpreting what is output on the console? Or do the events in your application not work? The console output is only diagnostic information which helps us track down subtle issues which might be related to it. If your application functions correctly even though stuff is printed on the console then we will just have to add the event type to the whitelist.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

mvlabat

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Strange error "Unhandled event type: 0"
« Reply #4 on: June 22, 2015, 01:53:50 pm »
I do
qDebug() << "some string..."
which has to print corresponding text to my IDE (Qt Creator) console on aforementioned in the code events.
On moving and pressing mouse and buttons I get no such output. So the logical conclusion is that my events aren't handled for some mysterious reason. In addition I get the strange error "Unhandled event type: 0" which may be related to the problem.

I hope now I'm clear. Thank you
« Last Edit: June 22, 2015, 01:55:40 pm by mvlabat »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Strange error "Unhandled event type: 0"
« Reply #5 on: June 22, 2015, 02:06:48 pm »
Are you sure that QSFMLCanvas::showEvent() is being called and that the SFML window is being created with the right window ID? Qt can create multiple (hidden/temporary) windows in certain situations and it is up to you to provide SFML with the right ID to take over.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

mvlabat

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Strange error "Unhandled event type: 0"
« Reply #6 on: June 22, 2015, 03:15:50 pm »
Yes, QSFMLCanvas::showEvent() is called.
Which window ID is right: of main window or of QSFMLCanvas widget?

As you can see all my program is working well except event handling.


(thumbnail)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Strange error "Unhandled event type: 0"
« Reply #7 on: June 22, 2015, 03:21:33 pm »
Event handling doesn't work reliably when you integrate SFML with Qt, especially on Linux -- and probably even more now that we've switched to XCB instead of Xlib. Use Qt events instead, those will always work perfectly.
Laurent Gomila - SFML developer

mvlabat

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Strange error "Unhandled event type: 0"
« Reply #8 on: June 22, 2015, 04:14:16 pm »
Event handling doesn't work reliably when you integrate SFML with Qt, especially on Linux -- and probably even more now that we've switched to XCB instead of Xlib. Use Qt events instead, those will always work perfectly.

Thank you for your answer. May I ask you if there are any best practices or examples how to use Qt events for proper movement implementation?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Strange error "Unhandled event type: 0"
« Reply #9 on: June 22, 2015, 04:37:01 pm »
Quote
May I ask you if there are any best practices or examples how to use Qt events for proper movement implementation?
Events will only tell you when movement starts and stops. What's in between is another topic.
Laurent Gomila - SFML developer