Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SnipArea not resizing when changing display setup #2

Open
yeahitsjan opened this issue Mar 24, 2023 · 4 comments
Open

SnipArea not resizing when changing display setup #2

yeahitsjan opened this issue Mar 24, 2023 · 4 comments
Assignees
Labels
bug Something isn't working core Related to the application's core windows Windows platform specifc
Milestone

Comments

@yeahitsjan
Copy link
Owner

Re-open issue from closed-source repo

Windows-specific. When changing the display setup from 1 to 2 displays the SnipArea is not drawn over both displays.

@yeahitsjan yeahitsjan added bug Something isn't working windows Windows platform specifc core Related to the application's core labels Mar 24, 2023
@yeahitsjan yeahitsjan self-assigned this Mar 24, 2023
@yeahitsjan
Copy link
Owner Author

It seems like even though we set the size of the widget to the current's desktop size (https://github.com/yeahitsjan/pawxel/blob/develop/source/sniparea.cpp#L16) the geometry isn't set to the top left point of the whole desktop. When we set the geometry manually to the top left point, we get our snip area to draw over the second screen but directing back to the primary screen (probably because QPixmap::grabWindow is deprecated).

@yeahitsjan
Copy link
Owner Author

yeahitsjan commented Mar 25, 2023

Replacing QPixmap::grabWindow with the following leads us the right direction:

// SnipArea::SnipArea()
this->setGeometry(QApplication::desktop()->geometry());

void SnipArea::grab(QRect _rect, QPoint _mousePos) {
    QPixmap _shot;
    //_shot = QPixmap::grabWindow(QApplication::desktop()->winId(), _rect.topLeft().x(), _rect.topLeft().y(), _rect.width(), _rect.height());
    QScreen *_tl = QApplication::screenAt(QPoint(QApplication::desktop()->geometry().x(), QApplication::desktop()->geometry().y()));
    _shot = _tl->grabWindow(0, _rect.topLeft().x(), _rect.topLeft().y(), _rect.width(), _rect.height());
    // emit snipped -> transfer _shot + QPoint to display LittlePreviewWindow on mouse pos
    emit snipped(_shot, _mousePos);
    this->close();
}

Still the mouse coordinates are now out of sync and the preview window moves out of bounds..

@yeahitsjan
Copy link
Owner Author

@yeahitsjan yeahitsjan added this to the 0.2.0 milestone Nov 29, 2023
@yeahitsjan yeahitsjan modified the milestones: 0.2.0, 0.2.1 Jan 17, 2024
@yeahitsjan
Copy link
Owner Author

Milestone modified due to other issues in private / personal projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core Related to the application's core windows Windows platform specifc
Projects
None yet
Development

No branches or pull requests

1 participant