Skip to content

Commit

Permalink
Attempt to fix taskbar bugs on Windows (#328, #69)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentGomila committed Jun 17, 2013
1 parent 4d78d02 commit 5d377fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SFML/Window/Win32/WindowImplWin32.cpp
Expand Up @@ -202,7 +202,7 @@ void WindowImplWin32::processEvents()
if (!m_callback)
{
MSG message;
while (PeekMessage(&message, m_handle, 0, 0, PM_REMOVE))
while (PeekMessage(&message, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&message);
DispatchMessage(&message);
Expand Down Expand Up @@ -884,7 +884,7 @@ LRESULT CALLBACK WindowImplWin32::globalOnEvent(HWND handle, UINT message, WPARA
}

// Get the WindowImpl instance corresponding to the window handle
WindowImplWin32* window = reinterpret_cast<WindowImplWin32*>(GetWindowLongPtr(handle, GWLP_USERDATA));
WindowImplWin32* window = handle ? reinterpret_cast<WindowImplWin32*>(GetWindowLongPtr(handle, GWLP_USERDATA)) : NULL;

// Forward the event to the appropriate function
if (window)
Expand Down

5 comments on commit 5d377fd

@Oberon00
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what happens now if you have multiple windows? Any call to any sf::Window's pollEvent() or waitEvent() will dispatch messages for all windows (and discard thread messages (?)). This seems not to be much of a problem for SFML windows, since they have internal queues, but it can cause problems if using other windows (e.g. native ones or ones from UI Toolkits like Qt).

By the way, I am not able to reproduce #328 or #69 even without this patch.

@LaurentGomila
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any call to any sf::Window's pollEvent() or waitEvent() will dispatch messages for all windows

Yes. I don't think it's a problem though.

and discard thread messages (?)

What do you mean? The whole point of this patch is to process thread messages by passing a NULL handle.

By the way, I am not able to reproduce #328 or #69 even without this patch.

Same for me, I was never able to reproduce it. I have no idea what makes it appear.

As the commit message states, this is only an attempt. It seems hard to find reliable documentation about this issue, so let's try something and see what good or bad effect it will have.

@Oberon00
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and discard thread messages (?)

What do you mean?

I thought of the scenario where one wants to combine SFML's event processing with a handwritten/other message loop. But on second thought this does not seem to be a good idea anyway, which actually invalidates my concerns.

The whole point of this patch is to process thread messages

You could also process thread messages only by passing -1 instead of NULL (see the documentation of the hWnd parameter) but when Werker is right the offending message is sent to a window (the mentioned "cicmarshalwnd" points, according to a quick search, to a console window). However, the current solution might be better anyway, since unprocessed messages are always bad, no matter if thread messages or ones belonging to mysterious marshal windows.

It seems hard to find reliable documentation about this issue, so let's try something and see what good or bad effect it will have.

Sounds reasonable. Bugs which one cannot reproduce are the hardest to fix.

@Raikiri
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the commit message states, this is only an attempt. It seems hard to find reliable documentation about this issue, so let's try something and see what good or bad effect it will have.

I don't know what you guys have been fixing but you apparently did this in a wrong way: http://en.sfml-dev.org/forums/index.php?topic=17251.0

@LaurentGomila
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what you guys have been fixing

The title says it, and links to the corresponding issues. The rest of my answer will be on the forum, to avoid splitting the discussion.

Please sign in to comment.