Merge pull request #4264 from jmarshallnz/scrollfix
authorjmarshallnz <jcmarsha@gmail.com>
Sun, 23 Feb 2014 19:00:23 +0000 (08:00 +1300)
committerjmarshallnz <jcmarsha@gmail.com>
Sun, 23 Feb 2014 19:00:23 +0000 (08:00 +1300)
[gui] scrolling text could be truncated

15 files changed:
addons/skin.confluence/720p/DialogSubtitles.xml
language/English/strings.po
system/settings/settings.xml
tools/Linux/xbmc.sh.in
xbmc/CueDocument.cpp
xbmc/CueDocument.h
xbmc/addons/AddonInstaller.cpp
xbmc/cores/VideoRenderers/WinRenderer.cpp
xbmc/guilib/GUIScrollBarControl.cpp
xbmc/input/SDLJoystick.cpp
xbmc/network/Network.cpp
xbmc/settings/lib/SettingsManager.cpp
xbmc/settings/lib/SettingsManager.h
xbmc/windowing/windows/WinSystemWin32.cpp
xbmc/windowing/windows/WinSystemWin32.h

index f63dd19..2124b24 100644 (file)
                                </control>
                                <control type="group" id="130">
                                        <control type="grouplist">
-                                               <left>20</left>
-                                               <top>660</top>
-                                               <width>305</width>
-                                               <height>40</height>
-                                               <align>right</align>
+                                               <left>50</left>
+                                               <top>659</top>
+                                               <width>605</width>
+                                               <height>30</height>
                                                <orientation>horizontal</orientation>
                                                <itemgap>5</itemgap>
                                                <control type="image">
-                                                       <width>40</width>
-                                                       <height>40</height>
+                                                       <width>30</width>
+                                                       <height>30</height>
                                                        <texture>DefaultIconInfo.png</texture>
                                                </control>
                                                <control type="label">
                                                        <description>notification</description>
-                                                       <width min="10" max="260">auto</width>
-                                                       <height>40</height>
+                                                       <width min="10" max="560">auto</width>
+                                                       <height>30</height>
                                                        <font>font13</font>
                                                        <textcolor>white</textcolor>
-                                                       <label>31413</label>
+                                                       <label>$LOCALIZE[31413]</label>
                                                        <aligny>center</aligny>
-                                                       <wrapmultiline>true</wrapmultiline>
                                                </control>
                                        </control>
                                </control>
index ba434d9..313e9b6 100755 (executable)
@@ -11832,9 +11832,10 @@ msgctxt "#24022"
 msgid "Enable"
 msgstr ""
 
+#. Defines the state of the add-on in the add-on manager window
 #: xbmc/filesystem/AddonsDirectory.cpp
 msgctxt "#24023"
-msgid "Add-on disabled"
+msgid "Disabled"
 msgstr ""
 
 #empty strings from id 24024 to 24026
index 45e8167..51ebd16 100644 (file)
       <requirement>HAS_ZEROCONF</requirement>
       <group id="1">
         <setting id="services.zeroconf" type="boolean" label="1260" help="36342">
-          <level>2</level>
+          <level>1</level>
           <default>true</default>
           <control type="toggle" />
         </setting>
index 2bead97..db99670 100644 (file)
@@ -23,6 +23,7 @@ prefix="@prefix@"
 exec_prefix="@exec_prefix@"
 datarootdir="@datarootdir@"
 LIBDIR="@libdir@"
+CRASHLOG_DIR=${CRASHLOG_DIR:-$HOME}
 
 # Check for some options used by this script
 while [ "$#" -gt "0" ]
