Re: Gdk problem.
- From: Michael J M Thomson <mjmt internode on net>
- To: PerBeatus <perbeatus os pl>
- Cc: gtkmm-list gnome org
- Subject: Re: Gdk problem.
- Date: Fri, 03 Nov 2006 06:23:23 +1100
PerBeatus wrote:
Hi.
Simple question. Why it compiles ok, and at run prints "segmentation
fault" ?
Gtk::Main main(argc, argv);
Gtk::Window w;
Gdk::Color c_red;
c_red.set_red(65535);
Glib::RefPtr<Gdk::Window> gdk_w = w.get_frame();
gdk_w->set_background(c_red);
I don't think Gtk::Window::get_frame() does what you're expecting. It actually
only returns a valid Gdk::Window when GTK is providing its own window frames*,
which on most platforms (X, Windows, etc) isn't the case, given window frames
are provided by a separate window manager process or the OS, so it isn't really
useful for GTK to give programs access to them. Instead get_frame() returns a
Glib::RefPtr<Gdk::Window> containing NULL, hence your segfault.
By the way, not everybody likes red. ;) If you want to draw attention to your
window, try Gtk::Window::set_urgency_hint(). Or possibly you were just looking for:
w.modify_bg(Gtk::STATE_NORMAL, Gdk::Color("red"));
[*] I think GTK only does this with DirectFB, which doesn't or didn't always
provide window management.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]