Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mika-f committed Jan 5, 2019
2 parents b14f498 + 07836f0 commit f6d703e
Show file tree
Hide file tree
Showing 22 changed files with 414 additions and 122 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "Source/Myst"]
path = Source/Myst
url = https://github.com/mika-f/Myst.git
[submodule "Source/VirtualDesktop"]
path = Source/VirtualDesktop
url = https://github.com/Grabacr07/VirtualDesktop.git
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# Robock

[![License](https://img.shields.io/github/license/mika-f/robock.svg?style=flat-square)](LICENSE)
[![AppVeyor branch](https://img.shields.io/appveyor/ci/mika-f/Robock/develop.svg?style=flat-square)](https://ci.appveyor.com/project/mika-f/robock)
[![GitHub release](https://img.shields.io/github/release/mika-f/Robock.svg?style=flat-square)](https://github.com/mika-f/Robock/releases/latest)
[![GitHub (pre-)release](https://img.shields.io/github/release/mika-f/Robock/all.svg?style=flat-square)](https://github.com/mika-f/Robock/releases/latest)


> Robock is experimental software. Please use it at your own risk.
Window Capture + Dynamic Wallpaper = Good Experience


## Video
## Demo

[![](https://img.youtube.com/vi/3HdT_-mdNBM/0.jpg)](https://www.youtube.com/watch?v=3HdT_-mdNBM)


## Requirements

* Windows 10 (1804 ~)
* Windows 10 (1803 ~)
* .NET Framework 4.7.2 ~
* DirectX 11 ~
* Video Card that supports Windows Display Driver Model
Expand Down
2 changes: 1 addition & 1 deletion Source/Myst
Submodule Myst updated from 0366a5 to 65508f
2 changes: 1 addition & 1 deletion Source/Robock.Background.Native/DxRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ HRESULT DxRenderer::LoadShader()
const auto width = static_cast<float>(this->_screenWidth);
SimpleVertex vertices[] =
{
{XMFLOAT3(-1.0f, -1.0f, 1.0f), XMFLOAT2(0, 1)},
{XMFLOAT3(-1.0f - (20 / width), -1.0f, 1.0f), XMFLOAT2(0, 1)},
{XMFLOAT3(-1.0f - (20 / width), 1.0f, 1.0f), XMFLOAT2(0, 0)},
{XMFLOAT3(1.0f, -1.0f, 1.0f), XMFLOAT2(1, 1)},
{XMFLOAT3(1.0f, 1.0f, 1.0f), XMFLOAT2(1, 0)}
Expand Down
23 changes: 17 additions & 6 deletions Source/Robock.Background/Robock.Background.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\Robock\bin\x64\Release\</OutputPath>
Expand All @@ -36,6 +37,7 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand All @@ -62,11 +64,11 @@
<Reference Include="Prism.Wpf, Version=6.3.0.0, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
<HintPath>..\packages\Prism.Wpf.6.3.0\lib\net45\Prism.Wpf.dll</HintPath>
</Reference>
<Reference Include="ReactiveProperty, Version=5.0.0.0, Culture=neutral, PublicKeyToken=910d1732782c71cb, processorArchitecture=MSIL">
<HintPath>..\packages\ReactiveProperty.5.1.1\lib\net461\ReactiveProperty.dll</HintPath>
<Reference Include="ReactiveProperty, Version=5.2.0.0, Culture=neutral, PublicKeyToken=910d1732782c71cb, processorArchitecture=MSIL">
<HintPath>..\packages\ReactiveProperty.5.3.2\lib\net461\ReactiveProperty.dll</HintPath>
</Reference>
<Reference Include="ReactiveProperty.NET46, Version=4.2.6746.33747, Culture=neutral, PublicKeyToken=3d1fed915120cbde, processorArchitecture=MSIL">
<HintPath>..\packages\ReactiveProperty.5.1.1\lib\net461\ReactiveProperty.NET46.dll</HintPath>
<Reference Include="ReactiveProperty.NET46, Version=5.3.1.0, Culture=neutral, PublicKeyToken=3d1fed915120cbde, processorArchitecture=MSIL">
<HintPath>..\packages\ReactiveProperty.5.3.2\lib\net461\ReactiveProperty.NET46.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
Expand All @@ -76,10 +78,19 @@
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Reactive, Version=4.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reactive.4.0.0\lib\net46\System.Reactive.dll</HintPath>
<Reference Include="System.Reactive, Version=4.1.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reactive.4.1.2\lib\net46\System.Reactive.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.ServiceModel" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Windows" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down
7 changes: 5 additions & 2 deletions Source/Robock.Background/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
<package id="Prism.Core" version="6.3.0" targetFramework="net472" />
<package id="Prism.Unity" version="6.3.0" targetFramework="net472" />
<package id="Prism.Wpf" version="6.3.0" targetFramework="net472" />
<package id="ReactiveProperty" version="5.1.1" targetFramework="net472" />
<package id="ReactiveProperty" version="5.3.2" targetFramework="net472" />
<package id="System.Collections" version="4.3.0" targetFramework="net472" />
<package id="System.ComponentModel.Annotations" version="4.5.0" targetFramework="net472" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net472" />
<package id="System.Reactive" version="4.0.0" targetFramework="net472" />
<package id="System.Reactive" version="4.1.2" targetFramework="net472" />
<package id="System.Reflection" version="4.3.0" targetFramework="net472" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.1" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
<package id="Unity" version="4.0.1" targetFramework="net472" />
</packages>
5 changes: 4 additions & 1 deletion Source/Robock.Shared/Robock.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
Expand All @@ -29,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
Expand Down Expand Up @@ -62,7 +64,6 @@
<Compile Include="Actions\DataContextDisposeAction.cs" />
<Compile Include="Models\IRobockBackgroundConnection.cs" />
<Compile Include="Extensions\IDisposableExtensions.cs" />
<Compile Include="Models\DesktopWindowManager.cs" />
<Compile Include="Models\RobockUtil.cs" />
<Compile Include="Models\Thumbnail.cs" />
<Compile Include="Mvvm\ViewModel.cs" />
Expand All @@ -75,7 +76,9 @@
<Compile Include="Win32\RECT.cs" />
<Compile Include="Win32\SendMessageTimeoutFlags.cs" />
<Compile Include="Win32\SetWindowPosFlags.cs" />
<Compile Include="Win32\ShowWindowCommands.cs" />
<Compile Include="Win32\TernaryRasterOperations.cs" />
<Compile Include="Win32\WINDOWPLACEMENT.cs" />
</ItemGroup>
<ItemGroup>
<Resource Include="Win32\README.txt" />
Expand Down
37 changes: 4 additions & 33 deletions Source/Robock.Shared/Win32/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,6 @@ public static class NativeMethods

#endregion

#region Gdi32

[DllImport("gdi32.dll", SetLastError = true)]
public static extern IntPtr CreateCompatibleDC(IntPtr hdc);

[DllImport("gdi32.dll")]
public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight);

[DllImport("gdi32.dll")]
public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hGdiObj);

[DllImport("gdi32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool BitBlt(IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, TernaryRasterOperations dwRop);

[DllImport("gdi32.dll")]
public static extern bool DeleteDC(IntPtr hdc);

[DllImport("gdi32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool DeleteObject(IntPtr hObject);

#endregion

#region Dwmapi

[DllImport("dwmapi.dll", SetLastError = true)]
Expand Down Expand Up @@ -92,15 +68,6 @@ public static class NativeMethods
[DllImport("user32.dll", SetLastError = true)]
public static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);

[DllImport("user32.dll")]
public static extern IntPtr GetDC(IntPtr hWnd);

[DllImport("user32.dll")]
public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, DeviceContextValues flags);

[DllImport("user32.dll")]
public static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDc);

[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

Expand All @@ -110,6 +77,10 @@ public static class NativeMethods
[DllImport("user32.dll", SetLastError = true)]
public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);

[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);

#endregion

#region Robock.Background.Native
Expand Down
90 changes: 90 additions & 0 deletions Source/Robock.Shared/Win32/ShowWindowCommands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// ReSharper disable FieldCanBeMadeReadOnly.Global
// ReSharper disable InconsistentNaming
// ReSharper disable MemberCanBePrivate.Global

namespace Robock.Shared.Win32
{
public enum ShowWindowCommands
{
/// <summary>
/// Hides the window and activates another window.
/// </summary>
Hide = 0,

/// <summary>
/// Activates and displays a window. If the window is minimized or
/// maximized, the system restores it to its original size and position.
/// An application should specify this flag when displaying the window
/// for the first time.
/// </summary>
Normal = 1,

/// <summary>
/// Activates the window and displays it as a minimized window.
/// </summary>
ShowMinimized = 2,

/// <summary>
/// Maximizes the specified window.
/// </summary>
Maximize = 3, // is this the right value?

/// <summary>
/// Activates the window and displays it as a maximized window.
/// </summary>
ShowMaximized = 3,

/// <summary>
/// Displays a window in its most recent size and position. This value
/// is similar to <see cref="Normal" />, except
/// the window is not activated.
/// </summary>
ShowNoActivate = 4,

/// <summary>
/// Activates the window and displays it in its current size and position.
/// </summary>
Show = 5,

/// <summary>
/// Minimizes the specified window and activates the next top-level
/// window in the Z order.
/// </summary>
Minimize = 6,

/// <summary>
/// Displays the window as a minimized window. This value is similar to
/// <see cref="ShowMinimized" />, except the
/// window is not activated.
/// </summary>
ShowMinNoActive = 7,

/// <summary>
/// Displays the window in its current size and position. This value is
/// similar to <see cref="Show" />, except the
/// window is not activated.
/// </summary>
ShowNA = 8,

/// <summary>
/// Activates and displays the window. If the window is minimized or
/// maximized, the system restores it to its original size and position.
/// An application should specify this flag when restoring a minimized window.
/// </summary>
Restore = 9,

/// <summary>
/// Sets the show state based on the SW_* value specified in the
/// STARTUPINFO structure passed to the CreateProcess function by the
/// program that started the application.
/// </summary>
ShowDefault = 10,

/// <summary>
/// <b>Windows 2000/XP:</b> Minimizes a window, even if the thread
/// that owns the window is not responding. This flag should only be
/// used when minimizing windows from a different thread.
/// </summary>
ForceMinimize = 11
}
}
62 changes: 62 additions & 0 deletions Source/Robock.Shared/Win32/WINDOWPLACEMENT.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System;
using System.Runtime.InteropServices;
using System.Windows;

// ReSharper disable FieldCanBeMadeReadOnly.Global
// ReSharper disable InconsistentNaming
// ReSharper disable MemberCanBePrivate.Global

namespace Robock.Shared.Win32
{
[Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct WINDOWPLACEMENT
{
/// <summary>
/// The length of the structure, in bytes. Before calling the GetWindowPlacement or SetWindowPlacement functions, set
/// this member to sizeof(WINDOWPLACEMENT).
/// <para>
/// GetWindowPlacement and SetWindowPlacement fail if this member is not set correctly.
/// </para>
/// </summary>
public int Length;

/// <summary>
/// Specifies flags that control the position of the minimized window and the method by which the window is restored.
/// </summary>
public int Flags;

/// <summary>
/// The current show state of the window.
/// </summary>
public ShowWindowCommands ShowCmd;

/// <summary>
/// The coordinates of the window's upper-left corner when the window is minimized.
/// </summary>
public Point MinPosition;

/// <summary>
/// The coordinates of the window's upper-left corner when the window is maximized.
/// </summary>
public Point MaxPosition;

/// <summary>
/// The window's coordinates when the window is in the restored position.
/// </summary>
public RECT NormalPosition;

/// <summary>
/// Gets the default (empty) value.
/// </summary>
public static WINDOWPLACEMENT Default
{
get
{
var result = new WINDOWPLACEMENT();
result.Length = Marshal.SizeOf(result);
return result;
}
}
}
}
2 changes: 1 addition & 1 deletion Source/Robock/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
Expand Down
7 changes: 6 additions & 1 deletion Source/Robock/Bootstrapper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Windows;
using System;
using System.Windows;

using WindowsDesktop;

using Microsoft.Practices.Unity;

Expand All @@ -12,6 +15,8 @@ internal class Bootstrapper : UnityBootstrapper
{
protected override DependencyObject CreateShell()
{
if (!VirtualDesktop.IsSupported)
throw new NotSupportedException();
return Container.Resolve<AppShell>();
}

Expand Down
Loading

0 comments on commit f6d703e

Please sign in to comment.