Changeset 54058 in webkit


Ignore:
Timestamp:
Jan 29, 2010 6:00:29 AM (14 years ago)
Author:
eric@webkit.org
Message:

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):
Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r54054 r54058  
     12010-01-29  Andreas Kling  <andreas.kling@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Add support for Maemo zoom keys in QtLauncher
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=34160
     8
     9        * QtLauncher/main.cpp:
     10        (LauncherWindow::LauncherWindow):
     11        (LauncherWindow::~LauncherWindow):
     12        (LauncherWindow::keyPressEvent):
     13        (LauncherWindow::grabZoomKeys):
     14
    1152010-01-29  Benjamin Poulain  <benjamin.poulain@nokia.com>
    216
  • trunk/WebKitTools/QtLauncher/main.cpp

    r53952 r54058  
    5050#include <qwebinspector.h>
    5151#include <qwebsettings.h>
     52
     53#ifdef Q_WS_MAEMO_5
     54#include <qx11info_x11.h>
     55#endif
     56
    5257#include "urlloader.h"
    5358#include "utils.h"
     
    5661#include "webview.h"
    5762
     63#ifdef Q_WS_MAEMO_5
     64#include <X11/Xatom.h>
     65#include <X11/Xlib.h>
     66#undef KeyPress
     67#endif
     68
    5869#ifndef NDEBUG
    5970void QWEBKIT_EXPORT qt_drt_garbageCollector_collect();
     
    96107        zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;
    97108
     109        grabZoomKeys(true);
     110
    98111        load(url);
     112    }
     113
     114    ~LauncherWindow()
     115    {
     116        grabZoomKeys(false);
     117    }
     118
     119    void keyPressEvent(QKeyEvent* event)
     120    {
     121#ifdef Q_WS_MAEMO_5
     122        switch (event->key()) {
     123        case Qt::Key_F7:
     124            zoomIn();
     125            event->accept();
     126            break;
     127        case Qt::Key_F8:
     128            zoomOut();
     129            event->accept();
     130            break;
     131        }
     132#endif
     133        MainWindow::keyPressEvent(event);
     134    }
     135
     136    void grabZoomKeys(bool grab)
     137    {
     138#ifdef Q_WS_MAEMO_5
     139        if (!winId()) {
     140            qWarning("Can't grab keys unless we have a window id");
     141            return;
     142        }
     143
     144        Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False);
     145        if (!atom) {
     146            qWarning("Unable to obtain _HILDON_ZOOM_KEY_ATOM");
     147            return;
     148        }
     149
     150        unsigned long val = (grab) ? 1 : 0;
     151        XChangeProperty(QX11Info::display(), winId(), atom, XA_INTEGER, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&val), 1);
     152#endif
    99153    }
    100154
Note: See TracChangeset for help on using the changeset viewer.