| 81 | } |
| 82 | |
| 83 | int64_t WMInstance::CreateWindowBuffer(int width, int height, WindowBuffer** buffer){ |
| 84 | size_t windowBufferSize = ((sizeof(WindowBuffer) + 0x1F) & (~0x1F)) + ((width * height * 4 + 0x1F) & (~0x1F) /* Round up to 32 bytes */) * 2; |
| 85 | |
| 86 | int64_t windowBufferKey = Lemon::CreateSharedMemory(windowBufferSize, SMEM_FLAGS_SHARED); |
| 87 | if(windowBufferKey <= 0){ |
| 88 | printf("[LemonWM] Warning: Error %ld obtaining shared memory for window\n", -windowBufferKey); |
| 89 | return windowBufferKey; |
| 90 | } |
| 91 | |
| 92 | WindowBuffer* windowBufferInfo = (WindowBuffer*)Lemon::MapSharedMemory(windowBufferKey); |
| 93 | windowBufferInfo->currentBuffer = 0; |
| 94 | windowBufferInfo->buffer1Offset = ((sizeof(WindowBuffer) + 0x1F) & (~0x1F)); |
| 95 | windowBufferInfo->buffer2Offset = ((sizeof(WindowBuffer) + 0x1F) & (~0x1F)) + ((width * height * 4 + 0x1F) & (~0x1F) /* Round up to 32 bytes*/); |
| 96 | |
| 97 | *buffer = windowBufferInfo; |
| 98 | |
| 99 | return windowBufferKey; |
| 100 | } |
| 101 | |
| 102 | void WMInstance::Poll(){ |
| 103 | Lemon::Message m; |
nothing calls this directly
no test coverage detected