Re: parent_relative questions




Adding a little to my previous post, I have written a very simple X-only app that creates a 200x200 window and sets the background pixmap to ParentRelative and can see that it works as expected (well, almost. It actually sets the window background to be whatever's already on screen as opposed to refreshing with the root window's bg pixmap, but that's okay for what I'm doing). When I use gtk for the simple test program (code attached), I get a solid black window instead.

So something in GTK2.0 must be drawing black into the rectangle that's about to be occupied by the window even though it's "app paintable", and then that black is getting picked up by the window's background, defeating the purpose of the ParentRelative setting. That's assuming that the ParentRelative setting even took and the black isn't just X clearing the background to black because it thinks the window has no pixmap...

Anybody ever worked with this or have any thoughts as to how I avoid the black? GTK+-2.0.2 on XFree86 4.2.0.

Thanks again,
--Brett


Brett Granger wrote:

I've been experimenting with gdk_window_set_back_pixmap and the parent_relative flag under X. According to the X docs, setting a bg pixmap of ParentRelative should indicate that the background of this window is the appropriately offset pixmap of whatever's in the bg of the parent window. This seems like it might be yet another way to pretend to have transparent top level windows, since the background pixmaps should be tiled in such a way as to make the child fit right in over the parent.

The first thing I learned is that if I don't "gtk_widget_set_app_paintable" I still get the default gray background fill. However, when I set the window to be "app paintable" I would expect that I should see the bg pixmap that I have set in my root window (since the windows I am playing with are TOPLEVEL). Instead I get a solid black background, regardless of what's in the root window.

Has anybody else had any success with parent_relative windows and can anyone comment on whether I really can achieve a fake transparency with toplevel windows in this way? I'm using GTK2.0.

Thanks in advance!
--Brett

ps. directfb is not an option for us, which is why I thought I'd try it this way...

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

#include <gtk/gtk.h>


gint main (gint argc, gchar **argv)
{
  GtkWidget *win = NULL;

  gtk_init(&argc, &argv);

  win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_app_paintable(win, TRUE);
  gtk_window_set_wmclass(GTK_WINDOW(win), "gtk_parent_relative_test", "Pvr");

  gtk_widget_realize(win);
  gdk_window_set_back_pixmap(win->window, NULL, TRUE);

  gtk_widget_show_all(win);
  
  gtk_main();

  return 0;
}


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