Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Bug 1282866 - remove widget/qt and other supporting QT code, …
…r=dougt. This patch does not remove all of the checks for MOZ_WIDGET_QT (which are dead code), but that will be a followup mentored bug." This reverts commit bf05496. This does not revert back pango configuration as it seems to be already removed.
- Loading branch information
Showing
72 changed files
with
7,701 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- | ||
* vim: sw=4 ts=4 et : | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include <QtCore/QTimer> | ||
|
||
#include "NestedLoopTimer.h" | ||
#include "mozilla/plugins/PluginModuleChild.h" | ||
|
||
namespace mozilla { | ||
namespace plugins { | ||
|
||
NestedLoopTimer::NestedLoopTimer(PluginModuleChild *pmc): | ||
QObject(), mModule(pmc), mQTimer(nullptr) | ||
{ | ||
} | ||
|
||
NestedLoopTimer::~NestedLoopTimer() | ||
{ | ||
if (mQTimer) { | ||
mQTimer->stop(); | ||
delete mQTimer; | ||
mQTimer = nullptr; | ||
} | ||
} | ||
|
||
void NestedLoopTimer::timeOut() | ||
{ | ||
// just detected a nested loop; start a timer that will | ||
// periodically rpc-call back into the browser and process some | ||
// events | ||
mQTimer = new QTimer(this); | ||
QObject::connect(mQTimer, SIGNAL(timeout()), this, | ||
SLOT(processSomeEvents())); | ||
mQTimer->setInterval(kNestedLoopDetectorIntervalMs); | ||
mQTimer->start(); | ||
} | ||
|
||
void NestedLoopTimer::processSomeEvents() | ||
{ | ||
if (mModule) | ||
mModule->CallProcessSomeEvents(); | ||
} | ||
|
||
} /* namespace plugins */ | ||
} /* namespace mozilla */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- | ||
* vim: sw=4 ts=4 et : | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef NESTEDLOOPTIMER_H | ||
#define NESTEDLOOPTIMER_H | ||
|
||
#include <QtCore/QObject> | ||
|
||
class QTimer; | ||
|
||
namespace mozilla { | ||
namespace plugins { | ||
|
||
class PluginModuleChild; | ||
|
||
class NestedLoopTimer: public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
NestedLoopTimer(PluginModuleChild *pmc); | ||
|
||
virtual ~NestedLoopTimer(); | ||
|
||
public Q_SLOTS: | ||
virtual void timeOut(); | ||
virtual void processSomeEvents(); | ||
|
||
private: | ||
PluginModuleChild *mModule; | ||
QTimer *mQTimer; | ||
}; | ||
|
||
} /* namespace plugins */ | ||
} /* namespace mozilla */ | ||
|
||
#undef slots | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*- | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "PluginHelperQt.h" | ||
#include <QtCore/QCoreApplication> | ||
#include <QtCore/QEventLoop> | ||
|
||
static const int kMaxtimeToProcessEvents = 30; | ||
|
||
bool | ||
PluginHelperQt::AnswerProcessSomeEvents() | ||
{ | ||
QCoreApplication::processEvents(QEventLoop::AllEvents, kMaxtimeToProcessEvents); | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* ***** BEGIN LICENSE BLOCK ***** | ||
* | ||
* Copyright (c) 2008, Mozilla Corporation | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* * Neither the name of the Mozilla Corporation nor the names of its | ||
* contributors may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* Contributor(s): | ||
* Josh Aas <josh@mozilla.com> | ||
* | ||
* ***** END LICENSE BLOCK ***** */ | ||
#include "nptest_platform.h" | ||
#include "npapi.h" | ||
|
||
using namespace std; | ||
|
||
bool | ||
pluginSupportsWindowMode() | ||
{ | ||
return false; | ||
} | ||
|
||
bool | ||
pluginSupportsWindowlessMode() | ||
{ | ||
return true; | ||
} | ||
|
||
NPError | ||
pluginInstanceInit(InstanceData* instanceData) | ||
{ | ||
printf("NPERR_INCOMPATIBLE_VERSION_ERROR\n"); | ||
return NPERR_INCOMPATIBLE_VERSION_ERROR; | ||
} | ||
|
||
void | ||
pluginInstanceShutdown(InstanceData* instanceData) | ||
{ | ||
NPN_MemFree(instanceData->platformData); | ||
instanceData->platformData = 0; | ||
} | ||
|
||
void | ||
pluginDoSetWindow(InstanceData* instanceData, NPWindow* newWindow) | ||
{ | ||
instanceData->window = *newWindow; | ||
} | ||
|
||
void | ||
pluginWidgetInit(InstanceData* instanceData, void* oldWindow) | ||
{ | ||
// XXX nothing here yet since we don't support windowed plugins | ||
} | ||
|
||
int16_t | ||
pluginHandleEvent(InstanceData* instanceData, void* event) | ||
{ | ||
return 0; | ||
} | ||
|
||
int32_t pluginGetEdge(InstanceData* instanceData, RectEdge edge) | ||
{ | ||
// XXX nothing here yet since we don't support windowed plugins | ||
return NPTEST_INT32_ERROR; | ||
} | ||
|
||
int32_t pluginGetClipRegionRectCount(InstanceData* instanceData) | ||
{ | ||
// XXX nothing here yet since we don't support windowed plugins | ||
return NPTEST_INT32_ERROR; | ||
} | ||
|
||
int32_t pluginGetClipRegionRectEdge(InstanceData* instanceData, | ||
int32_t rectIndex, RectEdge edge) | ||
{ | ||
// XXX nothing here yet since we don't support windowed plugins | ||
return NPTEST_INT32_ERROR; | ||
} | ||
|
||
void pluginDoInternalConsistencyCheck(InstanceData* instanceData, string& error) | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "QTMLocationProvider.h" | ||
#include "nsGeoPosition.h" | ||
|
||
using namespace mozilla; | ||
|
||
NS_IMPL_ISUPPORTS(QTMLocationProvider, nsIGeolocationProvider) | ||
|
||
QTMLocationProvider::QTMLocationProvider() | ||
{ | ||
if (QMetaType::type("QGeoPositionInfo") == QMetaType::UnknownType) { | ||
qRegisterMetaType<QGeoPositionInfo>("QGeoPositionInfo"); | ||
} | ||
mLocation = QGeoPositionInfoSource::createDefaultSource(this); | ||
if (mLocation) | ||
connect(mLocation, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo))); | ||
} | ||
|
||
QTMLocationProvider::~QTMLocationProvider() | ||
{ | ||
delete mLocation; | ||
} | ||
|
||
void | ||
QTMLocationProvider::positionUpdated(const QGeoPositionInfo &geoPosition) | ||
{ | ||
if (!geoPosition.isValid()) { | ||
NS_WARNING("Invalida geoposition received"); | ||
return; | ||
} | ||
|
||
QGeoCoordinate coord = geoPosition.coordinate(); | ||
double latitude = coord.latitude(); | ||
double longitude = coord.longitude(); | ||
double altitude = coord.altitude(); | ||
double accuracy = geoPosition.attribute(QGeoPositionInfo::HorizontalAccuracy); | ||
double altitudeAccuracy = geoPosition.attribute(QGeoPositionInfo::VerticalAccuracy); | ||
double heading = geoPosition.attribute(QGeoPositionInfo::Direction); | ||
|
||
bool providesSpeed = geoPosition.hasAttribute(QGeoPositionInfo::GroundSpeed); | ||
double speed = geoPosition.attribute(QGeoPositionInfo::GroundSpeed); | ||
|
||
RefPtr<nsGeoPosition> p = | ||
new nsGeoPosition(latitude, longitude, | ||
altitude, accuracy, | ||
altitudeAccuracy, heading, | ||
speed, geoPosition.timestamp().toTime_t()); | ||
if (mCallback) { | ||
mCallback->Update(p); | ||
} | ||
} | ||
|
||
NS_IMETHODIMP | ||
QTMLocationProvider::Startup() | ||
{ | ||
if (!mLocation) | ||
return NS_ERROR_NOT_IMPLEMENTED; | ||
|
||
// Not all versions of qt5positioning set default prefered method | ||
// thus this workaround initializing QGeoPositionSource explicitly | ||
SetHighAccuracy(false); | ||
mLocation->startUpdates(); | ||
|
||
return NS_OK; | ||
} | ||
|
||
NS_IMETHODIMP | ||
QTMLocationProvider::Watch(nsIGeolocationUpdate* aCallback) | ||
{ | ||
mCallback = aCallback; | ||
|
||
return NS_OK; | ||
} | ||
|
||
NS_IMETHODIMP | ||
QTMLocationProvider::Shutdown() | ||
{ | ||
if (!mLocation) | ||
return NS_ERROR_NOT_IMPLEMENTED; | ||
|
||
mLocation->stopUpdates(); | ||
mCallback = nullptr; | ||
|
||
return NS_OK; | ||
} | ||
|
||
NS_IMETHODIMP | ||
QTMLocationProvider::SetHighAccuracy(bool aHigh) | ||
{ | ||
if (!mLocation) | ||
return NS_ERROR_NOT_IMPLEMENTED; | ||
|
||
mLocation->setPreferredPositioningMethods(aHigh ? | ||
QGeoPositionInfoSource::SatellitePositioningMethods : | ||
QGeoPositionInfoSource::AllPositioningMethods); | ||
return NS_OK; | ||
} |
Oops, something went wrong.