From: Hannes Domani <ssbssa@yahoo.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 03/22] Forward mouse click to python TUI window
Date: Sat, 6 Mar 2021 18:33:58 +0100 [thread overview]
Message-ID: <20210306173417.21528-4-ssbssa@yahoo.de> (raw)
In-Reply-To: <20210306173417.21528-1-ssbssa@yahoo.de>
If the TUI window object implements the click method, it is called for each
mouse click event in this window.
---
gdb/doc/python.texi | 6 ++++++
gdb/python/py-tui.c | 17 +++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index ba3d2f92a43..97a28d054fa 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -5925,6 +5925,12 @@ contents. A positive argument should cause the viewport to move down,
and so the content should appear to move up.
@end defun
+@defun Window.click (@var{x}, @var{y}, @var{button})
+This is called on a mouse click in this window. @var{x} and @var{y} are
+the mouse coordinates inside the window, and @var{button} specifies which
+mouse button was used.
+@end defun
+
@node Python Auto-loading
@subsection Python Auto-loading
@cindex Python auto-loading
diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c
index 72e9c0d5e2b..39753aed468 100644
--- a/gdb/python/py-tui.c
+++ b/gdb/python/py-tui.c
@@ -99,6 +99,8 @@ class tui_py_window : public tui_win_info
}
}
+ void click (int mouse_x, int mouse_y, int mouse_button) override;
+
/* Erase and re-box the window. */
void erase ()
{
@@ -226,6 +228,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)
{
--
2.30.1
next prev parent reply other threads:[~2021-03-06 17:35 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210306173417.21528-1-ssbssa.ref@yahoo.de>
2021-03-06 17:33 ` [RFC] TUI windows for locals/display/threads/frames/memory Hannes Domani
2021-03-06 17:33 ` [PATCH 01/22] Initial TUI mouse support Hannes Domani
2021-03-11 17:32 ` Tom Tromey
2021-03-11 17:48 ` Hannes Domani
2021-03-12 16:35 ` Tom Tromey
2021-03-12 16:43 ` Hannes Domani
2021-03-12 17:02 ` Tom Tromey
2021-03-06 17:33 ` [PATCH 02/22] Create/disable/enable/delete breakpoints in TUI with mouse Hannes Domani
2021-03-08 9:32 ` Andrew Burgess
2021-03-08 12:00 ` Hannes Domani
2021-03-11 21:17 ` Tom Tromey
2021-03-11 21:16 ` Tom Tromey
2021-03-06 17:33 ` Hannes Domani [this message]
2021-03-06 18:09 ` [PATCH 03/22] Forward mouse click to python TUI window Eli Zaretskii
2021-03-08 9:36 ` Andrew Burgess
2021-03-11 21:19 ` Tom Tromey
2021-03-11 21:20 ` Tom Tromey
2021-03-06 17:33 ` [PATCH 04/22] Prevent flickering when redrawing the TUI python window Hannes Domani
2021-03-11 21:21 ` Tom Tromey
2021-03-06 17:34 ` [PATCH 05/22] Implement locals TUI window Hannes Domani
2021-03-08 9:51 ` Andrew Burgess
2021-03-11 21:26 ` Tom Tromey
2021-03-11 21:33 ` Tom Tromey
2021-03-11 22:00 ` Tom Tromey
2021-03-06 17:34 ` [PATCH 06/22] Implement display " Hannes Domani
2021-03-11 21:37 ` Tom Tromey
2021-03-06 17:34 ` [PATCH 07/22] Implement threads " Hannes Domani
2021-03-06 17:34 ` [PATCH 08/22] Implement frames " Hannes Domani
2021-03-11 21:40 ` Tom Tromey
2021-03-11 21:50 ` Hannes Domani
2021-03-06 17:34 ` [PATCH 09/22] Implement cccw TUI command Hannes Domani
2021-03-08 10:24 ` Christian Biesinger
2021-03-11 21:42 ` Tom Tromey
2021-03-11 21:57 ` [RFC] TUI windows for locals/display/threads/frames/memory Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210306173417.21528-4-ssbssa@yahoo.de \
--to=ssbssa@yahoo.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).