diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2014-01-09 23:55:30 -0800 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2014-01-09 23:58:14 -0800 |
commit | d6d3b377f82e4427d08de22371dd82aa26f80440 (patch) | |
tree | 27a061bdd8abd4da684a8c3d142465e0e78528b9 | |
parent | 700d6ad071614895c3cb305b894b8c1a003db39e (diff) |
keyboard: Make debug output less verbose
The keyboard is too chatty, make it use a dbg() function for logging
which defaults to disabled.
Also drop a noisy fprintf() in input_panel_configure().
-rw-r--r-- | clients/keyboard.c | 21 | ||||
-rw-r--r-- | desktop-shell/input-panel.c | 2 |
2 files changed, 17 insertions, 6 deletions
diff --git a/clients/keyboard.c b/clients/keyboard.c index b9778a7b..6876cdec 100644 --- a/clients/keyboard.c +++ b/clients/keyboard.c @@ -261,6 +261,19 @@ struct keyboard { enum keyboard_state state; }; +static void __attribute__ ((format (printf, 1, 2))) +dbg(const char *fmt, ...) +{ +#ifdef DEBUG + int l; + va_list argp; + + va_start(argp, fmt); + l = vfprintf(stderr, fmt, argp); + va_end(argp); +#endif +} + static const char * label_from_key(struct keyboard *keyboard, const struct key *key) @@ -463,14 +476,14 @@ delete_before_cursor(struct virtual_keyboard *keyboard) const char *start, *end; if (!keyboard->surrounding_text) { - fprintf(stderr, "delete_before_cursor: No surrounding text available\n"); + dbg("delete_before_cursor: No surrounding text available\n"); return; } start = prev_utf8_char(keyboard->surrounding_text, keyboard->surrounding_text + keyboard->surrounding_cursor); if (!start) { - fprintf(stderr, "delete_before_cursor: No previous character to delete\n"); + dbg("delete_before_cursor: No previous character to delete\n"); return; } @@ -715,7 +728,7 @@ handle_reset(void *data, { struct virtual_keyboard *keyboard = data; - fprintf(stderr, "Reset pre-edit buffer\n"); + dbg("Reset pre-edit buffer\n"); if (strlen(keyboard->preedit_string)) { free(keyboard->preedit_string); @@ -762,7 +775,7 @@ handle_commit_state(void *data, layout = get_current_layout(keyboard); if (keyboard->surrounding_text) - fprintf(stderr, "Surrounding text updated: %s\n", keyboard->surrounding_text); + dbg("Surrounding text updated: %s\n", keyboard->surrounding_text); window_schedule_resize(keyboard->keyboard->window, layout->columns * key_width, diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c index bb5802ac..267b3ef0 100644 --- a/desktop-shell/input-panel.c +++ b/desktop-shell/input-panel.c @@ -121,8 +121,6 @@ input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy) if (surface->width == 0) return; - fprintf(stderr, "%s panel: %d, output: %p\n", __FUNCTION__, ip_surface->panel, ip_surface->output); - if (ip_surface->panel) { x = get_default_view(shell->text_input.surface)->geometry.x + shell->text_input.cursor_rectangle.x2; y = get_default_view(shell->text_input.surface)->geometry.y + shell->text_input.cursor_rectangle.y2; |