Changeset View
Changeset View
Standalone View
Standalone View
client.cpp
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 99 | Client::Client() | |||
---|---|---|---|---|---|
103 | , m_frame() | 103 | , m_frame() | ||
104 | , m_activityUpdatesBlocked(false) | 104 | , m_activityUpdatesBlocked(false) | ||
105 | , m_blockedActivityUpdatesRequireTransients(false) | 105 | , m_blockedActivityUpdatesRequireTransients(false) | ||
106 | , m_moveResizeGrabWindow() | 106 | , m_moveResizeGrabWindow() | ||
107 | , move_resize_has_keyboard_grab(false) | 107 | , move_resize_has_keyboard_grab(false) | ||
108 | , m_managed(false) | 108 | , m_managed(false) | ||
109 | , m_transientForId(XCB_WINDOW_NONE) | 109 | , m_transientForId(XCB_WINDOW_NONE) | ||
110 | , m_originalTransientForId(XCB_WINDOW_NONE) | 110 | , m_originalTransientForId(XCB_WINDOW_NONE) | ||
111 | , shade_below(NULL) | 111 | , shade_below(nullptr) | ||
112 | , m_motif(atoms->motif_wm_hints) | 112 | , m_motif(atoms->motif_wm_hints) | ||
113 | , blocks_compositing(false) | 113 | , blocks_compositing(false) | ||
114 | , shadeHoverTimer(NULL) | 114 | , shadeHoverTimer(nullptr) | ||
115 | , m_colormap(XCB_COLORMAP_NONE) | 115 | , m_colormap(XCB_COLORMAP_NONE) | ||
116 | , in_group(NULL) | 116 | , in_group(nullptr) | ||
117 | , ping_timer(NULL) | 117 | , ping_timer(nullptr) | ||
118 | , m_killHelperPID(0) | 118 | , m_killHelperPID(0) | ||
119 | , m_pingTimestamp(XCB_TIME_CURRENT_TIME) | 119 | , m_pingTimestamp(XCB_TIME_CURRENT_TIME) | ||
120 | , m_userTime(XCB_TIME_CURRENT_TIME) // Not known yet | 120 | , m_userTime(XCB_TIME_CURRENT_TIME) // Not known yet | ||
121 | , allowed_actions(0) | 121 | , allowed_actions(nullptr) | ||
122 | , shade_geometry_change(false) | 122 | , shade_geometry_change(false) | ||
123 | , sm_stacking_order(-1) | 123 | , sm_stacking_order(-1) | ||
124 | , activitiesDefined(false) | 124 | , activitiesDefined(false) | ||
125 | , sessionActivityOverride(false) | 125 | , sessionActivityOverride(false) | ||
126 | , needsXWindowMove(false) | 126 | , needsXWindowMove(false) | ||
127 | , m_decoInputExtent() | 127 | , m_decoInputExtent() | ||
128 | , m_focusOutTimer(nullptr) | 128 | , m_focusOutTimer(nullptr) | ||
129 | , m_clientSideDecorated(false) | 129 | , m_clientSideDecorated(false) | ||
130 | { | 130 | { | ||
131 | // TODO: Do all as initialization | 131 | // TODO: Do all as initialization | ||
132 | syncRequest.counter = syncRequest.alarm = XCB_NONE; | 132 | syncRequest.counter = syncRequest.alarm = XCB_NONE; | ||
133 | syncRequest.timeout = syncRequest.failsafeTimeout = NULL; | 133 | syncRequest.timeout = syncRequest.failsafeTimeout = nullptr; | ||
134 | syncRequest.lastTimestamp = xTime(); | 134 | syncRequest.lastTimestamp = xTime(); | ||
135 | syncRequest.isPending = false; | 135 | syncRequest.isPending = false; | ||
136 | 136 | | |||
137 | // Set the initial mapping state | 137 | // Set the initial mapping state | ||
138 | mapping_state = Withdrawn; | 138 | mapping_state = Withdrawn; | ||
139 | 139 | | |||
140 | info = NULL; | 140 | info = nullptr; | ||
141 | 141 | | |||
142 | shade_mode = ShadeNone; | 142 | shade_mode = ShadeNone; | ||
143 | deleting = false; | 143 | deleting = false; | ||
144 | m_fullscreenMode = FullScreenNone; | 144 | m_fullscreenMode = FullScreenNone; | ||
145 | hidden = false; | 145 | hidden = false; | ||
146 | noborder = false; | 146 | noborder = false; | ||
147 | app_noborder = false; | 147 | app_noborder = false; | ||
148 | ignore_focus_stealing = false; | 148 | ignore_focus_stealing = false; | ||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | 220 | { | |||
222 | deleting = true; | 222 | deleting = true; | ||
223 | #ifdef KWIN_BUILD_TABBOX | 223 | #ifdef KWIN_BUILD_TABBOX | ||
224 | TabBox::TabBox *tabBox = TabBox::TabBox::self(); | 224 | TabBox::TabBox *tabBox = TabBox::TabBox::self(); | ||
225 | if (tabBox && tabBox->isDisplayed() && tabBox->currentClient() == this) { | 225 | if (tabBox && tabBox->isDisplayed() && tabBox->currentClient() == this) { | ||
226 | tabBox->nextPrev(true); | 226 | tabBox->nextPrev(true); | ||
227 | } | 227 | } | ||
228 | #endif | 228 | #endif | ||
229 | destroyWindowManagementInterface(); | 229 | destroyWindowManagementInterface(); | ||
230 | Deleted* del = NULL; | 230 | Deleted* del = nullptr; | ||
231 | if (!on_shutdown) { | 231 | if (!on_shutdown) { | ||
232 | del = Deleted::create(this); | 232 | del = Deleted::create(this); | ||
233 | } | 233 | } | ||
234 | if (isMoveResize()) | 234 | if (isMoveResize()) | ||
235 | emit clientFinishUserMovedResized(this); | 235 | emit clientFinishUserMovedResized(this); | ||
236 | emit windowClosed(this, del); | 236 | emit windowClosed(this, del); | ||
237 | finishCompositing(); | 237 | finishCompositing(); | ||
238 | RuleBook::self()->discardUsed(this, true); // Remove ForceTemporarily rules | 238 | RuleBook::self()->discardUsed(this, true); // Remove ForceTemporarily rules | ||
▲ Show 20 Lines • Show All 633 Lines • ▼ Show 20 Line(s) | 867 | } else { | |||
872 | shade_geometry_change = false; | 872 | shade_geometry_change = false; | ||
873 | plainResize(s); | 873 | plainResize(s); | ||
874 | geom_restore = geometry(); | 874 | geom_restore = geometry(); | ||
875 | if ((shade_mode == ShadeHover || shade_mode == ShadeActivated) && rules()->checkAcceptFocus(info->input())) | 875 | if ((shade_mode == ShadeHover || shade_mode == ShadeActivated) && rules()->checkAcceptFocus(info->input())) | ||
876 | setActive(true); | 876 | setActive(true); | ||
877 | if (shade_mode == ShadeHover) { | 877 | if (shade_mode == ShadeHover) { | ||
878 | ToplevelList order = workspace()->stackingOrder(); | 878 | ToplevelList order = workspace()->stackingOrder(); | ||
879 | // invalidate, since "this" could be the topmost toplevel and shade_below dangeling | 879 | // invalidate, since "this" could be the topmost toplevel and shade_below dangeling | ||
880 | shade_below = NULL; | 880 | shade_below = nullptr; | ||
881 | // this is likely related to the index parameter?! | 881 | // this is likely related to the index parameter?! | ||
882 | for (int idx = order.indexOf(this) + 1; idx < order.count(); ++idx) { | 882 | for (int idx = order.indexOf(this) + 1; idx < order.count(); ++idx) { | ||
883 | shade_below = qobject_cast<Client*>(order.at(idx)); | 883 | shade_below = qobject_cast<Client*>(order.at(idx)); | ||
884 | if (shade_below) { | 884 | if (shade_below) { | ||
885 | break; | 885 | break; | ||
886 | } | 886 | } | ||
887 | } | 887 | } | ||
888 | if (shade_below && shade_below->isNormalWindow()) | 888 | if (shade_below && shade_below->isNormalWindow()) | ||
889 | workspace()->raiseClient(this); | 889 | workspace()->raiseClient(this); | ||
890 | else | 890 | else | ||
891 | shade_below = NULL; | 891 | shade_below = nullptr; | ||
892 | } | 892 | } | ||
893 | m_wrapper.map(); | 893 | m_wrapper.map(); | ||
894 | m_client.map(); | 894 | m_client.map(); | ||
895 | exportMappingState(NormalState); | 895 | exportMappingState(NormalState); | ||
896 | if (isActive()) | 896 | if (isActive()) | ||
897 | workspace()->requestFocus(this); | 897 | workspace()->requestFocus(this); | ||
898 | } | 898 | } | ||
899 | info->setState(isShade() ? NET::Shaded : NET::States(0), NET::Shaded); | 899 | info->setState(isShade() ? NET::Shaded : NET::States(0), NET::Shaded); | ||
Show All 18 Lines | 917 | if (!tabGroup() || tabGroup()->current() == this || | |||
918 | tabGroup()->current()->shadeMode() == ShadeNormal) | 918 | tabGroup()->current()->shadeMode() == ShadeNormal) | ||
919 | setShade(ShadeNormal); | 919 | setShade(ShadeNormal); | ||
920 | cancelShadeHoverTimer(); | 920 | cancelShadeHoverTimer(); | ||
921 | } | 921 | } | ||
922 | 922 | | |||
923 | void Client::cancelShadeHoverTimer() | 923 | void Client::cancelShadeHoverTimer() | ||
924 | { | 924 | { | ||
925 | delete shadeHoverTimer; | 925 | delete shadeHoverTimer; | ||
926 | shadeHoverTimer = 0; | 926 | shadeHoverTimer = nullptr; | ||
927 | } | 927 | } | ||
928 | 928 | | |||
929 | void Client::toggleShade() | 929 | void Client::toggleShade() | ||
930 | { | 930 | { | ||
931 | // If the mode is ShadeHover or ShadeActive, cancel shade too | 931 | // If the mode is ShadeHover or ShadeActive, cancel shade too | ||
932 | setShade(shade_mode == ShadeNone ? ShadeNormal : ShadeNone); | 932 | setShade(shade_mode == ShadeNone ? ShadeNormal : ShadeNone); | ||
933 | } | 933 | } | ||
934 | 934 | | |||
▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Line(s) | |||||
1096 | * of the actual preview. | 1096 | * of the actual preview. | ||
1097 | */ | 1097 | */ | ||
1098 | void Client::updateHiddenPreview() | 1098 | void Client::updateHiddenPreview() | ||
1099 | { | 1099 | { | ||
1100 | if (hiddenPreview()) { | 1100 | if (hiddenPreview()) { | ||
1101 | workspace()->forceRestacking(); | 1101 | workspace()->forceRestacking(); | ||
1102 | if (Xcb::Extensions::self()->isShapeInputAvailable()) { | 1102 | if (Xcb::Extensions::self()->isShapeInputAvailable()) { | ||
1103 | xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, | 1103 | xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, | ||
1104 | XCB_CLIP_ORDERING_UNSORTED, frameId(), 0, 0, 0, NULL); | 1104 | XCB_CLIP_ORDERING_UNSORTED, frameId(), 0, 0, 0, nullptr); | ||
1105 | } | 1105 | } | ||
1106 | } else { | 1106 | } else { | ||
1107 | workspace()->forceRestacking(); | 1107 | workspace()->forceRestacking(); | ||
1108 | updateInputShape(); | 1108 | updateInputShape(); | ||
1109 | } | 1109 | } | ||
1110 | } | 1110 | } | ||
1111 | 1111 | | |||
1112 | void Client::sendClientMessage(xcb_window_t w, xcb_atom_t a, xcb_atom_t protocol, uint32_t data1, uint32_t data2, uint32_t data3, xcb_timestamp_t timestamp) | 1112 | void Client::sendClientMessage(xcb_window_t w, xcb_atom_t a, xcb_atom_t protocol, uint32_t data1, uint32_t data2, uint32_t data3, xcb_timestamp_t timestamp) | ||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | |||||
1174 | * doesn't respond within a reasonable time, it will be killed. | 1174 | * doesn't respond within a reasonable time, it will be killed. | ||
1175 | */ | 1175 | */ | ||
1176 | void Client::pingWindow() | 1176 | void Client::pingWindow() | ||
1177 | { | 1177 | { | ||
1178 | if (!info->supportsProtocol(NET::PingProtocol)) | 1178 | if (!info->supportsProtocol(NET::PingProtocol)) | ||
1179 | return; // Can't ping :( | 1179 | return; // Can't ping :( | ||
1180 | if (options->killPingTimeout() == 0) | 1180 | if (options->killPingTimeout() == 0) | ||
1181 | return; // Turned off | 1181 | return; // Turned off | ||
1182 | if (ping_timer != NULL) | 1182 | if (ping_timer != nullptr) | ||
1183 | return; // Pinging already | 1183 | return; // Pinging already | ||
1184 | ping_timer = new QTimer(this); | 1184 | ping_timer = new QTimer(this); | ||
1185 | connect(ping_timer, &QTimer::timeout, this, | 1185 | connect(ping_timer, &QTimer::timeout, this, | ||
1186 | [this]() { | 1186 | [this]() { | ||
1187 | if (unresponsive()) { | 1187 | if (unresponsive()) { | ||
1188 | qCDebug(KWIN_CORE) << "Final ping timeout, asking to kill:" << caption(); | 1188 | qCDebug(KWIN_CORE) << "Final ping timeout, asking to kill:" << caption(); | ||
1189 | ping_timer->deleteLater(); | 1189 | ping_timer->deleteLater(); | ||
1190 | ping_timer = nullptr; | 1190 | ping_timer = nullptr; | ||
Show All 16 Lines | |||||
1207 | } | 1207 | } | ||
1208 | 1208 | | |||
1209 | void Client::gotPing(xcb_timestamp_t timestamp) | 1209 | void Client::gotPing(xcb_timestamp_t timestamp) | ||
1210 | { | 1210 | { | ||
1211 | // Just plain compare is not good enough because of 64bit and truncating and whatnot | 1211 | // Just plain compare is not good enough because of 64bit and truncating and whatnot | ||
1212 | if (NET::timestampCompare(timestamp, m_pingTimestamp) != 0) | 1212 | if (NET::timestampCompare(timestamp, m_pingTimestamp) != 0) | ||
1213 | return; | 1213 | return; | ||
1214 | delete ping_timer; | 1214 | delete ping_timer; | ||
1215 | ping_timer = NULL; | 1215 | ping_timer = nullptr; | ||
1216 | 1216 | | |||
1217 | setUnresponsive(false); | 1217 | setUnresponsive(false); | ||
1218 | 1218 | | |||
1219 | if (m_killHelperPID && !::kill(m_killHelperPID, 0)) { // means the process is alive | 1219 | if (m_killHelperPID && !::kill(m_killHelperPID, 0)) { // means the process is alive | ||
1220 | ::kill(m_killHelperPID, SIGTERM); | 1220 | ::kill(m_killHelperPID, SIGTERM); | ||
1221 | m_killHelperPID = 0; | 1221 | m_killHelperPID = 0; | ||
1222 | } | 1222 | } | ||
1223 | } | 1223 | } | ||
▲ Show 20 Lines • Show All 565 Lines • ▼ Show 20 Line(s) | 1788 | { | |||
1789 | return info->input(); | 1789 | return info->input(); | ||
1790 | } | 1790 | } | ||
1791 | 1791 | | |||
1792 | void Client::setBlockingCompositing(bool block) | 1792 | void Client::setBlockingCompositing(bool block) | ||
1793 | { | 1793 | { | ||
1794 | const bool usedToBlock = blocks_compositing; | 1794 | const bool usedToBlock = blocks_compositing; | ||
1795 | blocks_compositing = rules()->checkBlockCompositing(block && options->windowsBlockCompositing()); | 1795 | blocks_compositing = rules()->checkBlockCompositing(block && options->windowsBlockCompositing()); | ||
1796 | if (usedToBlock != blocks_compositing) { | 1796 | if (usedToBlock != blocks_compositing) { | ||
1797 | emit blockingCompositingChanged(blocks_compositing ? this : 0); | 1797 | emit blockingCompositingChanged(blocks_compositing ? this : nullptr); | ||
1798 | } | 1798 | } | ||
1799 | } | 1799 | } | ||
1800 | 1800 | | |||
1801 | void Client::updateAllowedActions(bool force) | 1801 | void Client::updateAllowedActions(bool force) | ||
1802 | { | 1802 | { | ||
1803 | if (!isManaged() && !force) | 1803 | if (!isManaged() && !force) | ||
1804 | return; | 1804 | return; | ||
1805 | NET::Actions old_allowed_actions = NET::Actions(allowed_actions); | 1805 | NET::Actions old_allowed_actions = NET::Actions(allowed_actions); | ||
1806 | allowed_actions = 0; | 1806 | allowed_actions = nullptr; | ||
romangg: This is not a pure nullptr change, is it? Just for your information. If you think it's fine… | |||||
I forgot to undo that change, thanks! I'll fix default initialization of QFlags<T> in another patch. zzag: I forgot to undo that change, thanks! I'll fix default initialization of QFlags<T> in another… | |||||
There were some more of that below but if you didn't see them before pushing not a big issue. romangg: There were some more of that below but if you didn't see them before pushing not a big issue. | |||||
zzag: I re-ran clang-tidy so it's not a big deal. | |||||
1807 | if (isMovable()) | 1807 | if (isMovable()) | ||
1808 | allowed_actions |= NET::ActionMove; | 1808 | allowed_actions |= NET::ActionMove; | ||
1809 | if (isResizable()) | 1809 | if (isResizable()) | ||
1810 | allowed_actions |= NET::ActionResize; | 1810 | allowed_actions |= NET::ActionResize; | ||
1811 | if (isMinimizable()) | 1811 | if (isMinimizable()) | ||
1812 | allowed_actions |= NET::ActionMinimize; | 1812 | allowed_actions |= NET::ActionMinimize; | ||
1813 | if (isShadeable()) | 1813 | if (isShadeable()) | ||
1814 | allowed_actions |= NET::ActionShade; | 1814 | allowed_actions |= NET::ActionShade; | ||
▲ Show 20 Lines • Show All 357 Lines • Show Last 20 Lines |
This is not a pure nullptr change, is it? Just for your information. If you think it's fine it's fine. See also https://doc.qt.io/qt-5/qflags.html#QFlags-2