Re: gimp_ui_init @ 8bpp

2000-04-27 Thread Tomas Ogren

On 26 April, 2000 - Michael Natterer sent me these 1.1K bytes:

 Tomas Ogren wrote:
  
  On 24 April, 2000 - Michael Natterer sent me these 2.2K bytes:
  
   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.
  
  Due to a bug in GdkRGB (fixed in cvs, not in any release) you have to
  truncate the min_colors to max 6*6*6 or else GdkRGB will break.. And you
  don't have to do the allocation check yourself, GdkRGB tries with a new
  colormap if it can't meet the min_colors req.
 
 So the best thing is probably to remove install_cmap from gimprc and
 have only a min_colors options.

install_cmap works.. min_colors(256) which the docs used to say doesn't
work (except for cvs gtk+). As long as Gimp depends on the unreleased
1.2.8 or truncates the min_colors setting from gimprc to max 6*6*6,
there shouldn't be a problem AFAIK. I don't really know how the plugins
are supposed to find gimp-core's colormap other than using the same
settings...

I'd like to keep install_cmap ... so you can keep the default colormap
"free" if you want..

/Tomas
-- 
Tomas Ögren, [EMAIL PROTECTED], http://www.ing.umu.se/~stric/
|- Student at Computing Science, University of Umeå
`- Sysadmin at {cs,ing,acc}.umu.se



Re: gimp_ui_init @ 8bpp

2000-04-27 Thread Raphael Quinet

On Wed, 26 Apr 2000, Michael Natterer wrote:
[...]
 So the best thing is probably to remove install_cmap from gimprc and
 have only a min_colors options.
 
 But don't we have to tell plugins if the Gimp app installed a colormap?
 Or can we leave this decision to the plugin's GdkRGB instance?

IMHO, telling the plugins if the Gimp app has installed a colormap
will not help much (as long as our goal is to reduce colormap flashing
between the app and the plugins) because if the app did install a
colormap, you cannot be sure that the plugins will use exactly the
same one.  This is even more tricky when the app uses a non-default X
visual, because some plugins do not choose the same visual.

Here is a bit of context: one of the machines on which I test the Gimp
is a Sun box running openwin in a mode that supports both 24 bpp and 8
bpp visuals simultaneously.  The default visual (root window) uses
PseudoColor (8 bits with a colormap) but some applications such as the
Gimp, XV or Netscape select the "best" visual for their windows, which
is TrueColor (24 bits).  Here are some exceprts from xdpyinfo:

name of display::0.0
version number:11.0
vendor string:Sun Microsystems, Inc.
vendor release number:3600
[...]
screen #0:
  dimensions:1280x1024 pixels (361x288 millimeters)
  resolution:90x90 dots per inch
  depths (3):1, 8, 24
  root window id:0x37
  depth of root window:8 planes
[...]
  number of visuals:16
  default visual id:  0x20
  visual:
visual id:0x20
class:PseudoColor
depth:8 planes
available colormap entries:256
red, green, blue masks:0x0, 0x0, 0x0
significant bits in color specification:8 bits
[...]
  visual:
visual id:0x2d
class:TrueColor
depth:24 planes
available colormap entries:256 per subfield
red, green, blue masks:0xff, 0xff00, 0xff
significant bits in color specification:8 bits

Using a PseudoColor visual (0x20) as the default allows me to run
legacy X applications, while the more recent applications select a
TrueColor visual automatically.  So when the Gimp starts, it uses
a 24 bpp visual.

Until recently, there was a problem with some plug-ins such as
"Filters/Map/Map Object" and "Filters/Light Effects/Lighting Effects"
which did not use the same method as the main app for selecting the
visual and colormap.  As a result, these plugins were starting with
the PseudoColor visual, which gave some ugly colormap flashing and
reduced the quality of the previews.

Well, unfortunately the problem is even worse with 1.1.20: I just
tried these two plug-ins in order to check if they got better with the
new code, but they crash.  Most plugins work fine, but the two
mentioned above crash shortly after opening their window.  The crash
seems to happen when they try to display the preview, and generates
the following error:
  Gdk-ERROR **: BadMatch (invalid parameter attributes)
serial 653 error_code 8 request_code 72 minor_code 0

I haven't analyzed this in detail yet (so I haven't submitted a bug
report yet) but according to Xproto.h, the request code 72 is the code
for XPutImage.  I suspect that these two plugins are now opening their
window with the correct visual, thanks to the changes done by Mitch,
but unfortunately there is some old broken code that creates the
preview with a bit depth taken from the default visual instead of the
current one.

So...  Hmmm...  All this verbosity was about this: we should not only
ensure that the plugins are using the same colormap as the main app,
but this should also be done for the visual.  I don't know if this
info should be transmitted over the wire or if some part of libgimp
should ensure that all plugins make the same choices in the same way,
but it should be consistent.

Side note: IMHO, min_colors is better than install_cmap.  But maybe
there could be a problem if some other application allocates or
releases some colors while the Gimp is running: if the number of
available colors is just around the threshold, the plugins could take
different decisions about the colormap depending on when they are
started.  That would be a bit strange.

-Raphael




commands.[ch] conflicting types for...

2000-04-27 Thread Doug Alcorn

CVS gimp (updated 27/apr/2000) won't compile on my box.  It complains:

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..   
-I../intl-I/usr/lib/glib/include -I/usr/X11R6/include   
-I/usr/include -DLIBDIR=\""/usr/lib/gimp/1.1"\" 
-DLOCALEDIR=\""/usr/share/locale"\"-DREGEX_MALLOC  
-g -O2 -Wall -c commands.c
commands.c:254: conflicting types for `edit_fill_cmd_callback'
commands.h:19: previous declaration of `edit_fill_cmd_callback'
commands.c:1067: conflicting types for `tools_select_cmd_callback'
commands.h:87: previous declaration of `tools_select_cmd_callback'
commands.c:1103: conflicting types for `filters_repeat_cmd_callback'
commands.h:88: previous declaration of `filters_repeat_cmd_callback'
make[2]: *** [commands.o] Error 1
make[2]: Leaving directory `/usr/local/src/gimp/app'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/gimp'
make: *** [all-recursive-am] Error 2


Here's what I have...

commands.c==
250: void
251: edit_fill_cmd_callback (GtkWidget *widget,
252:gpointer   callback_data,
253:guint  callback_action)
254: {

commands.h==
19: void edit_fill_cmd_callback (GtkWidget *, gpointer);

commands.c==
1063: void
1064: tools_select_cmd_callback (GtkWidget *widget,
1065:  gpointer   callback_data,
1066:  guint  callback_action)
1067: {

commands.h==
87: void tools_select_cmd_callback (GtkWidget *, gpointer);

commands.c==
1099: void
1100: filters_repeat_cmd_callback (GtkWidget *widget,
1101:gpointer   callback_data,
1102:guint  callback_action)
1103: {

commands.h==
88: void filters_repeat_cmd_callback (GtkWidget *, gpointer);

It looks like the header file only defines two arguments in the
prototype, but the actual function has three.  How is it possible that
the gimp compiles for other people and not for me?
-- 
 (__)  Doug Alcorn  | program == list of computer instructions
 oo /  [EMAIL PROTECTED]   | firmware == program that is not user modifiable
 |_/   http://www.lathi.net | software == program that a user can modify
   Cincinnati, OH   | "If you don't have the source, it's not software"