Merge remote-tracking branch 'origin/5.5' into dev

Conflicts:
	src/compositor/wayland_wrapper/qwloutput.cpp

Change-Id: I05f7431aca46760f90632dfa7ef9c4d0abf392ec
This commit is contained in:
Liang Qi 2015-06-03 11:02:30 +02:00
commit b18f9ef9b3
8 changed files with 57 additions and 10 deletions

View File

@ -8,6 +8,8 @@ MODULE_PLUGIN_TYPES = \
wayland-inputdevice-integration \
wayland-decoration-client
CONFIG += generated_privates
load(qt_module)
# We have a bunch of C code with casts, so we can't have this option

View File

@ -237,6 +237,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
mScreens.append(screen);
// We need to get the output events before creating surfaces
forceRoundTrip();
screen->init();
mWaylandIntegration->screenAdded(screen);
} else if (interface == QStringLiteral("wl_compositor")) {
mCompositorVersion = qMin((int)version, 3);
@ -369,6 +370,11 @@ bool QWaylandDisplay::supportsWindowDecoration() const
return integrationSupport;
}
QWaylandWindow *QWaylandDisplay::lastInputWindow() const
{
return mLastInputWindow.data();
}
void QWaylandDisplay::setLastInputDevice(QWaylandInputDevice *device, uint32_t serial, QWaylandWindow *win)
{
mLastInputDevice = device;

View File

@ -36,6 +36,7 @@
#include <QtCore/QObject>
#include <QtCore/QRect>
#include <QtCore/QPointer>
#include <QtCore/QWaitCondition>
@ -156,7 +157,7 @@ public:
uint32_t lastInputSerial() const { return mLastInputSerial; }
QWaylandInputDevice *lastInputDevice() const { return mLastInputDevice; }
QWaylandWindow *lastInputWindow() const { return mLastInputWindow; }
QWaylandWindow *lastInputWindow() const;
void setLastInputDevice(QWaylandInputDevice *device, uint32_t serial, QWaylandWindow *window);
public slots:
@ -200,7 +201,7 @@ private:
int mCompositorVersion;
uint32_t mLastInputSerial;
QWaylandInputDevice *mLastInputDevice;
QWaylandWindow *mLastInputWindow;
QPointer<QWaylandWindow> mLastInputWindow;
void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE;
void registry_global_remove(uint32_t id) Q_DECL_OVERRIDE;

View File

@ -118,6 +118,10 @@ QWaylandInputDevice::Keyboard::~Keyboard()
#ifndef QT_NO_WAYLAND_XKB
releaseKeyMap();
#endif
if (mFocus)
QWindowSystemInterface::handleWindowActivated(0);
if (mFocusCallback)
wl_callback_destroy(mFocusCallback);
if (mParent->mVersion >= 3)
wl_keyboard_release(object());
else
@ -295,17 +299,18 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const
Qt::KeyboardModifiers ret = Qt::NoModifier;
#ifndef QT_NO_WAYLAND_XKB
if (!mXkbState)
return ret;
xkb_state_component cstate = static_cast<xkb_state_component>(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED);
if (xkb_state_mod_name_is_active(mXkbState, "Shift", cstate))
if (xkb_state_mod_name_is_active(mXkbState, XKB_MOD_NAME_SHIFT, cstate))
ret |= Qt::ShiftModifier;
if (xkb_state_mod_name_is_active(mXkbState, "Control", cstate))
if (xkb_state_mod_name_is_active(mXkbState, XKB_MOD_NAME_CTRL, cstate))
ret |= Qt::ControlModifier;
if (xkb_state_mod_name_is_active(mXkbState, "Alt", cstate))
if (xkb_state_mod_name_is_active(mXkbState, XKB_MOD_NAME_ALT, cstate))
ret |= Qt::AltModifier;
if (xkb_state_mod_name_is_active(mXkbState, "Mod1", cstate))
ret |= Qt::AltModifier;
if (xkb_state_mod_name_is_active(mXkbState, "Mod4", cstate))
if (xkb_state_mod_name_is_active(mXkbState, XKB_MOD_NAME_LOGO, cstate))
ret |= Qt::MetaModifier;
#endif
@ -592,13 +597,30 @@ static const uint32_t KeyTbl[] = {
XKB_KEY_Mode_switch, Qt::Key_Mode_switch,
XKB_KEY_script_switch, Qt::Key_Mode_switch,
XKB_KEY_XF86Back, Qt::Key_Back,
XKB_KEY_XF86Forward, Qt::Key_Forward,
XKB_KEY_XF86AudioPlay, Qt::Key_MediaTogglePlayPause, //there isn't a PlayPause keysym, however just play keys are not common
XKB_KEY_XF86AudioPause, Qt::Key_MediaPause,
XKB_KEY_XF86AudioStop, Qt::Key_MediaStop,
XKB_KEY_XF86AudioPrev, Qt::Key_MediaPrevious,
XKB_KEY_XF86AudioNext, Qt::Key_MediaNext,
XKB_KEY_XF86AudioRewind, Qt::Key_MediaPrevious,
XKB_KEY_XF86AudioForward, Qt::Key_MediaNext,
XKB_KEY_XF86AudioRecord, Qt::Key_MediaRecord,
XKB_KEY_XF86AudioMute, Qt::Key_VolumeMute,
XKB_KEY_XF86AudioLowerVolume, Qt::Key_VolumeDown,
XKB_KEY_XF86AudioRaiseVolume, Qt::Key_VolumeUp,
XKB_KEY_XF86AudioRandomPlay, Qt::Key_AudioRandomPlay,
XKB_KEY_XF86AudioRepeat, Qt::Key_AudioRepeat,
XKB_KEY_XF86ZoomIn, Qt::Key_ZoomIn,
XKB_KEY_XF86ZoomOut, Qt::Key_ZoomOut,
XKB_KEY_XF86Eject, Qt::Key_Eject,
0, 0
};
@ -759,7 +781,6 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
}
const xkb_keysym_t sym = xkb_state_key_get_one_sym(mXkbState, code);
xkb_state_update_key(mXkbState, code, isDown ? XKB_KEY_DOWN : XKB_KEY_UP);
Qt::KeyboardModifiers modifiers = mParent->modifiers();

