QScreen::GrabWindow mouse blinking
-
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? -
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?@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.htmlDidnt 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 -
@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.htmlDidnt not tell me why cursor should blink.
The windows actual method
https://code.woboq.org/qt5/qtbase/src/plugins/platforms/windows/qwindowsscreen.cpp.html#_ZNK14QWindowsScreen10grabWindowEyiiiiThis post is deleted! -
@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.htmlDidnt 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@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.
-
@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.
@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 ? -
@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 ?@mrjj blinking cursor in the window I grab.
I don't draw it somewhere at all. -
@mrjj blinking cursor in the window I grab.
I don't draw it somewhere at all.@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. -
@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.@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. -
@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.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 :)
-
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 :)
@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 :)