]> Pileus Git - ~andy/gtk/commitdiff
Start using NSInteger and NSUInteger
authorKristian Rietveld <kris@gtk.org>
Sun, 27 Dec 2009 16:01:25 +0000 (17:01 +0100)
committerTristan Van Berkom <tristan.van.berkom@gmail.com>
Sun, 4 Apr 2010 00:53:44 +0000 (20:53 -0400)
These have been introduced in Leopard and default to int and unsigned int.
In 64-bit Snow Leopard they are long and unsigned long.  This caused issues
with the getRectsBeingDrawn message which needs a pointer to a NSInteger
(long on 64-bit!) but we passed in an integer.  Surprisingly this problem
was visible when compiling with -O0 (segfault), but *not* when compiling
with -O1.  Other messages were NSInteger is now needed have also been
adapted.

Since NSInteger and NSUInteger are not available on Tiger, a define
has been added to add typedefs for these when they have not been defined
by the system headers.

gdk/quartz/GdkQuartzView.c
gdk/quartz/gdkcursor-quartz.c
gdk/quartz/gdkevents-quartz.c
gdk/quartz/gdkwindow-quartz.c
gdk/quartz/gdkwindow-quartz.h

index 5d643eb98499987140f25c7d3b21a0e1f28067ad..4ae010c3f8f6c7752d96bcb930a360a8a4d32a0a 100644 (file)
@@ -60,7 +60,8 @@
   GdkWindowObject *private = GDK_WINDOW_OBJECT (gdk_window);
   GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
   const NSRect *drawn_rects;
-  int count, i;
+  NSInteger count;
+  int i;
   GdkRegion *region;
 
   if (GDK_WINDOW_DESTROYED (gdk_window))
index 651952f0c1754cc4c1709738d18203ac855662d0..e8759690e54957ce02928abfadafbc176408c009 100644 (file)
@@ -84,7 +84,7 @@ create_builtin_cursor (GdkCursorType cursor_type)
 {
   GdkCursor *cursor;
   NSBitmapImageRep *bitmap_rep;
-  gint mask_width, mask_height;
+  NSInteger mask_width, mask_height;
   gint src_width, src_height;
   gint dst_stride;
   const guchar *mask_start, *src_start;
@@ -249,7 +249,7 @@ gdk_cursor_new_from_pixmap (GdkPixmap      *source,
   NSImage *image;
   NSCursor *nscursor;
   GdkCursor *cursor;
-  gint width, height;
+  NSInteger width, height;
   gint tmp_x, tmp_y;
   guchar *dst_data, *mask_data, *src_data;
   guchar *mask_start, *src_start;
index 24044b355c5687615ab9e0ca3057960b0ef5bdf7..0f14385293a500db204dc46214ff56a1d6ca5784 100644 (file)
@@ -213,7 +213,7 @@ get_time_from_ns_event (NSEvent *event)
 static int
 get_mouse_button_from_ns_event (NSEvent *event)
 {
-  int button;
+  NSInteger button;
 
   button = [event buttonNumber];
 
index 7b47e7fe4efad8f06a2fdb39ff1d56a5c3092d0a..91e5e181de3c463df954fbec6dea59ee5145781c 100644 (file)
@@ -730,7 +730,7 @@ find_child_window_helper (GdkWindow *window,
         {
           NSRect frame = NSMakeRect (0, 0, 100, 100);
           NSRect content;
-          int mask;
+          NSUInteger mask;
           int titlebar_height;
 
           mask = [child_impl->toplevel styleMask];
@@ -996,7 +996,7 @@ _gdk_window_impl_new (GdkWindow     *window,
         NSScreen *screen;
         NSRect screen_rect;
         NSRect content_rect;
-        int style_mask;
+        NSUInteger style_mask;
         int nx, ny;
         const char *title;
 
@@ -2644,7 +2644,7 @@ gdk_window_set_decorations (GdkWindow       *window,
                            GdkWMDecoration  decorations)
 {
   GdkWindowImplQuartz *impl;
-  int old_mask, new_mask;
+  NSUInteger old_mask, new_mask;
   NSView *old_view;
 
   if (GDK_WINDOW_DESTROYED (window) ||
index 8d4751234420a4619de1ae4187c6a98dcc023d69..f16c3af9372cb3ffc07dc1e7e1001587238b6361 100644 (file)
 #import <gdk/quartz/GdkQuartzView.h>
 #import <gdk/quartz/GdkQuartzWindow.h>
 
+/* NSInteger only exists in Leopard and newer.  This check has to be
+ * done after inclusion of the system headers.  If NSInteger has not
+ * been defined, we know for sure that we are on 32-bit.
+ */
+#ifndef NSINTEGER_DEFINED
+typedef int NSInteger;
+typedef unsigned int NSUInteger;
+#endif
 
 G_BEGIN_DECLS