Xinqi Bao's Git
projects
/
slstatus.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Flush the output stream instead of arbitrarily disabling buffering
[slstatus.git]
/
components
/
keyboard_indicators.c
diff --git
a/components/keyboard_indicators.c
b/components/keyboard_indicators.c
index
b7713b6
..
73ba32e
100644
(file)
--- a/
components/keyboard_indicators.c
+++ b/
components/keyboard_indicators.c
@@
-1,5
+1,5
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
-#include <
err
.h>
+#include <
stdio
.h>
#include <X11/Xlib.h>
#include "../util.h"
#include <X11/Xlib.h>
#include "../util.h"
@@
-7,24
+7,24
@@
const char *
keyboard_indicators(void)
{
const char *
keyboard_indicators(void)
{
- Display *dpy
= XOpenDisplay(NULL)
;
+ Display *dpy;
XKeyboardState state;
XKeyboardState state;
- if (
dpy == NULL
) {
- warn
x("XOpenDisplay failed
");
+ if (
!(dpy = XOpenDisplay(NULL))
) {
+ warn
("XOpenDisplay: Failed to open display
");
return NULL;
}
XGetKeyboardControl(dpy, &state);
XCloseDisplay(dpy);
switch (state.led_mask) {
return NULL;
}
XGetKeyboardControl(dpy, &state);
XCloseDisplay(dpy);
switch (state.led_mask) {
-
case 1:
-
return "c";
-
case 2:
-
return "n";
-
case 3:
-
return "cn";
-
default:
-
return "";
+ case 1:
+ return "c";
+ case 2:
+ return "n";
+ case 3:
+ return "cn";
+ default:
+ return "";
}
}
}
}