Changeset View
Changeset View
Standalone View
Standalone View
client.cpp
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 97 | Client::Client() | |||
---|---|---|---|---|---|
101 | , m_frame() | 101 | , m_frame() | ||
102 | , m_activityUpdatesBlocked(false) | 102 | , m_activityUpdatesBlocked(false) | ||
103 | , m_blockedActivityUpdatesRequireTransients(false) | 103 | , m_blockedActivityUpdatesRequireTransients(false) | ||
104 | , m_moveResizeGrabWindow() | 104 | , m_moveResizeGrabWindow() | ||
105 | , move_resize_has_keyboard_grab(false) | 105 | , move_resize_has_keyboard_grab(false) | ||
106 | , m_managed(false) | 106 | , m_managed(false) | ||
107 | , m_transientForId(XCB_WINDOW_NONE) | 107 | , m_transientForId(XCB_WINDOW_NONE) | ||
108 | , m_originalTransientForId(XCB_WINDOW_NONE) | 108 | , m_originalTransientForId(XCB_WINDOW_NONE) | ||
109 | , shade_below(NULL) | 109 | , shade_below(nullptr) | ||
110 | , m_motif(atoms->motif_wm_hints) | 110 | , m_motif(atoms->motif_wm_hints) | ||
111 | , blocks_compositing(false) | 111 | , blocks_compositing(false) | ||
112 | , shadeHoverTimer(NULL) | 112 | , shadeHoverTimer(nullptr) | ||
113 | , m_colormap(XCB_COLORMAP_NONE) | 113 | , m_colormap(XCB_COLORMAP_NONE) | ||
114 | , in_group(NULL) | 114 | , in_group(nullptr) | ||
115 | , ping_timer(NULL) | 115 | , ping_timer(nullptr) | ||
116 | , m_killHelperPID(0) | 116 | , m_killHelperPID(0) | ||
117 | , m_pingTimestamp(XCB_TIME_CURRENT_TIME) | 117 | , m_pingTimestamp(XCB_TIME_CURRENT_TIME) | ||
118 | , m_userTime(XCB_TIME_CURRENT_TIME) // Not known yet | 118 | , m_userTime(XCB_TIME_CURRENT_TIME) // Not known yet | ||
119 | , allowed_actions(0) | 119 | , allowed_actions(nullptr) | ||
120 | , shade_geometry_change(false) | 120 | , shade_geometry_change(false) | ||
121 | , sm_stacking_order(-1) | 121 | , sm_stacking_order(-1) | ||
122 | , activitiesDefined(false) | 122 | , activitiesDefined(false) | ||
123 | , sessionActivityOverride(false) | 123 | , sessionActivityOverride(false) | ||
124 | , needsXWindowMove(false) | 124 | , needsXWindowMove(false) | ||
125 | , m_decoInputExtent() | 125 | , m_decoInputExtent() | ||
126 | , m_focusOutTimer(nullptr) | 126 | , m_focusOutTimer(nullptr) | ||
127 | , m_clientSideDecorated(false) | 127 | , m_clientSideDecorated(false) | ||
128 | { | 128 | { | ||
129 | // TODO: Do all as initialization | 129 | // TODO: Do all as initialization | ||
130 | syncRequest.counter = syncRequest.alarm = XCB_NONE; | 130 | syncRequest.counter = syncRequest.alarm = XCB_NONE; | ||
131 | syncRequest.timeout = syncRequest.failsafeTimeout = NULL; | 131 | syncRequest.timeout = syncRequest.failsafeTimeout = nullptr; | ||
132 | syncRequest.lastTimestamp = xTime(); | 132 | syncRequest.lastTimestamp = xTime(); | ||
133 | syncRequest.isPending = false; | 133 | syncRequest.isPending = false; | ||
134 | 134 | | |||
135 | // Set the initial mapping state | 135 | // Set the initial mapping state | ||
136 | mapping_state = Withdrawn; | 136 | mapping_state = Withdrawn; | ||
137 | 137 | | |||
138 | info = NULL; | 138 | info = nullptr; | ||
139 | 139 | | |||
140 | shade_mode = ShadeNone; | 140 | shade_mode = ShadeNone; | ||
141 | deleting = false; | 141 | deleting = false; | ||
142 | m_fullscreenMode = FullScreenNone; | 142 | m_fullscreenMode = FullScreenNone; | ||
143 | hidden = false; | 143 | hidden = false; | ||
144 | noborder = false; | 144 | noborder = false; | ||
145 | app_noborder = false; | 145 | app_noborder = false; | ||
146 | ignore_focus_stealing = false; | 146 | ignore_focus_stealing = false; | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 207 | { | |||
209 | deleting = true; | 209 | deleting = true; | ||
210 | #ifdef KWIN_BUILD_TABBOX | 210 | #ifdef KWIN_BUILD_TABBOX | ||
211 | TabBox::TabBox *tabBox = TabBox::TabBox::self(); | 211 | TabBox::TabBox *tabBox = TabBox::TabBox::self(); | ||
212 | if (tabBox && tabBox->isDisplayed() && tabBox->currentClient() == this) { | 212 | if (tabBox && tabBox->isDisplayed() && tabBox->currentClient() == this) { | ||
213 | tabBox->nextPrev(true); | 213 | tabBox->nextPrev(true); | ||
214 | } | 214 | } | ||
215 | #endif | 215 | #endif | ||
216 | destroyWindowManagementInterface(); | 216 | destroyWindowManagementInterface(); | ||
217 | Deleted* del = NULL; | 217 | Deleted* del = nullptr; | ||
218 | if (!on_shutdown) { | 218 | if (!on_shutdown) { | ||
219 | del = Deleted::create(this); | 219 | del = Deleted::create(this); | ||
220 | } | 220 | } | ||
221 | if (isMoveResize()) | 221 | if (isMoveResize()) | ||
222 | emit clientFinishUserMovedResized(this); | 222 | emit clientFinishUserMovedResized(this); | ||
223 | emit windowClosed(this, del); | 223 | emit windowClosed(this, del); | ||
224 | finishCompositing(); | 224 | finishCompositing(); | ||
225 | RuleBook::self()->discardUsed(this, true); // Remove ForceTemporarily rules | 225 | RuleBook::self()->discardUsed(this, true); // Remove ForceTemporarily rules | ||
▲ Show 20 Lines • Show All 625 Lines • ▼ Show 20 Line(s) | 846 | } else { | |||
851 | shade_geometry_change = false; | 851 | shade_geometry_change = false; | ||
852 | plainResize(s); | 852 | plainResize(s); | ||
853 | geom_restore = geometry(); | 853 | geom_restore = geometry(); | ||
854 | if ((shade_mode == ShadeHover || shade_mode == ShadeActivated) && rules()->checkAcceptFocus(info->input())) | 854 | if ((shade_mode == ShadeHover || shade_mode == ShadeActivated) && rules()->checkAcceptFocus(info->input())) | ||
855 | setActive(true); | 855 | setActive(true); | ||
856 | if (shade_mode == ShadeHover) { | 856 | if (shade_mode == ShadeHover) { | ||
857 | ToplevelList order = workspace()->stackingOrder(); | 857 | ToplevelList order = workspace()->stackingOrder(); | ||
858 | // invalidate, since "this" could be the topmost toplevel and shade_below dangeling | 858 | // invalidate, since "this" could be the topmost toplevel and shade_below dangeling | ||
859 | shade_below = NULL; | 859 | shade_below = nullptr; | ||
860 | // this is likely related to the index parameter?! | 860 | // this is likely related to the index parameter?! | ||
861 | for (int idx = order.indexOf(this) + 1; idx < order.count(); ++idx) { | 861 | for (int idx = order.indexOf(this) + 1; idx < order.count(); ++idx) { | ||
862 | shade_below = qobject_cast<Client*>(order.at(idx)); | 862 | shade_below = qobject_cast<Client*>(order.at(idx)); | ||
863 | if (shade_below) { | 863 | if (shade_below) { | ||
864 | break; | 864 | break; | ||
865 | } | 865 | } | ||
866 | } | 866 | } | ||
867 | if (shade_below && shade_below->isNormalWindow()) | 867 | if (shade_below && shade_below->isNormalWindow()) | ||
868 | workspace()->raiseClient(this); | 868 | workspace()->raiseClient(this); | ||
869 | else | 869 | else | ||
870 | shade_below = NULL; | 870 | shade_below = nullptr; | ||
871 | } | 871 | } | ||
872 | m_wrapper.map(); | 872 | m_wrapper.map(); | ||
873 | m_client.map(); | 873 | m_client.map(); | ||
874 | exportMappingState(XCB_ICCCM_WM_STATE_NORMAL); | 874 | exportMappingState(XCB_ICCCM_WM_STATE_NORMAL); | ||
875 | if (isActive()) | 875 | if (isActive()) | ||
876 | workspace()->requestFocus(this); | 876 | workspace()->requestFocus(this); | ||
877 | } | 877 | } | ||
878 | info->setState(isShade() ? NET::Shaded : NET::States(), NET::Shaded); | 878 | info->setState(isShade() ? NET::Shaded : NET::States(), NET::Shaded); | ||
Show All 16 Lines | |||||
895 | { | 895 | { | ||
896 | setShade(ShadeNormal); | 896 | setShade(ShadeNormal); | ||
897 | cancelShadeHoverTimer(); | 897 | cancelShadeHoverTimer(); | ||
898 | } | 898 | } | ||
899 | 899 | | |||
900 | void Client::cancelShadeHoverTimer() | 900 | void Client::cancelShadeHoverTimer() | ||
901 | { | 901 | { | ||
902 | delete shadeHoverTimer; | 902 | delete shadeHoverTimer; | ||
903 | shadeHoverTimer = 0; | 903 | shadeHoverTimer = nullptr; | ||
904 | } | 904 | } | ||
905 | 905 | | |||
906 | void Client::toggleShade() | 906 | void Client::toggleShade() | ||
907 | { | 907 | { | ||
908 | // If the mode is ShadeHover or ShadeActive, cancel shade too | 908 | // If the mode is ShadeHover or ShadeActive, cancel shade too | ||
909 | setShade(shade_mode == ShadeNone ? ShadeNormal : ShadeNone); | 909 | setShade(shade_mode == ShadeNone ? ShadeNormal : ShadeNone); | ||
910 | } | 910 | } | ||
911 | 911 | | |||
▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Line(s) | |||||
1072 | * of the actual preview. | 1072 | * of the actual preview. | ||
1073 | */ | 1073 | */ | ||
1074 | void Client::updateHiddenPreview() | 1074 | void Client::updateHiddenPreview() | ||
1075 | { | 1075 | { | ||
1076 | if (hiddenPreview()) { | 1076 | if (hiddenPreview()) { | ||
1077 | workspace()->forceRestacking(); | 1077 | workspace()->forceRestacking(); | ||
1078 | if (Xcb::Extensions::self()->isShapeInputAvailable()) { | 1078 | if (Xcb::Extensions::self()->isShapeInputAvailable()) { | ||
1079 | xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, | 1079 | xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, | ||
1080 | XCB_CLIP_ORDERING_UNSORTED, frameId(), 0, 0, 0, NULL); | 1080 | XCB_CLIP_ORDERING_UNSORTED, frameId(), 0, 0, 0, nullptr); | ||
1081 | } | 1081 | } | ||
1082 | } else { | 1082 | } else { | ||
1083 | workspace()->forceRestacking(); | 1083 | workspace()->forceRestacking(); | ||
1084 | updateInputShape(); | 1084 | updateInputShape(); | ||
1085 | } | 1085 | } | ||
1086 | } | 1086 | } | ||
1087 | 1087 | | |||
1088 | 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) | 1088 | 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) | |||||
1150 | * doesn't respond within a reasonable time, it will be killed. | 1150 | * doesn't respond within a reasonable time, it will be killed. | ||
1151 | */ | 1151 | */ | ||
1152 | void Client::pingWindow() | 1152 | void Client::pingWindow() | ||
1153 | { | 1153 | { | ||
1154 | if (!info->supportsProtocol(NET::PingProtocol)) | 1154 | if (!info->supportsProtocol(NET::PingProtocol)) | ||
1155 | return; // Can't ping :( | 1155 | return; // Can't ping :( | ||
1156 | if (options->killPingTimeout() == 0) | 1156 | if (options->killPingTimeout() == 0) | ||
1157 | return; // Turned off | 1157 | return; // Turned off | ||
1158 | if (ping_timer != NULL) | 1158 | if (ping_timer != nullptr) | ||
1159 | return; // Pinging already | 1159 | return; // Pinging already | ||
1160 | ping_timer = new QTimer(this); | 1160 | ping_timer = new QTimer(this); | ||
1161 | connect(ping_timer, &QTimer::timeout, this, | 1161 | connect(ping_timer, &QTimer::timeout, this, | ||
1162 | [this]() { | 1162 | [this]() { | ||
1163 | if (unresponsive()) { | 1163 | if (unresponsive()) { | ||
1164 | qCDebug(KWIN_CORE) << "Final ping timeout, asking to kill:" << caption(); | 1164 | qCDebug(KWIN_CORE) << "Final ping timeout, asking to kill:" << caption(); | ||
1165 | ping_timer->deleteLater(); | 1165 | ping_timer->deleteLater(); | ||
1166 | ping_timer = nullptr; | 1166 | ping_timer = nullptr; | ||
Show All 16 Lines | |||||
1183 | } | 1183 | } | ||
1184 | 1184 | | |||
1185 | void Client::gotPing(xcb_timestamp_t timestamp) | 1185 | void Client::gotPing(xcb_timestamp_t timestamp) | ||
1186 | { | 1186 | { | ||
1187 | // Just plain compare is not good enough because of 64bit and truncating and whatnot | 1187 | // Just plain compare is not good enough because of 64bit and truncating and whatnot | ||
1188 | if (NET::timestampCompare(timestamp, m_pingTimestamp) != 0) | 1188 | if (NET::timestampCompare(timestamp, m_pingTimestamp) != 0) | ||
1189 | return; | 1189 | return; | ||
1190 | delete ping_timer; | 1190 | delete ping_timer; | ||
1191 | ping_timer = NULL; | 1191 | ping_timer = nullptr; | ||
1192 | 1192 | | |||
1193 | setUnresponsive(false); | 1193 | setUnresponsive(false); | ||
1194 | 1194 | | |||
1195 | if (m_killHelperPID && !::kill(m_killHelperPID, 0)) { // means the process is alive | 1195 | if (m_killHelperPID && !::kill(m_killHelperPID, 0)) { // means the process is alive | ||
1196 | ::kill(m_killHelperPID, SIGTERM); | 1196 | ::kill(m_killHelperPID, SIGTERM); | ||
1197 | m_killHelperPID = 0; | 1197 | m_killHelperPID = 0; | ||
1198 | } | 1198 | } | ||
1199 | } | 1199 | } | ||
▲ Show 20 Lines • Show All 554 Lines • ▼ Show 20 Line(s) | 1753 | { | |||
1754 | return info->input(); | 1754 | return info->input(); | ||
1755 | } | 1755 | } | ||
1756 | 1756 | | |||
1757 | void Client::setBlockingCompositing(bool block) | 1757 | void Client::setBlockingCompositing(bool block) | ||
1758 | { | 1758 | { | ||
1759 | const bool usedToBlock = blocks_compositing; | 1759 | const bool usedToBlock = blocks_compositing; | ||
1760 | blocks_compositing = rules()->checkBlockCompositing(block && options->windowsBlockCompositing()); | 1760 | blocks_compositing = rules()->checkBlockCompositing(block && options->windowsBlockCompositing()); | ||
1761 | if (usedToBlock != blocks_compositing) { | 1761 | if (usedToBlock != blocks_compositing) { | ||
1762 | emit blockingCompositingChanged(blocks_compositing ? this : 0); | 1762 | emit blockingCompositingChanged(blocks_compositing ? this : nullptr); | ||
1763 | } | 1763 | } | ||
1764 | } | 1764 | } | ||
1765 | 1765 | | |||
1766 | void Client::updateAllowedActions(bool force) | 1766 | void Client::updateAllowedActions(bool force) | ||
1767 | { | 1767 | { | ||
1768 | if (!isManaged() && !force) | 1768 | if (!isManaged() && !force) | ||
1769 | return; | 1769 | return; | ||
1770 | NET::Actions old_allowed_actions = NET::Actions(allowed_actions); | 1770 | NET::Actions old_allowed_actions = NET::Actions(allowed_actions); | ||
1771 | allowed_actions = 0; | 1771 | 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. | |||||
1772 | if (isMovable()) | 1772 | if (isMovable()) | ||
1773 | allowed_actions |= NET::ActionMove; | 1773 | allowed_actions |= NET::ActionMove; | ||
1774 | if (isResizable()) | 1774 | if (isResizable()) | ||
1775 | allowed_actions |= NET::ActionResize; | 1775 | allowed_actions |= NET::ActionResize; | ||
1776 | if (isMinimizable()) | 1776 | if (isMinimizable()) | ||
1777 | allowed_actions |= NET::ActionMinimize; | 1777 | allowed_actions |= NET::ActionMinimize; | ||
1778 | if (isShadeable()) | 1778 | if (isShadeable()) | ||
1779 | allowed_actions |= NET::ActionShade; | 1779 | allowed_actions |= NET::ActionShade; | ||
▲ Show 20 Lines • Show All 350 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