0

XCB に問題があります。*_reply_t*_request_tタイプの違いがわかりません。

*_reply_tの代わりに が渡されているように見えますが*_response_t、構造は大きく異なります。

例えば:

xcb_randr_get_screen_resources_current_reply_t *reply = xcb_randr_get_screen_resources_current_reply(
        connection, xcb_randr_get_screen_resources_current(connection, root), NULL);

だから今replyはのタイプです*_reply_t。しかし今、私は最初の引数がここのドキュメントに従ってxcb_randr_get_screen_resources_current_outputs型であることを期待するものを使用する必要があります:xcb_randr_get_screen_resources_current_request_t

http://www.linuxhowtos.org/manpages/3/xcb_randr_get_screen_resources_current_outputs.htm

          xcb_randr_output_t *xcb_randr_get_screen_resources_current_outputs(
            const xcb_randr_get_screen_resources_current_request_t *reply
          );

ただし、最初の呼び出しからの応答のタイプはxcb_randr_get_screen_resources_current_reply_t( *_reply_t) です。これをキャストせずに出力呼び出しに渡すにはどうすればよいですか? ドキュメントごとに構造が完全に異なります。

typedef struct xcb_randr_get_screen_resources_current_reply_t {
    uint8_t         response_type;
    uint8_t         pad0;
    uint16_t        sequence;
    uint32_t        length;
    xcb_timestamp_t timestamp;
    xcb_timestamp_t config_timestamp;
    uint16_t        num_crtcs;
    uint16_t        num_outputs;
    uint16_t        num_modes;
    uint16_t        names_len;
    uint8_t         pad1[8];
} xcb_randr_get_screen_resources_current_reply_t;

そして、の構造体*_request_tはドキュメントにはありません。ここのソースコードから取得しました:

https://xcb.freedesktop.org/manual/randr_8h_source.html#l00896

   typedef struct xcb_randr_get_screen_resources_current_request_t {
       uint8_t      major_opcode; 
       uint8_t      minor_opcode; 
       uint16_t     length; 
       xcb_window_t window; 
   } xcb_randr_get_screen_resources_current_request_t;

私は ctypes を行うので、メソッドの署名のために事前に渡すタイプを宣言する必要があります。replyそのため、まったく異なる構造 ( ) の何かが、 の構造を持つ 2 番目の呼び出しにどのように入るのかについて、私は非常に混乱していrequestます。

4

1 に答える 1

1

あなたが遭遇したのは、単なるドキュメントのバグだと思います。*_request_t実際に取得すると主張するすべての関数は、を期待してい*_reply_tます。リンク元のソースから、実際の関数定義(マニュアルページに記載されているものではなく)を見るだけで、

xcb_randr_output_t *
    xcb_randr_get_screen_resources_current_outputs (const xcb_randr_get_screen_resources_current_reply_t *R  );

あなたが見つけた構造体は実際にはファイルのどこにも使用されていないため、おそらく忘れられた残り物であるか、互換性の理由からまだ残っている可能性があります。

于 2016-05-08T08:23:20.170 に答える