Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge remote-tracking branch 'rhodes/3-4-STABLE' into 3-4-STABLE

  • Loading branch information...
commit ebd29038f93dbcdd3aa67b90f3714e9556e565da 2 parents 01c2284 + 16a54ff
Keith Gable authored
20 platform/android/build/android.rake
@@ -130,6 +130,18 @@ def add_motosol_sdk(manifest)
130 130 end
131 131 end
132 132
  133 +def set_app_icon_android
  134 + iconappname = File.join($app_path, "icon", "icon.png")
  135 +
  136 + ['drawable', 'drawable-hdpi', 'drawable-mdpi', 'drawable-ldpi'].each do |dpi|
  137 + drawable = File.join($appres, dpi)
  138 + iconresname = File.join(drawable, "icon.png")
  139 + rm_f iconresname
  140 + cp iconappname, iconresname if File.exist? drawable
  141 + end
  142 +
  143 +end
  144 +
133 145 def set_app_name_android(newname)
134 146 puts "set_app_name"
135 147 $stdout.flush
@@ -137,10 +149,6 @@ def set_app_name_android(newname)
137 149 rm_rf $appres
138 150 cp_r $rhores, $appres
139 151
140   - iconappname = File.join($app_path, "icon", "icon.png")
141   - iconresname = File.join($appres, "drawable", "icon.png")
142   - rm_f iconresname
143   - cp iconappname, iconresname
144 152
145 153 rhostrings = File.join($rhores, "values", "strings.xml")
146 154 appstrings = File.join($appres, "values", "strings.xml")
@@ -1368,6 +1376,7 @@ namespace "build" do
1368 1376
1369 1377 task :resources => [:rhobundle, :extensions] do
1370 1378 set_app_name_android($appname)
  1379 + set_app_icon_android
1371 1380 end
1372 1381
1373 1382 #desc "Build Rhodes for android"
@@ -1399,6 +1408,9 @@ namespace "build" do
1399 1408 cp_r res, $tmpdir
1400 1409 end
1401 1410 end
  1411 +
  1412 + #copy icon again in case an extension overwrites them (like rhoelementsext...)
  1413 + set_app_icon_android
1402 1414
1403 1415 unless $config_xml.nil?
1404 1416 rawres_path = File.join($tmpdir, 'res', 'raw')
4 platform/iphone/Classes/RhoViewController.m
@@ -41,12 +41,12 @@ - (BOOL)shouldAutorotate {
41 41 return YES;
42 42 }
43 43
44   -
  44 +/*
45 45 - (NSUInteger)supportedInterfaceOrientations
46 46 {
47 47 if ([[Rhodes sharedInstance] isRotationLocked])
48 48 return UIInterfaceOrientationMaskPortrait;
49 49 return UIInterfaceOrientationMaskAll;
50 50 }
51   -
  51 +*/
52 52 @end
10 platform/shared/common/RhodesApp.cpp
@@ -1985,7 +1985,15 @@ int rho_rhodesapp_isrubycompiler()
1985 1985
1986 1986 void rho_net_request(const char *url)
1987 1987 {
1988   - getNetRequest().pullData(url, null);
  1988 + String strCallbackUrl = RHODESAPP().canonicalizeRhoUrl(url);
  1989 + RHODESAPP().runCallbackInThread(strCallbackUrl, null);
  1990 +}
  1991 +
  1992 +void rho_net_request_with_data(const char *url, const char *str_body)
  1993 +{
  1994 + String strCallbackUrl = RHODESAPP().canonicalizeRhoUrl(url);
  1995 + String strBody = str_body;
  1996 + RHODESAPP().runCallbackInThread(strCallbackUrl, strBody);
1989 1997 }
1990 1998
1991 1999
8 platform/shared/common/RhodesAppBase.cpp
@@ -32,13 +32,7 @@
32 32 #include "sync/SyncThread.h"
33 33 #include "unzip/unzip.h"
34 34
35   -extern "C" {
36   - void rho_net_request_with_data(const char *url, const char *str_body)
37   - {
38   - getNetRequest().pushData(url, str_body, null);
39   - }
40   -
41   -}
  35 +extern "C" void rho_net_request_with_data(const char *url, const char *str_body);
