mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 05:46:38 +02:00
core: add incomplete mouse events "event-down" and "event-drag" (task #11840)
This commit is contained in:
committed by
Sebastien Helleu
parent
4d436e3ac6
commit
8b52fc90d5
@@ -32,6 +32,7 @@
|
||||
#include "../../core/weechat.h"
|
||||
#include "../../core/wee-config.h"
|
||||
#include "../../core/wee-hook.h"
|
||||
#include "../../core/wee-string.h"
|
||||
#include "../../core/wee-utf8.h"
|
||||
#include "../../plugins/plugin.h"
|
||||
#include "../gui-bar.h"
|
||||
@@ -314,9 +315,6 @@ gui_mouse_event_code2key (const char *code)
|
||||
}
|
||||
}
|
||||
|
||||
if (!MOUSE_CODE_END(code[0]))
|
||||
return NULL;
|
||||
|
||||
/* add name of button event */
|
||||
for (i = 0; gui_mouse_button_codes[i][0]; i++)
|
||||
{
|
||||
@@ -327,6 +325,21 @@ gui_mouse_event_code2key (const char *code)
|
||||
}
|
||||
}
|
||||
|
||||
if (!MOUSE_CODE_END(code[0]))
|
||||
{
|
||||
strcat (key, "-event-");
|
||||
if (MOUSE_CODE_MOTION(code[0])) {
|
||||
strcat (key, "drag");
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_mouse_event_x[1] = gui_mouse_event_x[0];
|
||||
gui_mouse_event_y[1] = gui_mouse_event_y[0];
|
||||
strcat (key, "down");
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
/*
|
||||
* Mouse gesture: if (x,y) on release is different from (x,y) on click,
|
||||
* compute distance and angle between 2 points.
|
||||
@@ -412,6 +425,7 @@ void
|
||||
gui_mouse_event_end ()
|
||||
{
|
||||
const char *mouse_key;
|
||||
int bare_event;
|
||||
|
||||
gui_mouse_event_pending = 0;
|
||||
|
||||
@@ -426,9 +440,11 @@ gui_mouse_event_end ()
|
||||
mouse_key = gui_mouse_event_code2key (gui_key_combo_buffer);
|
||||
if (mouse_key && mouse_key[0])
|
||||
{
|
||||
bare_event = string_match (mouse_key, "*-event-*", 1);
|
||||
if (gui_mouse_grab)
|
||||
{
|
||||
gui_mouse_grab_end (mouse_key);
|
||||
if (!bare_event)
|
||||
gui_mouse_grab_end (mouse_key);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -436,7 +452,8 @@ gui_mouse_event_end ()
|
||||
(void) gui_key_focus (mouse_key,
|
||||
GUI_KEY_CONTEXT_MOUSE);
|
||||
}
|
||||
gui_mouse_event_reset ();
|
||||
if (!bare_event)
|
||||
gui_mouse_event_reset ();
|
||||
}
|
||||
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
|
||||
@@ -1009,6 +1009,11 @@ gui_key_focus_command (const char *key, int context,
|
||||
if (gui_key_cmp (key, ptr_key->area_key, context) != 0)
|
||||
continue;
|
||||
|
||||
/* ignore mouse event if not explicit requested */
|
||||
if ((context == GUI_KEY_CONTEXT_MOUSE) &&
|
||||
(string_match (key, "*-event-*", 1) != string_match (ptr_key->area_key, "*-event-*", 1)))
|
||||
continue;
|
||||
|
||||
/* check if focus is matching with key */
|
||||
matching = gui_key_focus_matching (ptr_key, hashtable_focus);
|
||||
if (!matching)
|
||||
|
||||
Reference in New Issue
Block a user