From 1bb9f670bb2ccbf66d10b0d684998f4b1a15b8c9 Mon Sep 17 00:00:00 2001 From: GiWoong Kim Date: Mon, 16 Nov 2015 20:03:09 +0900 Subject: [PATCH] menu: open the popup menu without any focus On MacOS, right-click cannot bring up the popup menu without a window focus. This behavior is inconvenient to user. So, to improve this issue, I added raise() function call before the menu displaying. This call makes that emulator window can keep focusing and open the popup menu immediately. Change-Id: I342121e4e6922f9b7009776ee5391589b9a4e0c1 Signed-off-by: GiWoong Kim --- tizen/src/ui/mainwindow.cpp | 16 ++++++---------- tizen/src/ui/mainwindow.h | 3 ++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp index b3af2bbd0c..82b32fcdec 100644 --- a/tizen/src/ui/mainwindow.cpp +++ b/tizen/src/ui/mainwindow.cpp @@ -108,7 +108,7 @@ MainWindow::MainWindow(UiInformation *uiInfo, QWidget *parent) : setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), - SLOT(showContextMenu(const QPoint&))); + SLOT(slotContextMenu(const QPoint&))); } DisplayBase *MainWindow::createDisplay(DisplayType *displayForm) @@ -193,16 +193,12 @@ QLabel *MainWindow::getScreenWidget() return screenWidget; } -void MainWindow::showContextMenu(const QPoint& pos) +void MainWindow::slotContextMenu(const QPoint &pos) { - QAction* selectedItem = 0; - popupMenu->popup(mapToGlobal(pos), selectedItem); - if (selectedItem) { - //qDebug("%s", selectedItem->text().toLocal8Bit().data()); - } else { - qDebug("show context menu"); - /* do nothing */ - } + qDebug("show context menu"); + + raise(); + popupMenu->popup(mapToGlobal(pos)); } UiInformation *MainWindow::getUiInfo() diff --git a/tizen/src/ui/mainwindow.h b/tizen/src/ui/mainwindow.h index 0a8c99cc12..eac994a9b0 100644 --- a/tizen/src/ui/mainwindow.h +++ b/tizen/src/ui/mainwindow.h @@ -74,6 +74,7 @@ public: void unsetCaptureRequestHandler(void *data); void processCaptured(bool captured, void *pixels, int width, int height); void setTopMost(bool on); + DockingController *getDockingCon(); FloatingController *getFloatingCon(); void openController(int index, int dockPos); @@ -87,7 +88,7 @@ public: TransWidget *getTransWidget(); public slots: - void showContextMenu(const QPoint& pos); + void slotContextMenu(const QPoint &pos); protected: void showEvent(QShowEvent *event); -- 2.34.1