// File: /workspace/github_c_makefile_star2_O1/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 0xc3520
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 0x16c(%rip), %rax       # 0xc3521
movq %rax, 0x8(%rdx)
leaq 0x30(%rsp), %r8
movq %rbx, (%r8)
leaq 0x15f(%rip), %rax       # 0xc3527
movq %rax, 0x8(%r8)
leaq 0x20(%rsp), %r10
movq %rbx, (%r10)
leaq 0x14d(%rip), %rax       # 0xc3528
movq %rax, 0x8(%r10)
leaq 0x10(%rsp), %r11
movq %rbx, (%r11)
leaq 0x145(%rip), %rax       # 0xc3533
movq %rax, 0x8(%r11)
xorl %r15d, %r15d
leaq 0x50e4e(%rip), %r14     # 0x11424a
leaq 0x50e0a(%rip), %rsi     # 0x11420d
leaq 0x50e18(%rip), %rcx     # 0x114222
leaq 0x50e25(%rip), %r9      # 0x114236
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 0x50e21(%rip), %rsi     # 0x11425f
leaq 0x50e27(%rip), %rcx     # 0x11426c
leaq 0x50e2b(%rip), %r9      # 0x114277
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
cmpq %r15, 0x148(%rbx)
jne 0xc34ac
movq 0x128(%rbx), %rdi
movq 0x138(%rbx), %rdx
leaq 0x50dd1(%rip), %rsi     # 0x11425f
leaq 0x50dd7(%rip), %rcx     # 0x11426c
movl $0x408, %r8d            # imm = 0x408
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x57500
movq %rax, 0x148(%rbx)
movq 0x148(%rbx), %rdi
testq %rdi, %rdi
je 0xc350b
movq 0x150(%rbx), %rdx
leaq 0x50dc3(%rip), %rsi     # 0x114289
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x56fc0
leaq 0x8(%rsp), %r14
movq $0x0, (%r14)
movq 0x148(%rbx), %rdi
leaq 0x50dac(%rip), %rsi     # 0x114295
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