Re: [gtkmm] Gdk::Window problem

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

 



Murray Cumming wrote:

Murray Cumming wrote:



I found the problem, why Gdk::Window in GTKMM-2.4 is not compatible now
with GdkWindow in GTK+-2.4.




What do you mean? Exactly what problem are you encountering?



[snip]



GTKMM declaring paint_layout fucntion that take
Glib::RefPtr<Gdk::Window> as parameter, but we cannot cast Gdk::Drawable
to Gdk::Window, because Gdk::Drawable is base of Gdk::Window (see
Glib::RefPtr casting rules).



This is the only part of your email that looks like a problem that you have encountered. Why can't you cast Glib::RefPtr<Gdk::Drawable> to Glib::RefPtr<Gdk::Window> by using RefPtr::cast_dynamic, like so:

Glib::RefPtr<Gdk::Drawable refDrawable;
Glib::RefPtr<Gdk::Window> refWindow =
 Glib::RefPtr<Gdk::Window>::cast_dynamic(refDrawable);

http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1RefPtr.html#e0



You know, I would to apologize. I've tried that already, but had some compilation error, that forced me to decide that I can't cast Drawable to Window. Now I tried it again and everithing was working well.

[snip]


Also, If you look at GTK+ code, you will find that almost all functions
are taking GdkWindow (equal to GdkDrawable) as argument. And that may
cause potential problems for developers in GTKMM.



If a GTK+ function has a GdkWindow* parameter that can actually be some other GdkDrawable* (not a GdkWindow*), then that would be a GTK+ bug. Please CC me on any such bugzilla bugs.



There is no bugs in GTK+.
Example:

GTK+, in gtkstyle.h you see:

void gtk_paint_layout (GtkStyle *style,
GdkWindow *window, // = GdkDrawable*, because of "typedef GdkDrawable GdkWindow"
GtkStateType state_type,
gboolean use_text,
GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
gint y,
PangoLayout *layout);


GTKMM, in style.h you see:

void paint_layout(
const Glib::RefPtr<Gdk::Window>& window, // -> wrap of GdkWindowObject, but should be GdkDrawable (see above declaration)
Gtk::StateType state_type,
bool use_text,
const Gdk::Rectangle& area,
Widget& widget,
const Glib::ustring& detail,
int x,
int y,
const Glib::RefPtr<Pango::Layout>& layout) const;


Actually, since cast_dynamic is working, that will be just some inconvenience when using those methods, not a bug.

Thanks for the help,
-andrew

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux