Skip to content

Commit

Permalink
Improve code error handling of recent patch
Browse files Browse the repository at this point in the history
  • Loading branch information
handsome-feng committed Jul 21, 2020
1 parent cd67121 commit e216b4f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on:
push:
branches:
- master

pull_request:
branches:
- master

schedule:
- cron: '0 0 * * *'

jobs:
archlinux:
name: on Archlinux
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
cd build;
cmake ..;
make -j$(nproc);
fedora:
name: on Fedora 32
runs-on: ubuntu-20.04
Expand Down
1 change: 1 addition & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Copyright: 2019 Tianjin KYLIN Information Technology Co., Ltd
License: LGPL-2.1+

Files: debian/*
.github/workflows/build.yml
Copyright: 2019 Tianjin KYLIN Information Technology Co., Ltd
License: LGPL-2.1+

Expand Down
17 changes: 12 additions & 5 deletions tools/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,17 @@ bool playShutdownMusic(UkuiPower &powermanager, int num)

int main(int argc, char* argv[])
{
Display *disp = XOpenDisplay(NULL);
Screen *scrn = DefaultScreenOfDisplay(disp);
if (NULL == scrn) {
return 0;
Display *display = XOpenDisplay(NULL);
if (NULL == display) {
qDebug() << "Can't open display!";
return -1;
}
int width = scrn->width;
Screen *screen = DefaultScreenOfDisplay(display);
if (NULL == screen) {
qDebug() << "Get default screen failed!";
return -1;
}
int width = screen->width;

if (width > 2560) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
Expand All @@ -82,6 +87,8 @@ int main(int argc, char* argv[])
#endif
}

XCloseDisplay(display);

QApplication a(argc, argv);
//for hidpi

Expand Down

0 comments on commit e216b4f

Please sign in to comment.