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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - zzymyn

Pages: [1]
1
Window / Re: Windows gains focus only at borded
« on: August 07, 2014, 03:27:04 pm »
Thanks Hapax. I didn't see this workaround in the bug thread or via a Google search, so I thought it may be useful to people who Google the bug.

It may sound weird, but I prefer to workaround bugs and stick to the stable versions of libraries rather than use nightlies. Better the devil you know, or something.  :P

2
Window / Re: Windows gains focus only at borded
« on: August 07, 2014, 09:11:47 am »
There's a workaround here if you don't/can't build SFML 2.2:

You'll need to #include <CommCtrl.h> and link to Comctl32.lib.

Add this function somewhere:

#if SFML_VERSION_MAJOR == 2 && SFML_VERSION_MINOR == 1
        LRESULT CALLBACK GameWindowHook(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
        {
                if (uMsg == WM_MOUSEMOVE)
                {
                        // Supress mouse move events if the window doesn't have the focus:
                        if (GetActiveWindow() != hWnd)
                                return DefWindowProc(hWnd, uMsg, wParam, lParam);
                }
                return DefSubclassProc(hWnd, uMsg, wParam, lParam);
        }
#endif

And add this after you create your SFML window:

#if SFML_VERSION_MAJOR == 2 && SFML_VERSION_MINOR == 1
        SetWindowSubclass(window.getSystemHandle(), &GameWindowHook, 0, 0);
#endif

I haven't thoroughly tested this or anything so I don't recomment putting it in a release build.

Pages: [1]