@@ -1308,65 +1308,82 @@ void LaunchyWidget::applySkin(const QString& name) {
1308
1308
InputDataList::setSeparator (m_inputBox->separatorText ());
1309
1309
}
1310
1310
1311
- void LaunchyWidget::mousePressEvent (QMouseEvent *event) {
1312
- if (event->buttons () == Qt::LeftButton) {
1313
- if (!g_settings->value (OPTION_DRAGMODE, OPTION_DRAGMODE_DEFAULT).toBool ()
1314
- || (event->modifiers () & Qt::ShiftModifier)) {
1315
- m_dragging = true ;
1316
- m_dragStartPoint = event->pos ();
1317
- }
1311
+ void LaunchyWidget::mousePressEvent (QMouseEvent* event) {
1312
+
1313
+ if (event->buttons () == Qt::LeftButton
1314
+ && (!g_settings->value (OPTION_DRAGMODE, OPTION_DRAGMODE_DEFAULT).toBool ()
1315
+ || (event->modifiers () & Qt::ShiftModifier))) {
1316
+
1317
+ m_dragging = true ;
1318
+ m_dragStartPos = event->pos ();
1319
+ m_dragStartGlobalPos = event->globalPos ();
1320
+
1321
+ qDebug () << " LaunchyWidget::mousePressEvent, drag begin, global pos:"
1322
+ << m_dragStartGlobalPos << " pos:" << m_dragStartPos;
1318
1323
}
1324
+
1319
1325
hideAlternativeList ();
1320
1326
activateWindow ();
1321
1327
m_inputBox->setFocus ();
1322
1328
}
1323
1329
1324
1330
void LaunchyWidget::mouseMoveEvent (QMouseEvent* event) {
1325
- if (event->buttons () == Qt::LeftButton
1326
- && m_dragging) {
1331
+ if (m_dragging && event->buttons () == Qt::LeftButton) {
1327
1332
1328
1333
hideAlternativeList ();
1329
1334
1330
1335
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
1331
- QPoint pt = event->globalPos () - m_dragStartPoint ;
1336
+ QPoint pt = event->globalPos () - m_dragStartPos ;
1332
1337
#else
1333
- QPoint pt = event->globalPosition ().toPoint () - m_dragStartPoint ;
1338
+ QPoint pt = event->globalPosition ().toPoint () - m_dragStartPos ;
1334
1339
#endif
1335
1340
1336
1341
move (pt);
1337
1342
1338
- // qDebug() << "LaunchyWidget::mouseMoveEvent, pos:" << pt;
1339
-
1340
1343
m_inputBox->setFocus ();
1341
1344
}
1342
1345
}
1343
1346
1344
1347
void LaunchyWidget::mouseReleaseEvent (QMouseEvent* event) {
1348
+ if (m_dragging == false ) {
1349
+ return ;
1350
+ }
1345
1351
1346
1352
m_dragging = false ;
1347
1353
1348
- hideAlternativeList ();
1349
- m_inputBox->setFocus ();
1350
-
1351
- int screenIndex = g_settings->value (OPTION_SCREEN_INDEX, OPTION_SCREEN_INDEX_DEFAULT).toInt ();
1352
-
1353
1354
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
1354
1355
QPoint pt = event->globalPos ();
1355
1356
#else
1356
1357
QPoint pt = event->globalPosition ().toPoint ();
1357
1358
#endif
1358
1359
1360
+ qDebug () << " LaunchyWidget::mouseReleaseEvent, drag end, global pos:" << pt;
1361
+
1362
+ hideAlternativeList ();
1363
+ m_inputBox->setFocus ();
1364
+
1365
+ int prevScreenIndex = -1 ;
1366
+ int currScreenIndex = -1 ;
1367
+
1359
1368
QList<QScreen*> listScreens = qApp->screens ();
1360
1369
for (int i = 0 ; i < listScreens.size (); ++i) {
1361
- QScreen* pScreen = listScreens.at (i);
1370
+ QScreen* screen = listScreens.at (i);
1362
1371
1363
- if (pScreen->geometry ().contains (pt)) {
1364
- // skip when cursor screen is enabled
1365
- if (screenIndex != -1 ) {
1366
- g_settings->setValue (OPTION_SCREEN_INDEX, i);
1367
- }
1372
+ qDebug () << " LaunchyWidget::mouseReleaseEvent, screen:" << i
1373
+ << " geometry:" << screen->geometry ();
1374
+
1375
+ if (prevScreenIndex == -1 && screen->geometry ().contains (m_dragStartGlobalPos)) {
1376
+ prevScreenIndex = i;
1377
+ }
1368
1378
1369
- if (screenIndex != i) {
1379
+ if (currScreenIndex == -1 && screen->geometry ().contains (pt)) {
1380
+ currScreenIndex = i;
1381
+ }
1382
+
1383
+ if (prevScreenIndex >= 0 && currScreenIndex >= 0 ) {
1384
+ qDebug () << " LaunchyWidget::mouseReleaseEvent, prev screen:" << prevScreenIndex
1385
+ << " curr screen:" << currScreenIndex;
1386
+ if (prevScreenIndex != currScreenIndex) {
1370
1387
reloadSkin ();
1371
1388
}
1372
1389
break ;
@@ -1375,6 +1392,9 @@ void LaunchyWidget::mouseReleaseEvent(QMouseEvent* event) {
1375
1392
}
1376
1393
1377
1394
void LaunchyWidget::contextMenuEvent (QContextMenuEvent* event) {
1395
+ qDebug () << " LaunchyWidget::contextMenuEvent, global pos:"
1396
+ << event->globalPos () << " pos:" << event->pos ();
1397
+
1378
1398
QMenu menu (this );
1379
1399
menu.addAction (m_actRebuild);
1380
1400
menu.addAction (m_actReloadSkin);
0 commit comments