Here's the update to i3-4.12. Please test it and report back.
Cheers! David Index: Makefile =================================================================== RCS file: /cvs/ports/x11/i3/Makefile,v retrieving revision 1.103 diff -u -p -u -p -r1.103 Makefile --- Makefile 21 Jan 2016 13:22:58 -0000 1.103 +++ Makefile 8 Mar 2016 09:08:20 -0000 @@ -2,8 +2,7 @@ COMMENT = improved dynamic tiling window manager -DISTNAME = i3-4.11 -REVISION = 3 +DISTNAME = i3-4.12 CATEGORIES = x11 EXTRACT_SUFX = .tar.bz2 Index: distinfo =================================================================== RCS file: /cvs/ports/x11/i3/distinfo,v retrieving revision 1.24 diff -u -p -u -p -r1.24 distinfo --- distinfo 4 Oct 2015 08:48:12 -0000 1.24 +++ distinfo 8 Mar 2016 09:08:20 -0000 @@ -1,2 +1,2 @@ -SHA256 (i3-4.11.tar.bz2) = eM4eBvvZL9Y3ZbviP6p7j5KcF/me1iP3q/LlaBadmC8= -SIZE (i3-4.11.tar.bz2) = 972929 +SHA256 (i3-4.12.tar.bz2) = 4Z4c4IwlScuoPgg8x2jUhyAsQXYNXCg/Z3UueR8deLQ= +SIZE (i3-4.12.tar.bz2) = 988084 Index: patches/patch-common_mk =================================================================== RCS file: /cvs/ports/x11/i3/patches/patch-common_mk,v retrieving revision 1.23 diff -u -p -u -p -r1.23 patch-common_mk --- patches/patch-common_mk 4 Oct 2015 08:48:12 -0000 1.23 +++ patches/patch-common_mk 8 Mar 2016 09:08:20 -0000 @@ -1,7 +1,7 @@ $OpenBSD: patch-common_mk,v 1.23 2015/10/04 08:48:12 dcoppa Exp $ ---- common.mk.orig Wed Sep 30 08:55:10 2015 -+++ common.mk Fri Oct 2 16:58:54 2015 -@@ -162,9 +162,9 @@ I3_LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/us +--- common.mk.orig Sun Mar 6 16:17:18 2016 ++++ common.mk Mon Mar 7 15:15:37 2016 +@@ -171,9 +171,9 @@ I3_LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/us endif ifeq ($(UNAME),OpenBSD) Index: patches/patch-i3-dump-log_main_c =================================================================== RCS file: /cvs/ports/x11/i3/patches/patch-i3-dump-log_main_c,v retrieving revision 1.3 diff -u -p -u -p -r1.3 patch-i3-dump-log_main_c --- patches/patch-i3-dump-log_main_c 30 Mar 2015 12:33:46 -0000 1.3 +++ patches/patch-i3-dump-log_main_c 8 Mar 2016 09:08:20 -0000 @@ -2,8 +2,8 @@ $OpenBSD: patch-i3-dump-log_main_c,v 1.3 OpenBSD lacks pthread_condattr_setpshared() ---- i3-dump-log/main.c.orig Sun Mar 29 19:07:08 2015 -+++ i3-dump-log/main.c Mon Mar 30 14:21:46 2015 +--- i3-dump-log/main.c.orig Sun Mar 6 16:17:18 2016 ++++ i3-dump-log/main.c Mon Mar 7 15:15:37 2016 @@ -28,8 +28,12 @@ #include "shmlog.h" #include <i3/ipc.h> @@ -64,7 +64,7 @@ OpenBSD lacks pthread_condattr_setpshare return 0; } } -@@ -161,6 +181,7 @@ int main(int argc, char *argv[]) { +@@ -162,6 +182,7 @@ int main(int argc, char *argv[]) { walk = logbuffer + sizeof(i3_shmlog_header); print_till_end(); @@ -72,7 +72,7 @@ OpenBSD lacks pthread_condattr_setpshare if (follow) { /* Since pthread_cond_wait() expects a mutex, we need to provide one. * To not lock i3 (that???s bad, mhkay?) we just define one outside of -@@ -176,6 +197,7 @@ int main(int argc, char *argv[]) { +@@ -177,6 +198,7 @@ int main(int argc, char *argv[]) { } } } Index: patches/patch-i3-msg_main_c =================================================================== RCS file: patches/patch-i3-msg_main_c diff -N patches/patch-i3-msg_main_c --- patches/patch-i3-msg_main_c 26 Jan 2016 09:42:35 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,38 +0,0 @@ -$OpenBSD: patch-i3-msg_main_c,v 1.4 2016/01/26 09:42:35 dcoppa Exp $ - -commit a1d1f456a1fbf44bfa5c6a9d041023ac498b0c46 -Author: Theo Buehler <t...@math.ethz.ch> -Date: Thu Jan 14 10:06:34 2016 +0100 - -Add pledge(2) support for OpenBSD - -pledges for i3: -"stdio rpath unix" for talking to the i3 socket usually in /tmp -"proc exec" for executing programs -"wpath cpath" are needed for the restart-in-place functionality - -To make this work, @semarie pointed out that it is sufficient to ensure -that we get physical_mem_bytes only once, namely in init_logging(). - -pledges for i3-msg: -"stdio rpath unix" are needed for talking to the i3-socket - -pledges for i3-nagbar -"rpath getpw" to find the home directory -"wpath cpath" to write the script -"proc exec" to execute the script -"unix" for talking to the i3 socket - ---- i3-msg/main.c.orig Wed Sep 30 08:55:10 2015 -+++ i3-msg/main.c Sun Dec 20 14:42:51 2015 -@@ -119,6 +119,10 @@ static yajl_callbacks reply_callbacks = { - }; - - int main(int argc, char *argv[]) { -+#if defined(__OpenBSD__) -+ if (pledge("stdio rpath unix", NULL) == -1) -+ err(EXIT_FAILURE, "pledge"); -+#endif - char *env_socket_path = getenv("I3SOCK"); - if (env_socket_path) - socket_path = sstrdup(env_socket_path); Index: patches/patch-i3-nagbar_main_c =================================================================== RCS file: /cvs/ports/x11/i3/patches/patch-i3-nagbar_main_c,v retrieving revision 1.9 diff -u -p -u -p -r1.9 patch-i3-nagbar_main_c --- patches/patch-i3-nagbar_main_c 26 Jan 2016 09:42:35 -0000 1.9 +++ patches/patch-i3-nagbar_main_c 8 Mar 2016 09:08:20 -0000 @@ -1,31 +1,8 @@ $OpenBSD: patch-i3-nagbar_main_c,v 1.9 2016/01/26 09:42:35 dcoppa Exp $ -commit a1d1f456a1fbf44bfa5c6a9d041023ac498b0c46 -Author: Theo Buehler <t...@math.ethz.ch> -Date: Thu Jan 14 10:06:34 2016 +0100 - -Add pledge(2) support for OpenBSD - -pledges for i3: -"stdio rpath unix" for talking to the i3 socket usually in /tmp -"proc exec" for executing programs -"wpath cpath" are needed for the restart-in-place functionality - -To make this work, @semarie pointed out that it is sufficient to ensure -that we get physical_mem_bytes only once, namely in init_logging(). - -pledges for i3-msg: -"stdio rpath unix" are needed for talking to the i3-socket - -pledges for i3-nagbar -"rpath getpw" to find the home directory -"wpath cpath" to write the script -"proc exec" to execute the script -"unix" for talking to the i3 socket - ---- i3-nagbar/main.c.orig Wed Sep 30 08:55:10 2015 -+++ i3-nagbar/main.c Sun Dec 20 15:00:22 2015 -@@ -170,7 +170,7 @@ static void handle_button_release(xcb_connection_t *co +--- i3-nagbar/main.c.orig Sun Mar 6 16:17:18 2016 ++++ i3-nagbar/main.c Mon Mar 7 15:15:37 2016 +@@ -175,7 +175,7 @@ static void handle_button_release(xcb_connection_t *co } char *terminal_cmd; @@ -33,16 +10,4 @@ pledges for i3-nagbar + sasprintf(&terminal_cmd, "${X11BASE}/bin/xterm -e %s", link_path); printf("argv0 = %s\n", argv0); printf("terminal_cmd = %s\n", terminal_cmd); - -@@ -464,6 +464,11 @@ int main(int argc, char *argv[]) { - - font = load_font(pattern, true); - set_font(&font); -+ -+#if defined(__OpenBSD__) -+ if (pledge("stdio rpath wpath cpath getpw proc exec unix", NULL) == -1) -+ err(EXIT_FAILURE, "pledge"); -+#endif - - xcb_rectangle_t win_pos = get_window_position(); Index: patches/patch-include_commands_h =================================================================== RCS file: patches/patch-include_commands_h diff -N patches/patch-include_commands_h --- patches/patch-include_commands_h 18 Dec 2015 15:53:08 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,286 +0,0 @@ -$OpenBSD: patch-include_commands_h,v 1.1 2015/12/18 15:53:08 dcoppa Exp $ - -Migrate the resize command to use typed numbers. - -Migrate the move command to use typed numbers. - -Turn "char *" into "const char *" for all command parser functions. - ---- include/commands.h.orig Wed Sep 30 08:55:10 2015 -+++ include/commands.h Fri Dec 18 13:58:58 2015 -@@ -33,14 +33,14 @@ void cmd_criteria_match_windows(I3_CMD); - * specification. - * - */ --void cmd_criteria_add(I3_CMD, char *ctype, char *cvalue); -+void cmd_criteria_add(I3_CMD, const char *ctype, const char *cvalue); - - /** - * Implementation of 'move [window|container] [to] workspace - * next|prev|next_on_output|prev_on_output'. - * - */ --void cmd_move_con_to_workspace(I3_CMD, char *which); -+void cmd_move_con_to_workspace(I3_CMD, const char *which); - - /** - * Implementation of 'move [window|container] [to] workspace back_and_forth'. -@@ -52,55 +52,55 @@ void cmd_move_con_to_workspace_back_and_forth(I3_CMD); - * Implementation of 'move [window|container] [to] workspace <name>'. - * - */ --void cmd_move_con_to_workspace_name(I3_CMD, char *name); -+void cmd_move_con_to_workspace_name(I3_CMD, const char *name); - - /** - * Implementation of 'move [window|container] [to] workspace number <number>'. - * - */ --void cmd_move_con_to_workspace_number(I3_CMD, char *which); -+void cmd_move_con_to_workspace_number(I3_CMD, const char *which); - - /** - * Implementation of 'resize set <px> [px] <px> [px]'. - * - */ --void cmd_size(I3_CMD, char *cwidth, char *cheight); -+void cmd_resize_set(I3_CMD, long cwidth, long cheight); - - /** - * Implementation of 'resize grow|shrink <direction> [<px> px] [or <ppt> ppt]'. - * - */ --void cmd_resize(I3_CMD, char *way, char *direction, char *resize_px, char *resize_ppt); -+void cmd_resize(I3_CMD, const char *way, const char *direction, long resize_px, long resize_ppt); - - /** - * Implementation of 'border normal|pixel [<n>]', 'border none|1pixel|toggle'. - * - */ --void cmd_border(I3_CMD, char *border_style_str, char *border_width); -+void cmd_border(I3_CMD, const char *border_style_str, const char *border_width); - - /** - * Implementation of 'nop <comment>'. - * - */ --void cmd_nop(I3_CMD, char *comment); -+void cmd_nop(I3_CMD, const char *comment); - - /** - * Implementation of 'append_layout <path>'. - * - */ --void cmd_append_layout(I3_CMD, char *path); -+void cmd_append_layout(I3_CMD, const char *path); - - /** - * Implementation of 'workspace next|prev|next_on_output|prev_on_output'. - * - */ --void cmd_workspace(I3_CMD, char *which); -+void cmd_workspace(I3_CMD, const char *which); - - /** - * Implementation of 'workspace number <number>' - * - */ --void cmd_workspace_number(I3_CMD, char *which); -+void cmd_workspace_number(I3_CMD, const char *which); - - /** - * Implementation of 'workspace back_and_forth'. -@@ -112,85 +112,85 @@ void cmd_workspace_back_and_forth(I3_CMD); - * Implementation of 'workspace <name>' - * - */ --void cmd_workspace_name(I3_CMD, char *name); -+void cmd_workspace_name(I3_CMD, const char *name); - - /** - * Implementation of 'mark [--toggle] <mark>' - * - */ --void cmd_mark(I3_CMD, char *mark, char *toggle); -+void cmd_mark(I3_CMD, const char *mark, const char *toggle); - - /** - * Implementation of 'unmark [mark]' - * - */ --void cmd_unmark(I3_CMD, char *mark); -+void cmd_unmark(I3_CMD, const char *mark); - - /** - * Implementation of 'mode <string>'. - * - */ --void cmd_mode(I3_CMD, char *mode); -+void cmd_mode(I3_CMD, const char *mode); - - /** - * Implementation of 'move [window|container] [to] output <str>'. - * - */ --void cmd_move_con_to_output(I3_CMD, char *name); -+void cmd_move_con_to_output(I3_CMD, const char *name); - - /** - * Implementation of 'move [window|container] [to] mark <str>'. - * - */ --void cmd_move_con_to_mark(I3_CMD, char *mark); -+void cmd_move_con_to_mark(I3_CMD, const char *mark); - - /** - * Implementation of 'floating enable|disable|toggle' - * - */ --void cmd_floating(I3_CMD, char *floating_mode); -+void cmd_floating(I3_CMD, const char *floating_mode); - - /** - * Implementation of 'move workspace to [output] <str>'. - * - */ --void cmd_move_workspace_to_output(I3_CMD, char *name); -+void cmd_move_workspace_to_output(I3_CMD, const char *name); - - /** - * Implementation of 'split v|h|vertical|horizontal'. - * - */ --void cmd_split(I3_CMD, char *direction); -+void cmd_split(I3_CMD, const char *direction); - - /** - * Implementation of 'kill [window|client]'. - * - */ --void cmd_kill(I3_CMD, char *kill_mode_str); -+void cmd_kill(I3_CMD, const char *kill_mode_str); - - /** - * Implementation of 'exec [--no-startup-id] <command>'. - * - */ --void cmd_exec(I3_CMD, char *nosn, char *command); -+void cmd_exec(I3_CMD, const char *nosn, const char *command); - - /** - * Implementation of 'focus left|right|up|down'. - * - */ --void cmd_focus_direction(I3_CMD, char *direction); -+void cmd_focus_direction(I3_CMD, const char *direction); - - /** - * Implementation of 'focus tiling|floating|mode_toggle'. - * - */ --void cmd_focus_window_mode(I3_CMD, char *window_mode); -+void cmd_focus_window_mode(I3_CMD, const char *window_mode); - - /** - * Implementation of 'focus parent|child'. - * - */ --void cmd_focus_level(I3_CMD, char *level); -+void cmd_focus_level(I3_CMD, const char *level); - - /** - * Implementation of 'focus'. -@@ -202,31 +202,31 @@ void cmd_focus(I3_CMD); - * Implementation of 'fullscreen [enable|disable|toggle] [global]'. - * - */ --void cmd_fullscreen(I3_CMD, char *action, char *fullscreen_mode); -+void cmd_fullscreen(I3_CMD, const char *action, const char *fullscreen_mode); - - /** - * Implementation of 'sticky enable|disable|toggle'. - * - */ --void cmd_sticky(I3_CMD, char *action); -+void cmd_sticky(I3_CMD, const char *action); - - /** - * Implementation of 'move <direction> [<pixels> [px]]'. - * - */ --void cmd_move_direction(I3_CMD, char *direction, char *move_px); -+void cmd_move_direction(I3_CMD, const char *direction, long move_px); - - /** - * Implementation of 'layout default|stacked|stacking|tabbed|splitv|splith'. - * - */ --void cmd_layout(I3_CMD, char *layout_str); -+void cmd_layout(I3_CMD, const char *layout_str); - - /** - * Implementation of 'layout toggle [all|split]'. - * - */ --void cmd_layout_toggle(I3_CMD, char *toggle_mode); -+void cmd_layout_toggle(I3_CMD, const char *toggle_mode); - - /** - * Implementation of 'exit'. -@@ -256,19 +256,19 @@ void cmd_open(I3_CMD); - * Implementation of 'focus output <output>'. - * - */ --void cmd_focus_output(I3_CMD, char *name); -+void cmd_focus_output(I3_CMD, const char *name); - - /** - * Implementation of 'move [window|container] [to] [absolute] position <px> [px] <px> [px] - * - */ --void cmd_move_window_to_position(I3_CMD, char *method, char *x, char *y); -+void cmd_move_window_to_position(I3_CMD, const char *method, long x, long y); - - /** - * Implementation of 'move [window|container] [to] [absolute] position center - * - */ --void cmd_move_window_to_center(I3_CMD, char *method); -+void cmd_move_window_to_center(I3_CMD, const char *method); - - /** - * Implementation of 'move [window|container] [to] position mouse' -@@ -292,28 +292,28 @@ void cmd_scratchpad_show(I3_CMD); - * Implementation of 'title_format <format>' - * - */ --void cmd_title_format(I3_CMD, char *format); -+void cmd_title_format(I3_CMD, const char *format); - - /** - * Implementation of 'rename workspace <name> to <name>' - * - */ --void cmd_rename_workspace(I3_CMD, char *old_name, char *new_name); -+void cmd_rename_workspace(I3_CMD, const char *old_name, const char *new_name); - - /** - * Implementation of 'bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]' - * - */ --void cmd_bar(I3_CMD, char *bar_type, char *bar_value, char *bar_id); -+void cmd_bar(I3_CMD, const char *bar_type, const char *bar_value, const char *bar_id); - - /* - * Implementation of 'shmlog <size>|toggle|on|off' - * - */ --void cmd_shmlog(I3_CMD, char *argument); -+void cmd_shmlog(I3_CMD, const char *argument); - - /* - * Implementation of 'debuglog toggle|on|off' - * - */ --void cmd_debuglog(I3_CMD, char *argument); -+void cmd_debuglog(I3_CMD, const char *argument); Index: patches/patch-include_con_h =================================================================== RCS file: patches/patch-include_con_h diff -N patches/patch-include_con_h --- patches/patch-include_con_h 18 Dec 2015 15:53:09 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,19 +0,0 @@ -$OpenBSD: patch-include_con_h,v 1.4 2015/12/18 15:53:09 dcoppa Exp $ - -Fix crash when trying to split and float a dock container. - ---- include/con.h.orig Wed Sep 30 08:55:10 2015 -+++ include/con.h Fri Dec 18 13:58:58 2015 -@@ -113,6 +113,12 @@ bool con_is_internal(Con *con); - bool con_is_floating(Con *con); - - /** -+ * Returns true if the container is a docked container. -+ * -+ */ -+bool con_is_docked(Con *con); -+ -+/** - * Checks if the given container is either floating or inside some floating - * container. It returns the FLOATING_CON container. - * Index: patches/patch-include_match_h =================================================================== RCS file: patches/patch-include_match_h diff -N patches/patch-include_match_h --- patches/patch-include_match_h 18 Dec 2015 15:53:09 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,16 +0,0 @@ -$OpenBSD: patch-include_match_h,v 1.1 2015/12/18 15:53:09 dcoppa Exp $ - -Refactor parsing of matches to avoid code duplication. - ---- include/match.h.orig Wed Sep 30 08:55:10 2015 -+++ include/match.h Fri Dec 18 13:58:58 2015 -@@ -45,3 +45,9 @@ bool match_matches_window(Match *match, i3Window *wind - * - */ - void match_free(Match *match); -+ -+/** -+ * Interprets a ctype=cvalue pair and adds it to the given match specification. -+ * -+ */ -+void match_parse_property(Match *match, const char *ctype, const char *cvalue); Index: patches/patch-include_startup_h =================================================================== RCS file: patches/patch-include_startup_h diff -N patches/patch-include_startup_h --- patches/patch-include_startup_h 18 Dec 2015 15:53:09 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,15 +0,0 @@ -$OpenBSD: patch-include_startup_h,v 1.1 2015/12/18 15:53:09 dcoppa Exp $ - -Turn "char *" into "const char *" for all command parser functions. - ---- include/startup.h.orig Wed Sep 30 08:55:10 2015 -+++ include/startup.h Fri Dec 18 13:58:58 2015 -@@ -48,7 +48,7 @@ void startup_monitor_event(SnMonitorEvent *event, void - * Renames workspaces that are mentioned in the startup sequences. - * - */ --void startup_sequence_rename_workspace(char *old_name, char *new_name); -+void startup_sequence_rename_workspace(const char *old_name, const char *new_name); - - /** - * Gets the stored startup sequence for the _NET_STARTUP_ID of a given window. Index: patches/patch-include_workspace_h =================================================================== RCS file: patches/patch-include_workspace_h diff -N patches/patch-include_workspace_h --- patches/patch-include_workspace_h 18 Dec 2015 15:53:09 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -$OpenBSD: patch-include_workspace_h,v 1.1 2015/12/18 15:53:09 dcoppa Exp $ - -Turn "char *" into "const char *" for all command parser functions. - ---- include/workspace.h.orig Wed Sep 30 08:55:10 2015 -+++ include/workspace.h Fri Dec 18 13:58:58 2015 -@@ -194,4 +194,4 @@ Con *workspace_encapsulate(Con *ws); - * This returns true if and only if moving the workspace was successful. - * - */ --bool workspace_move_to_output(Con *ws, char *output); -+bool workspace_move_to_output(Con *ws, const char *output); Index: patches/patch-man_i3-migrate-config-to-v4_1 =================================================================== RCS file: /cvs/ports/x11/i3/patches/patch-man_i3-migrate-config-to-v4_1,v retrieving revision 1.20 diff -u -p -u -p -r1.20 patch-man_i3-migrate-config-to-v4_1 --- patches/patch-man_i3-migrate-config-to-v4_1 4 Oct 2015 08:48:12 -0000 1.20 +++ patches/patch-man_i3-migrate-config-to-v4_1 8 Mar 2016 09:08:20 -0000 @@ -8,11 +8,11 @@ the date of the last change is lost. --- man/i3-migrate-config-to-v4.1.orig Wed Sep 30 08:55:23 2015 +++ man/i3-migrate-config-to-v4.1 Fri Oct 2 16:59:55 2015 @@ -7,7 +7,7 @@ - .\" Source: i3 4.11 + .\" Source: i3 4.12 .\" Language: English .\" --.TH "I3\-MIGRATE\-CONFIG\" "1" "09/30/2015" "i3 4\&.11" "i3 Manual" -+.TH "I3\-MIGRATE\-CONFIG" "1" "09/30/2015" "i3 4\&.11" "i3 Manual" +-.TH "I3\-MIGRATE\-CONFIG\" "1" "03/06/2016" "i3 4\&.12" "i3 Manual" ++.TH "I3\-MIGRATE\-CONFIG" "1" "03/06/2016" "i3 4\&.12" "i3 Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- Index: patches/patch-man_i3-nagbar_1 =================================================================== RCS file: patches/patch-man_i3-nagbar_1 diff -N patches/patch-man_i3-nagbar_1 --- patches/patch-man_i3-nagbar_1 26 Jan 2016 09:42:35 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,19 +0,0 @@ -$OpenBSD: patch-man_i3-nagbar_1,v 1.2 2016/01/26 09:42:35 dcoppa Exp $ - -commit 7a25d3f1492ca3db1009bc48a96db2d2d512b34c -Author: David Coppa <dco...@gmail.com> -Date: Tue Jan 26 09:57:59 2016 +0100 - -Fix i3-nagbar example. - ---- man/i3-nagbar.1.orig Wed Sep 30 08:55:23 2015 -+++ man/i3-nagbar.1 Thu Jan 21 14:08:01 2016 -@@ -78,7 +78,7 @@ i3\-nagbar is used by i3 to tell you about errors in y - .\} - .nf - i3\-nagbar \-m \*(AqYou have an error in your i3 config file!\*(Aq \e --\-b \*(Aqedit config\*(Aq \*(Aqxterm $EDITOR ~/\&.i3/config\*(Aq -+\-b \*(Aqedit config\*(Aq \*(Aq/usr/bin/vi ~/\&.config/i3/config\*(Aq - .fi - .if n \{\ - .RE Index: patches/patch-man_i3_1 =================================================================== RCS file: /cvs/ports/x11/i3/patches/patch-man_i3_1,v retrieving revision 1.7 diff -u -p -u -p -r1.7 patch-man_i3_1 --- patches/patch-man_i3_1 11 Jul 2014 15:49:58 -0000 1.7 +++ patches/patch-man_i3_1 8 Mar 2016 09:08:20 -0000 @@ -1,7 +1,7 @@ $OpenBSD: patch-man_i3_1,v 1.7 2014/07/11 15:49:58 dcoppa Exp $ ---- man/i3.1.orig Sun Jun 15 19:12:54 2014 -+++ man/i3.1 Thu Jul 3 21:06:32 2014 -@@ -240,7 +240,7 @@ When starting, i3 looks for configuration files in the +--- man/i3.1.orig Sun Mar 6 16:17:27 2016 ++++ man/i3.1 Mon Mar 7 15:15:37 2016 +@@ -245,7 +245,7 @@ When starting, i3 looks for configuration files in the .sp -1 .IP " 2." 4.2 .\} @@ -10,7 +10,7 @@ $OpenBSD: patch-man_i3_1,v 1.7 2014/07/1 .RE .sp .RS 4 -@@ -262,7 +262,7 @@ When starting, i3 looks for configuration files in the +@@ -267,7 +267,7 @@ When starting, i3 looks for configuration files in the .sp -1 .IP " 4." 4.2 .\} @@ -19,7 +19,7 @@ $OpenBSD: patch-man_i3_1,v 1.7 2014/07/1 .RE .sp You can specify a custom path using the \-c option\&. -@@ -291,13 +291,13 @@ font pango:DejaVu Sans Mono 8 +@@ -296,13 +296,13 @@ font pango:DejaVu Sans Mono 8 floating_modifier Mod1 # start a terminal @@ -35,7 +35,7 @@ $OpenBSD: patch-man_i3_1,v 1.7 2014/07/1 # change focus bindsym Mod1+j focus left -@@ -416,7 +416,7 @@ ulimit \-c unlimited +@@ -421,7 +421,7 @@ ulimit \-c unlimited # Start i3 and log to ~/\&.i3/logfile echo "Starting at $(date)" >> ~/\&.i3/logfile Index: patches/patch-parser-specs_commands_spec =================================================================== RCS file: patches/patch-parser-specs_commands_spec diff -N patches/patch-parser-specs_commands_spec --- patches/patch-parser-specs_commands_spec 18 Dec 2015 15:53:09 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,100 +0,0 @@ -$OpenBSD: patch-parser-specs_commands_spec,v 1.5 2015/12/18 15:53:09 dcoppa Exp $ - -Migrate the resize command to use typed numbers. - -Migrate the move command to use typed numbers. - ---- parser-specs/commands.spec.orig Wed Sep 30 08:55:10 2015 -+++ parser-specs/commands.spec Fri Dec 18 13:58:58 2015 -@@ -225,10 +225,10 @@ state RESIZE_DIRECTION: - -> RESIZE_PX - - state RESIZE_PX: -- resize_px = word -+ resize_px = number - -> RESIZE_TILING - end -- -> call cmd_resize($way, $direction, "10", "10") -+ -> call cmd_resize($way, $direction, 10, 10) - - state RESIZE_TILING: - 'px' -@@ -236,29 +236,29 @@ state RESIZE_TILING: - 'or' - -> RESIZE_TILING_OR - end -- -> call cmd_resize($way, $direction, $resize_px, "10") -+ -> call cmd_resize($way, $direction, &resize_px, 10) - - state RESIZE_TILING_OR: -- resize_ppt = word -+ resize_ppt = number - -> RESIZE_TILING_FINAL - - state RESIZE_TILING_FINAL: - 'ppt', end -- -> call cmd_resize($way, $direction, $resize_px, $resize_ppt) -+ -> call cmd_resize($way, $direction, &resize_px, &resize_ppt) - - state RESIZE_SET: -- width = word -+ width = number - -> RESIZE_WIDTH - - state RESIZE_WIDTH: - 'px' - -> -- height = word -+ height = number - -> RESIZE_HEIGHT - - state RESIZE_HEIGHT: - 'px', end -- -> call cmd_size($width, $height) -+ -> call cmd_resize_set(&width, &height) - - # rename workspace <name> to <name> - # rename workspace to <name> -@@ -320,16 +320,16 @@ state MOVE: - -> MOVE_TO_ABSOLUTE_POSITION - - state MOVE_DIRECTION: -- pixels = word -+ pixels = number - -> MOVE_DIRECTION_PX - end -- -> call cmd_move_direction($direction, "10") -+ -> call cmd_move_direction($direction, 10) - - state MOVE_DIRECTION_PX: - 'px' -- -> call cmd_move_direction($direction, $pixels) -+ -> call cmd_move_direction($direction, &pixels) - end -- -> call cmd_move_direction($direction, $pixels) -+ -> call cmd_move_direction($direction, &pixels) - - state MOVE_WORKSPACE: - 'to ' -@@ -370,18 +370,18 @@ state MOVE_TO_POSITION: - -> call cmd_move_window_to_center($method) - 'mouse', 'cursor', 'pointer' - -> call cmd_move_window_to_mouse() -- coord_x = word -+ coord_x = number - -> MOVE_TO_POSITION_X - - state MOVE_TO_POSITION_X: - 'px' - -> -- coord_y = word -+ coord_y = number - -> MOVE_TO_POSITION_Y - - state MOVE_TO_POSITION_Y: - 'px', end -- -> call cmd_move_window_to_position($method, $coord_x, $coord_y) -+ -> call cmd_move_window_to_position($method, &coord_x, &coord_y) - - # mode <string> - state MODE: Index: patches/patch-src_assignments_c =================================================================== RCS file: patches/patch-src_assignments_c diff -N patches/patch-src_assignments_c --- patches/patch-src_assignments_c 18 Dec 2015 15:53:09 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,43 +0,0 @@ -$OpenBSD: patch-src_assignments_c,v 1.1 2015/12/18 15:53:09 dcoppa Exp $ - -Fixed logging statement. - -Mark assignment as run before executing it. - ---- src/assignments.c.orig Wed Sep 30 08:55:10 2015 -+++ src/assignments.c Fri Dec 18 13:58:58 2015 -@@ -40,6 +40,13 @@ void run_assignments(i3Window *window) { - if (skip) - continue; - -+ /* Store that we ran this assignment to not execute it again. We have -+ * to do this before running the actual command to prevent infinite -+ * loops. */ -+ window->nr_assignments++; -+ window->ran_assignments = srealloc(window->ran_assignments, sizeof(Assignment *) * window->nr_assignments); -+ window->ran_assignments[window->nr_assignments - 1] = current; -+ - DLOG("matching assignment, would do:\n"); - if (current->type == A_COMMAND) { - DLOG("execute command %s\n", current->dest.command); -@@ -53,11 +60,6 @@ void run_assignments(i3Window *window) { - - command_result_free(result); - } -- -- /* Store that we ran this assignment to not execute it again */ -- window->nr_assignments++; -- window->ran_assignments = srealloc(window->ran_assignments, sizeof(Assignment *) * window->nr_assignments); -- window->ran_assignments[window->nr_assignments - 1] = current; - } - - /* If any of the commands required re-rendering, we will do that now. */ -@@ -76,7 +78,7 @@ Assignment *assignment_for(i3Window *window, int type) - if ((type != A_ANY && (assignment->type & type) == 0) || - !match_matches_window(&(assignment->match), window)) - continue; -- DLOG("got a matching assignment (to %s)\n", assignment->dest.workspace); -+ DLOG("got a matching assignment\n"); - return assignment; - } - Index: patches/patch-src_bindings_c =================================================================== RCS file: /cvs/ports/x11/i3/patches/patch-src_bindings_c,v retrieving revision 1.4 diff -u -p -u -p -r1.4 patch-src_bindings_c --- patches/patch-src_bindings_c 18 Dec 2015 15:53:09 -0000 1.4 +++ patches/patch-src_bindings_c 8 Mar 2016 09:08:20 -0000 @@ -1,65 +1,7 @@ $OpenBSD: patch-src_bindings_c,v 1.4 2015/12/18 15:53:09 dcoppa Exp $ - -Bugfix: add keymap fall back (_XKB_RULES_NAMES, then defaults) - -Use sasprintf() - -Fix memleak in translate_keysyms - -Bugfix: correctly compare modifier mask when identifying keybindings - -Bugfix: set group mask 1 by default, correctly compare modifiers - ---- src/bindings.c.orig Wed Sep 30 08:55:10 2015 -+++ src/bindings.c Fri Dec 18 13:58:58 2015 -@@ -164,16 +164,34 @@ static Binding *get_binding(i3_event_state_mask_t stat - } - } - -+ const uint32_t xkb_group_state = (state_filtered & 0xFFFF0000); -+ const uint32_t modifiers_state = (state_filtered & 0x0000FFFF); - TAILQ_FOREACH(bind, bindings, bindings) { -- DLOG("binding with event_state_mask 0x%x, state_filtered 0x%x, match: %s\n", -- bind->event_state_mask, state_filtered, -- ((state_filtered & bind->event_state_mask) == bind->event_state_mask) ? "yes" : "no"); -+ const uint32_t xkb_group_mask = (bind->event_state_mask & 0xFFFF0000); -+ /* modifiers_mask is a special case: a value of 0 does not mean "match all", -+ * but rather "match exactly when no modifiers are present". */ -+ const uint32_t modifiers_mask = (bind->event_state_mask & 0x0000FFFF); -+ const bool groups_match = ((xkb_group_state & xkb_group_mask) == xkb_group_mask); -+ bool mods_match; -+ if (modifiers_mask == 0) { -+ /* Verify no modifiers are pressed. A bitwise AND would lead to -+ * false positives, see issue #2002. */ -+ mods_match = (modifiers_state == 0); -+ } else { -+ mods_match = ((modifiers_state & modifiers_mask) == modifiers_mask); -+ } -+ const bool state_matches = (groups_match && mods_match); -+ -+ DLOG("binding groups_match = %s, mods_match = %s, state_matches = %s\n", -+ (groups_match ? "yes" : "no"), -+ (mods_match ? "yes" : "no"), -+ (state_matches ? "yes" : "no")); - /* First compare the state_filtered (unless this is a - * B_UPON_KEYRELEASE_IGNORE_MODS binding and this is a KeyRelease - * event) */ - if (bind->input_type != input_type) - continue; -- if ((state_filtered & bind->event_state_mask) != bind->event_state_mask && -+ if (!state_matches && - (bind->release != B_UPON_KEYRELEASE_IGNORE_MODS || - !is_release)) - continue; -@@ -396,6 +414,7 @@ void translate_keysyms(void) { - } - - xkb_state_unref(dummy_state); -+ xkb_state_unref(dummy_state_no_shift); - } - - /* -@@ -603,7 +622,7 @@ CommandResult *run_binding(Binding *bind, Con *con) { +--- src/bindings.c.orig Sun Mar 6 16:17:18 2016 ++++ src/bindings.c Mon Mar 7 15:15:37 2016 +@@ -663,7 +663,7 @@ CommandResult *run_binding(Binding *bind, Con *con) { if (result->parse_error) { char *pageraction; @@ -68,128 +10,3 @@ Bugfix: set group mask 1 by default, cor char *argv[] = { NULL, /* will be replaced by the executable path */ "-f", -@@ -626,6 +645,77 @@ CommandResult *run_binding(Binding *bind, Con *con) { - return result; - } - -+static int fill_rmlvo_from_root(struct xkb_rule_names *xkb_names) { -+ xcb_intern_atom_reply_t *atom_reply; -+ size_t content_max_words = 256; -+ -+ xcb_window_t root = root_screen->root; -+ -+ atom_reply = xcb_intern_atom_reply( -+ conn, xcb_intern_atom(conn, 0, strlen("_XKB_RULES_NAMES"), "_XKB_RULES_NAMES"), NULL); -+ if (atom_reply == NULL) -+ return -1; -+ -+ xcb_get_property_cookie_t prop_cookie; -+ xcb_get_property_reply_t *prop_reply; -+ prop_cookie = xcb_get_property_unchecked(conn, false, root, atom_reply->atom, -+ XCB_GET_PROPERTY_TYPE_ANY, 0, content_max_words); -+ prop_reply = xcb_get_property_reply(conn, prop_cookie, NULL); -+ if (prop_reply == NULL) { -+ free(atom_reply); -+ return -1; -+ } -+ if (xcb_get_property_value_length(prop_reply) > 0 && prop_reply->bytes_after > 0) { -+ /* We received an incomplete value. Ask again but with a properly -+ * adjusted size. */ -+ content_max_words += ceil(prop_reply->bytes_after / 4.0); -+ /* Repeat the request, with adjusted size */ -+ free(prop_reply); -+ prop_cookie = xcb_get_property_unchecked(conn, false, root, atom_reply->atom, -+ XCB_GET_PROPERTY_TYPE_ANY, 0, content_max_words); -+ prop_reply = xcb_get_property_reply(conn, prop_cookie, NULL); -+ if (prop_reply == NULL) { -+ free(atom_reply); -+ return -1; -+ } -+ } -+ if (xcb_get_property_value_length(prop_reply) == 0) { -+ free(atom_reply); -+ free(prop_reply); -+ return -1; -+ } -+ -+ const char *walk = (const char *)xcb_get_property_value(prop_reply); -+ int remaining = xcb_get_property_value_length(prop_reply); -+ for (int i = 0; i < 5 && remaining > 0; i++) { -+ const int len = strnlen(walk, remaining); -+ remaining -= len; -+ switch (i) { -+ case 0: -+ sasprintf((char **)&(xkb_names->rules), "%.*s", len, walk); -+ break; -+ case 1: -+ sasprintf((char **)&(xkb_names->model), "%.*s", len, walk); -+ break; -+ case 2: -+ sasprintf((char **)&(xkb_names->layout), "%.*s", len, walk); -+ break; -+ case 3: -+ sasprintf((char **)&(xkb_names->variant), "%.*s", len, walk); -+ break; -+ case 4: -+ sasprintf((char **)&(xkb_names->options), "%.*s", len, walk); -+ break; -+ } -+ DLOG("component %d of _XKB_RULES_NAMES is \"%.*s\"\n", i, len, walk); -+ walk += (len + 1); -+ } -+ -+ free(atom_reply); -+ free(prop_reply); -+ return 0; -+} -+ - /* - * Loads the XKB keymap from the X11 server and feeds it to xkbcommon. - * -@@ -638,12 +728,40 @@ bool load_keymap(void) { - } - } - -- struct xkb_keymap *new_keymap; -- const int32_t device_id = xkb_x11_get_core_keyboard_device_id(conn); -- DLOG("device_id = %d\n", device_id); -- if ((new_keymap = xkb_x11_keymap_new_from_device(xkb_context, conn, device_id, 0)) == NULL) { -- ELOG("xkb_x11_keymap_new_from_device failed\n"); -- return false; -+ struct xkb_keymap *new_keymap = NULL; -+ int32_t device_id; -+ if (xkb_supported && (device_id = xkb_x11_get_core_keyboard_device_id(conn)) > -1) { -+ if ((new_keymap = xkb_x11_keymap_new_from_device(xkb_context, conn, device_id, 0)) == NULL) { -+ ELOG("xkb_x11_keymap_new_from_device failed\n"); -+ return false; -+ } -+ } else { -+ /* Likely there is no XKB support on this server, possibly because it -+ * is a VNC server. */ -+ LOG("No XKB / core keyboard device? Assembling keymap from local RMLVO.\n"); -+ struct xkb_rule_names names = { -+ .rules = NULL, -+ .model = NULL, -+ .layout = NULL, -+ .variant = NULL, -+ .options = NULL}; -+ if (fill_rmlvo_from_root(&names) == -1) { -+ ELOG("Could not get _XKB_RULES_NAMES atom from root window, falling back to defaults.\n"); -+ if ((new_keymap = xkb_keymap_new_from_names(xkb_context, &names, 0)) == NULL) { -+ ELOG("xkb_keymap_new_from_names(NULL) failed\n"); -+ return false; -+ } -+ } -+ new_keymap = xkb_keymap_new_from_names(xkb_context, &names, 0); -+ free((char *)names.rules); -+ free((char *)names.model); -+ free((char *)names.layout); -+ free((char *)names.variant); -+ free((char *)names.options); -+ if (new_keymap == NULL) { -+ ELOG("xkb_keymap_new_from_names(RMLVO) failed\n"); -+ return false; -+ } - } - xkb_keymap_unref(xkb_keymap); - xkb_keymap = new_keymap; Index: patches/patch-src_click_c =================================================================== RCS file: patches/patch-src_click_c diff -N patches/patch-src_click_c --- patches/patch-src_click_c 18 Dec 2015 15:53:09 -0000 1.10 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,15 +0,0 @@ -$OpenBSD: patch-src_click_c,v 1.10 2015/12/18 15:53:09 dcoppa Exp $ - -Bugfix: ignore XKB group bits in floating_modifier - ---- src/click.c.orig Wed Sep 30 08:55:10 2015 -+++ src/click.c Fri Dec 18 13:58:58 2015 -@@ -356,7 +356,7 @@ int handle_button_press(xcb_button_press_event_t *even - - last_timestamp = event->time; - -- const uint32_t mod = config.floating_modifier; -+ const uint32_t mod = (config.floating_modifier & 0xFFFF); - const bool mod_pressed = (mod != 0 && (event->state & mod) == mod); - DLOG("floating_mod = %d, detail = %d\n", mod_pressed, event->detail); - if ((con = con_by_window_id(event->event))) Index: patches/patch-src_commands_c =================================================================== RCS file: patches/patch-src_commands_c diff -N patches/patch-src_commands_c --- patches/patch-src_commands_c 26 Jan 2016 09:42:35 -0000 1.17 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,765 +0,0 @@ -$OpenBSD: patch-src_commands_c,v 1.17 2016/01/26 09:42:35 dcoppa Exp $ - -Fix duplicated marks on append_layout. - -Correctly handle command criteria for "move window to output". - -Migrate the resize command to use typed numbers. - -Migrate the move command to use typed numbers. - -Turn "char *" into "const char *" for all command parser functions. - -Fix crash when trying to split and float a dock container. - -Refactor parsing of matches to avoid code duplication. - -Remove commented-out code. - ---- src/commands.c.orig Wed Sep 30 08:55:10 2015 -+++ src/commands.c Tue Jan 26 10:20:25 2016 -@@ -83,7 +83,7 @@ static Output *get_output_of_con(Con *con) { - * and return true, signaling that no further workspace switching should occur in the calling function. - * - */ --static bool maybe_back_and_forth(struct CommandResultIR *cmd_output, char *name) { -+static bool maybe_back_and_forth(struct CommandResultIR *cmd_output, const char *name) { - Con *ws = con_get_workspace(focused); - - /* If we switched to a different workspace, do nothing */ -@@ -121,102 +121,6 @@ static Con *maybe_auto_back_and_forth_workspace(Con *w - return workspace; - } - --// This code is commented out because we might recycle it for popping up error --// messages on parser errors. --#if 0 --static pid_t migration_pid = -1; -- --/* -- * Handler which will be called when we get a SIGCHLD for the nagbar, meaning -- * it exited (or could not be started, depending on the exit code). -- * -- */ --static void nagbar_exited(EV_P_ ev_child *watcher, int revents) { -- ev_child_stop(EV_A_ watcher); -- if (!WIFEXITED(watcher->rstatus)) { -- fprintf(stderr, "ERROR: i3-nagbar did not exit normally.\n"); -- return; -- } -- -- int exitcode = WEXITSTATUS(watcher->rstatus); -- printf("i3-nagbar process exited with status %d\n", exitcode); -- if (exitcode == 2) { -- fprintf(stderr, "ERROR: i3-nagbar could not be found. Is it correctly installed on your system?\n"); -- } -- -- migration_pid = -1; --} -- --/* We need ev >= 4 for the following code. Since it is not *that* important (it -- * only makes sure that there are no i3-nagbar instances left behind) we still -- * support old systems with libev 3. */ --#if EV_VERSION_MAJOR >= 4 --/* -- * Cleanup handler. Will be called when i3 exits. Kills i3-nagbar with signal -- * SIGKILL (9) to make sure there are no left-over i3-nagbar processes. -- * -- */ --static void nagbar_cleanup(EV_P_ ev_cleanup *watcher, int revent) { -- if (migration_pid != -1) { -- LOG("Sending SIGKILL (9) to i3-nagbar with PID %d\n", migration_pid); -- kill(migration_pid, SIGKILL); -- } --} --#endif -- --void cmd_MIGRATION_start_nagbar(void) { -- if (migration_pid != -1) { -- fprintf(stderr, "i3-nagbar already running.\n"); -- return; -- } -- fprintf(stderr, "Starting i3-nagbar, command parsing differs from expected output.\n"); -- ELOG("Please report this on IRC or in the bugtracker. Make sure to include the full debug level logfile:\n"); -- ELOG("i3-dump-log | gzip -9c > /tmp/i3.log.gz\n"); -- ELOG("FYI: Your i3 version is " I3_VERSION "\n"); -- migration_pid = fork(); -- if (migration_pid == -1) { -- warn("Could not fork()"); -- return; -- } -- -- /* child */ -- if (migration_pid == 0) { -- char *pageraction; -- sasprintf(&pageraction, "i3-sensible-terminal -e i3-sensible-pager \"%s\"", errorfilename); -- char *argv[] = { -- NULL, /* will be replaced by the executable path */ -- "-t", -- "error", -- "-m", -- "You found a parsing error. Please, please, please, report it!", -- "-b", -- "show errors", -- pageraction, -- NULL -- }; -- exec_i3_utility("i3-nagbar", argv); -- } -- -- /* parent */ -- /* install a child watcher */ -- ev_child *child = smalloc(sizeof(ev_child)); -- ev_child_init(child, &nagbar_exited, migration_pid, 0); -- ev_child_start(main_loop, child); -- --/* We need ev >= 4 for the following code. Since it is not *that* important (it -- * only makes sure that there are no i3-nagbar instances left behind) we still -- * support old systems with libev 3. */ --#if EV_VERSION_MAJOR >= 4 -- /* install a cleanup watcher (will be called when i3 exits and i3-nagbar is -- * still running) */ -- ev_cleanup *cleanup = smalloc(sizeof(ev_cleanup)); -- ev_cleanup_init(cleanup, nagbar_cleanup); -- ev_cleanup_start(main_loop, cleanup); --#endif --} -- --#endif -- - /******************************************************************************* - * Criteria functions. - ******************************************************************************/ -@@ -315,108 +219,8 @@ void cmd_criteria_match_windows(I3_CMD) { - * specification. - * - */ --void cmd_criteria_add(I3_CMD, char *ctype, char *cvalue) { -- DLOG("ctype=*%s*, cvalue=*%s*\n", ctype, cvalue); -- -- if (strcmp(ctype, "class") == 0) { -- current_match->class = regex_new(cvalue); -- return; -- } -- -- if (strcmp(ctype, "instance") == 0) { -- current_match->instance = regex_new(cvalue); -- return; -- } -- -- if (strcmp(ctype, "window_role") == 0) { -- current_match->window_role = regex_new(cvalue); -- return; -- } -- -- if (strcmp(ctype, "con_id") == 0) { -- char *end; -- long parsed = strtol(cvalue, &end, 0); -- if (parsed == LONG_MIN || -- parsed == LONG_MAX || -- parsed < 0 || -- (end && *end != '\0')) { -- ELOG("Could not parse con id \"%s\"\n", cvalue); -- } else { -- current_match->con_id = (Con *)parsed; -- DLOG("id as int = %p\n", current_match->con_id); -- } -- return; -- } -- -- if (strcmp(ctype, "id") == 0) { -- char *end; -- long parsed = strtol(cvalue, &end, 0); -- if (parsed == LONG_MIN || -- parsed == LONG_MAX || -- parsed < 0 || -- (end && *end != '\0')) { -- ELOG("Could not parse window id \"%s\"\n", cvalue); -- } else { -- current_match->id = parsed; -- DLOG("window id as int = %d\n", current_match->id); -- } -- return; -- } -- -- if (strcmp(ctype, "window_type") == 0) { -- if (strcasecmp(cvalue, "normal") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_NORMAL; -- else if (strcasecmp(cvalue, "dialog") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_DIALOG; -- else if (strcasecmp(cvalue, "utility") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_UTILITY; -- else if (strcasecmp(cvalue, "toolbar") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_TOOLBAR; -- else if (strcasecmp(cvalue, "splash") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_SPLASH; -- else if (strcasecmp(cvalue, "menu") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_MENU; -- else if (strcasecmp(cvalue, "dropdown_menu") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_DROPDOWN_MENU; -- else if (strcasecmp(cvalue, "popup_menu") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_POPUP_MENU; -- else if (strcasecmp(cvalue, "tooltip") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_TOOLTIP; -- else -- ELOG("unknown window_type value \"%s\"\n", cvalue); -- -- return; -- } -- -- if (strcmp(ctype, "con_mark") == 0) { -- current_match->mark = regex_new(cvalue); -- return; -- } -- -- if (strcmp(ctype, "title") == 0) { -- current_match->title = regex_new(cvalue); -- return; -- } -- -- if (strcmp(ctype, "urgent") == 0) { -- if (strcasecmp(cvalue, "latest") == 0 || -- strcasecmp(cvalue, "newest") == 0 || -- strcasecmp(cvalue, "recent") == 0 || -- strcasecmp(cvalue, "last") == 0) { -- current_match->urgent = U_LATEST; -- } else if (strcasecmp(cvalue, "oldest") == 0 || -- strcasecmp(cvalue, "first") == 0) { -- current_match->urgent = U_OLDEST; -- } -- return; -- } -- -- if (strcmp(ctype, "workspace") == 0) { -- current_match->workspace = regex_new(cvalue); -- return; -- } -- -- ELOG("Unknown criterion: %s\n", ctype); -+void cmd_criteria_add(I3_CMD, const char *ctype, const char *cvalue) { -+ match_parse_property(current_match, ctype, cvalue); - } - - /* -@@ -424,7 +228,7 @@ void cmd_criteria_add(I3_CMD, char *ctype, char *cvalu - * next|prev|next_on_output|prev_on_output|current'. - * - */ --void cmd_move_con_to_workspace(I3_CMD, char *which) { -+void cmd_move_con_to_workspace(I3_CMD, const char *which) { - owindow *current; - - DLOG("which=%s\n", which); -@@ -500,7 +304,7 @@ void cmd_move_con_to_workspace_back_and_forth(I3_CMD) - * Implementation of 'move [window|container] [to] workspace <name>'. - * - */ --void cmd_move_con_to_workspace_name(I3_CMD, char *name) { -+void cmd_move_con_to_workspace_name(I3_CMD, const char *name) { - if (strncasecmp(name, "__", strlen("__")) == 0) { - LOG("You cannot move containers to i3-internal workspaces (\"%s\").\n", name); - ysuccess(false); -@@ -544,7 +348,7 @@ void cmd_move_con_to_workspace_name(I3_CMD, char *name - * Implementation of 'move [window|container] [to] workspace number <name>'. - * - */ --void cmd_move_con_to_workspace_number(I3_CMD, char *which) { -+void cmd_move_con_to_workspace_number(I3_CMD, const char *which) { - owindow *current; - - /* We have nothing to move: -@@ -591,7 +395,7 @@ void cmd_move_con_to_workspace_number(I3_CMD, char *wh - ysuccess(true); - } - --static void cmd_resize_floating(I3_CMD, char *way, char *direction, Con *floating_con, int px) { -+static void cmd_resize_floating(I3_CMD, const char *way, const char *direction, Con *floating_con, int px) { - LOG("floating resize\n"); - Rect old_rect = floating_con->rect; - Con *focused_con = con_descend_focused(floating_con); -@@ -643,7 +447,7 @@ static void cmd_resize_floating(I3_CMD, char *way, cha - floating_con->scratchpad_state = SCRATCHPAD_CHANGED; - } - --static bool cmd_resize_tiling_direction(I3_CMD, Con *current, char *way, char *direction, int ppt) { -+static bool cmd_resize_tiling_direction(I3_CMD, Con *current, const char *way, const char *direction, int ppt) { - LOG("tiling resize\n"); - Con *second = NULL; - Con *first = current; -@@ -696,7 +500,7 @@ static bool cmd_resize_tiling_direction(I3_CMD, Con *c - return true; - } - --static bool cmd_resize_tiling_width_height(I3_CMD, Con *current, char *way, char *direction, int ppt) { -+static bool cmd_resize_tiling_width_height(I3_CMD, Con *current, const char *way, const char *direction, int ppt) { - LOG("width/height resize\n"); - /* get the appropriate current container (skip stacked/tabbed cons) */ - while (current->parent->layout == L_STACKED || -@@ -782,15 +586,11 @@ static bool cmd_resize_tiling_width_height(I3_CMD, Con - * Implementation of 'resize grow|shrink <direction> [<px> px] [or <ppt> ppt]'. - * - */ --void cmd_resize(I3_CMD, char *way, char *direction, char *resize_px, char *resize_ppt) { -- /* resize <grow|shrink> <direction> [<px> px] [or <ppt> ppt] */ -- DLOG("resizing in way %s, direction %s, px %s or ppt %s\n", way, direction, resize_px, resize_ppt); -- // TODO: We could either handle this in the parser itself as a separate token (and make the stack typed) or we need a better way to convert a string to a number with error checking -- int px = atoi(resize_px); -- int ppt = atoi(resize_ppt); -+void cmd_resize(I3_CMD, const char *way, const char *direction, long resize_px, long resize_ppt) { -+ DLOG("resizing in way %s, direction %s, px %ld or ppt %ld\n", way, direction, resize_px, resize_ppt); - if (strcmp(way, "shrink") == 0) { -- px *= -1; -- ppt *= -1; -+ resize_px *= -1; -+ resize_ppt *= -1; - } - - HANDLE_EMPTY_MATCH; -@@ -805,14 +605,16 @@ void cmd_resize(I3_CMD, char *way, char *direction, ch - - Con *floating_con; - if ((floating_con = con_inside_floating(current->con))) { -- cmd_resize_floating(current_match, cmd_output, way, direction, floating_con, px); -+ cmd_resize_floating(current_match, cmd_output, way, direction, floating_con, resize_px); - } else { - if (strcmp(direction, "width") == 0 || - strcmp(direction, "height") == 0) { -- if (!cmd_resize_tiling_width_height(current_match, cmd_output, current->con, way, direction, ppt)) -+ if (!cmd_resize_tiling_width_height(current_match, cmd_output, -+ current->con, way, direction, resize_ppt)) - return; - } else { -- if (!cmd_resize_tiling_direction(current_match, cmd_output, current->con, way, direction, ppt)) -+ if (!cmd_resize_tiling_direction(current_match, cmd_output, -+ current->con, way, direction, resize_ppt)) - return; - } - } -@@ -827,13 +629,10 @@ void cmd_resize(I3_CMD, char *way, char *direction, ch - * Implementation of 'resize set <px> [px] <px> [px]'. - * - */ --void cmd_size(I3_CMD, char *cwidth, char *cheight) { -- DLOG("resizing to %sx%s px\n", cwidth, cheight); -- // TODO: We could either handle this in the parser itself as a separate token (and make the stack typed) or we need a better way to convert a string to a number with error checking -- int x = atoi(cwidth); -- int y = atoi(cheight); -- if (x <= 0 || y <= 0) { -- ELOG("Resize failed: dimensions cannot be negative (was %sx%s)\n", cwidth, cheight); -+void cmd_resize_set(I3_CMD, long cwidth, long cheight) { -+ DLOG("resizing to %ldx%ld px\n", cwidth, cheight); -+ if (cwidth <= 0 || cheight <= 0) { -+ ELOG("Resize failed: dimensions cannot be negative (was %ldx%ld)\n", cwidth, cheight); - return; - } - -@@ -843,7 +642,7 @@ void cmd_size(I3_CMD, char *cwidth, char *cheight) { - TAILQ_FOREACH(current, &owindows, owindows) { - Con *floating_con; - if ((floating_con = con_inside_floating(current->con))) { -- floating_resize(floating_con, x, y); -+ floating_resize(floating_con, cwidth, cheight); - } else { - ELOG("Resize failed: %p not a floating container\n", current->con); - } -@@ -858,7 +657,7 @@ void cmd_size(I3_CMD, char *cwidth, char *cheight) { - * Implementation of 'border normal|pixel [<n>]', 'border none|1pixel|toggle'. - * - */ --void cmd_border(I3_CMD, char *border_style_str, char *border_width) { -+void cmd_border(I3_CMD, const char *border_style_str, const char *border_width) { - DLOG("border style should be changed to %s with border width %s\n", border_style_str, border_width); - owindow *current; - -@@ -911,7 +710,7 @@ void cmd_border(I3_CMD, char *border_style_str, char * - * Implementation of 'nop <comment>'. - * - */ --void cmd_nop(I3_CMD, char *comment) { -+void cmd_nop(I3_CMD, const char *comment) { - LOG("-------------------------------------------------\n"); - LOG(" NOP: %s\n", comment); - LOG("-------------------------------------------------\n"); -@@ -921,7 +720,8 @@ void cmd_nop(I3_CMD, char *comment) { - * Implementation of 'append_layout <path>'. - * - */ --void cmd_append_layout(I3_CMD, char *path) { -+void cmd_append_layout(I3_CMD, const char *cpath) { -+ char *path = sstrdup(cpath); - LOG("Appending layout \"%s\"\n", path); - - /* Make sure we allow paths like '~/.i3/layout.json' */ -@@ -982,7 +782,7 @@ void cmd_append_layout(I3_CMD, char *path) { - * Implementation of 'workspace next|prev|next_on_output|prev_on_output'. - * - */ --void cmd_workspace(I3_CMD, char *which) { -+void cmd_workspace(I3_CMD, const char *which) { - Con *ws; - - DLOG("which=%s\n", which); -@@ -1018,7 +818,7 @@ void cmd_workspace(I3_CMD, char *which) { - * Implementation of 'workspace number <name>' - * - */ --void cmd_workspace_number(I3_CMD, char *which) { -+void cmd_workspace_number(I3_CMD, const char *which) { - Con *output, *workspace = NULL; - - if (con_get_fullscreen_con(croot, CF_GLOBAL)) { -@@ -1077,7 +877,7 @@ void cmd_workspace_back_and_forth(I3_CMD) { - * Implementation of 'workspace <name>' - * - */ --void cmd_workspace_name(I3_CMD, char *name) { -+void cmd_workspace_name(I3_CMD, const char *name) { - if (strncasecmp(name, "__", strlen("__")) == 0) { - LOG("You cannot switch to the i3-internal workspaces (\"%s\").\n", name); - ysuccess(false); -@@ -1104,7 +904,7 @@ void cmd_workspace_name(I3_CMD, char *name) { - * Implementation of 'mark [--toggle] <mark>' - * - */ --void cmd_mark(I3_CMD, char *mark, char *toggle) { -+void cmd_mark(I3_CMD, const char *mark, const char *toggle) { - HANDLE_EMPTY_MATCH; - - owindow *current = TAILQ_FIRST(&owindows); -@@ -1135,7 +935,7 @@ void cmd_mark(I3_CMD, char *mark, char *toggle) { - * Implementation of 'unmark [mark]' - * - */ --void cmd_unmark(I3_CMD, char *mark) { -+void cmd_unmark(I3_CMD, const char *mark) { - con_unmark(mark); - - cmd_output->needs_tree_render = true; -@@ -1147,7 +947,7 @@ void cmd_unmark(I3_CMD, char *mark) { - * Implementation of 'mode <string>'. - * - */ --void cmd_mode(I3_CMD, char *mode) { -+void cmd_mode(I3_CMD, const char *mode) { - DLOG("mode=%s\n", mode); - switch_mode(mode); - -@@ -1159,7 +959,7 @@ void cmd_mode(I3_CMD, char *mode) { - * Implementation of 'move [window|container] [to] output <str>'. - * - */ --void cmd_move_con_to_output(I3_CMD, char *name) { -+void cmd_move_con_to_output(I3_CMD, const char *name) { - DLOG("Should move window to output \"%s\".\n", name); - HANDLE_EMPTY_MATCH; - -@@ -1197,7 +997,7 @@ void cmd_move_con_to_output(I3_CMD, char *name) { - * Implementation of 'move [container|window] [to] mark <str>'. - * - */ --void cmd_move_con_to_mark(I3_CMD, char *mark) { -+void cmd_move_con_to_mark(I3_CMD, const char *mark) { - DLOG("moving window to mark \"%s\"\n", mark); - - HANDLE_EMPTY_MATCH; -@@ -1217,7 +1017,7 @@ void cmd_move_con_to_mark(I3_CMD, char *mark) { - * Implementation of 'floating enable|disable|toggle' - * - */ --void cmd_floating(I3_CMD, char *floating_mode) { -+void cmd_floating(I3_CMD, const char *floating_mode) { - owindow *current; - - DLOG("floating_mode=%s\n", floating_mode); -@@ -1248,7 +1048,7 @@ void cmd_floating(I3_CMD, char *floating_mode) { - * Implementation of 'move workspace to [output] <str>'. - * - */ --void cmd_move_workspace_to_output(I3_CMD, char *name) { -+void cmd_move_workspace_to_output(I3_CMD, const char *name) { - DLOG("should move workspace to output %s\n", name); - - HANDLE_EMPTY_MATCH; -@@ -1273,17 +1073,19 @@ void cmd_move_workspace_to_output(I3_CMD, char *name) - * Implementation of 'split v|h|vertical|horizontal'. - * - */ --void cmd_split(I3_CMD, char *direction) { -+void cmd_split(I3_CMD, const char *direction) { -+ HANDLE_EMPTY_MATCH; -+ - owindow *current; -- /* TODO: use matches */ - LOG("splitting in direction %c\n", direction[0]); -- if (match_is_empty(current_match)) -- tree_split(focused, (direction[0] == 'v' ? VERT : HORIZ)); -- else { -- TAILQ_FOREACH(current, &owindows, owindows) { -- DLOG("matching: %p / %s\n", current->con, current->con->name); -- tree_split(current->con, (direction[0] == 'v' ? VERT : HORIZ)); -+ TAILQ_FOREACH(current, &owindows, owindows) { -+ if (con_is_docked(current->con)) { -+ ELOG("Cannot split a docked container, skipping.\n"); -+ continue; - } -+ -+ DLOG("matching: %p / %s\n", current->con, current->con->name); -+ tree_split(current->con, (direction[0] == 'v' ? VERT : HORIZ)); - } - - cmd_output->needs_tree_render = true; -@@ -1295,7 +1097,7 @@ void cmd_split(I3_CMD, char *direction) { - * Implementation of 'kill [window|client]'. - * - */ --void cmd_kill(I3_CMD, char *kill_mode_str) { -+void cmd_kill(I3_CMD, const char *kill_mode_str) { - if (kill_mode_str == NULL) - kill_mode_str = "window"; - owindow *current; -@@ -1332,7 +1134,7 @@ void cmd_kill(I3_CMD, char *kill_mode_str) { - * Implementation of 'exec [--no-startup-id] <command>'. - * - */ --void cmd_exec(I3_CMD, char *nosn, char *command) { -+void cmd_exec(I3_CMD, const char *nosn, const char *command) { - bool no_startup_id = (nosn != NULL); - - DLOG("should execute %s, no_startup_id = %d\n", command, no_startup_id); -@@ -1346,7 +1148,7 @@ void cmd_exec(I3_CMD, char *nosn, char *command) { - * Implementation of 'focus left|right|up|down'. - * - */ --void cmd_focus_direction(I3_CMD, char *direction) { -+void cmd_focus_direction(I3_CMD, const char *direction) { - DLOG("direction = *%s*\n", direction); - - if (strcmp(direction, "left") == 0) -@@ -1372,7 +1174,7 @@ void cmd_focus_direction(I3_CMD, char *direction) { - * Implementation of 'focus tiling|floating|mode_toggle'. - * - */ --void cmd_focus_window_mode(I3_CMD, char *window_mode) { -+void cmd_focus_window_mode(I3_CMD, const char *window_mode) { - DLOG("window_mode = %s\n", window_mode); - - Con *ws = con_get_workspace(focused); -@@ -1403,7 +1205,7 @@ void cmd_focus_window_mode(I3_CMD, char *window_mode) - * Implementation of 'focus parent|child'. - * - */ --void cmd_focus_level(I3_CMD, char *level) { -+void cmd_focus_level(I3_CMD, const char *level) { - DLOG("level = %s\n", level); - bool success = false; - -@@ -1507,7 +1309,7 @@ void cmd_focus(I3_CMD) { - * 'fullscreen disable' - * - */ --void cmd_fullscreen(I3_CMD, char *action, char *fullscreen_mode) { -+void cmd_fullscreen(I3_CMD, const char *action, const char *fullscreen_mode) { - fullscreen_mode_t mode = strcmp(fullscreen_mode, "global") == 0 ? CF_GLOBAL : CF_OUTPUT; - DLOG("%s fullscreen, mode = %s\n", action, fullscreen_mode); - owindow *current; -@@ -1534,7 +1336,7 @@ void cmd_fullscreen(I3_CMD, char *action, char *fullsc - * Implementation of 'sticky enable|disable|toggle'. - * - */ --void cmd_sticky(I3_CMD, char *action) { -+void cmd_sticky(I3_CMD, const char *action) { - DLOG("%s sticky on window\n", action); - HANDLE_EMPTY_MATCH; - -@@ -1570,28 +1372,25 @@ void cmd_sticky(I3_CMD, char *action) { - * Implementation of 'move <direction> [<pixels> [px]]'. - * - */ --void cmd_move_direction(I3_CMD, char *direction, char *move_px) { -- // TODO: We could either handle this in the parser itself as a separate token (and make the stack typed) or we need a better way to convert a string to a number with error checking -- int px = atoi(move_px); -- -+void cmd_move_direction(I3_CMD, const char *direction, long move_px) { - owindow *current; - HANDLE_EMPTY_MATCH; - - Con *initially_focused = focused; - - TAILQ_FOREACH(current, &owindows, owindows) { -- DLOG("moving in direction %s, px %s\n", direction, move_px); -+ DLOG("moving in direction %s, px %ld\n", direction, move_px); - if (con_is_floating(current->con)) { -- DLOG("floating move with %d pixels\n", px); -+ DLOG("floating move with %ld pixels\n", move_px); - Rect newrect = current->con->parent->rect; - if (strcmp(direction, "left") == 0) { -- newrect.x -= px; -+ newrect.x -= move_px; - } else if (strcmp(direction, "right") == 0) { -- newrect.x += px; -+ newrect.x += move_px; - } else if (strcmp(direction, "up") == 0) { -- newrect.y -= px; -+ newrect.y -= move_px; - } else if (strcmp(direction, "down") == 0) { -- newrect.y += px; -+ newrect.y += move_px; - } - floating_reposition(current->con->parent, newrect); - } else { -@@ -1612,10 +1411,11 @@ void cmd_move_direction(I3_CMD, char *direction, char - * Implementation of 'layout default|stacked|stacking|tabbed|splitv|splith'. - * - */ --void cmd_layout(I3_CMD, char *layout_str) { -+void cmd_layout(I3_CMD, const char *layout_str) { -+ HANDLE_EMPTY_MATCH; -+ - if (strcmp(layout_str, "stacking") == 0) - layout_str = "stacked"; -- owindow *current; - layout_t layout; - /* default is a special case which will be handled in con_set_layout(). */ - if (strcmp(layout_str, "default") == 0) -@@ -1635,14 +1435,15 @@ void cmd_layout(I3_CMD, char *layout_str) { - - DLOG("changing layout to %s (%d)\n", layout_str, layout); - -- /* check if the match is empty, not if the result is empty */ -- if (match_is_empty(current_match)) -- con_set_layout(focused, layout); -- else { -- TAILQ_FOREACH(current, &owindows, owindows) { -- DLOG("matching: %p / %s\n", current->con, current->con->name); -- con_set_layout(current->con, layout); -+ owindow *current; -+ TAILQ_FOREACH(current, &owindows, owindows) { -+ if (con_is_docked(current->con)) { -+ ELOG("cannot change layout of a docked container, skipping it.\n"); -+ continue; - } -+ -+ DLOG("matching: %p / %s\n", current->con, current->con->name); -+ con_set_layout(current->con, layout); - } - - cmd_output->needs_tree_render = true; -@@ -1654,7 +1455,7 @@ void cmd_layout(I3_CMD, char *layout_str) { - * Implementation of 'layout toggle [all|split]'. - * - */ --void cmd_layout_toggle(I3_CMD, char *toggle_mode) { -+void cmd_layout_toggle(I3_CMD, const char *toggle_mode) { - owindow *current; - - if (toggle_mode == NULL) -@@ -1751,7 +1552,7 @@ void cmd_open(I3_CMD) { - * Implementation of 'focus output <output>'. - * - */ --void cmd_focus_output(I3_CMD, char *name) { -+void cmd_focus_output(I3_CMD, const char *name) { - owindow *current; - - DLOG("name = %s\n", name); -@@ -1793,9 +1594,7 @@ void cmd_focus_output(I3_CMD, char *name) { - * Implementation of 'move [window|container] [to] [absolute] position <px> [px] <px> [px] - * - */ --void cmd_move_window_to_position(I3_CMD, char *method, char *cx, char *cy) { -- int x = atoi(cx); -- int y = atoi(cy); -+void cmd_move_window_to_position(I3_CMD, const char *method, long x, long y) { - bool has_error = false; - - owindow *current; -@@ -1817,7 +1616,7 @@ void cmd_move_window_to_position(I3_CMD, char *method, - current->con->parent->rect.x = x; - current->con->parent->rect.y = y; - -- DLOG("moving to absolute position %d %d\n", x, y); -+ DLOG("moving to absolute position %ld %ld\n", x, y); - floating_maybe_reassign_ws(current->con->parent); - cmd_output->needs_tree_render = true; - } -@@ -1825,7 +1624,7 @@ void cmd_move_window_to_position(I3_CMD, char *method, - if (strcmp(method, "position") == 0) { - Rect newrect = current->con->parent->rect; - -- DLOG("moving to position %d %d\n", x, y); -+ DLOG("moving to position %ld %ld\n", x, y); - newrect.x = x; - newrect.y = y; - -@@ -1842,7 +1641,7 @@ void cmd_move_window_to_position(I3_CMD, char *method, - * Implementation of 'move [window|container] [to] [absolute] position center - * - */ --void cmd_move_window_to_center(I3_CMD, char *method) { -+void cmd_move_window_to_center(I3_CMD, const char *method) { - if (!con_is_floating(focused)) { - ELOG("Cannot change position. The window/container is not floating\n"); - yerror("Cannot change position. The window/container is not floating."); -@@ -1938,7 +1737,7 @@ void cmd_scratchpad_show(I3_CMD) { - * Implementation of 'title_format <format>' - * - */ --void cmd_title_format(I3_CMD, char *format) { -+void cmd_title_format(I3_CMD, const char *format) { - DLOG("setting title_format to \"%s\"\n", format); - HANDLE_EMPTY_MATCH; - -@@ -1975,7 +1774,7 @@ void cmd_title_format(I3_CMD, char *format) { - * Implementation of 'rename workspace [<name>] to <name>' - * - */ --void cmd_rename_workspace(I3_CMD, char *old_name, char *new_name) { -+void cmd_rename_workspace(I3_CMD, const char *old_name, const char *new_name) { - if (strncasecmp(new_name, "__", strlen("__")) == 0) { - LOG("Cannot rename workspace to \"%s\": names starting with __ are i3-internal.\n", new_name); - ysuccess(false); -@@ -2060,7 +1859,7 @@ void cmd_rename_workspace(I3_CMD, char *old_name, char - * Implementation of 'bar mode dock|hide|invisible|toggle [<bar_id>]' - * - */ --bool cmd_bar_mode(char *bar_mode, char *bar_id) { -+bool cmd_bar_mode(const char *bar_mode, const char *bar_id) { - int mode = M_DOCK; - bool toggle = false; - if (strcmp(bar_mode, "dock") == 0) -@@ -2105,7 +1904,7 @@ bool cmd_bar_mode(char *bar_mode, char *bar_id) { - * Implementation of 'bar hidden_state hide|show|toggle [<bar_id>]' - * - */ --bool cmd_bar_hidden_state(char *bar_hidden_state, char *bar_id) { -+bool cmd_bar_hidden_state(const char *bar_hidden_state, const char *bar_id) { - int hidden_state = S_SHOW; - bool toggle = false; - if (strcmp(bar_hidden_state, "hide") == 0) -@@ -2148,7 +1947,7 @@ bool cmd_bar_hidden_state(char *bar_hidden_state, char - * Implementation of 'bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]' - * - */ --void cmd_bar(I3_CMD, char *bar_type, char *bar_value, char *bar_id) { -+void cmd_bar(I3_CMD, const char *bar_type, const char *bar_value, const char *bar_id) { - bool ret; - if (strcmp(bar_type, "mode") == 0) - ret = cmd_bar_mode(bar_value, bar_id); -@@ -2170,7 +1969,7 @@ void cmd_bar(I3_CMD, char *bar_type, char *bar_value, - * Implementation of 'shmlog <size>|toggle|on|off' - * - */ --void cmd_shmlog(I3_CMD, char *argument) { -+void cmd_shmlog(I3_CMD, const char *argument) { - if (!strcmp(argument, "toggle")) - /* Toggle shm log, if size is not 0. If it is 0, set it to default. */ - shmlog_size = shmlog_size ? -shmlog_size : default_shmlog_size; -@@ -2201,7 +2000,7 @@ void cmd_shmlog(I3_CMD, char *argument) { - * Implementation of 'debuglog toggle|on|off' - * - */ --void cmd_debuglog(I3_CMD, char *argument) { -+void cmd_debuglog(I3_CMD, const char *argument) { - bool logging = get_debug_logging(); - if (!strcmp(argument, "toggle")) { - LOG("%s debug logging\n", logging ? "Disabling" : "Enabling"); Index: patches/patch-src_commands_parser_c =================================================================== RCS file: patches/patch-src_commands_parser_c diff -N patches/patch-src_commands_parser_c --- patches/patch-src_commands_parser_c 18 Dec 2015 15:53:09 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,178 +0,0 @@ -$OpenBSD: patch-src_commands_parser_c,v 1.1 2015/12/18 15:53:09 dcoppa Exp $ - -Allow the commands parser to use "number" arguments by making the stack typed. - -Turn "char *" into "const char *" for all command parser functions. - ---- src/commands_parser.c.orig Wed Sep 30 08:55:10 2015 -+++ src/commands_parser.c Fri Dec 18 13:58:58 2015 -@@ -73,7 +73,14 @@ typedef struct tokenptr { - struct stack_entry { - /* Just a pointer, not dynamically allocated. */ - const char *identifier; -- char *str; -+ enum { -+ STACK_STR = 0, -+ STACK_LONG = 1, -+ } type; -+ union { -+ char *str; -+ long num; -+ } val; - }; - - /* 10 entries should be enough for everybody. */ -@@ -90,7 +97,8 @@ static void push_string(const char *identifier, char * - continue; - /* Found a free slot, let???s store it here. */ - stack[c].identifier = identifier; -- stack[c].str = str; -+ stack[c].val.str = str; -+ stack[c].type = STACK_STR; - return; - } - -@@ -103,73 +111,61 @@ static void push_string(const char *identifier, char * - exit(1); - } - --// XXX: ideally, this would be const char. need to check if that works with all --// called functions. --static char *get_string(const char *identifier) { -+// TODO move to a common util -+static void push_long(const char *identifier, long num) { - for (int c = 0; c < 10; c++) { -+ if (stack[c].identifier != NULL) { -+ continue; -+ } -+ -+ stack[c].identifier = identifier; -+ stack[c].val.num = num; -+ stack[c].type = STACK_LONG; -+ return; -+ } -+ -+ /* When we arrive here, the stack is full. This should not happen and -+ * means there's either a bug in this parser or the specification -+ * contains a command with more than 10 identified tokens. */ -+ fprintf(stderr, "BUG: commands_parser stack full. This means either a bug " -+ "in the code, or a new command which contains more than " -+ "10 identified tokens.\n"); -+ exit(1); -+} -+ -+// TODO move to a common util -+static const char *get_string(const char *identifier) { -+ for (int c = 0; c < 10; c++) { - if (stack[c].identifier == NULL) - break; - if (strcmp(identifier, stack[c].identifier) == 0) -- return stack[c].str; -+ return stack[c].val.str; - } - return NULL; - } - --static void clear_stack(void) { -+// TODO move to a common util -+static long get_long(const char *identifier) { - for (int c = 0; c < 10; c++) { -- if (stack[c].str != NULL) -- free(stack[c].str); -- stack[c].identifier = NULL; -- stack[c].str = NULL; -+ if (stack[c].identifier == NULL) -+ break; -+ if (strcmp(identifier, stack[c].identifier) == 0) -+ return stack[c].val.num; - } --} - --// TODO: remove this if it turns out we don???t need it for testing. --#if 0 --/******************************************************************************* -- * A dynamically growing linked list which holds the criteria for the current -- * command. -- ******************************************************************************/ -- --typedef struct criterion { -- char *type; -- char *value; -- -- TAILQ_ENTRY(criterion) criteria; --} criterion; -- --static TAILQ_HEAD(criteria_head, criterion) criteria = -- TAILQ_HEAD_INITIALIZER(criteria); -- --/* -- * Stores the given type/value in the list of criteria. -- * Accepts a pointer as first argument, since it is 'call'ed by the parser. -- * -- */ --static void push_criterion(void *unused_criteria, const char *type, -- const char *value) { -- struct criterion *criterion = smalloc(sizeof(struct criterion)); -- criterion->type = sstrdup(type); -- criterion->value = sstrdup(value); -- TAILQ_INSERT_TAIL(&criteria, criterion, criteria); -+ return 0; - } - --/* -- * Clears the criteria linked list. -- * Accepts a pointer as first argument, since it is 'call'ed by the parser. -- * -- */ --static void clear_criteria(void *unused_criteria) { -- struct criterion *criterion; -- while (!TAILQ_EMPTY(&criteria)) { -- criterion = TAILQ_FIRST(&criteria); -- free(criterion->type); -- free(criterion->value); -- TAILQ_REMOVE(&criteria, criterion, criteria); -- free(criterion); -+// TODO move to a common util -+static void clear_stack(void) { -+ for (int c = 0; c < 10; c++) { -+ if (stack[c].type == STACK_STR && stack[c].val.str != NULL) -+ free(stack[c].val.str); -+ stack[c].identifier = NULL; -+ stack[c].val.str = NULL; -+ stack[c].val.num = 0; - } - } --#endif - - /******************************************************************************* - * The parser itself. -@@ -314,6 +310,29 @@ CommandResult *parse_command(const char *input, yajl_g - break; - } - continue; -+ } -+ -+ if (strcmp(token->name, "number") == 0) { -+ /* Handle numbers. We only accept decimal numbers for now. */ -+ char *end = NULL; -+ errno = 0; -+ long int num = strtol(walk, &end, 10); -+ if ((errno == ERANGE && (num == LONG_MIN || num == LONG_MAX)) || -+ (errno != 0 && num == 0)) -+ continue; -+ -+ /* No valid numbers found */ -+ if (end == walk) -+ continue; -+ -+ if (token->identifier != NULL) -+ push_long(token->identifier, num); -+ -+ /* Set walk to the first non-number character */ -+ walk = end; -+ next_state(token); -+ token_handled = true; -+ break; - } - - if (strcmp(token->name, "string") == 0 || Index: patches/patch-src_con_c =================================================================== RCS file: patches/patch-src_con_c diff -N patches/patch-src_con_c --- patches/patch-src_con_c 18 Dec 2015 15:53:09 -0000 1.16 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,44 +0,0 @@ -$OpenBSD: patch-src_con_c,v 1.16 2015/12/18 15:53:09 dcoppa Exp $ - -Avoid freeze when moving container - -Fix moving windows to a marked workspace by mark. - -Fix crash when trying to split and float a dock container. - ---- src/con.c.orig Wed Sep 30 08:55:10 2015 -+++ src/con.c Fri Dec 18 13:58:58 2015 -@@ -448,6 +448,20 @@ bool con_is_floating(Con *con) { - } - - /* -+ * Returns true if the container is a docked container. -+ * -+ */ -+bool con_is_docked(Con *con) { -+ if (con->parent == NULL) -+ return false; -+ -+ if (con->parent->type == CT_DOCKAREA) -+ return true; -+ -+ return con_is_docked(con->parent); -+} -+ -+/* - * Checks if the given container is either floating or inside some floating - * container. It returns the FLOATING_CON container. - * -@@ -1017,6 +1031,12 @@ bool con_move_to_mark(Con *con, const char *mark) { - if (con_is_floating(target)) { - DLOG("target container is floating, moving container to target's workspace.\n"); - con_move_to_workspace(con, con_get_workspace(target), true, false, false); -+ return true; -+ } -+ -+ if (con->type == CT_WORKSPACE) { -+ DLOG("target container is a workspace, simply moving the container there.\n"); -+ con_move_to_workspace(con, target, true, false, false); - return true; - } - Index: patches/patch-src_config_directives_c =================================================================== RCS file: patches/patch-src_config_directives_c diff -N patches/patch-src_config_directives_c --- patches/patch-src_config_directives_c 18 Dec 2015 15:53:09 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,130 +0,0 @@ -$OpenBSD: patch-src_config_directives_c,v 1.3 2015/12/18 15:53:09 dcoppa Exp $ - -Refactor parsing of matches to avoid code duplication. - -Fix multiple memory leaks with regular expressions. - -Bugfix: set group mask 1 by default, correctly compare modifiers - ---- src/config_directives.c.orig Wed Sep 30 08:55:10 2015 -+++ src/config_directives.c Fri Dec 18 13:58:58 2015 -@@ -29,6 +29,7 @@ CFGFUN(criteria_init, int _state) { - criteria_next_state = _state; - - DLOG("Initializing criteria, current_match = %p, state = %d\n", current_match, _state); -+ match_free(current_match); - match_init(current_match); - } - -@@ -42,110 +43,8 @@ CFGFUN(criteria_pop_state) { - * - */ - CFGFUN(criteria_add, const char *ctype, const char *cvalue) { -- DLOG("ctype=*%s*, cvalue=*%s*\n", ctype, cvalue); -- -- if (strcmp(ctype, "class") == 0) { -- current_match->class = regex_new(cvalue); -- return; -- } -- -- if (strcmp(ctype, "instance") == 0) { -- current_match->instance = regex_new(cvalue); -- return; -- } -- -- if (strcmp(ctype, "window_role") == 0) { -- current_match->window_role = regex_new(cvalue); -- return; -- } -- -- if (strcmp(ctype, "con_id") == 0) { -- char *end; -- long parsed = strtol(cvalue, &end, 10); -- if (parsed == LONG_MIN || -- parsed == LONG_MAX || -- parsed < 0 || -- (end && *end != '\0')) { -- ELOG("Could not parse con id \"%s\"\n", cvalue); -- } else { -- current_match->con_id = (Con *)parsed; -- DLOG("id as int = %p\n", current_match->con_id); -- } -- return; -- } -- -- if (strcmp(ctype, "id") == 0) { -- char *end; -- long parsed = strtol(cvalue, &end, 10); -- if (parsed == LONG_MIN || -- parsed == LONG_MAX || -- parsed < 0 || -- (end && *end != '\0')) { -- ELOG("Could not parse window id \"%s\"\n", cvalue); -- } else { -- current_match->id = parsed; -- DLOG("window id as int = %d\n", current_match->id); -- } -- return; -- } -- -- if (strcmp(ctype, "window_type") == 0) { -- if (strcasecmp(cvalue, "normal") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_NORMAL; -- else if (strcasecmp(cvalue, "dialog") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_DIALOG; -- else if (strcasecmp(cvalue, "utility") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_UTILITY; -- else if (strcasecmp(cvalue, "toolbar") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_TOOLBAR; -- else if (strcasecmp(cvalue, "splash") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_SPLASH; -- else if (strcasecmp(cvalue, "menu") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_MENU; -- else if (strcasecmp(cvalue, "dropdown_menu") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_DROPDOWN_MENU; -- else if (strcasecmp(cvalue, "popup_menu") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_POPUP_MENU; -- else if (strcasecmp(cvalue, "tooltip") == 0) -- current_match->window_type = A__NET_WM_WINDOW_TYPE_TOOLTIP; -- else -- ELOG("unknown window_type value \"%s\"\n", cvalue); -- -- return; -- } -- -- if (strcmp(ctype, "con_mark") == 0) { -- current_match->mark = regex_new(cvalue); -- return; -- } -- -- if (strcmp(ctype, "title") == 0) { -- current_match->title = regex_new(cvalue); -- return; -- } -- -- if (strcmp(ctype, "urgent") == 0) { -- if (strcasecmp(cvalue, "latest") == 0 || -- strcasecmp(cvalue, "newest") == 0 || -- strcasecmp(cvalue, "recent") == 0 || -- strcasecmp(cvalue, "last") == 0) { -- current_match->urgent = U_LATEST; -- } else if (strcasecmp(cvalue, "oldest") == 0 || -- strcasecmp(cvalue, "first") == 0) { -- current_match->urgent = U_OLDEST; -- } -- return; -- } -- -- if (strcmp(ctype, "workspace") == 0) { -- current_match->workspace = regex_new(cvalue); -- return; -- } -- -- ELOG("Unknown criterion: %s\n", ctype); -+ match_parse_property(current_match, ctype, cvalue); - } -- --/* TODO: refactor the above criteria code into a single file (with src/commands.c). */ - - /******************************************************************************* - * Utility functions Index: patches/patch-src_config_parser_c =================================================================== RCS file: /cvs/ports/x11/i3/patches/patch-src_config_parser_c,v retrieving revision 1.8 diff -u -p -u -p -r1.8 patch-src_config_parser_c --- patches/patch-src_config_parser_c 18 Dec 2015 15:53:09 -0000 1.8 +++ patches/patch-src_config_parser_c 8 Mar 2016 09:08:20 -0000 @@ -1,90 +1,14 @@ $OpenBSD: patch-src_config_parser_c,v 1.8 2015/12/18 15:53:09 dcoppa Exp $ - -Allow the commands parser to use "number" arguments by making the stack typed. - ---- src/config_parser.c.orig Wed Sep 30 08:55:10 2015 -+++ src/config_parser.c Fri Dec 18 13:58:58 2015 -@@ -122,7 +122,7 @@ static void push_string(const char *identifier, const - /* When we arrive here, the stack is full. This should not happen and - * means there???s either a bug in this parser or the specification - * contains a command with more than 10 identified tokens. */ -- fprintf(stderr, "BUG: commands_parser stack full. This means either a bug " -+ fprintf(stderr, "BUG: config_parser stack full. This means either a bug " - "in the code, or a new command which contains more than " - "10 identified tokens.\n"); - exit(1); -@@ -142,7 +142,7 @@ static void push_long(const char *identifier, long num - /* When we arrive here, the stack is full. This should not happen and - * means there???s either a bug in this parser or the specification - * contains a command with more than 10 identified tokens. */ -- fprintf(stderr, "BUG: commands_parser stack full. This means either a bug " -+ fprintf(stderr, "BUG: config_parser stack full. This means either a bug " - "in the code, or a new command which contains more than " - "10 identified tokens.\n"); - exit(1); -@@ -178,54 +178,7 @@ static void clear_stack(void) { - } - } - --// TODO: remove this if it turns out we don???t need it for testing. --#if 0 - /******************************************************************************* -- * A dynamically growing linked list which holds the criteria for the current -- * command. -- ******************************************************************************/ -- --typedef struct criterion { -- char *type; -- char *value; -- -- TAILQ_ENTRY(criterion) criteria; --} criterion; -- --static TAILQ_HEAD(criteria_head, criterion) criteria = -- TAILQ_HEAD_INITIALIZER(criteria); -- --/* -- * Stores the given type/value in the list of criteria. -- * Accepts a pointer as first argument, since it is 'call'ed by the parser. -- * -- */ --static void push_criterion(void *unused_criteria, const char *type, -- const char *value) { -- struct criterion *criterion = smalloc(sizeof(struct criterion)); -- criterion->type = sstrdup(type); -- criterion->value = sstrdup(value); -- TAILQ_INSERT_TAIL(&criteria, criterion, criteria); --} -- --/* -- * Clears the criteria linked list. -- * Accepts a pointer as first argument, since it is 'call'ed by the parser. -- * -- */ --static void clear_criteria(void *unused_criteria) { -- struct criterion *criterion; -- while (!TAILQ_EMPTY(&criteria)) { -- criterion = TAILQ_FIRST(&criteria); -- free(criterion->type); -- free(criterion->value); -- TAILQ_REMOVE(&criteria, criterion, criteria); -- free(criterion); -- } --} --#endif -- --/******************************************************************************* - * The parser itself. - ******************************************************************************/ - -@@ -1007,8 +960,8 @@ bool parse_file(const char *f, bool use_nagbar) { - - char *editaction, - *pageraction; -- sasprintf(&editaction, "i3-sensible-editor \"%s\" && i3-msg reload\n", f); -- sasprintf(&pageraction, "i3-sensible-pager \"%s\"\n", errorfilename); -+ sasprintf(&editaction, "/usr/bin/vi \"%s\" && i3-msg reload\n", f); -+ sasprintf(&pageraction, "/usr/bin/less \"%s\"\n", errorfilename); - char *argv[] = { - NULL, /* will be replaced by the executable path */ - "-f", +--- src/config_parser.c.orig Mon Mar 7 15:15:54 2016 ++++ src/config_parser.c Mon Mar 7 15:16:45 2016 +@@ -788,8 +788,8 @@ static char *migrate_config(char *input, off_t size) { + */ + void start_config_error_nagbar(const char *configpath, bool has_errors) { + char *editaction, *pageraction; +- sasprintf(&editaction, "i3-sensible-editor \"%s\" && i3-msg reload\n", configpath); +- sasprintf(&pageraction, "i3-sensible-pager \"%s\"\n", errorfilename); ++ sasprintf(&editaction, "/usr/bin/vi \"%s\" && i3-msg reload\n", configpath); ++ sasprintf(&pageraction, "/usr/bin/less \"%s\"\n", errorfilename); + char *argv[] = { + NULL, /* will be replaced by the executable path */ + "-f", Index: patches/patch-src_floating_c =================================================================== RCS file: patches/patch-src_floating_c diff -N patches/patch-src_floating_c --- patches/patch-src_floating_c 18 Dec 2015 15:53:09 -0000 1.21 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,15 +0,0 @@ -$OpenBSD: patch-src_floating_c,v 1.21 2015/12/18 15:53:09 dcoppa Exp $ - -Fix crash when trying to split and float a dock container. - ---- src/floating.c.orig Wed Sep 30 08:55:10 2015 -+++ src/floating.c Fri Dec 18 13:58:58 2015 -@@ -108,7 +108,7 @@ void floating_check_size(Con *floating_con) { - void floating_enable(Con *con, bool automatic) { - bool set_focus = (con == focused); - -- if (con->parent && con->parent->type == CT_DOCKAREA) { -+ if (con_is_docked(con)) { - LOG("Container is a dock window, not enabling floating mode.\n"); - return; - } Index: patches/patch-src_i3_mk =================================================================== RCS file: /cvs/ports/x11/i3/patches/patch-src_i3_mk,v retrieving revision 1.10 diff -u -p -u -p -r1.10 patch-src_i3_mk --- patches/patch-src_i3_mk 4 Oct 2015 08:48:12 -0000 1.10 +++ patches/patch-src_i3_mk 8 Mar 2016 09:08:20 -0000 @@ -8,11 +8,11 @@ with libpthread here. @@ -6,7 +6,11 @@ i3_SOURCES := $(filter-out $(i3_SOURCES_GENE i3_HEADERS_CMDPARSER := $(wildcard include/GENERATED_*.h) i3_HEADERS := $(filter-out $(i3_HEADERS_CMDPARSER),$(wildcard include/*.h)) - i3_CFLAGS = $(XKB_COMMON_CFLAGS) $(XKB_COMMON_X11_CFLAGS) $(XCB_CFLAGS) $(XCB_KBD_CFLAGS) $(XCB_WM_CFLAGS) $(XCURSOR_CFLAGS) $(PANGO_CFLAGS) $(YAJL_CFLAGS) $(LIBEV_CFLAGS) $(PCRE_CFLAGS) $(LIBSN_CFLAGS) + i3_CFLAGS = $(XKB_COMMON_CFLAGS) $(XKB_COMMON_X11_CFLAGS) $(XCB_CFLAGS) $(XCB_KBD_CFLAGS) $(XCB_WM_CFLAGS) $(XCB_CURSOR_CFLAGS) $(PANGO_CFLAGS) $(YAJL_CFLAGS) $(LIBEV_CFLAGS) $(PCRE_CFLAGS) $(LIBSN_CFLAGS) +ifneq ($(UNAME),OpenBSD) - i3_LIBS = $(XKB_COMMON_LIBS) $(XKB_COMMON_X11_LIBS) $(XCB_LIBS) $(XCB_XKB_LIBS) $(XCB_KBD_LIBS) $(XCB_WM_LIBS) $(XCURSOR_LIBS) $(PANGO_LIBS) $(YAJL_LIBS) $(LIBEV_LIBS) $(PCRE_LIBS) $(LIBSN_LIBS) -lm -lpthread + i3_LIBS = $(XKB_COMMON_LIBS) $(XKB_COMMON_X11_LIBS) $(XCB_LIBS) $(XCB_XKB_LIBS) $(XCB_KBD_LIBS) $(XCB_WM_LIBS) $(XCB_CURSOR_LIBS) $(PANGO_LIBS) $(YAJL_LIBS) $(LIBEV_LIBS) $(PCRE_LIBS) $(LIBSN_LIBS) -lm -lpthread +else -+i3_LIBS = $(XKB_COMMON_LIBS) $(XKB_COMMON_X11_LIBS) $(XCB_LIBS) $(XCB_XKB_LIBS) $(XCB_KBD_LIBS) $(XCB_WM_LIBS) $(XCURSOR_LIBS) $(PANGO_LIBS) $(YAJL_LIBS) $(LIBEV_LIBS) $(PCRE_LIBS) $(LIBSN_LIBS) -lm ++i3_LIBS = $(XKB_COMMON_LIBS) $(XKB_COMMON_X11_LIBS) $(XCB_LIBS) $(XCB_XKB_LIBS) $(XCB_KBD_LIBS) $(XCB_WM_LIBS) $(XCB_CURSOR_LIBS) $(PANGO_LIBS) $(YAJL_LIBS) $(LIBEV_LIBS) $(PCRE_LIBS) $(LIBSN_LIBS) -lm +endif # When using clang, we use pre-compiled headers to speed up the build. With Index: patches/patch-src_ipc_c =================================================================== RCS file: /cvs/ports/x11/i3/patches/patch-src_ipc_c,v retrieving revision 1.15 diff -u -p -u -p -r1.15 patch-src_ipc_c --- patches/patch-src_ipc_c 18 Dec 2015 15:53:09 -0000 1.15 +++ patches/patch-src_ipc_c 8 Mar 2016 09:08:20 -0000 @@ -2,10 +2,8 @@ $OpenBSD: patch-src_ipc_c,v 1.15 2015/12 Add missing header -fix a memory leak in handle_get_bar_config - ---- src/ipc.c.orig Wed Sep 30 08:55:10 2015 -+++ src/ipc.c Fri Dec 18 13:58:58 2015 +--- src/ipc.c.orig Sun Jun 15 19:12:43 2014 ++++ src/ipc.c Fri Jul 11 16:39:36 2014 @@ -12,6 +12,7 @@ #include "all.h" #include "yajl_utils.h" @@ -14,22 +12,3 @@ fix a memory leak in handle_get_bar_conf #include <sys/socket.h> #include <sys/un.h> #include <fcntl.h> -@@ -894,8 +895,8 @@ IPC_HANDLER(get_bar_config) { - - /* To get a properly terminated buffer, we copy - * message_size bytes out of the buffer */ -- char *bar_id = scalloc(message_size + 1, 1); -- strncpy(bar_id, (const char *)message, message_size); -+ char *bar_id = NULL; -+ sasprintf(&bar_id, "%.*s", message_size, message); - LOG("IPC: looking for config for bar ID \"%s\"\n", bar_id); - Barconfig *current, *config = NULL; - TAILQ_FOREACH(current, &barconfigs, configs) { -@@ -905,6 +906,7 @@ IPC_HANDLER(get_bar_config) { - config = current; - break; - } -+ free(bar_id); - - if (!config) { - /* If we did not find a config for the given ID, the reply will contain Index: patches/patch-src_log_c =================================================================== RCS file: /cvs/ports/x11/i3/patches/patch-src_log_c,v retrieving revision 1.11 diff -u -p -u -p -r1.11 patch-src_log_c --- patches/patch-src_log_c 18 Jan 2016 10:04:29 -0000 1.11 +++ patches/patch-src_log_c 8 Mar 2016 09:08:20 -0000 @@ -2,8 +2,8 @@ $OpenBSD: patch-src_log_c,v 1.11 2016/01 OpenBSD lacks pthread_condattr_setpshared() ---- src/log.c.orig Wed Sep 30 08:55:10 2015 -+++ src/log.c Sun Jan 17 23:10:44 2016 +--- src/log.c.orig Sun Mar 6 16:17:18 2016 ++++ src/log.c Mon Mar 7 15:15:37 2016 @@ -20,7 +20,9 @@ #include <sys/mman.h> #include <sys/stat.h> @@ -14,49 +14,7 @@ OpenBSD lacks pthread_condattr_setpshare #include "util.h" #include "log.h" -@@ -58,6 +60,8 @@ static char *loglastwrap; - static int logbuffer_size; - /* File descriptor for shm_open. */ - static int logbuffer_shm; -+/* Size (in bytes) of physical memory */ -+static long long physical_mem_bytes; - - /* - * Writes the offsets for the next write and for the last wrap to the -@@ -89,6 +93,16 @@ void init_logging(void) { - } - } - } -+ if (physical_mem_bytes == 0) { -+#if defined(__APPLE__) -+ int mib[2] = {CTL_HW, HW_MEMSIZE}; -+ size_t length = sizeof(long long); -+ sysctl(mib, 2, &physical_mem_bytes, &length, NULL, 0); -+#else -+ physical_mem_bytes = (long long)sysconf(_SC_PHYS_PAGES) * -+ sysconf(_SC_PAGESIZE); -+#endif -+ } - /* Start SHM logging if shmlog_size is > 0. shmlog_size is SHMLOG_SIZE by - * default on development versions, and 0 on release versions. If it is - * not > 0, the user has turned it off, so let's close the logbuffer. */ -@@ -108,15 +122,6 @@ void open_logbuffer(void) { - * For 512 MiB of RAM this will lead to a 5 MiB log buffer. - * At the moment (2011-12-10), no testcase leads to an i3 log - * of more than ~ 600 KiB. */ -- long long physical_mem_bytes; --#if defined(__APPLE__) -- int mib[2] = {CTL_HW, HW_MEMSIZE}; -- size_t length = sizeof(long long); -- sysctl(mib, 2, &physical_mem_bytes, &length, NULL, 0); --#else -- physical_mem_bytes = (long long)sysconf(_SC_PHYS_PAGES) * -- sysconf(_SC_PAGESIZE); --#endif - logbuffer_size = min(physical_mem_bytes * 0.01, shmlog_size); - #if defined(__FreeBSD__) - sasprintf(&shmlogname, "/tmp/i3-log-%d", getpid()); -@@ -154,11 +159,13 @@ void open_logbuffer(void) { +@@ -157,11 +159,13 @@ void open_logbuffer(void) { header = (i3_shmlog_header *)logbuffer; @@ -70,7 +28,7 @@ OpenBSD lacks pthread_condattr_setpshare logwalk = logbuffer + sizeof(i3_shmlog_header); loglastwrap = logbuffer + logbuffer_size; -@@ -273,8 +280,10 @@ static void vlog(const bool print, const char *fmt, va +@@ -277,8 +281,10 @@ static void vlog(const bool print, const char *fmt, va store_log_markers(); Index: patches/patch-src_main_c =================================================================== RCS file: patches/patch-src_main_c diff -N patches/patch-src_main_c --- patches/patch-src_main_c 26 Jan 2016 09:42:35 -0000 1.17 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,57 +0,0 @@ -$OpenBSD: patch-src_main_c,v 1.17 2016/01/26 09:42:35 dcoppa Exp $ - -Bugfix: add keymap fall back (_XKB_RULES_NAMES, then defaults) - -commit a1d1f456a1fbf44bfa5c6a9d041023ac498b0c46 -Author: Theo Buehler <t...@math.ethz.ch> -Date: Thu Jan 14 10:06:34 2016 +0100 - -Add pledge(2) support for OpenBSD - -pledges for i3: -"stdio rpath unix" for talking to the i3 socket usually in /tmp -"proc exec" for executing programs -"wpath cpath" are needed for the restart-in-place functionality - -To make this work, @semarie pointed out that it is sufficient to ensure -that we get physical_mem_bytes only once, namely in init_logging(). - -pledges for i3-msg: -"stdio rpath unix" are needed for talking to the i3-socket - -pledges for i3-nagbar -"rpath getpw" to find the home directory -"wpath cpath" to write the script -"proc exec" to execute the script -"unix" for talking to the i3 socket - ---- src/main.c.orig Wed Sep 30 08:55:10 2015 -+++ src/main.c Sun Jan 17 17:55:53 2016 -@@ -87,6 +87,7 @@ struct ws_assignments_head ws_assignments = TAILQ_HEAD - - /* We hope that those are supported and set them to true */ - bool xcursor_supported = true; -+bool xkb_supported = true; - - /* - * This callback is only a dummy, see xcb_prepare_cb and xcb_check_cb. -@@ -543,6 +544,7 @@ int main(int argc, char *argv[]) { - - const xcb_query_extension_reply_t *extreply; - extreply = xcb_get_extension_data(conn, &xcb_xkb_id); -+ xkb_supported = extreply->present; - if (!extreply->present) { - DLOG("xkb is not present on this server\n"); - } else { -@@ -784,6 +786,11 @@ int main(int argc, char *argv[]) { - xcb_free_gc(conn, gc); - xcb_free_pixmap(conn, pixmap); - } -+ -+#if defined(__OpenBSD__) -+ if (pledge("stdio rpath wpath cpath proc exec unix", NULL) == -1) -+ err(EXIT_FAILURE, "pledge"); -+#endif - - struct sigaction action; - Index: patches/patch-src_manage_c =================================================================== RCS file: patches/patch-src_manage_c diff -N patches/patch-src_manage_c --- patches/patch-src_manage_c 18 Dec 2015 15:53:09 -0000 1.17 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,44 +0,0 @@ -$OpenBSD: patch-src_manage_c,v 1.17 2015/12/18 15:53:09 dcoppa Exp $ - -Suppress no_focus for first window on a workspace. - -Fix multiple memory leaks with regular expressions. - ---- src/manage.c.orig Wed Sep 30 08:55:10 2015 -+++ src/manage.c Fri Dec 18 13:58:58 2015 -@@ -294,6 +294,7 @@ void manage_window(xcb_window_t window, xcb_get_window - if (match != NULL && match->insert_where != M_BELOW) { - DLOG("Removing match %p from container %p\n", match, nc); - TAILQ_REMOVE(&(nc->swallow_head), match, matches); -+ match_free(match); - } - } - -@@ -524,13 +525,23 @@ void manage_window(xcb_window_t window, xcb_get_window - /* Send an event about window creation */ - ipc_send_window_event("new", nc); - -+ if (set_focus && assignment_for(cwindow, A_NO_FOCUS) != NULL) { -+ /* The first window on a workspace should always be focused. We have to -+ * compare with == 1 because the container has already been inserted at -+ * this point. */ -+ if (con_num_children(ws) == 1) { -+ DLOG("This is the first window on this workspace, ignoring no_focus.\n"); -+ } else { -+ DLOG("no_focus was set for con = %p, not setting focus.\n", nc); -+ set_focus = false; -+ } -+ } -+ - /* Defer setting focus after the 'new' event has been sent to ensure the - * proper window event sequence. */ - if (set_focus && !nc->window->doesnt_accept_focus && nc->mapped) { -- if (assignment_for(cwindow, A_NO_FOCUS) == NULL) { -- DLOG("Now setting focus.\n"); -- con_focus(nc); -- } -+ DLOG("Now setting focus.\n"); -+ con_focus(nc); - } - - tree_render(); Index: patches/patch-src_match_c =================================================================== RCS file: patches/patch-src_match_c diff -N patches/patch-src_match_c --- patches/patch-src_match_c 18 Dec 2015 15:53:09 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,143 +0,0 @@ -$OpenBSD: patch-src_match_c,v 1.1 2015/12/18 15:53:09 dcoppa Exp $ - -Refactor parsing of matches to avoid code duplication. - -Fix multiple memory leaks with regular expressions. - ---- src/match.c.orig Wed Sep 30 08:55:10 2015 -+++ src/match.c Fri Dec 18 13:58:58 2015 -@@ -238,19 +238,126 @@ bool match_matches_window(Match *match, i3Window *wind - * - */ - void match_free(Match *match) { -- /* First step: free the regex fields / patterns */ - regex_free(match->title); - regex_free(match->application); - regex_free(match->class); - regex_free(match->instance); - regex_free(match->mark); - regex_free(match->window_role); -+ regex_free(match->workspace); -+} - -- /* Second step: free the regex helper struct itself */ -- FREE(match->title); -- FREE(match->application); -- FREE(match->class); -- FREE(match->instance); -- FREE(match->mark); -- FREE(match->window_role); -+/* -+ * Interprets a ctype=cvalue pair and adds it to the given match specification. -+ * -+ */ -+void match_parse_property(Match *match, const char *ctype, const char *cvalue) { -+ assert(match != NULL); -+ DLOG("ctype=*%s*, cvalue=*%s*\n", ctype, cvalue); -+ -+ if (strcmp(ctype, "class") == 0) { -+ regex_free(match->class); -+ match->class = regex_new(cvalue); -+ return; -+ } -+ -+ if (strcmp(ctype, "instance") == 0) { -+ regex_free(match->instance); -+ match->instance = regex_new(cvalue); -+ return; -+ } -+ -+ if (strcmp(ctype, "window_role") == 0) { -+ regex_free(match->window_role); -+ match->window_role = regex_new(cvalue); -+ return; -+ } -+ -+ if (strcmp(ctype, "con_id") == 0) { -+ char *end; -+ long parsed = strtol(cvalue, &end, 10); -+ if (parsed == LONG_MIN || -+ parsed == LONG_MAX || -+ parsed < 0 || -+ (end && *end != '\0')) { -+ ELOG("Could not parse con id \"%s\"\n", cvalue); -+ } else { -+ match->con_id = (Con *)parsed; -+ DLOG("id as int = %p\n", match->con_id); -+ } -+ return; -+ } -+ -+ if (strcmp(ctype, "id") == 0) { -+ char *end; -+ long parsed = strtol(cvalue, &end, 10); -+ if (parsed == LONG_MIN || -+ parsed == LONG_MAX || -+ parsed < 0 || -+ (end && *end != '\0')) { -+ ELOG("Could not parse window id \"%s\"\n", cvalue); -+ } else { -+ match->id = parsed; -+ DLOG("window id as int = %d\n", match->id); -+ } -+ return; -+ } -+ -+ if (strcmp(ctype, "window_type") == 0) { -+ if (strcasecmp(cvalue, "normal") == 0) -+ match->window_type = A__NET_WM_WINDOW_TYPE_NORMAL; -+ else if (strcasecmp(cvalue, "dialog") == 0) -+ match->window_type = A__NET_WM_WINDOW_TYPE_DIALOG; -+ else if (strcasecmp(cvalue, "utility") == 0) -+ match->window_type = A__NET_WM_WINDOW_TYPE_UTILITY; -+ else if (strcasecmp(cvalue, "toolbar") == 0) -+ match->window_type = A__NET_WM_WINDOW_TYPE_TOOLBAR; -+ else if (strcasecmp(cvalue, "splash") == 0) -+ match->window_type = A__NET_WM_WINDOW_TYPE_SPLASH; -+ else if (strcasecmp(cvalue, "menu") == 0) -+ match->window_type = A__NET_WM_WINDOW_TYPE_MENU; -+ else if (strcasecmp(cvalue, "dropdown_menu") == 0) -+ match->window_type = A__NET_WM_WINDOW_TYPE_DROPDOWN_MENU; -+ else if (strcasecmp(cvalue, "popup_menu") == 0) -+ match->window_type = A__NET_WM_WINDOW_TYPE_POPUP_MENU; -+ else if (strcasecmp(cvalue, "tooltip") == 0) -+ match->window_type = A__NET_WM_WINDOW_TYPE_TOOLTIP; -+ else -+ ELOG("unknown window_type value \"%s\"\n", cvalue); -+ -+ return; -+ } -+ -+ if (strcmp(ctype, "con_mark") == 0) { -+ regex_free(match->mark); -+ match->mark = regex_new(cvalue); -+ return; -+ } -+ -+ if (strcmp(ctype, "title") == 0) { -+ regex_free(match->title); -+ match->title = regex_new(cvalue); -+ return; -+ } -+ -+ if (strcmp(ctype, "urgent") == 0) { -+ if (strcasecmp(cvalue, "latest") == 0 || -+ strcasecmp(cvalue, "newest") == 0 || -+ strcasecmp(cvalue, "recent") == 0 || -+ strcasecmp(cvalue, "last") == 0) { -+ match->urgent = U_LATEST; -+ } else if (strcasecmp(cvalue, "oldest") == 0 || -+ strcasecmp(cvalue, "first") == 0) { -+ match->urgent = U_OLDEST; -+ } -+ return; -+ } -+ -+ if (strcmp(ctype, "workspace") == 0) { -+ regex_free(match->workspace); -+ match->workspace = regex_new(cvalue); -+ return; -+ } -+ -+ ELOG("Unknown criterion: %s\n", ctype); - } Index: patches/patch-src_randr_c =================================================================== RCS file: patches/patch-src_randr_c diff -N patches/patch-src_randr_c --- patches/patch-src_randr_c 18 Dec 2015 15:53:09 -0000 1.11 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,62 +0,0 @@ -$OpenBSD: patch-src_randr_c,v 1.11 2015/12/18 15:53:09 dcoppa Exp $ - -Activate root output if RandR request fails. - ---- src/randr.c.orig Wed Sep 30 08:55:10 2015 -+++ src/randr.c Fri Dec 18 13:58:58 2015 -@@ -604,7 +604,6 @@ void randr_query_outputs(void) { - Output *output, *other, *first; - xcb_randr_get_output_primary_cookie_t pcookie; - xcb_randr_get_screen_resources_current_cookie_t rcookie; -- resources_reply *res; - - /* timestamp of the configuration so that we get consistent replies to all - * requests (if the configuration changes between our different calls) */ -@@ -621,28 +620,31 @@ void randr_query_outputs(void) { - ELOG("Could not get RandR primary output\n"); - else - DLOG("primary output is %08x\n", primary->output); -- if ((res = xcb_randr_get_screen_resources_current_reply(conn, rcookie, NULL)) == NULL) -- return; - -- cts = res->config_timestamp; -+ resources_reply *res = xcb_randr_get_screen_resources_current_reply(conn, rcookie, NULL); -+ if (res == NULL) { -+ ELOG("Could not query screen resources.\n"); -+ } else { -+ cts = res->config_timestamp; - -- int len = xcb_randr_get_screen_resources_current_outputs_length(res); -- randr_outputs = xcb_randr_get_screen_resources_current_outputs(res); -+ int len = xcb_randr_get_screen_resources_current_outputs_length(res); -+ randr_outputs = xcb_randr_get_screen_resources_current_outputs(res); - -- /* Request information for each output */ -- xcb_randr_get_output_info_cookie_t ocookie[len]; -- for (int i = 0; i < len; i++) -- ocookie[i] = xcb_randr_get_output_info(conn, randr_outputs[i], cts); -+ /* Request information for each output */ -+ xcb_randr_get_output_info_cookie_t ocookie[len]; -+ for (int i = 0; i < len; i++) -+ ocookie[i] = xcb_randr_get_output_info(conn, randr_outputs[i], cts); - -- /* Loop through all outputs available for this X11 screen */ -- for (int i = 0; i < len; i++) { -- xcb_randr_get_output_info_reply_t *output; -+ /* Loop through all outputs available for this X11 screen */ -+ for (int i = 0; i < len; i++) { -+ xcb_randr_get_output_info_reply_t *output; - -- if ((output = xcb_randr_get_output_info_reply(conn, ocookie[i], NULL)) == NULL) -- continue; -+ if ((output = xcb_randr_get_output_info_reply(conn, ocookie[i], NULL)) == NULL) -+ continue; - -- handle_output(conn, randr_outputs[i], output, cts, res); -- free(output); -+ handle_output(conn, randr_outputs[i], output, cts, res); -+ free(output); -+ } - } - - /* If there's no randr output, enable the output covering the root window. */ Index: patches/patch-src_regex_c =================================================================== RCS file: patches/patch-src_regex_c diff -N patches/patch-src_regex_c --- patches/patch-src_regex_c 18 Dec 2015 15:53:09 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ -$OpenBSD: patch-src_regex_c,v 1.1 2015/12/18 15:53:09 dcoppa Exp $ - -Fix multiple memory leaks with regular expressions. - ---- src/regex.c.orig Wed Sep 30 08:55:10 2015 -+++ src/regex.c Fri Dec 18 13:58:58 2015 -@@ -64,6 +64,7 @@ void regex_free(struct regex *regex) { - FREE(regex->pattern); - FREE(regex->regex); - FREE(regex->extra); -+ FREE(regex); - } - - /* Index: patches/patch-src_startup_c =================================================================== RCS file: /cvs/ports/x11/i3/patches/patch-src_startup_c,v retrieving revision 1.6 diff -u -p -u -p -r1.6 patch-src_startup_c --- patches/patch-src_startup_c 18 Dec 2015 15:53:09 -0000 1.6 +++ patches/patch-src_startup_c 8 Mar 2016 09:08:20 -0000 @@ -2,10 +2,8 @@ $OpenBSD: patch-src_startup_c,v 1.6 2015 On OpenBSD, time_t is long long. -Turn "char *" into "const char *" for all command parser functions. - ---- src/startup.c.orig Wed Sep 30 08:55:10 2015 -+++ src/startup.c Fri Dec 18 13:58:58 2015 +--- src/startup.c.orig Sun Jun 15 19:12:43 2014 ++++ src/startup.c Wed Jul 2 20:42:22 2014 @@ -103,8 +103,8 @@ static int _prune_startup_sequences(void) { */ void startup_sequence_delete(struct Startup_Sequence *sequence) { @@ -28,12 +26,3 @@ Turn "char *" into "const char *" for al if (_prune_startup_sequences() == 0) { DLOG("No more startup sequences running, changing root window cursor to default pointer.\n"); -@@ -261,7 +261,7 @@ void startup_monitor_event(SnMonitorEvent *event, void - * Renames workspaces that are mentioned in the startup sequences. - * - */ --void startup_sequence_rename_workspace(char *old_name, char *new_name) { -+void startup_sequence_rename_workspace(const char *old_name, const char *new_name) { - struct Startup_Sequence *current; - TAILQ_FOREACH(current, &startup_sequences, sequences) { - if (strcmp(current->workspace, old_name) != 0) Index: patches/patch-src_workspace_c =================================================================== RCS file: patches/patch-src_workspace_c diff -N patches/patch-src_workspace_c --- patches/patch-src_workspace_c 18 Dec 2015 15:53:09 -0000 1.15 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,15 +0,0 @@ -$OpenBSD: patch-src_workspace_c,v 1.15 2015/12/18 15:53:09 dcoppa Exp $ - -Turn "char *" into "const char *" for all command parser functions. - ---- src/workspace.c.orig Wed Sep 30 08:55:10 2015 -+++ src/workspace.c Fri Dec 18 13:58:58 2015 -@@ -918,7 +918,7 @@ Con *workspace_encapsulate(Con *ws) { - * Move the given workspace to the specified output. - * This returns true if and only if moving the workspace was successful. - */ --bool workspace_move_to_output(Con *ws, char *name) { -+bool workspace_move_to_output(Con *ws, const char *name) { - LOG("Trying to move workspace %p / %s to output \"%s\".\n", ws, ws->name, name); - - Con *current_output_con = con_get_output(ws);