- &win_x, &win_y, &temp_mask);
-//printf("BC_WindowBase::get_cursor_over_window %d %s 0x%x %d 0x%x\n",
-// __LINE__, title, win, ret, child_return);
-
- int result = !ret || child_return == None ? 0 :
- match_window(child_return);
- return result;
+ &win_x, &win_y, &mask_return);
+ if( ret && child_return == None ) ret = 0;
+ if( ret && win != child_return )
+ ret = top_level->match_window(child_return);
+// query pointer can return a window manager window with this top_level as a child
+// for kde this can be two levels deep
+ unsigned int nchildren_return = 0;
+ Window parent_return, *children_return = 0;
+ Window top_win = top_level->win;
+ while( !ret && top_win != top_level->rootwin && top_win != root_return &&
+ XQueryTree(top_level->display, top_win, &root_return,
+ &parent_return, &children_return, &nchildren_return) ) {
+ if( children_return ) XFree(children_return);
+ if( (top_win=parent_return) == child_return ) ret = 1;
+ }
+ return ret;