i3 icon indicating copy to clipboard operation
i3 copied to clipboard

Issue outlining rounded edges

Open luaugg opened this issue 6 years ago • 7 comments

I'm submitting a…

[ ] Bug
[ ] Feature Request
[ ] Documentation Request
[x] Other (Please describe in detail)

I'm unsure whether this is a bug or simply a missing feature,
which is why I have ticked Other, and why I have not specified a log file.

Current Behavior

Setting a border pixel size of 1 currently outlines the border, as expected, but has issues when outlining the rounded edge; it usually cuts off as seen here:

Expected Behavior

The expected behavior is that the rounded edges get outlined the way the non-rounded sides get handled, like this:

(basically just a black line going smoothly around the edge, instead of cutting off).

Reproduction Instructions

for_window [class=".*"] border pixel 1
border_radius 8

Just add these two lines to your i3 config and reload/restart.

Environment

Output of i3 --moreversion 2>&-:

i3 version:
Binary i3 version:  4.16.1-184-g00181678 (2019-07-03, branch "makepkg") © 2009 Michael Stapelberg and contributors
Running i3 version: 4.16.1-184-g00181678 (2019-07-03, branch "makepkg") (pid 1020)
Loaded i3 config: /home/sam/.config/i3/config (Last modified: Fri 30 Aug 2019 20:29:53 BST, 4377542 seconds ago)

The i3 binary you just called: /usr/bin/i3
The i3 binary you are running: i3

i3 configuration file is here.

- Linux Distribution & Version: Manjaro Linux 18.0 (Linux Kernel is `5.4.0-1-MANJARO`)
- Are you using a compositor (e.g., xcompmgr or compton): compton
- This issue persists on older kernels too.

luaugg avatar Oct 20 '19 11:10 luaugg

Thanks for the very thorough issue!

This problem has been discussed in the past and is probably the last major hurdle functionally. In fact I already have a somewhat working solution that you can find here. It's not quite there because it crashes very easily. I assume this is a result of the pixmap being updated when that isn't expected.

I haven't looked into this further because, to be honest, it wouldn't be a feature I'd use. I'll push the change to a seperate branch and hopefully someone more motivated then me can track down what causes the crash.

resloved avatar Oct 21 '19 22:10 resloved

The changes are now on the shape-dev branch, you can find them here.

The crash I'm referring to can be reproduced by following these steps:

  1. Create two windows
  2. Create another window in the opposite orientation (if the second window was horizontal, then the third window should be vertical or vice-versa)
  3. Create a forth window with the original orientation.
  4. Delete the last two windows

resloved avatar Oct 21 '19 23:10 resloved

I see, thank you. The crashes won't bother me too much and I'd actually try to help track it down if I was experienced with this sort of stuff. The strokes are mainly for aesthetic reasons, so they're not too important. I'll close this issue because of the changes you made available, thank you.

luaugg avatar Oct 23 '19 08:10 luaugg

I think I'm going to leave this open. I'm glad this change works for you, but I'd still like to find a solution and it would be nice to have something open for people that are curious why this hasn't been fixed yet.

resloved avatar Oct 23 '19 15:10 resloved

Hello there ! I've been using your fork for the last day and can't live without the rounded corners now. :heart:

So here's the thing, I have plenty of time being confined and I would really like to push this issue further but I don't have much experience with C. Would you have some time for mentoring me in the next 5 or so weeks ?

MonsieurMan avatar Mar 20 '20 08:03 MonsieurMan

@MonsieurMan Love to hear when people are interested in working open source, even if they don't have the experience. Working on established code bases is how I learned anything about C so I think it's a great place to start!

As for suggestions:

  • If you aren't that familiar with C you can learn a lot poking around and changing some variables. I'm sure there are a lot of resources online if you are more interested with that, but I have nothing to recommend.
  • Hacking i3 is pretty much a required read (or at least reference)
  • i3 communicates with X so you may want to get a basic overview of how its structured https://en.wikipedia.org/wiki/X_Window_System
  • To communicate with X i3 uses xcb https://xcb.freedesktop.org/tutorial/

If you want to try to solve this issue in particular I would suggest just using the shape-dev branch to start. If you create a fair amount of windows you'll see the issue pretty quickly. Things you may need to learn about to get some context:

  • Read through and try to understand what is actually happening in x_shape_window() in src/x.c. Lots of the important logic is in there and the title reshaping.
  • Read up on the shape extension. The rounding is only possible using the functionality it provides.

I'm not in a place to actually mentor someone, but if you have any general questions feel free to DM me on twitter (@resloved) or on reddit (/u/resloves).

resloved avatar Mar 20 '20 17:03 resloved

@resloved, that was the kind of 'mentoring' I was looking for. I know time is a precious resource.

Thank you for trying to make me confident facing this big codebase aha !

I'll be sure to DM you on reddit if I make any significant progress or hit a wall. Thank again and see you soon.

MonsieurMan avatar Mar 20 '20 19:03 MonsieurMan