]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Move begin_interactive() to server.c
authorJohan Malm <jgm323@gmail.com>
Fri, 22 May 2020 20:13:43 +0000 (21:13 +0100)
committerJohan Malm <jgm323@gmail.com>
Fri, 22 May 2020 20:13:43 +0000 (21:13 +0100)
README.md
labwc.h
server.c
view.c

index c760f5142409ab462acaa38bad11137ce6d39ae6..820bb7b06ff8fd43ec44e410e20128d3c644a825 100644 (file)
--- a/README.md
+++ b/README.md
@@ -12,10 +12,10 @@ This software is in early development.
 
 ## Aim
 
-[x] Support xwayland  
-[ ] Support some of openbox's rc.xml  
-[ ] Support openbox themes  
-[ ] Support layer-shell's background layer  
+- [x] Support xwayland
+- [ ] Support some of openbox's rc.xml
+- [ ] Support openbox themes
+- [ ] Support layer-shell's background layer
 
 ## Influenced by
 
@@ -67,51 +67,54 @@ example `gb`. Read `xkeyboard-config(7)` for details.
 
 ### Debian
 
-    sudo apt install \
-       build-essential \
-       cmake \
-       libwayland-dev \
-       wayland-protocols \
-       libegl1-mesa-dev \
-       libgles2-mesa-dev \
-       libdrm-dev libgbm-dev \
-       libinput-dev \
-       libxkbcommon-dev \
-       libudev-dev \
-       libpixman-1-dev \
-       libsystemd-dev \
-       libcap-dev \
-       libxcb1-dev \
-       libxcb-composite0-dev \
-       libxcb-xfixes0-dev \
-       libxcb-xinput-dev \
-       libxcb-image0-dev \
-       libxcb-render-util0-dev \
-       libx11-xcb-dev \
-       libxcb-icccm4-dev \
-       freerdp2-dev \
-       libwinpr2-dev \
-       libpng-dev \
-       libavutil-dev \
-       libavcodec-dev \
-       libavformat-dev \
-       universal-ctags \
-       xwayland
-    
-    # Debian Buster has an old version of meson, so we use pip3
-    pip3 install --target=$HOME/bin meson
-    
-    git clone https://github.com/johanmalm/labwc
-    cd labwc
-    git clone https://github.com/swaywm/wlroots subprojects/wlroots
-    
-    # wlroots 0.10.0 is the last version which runs with Wayland 0.16
-    # (which is what Buster runs)
-    cd subprojects/wlroots && git checkout 0.10.0 && cd ../..
-    
-    meson build
-    ninja -C build
+```
+sudo apt install \
+       build-essential \
+       cmake \
+       libwayland-dev \
+       wayland-protocols \
+       libegl1-mesa-dev \
+       libgles2-mesa-dev \
+       libdrm-dev libgbm-dev \
+       libinput-dev \
+       libxkbcommon-dev \
+       libudev-dev \
+       libpixman-1-dev \
+       libsystemd-dev \
+       libcap-dev \
+       libxcb1-dev \
+       libxcb-composite0-dev \
+       libxcb-xfixes0-dev \
+       libxcb-xinput-dev \
+       libxcb-image0-dev \
+       libxcb-render-util0-dev \
+       libx11-xcb-dev \
+       libxcb-icccm4-dev \
+       freerdp2-dev \
+       libwinpr2-dev \
+       libpng-dev \
+       libavutil-dev \
+       libavcodec-dev \
+       libavformat-dev \
+       universal-ctags \
+       xwayland
+
+# Debian Buster has an old version of meson, so we use pip3
+pip3 install --target=$HOME/bin meson
+
+git clone https://github.com/johanmalm/labwc
+cd labwc
+git clone https://github.com/swaywm/wlroots subprojects/wlroots
+
+# wlroots 0.10.0 is the last version which runs with Wayland 0.16
+# (which is what Buster runs)
+cd subprojects/wlroots && git checkout 0.10.0 && cd ../..
+
+meson build
+ninja -C build
+```
 
 ## Debug
 
 To enable ASAN and UBSAN, run meson with `-Db_sanitize=address,undefined`
+
diff --git a/labwc.h b/labwc.h
index 05d5755cd714ec1cd98e8bfdf9d2d406b8eaccbb..46be920a78357eed28c42bedaf6c770bc2218162 100644 (file)
--- a/labwc.h
+++ b/labwc.h
@@ -142,14 +142,14 @@ void xwl_surface_new(struct wl_listener *listener, void *data);
 
 bool view_want_deco(struct view *view);
 void view_focus(struct view *view);
-void begin_interactive(struct view *view, enum cursor_mode mode,
-                      uint32_t edges);
 struct view *view_front_toplevel(struct server *server);
 struct view *next_toplevel(struct view *current);
 struct view *view_at(struct server *server, double lx, double ly,
                     struct wlr_surface **surface, double *sx, double *sy,
                     int *view_area);
 
