xlmnxp / blue-recorder

Simple Screen Recorder written in Rust based on Green Recorder
Other
498 stars 27 forks source link

Capture area ... at position ... outside the screen size 3840x1080 #28

Open danstewart opened 2 years ago

danstewart commented 2 years ago

Having an issue with the "Area Chooser". When it's near the bottom of the screen I get an error complaining the area is off the screen.

Here is the exact error:

[x11grab @ 0x55a0a1c9ea00] Capture area 397x299 at position 2691.795 outside the screen size 3840x1080
:99.0+2691,795: Invalid argument

And here is a screenshot of the captured area: image

xlmnxp commented 2 years ago

2691 + 397 = 3088 < 3840 299 + 795 = 1094 > 1080 (this is the reason) I think xwininfo calculate window shadow as part of select area

danstewart commented 2 years ago

Looks like it, do you maybe need to remove the depth value?

xwininfo output for another failing example:

xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

xwininfo: Window id: 0x7001c18 "Area Chooser"

  Absolute upper-left X:  2341
  Absolute upper-left Y:  297
  Relative upper-left X:  2341
  Relative upper-left Y:  297
  Width: 1163
  Height: 801
  Depth: 32
  Visual: 0x6ab
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x7000006 (not installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +2341+297  -336+297  -336--18  +2341--18
  -geometry 1163x801+2341--18

Error:

[x11grab @ 0x559d8f036a00] Capture area 1163x801 at position 2313.301 outside the screen size 3840x1080
:99.0+2313,301: Invalid argument

297 + 801 = 1098 1098 - 32 = 1066

1066 seems like the correct Y position of the window.

xlmnxp commented 2 years ago

I don't know if depth is used for that?

danstewart commented 2 years ago

I can't find a definitive answer of what the depth value actually means. Found a few forum posts using at as color depth but I don't think that's correct.

Testing on a few different windows I tend to get either 24 or 32. Seems GTK apps are 32 and electron apps are 32.

danstewart commented 2 years ago

It does seem to be roughly correct, I put the area chooser at the bottom of the screen.

xwininfo:

  Absolute upper-left X:  2270
  Absolute upper-left Y:  810
  Relative upper-left X:  2270
  Relative upper-left Y:  810
  Width: 397
  Height: 299
  Depth: 32

Error:

[x11grab @ 0x55bcd20f1a00] Capture area 397x299 at position 2270.810 outside the screen size 3840x1080

299 + 810 = 1109 1109 - 32 = 1077

So there are 3px unaccounted for :man_shrugging:

danstewart commented 2 years ago

After some further testing maybe this isn't what is needed.

Some tests with a window aligned to the bottom of the screen:

Nautilus (Gnome Files) ``` Absolute upper-left X: 2075 Absolute upper-left Y: 647 Relative upper-left X: 2075 Relative upper-left Y: 647 Width: 644 Height: 495 Depth: 32 ``` 647 + 495 = 1142 1142 - 32 = 1110
Gedit ``` Absolute upper-left X: 2405 Absolute upper-left Y: 257 Relative upper-left X: 2405 Relative upper-left Y: 257 Width: 1058 Height: 885 Depth: 32 ``` 257 + 885 = 1142 1142 = 32 = 1110
VS Code ``` Absolute upper-left X: 2722 Absolute upper-left Y: 810 Relative upper-left X: 10 Relative upper-left Y: 39 Width: 508 Height: 270 Depth: 24 ``` 810 + 270 = 1080
Spotify ``` Absolute upper-left X: 2073 Absolute upper-left Y: 146 Relative upper-left X: 10 Relative upper-left Y: 39 Width: 1717 Height: 934 Depth: 24 ``` 146 + 934 = 1080
Area Chooser ``` Absolute upper-left X: 2666 Absolute upper-left Y: 810 Relative upper-left X: 2666 Relative upper-left Y: 810 Width: 397 Height: 299 Depth: 32 ``` 810 + 299 = 1109 1109 - 32 = 1077