Skip to content

Commit

Permalink
Merge remote-tracking branch 'rhodes/3-4-STABLE' into 3-4-STABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
ziggythehamster committed Dec 10, 2012
2 parents 01c2284 + 16a54ff commit ebd2903
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 43 deletions.
20 changes: 16 additions & 4 deletions platform/android/build/android.rake
Expand Up @@ -130,17 +130,25 @@ def add_motosol_sdk(manifest)
end
end

def set_app_icon_android
iconappname = File.join($app_path, "icon", "icon.png")

['drawable', 'drawable-hdpi', 'drawable-mdpi', 'drawable-ldpi'].each do |dpi|
drawable = File.join($appres, dpi)
iconresname = File.join(drawable, "icon.png")
rm_f iconresname
cp iconappname, iconresname if File.exist? drawable
end

end

def set_app_name_android(newname)
puts "set_app_name"
$stdout.flush

rm_rf $appres
cp_r $rhores, $appres

iconappname = File.join($app_path, "icon", "icon.png")
iconresname = File.join($appres, "drawable", "icon.png")
rm_f iconresname
cp iconappname, iconresname

rhostrings = File.join($rhores, "values", "strings.xml")
appstrings = File.join($appres, "values", "strings.xml")
Expand Down Expand Up @@ -1368,6 +1376,7 @@ namespace "build" do

task :resources => [:rhobundle, :extensions] do
set_app_name_android($appname)
set_app_icon_android
end

#desc "Build Rhodes for android"
Expand Down Expand Up @@ -1399,6 +1408,9 @@ namespace "build" do
cp_r res, $tmpdir
end
end

#copy icon again in case an extension overwrites them (like rhoelementsext...)
set_app_icon_android

unless $config_xml.nil?
rawres_path = File.join($tmpdir, 'res', 'raw')
Expand Down
4 changes: 2 additions & 2 deletions platform/iphone/Classes/RhoViewController.m
Expand Up @@ -41,12 +41,12 @@ - (BOOL)shouldAutorotate {
return YES;
}


/*
- (NSUInteger)supportedInterfaceOrientations
{
if ([[Rhodes sharedInstance] isRotationLocked])
return UIInterfaceOrientationMaskPortrait;
return UIInterfaceOrientationMaskAll;
}

*/
@end
10 changes: 9 additions & 1 deletion platform/shared/common/RhodesApp.cpp
Expand Up @@ -1985,7 +1985,15 @@ int rho_rhodesapp_isrubycompiler()

void rho_net_request(const char *url)
{
getNetRequest().pullData(url, null);
String strCallbackUrl = RHODESAPP().canonicalizeRhoUrl(url);
RHODESAPP().runCallbackInThread(strCallbackUrl, null);
}

void rho_net_request_with_data(const char *url, const char *str_body)
{
String strCallbackUrl = RHODESAPP().canonicalizeRhoUrl(url);
String strBody = str_body;
RHODESAPP().runCallbackInThread(strCallbackUrl, strBody);
}


Expand Down
8 changes: 1 addition & 7 deletions platform/shared/common/RhodesAppBase.cpp
Expand Up @@ -32,13 +32,7 @@
#include "sync/SyncThread.h"
#include "unzip/unzip.h"

extern "C" {
void rho_net_request_with_data(const char *url, const char *str_body)
{
getNetRequest().pushData(url, str_body, null);
}

}
extern "C" void rho_net_request_with_data(const char *url, const char *str_body);

