Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed .mm file tabs

  • Loading branch information...
commit 599921675f2380836de8c649696d91fc9fb12664 1 parent ca505a6
@taxilian taxilian authored
View
8 fixtabs
@@ -2,6 +2,7 @@
CPPFILES=`find . -type f -name '*.cpp'`
HFILES=`find . -type f -name '*.h'`
+MMFILES=`find . -type f -name '*.mm'`
for FILE in $HFILES
do
@@ -17,3 +18,10 @@ do
rm -v $FILE
mv -v ${FILE}_ $FILE
done
+for FILE in $MMFILES
+do
+ echo "Expanding $FILE..."
+ expand -t 4 $FILE > ${FILE}_
+ rm -v $FILE
+ mv -v ${FILE}_ $FILE
+done
View
158 src/PluginAuto/Mac/NpapiPluginMac.mm 100755 → 100644
@@ -54,9 +54,9 @@
}
NpapiPluginMac::NpapiPluginMac(const FB::Npapi::NpapiBrowserHostPtr &host, const std::string& mimetype)
- : NpapiPlugin(host, mimetype), m_eventModel((NPEventModel)-1), m_drawingModel((NPDrawingModel)-1)
+ : NpapiPlugin(host, mimetype), m_eventModel((NPEventModel)-1), m_drawingModel((NPDrawingModel)-1)
#if FBMAC_USE_COREANIMATION
- , m_layer(NULL)
+ , m_layer(NULL)
#endif
{
// If you receive a BAD_ACCESS error here you probably have something
@@ -68,109 +68,109 @@
static const std::string pluginPath = getPluginPath();
setFSPath(pluginPath);
- // These HAVE to be called here during the NPP_New call to set the drawing and event models.
- m_drawingModel = PluginWindowMac::initPluginWindowMac(m_npHost);
- m_eventModel = PluginEventMac::initPluginEventMac(m_npHost, m_drawingModel);
+ // These HAVE to be called here during the NPP_New call to set the drawing and event models.
+ m_drawingModel = PluginWindowMac::initPluginWindowMac(m_npHost);
+ m_eventModel = PluginEventMac::initPluginEventMac(m_npHost, m_drawingModel);
- // We can create our event model handler now.
- pluginEvt = PluginEventMacPtr(PluginEventMac::createPluginEventMac(m_eventModel));
+ // We can create our event model handler now.
+ pluginEvt = PluginEventMacPtr(PluginEventMac::createPluginEventMac(m_eventModel));
}
NpapiPluginMac::~NpapiPluginMac()
{
#if FBMAC_USE_COREANIMATION
- if (m_layer) {
- [(CALayer*)m_layer autorelease];
- m_layer = NULL;
- }
+ if (m_layer) {
+ [(CALayer*)m_layer autorelease];
+ m_layer = NULL;
+ }
#endif
}
NPError NpapiPluginMac::SetWindow(NPWindow* window) {
- NPError res = NPERR_NO_ERROR;
- if (window)
- {
- if (!pluginWin)
- {
- // If we don't have a PluginWindow, create one. It will be made for the chosen drawing model.
- pluginWin = PluginWindowMacPtr(PluginWindowMac::createPluginWindowMac(m_drawingModel));
- if (pluginWin)
- {
- pluginWin->setNpHost(m_npHost);
- // Tell the event model which window to use for events.
- if (pluginEvt)
- pluginEvt->setPluginWindow(pluginWin);
- pluginWin->setPluginEvent(pluginEvt);
- }
- }
- if (pluginWin)
- {
+ NPError res = NPERR_NO_ERROR;
+ if (window)
+ {
+ if (!pluginWin)
+ {
+ // If we don't have a PluginWindow, create one. It will be made for the chosen drawing model.
+ pluginWin = PluginWindowMacPtr(PluginWindowMac::createPluginWindowMac(m_drawingModel));
+ if (pluginWin)
+ {
+ pluginWin->setNpHost(m_npHost);
+ // Tell the event model which window to use for events.
+ if (pluginEvt)
+ pluginEvt->setPluginWindow(pluginWin);
+ pluginWin->setPluginEvent(pluginEvt);
+ }
+ }
+ if (pluginWin)
+ {
#if FBMAC_USE_COREANIMATION
- // Patch up the NPWindow before calling SetWindow for CoreAnimation to pass the CALayer.
- if ((PluginWindowMac::DrawingModelCoreAnimation == pluginWin->getDrawingModel()) || (PluginWindowMac::DrawingModelInvalidatingCoreAnimation == pluginWin->getDrawingModel()))
- {
- assert(!window->window);
- window->window = m_layer;
- }
+ // Patch up the NPWindow before calling SetWindow for CoreAnimation to pass the CALayer.
+ if ((PluginWindowMac::DrawingModelCoreAnimation == pluginWin->getDrawingModel()) || (PluginWindowMac::DrawingModelInvalidatingCoreAnimation == pluginWin->getDrawingModel()))
+ {
+ assert(!window->window);
+ window->window = m_layer;
+ }
#endif
- // Set the Window.
- res = pluginWin->SetWindow(window);
+ // Set the Window.
+ res = pluginWin->SetWindow(window);
#if FBMAC_USE_COREANIMATION
- if ((PluginWindowMac::DrawingModelCoreAnimation == pluginWin->getDrawingModel()) || (PluginWindowMac::DrawingModelInvalidatingCoreAnimation == pluginWin->getDrawingModel()))
- window->window = NULL;
+ if ((PluginWindowMac::DrawingModelCoreAnimation == pluginWin->getDrawingModel()) || (PluginWindowMac::DrawingModelInvalidatingCoreAnimation == pluginWin->getDrawingModel()))
+ window->window = NULL;
#endif
- // Notify the PluginCore about our new window. This will post an AttachedEvent.
- if (!pluginMain->GetWindow())
- pluginMain->SetWindow(pluginWin.get());
- }
- } else {
- // Notify the PluginCore about our missing window. This will post an DetachedEvent.
- pluginMain->ClearWindow();
- pluginWin.reset();
- }
+ // Notify the PluginCore about our new window. This will post an AttachedEvent.
+ if (!pluginMain->GetWindow())
+ pluginMain->SetWindow(pluginWin.get());
+ }
+ } else {
+ // Notify the PluginCore about our missing window. This will post an DetachedEvent.
+ pluginMain->ClearWindow();
+ pluginWin.reset();
+ }
return res;
}
int16_t NpapiPluginMac::HandleEvent(void* event)
{
- if (pluginEvt)
- return pluginEvt->HandleEvent(event);
+ if (pluginEvt)
+ return pluginEvt->HandleEvent(event);
return 0;
}
int16_t NpapiPluginMac::GetValue(NPPVariable variable, void *value) {
- int16_t res = NPERR_GENERIC_ERROR;
- switch (variable) {
+ int16_t res = NPERR_GENERIC_ERROR;
+ switch (variable) {
#if FBMAC_USE_COREANIMATION
- case NPPVpluginCoreAnimationLayer:
- {
- // The BrowserPlugin owns the CALayer.
- CALayer *mlayer = (CALayer *) m_layer;
- if (!mlayer)
- mlayer = [[CALayer layer] retain];
- if (mlayer) {
- mlayer.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable;
- mlayer.needsDisplayOnBoundsChange = YES;
- *(CALayer**) value = [(CALayer*)mlayer retain];
- }
- m_layer = mlayer;
- res = NPERR_NO_ERROR;
- } break;
+ case NPPVpluginCoreAnimationLayer:
+ {
+ // The BrowserPlugin owns the CALayer.
+ CALayer *mlayer = (CALayer *) m_layer;
+ if (!mlayer)
+ mlayer = [[CALayer layer] retain];
+ if (mlayer) {
+ mlayer.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable;
+ mlayer.needsDisplayOnBoundsChange = YES;
+ *(CALayer**) value = [(CALayer*)mlayer retain];
+ }
+ m_layer = mlayer;
+ res = NPERR_NO_ERROR;
+ } break;
#endif
- case NPPVpluginScriptableNPObject:
- {
- res = NpapiPlugin::GetValue(variable, value);
- if (NPERR_NO_ERROR == res)
- setReady(); // Ready state means that we are ready to interact with Javascript;
- } break;
- default:
- res = NpapiPlugin::GetValue(variable, value);
- break;
- }
- return res;
+ case NPPVpluginScriptableNPObject:
+ {
+ res = NpapiPlugin::GetValue(variable, value);
+ if (NPERR_NO_ERROR == res)
+ setReady(); // Ready state means that we are ready to interact with Javascript;
+ } break;
+ default:
+ res = NpapiPlugin::GetValue(variable, value);
+ break;
+ }
+ return res;
}
void NpapiPluginMac::HandleTimerEvent() {
- if (pluginWin)
- return pluginWin->handleTimerEvent();
+ if (pluginWin)
+ return pluginWin->handleTimerEvent();
}
View
8 src/PluginAuto/Mac/PluginEventMacCocoa.mm
@@ -32,10 +32,10 @@
PluginEventMacCocoa::~PluginEventMacCocoa() {}
int16_t PluginEventMacCocoa::HandleEvent(void* event) {
- NPCocoaEvent* evt = (NPCocoaEvent*) event;
- PluginWindowMacPtr window = m_PluginWindow.lock();
- if (!window)
- return false;
+ NPCocoaEvent* evt = (NPCocoaEvent*) event;
+ PluginWindowMacPtr window = m_PluginWindow.lock();
+ if (!window)
+ return false;
// Let the plugin handle the event if it wants
MacEventCocoa macEv(evt);
View
52 src/PluginAuto/Mac/PluginWindowMacCA.mm
@@ -26,42 +26,42 @@
}
PluginWindowMacCA::PluginWindowMacCA(bool invalidating)
- : PluginWindowMac(), m_layer(NULL), m_invalidating(invalidating)
+ : PluginWindowMac(), m_layer(NULL), m_invalidating(invalidating)
{
}
PluginWindowMacCA::~PluginWindowMacCA()
{
- [(CALayer*)m_layer autorelease];
- m_layer = NULL;
+ [(CALayer*)m_layer autorelease];
+ m_layer = NULL;
}
NPError PluginWindowMacCA::SetWindow(NPWindow* window)
{
- CALayer *layer = (CALayer*) window->window;
-// FBLOG_TRACE("PluginCore", "PluginWindowMacCA::SetWindow() CALayer=%p", layer);
- if (!layer)
- return NPERR_INVALID_PARAM;
+ CALayer *layer = (CALayer*) window->window;
+// FBLOG_TRACE("PluginCore", "PluginWindowMacCA::SetWindow() CALayer=%p", layer);
+ if (!layer)
+ return NPERR_INVALID_PARAM;
- if (m_layer != layer)
- {
- [(CALayer*)layer retain];
- [(CALayer*)m_layer autorelease];
- m_layer = layer;
-
- m_x = window->x;
- m_y = window->y;
- m_width = window->width;
- m_height = window->height;
- m_clipTop = window->clipRect.top;
- m_clipLeft = window->clipRect.left;
- m_clipBottom = window->clipRect.bottom;
- m_clipRight = window->clipRect.right;
-
- AttachedEvent evt2;
- SendEvent(&evt2);
- return NPERR_NO_ERROR;
- }
+ if (m_layer != layer)
+ {
+ [(CALayer*)layer retain];
+ [(CALayer*)m_layer autorelease];
+ m_layer = layer;
+
+ m_x = window->x;
+ m_y = window->y;
+ m_width = window->width;
+ m_height = window->height;
+ m_clipTop = window->clipRect.top;
+ m_clipLeft = window->clipRect.left;
+ m_clipBottom = window->clipRect.bottom;
+ m_clipRight = window->clipRect.right;
+
+ AttachedEvent evt2;
+ SendEvent(&evt2);
+ return NPERR_NO_ERROR;
+ }
return PluginWindowMac::SetWindow(window);
}
View
34 src/PluginCore/Mac/OneShotManager.mm
@@ -83,29 +83,29 @@ - (void)doStuff:(id)obj
void FB::OneShotManager::push(void* npp, OneShotCallback sink)
{
- boost::mutex::scoped_lock lock(m_mutex);
+ boost::mutex::scoped_lock lock(m_mutex);
m_sinks.push(std::make_pair(npp, sink));
[getHelper(this) performSelectorOnMainThread:@selector(doStuff:) withObject:nil waitUntilDone:NO];
}
void FB::OneShotManager::clear(void* npp)
{
- // This and push must never be called at the same time; thus, the mutex prevents that
- // from happening.
- boost::mutex::scoped_lock lock(m_mutex);
+ // This and push must never be called at the same time; thus, the mutex prevents that
+ // from happening.
+ boost::mutex::scoped_lock lock(m_mutex);
SinkQueue tmp;
- SinkPair cur;
- // Go through all items in the queue; add all but those
- // associated with npp to a temporary queue
- while (m_sinks.try_pop(cur)) {
- if (cur.first != npp) {
- tmp.push(cur);
- }
- }
- // Add the items we kept back into the queue
- while (tmp.try_pop(cur)) {
- m_sinks.push(cur);
- }
+ SinkPair cur;
+ // Go through all items in the queue; add all but those
+ // associated with npp to a temporary queue
+ while (m_sinks.try_pop(cur)) {
+ if (cur.first != npp) {
+ tmp.push(cur);
+ }
+ }
+ // Add the items we kept back into the queue
+ while (tmp.try_pop(cur)) {
+ m_sinks.push(cur);
+ }
}
FB::OneShotManager& FB::OneShotManager::getInstance()
@@ -116,7 +116,7 @@ - (void)doStuff:(id)obj
void FB::OneShotManager::shoot()
{
- SinkPair val;
+ SinkPair val;
while (m_sinks.try_pop(val))
{
val.second(val.first, 0);
Please sign in to comment.
Something went wrong with that request. Please try again.