[vte/vte-0-52] widget: Remove GdkVisibilityState handling



commit 9058e0eaa19e982a83724fdd24d6badf891d02fa
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Mar 9 19:51:03 2018 +0100

    widget: Remove GdkVisibilityState handling
    
    GtkWidget::visibility-notify-event doesn't work on modern composited
    windowing systems. In such cases one can only assume that the widget
    is always completely visible (ie. GDK_VISIBILITY_UNOBSCURED).
    
    These days most users have a compositor, and therefore bugs in this
    optimization often manage to survive undetected.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=794214
    (cherry picked from commit b54395869c408656f31493a25f9e9fe89cd56bb7)

 src/vte.cc         |   53 +---------------------------------------------------
 src/vtegtk.cc      |    9 --------
 src/vteinternal.hh |    4 ---
 3 files changed, 1 insertions(+), 65 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index bc7ff14..ddb16a4 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -7476,42 +7476,6 @@ visibility_state_str(GdkVisibilityState state)
        }
 }
 
-void
-VteTerminalPrivate::widget_visibility_notify(GdkEventVisibility *event)
-{
-       _vte_debug_print(VTE_DEBUG_EVENTS | VTE_DEBUG_MISC,
-                         "Visibility (%s -> %s).\n",
-                       visibility_state_str(m_visibility_state),
-                       visibility_state_str(event->state));
-
-       if (event->state == m_visibility_state) {
-               return;
-       }
-
-       /* fully obscured to visible switch, force the fast path */
-       if (m_visibility_state == GDK_VISIBILITY_FULLY_OBSCURED) {
-               /* set invalidated_all false, since we didn't really mean it
-                * when we set it to TRUE when becoming obscured */
-               m_invalidated_all = FALSE;
-
-               /* if all unobscured now, invalidate all, otherwise, wait
-                * for the expose event */
-               if (event->state == GDK_VISIBILITY_UNOBSCURED) {
-                       invalidate_all();
-               }
-       }
-
-       m_visibility_state = event->state;
-
-       /* no longer visible, stop processing display updates */
-       if (m_visibility_state == GDK_VISIBILITY_FULLY_OBSCURED) {
-               remove_update_timeout(this);
-               /* if fully obscured, just act like we have invalidated all,
-                * so no updates are accumulated. */
-               m_invalidated_all = TRUE;
-       }
-}
-
 /* Apply the changed metrics, and queue a resize if need be.
  *
  * The cell's height consists of 4 parts, from top to bottom:
@@ -7986,8 +7950,6 @@ VteTerminalPrivate::vadjustment_value_changed()
        /* Sanity checks. */
         if (G_UNLIKELY(!widget_realized()))
                 return;
-       if (m_visibility_state == GDK_VISIBILITY_FULLY_OBSCURED)
-               return;
 
         /* FIXME: do this check in pixel space */
        if (!_vte_double_equal(dy, 0)) {
@@ -8235,10 +8197,6 @@ VteTerminalPrivate::VteTerminalPrivate(VteTerminal *t) :
         /* Mouse */
         m_mouse_last_position = vte::view::coords(-1, -1);
 
-       /* Not all backends generate GdkVisibilityNotify, so mark the
-        * window as unobscured initially. */
-       m_visibility_state = GDK_VISIBILITY_UNOBSCURED;
-
         m_padding = default_padding;
         update_view_extents();
 
@@ -8724,7 +8682,6 @@ VteTerminalPrivate::widget_realize()
        attributes.visual = gtk_widget_get_visual(m_widget);
        attributes.event_mask = gtk_widget_get_events(m_widget) |
                                GDK_EXPOSURE_MASK |
-                               GDK_VISIBILITY_NOTIFY_MASK |
                                GDK_FOCUS_CHANGE_MASK |
                                GDK_SMOOTH_SCROLL_MASK |
                                GDK_SCROLL_MASK |
@@ -10849,11 +10806,7 @@ void
 VteTerminalPrivate::reset_update_rects()
 {
         g_array_set_size(m_update_rects, 0);
-
-       /* The invalidated_all flag also marks whether to skip processing
-        * due to the widget being invisible.
-         */
-       m_invalidated_all = m_visibility_state == GDK_VISIBILITY_FULLY_OBSCURED;
+       m_invalidated_all = FALSE;
 }
 
 static bool
@@ -11151,10 +11104,6 @@ VteTerminalPrivate::invalidate_dirty_rects_and_process_updates()
 {
         if (G_UNLIKELY(!widget_realized()))
                 return false;
-       if (m_visibility_state == GDK_VISIBILITY_FULLY_OBSCURED) {
-               reset_update_rects();
-               return false;
-       }
 
        if (G_UNLIKELY (!m_update_rects->len))
                return false;
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 516e042..9adeccf 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -266,14 +266,6 @@ vte_terminal_leave(GtkWidget *widget, GdkEventCrossing *event)
         return ret;
 }
 
-static gboolean
-vte_terminal_visibility_notify(GtkWidget *widget, GdkEventVisibility *event)
-{
-       VteTerminal *terminal = VTE_TERMINAL(widget);
-        IMPL(terminal)->widget_visibility_notify(event);
-       return FALSE;
-}
-
 static void
 vte_terminal_get_preferred_width(GtkWidget *widget,
                                 int       *minimum_width,
@@ -689,7 +681,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
        widget_class->leave_notify_event = vte_terminal_leave;
        widget_class->focus_in_event = vte_terminal_focus_in;
        widget_class->focus_out_event = vte_terminal_focus_out;
-       widget_class->visibility_notify_event = vte_terminal_visibility_notify;
        widget_class->style_updated = vte_terminal_style_updated;
        widget_class->get_preferred_width = vte_terminal_get_preferred_width;
        widget_class->get_preferred_height = vte_terminal_get_preferred_height;
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index f813913..1521cd1 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -650,9 +650,6 @@ public:
        /* Key modifiers. */
         guint m_modifiers;
 
-       /* Obscured? state. */
-        GdkVisibilityState m_visibility_state;
-
        /* Font stuff. */
         gboolean m_has_fonts;
         long m_line_thickness;
@@ -823,7 +820,6 @@ public:
         bool widget_button_release(GdkEventButton *event);
         void widget_enter(GdkEventCrossing *event);
         void widget_leave(GdkEventCrossing *event);
-        void widget_visibility_notify(GdkEventVisibility *event);
         void widget_scroll(GdkEventScroll *event);
         bool widget_motion_notify(GdkEventMotion *event);
         void widget_draw(cairo_t *cr);


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