[libhandy/tab-fixes: 8/9] tab-box: Don't hide placeholder tab




commit 3c86f08b247d2c7700685fe2a85cfd3034c2aaf3
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Feb 8 17:26:16 2021 +0500

    tab-box: Don't hide placeholder tab
    
    Instead, set its opacity to 0. That way we can still measure it, because we
    care about its size.

 src/hdy-tab-box.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/hdy-tab-box.c b/src/hdy-tab-box.c
index 9d39cd7f..30d0b671 100644
--- a/src/hdy-tab-box.c
+++ b/src/hdy-tab-box.c
@@ -1624,6 +1624,8 @@ create_tab_info (HdyTabBox  *self,
   if (self->window)
     gtk_widget_set_parent_window (GTK_WIDGET (info->tab), self->window);
 
+  gtk_widget_show (GTK_WIDGET (info->tab));
+
   return info;
 }
 
@@ -1646,8 +1648,6 @@ page_attached_cb (HdyTabBox  *self,
 
   info = create_tab_info (self, page);
 
-  gtk_widget_show (GTK_WIDGET (info->tab));
-
   info->notify_needs_attention_id =
     g_signal_connect_object (page,
                              "notify::needs-attention",
@@ -1868,6 +1868,8 @@ insert_placeholder (HdyTabBox  *self,
 
     info = create_tab_info (self, page);
 
+    gtk_widget_set_opacity (GTK_WIDGET (info->tab), 0);
+
     hdy_tab_set_dragging (info->tab, TRUE);
     hdy_tab_set_hovering (info->tab, TRUE);
 
@@ -1934,7 +1936,7 @@ replace_placeholder (HdyTabBox  *self,
   gdouble initial_progress;
 
   self->placeholder_scroll_offset = 0;
-  gtk_widget_show (GTK_WIDGET (self->reorder_placeholder->tab));
+  gtk_widget_set_opacity (GTK_WIDGET (self->reorder_placeholder->tab), 1);
   hdy_tab_set_dragging (info->tab, FALSE);
 
   if (!info->appear_animation) {
@@ -3066,7 +3068,7 @@ hdy_tab_box_drag_begin (GtkWidget      *widget,
   end_dragging (self);
   update_hover (self);
 
-  gtk_widget_hide (GTK_WIDGET (detached_tab));
+  gtk_widget_set_opacity (GTK_WIDGET (detached_tab), 0);
   self->detached_index = hdy_tab_view_get_page_position (self->view, self->detached_page);
 
   hdy_tab_view_detach_page (self->view, self->detached_page);


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