// File: /workspace/github_c_makefile_star2_O2/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 0xbc2f3
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movq 0x120(%rdi), %rdi
callq 0x5a230
leaq 0x58(%rsp), %rdx
movq %rbx, (%rdx)
leaq 0x16d(%rip), %rax       # 0xbc2f4
movq %rax, 0x8(%rdx)
leaq 0x48(%rsp), %r8
movq %rbx, (%r8)
leaq 0x15e(%rip), %rax       # 0xbc2f8
movq %rax, 0x8(%r8)
leaq 0x38(%rsp), %rax
movq %rbx, (%rax)
leaq 0x14c(%rip), %rcx       # 0xbc2f9
movq %rcx, 0x8(%rax)
leaq 0x28(%rsp), %rcx
movq %rbx, (%rcx)
leaq 0x144(%rip), %rsi       # 0xbc304
movq %rsi, 0x8(%rcx)
movq %rcx, 0x10(%rsp)
leaq 0x47166(%rip), %rcx     # 0x103336
andq $0x0, 0x18(%rsp)
movq %rcx, 0x8(%rsp)
movq %rax, (%rsp)
leaq 0x47113(%rip), %rsi     # 0x1032f9
leaq 0x47121(%rip), %rcx     # 0x10330e
leaq 0x4712e(%rip), %r9      # 0x103322
xorl %edi, %edi
xorl %eax, %eax
callq 0x58da0
movq %rax, %r14
movq 0x128(%rbx), %rdi
movq 0x138(%rbx), %rdx
andq $0x0, 0x8(%rsp)
movq %rax, (%rsp)
leaq 0x4712c(%rip), %rsi     # 0x10334b
leaq 0x47132(%rip), %rcx     # 0x103358
leaq 0x47136(%rip), %r9      # 0x103363
movl $0x402, %r8d            # imm = 0x402
xorl %eax, %eax
callq 0x58700
movq %rax, 0x148(%rbx)
movq %r14, %rdi
callq 0x59110
movq 0x148(%rbx), %rdi
testq %rdi, %rdi
jne 0xbc290
movq 0x128(%rbx), %rdi
movq 0x138(%rbx), %rdx
leaq 0x470e1(%rip), %rsi     # 0x10334b
leaq 0x470e7(%rip), %rcx     # 0x103358
movl $0x408, %r8d            # imm = 0x408
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x58700
movq %rax, %rdi
movq %rax, 0x148(%rbx)
testq %rax, %rax
je 0xbc2e0
movq 0x150(%rbx), %rdx
leaq 0x470d7(%rip), %rsi     # 0x103375
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x58170
leaq 0x20(%rsp), %r14
andq $0x0, (%r14)
movq 0x148(%rbx), %rdi
leaq 0x470c3(%rip), %rsi     # 0x103381
movq %r14, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x59560
movq 0x120(%rbx), %rdi
movq 0x150(%rbx), %rsi
movq (%r14), %rdx
callq 0x598f0
movq 0x120(%rbx), %rdi
callq 0x578a0
addq $0x68, %rsp
popq %rbx
popq %r14
retq