1
0
forked from pool/wxWidgets-3_2
wxWidgets-3_2/wxWidgets-3.1.6-fix-wxDVC-not-showing-empty-cells.patch
Jan Engelhardt 2ecff40c38 Accepting request 976441 from home:1Antoine1:branches:M17N
- Add wxWidgets-3.1.6-fix-wxDVC-not-showing-empty-cells.patch
  (gh#wxWidgets/wxWidgets#22359).
- Remove _service file: Unused.
- Fix some rpmlint warnings:
  * Remove unused rpmlintrc filters.
  * Remove non-breaking spaces.

OBS-URL: https://build.opensuse.org/request/show/976441
OBS-URL: https://build.opensuse.org/package/show/X11:wxWidgets/wxWidgets-3_2?expand=0&rev=90
2022-05-11 16:18:24 +00:00

138 lines
4.7 KiB
Diff

From 1c9c48c34606ef4c26cf92dfb2b5abd4ac65f8d1 Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Sun, 8 May 2022 00:27:45 +0200
Subject: [PATCH 1/3] Don't show value-less wxDataViewVirtualListModel cells in
wxGTK
For some reason, calls to wxGtkTreeSetVisibleProp() were skipped when
using virtual list model in wxGTK implementation, resulting in showing
the value of the previous (i.e. upper) cell for the rows of this model
for which no value was available.
Simply remove IsVirtualListModel() checks and always set the cell
visibility to fix this.
This commit is best viewed ignoring whitespace-only changes.
---
src/gtk/dataview.cpp | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp
index 22f7f25cc359..85e64d69adec 100644
--- a/src/gtk/dataview.cpp
+++ b/src/gtk/dataview.cpp
@@ -3233,25 +3233,15 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
wxDataViewModel *wx_model = tree_model->internal->GetDataViewModel();
- if (!wx_model->IsVirtualListModel())
+ gboolean visible = wx_model->HasValue(item, column);
+ if ( visible )
{
- gboolean visible = wx_model->HasValue(item, column);
- wxGtkTreeSetVisibleProp(renderer, visible);
+ cell->GtkSetCurrentItem(item);
- if ( !visible )
- return;
+ visible = cell->PrepareForItem(wx_model, item, column);
}
- cell->GtkSetCurrentItem(item);
-
- if (!cell->PrepareForItem(wx_model, item, column))
- {
- // We don't have any value in this cell, after all, so hide it.
- if (!wx_model->IsVirtualListModel())
- {
- wxGtkTreeSetVisibleProp(renderer, FALSE);
- }
- }
+ wxGtkTreeSetVisibleProp(renderer, visible);
}
} // extern "C"
From 610eeb476ba4e0e87c0cd9d9fff17fa38e098a6a Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Sun, 8 May 2022 00:32:06 +0200
Subject: [PATCH 2/3] Inline wxGtkTreeSetVisibleProp() function
No real changes, just get rid of a trivial helper function which is only
used once since the changes of the previous commit and copy its code
directly into the caller.
---
src/gtk/dataview.cpp | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp
index 85e64d69adec..5b3b391c98b7 100644
--- a/src/gtk/dataview.cpp
+++ b/src/gtk/dataview.cpp
@@ -3199,14 +3199,6 @@ gtk_dataview_header_button_press_callback( GtkWidget *WXUNUSED(widget),
return FALSE;
}
-// Helper for wxGtkTreeCellDataFunc() below.
-static void wxGtkTreeSetVisibleProp(GtkCellRenderer *renderer, gboolean visible)
-{
- wxGtkValue gvalue( G_TYPE_BOOLEAN );
- g_value_set_boolean( gvalue, visible );
- g_object_set_property( G_OBJECT(renderer), "visible", gvalue );
-}
-
extern "C"
{
@@ -3241,7 +3233,9 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
visible = cell->PrepareForItem(wx_model, item, column);
}
- wxGtkTreeSetVisibleProp(renderer, visible);
+ wxGtkValue gvalue( G_TYPE_BOOLEAN );
+ g_value_set_boolean( gvalue, visible );
+ g_object_set_property( G_OBJECT(renderer), "visible", gvalue );
}
} // extern "C"
From 8aefedcb456c32fac72a691001eb47f23447f559 Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Sun, 8 May 2022 18:24:01 +0200
Subject: [PATCH 3/3] Remove duplicated HasValue() call from wxGTK
wxDataViewCtrl code
HasValue() is already called by PrepareForItem(), so there is no need to
call it explicitly from wxGTK code, just rely on PrepareForItem()
returning false if there is no value to show -- we can skip the call to
GtkSetCurrentItem() in this case, this function is cheap, and we lose
more by calling HasValue() twice in the common case than we save on not
calling it.
No real changes.
---
src/gtk/dataview.cpp | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp
index 5b3b391c98b7..115299de1365 100644
--- a/src/gtk/dataview.cpp
+++ b/src/gtk/dataview.cpp
@@ -3225,13 +3225,10 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
wxDataViewModel *wx_model = tree_model->internal->GetDataViewModel();
- gboolean visible = wx_model->HasValue(item, column);
- if ( visible )
- {
- cell->GtkSetCurrentItem(item);
+ cell->GtkSetCurrentItem(item);
- visible = cell->PrepareForItem(wx_model, item, column);
- }
+ // Cells without values shouldn't be rendered at all.
+ const bool visible = cell->PrepareForItem(wx_model, item, column);
wxGtkValue gvalue( G_TYPE_BOOLEAN );
g_value_set_boolean( gvalue, visible );