Commit f8ba9215 authored by eric@webkit.org's avatar eric@webkit.org

2010-01-29 Andreas Kling <andreas.kling@nokia.com>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] Add support for Maemo zoom keys in QtLauncher

        https://bugs.webkit.org/show_bug.cgi?id=34160

        * QtLauncher/main.cpp:
        (LauncherWindow::LauncherWindow):
        (LauncherWindow::~LauncherWindow):
        (LauncherWindow::keyPressEvent):
        (LauncherWindow::grabZoomKeys):

git-svn-id: svn://svn.chromium.org/blink/trunk@54058 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 09608666
2010-01-29 Andreas Kling <andreas.kling@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Add support for Maemo zoom keys in QtLauncher
https://bugs.webkit.org/show_bug.cgi?id=34160
* QtLauncher/main.cpp:
(LauncherWindow::LauncherWindow):
(LauncherWindow::~LauncherWindow):
(LauncherWindow::keyPressEvent):
(LauncherWindow::grabZoomKeys):
2010-01-29 Benjamin Poulain <benjamin.poulain@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
......
......@@ -49,12 +49,23 @@
#include <qwebframe.h>
#include <qwebinspector.h>
#include <qwebsettings.h>
#ifdef Q_WS_MAEMO_5
#include <qx11info_x11.h>
#endif
#include "urlloader.h"
#include "utils.h"
#include "webinspector.h"
#include "webpage.h"
#include "webview.h"
#ifdef Q_WS_MAEMO_5
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#undef KeyPress
#endif
#ifndef NDEBUG
void QWEBKIT_EXPORT qt_drt_garbageCollector_collect();
#endif
......@@ -95,9 +106,52 @@ public:
zoomLevels << 100;
zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;
grabZoomKeys(true);
load(url);
}
~LauncherWindow()
{
grabZoomKeys(false);
}
void keyPressEvent(QKeyEvent* event)
{
#ifdef Q_WS_MAEMO_5
switch (event->key()) {
case Qt::Key_F7:
zoomIn();
event->accept();
break;
case Qt::Key_F8:
zoomOut();
event->accept();
break;
}
#endif
MainWindow::keyPressEvent(event);
}
void grabZoomKeys(bool grab)
{
#ifdef Q_WS_MAEMO_5
if (!winId()) {
qWarning("Can't grab keys unless we have a window id");
return;
}
Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False);
if (!atom) {
qWarning("Unable to obtain _HILDON_ZOOM_KEY_ATOM");
return;
}
unsigned long val = (grab) ? 1 : 0;
XChangeProperty(QX11Info::display(), winId(), atom, XA_INTEGER, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&val), 1);
#endif
}
#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
void sendTouchEvent()
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment