summaryrefslogtreecommitdiff
path: root/xW/xW.cpp
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-07-27 16:05:32 +0200
committerPřemysl Eric Janouch <p@janouch.name>2023-07-27 16:06:41 +0200
commitfcd1b8e0110182bbb53a5b9a2e797f6ec1e1657e (patch)
tree556d32d1b3addc36cb0bef0c7c302a7654306087 /xW/xW.cpp
parent3d345987c38b6a5ded0a5c66cb00de089b5e7cc5 (diff)
downloadxK-fcd1b8e0110182bbb53a5b9a2e797f6ec1e1657e.tar.gz
xK-fcd1b8e0110182bbb53a5b9a2e797f6ec1e1657e.tar.xz
xK-fcd1b8e0110182bbb53a5b9a2e797f6ec1e1657e.zip
xW: improve beeping
This adds yet another build dependency, but it's better than the alternatives of handling it in code.
Diffstat (limited to 'xW/xW.cpp')
-rw-r--r--xW/xW.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/xW/xW.cpp b/xW/xW.cpp
index cbc5b30..a20b1d0 100644
--- a/xW/xW.cpp
+++ b/xW/xW.cpp
@@ -165,6 +165,14 @@ window_get_text(HWND hWnd)
return buffer;
}
+static void
+beep()
+{
+ if (!PlaySound(MAKEINTRESOURCE(IDR_BEEP),
+ GetModuleHandle(NULL), SND_ASYNC | SND_RESOURCE))
+ Beep(800, 100);
+}
+
// --- Networking --------------------------------------------------------------
static bool
@@ -785,8 +793,7 @@ relay_process_buffer_line(Buffer &b, Relay::EventData_BufferLine &m)
if (line->is_highlight || (!visible && !line->is_unimportant &&
b.kind == Relay::BufferKind::PRIVATE_MESSAGE)) {
- // TODO(p): Avoid the PC speaker, which is also unreliable.
- Beep(800, 100);
+ beep();
if (!visible) {
b.highlighted = true;
@@ -1261,9 +1268,8 @@ input_complete(const InputStamp &state, const std::wstring &error,
SendMessage(g.hwndInput, EM_REPLACESEL, TRUE, (LPARAM) insert.c_str());
}
- // TODO(p): Avoid the PC speaker, which is also unreliable.
if (response->completions.size() != 1)
- Beep(800, 100);
+ beep();
// TODO(p): Show all completion options.
}