diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c index d98b4e6bbf..aa5082f6bf 100644 --- a/gdk/x11/gdksurface-x11.c +++ b/gdk/x11/gdksurface-x11.c @@ -1271,13 +1271,18 @@ x11_surface_move (GdkSurface *surface, if (impl->override_redirect) { - surface->x = x; - surface->y = y; + impl->abs_x = x; + impl->abs_y = y; if (surface->parent) { - impl->offset_x = surface->x - surface->parent->x; - impl->offset_y = surface->y - surface->parent->y; + surface->x = impl->abs_x - GDK_X11_SURFACE (surface->parent)->abs_x; + surface->y = impl->abs_y - GDK_X11_SURFACE (surface->parent)->abs_y; + } + else + { + surface->x = x; + surface->y = y; } } } @@ -1340,8 +1345,8 @@ x11_surface_move_resize (GdkSurface *surface, if (impl->override_redirect) { - surface->x = x; - surface->y = y; + impl->abs_x = x; + impl->abs_y = y; impl->unscaled_width = width * impl->surface_scale; impl->unscaled_height = height * impl->surface_scale; @@ -1352,8 +1357,13 @@ x11_surface_move_resize (GdkSurface *surface, if (surface->parent) { - impl->offset_x = surface->x - surface->parent->x; - impl->offset_y = surface->y - surface->parent->y; + surface->x = impl->abs_x - GDK_X11_SURFACE (surface->parent)->abs_x; + surface->y = impl->abs_y - GDK_X11_SURFACE (surface->parent)->abs_y; + } + else + { + surface->x = x; + surface->y = y; } } else @@ -1395,10 +1405,10 @@ gdk_x11_surface_update_popups (GdkSurface *parent) { GdkX11Surface *popup_impl = l->data; GdkSurface *popup = GDK_SURFACE (popup_impl); - int new_x = parent->x + popup_impl->offset_x; - int new_y = parent->y + popup_impl->offset_y; + int new_x = GDK_X11_SURFACE (parent)->abs_x + popup->x; + int new_y = GDK_X11_SURFACE (parent)->abs_y + popup->y; - if (new_x != popup->x || new_y != popup->y) + if (new_x != popup_impl->abs_x || new_y != popup_impl->abs_y) x11_surface_move (popup, new_x, new_y); gdk_x11_surface_restack_toplevel (popup, parent, TRUE); } @@ -2346,8 +2356,8 @@ gdk_x11_surface_get_frame_extents (GdkSurface *surface, impl = GDK_X11_SURFACE (surface); /* Refine our fallback answer a bit using local information */ - rect->x = surface->x * impl->surface_scale; - rect->y = surface->y * impl->surface_scale; + rect->x = impl->abs_x * impl->surface_scale; + rect->y = impl->abs_y * impl->surface_scale; rect->width = surface->width * impl->surface_scale; rect->height = surface->height * impl->surface_scale; diff --git a/gdk/x11/gdksurface-x11.h b/gdk/x11/gdksurface-x11.h index 6c6744a71d..c890d6c13f 100644 --- a/gdk/x11/gdksurface-x11.h +++ b/gdk/x11/gdksurface-x11.h @@ -76,8 +76,8 @@ struct _GdkX11Surface Damage damage; #endif - int offset_x; - int offset_y; + int abs_x; + int abs_y; }; struct _GdkX11SurfaceClass