Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QScreen::GrabWindow mouse blinking

QScreen::GrabWindow mouse blinking

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 2 Posters 3.2k 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.
  • UndeadBlowU Offline
    UndeadBlowU Offline
    UndeadBlow
    wrote on last edited by
    #1

    Hi, I have code:

    HWND h = FindWindow(NULL, (LPCWSTR)"Some window name");
    if (h == NULL) {
      qDebug() << "Can't get Handle of Window";
      return;
    }
    ++_screens_processed;
    
    const QImage& image = QGuiApplication::primaryScreen()->grabWindow((WId)(h)).toImage();
    

    And I'm doing it fast, about 1 time in 50 ms. And works very good except mouse cursor - it blinking very hard inside windows that is grabbing.
    Someone faced the such? What can I do?

    mrjjM 1 Reply Last reply
    0
    • UndeadBlowU UndeadBlow

      Hi, I have code:

      HWND h = FindWindow(NULL, (LPCWSTR)"Some window name");
      if (h == NULL) {
        qDebug() << "Can't get Handle of Window";
        return;
      }
      ++_screens_processed;
      
      const QImage& image = QGuiApplication::primaryScreen()->grabWindow((WId)(h)).toImage();
      

      And I'm doing it fast, about 1 time in 50 ms. And works very good except mouse cursor - it blinking very hard inside windows that is grabbing.
      Someone faced the such? What can I do?

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      @UndeadBlow said in QScreen::GrabWindow mouse blinking:

      grabWindow

      Hi Docs just says
      "The mouse cursor is generally not grabbed."

      So it sounds like its turned off/on but can not confirm it.

      Browsing the code
      https://code.woboq.org/qt5/qtbase/src/gui/kernel/qscreen.cpp.html

      Didnt not tell me why cursor should blink.

      The windows actual method
      https://code.woboq.org/qt5/qtbase/src/plugins/platforms/windows/qwindowsscreen.cpp.html#_ZNK14QWindowsScreen10grabWindowEyiiii

      UndeadBlowU 2 Replies Last reply
      0
      • mrjjM mrjj

        @UndeadBlow said in QScreen::GrabWindow mouse blinking:

        grabWindow

        Hi Docs just says
        "The mouse cursor is generally not grabbed."

        So it sounds like its turned off/on but can not confirm it.

        Browsing the code
        https://code.woboq.org/qt5/qtbase/src/gui/kernel/qscreen.cpp.html

        Didnt not tell me why cursor should blink.

        The windows actual method
        https://code.woboq.org/qt5/qtbase/src/plugins/platforms/windows/qwindowsscreen.cpp.html#_ZNK14QWindowsScreen10grabWindowEyiiii

        UndeadBlowU Offline
        UndeadBlowU Offline
        UndeadBlow
        wrote on last edited by UndeadBlow
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • mrjjM mrjj

          @UndeadBlow said in QScreen::GrabWindow mouse blinking:

          grabWindow

          Hi Docs just says
          "The mouse cursor is generally not grabbed."

          So it sounds like its turned off/on but can not confirm it.

          Browsing the code
          https://code.woboq.org/qt5/qtbase/src/gui/kernel/qscreen.cpp.html

          Didnt not tell me why cursor should blink.

          The windows actual method
          https://code.woboq.org/qt5/qtbase/src/plugins/platforms/windows/qwindowsscreen.cpp.html#_ZNK14QWindowsScreen10grabWindowEyiiii

          UndeadBlowU Offline
          UndeadBlowU Offline
          UndeadBlow
          wrote on last edited by
          #4

          @mrjj http://stackoverflow.com/questions/1541492/how-to-code-for-reducing-flicker-need-your-help-with-code-win32-vc-flicker Well... Seems that WinAPI sucks a little. I think we need to introduce some flag into Qt GrabWindow method, for double buffering.

          mrjjM 1 Reply Last reply
          0
          • UndeadBlowU UndeadBlow

            @mrjj http://stackoverflow.com/questions/1541492/how-to-code-for-reducing-flicker-need-your-help-with-code-win32-vc-flicker Well... Seems that WinAPI sucks a little. I think we need to introduce some flag into Qt GrabWindow method, for double buffering.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @UndeadBlow
            It sounds its more related to WM_ERASEBKGND
            But its unclear for me if its the cursor IN the window you grab or if you paint the grabbed
            some place else ?

            UndeadBlowU 1 Reply Last reply
            0
            • mrjjM mrjj

              @UndeadBlow
              It sounds its more related to WM_ERASEBKGND
              But its unclear for me if its the cursor IN the window you grab or if you paint the grabbed
              some place else ?

              UndeadBlowU Offline
              UndeadBlowU Offline
              UndeadBlow
              wrote on last edited by
              #6

              @mrjj blinking cursor in the window I grab.
              I don't draw it somewhere at all.

              mrjjM 1 Reply Last reply
              0
              • UndeadBlowU UndeadBlow

                @mrjj blinking cursor in the window I grab.
                I don't draw it somewhere at all.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @UndeadBlow
                Oh, but that is what link talk about. if u draw it at cursor.
                Not grabbing it.
                Double buffer is for flicker free drawing. Not sure it will do anything while grabbing.

                UndeadBlowU 1 Reply Last reply
                0
                • mrjjM mrjj

                  @UndeadBlow
                  Oh, but that is what link talk about. if u draw it at cursor.
                  Not grabbing it.
                  Double buffer is for flicker free drawing. Not sure it will do anything while grabbing.

                  UndeadBlowU Offline
                  UndeadBlowU Offline
                  UndeadBlow
                  wrote on last edited by UndeadBlow
                  #8

                  @mrjj Well, you are right. I was inattentive, sorry.
                  But I found where problem is. I've copied Qt GrabWindow code and removed CAPTUREBLT flag (here). And now it's totally ok. Is that bug or something? Maybe we should initiate some interface changes? I think code-user must have ability to pass some flags in Qt GrabWindow to control that.
                  And, well, I don't know how that flag makes cursor to blink.

                  mrjjM 1 Reply Last reply
                  0
                  • UndeadBlowU UndeadBlow

                    @mrjj Well, you are right. I was inattentive, sorry.
                    But I found where problem is. I've copied Qt GrabWindow code and removed CAPTUREBLT flag (here). And now it's totally ok. Is that bug or something? Maybe we should initiate some interface changes? I think code-user must have ability to pass some flags in Qt GrabWindow to control that.
                    And, well, I don't know how that flag makes cursor to blink.

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by mrjj
                    #9

                    np, it often happens fighting an issue and reading all over :)

                    Oh, i would never guess on that.
                    Good found!

                    CAPTUREBLT
                    "Includes any windows that are layered on top of your window in the resulting image. By default, the image only contains your window. Note that this generally cannot be used for printing device contexts."

                    So nope, does scream "BLINK" to me :)

                    UndeadBlowU 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      np, it often happens fighting an issue and reading all over :)

                      Oh, i would never guess on that.
                      Good found!

                      CAPTUREBLT
                      "Includes any windows that are layered on top of your window in the resulting image. By default, the image only contains your window. Note that this generally cannot be used for printing device contexts."

                      So nope, does scream "BLINK" to me :)

                      UndeadBlowU Offline
                      UndeadBlowU Offline
                      UndeadBlow
                      wrote on last edited by
                      #10

                      @mrjj And funny thing, I mentioned above that with screen recorder mouse blinks a little too. It was IceCream Screen Recorder. And what is funny - it is on Qt :)

                      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