Author Topic: Auto-comp list selection color  (Read 22165 times)

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Auto-comp list selection color
« on: January 10, 2013, 12:41:38 am »
Others have mentioned, and it has also bothered me, that the selection highlight for the auto completion list makes it nearly impossible to read under Ubuntu's default color scheme.  After some searching, I found:
sdk/wxscintilla/src/PlatWX.cpp line 948
Code
        // NOTE: We need to fool the wxListView into thinking that it has the
        // focus so it will use the normal selection colour and will look
        // "right" to the user.  But since the wxPopupWindow or its children
        // can't receive focus then we have to pull a fast one and temporarily
        // parent the listctrl on the STC window and then call SetFocus and
        // then reparent it back to the popup.
        lv->SetFocus();
        lv->Reparent(this);
Apparently, wxGTK (I presume) has remained relatively "un-tricked" by this.  Any ideas on a solution?

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Auto-comp list selection color
« Reply #1 on: January 11, 2013, 04:58:55 am »
Also, screenshot from bug 18779 to demonstrate problem.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Auto-comp list selection color
« Reply #2 on: January 11, 2013, 07:20:32 am »
We have the same issue for the listcontrols in the logger, which are also derived from wxListCtrl (like wxListview the base class of wxSCIListBox).

On my system (fedora 17) it works fine with all themes except the two ubuntu themes (radiance and ambiance).

It seems to be either a wxGTK-isssue or a theme-error.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: Auto-comp list selection color
« Reply #3 on: January 11, 2013, 03:59:49 pm »
It seems to be either a wxGTK-isssue or a theme-error.
Can you try with wx29? This would maybe show that its a wxGTX 28 error... there has much work been done by the "wxTeam" to support GTK better in wx29 to my knowledge...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Auto-comp list selection color
« Reply #4 on: January 11, 2013, 04:15:40 pm »
It seems to be either a wxGTK-isssue or a theme-error.
Can you try with wx29? This would maybe show that its a wxGTX 28 error... there has much work been done by the "wxTeam" to support GTK better in wx29 to my knowledge...
I will test this evening (no real OS available at the moment  ;) ),  I have to work on moving all our XP stuff to win8.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: Auto-comp list selection color
« Reply #5 on: January 11, 2013, 04:49:51 pm »
I have to work on moving all our XP stuff to win8.
Oh dear - sounds like no fun. On my private PC I upgraded to Win8 but after a while I re-installed the Win7 backup. What annoys me most on Win8 is that you can't have Windows next or each other anymore. It should be named "Window" and not "Windows" any longer... I read that somewhere in an article when searching for a solution and think this is funny, but true.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Auto-comp list selection color
« Reply #6 on: January 11, 2013, 10:00:58 pm »
From the four colors:
  • highlight-background-focused (orange)
  • highlighted-text-focused (white)
  • highlight-background-no_focus (light gray)
  • highlighted-text-no_focus (black)
The auto-comp box currently uses highlight-background-no_focus (light gray) and highlighted-text-focused (white), which is why it is completely unreadable.  If we make no attempt to give the box the "focused" color set, it becomes readable:
Code
Index: src/sdk/wxscintilla/src/PlatWX.cpp
===================================================================
--- src/sdk/wxscintilla/src/PlatWX.cpp (revision 8782)
+++ src/sdk/wxscintilla/src/PlatWX.cpp (working copy)
@@ -951,7 +951,7 @@
         // can't receive focus then we have to pull a fast one and temporarily
         // parent the listctrl on the STC window and then call SetFocus and
         // then reparent it back to the popup.
-        lv->SetFocus();
+        //lv->SetFocus();
         lv->Reparent(this);
 #ifdef __WXMSW__
         lv->Show();
