[vte] widget: Add function to translate event coords to confined grid coords
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] widget: Add function to translate event coords to confined grid coords
- Date: Fri, 25 Dec 2015 21:00:46 +0000 (UTC)
commit 4a126221f0c25f16eba92a23c065d4966cb8b883
Author: Christian Persch <chpe gnome org>
Date: Fri Dec 25 21:55:44 2015 +0100
widget: Add function to translate event coords to confined grid coords
src/vte.cc | 14 ++++++++++++++
src/vteinternal.hh | 1 +
2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 8801e82..a72f1cd 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -1880,6 +1880,20 @@ VteTerminalPrivate::grid_coords_from_event(GdkEvent const* event) const
}
/*
+ * VteTerminalPrivate::grid_coords_from_event:
+ * @event: a #GdkEvent
+ *
+ * Like grid_coords_from_event(), but also confines the coordinates
+ * to an actual cell in the visible area.
+ */
+vte::grid::coords
+VteTerminalPrivate::confined_grid_coords_from_event(GdkEvent const* event) const
+{
+ auto rowcol = grid_coords_from_view_coords(view_coords_from_event(event));
+ return confine_grid_coords(rowcol);
+}
+
+/*
* VteTerminalPrivate::grid_coords_from_view_coords:
* @pos: the view coordinates
* @rowcol: the grid coordinates
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index db03d28..6001489 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -530,6 +530,7 @@ public:
inline bool grid_coords_in_scrollback(vte::grid::coords const& rowcol) const { return rowcol.row() <
m_screen->insert_delta; }
vte::grid::coords confine_grid_coords(vte::grid::coords& rowcol) const;
+ vte::grid::coords confined_grid_coords_from_event(GdkEvent const* event) const;
void confine_coordinates(long *xp,
long *yp);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]