New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipc: add backward-compatible I3SOCK ipc socket. #2986

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@Snaipe
Contributor

Snaipe commented Oct 25, 2018

This is a work in progress to eventually address #2976.

@Snaipe Snaipe force-pushed the Snaipe:i3sock-compat branch 2 times, most recently from b85564a to 5291166 Oct 25, 2018

@Snaipe

This comment has been minimized.

Contributor

Snaipe commented Oct 26, 2018

I pretty much got it to work; here's a sample example of GET_TREE for a workspace with a wayland terminal and an xwayland chromium:

swaymsg -t get_tree
i3-msg -t get_tree

I still have to clean things up a bit, but I think that's a pretty good start.

Show resolved Hide resolved sway/ipc-server.c

@Snaipe Snaipe force-pushed the Snaipe:i3sock-compat branch 3 times, most recently from 6af2cbe to b9b4e6f Oct 28, 2018

@Snaipe Snaipe changed the title from [wip] ipc: add backward-compatible I3SOCK ipc socket. to ipc: add backward-compatible I3SOCK ipc socket. Oct 29, 2018

@Snaipe

This comment has been minimized.

Contributor

Snaipe commented Oct 29, 2018

I'm starting to get happy with this PR, and I think it's ready for a first review.

Show resolved Hide resolved include/sway/tree/node.h Outdated
@emersion

There are remaining 80 char limit issues

Show resolved Hide resolved sway/ipc-i3.c Outdated
Show resolved Hide resolved sway/ipc-i3.c
Show resolved Hide resolved sway/ipc-i3.c
Show resolved Hide resolved sway/ipc-json.c Outdated
Show resolved Hide resolved sway/ipc-json.c Outdated
Show resolved Hide resolved sway/ipc-json.c Outdated
Show resolved Hide resolved sway/ipc-sway.c Outdated

@Snaipe Snaipe force-pushed the Snaipe:i3sock-compat branch from b9b4e6f to 7eaeee1 Nov 3, 2018

Show resolved Hide resolved sway/ipc-i3.c Outdated

@Snaipe Snaipe force-pushed the Snaipe:i3sock-compat branch from 7eaeee1 to 466871a Nov 3, 2018

@emersion

This comment has been minimized.

Member

emersion commented Nov 18, 2018

Can you rebase and squash the fixup commit?

@Snaipe Snaipe force-pushed the Snaipe:i3sock-compat branch from 466871a to 0169d94 Nov 18, 2018

Snaipe added some commits Oct 28, 2018

ipc: refactor ipc handlers into ipc-sway.c
This is preparative work for the backward-compatible I3SOCK
implementation.

Signed-off-by: Franklin "Snaipe" Mathieu <me@snai.pe>
ipc: add function hooks to ipc_json_describe_node*
This makes it easier to have an alternative json output for
compatibility purposes, and is preparative work for serving
a mimicked i3 output on I3SOCK.

Signed-off-by: Franklin "Snaipe" Mathieu <me@snai.pe>
ipc: added backward-compatible I3SOCK ipc
Signed-off-by: Franklin "Snaipe" Mathieu <me@snai.pe>

@Snaipe Snaipe force-pushed the Snaipe:i3sock-compat branch from 0169d94 to dee18c0 Nov 18, 2018

@@ -4,13 +4,27 @@
#include "sway/tree/container.h"
#include "sway/input/input-manager.h"
typedef void ipc_json_descriptor(struct sway_node *, json_object *);

This comment has been minimized.

@emersion

emersion Nov 22, 2018

Member

Is it possible to set this to be a pointer to a function instead?

typedef void (*ipc_json_descriptor)(struct sway_node *, json_object *);
@@ -4,13 +4,27 @@
#include "sway/tree/container.h"
#include "sway/input/input-manager.h"
typedef void ipc_json_descriptor(struct sway_node *, json_object *);
typedef ipc_json_descriptor *ipc_json_descriptors[NUM_NODE_TYPES];

This comment has been minimized.

@emersion

emersion Nov 22, 2018

Member

The one-char difference between ipc_json_descriptor and ipc_json_descriptors is confusing. Can we add a _map suffix or something?

bool ipc_send_reply(struct ipc_client *client, const char *payload, uint32_t payload_length);
typedef json_object *ipc_handler(struct ipc_client *client, char *data);

This comment has been minimized.

@emersion

emersion Nov 22, 2018

Member

Ditto

typedef json_object *(*ipc_handler)(struct ipc_client *client, char *data);
static void ipc_get_workspaces_callback(struct sway_workspace *workspace,
void *data) {
json_object *workspace_json = ipc_json_describe_node(&workspace->node, &ipc_json_sway_descriptors);

This comment has been minimized.

@emersion

emersion Nov 22, 2018

Member

Style: 80-char limit

@emersion

This comment has been minimized.

Member

emersion commented Nov 22, 2018

Needs rebase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment