Re: How to determine *actual* visible region of a window?



On 6/27/07, Dave Howorth <dhoworth mrc-lmb cam ac uk> wrote:
Gaurav Jain wrote:
> For the purpose of my application, I need to programmatically
> determine the actual 'exposed' region of a gdk window.  The exposed
> region should not include any obscured regions of the window.  For
> example, if there's some external window in front of my application's
> window, then the exposed region should not include the area obscured
> by that external window, but should include all other area that's
> visible.
>
> I tried using the API gdk_drawable_get_visible_region() but this
> doesn't exclude the obscured regions, so it's not of my use.
>
> Does somebody know of any suitable API that I can use to achieve what
> I want?  Or is there a method that somebody could suggest that I could
> use to calculate this region?

I'm pretty much a beginner with gtk but I do know a bit about X and you
haven't had an answer, so here's what I understand:

What is currently exposed is dynamic, of course, so it's event driven. I
believe you need to get the GdkEventExpose structure from a GdkEvent of
type GDK_EXPOSE and then look at the GdkRegion structure within it,
which contains the information you're looking for.

You'll need to enable such events on your window. You can also cause
such an event any time you want by calling queue_redraw.

HTH, Dave

Thank you for your reply Dave.  I have tried doing this
programmatically (by invalidating the window's rect and then calling
gdk_window_process_updates() ) but that results in expose events with
the entire update region, including the areas that are actually
obscured.  However, if the window is shown as a result of user action
(by say minimizing and then maximizing) with another smaller window in
front of that window, then the expose events are emitted with the
correct expose region (i.e., excluding the obscured windows).

I wonder if there's a way to programmatically determine at any point
of time what is the currently exposed/visible region of a given gdk
window.



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