[gtk+] quartz: implement gdk_window_set_shadow_width()



commit feedf46ddc8d47618e27c7888b223e4706a03cd2
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Dec 12 23:31:52 2013 -0500

    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

 gdk/quartz/GdkQuartzNSWindow.c |    6 ++++--
 gdk/quartz/gdkwindow-quartz.c  |   20 ++++++++++++++++++++
 gdk/quartz/gdkwindow-quartz.h  |    2 ++
 3 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/gdk/quartz/GdkQuartzNSWindow.c b/gdk/quartz/GdkQuartzNSWindow.c
index df96a26..8ab09eb 100644
--- a/gdk/quartz/GdkQuartzNSWindow.c
+++ b/gdk/quartz/GdkQuartzNSWindow.c
@@ -337,6 +337,8 @@
 
 - (BOOL)trackManualMove
 {
+  GdkWindow *window = [[self contentView] gdkWindow];
+  GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
   NSPoint currentLocation;
   NSPoint newOrigin;
   NSRect screenFrame = [[NSScreen mainScreen] visibleFrame];
@@ -350,8 +352,8 @@
   newOrigin.y = currentLocation.y - initialMoveLocation.y;
 
   /* Clamp vertical position to below the menu bar. */
-  if (newOrigin.y + windowFrame.size.height > screenFrame.origin.y + screenFrame.size.height)
-    newOrigin.y = screenFrame.origin.y + screenFrame.size.height - windowFrame.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 + 
impl->shadow_top;
 
   [self setFrameOrigin:newOrigin];
 
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 05b3b77..27ef1a5 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -2887,6 +2887,25 @@ gdk_quartz_window_set_opacity (GdkWindow *window,
   [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 *
 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_move_drag = gdk_quartz_window_begin_move_drag;
   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->register_dnd = _gdk_quartz_window_register_dnd;
   impl_class->drag_begin = _gdk_quartz_window_drag_begin;
diff --git a/gdk/quartz/gdkwindow-quartz.h b/gdk/quartz/gdkwindow-quartz.h
index dcd75b0..396035d 100644
--- a/gdk/quartz/gdkwindow-quartz.h
+++ b/gdk/quartz/gdkwindow-quartz.h
@@ -62,6 +62,8 @@ struct _GdkWindowImplQuartz
   cairo_region_t *needs_display_region;
 
   cairo_surface_t *cairo_surface;
+
+  gint shadow_top;
 };
  
 struct _GdkWindowImplQuartzClass 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]