return window->impl_window == window;
}
+static gboolean
+gdk_window_is_toplevel (GdkWindowObject *window)
+{
+ return
+ window->parent == NULL ||
+ window->parent->window_type == GDK_WINDOW_ROOT;
+}
+
gboolean
_gdk_window_has_impl (GdkWindow *window)
{
r.height = private->height;
new_clip = gdk_region_rectangle (&r);
- if (private->parent != NULL &&
- private->parent->window_type != GDK_WINDOW_ROOT)
+ if (!gdk_window_is_toplevel (private))
{
gdk_region_intersect (new_clip, private->parent->clip_region);
}
if (recalculate_siblings &&
- private->parent != NULL &&
- private->parent->window_type != GDK_WINDOW_ROOT)
+ !gdk_window_is_toplevel (private))
{
/* If we moved a child window in parent or changed the stacking order, then we
* need to recompute the visible area of all the other children in the parent
while (obj->window_type == GDK_WINDOW_CHILD)
{
- if (obj->parent == NULL ||
- obj->parent->window_type == GDK_WINDOW_ROOT)
+ if (gdk_window_is_toplevel (obj))
break;
obj = obj->parent;
}
* so we copy from the toplevel with INCLUDE_INFERIORS.
*/
private = impl_window;
- while (private->parent != NULL &&
- private->parent->window_type != GDK_WINDOW_ROOT)
+ while (!gdk_window_is_toplevel (private))
{
dx -= private->parent->abs_x + private->x;
dy -= private->parent->abs_y + private->y;
}
/* Just do native raise for toplevels */
- if (private->parent == NULL ||
- private->parent->window_type == GDK_WINDOW_ROOT ||
+ if (gdk_window_is_toplevel (private) ||
/* The restack_under codepath should work correctly even if the parent
is native, but it relies on the order of ->children to be correct,
and some apps like SWT reorder the x windows without gdks knowledge,
if (gdk_window_has_impl (w) &&
w->window_type != GDK_WINDOW_FOREIGN &&
- w->parent != NULL &&
- w->parent->window_type != GDK_WINDOW_ROOT)
+ !gdk_window_is_toplevel (w))
{
/* For most native windows we show/hide them not when they are
* mapped/unmapped, because that may not produce the correct results.
if (priv->window_type == GDK_WINDOW_FOREIGN ||
priv->window_type == GDK_WINDOW_ROOT)
viewable = TRUE;
- else if (priv->parent == NULL ||
- priv->parent->window_type == GDK_WINDOW_ROOT ||
+ else if (gdk_window_is_toplevel (priv) ||
priv->parent->viewable)
viewable = GDK_WINDOW_IS_MAPPED (priv);
else
}
/* Just do native lower for toplevels */
- if (private->parent == NULL ||
- private->parent->window_type == GDK_WINDOW_ROOT ||
+ if (gdk_window_is_toplevel (private) ||
/* The restack_under codepath should work correctly even if the parent
is native, but it relies on the order of ->children to be correct,
and some apps like SWT reorder the x windows without gdks knowledge,
{
GdkRectangle r, child;
- if (private->parent == NULL ||
- private->parent->window_type == GDK_WINDOW_ROOT)
+ if (gdk_window_is_toplevel (private))
return;
/* get the visible rectangle of the parent */
if (private->destroyed)
return;
- if (private->parent == NULL ||
- private->parent->window_type == GDK_WINDOW_ROOT)
+ if (gdk_window_is_toplevel (private))
{
gdk_window_move_resize_toplevel (window, with_move, x, y, width, height);
return;
gdk_region_destroy (diff);
- if (private->parent != NULL &&
- private->parent->window_type != GDK_WINDOW_ROOT)
+ if (!gdk_window_is_toplevel (private))
{
/* New area in the non-root parent window, needs invalidation */
diff = gdk_region_copy (old_region);
x = child_x;
y = child_y;
- while (private->parent != NULL &&
- (private->parent->window_type != GDK_WINDOW_ROOT))
+ while (!gdk_window_is_toplevel (private))
{
x += private->x;
y += private->y;
event_private->window_type == GDK_WINDOW_ROOT)
return;
- is_toplevel =
- event_private->parent == NULL ||
- event_private->parent->window_type == GDK_WINDOW_ROOT;
+ is_toplevel = gdk_window_is_toplevel (event_private);
if ((event->type == GDK_ENTER_NOTIFY ||
event->type == GDK_LEAVE_NOTIFY) &&