uris -> files.

This commit is contained in:
Miroslav Šedivý 2021-01-06 18:54:55 +01:00
parent a92ead019e
commit 64187964d4
3 changed files with 8 additions and 8 deletions

View File

@ -85,9 +85,9 @@ char **uris_make(int size) {
return calloc(size + 1, sizeof(char *));
}
void uris_set(char **uris, char *filename, int n) {
GFile *file = g_file_new_for_path(filename);
uris[n] = g_file_get_uri(file);
void uris_set_file(char **uris, char *file, int n) {
GFile *gfile = g_file_new_for_path(file);
uris[n] = g_file_get_uri(gfile);
}
void uris_free(char **uris, int size) {

View File

@ -14,16 +14,16 @@ import (
var mu = sync.Mutex{}
func FileDrop(x int, y int, uris []string) {
func DragWindow(files []string) {
mu.Lock()
defer mu.Unlock()
size := C.int(len(uris))
size := C.int(len(files))
urisUnsafe := C.uris_make(size);
defer C.uris_free(urisUnsafe, size)
for i, uri := range uris {
C.uris_set(urisUnsafe, C.CString(uri), C.int(i))
for i, file := range files {
C.uris_set_file(urisUnsafe, C.CString(file), C.int(i))
}
C.drag_window(urisUnsafe)

View File

@ -25,5 +25,5 @@ static void drag_end(
void drag_window(char **uris);
char **uris_make(int size);
void uris_set(char **uris, char *filename, int n);
void uris_set_file(char **uris, char *file, int n);
void uris_free(char **uris, int size);