1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 06:16:40 +02:00

core: fix crash with "/input grab_mouse"

This commit is contained in:
Sebastien Helleu
2011-08-03 20:13:29 +02:00
parent 2460699343
commit 8137c2cf9a
3 changed files with 2 additions and 26 deletions
+2 -24
View File
@@ -203,21 +203,16 @@ gui_mouse_event_init ()
/*
* gui_mouse_event_code2key: get key name with a mouse code
* *extra_chars is set with first char following the
* end of mouse code (this can point to the '\0' or
* other chars)
*/
const char *
gui_mouse_event_code2key (const char *code, char **extra_chars)
gui_mouse_event_code2key (const char *code)
{
int x, y, code_utf8, length;
double diff_x, diff_y, distance, angle, pi4;
static char key[128];
char button[2], *ptr_code;
*extra_chars = NULL;
key[0] = '\0';
/*
@@ -238,14 +233,12 @@ gui_mouse_event_code2key (const char *code, char **extra_chars)
if (!ptr_code)
return NULL;
y = utf8_char_int (ptr_code) - 33;
*extra_chars = utf8_next_char (ptr_code);
}
else
{
/* get coordinates using ISO chars in code */
x = ((unsigned char)code[1]) - 33;
y = ((unsigned char)code[2]) - 33;
*extra_chars = (char *)code + 3;
}
if (x < 0)
x = 0;
@@ -393,8 +386,6 @@ void
gui_mouse_event_end ()
{
const char *mouse_key;
char *extra_chars;
int i;
gui_mouse_event_pending = 0;
@@ -406,7 +397,7 @@ gui_mouse_event_end ()
}
/* get key from mouse code */
mouse_key = gui_mouse_event_code2key (gui_key_combo_buffer, &extra_chars);
mouse_key = gui_mouse_event_code2key (gui_key_combo_buffer);
if (mouse_key && mouse_key[0])
{
if (gui_mouse_grab)
@@ -423,17 +414,4 @@ gui_mouse_event_end ()
}
gui_key_combo_buffer[0] = '\0';
/*
* if extra chars, use them as new input (this can happen if used typed
* something and that mouse timer was not reached yet
*/
if (extra_chars && extra_chars[0])
{
for (i = 0; extra_chars[i]; i++)
{
gui_key_buffer_add ((unsigned char)extra_chars[i]);
}
gui_key_flush ();
}
}
-1
View File
@@ -101,7 +101,6 @@ extern void gui_chat_calculate_line_diff (struct t_gui_window *window,
/* key functions */
extern void gui_key_default_bindings (int context);
extern void gui_key_read ();
extern void gui_key_flush ();
/* window functions */
extern void gui_window_redraw_buffer (struct t_gui_buffer *buffer);
-1
View File
@@ -105,6 +105,5 @@ extern void gui_key_print_log (struct t_gui_buffer *buffer);
/* key functions (GUI dependent) */
extern void gui_key_default_bindings ();
extern void gui_key_flush ();
#endif /* __WEECHAT_GUI_KEY_H */