42 36
43 37 namespace rho {
44 38 namespace common{
6 platform/shared/net/URI.cpp
@@ -203,12 +203,12 @@ String URI::urlEncode(const String& fullPath)
203 203 }
204 204
205 205 strRes += '%';
206   - if (c > 15) { // is it a non-control char, ie. >x0F so 2 chars
  206 + if (((unsigned char)c) > 15) { // is it a non-control char, ie. >x0F so 2 chars
207 207 //sb.append(Integer.toHexString((int)c)); // just add % and the string
208   - toHexString(c, strRes, 16);
  208 + toHexString((unsigned char)c, strRes, 16);
209 209 } else {
210 210 strRes += '0';
211   - toHexString(c, strRes, 16);
  211 + toHexString((unsigned char)c, strRes, 16);
212 212 //sb.append("0" + Integer.toHexString((int)c));
213 213 // otherwise need to add a leading 0
214 214 }
57 platform/wm/rhodes/MainWindow.cpp
@@ -105,6 +105,7 @@ CMainWindow::CMainWindow()
105 105 m_menuBarHeight = 0;
106 106
107 107 m_alertDialog = 0;
  108 + m_isMinimized = 0;
108 109 }
109 110
110 111 CMainWindow::~CMainWindow()
@@ -579,20 +580,44 @@ LRESULT CMainWindow::OnAuthenticationRequest (UINT /*uMsg*/, WPARAM wParam, LPAR
579 580
580 581 #endif //APP_BUILD_CAPABILITY_WEBKIT_BROWSER
581 582
  583 +LRESULT CMainWindow::OnWindowMinimized (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
  584 +{
  585 + ProcessActivate( FALSE, MAKEWPARAM(0,1), 0 );
  586 +
  587 + SetForegroundWindow(m_hWnd);
  588 +
  589 + ::ShowWindow( m_hWnd, SW_MINIMIZE );
  590 +
  591 + m_isMinimized = true;
  592 +
  593 + return 0;
  594 +}
  595 +
582 596 LRESULT CMainWindow::OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
583 597 {
584 598 int fActive = LOWORD(wParam);
585   - LOG(INFO) + "ACTIVATE: " + fActive;
  599 +
  600 + if(m_isMinimized)
  601 + {
  602 + m_isMinimized = false;
  603 + SendMessage( m_hWnd, PB_WINDOW_RESTORE, NULL, TRUE);
  604 + }
586 605
587 606 if (lParam) //We get activate from some internal window
588 607 {
589 608 #if defined(_WIN32_WCE)
590   - if (m_bFullScreen && fActive && (getSIPVisibleTop()<0))
591   - RhoSetFullScreen(true);
  609 + if (m_bFullScreen && fActive && (getSIPVisibleTop()<0))
  610 + RhoSetFullScreen(true);
592 611 #endif
593 612 return 0;
594 613 }
595 614
  615 + ProcessActivate( fActive, wParam, lParam );
  616 + return 0;
  617 +}
  618 +
  619 +void CMainWindow::ProcessActivate( BOOL fActive, WPARAM wParam, LPARAM lParam )
  620 +{
596 621 #if defined(_WIN32_WCE)
597 622 if (m_bFullScreen)
598 623 RhoSetFullScreen(fActive!=0);
@@ -602,24 +627,10 @@ LRESULT CMainWindow::OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOO
602 627 #if defined(_WIN32_WCE) && !defined (OS_PLATFORM_MOTCE)
603 628 // Notify shell of our WM_ACTIVATE message
604 629 SHHandleWMActivate(m_hWnd, wParam, lParam, &m_sai, 0);
605   -
606   - //pause_sync(!fActive);
607   -/* TBD: Commented this out because it was called before http server started
608   - We need to fix this properly
609   - if ( fActive )
610   - CHttpServer::Instance()->ResumeThread();
611   - else
612   - CHttpServer::Instance()->FreezeThread();
613   -*/
614   - //activate calls after javascript alerts, so we have viciouse cycle if alert is display in home page
615   - //if ( rho::common::CRhodesApp::getInstance() != null )
616   - // RHODESAPP().callAppActiveCallback(fActive!=0);
617   -
618 630 #endif
619 631
620 632 if (!fActive)
621 633 rho_geoimpl_turngpsoff();
622   - return 0;
623 634 }
624 635
625 636 LRESULT CMainWindow::OnSetCookieCommand(WORD /*wNotifyCode*/, WORD /*wID*/, HWND hWndCtl, BOOL& /*bHandled*/)
@@ -1124,12 +1135,12 @@ LRESULT CMainWindow::OnAlertShowPopup (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
1124 1135 m_SyncStatusDlg.setStatusText(convertToStringW(params->m_message).c_str());
1125 1136 m_SyncStatusDlg.setTitle( convertToStringW(params->m_title).c_str() );
1126 1137 if ( !m_SyncStatusDlg.m_hWnd )
1127   - m_SyncStatusDlg.Create(m_hWnd, 0);
1128   - else
1129   - {
1130   - m_SyncStatusDlg.ShowWindow(SW_SHOW);
1131   - m_SyncStatusDlg.BringWindowToTop();
1132   - }
  1138 + m_SyncStatusDlg.Create(m_hWnd, 0);
  1139 + //else
  1140 + //{
  1141 + m_SyncStatusDlg.ShowWindow(SW_SHOW);
  1142 + m_SyncStatusDlg.BringWindowToTop();
  1143 + //}
1133 1144 }else if (params->m_dlgType == CAlertDialog::Params::DLG_DEFAULT) {
1134 1145 MessageBox(convertToStringW(params->m_message).c_str(), strAppName.c_str(), MB_ICONWARNING | MB_OK);
1135 1146 RHODESAPP().callPopupCallback(params->m_callback, "ok", "ok");
6 platform/wm/rhodes/MainWindow.h
@@ -103,6 +103,7 @@ static UINT WM_BLUETOOTH_DISCOVERED = ::RegisterWindowMessage(L"RHODES_WM_BLU
103 103 static UINT WM_BLUETOOTH_CALLBACK = ::RegisterWindowMessage(L"RHODES_WM_BLUETOOTH_CALLBACK");
104 104 static UINT WM_EXECUTE_COMMAND = ::RegisterWindowMessage(L"RHODES_WM_EXECUTE_COMMAND");
105 105 static UINT WM_EXECUTE_RUNNABLE = ::RegisterWindowMessage(L"RHODES_WM_EXECUTE_RUNNABLE");
  106 +static UINT WM_WINDOW_MINIMIZE = ::RegisterWindowMessage(L"RHODES_WM_MINIMIZE");
106 107 extern UINT WM_LICENSE_SCREEN;
107 108
108 109 typedef struct _TCookieData {
@@ -210,6 +211,7 @@ class CMainWindow :
210 211 MESSAGE_HANDLER(WM_BLUETOOTH_CALLBACK, OnBluetoothCallback);
211 212 MESSAGE_HANDLER(WM_EXECUTE_COMMAND, OnExecuteCommand);
212 213 MESSAGE_HANDLER(WM_EXECUTE_RUNNABLE, OnExecuteRunnable);
  214 + MESSAGE_HANDLER(WM_WINDOW_MINIMIZE, OnWindowMinimized);
213 215 MESSAGE_HANDLER(WM_LICENSE_SCREEN, OnLicenseScreen);
214 216 MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus);
215 217 MESSAGE_HANDLER(WM_HOTKEY, OnHotKey);
@@ -279,6 +281,7 @@ class CMainWindow :
279 281 LRESULT OnBluetoothCallback (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
280 282 LRESULT OnExecuteCommand (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
281 283 LRESULT OnExecuteRunnable (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
  284 + LRESULT OnWindowMinimized (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
282 285 LRESULT OnLicenseScreen (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
283 286 LRESULT OnSetFocus (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
284 287 LRESULT OnHotKey (UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
@@ -348,6 +351,7 @@ class CMainWindow :
348 351
349 352 private:
350 353 bool mIsBrowserViewHided;
  354 + bool m_isMinimized;
351 355
352 356 rho::IBrowserEngine* m_pBrowserEng;
353 357
@@ -389,6 +393,8 @@ class CMainWindow :
389 393 CAlertDialog *m_alertDialog;
390 394
391 395 CSyncStatusDlg m_SyncStatusDlg;
  396 +
  397 + void ProcessActivate( BOOL fActive, WPARAM wParam, LPARAM lParam );
392 398 };
393 399
394 400 #if !defined(_WIN32_WCE) || defined( OS_PLATFORM_MOTCE )
3  platform/wm/rhodes/Rhodes.cpp
@@ -405,7 +405,8 @@ HRESULT CRhodesModule::PreMessageLoop(int nShowCmd) throw()
405 405
406 406 if (hWnd)
407 407 {
408   - SetForegroundWindow( HWND( DWORD(hWnd) | 0x01 ) );
  408 + SendMessage( hWnd, PB_WINDOW_RESTORE, NULL, TRUE);
  409 + SetForegroundWindow( hWnd );
409 410 return S_FALSE;
410 411 }
411 412
7 platform/wm/rhodes/bluetooth/Bluetooth.cpp
@@ -682,6 +682,13 @@ DWORD WINAPI RhoBluetoothManager::runThreadReadData(LPVOID voidArg) {
682 682 return WSAGetLastError();
683 683 }
684 684 else
  685 + if (cbBytesRecd == 0) {
  686 + // connection closed !
  687 + LOG(INFO) + "RhoBluetoothManager::runThreadReadData() exit with connection closed message";
  688 + functionInfo->fireSessionCallBack(functionInfo->mConnectedDeviceName, RHO_BT_SESSION_DISCONNECT);
  689 + return 0;
  690 + }
  691 + else
685 692 {
686 693 // something was received, then copy the contents in szMessage
687 694 if(cbBytesRecd>0)
3  platform/wm/rhodes/rho/common/ExtManager.cpp
@@ -212,7 +212,8 @@ static void __minimize_restoreApp(int nParam)
212 212
213 213 void CExtManager::minimizeApp()
214 214 {
215   - rho_callInUIThread(__minimize_restoreApp, SW_MINIMIZE);
  215 + //rho_callInUIThread(__minimize_restoreApp, SW_MINIMIZE);
  216 + ::PostMessage( getMainWnd(), WM_WINDOW_MINIMIZE, 0, 0 );
216 217 }
217 218
218 219 void CExtManager::restoreApp()
2  version
... ... @@ -1 +1 @@
1   -3.4.2
  1 +3.4.2.2

0 comments on commit ebd2903

Please sign in to comment.
Something went wrong with that request. Please try again.