Merge branch 'fix-3793' into 'master'

gdksurface-win32.c: Fix up popup placement (fix issue #3793)

Closes #3793

See merge request GNOME/gtk!3674
This commit is contained in:
Matthias Clasen 2021-06-16 10:08:52 +00:00
commit 1abbf00dcf

View File

@ -1229,6 +1229,7 @@ gdk_win32_surface_layout_popup (GdkSurface *surface,
&shadow_right, &shadow_right,
&shadow_top, &shadow_top,
&shadow_bottom); &shadow_bottom);
gdk_win32_surface_set_shadow_width (surface, gdk_win32_surface_set_shadow_width (surface,
shadow_left, shadow_left,
shadow_right, shadow_right,
@ -1238,10 +1239,10 @@ gdk_win32_surface_layout_popup (GdkSurface *surface,
gdk_surface_layout_popup_helper (surface, gdk_surface_layout_popup_helper (surface,
width, width,
height, height,
impl->shadow.left, shadow_left,
impl->shadow.right, shadow_right,
impl->shadow.top, shadow_top,
impl->shadow.bottom, shadow_bottom,
monitor, monitor,
&bounds, &bounds,
layout, layout,
@ -1261,9 +1262,7 @@ gdk_win32_surface_layout_popup (GdkSurface *surface,
final_rect.height); final_rect.height);
} }
else else
{ gdk_win32_surface_move (surface, x, y);
gdk_win32_surface_move (surface, x, y);
}
} }
static void static void
@ -4417,9 +4416,9 @@ gdk_win32_surface_set_shadow_width (GdkSurface *window,
if (impl->zero_shadow) if (impl->zero_shadow)
return; return;
impl->shadow.left = left; impl->shadow.left = left * impl->surface_scale;;
impl->shadow.right = right * impl->surface_scale; impl->shadow.right = right * impl->surface_scale;
impl->shadow.top = top; impl->shadow.top = top * impl->surface_scale;;
impl->shadow.bottom = bottom * impl->surface_scale; impl->shadow.bottom = bottom * impl->surface_scale;
impl->shadow_x = left + right; impl->shadow_x = left + right;
impl->shadow_y = top + bottom; impl->shadow_y = top + bottom;
@ -4555,7 +4554,7 @@ _gdk_win32_surface_request_layout (GdkSurface *surface)
int scale = impl->surface_scale; int scale = impl->surface_scale;
RECT rect; RECT rect;
if (GDK_IS_TOPLEVEL (surface) && impl->drag_move_resize_context.native_move_resize_pending) if (impl->drag_move_resize_context.native_move_resize_pending)
{ {
surface->width = impl->next_layout.configured_width; surface->width = impl->next_layout.configured_width;
surface->height = impl->next_layout.configured_height; surface->height = impl->next_layout.configured_height;
@ -4566,8 +4565,18 @@ _gdk_win32_surface_request_layout (GdkSurface *surface)
impl->next_layout.configured_width = (rect.right - rect.left + scale - 1) / scale; impl->next_layout.configured_width = (rect.right - rect.left + scale - 1) / scale;
impl->next_layout.configured_height = (rect.bottom - rect.top + scale - 1) / scale; impl->next_layout.configured_height = (rect.bottom - rect.top + scale - 1) / scale;
surface->x = rect.left / scale;
surface->y = rect.top / scale; if (GDK_IS_TOPLEVEL (surface))
{
surface->x = rect.left / scale;
surface->y = rect.top / scale;
}
else if (GDK_IS_POPUP (surface))
{
gdk_win32_surface_get_geometry (surface,
&surface->x, &surface->y,
NULL, NULL);
}
} }
} }
@ -4657,9 +4666,9 @@ gdk_win32_popup_init (GdkWin32Popup *popup)
static void static void
gdk_win32_popup_get_property (GObject *object, gdk_win32_popup_get_property (GObject *object,
guint prop_id, guint prop_id,
GValue *value, GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GdkSurface *surface = GDK_SURFACE (object); GdkSurface *surface = GDK_SURFACE (object);
@ -4681,9 +4690,9 @@ gdk_win32_popup_get_property (GObject *object,
static void static void
gdk_win32_popup_set_property (GObject *object, gdk_win32_popup_set_property (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GdkSurface *surface = GDK_SURFACE (object); GdkSurface *surface = GDK_SURFACE (object);
@ -4718,9 +4727,9 @@ gdk_win32_popup_class_init (GdkWin32PopupClass *class)
static gboolean static gboolean
gdk_win32_popup_present (GdkPopup *popup, gdk_win32_popup_present (GdkPopup *popup,
int width, int width,
int height, int height,
GdkPopupLayout *layout) GdkPopupLayout *layout)
{ {
return gdk_win32_surface_present_popup (GDK_SURFACE (popup), width, height, layout); return gdk_win32_surface_present_popup (GDK_SURFACE (popup), width, height, layout);
} }