Mercurial > mplayer.hg
comparison mp_fifo.c @ 33145:1e637ada9003
Avoid MPlayer ignoring a key press completely, instead sending
MP_KEY_RELEASE_ALL all the time.
author | reimar |
---|---|
date | Thu, 07 Apr 2011 21:49:06 +0000 |
parents | 03ed899a72bc |
children | d63bf64a2094 |
comparison
equal
deleted
inserted
replaced
33144:a2a32138597b | 33145:1e637ada9003 |
---|---|
37 // Make sure we do not reset key state because of a down event | 37 // Make sure we do not reset key state because of a down event |
38 if((code & MP_KEY_DOWN) && fifo_free <= (key_fifo_size >> 1)) | 38 if((code & MP_KEY_DOWN) && fifo_free <= (key_fifo_size >> 1)) |
39 return; | 39 return; |
40 // in the worst case, just reset key state | 40 // in the worst case, just reset key state |
41 if (fifo_free == 1) { | 41 if (fifo_free == 1) { |
42 // ensure we do not only create MP_KEY_RELEASE_ALL events | |
43 if (previous_down_key & MP_KEY_RELEASE_ALL) | |
44 return; | |
42 // HACK: this ensures that a fifo size of 2 does | 45 // HACK: this ensures that a fifo size of 2 does |
43 // not queue any key presses while still allowing | 46 // not queue any key presses while still allowing |
44 // the mouse wheel to work (which sends down and up | 47 // the mouse wheel to work (which sends down and up |
45 // at nearly the same time | 48 // at nearly the same time |
46 if (code != previous_down_key) | 49 if (code != previous_down_key) |
50 key_fifo_data[key_fifo_write % key_fifo_size]=code; | 53 key_fifo_data[key_fifo_write % key_fifo_size]=code; |
51 key_fifo_write++; | 54 key_fifo_write++; |
52 if (code & MP_KEY_DOWN) | 55 if (code & MP_KEY_DOWN) |
53 previous_down_key = code & ~MP_KEY_DOWN; | 56 previous_down_key = code & ~MP_KEY_DOWN; |
54 else | 57 else |
55 previous_down_key = 0; | 58 previous_down_key = code & MP_KEY_RELEASE_ALL; |
56 } | 59 } |
57 | 60 |
58 int mplayer_get_key(int fd){ | 61 int mplayer_get_key(int fd){ |
59 int key; | 62 int key; |
60 if (key_fifo_data == NULL) | 63 if (key_fifo_data == NULL) |