Re: color of focus rectangle



Havoc Pennington wrote:
> 
> Patrick Schweiger <pks@timing.com> writes:
> I take it from this that it's some sort of in-house or contract
> application, and you control how it's deployed -

Indeed. We'll be in charge of everyting from os to processor
the application will run on.

> Basically what you want to do is override the draw_focus method in
> GtkStyleClass for all widgets. Look over gtkstyle.[hc].

I took a look at the files you recommended and see how the
focus rectangle is drawn in the end. What I haven't found
(or investigated thoroughly, once again) is if GtkStyleClass
default_class is the only one in use throughout the gtk
library.

> The clean and officially supported way to do that is to write a theme
> engine and use that theme engine. You'd then ship the theme engine
> with your app, along with a gtkrc file that assigned that theme engine
> should be OK since you're already hardcoding a bunch of stuff.

I haven't found much about theme engines on the web, went to
gtk.themes.org and found little information on how to go
about writing one there. Will you recommend a better place?

I do use gtk_rc_parse to control the appearance of the
controls. The only things the rc file changes at this point
are colors and fonts. In fact the rc file is where the black
background originates. Having looked at gtkstyle.[hc] I
don't quite see how the rc file could be used to affect the
color of the focus rectangle though.

> The simpler way, if you already control deployment, is to just go in
> to gtkstyle.c, find gtk_default_draw_focus, and change it to draw with
> a color GC instead of style->black_gc.
 
> There may also be some hack like getting a pointer to the default
> style and poking a different function into the GtkStyleClass, but that
> may or may not work.

thanks for the two quick-fixes ... I might wind up
implementing either of them if the additional information
(apologies for not including it in the first place as it
sounds like it's relevant information after all)

Thanks again,
Patrick Schweiger




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]