Fixed name of path drop list.

This commit is contained in:
Camilla Berglund
2015-01-27 23:04:22 +01:00
parent ac8dba2a80
commit 93855ae6ab
6 changed files with 27 additions and 27 deletions
+5 -5
View File
@@ -592,17 +592,17 @@ static int translateKey(unsigned int key)
if (count)
{
NSEnumerator* e = [files objectEnumerator];
char** names = calloc(count, sizeof(char*));
char** paths = calloc(count, sizeof(char*));
int i;
for (i = 0; i < count; i++)
names[i] = strdup([[e nextObject] UTF8String]);
paths[i] = strdup([[e nextObject] UTF8String]);
_glfwInputDrop(window, count, (const char**) names);
_glfwInputDrop(window, count, (const char**) paths);
for (i = 0; i < count; i++)
free(names[i]);
free(names);
free(paths[i]);
free(paths);
}
return YES;
+2 -2
View File
@@ -216,10 +216,10 @@ void _glfwInputCursorEnter(_GLFWwindow* window, int entered)
window->callbacks.cursorEnter((GLFWwindow*) window, entered);
}
void _glfwInputDrop(_GLFWwindow* window, int count, const char** names)
void _glfwInputDrop(_GLFWwindow* window, int count, const char** paths)
{
if (window->callbacks.drop)
window->callbacks.drop((GLFWwindow*) window, count, names);
window->callbacks.drop((GLFWwindow*) window, count, paths);
}
+5 -5
View File
@@ -584,7 +584,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
int i;
const int count = DragQueryFileW(hDrop, 0xffffffff, NULL, 0);
char** names = calloc(count, sizeof(char*));
char** paths = calloc(count, sizeof(char*));
// Move the mouse to the position of the drop
DragQueryPoint(hDrop, &pt);
@@ -596,16 +596,16 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
WCHAR* buffer = calloc(length + 1, sizeof(WCHAR));
DragQueryFileW(hDrop, i, buffer, length + 1);
names[i] = _glfwCreateUTF8FromWideString(buffer);
paths[i] = _glfwCreateUTF8FromWideString(buffer);
free(buffer);
}
_glfwInputDrop(window, count, (const char**) names);
_glfwInputDrop(window, count, (const char**) paths);
for (i = 0; i < count; i++)
free(names[i]);
free(names);
free(paths[i]);
free(paths);
DragFinish(hDrop);
return 0;
+12 -12
View File
@@ -188,7 +188,7 @@ static void changeWindowState(_GLFWwindow* window, Atom state, int action)
static char** parseUriList(char* text, int* count)
{
const char* prefix = "file://";
char** names = NULL;
char** paths = NULL;
char* line;
*count = 0;
@@ -205,27 +205,27 @@ static char** parseUriList(char* text, int* count)
(*count)++;
char* name = calloc(strlen(line) + 1, 1);
names = realloc(names, *count * sizeof(char*));
names[*count - 1] = name;
char* path = calloc(strlen(line) + 1, 1);
paths = realloc(paths, *count * sizeof(char*));
paths[*count - 1] = path;
while (*line)
{
if (line[0] == '%' && line[1] && line[2])
{
const char digits[3] = { line[1], line[2], '\0' };
*name = strtol(digits, NULL, 16);
*path = strtol(digits, NULL, 16);
line += 2;
}
else
*name = *line;
*path = *line;
name++;
path++;
line++;
}
}
return names;
return paths;
}
// Create the X11 window (and its colormap)
@@ -1217,13 +1217,13 @@ static void processEvent(XEvent *event)
if (result)
{
int i, count;
char** names = parseUriList(data, &count);
char** paths = parseUriList(data, &count);
_glfwInputDrop(window, count, (const char**) names);
_glfwInputDrop(window, count, (const char**) paths);
for (i = 0; i < count; i++)
free(names[i]);
free(names);
free(paths[i]);
free(paths);
}
XFree(data);