Re: Widget Peek functions



On Tue, 29 Feb 2000, Karl Nelson wrote:

> 
> The Gtk-- crew was trying to implement a quick and dirty image
> loader so that we can load images prior to realization for 
> some applications.  This involved loading the pixmap with the
> colormap from the top of the gtk+ colormap stack.  
> 
> Unfortunately it appears like the colormap is so protected that
> it is unaccessible.  You can view the default colormap but not
> the colormap you are about to create with.  Was this intentional?  
> It is possible that the gtk_widget_peek_* functions can be exposed 
> to the user?  (if not in the header at least as a symbol that we can
> link to.)  Considering there is no way to alter it through the peek
> functions, I don't understand why they are so guarded.

they weren't really used outside of gtkwidget.c yet.
you're probably right in wanting to be able to figure the last colormap
set. however exposing gtk_widget_peek_* will leave us with:

void         gtk_widget_push_style           (GtkStyle   *style);
void         gtk_widget_push_colormap        (GdkColormap *cmap);
void         gtk_widget_push_visual          (GdkVisual  *visual);
void         gtk_widget_push_composite_child (void);
void         gtk_widget_pop_composite_child  (void);
void         gtk_widget_pop_style            (void);
void         gtk_widget_pop_colormap         (void);
void         gtk_widget_pop_visual           (void);
void         gtk_widget_set_default_style    (GtkStyle    *style);
void         gtk_widget_set_default_colormap (GdkColormap *colormap);
void         gtk_widget_set_default_visual   (GdkVisual   *visual);
GtkStyle*    gtk_widget_get_default_style    (void);
GdkColormap* gtk_widget_get_default_colormap (void);
GdkVisual*   gtk_widget_get_default_visual   (void);
/* newly added */
GtkStyle*    gtk_widget_peek_style           (void);
GdkColormap* gtk_widget_peek_colormap        (void);
GdkVisual*   gtk_widget_peek_visual          (void);

i think a better choice would be to make

GtkStyle*    gtk_widget_get_default_style    (void);
GdkColormap* gtk_widget_get_default_colormap (void);
GdkVisual*   gtk_widget_get_default_visual   (void);

be effectively what the peek functions currently do
to keep the API simple (read: less complex).

though that is a semantic change in some sense,
gtk_widget_get_default_* aren't really used that much
and applications usually use them as if they actually
were the peek variants.
the only thing i see that actually needs changing after
this, is gtkentry.c and gtktext.c that need to compare their
colormaps against gdk_colormap_get_system() for the
GDK_IC_PREEDIT_COLORMAP attribute.

owen, you see problems with that change?

> 
> Thanks
> 
> --Karl 
> 

---
ciaoTJ



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