projects
/
dcpu16
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
consolidated log message callbacks
[dcpu16]
/
hw_keyboard.c
diff --git
a/hw_keyboard.c
b/hw_keyboard.c
index aaf2f2c88f5a24cd5139517343bd15348d165205..f69b8f4227e7eaa07a69ce7ffcfdc3ab9f5c0004 100644
(file)
--- a/
hw_keyboard.c
+++ b/
hw_keyboard.c
@@
-70,7
+70,9
@@
void keyboard_rfbevent_(rfbBool down, rfbKeySym key, rfbClientPtr cl) {
struct dcpu16_hw *hw = (struct dcpu16_hw *)cl->screen->screenData;
struct keyboard_ *keyboard = (struct keyboard_ *)hw->data;
struct dcpu16_hw *hw = (struct dcpu16_hw *)cl->screen->screenData;
struct keyboard_ *keyboard = (struct keyboard_ *)hw->data;
- hw->vm->trace_cb_("%s>> down:%u rfb_key:0x%04x", down, key);
+#ifdef DEBUG
+ hw->vm->msg_cb_(MSG_DEBUG, "%s>> down:%u rfb_key:0x%04x", down, key);
+#endif /* DEBUG */
if (keysym_rfbtodcpu(key, &dcpu_key)) {
/* unhandled key event */
if (keysym_rfbtodcpu(key, &dcpu_key)) {
/* unhandled key event */
@@
-80,7
+82,7
@@
void keyboard_rfbevent_(rfbBool down, rfbKeySym key, rfbClientPtr cl) {
keyboard->keys_pressed[dcpu_key] = (down ? 1 : 0);
if (down) {
if ((keyboard->buf_tail + 1) % keyboard->buf_sz == keyboard->buf_head) {
keyboard->keys_pressed[dcpu_key] = (down ? 1 : 0);
if (down) {
if ((keyboard->buf_tail + 1) % keyboard->buf_sz == keyboard->buf_head) {
- hw->vm->
warn_cb_(
"keyboard buffer overflow");
+ hw->vm->
msg_cb_(MSG_INFO,
"keyboard buffer overflow");
return;
}
keyboard->buf[keyboard->buf_tail] = dcpu_key;
return;
}
keyboard->buf[keyboard->buf_tail] = dcpu_key;
@@
-150,13
+152,13
@@
int keyboard_data_init_(struct dcpu16_hw *hw, void *data) {
hw->data = calloc(1, sizeof(struct keyboard_));
if (hw->data == NULL) {
hw->data = calloc(1, sizeof(struct keyboard_));
if (hw->data == NULL) {
- hw->vm->
warn_cb_(
"%s():%s", "calloc", strerror(errno));
+ hw->vm->
msg_cb_(MSG_ERROR,
"%s():%s", "calloc", strerror(errno));
return -1;
}
((struct keyboard_ *)(hw->data))->buf = malloc(buf_sz * sizeof *((struct keyboard_ *)(hw->data))->buf);
if (((struct keyboard_ *)(hw->data))->buf == NULL) {
return -1;
}
((struct keyboard_ *)(hw->data))->buf = malloc(buf_sz * sizeof *((struct keyboard_ *)(hw->data))->buf);
if (((struct keyboard_ *)(hw->data))->buf == NULL) {
- hw->vm->
warn_cb_(
"%s():%s", "malloc", strerror(errno));
+ hw->vm->
msg_cb_(MSG_ERROR,
"%s():%s", "malloc", strerror(errno));
free(hw->data);
hw->data = NULL;
return -1;
free(hw->data);
hw->data = NULL;
return -1;
@@
-199,11
+201,13
@@
int keyboard_data_ctl_(struct dcpu16_hw *hw, const char *cmd, void *data_in, voi
}
if (buf_sz_in) {
}
if (buf_sz_in) {
- hw->vm->trace_cb_("%s>> resizing buffer from %zu to %zu", __func__, keyboard->buf_sz, *buf_sz_in);
+#ifdef DEBUG
+ hw->vm->msg_cb_(MSG_DEBUG, "%s>> resizing buffer from %zu to %zu", __func__, keyboard->buf_sz, *buf_sz_in);
+#endif /* DEBUG */
tmp_ptr = realloc(keyboard->buf, *buf_sz_in);
if (tmp_ptr == NULL) {
tmp_ptr = realloc(keyboard->buf, *buf_sz_in);
if (tmp_ptr == NULL) {
- hw->vm->
warn_cb_(
"%s():%s", "realloc", strerror(errno));
+ hw->vm->
msg_cb_(MSG_DEBUG,
"%s():%s", "realloc", strerror(errno));
return -1;
}
keyboard->buf = tmp_ptr;
return -1;
}
keyboard->buf = tmp_ptr;