]> Pileus Git - ~andy/gtk/blobdiff - gdk/quartz/gdkwindow-quartz.c
Change FSF Address
[~andy/gtk] / gdk / quartz / gdkwindow-quartz.c
index a6fc4ed22e333409887033f67fb2b735d8337edd..fcfe7c140714f14e9e9d1bad3b9d9a2b027fd315 100644 (file)
@@ -14,9 +14,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "config.h"
@@ -1630,7 +1628,18 @@ gdk_window_quartz_restack_toplevel (GdkWindow *window,
                                    GdkWindow *sibling,
                                    gboolean   above)
 {
-  /* FIXME: Implement this */
+  GdkWindowImplQuartz *impl;
+  gint sibling_num;
+
+  impl = GDK_WINDOW_IMPL_QUARTZ (sibling->impl);
+  sibling_num = [impl->toplevel windowNumber];
+
+  impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
+
+  if (above)
+    [impl->toplevel orderWindow:NSWindowAbove relativeTo:sibling_num];
+  else
+    [impl->toplevel orderWindow:NSWindowBelow relativeTo:sibling_num];
 }
 
 static void
@@ -1836,7 +1845,8 @@ gdk_window_quartz_get_device_state_helper (GdkWindow       *window,
   
   toplevel = gdk_window_get_toplevel (window);
 
-  *mask = _gdk_quartz_events_get_current_event_mask ();
+  *mask = _gdk_quartz_events_get_current_keyboard_modifiers () |
+      _gdk_quartz_events_get_current_mouse_modifiers ();
 
   /* Get the y coordinate, needs to be flipped. */
   if (window == _gdk_root)
@@ -2440,6 +2450,7 @@ gdk_quartz_window_set_skip_pager_hint (GdkWindow *window,
 static void
 gdk_quartz_window_begin_resize_drag (GdkWindow     *window,
                                      GdkWindowEdge  edge,
+                                     GdkDevice     *device,
                                      gint           button,
                                      gint           root_x,
                                      gint           root_y,
@@ -2471,6 +2482,7 @@ gdk_quartz_window_begin_resize_drag (GdkWindow     *window,
 
 static void
 gdk_quartz_window_begin_move_drag (GdkWindow *window,
+                                   GdkDevice *device,
                                    gint       button,
                                    gint       root_x,
                                    gint       root_y,
@@ -2529,9 +2541,17 @@ gdk_quartz_window_get_frame_extents (GdkWindow    *window,
   rect->height = ns_rect.size.height;
 }
 
+/* Fake protocol to make gcc think that it's OK to call setStyleMask
+   even if it isn't. We check to make sure before actually calling
+   it. */
+
+@protocol CanSetStyleMask
+- (void)setStyleMask:(int)mask;
+@end
+
 static void
 gdk_quartz_window_set_decorations (GdkWindow       *window,
-                                   GdkWMDecoration  decorations)
+                           GdkWMDecoration  decorations)
 {
   GdkWindowImplQuartz *impl;
   NSUInteger old_mask, new_mask;
@@ -2559,10 +2579,6 @@ gdk_quartz_window_set_decorations (GdkWindow       *window,
 
   old_mask = [impl->toplevel styleMask];
 
-  /* Note, there doesn't seem to be a way to change this without
-   * recreating the toplevel. There might be bad side-effects of doing
-   * that, but it seems alright.
-   */
   if (old_mask != new_mask)
     {
       NSRect rect;
@@ -2586,15 +2602,26 @@ gdk_quartz_window_set_decorations (GdkWindow       *window,
           rect = [NSWindow contentRectForFrameRect:rect styleMask:old_mask];
         }
 
-      impl->toplevel = [impl->toplevel initWithContentRect:rect
-                                                 styleMask:new_mask
-                                                   backing:NSBackingStoreBuffered
-                                                     defer:NO];
-
-      [impl->toplevel setHasShadow: window_type_hint_to_shadow (impl->type_hint)];
-      [impl->toplevel setLevel: window_type_hint_to_level (impl->type_hint)];
+      /* Note, before OS 10.6 there doesn't seem to be a way to change this without
+       * recreating the toplevel. There might be bad side-effects of doing
+       * that, but it seems alright.
+       */
+      if ([impl->toplevel respondsToSelector:@selector(setStyleMask:)])
+        {
+          [(id<CanSetStyleMask>)impl->toplevel setStyleMask:new_mask];
+        }
+      else
+        {
+          [impl->toplevel release];
+          impl->toplevel = [[GdkQuartzNSWindow alloc] initWithContentRect:rect
+                                                                styleMask:new_mask
+                                                                  backing:NSBackingStoreBuffered
+                                                                    defer:NO];
+          [impl->toplevel setHasShadow: window_type_hint_to_shadow (impl->type_hint)];
+          [impl->toplevel setLevel: window_type_hint_to_level (impl->type_hint)];
+          [impl->toplevel setContentView:old_view];
+        }
 
-      [impl->toplevel setContentView:old_view];
       [impl->toplevel setFrame:rect display:YES];
 
       /* Invalidate the window shadow for non-opaque views that have shadow