This, of course, is not the desired appearance, but I guess it implies that highlight-background-* and highlighted-text-* are set differently, and (possibly) other themes work because mismatched sets of these are still readable in those themes.
I do not currently have wx29 on Linux, and have not tested it yet.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: Auto-comp list selection color
« Reply #7 on: January 12, 2013, 12:45:58 pm »
If we make no attempt to give the box the "focused" color set, it becomes readable:
Well but is it working then, does it auto-complete if I press the shortcut? Otherwise thats not an option I'm afraid.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Auto-comp list selection color
« Reply #8 on: January 12, 2013, 12:50:22 pm »
It seems to be either a wxGTK-isssue or a theme-error.
Can you try with wx29? This would maybe show that its a wxGTX 28 error... there has much work been done by the "wxTeam" to support GTK better in wx29 to my knowledge...
It's the same with wx2.9.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Auto-comp list selection color
« Reply #9 on: January 12, 2013, 03:05:26 pm »
If we make no attempt to give the box the "focused" color set, it becomes readable:
Well but is it working then, does it auto-complete if I press the shortcut? Otherwise thats not an option I'm afraid.
Yes (at least on my testing on Linux).  From what I understand of the auto-comp box is that it never actually has focus; commands are intercepted by the parent stc, and act from there.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: Auto-comp list selection color
« Reply #10 on: January 12, 2013, 05:28:50 pm »
Yes (at least on my testing on Linux).  From what I understand of the auto-comp box is that it never actually has focus; commands are intercepted by the parent stc, and act from there.
OK - so lets have some testing with other Linux people and maybe other Linux distros. (I'm not using Linux if I can avoid it.)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Auto-comp list selection color
« Reply #11 on: January 14, 2013, 10:15:47 pm »
How much time do others want for testing?  When testing is complete, this is the patch I recommend:
Code
Index: src/sdk/wxscintilla/src/PlatWX.cpp
===================================================================
--- src/sdk/wxscintilla/src/PlatWX.cpp (revision 8787)
+++ src/sdk/wxscintilla/src/PlatWX.cpp (working copy)
@@ -951,7 +951,13 @@
         // can't receive focus then we have to pull a fast one and temporarily
         // parent the listctrl on the STC window and then call SetFocus and
         // then reparent it back to the popup.
+/* C::B begin */
+        // this focus hack makes the selection unreadable for Ubuntu themes,
+        // so do not attempt under GTK
+#ifndef __WXGTK__
         lv->SetFocus();
+#endif
+/* C::B end */
         lv->Reparent(this);
 #ifdef __WXMSW__
         lv->Show();
« Last Edit: January 14, 2013, 10:27:18 pm by Alpha »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Auto-comp list selection color
« Reply #12 on: January 14, 2013, 10:55:50 pm »
Alpha:
Have you tried to contact wx's developers?
I guess they might help in solving this or you can help them fix a bug in wxstc.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Auto-comp list selection color
« Reply #13 on: January 14, 2013, 11:58:34 pm »
Have you tried to contact wx's developers?
I guess they might help in solving this or you can help them fix a bug in wxstc.
Reported now.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Auto-comp list selection color
« Reply #14 on: February 04, 2013, 09:56:12 pm »
I have not received much response from the wxWidgets developers.  Is there any reason this patch should not be committed in the interim?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Auto-comp list selection color
« Reply #15 on: February 04, 2013, 11:09:39 pm »
They've told you that your patch is not correct, but don't know how to make it better.

Jens: Have you tried it? I have not, but also I'm not using Ubuntu.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Auto-comp list selection color
« Reply #16 on: February 24, 2013, 05:55:49 pm »
Okay; this is the "correct" way of disabling the focus hack under wxGTK.  (Unless, should the hack be removed completely for all systems?)
Code
Index: src/sdk/wxscintilla/src/PlatWX.cpp
===================================================================
--- src/sdk/wxscintilla/src/PlatWX.cpp (revision 8854)
+++ src/sdk/wxscintilla/src/PlatWX.cpp (working copy)
@@ -938,13 +938,21 @@
 /* C::B end */
 
 /* C::B begin */
+#ifdef __WXGTK__
+        lv = new wxSCIListBox(this, id, wxDefaultPosition, wxDefaultSize,
+#else
         lv = new wxSCIListBox(parent, id, wxDefaultPosition, wxDefaultSize,
+#endif
                               wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_NO_HEADER | wxSIMPLE_BORDER);
 /* C::B end */
         lv->SetCursor(wxCursor(wxCURSOR_ARROW));
         lv->InsertColumn(0, wxEmptyString);
         lv->InsertColumn(1, wxEmptyString);
 
+/* C::B begin */
+        // this focus hack makes the selection unreadable for Ubuntu themes,
+        // so do not attempt under GTK
+#ifndef __WXGTK__
         // NOTE: We need to fool the wxListView into thinking that it has the
         // focus so it will use the normal selection colour and will look
         // "right" to the user.  But since the wxPopupWindow or its children
@@ -953,6 +961,8 @@
         // then reparent it back to the popup.
         lv->SetFocus();
         lv->Reparent(this);
+#endif
+/* C::B end */
 #ifdef __WXMSW__
         lv->Show();
 #endif