// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/gui/widgets/basic/titlebar.cpp
// Function: smooth::GUI::Titlebar::Process(int, int, int)
S::Int S::GUI::Titlebar::Process(Int message, Int wParam, Int lParam)
{
	if (!IsRegistered())		 return Error();
	if (!IsActive() || !IsVisible()) return Success();

#ifdef __WIN32__
	Window	*window = container->GetContainerWindow();
#endif

	Bool	 prevPaintActive = paintActive;

	switch (message)
	{
		case SM_GETFOCUS:
		case SM_LOSEFOCUS:
		case SM_WINDOWTITLECHANGED:
#ifdef __WIN32__
			if (GetActiveWindow() == (HWND) window->GetSystemWindow() && (!paintActive || message == SM_WINDOWTITLECHANGED))
			{
				paintActive = True;
			}
			else if (GetActiveWindow() != (HWND) window->GetSystemWindow())
			{
				paintActive = False;

				Widget	*remoteParent = Window::GetWindow(GetActiveWindow());

				if (remoteParent != NIL)
				{
					if (remoteParent->GetObjectType() == ToolWindow::classID)
					{
						do
						{
							remoteParent = remoteParent->GetContainer();

							if (remoteParent == window) { paintActive = True; break; }
						}
						while (remoteParent != NIL);
					}
				}
			}
#endif
			if (message == SM_WINDOWTITLECHANGED || paintActive != prevPaintActive) Paint(SP_PAINT);

			break;
	}

	return Widget::Process(message, wParam, lParam);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x60(%rbp)
movq (%rdi), %rax
callq *0x88(%rax)
testb $0x1, %al
jne 0xa880b
leaq -0x30(%rbp), %rdi
movq %rdi, -0x70(%rbp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5a9c0
movq -0x70(%rbp), %rdi
callq 0x59680
movl %eax, -0x64(%rbp)
jmp 0xa87dd
movl -0x64(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x5b5b0
jmp 0xa88f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x5b5b0
jmp 0xa88ff
movq -0x60(%rbp), %rdi
movq (%rdi), %rax
callq *0x98(%rax)
testb $0x1, %al
jne 0xa881e
jmp 0xa882f
movq -0x60(%rbp), %rdi
movq (%rdi), %rax
callq *0x90(%rax)
testb $0x1, %al
jne 0xa8878
leaq -0x50(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x5ca80
movq -0x80(%rbp), %rdi
callq 0x59680
movl %eax, -0x74(%rbp)
jmp 0xa884a
movl -0x74(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5a410
jmp 0xa88f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5a410
jmp 0xa88ff
movq -0x60(%rbp), %rax
movb 0x5b8(%rax), %al
andb $0x1, %al
movb %al, -0x51(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x84(%rbp)
subl $0x780a, %eax           # imm = 0x780A
je 0xa88ab
jmp 0xa8899
movl -0x84(%rbp), %eax
addl $0xffff87ee, %eax       # imm = 0xFFFF87EE
subl $0x1, %eax
ja 0xa88de
jmp 0xa88ab
cmpl $0x780a, -0x14(%rbp)    # imm = 0x780A
je 0xa88d0
movq -0x60(%rbp), %rax
movb 0x5b8(%rax), %al
andb $0x1, %al
movzbl %al, %eax
movb -0x51(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
je 0xa88dc
movq -0x60(%rbp), %rdi
movq (%rdi), %rax
xorl %esi, %esi
callq *0x78(%rax)
jmp 0xa88de
movq -0x60(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
callq 0x5cbf0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x5b6b0
nopl (%rax,%rax)