Getting the visible portion of a scrolled window



I've got a scrolled window containing an OpenGL-enabled drawing area, and I'm trying to implement drag-selection of OpenGL-rendered items.

This works just fine so long at the entire area I'm selecting is within the drawing area. However, if it isn't, the program crashes because I can't control what's drawn there.

Since the selection only includes a draw to the GL_BACK buffer and no visible render, I'm not sure why the program can't draw there just because that part of the window is "hidden" (scrolled away), but let's not worry about that for now.

What I'd like to do is limit the size of my drag-box to the currently visible area. This works fine if my scrolled window has no scroll bars and is completely visible; I can easily limit myself to the bounds of the most recent configure event on the drawing area.

But how can I get the visible area of a scrolled window when it's only partially visible, and scroll bars exist? There must be a way to do it; *something* knows which part of the child to draw.


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