Skip to content
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

[WIP] Left and right dockarea #3123

Closed
wants to merge 3 commits into from
Closed

Conversation

vesim987
Copy link

@vesim987 vesim987 commented Jan 24, 2018

This PR add support for vertical dock client.

TODO:

  • handle_strut_partial_change seem's to doesn't work
  • do something with dock overlapping
  • refactor render_output
  • write tests

fixes: #1129

@vesim987
Copy link
Author

vesim987 commented Jan 24, 2018

Oh, i broke commit history. How i can fix it?

@okraits
Copy link
Contributor

okraits commented Jan 25, 2018

I guess you need to rebase your branch against the next branch.

@Airblader
Copy link
Member

Thanks for taking a shot at this! I really think this would be a cool feature to have in i3. As @okraits mentioned you'll need to rebase.

Once that is sorted out, two very high-level comments (I haven't reviewed the PR in detail yet):

  1. It'd be good if you could write, in text form, some explanation as to how vertical dock clients fit into the container structure of i3 now. For one it'll help us understand, but I also think we'll need to document this a bit in, say, the hacking howto, as this is a change to the fundamental container structure.
  2. Please don't rename things on the IPC (I just saw a "dockarea" → "hdockarea"). This breaks compatibility which we'd like to avoid when possible. Having "dockarea" and "vdockarea" is not the ideal situation, but it's better than breaking IPC clients.

Let us know via comment when you rebased the PR!

@vesim987
Copy link
Author

@Airblader I've fixed this branch. There was ~170 commits difference... idk how I did this. I've just created new branch, and applied my latest commit, and renamed it.

@Airblader
Copy link
Member

add left and right position to i3bar

Please don't do this in this PR. It's a completely separate topic and one that has to be decided separately as well. I currently don't think we want a vertical mode for i3bar because we have no good answer to what the statusline should look like.

Copy link
Member

@Airblader Airblader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a quick initial pass over the changes, but I haven't yet looked at it too closely. I think there's some stuff to work on still and would also appreciate the textual description I mentioned previously.

src/con.c Outdated
@@ -535,7 +536,10 @@ bool con_is_docked(Con *con) {
if (con->parent == NULL)
return false;

if (con->parent->type == CT_DOCKAREA)
if (con->parent->type == CT_HDOCKAREA )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and in general, please run the clang formatter to fix the code formatting.

src/con.c Outdated
if (con->parent->type == CT_HDOCKAREA )
return true;

if (con->parent->type == CT_VDOCKAREA )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not combine these two conditions?

src/con.c Outdated
@@ -2124,7 +2132,7 @@ void con_update_parents_urgency(Con *con) {
return;

bool new_urgency_value = con->urgent;
while (parent && parent->type != CT_WORKSPACE && parent->type != CT_DOCKAREA) {
while (parent && parent->type != CT_WORKSPACE && parent->type != CT_HDOCKAREA && parent->type != CT_VDOCKAREA ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I think it'd be good to use something like con_is_docked for all of these conditions since they get pretty lengthy.

src/handlers.c Outdated
DLOG("geom->y = %d >= rect.height / 2 = %d, it is a bottom dock client\n",
con->geometry.y, (search_at->rect.height / 2));
con->window->dock = W_DOCK_BOTTOM;
if(abs(con->window->reserved.bottom - con->window->reserved.top) >
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire block has become quite unreadable. I think we'd really gain a lot of clarity from refactoring this a little bit (if you want).

src/ipc.c Outdated
case CT_DOCKAREA:
ystr("dockarea");
case CT_HDOCKAREA:
ystr("hdockarea");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this to dumping "dockarea" to maintain compatibility on the IPC.

@@ -340,8 +340,10 @@ static int json_string(void *ctx, const unsigned char *val, size_t len) {
json_node->type = CT_FLOATING_CON;
else if (strcasecmp(buf, "workspace") == 0)
json_node->type = CT_WORKSPACE;
else if (strcasecmp(buf, "dockarea") == 0)
json_node->type = CT_DOCKAREA;
else if (strcasecmp(buf, "hdockarea") == 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this would have to be adjusted back as well

src/randr.c Outdated
@@ -316,6 +316,7 @@ void output_init_con(Output *output) {
}
con->rect = output->rect;
output->con = con;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this extra newline

src/randr.c Outdated
DLOG("attaching\n");
con_attach(topdock, con, false);

{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These blocks absolutely do need to be refactored; using scoped blocks with this much duplication is not good. :-)

src/render.c Outdated
@@ -338,41 +343,100 @@ static void render_output(Con *con) {

/* First pass: determine the height of all CT_DOCKAREAs (the sum of their
* children) and figure out how many pixels we have left for the rest */
Con *left_dock = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use NULL over 0

src/render.c Outdated
}


if(bottom_dock) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, these blocks are a lot of repetition that should be refactored.

@vesim987
Copy link
Author

@Airblader do you have idea how to rewrite this part: https://github.com/vesim987/i3/blob/vertical-dockarea/src/handlers.c#L1376-L1415

@op8867555
Copy link
Contributor

op8867555 commented Feb 10, 2018

Hi there, any progress on this? I tried this PR and found some problems:

  • Incorrect bar position when using multiple monitors
  • Incorrect bar position when running multiple bars
  • is_docked is not restore when loading json layout which would crash i3 when reloading

Here is some changes to fixes problems above:
vesim987/i3@vertical-dockarea...op8867555:6f4ba84f540a4ac74bef8fd09a2f495911e913ed

I'm new to i3, please take a look and point me out if I didn't do it right. :)

@Airblader Airblader added the waiting Waiting for feedback/changes from the author of the issue/PR. Make sure to notify us with a comment. label Mar 24, 2018
@Airblader Airblader added the stale Issue or PR has become stale and will be closed soon label Jun 22, 2018
@Airblader
Copy link
Member

@vesim987 Are you continuing your work on this?

@Airblader Airblader closed this Jul 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issue or PR has become stale and will be closed soon waiting Waiting for feedback/changes from the author of the issue/PR. Make sure to notify us with a comment.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support vertical dock clients
4 participants