Closed mitchmindtree closed 6 years ago
The crash seems to occur immediately after a call to the wayland_window::Handler::configure
method implemented for Window
. Upon entering the main loop
, it is called the first time with the dimensions (256, 128)
, which seems fine as it indicates the window's initial dimensions. However, during the next pass of the loop, the method is called again dimensions (-16, -32)
which are invalid and are likely the cause of the [456358.4(45] wl_display@1.error(wl_shm_pool@11, 1, "invalid width, height or stride (0x24, 0)")
I posted in my previous comment.
If I change the configure
implementation to ignore invalid dimensions like this:
if width <= 0 || height <= 0 {
return;
}
The window seems to run relatively normally. It initially appears far offscreen to the left (this might have something to do with the different DPIs on each of my displays, though I'm unsure) but if I enter Gnome's "Activities" HUD I can move it back onto my other display and see it appearing normally:
The invlid dimensions don't seem to appear again after that first call in the second pass of the main loop
, so perhaps it has something to do with the initial setup of the window or the decorations.
The window still seems to ignore resizing and dragging, despite the resize cursor showing correctly when hovering the mouse over each of the edges. I can also see that the event_queue is actually dispatching events during resize, however configure
never gets called with the new dimensions. Curiously, if I click the terminal window (with which the simple_window
example is ran), configure
does get called however the width
and height
passed to it are the always (256, 120) so nothing changes.
I'll continue to dig deeper, though would still love to hear your thoughts in the meantime as I'm still a newbie when it comes to linux and wayland!
Thanks for all your efforts on wayland btw! I'm running an Arch+Gnome+Wayland system as my main development machine now so I'm keen to do my best to help get this into shape :+1:
Yes, actually the example implementation should be something like
impl wayland_window::Handler for Window {
fn configure(&mut self, _: &mut EventQueueHandle, _: wl_shell_surface::Resize, width: i32, height: i32) {
use std::cmp::max;
self.newsize = Some((max(width,1), max(height,1)))
}
}
So that the window refuses to be resized smaller than (1,1)
(which would be a protocol error anyway).
Regarding the fact that the window does not behave well... In your logs, when you try resizing it by grabbing a border, do you see the client sending a wl_shell_surface@...resize()
event ?
PS: I will be quite busy today and the next two days, son won't be able to answer a lot, sorry.
@vberger yes, but only at the very beginning of the resize - does that sound correct?
Here is an annotated log from the moment I press the left mouse button and begin the attempt to resize from the right edge of the window:
Press the resizable edge:
[814139.649] wl_pointer@21.button(20109, 10070859, 272, 1)
[814139.727] -> wl_shell_surface@20.resize(wl_seat@10, 20109, 8)
Drag the resizable edge to the right, attempting to make it wider (window desn't actually resize):
[815561.237] wl_pointer@21.motion(10072280, 4.179688, 85.035156)
[815578.364] wl_pointer@21.motion(10072295, 4.351562, 85.035156)
[815593.633] wl_pointer@21.motion(10072311, 4.527344, 85.035156)
[815610.814] wl_pointer@21.motion(10072326, 4.710938, 85.035156)
[815627.786] wl_pointer@21.motion(10072342, 4.894531, 85.035156)
[815644.873] wl_pointer@21.motion(10072357, 5.085938, 85.035156)
[815660.386] wl_pointer@21.motion(10072372, 5.277344, 85.035156)
[815680.182] wl_pointer@21.motion(10072395, 5.613281, 85.035156)
[815695.733] wl_pointer@21.motion(10072411, 5.968750, 85.035156)
[815712.571] wl_pointer@21.motion(10072426, 6.324219, 85.035156)
[815728.408] wl_pointer@21.motion(10072441, 6.496094, 85.035156)
[815746.070] wl_pointer@21.motion(10072464, 7.011719, 85.035156)
[815761.964] wl_pointer@21.motion(10072480, 7.355469, 85.035156)
[815780.930] wl_pointer@21.motion(10072488, 7.527344, 85.203125)
[815796.711] wl_pointer@21.motion(10072511, 7.527344, 85.367188)
[815870.186] wl_pointer@21.motion(10072587, 7.675781, 85.367188)
[817066.688] wl_pointer@21.motion(10073786, 7.785156, 85.367188)
[817765.569] wl_pointer@21.motion(10074484, 7.867188, 85.367188)
[818236.053] wl_pointer@21.motion(10074953, 7.953125, 85.367188)
Release the mouse button:
[818401.878] wl_pointer@21.button(20110, 10075122, 272, 0)
[818420.178] wl_pointer@21.leave(20111, wl_surface@13)
[818420.266] -> wl_surface@23.attach(wl_buffer@34, 0, 0)
[818420.282] -> wl_surface@23.damage(0, 0, 24, 24)
[818420.290] -> wl_surface@23.commit()
[818420.294] -> wl_pointer@21.set_cursor(20111, wl_surface@23, 4, 4)
Alt-tab back to the Terminal
[826417.962] wl_shell_surface@20.configure(0, 272, 152)
[826418.011] -> wl_buffer@40.destroy()
[826418.018] -> wl_buffer@41.destroy()
[826418.022] -> wl_buffer@42.destroy()
[826418.025] -> wl_buffer@43.destroy()
[826434.931] -> wl_shm_pool@11.create_buffer(new id wl_buffer@46, 0, 272, 24, 1088, 0)
[826435.139] -> wl_surface@12.attach(wl_buffer@46, 0, 0)
[826435.171] -> wl_subsurface@16.set_position(-8, -24)
[826435.185] -> wl_shm_pool@11.create_buffer(new id wl_buffer@47, 0, 8, 120, 32, 0)
[826435.210] -> wl_surface@13.attach(wl_buffer@47, 0, 0)
[826435.230] -> wl_subsurface@17.set_position(256, 0)
[826435.245] -> wl_shm_pool@11.create_buffer(new id wl_buffer@48, 0, 272, 8, 1088, 0)
[826435.278] -> wl_surface@14.attach(wl_buffer@48, 0, 0)
[826435.288] -> wl_subsurface@18.set_position(-8, 120)
[826435.294] -> wl_shm_pool@11.create_buffer(new id wl_buffer@49, 0, 8, 120, 32, 0)
[826435.318] -> wl_surface@15.attach(wl_buffer@49, 0, 0)
[826435.327] -> wl_subsurface@19.set_position(-8, 0)
[826435.335] -> wl_surface@12.commit()
[826435.339] -> wl_surface@13.commit()
[826435.341] -> wl_surface@14.commit()
[826435.343] -> wl_surface@15.commit()
[826435.350] -> wl_buffer@44.destroy()
[826435.356] -> wl_shm_pool@8.create_buffer(new id wl_buffer@50, 0, 256, 120, 1024, 0)
[826435.373] -> wl_surface@3.attach(wl_buffer@50, 0, 0)
[826435.382] -> wl_surface@3.commit()
Should it be continually receiving resize events? Or only the very first?
I also tried dragging the window by grabbing the top bar with the left mouse button and moving it slightly to the right. Here are the logs for that:
Left-press the top title bar of the window:
[1142431.986] wl_pointer@21.button(21483, 10399152, 272, 1)
[1142432.020] -> wl_shell_surface@20.move(wl_seat@10, 21483)
Attempt to drag the cursor to the right by moving the mouse (window doesn't actually move):
[1144728.157] wl_pointer@21.motion(10401447, 154.250000, 8.613281)
[1144744.943] wl_pointer@21.motion(10401462, 154.421875, 8.613281)
[1144761.082] wl_pointer@21.motion(10401478, 154.597656, 8.613281)
[1144777.543] wl_pointer@21.motion(10401493, 154.871094, 8.613281)
[1144795.330] wl_pointer@21.motion(10401508, 155.152344, 8.613281)
[1144810.354] wl_pointer@21.motion(10401524, 155.445312, 8.613281)
[1144826.021] wl_pointer@21.motion(10401539, 155.843750, 8.613281)
[1144843.374] wl_pointer@21.motion(10401555, 156.261719, 8.613281)
[1144858.800] wl_pointer@21.motion(10401578, 157.531250, 8.613281)
[1144881.282] wl_pointer@21.motion(10401593, 158.261719, 8.613281)
[1144896.999] wl_pointer@21.motion(10401608, 158.753906, 8.613281)
[1144917.378] wl_pointer@21.motion(10401631, 159.457031, 8.613281)
[1144933.127] wl_pointer@21.motion(10401647, 159.914062, 8.613281)
[1144952.112] wl_pointer@21.motion(10401670, 160.550781, 8.613281)
[1145003.190] wl_pointer@21.motion(10401716, 160.734375, 8.613281)
[1145206.336] wl_pointer@21.motion(10401923, 160.878906, 8.613281)
[1145223.372] wl_pointer@21.motion(10401938, 161.113281, 8.613281)
[1145242.660] wl_pointer@21.motion(10401954, 161.343750, 8.613281)
[1145276.560] wl_pointer@21.motion(10401992, 162.031250, 8.613281)
[1145294.371] wl_pointer@21.motion(10402007, 162.265625, 8.613281)
[1145310.132] wl_pointer@21.motion(10402023, 162.500000, 8.613281)
[1145329.631] wl_pointer@21.motion(10402046, 162.953125, 8.613281)
[1145345.538] wl_pointer@21.motion(10402061, 163.320312, 8.613281)
[1145364.904] wl_pointer@21.motion(10402069, 163.507812, 8.613281)
[1145380.779] wl_pointer@21.motion(10402084, 163.687500, 8.613281)
[1145996.511] wl_pointer@21.motion(10402713, 163.824219, 8.613281)
[1146080.881] wl_pointer@21.motion(10402798, 163.925781, 8.613281)
[1146250.205] wl_pointer@21.motion(10402967, 164.023438, 8.613281)
[1147148.209] wl_pointer@21.motion(10403865, 164.113281, 8.613281)
[1147207.543] wl_pointer@21.motion(10403926, 164.195312, 8.613281)
Release the mouse button
[1147207.601] wl_pointer@21.button(21484, 10403926, 272, 0)
I may be missing something, but to me it looks like Gnome is not behaving correctly as a compositor here.
The expected behavior (and what weston does) is that the client should send a single "resize" or "move" request, to initiate the interactive resize or move, and then the compositor should handle the rest : move the window around, or continually send "configure" events to notify the client about its new size. Until the mouse button is released.
Now, it's entirely possible that the gnome developers did not bother implementing wl_shell fully because they are focusing on xdg_shell, and ideally we'd be using it too. But we can't before rust 1.17, as it requires the "recursive_static" feature gate which will only be stabilized then.
Le 24 avril 2017 08:00:37 GMT+02:00, mitchmindtree notifications@github.com a écrit :
@vberger yes, but only at the very beginning of the resize - does that sound correct?
Here is an annotated log from the moment I press the left mouse button and begin the attempt to resize from the right edge of the window:
Press the resizable edge:
[814139.649] wl_pointer@21.button(20109, 10070859, 272, 1) [814139.727] -> wl_shell_surface@20.resize(wl_seat@10, 20109, 8)
Drag the resizable edge to the right, attempting to make it wider (window desn't actually resize):
[815561.237] wl_pointer@21.motion(10072280, 4.179688, 85.035156) [815578.364] wl_pointer@21.motion(10072295, 4.351562, 85.035156) [815593.633] wl_pointer@21.motion(10072311, 4.527344, 85.035156) [815610.814] wl_pointer@21.motion(10072326, 4.710938, 85.035156) [815627.786] wl_pointer@21.motion(10072342, 4.894531, 85.035156) [815644.873] wl_pointer@21.motion(10072357, 5.085938, 85.035156) [815660.386] wl_pointer@21.motion(10072372, 5.277344, 85.035156) [815680.182] wl_pointer@21.motion(10072395, 5.613281, 85.035156) [815695.733] wl_pointer@21.motion(10072411, 5.968750, 85.035156) [815712.571] wl_pointer@21.motion(10072426, 6.324219, 85.035156) [815728.408] wl_pointer@21.motion(10072441, 6.496094, 85.035156) [815746.070] wl_pointer@21.motion(10072464, 7.011719, 85.035156) [815761.964] wl_pointer@21.motion(10072480, 7.355469, 85.035156) [815780.930] wl_pointer@21.motion(10072488, 7.527344, 85.203125) [815796.711] wl_pointer@21.motion(10072511, 7.527344, 85.367188) [815870.186] wl_pointer@21.motion(10072587, 7.675781, 85.367188) [817066.688] wl_pointer@21.motion(10073786, 7.785156, 85.367188) [817765.569] wl_pointer@21.motion(10074484, 7.867188, 85.367188) [818236.053] wl_pointer@21.motion(10074953, 7.953125, 85.367188)
Release the mouse button:
[818401.878] wl_pointer@21.button(20110, 10075122, 272, 0) [818420.178] wl_pointer@21.leave(20111, wl_surface@13) [818420.266] -> wl_surface@23.attach(wl_buffer@34, 0, 0) [818420.282] -> wl_surface@23.damage(0, 0, 24, 24) [818420.290] -> wl_surface@23.commit() [818420.294] -> wl_pointer@21.set_cursor(20111, wl_surface@23, 4, 4)
Alt-tab back to the Terminal
[826417.962] wl_shell_surface@20.configure(0, 272, 152) [826418.011] -> wl_buffer@40.destroy() [826418.018] -> wl_buffer@41.destroy() [826418.022] -> wl_buffer@42.destroy() [826418.025] -> wl_buffer@43.destroy() [826434.931] -> wl_shm_pool@11.create_buffer(new id wl_buffer@46, 0, 272, 24, 1088, 0) [826435.139] -> wl_surface@12.attach(wl_buffer@46, 0, 0) [826435.171] -> wl_subsurface@16.set_position(-8, -24) [826435.185] -> wl_shm_pool@11.create_buffer(new id wl_buffer@47, 0, 8, 120, 32, 0) [826435.210] -> wl_surface@13.attach(wl_buffer@47, 0, 0) [826435.230] -> wl_subsurface@17.set_position(256, 0) [826435.245] -> wl_shm_pool@11.create_buffer(new id wl_buffer@48, 0, 272, 8, 1088, 0) [826435.278] -> wl_surface@14.attach(wl_buffer@48, 0, 0) [826435.288] -> wl_subsurface@18.set_position(-8, 120) [826435.294] -> wl_shm_pool@11.create_buffer(new id wl_buffer@49, 0, 8, 120, 32, 0) [826435.318] -> wl_surface@15.attach(wl_buffer@49, 0, 0) [826435.327] -> wl_subsurface@19.set_position(-8, 0) [826435.335] -> wl_surface@12.commit() [826435.339] -> wl_surface@13.commit() [826435.341] -> wl_surface@14.commit() [826435.343] -> wl_surface@15.commit() [826435.350] -> wl_buffer@44.destroy() [826435.356] -> wl_shm_pool@8.create_buffer(new id wl_buffer@50, 0, 256, 120, 1024, 0) [826435.373] -> wl_surface@3.attach(wl_buffer@50, 0, 0) [826435.382] -> wl_surface@3.commit()
Should it be continually receiving resize events? Or only the very first?
I also tried dragging the window by grabbing the top bar with the left mouse button and moving it slightly to the right. Here are the logs for that:
Left-press the top title bar of the window:
[1142431.986] wl_pointer@21.button(21483, 10399152, 272, 1) [1142432.020] -> wl_shell_surface@20.move(wl_seat@10, 21483)
Attempt to drag the cursor to the right by moving the mouse (window doesn't actually move):
[1144728.157] wl_pointer@21.motion(10401447, 154.250000, 8.613281) [1144744.943] wl_pointer@21.motion(10401462, 154.421875, 8.613281) [1144761.082] wl_pointer@21.motion(10401478, 154.597656, 8.613281) [1144777.543] wl_pointer@21.motion(10401493, 154.871094, 8.613281) [1144795.330] wl_pointer@21.motion(10401508, 155.152344, 8.613281) [1144810.354] wl_pointer@21.motion(10401524, 155.445312, 8.613281) [1144826.021] wl_pointer@21.motion(10401539, 155.843750, 8.613281) [1144843.374] wl_pointer@21.motion(10401555, 156.261719, 8.613281) [1144858.800] wl_pointer@21.motion(10401578, 157.531250, 8.613281) [1144881.282] wl_pointer@21.motion(10401593, 158.261719, 8.613281) [1144896.999] wl_pointer@21.motion(10401608, 158.753906, 8.613281) [1144917.378] wl_pointer@21.motion(10401631, 159.457031, 8.613281) [1144933.127] wl_pointer@21.motion(10401647, 159.914062, 8.613281) [1144952.112] wl_pointer@21.motion(10401670, 160.550781, 8.613281) [1145003.190] wl_pointer@21.motion(10401716, 160.734375, 8.613281) [1145206.336] wl_pointer@21.motion(10401923, 160.878906, 8.613281) [1145223.372] wl_pointer@21.motion(10401938, 161.113281, 8.613281) [1145242.660] wl_pointer@21.motion(10401954, 161.343750, 8.613281) [1145276.560] wl_pointer@21.motion(10401992, 162.031250, 8.613281) [1145294.371] wl_pointer@21.motion(10402007, 162.265625, 8.613281) [1145310.132] wl_pointer@21.motion(10402023, 162.500000, 8.613281) [1145329.631] wl_pointer@21.motion(10402046, 162.953125, 8.613281) [1145345.538] wl_pointer@21.motion(10402061, 163.320312, 8.613281) [1145364.904] wl_pointer@21.motion(10402069, 163.507812, 8.613281) [1145380.779] wl_pointer@21.motion(10402084, 163.687500, 8.613281) [1145996.511] wl_pointer@21.motion(10402713, 163.824219, 8.613281) [1146080.881] wl_pointer@21.motion(10402798, 163.925781, 8.613281) [1146250.205] wl_pointer@21.motion(10402967, 164.023438, 8.613281) [1147148.209] wl_pointer@21.motion(10403865, 164.113281, 8.613281) [1147207.543] wl_pointer@21.motion(10403926, 164.195312, 8.613281)
Release the mouse button
[1147207.601] wl_pointer@21.button(21484, 10403926, 272, 0)
-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/vberger/wayland-window/issues/16#issuecomment-296531455
But we can't before rust 1.17, as it requires the "recursive_static" feature gate which will only be stabilized then.
Would you mind elaborating on this a little? Do you have plans to move to xdg_shell once 1.17 is released in a few days? Do you have a fork/feature/issue that I might be able to track somewhere? I'd be happy to test/help if there's a possibility it could solve this issue.
I asked in the wayland IRC about wl_shell:
< mindtree> hey folks, is
wl-shell
still (or was it ever fully) supported in the latest stable Gnome release? < ANON> mindtree, I'd be surprised if it was not, since so many programs use it in lack of a stable alternative. That said, I don't actually know.
After explaining my exact issues a little further, this was suggested:
Maybe there is an issue with input event serials, if the resize or move is dismissed immediately?
Could this be a possibility? There's probably a better place I could ask for support than the wayland IRC I suppose. I guess it is mutter
that does not seem to be behaving as expected in this case - would I be correct in saying that?
I have nothing working yet, apart from the API bindings to the xdg_shell protocol extension in the wayland-protocols crate.
My goal for wayland-window would be to have xdg_shell support as a cargo feature enabled by default (to remain pre-1.17 compatible) and try to use it at runtime, fallbacking to wl_shell (the current implementation) if it is not available.
But all this means quite some work tbh, and with the other wayland libs and smithay, I don't have a huge amount of time. So this got relatively low priority as the current backend seemed "good enough", especially considering xdg_shell is still an experimental protocol that has not reached a stable release (but wl_shell is already deprecated so everybody uses xdg_shell anyway, I guess...)
Le 24 avril 2017 11:38:25 GMT+02:00, mitchmindtree notifications@github.com a écrit :
But we can't before rust 1.17, as it requires the "recursive_static" feature gate which will only be stabilized then.
Would you mind elaborating on this a little? Do you have plans to move to xdg_shell once 1.17 is released in a few days? Do you have a fork/feature/issue that I might be able to track somewhere? I'd be happy to test/help if there's a possibility it could solve this issue.
I asked in the wayland IRC about wl_shell:
< mindtree> hey folks, is
wl-shell
still (or was it ever fully) supported in the latest stable Gnome release? < ANON> mindtree, I'd be surprised if it was not, since so many programs use it in lack of a stable alternative. That said, I don't actually know.After explaining my exact issues a little further, this was suggested:
Maybe there is an issue with input event serials, if the resize or move is dismissed immediately?
Could this be a possibility? There's probably a better place I could ask for support than the wayland IRC I suppose. I guess it is
mutter
that does not seem to be behaving as expected in this case - would I be correct in saying that?-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/vberger/wayland-window/issues/16#issuecomment-296595971
@vberger out of curiosity, what system do you run that uses wayland that runs this example successfully (including allowing to resize and move the window)?
I just ran the simple_window
example with weston
(launched in a window) and it seemed to work perfectly! Perhaps this does indicate that there's some issue with mutter's implementation of wl_shell
.
I do most of my testing using weston currently.
Le 24 avril 2017 13:17:10 GMT+02:00, mitchmindtree notifications@github.com a écrit :
@vberger out of curiosity, what system do you run that uses wayland that runs this example successfully (including allowing to resize and move the window)?
-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/vberger/wayland-window/issues/16#issuecomment-296623622
@vberger After doing a bit more research and talking to the gnome IRC it seems like Gnome's priority switched from supporting wl_shell to xdg_shell around 2014, so I feel my time might be best spent helping implement the xdg_shell feature for wayland-rs.
Could you possibly provide a small overview (perhaps a new issue at wayland-rs) of the work that needs to be done to make this happen and any recommended steps for approaching it? Could I perhaps use the existing wl_shell implementation as a rough guide for how to implement this in wayland-rs?
Well, sure. Actually no work needs to be done on wayland-rs itself, only here, on wayland-window.
The bindings for xdg_shell are provided by the wayland-protocols crate: http://vberger.github.io/wayland-rs/wayland_protocols/unstable/xdg_shell/client/index.html
They are hidden behind the cargo features unstable_protocols
(because the protocol is not stable) and nightly
(for the static_recursion
feature).
On this protocol, the entry point is the zxgd_shell_v6
global, you can start looking at the docs I linked just before. As a comparison, the current implementations uses the wl_shell
global from the core wayland protocol: http://vberger.github.io/wayland-rs/wayland_client/protocol/wl_shell/index.html
@vberger what would be the best way to access the unstable xdg_shell
module within the wayland_window
crate? Should I import the wayland_protocols
crate directly enabling the nightly
and unstable_protocols
features? Or should the unstable_protocols
feature be made available through the wayland_client
dependency somehow?
The way the crates from wayland-rs are designed is that wayland-window
should directly depend on wayland-protocols
with the needed features. You'll also need the client
feature for wayland-protocols
.
Hey there!
I thought I'd have a go at running the
wayland-window
example after your comment at tomaka/winit#163 to test whether or not resizing or window works on this, however the example crashes as soon as it is run. Here is the output withRUST_BACKTRACE=1 WAYLAND_DEBUG=1 cargo run --example simple_window
:simple_window_debug.txt
Any ideas what might be going on here?