// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/classes/gui/window/backends/xlib/windowxlib.cpp
// Function: smooth::GUI::WindowXLib::CreateInputContext()
S::Void S::GUI::WindowXLib::CreateInputContext()
{
	if (im == NIL) return;

	XLockDisplay(display);

	/* Set up callbacks.
	 */
	XIMCallback	 cbPeStart  = { (XPointer) this, (XIMProc) S::GUI::OnXIMPreeditStart };
	XIMCallback	 cbPeDone   = { (XPointer) this, (XIMProc) S::GUI::OnXIMPreeditDone  };
	XIMCallback	 cbPeDraw   = { (XPointer) this, (XIMProc) S::GUI::OnXIMPreeditDraw  };
	XIMCallback	 cbPeCaret  = { (XPointer) this, (XIMProc) S::GUI::OnXIMPreeditCaret };

	XVaNestedList	 preeditCbs = XVaCreateNestedList(0, XNPreeditStartCallback, &cbPeStart,
							     XNPreeditDoneCallback,  &cbPeDone,
							     XNPreeditDrawCallback,  &cbPeDraw,
							     XNPreeditCaretCallback, &cbPeCaret, NULL);

	/* Create input context.
	 */
	ic = XCreateIC(im, XNClientWindow,	wnd,
			   XNInputStyle,	XIMPreeditCallbacks | XIMStatusNothing,
			   XNPreeditAttributes,	preeditCbs, NULL);

	XFree(preeditCbs);

	if (ic == NIL)
	{
		/* Creating an IC for pre-editing can fail if the desktop environment does
		 * not support it. Try creating one without pre-editing in that case.
		 */
		ic = XCreateIC(im, XNClientWindow, wnd,
				   XNInputStyle,   XIMPreeditNothing | XIMStatusNothing, NULL);
	}

	/* Configure input context.
	 */
	if (ic != NIL)
	{
		/* Set focus window.
		 */
		XSetICValues(ic, XNFocusWindow, iwnd, NULL);

		/* Get mask of filter events for IC.
		 */
		long	 filterEvents = 0;

		XGetICValues(ic, XNFilterEvents, &filterEvents, NULL);

		XSelectInput(display, iwnd, filterEvents);
	}

	XUnlockDisplay(display);
}

// Assembly:
cmpq $0x0, 0x128(%rdi)
je 0xc238b
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
movq 0x120(%rdi), %rdi
callq 0x58ec0
leaq 0x40(%rsp), %rdx
movq %rbx, (%rdx)
leaq 0x16b(%rip), %rax       # 0xc238c
movq %rax, 0x8(%rdx)
leaq 0x30(%rsp), %r8
movq %rbx, (%r8)
leaq 0x15e(%rip), %rax       # 0xc2392
movq %rax, 0x8(%r8)
leaq 0x20(%rsp), %r10
movq %rbx, (%r10)
leaq 0x14c(%rip), %rax       # 0xc2393
movq %rax, 0x8(%r10)
leaq 0x10(%rsp), %r11
movq %rbx, (%r11)
leaq 0x144(%rip), %rax       # 0xc239e
movq %rax, 0x8(%r11)
xorl %r15d, %r15d
leaq 0x511ee(%rip), %r14     # 0x113456
leaq 0x511aa(%rip), %rsi     # 0x113419
leaq 0x511b8(%rip), %rcx     # 0x11342e
leaq 0x511c5(%rip), %r9      # 0x113442
xorl %edi, %edi
xorl %eax, %eax
pushq %r15
pushq %r11
pushq %r14
pushq %r10
callq 0x57b30
addq $0x20, %rsp
movq %rax, %r14
movq 0x128(%rbx), %rdi
movq 0x138(%rbx), %rdx
leaq 0x511c1(%rip), %rsi     # 0x11346b
leaq 0x511c7(%rip), %rcx     # 0x113478
leaq 0x511cb(%rip), %r9      # 0x113483
movl $0x402, %r8d            # imm = 0x402
xorl %eax, %eax
pushq %r15
pushq %r14
callq 0x57500
addq $0x10, %rsp
movq %rax, 0x148(%rbx)
movq %r14, %rdi
callq 0x57e80
movq 0x148(%rbx), %rdi
testq %rdi, %rdi
jne 0xc2323
movq 0x128(%rbx), %rdi
movq 0x138(%rbx), %rdx
leaq 0x5116e(%rip), %rsi     # 0x11346b
leaq 0x51174(%rip), %rcx     # 0x113478
movl $0x408, %r8d            # imm = 0x408
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x57500
movq %rax, %rdi
movq %rax, 0x148(%rbx)
testq %rax, %rax
je 0xc2376
movq 0x150(%rbx), %rdx
leaq 0x51164(%rip), %rsi     # 0x113495
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x56fc0
leaq 0x8(%rsp), %r14
movq $0x0, (%r14)
movq 0x148(%rbx), %rdi
leaq 0x5114d(%rip), %rsi     # 0x1134a1
movq %r14, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x582b0
movq 0x120(%rbx), %rdi
movq 0x150(%rbx), %rsi
movq (%r14), %rdx
callq 0x58600
movq 0x120(%rbx), %rdi
callq 0x56760
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq