[KRDB] Write correct tooltip colors into gtkrc in kcminit
ClosedPublic

Authored by broulik on Jan 23 2019, 7:06 PM.

Details

Summary

kcminit for performance reasons is not desktop settings aware which means it won't load the plasma integration plugin and as such not apply the color scheme to Qt's widgets.
When writing the GTK config, it would read them from kdeglobals directly. However, for tooltips it would use QToolTip::palette() which would then use Qt's default palette in kcminit. Use the QPalette we created from kdeglobals to get the tooltip colors instead.

BUG: 355540
FIXED-IN: 5.12.8

Test Plan

Because of a bug preventing proper propagation of environment variables to apps launched through Kickoff/KRunner (KRun?) via klauncher(??) this is hardly noticeable but when you e.g. open Gimp or Inkscape through "Open With" in Dolphin or manually using

GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:$HOME/.gtkrc-2.0:$HOME/.config/gtkrc-2.0 gimp

I didn't fully understand where it gets the tooltip base vs background from, so here are the compared values:
Incorrect colors applied on startup by kcminit (note the light bg):

style "ToolTip"
{
  bg[NORMAL] = { 0.937, 0.937, 0.937 }
  base[NORMAL] = { 1.000, 1.000, 1.000 }
  text[NORMAL] = { 0.000, 0.000, 0.000 }
  fg[NORMAL] = { 0.000, 0.000, 0.000 }
}

Without this patch colors applied correctly when hitting Apply in the Color KCM:

style "ToolTip"
{
  bg[NORMAL] = { 0.192, 0.212, 0.231 }
  base[NORMAL] = { 0.137, 0.149, 0.161 }
  text[NORMAL] = { 0.937, 0.941, 0.945 }
  fg[NORMAL] = { 0.937, 0.941, 0.945 }
}

Colors applied consistently with this patch, notice how base is now same as bg and different from the previous correct case:

style "ToolTip"
{
  bg[NORMAL] = { 0.192, 0.212, 0.231 }
  base[NORMAL] = { 0.192, 0.212, 0.231 }
  text[NORMAL] = { 0.937, 0.941, 0.945 }
  fg[NORMAL] = { 0.937, 0.941, 0.945 }
}

However, it now appears as though applying the colorscheme through the KCM is broken now :( Nevermind, I forgot to rebuild the colors kcm as I thought krdb was a library but in fact it's just compiled into all these KCMs

Diff Detail

Repository
R119 Plasma Desktop
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Jan 23 2019, 7:06 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJan 23 2019, 7:06 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Jan 23 2019, 7:06 PM
broulik edited the test plan for this revision. (Show Details)Jan 23 2019, 7:10 PM
broulik edited the test plan for this revision. (Show Details)Jan 23 2019, 7:16 PM
ngraham accepted this revision.Jan 23 2019, 7:39 PM
ngraham added a subscriber: ngraham.

Confirmed; it's fixed!!! You did it! *high-fives*

This revision is now accepted and ready to land.Jan 23 2019, 7:39 PM
davidedmundson accepted this revision.Jan 23 2019, 9:26 PM
davidedmundson added a subscriber: davidedmundson.

Because of a bug preventing proper propagation of environment variables to apps launched through Kickoff/KRunner (KRun?) via klauncher(??) this is hardly noticeable but when you e.g. open Gimp or Inkscape through "Open With" in Dolphin or manually using

:/
That shouldn't happen.

As for this patch. It's considerably more sane to not create random widgets in the first place ++

This revision was automatically updated to reflect the committed changes.