mirror of
https://github.com/swaywm/sway.git
synced 2026-03-30 11:10:59 -04:00
Revert "Merge remote-tracking branch 'besser82/bugfix/json-c' into 0.15"
This reverts commit1c4a086e75, reversing changes made to1263ea6497.
This commit is contained in:
parent
1c4a086e75
commit
d0bd0ed598
9 changed files with 17 additions and 48 deletions
|
|
@ -6,11 +6,6 @@ compiler:
|
||||||
- gcc
|
- gcc
|
||||||
- clang
|
- clang
|
||||||
|
|
||||||
env:
|
|
||||||
- BUILD_TYPE=Release
|
|
||||||
- BUILD_TYPE=Debug
|
|
||||||
- BUILD_TYPE=ASAN
|
|
||||||
|
|
||||||
arch:
|
arch:
|
||||||
packages:
|
packages:
|
||||||
- cmake
|
- cmake
|
||||||
|
|
@ -24,7 +19,7 @@ arch:
|
||||||
- wlc-git
|
- wlc-git
|
||||||
- libcap
|
- libcap
|
||||||
script:
|
script:
|
||||||
- "cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE ."
|
- "cmake ."
|
||||||
- "make"
|
- "make"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
||||||
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-result -Werror)
|
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-result -Werror)
|
||||||
|
|
||||||
# Add Address Sanitiezed build type
|
|
||||||
set(CMAKE_C_FLAGS_ASAN
|
|
||||||
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer"
|
|
||||||
CACHE STRING "Flags used by the C compiler during address sanitizer builds."
|
|
||||||
FORCE )
|
|
||||||
mark_as_advanced(
|
|
||||||
CMAKE_C_FLAGS_ASAN
|
|
||||||
CMAKE_EXE_LINKER_FLAGS_DEBUG
|
|
||||||
CMAKE_SHARED_LINKER_FLAGS_DEBUG
|
|
||||||
)
|
|
||||||
|
|
||||||
list(INSERT CMAKE_MODULE_PATH 0
|
list(INSERT CMAKE_MODULE_PATH 0
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/CMake
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
#ifndef _SWAY_JSON_HELPER_H
|
|
||||||
#define _SWAY_JSON_HELPER_H
|
|
||||||
|
|
||||||
#include <json-c/json.h>
|
|
||||||
|
|
||||||
// Macros for checking a specific version.
|
|
||||||
#define JSON_C_VERSION_013 (13 << 8)
|
|
||||||
|
|
||||||
// json-c v0.13 uses size_t for array_list_length().
|
|
||||||
#if defined(JSON_C_VERSION_NUM) && JSON_C_VERSION_NUM >= JSON_C_VERSION_013
|
|
||||||
typedef size_t json_ar_len_t;
|
|
||||||
#else
|
|
||||||
typedef int json_ar_len_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // _SWAY_JSON_HELPER_H
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include "sway_json_helper.h"
|
#include <json-c/json.h>
|
||||||
#include "wlc/wlc.h"
|
#include "wlc/wlc.h"
|
||||||
|
|
||||||
void init_json_tree(int socketfd);
|
void init_json_tree(int socketfd);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <json-c/json.h>
|
||||||
#include <list.h>
|
#include <list.h>
|
||||||
#include <libinput.h>
|
#include <libinput.h>
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
|
@ -24,7 +25,6 @@ struct ucred {
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#include "sway_json_helper.h"
|
|
||||||
#include "sway/ipc-json.h"
|
#include "sway/ipc-json.h"
|
||||||
#include "sway/ipc-server.h"
|
#include "sway/ipc-server.h"
|
||||||
#include "sway/security.h"
|
#include "sway/security.h"
|
||||||
|
|
@ -724,7 +724,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse requested event types
|
// parse requested event types
|
||||||
for (json_ar_len_t i = 0; i < json_object_array_length(request); i++) {
|
for (int i = 0; i < json_object_array_length(request); i++) {
|
||||||
const char *event_type = json_object_get_string(json_object_array_get_idx(request, i));
|
const char *event_type = json_object_get_string(json_object_array_get_idx(request, i));
|
||||||
if (strcmp(event_type, "workspace") == 0) {
|
if (strcmp(event_type, "workspace") == 0) {
|
||||||
client->subscribed_events |= event_mask(IPC_EVENT_WORKSPACE);
|
client->subscribed_events |= event_mask(IPC_EVENT_WORKSPACE);
|
||||||
|
|
@ -1126,8 +1126,7 @@ static void ipc_event_binding(json_object *sb_obj) {
|
||||||
sway_log(L_DEBUG, "Sending binding::run event");
|
sway_log(L_DEBUG, "Sending binding::run event");
|
||||||
json_object *obj = json_object_new_object();
|
json_object *obj = json_object_new_object();
|
||||||
json_object_object_add(obj, "change", json_object_new_string("run"));
|
json_object_object_add(obj, "change", json_object_new_string("run"));
|
||||||
// sb_obj gets owned by the temporary json_object, too.
|
json_object_object_add(obj, "binding", sb_obj);
|
||||||
json_object_object_add(obj, "binding", json_object_get(sb_obj));
|
|
||||||
|
|
||||||
const char *json_string = json_object_to_json_string(obj);
|
const char *json_string = json_object_to_json_string(obj);
|
||||||
ipc_send_event(json_string, IPC_EVENT_BINDING);
|
ipc_send_event(json_string, IPC_EVENT_BINDING);
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <json-c/json.h>
|
||||||
|
|
||||||
#include "sway_json_helper.h"
|
|
||||||
#include "swaybar/config.h"
|
#include "swaybar/config.h"
|
||||||
#include "swaybar/status_line.h"
|
#include "swaybar/status_line.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
@ -70,7 +70,8 @@ static void parse_json(struct bar *bar, const char *text) {
|
||||||
|
|
||||||
bar->status->block_line = create_list();
|
bar->status->block_line = create_list();
|
||||||
|
|
||||||
for (json_ar_len_t i = 0; i < json_object_array_length(results); ++i) {
|
int i;
|
||||||
|
for (i = 0; i < json_object_array_length(results); ++i) {
|
||||||
json_object *full_text, *short_text, *color, *min_width, *align, *urgent;
|
json_object *full_text, *short_text, *color, *min_width, *align, *urgent;
|
||||||
json_object *name, *instance, *separator, *separator_block_width;
|
json_object *name, *instance, *separator, *separator_block_width;
|
||||||
json_object *background, *border, *border_top, *border_bottom;
|
json_object *background, *border, *border_top, *border_bottom;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,8 @@ static json_object *get_focused_container_r(json_object *c) {
|
||||||
} else {
|
} else {
|
||||||
json_object *nodes, *node, *child;
|
json_object *nodes, *node, *child;
|
||||||
json_object_object_get_ex(c, "nodes", &nodes);
|
json_object_object_get_ex(c, "nodes", &nodes);
|
||||||
for (json_ar_len_t i = 0; i < json_object_array_length(nodes); i++) {
|
int i;
|
||||||
|
for (i = 0; i < json_object_array_length(nodes); i++) {
|
||||||
node = json_object_array_get_idx(nodes, i);
|
node = json_object_array_get_idx(nodes, i);
|
||||||
|
|
||||||
if ((child = get_focused_container_r(node))) {
|
if ((child = get_focused_container_r(node))) {
|
||||||
|
|
@ -59,7 +60,7 @@ static json_object *get_focused_container_r(json_object *c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
json_object_object_get_ex(c, "floating_nodes", &nodes);
|
json_object_object_get_ex(c, "floating_nodes", &nodes);
|
||||||
for (json_ar_len_t i = 0; i < json_object_array_length(nodes); i++) {
|
for (i = 0; i < json_object_array_length(nodes); i++) {
|
||||||
node = json_object_array_get_idx(nodes, i);
|
node = json_object_array_get_idx(nodes, i);
|
||||||
|
|
||||||
if ((child = get_focused_container_r(node))) {
|
if ((child = get_focused_container_r(node))) {
|
||||||
|
|
@ -82,7 +83,7 @@ char *get_focused_output() {
|
||||||
if (!outputs) {
|
if (!outputs) {
|
||||||
sway_abort("Unabled to get focused output. No nodes in tree.");
|
sway_abort("Unabled to get focused output. No nodes in tree.");
|
||||||
}
|
}
|
||||||
for (json_ar_len_t i = 0; i < json_object_array_length(outputs); i++) {
|
for (int i = 0; i < json_object_array_length(outputs); i++) {
|
||||||
output = json_object_array_get_idx(outputs, i);
|
output = json_object_array_get_idx(outputs, i);
|
||||||
|
|
||||||
if (get_focused_container_r(output)) {
|
if (get_focused_container_r(output)) {
|
||||||
|
|
@ -130,7 +131,7 @@ json_object *get_output_container(const char *output) {
|
||||||
json_object *outputs, *json_output, *name;
|
json_object *outputs, *json_output, *name;
|
||||||
json_object_object_get_ex(tree, "nodes", &outputs);
|
json_object_object_get_ex(tree, "nodes", &outputs);
|
||||||
|
|
||||||
for (json_ar_len_t i = 0; i < json_object_array_length(outputs); i++) {
|
for (int i = 0; i < json_object_array_length(outputs); i++) {
|
||||||
json_output = json_object_array_get_idx(outputs, i);
|
json_output = json_object_array_get_idx(outputs, i);
|
||||||
json_object_object_get_ex(json_output, "name", &name);
|
json_object_object_get_ex(json_output, "name", &name);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include <xkbcommon/xkbcommon-names.h>
|
#include <xkbcommon/xkbcommon-names.h>
|
||||||
#include <security/pam_appl.h>
|
#include <security/pam_appl.h>
|
||||||
|
#include <json-c/json.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -13,7 +14,6 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "sway_json_helper.h"
|
|
||||||
#include "client/window.h"
|
#include "client/window.h"
|
||||||
#include "client/registry.h"
|
#include "client/registry.h"
|
||||||
#include "client/cairo.h"
|
#include "client/cairo.h"
|
||||||
|
|
@ -583,7 +583,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
for (i = 0; i < registry->outputs->length; ++i) {
|
for (i = 0; i < registry->outputs->length; ++i) {
|
||||||
if (displays_paths[i * 2] != NULL) {
|
if (displays_paths[i * 2] != NULL) {
|
||||||
for (json_ar_len_t j = 0;; ++j) {
|
for (int j = 0;; ++j) {
|
||||||
if (j >= json_object_array_length(json_outputs)) {
|
if (j >= json_object_array_length(json_outputs)) {
|
||||||
sway_log(L_ERROR, "%s is not an extant output", displays_paths[i * 2]);
|
sway_log(L_ERROR, "%s is not an extant output", displays_paths[i * 2]);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "sway_json_helper.h"
|
#include <json-c/json.h>
|
||||||
#include "stringop.h"
|
#include "stringop.h"
|
||||||
#include "ipc-client.h"
|
#include "ipc-client.h"
|
||||||
#include "readline.h"
|
#include "readline.h"
|
||||||
|
|
@ -149,7 +149,7 @@ static void pretty_print_version(json_object *v) {
|
||||||
static void pretty_print_clipboard(json_object *v) {
|
static void pretty_print_clipboard(json_object *v) {
|
||||||
if (success(v, true)) {
|
if (success(v, true)) {
|
||||||
if (json_object_is_type(v, json_type_array)) {
|
if (json_object_is_type(v, json_type_array)) {
|
||||||
for (json_ar_len_t i = 0; i < json_object_array_length(v); ++i) {
|
for (int i = 0; i < json_object_array_length(v); ++i) {
|
||||||
json_object *o = json_object_array_get_idx(v, i);
|
json_object *o = json_object_array_get_idx(v, i);
|
||||||
printf("%s\n", json_object_get_string(o));
|
printf("%s\n", json_object_get_string(o));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue