Commit Graph

50 Commits

Author SHA1 Message Date
Tony Crisci
70360c5c07 Add timestamp to log messages 2016-07-28 22:15:14 -04:00
Drew DeVault
c8917395c0 Remove SIGSERV and SIGABORT handler
From now on let's just let the core dumps happen and ask users to
provide them.
2016-07-17 11:29:29 -04:00
David Eklov
26842ff383 Add get_log_level() to encapsulate v (current log level)
This patch also makes all global variable in log.c static.
2016-06-27 18:56:50 -05:00
Zandr Martin
9ecb43ea3b
couple small fixes 2016-06-11 15:29:04 -05:00
Zandr Martin
2298143d09
cleanup + add timeouts for pid_workspace list 2016-06-11 12:43:34 -05:00
Zandr Martin
66caee645c Merge branch 'master' into assign-command 2016-06-11 09:33:24 -05:00
Zandr Martin
03d79b41c7
semi-working (only non-client/server wayland apps) 2016-06-10 06:08:59 -05:00
Roosembert Palacios
230591fa4e
Common: Readline: Ignore newline on '\' escaped line ends.
Escape line return when reading from a file with the '\' character.
Similar to shell scripts.

Signed-off-by: Roosembert Palacios <roosembert.palacios@epfl.ch>
2016-06-06 00:17:27 +02:00
Zandr Martin
9ccc92705e implement stable sort for lists
also change sort_workspaces() to use it
2016-06-02 15:48:14 -05:00
Eric Engestrom
cc9d1cacbb common: refactor sway_log()
This removes most preprocessor logic, leaving it only it the header.
2016-05-02 18:30:04 +01:00
Eric Engestrom
f53ddbe800 common: fix double-close in error_handler() 2016-05-02 15:58:32 +01:00
Eric Engestrom
a1bb58017b Fix off-by-one bug in log functions 2016-05-02 12:04:14 +01:00
Eric Engestrom
aece36cd22 common: fix potential buffer overflow 2016-05-01 13:57:23 +01:00
Daniel Lockyer
235cfd93b2 common/stringop.c: a premature decrement meant an element of argv was never released 2016-04-29 18:00:21 +01:00
Tomáš Čech
bcdeb72189 Explicitly mark static linking in CMake
When no type is given, it depends on BUILD_SHARED_LIBS value which is
not desired in this case.
2016-04-28 20:13:26 +02:00
Tomáš Čech
468ddfb34d Fix missing include paths
When headers were installed in more sofisticated places (but package
config knows it right), it revealed missing paths in CMake
configuration. Lets fix it.
2016-04-28 20:08:41 +02:00
Eric Engestrom
3e8081514d Fix spelling mistakes 2016-04-02 16:00:05 +01:00
Dominique Martinet
234932723c CMake: add missing wlc include dir for common and swaygrab 2016-03-24 18:26:01 -04:00
Mikkel Oscar Lyderik
1d010afbf7 Abort when receiving 0 bytes in IPC call
When sway crashes a swaybar process is sometimes left behind running at
100% CPU. This was caused by the swaybar trying to retrieve an IPC
response from the closed sway socket.

This patch fixes the problem by aborting when the socket has been closed
(recv return 0).

Fix #528
2016-03-22 11:27:39 +01:00
Mikkel Oscar Lyderik
5e253fdd9a Correctly exit sway on errors.
Calling `exit` in sway_terminate prevents sway from correctly shutting
down (freeing data, cleanly terminating the ipc server, etc.).

A better way is to exit straight away if the failure occurs before
`wlc_run` and use sway_abort as usual if it occur when wlc is running.
2016-02-26 09:42:21 +01:00
Mikkel Oscar Lyderik
bacd40d6db Fix clang warnings 2016-02-08 12:30:42 +01:00
Drew DeVault
e5bb08cc18 Print /proc/<pid>/maps on segfault 2016-01-28 07:57:07 -05:00
Mikkel Oscar Lyderik
32ae26e519 Add quotes to multiword arguments.
This adds quotes around multiword arguments before they are passed to
`/bin/sh -c` in an exec command.

Example:

I connect to irc like this:

    exec termite -e "mosh server tmux a"

Without this patch the arguments are passed to sh as:

    termite -e mosh server tmux a

When it should be:

    termite -e "mosh server tmux a"

For the command to work.
2016-01-25 00:14:13 +01:00
Mikkel Oscar Lyderik
c8cf3f70f9 numlen(0) == 1 2016-01-24 03:02:51 +01:00
Mikkel Oscar Lyderik
2707be7199 use log10 in numlen 2016-01-24 02:59:58 +01:00
Drew DeVault
a416715372 Revert "s/numlen/log10/g"
This reverts commit 038bb8cc7c.
2016-01-23 16:35:32 -05:00
Drew DeVault
038bb8cc7c s/numlen/log10/g 2016-01-23 15:51:38 -05:00
Mikkel Oscar Lyderik
dffacea831 Add function for getting list of modifier names.
Get an array of modifier names from modifier masks.
2016-01-08 03:03:40 +01:00
Mikkel Oscar Lyderik
95e0f44c73 Move modifier name table to common/util.c
Lookup of modifier names is required in several places, thus it makes
sense to move it to a general place.
2016-01-05 18:36:24 +01:00
Mikkel Oscar Lyderik
7298a9c67a Add type to returned response.
Makes `ipc_recv_response` return a struct with size, type and payload
rather than just the payload string.

