Lisp HUG Maillist Archive

Background color of push-buttons in GTK

Hi.

We have a small notification window which uses the background color to
indicate status: green, orange or red, and a short message text in the
foreground color.

However, setting the background color has ceased to work in recent
years.  In at least Ubuntu 16.04 and Debian 9.4, the background remains
the default gray.  In an old Ubuntu 14.04 (running in a full screen VM
on a mac), however, the background is green, as expected.

My standard lisp is still LW7.0, but the behaviour is the same on LW7.1
(I haven't installed the 7.1.1 patch yet).  The Ubuntu 16.04 box (my
primary) is running KDE, The Debian box has Gnome, I believe, and the
Ubuntu 14.04 VM is running Compiz.

LW reports the same GTK-versions on both of the Ubuntus:

CL-USER> (format nil "~a.~a" lwgtk:*gtk-major-version* lwgtk:*gtk-minor-version*)
"2.24"

while the Debian box reports "2.2".

A minimal code-snippet displaying the behaviour:

    (capi:contain
      (capi:define-interface status-button ()
        ()
        (:panes
         (status/button capi:push-button
                        :text "Status OK"
                        :foreground :white
                        :background :forestgreen)))

In reality, there is also a background update process that does
    (setf (simple-pane-background status/button) color)
to change the color at runtime.

Does anyone know why the background color is not green on some of the
displays?  Or even better - how we can fix it, short of reverting to an
ancient OS?  I have tried all the color/theme stuff I could think of in
the settings on my KDE Ubuntu 16.04, to no avail.

-- 
Mvh/Regards
Peder O. Klingenberg
Netfonds Bank AS

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Re: Background color of push-buttons in GTK

Unable to parse email body. Email id is 14847

Re: Background color of push-buttons in GTK

On Sun, Jul 08 2018 at 23:06, Madhu wrote:

> With LW61 this shows a button with a forestgreen background in the
> normal case.  However when button is active, specifically when "the
> mouse pointer is over the widget and the widget will respond to mouse
> clicks", it appears as grey. This state is called GTK_STATE_PRELIGHT
>
> Perhaps this is the behaviour you are seeing?  (At least with some
> versions of GTK.)

Not quite, but your reply was very helpful.

> AFAICT lispworks does not let you control the style for the PRELIGHT
> state.  But it is still accessible from ~/.gtkrc-2.0: For Eg.  if you
> had these tasteful colours in your ~/.gtkrc-2.0

This was the vital clue.  I already had a ~/.gtkrc-2.0 file, that was
apparently created by some theme setting in KDE, and had the line
  include "/usr/share/themes/Breeze/gtk-2.0/gtkrc"

When trying your example did exactly nothing, I looked at that system
gtkrc file, and it defined pixmaps for each state.  I then looked at
the pixmap pngs, and they were exactly the shade of grey I don't want on
this button.

> LW does have some examples on how to use and change a resource
> file at runtime (look in the examples directory for
> capi-gtk-library:remove-application-resource-file and
> capi-gtk-library:update-screen-resources)

Having an idea what to search for, I found
https://stackoverflow.com/questions/533321/disable-pixmap-background-defined-by-gtk-theme-per-application

An with the examples you pointed to for changing resources in LW (they
exist in LW7.1 too, it seems), I should be able to force GTK into
submission at last.

Thanks!

-- 
Mvh/Regards
Peder O. Klingenberg
Netfonds Bank AS

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Updated at: 2020-12-10 08:29 UTC