namespace rho {
namespace common{
Expand Down
6 changes: 3 additions & 3 deletions platform/shared/net/URI.cpp
Expand Up @@ -203,12 +203,12 @@ String URI::urlEncode(const String& fullPath)
}

strRes += '%';
if (c > 15) { // is it a non-control char, ie. >x0F so 2 chars
if (((unsigned char)c) > 15) { // is it a non-control char, ie. >x0F so 2 chars
//sb.append(Integer.toHexString((int)c)); // just add % and the string
toHexString(c, strRes, 16);
toHexString((unsigned char)c, strRes, 16);
} else {
strRes += '0';
toHexString(c, strRes, 16);
toHexString((unsigned char)c, strRes, 16);
//sb.append("0" + Integer.toHexString((int)c));
// otherwise need to add a leading 0
}
Expand Down
57 changes: 34 additions & 23 deletions platform/wm/rhodes/MainWindow.cpp
Expand Up @@ -105,6 +105,7 @@ CMainWindow::CMainWindow()
m_menuBarHeight = 0;

m_alertDialog = 0;
m_isMinimized = 0;
}

CMainWindow::~CMainWindow()
Expand Down Expand Up @@ -579,20 +580,44 @@ LRESULT CMainWindow::OnAuthenticationRequest (UINT /*uMsg*/, WPARAM wParam, LPAR

#endif //APP_BUILD_CAPABILITY_WEBKIT_BROWSER

LRESULT CMainWindow::OnWindowMinimized (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
ProcessActivate( FALSE, MAKEWPARAM(0,1), 0 );

SetForegroundWindow(m_hWnd);

::ShowWindow( m_hWnd, SW_MINIMIZE );

m_isMinimized = true;

return 0;
}

LRESULT CMainWindow::OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
{
int fActive = LOWORD(wParam);
LOG(INFO) + "ACTIVATE: " + fActive;

if(m_isMinimized)
{
m_isMinimized = false;
SendMessage( m_hWnd, PB_WINDOW_RESTORE, NULL, TRUE);
}

if (lParam) //We get activate from some internal window
{
#if defined(_WIN32_WCE)
if (m_bFullScreen && fActive && (getSIPVisibleTop()<0))
RhoSetFullScreen(true);
if (m_bFullScreen && fActive && (getSIPVisibleTop()<0))
RhoSetFullScreen(true);
#endif
return 0;
}

ProcessActivate( fActive, wParam, lParam );
return 0;
}

void CMainWindow::ProcessActivate( BOOL fActive, WPARAM wParam, LPARAM lParam )
{
#if defined(_WIN32_WCE)
if (m_bFullScreen)
RhoSetFullScreen(fActive!=0);
Expand All @@ -602,24 +627,10 @@ LRESULT CMainWindow::OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOO
#if defined(_WIN32_WCE) && !defined (OS_PLATFORM_MOTCE)
// Notify shell of our WM_ACTIVATE message
SHHandleWMActivate(m_hWnd, wParam, lParam, &m_sai, 0);

//pause_sync(!fActive);
/* TBD: Commented this out because it was called before http server started
We need to fix this properly
if ( fActive )
CHttpServer::Instance()->ResumeThread();
else
CHttpServer::Instance()->FreezeThread();
*/
//activate calls after javascript alerts, so we have viciouse cycle if alert is display in home page
//if ( rho::common::CRhodesApp::getInstance() != null )
// RHODESAPP().callAppActiveCallback(fActive!=0);

#endif

if (!fActive)
rho_geoimpl_turngpsoff();
return 0;
}

LRESULT CMainWindow::OnSetCookieCommand(WORD /*wNotifyCode*/, WORD /*wID*/, HWND hWndCtl, BOOL& /*bHandled*/)
Expand Down Expand Up @@ -1124,12 +1135,12 @@ LRESULT CMainWindow::OnAlertShowPopup (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
m_SyncStatusDlg.setStatusText(convertToStringW(params->m_message).c_str());
m_SyncStatusDlg.setTitle( convertToStringW(params->m_title).c_str() );
if ( !m_SyncStatusDlg.m_hWnd )
m_SyncStatusDlg.Create(m_hWnd, 0);
else
{
m_SyncStatusDlg.ShowWindow(SW_SHOW);
m_SyncStatusDlg.BringWindowToTop();
}
m_SyncStatusDlg.Create(m_hWnd, 0);
//else
//{
m_SyncStatusDlg.ShowWindow(SW_SHOW);
m_SyncStatusDlg.BringWindowToTop();
//}
}else if (params->m_dlgType == CAlertDialog::Params::DLG_DEFAULT) {
MessageBox(convertToStringW(params->m_message).c_str(), strAppName.c_str(), MB_ICONWARNING | MB_OK);
RHODESAPP().callPopupCallback(params->m_callback, "ok", "ok");
Expand Down
6 changes: 6 additions & 0 deletions platform/wm/rhodes/MainWindow.h
Expand Up @@ -103,6 +103,7 @@ static UINT WM_BLUETOOTH_DISCOVERED = ::RegisterWindowMessage(L"RHODES_WM_BLU
static UINT WM_BLUETOOTH_CALLBACK = ::RegisterWindowMessage(L"RHODES_WM_BLUETOOTH_CALLBACK");
static UINT WM_EXECUTE_COMMAND = ::RegisterWindowMessage(L"RHODES_WM_EXECUTE_COMMAND");
static UINT WM_EXECUTE_RUNNABLE = ::RegisterWindowMessage(L"RHODES_WM_EXECUTE_RUNNABLE");
static UINT WM_WINDOW_MINIMIZE = ::RegisterWindowMessage(L"RHODES_WM_MINIMIZE");
extern UINT WM_LICENSE_SCREEN;

typedef struct _TCookieData {
Expand Down Expand Up @@ -210,6 +211,7 @@ class CMainWindow :
MESSAGE_HANDLER(WM_BLUETOOTH_CALLBACK, OnBluetoothCallback);
MESSAGE_HANDLER(WM_EXECUTE_COMMAND, OnExecuteCommand);
MESSAGE_HANDLER(WM_EXECUTE_RUNNABLE, OnExecuteRunnable);
MESSAGE_HANDLER(WM_WINDOW_MINIMIZE, OnWindowMinimized);
MESSAGE_HANDLER(WM_LICENSE_SCREEN, OnLicenseScreen);
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus);
MESSAGE_HANDLER(WM_HOTKEY, OnHotKey);
Expand Down Expand Up @@ -279,6 +281,7 @@ class CMainWindow :
LRESULT OnBluetoothCallback (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
LRESULT OnExecuteCommand (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
LRESULT OnExecuteRunnable (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
LRESULT OnWindowMinimized (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
LRESULT OnLicenseScreen (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
LRESULT OnSetFocus (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
LRESULT OnHotKey (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
Expand Down Expand Up @@ -348,6 +351,7 @@ class CMainWindow :

private:
bool mIsBrowserViewHided;
bool m_isMinimized;

rho::IBrowserEngine* m_pBrowserEng;

Expand Down Expand Up @@ -389,6 +393,8 @@ class CMainWindow :
CAlertDialog *m_alertDialog;

CSyncStatusDlg m_SyncStatusDlg;

void ProcessActivate( BOOL fActive, WPARAM wParam, LPARAM lParam );
};

#if !defined(_WIN32_WCE) || defined( OS_PLATFORM_MOTCE )
Expand Down
3 changes: 2 additions & 1 deletion platform/wm/rhodes/Rhodes.cpp
Expand Up @@ -405,7 +405,8 @@ HRESULT CRhodesModule::PreMessageLoop(int nShowCmd) throw()

if (hWnd)
{
SetForegroundWindow( HWND( DWORD(hWnd) | 0x01 ) );
SendMessage( hWnd, PB_WINDOW_RESTORE, NULL, TRUE);
SetForegroundWindow( hWnd );
return S_FALSE;
}

Expand Down
7 changes: 7 additions & 0 deletions platform/wm/rhodes/bluetooth/Bluetooth.cpp
Expand Up @@ -682,6 +682,13 @@ DWORD WINAPI RhoBluetoothManager::runThreadReadData(LPVOID voidArg) {
return WSAGetLastError();
}
else
if (cbBytesRecd == 0) {
// connection closed !
LOG(INFO) + "RhoBluetoothManager::runThreadReadData() exit with connection closed message";
functionInfo->fireSessionCallBack(functionInfo->mConnectedDeviceName, RHO_BT_SESSION_DISCONNECT);
return 0;
}
else
{
// something was received, then copy the contents in szMessage
if(cbBytesRecd>0)
Expand Down
3 changes: 2 additions & 1 deletion platform/wm/rhodes/rho/common/ExtManager.cpp
Expand Up @@ -212,7 +212,8 @@ static void __minimize_restoreApp(int nParam)

void CExtManager::minimizeApp()
{
rho_callInUIThread(__minimize_restoreApp, SW_MINIMIZE);
//rho_callInUIThread(__minimize_restoreApp, SW_MINIMIZE);
::PostMessage( getMainWnd(), WM_WINDOW_MINIMIZE, 0, 0 );
}

void CExtManager::restoreApp()
Expand Down
2 changes: 1 addition & 1 deletion version
@@ -1 +1 @@
3.4.2
3.4.2.2

0 comments on commit ebd2903

Please sign in to comment.