This is useful if the type has to be checked on the client.
2016-01-03 20:40:50 +01:00
progandy
8fefdb3c64 swaybar: fix memory leaks 2015-12-22 17:54:47 +01:00
robotanarchy
c3e9ee5e43 replace non-standard qsort_r with qsort
I've tried to make as few changes, as possible.

Usually the reason for using qsort_r is, that you can pass an extra userdata pointer to the
compare function. However, in sway list_sort wrapped qsort_r and always called a wrapper
function for comparing, the wrapper function then had the real compare function as argument.
The only thing, that the wrapper function does, is dereferencing the 'left' and 'right' function
arguments before passing them to the real compare function.

I have renamed list_sort to list_qsort to avoid confusion (so nobody tries to use list_qsort like
list_sort) and removed the wrapper functionality. Now the dereferencing must be done in the
compare function, that gets passed.

Some compare functions were used in both list_sort and list_seq_find. To make the difference
clear, I've added a '_qsort' suffix to the compare functions, that are intended to be used with
the new list_qsort. (In other words: list_qsort is not compatible anymore with list_seq_find).

- Changed and renamed function (it isn't used anywhere but in commands.c, and only for sorting):
	compare_set -> compare_set_qsort
- New wrapper functions:
	sway_binding_cmp_qsort (for sway_binding_cmp)
	sway_mouse_binding_cmp_qsort (for sway_mouse_binding_cmp)
2015-12-22 00:38:18 +01:00
robotanarchy
470e59b291 fix backtrace detection in CMake
works on arch (glibc) and void linux (tested with musl libc) now
2015-12-22 00:32:41 +01:00
robotanarchy
94cac7a014 use CMake's FindBacktrace for backtrace feature detection 2015-12-21 19:01:17 +01:00
Mikkel Oscar Lyderik
cf56c41c10 Move sway/util.c to common/util.c 2015-12-14 17:17:06 +01:00
Drew DeVault
e277d4e094 Subscribe to workspace change events and redraw 2015-12-13 16:04:54 -05:00
Christoph Gysin
76920d2759 remove archive from git, add *.a to gitignore 2015-12-03 15:52:21 +02:00
Drew DeVault
71afa38890 Add swaylock protocol, add resource destructors
This prevents sway crashing if swaybg or swaybar dies.
2015-12-03 08:35:22 -05:00
Christoph Gysin
cce9c338c0 cmake: build common code only once
This creates (static) libraries for protocols/, common/, and wayland/.
2015-12-02 12:15:57 +02:00
Drew DeVault
5a369b3132 Only strip comments at the start of a line
This is necessary because i3 config files use CSS notation for colors
(i.e. #rrggbb).
2015-11-29 14:02:58 -05:00
Drew DeVault
8b1de6df30 Fix incorrect #include on ipc-client.c 2015-11-28 08:57:45 -05:00
Drew DeVault
062c74b7d0 Add command line to swaygrab
Also modifies IPC client so that we can work with persistent
connections.
2015-11-27 10:10:29 -05:00
Drew DeVault
27f03c705d Move IPC client into common, refactor IPC 2015-11-27 09:50:04 -05:00
Drew DeVault
9a15371ba3 Parse command line args for swaymsg 2015-11-26 14:31:29 -05:00
taiyu
9d50f88cef fix list sorting 2015-11-24 00:30:02 -08:00
S. Christoffer Eliesen
5531dbe1b2 cmd_workspace: Don't fill up config->workspace_outputs with duplicates.
This also fixes a bug where issuing a new "workspace a output b" command
for an already assigned workspace would not work (the old config would
be found first and used instead).
2015-11-22 11:08:08 +01:00
S. Christoffer Eliesen
a33e3badad list: Add list_seq_find.
Sometimes one has to traverse a list to find out if some data already
exists there in order to avoid dupilcates in the list, and this function
facilitates in that without requiring that the data is ordered.
2015-11-21 22:22:08 +01:00
Drew DeVault
fd1a59def3 Clean up CMake stuff 2015-11-13 07:17:48 -05:00
Ben Boeckel
ec013d1f1a common: create a static library 2015-11-12 21:56:14 -05:00
Drew DeVault
bfcabe48ef Start fleshing out wayland client implementation
This introduces a basic shared framework for making wayland clients
within sway itself.
2015-11-12 19:04:01 -05:00