本文整理汇总了C++中CClient::GetWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ CClient::GetWindow方法的具体用法?C++ CClient::GetWindow怎么用?C++ CClient::GetWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClient
的用法示例。
在下文中一共展示了CClient::GetWindow方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleMessage_DrawRect
void HandleMessage_DrawRect(CClient& client, CDeserialiser& message)
{
uint16_t win_id = message.ReadU16();
uint16_t x = message.ReadU16();
uint16_t y = message.ReadU16();
uint16_t w = message.ReadU16();
uint16_t h = message.ReadU16();
uint32_t colour = message.ReadU32();
_SysDebug("_DrawRect: (%i (%i,%i) %ix%i %06x)", win_id, x, y, w, h, colour);
CWindow* win = client.GetWindow(win_id);
if(!win) {
throw IPC::CClientFailure("_DrawRect: Bad window");
}
if(h == 0) {
}
else if(h == 1) {
win->FillScanline(y, x, w, colour);
}
else if(h == 2) {
win->FillScanline(y++, x, w, colour);
win->FillScanline(y++, x, w, colour);
}
else {
win->FillScanline(y++, x, w, colour);
while( h -- > 2 ) {
win->FillScanline(y, x, 1, colour);
win->FillScanline(y, x+w-1, 1, colour);
y ++;
}
win->FillScanline(y++, x, w, colour);
}
}
示例2: HandleMessage_PushData
void HandleMessage_PushData(CClient& client, CDeserialiser& message)
{
uint16_t win_id = message.ReadU16();
uint16_t x = message.ReadU16();
uint16_t y = message.ReadU16();
uint16_t w = message.ReadU16();
uint16_t h = message.ReadU16();
_SysDebug("_PushData: (%i, (%i,%i) %ix%i)", win_id, x, y, w, h);
CWindow* win = client.GetWindow(win_id);
if(!win) {
throw IPC::CClientFailure("_PushData: Bad window");
}
for( unsigned int row = 0; row < h; row ++ )
{
const ::std::vector<uint8_t> scanline_data = message.ReadBuffer();
if( scanline_data.size() != w * 4 ) {
_SysDebug("ERROR _PushData: Scanline buffer size mismatch (%i,%i)",
scanline_data.size(), w*4);
continue ;
}
win->DrawScanline(y+row, x, w, scanline_data.data());
}
}
示例3: HandleMessage_DestroyWindow
void HandleMessage_DestroyWindow(CClient& client, CDeserialiser& message)
{
uint16_t win_id = message.ReadU16();
_SysDebug("_DestroyWindow: (%i)", win_id);
CWindow* win = client.GetWindow(win_id);
if(!win) {
throw IPC::CClientFailure("_DestroyWindow: Bad window");
}
client.SetWindow(win_id, 0);
// TODO: Directly inform compositor?
delete win;
}
示例4: HandleMessage_DamageRect
void HandleMessage_DamageRect(CClient& client, CDeserialiser& message)
{
uint16_t winid = message.ReadU16();
uint16_t x = message.ReadU16();
uint16_t y = message.ReadU16();
uint16_t w = message.ReadU16();
uint16_t h = message.ReadU16();
_SysDebug("_DamageRect: (%i %i,%i %ix%i)", winid, x, y, w, h);
CWindow* win = client.GetWindow(winid);
if(!win) {
throw IPC::CClientFailure("_PushData: Bad window");
}
CRect area(x,y,w,h);
win->Repaint(area);
}
示例5: HandleMessage_GetWindowBuffer
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);
}
示例6: HandleMessage_DrawText
void HandleMessage_DrawText(CClient& client, CDeserialiser& message)
{
uint16_t win_id = message.ReadU16();
uint16_t x = message.ReadU16();
uint16_t y = message.ReadU16();
uint16_t w = message.ReadU16();
uint16_t h = message.ReadU16();
uint16_t font_id = message.ReadU16();
::std::string str = message.ReadString();
_SysDebug("_DrawText: (%i (%i,%i) %ix%i Font%i \"%s\")", win_id, x, y, w, h, font_id, str.c_str());
CWindow* win = client.GetWindow(win_id);
if(!win) {
throw IPC::CClientFailure("_DrawText: Bad window");
}
// 1. Get font from client structure
IFontFace& fontface = client.GetFont(font_id);
// 2. Render
CRect area(x, y, w, h);
fontface.Render(win->m_surface, area, str, h);
}
示例7: HandleMessage_SetWindowAttr
void HandleMessage_SetWindowAttr(CClient& client, CDeserialiser& message)
{
uint16_t win_id = message.ReadU16();
uint16_t attr_id = message.ReadU16();
_SysDebug("_SetWindowAttr: (Win=%i, ID=%i)", win_id, attr_id);
CWindow* win = client.GetWindow(win_id);
if(!win) {
throw IPC::CClientFailure("_SetWindowAttr - Bad window");
}
switch(attr_id)
{
case IPC_WINATTR_DIMENSIONS: {
uint16_t new_w = message.ReadU16();
uint16_t new_h = message.ReadU16();
win->Resize(new_w, new_h);
break; }
case IPC_WINATTR_POSITION: {
int16_t new_x = message.ReadS16();
int16_t new_y = message.ReadS16();
win->Move(new_x, new_y);
break; }
case IPC_WINATTR_SHOW:
win->Show( message.ReadU8() != 0 );
break;
case IPC_WINATTR_FLAGS:
win->SetFlags( message.ReadU8() ); // TODO: U8? why so small?
break;
case IPC_WINATTR_TITLE:
assert(!"TODO: IPC_WINATTR_TITLE");
break;
default:
_SysDebug("HandleMessage_SetWindowAttr - Bad attr %u", attr_id);
throw IPC::CClientFailure("Bad window attr");
}
}
示例8: HandleMessage_DrawCtl
void HandleMessage_DrawCtl(CClient& client, CDeserialiser& message)
{
uint16_t win_id = message.ReadU16();
uint16_t x = message.ReadU16();
uint16_t y = message.ReadU16();
uint16_t w = message.ReadU16();
uint16_t h = message.ReadU16();
uint16_t ctrl_id = message.ReadU16();
uint16_t frame = message.ReadU16();
_SysDebug("_DrawCtl: (%i, (%i,%i) %ix%i Ctl%i frame?=0x%04x)", win_id, x, y, w, h, ctrl_id, frame);
CWindow* win = client.GetWindow(win_id);
if(!win) {
throw IPC::CClientFailure("_DrawCtl: Bad window");
}
const CControl* ctrl = CControl::GetByID(ctrl_id);
if(!ctrl) {
throw IPC::CClientFailure("_DrawCtl: Invalid control ID");
}
CRect area(x,y,w,h);
ctrl->Render(win->m_surface, area);
}