Cloudef / wlc

High-level Wayland compositor library
MIT License
331 stars 58 forks source link

Accepting requested geometry causes X windows to grow #191

Closed kozec closed 8 years ago

kozec commented 8 years ago

Hello,

I found strange issue with wlc_set_view_request_geometry_cb callback.

As per documentation, I'm trying to agree on requested geometry by setting it using wlc_view_set_geometry. But doing so apparently sets size of X window larger by 2px in both directions, which in turn causes new size to be requested, ending in infinite loop of window slowly growing.

Here is minimal example. Compiling it with gcc test.c -lwlc -o test, running generated binary and then launching DISPLAY=:1 xterm from another console replicates this problem.

Earnestly commented 8 years ago

(Completely aside, consider using another pastebin, like https://ptpb.pw, as pastebin.com injects CRLF line endings. (And everything else that's bad with it.))

kozec commented 8 years ago

@Earnestly Here you are

kozec commented 8 years ago

Just small followup, this is apparently caused by wlc ignoring doing something wrong with border_width in XCB_CONFIGURE_REQUEST.

There is slight chance I'll be able to get PR with fix together myself.

Log I'm getting right now:

XCB_CONFIGURE_REQUEST (4194338) [10x17+0,0] bord 1
XCB_CONFIGURE_REQUEST (4194338) [484x316+0,0] bord 1
>>> view_request_geometry called with size 486x318
Earnestly commented 8 years ago

I wonder if this 2px thing is related to creating a gap where a border can be rendered?

Cloudef commented 8 years ago

Those gaps IIRC can be turned off by wm.

kozec commented 8 years ago

I'm sorry, my last comment was probably on wrong track. Even window that doesn't send any size request gets same treatment and grows forever.

kozec commented 8 years ago

Those gaps IIRC can be turned off by wm.

Do you happen to remember how?

[tom@silver wlc-git]$ grep -R gap
Binary file .git/objects/pack/pack-d3977f8f8e12e28e2ae9aa2894bc7bcf946b7ae7.pack matches
Cloudef commented 8 years ago

You need to call xcb_configure_window on the window with XCB_CONFIG_WINDOW_BORDER_WIDTH bit included in the type.

kozec commented 8 years ago

@Cloudef

Thanks, I managed to fix problem like this:

https://github.com/kozec/wlc/commit/fec9e46b0db30bd471c8e73c7ef7dea377ecb42a

Should I make PR? Is there a chance that it will break something I don't know about?

Cloudef commented 8 years ago

Yes make a PR, It should not break anything as far I see.