summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorminkee.lee <minkee.lee@samsung.com>2014-10-08 16:27:36 +0900
committerGiWoong Kim <giwoong.kim@samsung.com>2014-10-28 01:11:11 -0700
commit15da17e41b28a489abe57f12cd97a4b8d6b97539 (patch)
tree50cb7c07b24532d6675763ffd104ef3dce3099cf
parentc52c034f0336fdfa436dd094bef967fb87270db9 (diff)
downloadqemu-15da17e41b28a489abe57f12cd97a4b8d6b97539.tar.gz
qemu-15da17e41b28a489abe57f12cd97a4b8d6b97539.tar.bz2
qemu-15da17e41b28a489abe57f12cd97a4b8d6b97539.zip
Direct rendering: Added "always on top" in Ubuntu.
Change-Id: I3390a5f3c1bd0c3f142e9950d1a3bb2ad2e0050d Signed-off-by: minkee.lee <minkee.lee@samsung.com>
-rw-r--r--tizen/src/ui/menu/contextmenu.cpp58
1 files changed, 50 insertions, 8 deletions
diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp
index 2411f5431e..3907632336 100644
--- a/tizen/src/ui/menu/contextmenu.cpp
+++ b/tizen/src/ui/menu/contextmenu.cpp
@@ -33,6 +33,16 @@
#include "contextmenu.h"
#include "mainwindow.h"
+#ifdef CONFIG_WIN32
+#include "windows.h"
+
+#else
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
+#endif
+
+
ContextMenu::ContextMenu(QWidget *parent) :
QMenu(parent)
{
@@ -56,7 +66,7 @@ void ContextMenu::createItems() {
addSeparator();
-#if 0
+#ifndef CONFIG_WIN32
/* Always On Top menu */
action = addAction("&Always on Top");
action->setCheckable(true);
@@ -244,7 +254,10 @@ void ContextMenu::slotTopMost(bool on)
{
qDebug("stays on top : %s", on? "on" : "off");
- QWidget *win = ((QWidget *)this->parent());
+ QWidget *win = (QWidget *)this->parent();
+
+#ifdef CONFIG_WIN32
+ /*
if (on == true) {
win->setWindowFlags(win->windowFlags() | Qt::WindowStaysOnTopHint);
} else {
@@ -252,6 +265,35 @@ void ContextMenu::slotTopMost(bool on)
}
win->show();
+ */
+ HWND hWnd = (HWND)win->winId();
+ HWND hWndInsertAfter = ( (on == true) ? HWND_TOPMOST : HWND_NOTOPMOST);
+ SetWindowPos(hWnd, hWndInsertAfter, win->pos().x(), win->pos().y(), 0, 0, SWP_NOSIZE);
+ win->show();
+
+#else
+ Display* display = XOpenDisplay (NULL);
+ if (display == NULL) {
+ qDebug("Error: XOpenDisplay() Failed. Always on top failed.");
+ return;
+ }
+ XClientMessageEvent event;
+ memset(&event,0,sizeof(event));
+ event.type = ClientMessage;
+ event.window = win->winId();
+ event.message_type = XInternAtom (display, "_NET_WM_STATE", False);
+ event.format = 32;
+ event.data.l[0] = on ? 1 : 0; // 1:_NET_WM_STATE_ADD , 0:_NET_WM_STATE_REMOVE
+ event.data.l[1] = XInternAtom (display, "_NET_WM_STATE_ABOVE", False);
+ event.data.l[2] = 0; //unused.
+ event.data.l[3] = 0;
+ event.data.l[4] = 0;
+ XSendEvent (display, DefaultRootWindow(display), False, SubstructureRedirectMask|SubstructureNotifyMask, (XEvent*)&event);
+ XFlush(display);
+ XCloseDisplay(display);
+#endif
+
+
}
void ContextMenu::slotRotate(int angle)
@@ -285,7 +327,7 @@ void ContextMenu::slotShell()
qDebug() << msg;
QMessageBox *msgBox = new QMessageBox(QMessageBox::Information,
- "Emulator", msg, QMessageBox::Ok);
+ "Emulator", msg, QMessageBox::Ok, (QWidget*)this->parent());
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setModal(false);
msgBox->show();
@@ -310,7 +352,7 @@ void ContextMenu::slotShell()
qWarning() << msg;
QMessageBox *msgBox = new QMessageBox(QMessageBox::Warning,
- "Emulator", msg, QMessageBox::Ok);
+ "Emulator", msg, QMessageBox::Ok, (QWidget*)this->parent());
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setModal(false);
msgBox->show();
@@ -343,7 +385,7 @@ void ContextMenu::slotShell()
qDebug() << msg;
QMessageBox *msgBox = new QMessageBox(QMessageBox::Warning,
- "Emulator", msg, QMessageBox::Ok);
+ "Emulator", msg, QMessageBox::Ok ,(QWidget*)this->parent());
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setModal(false);
msgBox->show();
@@ -374,7 +416,7 @@ void ContextMenu::slotControlPanel()
qWarning() << msg;
QMessageBox *msgBox = new QMessageBox(QMessageBox::Warning,
- "Emulator", msg, QMessageBox::Ok);
+ "Emulator", msg, QMessageBox::Ok, (QWidget*)this->parent());
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setModal(false);
msgBox->show();
@@ -402,7 +444,7 @@ void ContextMenu::slotControlPanel()
qDebug() << msg;
QMessageBox *msgBox = new QMessageBox(QMessageBox::Warning,
- "Emulator", msg, QMessageBox::Ok);
+ "Emulator", msg, QMessageBox::Ok, (QWidget*)this->parent());
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setModal(false);
msgBox->show();
@@ -433,7 +475,7 @@ void ContextMenu::slotForceClose()
{
qDebug("force close");
- QMessageBox *msg = new QMessageBox();
+ QMessageBox *msg = new QMessageBox((QWidget*)this->parent());
msg->setAttribute(Qt::WA_DeleteOnClose);
msg->setWindowTitle("Emulator");
msg->setText("If you force stop an emulator, it may cause some problems.\n"