Skip to content

Commit 9112683

Browse files
LiHua000deepin-ci-robot
authored andcommitted
fix: xcb: unset states and set new ones as need
Log: Should not unset all the old state and set the new ones. Only unset the state that needs to be unset. If states changes from maximized to minimized, there is no need to unset the maximized state and set the maximized states again. (minimized and maximized can exist simultaneously :) Bug: linuxdeepin/developer-center#5627 upstream: https://codereview.qt-project.org/c/qt/qtbase/+/504136
1 parent 03bacfe commit 9112683

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

debian/changelog

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
qtbase-opensource-src (5.15.8-1+deepin1) UNRELEASED; urgency=medium
1+
qtbase-opensource-src (5.15.8-1+deepin2) UNRELEASED; urgency=medium
22

33
[ Lu YaNing ]
44
* New upstream release (5.15.8).
55

66
[ Zhang TingAn ]
77
* Add some error handling for the inotify file system watcher
88
-- Add-some-error-handling-for-the-inotify-file-system-watcher.patch
9+
* xcb: unset states and set new ones as need
10+
-- xcb-unset-states-and-set-new-ones-as-need.patch
911

1012
-- Lu YaNing <[email protected]> Sat, 28 Jan 2023 16:18:43 +0800
1113

debian/patches/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ QTBUG-92468-reconsider-cursor-drawing-textObject.patch
6363
QTBUG-108092-add-filter-hook.patch
6464
QTBUG-101347-revert-xcb-implement-missing-bits-form-icccm414-WM_STATE-handling.patch
6565
Add-some-error-handling-for-the-inotify-file-system-watcher.patch
66+
xcb-unset-states-and-set-new-ones-as-need.patch
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Author: Zhang TingAn <[email protected]>
2+
Date: Tue Nov 07 15:09:13 2023 +0800
3+
Subject: xcb: unset states and set new ones as need
4+
Upstream: https://codereview.qt-project.org/c/qt/qtbase/+/504136
5+
6+
Index: qtbase-opensource-src/src/plugins/platforms/xcb/qxcbwindow.cpp
7+
===================================================================
8+
--- qtbase-opensource-src.orig/src/plugins/platforms/xcb/qxcbwindow.cpp
9+
+++ qtbase-opensource-src/src/plugins/platforms/xcb/qxcbwindow.cpp
10+
@@ -1125,18 +1125,21 @@ void QXcbWindow::setWindowState(Qt::Wind
11+
if (state == m_windowState)
12+
return;
13+
14+
+ Qt::WindowStates unsetState = m_windowState & ~state;
15+
+ Qt::WindowStates newState = state & ~m_windowState;
16+
+
17+
// unset old state
18+
- if (m_windowState & Qt::WindowMinimized)
19+
+ if (unsetState & Qt::WindowMinimized)
20+
xcb_map_window(xcb_connection(), m_window);
21+
- if (m_windowState & Qt::WindowMaximized)
22+
+ if (unsetState & Qt::WindowMaximized)
23+
setNetWmState(false,
24+
atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_HORZ),
25+
atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_VERT));
26+
- if (m_windowState & Qt::WindowFullScreen)
27+
+ if (unsetState & Qt::WindowFullScreen)
28+
setNetWmState(false, atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN));
29+
30+
// set new state
31+
- if (state & Qt::WindowMinimized) {
32+
+ if (newState & Qt::WindowMinimized) {
33+
{
34+
xcb_client_message_event_t event;
35+
36+
@@ -1157,13 +1160,8 @@ void QXcbWindow::setWindowState(Qt::Wind
37+
}
38+
m_minimized = true;
39+
}
40+
- if (state & Qt::WindowMaximized)
41+
- setNetWmState(true,
42+
- atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_HORZ),
43+
- atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_VERT));
44+
- if (state & Qt::WindowFullScreen)
45+
- setNetWmState(true, atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN));
46+
47+
+ // set Maximized && FullScreen state if need
48+
setNetWmState(state);
49+
50+
xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_hints_unchecked(xcb_connection(), m_window);

0 commit comments

Comments
 (0)