colinkeenan / silentcast

Create silent mkv screencast and animated gif.
GNU General Public License v3.0
512 stars 22 forks source link

Entire window doesn't get window borders on top #2

Closed Seth-Johnson closed 9 years ago

Seth-Johnson commented 9 years ago

The "entire window" option doesn't seem to get the top borders on Ubuntu 14.04. For example:

anim

In the above gif the window border isn't shown. The entire window looks like this:

-untitled document 1 - gedit_029

Gedit isn't the only application. This also happens in gnome-terminal as well.

Seth-Johnson commented 9 years ago

Tested in Xubuntu 14.04 it works just fine:

xubuntu

colinkeenan commented 9 years ago

I'll look into this. I'm hoping to solve this without having to install Ubuntu myself. I'll update here tomorrow or sooner if I fix it. Thanks for the report.

Seth-Johnson commented 9 years ago

Let me know if you need more information or to test something. Thanks for making this awesome little app!

colinkeenan commented 9 years ago

I ended up using http://virtualboximages.com/Ubuntu+14.04.01+amd64+Desktop+VirtualBox+VDI to run Ubuntu in Virtual Box. Which was a quick and easy way to run Ubuntu. I will eventually add instructions to my README.md for all the Ubuntu flavors.

Anyway, for some reason, Silentcast worked for me when recording the entire window:

anim.gif

Here is what I did to get the dependencies installed for Silentcast. I've only tested recording the entire window so far, so I don't know if everything works, but that did:

sudo apt-get install bash libav-tools imagemagick x11-xserver-utils xdotool wininfo wmctrl python-gobject pyhon-cairo xdg-utils
sudo ln -s /usr/bin/avconv /usr/bin/ffmpeg    # I tried this instead of installing ffmpeg

Used Firefox to open http://www.ubuntuupdates.org/package/webupd8/trusty/main/base/yad clicked the "64-bit deb package" button in the Download section and let Software Center install yad

sudo apt-add-repository ppa:gurqn/systray-trusty # This stuff is to get systray notifications working
sudo gedit /etc/apt/preferences.d/systray-trusty

copy and pasted the following into the gedit window:

Package: *
Pin: release o=LP-PPA-gurqn-systray-trusty
Pin-Priority: 600

Then, back to the terminal

sudo apt-get update
sudo apt-get upgrade

Finally, did a reboot, and then ran Silentcast and recorded the entire file-browser window. Seems to work for me.

Oh, but I didn't try to record gedit or gnome terminal. Let me try those now.

Seth-Johnson commented 9 years ago

This is the output of xwininfo -id $(xdotool getactivewindow) on gnome-terminal in Ubuntu 14.04:

seth@johnson:~/projects/silentcast$ xwininfo -id $(xdotool getactivewindow)

