فهرست منبع

wayland: Coding style cleanup

Fixes * positioning, indentation and newline inconsistencies.
Jonas Ådahl 11 سال پیش
والد
کامیت
4dd669661b
2فایلهای تغییر یافته به همراه39 افزوده شده و 29 حذف شده
  1. 14 7
      src/wl_init.c
  2. 25 22
      src/wl_window.c

+ 14 - 7
src/wl_init.c

@@ -573,18 +573,25 @@ int _glfwPlatformInit(void)
     _glfwInitTimer();
     _glfwInitTimer();
     _glfwInitJoysticks();
     _glfwInitJoysticks();
 
 
-    if (_glfw.wl.pointer && _glfw.wl.shm){
+    if (_glfw.wl.pointer && _glfw.wl.shm)
+    {
         _glfw.wl.cursorTheme = wl_cursor_theme_load(NULL, 32, _glfw.wl.shm);
         _glfw.wl.cursorTheme = wl_cursor_theme_load(NULL, 32, _glfw.wl.shm);
-        if (!_glfw.wl.cursorTheme) {
-            _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Unable to load default cursor theme\n");
+        if (!_glfw.wl.cursorTheme)
+        {
+            _glfwInputError(GLFW_PLATFORM_ERROR,
+                            "Wayland: Unable to load default cursor theme\n");
             return GL_FALSE;
             return GL_FALSE;
         }
         }
-        _glfw.wl.defaultCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, "left_ptr");
-        if (!_glfw.wl.defaultCursor) {
-            _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Unable to load default left pointer\n");
+        _glfw.wl.defaultCursor =
+            wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, "left_ptr");
+        if (!_glfw.wl.defaultCursor)
+        {
+            _glfwInputError(GLFW_PLATFORM_ERROR,
+                            "Wayland: Unable to load default left pointer\n");
             return GL_FALSE;
             return GL_FALSE;
         }
         }
-        _glfw.wl.cursorSurface = wl_compositor_create_surface(_glfw.wl.compositor);
+        _glfw.wl.cursorSurface =
+            wl_compositor_create_surface(_glfw.wl.compositor);
     }
     }
 
 
     return GL_TRUE;
     return GL_TRUE;

+ 25 - 22
src/wl_window.c

@@ -370,24 +370,26 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
                               const GLFWimage* image,
                               const GLFWimage* image,
                               int xhot, int yhot)
                               int xhot, int yhot)
 {
 {
-    struct wl_shm_pool *pool;
+    struct wl_shm_pool* pool;
     int stride = image->width * 4;
     int stride = image->width * 4;
     int length = image->width * image->height * 4;
     int length = image->width * image->height * 4;
-    void *data;
+    void* data;
     int fd, i;
     int fd, i;
 
 
     fd = createAnonymousFile(length);
     fd = createAnonymousFile(length);
-    if (fd < 0) {
+    if (fd < 0)
+    {
         _glfwInputError(GLFW_PLATFORM_ERROR,
         _glfwInputError(GLFW_PLATFORM_ERROR,
-                    "Wayland: Creating a buffer file for %d B failed: %m\n",
-                    length);
+                        "Wayland: Creating a buffer file for %d B failed: %m\n",
+                        length);
         return GL_FALSE;
         return GL_FALSE;
     }
     }
 
 
     data = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
     data = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-    if (data == MAP_FAILED) {
+    if (data == MAP_FAILED)
+    {
         _glfwInputError(GLFW_PLATFORM_ERROR,
         _glfwInputError(GLFW_PLATFORM_ERROR,
-                    "Wayland: Cursor mmap failed: %m\n");
+                        "Wayland: Cursor mmap failed: %m\n");
         close(fd);
         close(fd);
         return GL_FALSE;
         return GL_FALSE;
     }
     }
@@ -405,10 +407,11 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
         *target++ = source[3];
         *target++ = source[3];
     }
     }
 
 
-    cursor->wl.buffer = wl_shm_pool_create_buffer(pool, 0,
-                    image->width,
-                    image->height,
-                    stride, WL_SHM_FORMAT_ARGB8888);
+    cursor->wl.buffer =
+        wl_shm_pool_create_buffer(pool, 0,
+                                  image->width,
+                                  image->height,
+                                  stride, WL_SHM_FORMAT_ARGB8888);
     munmap(data, length);
     munmap(data, length);
     wl_shm_pool_destroy(pool);
     wl_shm_pool_destroy(pool);
 
 
@@ -426,9 +429,9 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
 
 
 void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
 void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
 {
 {
-    struct wl_buffer *buffer;
-    struct wl_cursor_image *image;
-    struct wl_surface *surface = _glfw.wl.cursorSurface;
+    struct wl_buffer* buffer;
+    struct wl_cursor_image* image;
+    struct wl_surface* surface = _glfw.wl.cursorSurface;
 
 
     if (!_glfw.wl.pointer)
     if (!_glfw.wl.pointer)
         return;
         return;
@@ -449,23 +452,23 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
             if (!buffer)
             if (!buffer)
                 return;
                 return;
             wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial,
             wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial,
-                        surface,
-                        image->hotspot_x,
-                        image->hotspot_y);
+                                  surface,
+                                  image->hotspot_x,
+                                  image->hotspot_y);
             wl_surface_attach(surface, buffer, 0, 0);
             wl_surface_attach(surface, buffer, 0, 0);
             wl_surface_damage(surface, 0, 0,
             wl_surface_damage(surface, 0, 0,
-                        image->width, image->height);
+                              image->width, image->height);
             wl_surface_commit(surface);
             wl_surface_commit(surface);
         }
         }
         else
         else
         {
         {
             wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial,
             wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial,
-                        surface,
-                        cursor->wl.xhot,
-                        cursor->wl.yhot);
+                                  surface,
+                                  cursor->wl.xhot,
+                                  cursor->wl.yhot);
             wl_surface_attach(surface, cursor->wl.buffer, 0, 0);
             wl_surface_attach(surface, cursor->wl.buffer, 0, 0);
             wl_surface_damage(surface, 0, 0,
             wl_surface_damage(surface, 0, 0,
-                        cursor->wl.width, cursor->wl.height);
+                              cursor->wl.width, cursor->wl.height);
             wl_surface_commit(surface);
             wl_surface_commit(surface);
         }
         }
     }
     }