summary refs log tree commit diff
path: root/main.c
diff options
context:
space:
mode:
authorStacy Harper <contact@stacyharper.net>2021-08-26 19:20:20 +0200
committerJohn Sullivan <jsullivan@csumb.edu>2021-10-19 23:12:01 -0700
commit4648092db1c169d9e62bb6a0c577ab99434652e7 (patch)
tree07db2c44384c4e725f9382d4b043a21c73f4f4dd /main.c
parent24a9bdc214127281915bbee4df2750adeb21f46a (diff)
downloadsuggpicker-4648092db1c169d9e62bb6a0c577ab99434652e7.tar.gz
Add landscape layers
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/main.c b/main.c
index fe29dcb..87f0bef 100644
--- a/main.c
+++ b/main.c
@@ -238,6 +238,21 @@ seat_handle_name(void *data, struct wl_seat *wl_seat, const char *name) {}
 static void
 display_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, int physical_width, int physical_height, int subpixel, const char *make, const char *model, int transform)
 {
+	if (transform % 2 == 0) {
+		keyboard.landscape = false;
+	} else {
+		keyboard.landscape = true;
+	}
+
+	enum layout_id layer;
+	if (keyboard.landscape) {
+		layer = keyboard.landscape_layers[0];
+	} else {
+		layer = keyboard.layers[0];
+	}
+
+	keyboard.layout = &keyboard.layouts[layer];
+	keyboard.prevlayout = keyboard.layout;
 }
 
 static void
@@ -379,6 +394,7 @@ main(int argc, char **argv) {
 
 	/* keyboard settings */
 	keyboard.layers = (enum layout_id *) &layers;
+	keyboard.landscape_layers = (enum layout_id *) &landscape_layers;
 	keyboard.scheme = scheme;
 	keyboard.layer_index = 0;
 	keyboard.scheme1 = scheme1;