// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/gui/window/backends/xlib/windowxlib.cpp
// Function: smooth::GUI::WindowXLib::GetDroppedFiles() const
const S::Array<S::String> &S::GUI::WindowXLib::GetDroppedFiles() const
{
	static Atom	 mimeURIListAtom   = XInternAtom(display, "text/uri-list", False);

	static Atom	 xdndSelectionAtom = XInternAtom(display, "XdndSelection", False);

	static Array<String>	 fileNames;

	fileNames.RemoveAll();

	XConvertSelection(display, xdndSelectionAtom, mimeURIListAtom, XA_PRIMARY, wnd, xdndTimeStamp);
	XFlush(display);

	/* Wait for SelectionNotify event to be sent.
	 */
	XEvent	 event;

	do
	{
		XNextEvent(display, &event);

		WindowXLib	*backend = GUI::WindowXLib::GetWindowBackend(event.xany.window);

		if (backend != NIL) backend->ProcessSystemMessages(&event);
	}
	while (event.type != SelectionNotify);

	Atom		 type;
	int		 format;
	unsigned long	 items, bytes;
	unsigned char	*data = NIL;

	/* Do not get any data yet, see how much data is there.
	 */
	if (XGetWindowProperty(display, wnd, XA_PRIMARY, 0, 0, 0, AnyPropertyType, &type, &format, &items, &bytes, &data) == 0)
	{
		if (data != NIL) { XFree(data); data = NIL; }

		/* Data is there!
		 */
		if (bytes > 0) XGetWindowProperty(display, wnd, XA_PRIMARY, 0, bytes, 0, AnyPropertyType, &type, &format, &items, &bytes, &data);
	}

	if (data == NIL) return fileNames;

	/* Query data.
	 */
	IO::InStream	 in(IO::STREAM_BUFFER, data, strlen((char *) data) + 1);

	while (in.GetPos() < in.Size())
	{
		String	 line = in.InputLine();

		if (line.StartsWith("#")) continue;

		if (line.StartsWith("file://"))
		{
			String	 host = line.SubString(7, line.Tail(line.Length() - 7).Find("/"));

			fileNames.Add(Encoding::URLEncode::Decode(line.Tail(line.Length() - 7 - host.Length())));
		}
	}

	in.Close();

	XFree(data);

	return fileNames;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x360, %rsp            # imm = 0x360
movq %rdi, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x2f8(%rbp)
cmpb $0x0, 0xee1c4(%rip)     # 0x214ad8
jne 0x126966
leaq 0xee1bb(%rip), %rdi     # 0x214ad8
callq 0x5a4e0
cmpl $0x0, %eax
je 0x126966
movq -0x2f8(%rbp), %rax
movq 0x120(%rax), %rdi
leaq 0x80082(%rip), %rsi     # 0x1a69be
xorl %edx, %edx
callq 0x5c7a0
movq %rax, -0x300(%rbp)
jmp 0x12694c
movq -0x300(%rbp), %rax
movq %rax, 0xee176(%rip)     # 0x214ad0
leaq 0xee177(%rip), %rdi     # 0x214ad8
callq 0x5b0c0
cmpb $0x0, 0xee17b(%rip)     # 0x214ae8
jne 0x1269bf
leaq 0xee172(%rip), %rdi     # 0x214ae8
callq 0x5a4e0
cmpl $0x0, %eax
je 0x1269bf
movq -0x2f8(%rbp), %rax
movq 0x120(%rax), %rdi
leaq 0x801d4(%rip), %rsi     # 0x1a6b69
xorl %edx, %edx
callq 0x5c7a0
movq %rax, -0x308(%rbp)
jmp 0x1269a5
movq -0x308(%rbp), %rax
movq %rax, 0xee12d(%rip)     # 0x214ae0
leaq 0xee12e(%rip), %rdi     # 0x214ae8
callq 0x5b0c0
cmpb $0x0, 0xee182(%rip)     # 0x214b48
jne 0x126a0d
leaq 0xee179(%rip), %rdi     # 0x214b48
callq 0x5a4e0
cmpl $0x0, %eax
je 0x126a0d
leaq 0xee110(%rip), %rdi     # 0x214af0
callq 0x74650
jmp 0x1269e7
leaq -0xb235e(%rip), %rdi    # 0x74690
leaq 0xee0fb(%rip), %rsi     # 0x214af0
leaq 0xe4d04(%rip), %rdx     # 0x20b700
callq 0x5c700
leaq 0xee140(%rip), %rdi     # 0x214b48
callq 0x5b0c0
leaq 0xee0dc(%rip), %rdi     # 0x214af0
callq 0x74ed0
movq -0x2f8(%rbp), %rax
movq 0x120(%rax), %rdi
movq 0xee0b2(%rip), %rsi     # 0x214ae0
movq 0xee09b(%rip), %rdx     # 0x214ad0
movq 0x138(%rax), %r8
movq 0x168(%rax), %r9
movl $0x1, %ecx
callq 0x5d2d0
movq -0x2f8(%rbp), %rax
movq 0x120(%rax), %rdi
callq 0x5a0d0
movq -0x2f8(%rbp), %rax
movq 0x120(%rax), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x5c7e0
movq -0xd0(%rbp), %rdi
callq 0x121de0
movq %rax, -0xf8(%rbp)
cmpq $0x0, -0xf8(%rbp)
je 0x126b03
movq -0xf8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x1223c0
jmp 0x126b03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq 0xee019(%rip), %rdi     # 0x214ad8
callq 0x5a860
jmp 0x127039
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq 0xee00c(%rip), %rdi     # 0x214ae8
callq 0x5a860
jmp 0x127039
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq 0xee04f(%rip), %rdi     # 0x214b48
callq 0x5a860
jmp 0x127039
jmp 0x126b05
cmpl $0x1f, -0xf0(%rbp)
jne 0x126a60
movq -0x2f8(%rbp), %rax
movq $0x0, -0x120(%rbp)
movq 0x120(%rax), %rdi
movq 0x138(%rax), %rsi
movl $0x1, %edx
xorl %eax, %eax
movl %eax, %r8d
xorl %r9d, %r9d
leaq -0x100(%rbp), %r14
leaq -0x104(%rbp), %rbx
leaq -0x110(%rbp), %r11
leaq -0x118(%rbp), %r10
leaq -0x120(%rbp), %rax
movq %r8, %rcx
movq $0x0, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
callq 0x5cb20
cmpl $0x0, %eax
jne 0x126c32
cmpq $0x0, -0x120(%rbp)
je 0x126bb5
movq -0x120(%rbp), %rdi
callq 0x5c780
movq $0x0, -0x120(%rbp)
cmpq $0x0, -0x118(%rbp)
jbe 0x126c30
movq -0x2f8(%rbp), %rax
movq 0x120(%rax), %rdi
movq 0x138(%rax), %rsi
movq -0x118(%rbp), %r8
movl $0x1, %edx
xorl %eax, %eax
movl %eax, %ecx
xorl %r9d, %r9d
leaq -0x100(%rbp), %r14
leaq -0x104(%rbp), %rbx
leaq -0x110(%rbp), %r11
leaq -0x118(%rbp), %r10
leaq -0x120(%rbp), %rax
movq $0x0, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
callq 0x5cb20
jmp 0x126c32
cmpq $0x0, -0x120(%rbp)
jne 0x126c4c
leaq 0xedead(%rip), %rax     # 0x214af0
movq %rax, -0x18(%rbp)
jmp 0x127029
movq -0x120(%rbp), %rax
movq %rax, -0x310(%rbp)
movq -0x120(%rbp), %rdi
callq 0x5a790
movq -0x310(%rbp), %rdx
movq %rax, %rcx
addq $0x1, %rcx
leaq -0x228(%rbp), %rdi
movl $0x5, %esi
callq 0x5aa00
leaq -0x228(%rbp), %rdi
callq 0x5da70
movq %rax, -0x318(%rbp)
jmp 0x126c9a
leaq -0x228(%rbp), %rdi
callq 0x5a580
movq %rax, -0x320(%rbp)
jmp 0x126caf
movq -0x318(%rbp), %rax
movq -0x320(%rbp), %rcx
cmpq %rcx, %rax
jge 0x126fdc
leaq -0x240(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x5b9a0
jmp 0x126cdb
leaq 0x89610(%rip), %rsi     # 0x1b02f2
leaq -0x258(%rbp), %rdi
callq 0x5c1f0
jmp 0x126cf0
leaq -0x240(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x5bf60
movb %al, -0x321(%rbp)
jmp 0x126d0b
leaq -0x258(%rbp), %rdi
callq 0x5df00
movb -0x321(%rbp), %al
testb $0x1, %al
jne 0x126d23
jmp 0x126d71
movl $0x4, -0x25c(%rbp)
jmp 0x126fac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x12701b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x126fce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x5df00
jmp 0x126fce
leaq 0x7f9b6(%rip), %rsi     # 0x1a672e
leaq -0x278(%rbp), %rdi
callq 0x5c1f0
jmp 0x126d86
leaq -0x240(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x5bf60
movb %al, -0x322(%rbp)
jmp 0x126da1
leaq -0x278(%rbp), %rdi
callq 0x5df00
movb -0x322(%rbp), %al
testb $0x1, %al
jne 0x126dbc
jmp 0x126fa2
leaq -0x240(%rbp), %rdi
callq 0x5b800
movl %eax, -0x328(%rbp)
jmp 0x126dd0
movl -0x328(%rbp), %edx
addl $-0x7, %edx
leaq -0x2a8(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x5c8a0
jmp 0x126dee
leaq 0x60841(%rip), %rsi     # 0x187636
leaq -0x2c0(%rbp), %rdi
callq 0x5c1f0
jmp 0x126e03
leaq -0x2a8(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x5bd60
movl %eax, -0x32c(%rbp)
jmp 0x126e1e
movl -0x32c(%rbp), %ecx
leaq -0x290(%rbp), %rdi
leaq -0x240(%rbp), %rsi
movl $0x7, %edx
callq 0x5dc20
jmp 0x126e3e
leaq -0x2c0(%rbp), %rdi
callq 0x5df00
leaq -0x2a8(%rbp), %rdi
callq 0x5df00
leaq -0x240(%rbp), %rdi
callq 0x5b800
movl %eax, -0x330(%rbp)
jmp 0x126e6a
movl -0x330(%rbp), %eax
addl $-0x7, %eax
movl %eax, -0x338(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x5b800
movl %eax, -0x334(%rbp)
jmp 0x126e8d
movl -0x334(%rbp), %eax
movl -0x338(%rbp), %edx
subl %eax, %edx
leaq -0x2f0(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x5c8a0
jmp 0x126eb0
leaq -0x2d8(%rbp), %rdi
leaq -0x2f0(%rbp), %rsi
callq 0x5af70
jmp 0x126ec5
leaq 0xedc24(%rip), %rdi     # 0x214af0
leaq -0x2d8(%rbp), %rsi
callq 0x74750
jmp 0x126eda
leaq -0x2d8(%rbp), %rdi
callq 0x5df00
leaq -0x2f0(%rbp), %rdi
callq 0x5df00
leaq -0x290(%rbp), %rdi
callq 0x5df00
jmp 0x126fa2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x5df00
jmp 0x126fce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x126f46
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x5df00
leaq -0x2a8(%rbp), %rdi
callq 0x5df00
jmp 0x126fce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x126f94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x126f88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x5df00
leaq -0x2f0(%rbp), %rdi
callq 0x5df00
leaq -0x290(%rbp), %rdi
callq 0x5df00
jmp 0x126fce
movl $0x0, -0x25c(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x5df00
movl -0x25c(%rbp), %eax
testl %eax, %eax
je 0x126fc9
jmp 0x126fc4
jmp 0x126c85
jmp 0x126c85
leaq -0x240(%rbp), %rdi
callq 0x5df00
jmp 0x12701b
leaq -0x228(%rbp), %rdi
callq 0x59400
jmp 0x126fea
movq -0x120(%rbp), %rdi
callq 0x5c780
jmp 0x126ff8
leaq 0xedaf1(%rip), %rax     # 0x214af0
movq %rax, -0x18(%rbp)
movl $0x1, -0x25c(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x59710
jmp 0x127029
leaq -0x228(%rbp), %rdi
callq 0x59710
jmp 0x127039
movq -0x18(%rbp), %rax
addq $0x360, %rsp            # imm = 0x360
popq %rbx
popq %r14
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x5b6b0
nopw %cs:(%rax,%rax)