@@ -52,7 +53,7 @@ single_stacktrace()
 
 print_crash_report()
 {
-  FILE="$HOME/xbmc_crashlog-`date +%Y%m%d_%H%M%S`.log"
+  FILE="$CRASHLOG_DIR/xbmc_crashlog-`date +%Y%m%d_%H%M%S`.log"
   echo "############## XBMC CRASH LOG ###############" >> $FILE
   echo >> $FILE
   echo "################ SYSTEM INFO ################" >> $FILE
index f72f51c..5619054 100644 (file)
@@ -127,25 +127,16 @@ bool CCueDocument::Parse(const CStdString &strFile)
     else if (StringUtils::StartsWithNoCase(strLine,"TITLE"))
     {
       if (m_iTotalTracks == -1) // No tracks yet
-        ExtractQuoteInfo(strLine, m_strAlbum);
-      else if (!ExtractQuoteInfo(strLine, m_Track[m_iTotalTracks].strTitle))
-      {
-        // lets manage tracks titles without quotes
-        CStdString titleNoQuote = strLine.substr(5);
-        StringUtils::TrimLeft(titleNoQuote);
-        if (!titleNoQuote.empty())
-        {
-          g_charsetConverter.unknownToUTF8(titleNoQuote);
-          m_Track[m_iTotalTracks].strTitle = titleNoQuote;
-        }
-      }
+        m_strAlbum = ExtractInfo(strLine.substr(5));
+      else
+        m_Track[m_iTotalTracks].strTitle = ExtractInfo(strLine.substr(5));
     }
     else if (StringUtils::StartsWithNoCase(strLine,"PERFORMER"))
     {
       if (m_iTotalTracks == -1) // No tracks yet
-        ExtractQuoteInfo(strLine, m_strArtist);
+        m_strArtist = ExtractInfo(strLine.substr(9));
       else // New Artist for this track
-        ExtractQuoteInfo(strLine, m_Track[m_iTotalTracks].strArtist);
+        m_Track[m_iTotalTracks].strArtist = ExtractInfo(strLine.substr(9));
     }
     else if (StringUtils::StartsWithNoCase(strLine,"TRACK"))
     {
@@ -176,7 +167,7 @@ bool CCueDocument::Parse(const CStdString &strFile)
       if(strCurrentFile.size() > 0)
         bCurrentFileChanged = true;
 
-      ExtractQuoteInfo(strLine, strCurrentFile);
+      strCurrentFile = ExtractInfo(strLine.substr(4));
 
       // Resolve absolute paths (if needed).
       if (strCurrentFile.length() > 0)
@@ -190,16 +181,7 @@ bool CCueDocument::Parse(const CStdString &strFile)
     }
     else if (StringUtils::StartsWithNoCase(strLine,"REM GENRE"))
     {
-      if (!ExtractQuoteInfo(strLine, m_strGenre))
-      {
-        CStdString genreNoQuote = strLine.substr(9);
-        StringUtils::TrimLeft(genreNoQuote);
-        if (!genreNoQuote.empty())
-        {
-          g_charsetConverter.unknownToUTF8(genreNoQuote);
-          m_strGenre = genreNoQuote;
-        }
-      }
+      m_strGenre = ExtractInfo(strLine.substr(9));
     }
     else if (StringUtils::StartsWithNoCase(strLine,"REM REPLAYGAIN_ALBUM_GAIN"))
       m_replayGainAlbumGain = (float)atof(strLine.substr(26).c_str());
@@ -299,19 +281,26 @@ bool CCueDocument::ReadNextLine(CStdString &szLine)
 }
 
 ////////////////////////////////////////////////////////////////////////////////////
-// Function: ExtractQuoteInfo()
+// Function: ExtractInfo()
 // Extracts the information in quotes from the string line, returning it in quote
 ////////////////////////////////////////////////////////////////////////////////////
-bool CCueDocument::ExtractQuoteInfo(const CStdString &line, CStdString &quote)
+CStdString CCueDocument::ExtractInfo(const CStdString &line)
 {
-  quote.clear();
   size_t left = line.find('\"');
-  if (left == std::string::npos) return false;
-  size_t right = line.find('\"', left + 1);
-  if (right == std::string::npos) return false;
-  quote = line.substr(left + 1, right - left - 1);
-  g_charsetConverter.unknownToUTF8(quote);
-  return true;
+  if (left != std::string::npos)
+  {
+    size_t right = line.find('\"', left + 1);
+    if (right != std::string::npos)
+    {
+      CStdString text = line.substr(left + 1, right - left - 1);
+      g_charsetConverter.unknownToUTF8(text);
+      return text;
+    }
+  }
+  CStdString text = line;
+  StringUtils::Trim(text);
+  g_charsetConverter.unknownToUTF8(text);
+  return text;
 }
 
 ////////////////////////////////////////////////////////////////////////////////////
