commit 3d65344

Michael Forney  ·  2013-11-23 01:33:08 +0000 UTC
parent faad1a2
window: Use swc_rectangle for geometry
4 files changed,  +21, -12
+5, -4
 1@@ -153,14 +153,15 @@ static const struct wl_shell_surface_interface shell_surface_implementation = {
 2     .set_class = &set_class
 3 };
 4 
 5-static void configure(struct swc_window * window, int32_t x, int32_t y,
 6-                      uint32_t width, uint32_t height)
 7+static void configure(struct swc_window * window,
 8+                      const struct swc_rectangle * geometry)
 9 {
10     struct swc_shell_surface * shell_surface
11         = CONTAINER_OF(window, typeof(*shell_surface), window);
12 
13-    wl_shell_surface_send_configure
14-        (shell_surface->resource, WL_SHELL_SURFACE_RESIZE_NONE, width, height);
15+    wl_shell_surface_send_configure(shell_surface->resource,
16+                                    WL_SHELL_SURFACE_RESIZE_NONE,
17+                                    geometry->width, geometry->height);
18 }
19 
20 static const struct swc_window_impl shell_window_impl = {
+10, -2
 1@@ -28,6 +28,14 @@
 2 #include <stdint.h>
 3 #include <wayland-server.h>
 4 
 5+/* Rectangles {{{ */
 6+struct swc_rectangle
 7+{
 8+    int32_t x, y;
 9+    uint32_t width, height;
10+};
11+/* }}} */
12+
13 /* Windows {{{ */
14 enum
15 {
16@@ -56,8 +64,8 @@ struct swc_window
17 void swc_window_show(struct swc_window * window);
18 void swc_window_hide(struct swc_window * window);
19 void swc_window_focus(struct swc_window * window);
20-void swc_window_set_geometry(struct swc_window * window, int32_t x, int32_t y,
21-                             uint32_t width, uint32_t height);
22+void swc_window_set_geometry(struct swc_window * window,
23+                             const struct swc_rectangle * geometry);
24 void swc_window_set_border(struct swc_window * window,
25                            uint32_t color, uint32_t width);
26 /* }}} */
+4, -4
 1@@ -70,13 +70,13 @@ void swc_window_focus(struct swc_window * window)
 2                            INTERNAL(window)->surface);
 3 }
 4 
 5-void swc_window_set_geometry(struct swc_window * window, int32_t x, int32_t y,
 6-                             uint32_t width, uint32_t height)
 7+void swc_window_set_geometry(struct swc_window * window,
 8+                             const struct swc_rectangle * geometry)
 9 {
10     if (INTERNAL(window)->impl->configure)
11-        INTERNAL(window)->impl->configure(window, x, y, width, height);
12+        INTERNAL(window)->impl->configure(window, geometry);
13 
14-    swc_surface_move(INTERNAL(window)->surface, x, y);
15+    swc_surface_move(INTERNAL(window)->surface, geometry->x, geometry->y);
16 }
17 
18 void swc_window_set_border(struct swc_window * window,
+2, -2
 1@@ -31,8 +31,8 @@ struct swc_window;
 2 
 3 struct swc_window_impl
 4 {
 5-    void (* configure)(struct swc_window * window, int32_t x, int32_t y,
 6-                       uint32_t width, uint32_t height);
 7+    void (* configure)(struct swc_window * window,
 8+                       const struct swc_rectangle * geometry);
 9     void (* focus)(struct swc_window * window);
10 };
11