summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-02-13 20:47:57 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-02-13 21:01:46 -0500
commitea19f7c360c82091c00b900d6bc00508a02f90e8 (patch)
tree2d11800d4e6ed84c563ad15bcbdf6c834309bf0c
parent0222d389eefe5ec5cef6282912b78ebac791cc40 (diff)
downloadgtk+-ea19f7c360c82091c00b900d6bc00508a02f90e8.tar.gz
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.
-rw-r--r--docs/reference/gdk/gdk4-docs.xml4
-rw-r--r--docs/reference/gdk/gdk4-sections.txt2
-rw-r--r--gdk/gdkpopuplayout.c70
-rw-r--r--gdk/gdkpopuplayout.h14
4 files changed, 89 insertions, 1 deletions
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 @@
<title>Index of all symbols</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
+ <index id="api-index-4-2" role="4.2">
+ <title>Index of new symbols in 4.2</title>
+ <xi:include href="xml/api-index-4.2.xml"><xi:fallback /></xi:include>
+ </index>
<index id="api-index-deprecated" role="deprecated">
<title>Index of deprecated symbols</title>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
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
<SUBSECTION Standard>
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__ */