Skip to content

Commit

Permalink
Landscape (stretched) suspend screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems committed Jan 14, 2024
1 parent 3ba206c commit a547b54
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion applications/system-service/screenapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ QDBusObjectPath ScreenAPI::screenshot(){
});
}

bool ScreenAPI::drawFullscreenImage(QString path) {
bool ScreenAPI::drawFullscreenImage(QString path, float rotate) {
if (!hasPermission("screen")) {
return false;
}
Expand All @@ -55,6 +55,9 @@ bool ScreenAPI::drawFullscreenImage(QString path) {
qDebug() << "Image data invalid" << path;
return false;
}
if(rotate){
img = img.transformed(QTransform().rotate(rotate));
}
Oxide::Sentry::sentry_transaction(
"screen", "drawFullscrenImage",
[img, path](Oxide::Sentry::Transaction *t) {
Expand Down
2 changes: 1 addition & 1 deletion applications/system-service/screenapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class ScreenAPI : public APIBase {
return list;
}

Q_INVOKABLE bool drawFullscreenImage(QString path);
Q_INVOKABLE bool drawFullscreenImage(QString path, float rotate = 0);

Q_INVOKABLE QDBusObjectPath screenshot();
QImage copy(){
Expand Down
9 changes: 5 additions & 4 deletions applications/system-service/systemapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ void SystemAPI::PrepareForSleep(bool suspending){
resumeApp = nullptr;
}
});
Oxide::Sentry::sentry_span(t, "screen", "Update screen with suspend image", []{
auto rotate = landscape() ? 90 : 0;
Oxide::Sentry::sentry_span(t, "screen", "Update screen with suspend image", [rotate]{
if(QFile::exists("/usr/share/remarkable/sleeping.png")){
screenAPI->drawFullscreenImage("/usr/share/remarkable/sleeping.png");
screenAPI->drawFullscreenImage("/usr/share/remarkable/sleeping.png", rotate);
}else{
screenAPI->drawFullscreenImage("/usr/share/remarkable/suspended.png");
screenAPI->drawFullscreenImage("/usr/share/remarkable/suspended.png", rotate);
}
});
Oxide::Sentry::sentry_span(t, "disable", "Disable various services", [this, device]{
Expand All @@ -58,7 +59,7 @@ void SystemAPI::PrepareForSleep(bool suspending){
}
releaseSleepInhibitors();
});
Oxide::Sentry::sentry_span(t, "clear-input", "Clear input buffers", [this]{
Oxide::Sentry::sentry_span(t, "clear-input", "Clear input buffers", []{
touchHandler->clear_buffer();
wacomHandler->clear_buffer();
buttonHandler->clear_buffer();
Expand Down

0 comments on commit a547b54

Please sign in to comment.