index 01d28e7..650ffd2 100644 (file)
@@ -79,7 +79,7 @@ private:
   std::vector<CCueTrack> m_Track;
 
   bool ReadNextLine(CStdString &strLine);
-  bool ExtractQuoteInfo(const CStdString &line, CStdString &quote);
+  CStdString ExtractInfo(const CStdString &line);
   int ExtractTimeFromIndex(const CStdString &index);
   int ExtractNumericInfo(const CStdString &info);
   bool ResolvePath(CStdString &strPath, const CStdString &strBase);
index ccc8fdf..e87d299 100644 (file)
@@ -733,7 +733,10 @@ void CAddonInstallJob::OnPostInstall(bool reloadAddon)
         toast->ResetTimer();
         toast->Close(true);
       }
-      CSettings::Get().SetString("lookandfeel.skin",m_addon->ID().c_str());
+      if (CSettings::Get().GetString("lookandfeel.skin") == m_addon->ID())
+        CApplicationMessenger::Get().ExecBuiltIn("ReloadSkin", true);
+      else
+        CSettings::Get().SetString("lookandfeel.skin",m_addon->ID().c_str());
     }
   }
 
index 6c16a97..48794a7 100644 (file)
@@ -140,10 +140,11 @@ void CWinRenderer::SelectRenderMethod()
   {
     CLog::Log(LOGNOTICE, "D3D: rendering method forced to DXVA processor");
     m_renderMethod = RENDER_DXVA;
-    if (!m_processor->Open(m_sourceWidth, m_sourceHeight, m_iFlags, m_format, m_extended_format))
+    if (!m_processor || !m_processor->Open(m_sourceWidth, m_sourceHeight, m_iFlags, m_format, m_extended_format))
     {
       CLog::Log(LOGNOTICE, "D3D: unable to open DXVA processor");
-      m_processor->Close();
+      if (m_processor)  
+        m_processor->Close();
       m_renderMethod = RENDER_INVALID;
     }
   }
