Re: gdk_gc_set_foreground(): not working over DirectFB
Hi, On Mon, 2006-11-13 at 14:40 +0530, Prasanna Kumar K wrote: + GdkColor color; + + color.pixel = 0x; + gdk_gc_set_foreground (widget-style-fg_gc[GTK_WIDGET_STATE (widget)], color); You are using an unallocated color here. There's gdk_gc_set_rgb_fg_color() for that purpose. Kalle already outlined other issues with this code in another mail so I am not going to comment on the fact that it is a bad idea to access the widget's style directly. Sven ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
gdk_gc_set_foreground(): not working over DirectFB
Hi All, I have added few lines in scribble-simple.c (gtk+-2.10.1/examples/scribble-simple) for the foreground color. Kindly find the attached patch file for this. I'm not able to set the foreground color for gtk_drawable application(scribble-simple) over DirectFB (but over X it is working fine).In the function expose_event whatever color I am setting for brush, DirectFB is taking Black color only irrespective of any new foreground color set using gdk_gc_set_foreground(). --- /opt/gtk_dfb/gtk+-2.10.1/examples/scribble-simple/scribble-simple.c 2005-01-04 00:56:34.0 +0530 +++ scribble-simple.c 2006-11-13 14:27:07.509601600 +0530 @@ -49,6 +49,10 @@ static gboolean configure_event( GtkWidg static gboolean expose_event( GtkWidget *widget, GdkEventExpose *event ) { + GdkColor color; + + color.pixel = 0x; + gdk_gc_set_foreground (widget-style-fg_gc[GTK_WIDGET_STATE (widget)], color); gdk_draw_drawable (widget-window, widget-style-fg_gc[GTK_WIDGET_STATE (widget)], pixmap, Regards, Prasanna --- /opt/gtk_dfb/gtk+-2.10.1/examples/scribble-simple/scribble-simple.c 2005-01-04 00:56:34.0 +0530 +++ scribble-simple.c 2006-11-13 14:27:07.509601600 +0530 @@ -49,6 +49,10 @@ static gboolean configure_event( GtkWidg static gboolean expose_event( GtkWidget *widget, GdkEventExpose *event ) { + GdkColor color; + + color.pixel = 0x; + gdk_gc_set_foreground (widget-style-fg_gc[GTK_WIDGET_STATE (widget)], color); gdk_draw_drawable (widget-window, widget-style-fg_gc[GTK_WIDGET_STATE (widget)], pixmap, ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: gdk_gc_set_foreground(): not working over DirectFB
2006/11/13, Prasanna Kumar K [EMAIL PROTECTED]: Hi All, I have added few lines in scribble-simple.c (gtk+-2.10.1/examples/scribble-simple) for the foreground color. Kindly find the attached patch file for this. I'm not able to set the foreground color for gtk_drawable application(scribble-simple) over DirectFB (but over X it is working fine).In the function expose_event whatever color I am setting for brush, DirectFB is taking Black color only irrespective of any new foreground color set using gdk_gc_set_foreground(). First, one should never modigy the style members directly, the gtk_widget_modify_*() functions are for overriding temporary per-widget style properties (for a lasting effect, do it in gtkrc). Secondly, the expose_event of the scribble example only copies the pixmap used to store the stroked pixels to the visible window. So it does not manipulate the pixel data, only copies the drawn data to the screen. The actual drawing takes place in draw_brush() with gdk_draw_rectangle(), which uses widget-style-black_gc directly (so the style change would not have effect anyway). To change the color, I'd suggest creating a GdkGC from the pixmap and setting the foreground to that GC, not one from the widget's style. -- Kalle Vahlman, [EMAIL PROTECTED] Powered by http://movial.fi Interesting stuff at http://syslog.movial.fi ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list