Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
hrod17 committed Oct 9, 2017
1 parent 5ba3e0b commit c95af29
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
4 changes: 4 additions & 0 deletions abstractedsocket.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ QByteArray AbstractedSocket::getSessionHash() {
return sessionPasswordHash;
}

void AbstractedSocket::closeSocket() {
socket->close();
}

/*********************
* Public functions *
*********************/
Expand Down
2 changes: 2 additions & 0 deletions abstractedsocket.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class AbstractedSocket : public QObject
bool writeString(QString str, bool encrypt);
QString readString(bool decrypt);

void closeSocket();

private:
bool readAllData(QByteArray *data);
bool writeAllData(QByteArray data);
Expand Down
15 changes: 14 additions & 1 deletion fakeinput-windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,19 @@ void sendMouseEvent(DWORD flags, LONG dx, LONG dy, DWORD mouseData)
SendInput(1, &input, sizeof(input));
}

void sendMouseEventAbsolute(DWORD flags, LONG x, LONG y, DWORD mouseData)
{
INPUT input;
ZeroMemory(&input, sizeof(input));
input.type = INPUT_MOUSE;
input.mi.mouseData = mouseData;
input.mi.dx = x * (65536 / GetSystemMetrics(SM_CXSCREEN));
input.mi.dy = y * (65536 / GetSystemMetrics(SM_CYSCREEN));
input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | flags;

SendInput(1, &input, sizeof(input));
}

// SendInput() function doesn't repeat keys, here's a timer to simulate
// the normal behavior in windows: keys repeating as you hold them down.
QString lastKeyDown;
Expand Down Expand Up @@ -282,7 +295,7 @@ void keyUp(QString key) {
}

void mouseSetPos(int x, int y) {
sendMouseEvent(MOUSEEVENTF_ABSOLUTE, x, y, 0);
sendMouseEventAbsolute(MOUSEEVENTF_MOVE, x, y, 0);
}

void mouseMove(int addX, int addY) {
Expand Down
4 changes: 3 additions & 1 deletion fileutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ void sendScreenJPG(QString opts, AbstractedSocket *socket)
cropRect.setHeight(optList.at(4).toInt());
}

QPixmap screenshot = grabScreens();
//QPixmap screenshot = grabScreens();
QScreen *screen = QGuiApplication::primaryScreen();
QPixmap screenshot = screen->grabWindow(0);
if(cropped) {
QPainter painterFrame(&screenshot);
painterFrame.setCompositionMode(QPainter::CompositionMode_Source);
Expand Down

0 comments on commit c95af29

Please sign in to comment.