On Fri, 2011-02-25 at 10:09 -0500, Nathan A. Stine wrote:
> On Fri, 2011-02-25 at 11:14 +0100, Michael Vogt wrote:
> > On Sat, Feb 19, 2011 at 11:33:37AM -0500, Nathan A. Stine wrote:
> > > Package: synaptic
> > > Version: 0.75
> > > Severity: normal
> > > Tags: patch
> >
> > Thanks for your bugreport and your patch.
> >
> > > I have included a patch that should work well with all themes. Instead of
> > > setting the background to a particular color during a search, the text and
> > > background colors are flip-flopped.
> >
> > I played with the patch and after the first search I apparently get a
> > white background and white textcolor. So something is missing here,
> > could you please have a look?
> >
> >
> > Thanks,
> > Michael
>
> I noticed the same on my PC. I think the defaults need to be reset
> after the search. I believe simply saving the defaults and restoring
> them after the search is completed will do it. I will have time to look
> at this later this weekend.
>
> Best regards,
>
> Nathan A. Stine
The problem with my original submission was that I wasn't restoring the
text color. Unfortunately, just adding that line caused the text /
background to flip back and forth if a character was deleted from the
search string (the background would be the theme default if you typed
"synaptic" and then backspaced a character -- even though a search was
running). To resolve that, I moved the default color restoration higher
in the function.
The only difference (that I can see) between this and the original
upstream version is that as the search string changes, the background
does not stay a static color. It now "blinks" for a moment while
processing the new string. I am unsure how to tackle that problem, but
will look into it if you think it is important enough to decline the
patch.
Best regards,
Nathan A. Stine
--- synaptic-0.75.orig/gtk/rgmainwindow.cc 2011-02-10 03:48:53.000000000 -0500
+++ synaptic-0.75/gtk/rgmainwindow.cc 2011-02-26 13:12:08.958257903 -0500
@@ -3030,10 +3030,11 @@
me->_fastSearchEventID = -1;
me->setBusyCursor(true);
+ // reset the colors to theme defaults
+ gtk_widget_modify_base(me->_entry_fast_search, GTK_STATE_NORMAL, NULL);
+ gtk_widget_modify_text(me->_entry_fast_search, GTK_STATE_NORMAL, NULL);
RGFlushInterface();
if(str == NULL || strlen(str) <= 1) {
- // reset the color
- gtk_widget_modify_base(me->_entry_fast_search, GTK_STATE_NORMAL, NULL);
// if the user has cleared the search, refresh the view
// Gtk-CRITICAL **: gtk_tree_view_unref_tree_helper: assertion `node != NULL' failed
// at us, see LP: #38397 for more information
@@ -3048,10 +3049,12 @@
RGFlushInterface();
gtk_tree_view_set_model(GTK_TREE_VIEW(me->_treeView), NULL);
me->refreshTable();
- // set color to a light yellow to make it more obvious that a search
- // is performed
- GdkColor yellowish = {0, 63479,63479,48830};
- gtk_widget_modify_base(me->_entry_fast_search, GTK_STATE_NORMAL, &yellowish);
+ // allocate temporary colors based on the current theme
+ // flipping the foreground and the background on search should work ok
+ GdkColor srchColorBox = me->_entry_fast_search->style->text[GTK_STATE_NORMAL];
+ GdkColor srchColorText = me->_entry_fast_search->style->base[GTK_STATE_NORMAL];
+ gtk_widget_modify_base(me->_entry_fast_search, GTK_STATE_NORMAL, &srchColorBox);
+ gtk_widget_modify_text(me->_entry_fast_search, GTK_STATE_NORMAL, &srchColorText);
}
me->setBusyCursor(false);