From 733993a651c71f7e2198d505960d6bbd31e0e107 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sat, 18 Nov 2017 11:22:02 -0500 Subject: [PATCH] Move everything to sway/old/ --- CMakeLists.txt | 12 +- common/log.c | 2 +- include/sway.h | 6 - include/sway/handlers.h | 11 -- include/sway/{ => old}/border.h | 0 include/sway/{ => old}/commands.h | 0 include/sway/{ => old}/config.h | 0 include/sway/{ => old}/container.h | 0 include/sway/{ => old}/criteria.h | 0 include/sway/{ => old}/focus.h | 0 include/sway/{ => old}/input.h | 0 include/sway/{ => old}/input_state.h | 0 include/sway/{ => old}/ipc-json.h | 0 include/sway/{ => old}/ipc-server.h | 8 - include/sway/{ => old}/layout.h | 0 include/sway/old/output.h | 36 +++++ include/sway/{ => old}/workspace.h | 0 include/sway/output.h | 22 +-- sway/CMakeLists.txt | 27 ---- sway/debug_log.c | 103 ------------- sway/desktop/output.c | 19 +-- sway/desktop/xdg_shell_v6.c | 61 +------- sway/main.c | 54 +++---- sway/{ => old}/border.c | 0 sway/{ => old}/commands.c | 0 sway/{ => old}/commands/assign.c | 0 sway/{ => old}/commands/bar.c | 0 sway/{ => old}/commands/bar/activate_button.c | 0 .../commands/bar/binding_mode_indicator.c | 0 sway/{ => old}/commands/bar/bindsym.c | 0 sway/{ => old}/commands/bar/colors.c | 0 sway/{ => old}/commands/bar/context_button.c | 0 sway/{ => old}/commands/bar/font.c | 0 sway/{ => old}/commands/bar/height.c | 0 sway/{ => old}/commands/bar/hidden_state.c | 0 sway/{ => old}/commands/bar/icon_theme.c | 0 sway/{ => old}/commands/bar/id.c | 0 sway/{ => old}/commands/bar/mode.c | 0 sway/{ => old}/commands/bar/modifier.c | 0 sway/{ => old}/commands/bar/output.c | 0 sway/{ => old}/commands/bar/pango_markup.c | 0 sway/{ => old}/commands/bar/position.c | 0 .../{ => old}/commands/bar/secondary_button.c | 0 .../{ => old}/commands/bar/separator_symbol.c | 0 sway/{ => old}/commands/bar/status_command.c | 0 .../commands/bar/strip_workspace_numbers.c | 0 sway/{ => old}/commands/bar/swaybar_command.c | 0 sway/{ => old}/commands/bar/tray_output.c | 0 sway/{ => old}/commands/bar/tray_padding.c | 0 .../commands/bar/workspace_buttons.c | 0 sway/{ => old}/commands/bar/wrap_scroll.c | 0 sway/{ => old}/commands/bind.c | 0 sway/{ => old}/commands/border.c | 0 sway/{ => old}/commands/client.c | 0 sway/{ => old}/commands/clipboard.c | 0 sway/{ => old}/commands/commands.c | 0 sway/{ => old}/commands/debuglog.c | 0 sway/{ => old}/commands/default_border.c | 0 .../commands/default_floating_border.c | 0 sway/{ => old}/commands/exec.c | 0 sway/{ => old}/commands/exec_always.c | 0 sway/{ => old}/commands/exit.c | 0 sway/{ => old}/commands/floating.c | 0 .../commands/floating_maximum_size.c | 0 .../commands/floating_minimum_size.c | 0 sway/{ => old}/commands/floating_mod.c | 0 sway/{ => old}/commands/floating_scroll.c | 0 sway/{ => old}/commands/focus.c | 0 sway/{ => old}/commands/focus_follows_mouse.c | 0 sway/{ => old}/commands/font.c | 0 sway/{ => old}/commands/for_window.c | 0 .../{ => old}/commands/force_focus_wrapping.c | 0 sway/{ => old}/commands/fullscreen.c | 0 sway/{ => old}/commands/gaps.c | 0 sway/{ => old}/commands/hide_edge_borders.c | 0 sway/{ => old}/commands/include.c | 0 sway/{ => old}/commands/input.c | 0 sway/{ => old}/commands/input/accel_profile.c | 0 sway/{ => old}/commands/input/click_method.c | 0 sway/{ => old}/commands/input/drag_lock.c | 0 sway/{ => old}/commands/input/dwt.c | 0 sway/{ => old}/commands/input/events.c | 0 sway/{ => old}/commands/input/left_handed.c | 0 .../commands/input/middle_emulation.c | 0 .../{ => old}/commands/input/natural_scroll.c | 0 sway/{ => old}/commands/input/pointer_accel.c | 0 sway/{ => old}/commands/input/scroll_method.c | 0 sway/{ => old}/commands/input/tap.c | 0 sway/{ => old}/commands/ipc.c | 0 sway/{ => old}/commands/kill.c | 0 sway/{ => old}/commands/layout.c | 0 sway/{ => old}/commands/log_colors.c | 0 sway/{ => old}/commands/mark.c | 0 sway/{ => old}/commands/mode.c | 0 sway/{ => old}/commands/mouse_warping.c | 0 sway/{ => old}/commands/move.c | 0 sway/{ => old}/commands/new_float.c | 0 sway/{ => old}/commands/new_window.c | 0 sway/{ => old}/commands/no_focus.c | 0 sway/{ => old}/commands/orientation.c | 0 sway/{ => old}/commands/output.c | 0 sway/{ => old}/commands/permit.c | 0 sway/{ => old}/commands/reload.c | 0 sway/{ => old}/commands/resize.c | 0 sway/{ => old}/commands/scratchpad.c | 0 sway/{ => old}/commands/seamless_mouse.c | 0 sway/{ => old}/commands/set.c | 0 sway/{ => old}/commands/show_marks.c | 0 sway/{ => old}/commands/smart_gaps.c | 0 sway/{ => old}/commands/split.c | 0 sway/{ => old}/commands/sticky.c | 0 sway/{ => old}/commands/unmark.c | 0 sway/{ => old}/commands/workspace.c | 0 .../commands/workspace_auto_back_and_forth.c | 0 sway/{ => old}/commands/workspace_layout.c | 0 sway/{ => old}/config.c | 138 +----------------- sway/{tree => old}/container.c | 0 sway/{tree => old}/criteria.c | 0 sway/{tree => old}/focus.c | 0 sway/{ => old}/handlers.c | 0 sway/{ => old}/input_state.c | 0 sway/{ => old}/ipc-json.c | 0 sway/{ => old}/ipc-server.c | 5 - sway/{tree => old}/layout.c | 0 sway/{tree => old}/output.c | 0 sway/{ => old}/security.c | 0 sway/{tree => old}/workspace.c | 0 sway/server.c | 2 - 128 files changed, 76 insertions(+), 430 deletions(-) delete mode 100644 include/sway.h delete mode 100644 include/sway/handlers.h rename include/sway/{ => old}/border.h (100%) rename include/sway/{ => old}/commands.h (100%) rename include/sway/{ => old}/config.h (100%) rename include/sway/{ => old}/container.h (100%) rename include/sway/{ => old}/criteria.h (100%) rename include/sway/{ => old}/focus.h (100%) rename include/sway/{ => old}/input.h (100%) rename include/sway/{ => old}/input_state.h (100%) rename include/sway/{ => old}/ipc-json.h (100%) rename include/sway/{ => old}/ipc-server.h (89%) rename include/sway/{ => old}/layout.h (100%) create mode 100644 include/sway/old/output.h rename include/sway/{ => old}/workspace.h (100%) delete mode 100644 sway/debug_log.c rename sway/{ => old}/border.c (100%) rename sway/{ => old}/commands.c (100%) rename sway/{ => old}/commands/assign.c (100%) rename sway/{ => old}/commands/bar.c (100%) rename sway/{ => old}/commands/bar/activate_button.c (100%) rename sway/{ => old}/commands/bar/binding_mode_indicator.c (100%) rename sway/{ => old}/commands/bar/bindsym.c (100%) rename sway/{ => old}/commands/bar/colors.c (100%) rename sway/{ => old}/commands/bar/context_button.c (100%) rename sway/{ => old}/commands/bar/font.c (100%) rename sway/{ => old}/commands/bar/height.c (100%) rename sway/{ => old}/commands/bar/hidden_state.c (100%) rename sway/{ => old}/commands/bar/icon_theme.c (100%) rename sway/{ => old}/commands/bar/id.c (100%) rename sway/{ => old}/commands/bar/mode.c (100%) rename sway/{ => old}/commands/bar/modifier.c (100%) rename sway/{ => old}/commands/bar/output.c (100%) rename sway/{ => old}/commands/bar/pango_markup.c (100%) rename sway/{ => old}/commands/bar/position.c (100%) rename sway/{ => old}/commands/bar/secondary_button.c (100%) rename sway/{ => old}/commands/bar/separator_symbol.c (100%) rename sway/{ => old}/commands/bar/status_command.c (100%) rename sway/{ => old}/commands/bar/strip_workspace_numbers.c (100%) rename sway/{ => old}/commands/bar/swaybar_command.c (100%) rename sway/{ => old}/commands/bar/tray_output.c (100%) rename sway/{ => old}/commands/bar/tray_padding.c (100%) rename sway/{ => old}/commands/bar/workspace_buttons.c (100%) rename sway/{ => old}/commands/bar/wrap_scroll.c (100%) rename sway/{ => old}/commands/bind.c (100%) rename sway/{ => old}/commands/border.c (100%) rename sway/{ => old}/commands/client.c (100%) rename sway/{ => old}/commands/clipboard.c (100%) rename sway/{ => old}/commands/commands.c (100%) rename sway/{ => old}/commands/debuglog.c (100%) rename sway/{ => old}/commands/default_border.c (100%) rename sway/{ => old}/commands/default_floating_border.c (100%) rename sway/{ => old}/commands/exec.c (100%) rename sway/{ => old}/commands/exec_always.c (100%) rename sway/{ => old}/commands/exit.c (100%) rename sway/{ => old}/commands/floating.c (100%) rename sway/{ => old}/commands/floating_maximum_size.c (100%) rename sway/{ => old}/commands/floating_minimum_size.c (100%) rename sway/{ => old}/commands/floating_mod.c (100%) rename sway/{ => old}/commands/floating_scroll.c (100%) rename sway/{ => old}/commands/focus.c (100%) rename sway/{ => old}/commands/focus_follows_mouse.c (100%) rename sway/{ => old}/commands/font.c (100%) rename sway/{ => old}/commands/for_window.c (100%) rename sway/{ => old}/commands/force_focus_wrapping.c (100%) rename sway/{ => old}/commands/fullscreen.c (100%) rename sway/{ => old}/commands/gaps.c (100%) rename sway/{ => old}/commands/hide_edge_borders.c (100%) rename sway/{ => old}/commands/include.c (100%) rename sway/{ => old}/commands/input.c (100%) rename sway/{ => old}/commands/input/accel_profile.c (100%) rename sway/{ => old}/commands/input/click_method.c (100%) rename sway/{ => old}/commands/input/drag_lock.c (100%) rename sway/{ => old}/commands/input/dwt.c (100%) rename sway/{ => old}/commands/input/events.c (100%) rename sway/{ => old}/commands/input/left_handed.c (100%) rename sway/{ => old}/commands/input/middle_emulation.c (100%) rename sway/{ => old}/commands/input/natural_scroll.c (100%) rename sway/{ => old}/commands/input/pointer_accel.c (100%) rename sway/{ => old}/commands/input/scroll_method.c (100%) rename sway/{ => old}/commands/input/tap.c (100%) rename sway/{ => old}/commands/ipc.c (100%) rename sway/{ => old}/commands/kill.c (100%) rename sway/{ => old}/commands/layout.c (100%) rename sway/{ => old}/commands/log_colors.c (100%) rename sway/{ => old}/commands/mark.c (100%) rename sway/{ => old}/commands/mode.c (100%) rename sway/{ => old}/commands/mouse_warping.c (100%) rename sway/{ => old}/commands/move.c (100%) rename sway/{ => old}/commands/new_float.c (100%) rename sway/{ => old}/commands/new_window.c (100%) rename sway/{ => old}/commands/no_focus.c (100%) rename sway/{ => old}/commands/orientation.c (100%) rename sway/{ => old}/commands/output.c (100%) rename sway/{ => old}/commands/permit.c (100%) rename sway/{ => old}/commands/reload.c (100%) rename sway/{ => old}/commands/resize.c (100%) rename sway/{ => old}/commands/scratchpad.c (100%) rename sway/{ => old}/commands/seamless_mouse.c (100%) rename sway/{ => old}/commands/set.c (100%) rename sway/{ => old}/commands/show_marks.c (100%) rename sway/{ => old}/commands/smart_gaps.c (100%) rename sway/{ => old}/commands/split.c (100%) rename sway/{ => old}/commands/sticky.c (100%) rename sway/{ => old}/commands/unmark.c (100%) rename sway/{ => old}/commands/workspace.c (100%) rename sway/{ => old}/commands/workspace_auto_back_and_forth.c (100%) rename sway/{ => old}/commands/workspace_layout.c (100%) rename sway/{ => old}/config.c (88%) rename sway/{tree => old}/container.c (100%) rename sway/{tree => old}/criteria.c (100%) rename sway/{tree => old}/focus.c (100%) rename sway/{ => old}/handlers.c (100%) rename sway/{ => old}/input_state.c (100%) rename sway/{ => old}/ipc-json.c (100%) rename sway/{ => old}/ipc-server.c (99%) rename sway/{tree => old}/layout.c (100%) rename sway/{tree => old}/output.c (100%) rename sway/{ => old}/security.c (100%) rename sway/{tree => old}/workspace.c (100%) 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) add_subdirectory(sway) if(enable-swaybg) if(CAIRO_FOUND AND PANGO_FOUND) - add_subdirectory(swaybg) + # TODO WLR + #add_subdirectory(swaybg) else() message(WARNING "Not building swaybg - cairo, and pango are required.") endif() @@ -125,18 +126,21 @@ if(enable-swaymsg) add_subdirectory(swaymsg) endif() if(enable-swaygrab) - add_subdirectory(swaygrab) + # TODO WLR + #add_subdirectory(swaygrab) endif() if(enable-swaybar) if(CAIRO_FOUND AND PANGO_FOUND) - add_subdirectory(swaybar) + # TODO WLR + #add_subdirectory(swaybar) else() message(WARNING "Not building swaybar - cairo, and pango are required.") endif() endif() if(enable-swaylock) if(CAIRO_FOUND AND PANGO_FOUND AND PAM_FOUND) - add_subdirectory(swaylock) + # TODO WLR + #add_subdirectory(swaylock) else() message(WARNING "Not building swaylock - cairo, pango, and PAM are required.") 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 @@ #include #include #include "log.h" -#include "sway.h" #include "readline.h" static int colored = 1; @@ -117,6 +116,7 @@ void _sway_log(const char *filename, int line, log_importance_t verbosity, const va_end(args); } +void sway_terminate(int code); void _sway_abort(const char *filename, int line, const char* format, ...) { 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 @@ -#ifndef _SWAY_SWAY_H -#define _SWAY_SWAY_H - -void sway_terminate(int exit_code); - -#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 @@ -#ifndef _SWAY_HANDLERS_H -#define _SWAY_HANDLERS_H -#include "container.h" -#include -#include - -void register_wlc_handlers(); - -extern uint32_t keys_pressed[32]; - -#endif diff --git a/include/sway/border.h b/include/sway/old/border.h similarity index 100% rename from include/sway/border.h rename to include/sway/old/border.h diff --git a/include/sway/commands.h b/include/sway/old/commands.h similarity index 100% rename from include/sway/commands.h rename to include/sway/old/commands.h diff --git a/include/sway/config.h b/include/sway/old/config.h similarity index 100% rename from include/sway/config.h rename to include/sway/old/config.h diff --git a/include/sway/container.h b/include/sway/old/container.h similarity index 100% rename from include/sway/container.h rename to include/sway/old/container.h diff --git a/include/sway/criteria.h b/include/sway/old/criteria.h similarity index 100% rename from include/sway/criteria.h rename to include/sway/old/criteria.h diff --git a/include/sway/focus.h b/include/sway/old/focus.h similarity index 100% rename from include/sway/focus.h rename to include/sway/old/focus.h diff --git a/include/sway/input.h b/include/sway/old/input.h similarity index 100% rename from include/sway/input.h rename to include/sway/old/input.h diff --git a/include/sway/input_state.h b/include/sway/old/input_state.h similarity index 100% rename from include/sway/input_state.h rename to include/sway/old/input_state.h diff --git a/include/sway/ipc-json.h b/include/sway/old/ipc-json.h similarity index 100% rename from include/sway/ipc-json.h rename to include/sway/old/ipc-json.h diff --git a/include/sway/ipc-server.h b/include/sway/old/ipc-server.h similarity index 89% rename from include/sway/ipc-server.h rename to 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 @@ #ifndef _SWAY_IPC_SERVER_H #define _SWAY_IPC_SERVER_H - -#include - #include "container.h" #include "config.h" #include "ipc.h" @@ -33,9 +30,4 @@ void ipc_event_modifier(uint32_t modifier, const char *state); void ipc_event_binding_keyboard(struct sway_binding *sb); const char *swayc_type_string(enum swayc_types type); -/** - * Send pixel data to registered clients. - */ -void ipc_get_pixels(wlc_handle output); - #endif diff --git a/include/sway/layout.h b/include/sway/old/layout.h similarity index 100% rename from include/sway/layout.h rename to 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 @@ +#ifndef _SWAY_OUTPUT_H +#define _SWAY_OUTPUT_H +#include +#include +#include +#include "container.h" +#include "focus.h" + +struct sway_server; + +struct sway_output { + struct wlr_output *wlr_output; + struct wl_listener frame; + struct sway_server *server; + struct timespec last_frame; +}; + +// Position is absolute coordinates on the edge where the adjacent output +// should be searched for. +swayc_t *output_by_name(const char* name, const struct wlc_point *abs_pos); +swayc_t *swayc_opposite_output(enum movement_direction dir, const struct wlc_point *abs_pos); +swayc_t *swayc_adjacent_output(swayc_t *output, enum movement_direction dir, const struct wlc_point *abs_pos, bool pick_closest); + +// Place absolute coordinates for given container into given wlc_point. +void get_absolute_position(swayc_t *container, struct wlc_point *point); + +// Place absolute coordinates for the center point of given container into +// given wlc_point. +void get_absolute_center_position(swayc_t *container, struct wlc_point *point); + +// stable sort workspaces on this output +void sort_workspaces(swayc_t *output); + +void output_get_scaled_size(wlc_handle handle, struct wlc_size *size); + +#endif diff --git a/include/sway/workspace.h b/include/sway/old/workspace.h similarity index 100% rename from include/sway/workspace.h rename to 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 @@ #include #include #include -#include "container.h" -#include "focus.h" struct sway_server; struct sway_output { struct wlr_output *wlr_output; - struct wl_listener frame; struct sway_server *server; struct timespec last_frame; + struct wl_listener frame; }; -// Position is absolute coordinates on the edge where the adjacent output -// should be searched for. -swayc_t *output_by_name(const char* name, const struct wlc_point *abs_pos); -swayc_t *swayc_opposite_output(enum movement_direction dir, const struct wlc_point *abs_pos); -swayc_t *swayc_adjacent_output(swayc_t *output, enum movement_direction dir, const struct wlc_point *abs_pos, bool pick_closest); - -// Place absolute coordinates for given container into given wlc_point. -void get_absolute_position(swayc_t *container, struct wlc_point *point); - -// Place absolute coordinates for the center point of given container into -// given wlc_point. -void get_absolute_center_position(swayc_t *container, struct wlc_point *point); - -// stable sort workspaces on this output -void sort_workspaces(swayc_t *output); - -void output_get_scaled_size(wlc_handle handle, struct wlc_size *size); - #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 @@ include_directories( ${PROTOCOLS_INCLUDE_DIRS} - ${WLC_INCLUDE_DIRS} ${WLR_INCLUDE_DIRS} ${PCRE_INCLUDE_DIRS} ${JSONC_INCLUDE_DIRS} @@ -11,37 +10,12 @@ include_directories( ${WAYLAND_INCLUDE_DIR} ) -file(GLOB cmds - "commands/*.c" - "commands/bar/*.c" - "commands/input/*.c" -) - add_executable(sway desktop/output.c desktop/xdg_shell_v6.c - tree/container.c - tree/criteria.c - tree/focus.c - tree/output.c - tree/workspace.c - tree/layout.c - - input/input.c - - commands.c - ${cmds} - base64.c - config.c - debug_log.c - input_state.c - ipc-json.c - ipc-server.c main.c - border.c - security.c server.c ) @@ -53,7 +27,6 @@ target_link_libraries(sway sway-common sway-protocols sway-wayland - ${WLC_LIBRARIES} ${WLR_LIBRARIES} ${XKBCOMMON_LIBRARIES} ${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 @@ -#include "log.h" -#include "sway.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "sway/workspace.h" - -/* XXX:DEBUG:XXX */ -static void container_log(const swayc_t *c, int depth) { - fprintf(stderr, "focus:%c", - c == get_focused_view(&root_container) ? 'K': - c == get_focused_container(&root_container) ? 'F' : // Focused - c == swayc_active_workspace() ? 'W' : // active workspace - c == &root_container ? 'R' : // root - 'X');// not any others - for (int i = 6; i > depth; i--) { fprintf(stderr, " "); } - fprintf(stderr,"|(%p)",c); - fprintf(stderr,"(p:%-8p)",c->parent); - fprintf(stderr,"(f:%-8p)",c->focused); - fprintf(stderr,"(h:%2" PRIuPTR ")",c->handle); - fprintf(stderr,"Type:%-4s|", - c->type == C_ROOT ? "root" : - c->type == C_OUTPUT ? "op" : - c->type == C_WORKSPACE ? "ws" : - c->type == C_CONTAINER ? "cont" : - c->type == C_VIEW ? "view" : "?"); - fprintf(stderr,"layout:%-5s|", - c->layout == L_NONE ? "-" : - c->layout == L_HORIZ ? "Horiz": - c->layout == L_VERT ? "Vert": - c->layout == L_STACKED ? "Stack": - c->layout == L_TABBED ? "Tab": - c->layout == L_FLOATING ? "Float": - c->layout == L_AUTO_LEFT ? "A_lft": - c->layout == L_AUTO_RIGHT ? "A_rgt": - c->layout == L_AUTO_TOP ? "A_top": - c->layout == L_AUTO_BOTTOM ? "A_bot": - "Unknown"); - fprintf(stderr, "w:%4.f|h:%4.f|", c->width, c->height); - fprintf(stderr, "x:%4.f|y:%4.f|", c->x, c->y); - fprintf(stderr, "g:%3d|",c->gaps); - fprintf(stderr, "vis:%c|", c->visible?'t':'f'); - fprintf(stderr, "children:%2d|",c->children?c->children->length:0); - fprintf(stderr, "name:%.16s\n", c->name); -} -void layout_log(const swayc_t *c, int depth) { - if (L_DEBUG > get_log_level()) return; - int i, d; - int e = c->children ? c->children->length : 0; - container_log(c, depth); - if (e) { - for (i = 0; i < e; ++i) { - fputc('|',stderr); - for (d = 0; d < depth; ++d) fputc('-', stderr); - layout_log(c->children->items[i], depth + 1); - } - } - if (c->type == C_WORKSPACE) { - e = c->floating?c->floating->length:0; - if (e) { - for (i = 0; i < e; ++i) { - fputc('|',stderr); - for (d = 0; d < depth; ++d) fputc('=', stderr); - layout_log(c->floating->items[i], depth + 1); - } - } - } -} - -const char *swayc_type_string(enum swayc_types type) { - return type == C_ROOT ? "ROOT" : - type == C_OUTPUT ? "OUTPUT" : - type == C_WORKSPACE ? "WORKSPACE" : - type == C_CONTAINER ? "CONTAINER" : - type == C_VIEW ? "VIEW" : - "UNKNOWN"; -} - -// Like sway_log, but also appends some info about given container to log output. -void swayc_log(log_importance_t verbosity, swayc_t *cont, const char* format, ...) { - sway_assert(cont, "swayc_log: no container ..."); - va_list args; - va_start(args, format); - char *txt = malloc(128); - vsprintf(txt, format, args); - va_end(args); - - char *debug_txt = malloc(32); - snprintf(debug_txt, 32, "%s '%s'", swayc_type_string(cont->type), cont->name); - - sway_log(verbosity, "%s (%s)", txt, debug_txt); - free(txt); - free(debug_txt); -} - -/* 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 @@ #include #include #include -#include "sway/server.h" -#include "sway/container.h" -#include "sway/workspace.h" -#include "sway/output.h" #include "log.h" +#include "sway/output.h" +#include "sway/server.h" static void output_frame_notify(struct wl_listener *listener, void *data) { struct sway_output *soutput = wl_container_of( @@ -37,19 +35,10 @@ void output_add_notify(struct wl_listener *listener, void *data) { output->wlr_output = wlr_output; output->server = server; - swayc_t *node = new_output(output); - if (!sway_assert(node, "Failed to allocate output")) { - return; - } - - // Switch to workspace if we need to - if (swayc_active_workspace() == NULL) { - swayc_t *ws = node->children->items[0]; - workspace_switch(ws); - } - output->frame.notify = output_frame_notify; wl_signal_add(&wlr_output->events.frame, &output->frame); + + // TODO: Add to tree } void 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 @@ #include #include #include -#include "sway/commands.h" -#include "sway/container.h" -#include "sway/focus.h" -#include "sway/ipc-server.h" #include "sway/server.h" #include "sway/view.h" #include "log.h" -// TODO: move elsewhere -static void temp_ws_cleanup() { - swayc_t *op, *ws; - int i = 0, j; - if (!root_container.children) - return; - while (i < root_container.children->length) { - op = root_container.children->items[i++]; - if (!op->children) - continue; - j = 0; - while (j < op->children->length) { - ws = op->children->items[j++]; - if (ws->children->length == 0 && ws->floating->length == 0 && ws != op->focused) { - if (destroy_workspace(ws)) { - j--; - } - } - } - } -} - -// TODO: move elsewhere -static swayc_t *move_focus_to_tiling(swayc_t *focused) { - if (focused->is_floating) { - if (focused->parent->children->length == 0) { - return focused->parent; - } - // TODO find a better way of doing this - // Or to focused container - return get_focused_container(focused->parent->children->items[0]); - } - return focused; -} - static const char *get_prop(struct sway_view *view, enum sway_view_prop prop) { if (!sway_assert(view->type == SWAY_XDG_SHELL_V6_VIEW, "xdg get_prop for non-xdg view!")) { @@ -88,30 +49,10 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { sway_surface->view = sway_view; // TODO: - // - Consolodate common logic between shells + // - Add to tree // - Wire up listeners // - Handle popups // - Look up pid and open on appropriate workspace // - Set new view to maximized so it behaves nicely // - Criteria - - suspend_workspace_cleanup = true; - //swayc_t *current_ws = swayc_active_workspace(); - swayc_t *prev_focus = get_focused_container(&root_container); - swayc_t *focused = move_focus_to_tiling(prev_focus); - - // TODO: fix new_view - swayc_t *view = new_view(focused, sway_view); - ipc_event_window(view, "new"); - set_focused_container(view); - - swayc_t *output = swayc_parent_by_type(view, C_OUTPUT); - arrange_windows(output, -1, -1); - - swayc_t *workspace = swayc_parent_by_type(focused, C_WORKSPACE); - if (workspace && workspace->fullscreen) { - set_focused_container(workspace->fullscreen); - } - suspend_workspace_cleanup = false; - temp_ws_cleanup(); } 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 @@ #define _XOPEN_SOURCE 700 #define _POSIX_C_SOURCE 200112L -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef __linux__ #include #include #endif -#include "sway/layout.h" -#include "sway/config.h" -#include "sway/security.h" -#include "sway/handlers.h" -#include "sway/input.h" -#include "sway/ipc-server.h" #include "sway/server.h" #include "ipc-client.h" #include "readline.h" #include "stringop.h" -#include "sway.h" #include "log.h" #include "util.h" @@ -39,7 +33,7 @@ void sway_terminate(int exit_code) { } void sig_handler(int signal) { - close_views(&root_container); + //close_views(&root_container); sway_terminate(EXIT_SUCCESS); } @@ -442,17 +436,17 @@ int main(int argc, char **argv) { return 1; } - init_layout(); - ipc_init(); + //init_layout(); + //ipc_init(); - if (validate) { - bool valid = load_main_config(config_path, false); - return valid ? 0 : 1; - } + //if (validate) { + // bool valid = load_main_config(config_path, false); + // return valid ? 0 : 1; + //} - if (!load_main_config(config_path, false)) { - sway_terminate(EXIT_FAILURE); - } + //if (!load_main_config(config_path, false)) { + // sway_terminate(EXIT_FAILURE); + //} if (config_path) { free(config_path); @@ -466,11 +460,11 @@ int main(int argc, char **argv) { server_fini(&server); - ipc_terminate(); + //ipc_terminate(); - if (config) { - free_config(config); - } + //if (config) { + // free_config(config); + //} return exit_value; } diff --git a/sway/border.c b/sway/old/border.c similarity index 100% rename from sway/border.c rename to sway/old/border.c diff --git a/sway/commands.c b/sway/old/commands.c similarity index 100% rename from sway/commands.c rename to sway/old/commands.c diff --git a/sway/commands/assign.c b/sway/old/commands/assign.c similarity index 100% rename from sway/commands/assign.c rename to sway/old/commands/assign.c diff --git a/sway/commands/bar.c b/sway/old/commands/bar.c similarity index 100% rename from sway/commands/bar.c rename to sway/old/commands/bar.c diff --git a/sway/commands/bar/activate_button.c b/sway/old/commands/bar/activate_button.c similarity index 100% rename from sway/commands/bar/activate_button.c rename to 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 similarity index 100% rename from sway/commands/bar/binding_mode_indicator.c rename to sway/old/commands/bar/binding_mode_indicator.c diff --git a/sway/commands/bar/bindsym.c b/sway/old/commands/bar/bindsym.c similarity index 100% rename from sway/commands/bar/bindsym.c rename to sway/old/commands/bar/bindsym.c diff --git a/sway/commands/bar/colors.c b/sway/old/commands/bar/colors.c similarity index 100% rename from sway/commands/bar/colors.c rename to sway/old/commands/bar/colors.c diff --git a/sway/commands/bar/context_button.c b/sway/old/commands/bar/context_button.c similarity index 100% rename from sway/commands/bar/context_button.c rename to sway/old/commands/bar/context_button.c diff --git a/sway/commands/bar/font.c b/sway/old/commands/bar/font.c similarity index 100% rename from sway/commands/bar/font.c rename to sway/old/commands/bar/font.c diff --git a/sway/commands/bar/height.c b/sway/old/commands/bar/height.c similarity index 100% rename from sway/commands/bar/height.c rename to sway/old/commands/bar/height.c diff --git a/sway/commands/bar/hidden_state.c b/sway/old/commands/bar/hidden_state.c similarity index 100% rename from sway/commands/bar/hidden_state.c rename to sway/old/commands/bar/hidden_state.c diff --git a/sway/commands/bar/icon_theme.c b/sway/old/commands/bar/icon_theme.c similarity index 100% rename from sway/commands/bar/icon_theme.c rename to sway/old/commands/bar/icon_theme.c diff --git a/sway/commands/bar/id.c b/sway/old/commands/bar/id.c similarity index 100% rename from sway/commands/bar/id.c rename to sway/old/commands/bar/id.c diff --git a/sway/commands/bar/mode.c b/sway/old/commands/bar/mode.c similarity index 100% rename from sway/commands/bar/mode.c rename to sway/old/commands/bar/mode.c diff --git a/sway/commands/bar/modifier.c b/sway/old/commands/bar/modifier.c similarity index 100% rename from sway/commands/bar/modifier.c rename to sway/old/commands/bar/modifier.c diff --git a/sway/commands/bar/output.c b/sway/old/commands/bar/output.c similarity index 100% rename from sway/commands/bar/output.c rename to sway/old/commands/bar/output.c diff --git a/sway/commands/bar/pango_markup.c b/sway/old/commands/bar/pango_markup.c similarity index 100% rename from sway/commands/bar/pango_markup.c rename to sway/old/commands/bar/pango_markup.c diff --git a/sway/commands/bar/position.c b/sway/old/commands/bar/position.c similarity index 100% rename from sway/commands/bar/position.c rename to sway/old/commands/bar/position.c diff --git a/sway/commands/bar/secondary_button.c b/sway/old/commands/bar/secondary_button.c similarity index 100% rename from sway/commands/bar/secondary_button.c rename to sway/old/commands/bar/secondary_button.c diff --git a/sway/commands/bar/separator_symbol.c b/sway/old/commands/bar/separator_symbol.c similarity index 100% rename from sway/commands/bar/separator_symbol.c rename to sway/old/commands/bar/separator_symbol.c diff --git a/sway/commands/bar/status_command.c b/sway/old/commands/bar/status_command.c similarity index 100% rename from sway/commands/bar/status_command.c rename to 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 similarity index 100% rename from sway/commands/bar/strip_workspace_numbers.c rename to 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 similarity index 100% rename from sway/commands/bar/swaybar_command.c rename to sway/old/commands/bar/swaybar_command.c diff --git a/sway/commands/bar/tray_output.c b/sway/old/commands/bar/tray_output.c similarity index 100% rename from sway/commands/bar/tray_output.c rename to sway/old/commands/bar/tray_output.c diff --git a/sway/commands/bar/tray_padding.c b/sway/old/commands/bar/tray_padding.c similarity index 100% rename from sway/commands/bar/tray_padding.c rename to sway/old/commands/bar/tray_padding.c diff --git a/sway/commands/bar/workspace_buttons.c b/sway/old/commands/bar/workspace_buttons.c similarity index 100% rename from sway/commands/bar/workspace_buttons.c rename to sway/old/commands/bar/workspace_buttons.c diff --git a/sway/commands/bar/wrap_scroll.c b/sway/old/commands/bar/wrap_scroll.c similarity index 100% rename from sway/commands/bar/wrap_scroll.c rename to sway/old/commands/bar/wrap_scroll.c diff --git a/sway/commands/bind.c b/sway/old/commands/bind.c similarity index 100% rename from sway/commands/bind.c rename to sway/old/commands/bind.c diff --git a/sway/commands/border.c b/sway/old/commands/border.c similarity index 100% rename from sway/commands/border.c rename to sway/old/commands/border.c diff --git a/sway/commands/client.c b/sway/old/commands/client.c similarity index 100% rename from sway/commands/client.c rename to sway/old/commands/client.c diff --git a/sway/commands/clipboard.c b/sway/old/commands/clipboard.c similarity index 100% rename from sway/commands/clipboard.c rename to sway/old/commands/clipboard.c diff --git a/sway/commands/commands.c b/sway/old/commands/commands.c similarity index 100% rename from sway/commands/commands.c rename to sway/old/commands/commands.c diff --git a/sway/commands/debuglog.c b/sway/old/commands/debuglog.c similarity index 100% rename from sway/commands/debuglog.c rename to sway/old/commands/debuglog.c diff --git a/sway/commands/default_border.c b/sway/old/commands/default_border.c similarity index 100% rename from sway/commands/default_border.c rename to sway/old/commands/default_border.c diff --git a/sway/commands/default_floating_border.c b/sway/old/commands/default_floating_border.c similarity index 100% rename from sway/commands/default_floating_border.c rename to sway/old/commands/default_floating_border.c diff --git a/sway/commands/exec.c b/sway/old/commands/exec.c similarity index 100% rename from sway/commands/exec.c rename to sway/old/commands/exec.c diff --git a/sway/commands/exec_always.c b/sway/old/commands/exec_always.c similarity index 100% rename from sway/commands/exec_always.c rename to sway/old/commands/exec_always.c diff --git a/sway/commands/exit.c b/sway/old/commands/exit.c similarity index 100% rename from sway/commands/exit.c rename to sway/old/commands/exit.c diff --git a/sway/commands/floating.c b/sway/old/commands/floating.c similarity index 100% rename from sway/commands/floating.c rename to sway/old/commands/floating.c diff --git a/sway/commands/floating_maximum_size.c b/sway/old/commands/floating_maximum_size.c similarity index 100% rename from sway/commands/floating_maximum_size.c rename to sway/old/commands/floating_maximum_size.c diff --git a/sway/commands/floating_minimum_size.c b/sway/old/commands/floating_minimum_size.c similarity index 100% rename from sway/commands/floating_minimum_size.c rename to sway/old/commands/floating_minimum_size.c diff --git a/sway/commands/floating_mod.c b/sway/old/commands/floating_mod.c similarity index 100% rename from sway/commands/floating_mod.c rename to sway/old/commands/floating_mod.c diff --git a/sway/commands/floating_scroll.c b/sway/old/commands/floating_scroll.c similarity index 100% rename from sway/commands/floating_scroll.c rename to sway/old/commands/floating_scroll.c diff --git a/sway/commands/focus.c b/sway/old/commands/focus.c similarity index 100% rename from sway/commands/focus.c rename to sway/old/commands/focus.c diff --git a/sway/commands/focus_follows_mouse.c b/sway/old/commands/focus_follows_mouse.c similarity index 100% rename from sway/commands/focus_follows_mouse.c rename to sway/old/commands/focus_follows_mouse.c diff --git a/sway/commands/font.c b/sway/old/commands/font.c similarity index 100% rename from sway/commands/font.c rename to sway/old/commands/font.c diff --git a/sway/commands/for_window.c b/sway/old/commands/for_window.c similarity index 100% rename from sway/commands/for_window.c rename to sway/old/commands/for_window.c diff --git a/sway/commands/force_focus_wrapping.c b/sway/old/commands/force_focus_wrapping.c similarity index 100% rename from sway/commands/force_focus_wrapping.c rename to sway/old/commands/force_focus_wrapping.c diff --git a/sway/commands/fullscreen.c b/sway/old/commands/fullscreen.c similarity index 100% rename from sway/commands/fullscreen.c rename to sway/old/commands/fullscreen.c diff --git a/sway/commands/gaps.c b/sway/old/commands/gaps.c similarity index 100% rename from sway/commands/gaps.c rename to sway/old/commands/gaps.c diff --git a/sway/commands/hide_edge_borders.c b/sway/old/commands/hide_edge_borders.c similarity index 100% rename from sway/commands/hide_edge_borders.c rename to sway/old/commands/hide_edge_borders.c diff --git a/sway/commands/include.c b/sway/old/commands/include.c similarity index 100% rename from sway/commands/include.c rename to sway/old/commands/include.c diff --git a/sway/commands/input.c b/sway/old/commands/input.c similarity index 100% rename from sway/commands/input.c rename to sway/old/commands/input.c diff --git a/sway/commands/input/accel_profile.c b/sway/old/commands/input/accel_profile.c similarity index 100% rename from sway/commands/input/accel_profile.c rename to sway/old/commands/input/accel_profile.c diff --git a/sway/commands/input/click_method.c b/sway/old/commands/input/click_method.c similarity index 100% rename from sway/commands/input/click_method.c rename to sway/old/commands/input/click_method.c diff --git a/sway/commands/input/drag_lock.c b/sway/old/commands/input/drag_lock.c similarity index 100% rename from sway/commands/input/drag_lock.c rename to sway/old/commands/input/drag_lock.c diff --git a/sway/commands/input/dwt.c b/sway/old/commands/input/dwt.c similarity index 100% rename from sway/commands/input/dwt.c rename to sway/old/commands/input/dwt.c diff --git a/sway/commands/input/events.c b/sway/old/commands/input/events.c similarity index 100% rename from sway/commands/input/events.c rename to sway/old/commands/input/events.c diff --git a/sway/commands/input/left_handed.c b/sway/old/commands/input/left_handed.c similarity index 100% rename from sway/commands/input/left_handed.c rename to sway/old/commands/input/left_handed.c diff --git a/sway/commands/input/middle_emulation.c b/sway/old/commands/input/middle_emulation.c similarity index 100% rename from sway/commands/input/middle_emulation.c rename to sway/old/commands/input/middle_emulation.c diff --git a/sway/commands/input/natural_scroll.c b/sway/old/commands/input/natural_scroll.c similarity index 100% rename from sway/commands/input/natural_scroll.c rename to sway/old/commands/input/natural_scroll.c diff --git a/sway/commands/input/pointer_accel.c b/sway/old/commands/input/pointer_accel.c similarity index 100% rename from sway/commands/input/pointer_accel.c rename to sway/old/commands/input/pointer_accel.c diff --git a/sway/commands/input/scroll_method.c b/sway/old/commands/input/scroll_method.c similarity index 100% rename from sway/commands/input/scroll_method.c rename to sway/old/commands/input/scroll_method.c diff --git a/sway/commands/input/tap.c b/sway/old/commands/input/tap.c similarity index 100% rename from sway/commands/input/tap.c rename to sway/old/commands/input/tap.c diff --git a/sway/commands/ipc.c b/sway/old/commands/ipc.c similarity index 100% rename from sway/commands/ipc.c rename to sway/old/commands/ipc.c diff --git a/sway/commands/kill.c b/sway/old/commands/kill.c similarity index 100% rename from sway/commands/kill.c rename to sway/old/commands/kill.c diff --git a/sway/commands/layout.c b/sway/old/commands/layout.c similarity index 100% rename from sway/commands/layout.c rename to sway/old/commands/layout.c diff --git a/sway/commands/log_colors.c b/sway/old/commands/log_colors.c similarity index 100% rename from sway/commands/log_colors.c rename to sway/old/commands/log_colors.c diff --git a/sway/commands/mark.c b/sway/old/commands/mark.c similarity index 100% rename from sway/commands/mark.c rename to sway/old/commands/mark.c diff --git a/sway/commands/mode.c b/sway/old/commands/mode.c similarity index 100% rename from sway/commands/mode.c rename to sway/old/commands/mode.c diff --git a/sway/commands/mouse_warping.c b/sway/old/commands/mouse_warping.c similarity index 100% rename from sway/commands/mouse_warping.c rename to sway/old/commands/mouse_warping.c diff --git a/sway/commands/move.c b/sway/old/commands/move.c similarity index 100% rename from sway/commands/move.c rename to sway/old/commands/move.c diff --git a/sway/commands/new_float.c b/sway/old/commands/new_float.c similarity index 100% rename from sway/commands/new_float.c rename to sway/old/commands/new_float.c diff --git a/sway/commands/new_window.c b/sway/old/commands/new_window.c similarity index 100% rename from sway/commands/new_window.c rename to sway/old/commands/new_window.c diff --git a/sway/commands/no_focus.c b/sway/old/commands/no_focus.c similarity index 100% rename from sway/commands/no_focus.c rename to sway/old/commands/no_focus.c diff --git a/sway/commands/orientation.c b/sway/old/commands/orientation.c similarity index 100% rename from sway/commands/orientation.c rename to sway/old/commands/orientation.c diff --git a/sway/commands/output.c b/sway/old/commands/output.c similarity index 100% rename from sway/commands/output.c rename to sway/old/commands/output.c diff --git a/sway/commands/permit.c b/sway/old/commands/permit.c similarity index 100% rename from sway/commands/permit.c rename to sway/old/commands/permit.c diff --git a/sway/commands/reload.c b/sway/old/commands/reload.c similarity index 100% rename from sway/commands/reload.c rename to sway/old/commands/reload.c diff --git a/sway/commands/resize.c b/sway/old/commands/resize.c similarity index 100% rename from sway/commands/resize.c rename to sway/old/commands/resize.c diff --git a/sway/commands/scratchpad.c b/sway/old/commands/scratchpad.c similarity index 100% rename from sway/commands/scratchpad.c rename to sway/old/commands/scratchpad.c diff --git a/sway/commands/seamless_mouse.c b/sway/old/commands/seamless_mouse.c similarity index 100% rename from sway/commands/seamless_mouse.c rename to sway/old/commands/seamless_mouse.c diff --git a/sway/commands/set.c b/sway/old/commands/set.c similarity index 100% rename from sway/commands/set.c rename to sway/old/commands/set.c diff --git a/sway/commands/show_marks.c b/sway/old/commands/show_marks.c similarity index 100% rename from sway/commands/show_marks.c rename to sway/old/commands/show_marks.c diff --git a/sway/commands/smart_gaps.c b/sway/old/commands/smart_gaps.c similarity index 100% rename from sway/commands/smart_gaps.c rename to sway/old/commands/smart_gaps.c diff --git a/sway/commands/split.c b/sway/old/commands/split.c similarity index 100% rename from sway/commands/split.c rename to sway/old/commands/split.c diff --git a/sway/commands/sticky.c b/sway/old/commands/sticky.c similarity index 100% rename from sway/commands/sticky.c rename to sway/old/commands/sticky.c diff --git a/sway/commands/unmark.c b/sway/old/commands/unmark.c similarity index 100% rename from sway/commands/unmark.c rename to sway/old/commands/unmark.c diff --git a/sway/commands/workspace.c b/sway/old/commands/workspace.c similarity index 100% rename from sway/commands/workspace.c rename to 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 similarity index 100% rename from sway/commands/workspace_auto_back_and_forth.c rename to sway/old/commands/workspace_auto_back_and_forth.c diff --git a/sway/commands/workspace_layout.c b/sway/old/commands/workspace_layout.c similarity index 100% rename from sway/commands/workspace_layout.c rename to sway/old/commands/workspace_layout.c diff --git a/sway/config.c b/sway/old/config.c similarity index 88% rename from sway/config.c rename to 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) { } static void terminate_swaybar(pid_t pid) { + return; // TODO WLR int ret = kill(pid, SIGTERM); if (ret != 0) { sway_log(L_ERROR, "Unable to terminate swaybar [pid: %d]", pid); @@ -1066,143 +1067,6 @@ void load_swaybars() { list_free(bars); } -void apply_input_config(struct input_config *ic, struct libinput_device *dev) { - if (!ic) { - return; - } - - sway_log(L_DEBUG, "apply_input_config(%s)", ic->identifier); - - if (ic->accel_profile != INT_MIN) { - sway_log(L_DEBUG, "apply_input_config(%s) accel_set_profile(%d)", ic->identifier, ic->accel_profile); - libinput_device_config_accel_set_profile(dev, ic->accel_profile); - } - if (ic->click_method != INT_MIN) { - sway_log(L_DEBUG, "apply_input_config(%s) click_set_method(%d)", ic->identifier, ic->click_method); - libinput_device_config_click_set_method(dev, ic->click_method); - } - if (ic->drag_lock != INT_MIN) { - sway_log(L_DEBUG, "apply_input_config(%s) tap_set_drag_lock_enabled(%d)", ic->identifier, ic->click_method); - libinput_device_config_tap_set_drag_lock_enabled(dev, ic->drag_lock); - } - if (ic->dwt != INT_MIN) { - sway_log(L_DEBUG, "apply_input_config(%s) dwt_set_enabled(%d)", ic->identifier, ic->dwt); - libinput_device_config_dwt_set_enabled(dev, ic->dwt); - } - if (ic->left_handed != INT_MIN) { - sway_log(L_DEBUG, "apply_input_config(%s) left_handed_set_enabled(%d)", ic->identifier, ic->left_handed); - libinput_device_config_left_handed_set(dev, ic->left_handed); - } - if (ic->middle_emulation != INT_MIN) { - sway_log(L_DEBUG, "apply_input_config(%s) middle_emulation_set_enabled(%d)", ic->identifier, ic->middle_emulation); - libinput_device_config_middle_emulation_set_enabled(dev, ic->middle_emulation); - } - if (ic->natural_scroll != INT_MIN) { - sway_log(L_DEBUG, "apply_input_config(%s) natural_scroll_set_enabled(%d)", ic->identifier, ic->natural_scroll); - libinput_device_config_scroll_set_natural_scroll_enabled(dev, ic->natural_scroll); - } - if (ic->pointer_accel != FLT_MIN) { - sway_log(L_DEBUG, "apply_input_config(%s) accel_set_speed(%f)", ic->identifier, ic->pointer_accel); - libinput_device_config_accel_set_speed(dev, ic->pointer_accel); - } - if (ic->scroll_method != INT_MIN) { - sway_log(L_DEBUG, "apply_input_config(%s) scroll_set_method(%d)", ic->identifier, ic->scroll_method); - libinput_device_config_scroll_set_method(dev, ic->scroll_method); - } - if (ic->send_events != INT_MIN) { - sway_log(L_DEBUG, "apply_input_config(%s) send_events_set_mode(%d)", ic->identifier, ic->send_events); - libinput_device_config_send_events_set_mode(dev, ic->send_events); - } - if (ic->tap != INT_MIN) { - sway_log(L_DEBUG, "apply_input_config(%s) tap_set_enabled(%d)", ic->identifier, ic->tap); - libinput_device_config_tap_set_enabled(dev, ic->tap); - } -} - -void apply_output_config(struct output_config *oc, swayc_t *output) { - if (oc && oc->enabled == 0) { - destroy_output(output); - return; - } - - if (oc && oc->width > 0 && oc->height > 0) { - output->width = oc->width; - output->height = oc->height; - - sway_log(L_DEBUG, "Set %s size to %ix%i (%d)", oc->name, oc->width, oc->height, oc->scale); - // TODO WLR: modes - //struct wlc_size new_size = { .w = oc->width, .h = oc->height }; - //wlc_output_set_resolution(output->handle, &new_size, (uint32_t)oc->scale); - } else if (oc) { - //const struct wlc_size *new_size = wlc_output_get_resolution(output->handle); - //wlc_output_set_resolution(output->handle, new_size, (uint32_t)oc->scale); - } - - // TODO WLR: wlr_output_layout - // Find position for it - if (oc && oc->x != -1 && oc->y != -1) { - sway_log(L_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y); - output->x = oc->x; - output->y = oc->y; - } else { - int x = 0; - for (int i = 0; i < root_container.children->length; ++i) { - swayc_t *c = root_container.children->items[i]; - if (c->type == C_OUTPUT) { - if (c->width + c->x > x) { - x = c->width + c->x; - } - } - } - output->x = x; - } - - if (!oc || !oc->background) { - // Look for a * config for background - int i = list_seq_find(config->output_configs, output_name_cmp, "*"); - if (i >= 0) { - oc = config->output_configs->items[i]; - } else { - oc = NULL; - } - } - - int output_i; - for (output_i = 0; output_i < root_container.children->length; ++output_i) { - if (root_container.children->items[output_i] == output) { - break; - } - } - - /* TODO WLR - if (oc && oc->background) { - if (output->bg_pid != 0) { - terminate_swaybg(output->bg_pid); - } - - sway_log(L_DEBUG, "Setting background for output %d to %s", output_i, oc->background); - - size_t bufsize = 12; - char output_id[bufsize]; - snprintf(output_id, bufsize, "%d", output_i); - output_id[bufsize-1] = 0; - - char *const cmd[] = { - "swaybg", - output_id, - oc->background, - oc->background_option, - NULL, - }; - - output->bg_pid = fork(); - if (output->bg_pid == 0) { - execvp(cmd[0], cmd); - } - } - */ -} - char *do_var_replacement(char *str) { int i; char *find = str; diff --git a/sway/tree/container.c b/sway/old/container.c similarity index 100% rename from sway/tree/container.c rename to sway/old/container.c diff --git a/sway/tree/criteria.c b/sway/old/criteria.c similarity index 100% rename from sway/tree/criteria.c rename to sway/old/criteria.c diff --git a/sway/tree/focus.c b/sway/old/focus.c similarity index 100% rename from sway/tree/focus.c rename to sway/old/focus.c diff --git a/sway/handlers.c b/sway/old/handlers.c similarity index 100% rename from sway/handlers.c rename to sway/old/handlers.c diff --git a/sway/input_state.c b/sway/old/input_state.c similarity index 100% rename from sway/input_state.c rename to sway/old/input_state.c diff --git a/sway/ipc-json.c b/sway/old/ipc-json.c similarity index 100% rename from sway/ipc-json.c rename to sway/old/ipc-json.c diff --git a/sway/ipc-server.c b/sway/old/ipc-server.c similarity index 99% rename from sway/ipc-server.c rename to sway/old/ipc-server.c index d4db4e7a..fd64e81b 100644 --- a/sway/ipc-server.c +++ b/sway/old/ipc-server.c @@ -1,10 +1,8 @@ // See https://i3wm.org/docs/ipc.html for protocol information - #ifndef __FreeBSD__ // Any value will hide SOCK_CLOEXEC on FreeBSD (__BSD_VISIBLE=0) #define _XOPEN_SOURCE 700 #endif - #include #include #include @@ -56,8 +54,6 @@ struct ipc_client { char *write_buffer; }; -static list_t *ipc_get_pixel_requests = NULL; - struct sockaddr_un *ipc_user_sockaddr(void); int ipc_handle_connection(int fd, uint32_t mask, void *data); int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data); @@ -97,7 +93,6 @@ void ipc_init(void) { setenv("SWAYSOCK", ipc_sockaddr->sun_path, 1); ipc_client_list = create_list(); - ipc_get_pixel_requests = create_list(); ipc_event_source = wl_event_loop_add_fd(server.wl_event_loop, ipc_socket, WL_EVENT_READABLE, ipc_handle_connection, NULL); diff --git a/sway/tree/layout.c b/sway/old/layout.c similarity index 100% rename from sway/tree/layout.c rename to sway/old/layout.c diff --git a/sway/tree/output.c b/sway/old/output.c similarity index 100% rename from sway/tree/output.c rename to sway/old/output.c diff --git a/sway/security.c b/sway/old/security.c similarity index 100% rename from sway/security.c rename to sway/old/security.c diff --git a/sway/tree/workspace.c b/sway/old/workspace.c similarity index 100% rename from sway/tree/workspace.c rename to 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 @@ // TODO WLR: make Xwayland optional #include #include "sway/server.h" -#include "sway/input.h" #include "log.h" bool server_init(struct sway_server *server) { @@ -23,7 +22,6 @@ bool server_init(struct sway_server *server) { server->renderer = wlr_gles2_renderer_create(server->backend); wl_display_init_shm(server->wl_display); - server->input = sway_input_create(server); server->data_device_manager = wlr_data_device_manager_create(server->wl_display);