]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Add action.c
authorJohan Malm <jgm323@gmail.com>
Thu, 18 Jun 2020 19:18:01 +0000 (20:18 +0100)
committerJohan Malm <jgm323@gmail.com>
Thu, 18 Jun 2020 19:18:01 +0000 (20:18 +0100)
include/labwc.h
src/action.c [new file with mode: 0644]
src/config/keybind.c
src/keyboard.c
src/main.c
src/meson.build
src/output.c
src/server.c
src/view.c
src/xdg.c

index fcd9936c54b814a738a5367b157f4db7b97bdfc4..8011cdd9a41ca1cc479ae293c400b70f8dcc757d 100644 (file)
@@ -29,6 +29,8 @@
 #include <wlr/xwayland.h>
 #include <xkbcommon/xkbcommon.h>
 
+#include "rcxml.h"
+
 #define XCURSOR_DEFAULT "left_ptr"
 #define XCURSOR_SIZE 24
 #define XCURSOR_MOVE "grabbing"
@@ -176,6 +178,8 @@ struct wlr_box deco_max_extents(struct view *view);
 struct wlr_box deco_box(struct view *view, enum deco_part deco_part);
 enum deco_part deco_at(struct view *view, double lx, double ly);
 
+void action(struct server *server, struct keybind *keybind);
+
 void dbg_show_one_view(struct view *view);
 void dbg_show_views(struct server *server);
 
diff --git a/src/action.c b/src/action.c
new file mode 100644 (file)
index 0000000..4087f34
--- /dev/null
@@ -0,0 +1,22 @@
+#include "labwc.h"
+
+#include <strings.h>
+
+void action(struct server *server, struct keybind *keybind)
+{
+       if (!keybind || !keybind->action)
+               return;
+       if (!strcasecmp(keybind->action, "Exit")) {
+               wl_display_terminate(server->wl_display);
+       } else if (!strcasecmp(keybind->action, "NextWindow")) {
+               server->cycle_view = next_toplevel(view_front_toplevel(server));
+       } else if (!strcasecmp(keybind->action, "Execute")) {
+               if (!fork())
+                       execl("/bin/dmenu_run", "/bin/dmenu_run", (void *)NULL);
+       } else if (!strcasecmp(keybind->action, "debug-views")) {
+               dbg_show_views(server);
+       } else {
+               fprintf(stderr, "warn: action (%s) not supported\n",
+                       keybind->action);
+       }
+}
index 3acf27f3ad7071daecfa118004a54fb3bf41a708..e6764daec58ec639df76d0c8a4f9ea363aa084de 100644 (file)
@@ -56,9 +56,9 @@ void keybind_add(struct wl_list *keybinds, const char *keybind,
 
 void keybind_init()
 {
-       keybind_add(&rc.keybinds, "A-Escape", "exit");
-       keybind_add(&rc.keybinds, "A-Tab", "cycle");
-       keybind_add(&rc.keybinds, "A-F3", "exec");
+       keybind_add(&rc.keybinds, "A-Escape", "Exit");
+       keybind_add(&rc.keybinds, "A-Tab", "NextWindow");
+       keybind_add(&rc.keybinds, "A-F3", "Execute");
 }
 
 void keybind_print()
index fcaf06eab912da040579fdfe34fefc6c383e0509..94a2d1ea7782794d1c4832eef942e4316b134101 100644 (file)
@@ -1,5 +1,4 @@
 #include "labwc.h"
-#include "rcxml.h"
 
 static void keyboard_handle_modifiers(struct wl_listener *listener, void *data)
 {
@@ -21,25 +20,6 @@ static void keyboard_handle_modifiers(struct wl_listener *listener, void *data)
                keyboard->server->seat, &keyboard->device->keyboard->modifiers);
 }
 
-static void action(struct server *server, struct keybind *keybind)
-{
-       if (!keybind || !keybind->action)
-               return;
-       if (!strcmp(keybind->action, "exit")) {
-               wl_display_terminate(server->wl_display);
-       } else if (!strcmp(keybind->action, "cycle")) {
-               server->cycle_view = next_toplevel(view_front_toplevel(server));
-       } else if (!strcmp(keybind->action, "exec")) {
-               if (!fork())
-                       execl("/bin/dmenu_run", "/bin/dmenu_run", (void *)NULL);
-       } else if (!strcmp(keybind->action, "debug-views")) {
-               dbg_show_views(server);
-       } else {
-               fprintf(stderr, "warn: action (%s) not supported\n",
-                       keybind->action);
-       }
-}
-
 static bool handle_keybinding(struct server *server, uint32_t modifiers,
                              xkb_keysym_t sym)
 {
index de84e6b5b9da5ec8e572865a036769782499e0a0..3541ab9d83c31953383da7dfefde3ef0352766b4 100644 (file)
@@ -1,5 +1,4 @@
 #include "labwc.h"
-#include "rcxml.h"
 #include "theme.h"
 
 struct server server = { 0 };
index 5895d465e42fe376fe299deece1a8f9e27a0958f..0678cd9f1b7fd7500f75b70562d208692cc62be2 100644 (file)
@@ -1,4 +1,5 @@
 labwc_sources = files(
+  'action.c',
   'cursor.c',
   'deco.c',
   'interactive.c',
index 521497b4e9c93e7a158902bfd3035e31a883f4ca..dd62bc4ea43238bfddeb432fa78a243349f81dc6 100644 (file)
@@ -1,5 +1,4 @@
 #include "labwc.h"
-#include "rcxml.h"
 #include "theme.h"
 
 struct draw_data {
index e496a5340764736e84edcc475a8d4dbafda6f2e5..2af99ada54d52093decc287bc8365dc3dada74e7 100644 (file)
@@ -1,5 +1,4 @@
 #include "labwc.h"
-#include "rcxml.h"
 
 #include <wlr/types/wlr_export_dmabuf_v1.h>
 #include <wlr/types/wlr_screencopy_v1.h>
index 44a80cc778de34d0396fb8099885063598e1f118..e99df0b0298035c014b3733a5264770df194b9a8 100644 (file)
@@ -1,5 +1,4 @@
 #include "labwc.h"
-#include "rcxml.h"
 
 static bool is_toplevel(struct view *view)
 {
index e8ea18a6927ba488d5209c873906e21c0232aae0..b208f30944f7ee972a517510a15b9d509fdcd6e4 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -1,5 +1,4 @@
 #include "labwc.h"
-#include "rcxml.h"
 
 struct xdg_deco {
        struct wlr_xdg_toplevel_decoration_v1 *wlr_decoration;