Login
Immutable PageDiscussionInfoAttachments
Diff for "clear/note/2012-05"

MMA
Differences between revisions 2 and 3
Revision 2 as of 2012-05-01 01:01:06
Size: 531
Editor: clear
Comment:
Revision 3 as of 2012-05-01 01:01:44
Size: 569
Editor: clear
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
=== XPeekEvent === === PeekMessageとXPeekEventは似てるけど違う ===

2012年5月

05/01

PeekMessageとXPeekEventは似てるけど違う

Windows APIのPeekMessage()はメッセージがない場合ただちに返ってくるが、XlibのXPeekEvent()はイベントが来るまでブロックするらしい。XlibでPeekMessage()相当のことをやりたい時はXPending()+XNextEvent()でできそう。

for (;;) {
    if (XPending(dpy)) {
        XNextEvent(dpy, &ev);
        /* ... */
    } else {
        /* イベントがないときの処理 */
    }
}

clear/note/2012-05 (last edited 2012-05-31 03:01:20 by clear)