Kevin Turner wrote:
> Using gimp_ui_init, I get colormap flashing between with my plug-in's
> dialog. If I comment out the line
> gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
> in the if(gimp_install_cmap()) block, the colormap flashing goes away.
Yep, I didn't test this function at all, just hacked it at home and
commited it so I can check it out at university where we have lots
of 8-bit displays.
The problem is that almost all plug-ins share a piece of code...
gtk_preview_set_gamma (gimp_gamma ());
gtk_preview_set_install_cmap (gimp_install_cmap ());
color_cube = gimp_color_cube ();
gtk_preview_set_color_cube (color_cube, color_cube,
gtk_widget_set_default_visual (gtk_preview_get_visual ());
gtk_widget_set_default_colormap (gtk_preview_get_cmap ());
...which is totally broken because gtk_preview_set_color_cube() is
deprecated and does nothing and the other gtk_preview_*() (except
gtk_preview_set_gamma()) functions call GdkRGB functions.
So I put this to libgimp where all plugins can use it...
The current state of private colormap handling in the Gimp is
a Gtk 1.0 artefact:
- there are color_cube and install_cmap parameters in gimprc
- both of them are not used at all in the main app
- both go over the wire when a plugin gets it's initial "configure"
- conclusion: the plugin cannot correctly determine anything from this
I propose the following solution:
1. default to install_cmap == FALSE in gimprc
2. remove color_cube from gimprc
3. add a min_colors parameter to gimprc
4. in the gimp app, install a private colormap if GdkRGB cannot allocate
at least min_colors colors _or_ if install_cmap is TRUE.
5. determine if GdkRGB actually installed a colormap
6. pass Gimp's real "install colormap" state as determined in step (5)
to all plugins.
7. let the gimp_ui_init() do the right thing to get the correct colormap
for the plugin.
Does this sound reasonable?
Raph, I CC'ed you because you probably know how GdkRGB really works :)
Can you tell us if the above proposal is good? Or is there any
standard way to ensure consistent colormaps across gtk instances?