开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: SBITX V2 - Second Monitor Issue


 

Thanks for info..
Sorting it out?

Joe

On Wed, Jul 5, 2023, 9:04 AM Evan Hand <elhandjr@...> wrote:
Hi Joe,

The code in the sbitx sbitx_gtk.c gets the screen size from the OS and adjusts the size of the gtk screen.? If you have two different monitors, the size will be the length and width of the screen placement area.? If the same size and position, all works well.? If the screens are offset, or the HDMI resolution is set to a higher value, then the sum of the two screens is used.

If you always use the 7" Raspberry Pi DSI screen, you can change the code in sbitx_gtk.c to a fixed value of 800x480.? You will need to comment out five lines and add back two like this:

From lines 3593 to 3606 in the latest sbitx_gtk.c:

void ui_init(int argc, char *argv[]){
?
? gtk_init( &argc, &argv );
?
//we are using two deprecated functions here
//if anyone has a hack around them, do submit it
?
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
screen_width = gdk_screen_width();
screen_height = gdk_screen_height();
#pragma pop
?
q_init(&q_web, 1000);

Change to:

void ui_init(int argc, char *argv[]){
?
? gtk_init( &argc, &argv );
?
//we are using two deprecated functions here
//if anyone has a hack around them, do submit it
/*
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
screen_width = gdk_screen_width();
screen_height = gdk_screen_height();
#pragma pop
*/
? ? ? ? screen_width = 800 ;
? ? ? ? screen_height = 480 ;

q_init(&q_web, 1000);

You will need to ./build sbitx (NOT update) and then restart.

To get the gtk (legacy) screen to align on the DSI screen, you need to start the sbitx program on the DSI screen.? I do this by opening a terminal window, moving it to fit on the DSI screen, changing to the sbitx directory (folder), and then ./sbitx to start (the ./is required).? I made a shell script to add the mapping of the touch screen and redirect the error info to a file:

cd /home/pi/sbitx
sudo xinput map-to-output "raspberrypi-ts" "DSI-1"
./sbitx &> errlog.txt

The alternative is to start the sbitx on the larger screen and minimize the gtk screen by clicking on the lowes righthand box on the gtk screen.? You may need to close the web interface to get to that screen.? You can always reopen by starting the Chrome browser and entering 127.0.0.1 in the URL box.

I hope this helps.
73
Evan
AC9TU

Join [email protected] to automatically receive all group messages.