[vala/wip/sdl2: 13/18] sdl2: Fix a few type problems and cname attribute issues




commit 38e19acfb722211ea3b2c5c776d667dea0ada29c
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Jan 25 13:46:45 2021 +0100

    sdl2: Fix a few type problems and cname attribute issues

 vapi/sdl2.vapi | 64 +++++++++++++++++++++++++++-------------------------------
 1 file changed, 30 insertions(+), 34 deletions(-)
---
diff --git a/vapi/sdl2.vapi b/vapi/sdl2.vapi
index 5ae3b0fb2..6b80a5984 100644
--- a/vapi/sdl2.vapi
+++ b/vapi/sdl2.vapi
@@ -171,8 +171,7 @@ namespace SDL {
        //
 
        [CCode (cheader_filename = "SDL2/SDL_cpuinfo.h")]
-       [Compact]
-       public class CPU {
+       namespace CPU {
                [Version (since = "2.0.0")]
                [CCode (cname = "SDL_GetCPUCacheLineSize")]
                public static int get_cache_line_size ();
@@ -225,7 +224,7 @@ namespace SDL {
                public static bool has_sse42 ();
        }
 
-       [CCode (type_id = "SDL_version", cheader_filename = "SDL2/SDL_version.h", cname = "SDL_version")]
+       [CCode (cname = "SDL_version", cheader_filename = "SDL2/SDL_version.h")]
        public class Version {
                public uint8 major;
                public uint8 minor;
@@ -245,8 +244,7 @@ namespace SDL {
        /// Hints
        ///
        [CCode (cheader_filename = "SDL2/SDL_hints.h")]
-       [Compact]
-       public class Hint {
+       namespace Hint {
                /**
                 * A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
                 *
@@ -1094,7 +1092,7 @@ namespace SDL {
                 *  A variable setting the double click radius, in pixels.
                 */
                [Version (since = "2.0.9")]
-               [CCode (cname = "SDL_MOUSE_DOUBLE_CLICK_RADIUS")]
+               [CCode (cname = "SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS")]
                public const string MOUSE_DOUBLE_CLICK_RADIUS;
 
                /**
@@ -1789,7 +1787,7 @@ namespace SDL {
 
        [CCode (cname = "Uint8", cprefix = "SDL_HAT_", cheader_filename = "SDL2/SDL_events.h")]
        public enum HatValue {
-               LEFTU, UP, RIGHTUP,
+               LEFTUP, UP, RIGHTUP,
                LEFT, CENTERED, RIGHT,
                LEFTDOWN, DOWN, RIGHTDOWN
        }
@@ -1920,7 +1918,7 @@ namespace SDL {
        [Compact]
        public struct OSEvent : CommonEvent {}// OSEvent
 
-       [CCode (cname = "SDL_SysWMEvent", type_id = "SDL_SysWMEvent", cheader_filename = "SDL2/SDL_events.h")]
+       [CCode (cname = "SDL_SysWMEvent", cheader_filename = "SDL2/SDL_events.h")]
        public struct SysWMEvent {
                public Video.SysWMmsg msg;
        }// SysWMEvent
@@ -2031,9 +2029,9 @@ namespace SDL {
        ///
        /// Video
        ///
-       [CCode (cheader_filename = "SDL2/SDL_video.h")]
+       [CCode (cprefix = "SDL_", cheader_filename = "SDL2/SDL_video.h")]
        namespace Video {
-               [CCode (cprefix = "SDL_ALPHA_", cheader_filename = "SDL2/SDL_pixels.h")]
+               [CCode (cname = "int", cprefix = "SDL_ALPHA_", cheader_filename = "SDL2/SDL_pixels.h")]
                public enum Alpha {
                        OPAQUE,
                        TRANSPARENT
@@ -2128,7 +2126,7 @@ namespace SDL {
                        public int y;
                }// Point
 
-               [CCode (cname = "SDL_BlitMap")]
+               [CCode (cname = "struct SDL_BlitMap")]
                [SimpleType]
                public struct BlitMap {
                        // Private type, content should not be added
@@ -2178,7 +2176,7 @@ namespace SDL {
 
 
 
-               [CCode (type_id = "SDL_Palette", cname = "SDL_Palette", cheader_filename = 
"SDL2/SDL_pixels.h", cprefix = "SDL_", free_function = "SDL_FreePalette", ref_function = "SDL_Palette_up", 
unref_function = "SDL_FreePalette")]
+               [CCode (cname = "SDL_Palette", cheader_filename = "SDL2/SDL_pixels.h", cprefix = "SDL_", 
free_function = "SDL_FreePalette", ref_function = "SDL_Palette_up", unref_function = "SDL_FreePalette")]
                public class Palette {
                        [CCode (array_length_cexpr = "ncolors", array_length_type = "int")]
                        public Video.Color[] colors;
@@ -2196,7 +2194,7 @@ namespace SDL {
                        public int set_colors (Video.Color[] colors, int first_color);
                }
 
-               [CCode (type_id = "SDL_PixelFormat", cname = "SDL_PixelFormat", cheader_filename = 
"SDL2/SDL_pixels.h", cprefix = "SDL_", free_function = "SDL_FreeFormat", ref_function = "SDL_PixelFormat_up", 
unref_function = "SDL_FreeFormat")]
+               [CCode (cname = "SDL_PixelFormat", cheader_filename = "SDL2/SDL_pixels.h", cprefix = "SDL_", 
free_function = "SDL_FreeFormat", ref_function = "SDL_PixelFormat_up", unref_function = "SDL_FreeFormat")]
                public class PixelFormat {
                        public Video.PixelRAWFormat format;
                        public Video.Palette palette;
@@ -2267,7 +2265,7 @@ namespace SDL {
                public delegate int BlitFunc (Video.Surface src, Video.Rect? srcrect,
                 Video.Surface dst, Video.Rect? dstrect);
 
-               [CCode (type_id = "SDL_Surface", cname = "SDL_Surface", ref_function = "SDL_Surface_up", 
unref_function = "SDL_FreeSurface", cheader_filename = "SDL2/SDL_surface.h")]
+               [CCode (cname = "SDL_Surface", ref_function = "SDL_Surface_up", unref_function = 
"SDL_FreeSurface", cheader_filename = "SDL2/SDL_surface.h")]
                [Compact]
                public class Surface {
                        public uint32 flags;
@@ -2414,7 +2412,7 @@ namespace SDL {
                [Compact]
                public class RendererInfo {
 
-                       public const string name;
+                       public unowned string name;
                        public uint32 flags;
 
                        [CCode (cname = "num_texture_formats")]
@@ -2899,11 +2897,11 @@ namespace SDL {
                        public const uint8 POS_CENTERED;
 
                        [CCode (cname = "SDL_NONSHAPEABLE_WINDOW", cheader_filename = "SDL2/SDL_shape.h")]
-                       private const int8 SDL_NONSHAPEABLE_WINDOW;
+                       public const int8 SDL_NONSHAPEABLE_WINDOW;
                        [CCode (cname = "SDL_INVALID_SHAPE_ARGUMENT", cheader_filename = "SDL2/SDL_shape.h")]
-                       private const int8 SDL_INVALID_SHAPE_ARGUMENT;
+                       public const int8 SDL_INVALID_SHAPE_ARGUMENT;
                        [CCode (cname = "SDL_WINDOW_LACKS_SHAPE", cheader_filename = "SDL2/SDL_shape.h")]
-                       private const int8 SDL_WINDOW_LACKS_SHAPE;
+                       public const int8 SDL_WINDOW_LACKS_SHAPE;
 
                        [Version (since = "2.0.4")]
                        [CCode (cname = "SDL_GetGrabbedWindow")]
@@ -3197,7 +3195,7 @@ namespace SDL {
                        }
 
                        [Version (since = "2.0.5")]
-                       [CCode (cname = "SDL_WindowShapeMode", type_id = "SDL_WindowShapeMode" , 
cheader_filename = "SDL2/SDL_shape.h")]
+                       [CCode (cname = "SDL_WindowShapeMode", cheader_filename = "SDL2/SDL_shape.h")]
                        public struct ShapeMode {
                                /**
                                 * The mode of these window-shape parameters.
@@ -3229,7 +3227,7 @@ namespace SDL {
                [CCode (cprefix = "SDL_GL_", cheader_filename = "SDL2/SDL_video.h")]
                namespace GL {
 
-                       [CCode (type_id = "SDL_GLContext", cname = "SDL_GLContext", free_function = 
"SDL_GL_DeleteContext", cheader_filename = "SDL2/SDL_video.h")]
+                       [CCode (cname = "SDL_GLContext", free_function = "SDL_GL_DeleteContext", 
cheader_filename = "SDL2/SDL_video.h")]
                        [Compact]
                        public class Context {
                                [CCode (cname = "SDL_GL_CreateContext")]
@@ -3257,9 +3255,9 @@ namespace SDL {
                                CORE, COMPATIBILITY, ES;
                        }// GLprofile
 
-                       [CCode (cname = "SDL_GLcontextFlag", cprefix = "SDL_GL_CONTEXT_", lower_case_csuffix 
= "flag", cheader_filename = "SDL2/SDL_video.h")]
+                       [CCode (cname = "SDL_GLcontextFlag", cprefix = "SDL_GL_CONTEXT_", cheader_filename = 
"SDL2/SDL_video.h")]
                        public enum ContextFlag {
-                               DEBUG, FORWARD_COMPATIBLE, ROBUST_ACCESS, RESET_ISOLATION
+                               DEBUG_FLAG, FORWARD_COMPATIBLE_FLAG, ROBUST_ACCESS_FLAG, RESET_ISOLATION_FLAG
                        }
                        [CCode (cname = "SDL_GL_LoadLibrary")]
                        public static int load_library (string path);
@@ -3311,8 +3309,7 @@ namespace SDL {
                /// MessageBox
                ///
                [CCode (cprefix = "SDL_", cheader_filename = "SDL2/SDL_messagebox.h")]
-               [Compact]
-               public class MessageBox {
+               namespace MessageBox {
                        [Flags, CCode (cname = "SDL_MessageBoxFlags", cprefix = "SDL_MESSAGEBOX_", 
cheader_filename = "SDL2/SDL_messagebox.h")]
                        public enum Flags {
                                /**
@@ -3410,8 +3407,7 @@ namespace SDL {
        namespace Input {
 
                [CCode (cheader_filename = "SDL2/SDL_clipboard.h")]
-               [Compact]
-               public class Clipboard {
+               namespace Clipboard {
 
                        [Version (since = "2.0.0")]
                        [CCode (cname = "SDL_GetClipboardText")]
@@ -3595,7 +3591,7 @@ namespace SDL {
                }// Key
 
                [CCode (cheader_filename = "SDL2/SDL_keyboard.h")]
-               public class Keyboard {
+               namespace Keyboard {
                        [CCode (cname = "SDL_GetKeyboardFocus")]
                        public static Video.Window get_focus ();
 
@@ -3621,7 +3617,7 @@ namespace SDL {
                }// Keyboard
 
                [CCode (cheader_filename = "SDL2/SDL_keyboard.h")]
-               public class TextInput {
+               namespace TextInput {
                        [CCode (cname = "SDL_StartTextInput")]
                        public static void start ();
 
@@ -3637,7 +3633,7 @@ namespace SDL {
                }// TextInput
 
                [CCode (cheader_filename = "SDL2/SDL_keyboard.h")]
-               public class ScreenKeyboard {
+               namespace ScreenKeyboard {
                        [Version (since = "2.0.0")]
                        [CCode (cname = "SDL_HasScreenKeyboardSupport")]
                        public static bool has_support ();
@@ -3662,7 +3658,7 @@ namespace SDL {
                        X1MASK, X2MASK
                }// Buttons
 
-               [CCode (type_id = "SDL_Cursor", free_function = "SDL_FreeCursor", cheader_filename = 
"SDL2/SDL_mouse.h")]
+               [CCode (cname = "SDL_Cursor", free_function = "SDL_FreeCursor", cheader_filename = 
"SDL2/SDL_mouse.h")]
                [Compact]
                public class Cursor {
                        [CCode (cname = "SDL_GetMouseFocus")]
@@ -3895,7 +3891,7 @@ namespace SDL {
 
 
 
-                       [CCode (cname = "SDL_Finger", type_id = "SDL_Finger", cheader_filename = 
"SDL2/SDL_touch.h")]
+                       [CCode (cname = "SDL_Finger", cheader_filename = "SDL2/SDL_touch.h")]
                        [Compact]
                        public class Finger {
                                public FingerID id;
@@ -4498,7 +4494,7 @@ namespace SDL {
        /// Threading
        ///
        [CCode (has_target = true)]
-       public delegate int ThreadFunc ();
+       public delegate int ThreadFunction ();
 
 
        [CCode (cname = "SDL_ThreadPriority", cprefix = "SDL_THREAD_PRIORITY_", cheader_filename = 
"SDL2/SDL_thread.h")]
@@ -4510,7 +4506,7 @@ namespace SDL {
        [Compact]
        public class Thread {
                [CCode (cname = "SDL_CreateThread", delegate_target_pos= 1.1)]
-               public Thread (ThreadFunc f, string name);
+               public Thread (ThreadFunction f, string name);
 
                [CCode (cname = "SDL_ThreadID")]
                public static ulong id ();
@@ -4541,7 +4537,7 @@ namespace SDL {
 
        }// Thread
 
-       [CCode (cname = "SDL_Mutex", free_function = "SDL_DestroyMutex")]
+       [CCode (cname = "SDL_mutex", free_function = "SDL_DestroyMutex")]
        [Compact]
        public class Mutex {
                [CCode (cname = "SDL_CreateMutex")]


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