Commit 085ef06b authored by Alexandre Julliard's avatar Alexandre Julliard

Added is_window_visible function.

parent 7d716db7
......@@ -96,6 +96,7 @@ static inline struct region *create_empty_region(void) { return create_region( N
extern void destroy_thread_windows( struct thread *thread );
extern int is_child_window( user_handle_t parent, user_handle_t child );
extern int is_top_level_window( user_handle_t window );
extern int is_window_visible( user_handle_t window );
extern int make_window_active( user_handle_t window );
extern struct thread *get_window_thread( user_handle_t handle );
extern user_handle_t window_from_point( int x, int y );
......
......@@ -405,6 +405,27 @@ int make_window_active( user_handle_t window )
return 1;
}
/* check if window and all its ancestors are visible */
static int is_visible( const struct window *win )
{
while (win && win != top_window)
{
if (!(win->style & WS_VISIBLE)) return 0;
win = win->parent;
/* if parent is minimized children are not visible */
if (win && (win->style & WS_MINIMIZE)) return 0;
}
return 1;
}
/* same as is_visible but takes a window handle */
int is_window_visible( user_handle_t window )
{
struct window *win = get_user_object( window, USER_WINDOW );
if (!win) return 0;
return is_visible( win );
}
/* check if point is inside the window */
static inline int is_point_in_window( struct window *win, int x, int y )
{
......@@ -601,15 +622,13 @@ static struct region *get_visible_region( struct window *win, struct window *top
unsigned int flags )
{
struct region *tmp, *region;
struct window *ptr;
int offset_x, offset_y;
if (!(region = create_empty_region())) return NULL;
/* first check if all ancestors are visible */
for (ptr = win; ptr != top_window; ptr = ptr->parent)
if (!(ptr->style & WS_VISIBLE)) return region; /* empty region */
if (!is_visible( win )) return region; /* empty region */
/* create a region relative to the window itself */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment