Initial position of application interface and mouse dragging failure under Linux

Time:2021-4-20

Story background: Recently, in the adaptive UOS system, the initial starting position of the client program jumps wildly. It’s not in the middle of the screen that I set. The mouse drag fails. I once suspected that there was something wrong with my code. Let’s start our exploration…

 

The way to explore:Later, goolge found that most desktop systems are X11, but this UOS system is Wayland, through export or echo $ XDG_ SESSION_ Type can view this environment variable. You may need to change the code to adapt Wayland…

@ubuntu:~$ echo $XDG_SESSION_TYPE 
x11
@ubuntu:~$ 

 

 

Solution:With excitement, I try to add environment variables in the startup scriptexport QT_QPA_PLATFORM=‘xcb’ actually took effect, because it is said on the Internet that Wayland is another desktop system, and it may need to modify the code to adapt to it, so let’s solve this problem first. If you are familiar with this, you can share it, ha ha ha.

 

The code says:Instead of writing the code, add export QT at the beginning of your startup script_ QPA_ PLATFORM=‘xcb’that will do

Recommended Today

Deeply analyze the principle and practice of RSA key

1、 Preface After experiencing many dark moments in life, when you read this article, you will regret and even be angry: why didn’t you write this article earlier?! Your darkest moments include: 1. Your project needs to be connected with the bank, and the other party needs you to provide an encryption certificate. You have […]