mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-23 02:38:52 -05:00
Fixed name of path drop list.
This commit is contained in:
parent
ac8dba2a80
commit
93855ae6ab
|
@ -988,7 +988,7 @@ typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
|
|||
*
|
||||
* @param[in] window The window that received the event.
|
||||
* @param[in] count The number of dropped files.
|
||||
* @param[in] names The UTF-8 encoded path names of the dropped files.
|
||||
* @param[in] paths The UTF-8 encoded file and/or directory path names.
|
||||
*
|
||||
* @sa glfwSetDropCallback
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -398,7 +398,7 @@ static void char_mods_callback(GLFWwindow* window, unsigned int codepoint, int m
|
|||
get_mods_name(mods));
|
||||
}
|
||||
|
||||
static void drop_callback(GLFWwindow* window, int count, const char** names)
|
||||
static void drop_callback(GLFWwindow* window, int count, const char** paths)
|
||||
{
|
||||
int i;
|
||||
Slot* slot = glfwGetWindowUserPointer(window);
|
||||
|
@ -407,7 +407,7 @@ static void drop_callback(GLFWwindow* window, int count, const char** names)
|
|||
counter++, slot->number, glfwGetTime());
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
printf(" %i: \"%s\"\n", i, names[i]);
|
||||
printf(" %i: \"%s\"\n", i, paths[i]);
|
||||
}
|
||||
|
||||
static void monitor_callback(GLFWmonitor* monitor, int event)
|
||||
|
|
Loading…
Reference in New Issue
Block a user