Move bell handling into python

This commit is contained in:
Kovid Goyal 2017-02-11 08:47:42 +05:30
parent 7d2332da21
commit 8b8186660b
2 changed files with 7 additions and 6 deletions

View file

@ -857,12 +857,9 @@ void screen_erase_characters(Screen *self, unsigned int count) {
void
screen_bell(Screen UNUSED *self) {
FILE *f = fopen("/dev/tty", "w");
static const char *bell = "\007";
if (f != NULL) {
fwrite(bell, 1, 1, f);
fclose(f);
}
PyObject_CallMethod(self->callbacks, "bell", NULL);
if (PyErr_Occurred()) PyErr_Print();
PyErr_Clear();
}
static inline void

View file

@ -106,6 +106,10 @@ class Window:
self.write_buf = memoryview(self.write_buf.tobytes() + data)
wakeup()
def bell(self):
with open('/dev/tty', 'wb') as f:
f.write(b'\007')
def update_screen(self):
self.char_grid.update_cell_data()
glfw_post_empty_event()