Improve updating user timestamp
Use the timestamp from the xcb event which triggers the update whenever possible. If we don't have access to the latest event, let's at least update our own xTime prior to using it. Slightly unrelated change included: Group switches the userTime from XLib datatype to xcb datatype. BUG: 335637 REVIEW: 118456icc-effect-5.14.5
parent
8543033d59
commit
7910fed659
|
@ -661,8 +661,10 @@ void Workspace::clientAttentionChanged(Client* c, bool set)
|
|||
void Client::updateUserTime(xcb_timestamp_t time)
|
||||
{
|
||||
// copied in Group::updateUserTime
|
||||
if (time == XCB_TIME_CURRENT_TIME)
|
||||
if (time == XCB_TIME_CURRENT_TIME) {
|
||||
updateXTime();
|
||||
time = xTime();
|
||||
}
|
||||
if (time != -1U
|
||||
&& (m_userTime == XCB_TIME_CURRENT_TIME
|
||||
|| NET::timestampCompare(time, m_userTime) > 0)) { // time > user_time
|
||||
|
@ -865,13 +867,15 @@ void Group::startupIdChanged()
|
|||
}
|
||||
}
|
||||
|
||||
void Group::updateUserTime(Time time)
|
||||
void Group::updateUserTime(xcb_timestamp_t time)
|
||||
{
|
||||
// copy of Client::updateUserTime
|
||||
if (time == CurrentTime)
|
||||
if (time == XCB_CURRENT_TIME) {
|
||||
updateXTime();
|
||||
time = xTime();
|
||||
}
|
||||
if (time != -1U
|
||||
&& (user_time == CurrentTime
|
||||
&& (user_time == XCB_CURRENT_TIME
|
||||
|| NET::timestampCompare(time, user_time) > 0)) // time > user_time
|
||||
user_time = time;
|
||||
}
|
||||
|
|
4
client.h
4
client.h
|
@ -496,7 +496,7 @@ public:
|
|||
|
||||
QString caption(bool full = true, bool stripped = false) const;
|
||||
|
||||
void keyPressEvent(uint key_code); // FRAME ??
|
||||
void keyPressEvent(uint key_code, xcb_timestamp_t time); // FRAME ??
|
||||
void updateMouseGrab();
|
||||
xcb_window_t moveResizeGrabWindow() const;
|
||||
|
||||
|
@ -701,7 +701,7 @@ private:
|
|||
void focusOutEvent(xcb_focus_out_event_t *e);
|
||||
virtual void damageNotifyEvent();
|
||||
|
||||
bool buttonPressEvent(xcb_window_t w, int button, int state, int x, int y, int x_root, int y_root);
|
||||
bool buttonPressEvent(xcb_window_t w, int button, int state, int x, int y, int x_root, int y_root, xcb_timestamp_t time = XCB_CURRENT_TIME);
|
||||
bool buttonReleaseEvent(xcb_window_t w, int button, int state, int x, int y, int x_root, int y_root);
|
||||
bool motionNotifyEvent(xcb_window_t w, int state, int x, int y, int x_root, int y_root);
|
||||
void checkQuickTilingMaximizationZones(int xroot, int yroot);
|
||||
|
|
19
events.cpp
19
events.cpp
|
@ -252,10 +252,11 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
|
|||
case XCB_KEY_PRESS: {
|
||||
was_user_interaction = true;
|
||||
int keyQt;
|
||||
KKeyServer::xcbKeyPressEventToQt(reinterpret_cast<xcb_key_press_event_t*>(e), &keyQt);
|
||||
xcb_key_press_event_t *event = reinterpret_cast<xcb_key_press_event_t*>(e);
|
||||
KKeyServer::xcbKeyPressEventToQt(event, &keyQt);
|
||||
// qDebug() << "Workspace::keyPress( " << keyQt << " )";
|
||||
if (movingClient) {
|
||||
movingClient->keyPressEvent(keyQt);
|
||||
movingClient->keyPressEvent(keyQt, event->time);
|
||||
return true;
|
||||
}
|
||||
#ifdef KWIN_BUILD_TABBOX
|
||||
|
@ -606,15 +607,15 @@ bool Client::windowEvent(xcb_generic_event_t *e)
|
|||
propertyNotifyEvent(reinterpret_cast<xcb_property_notify_event_t*>(e));
|
||||
break;
|
||||
case XCB_KEY_PRESS:
|
||||
updateUserTime();
|
||||
updateUserTime(reinterpret_cast<xcb_key_press_event_t*>(e)->time);
|
||||
workspace()->setWasUserInteraction();
|
||||
break;
|
||||
case XCB_BUTTON_PRESS: {
|
||||
const auto *event = reinterpret_cast<xcb_button_press_event_t*>(e);
|
||||
updateUserTime();
|
||||
updateUserTime(event->time);
|
||||
workspace()->setWasUserInteraction();
|
||||
buttonPressEvent(event->event, event->detail, event->state,
|
||||
event->event_x, event->event_y, event->root_x, event->root_y);
|
||||
event->event_x, event->event_y, event->root_x, event->root_y, event->time);
|
||||
break;
|
||||
}
|
||||
case XCB_KEY_RELEASE:
|
||||
|
@ -1086,7 +1087,7 @@ static bool modKeyDown(int state) {
|
|||
|
||||
|
||||
// return value matters only when filtering events before decoration gets them
|
||||
bool Client::buttonPressEvent(xcb_window_t w, int button, int state, int x, int y, int x_root, int y_root)
|
||||
bool Client::buttonPressEvent(xcb_window_t w, int button, int state, int x, int y, int x_root, int y_root, xcb_timestamp_t time)
|
||||
{
|
||||
if (buttonDown) {
|
||||
if (w == wrapperId())
|
||||
|
@ -1096,7 +1097,7 @@ bool Client::buttonPressEvent(xcb_window_t w, int button, int state, int x, int
|
|||
|
||||
if (w == wrapperId() || w == frameId() || w == decorationId() || w == inputId()) {
|
||||
// FRAME neco s tohohle by se melo zpracovat, nez to dostane dekorace
|
||||
updateUserTime();
|
||||
updateUserTime(time);
|
||||
workspace()->setWasUserInteraction();
|
||||
const bool bModKeyHeld = modKeyDown(state);
|
||||
|
||||
|
@ -1473,9 +1474,9 @@ void Client::NETMoveResize(int x_root, int y_root, NET::Direction direction)
|
|||
}
|
||||
}
|
||||
|
||||
void Client::keyPressEvent(uint key_code)
|
||||
void Client::keyPressEvent(uint key_code, xcb_timestamp_t time)
|
||||
{
|
||||
updateUserTime();
|
||||
updateUserTime(time);
|
||||
if (!isMove() && !isResize())
|
||||
return;
|
||||
bool is_control = key_code & Qt::CTRL;
|
||||
|
|
8
group.h
8
group.h
|
@ -47,8 +47,8 @@ public:
|
|||
void removeMember(Client* member);
|
||||
void gotLeader(Client* leader);
|
||||
void lostLeader();
|
||||
void updateUserTime(Time time = CurrentTime);
|
||||
Time userTime() const;
|
||||
void updateUserTime(xcb_timestamp_t time);
|
||||
xcb_timestamp_t userTime() const;
|
||||
void ref();
|
||||
void deref();
|
||||
EffectWindowGroupImpl* effectGroup();
|
||||
|
@ -58,7 +58,7 @@ private:
|
|||
Client* leader_client;
|
||||
Window leader_wid;
|
||||
NETWinInfo* leader_info;
|
||||
Time user_time;
|
||||
xcb_timestamp_t user_time;
|
||||
int refcount;
|
||||
EffectWindowGroupImpl* effect_group;
|
||||
};
|
||||
|
@ -83,7 +83,7 @@ inline const ClientList& Group::members() const
|
|||
return _members;
|
||||
}
|
||||
|
||||
inline Time Group::userTime() const
|
||||
inline xcb_timestamp_t Group::userTime() const
|
||||
{
|
||||
return user_time;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue