I have Ubuntu-server 16.04. Installed gtk3 and can execute my program manually by this command: ./img when I go to it's directory /home/m.

But when I tried to add this line to my /etc/rc.local file:
/home/m/img &
It didn't work. This is my rc.local full content:
startx
/home/m/img &
exit 0
Then I tried to create ~/.xinitrc file with this content:
#!/usr/bin/env bash
/home/m/img &
exec openbox-session
Then made it executable by this command:
chmod +x ~/.xinitrc
But I got nothing(even it didn't show my openbox after reboot), So I executed this command too:
ln -s ~/.xinitrc ~/.xsession
After that my openbox came back but my program didn't start after boot! or any other time!
My goal is this: when I turned on my board, after boot, it runs my gtk-based program and shows my image. It's something like Kiosk but a c++ program should only show an image!
How should I do that?
EDIT: I did add this line:
/home/m/img &
to my /etc/xdg/openbox/autostart file, and it works after login but doesn't show my image, it shows only a file icon at center of the screen. But when I go to this address /home/m/ and run this command ./img it shows my image in full screen!
Why this happens?
**Also I like to hide my mouse pointer and my windows borders but don't know how?
EDIT2: This is what I see after boot:

And this is what I see after trying this command(in write buttom corner an icon appears): /home/m/img &

rc.local. Did you add thestartxor is that an Ubuntu surprise? – Chris Davies Nov 09 '17 at 20:34/home/m/img &on a terminal, does your application work? – Zip Nov 10 '17 at 16:50&. You can make your app run without hanging the terminal by itself... – Zip Nov 10 '17 at 23:01/home/mdirectory are. My educated guess is that that will make it blatantly obvious to answerers why there's no image if the program is run with a different working directory. – JdeBP Nov 22 '17 at 14:51