quartz: implement gdk_window_set_shadow_width()

Use the information to allow dragging windows all the way to the top of
the screen (ie: allow the top shadow to go under the menubar).

https://bugzilla.gnome.org/show_bug.cgi?id=720374
This commit is contained in:
Ryan Lortie
2013-12-12 23:31:52 -05:00
parent 394fe4b57e
commit feedf46ddc
3 changed files with 26 additions and 2 deletions

View File

@ -337,6 +337,8 @@
- (BOOL)trackManualMove - (BOOL)trackManualMove
{ {
GdkWindow *window = [[self contentView] gdkWindow];
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
NSPoint currentLocation; NSPoint currentLocation;
NSPoint newOrigin; NSPoint newOrigin;
NSRect screenFrame = [[NSScreen mainScreen] visibleFrame]; NSRect screenFrame = [[NSScreen mainScreen] visibleFrame];
@ -350,8 +352,8 @@
newOrigin.y = currentLocation.y - initialMoveLocation.y; newOrigin.y = currentLocation.y - initialMoveLocation.y;
/* Clamp vertical position to below the menu bar. */ /* Clamp vertical position to below the menu bar. */
if (newOrigin.y + windowFrame.size.height > screenFrame.origin.y + screenFrame.size.height) if (newOrigin.y + windowFrame.size.height - impl->shadow_top > screenFrame.origin.y + screenFrame.size.height)
newOrigin.y = screenFrame.origin.y + screenFrame.size.height - windowFrame.size.height; newOrigin.y = screenFrame.origin.y + screenFrame.size.height - windowFrame.size.height + impl->shadow_top;
[self setFrameOrigin:newOrigin]; [self setFrameOrigin:newOrigin];

View File

@ -2887,6 +2887,25 @@ gdk_quartz_window_set_opacity (GdkWindow *window,
[impl->toplevel setAlphaValue: opacity]; [impl->toplevel setAlphaValue: opacity];
} }
static void
gdk_quartz_window_set_shadow_width (GdkWindow *window,
gint left,
gint right,
gint top,
gint bottom)
{
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (WINDOW_IS_TOPLEVEL (window));
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
return;
impl->shadow_top = top;
}
static cairo_region_t * static cairo_region_t *
gdk_quartz_window_get_shape (GdkWindow *window) gdk_quartz_window_get_shape (GdkWindow *window)
{ {
@ -3000,6 +3019,7 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
impl_class->begin_resize_drag = gdk_quartz_window_begin_resize_drag; impl_class->begin_resize_drag = gdk_quartz_window_begin_resize_drag;
impl_class->begin_move_drag = gdk_quartz_window_begin_move_drag; impl_class->begin_move_drag = gdk_quartz_window_begin_move_drag;
impl_class->set_opacity = gdk_quartz_window_set_opacity; impl_class->set_opacity = gdk_quartz_window_set_opacity;
impl_class->set_shadow_width = gdk_quartz_window_set_shadow_width;
impl_class->destroy_notify = gdk_quartz_window_destroy_notify; impl_class->destroy_notify = gdk_quartz_window_destroy_notify;
impl_class->register_dnd = _gdk_quartz_window_register_dnd; impl_class->register_dnd = _gdk_quartz_window_register_dnd;
impl_class->drag_begin = _gdk_quartz_window_drag_begin; impl_class->drag_begin = _gdk_quartz_window_drag_begin;

View File

@ -62,6 +62,8 @@ struct _GdkWindowImplQuartz
cairo_region_t *needs_display_region; cairo_region_t *needs_display_region;
cairo_surface_t *cairo_surface; cairo_surface_t *cairo_surface;
gint shadow_top;
}; };
struct _GdkWindowImplQuartzClass struct _GdkWindowImplQuartzClass