Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QWS VNC doesn't work on Portrait mode
Forum Update on Monday, May 27th 2025

QWS VNC doesn't work on Portrait mode

Scheduled Pinned Locked Moved Mobile and Embedded
vncqwsembedded4.8rotate
29 Posts 3 Posters 14.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kumararajas
    wrote on last edited by
    #1

    Hi,

    I am working on embedded product which has 7" LCD display. And the core is TI AM335x.

    Since the display by default is, Landscape mode and I need to rotate the screen to portrait mode as per the requirements.

    Since I need screen rotation, I use a QWS option "Transformed:Rot270" to rotate the screen. And it works cool.

    Now I would like to extend the display to my linux as well. So, I use VNC for that.
    When I tested VNC, it worked excellent in case of TI AM335x EVM board.
    The reason is that, I have never rotated the screen in the EVM board.

    Now, in my application, I need to rotate the screen.

    The export option I have set is,
    export QWS_DISPLAY="Multi: VNC:size=480x640:0 Transformed:Rot270:LinuxFb:size=480x640:1 Transformed:Rot270 :2"

    With this In the desktop, I could see the VNC viewer screen was rotated and displayed as I wanted. And also, I have used the mouse to operate the UI and it was working perfect.

    But in the LCD UI, I could see two UI's of actual UI. Meaning, One in the landscape mode and other one in the portrait mode.
    And I can actually operate the one which is in portrait mode. The landscape mode UI was actually from VNC (may be).

    Then later, I was trying various combinations for QWS, but could not corner the problem.

    Then I googled to see if there are fixes. That time, I came across this:
    https://bugreports.qt.io/browse/QTBUG-12290
    It looks like it is a bug from Qt related to screen rotation.

    I wanted to apply this patch and see if it solves my problem.

    After applying the patch, my observations are

    • Both LCD and Linux shows the UI exactly same.
    • When I operate the UI from Linux, it works perfect.
    • When I operate the UI from LCD, it doesnt work. It looks like the touch inputs are still without screen rotate.
      Visualize the screen in portrait mode (rotated screen). Meaning, assume there is a button in top left corner. If I click the button from Linux VNC, yes it works. When I touch the same position - top left in the LCD UI, there is no response. But, if I touch the bottom left, button responds. It seems like the touch inputs are not rotated.

    I tried my best to explain the problem. Please let me know if you have any thoughts on this.

    Thank you,
    Kumara

    --Kumar

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I'd look at the sendMouseEvent patch part, it's probably there that the dispatching is not done correctly

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 3 Replies Last reply
      0
      • SGaistS SGaist

        Hi,

        I'd look at the sendMouseEvent patch part, it's probably there that the dispatching is not done correctly

        K Offline
        K Offline
        kumararajas
        wrote on last edited by kumararajas
        #3

        @SGaist Hi Sam, Thank you for taking time and looking at the implementation.

        How to go about?

        Thanks,
        Kumara

        --Kumar

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          I'd look at the sendMouseEvent patch part, it's probably there that the dispatching is not done correctly

          K Offline
          K Offline
          kumararajas
          wrote on last edited by kumararajas
          #4

          @SGaist This was the else part added as part of the patch (that is attached in Qt bug)

              if (qt_screen->isTransformed()) 
              {
                  QSize s = QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight());
                  tpos = qt_screen->mapFromDevice(pos, s);
              } 
              else 
              {
                  //tpos = pos;
                  // Only in case of Multi Display
                  // If main screen is not transformed, then check if sub screens are transformed
                  QList<QScreen*> screens = qt_screen->subScreens();
                  if (screens.size() && !bRemote) 
                  {
                      for (int i = 0; i < screens.size(); ++i) 
                      {
                          QScreen *screen = screens.at(i);
                          if (screen->isTransformed())
                          {
                              QSize s = QSize(screen->deviceWidth(), screen->deviceHeight());
                              tpos = screen->mapFromDevice(pos, s);
                              break;
                          }
                      }
                  }
              }

          --Kumar

          1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            I'd look at the sendMouseEvent patch part, it's probably there that the dispatching is not done correctly

            K Offline
            K Offline
            kumararajas
            wrote on last edited by
            #5

            @SGaist This Qt bug is not fixed in any of Qt 4.8 versions?

            --Kumar

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              It's still the same in 4.8.7

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              K 1 Reply Last reply
              0
              • SGaistS SGaist

                It's still the same in 4.8.7

                K Offline
                K Offline
                kumararajas
                wrote on last edited by
                #7

                @SGaist Ok Sam. Do you see any way to fix this problem?

                Thank you.

                --Kumar

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  If I understand the patch correctly, it only check other screens if the main screen is not transformed. Since you have more that one screen transformed, you should check all screens (main + sub-screens)

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  K 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    If I understand the patch correctly, it only check other screens if the main screen is not transformed. Since you have more that one screen transformed, you should check all screens (main + sub-screens)

                    K Offline
                    K Offline
                    kumararajas
                    wrote on last edited by
                    #9

                    @SGaist Then it means that, the else part of code, should be done for if condition as well?

                        if (qt_screen->isTransformed()) 
                        {
                            QSize s = QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight());
                            tpos = qt_screen->mapFromDevice(pos, s);
                        } 
                        //tpos = pos;
                        // Only in case of Multi Display
                        // If main screen is not transformed, then check if sub screens are transformed
                        QList<QScreen*> screens = qt_screen->subScreens();
                        if (screens.size() && !bRemote) 
                        {
                            for (int i = 0; i < screens.size(); ++i) 
                            {
                                QScreen *screen = screens.at(i);
                                if (screen->isTransformed())
                                {
                                    QSize s = QSize(screen->deviceWidth(), screen->deviceHeight());
                                    tpos = screen->mapFromDevice(pos, s);
                                    break;
                                }
                            }
                        }
                    

                    Is it like that?

                    --Kumar

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      I'd remove also the bRemote, just check them all

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      K 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        I'd remove also the bRemote, just check them all

                        K Offline
                        K Offline
                        kumararajas
                        wrote on last edited by
                        #11

                        @SGaist Hmm, let me test this.

                        Just for better understanding attaching the modified code:

                        if (qt_screen->isTransformed()) 
                            {
                                QSize s = QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight());
                                tpos = qt_screen->mapFromDevice(pos, s);
                            } 
                            //tpos = pos;
                            // Only in case of Multi Display
                            // If main screen is not transformed, then check if sub screens are transformed
                            QList<QScreen*> screens = qt_screen->subScreens();
                            if (screens.size()) 
                            {
                                for (int i = 0; i < screens.size(); ++i) 
                                {
                                    QScreen *screen = screens.at(i);
                                    if (screen->isTransformed())
                                    {
                                        QSize s = QSize(screen->deviceWidth(), screen->deviceHeight());
                                        tpos = screen->mapFromDevice(pos, s);
                                        break;
                                    }
                                }
                            } 
                        

                        I'll test and keep you posted..

                        --Kumar

                        K 1 Reply Last reply
                        0
                        • K kumararajas

                          @SGaist Hmm, let me test this.

                          Just for better understanding attaching the modified code:

                          if (qt_screen->isTransformed()) 
                              {
                                  QSize s = QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight());
                                  tpos = qt_screen->mapFromDevice(pos, s);
                              } 
                              //tpos = pos;
                              // Only in case of Multi Display
                              // If main screen is not transformed, then check if sub screens are transformed
                              QList<QScreen*> screens = qt_screen->subScreens();
                              if (screens.size()) 
                              {
                                  for (int i = 0; i < screens.size(); ++i) 
                                  {
                                      QScreen *screen = screens.at(i);
                                      if (screen->isTransformed())
                                      {
                                          QSize s = QSize(screen->deviceWidth(), screen->deviceHeight());
                                          tpos = screen->mapFromDevice(pos, s);
                                          break;
                                      }
                                  }
                              } 
                          

                          I'll test and keep you posted..

                          K Offline
                          K Offline
                          kumararajas
                          wrote on last edited by
                          #12

                          No success yet!

                          While running the application with Multi for VNC, still the touch inputs on the device is still not rotated.

                          --Kumar

                          K 1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            Silly idea (and just to verify) but what about just dropping the if and do the transform for all screens anyway ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            K 2 Replies Last reply
                            0
                            • K kumararajas

                              No success yet!

                              While running the application with Multi for VNC, still the touch inputs on the device is still not rotated.

                              K Offline
                              K Offline
                              kumararajas
                              wrote on last edited by kumararajas
                              #14

                              Just for more information:

                              export QWS_DISPLAY="Multi: VNC:0:size=480x640 Transformed:rot0"
                              

                              This displays the UI in a landscape mode and the touch input works as per the UI.

                              export QWS_DISPLAY="Multi: VNC:0:size=480x640 Transformed:rot90"
                              

                              This rotates the UI to 90 degrees. But the touch input is as same as 0 degrees.

                              This clearly indicates that the display transformation works good but the transformation to touch input mapping is not working.

                              --Kumar

                              1 Reply Last reply
                              0
                              • SGaistS SGaist

                                Silly idea (and just to verify) but what about just dropping the if and do the transform for all screens anyway ?

                                K Offline
                                K Offline
                                kumararajas
                                wrote on last edited by
                                #15

                                @SGaist Sam, can you please send me the code snippet to be on same page?

                                Thanks,
                                Kumara

                                --Kumar

                                1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  Silly idea (and just to verify) but what about just dropping the if and do the transform for all screens anyway ?

                                  K Offline
                                  K Offline
                                  kumararajas
                                  wrote on last edited by
                                  #16

                                  @SGaist You mean to try this kind of code:

                                  QList<QScreen*> screens = qt_screen->subScreens();
                                  if (screens.size()) 
                                  {
                                      for (int i = 0; i < screens.size(); ++i) 
                                      {
                                          QScreen *screen = screens.at(i);
                                          QSize s = QSize(screen->deviceWidth(), screen->deviceHeight());
                                          tpos = screen->mapFromDevice(pos, s);
                                          break;
                                      }
                                  }
                                  

                                  instead of

                                  if (qt_screen->isTransformed()) 
                                      {
                                          QSize s = QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight());
                                          tpos = qt_screen->mapFromDevice(pos, s);
                                      } 
                                      else 
                                      {
                                          //tpos = pos;
                                          // Only in case of Multi Display
                                          // If main screen is not transformed, then check if sub screens are transformed
                                          QList<QScreen*> screens = qt_screen->subScreens();
                                          if (screens.size() && !bRemote) 
                                          {
                                              for (int i = 0; i < screens.size(); ++i) 
                                              {
                                                  QScreen *screen = screens.at(i);
                                                  if (screen->isTransformed())
                                                  {
                                                      QSize s = QSize(screen->deviceWidth(), screen->deviceHeight());
                                                      tpos = screen->mapFromDevice(pos, s);
                                                      break;
                                                  }
                                              }
                                          }
                                      }
                                  

                                  Sam, if you confirm, I can make these changes and build my packages.

                                  Thanks,
                                  Kumara

                                  --Kumar

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #17

                                    Yes that's what I had in mind, without forgetting the main screen first.

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    K 2 Replies Last reply
                                    0
                                    • SGaistS SGaist

                                      Yes that's what I had in mind, without forgetting the main screen first.

                                      K Offline
                                      K Offline
                                      kumararajas
                                      wrote on last edited by
                                      #18

                                      @SGaist Oh ya, I missed the main screen

                                      So here is the code which I can do the test:

                                      // Main screen
                                      QSize s = QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight());
                                      tpos = qt_screen->mapFromDevice(pos, s);
                                      
                                      // Subscreens
                                      QList<QScreen*> screens = qt_screen->subScreens();
                                      if (screens.size()) 
                                      {
                                          for (int i = 0; i < screens.size(); ++i) 
                                          {
                                              QScreen *screen = screens.at(i);
                                              QSize s = QSize(screen->deviceWidth(), screen->deviceHeight());
                                              tpos = screen->mapFromDevice(pos, s);
                                              break;
                                          }
                                      }
                                      

                                      Right?

                                      --Kumar

                                      1 Reply Last reply
                                      0
                                      • SGaistS SGaist

                                        Yes that's what I had in mind, without forgetting the main screen first.

                                        K Offline
                                        K Offline
                                        kumararajas
                                        wrote on last edited by
                                        #19

                                        @SGaist Below the patch code, I see

                                            QPoint tpos;
                                            // Main screen
                                            QSize s = QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight());
                                            tpos = qt_screen->mapFromDevice(pos, s);
                                        
                                            // Sub screens
                                            QList<QScreen*> screens = qt_screen->subScreens();
                                            if (screens.size()) 
                                            {
                                                for (int i = 0; i < screens.size(); ++i) 
                                                {
                                                    QScreen *screen = screens.at(i);
                                                    QSize s = QSize(screen->deviceWidth(), screen->deviceHeight());
                                                    tpos = screen->mapFromDevice(pos, s);
                                                    break;
                                                }
                                            }
                                        
                                            if (qt_last_x) {
                                                 *qt_last_x = tpos.x();
                                                 *qt_last_y = tpos.y();
                                            }
                                            QWSServer::mousePosition = tpos;
                                            qwsServerPrivate->mouseState = state;
                                        

                                        We use the tpos and mouse the mousePosition just once. Even though, we have many subscreens, we just do it once.

                                        Is this correct?

                                        Should we not do this in a loop for all the screens?

                                        Please let me know.

                                        --Kumar

                                        K 1 Reply Last reply
                                        0
                                        • K kumararajas

                                          @SGaist Below the patch code, I see

                                              QPoint tpos;
                                              // Main screen
                                              QSize s = QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight());
                                              tpos = qt_screen->mapFromDevice(pos, s);
                                          
                                              // Sub screens
                                              QList<QScreen*> screens = qt_screen->subScreens();
                                              if (screens.size()) 
                                              {
                                                  for (int i = 0; i < screens.size(); ++i) 
                                                  {
                                                      QScreen *screen = screens.at(i);
                                                      QSize s = QSize(screen->deviceWidth(), screen->deviceHeight());
                                                      tpos = screen->mapFromDevice(pos, s);
                                                      break;
                                                  }
                                              }
                                          
                                              if (qt_last_x) {
                                                   *qt_last_x = tpos.x();
                                                   *qt_last_y = tpos.y();
                                              }
                                              QWSServer::mousePosition = tpos;
                                              qwsServerPrivate->mouseState = state;
                                          

                                          We use the tpos and mouse the mousePosition just once. Even though, we have many subscreens, we just do it once.

                                          Is this correct?

                                          Should we not do this in a loop for all the screens?

                                          Please let me know.

                                          K Offline
                                          K Offline
                                          kumararajas
                                          wrote on last edited by
                                          #20

                                          Looks like I am in a wrong direction.

                                          I suspect "Transformed" driver is not having problem.

                                          I think, it is "multi" screen driver is what not working good.

                                          Because, when VNC option is selected, Transformed works food.
                                          When LinuxFb is selected, Transformed works good.

                                          When both are used, there lies the problem.

                                          I guess, we may have to look at Multi Screen driver source code to see how it has been implemented.

                                          Can you please point me to the right location?

                                          Thanks,
                                          Kumara

                                          --Kumar

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved