Wrapped GdkWindow* resize issues



Hey all,

Hoping to get some help on an older version of Gtkmm (2.4).  I'm supporting some legacy code and as we migrate to newer versions of OS, we're running into issues with some drawing functionality.

To boil it down, we are creating a GdkWindow via gdk_window_foreign_new() from a drawable window, and then wrapping that in a Glib::RefPtr<Gdk::Drawable> via Glib::wrap().

void InitDrawable() {

Window win;  // local variable, assume initialized properly
Glib::RefPtr<Gdk::Drawable> drawable;
GdkWindow* w = gdk_window_foreign_new(win)
drawable = Glib::wrap(w);

}

The issue is that everything works fine the first time through.  But if we resize the window, the drawable->get_size() always returns whatever size the window was when the drawable was initialized.

I've tried a bunch of different ideas to try to get this to work:

- gdk_window_foreign_new_for_display(dpy, win) has no effect on behavior
- drawable.reset() to free up the GdkWindow and re-initialize whenever the Window resizes.
- XGetGeometry(dpy, win, ...) followed by drawable->resize() or gdk_window_resize(win,...)

Nothing seems to work.  Resize() has no effect on the GdkWindow.  Freeing the drawable and then calling gdk_window_foreign_new() actually returns the same value for the GdkWindow* every time.

I'm hoping someone has some clues as to what I'm doing wrong.  I'd be happy with any kind of workaround just to get this functional.  Suggestions to just upgrade to latest are not helpful, as this is legacy code.  However, we are in the middle of rewriting the front end in pure Gtkmm, so this issue will not last forever.  I just need to get the previous version stabilized for the porting period.

--carl



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