+void begin_interactive(struct view *view, enum cursor_mode mode,
+                      uint32_t edges);
 void server_new_input(struct wl_listener *listener, void *data);
 void seat_request_cursor(struct wl_listener *listener, void *data);
 void seat_request_set_selection(struct wl_listener *listener, void *data);
index c5eef4727613d4a849a5f8bfc6ba3e2254c8cdbe..6368e94bdba53a0d7ff28effe1bd0178df7af7cf 100644 (file)
--- a/server.c
+++ b/server.c
@@ -3,6 +3,49 @@
 static bool in_alt_tab_mode;
 static struct view *alt_tab_view;
 
+void begin_interactive(struct view *view, enum cursor_mode mode,
+                      uint32_t edges)
+{
+       /* This function sets up an interactive move or resize operation, where
+        * the compositor stops propegating pointer events to clients and
+        * instead consumes them itself, to move or resize windows. */
+       struct server *server = view->server;
+       server->grabbed_view = view;
+       server->cursor_mode = mode;
+
+       if (mode == TINYWL_CURSOR_MOVE) {
+               server->grab_x = server->cursor->x - view->x;
+               server->grab_y = server->cursor->y - view->y;
+       } else {
+               struct wlr_box geo_box;
+               switch (view->type) {
+               case LAB_XDG_SHELL_VIEW:
+                       wlr_xdg_surface_get_geometry(view->xdg_surface,
+                                                    &geo_box);
+                       break;
+               case LAB_XWAYLAND_VIEW:
+                       geo_box.x = view->xwayland_surface->x;
+                       geo_box.y = view->xwayland_surface->y;
+                       geo_box.width = view->xwayland_surface->width;
+                       geo_box.height = view->xwayland_surface->height;
+                       break;
+               }
+
+               double border_x =
+                       (view->x + geo_box.x) +
+                       ((edges & WLR_EDGE_RIGHT) ? geo_box.width : 0);
+               double border_y =
+                       (view->y + geo_box.y) +
+                       ((edges & WLR_EDGE_BOTTOM) ? geo_box.height : 0);
+               server->grab_x = server->cursor->x - border_x;
+               server->grab_y = server->cursor->y - border_y;
+               server->grab_box = geo_box;
+               server->grab_box.x += view->x;
+               server->grab_box.y += view->y;
+               server->resize_edges = edges;
+       }
+}
+
 static void keyboard_handle_modifiers(struct wl_listener *listener, void *data)
 {
        /* This event is raised when a modifier key, such as shift or alt, is
diff --git a/view.c b/view.c
index 966b8690e5476f6f1d7ae15d7f1f3942701a5c15..8d8912a57d7055cd2a096e0117585f0e797a16a6 100644 (file)
--- a/view.c
+++ b/view.c
@@ -85,48 +85,6 @@ void view_focus(struct view *view)
                                       &keyboard->modifiers);
 }
 
-void begin_interactive(struct view *view, enum cursor_mode mode, uint32_t edges)
-{
-       /* This function sets up an interactive move or resize operation, where
-        * the compositor stops propegating pointer events to clients and
-        * instead consumes them itself, to move or resize windows. */
-       struct server *server = view->server;
-       server->grabbed_view = view;
-       server->cursor_mode = mode;
-
-       if (mode == TINYWL_CURSOR_MOVE) {
-               server->grab_x = server->cursor->x - view->x;
-               server->grab_y = server->cursor->y - view->y;
-       } else {
-               struct wlr_box geo_box;
-               switch (view->type) {
-               case LAB_XDG_SHELL_VIEW:
-                       wlr_xdg_surface_get_geometry(view->xdg_surface,
-                                                    &geo_box);
-                       break;
-               case LAB_XWAYLAND_VIEW:
-                       geo_box.x = view->xwayland_surface->x;
-                       geo_box.y = view->xwayland_surface->y;
-                       geo_box.width = view->xwayland_surface->width;
-                       geo_box.height = view->xwayland_surface->height;
-                       break;
-               }
-
-               double border_x =
-                       (view->x + geo_box.x) +
-                       ((edges & WLR_EDGE_RIGHT) ? geo_box.width : 0);
-               double border_y =
-                       (view->y + geo_box.y) +
-                       ((edges & WLR_EDGE_BOTTOM) ? geo_box.height : 0);
-               server->grab_x = server->cursor->x - border_x;
-               server->grab_y = server->cursor->y - border_y;
-               server->grab_box = geo_box;
-               server->grab_box.x += view->x;
-               server->grab_box.y += view->y;
-               server->resize_edges = edges;
-       }
-}
-
 struct view *view_front_toplevel(struct server *server)
 {
        struct view *view;