aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-11-18 11:22:02 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2017-11-18 11:22:02 -0500
commit733993a651c71f7e2198d505960d6bbd31e0e107 (patch)
treee51732c5872b624e73355f9e5b3f762101f3cd0d
parentInitial (awful) pass on xdg shell support (diff)
downloadsway-733993a651c71f7e2198d505960d6bbd31e0e107.tar.gz
sway-733993a651c71f7e2198d505960d6bbd31e0e107.tar.zst
sway-733993a651c71f7e2198d505960d6bbd31e0e107.zip
Move everything to sway/old/
-rw-r--r--CMakeLists.txt12
-rw-r--r--common/log.c2
-rw-r--r--include/sway.h6
-rw-r--r--include/sway/handlers.h11
-rw-r--r--include/sway/old/border.h (renamed from include/sway/border.h)0
-rw-r--r--include/sway/old/commands.h (renamed from include/sway/commands.h)0
-rw-r--r--include/sway/old/config.h (renamed from include/sway/config.h)0
-rw-r--r--include/sway/old/container.h (renamed from include/sway/container.h)0
-rw-r--r--include/sway/old/criteria.h (renamed from include/sway/criteria.h)0
-rw-r--r--include/sway/old/focus.h (renamed from include/sway/focus.h)0
-rw-r--r--include/sway/old/input.h (renamed from include/sway/input.h)0
-rw-r--r--include/sway/old/input_state.h (renamed from include/sway/input_state.h)0
-rw-r--r--include/sway/old/ipc-json.h (renamed from include/sway/ipc-json.h)0
-rw-r--r--include/sway/old/ipc-server.h (renamed from include/sway/ipc-server.h)8
-rw-r--r--include/sway/old/layout.h (renamed from include/sway/layout.h)0
-rw-r--r--include/sway/old/output.h36
-rw-r--r--include/sway/old/workspace.h (renamed from include/sway/workspace.h)0
-rw-r--r--include/sway/output.h22
-rw-r--r--sway/CMakeLists.txt27
-rw-r--r--sway/debug_log.c103
-rw-r--r--sway/desktop/output.c19
-rw-r--r--sway/desktop/xdg_shell_v6.c61
-rw-r--r--sway/main.c48
-rw-r--r--sway/old/border.c (renamed from sway/border.c)0
-rw-r--r--sway/old/commands.c (renamed from sway/commands.c)0
-rw-r--r--sway/old/commands/assign.c (renamed from sway/commands/assign.c)0
-rw-r--r--sway/old/commands/bar.c (renamed from sway/commands/bar.c)0
-rw-r--r--sway/old/commands/bar/activate_button.c (renamed from sway/commands/bar/activate_button.c)0
-rw-r--r--sway/old/commands/bar/binding_mode_indicator.c (renamed from sway/commands/bar/binding_mode_indicator.c)0
-rw-r--r--sway/old/commands/bar/bindsym.c (renamed from sway/commands/bar/bindsym.c)0
-rw-r--r--sway/old/commands/bar/colors.c (renamed from sway/commands/bar/colors.c)0
-rw-r--r--sway/old/commands/bar/context_button.c (renamed from sway/commands/bar/context_button.c)0
-rw-r--r--sway/old/commands/bar/font.c (renamed from sway/commands/bar/font.c)0
-rw-r--r--sway/old/commands/bar/height.c (renamed from sway/commands/bar/height.c)0
-rw-r--r--sway/old/commands/bar/hidden_state.c (renamed from sway/commands/bar/hidden_state.c)0
-rw-r--r--sway/old/commands/bar/icon_theme.c (renamed from sway/commands/bar/icon_theme.c)0
-rw-r--r--sway/old/commands/bar/id.c (renamed from sway/commands/bar/id.c)0
-rw-r--r--sway/old/commands/bar/mode.c (renamed from sway/commands/bar/mode.c)0
-rw-r--r--sway/old/commands/bar/modifier.c (renamed from sway/commands/bar/modifier.c)0
-rw-r--r--sway/old/commands/bar/output.c (renamed from sway/commands/bar/output.c)0
-rw-r--r--sway/old/commands/bar/pango_markup.c (renamed from sway/commands/bar/pango_markup.c)0
-rw-r--r--sway/old/commands/bar/position.c (renamed from sway/commands/bar/position.c)0
-rw-r--r--sway/old/commands/bar/secondary_button.c (renamed from sway/commands/bar/secondary_button.c)0
-rw-r--r--sway/old/commands/bar/separator_symbol.c (renamed from sway/commands/bar/separator_symbol.c)0
-rw-r--r--sway/old/commands/bar/status_command.c (renamed from sway/commands/bar/status_command.c)0
-rw-r--r--sway/old/commands/bar/strip_workspace_numbers.c (renamed from sway/commands/bar/strip_workspace_numbers.c)0
-rw-r--r--sway/old/commands/bar/swaybar_command.c (renamed from sway/commands/bar/swaybar_command.c)0
-rw-r--r--sway/old/commands/bar/tray_output.c (renamed from sway/commands/bar/tray_output.c)0
-rw-r--r--sway/old/commands/bar/tray_padding.c (renamed from sway/commands/bar/tray_padding.c)0
-rw-r--r--sway/old/commands/bar/workspace_buttons.c (renamed from sway/commands/bar/workspace_buttons.c)0
-rw-r--r--sway/old/commands/bar/wrap_scroll.c (renamed from sway/commands/bar/wrap_scroll.c)0
-rw-r--r--sway/old/commands/bind.c (renamed from sway/commands/bind.c)0
-rw-r--r--sway/old/commands/border.c (renamed from sway/commands/border.c)0
-rw-r--r--sway/old/commands/client.c (renamed from sway/commands/client.c)0
-rw-r--r--sway/old/commands/clipboard.c (renamed from sway/commands/clipboard.c)0
-rw-r--r--sway/old/commands/commands.c (renamed from sway/commands/commands.c)0
-rw-r--r--sway/old/commands/debuglog.c (renamed from sway/commands/debuglog.c)0
-rw-r--r--sway/old/commands/default_border.c (renamed from sway/commands/default_border.c)0
-rw-r--r--sway/old/commands/default_floating_border.c (renamed from sway/commands/default_floating_border.c)0
-rw-r--r--sway/old/commands/exec.c (renamed from sway/commands/exec.c)0
-rw-r--r--sway/old/commands/exec_always.c (renamed from sway/commands/exec_always.c)0
-rw-r--r--sway/old/commands/exit.c (renamed from sway/commands/exit.c)0
-rw-r--r--sway/old/commands/floating.c (renamed from sway/commands/floating.c)0
-rw-r--r--sway/old/commands/floating_maximum_size.c (renamed from sway/commands/floating_maximum_size.c)0
-rw-r--r--sway/old/commands/floating_minimum_size.c (renamed from sway/commands/floating_minimum_size.c)0
-rw-r--r--sway/old/commands/floating_mod.c (renamed from sway/commands/floating_mod.c)0
-rw-r--r--sway/old/commands/floating_scroll.c (renamed from sway/commands/floating_scroll.c)0
-rw-r--r--sway/old/commands/focus.c (renamed from sway/commands/focus.c)0
-rw-r--r--sway/old/commands/focus_follows_mouse.c (renamed from sway/commands/focus_follows_mouse.c)0
-rw-r--r--sway/old/commands/font.c (renamed from sway/commands/font.c)0
-rw-r--r--sway/old/commands/for_window.c (renamed from sway/commands/for_window.c)0
-rw-r--r--sway/old/commands/force_focus_wrapping.c (renamed from sway/commands/force_focus_wrapping.c)0
-rw-r--r--sway/old/commands/fullscreen.c (renamed from sway/commands/fullscreen.c)0
-rw-r--r--sway/old/commands/gaps.c (renamed from sway/commands/gaps.c)0
-rw-r--r--sway/old/commands/hide_edge_borders.c (renamed from sway/commands/hide_edge_borders.c)0
-rw-r--r--sway/old/commands/include.c (renamed from sway/commands/include.c)0
-rw-r--r--sway/old/commands/input.c (renamed from sway/commands/input.c)0
-rw-r--r--sway/old/commands/input/accel_profile.c (renamed from sway/commands/input/accel_profile.c)0
-rw-r--r--sway/old/commands/input/click_method.c (renamed from sway/commands/input/click_method.c)0
-rw-r--r--sway/old/commands/input/drag_lock.c (renamed from sway/commands/input/drag_lock.c)0
-rw-r--r--sway/old/commands/input/dwt.c (renamed from sway/commands/input/dwt.c)0
-rw-r--r--sway/old/commands/input/events.c (renamed from sway/commands/input/events.c)0
-rw-r--r--sway/old/commands/input/left_handed.c (renamed from sway/commands/input/left_handed.c)0
-rw-r--r--sway/old/commands/input/middle_emulation.c (renamed from sway/commands/input/middle_emulation.c)0
-rw-r--r--sway/old/commands/input/natural_scroll.c (renamed from sway/commands/input/natural_scroll.c)0
-rw-r--r--sway/old/commands/input/pointer_accel.c (renamed from sway/commands/input/pointer_accel.c)0
-rw-r--r--sway/old/commands/input/scroll_method.c (renamed from sway/commands/input/scroll_method.c)0
-rw-r--r--sway/old/commands/input/tap.c (renamed from sway/commands/input/tap.c)0
-rw-r--r--sway/old/commands/ipc.c (renamed from sway/commands/ipc.c)0
-rw-r--r--sway/old/commands/kill.c (renamed from sway/commands/kill.c)0
-rw-r--r--sway/old/commands/layout.c (renamed from sway/commands/layout.c)0
-rw-r--r--sway/old/commands/log_colors.c (renamed from sway/commands/log_colors.c)0
-rw-r--r--sway/old/commands/mark.c (renamed from sway/commands/mark.c)0
-rw-r--r--sway/old/commands/mode.c (renamed from sway/commands/mode.c)0
-rw-r--r--sway/old/commands/mouse_warping.c (renamed from sway/commands/mouse_warping.c)0
-rw-r--r--sway/old/commands/move.c (renamed from sway/commands/move.c)0
-rw-r--r--sway/old/commands/new_float.c (renamed from sway/commands/new_float.c)0
-rw-r--r--sway/old/commands/new_window.c (renamed from sway/commands/new_window.c)0
-rw-r--r--sway/old/commands/no_focus.c (renamed from sway/commands/no_focus.c)0
-rw-r--r--sway/old/commands/orientation.c (renamed from sway/commands/orientation.c)0
-rw-r--r--sway/old/commands/output.c (renamed from sway/commands/output.c)0
-rw-r--r--sway/old/commands/permit.c (renamed from sway/commands/permit.c)0
-rw-r--r--sway/old/commands/reload.c (renamed from sway/commands/reload.c)0
-rw-r--r--sway/old/commands/resize.c (renamed from sway/commands/resize.c)0
-rw-r--r--sway/old/commands/scratchpad.c (renamed from sway/commands/scratchpad.c)0
-rw-r--r--sway/old/commands/seamless_mouse.c (renamed from sway/commands/seamless_mouse.c)0
-rw-r--r--sway/old/commands/set.c (renamed from sway/commands/set.c)0
-rw-r--r--sway/old/commands/show_marks.c (renamed from sway/commands/show_marks.c)0
-rw-r--r--sway/old/commands/smart_gaps.c (renamed from sway/commands/smart_gaps.c)0
-rw-r--r--sway/old/commands/split.c (renamed from sway/commands/split.c)0
-rw-r--r--sway/old/commands/sticky.c (renamed from sway/commands/sticky.c)0
-rw-r--r--sway/old/commands/unmark.c (renamed from sway/commands/unmark.c)0
-rw-r--r--sway/old/commands/workspace.c (renamed from sway/commands/workspace.c)0
-rw-r--r--sway/old/commands/workspace_auto_back_and_forth.c (renamed from sway/commands/workspace_auto_back_and_forth.c)0
-rw-r--r--sway/old/commands/workspace_layout.c (renamed from sway/commands/workspace_layout.c)0
-rw-r--r--sway/old/config.c (renamed from sway/config.c)138
-rw-r--r--sway/old/container.c (renamed from sway/tree/container.c)0
-rw-r--r--sway/old/criteria.c (renamed from sway/tree/criteria.c)0
-rw-r--r--sway/old/focus.c (renamed from sway/tree/focus.c)0
-rw-r--r--sway/old/handlers.c (renamed from sway/handlers.c)0
-rw-r--r--sway/old/input_state.c (renamed from sway/input_state.c)0
-rw-r--r--sway/old/ipc-json.c (renamed from sway/ipc-json.c)0
-rw-r--r--sway/old/ipc-server.c (renamed from sway/ipc-server.c)5
-rw-r--r--sway/old/layout.c (renamed from sway/tree/layout.c)0
-rw-r--r--sway/old/output.c (renamed from sway/tree/output.c)0
-rw-r--r--sway/old/security.c (renamed from sway/security.c)0
-rw-r--r--sway/old/workspace.c (renamed from sway/tree/workspace.c)0
-rw-r--r--sway/server.c2
128 files changed, 73 insertions, 427 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 34098eb3..b53670b6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -116,7 +116,8 @@ add_subdirectory(wayland)
116add_subdirectory(sway) 116add_subdirectory(sway)
117if(enable-swaybg) 117if(enable-swaybg)
118 if(CAIRO_FOUND AND PANGO_FOUND) 118 if(CAIRO_FOUND AND PANGO_FOUND)
119 add_subdirectory(swaybg) 119 # TODO WLR
120 #add_subdirectory(swaybg)
120 else() 121 else()
121 message(WARNING "Not building swaybg - cairo, and pango are required.") 122 message(WARNING "Not building swaybg - cairo, and pango are required.")
122 endif() 123 endif()
@@ -125,18 +126,21 @@ if(enable-swaymsg)
125 add_subdirectory(swaymsg) 126 add_subdirectory(swaymsg)
126endif() 127endif()
127if(enable-swaygrab) 128if(enable-swaygrab)
128 add_subdirectory(swaygrab) 129 # TODO WLR
130 #add_subdirectory(swaygrab)
129endif() 131endif()
130if(enable-swaybar) 132if(enable-swaybar)
131 if(CAIRO_FOUND AND PANGO_FOUND) 133 if(CAIRO_FOUND AND PANGO_FOUND)
132 add_subdirectory(swaybar) 134 # TODO WLR
135 #add_subdirectory(swaybar)
133 else() 136 else()
134 message(WARNING "Not building swaybar - cairo, and pango are required.") 137 message(WARNING "Not building swaybar - cairo, and pango are required.")
135 endif() 138 endif()
136endif() 139endif()
137if(enable-swaylock) 140if(enable-swaylock)
138 if(CAIRO_FOUND AND PANGO_FOUND AND PAM_FOUND) 141 if(CAIRO_FOUND AND PANGO_FOUND AND PAM_FOUND)
139 add_subdirectory(swaylock) 142 # TODO WLR
143 #add_subdirectory(swaylock)
140 else() 144 else()
141 message(WARNING "Not building swaylock - cairo, pango, and PAM are required.") 145 message(WARNING "Not building swaylock - cairo, pango, and PAM are required.")
142 endif() 146 endif()
diff --git a/common/log.c b/common/log.c
index 6dc9d743..c47b4eea 100644
--- a/common/log.c
+++ b/common/log.c
@@ -9,7 +9,6 @@
9#include <string.h> 9#include <string.h>
10#include <time.h> 10#include <time.h>
11#include "log.h" 11#include "log.h"
12#include "sway.h"
13#include "readline.h" 12#include "readline.h"
14 13
15static int colored = 1; 14static int colored = 1;
@@ -117,6 +116,7 @@ void _sway_log(const char *filename, int line, log_importance_t verbosity, const
117 va_end(args); 116 va_end(args);
118} 117}
119 118
119void sway_terminate(int code);
120 120
121void _sway_abort(const char *filename, int line, const char* format, ...) { 121void _sway_abort(const char *filename, int line, const char* format, ...) {
122 va_list args; 122 va_list args;
diff --git a/include/sway.h b/include/sway.h
deleted file mode 100644
index b5cfb668..00000000
--- a/include/sway.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _SWAY_SWAY_H
2#define _SWAY_SWAY_H
3
4void sway_terminate(int exit_code);
5
6#endif
diff --git a/include/sway/handlers.h b/include/sway/handlers.h
deleted file mode 100644
index 956b98f4..00000000
--- a/include/sway/handlers.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _SWAY_HANDLERS_H
2#define _SWAY_HANDLERS_H
3#include "container.h"
4#include <stdbool.h>
5#include <wlc/wlc.h>
6
7void register_wlc_handlers();
8
9extern uint32_t keys_pressed[32];
10
11#endif
diff --git a/include/sway/border.h b/include/sway/old/border.h
index c30c9da3..c30c9da3 100644
--- a/include/sway/border.h
+++ b/include/sway/old/border.h
diff --git a/include/sway/commands.h b/include/sway/old/commands.h
index 660da2c2..660da2c2 100644
--- a/include/sway/commands.h
+++ b/include/sway/old/commands.h
diff --git a/include/sway/config.h b/include/sway/old/config.h
index a05d5ede..a05d5ede 100644
--- a/include/sway/config.h
+++ b/include/sway/old/config.h
diff --git a/include/sway/container.h b/include/sway/old/container.h
index d46ffa63..d46ffa63 100644
--- a/include/sway/container.h
+++ b/include/sway/old/container.h
diff --git a/include/sway/criteria.h b/include/sway/old/criteria.h
index c5ed9857..c5ed9857 100644
--- a/include/sway/criteria.h
+++ b/include/sway/old/criteria.h
diff --git a/include/sway/focus.h b/include/sway/old/focus.h
index 652cdccc..652cdccc 100644
--- a/include/sway/focus.h
+++ b/include/sway/old/focus.h
diff --git a/include/sway/input.h b/include/sway/old/input.h
index eb92e470..eb92e470 100644
--- a/include/sway/input.h
+++ b/include/sway/old/input.h
diff --git a/include/sway/input_state.h b/include/sway/old/input_state.h
index fd5a3a25..fd5a3a25 100644
--- a/include/sway/input_state.h
+++ b/include/sway/old/input_state.h
diff --git a/include/sway/ipc-json.h b/include/sway/old/ipc-json.h
index 3a5af0f5..3a5af0f5 100644
--- a/include/sway/ipc-json.h
+++ b/include/sway/old/ipc-json.h
diff --git a/include/sway/ipc-server.h b/include/sway/old/ipc-server.h
index 1d199134..0cc26d99 100644
--- a/include/sway/ipc-server.h
+++ b/include/sway/old/ipc-server.h
@@ -1,8 +1,5 @@
1#ifndef _SWAY_IPC_SERVER_H 1#ifndef _SWAY_IPC_SERVER_H
2#define _SWAY_IPC_SERVER_H 2#define _SWAY_IPC_SERVER_H
3
4#include <wlc/wlc.h>
5
6#include "container.h" 3#include "container.h"
7#include "config.h" 4#include "config.h"
8#include "ipc.h" 5#include "ipc.h"
@@ -33,9 +30,4 @@ void ipc_event_modifier(uint32_t modifier, const char *state);
33void ipc_event_binding_keyboard(struct sway_binding *sb); 30void ipc_event_binding_keyboard(struct sway_binding *sb);
34const char *swayc_type_string(enum swayc_types type); 31const char *swayc_type_string(enum swayc_types type);
35 32
36/**
37 * Send pixel data to registered clients.
38 */
39void ipc_get_pixels(wlc_handle output);
40
41#endif 33#endif
diff --git a/include/sway/layout.h b/include/sway/old/layout.h
index f0791588..f0791588 100644
--- a/include/sway/layout.h
+++ b/include/sway/old/layout.h
diff --git a/include/sway/old/output.h b/include/sway/old/output.h
new file mode 100644
index 00000000..2a222238
--- /dev/null
+++ b/include/sway/old/output.h
@@ -0,0 +1,36 @@
1#ifndef _SWAY_OUTPUT_H
2#define _SWAY_OUTPUT_H
3#include <time.h>
4#include <wayland-server.h>
5#include <wlr/types/wlr_output.h>
6#include "container.h"
7#include "focus.h"
8
9struct sway_server;
10
11struct sway_output {
12 struct wlr_output *wlr_output;
13 struct wl_listener frame;
14 struct sway_server *server;
15 struct timespec last_frame;
16};
17
18// Position is absolute coordinates on the edge where the adjacent output
19// should be searched for.
20swayc_t *output_by_name(const char* name, const struct wlc_point *abs_pos);
21swayc_t *swayc_opposite_output(enum movement_direction dir, const struct wlc_point *abs_pos);
22swayc_t *swayc_adjacent_output(swayc_t *output, enum movement_direction dir, const struct wlc_point *abs_pos, bool pick_closest);
23
24// Place absolute coordinates for given container into given wlc_point.
25void get_absolute_position(swayc_t *container, struct wlc_point *point);
26
27// Place absolute coordinates for the center point of given container into
28// given wlc_point.
29void get_absolute_center_position(swayc_t *container, struct wlc_point *point);
30
31// stable sort workspaces on this output
32void sort_workspaces(swayc_t *output);
33
34void output_get_scaled_size(wlc_handle handle, struct wlc_size *size);
35
36#endif
diff --git a/include/sway/workspace.h b/include/sway/old/workspace.h
index c268fafa..c268fafa 100644
--- a/include/sway/workspace.h
+++ b/include/sway/old/workspace.h
diff --git a/include/sway/output.h b/include/sway/output.h
index 2a222238..ffc6708d 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -3,34 +3,14 @@
3#include <time.h> 3#include <time.h>
4#include <wayland-server.h> 4#include <wayland-server.h>
5#include <wlr/types/wlr_output.h> 5#include <wlr/types/wlr_output.h>
6#include "container.h"
7#include "focus.h"
8 6
9struct sway_server; 7struct sway_server;
10 8
11struct sway_output { 9struct sway_output {
12 struct wlr_output *wlr_output; 10 struct wlr_output *wlr_output;
13 struct wl_listener frame;
14 struct sway_server *server; 11 struct sway_server *server;
15 struct timespec last_frame; 12 struct timespec last_frame;
13 struct wl_listener frame;
16}; 14};
17 15
18// Position is absolute coordinates on the edge where the adjacent output
19// should be searched for.
20swayc_t *output_by_name(const char* name, const struct wlc_point *abs_pos);
21swayc_t *swayc_opposite_output(enum movement_direction dir, const struct wlc_point *abs_pos);
22swayc_t *swayc_adjacent_output(swayc_t *output, enum movement_direction dir, const struct wlc_point *abs_pos, bool pick_closest);
23
24// Place absolute coordinates for given container into given wlc_point.
25void get_absolute_position(swayc_t *container, struct wlc_point *point);
26
27// Place absolute coordinates for the center point of given container into
28// given wlc_point.
29void get_absolute_center_position(swayc_t *container, struct wlc_point *point);
30
31// stable sort workspaces on this output
32void sort_workspaces(swayc_t *output);
33
34void output_get_scaled_size(wlc_handle handle, struct wlc_size *size);
35
36#endif 16#endif
diff --git a/sway/CMakeLists.txt b/sway/CMakeLists.txt
index f9209189..73531a84 100644
--- a/sway/CMakeLists.txt
+++ b/sway/CMakeLists.txt
@@ -1,6 +1,5 @@
1include_directories( 1include_directories(
2 ${PROTOCOLS_INCLUDE_DIRS} 2 ${PROTOCOLS_INCLUDE_DIRS}
3 ${WLC_INCLUDE_DIRS}
4 ${WLR_INCLUDE_DIRS} 3 ${WLR_INCLUDE_DIRS}
5 ${PCRE_INCLUDE_DIRS} 4 ${PCRE_INCLUDE_DIRS}
6 ${JSONC_INCLUDE_DIRS} 5 ${JSONC_INCLUDE_DIRS}
@@ -11,37 +10,12 @@ include_directories(
11 ${WAYLAND_INCLUDE_DIR} 10 ${WAYLAND_INCLUDE_DIR}
12) 11)
13 12
14file(GLOB cmds
15 "commands/*.c"
16 "commands/bar/*.c"
17 "commands/input/*.c"
18)
19
20add_executable(sway 13add_executable(sway
21 desktop/output.c 14 desktop/output.c
22 desktop/xdg_shell_v6.c 15 desktop/xdg_shell_v6.c
23 16
24 tree/container.c
25 tree/criteria.c
26 tree/focus.c
27 tree/output.c
28 tree/workspace.c
29 tree/layout.c
30
31 input/input.c
32
33 commands.c
34 ${cmds}
35
36 base64.c 17 base64.c
37 config.c
38 debug_log.c
39 input_state.c
40 ipc-json.c
41 ipc-server.c
42 main.c 18 main.c
43 border.c
44 security.c
45 server.c 19 server.c
46) 20)
47 21
@@ -53,7 +27,6 @@ target_link_libraries(sway
53 sway-common 27 sway-common
54 sway-protocols 28 sway-protocols
55 sway-wayland 29 sway-wayland
56 ${WLC_LIBRARIES}
57 ${WLR_LIBRARIES} 30 ${WLR_LIBRARIES}
58 ${XKBCOMMON_LIBRARIES} 31 ${XKBCOMMON_LIBRARIES}
59 ${PCRE_LIBRARIES} 32 ${PCRE_LIBRARIES}
diff --git a/sway/debug_log.c b/sway/debug_log.c
deleted file mode 100644
index d1eafae8..00000000
--- a/sway/debug_log.c
+++ /dev/null
@@ -1,103 +0,0 @@
1#include "log.h"
2#include "sway.h"
3#include <stdarg.h>
4#include <stdio.h>
5#include <stdlib.h>
6#include <libgen.h>
7#include <fcntl.h>
8#include <unistd.h>
9#include <signal.h>
10#include <errno.h>
11#include <string.h>
12#include <stringop.h>
13#include "sway/workspace.h"
14
15/* XXX:DEBUG:XXX */
16static void container_log(const swayc_t *c, int depth) {
17 fprintf(stderr, "focus:%c",
18 c == get_focused_view(&root_container) ? 'K':
19 c == get_focused_container(&root_container) ? 'F' : // Focused
20 c == swayc_active_workspace() ? 'W' : // active workspace
21 c == &root_container ? 'R' : // root
22 'X');// not any others
23 for (int i = 6; i > depth; i--) { fprintf(stderr, " "); }
24 fprintf(stderr,"|(%p)",c);
25 fprintf(stderr,"(p:%-8p)",c->parent);
26 fprintf(stderr,"(f:%-8p)",c->focused);
27 fprintf(stderr,"(h:%2" PRIuPTR ")",c->handle);
28 fprintf(stderr,"Type:%-4s|",
29 c->type == C_ROOT ? "root" :
30 c->type == C_OUTPUT ? "op" :
31 c->type == C_WORKSPACE ? "ws" :
32 c->type == C_CONTAINER ? "cont" :
33 c->type == C_VIEW ? "view" : "?");
34 fprintf(stderr,"layout:%-5s|",
35 c->layout == L_NONE ? "-" :
36 c->layout == L_HORIZ ? "Horiz":
37 c->layout == L_VERT ? "Vert":
38 c->layout == L_STACKED ? "Stack":
39 c->layout == L_TABBED ? "Tab":
40 c->layout == L_FLOATING ? "Float":
41 c->layout == L_AUTO_LEFT ? "A_lft":
42 c->layout == L_AUTO_RIGHT ? "A_rgt":
43 c->layout == L_AUTO_TOP ? "A_top":
44 c->layout == L_AUTO_BOTTOM ? "A_bot":
45 "Unknown");
46 fprintf(stderr, "w:%4.f|h:%4.f|", c->width, c->height);
47 fprintf(stderr, "x:%4.f|y:%4.f|", c->x, c->y);
48 fprintf(stderr, "g:%3d|",c->gaps);
49 fprintf(stderr, "vis:%c|", c->visible?'t':'f');
50 fprintf(stderr, "children:%2d|",c->children?c->children->length:0);
51 fprintf(stderr, "name:%.16s\n", c->name);
52}
53void layout_log(const swayc_t *c, int depth) {
54 if (L_DEBUG > get_log_level()) return;
55 int i, d;
56 int e = c->children ? c->children->length : 0;
57 container_log(c, depth);
58 if (e) {
59 for (i = 0; i < e; ++i) {
60 fputc('|',stderr);
61 for (d = 0; d < depth; ++d) fputc('-', stderr);
62 layout_log(c->children->items[i], depth + 1);
63 }
64 }
65 if (c->type == C_WORKSPACE) {
66 e = c->floating?c->floating->length:0;
67 if (e) {
68 for (i = 0; i < e; ++i) {
69 fputc('|',stderr);
70 for (d = 0; d < depth; ++d) fputc('=', stderr);
71 layout_log(c->floating->items[i], depth + 1);
72 }
73 }
74 }
75}
76
77const char *swayc_type_string(enum swayc_types type) {
78 return type == C_ROOT ? "ROOT" :
79 type == C_OUTPUT ? "OUTPUT" :
80 type == C_WORKSPACE ? "WORKSPACE" :
81 type == C_CONTAINER ? "CONTAINER" :
82 type == C_VIEW ? "VIEW" :
83 "UNKNOWN";
84}
85
86// Like sway_log, but also appends some info about given container to log output.
87void swayc_log(log_importance_t verbosity, swayc_t *cont, const char* format, ...) {
88 sway_assert(cont, "swayc_log: no container ...");
89 va_list args;
90 va_start(args, format);
91 char *txt = malloc(128);
92 vsprintf(txt, format, args);
93 va_end(args);
94
95 char *debug_txt = malloc(32);
96 snprintf(debug_txt, 32, "%s '%s'", swayc_type_string(cont->type), cont->name);
97
98 sway_log(verbosity, "%s (%s)", txt, debug_txt);
99 free(txt);
100 free(debug_txt);
101}
102
103/* XXX:DEBUG:XXX */
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 6d0bebc5..6ddcac3b 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -4,11 +4,9 @@
4#include <wayland-server.h> 4#include <wayland-server.h>
5#include <wlr/types/wlr_output.h> 5#include <wlr/types/wlr_output.h>
6#include <wlr/render.h> 6#include <wlr/render.h>
7#include "sway/server.h"
8#include "sway/container.h"
9#include "sway/workspace.h"
10#include "sway/output.h"
11#include "log.h" 7#include "log.h"
8#include "sway/output.h"
9#include "sway/server.h"
12 10
13static void output_frame_notify(struct wl_listener *listener, void *data) { 11static void output_frame_notify(struct wl_listener *listener, void *data) {
14 struct sway_output *soutput = wl_container_of( 12 struct sway_output *soutput = wl_container_of(
@@ -37,19 +35,10 @@ void output_add_notify(struct wl_listener *listener, void *data) {
37 output->wlr_output = wlr_output; 35 output->wlr_output = wlr_output;
38 output->server = server; 36 output->server = server;
39 37
40 swayc_t *node = new_output(output);
41 if (!sway_assert(node, "Failed to allocate output")) {
42 return;
43 }
44
45 // Switch to workspace if we need to
46 if (swayc_active_workspace() == NULL) {
47 swayc_t *ws = node->children->items[0];
48 workspace_switch(ws);
49 }
50
51 output->frame.notify = output_frame_notify; 38 output->frame.notify = output_frame_notify;
52 wl_signal_add(&wlr_output->events.frame, &output->frame); 39 wl_signal_add(&wlr_output->events.frame, &output->frame);
40
41 // TODO: Add to tree
53} 42}
54 43
55void output_remove_notify(struct wl_listener *listener, void *data) { 44void output_remove_notify(struct wl_listener *listener, void *data) {
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index e29b46d7..04f3f42c 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -1,49 +1,10 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <wayland-server.h> 2#include <wayland-server.h>
3#include <wlr/types/wlr_xdg_shell_v6.h> 3#include <wlr/types/wlr_xdg_shell_v6.h>
4#include "sway/commands.h"
5#include "sway/container.h"
6#include "sway/focus.h"
7#include "sway/ipc-server.h"
8#include "sway/server.h" 4#include "sway/server.h"
9#include "sway/view.h" 5#include "sway/view.h"
10#include "log.h" 6#include "log.h"
11 7
12// TODO: move elsewhere
13static void temp_ws_cleanup() {
14 swayc_t *op, *ws;
15 int i = 0, j;
16 if (!root_container.children)
17 return;
18 while (i < root_container.children->length) {
19 op = root_container.children->items[i++];
20 if (!op->children)
21 continue;
22 j = 0;
23 while (j < op->children->length) {
24 ws = op->children->items[j++];
25 if (ws->children->length == 0 && ws->floating->length == 0 && ws != op->focused) {
26 if (destroy_workspace(ws)) {
27 j--;
28 }
29 }
30 }
31 }
32}
33
34// TODO: move elsewhere
35static swayc_t *move_focus_to_tiling(swayc_t *focused) {
36 if (focused->is_floating) {
37 if (focused->parent->children->length == 0) {
38 return focused->parent;
39 }
40 // TODO find a better way of doing this
41 // Or to focused container
42 return get_focused_container(focused->parent->children->items[0]);
43 }
44 return focused;
45}
46
47static const char *get_prop(struct sway_view *view, enum sway_view_prop prop) { 8static const char *get_prop(struct sway_view *view, enum sway_view_prop prop) {
48 if (!sway_assert(view->type == SWAY_XDG_SHELL_V6_VIEW, 9 if (!sway_assert(view->type == SWAY_XDG_SHELL_V6_VIEW,
49 "xdg get_prop for non-xdg view!")) { 10 "xdg get_prop for non-xdg view!")) {
@@ -88,30 +49,10 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
88 sway_surface->view = sway_view; 49 sway_surface->view = sway_view;
89 50
90 // TODO: 51 // TODO:
91 // - Consolodate common logic between shells 52 // - Add to tree
92 // - Wire up listeners 53 // - Wire up listeners
93 // - Handle popups 54 // - Handle popups
94 // - Look up pid and open on appropriate workspace 55 // - Look up pid and open on appropriate workspace
95 // - Set new view to maximized so it behaves nicely 56 // - Set new view to maximized so it behaves nicely
96 // - Criteria 57 // - Criteria
97
98 suspend_workspace_cleanup = true;
99 //swayc_t *current_ws = swayc_active_workspace();
100 swayc_t *prev_focus = get_focused_container(&root_container);
101 swayc_t *focused = move_focus_to_tiling(prev_focus);
102
103 // TODO: fix new_view
104 swayc_t *view = new_view(focused, sway_view);
105 ipc_event_window(view, "new");
106 set_focused_container(view);
107
108 swayc_t *output = swayc_parent_by_type(view, C_OUTPUT);
109 arrange_windows(output, -1, -1);
110
111 swayc_t *workspace = swayc_parent_by_type(focused, C_WORKSPACE);
112 if (workspace && workspace->fullscreen) {
113 set_focused_container(workspace->fullscreen);
114 }
115 suspend_workspace_cleanup = false;
116 temp_ws_cleanup();
117} 58}
diff --git a/sway/main.c b/sway/main.c
index 7d6f2873..5710a099 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -1,30 +1,24 @@
1#define _XOPEN_SOURCE 700 1#define _XOPEN_SOURCE 700
2#define _POSIX_C_SOURCE 200112L 2#define _POSIX_C_SOURCE 200112L
3#include <stdio.h> 3#include <getopt.h>
4#include <stdlib.h> 4#include <signal.h>
5#include <stdbool.h> 5#include <stdbool.h>
6#include <sys/wait.h> 6#include <stdlib.h>
7#include <sys/types.h> 7#include <stdio.h>
8#include <string.h>
8#include <sys/stat.h> 9#include <sys/stat.h>
10#include <sys/types.h>
11#include <sys/wait.h>
9#include <sys/un.h> 12#include <sys/un.h>
10#include <signal.h>
11#include <unistd.h> 13#include <unistd.h>
12#include <getopt.h>
13#ifdef __linux__ 14#ifdef __linux__
14#include <sys/capability.h> 15#include <sys/capability.h>
15#include <sys/prctl.h> 16#include <sys/prctl.h>
16#endif 17#endif
17#include "sway/layout.h"
18#include "sway/config.h"
19#include "sway/security.h"
20#include "sway/handlers.h"
21#include "sway/input.h"
22#include "sway/ipc-server.h"
23#include "sway/server.h" 18#include "sway/server.h"
24#include "ipc-client.h" 19#include "ipc-client.h"
25#include "readline.h" 20#include "readline.h"
26#include "stringop.h" 21#include "stringop.h"
27#include "sway.h"
28#include "log.h" 22#include "log.h"
29#include "util.h" 23#include "util.h"
30 24
@@ -39,7 +33,7 @@ void sway_terminate(int exit_code) {
39} 33}
40 34
41void sig_handler(int signal) { 35void sig_handler(int signal) {
42 close_views(&root_container); 36 //close_views(&root_container);
43 sway_terminate(EXIT_SUCCESS); 37 sway_terminate(EXIT_SUCCESS);
44} 38}
45 39
@@ -442,17 +436,17 @@ int main(int argc, char **argv) {
442 return 1; 436 return 1;
443 } 437 }
444 438
445 init_layout(); 439 //init_layout();
446 ipc_init(); 440 //ipc_init();
447 441
448 if (validate) { 442 //if (validate) {
449 bool valid = load_main_config(config_path, false); 443 // bool valid = load_main_config(config_path, false);
450 return valid ? 0 : 1; 444 // return valid ? 0 : 1;
451 } 445 //}
452 446
453 if (!load_main_config(config_path, false)) { 447 //if (!load_main_config(config_path, false)) {
454 sway_terminate(EXIT_FAILURE); 448 // sway_terminate(EXIT_FAILURE);
455 } 449 //}
456 450
457 if (config_path) { 451 if (config_path) {
458 free(config_path); 452 free(config_path);
@@ -466,11 +460,11 @@ int main(int argc, char **argv) {
466 460
467 server_fini(&server); 461 server_fini(&server);
468 462
469 ipc_terminate(); 463 //ipc_terminate();
470 464
471 if (config) { 465 //if (config) {
472 free_config(config); 466 // free_config(config);
473 } 467 //}
474 468
475 return exit_value; 469 return exit_value;
476} 470}
diff --git a/sway/border.c b/sway/old/border.c
index df0022ce..df0022ce 100644
--- a/sway/border.c
+++ b/sway/old/border.c
diff --git a/sway/commands.c b/sway/old/commands.c
index e1181893..e1181893 100644
--- a/sway/commands.c
+++ b/sway/old/commands.c
diff --git a/sway/commands/assign.c b/sway/old/commands/assign.c
index c3b03bbc..c3b03bbc 100644
--- a/sway/commands/assign.c
+++ b/sway/old/commands/assign.c
diff --git a/sway/commands/bar.c b/sway/old/commands/bar.c
index 04745a6e..04745a6e 100644
--- a/sway/commands/bar.c
+++ b/sway/old/commands/bar.c
diff --git a/sway/commands/bar/activate_button.c b/sway/old/commands/bar/activate_button.c
index 32a1d3e5..32a1d3e5 100644
--- a/sway/commands/bar/activate_button.c
+++ b/sway/old/commands/bar/activate_button.c
diff --git a/sway/commands/bar/binding_mode_indicator.c b/sway/old/commands/bar/binding_mode_indicator.c
index 64f5b84f..64f5b84f 100644
--- a/sway/commands/bar/binding_mode_indicator.c
+++ b/sway/old/commands/bar/binding_mode_indicator.c
diff --git a/sway/commands/bar/bindsym.c b/sway/old/commands/bar/bindsym.c
index 5f90b51a..5f90b51a 100644
--- a/sway/commands/bar/bindsym.c
+++ b/sway/old/commands/bar/bindsym.c
diff --git a/sway/commands/bar/colors.c b/sway/old/commands/bar/colors.c
index 8b3b0aac..8b3b0aac 100644
--- a/sway/commands/bar/colors.c
+++ b/sway/old/commands/bar/colors.c
diff --git a/sway/commands/bar/context_button.c b/sway/old/commands/bar/context_button.c
index 6d7d7aec..6d7d7aec 100644
--- a/sway/commands/bar/context_button.c
+++ b/sway/old/commands/bar/context_button.c
diff --git a/sway/commands/bar/font.c b/sway/old/commands/bar/font.c
index c586c5bc..c586c5bc 100644
--- a/sway/commands/bar/font.c
+++ b/sway/old/commands/bar/font.c
diff --git a/sway/commands/bar/height.c b/sway/old/commands/bar/height.c
index eb576ab3..eb576ab3 100644
--- a/sway/commands/bar/height.c
+++ b/sway/old/commands/bar/height.c
diff --git a/sway/commands/bar/hidden_state.c b/sway/old/commands/bar/hidden_state.c
index 0b49aa6b..0b49aa6b 100644
--- a/sway/commands/bar/hidden_state.c
+++ b/sway/old/commands/bar/hidden_state.c
diff --git a/sway/commands/bar/icon_theme.c b/sway/old/commands/bar/icon_theme.c
index cbfc0be5..cbfc0be5 100644
--- a/sway/commands/bar/icon_theme.c
+++ b/sway/old/commands/bar/icon_theme.c
diff --git a/sway/commands/bar/id.c b/sway/old/commands/bar/id.c
index 1221ebf6..1221ebf6 100644
--- a/sway/commands/bar/id.c
+++ b/sway/old/commands/bar/id.c
diff --git a/sway/commands/bar/mode.c b/sway/old/commands/bar/mode.c
index 36816b93..36816b93 100644
--- a/sway/commands/bar/mode.c
+++ b/sway/old/commands/bar/mode.c
diff --git a/sway/commands/bar/modifier.c b/sway/old/commands/bar/modifier.c
index 153d87e6..153d87e6 100644
--- a/sway/commands/bar/modifier.c
+++ b/sway/old/commands/bar/modifier.c
diff --git a/sway/commands/bar/output.c b/sway/old/commands/bar/output.c
index a5710bc0..a5710bc0 100644
--- a/sway/commands/bar/output.c
+++ b/sway/old/commands/bar/output.c
diff --git a/sway/commands/bar/pango_markup.c b/sway/old/commands/bar/pango_markup.c
index f69e882f..f69e882f 100644
--- a/sway/commands/bar/pango_markup.c
+++ b/sway/old/commands/bar/pango_markup.c
diff --git a/sway/commands/bar/position.c b/sway/old/commands/bar/position.c
index 50de58e2..50de58e2 100644
--- a/sway/commands/bar/position.c
+++ b/sway/old/commands/bar/position.c
diff --git a/sway/commands/bar/secondary_button.c b/sway/old/commands/bar/secondary_button.c
index 745045c5..745045c5 100644
--- a/sway/commands/bar/secondary_button.c
+++ b/sway/old/commands/bar/secondary_button.c
diff --git a/sway/commands/bar/separator_symbol.c b/sway/old/commands/bar/separator_symbol.c
index 2766d8a2..2766d8a2 100644
--- a/sway/commands/bar/separator_symbol.c
+++ b/sway/old/commands/bar/separator_symbol.c
diff --git a/sway/commands/bar/status_command.c b/sway/old/commands/bar/status_command.c
index b227ac47..b227ac47 100644
--- a/sway/commands/bar/status_command.c
+++ b/sway/old/commands/bar/status_command.c
diff --git a/sway/commands/bar/strip_workspace_numbers.c b/sway/old/commands/bar/strip_workspace_numbers.c
index 9ac32482..9ac32482 100644
--- a/sway/commands/bar/strip_workspace_numbers.c
+++ b/sway/old/commands/bar/strip_workspace_numbers.c
diff --git a/sway/commands/bar/swaybar_command.c b/sway/old/commands/bar/swaybar_command.c
index 452e2df5..452e2df5 100644
--- a/sway/commands/bar/swaybar_command.c
+++ b/sway/old/commands/bar/swaybar_command.c
diff --git a/sway/commands/bar/tray_output.c b/sway/old/commands/bar/tray_output.c
index 012304a9..012304a9 100644
--- a/sway/commands/bar/tray_output.c
+++ b/sway/old/commands/bar/tray_output.c
diff --git a/sway/commands/bar/tray_padding.c b/sway/old/commands/bar/tray_padding.c
index ac0572ce..ac0572ce 100644
--- a/sway/commands/bar/tray_padding.c
+++ b/sway/old/commands/bar/tray_padding.c
diff --git a/sway/commands/bar/workspace_buttons.c b/sway/old/commands/bar/workspace_buttons.c
index 67dd2d31..67dd2d31 100644
--- a/sway/commands/bar/workspace_buttons.c
+++ b/sway/old/commands/bar/workspace_buttons.c
diff --git a/sway/commands/bar/wrap_scroll.c b/sway/old/commands/bar/wrap_scroll.c
index 4ed1f12a..4ed1f12a 100644
--- a/sway/commands/bar/wrap_scroll.c
+++ b/sway/old/commands/bar/wrap_scroll.c
diff --git a/sway/commands/bind.c b/sway/old/commands/bind.c
index d9ea37b7..d9ea37b7 100644
--- a/sway/commands/bind.c
+++ b/sway/old/commands/bind.c
diff --git a/sway/commands/border.c b/sway/old/commands/border.c
index c888622e..c888622e 100644
--- a/sway/commands/border.c
+++ b/sway/old/commands/border.c
diff --git a/sway/commands/client.c b/sway/old/commands/client.c
index f3d879cd..f3d879cd 100644
--- a/sway/commands/client.c
+++ b/sway/old/commands/client.c
diff --git a/sway/commands/clipboard.c b/sway/old/commands/clipboard.c
index 95514e78..95514e78 100644
--- a/sway/commands/clipboard.c
+++ b/sway/old/commands/clipboard.c
diff --git a/sway/commands/commands.c b/sway/old/commands/commands.c
index 0c64970c..0c64970c 100644
--- a/sway/commands/commands.c
+++ b/sway/old/commands/commands.c
diff --git a/sway/commands/debuglog.c b/sway/old/commands/debuglog.c
index 658d6165..658d6165 100644
--- a/sway/commands/debuglog.c
+++ b/sway/old/commands/debuglog.c
diff --git a/sway/commands/default_border.c b/sway/old/commands/default_border.c
index 8fbe8d19..8fbe8d19 100644
--- a/sway/commands/default_border.c
+++ b/sway/old/commands/default_border.c
diff --git a/sway/commands/default_floating_border.c b/sway/old/commands/default_floating_border.c
index fb48c1c0..fb48c1c0 100644
--- a/sway/commands/default_floating_border.c
+++ b/sway/old/commands/default_floating_border.c
diff --git a/sway/commands/exec.c b/sway/old/commands/exec.c
index 58ef5f94..58ef5f94 100644
--- a/sway/commands/exec.c
+++ b/sway/old/commands/exec.c
diff --git a/sway/commands/exec_always.c b/sway/old/commands/exec_always.c
index ab2d8622..ab2d8622 100644
--- a/sway/commands/exec_always.c
+++ b/sway/old/commands/exec_always.c
diff --git a/sway/commands/exit.c b/sway/old/commands/exit.c
index f192f86a..f192f86a 100644
--- a/sway/commands/exit.c
+++ b/sway/old/commands/exit.c
diff --git a/sway/commands/floating.c b/sway/old/commands/floating.c
index ccfde532..ccfde532 100644
--- a/sway/commands/floating.c
+++ b/sway/old/commands/floating.c
diff --git a/sway/commands/floating_maximum_size.c b/sway/old/commands/floating_maximum_size.c
index 5bca4d7c..5bca4d7c 100644
--- a/sway/commands/floating_maximum_size.c
+++ b/sway/old/commands/floating_maximum_size.c
diff --git a/sway/commands/floating_minimum_size.c b/sway/old/commands/floating_minimum_size.c
index ba72454c..ba72454c 100644
--- a/sway/commands/floating_minimum_size.c
+++ b/sway/old/commands/floating_minimum_size.c
diff --git a/sway/commands/floating_mod.c b/sway/old/commands/floating_mod.c
index b8e81ab9..b8e81ab9 100644
--- a/sway/commands/floating_mod.c
+++ b/sway/old/commands/floating_mod.c
diff --git a/sway/commands/floating_scroll.c b/sway/old/commands/floating_scroll.c
index 8c50c5bd..8c50c5bd 100644
--- a/sway/commands/floating_scroll.c
+++ b/sway/old/commands/floating_scroll.c
diff --git a/sway/commands/focus.c b/sway/old/commands/focus.c
index c83157b8..c83157b8 100644
--- a/sway/commands/focus.c
+++ b/sway/old/commands/focus.c
diff --git a/sway/commands/focus_follows_mouse.c b/sway/old/commands/focus_follows_mouse.c
index 7c9c2b13..7c9c2b13 100644
--- a/sway/commands/focus_follows_mouse.c
+++ b/sway/old/commands/focus_follows_mouse.c
diff --git a/sway/commands/font.c b/sway/old/commands/font.c
index 32994f8a..32994f8a 100644
--- a/sway/commands/font.c
+++ b/sway/old/commands/font.c
diff --git a/sway/commands/for_window.c b/sway/old/commands/for_window.c
index d1fd1641..d1fd1641 100644
--- a/sway/commands/for_window.c
+++ b/sway/old/commands/for_window.c
diff --git a/sway/commands/force_focus_wrapping.c b/sway/old/commands/force_focus_wrapping.c
index f19dd163..f19dd163 100644
--- a/sway/commands/force_focus_wrapping.c
+++ b/sway/old/commands/force_focus_wrapping.c
diff --git a/sway/commands/fullscreen.c b/sway/old/commands/fullscreen.c
index bfff82f9..bfff82f9 100644
--- a/sway/commands/fullscreen.c
+++ b/sway/old/commands/fullscreen.c
diff --git a/sway/commands/gaps.c b/sway/old/commands/gaps.c
index 0a48592d..0a48592d 100644
--- a/sway/commands/gaps.c
+++ b/sway/old/commands/gaps.c
diff --git a/sway/commands/hide_edge_borders.c b/sway/old/commands/hide_edge_borders.c
index ee2a2644..ee2a2644 100644
--- a/sway/commands/hide_edge_borders.c
+++ b/sway/old/commands/hide_edge_borders.c
diff --git a/sway/commands/include.c b/sway/old/commands/include.c
index 1ba9a10d..1ba9a10d 100644
--- a/sway/commands/include.c
+++ b/sway/old/commands/include.c
diff --git a/sway/commands/input.c b/sway/old/commands/input.c
index ad53d272..ad53d272 100644
--- a/sway/commands/input.c
+++ b/sway/old/commands/input.c
diff --git a/sway/commands/input/accel_profile.c b/sway/old/commands/input/accel_profile.c
index 8288c1ad..8288c1ad 100644
--- a/sway/commands/input/accel_profile.c
+++ b/sway/old/commands/input/accel_profile.c
diff --git a/sway/commands/input/click_method.c b/sway/old/commands/input/click_method.c
index 5e9d3dcb..5e9d3dcb 100644
--- a/sway/commands/input/click_method.c
+++ b/sway/old/commands/input/click_method.c
diff --git a/sway/commands/input/drag_lock.c b/sway/old/commands/input/drag_lock.c
index f5a7beb4..f5a7beb4 100644
--- a/sway/commands/input/drag_lock.c
+++ b/sway/old/commands/input/drag_lock.c
diff --git a/sway/commands/input/dwt.c b/sway/old/commands/input/dwt.c
index 557b2207..557b2207 100644
--- a/sway/commands/input/dwt.c
+++ b/sway/old/commands/input/dwt.c
diff --git a/sway/commands/input/events.c b/sway/old/commands/input/events.c
index 9d54287a..9d54287a 100644
--- a/sway/commands/input/events.c
+++ b/sway/old/commands/input/events.c
diff --git a/sway/commands/input/left_handed.c b/sway/old/commands/input/left_handed.c
index 6c913e70..6c913e70 100644
--- a/sway/commands/input/left_handed.c
+++ b/sway/old/commands/input/left_handed.c
diff --git a/sway/commands/input/middle_emulation.c b/sway/old/commands/input/middle_emulation.c
index 33cdd7d6..33cdd7d6 100644
--- a/sway/commands/input/middle_emulation.c
+++ b/sway/old/commands/input/middle_emulation.c
diff --git a/sway/commands/input/natural_scroll.c b/sway/old/commands/input/natural_scroll.c
index 7bc8b8d0..7bc8b8d0 100644
--- a/sway/commands/input/natural_scroll.c
+++ b/sway/old/commands/input/natural_scroll.c
diff --git a/sway/commands/input/pointer_accel.c b/sway/old/commands/input/pointer_accel.c
index 94f595d1..94f595d1 100644
--- a/sway/commands/input/pointer_accel.c
+++ b/sway/old/commands/input/pointer_accel.c
diff --git a/sway/commands/input/scroll_method.c b/sway/old/commands/input/scroll_method.c
index 5c6c3d7a..5c6c3d7a 100644
--- a/sway/commands/input/scroll_method.c
+++ b/sway/old/commands/input/scroll_method.c
diff --git a/sway/commands/input/tap.c b/sway/old/commands/input/tap.c
index 9e3ca2af..9e3ca2af 100644
--- a/sway/commands/input/tap.c
+++ b/sway/old/commands/input/tap.c
diff --git a/sway/commands/ipc.c b/sway/old/commands/ipc.c
index 0c678961..0c678961 100644
--- a/sway/commands/ipc.c
+++ b/sway/old/commands/ipc.c
diff --git a/sway/commands/kill.c b/sway/old/commands/kill.c
index 742e2b86..742e2b86 100644
--- a/sway/commands/kill.c
+++ b/sway/old/commands/kill.c
diff --git a/sway/commands/layout.c b/sway/old/commands/layout.c
index 57a86565..57a86565 100644
--- a/sway/commands/layout.c
+++ b/sway/old/commands/layout.c
diff --git a/sway/commands/log_colors.c b/sway/old/commands/log_colors.c
index 815d1942..815d1942 100644
--- a/sway/commands/log_colors.c
+++ b/sway/old/commands/log_colors.c
diff --git a/sway/commands/mark.c b/sway/old/commands/mark.c
index c1d959df..c1d959df 100644
--- a/sway/commands/mark.c
+++ b/sway/old/commands/mark.c
diff --git a/sway/commands/mode.c b/sway/old/commands/mode.c
index d2985c54..d2985c54 100644
--- a/sway/commands/mode.c
+++ b/sway/old/commands/mode.c
diff --git a/sway/commands/mouse_warping.c b/sway/old/commands/mouse_warping.c
index 5596d483..5596d483 100644
--- a/sway/commands/mouse_warping.c
+++ b/sway/old/commands/mouse_warping.c
diff --git a/sway/commands/move.c b/sway/old/commands/move.c
index 52c73e22..52c73e22 100644
--- a/sway/commands/move.c
+++ b/sway/old/commands/move.c
diff --git a/sway/commands/new_float.c b/sway/old/commands/new_float.c
index d0f96093..d0f96093 100644
--- a/sway/commands/new_float.c
+++ b/sway/old/commands/new_float.c
diff --git a/sway/commands/new_window.c b/sway/old/commands/new_window.c
index 574a4527..574a4527 100644
--- a/sway/commands/new_window.c
+++ b/sway/old/commands/new_window.c
diff --git a/sway/commands/no_focus.c b/sway/old/commands/no_focus.c
index b3b88e5a..b3b88e5a 100644
--- a/sway/commands/no_focus.c
+++ b/sway/old/commands/no_focus.c
diff --git a/sway/commands/orientation.c b/sway/old/commands/orientation.c
index e54b60ee..e54b60ee 100644
--- a/sway/commands/orientation.c
+++ b/sway/old/commands/orientation.c
diff --git a/sway/commands/output.c b/sway/old/commands/output.c
index 911391d2..911391d2 100644
--- a/sway/commands/output.c
+++ b/sway/old/commands/output.c
diff --git a/sway/commands/permit.c b/sway/old/commands/permit.c
index 7a5e06f7..7a5e06f7 100644
--- a/sway/commands/permit.c
+++ b/sway/old/commands/permit.c
diff --git a/sway/commands/reload.c b/sway/old/commands/reload.c
index 01fcc5ba..01fcc5ba 100644
--- a/sway/commands/reload.c
+++ b/sway/old/commands/reload.c
diff --git a/sway/commands/resize.c b/sway/old/commands/resize.c
index ef52bb07..ef52bb07 100644
--- a/sway/commands/resize.c
+++ b/sway/old/commands/resize.c
diff --git a/sway/commands/scratchpad.c b/sway/old/commands/scratchpad.c
index 6c5c92df..6c5c92df 100644
--- a/sway/commands/scratchpad.c
+++ b/sway/old/commands/scratchpad.c
diff --git a/sway/commands/seamless_mouse.c b/sway/old/commands/seamless_mouse.c
index 7760e88d..7760e88d 100644
--- a/sway/commands/seamless_mouse.c
+++ b/sway/old/commands/seamless_mouse.c
diff --git a/sway/commands/set.c b/sway/old/commands/set.c
index 46fc6d38..46fc6d38 100644
--- a/sway/commands/set.c
+++ b/sway/old/commands/set.c
diff --git a/sway/commands/show_marks.c b/sway/old/commands/show_marks.c
index ed56d9e5..ed56d9e5 100644
--- a/sway/commands/show_marks.c
+++ b/sway/old/commands/show_marks.c
diff --git a/sway/commands/smart_gaps.c b/sway/old/commands/smart_gaps.c
index 815fc501..815fc501 100644
--- a/sway/commands/smart_gaps.c
+++ b/sway/old/commands/smart_gaps.c
diff --git a/sway/commands/split.c b/sway/old/commands/split.c
index e3045a4f..e3045a4f 100644
--- a/sway/commands/split.c
+++ b/sway/old/commands/split.c
diff --git a/sway/commands/sticky.c b/sway/old/commands/sticky.c
index 4899e061..4899e061 100644
--- a/sway/commands/sticky.c
+++ b/sway/old/commands/sticky.c
diff --git a/sway/commands/unmark.c b/sway/old/commands/unmark.c
index ac213261..ac213261 100644
--- a/sway/commands/unmark.c
+++ b/sway/old/commands/unmark.c
diff --git a/sway/commands/workspace.c b/sway/old/commands/workspace.c
index a7839746..a7839746 100644
--- a/sway/commands/workspace.c
+++ b/sway/old/commands/workspace.c
diff --git a/sway/commands/workspace_auto_back_and_forth.c b/sway/old/commands/workspace_auto_back_and_forth.c
index d58ae5c8..d58ae5c8 100644
--- a/sway/commands/workspace_auto_back_and_forth.c
+++ b/sway/old/commands/workspace_auto_back_and_forth.c
diff --git a/sway/commands/workspace_layout.c b/sway/old/commands/workspace_layout.c
index 9ac84be2..9ac84be2 100644
--- a/sway/commands/workspace_layout.c
+++ b/sway/old/commands/workspace_layout.c
diff --git a/sway/config.c b/sway/old/config.c
index aa40c49a..d14653e3 100644
--- a/sway/config.c
+++ b/sway/old/config.c
@@ -998,6 +998,7 @@ static void invoke_swaybar(struct bar_config *bar) {
998} 998}
999 999
1000static void terminate_swaybar(pid_t pid) { 1000static void terminate_swaybar(pid_t pid) {
1001 return; // TODO WLR
1001 int ret = kill(pid, SIGTERM); 1002 int ret = kill(pid, SIGTERM);
1002 if (ret != 0) { 1003 if (ret != 0) {
1003 sway_log(L_ERROR, "Unable to terminate swaybar [pid: %d]", pid); 1004 sway_log(L_ERROR, "Unable to terminate swaybar [pid: %d]", pid);
@@ -1066,143 +1067,6 @@ void load_swaybars() {
1066 list_free(bars); 1067 list_free(bars);
1067} 1068}
1068 1069
1069void apply_input_config(struct input_config *ic, struct libinput_device *dev) {
1070 if (!ic) {
1071 return;
1072 }
1073
1074 sway_log(L_DEBUG, "apply_input_config(%s)", ic->identifier);
1075
1076 if (ic->accel_profile != INT_MIN) {
1077 sway_log(L_DEBUG, "apply_input_config(%s) accel_set_profile(%d)", ic->identifier, ic->accel_profile);
1078 libinput_device_config_accel_set_profile(dev, ic->accel_profile);
1079 }
1080 if (ic->click_method != INT_MIN) {
1081 sway_log(L_DEBUG, "apply_input_config(%s) click_set_method(%d)", ic->identifier, ic->click_method);
1082 libinput_device_config_click_set_method(dev, ic->click_method);
1083 }
1084 if (ic->drag_lock != INT_MIN) {
1085 sway_log(L_DEBUG, "apply_input_config(%s) tap_set_drag_lock_enabled(%d)", ic->identifier, ic->click_method);
1086 libinput_device_config_tap_set_drag_lock_enabled(dev, ic->drag_lock);
1087 }
1088 if (ic->dwt != INT_MIN) {
1089 sway_log(L_DEBUG, "apply_input_config(%s) dwt_set_enabled(%d)", ic->identifier, ic->dwt);
1090 libinput_device_config_dwt_set_enabled(dev, ic->dwt);
1091 }
1092 if (ic->left_handed != INT_MIN) {
1093 sway_log(L_DEBUG, "apply_input_config(%s) left_handed_set_enabled(%d)", ic->identifier, ic->left_handed);
1094 libinput_device_config_left_handed_set(dev, ic->left_handed);
1095 }
1096 if (ic->middle_emulation != INT_MIN) {
1097 sway_log(L_DEBUG, "apply_input_config(%s) middle_emulation_set_enabled(%d)", ic->identifier, ic->middle_emulation);
1098 libinput_device_config_middle_emulation_set_enabled(dev, ic->middle_emulation);
1099 }
1100 if (ic->natural_scroll != INT_MIN) {
1101 sway_log(L_DEBUG, "apply_input_config(%s) natural_scroll_set_enabled(%d)", ic->identifier, ic->natural_scroll);
1102 libinput_device_config_scroll_set_natural_scroll_enabled(dev, ic->natural_scroll);
1103 }
1104 if (ic->pointer_accel != FLT_MIN) {
1105 sway_log(L_DEBUG, "apply_input_config(%s) accel_set_speed(%f)", ic->identifier, ic->pointer_accel);
1106 libinput_device_config_accel_set_speed(dev, ic->pointer_accel);
1107 }
1108 if (ic->scroll_method != INT_MIN) {
1109 sway_log(L_DEBUG, "apply_input_config(%s) scroll_set_method(%d)", ic->identifier, ic->scroll_method);
1110 libinput_device_config_scroll_set_method(dev, ic->scroll_method);
1111 }
1112 if (ic->send_events != INT_MIN) {
1113 sway_log(L_DEBUG, "apply_input_config(%s) send_events_set_mode(%d)", ic->identifier, ic->send_events);
1114 libinput_device_config_send_events_set_mode(dev, ic->send_events);
1115 }
1116 if (ic->tap != INT_MIN) {
1117 sway_log(L_DEBUG, "apply_input_config(%s) tap_set_enabled(%d)", ic->identifier, ic->tap);
1118 libinput_device_config_tap_set_enabled(dev, ic->tap);
1119 }
1120}
1121
1122void apply_output_config(struct output_config *oc, swayc_t *output) {
1123 if (oc && oc->enabled == 0) {
1124 destroy_output(output);
1125 return;
1126 }
1127
1128 if (oc && oc->width > 0 && oc->height > 0) {
1129 output->width = oc->width;
1130 output->height = oc->height;
1131
1132 sway_log(L_DEBUG, "Set %s size to %ix%i (%d)", oc->name, oc->width, oc->height, oc->scale);
1133 // TODO WLR: modes
1134 //struct wlc_size new_size = { .w = oc->width, .h = oc->height };
1135 //wlc_output_set_resolution(output->handle, &new_size, (uint32_t)oc->scale);
1136 } else if (oc) {
1137 //const struct wlc_size *new_size = wlc_output_get_resolution(output->handle);
1138 //wlc_output_set_resolution(output->handle, new_size, (uint32_t)oc->scale);
1139 }
1140
1141 // TODO WLR: wlr_output_layout
1142 // Find position for it
1143 if (oc && oc->x != -1 && oc->y != -1) {
1144 sway_log(L_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
1145 output->x = oc->x;
1146 output->y = oc->y;
1147 } else {
1148 int x = 0;
1149 for (int i = 0; i < root_container.children->length; ++i) {
1150 swayc_t *c = root_container.children->items[i];
1151 if (c->type == C_OUTPUT) {
1152 if (c->width + c->x > x) {
1153 x = c->width + c->x;
1154 }
1155 }
1156 }
1157 output->x = x;
1158 }
1159
1160 if (!oc || !oc->background) {
1161 // Look for a * config for background
1162 int i = list_seq_find(config->output_configs, output_name_cmp, "*");
1163 if (i >= 0) {
1164 oc = config->output_configs->items[i];
1165 } else {
1166 oc = NULL;
1167 }
1168 }
1169
1170 int output_i;
1171 for (output_i = 0; output_i < root_container.children->length; ++output_i) {
1172 if (root_container.children->items[output_i] == output) {
1173 break;
1174 }
1175 }
1176
1177 /* TODO WLR
1178 if (oc && oc->background) {
1179 if (output->bg_pid != 0) {
1180 terminate_swaybg(output->bg_pid);
1181 }
1182
1183 sway_log(L_DEBUG, "Setting background for output %d to %s", output_i, oc->background);
1184
1185 size_t bufsize = 12;
1186 char output_id[bufsize];
1187 snprintf(output_id, bufsize, "%d", output_i);
1188 output_id[bufsize-1] = 0;
1189
1190 char *const cmd[] = {
1191 "swaybg",
1192 output_id,
1193 oc->background,
1194 oc->background_option,
1195 NULL,
1196 };
1197
1198 output->bg_pid = fork();
1199 if (output->bg_pid == 0) {
1200 execvp(cmd[0], cmd);
1201 }
1202 }
1203 */
1204}
1205
1206char *do_var_replacement(char *str) { 1070char *do_var_replacement(char *str) {
1207 int i; 1071 int i;
1208 char *find = str; 1072 char *find = str;
diff --git a/sway/tree/container.c b/sway/old/container.c
index 82c0d877..82c0d877 100644
--- a/sway/tree/container.c
+++ b/sway/old/container.c
diff --git a/sway/tree/criteria.c b/sway/old/criteria.c
index e8978ebe..e8978ebe 100644
--- a/sway/tree/criteria.c
+++ b/sway/old/criteria.c
diff --git a/sway/tree/focus.c b/sway/old/focus.c
index 66f7ee17..66f7ee17 100644
--- a/sway/tree/focus.c
+++ b/sway/old/focus.c
diff --git a/sway/handlers.c b/sway/old/handlers.c
index 33e75d6b..33e75d6b 100644
--- a/sway/handlers.c
+++ b/sway/old/handlers.c
diff --git a/sway/input_state.c b/sway/old/input_state.c
index 04aafd37..04aafd37 100644
--- a/sway/input_state.c
+++ b/sway/old/input_state.c
diff --git a/sway/ipc-json.c b/sway/old/ipc-json.c
index 1579a2d9..1579a2d9 100644
--- a/sway/ipc-json.c
+++ b/sway/old/ipc-json.c
diff --git a/sway/ipc-server.c b/sway/old/ipc-server.c
index d4db4e7a..fd64e81b 100644
--- a/sway/ipc-server.c
+++ b/sway/old/ipc-server.c
@@ -1,10 +1,8 @@
1// See https://i3wm.org/docs/ipc.html for protocol information 1// See https://i3wm.org/docs/ipc.html for protocol information
2
3#ifndef __FreeBSD__ 2#ifndef __FreeBSD__
4// Any value will hide SOCK_CLOEXEC on FreeBSD (__BSD_VISIBLE=0) 3// Any value will hide SOCK_CLOEXEC on FreeBSD (__BSD_VISIBLE=0)
5#define _XOPEN_SOURCE 700 4#define _XOPEN_SOURCE 700
6#endif 5#endif
7
8#include <errno.h> 6#include <errno.h>
9#include <string.h> 7#include <string.h>
10#include <sys/socket.h> 8#include <sys/socket.h>
@@ -56,8 +54,6 @@ struct ipc_client {
56 char *write_buffer; 54 char *write_buffer;
57}; 55};
58 56
59static list_t *ipc_get_pixel_requests = NULL;
60
61struct sockaddr_un *ipc_user_sockaddr(void); 57struct sockaddr_un *ipc_user_sockaddr(void);
62int ipc_handle_connection(int fd, uint32_t mask, void *data); 58int ipc_handle_connection(int fd, uint32_t mask, void *data);
63int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data); 59int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data);
@@ -97,7 +93,6 @@ void ipc_init(void) {
97 setenv("SWAYSOCK", ipc_sockaddr->sun_path, 1); 93 setenv("SWAYSOCK", ipc_sockaddr->sun_path, 1);
98 94
99 ipc_client_list = create_list(); 95 ipc_client_list = create_list();
100 ipc_get_pixel_requests = create_list();
101 96
102 ipc_event_source = wl_event_loop_add_fd(server.wl_event_loop, ipc_socket, 97 ipc_event_source = wl_event_loop_add_fd(server.wl_event_loop, ipc_socket,
103 WL_EVENT_READABLE, ipc_handle_connection, NULL); 98 WL_EVENT_READABLE, ipc_handle_connection, NULL);
diff --git a/sway/tree/layout.c b/sway/old/layout.c
index 22f81688..22f81688 100644
--- a/sway/tree/layout.c
+++ b/sway/old/layout.c
diff --git a/sway/tree/output.c b/sway/old/output.c
index edfcac98..edfcac98 100644
--- a/sway/tree/output.c
+++ b/sway/old/output.c
diff --git a/sway/security.c b/sway/old/security.c
index fcd70f9d..fcd70f9d 100644
--- a/sway/security.c
+++ b/sway/old/security.c
diff --git a/sway/tree/workspace.c b/sway/old/workspace.c
index 14cde146..14cde146 100644
--- a/sway/tree/workspace.c
+++ b/sway/old/workspace.c
diff --git a/sway/server.c b/sway/server.c
index 940f28b3..8892b917 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -10,7 +10,6 @@
10// TODO WLR: make Xwayland optional 10// TODO WLR: make Xwayland optional
11#include <wlr/xwayland.h> 11#include <wlr/xwayland.h>
12#include "sway/server.h" 12#include "sway/server.h"
13#include "sway/input.h"
14#include "log.h" 13#include "log.h"
15 14
16bool server_init(struct sway_server *server) { 15bool server_init(struct sway_server *server) {
@@ -23,7 +22,6 @@ bool server_init(struct sway_server *server) {
23 server->renderer = wlr_gles2_renderer_create(server->backend); 22 server->renderer = wlr_gles2_renderer_create(server->backend);
24 wl_display_init_shm(server->wl_display); 23 wl_display_init_shm(server->wl_display);
25 24
26 server->input = sway_input_create(server);
27 server->data_device_manager = 25 server->data_device_manager =
28 wlr_data_device_manager_create(server->wl_display); 26 wlr_data_device_manager_create(server->wl_display);
29 27