xwininfo: Window id: 0x5000332 "seth@johnson: ~/projects/silentcast"

  Absolute upper-left X:  796
  Absolute upper-left Y:  354
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 722
  Height: 434
  Depth: 32
  Visual: 0x134
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x500000a (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:  +796+354  -402+354  -402-292  +796-292
  -geometry 80x24+786+316

Key here is:

  Relative upper-left X:  0
  Relative upper-left Y:  0

I will try some other applications.

Seth-Johnson commented 9 years ago

I just took a look at your .gif. That doesn't look like entire window to me. To my mind entire window means it will include the titlebar (without moving the window around). If you look at my gedit examples one includes the titlebar, the other doesn't.

Maybe your meaning for entire window is different from mine?

colinkeenan commented 9 years ago

OK - yeah, I see that I moved the window and that's the only reason I got the title bar. OK. And here is gedit:

anim.gif

Well, now I can work on fixing this.

colinkeenan commented 9 years ago

I will try to find out what needs to be done to get the size of the title bar and borders since for some reason xwininfo is giving the wrong answer.

colinkeenan commented 9 years ago

Google isn't giving me anything. I've posted the question on stackexchange and stackoverflow:

http://unix.stackexchange.com/questions/157613/how-to-get-the-full-window-dimensions-in-unity-on-ubuntu-14-04

http://stackoverflow.com/questions/26050788/in-bash-on-ubuntu-14-04-unity-how-can-i-get-the-total-size-of-an-open-window-i

Seth-Johnson commented 9 years ago

Google didn't help me either. Would manually allowing for the decorations work?

If it helps, it appears the titlebar is between 25 and 30 pixels in height:

workspace 1_033

Seth-Johnson commented 9 years ago

I managed to use some manual tweaking for the window decorations. I changed line 176 of genffcom (let y=$y-t) to:

let y=$y-28  

This captured the top window decorations. Unity doesn't have any others, so we should be ok. I tested on gnome-terminal and gedit. Both worked.

anim

This can be scripted by changing:

    if [ "$entire" = true ]
    then
        let x=$x-$b
        let y=$y-28 #$t
        let w=$w+2*$b
        let h=$h+$t+$b
    fi 

to:

    if [ "$entire" = true ]
    then
            if ["$XDG_CURRENT_DESKTOP" == "Unity"]
            then
                let x=$x-$b
                let y=$y-28 #$t
                let w=$w+2*$b
                let h=$h+$t+$b
            else
                let x=$x-$b
                let y=$y-$t
                let w=$w+2*$b
                let h=$h+$t+$b
            fi
    fi

I also tested in Xubuntu and it didn't affect it. I will do some more testing, but this seems like it will probably solve the issue.

Seth-Johnson commented 9 years ago

When I tested the system settings some of the bottom was getting clipped, so I had to change it too:

    if [ "$entire" = true ]
    then
            if ["$XDG_CURRENT_DESKTOP" == "Unity"]
            then
                let x=$x-$b
                let y=$y-28 #$t
                let w=$w+2*$b
                let h=$h+$t+$b+10
            else
                let x=$x-$b
                let y=$y-$t
                let w=$w+2*$b
                let h=$h+$t+$b
            fi
        fi

(Note the +10 on h)

That fixed it in the settings.

colinkeenan commented 9 years ago

Thank your for working on this. For now, I'm not going to put set numbers into it for Unity, but might end up doing that. I've found information that says you are right about the 28, but I think the other borders are 1, and the 10 comes from "the extra size of the input areas". I think you should be setting $b to 1, and adding 10 was correct.

I've sent an email to the author of this page about Unity Theming: https://wiki.ubuntu.com/Unity/Theming. I'm hoping he will answer the question on stack exchange because I'm sure he can. Maybe I can figure it out, but the info on that page isn't making a lot of sense to me at the moment.

I also filed a bug against xorg about xwininfo on Ubuntu 14.04 under Unity, but will be surprised if anyone does anything about it.

colinkeenan commented 9 years ago

By the way, I don't know if you noticed when you used Silentcast on Xfce, but when you use the transparent window, the title of it tells you the hot key for grabbing the borders with the mouse for resizing. I put that there since so many people use 1px themes that are nearly impossible to grab. I would like to do the same for all the other popular desktops, and had asked this question:

http://unix.stackexchange.com/questions/156083/from-a-bash-script-is-there-a-way-to-get-the-keybinding-for-resize-window

Maybe you'd like to work on an answer for that for Unity?

colinkeenan commented 9 years ago

I have posted this question in the proper place now where I think it will eventually be answered:

https://answers.launchpad.net/unity/+question/255025

colinkeenan commented 9 years ago

My question was answered and I'm going to have a new version out today. Not sure if I will work on it right away though.

colinkeenan commented 9 years ago

OK - Finally did this. A new version of genffcom is in this repository now. Luckily, the answer I got works for xfwm4 as well as for Unity, so I don't have to test for what window manager is running. I didn't end up using the extra 10px input area though, so let me know if you're still missing something off the bottom. In my tests, nothing was missing from top or bottom when ignoring the input area. I found that the input area is an extra 10px all around the window and responds when you put your mouse pointer in it as if it was an invisible border. That's why it's so easy to resize Unity windows even though the border is 0 width.

colinkeenan commented 9 years ago

When you have a chance, let me know if this latest version works properly for you. Then, I'll close this issue. Thanks for this bug report so I could get Silentcast working on Ubuntu.

Seth-Johnson commented 9 years ago

Awesome, testing now. I see you also fixed the full screen issue. I had already fixed that in my fork, but your fix is better.

Seth-Johnson commented 9 years ago

Yup, seems like it works fine! I tested both gnome-terminal and system-settings. No issues. Thanks!

Seth-Johnson commented 9 years ago

Oops, closed it myself. Hope you don't mind.

colinkeenan commented 9 years ago

I guess it makes sense for the person who opened an issue to also close it. Thanks.