[vte] widget: Add function to check if grid coords are in scrollback



commit a0414b176add01e4e952484e9849ed934a03644f
Author: Christian Persch <chpe gnome org>
Date:   Fri Dec 25 21:55:43 2015 +0100

    widget: Add function to check if grid coords are in scrollback

 src/vte.cc         |    2 +-
 src/vteinternal.hh |    4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 34cca8e..8801e82 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -336,7 +336,7 @@ VteTerminalPrivate::mouse_pixels_to_grid (long x,
         rowcol = confine_grid_coords(rowcol);
 
         /* Don't allow clicking on scrollback contents: bug 755187. */
-        if (rowcol.row() < m_screen->insert_delta)
+        if (grid_coords_in_scrollback(rowcol))
                 return false;
 
         *col = rowcol.column();
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 844acac..db03d28 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -239,6 +239,7 @@ public:
        /* Screen data.  We support the normal screen, and an alternate
         * screen, which seems to be a DEC-specific feature. */
        struct _VteScreen normal_screen, alternate_screen, *screen;
+#define m_screen screen
 
         /* Values we save along with the cursor */
         VteVisualPosition cursor;      /* relative to the insertion delta */
@@ -526,6 +527,8 @@ public:
         bool view_coords_visible(vte::view::coords const& pos) const;
         bool grid_coords_visible(vte::grid::coords const& rowcol) const;
 
+        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;
 
         void confine_coordinates(long *xp,
@@ -1017,7 +1020,6 @@ public:
 #define m_match_attributes match_attributes
 #define m_match_contents match_contents
 #define m_match_regex_mode match_regex_mode
-#define m_screen screen
 #define m_mouse_tracking_mode mouse_tracking_mode
 #define m_mouse_pressed_buttons mouse_pressed_buttons
 #define m_mouse_last_column mouse_last_col


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]