Re: Window with background Image
Greg Breland wrote: I got despirate and hooded up the "expose-event" to reset the BG image and this works. Seems a bit excessive, surely there's a better event to use? FWIW, I'm using the regular expose the gets called before the default handler. IIRC, if you hook up to expose-event, gtk doesn't run its default expose handler anymore. i *think*, that if you just do gdk_window_clear_area() in your handler, using event->area as the arguments, that should do it. also, after doing gdk_window_set_back_pixmap() in your style-set handler, you may want to call gtk_widget_queue_draw(). -brian On Sun, 2005-02-06 at 01:12, Greg Breland wrote: I'm using FC2/Gnome with the default WM MetaCity. I hooked up the "style-set" event on the window, both normal and _after, but this doesn't seem to be helping. I also tried the "realize" and "show" events with no luck. You can see the source as it stands after your advice at: http://home.atlee.net/background.c ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Window with background Image
I got despirate and hooded up the "expose-event" to reset the BG image and this works. Seems a bit excessive, surely there's a better event to use? FWIW, I'm using the regular expose the gets called before the default handler. On Sun, 2005-02-06 at 01:12, Greg Breland wrote: > I'm using FC2/Gnome with the default WM MetaCity. I hooked up the > "style-set" event on the window, both normal and _after, but this > doesn't seem to be helping. I also tried the "realize" and "show" > events with no luck. You can see the source as it stands after your > advice at: > > http://home.atlee.net/background.c ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Window with background Image
Thanks Brian, you've gotten me very close to solving this problem. When I use window->window instead of getting the root window, I now see my background image for short periods of time when portions of the window are newly exposed such as during resize and when other windows are moved over it just like Russell's email suggested. Just wondering, where did you find the window->window property? I looked through the entire widget hierarchy (GtkBin, GtkContainer, GtkWidget, etc.) and didn't see this property. I'm using FC2/Gnome with the default WM MetaCity. I hooked up the "style-set" event on the window, both normal and _after, but this doesn't seem to be helping. I also tried the "realize" and "show" events with no luck. You can see the source as it stands after your advice at: http://home.atlee.net/background.c On Sun, 2005-02-06 at 00:11, Brian J. Tarricone wrote: > You're trying to set the bg pixmap of the screen's root window. You > want to set it on the GdkWindow of the widget itself: > gdk_window_set_back_pixmap(window->window, pixmap, FALSE); > > Note that gtk themes that have pixmap window backgrounds set may > override this, so you'd want to connect to the GtkWindow's style-set > signal, and re-set the bg pixmap in that signal handler. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Window with background Image
Greg Breland wrote: I've been working on this problem for 6 hours now so any help would be appreciated. I've created a simple test app to try to figure out what I'm doing wrong. I've read everything in the archives even remotely related to this issue. I'm needing a background image on a window to indicate that the window is in edit mode, similar to the way glade paints the cross hatch pattern. I'm not getting any errors with the code below, but I'm also not seeing my image and I don't know what else to try. Here is the simple testing app I have right now: [snip] gdk_window_set_back_pixmap(gtk_widget_get_root_window(window), pixmap, FALSE); You're trying to set the bg pixmap of the screen's root window. You want to set it on the GdkWindow of the widget itself: gdk_window_set_back_pixmap(window->window, pixmap, FALSE); Note that gtk themes that have pixmap window backgrounds set may override this, so you'd want to connect to the GtkWindow's style-set signal, and re-set the bg pixmap in that signal handler. -brian ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Window with background Image
Greg Breland wrote: I've been working on this problem for 6 hours now so any help would be appreciated. I've created a simple test app to try to figure out what I'm doing wrong. I've read everything in the archives even remotely related to this issue. I'm needing a background image on a window to indicate that the window is in edit mode, similar to the way glade paints the cross hatch pattern. I'm not getting any errors with the code below, but I'm also not seeing my image and I don't know what else to try. Here is the simple testing app I have right now: #include int main( int argc, char *argv[] ){ GtkWidget *window; GdkPixbuf *pixbuf_image = NULL; GdkPixmap *pixmap; GdkScreen *screen = NULL; gint depth, width, height; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_widget_realize(window); pixbuf_image = gdk_pixbuf_new_from_file("test.png",NULL); width = gdk_pixbuf_get_width(pixbuf_image); height = gdk_pixbuf_get_height(pixbuf_image); screen = gdk_screen_get_default(); depth = (gdk_screen_get_system_visual(screen))->depth; pixmap = gdk_pixmap_new(NULL, width, height, depth); gdk_drawable_set_colormap(pixmap, gdk_colormap_get_system ()); gdk_pixbuf_render_pixmap_and_mask(pixbuf_image, &pixmap, NULL,0); gdk_window_set_back_pixmap(gtk_widget_get_root_window(window), pixmap, FALSE); gtk_widget_show (window); gtk_main (); return 0; } Try dragging another window with the mouse so that there is some overlap with the window you created. This should cause expose events to redraw the window including its background. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Window with background Image
I've been working on this problem for 6 hours now so any help would be appreciated. I've created a simple test app to try to figure out what I'm doing wrong. I've read everything in the archives even remotely related to this issue. I'm needing a background image on a window to indicate that the window is in edit mode, similar to the way glade paints the cross hatch pattern. I'm not getting any errors with the code below, but I'm also not seeing my image and I don't know what else to try. Here is the simple testing app I have right now: #include int main( int argc, char *argv[] ){ GtkWidget *window; GdkPixbuf *pixbuf_image = NULL; GdkPixmap *pixmap; GdkScreen *screen = NULL; gint depth, width, height; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_widget_realize(window); pixbuf_image = gdk_pixbuf_new_from_file("test.png",NULL); width = gdk_pixbuf_get_width(pixbuf_image); height = gdk_pixbuf_get_height(pixbuf_image); screen = gdk_screen_get_default(); depth = (gdk_screen_get_system_visual(screen))->depth; pixmap = gdk_pixmap_new(NULL, width, height, depth); gdk_drawable_set_colormap(pixmap, gdk_colormap_get_system ()); gdk_pixbuf_render_pixmap_and_mask(pixbuf_image, &pixmap, NULL,0); gdk_window_set_back_pixmap(gtk_widget_get_root_window(window), pixmap, FALSE); gtk_widget_show (window); gtk_main (); return 0; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list