Get rid of the bell callback, just handle it all in C

This commit is contained in:
Kovid Goyal 2017-09-16 14:34:23 +05:30
parent 2ddbac073a
commit 50a1bf528c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 12 additions and 21 deletions

View File

@ -220,12 +220,6 @@ class Boss:
old_focus.focus_changed(False)
tab.active_window.focus_changed(True)
def request_attention(self):
try:
self.glfw_window.request_window_attention()
except AttributeError:
pass # needs glfw 3.3
def send_fake_scroll(self, window_idx, amt, upwards):
tab = self.active_tab
w = tab.windows[window_idx]

View File

@ -320,3 +320,4 @@ void scroll_event(double, double);
void set_special_key_combo(int glfw_key, int mods);
void on_text_input(unsigned int codepoint, int mods);
void on_key_input(int key, int scancode, int action, int mods);
void request_window_attention();

View File

@ -16,6 +16,10 @@
#error "glfw >= 3.2 required"
#endif
#if GLFW_VERSION_MAJOR > 4 || (GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR > 2)
#define has_request_attention
#endif
#if GLFW_KEY_LAST >= MAX_KEY_COUNT
#error "glfw has too many keys, you should increase MAX_KEY_COUNT"
#endif
@ -401,13 +405,13 @@ current_monitor_dpi(WindowWrapper *self) {
return get_physical_dpi(m);
}
#ifdef glfwRequestWindowAttention
static PyObject*
request_window_attention(WindowWrapper *self) {
glfwRequestWindowAttention(self->window);
Py_RETURN_NONE;
}
void
request_window_attention() {
#ifdef has_request_attention
glfwRequestWindowAttention(the->window);
#endif
glfwPostEmptyEvent();
}
#ifdef __APPLE__
static PyObject*
@ -429,9 +433,6 @@ static PyMethodDef methods[] = {
MND(get_framebuffer_size, METH_NOARGS),
MND(get_window_size, METH_NOARGS),
MND(current_monitor_dpi, METH_NOARGS),
#ifdef glfwRequestWindowAttention
MND(request_window_attention, METH_NOARGS),
#endif
#ifdef __APPLE__
MND(cocoa_window_id, METH_NOARGS),
#endif

View File

@ -951,11 +951,11 @@ screen_bell(Screen UNUSED *self) {
}
close(fd);
}
request_window_attention();
}
if (global_state.opts.visual_bell_duration > 0) {
self->start_visual_bell_at = monotonic();
}
CALLBACK("bell", NULL);
}
static inline void

View File

@ -139,11 +139,6 @@ class Window:
print('Failed to write to child %d as it does not exist' % self.id, file=sys.stderr)
# screen callbacks {{{
def bell(self):
boss = get_boss()
boss.request_attention()
glfw_post_empty_event()
def use_utf8(self, on):
get_boss().child_monitor.set_iutf8(self.window_id, on)