View File

@ -226,6 +226,13 @@ QVariant QWaylandIntegration::styleHint(StyleHint hint) const
if (hint == ShowIsFullScreen && mDisplay->windowManagerIntegration())
return mDisplay->windowManagerIntegration()->showIsFullScreen();
switch (hint) {
case QPlatformIntegration::FontSmoothingGamma:
return qreal(1.0);
default:
break;
}
return QPlatformIntegration::styleHint(hint);
}

View File

@ -58,7 +58,7 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin
, mFormat(QImage::Format_ARGB32_Premultiplied)
, mOutputName(QStringLiteral("Screen%1").arg(id))
, m_orientation(Qt::PrimaryOrientation)
, mWaylandCursor(new QWaylandCursor(this))
, mWaylandCursor(0)
{
}
@ -67,6 +67,11 @@ QWaylandScreen::~QWaylandScreen()
delete mWaylandCursor;
}
void QWaylandScreen::init()
{
mWaylandCursor = new QWaylandCursor(this);
}
QWaylandDisplay * QWaylandScreen::display() const
{
return mWaylandDisplay;

View File

@ -52,6 +52,7 @@ public:
QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id);
~QWaylandScreen();
void init();
QWaylandDisplay *display() const;
QRect geometry() const;

View File

@ -88,6 +88,7 @@ struct WaylandArgument {
struct WaylandEvent {
bool request;
QByteArray name;
QByteArray type;
QList<WaylandArgument> arguments;
};
@ -124,6 +125,7 @@ WaylandEvent readEvent(QXmlStreamReader &xml, bool request)
WaylandEvent event;
event.request = request;
event.name = byteArrayValue(xml, "name");
event.type = byteArrayValue(xml, "type");
while (xml.readNextStartElement()) {
if (xml.name() == "arg") {
WaylandArgument argument;
@ -998,6 +1000,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
}
}
printf(");\n");
if (e.type == "destructor")
printf(" m_%s = 0;\n", interfaceName);
printf(" }\n");
}