• R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

Common Source Code Project for Qt (a.k.a for FM-7).


Commit MetaInfo

Revision0659adcb9145ed4f632ce15610e16538d9610e6a (tree)
Time2018-07-02 15:27:03
AuthorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Log Message

[Qt][MOUSE] Fix returning wrong point when rotating screen.

Change Summary

Incremental Difference

--- a/source/src/qt/common/emu_thread.cpp
+++ b/source/src/qt/common/emu_thread.cpp
@@ -81,7 +81,7 @@ void EmuThreadClass::moved_mouse(int x, int y)
8181 {
8282 mouse_x = x;
8383 mouse_y = y;
84-
84+ //printf("Moved Mouse %d, %d\n", x, y);
8585 #if defined(USE_MOUSE)
8686 bool flag = p_emu->get_osd()->is_mouse_enabled();
8787 if(!flag) return;
--- a/source/src/qt/gui/qt_glevents.cpp
+++ b/source/src/qt/gui/qt_glevents.cpp
@@ -50,21 +50,32 @@ void GLDrawClass::mouseMoveEvent(QMouseEvent *event)
5050 QPointF pos = event->localPos();
5151 double xpos = (double)(pos.x()) / (double)width();
5252 double ypos = (double)(pos.y()) / (double)height();
53- if(using_flags->is_use_one_board_computer() || using_flags->is_use_mouse()) {
53+ //printf("@@ %d %d\n", pos.x(), pos.y());
54+ if(using_flags->is_use_one_board_computer() || using_flags->is_use_mouse() || (using_flags->get_max_button() > 0)) {
5455 if(!enable_mouse) return;
5556 //if(QApplication::overrideCursor() == NULL) {
5657 //QApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
5758 //}
5859 switch(p_config->rotate_type) {
5960 case 0:
60- case 2:
6161 xx = xpos * (double)d_ww;
6262 yy = ypos * (double)d_hh;
6363 break;
64- case 1:
65- case 3:
66- xx = ypos * (double)d_hh;
67- yy = xpos * (double)d_ww;
64+ case 2:
65+ xx = (1.0 - xpos) * (double)d_ww;
66+ yy = (1.0 - ypos) * (double)d_hh;
67+ break;
68+ case 1:
69+ xx = ypos * (double)d_ww;
70+ yy = (1.0 - xpos) * (double)d_hh;
71+ break;
72+ case 3:
73+ xx = (1.0 - ypos) * (double)d_ww;
74+ yy = xpos * (double)d_hh;
75+ break;
76+ default:
77+ xx = xpos * (double)d_ww;
78+ yy = ypos * (double)d_hh;
6879 break;
6980 }
7081 } else {
@@ -72,14 +83,14 @@ void GLDrawClass::mouseMoveEvent(QMouseEvent *event)
7283 yy = ypos * (double)d_hh;
7384 }
7485
75- //printf("Mouse Move: (%f,%f) -> (%d, %d)\n", xpos, ypos, (int)xx, (int)yy);
86+ //csp_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_GENERAL, "Mouse Move: (%f,%f) -> (%d, %d)\n", xpos, ypos, (int)xx, (int)yy);
7687 emit do_notify_move_mouse((int)xx, (int)yy);
7788
7889 }
7990 // Will fix. zap of emu-> or ??
8091 void GLDrawClass::mousePressEvent(QMouseEvent *event)
8192 {
82- if(using_flags->is_use_one_board_computer() || using_flags->is_use_mouse()) {
93+ if(using_flags->is_use_one_board_computer() || using_flags->is_use_mouse() || (using_flags->get_max_button() > 0)) {
8394 if(event->button() == Qt::MiddleButton) {
8495 emit sig_check_grab_mouse(true);
8596 return;
@@ -92,7 +103,7 @@ void GLDrawClass::mousePressEvent(QMouseEvent *event)
92103
93104 void GLDrawClass::mouseReleaseEvent(QMouseEvent *event)
94105 {
95- if(using_flags->is_use_one_board_computer() || using_flags->is_use_mouse()) {
106+ if(using_flags->is_use_one_board_computer() || using_flags->is_use_mouse() || (using_flags->get_max_button() > 0)) {
96107 if(!enable_mouse) return;
97108 mouseMoveEvent(event); // Update pointer's location. 20180514
98109 emit do_notify_button_released(event->button());
Show on old repository browser