]> git.tdb.fi Git - libs/gui.git/commitdiff
Use Get/SetWindowLongPtr
authorMikko Rasa <tdb@tdb.fi>
Mon, 17 Jun 2019 22:34:52 +0000 (01:34 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 17 Jun 2019 22:36:52 +0000 (01:36 +0300)
Since sizeof(long) != sizeof(void *) on Windows, the non-Ptr versions do
not work properly on 64-bit Windows.

source/graphics/windows/window.cpp

index c07fbae671bd511693ca249b92f5307253cbce22..977efcdd5ea33fe147db8c82cf59fbb7208e6eec 100644 (file)
@@ -14,11 +14,11 @@ LRESULT CALLBACK wndproc_(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
        if(msg==WM_CREATE)
        {
                CREATESTRUCT *cs = reinterpret_cast<CREATESTRUCT *>(lparam);
-               SetWindowLong(hwnd, 0, reinterpret_cast<LONG>(cs->lpCreateParams));
+               SetWindowLongPtr(hwnd, 0, reinterpret_cast<LONG_PTR>(cs->lpCreateParams));
        }
        else
        {
-               Msp::Graphics::Window *wnd = reinterpret_cast<Msp::Graphics::Window *>(GetWindowLong(hwnd, 0));
+               Msp::Graphics::Window *wnd = reinterpret_cast<Msp::Graphics::Window *>(GetWindowLongPtr(hwnd, 0));
                Msp::Graphics::Window::Event ev;
                ev.msg = msg;
                ev.wparam = wparam;
@@ -117,8 +117,8 @@ void Window::platform_reconfigure(bool fullscreen_changed)
                bool was_visible = visible;
                if(was_visible)
                        hide();
-               SetWindowLong(priv->window, GWL_EXSTYLE, exstyle);
-               SetWindowLong(priv->window, GWL_STYLE, style);
+               SetWindowLongPtr(priv->window, GWL_EXSTYLE, exstyle);
+               SetWindowLongPtr(priv->window, GWL_STYLE, style);
                if(was_visible)
                        show();
        }