Skip to content

Commit

Permalink
Some fixes (UWP and Rhosim)
Browse files Browse the repository at this point in the history
  • Loading branch information
Georgy Shabalev committed Jun 7, 2017
1 parent 2142c13 commit c16f1d1
Show file tree
Hide file tree
Showing 24 changed files with 1,200 additions and 209 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -100,6 +100,7 @@ platform/wp8/*/obj/*
platform/wp8/bin/*
platform/wp8/ipch/*
platform/uwp/*/obj/*
platform/uwp/platform
platform/uwp/bin/*
platform/uwp/ipch/*
platform/uwp/RhoRuntimeInvoker/bin/*
Expand Down
11 changes: 6 additions & 5 deletions Rakefile
Expand Up @@ -4237,18 +4237,19 @@ namespace "run" do
end

oldDir = File.join( $startdir, "platform/win32/RhoSimulator" )
newDir = File.join( $startdir, "platform/win32/RhoSimulatorRunnable" )
newDir = oldDir
#newDir = File.join( $startdir, "platform/win32/RhoSimulatorRunnable" )

rm_rf newDir if Dir.exist?(newDir)
FileUtils.mkpath newDir
#rm_rf newDir if Dir.exist?(newDir)
#FileUtils.mkpath newDir

cp_r File.join(oldDir, "."), newDir
#cp_r File.join(oldDir, "."), newDir

qtdir = ENV['QTDIR']
if !qtdir.nil?
cp File.join(qtdir, "bin/Qt5Core.dll"), newDir
args << "-remote-debugging-port=9090"
end
args << "-remote-debugging-port=9090"

cmd = File.join(newDir, 'rhosimulator.exe')
elsif RUBY_PLATFORM =~ /darwin/
Expand Down
2 changes: 1 addition & 1 deletion lib/commonAPI/coreapi/ext/platform/uwp/Coreapi.vcxproj
Expand Up @@ -26,7 +26,7 @@
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10586.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down
Expand Up @@ -26,7 +26,7 @@
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10586.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down
Expand Up @@ -26,7 +26,7 @@
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10586.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down
3 changes: 1 addition & 2 deletions lib/commonAPI/coreapi/ext/platform/uwp/WebViewLib.vcxproj
Expand Up @@ -26,7 +26,7 @@
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10586.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down Expand Up @@ -151,7 +151,6 @@
<IgnoreSpecificDefaultLibraries>ole32.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateWindowsMetadata>true</GenerateWindowsMetadata>
</Link>

</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
Expand Down
2 changes: 1 addition & 1 deletion lib/extensions/digest-md5/ext/uwp/digest-md5.vcxproj
Expand Up @@ -26,7 +26,7 @@
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10586.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down
2 changes: 1 addition & 1 deletion lib/extensions/digest-sha1/ext/uwp/digest-sha1.vcxproj
Expand Up @@ -26,7 +26,7 @@
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10586.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down
2 changes: 1 addition & 1 deletion lib/extensions/digest/ext/uwp/digest.vcxproj
Expand Up @@ -26,7 +26,7 @@
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10586.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down
4 changes: 2 additions & 2 deletions platform/shared/ruby/io.c
Expand Up @@ -284,7 +284,7 @@ rb_fix_detect_o_cloexec(int fd)
int
rb_cloexec_open(const char *pathname, int flags, mode_t mode)
{
int ret;
int ret = 0;
static int o_cloexec_state = -1; /* <0: unknown, 0: ignored, >0: working */

#ifdef O_CLOEXEC
Expand Down Expand Up @@ -5482,7 +5482,7 @@ rb_sysopen_internal(struct sysopen_struct *data)
static int
rb_sysopen(VALUE fname, int oflags, mode_t perm)
{
int fd;
int fd = 0;
struct sysopen_struct data;

data.fname = rb_str_encode_ospath(fname);
Expand Down
32 changes: 11 additions & 21 deletions platform/shared/ruby/uwp/win32/win32.c
Expand Up @@ -49,15 +49,10 @@
#include <processthreadsapi.h>
#include <wtypesbase.h>
#include "../../../../uwp/rhoruntime/common/RhodesHelperWP8.h"
//#define rb_w32_wopen _wopen

#if _MSC_VER >= 1400
#include <crtdbg.h>
#include <rtcapi.h>
#endif
#ifdef __MINGW32__
#include <mswsock.h>
#endif

#include "uwp.h"
#include "win32/dir.h"
Expand All @@ -73,7 +68,6 @@
#include <ShlObj.h>
#include <WinBase.h>


#define isdirsep(x) ((x) == '/' || (x) == '\\')

#include "logging/RhoLog.h"
Expand Down Expand Up @@ -135,7 +129,6 @@ int rb_w32_reparse_symlink_p(const WCHAR *path);

#include "../posixnames.h"


static struct ChildRecord *CreateChild(const WCHAR *, const WCHAR *, SECURITY_ATTRIBUTES *, HANDLE, HANDLE, HANDLE, DWORD);
static int has_redirection(const char *, UINT);
int rb_w32_wait_events(HANDLE *events, int num, DWORD timeout);
Expand All @@ -144,6 +137,7 @@ static int wstati64(const WCHAR *path, struct stati64 *st);
static int wlstati64(const WCHAR *path, struct stati64 *st);
VALUE rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc);
int ruby_brace_glob_with_enc(const char *str, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc);
static FARPROC get_proc_address(const char *module, const char *func, HANDLE *mh);

