コード例 #1
0
 bool kbd_input(const timeval & now, uint32_t uchar) override {
     (void)now;
     if (keyboard_buffer_32.has_room(sizeof(uint32_t))) {
         keyboard_buffer_32.out_uint32_le(uchar);
     }
     return true;
 }
コード例 #2
0
ファイル: bitmapupdate.hpp プロジェクト: wallix/redemption
    void emit(OutStream & stream) const {
        unsigned expected;

        if (    (this->flags & BITMAP_COMPRESSION)
            && !(this->flags & NO_BITMAP_COMPRESSION_HDR)) {
            expected = 26; /* destLeft(2) + destTop(2) + destRight(2) +
                              destBottom(2) + width(2) + height(2) +
                              bitsPerPixel(2) + flags(2) + bitmapLength(2) +
                              cbCompFirstRowSize(2) + cbCompMainBodySize(2) +
                              cbScanWidth(2) + cbUncompressedSize(2) */
        }
        else {
            expected = 18; /* destLeft(2) + destTop(2) + destRight(2) +
                              destBottom(2) + width(2) + height(2) +
                              bitsPerPixel(2) + flags(2) + bitmapLength(2) */
        }

        if (!stream.has_room(expected)) {
            LOG( LOG_ERR
               , "BitmapData::emit - stream too small, need=%u, remains=%zu"
               , expected, stream.tailroom());
            throw Error(ERR_STREAM_MEMORY_TOO_SMALL);
        }

        stream.out_uint16_le(this->dest_left);
        stream.out_uint16_le(this->dest_top);
        stream.out_uint16_le(this->dest_right);
        stream.out_uint16_le(this->dest_bottom);
        stream.out_uint16_le(this->width);
        stream.out_uint16_le(this->height);
        stream.out_uint16_le(this->bits_per_pixel);
        stream.out_uint16_le(this->flags);
        stream.out_uint16_le(this->bitmap_length);

        if (    (this->flags & BITMAP_COMPRESSION)
            && !(this->flags & NO_BITMAP_COMPRESSION_HDR)) {
            stream.out_uint16_le(0x0000);   /* cbCompFirstRowSize (2 bytes) */
            stream.out_uint16_le(this->cb_comp_main_body_size);
            stream.out_uint16_le(this->cb_scan_width);
            stream.out_uint16_le(this->cb_uncompressed_size);
        }
    }