@@ -155,13 +156,16 @@ void CWinRenderer::SelectRenderMethod()
     {
       case RENDER_METHOD_DXVAHD:
       case RENDER_METHOD_DXVA:
-        m_renderMethod = RENDER_DXVA;
-        if (m_processor->Open(m_sourceWidth, m_sourceHeight, m_iFlags, m_format, m_extended_format))
-            break;
-        else
+        if (!m_processor || !m_processor->Open(m_sourceWidth, m_sourceHeight, m_iFlags, m_format, m_extended_format))
         {
           CLog::Log(LOGNOTICE, "D3D: unable to open DXVA processor");
-          m_processor->Close();
+          if (m_processor)
+            m_processor->Close();
+        }
+        else
+        {
+          m_renderMethod = RENDER_DXVA;
+          break;
         }
       // Drop through to pixel shader
       case RENDER_METHOD_AUTO:
@@ -397,8 +401,9 @@ unsigned int CWinRenderer::PreInit()
 
   m_iRequestedMethod = CSettings::Get().GetInt("videoplayer.rendermethod");
 
-  if (g_advancedSettings.m_DXVAForceProcessorRenderer || m_iRequestedMethod == RENDER_METHOD_DXVA
-      || m_iRequestedMethod == RENDER_METHOD_DXVAHD)
+  if (g_advancedSettings.m_DXVAForceProcessorRenderer
+  ||  m_iRequestedMethod == RENDER_METHOD_DXVA
+  ||  m_iRequestedMethod == RENDER_METHOD_DXVAHD)
   {
     if (m_iRequestedMethod != RENDER_METHOD_DXVA && CSysInfo::IsWindowsVersionAtLeast(CSysInfo::WindowsVersionWin7))
     {
@@ -407,29 +412,30 @@ unsigned int CWinRenderer::PreInit()
       {
         CLog::Log(LOGNOTICE, "CWinRenderer::Preinit - could not init DXVA-HD processor - skipping");
         SAFE_DELETE(m_processor);
-        m_processor = new DXVA::CProcessor();
       }
-      else
-        return 0;
     }
-    else
+    if (!m_processor)
+    {
       m_processor = new DXVA::CProcessor();
-
-    if (!m_processor->PreInit())
-      CLog::Log(LOGNOTICE, "CWinRenderer::Preinit - could not init DXVA2 processor - skipping");
-    else
-      return 0;
+      if (!m_processor->PreInit())
+      {
+        CLog::Log(LOGNOTICE, "CWinRenderer::Preinit - could not init DXVA2 processor - skipping");
+        SAFE_DELETE(m_processor);
+      }
+    }
   }
-  
-  if (g_Windowing.IsTextureFormatOk(D3DFMT_L16, 0))
+  // allow other color spaces besides YV12 in case DXVA rendering is not used or not available
+  if (!m_processor || (m_iRequestedMethod != RENDER_METHOD_DXVA && m_iRequestedMethod != RENDER_METHOD_DXVAHD))
   {
-    m_formats.push_back(RENDER_FMT_YUV420P10);
-    m_formats.push_back(RENDER_FMT_YUV420P16);
+    if (g_Windowing.IsTextureFormatOk(D3DFMT_L16, 0))
+    {
+      m_formats.push_back(RENDER_FMT_YUV420P10);
+      m_formats.push_back(RENDER_FMT_YUV420P16);
+    }
+    m_formats.push_back(RENDER_FMT_NV12);
+    m_formats.push_back(RENDER_FMT_YUYV422);
+    m_formats.push_back(RENDER_FMT_UYVY422);
   }
-  m_formats.push_back(RENDER_FMT_NV12);
-  m_formats.push_back(RENDER_FMT_YUYV422);
-  m_formats.push_back(RENDER_FMT_UYVY422);
-
   return 0;
 }
 
