From: Matthias Clasen Date: Sun, 14 Feb 2021 01:47:57 +0000 (-0500) Subject: popuplayout: Add shadow width X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1~1^2~83^2^2~405^2~10 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ea19f7c360c82091c00b900d6bc00508a02f90e8;p=gtk4.git popuplayout: Add shadow width Add shadow width to the GdkPopupLayout struct. This information is needed by the compositor to make correct positioning decisions about popups. --- diff --git a/docs/reference/gdk/gdk4-docs.xml b/docs/reference/gdk/gdk4-docs.xml index 50b018be9d..d63c7e346c 100644 --- a/docs/reference/gdk/gdk4-docs.xml +++ b/docs/reference/gdk/gdk4-docs.xml @@ -75,6 +75,10 @@ Index of all symbols + + Index of new symbols in 4.2 + + Index of deprecated symbols diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt index 2c82ab8d92..5d0cd8a11a 100644 --- a/docs/reference/gdk/gdk4-sections.txt +++ b/docs/reference/gdk/gdk4-sections.txt @@ -627,6 +627,8 @@ gdk_popup_layout_set_anchor_hints gdk_popup_layout_get_anchor_hints gdk_popup_layout_set_offset gdk_popup_layout_get_offset +gdk_popup_layout_set_shadow_width +gdk_popup_layout_get_shadow_width GDK_TYPE_POPUP_LAYOUT gdk_popup_layout_get_type diff --git a/gdk/gdkpopuplayout.c b/gdk/gdkpopuplayout.c index 7192ef259d..686a2cbafe 100644 --- a/gdk/gdkpopuplayout.c +++ b/gdk/gdkpopuplayout.c @@ -74,6 +74,10 @@ struct _GdkPopupLayout GdkAnchorHints anchor_hints; int dx; int dy; + int shadow_left; + int shadow_right; + int shadow_top; + int shadow_bottom; }; G_DEFINE_BOXED_TYPE (GdkPopupLayout, gdk_popup_layout, @@ -165,6 +169,10 @@ gdk_popup_layout_copy (GdkPopupLayout *layout) new_layout->anchor_hints = layout->anchor_hints; new_layout->dx = layout->dx; new_layout->dy = layout->dy; + new_layout->shadow_left = layout->shadow_left; + new_layout->shadow_right = layout->shadow_right; + new_layout->shadow_top = layout->shadow_top; + new_layout->shadow_bottom = layout->shadow_bottom; return new_layout; } @@ -191,7 +199,11 @@ gdk_popup_layout_equal (GdkPopupLayout *layout, layout->surface_anchor == other->surface_anchor && layout->anchor_hints == other->anchor_hints && layout->dx == other->dx && - layout->dy == other->dy); + layout->dy == other->dy && + layout->shadow_left == other->shadow_left && + layout->shadow_right == other->shadow_right && + layout->shadow_top == other->shadow_top && + layout->shadow_bottom == other->shadow_bottom); } /** @@ -346,3 +358,59 @@ gdk_popup_layout_get_offset (GdkPopupLayout *layout, if (dy) *dy = layout->dy; } + +/** + * gdk_popup_layout_set_shadow_width: + * @layout: a #GdkPopupLayout + * @left: width of the left part of the shadow + * @right: width of the right part of the shadow + * @top: height of the top part of the shadow + * @bottom: height of the bottom part of the shadow + * + * The shadow width corresponds to the part of the computed surface size + * that would consist of the shadow margin surrounding the window, would + * there be any. + * + * Since: 4.2 + */ +void +gdk_popup_layout_set_shadow_width (GdkPopupLayout *layout, + int left, + int right, + int top, + int bottom) +{ + layout->shadow_left = left; + layout->shadow_right = right; + layout->shadow_top = top; + layout->shadow_bottom = bottom; +} + +/** + * gdk_popup_layout_get_shadow_width: + * @layout: a #GdkPopupLayout + * @left: (out): return location for the left shadow width + * @right: (out): return location for the right shadow width + * @top: (out): return location for the top shadow width + * @bottom: (out): return location for the bottom shadow width + * + * Obtains the shadow widths of this layout. + * + * Since: 4.2 + */ +void +gdk_popup_layout_get_shadow_width (GdkPopupLayout *layout, + int *left, + int *right, + int *top, + int *bottom) +{ + if (left) + *left = layout->shadow_left; + if (right) + *right = layout->shadow_right; + if (top) + *top = layout->shadow_top; + if (bottom) + *bottom = layout->shadow_bottom; +} diff --git a/gdk/gdkpopuplayout.h b/gdk/gdkpopuplayout.h index f55c748895..254704ead5 100644 --- a/gdk/gdkpopuplayout.h +++ b/gdk/gdkpopuplayout.h @@ -137,6 +137,20 @@ void gdk_popup_layout_get_offset (GdkPopupLayout int *dx, int *dy); +GDK_AVAILABLE_IN_4_2 +void gdk_popup_layout_set_shadow_width (GdkPopupLayout *layout, + int left, + int right, + int top, + int bottom); +GDK_AVAILABLE_IN_4_2 +void gdk_popup_layout_get_shadow_width (GdkPopupLayout *layout, + int *left, + int *right, + int *top, + int *bottom); + + G_END_DECLS #endif /* __GDK_POPUP_LAYOUT_H__ */