#define RUBY_CRITICAL(expr) do { expr; } while (0)

Expand Down Expand Up @@ -494,15 +488,15 @@ regulate_path(WCHAR *path)
static FARPROC
get_proc_address(const char *module, const char *func, HANDLE *mh)
{
HANDLE h;
HMODULE h = 0;
FARPROC ptr;

if (mh)
h = LoadLibrary(module);
h = LoadLibraryA(module);
else
h = GetModuleHandle(module);
if (!h)
return NULL;
h = GetModuleHandleA(module);

if (!h) return NULL;

ptr = GetProcAddress(h, func);
if (mh) {
Expand Down Expand Up @@ -805,14 +799,12 @@ static int w32_cmdvector(const WCHAR *, char ***, UINT, rb_encoding *);
void
rb_w32_sysinit(int *argc, char ***argv)
{
#if RT_VER >= 80// && !defined(OS_WP8) && !defined(OS_UWP)
static void set_pioinfo_extra(void);

_CrtSetReportMode(_CRT_ASSERT, 0);
_set_invalid_parameter_handler(invalid_parameter);
_RTC_SetErrorFunc(rtc_error_handler);
_RTC_SetErrorFuncW(rtc_error_handler);
set_pioinfo_extra();
#endif
SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX);

get_version();
Expand Down Expand Up @@ -2084,7 +2076,7 @@ rb_w32_wstr_to_mbstr(UINT cp, const WCHAR *wstr, int clen, long *plen)
WCHAR *
rb_w32_mbstr_to_wstr(UINT cp, const char *str, int clen, long *plen)
{
WCHAR *ptr;
WCHAR *ptr = 0;
int len = MultiByteToWideChar(cp, 0, str, clen, NULL, 0);
if (!(ptr = malloc(sizeof(WCHAR) * len))) return 0;
MultiByteToWideChar(cp, 0, str, clen, ptr, len);
Expand Down Expand Up @@ -2422,7 +2414,7 @@ static inline ioinfo* _pioinfo(int);
#define rb_acrt_lowio_lock_fh(i) EnterCriticalSection(&_pioinfo(i)->lock)
#define rb_acrt_lowio_unlock_fh(i) LeaveCriticalSection(&_pioinfo(i)->lock)

#if RT_VER >= 80 //&& !defined(OS_WP8) && !defined(OS_UWP)
#if defined(OS_UWP)
static size_t pioinfo_extra = 0; /* workaround for VC++8 SP1 */

/* License: Ruby's */
Expand Down Expand Up @@ -5781,8 +5773,7 @@ w32_stati64(const char *path, struct stati64 *st, UINT cp)
WCHAR *wpath;
int ret;

if (!(wpath = mbstr_to_wstr(cp, path, -1, NULL)))
return -1;
if (!(wpath = mbstr_to_wstr(cp, path, -1, NULL))) return -1;
ret = wstati64(wpath, st);
free(wpath);
return ret;
Expand Down Expand Up @@ -6169,8 +6160,7 @@ rb_w32_uopen(const char *file, int oflag, ...)
pmode = va_arg(arg, int);
va_end(arg);

if (!(wfile = utf8_to_wstr(file, NULL)))
return -1;
if (!(wfile = utf8_to_wstr(file, NULL))) return -1;
ret = rb_w32_wopen(wfile, oflag, pmode);
free(wfile);
return ret;
Expand Down
2 changes: 1 addition & 1 deletion platform/uwp/RhoRuntimeInvoker/RhoRuntimeInvoker.csproj
Expand Up @@ -14,7 +14,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.14393.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.14393.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Expand Down
2 changes: 1 addition & 1 deletion platform/uwp/curl/libcurl.vcxproj
Expand Up @@ -36,7 +36,7 @@
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10586.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down
11 changes: 10 additions & 1 deletion platform/uwp/rhodes/MainPage.xaml.cs
Expand Up @@ -195,6 +195,7 @@ public bool ApplicationBarStatus()
return getAppBar().IsOpen;
}


public MainPage()
{
deb("Running constructor");
Expand Down Expand Up @@ -230,6 +231,7 @@ public MainPage()
try{
// initialize C# extensions factories
deb("InitializeExtensions()");

CSharpExtensions.InitializeExtensions();

// create rhodes runtime object
Expand Down Expand Up @@ -661,35 +663,42 @@ private CommandBar getAppBar()

private void updateAppBarModeAndVisibility(bool autoToolbarVisibility = true)
{
if (autoToolbarVisibility) { deb("Tool bar visible"); }
else { deb("Tool bar invisible"); }

getAppBar().Visibility = autoToolbarVisibility ? Visibility.Visible : Visibility.Collapsed;
//getAppBar().IsSticky = autoToolbarVisibility ?
if (autoToolbarVisibility && (getAppBar().PrimaryCommands.Count > 0))
{
getAppBar().ClosedDisplayMode = AppBarClosedDisplayMode.Compact;
getAppBar().IsOpen = true;
//ApplicationBar.IsMenuEnabled = true;
getAppBar().Opacity = 1.0;
deb("Tool bar type 1");
}
else if (getAppBar().PrimaryCommands.Count > 0)
{
getAppBar().ClosedDisplayMode = AppBarClosedDisplayMode.Minimal;
getAppBar().IsOpen = true;
//ApplicationBar.IsMenuEnabled = true;
getAppBar().Opacity = 0.75;
deb("Tool bar type 2");
}
else
{
getAppBar().ClosedDisplayMode = AppBarClosedDisplayMode.Compact;
getAppBar().IsOpen = false;
//ApplicationBar.IsMenuEnabled = false;
getAppBar().Opacity = 1.0;
deb("Tool bar type 3");
}
}

// *** TOOLBAR ***

public void toolbarRemoveAllButtons()
{

deb("Removing buttons");
if (!isUIThread) { InvokeInUIThread(delegate() { toolbarRemoveAllButtons(); }); return; }

foreach(ICommandBarElement value in getAppBar().PrimaryCommands.ToList()){
Expand Down
2 changes: 1 addition & 1 deletion platform/uwp/rhodes/common/RhoResourceMap.cs
Expand Up @@ -58,7 +58,7 @@ private static void copyMap(String strMap)
{
String[] values = files[i].Split('|');

String strFile = "rho/" + values[0];
String strFile = "rho" + values[0];
String strDstFile = strFile;

if (values[1] == "dir")
Expand Down
8 changes: 5 additions & 3 deletions platform/uwp/rhodes/rhodes.csproj
Expand Up @@ -22,7 +22,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.14393.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.14393.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Expand Down Expand Up @@ -71,6 +71,8 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DebugType>pdbonly</DebugType>
Expand Down Expand Up @@ -202,10 +204,10 @@
<SDKReference Include="Microsoft.VCLibs, Version=14.0">
<Name>Visual C++ 2015 Runtime for Universal Windows Platform Apps</Name>
</SDKReference>
<SDKReference Include="WindowsDesktop, Version=10.0.10586.0">
<SDKReference Include="WindowsDesktop, Version=10.0.14393.0">
<Name>Windows Desktop Extensions for the UWP</Name>
</SDKReference>
<SDKReference Include="WindowsIoT, Version=10.0.10586.0">
<SDKReference Include="WindowsIoT, Version=10.0.14393.0">
<Name>Windows IoT Extensions for the UWP</Name>
</SDKReference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion platform/uwp/rholib/rholib.vcxproj
Expand Up @@ -36,7 +36,7 @@
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10586.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down
2 changes: 1 addition & 1 deletion platform/uwp/rhoruntime/common/RhodesHelperWP8.h
Expand Up @@ -100,7 +100,7 @@ extern "C" {
}
#endif //__cplusplus

#if (defined(_WP8_LIB) || defined(_UWP_LIB)) && !defined(_WINRT_DLL)
#if defined(_UWP_LIB) && !defined(_WINRT_DLL)
#define CreateFileW Rho_CreateFileW
#define CreateFileA Rho_CreateFileW
#define CreateFile Rho_CreateFileW
Expand Down
2 changes: 1 addition & 1 deletion platform/uwp/rhoruntime/rhoruntime.cpp
Expand Up @@ -378,7 +378,7 @@ extern "C" void rho_title_change(const int tabIndex, const char* strTitle)

extern "C" const char* rho_native_rhopath()
{
return "rho/"; //rho/apps?
return "rho"; //rho/apps?
}


Expand Down

0 comments on commit c16f1d1

Please sign in to comment.