Skip to content

Commit 2e56e66

Browse files
committed
fix: random crash due to XFree()
1 parent 783f451 commit 2e56e66

File tree

4 files changed

+7
-28
lines changed

4 files changed

+7
-28
lines changed

deb.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set(_VERSION_MAJOR 0)
22
set(_VERSION_MINOR 6)
3-
set(_VERSION_PATCH 5)
3+
set(_VERSION_PATCH 6)
44

55
set(CPACK_GENERATOR "DEB")
66

debian/doc/changelog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* 0.6.6
2+
- fix: random crash due to XFree()
13
* 0.6.5
24
- add: Allow to drag is now in the preference page
35
* 0.6.4

frame/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ int main(int argc, char *argv[]) {
3131
app.setOrganizationName("septemberhx");
3232
app.setApplicationName("dde-top-panel");
3333
app.setApplicationDisplayName("DDE Top Panel");
34-
app.setApplicationVersion("0.6.5");
34+
app.setApplicationVersion("0.6.6");
3535
app.loadTranslator();
3636
app.setAttribute(Qt::AA_EnableHighDpiScaling, true);
3737
app.setAttribute(Qt::AA_UseHighDpiPixmaps, false);

frame/util/XUtils.cpp

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -223,32 +223,9 @@ QPixmap XUtils::getWindowIconName(int winId) {
223223

224224

225225
int XUtils::getWindowScreenNum(int winId) {
226-
openXdo();
227-
228-
QRect r;
229-
XWindowAttributes attr;
230-
int ret = XGetWindowAttributes(m_xdo->xdpy, winId, &attr);
231-
if (ret != 0) {
232-
int x, y;
233-
Window unused_child, parent, root;
234-
Window *children;
235-
unsigned int nchildren;
236-
XQueryTree(m_xdo->xdpy, winId, &root, &parent, &children, &nchildren);
237-
if (children != NULL) {
238-
XFree(children);
239-
}
240-
if (parent == attr.root) {
241-
x = attr.x;
242-
y = attr.y;
243-
} else {
244-
XTranslateCoordinates(m_xdo->xdpy, winId, attr.root, attr.x, attr.y, &x, &y, &unused_child);
245-
}
246-
247-
r.setLeft(x);
248-
r.setTop(y);
249-
r.setWidth(attr.width);
250-
r.setHeight(attr.height);
251-
226+
KWindowInfo info = KWindowSystem::self()->windowInfo(winId, NET::WMGeometry);
227+
if (info.valid()) {
228+
QRect r = info.geometry();
252229
int maxPartScreenNum = 0;
253230
int maxPartArea = 0;
254231
int i = 0;

0 commit comments

Comments
 (0)