aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-tui.c
diff options
context:
space:
mode:
authorHannes Domani <ssbssa@yahoo.de>2020-12-20 17:25:09 +0100
committerHannes Domani <ssbssa@yahoo.de>2021-06-04 16:18:10 +0200
commita53755664f5f904aefd0d0b87e12f9adb6b69129 (patch)
tree70cc826ff5f858bade6c0dcd83cc23c12504ebf2 /gdb/python/py-tui.c
parent1bace02a96a7124accf7910f271663b0b7e8754b (diff)
downloadbinutils-a53755664f5f904aefd0d0b87e12f9adb6b69129.zip
binutils-a53755664f5f904aefd0d0b87e12f9adb6b69129.tar.gz
binutils-a53755664f5f904aefd0d0b87e12f9adb6b69129.tar.bz2
Forward mouse click to python TUI window
If the TUI window object implements the click method, it is called for each mouse click event in this window. gdb/ChangeLog: 2021-06-04 Hannes Domani <ssbssa@yahoo.de> * python/py-tui.c (class tui_py_window): Add click function. (tui_py_window::click): Likewise. gdb/doc/ChangeLog: 2021-06-04 Hannes Domani <ssbssa@yahoo.de> * python.texi (TUI Windows In Python): Document Window.click.
Diffstat (limited to 'gdb/python/py-tui.c')
-rw-r--r--gdb/python/py-tui.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c
index 97e9de7..8dfed9d 100644
--- a/gdb/python/py-tui.c
+++ b/gdb/python/py-tui.c
@@ -101,6 +101,8 @@ public:
tui_win_info::refresh_window ();
}
+ void click (int mouse_x, int mouse_y, int mouse_button) override;
+
/* Erase and re-box the window. */
void erase ()
{
@@ -230,6 +232,21 @@ tui_py_window::do_scroll_vertical (int num_to_scroll)
}
void
+tui_py_window::click (int mouse_x, int mouse_y, int mouse_button)
+{
+ gdbpy_enter enter_py (get_current_arch (), current_language);
+
+ if (PyObject_HasAttrString (m_window.get (), "click"))
+ {
+ gdbpy_ref<> result (PyObject_CallMethod (m_window.get (), "click",
+ "iii", mouse_x, mouse_y,
+ mouse_button));
+ if (result == nullptr)
+ gdbpy_print_stack ();
+ }
+}
+
+void
tui_py_window::output (const char *text, bool full_window)
{
if (m_inner_window != nullptr)