forked from AuroraMiddleware/gtk
gdk: add gdk_window_set_shadow_width()
And deprecate the X11-specific version of it. We call this new API _set_shadow_width() and not _set_frame_extents() because we already have a gdk_window_get_frame_extents() with a different meaning and different type of value. https://bugzilla.gnome.org/show_bug.cgi?id=720374
This commit is contained in:
parent
ec61f290dc
commit
04897e5b09
@ -450,6 +450,7 @@ gdk_window_set_modal_hint
|
||||
gdk_window_get_modal_hint
|
||||
gdk_window_set_type_hint
|
||||
gdk_window_get_type_hint
|
||||
gdk_window_set_shadow_width
|
||||
gdk_window_set_skip_taskbar_hint
|
||||
gdk_window_set_skip_pager_hint
|
||||
gdk_window_set_urgency_hint
|
||||
|
@ -10872,3 +10872,42 @@ gdk_window_set_opaque_region (GdkWindow *window,
|
||||
if (impl_class->set_opaque_region)
|
||||
return impl_class->set_opaque_region (window, region);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_set_shadow_width:
|
||||
* @window: a #GdkWindow
|
||||
* @left: The left extent
|
||||
* @right: The right extent
|
||||
* @top: The top extent
|
||||
* @bottom: The bottom extent
|
||||
*
|
||||
* Newer GTK+ windows using client-side decorations use extra geometry
|
||||
* around their frames for effects like shadows and invisible borders.
|
||||
* Window managers that want to maximize windows or snap to edges need
|
||||
* to know where the extents of the actual frame lie, so that users
|
||||
* don't feel like windows are snapping against random invisible edges.
|
||||
*
|
||||
* Note that this property is automatically updated by GTK+, so this
|
||||
* function should only be used by applications which do not use GTK+
|
||||
* to create toplevel windows.
|
||||
*
|
||||
* Since: 3.12
|
||||
*/
|
||||
void
|
||||
gdk_window_set_shadow_width (GdkWindow *window,
|
||||
gint left,
|
||||
gint right,
|
||||
gint top,
|
||||
gint bottom)
|
||||
{
|
||||
GdkWindowImplClass *impl_class;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
g_return_if_fail (!GDK_WINDOW_DESTROYED (window));
|
||||
g_return_if_fail (left >= 0 && right >= 0 && top >= 0 && bottom >= 0);
|
||||
|
||||
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
|
||||
|
||||
if (impl_class->set_shadow_width)
|
||||
impl_class->set_shadow_width (window, left, right, top, bottom);
|
||||
}
|
||||
|
@ -1096,6 +1096,13 @@ void gdk_window_set_event_compression (GdkWindow *window,
|
||||
GDK_AVAILABLE_IN_3_12
|
||||
gboolean gdk_window_get_event_compression (GdkWindow *window);
|
||||
|
||||
GDK_AVAILABLE_IN_3_12
|
||||
void gdk_window_set_shadow_width (GdkWindow *window,
|
||||
gint left,
|
||||
gint right,
|
||||
gint top,
|
||||
gint bottom);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_WINDOW_H__ */
|
||||
|
@ -295,6 +295,11 @@ struct _GdkWindowImplClass
|
||||
|
||||
void (* set_opaque_region) (GdkWindow *window,
|
||||
cairo_region_t *region);
|
||||
void (* set_shadow_width) (GdkWindow *window,
|
||||
gint left,
|
||||
gint right,
|
||||
gint top,
|
||||
gint bottom);
|
||||
};
|
||||
|
||||
/* Interface Functions */
|
||||
|
@ -3660,32 +3660,12 @@ gdk_x11_window_set_hide_titlebar_when_maximized (GdkWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_x11_window_set_frame_extents:
|
||||
* @window: (type GdkX11Window): a #GdkWindow
|
||||
* @left: The left extent
|
||||
* @right: The right extent
|
||||
* @top: The top extent
|
||||
* @bottom: The bottom extent
|
||||
*
|
||||
* Newer GTK+ windows using client-side decorations use extra geometry
|
||||
* around their frames for effects like shadows and invisible borders.
|
||||
* Window managers that want to maximize windows or snap to edges need
|
||||
* to know where the extents of the actual frame lie, so that users
|
||||
* don't feel like windows are snapping against random invisible edges.
|
||||
*
|
||||
* Note that this property is automatically updated by GTK+, so this
|
||||
* function should only be used by applications which do not use GTK+
|
||||
* to create toplevel windows.
|
||||
*
|
||||
* Since: 3.10
|
||||
*/
|
||||
void
|
||||
gdk_x11_window_set_frame_extents (GdkWindow *window,
|
||||
int left,
|
||||
int right,
|
||||
int top,
|
||||
int bottom)
|
||||
static void
|
||||
gdk_x11_window_set_shadow_width (GdkWindow *window,
|
||||
int left,
|
||||
int right,
|
||||
int top,
|
||||
int bottom)
|
||||
{
|
||||
Atom frame_extents;
|
||||
gulong data[4] = { left, right, top, bottom };
|
||||
@ -3699,6 +3679,31 @@ gdk_x11_window_set_frame_extents (GdkWindow *window,
|
||||
(guchar *) &data, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_x11_window_set_frame_extents:
|
||||
* @window: (type GdkX11Window): a #GdkWindow
|
||||
* @left: The left extent
|
||||
* @right: The right extent
|
||||
* @top: The top extent
|
||||
* @bottom: The bottom extent
|
||||
*
|
||||
* This is the same as gdk_window_set_shadow_width() but it only works
|
||||
* on GdkX11Window.
|
||||
*
|
||||
* Since: 3.10
|
||||
*
|
||||
* Deprecated: 3.12: Use gdk_window_set_shadow_width() instead.
|
||||
*/
|
||||
void
|
||||
gdk_x11_window_set_frame_extents (GdkWindow *window,
|
||||
int left,
|
||||
int right,
|
||||
int top,
|
||||
int bottom)
|
||||
{
|
||||
gdk_x11_window_set_shadow_width (window, left, right, top, bottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_x11_window_set_theme_variant:
|
||||
* @window: (type GdkX11Window): a #GdkWindow
|
||||
@ -5712,4 +5717,5 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
|
||||
impl_class->delete_property = _gdk_x11_window_delete_property;
|
||||
impl_class->get_scale_factor = gdk_x11_window_get_scale_factor;
|
||||
impl_class->set_opaque_region = gdk_x11_window_set_opaque_region;
|
||||
impl_class->set_shadow_width = gdk_x11_window_set_shadow_width;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ void gdk_x11_window_set_utf8_property (GdkWindow *window,
|
||||
GDK_AVAILABLE_IN_3_2
|
||||
void gdk_x11_window_set_theme_variant (GdkWindow *window,
|
||||
char *variant);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
GDK_DEPRECATED_IN_3_12_FOR(gdk_window_set_shadow_width)
|
||||
void gdk_x11_window_set_frame_extents (GdkWindow *window,
|
||||
int left,
|
||||
int right,
|
||||
|
@ -6422,21 +6422,19 @@ update_border_windows (GtkWindow *window)
|
||||
}
|
||||
|
||||
static void
|
||||
update_frame_extents (GtkWindow *window,
|
||||
GtkBorder *border)
|
||||
update_shadow_width (GtkWindow *window,
|
||||
GtkBorder *border)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
GdkWindow *gdk_window;
|
||||
|
||||
gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
|
||||
|
||||
if (GDK_IS_X11_WINDOW (gdk_window))
|
||||
gdk_x11_window_set_frame_extents (gdk_window,
|
||||
border->left,
|
||||
border->right,
|
||||
border->top,
|
||||
border->bottom);
|
||||
#endif
|
||||
if (gdk_window)
|
||||
gdk_window_set_shadow_width (gdk_window,
|
||||
border->left,
|
||||
border->right,
|
||||
border->top,
|
||||
border->bottom);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -6571,7 +6569,7 @@ _gtk_window_set_allocation (GtkWindow *window,
|
||||
priv->title_height = 0;
|
||||
|
||||
if (priv->client_decorated)
|
||||
update_frame_extents (window, &window_border);
|
||||
update_shadow_width (window, &window_border);
|
||||
|
||||
update_opaque_region (window, &window_border, &child_allocation);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user