mirror of
https://github.com/glfw/glfw.git
synced 2025-10-02 21:00:57 +00:00
fixes for vs
This commit is contained in:
parent
931097811c
commit
11cb59cc35
@ -92,7 +92,7 @@ static GLboolean initLibraries(void)
|
|||||||
_glfw.win32.dwmapi.DwmIsCompositionEnabled = (DWMISCOMPOSITIONENABLED_T)
|
_glfw.win32.dwmapi.DwmIsCompositionEnabled = (DWMISCOMPOSITIONENABLED_T)
|
||||||
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmIsCompositionEnabled");
|
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmIsCompositionEnabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,6 +208,9 @@ int _glfwPlatformInit(void)
|
|||||||
|
|
||||||
if (!_glfwInitContextAPI())
|
if (!_glfwInitContextAPI())
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
|
_glfw.win32.dropString = (char*)malloc(1000);
|
||||||
|
_glfw.win32.dropStringSize = 1000;
|
||||||
|
|
||||||
_glfwInitTimer();
|
_glfwInitTimer();
|
||||||
_glfwInitJoysticks();
|
_glfwInitJoysticks();
|
||||||
|
@ -168,6 +168,7 @@ typedef struct _GLFWlibraryWin32
|
|||||||
DWORD foregroundLockTimeout;
|
DWORD foregroundLockTimeout;
|
||||||
char* clipboardString;
|
char* clipboardString;
|
||||||
char* dropString;
|
char* dropString;
|
||||||
|
int dropStringSize;
|
||||||
|
|
||||||
// Timer data
|
// Timer data
|
||||||
struct {
|
struct {
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#include <Windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#include <Shellapi.h>
|
#include <Shellapi.h>
|
||||||
|
|
||||||
@ -718,31 +719,32 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
}
|
}
|
||||||
case WM_DROPFILES:
|
case WM_DROPFILES:
|
||||||
{
|
{
|
||||||
|
|
||||||
TCHAR szName[MAX_PATH];
|
TCHAR szName[MAX_PATH];
|
||||||
HDROP hDrop = (HDROP)wParam;
|
HDROP hDrop = (HDROP)wParam;
|
||||||
POINT pt;
|
POINT pt;
|
||||||
|
int numFiles = DragQueryFile(hDrop, 0xFFFFFFFF, szName, MAX_PATH);
|
||||||
|
int currentSize = 1;
|
||||||
|
int i;
|
||||||
|
char* utf8str;
|
||||||
DragQueryPoint(hDrop, &pt);
|
DragQueryPoint(hDrop, &pt);
|
||||||
|
|
||||||
// Move the mouse to the position of the drop
|
// Move the mouse to the position of the drop
|
||||||
_glfwInputCursorMotion(window,pt.x,pt.y);
|
_glfwInputCursorMotion(window,pt.x,pt.y);
|
||||||
|
|
||||||
// Retrieve the names of the dropped objects
|
memset(_glfw.win32.dropString, 0, _glfw.win32.dropStringSize);
|
||||||
int count = DragQueryFile(hDrop, 0xFFFFFFFF, szName, MAX_PATH);
|
for(i = 0; i < numFiles; i++)
|
||||||
char s[MAX_PATH*count];
|
|
||||||
s[0] = 0;
|
|
||||||
int i;
|
|
||||||
for(i = 0; i < count; i++)
|
|
||||||
{
|
{
|
||||||
DragQueryFile(hDrop, i, szName, MAX_PATH);
|
DragQueryFile(hDrop, i, szName, MAX_PATH);
|
||||||
char* utf8str = _glfwCreateUTF8FromWideString((const wchar_t*)szName);
|
utf8str = _glfwCreateUTF8FromWideString((const wchar_t*)szName);
|
||||||
strcat(s, utf8str);
|
currentSize += strlen(utf8str);
|
||||||
strcat(s, "\n");
|
if(_glfw.win32.dropStringSize < currentSize){
|
||||||
|
_glfw.win32.dropStringSize *= 2;
|
||||||
|
_glfw.win32.dropString = (char*)realloc(_glfw.win32.dropString,_glfw.win32.dropStringSize);
|
||||||
|
}
|
||||||
|
strcat(_glfw.win32.dropString, utf8str);
|
||||||
|
strcat(_glfw.win32.dropString, "\n");
|
||||||
free(utf8str);
|
free(utf8str);
|
||||||
}
|
}
|
||||||
free(_glfw.win32.dropString);
|
|
||||||
_glfw.win32.dropString = strdup(s);
|
|
||||||
free(s);
|
|
||||||
|
|
||||||
_glfwInputDrop(window,_glfw.win32.dropString);
|
_glfwInputDrop(window,_glfw.win32.dropString);
|
||||||
DragFinish(hDrop);
|
DragFinish(hDrop);
|
||||||
|
Loading…
Reference in New Issue
Block a user