Example #1
0
void HandleMessage_GetGlobalAttr(CClient& client, CDeserialiser& message)
{
	uint16_t	attr_id = message.ReadU16();
	
	CSerialiser	reply;
	reply.WriteU8(IPCMSG_REPLY);
	reply.WriteU8(IPCMSG_GETGLOBAL);
	reply.WriteU16(attr_id);
	
	switch(attr_id)
	{
	case IPC_GLOBATTR_SCREENDIMS: {
		uint8_t	screen_id = message.ReadU8();
		unsigned int w, h;
		gpCompositor->GetScreenDims(screen_id, &w, &h);
		reply.WriteU16( (w <= UINT16_MAX ? w : UINT16_MAX) );
		reply.WriteU16( (h <= UINT16_MAX ? h : UINT16_MAX) );
		break; }
	case IPC_GLOBATTR_MAXAREA:
		assert(!"TODO: IPC_GLOBATTR_MAXAREA");
		break;
	default:
		throw IPC::CClientFailure("Bad global attribute ID");
	}
	
	client.SendMessage(reply);
}
Example #2
0
void HandleMessage_Ping(CClient& client, CDeserialiser& message)
{
	// A client has asked for a ping, we pong them back
	CSerialiser	reply;
	reply.WriteU8(IPCMSG_REPLY);
	reply.WriteU8(IPCMSG_PING);
	client.SendMessage(reply);
}
Example #3
0
void SendMessage_KeyEvent(CClient& client, unsigned int WinID, uint32_t KeySym, bool Pressed, const char *Translated)
{
	CSerialiser	msg;
	msg.WriteU8(IPCMSG_INPUTEVENT);
	msg.WriteU8(IPC_INEV_KEYBOARD);
	msg.WriteU16(WinID);
	msg.WriteU16(KeySym);
	msg.WriteU8(Pressed ? 0 : 1);
	msg.WriteString(Translated);
	client.SendMessage(msg);
}
Example #4
0
void SendMessage_MouseButton(CClient& client, unsigned int WinID, unsigned int X, unsigned int Y, uint8_t Button, bool Pressed)
{
	CSerialiser	msg;
	msg.WriteU8(IPCMSG_INPUTEVENT);
	msg.WriteU8(IPC_INEV_MOUSEBTN);
	msg.WriteU16(WinID);
	msg.WriteU16(X);
	msg.WriteU16(Y);
	msg.WriteU8(Button);
	msg.WriteU8(Pressed ? 0 : 1);
	client.SendMessage(msg);
}
Example #5
0
void HandleMessage_GetWindowBuffer(CClient& client, CDeserialiser& message)
{
	uint16_t	win_id = message.ReadU16();
	_SysDebug("_GetWindowBuffer: (%i)", win_id);
	
	CWindow*	win = client.GetWindow(win_id);
	if(!win) {
		throw IPC::CClientFailure("_PushData: Bad window");
	}
	
	uint64_t handle = win->m_surface.GetSHMHandle();
	
	CSerialiser	reply;
	reply.WriteU8(IPCMSG_REPLY);
	reply.WriteU8(IPCMSG_GETWINBUF);
	reply.WriteU16(win_id);
	reply.WriteU64(handle);
	client.SendMessage(reply);
}
Example #6
0
BOOL CiUMeApp::InitInstance()
{
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();


	AfxEnableControlContainer();

	// 创建 shell 管理器,以防对话框包含
	// 任何 shell 树视图控件或 shell 列表视图控件。
	CShellManager *pShellManager = new CShellManager;

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

	m_strApp = GetApp();

	CPaintManagerUI::SetInstance(m_hInstance);

	if (!CheckInstance())		// 检查是否有另一个实例运行
		return FALSE;
#if 0
	CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("\\iUMe"));
#else	
	CPaintManagerUI::SetResourceZip(_T("iUMe.zip"));
#endif

	HRESULT Hr = ::CoInitialize(NULL);
	if( FAILED(Hr) ) return 0;

	CClient* pFrame = new CClient();
	if( pFrame == NULL ) return 0;
	pFrame->Create(NULL, _T("iUMe"), UI_WNDSTYLE_FRAME, WS_EX_WINDOWEDGE);	
	pFrame->SetIcon(IDR_Client);		// 设置任务栏中的图标
	pFrame->CenterWindow();
	pFrame->ShowWindow(true);
	pFrame->SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0);

	CPaintManagerUI::MessageLoop();

	::CoUninitialize();

	// 删除上面创建的 shell 管理器。
	if (pShellManager != NULL)
	{
		delete pShellManager;
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return FALSE;
}