Skip to content

Commit a7c25bf

Browse files
committed
Fix hide on hover
1 parent 70c6167 commit a7c25bf

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

mouseEventThread.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ void MouseEventThread::processEvent(XRecordInterceptData *hook) {
6363
if (queryCursor(relX, relY, absX, absY)) {
6464
break;
6565
}
66-
emit mousePress(QPoint(relX * sensibility, relY * sensibility), QPoint(absX * sensibility, absY * sensibility));
66+
emit mousePress(QPoint(relX * sensibility, relY * sensibility), QPoint(relX, relY));
6767
}
6868
break;
6969
case ButtonRelease:
7070
if (buttonCode == 1) {
7171
if (queryCursor(relX, relY, absX, absY)) {
7272
break;
7373
}
74-
emit mouseRelease(QPoint(relX * sensibility, relY * sensibility), QPoint(absX * sensibility, absY * sensibility));
74+
emit mouseRelease(QPoint(relX * sensibility, relY * sensibility), QPoint(relX, relY));
7575
}
7676
break;
7777
case MotionNotify:
@@ -85,7 +85,7 @@ void MouseEventThread::processEvent(XRecordInterceptData *hook) {
8585
// qDebug() << "motion too small, ignoring...";
8686
// break;
8787
// }
88-
emit mouseEvent(QPoint(relX * sensibility, relY * sensibility), QPoint(absX * sensibility, absY * sensibility));
88+
emit mouseEvent(QPoint(relX * sensibility, relY * sensibility), QPoint(relX, relY));
8989
break;
9090
}
9191
XRecordFreeData (hook);

mouseEventThread.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ public slots:
6262
double sensibility;
6363
// int dx, dy, lastx, lasty = 0;
6464
signals:
65-
void mouseEvent(QPoint relPosition, QPoint absPosition);
66-
void mousePress(QPoint relPosition, QPoint absPosition);
67-
void mouseRelease(QPoint relPosition, QPoint absPosition);
65+
void mouseEvent(QPoint relPosition, QPoint rawPosition);
66+
void mousePress(QPoint relPosition, QPoint rawPosition);
67+
void mouseRelease(QPoint relPosition, QPoint rawPosition);
6868
};
6969

7070

widget.cpp

+6-12
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ void Widget::live2dInitialized(QLive2dWidget *wid) {
9696
wid->setModel(this->currentConfiguration.getModelName().toStdString());
9797
this->initialized = true;
9898
}
99-
void Widget::mouseEvent(QPoint rel, QPoint abs) {
99+
void Widget::mouseEvent(QPoint rel, QPoint raw) {
100100
//cout<<"rel: "<<rel.x()<<", "<<rel.y()<<endl;
101-
//cout<<"abs: "<<abs.x()<<", "<<abs.y()<<endl;
101+
//cout<<"abs: "<<raw.x()<<", "<<raw.y()<<endl;
102102
widget->mouseMove(rel);
103103
//widget->mouseMove(rel);
104104
if (this->currentConfiguration.isHideOnHover()) {
105-
if (widget->geometry().contains(rel) && widget->isVisible()) {
105+
if (widget->geometry().contains(raw) && widget->isVisible()) {
106106
widget->hide();
107107
}
108-
if (!widget->geometry().contains(rel) && !widget->isVisible()) {
108+
if (!widget->geometry().contains(raw) && !widget->isVisible()) {
109109
widget->show();
110110
}
111111
}
@@ -122,10 +122,7 @@ void Widget::setWidgetPosition(bool widgetOnLeft) {
122122
}
123123
}
124124

125-
void Widget::mousePress(QPoint rel, QPoint abs) {
126-
if (!this->widget->isVisible()) {
127-
return;
128-
}
125+
void Widget::mousePress(QPoint rel, QPoint raw) {
129126
if (this->widget->geometry().contains(rel)) {
130127
if (this->currentConfiguration.isHideOnHover()) {
131128
this->widget->mousePress(QPoint(rel.x(), this->height() - rel.y()));
@@ -136,10 +133,7 @@ void Widget::mousePress(QPoint rel, QPoint abs) {
136133
}
137134
}
138135

139-
void Widget::mouseRelease(QPoint rel, QPoint abs) {
140-
if (!this->widget->isVisible()) {
141-
return;
142-
}
136+
void Widget::mouseRelease(QPoint rel, QPoint raw) {
143137
if (this->widget->geometry().contains(rel)) {
144138
if (this->currentConfiguration.isHideOnHover()) {
145139
this->widget->mouseRelease(QPoint(rel.x(), this->height() - rel.y()));

0 commit comments

Comments
 (0)