index 20715a9..2fb40e3 100644 (file)
@@ -286,13 +286,13 @@ void CGUIScrollBar::SetFromPosition(const CPoint &point)
 {
   float fPercent;
   if (m_orientation == VERTICAL)
-    fPercent = (point.y - m_guiBackground.GetYPosition() - 0.5f*m_guiBarFocus.GetHeight()) / m_guiBackground.GetHeight();
+    fPercent = (point.y - m_guiBackground.GetYPosition() - 0.5f*m_guiBarFocus.GetHeight()) / (m_guiBackground.GetHeight() - m_guiBarFocus.GetHeight());
   else
-    fPercent = (point.x - m_guiBackground.GetXPosition() - 0.5f*m_guiBarFocus.GetWidth()) / m_guiBackground.GetWidth();
+    fPercent = (point.x - m_guiBackground.GetXPosition() - 0.5f*m_guiBarFocus.GetWidth()) / (m_guiBackground.GetWidth() - m_guiBarFocus.GetWidth());
   if (fPercent < 0) fPercent = 0;
   if (fPercent > 1) fPercent = 1;
 
-  int offset = (int)(floor(fPercent * m_numItems + 0.5f));
+  int offset = (int)(floor(fPercent * (m_numItems - m_pageSize) + 0.5f));
 
   if (m_offset != offset)
   {
index 0334178..e1ff570 100644 (file)
@@ -115,11 +115,16 @@ void CJoystick::Initialize()
         // Details: Total Axis: 37 Total Hats: 0 Total Buttons: 57
         // NOTICE: Enabled Joystick: Microsoft Microsoft® 2.4GHz Transceiver v6.0
         // Details: Total Axis: 37 Total Hats: 0 Total Buttons: 57
+        // also checks if we have at least 1 button, fixes 
+        // NOTICE: Enabled Joystick: ST LIS3LV02DL Accelerometer
+        // Details: Total Axis: 3 Total Hats: 0 Total Buttons: 0
         int num_axis = SDL_JoystickNumAxes(joy);
         int num_buttons = SDL_JoystickNumButtons(joy);
-        if (num_axis > 20 && num_buttons > 50)
-          CLog::Log(LOGNOTICE, "Your Joystick seems to be a Keyboard, ignoring it: %s Axis: %d Buttons: %d", 
-            SDL_JoystickName(i), num_axis, num_buttons);
+        if ((num_axis > 20 && num_buttons > 50) || num_buttons == 0)
+        {
+          CLog::Log(LOGNOTICE, "Ignoring Joystick %s Axis: %d Buttons: %d: invalid device properties",
+           SDL_JoystickName(i), num_axis, num_buttons);
+        }
         else
         {
           m_JoystickNames.push_back(string(SDL_JoystickName(i)));
index 9f7a2cc..0d98f9f 100644 (file)
@@ -29,6 +29,7 @@
 #ifdef TARGET_WINDOWS
 #include "utils/SystemInfo.h"
 #include "win32/WIN32Util.h"
+#include "utils/CharsetConverter.h"
 #endif
 
 /* slightly modified in_ether taken from the etherboot project (http://sourceforge.net/projects/etherboot) */
@@ -162,8 +163,14 @@ CStdString CNetwork::GetHostName(void)
   char hostName[128];
   if (gethostname(hostName, sizeof(hostName)))
     return CStdString("unknown");
-  else
-    return CStdString(hostName);
+
+  std::string hostStr;
+#ifdef TARGET_WINDOWS
+  g_charsetConverter.systemToUtf8(hostName, hostStr);
+#else
+  hostStr = hostName;
+#endif
+  return hostStr;
 }
 
 CNetworkInterface* CNetwork::GetFirstConnectedInterface()
index b2255cb..53334bd 100644 (file)
@@ -860,6 +860,13 @@ bool CSettingsManager::OnSettingsLoading()
   return true;
 }
 
+void CSettingsManager::OnSettingsUnloaded()
+{
+  CSharedLock lock(m_critical);
+  for (SettingsHandlers::const_iterator it = m_settingsHandlers.begin(); it != m_settingsHandlers.end(); ++it)
+    (*it)->OnSettingsUnloaded();
+}
+
 void CSettingsManager::OnSettingsLoaded()
 {
   CSharedLock lock(m_critical);
index ee6c774..30a997f 100644 (file)
@@ -393,6 +393,7 @@ private:
   // implementation of ISettingsHandler
   virtual bool OnSettingsLoading();
   virtual void OnSettingsLoaded();
+  virtual void OnSettingsUnloaded();
   virtual bool OnSettingsSaving() const;
   virtual void OnSettingsSaved() const;
   virtual void OnSettingsCleared();
index d2e13c9..4391de3 100644 (file)
@@ -26,6 +26,7 @@
 #include "settings/DisplaySettings.h"
 #include "settings/Settings.h"
 #include "utils/log.h"
+#include "utils/CharsetConverter.h"
 
 #ifdef TARGET_WINDOWS
 #include <tpcshrd.h>
@@ -356,10 +357,10 @@ RECT CWinSystemWin32::ScreenRect(int screen)
 {
   const MONITOR_DETAILS &details = GetMonitor(screen);
 
-  DEVMODE sDevMode;
+  DEVMODEW sDevMode;
   ZeroMemory(&sDevMode, sizeof(DEVMODE));
   sDevMode.dmSize = sizeof(DEVMODE);
-  if(!EnumDisplaySettings(details.DeviceName, ENUM_CURRENT_SETTINGS, &sDevMode))
+  if(!EnumDisplaySettingsW(details.DeviceNameW.c_str(), ENUM_CURRENT_SETTINGS, &sDevMode))
     CLog::Log(LOGERROR, "%s : EnumDisplaySettings failed with %d", __FUNCTION__, GetLastError());
 
   RECT rc;
@@ -443,12 +444,12 @@ bool CWinSystemWin32::ChangeResolution(RESOLUTION_INFO res)
 {
   const MONITOR_DETAILS &details = GetMonitor(res.iScreen);
 
-  DEVMODE sDevMode;
+  DEVMODEW sDevMode;
   ZeroMemory(&sDevMode, sizeof(DEVMODE));
   sDevMode.dmSize = sizeof(DEVMODE);
 
   // If we can't read the current resolution or any detail of the resolution is different than res
-  if (!EnumDisplaySettings(details.DeviceName, ENUM_CURRENT_SETTINGS, &sDevMode) ||
+  if (!EnumDisplaySettingsW(details.DeviceNameW.c_str(), ENUM_CURRENT_SETTINGS, &sDevMode) ||
       sDevMode.dmPelsWidth != res.iWidth || sDevMode.dmPelsHeight != res.iHeight ||
       sDevMode.dmDisplayFrequency != (int)res.fRefreshRate ||
       ((sDevMode.dmDisplayFlags & DM_INTERLACED) && !(res.dwFlags & D3DPRESENTFLAG_INTERLACED)) ||
@@ -465,7 +466,7 @@ bool CWinSystemWin32::ChangeResolution(RESOLUTION_INFO res)
 
     // CDS_FULLSCREEN is for temporary fullscreen mode and prevents icons and windows from moving
     // to fit within the new dimensions of the desktop
-    LONG rc = ChangeDisplaySettingsEx(details.DeviceName, &sDevMode, NULL, CDS_FULLSCREEN, NULL);
+    LONG rc = ChangeDisplaySettingsExW(details.DeviceNameW.c_str(), &sDevMode, NULL, CDS_FULLSCREEN, NULL);
     if (rc != DISP_CHANGE_SUCCESSFUL)
     {
       CLog::Log(LOGERROR, "%s : ChangeDisplaySettingsEx failed with %d", __FUNCTION__, rc);
@@ -540,10 +541,10 @@ void CWinSystemWin32::UpdateResolutions()
   {
     for(int mode = 0;; mode++)
     {
-      DEVMODE devmode;
+      DEVMODEW devmode;
       ZeroMemory(&devmode, sizeof(devmode));
       devmode.dmSize = sizeof(devmode);
-      if(EnumDisplaySettings(m_MonitorsInfo[monitor].DeviceName, mode, &devmode) == 0)
+      if(EnumDisplaySettingsW(m_MonitorsInfo[monitor].DeviceNameW.c_str(), mode, &devmode) == 0)
         break;
       if(devmode.dmBitsPerPel != 32)
         continue;
@@ -583,25 +584,25 @@ void CWinSystemWin32::AddResolution(const RESOLUTION_INFO &res)
 bool CWinSystemWin32::UpdateResolutionsInternal()
 {
 
-  DISPLAY_DEVICE ddAdapter;
+  DISPLAY_DEVICEW ddAdapter;
   ZeroMemory(&ddAdapter, sizeof(ddAdapter));
   ddAdapter.cb = sizeof(ddAdapter);
   DWORD adapter = 0;
 
-  while (EnumDisplayDevices(NULL, adapter, &ddAdapter, 0))
+  while (EnumDisplayDevicesW(NULL, adapter, &ddAdapter, 0))
   {
     // Exclude displays that are not part of the windows desktop. Using them is too different: no windows,
     // direct access with GDI CreateDC() or DirectDraw for example. So it may be possible to play video, but GUI?
     if (!(ddAdapter.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) && (ddAdapter.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP))
     {
-      DISPLAY_DEVICE ddMon;
+      DISPLAY_DEVICEW ddMon;
       ZeroMemory(&ddMon, sizeof(ddMon));
       ddMon.cb = sizeof(ddMon);
       bool foundScreen = false;
       DWORD screen = 0;
 
       // Just look for the first active output, we're actually only interested in the information at the adapter level.
-      while (EnumDisplayDevices(ddAdapter.DeviceName, screen, &ddMon, 0))
+      while (EnumDisplayDevicesW(ddAdapter.DeviceName, screen, &ddMon, 0))
       {
         if (ddMon.StateFlags & (DISPLAY_DEVICE_ACTIVE | DISPLAY_DEVICE_ATTACHED))
         {
@@ -615,33 +616,35 @@ bool CWinSystemWin32::UpdateResolutionsInternal()
       // Remoting returns no screens. Handle with a dummy screen.
       if (!foundScreen && screen == 0)
       {
-        lstrcpy(ddMon.DeviceString, _T("Dummy Monitor")); // safe: large static array
+        lstrcpyW(ddMon.DeviceString, L"Dummy Monitor"); // safe: large static array
         foundScreen = true;
       }
 
       if (foundScreen)
       {
-        CLog::Log(LOGNOTICE, "Found screen: %s on %s, adapter %d.", ddMon.DeviceString, ddAdapter.DeviceString, adapter);
+        std::string monitorStr, adapterStr;
+        g_charsetConverter.wToUTF8(ddMon.DeviceString, monitorStr);
+        g_charsetConverter.wToUTF8(ddAdapter.DeviceString, adapterStr);
+        CLog::Log(LOGNOTICE, "Found screen: %s on %s, adapter %d.", monitorStr.c_str(), adapterStr.c_str(), adapter);
 
         // get information about the display's current position and display mode
         // TODO: for Windows 7/Server 2008 and up, Microsoft recommends QueryDisplayConfig() instead, the API used by the control panel.
-        DEVMODE dm;
+        DEVMODEW dm;
         ZeroMemory(&dm, sizeof(dm));
         dm.dmSize = sizeof(dm);
-        if (EnumDisplaySettingsEx(ddAdapter.DeviceName, ENUM_CURRENT_SETTINGS, &dm, 0) == FALSE)
-          EnumDisplaySettingsEx(ddAdapter.DeviceName, ENUM_REGISTRY_SETTINGS, &dm, 0);
+        if (EnumDisplaySettingsExW(ddAdapter.DeviceName, ENUM_CURRENT_SETTINGS, &dm, 0) == FALSE)
+          EnumDisplaySettingsExW(ddAdapter.DeviceName, ENUM_REGISTRY_SETTINGS, &dm, 0);
 
         // get the monitor handle and workspace
         HMONITOR hm = 0;
         POINT pt = { dm.dmPosition.x, dm.dmPosition.y };
         hm = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL);
 
-        MONITOR_DETAILS md;
-        memset(&md, 0, sizeof(MONITOR_DETAILS));
+        MONITOR_DETAILS md = {};
 
-        strcpy(md.MonitorName, ddMon.DeviceString);
-        strcpy(md.CardName, ddAdapter.DeviceString);
-        strcpy(md.DeviceName, ddAdapter.DeviceName);
+        md.MonitorNameW = ddMon.DeviceString;
+        md.CardNameW = ddAdapter.DeviceString;
+        md.DeviceNameW = ddAdapter.DeviceName;
 
         // width x height @ x,y - bpp - refresh rate
         // note that refresh rate information is not available on Win9x
index 836eba7..245d84c 100644 (file)
@@ -22,6 +22,7 @@
 #define WINDOW_SYSTEM_WIN32_H
 
 #include "windowing/WinSystem.h"
+#include <string>
 
 struct MONITOR_DETAILS
 {
@@ -33,9 +34,9 @@ struct MONITOR_DETAILS
   bool      Interlaced;
 
   HMONITOR  hMonitor;
-  char      MonitorName[128];
-  char      CardName[128];
-  char      DeviceName[128];
+  std::wstring MonitorNameW;
+  std::wstring CardNameW;
+  std::wstring DeviceNameW;
   int       ScreenNumber; // XBMC POV, not Windows. Windows primary is XBMC #0, then each secondary is +1.
 };