home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
Improvement Suggestions
Run on secondary monitor
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="webrant" data-source="post: 100350" data-attributes="member: 28328"><p>I made some small changes to be able to specify which monitor to use.</p><p>Save code content into secondarymonitorpatch.patch and apply it.</p><p>You also have to specify monitor to use under general section in mediaportal.xml</p><p> <entry name="monitor">1</entry></p><p>Search for loglevel to get the correct position.</p><p>Works for me atleast ;-)</p><p></p><p>[code]</p><p>Index: d3dapp.cs</p><p>===================================================================</p><p>--- d3dapp.cs (revision 12447)</p><p>+++ d3dapp.cs (working copy)</p><p>@@ -79,6 +79,8 @@</p><p> </p><p> #endregion</p><p> </p><p>+ protected int monitor = -1;</p><p>+</p><p> protected bool _minimizeOnStartup = false; // Minimize to tray on startup and on gui exit</p><p> protected bool _minimizeOnGuiExit = false;</p><p> protected bool _shuttingDown = false;</p><p>@@ -314,7 +316,9 @@</p><p> frameStats = null;</p><p> </p><p> this.Text = "D3D9 Sample";</p><p>+</p><p> this.ClientSize = new Size(720, 576);</p><p>+ </p><p> this.KeyPreview = true;</p><p> </p><p> minDepthBits = 16;</p><p>@@ -428,9 +432,18 @@</p><p> this.MaximizeBox = false;</p><p> this.MinimizeBox = false;</p><p> this.Menu = null;</p><p>- this.Location = new Point(0, 0);</p><p>- this.Bounds = new Rectangle(0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);</p><p>- this.ClientSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);</p><p>+</p><p>+ if (this.monitor >= 0)</p><p>+ {</p><p>+ this.Bounds = Screen.AllScreens[this.monitor].Bounds;</p><p>+ }</p><p>+ else</p><p>+ {</p><p>+ this.Location = new Point(0, 0);</p><p>+ this.Bounds = new Rectangle(0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);</p><p>+ this.ClientSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);</p><p>+</p><p>+ }</p><p> //GUIGraphicsContext.DX9Device.PresentationParameters.BackBufferWidth=Screen.PrimaryScreen.Bounds.Width;</p><p> //GUIGraphicsContext.DX9Device.PresentationParameters.BackBufferHeight=Screen.PrimaryScreen.Bounds.Height;</p><p> Log.Info("D3D: Client size: {0}x{1} - Screen: {2}x{3}",</p><p>@@ -482,6 +495,9 @@</p><p> // Get display mode of primary adapter (which is assumed to be where the window </p><p> // will appear)</p><p> DisplayMode primaryDesktopDisplayMode = Manager.Adapters[0].CurrentDisplayMode;</p><p>+ </p><p>+ if (this.monitor >= 0)</p><p>+ primaryDesktopDisplayMode = Manager.Adapters[this.monitor].CurrentDisplayMode;</p><p> </p><p> GraphicsAdapterInfo bestAdapterInfo = null;</p><p> GraphicsDeviceInfo bestDeviceInfo = null;</p><p>@@ -489,6 +505,12 @@</p><p> </p><p> foreach (GraphicsAdapterInfo adapterInfo in enumerationSettings.AdapterInfoList)</p><p> {</p><p>+ if (this.monitor >= 0)</p><p>+ {</p><p>+ if (!Screen.AllScreens[this.monitor].DeviceName.StartsWith(adapterInfo.AdapterDetails.DeviceName))</p><p>+ continue;</p><p>+ }</p><p>+</p><p> foreach (GraphicsDeviceInfo deviceInfo in adapterInfo.DeviceInfoList)</p><p> {</p><p> if (doesRequireHardware && deviceInfo.DevType != DeviceType.Hardware)</p><p>@@ -587,6 +609,12 @@</p><p> </p><p> foreach (GraphicsAdapterInfo adapterInfo in enumerationSettings.AdapterInfoList)</p><p> {</p><p>+ if (this.monitor >= 0)</p><p>+ {</p><p>+ if (!Screen.AllScreens[this.monitor].DeviceName.StartsWith(adapterInfo.AdapterDetails.DeviceName))</p><p>+ continue;</p><p>+ }</p><p>+</p><p> adapterDesktopDisplayMode = Manager.Adapters[adapterInfo.AdapterOrdinal].CurrentDisplayMode;</p><p> foreach (GraphicsDeviceInfo deviceInfo in adapterInfo.DeviceInfoList)</p><p> {</p><p>@@ -1737,9 +1765,17 @@</p><p> this.MaximizeBox = false;</p><p> this.MinimizeBox = false;</p><p> this.Menu = null;</p><p>- this.Location = new Point(0, 0);</p><p>- this.Bounds = new Rectangle(0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);</p><p>- this.ClientSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);</p><p>+</p><p>+ if (this.monitor >= 0)</p><p>+ {</p><p>+ this.Bounds = Screen.AllScreens[this.monitor].Bounds;</p><p>+ }</p><p>+ else</p><p>+ {</p><p>+ this.Location = new Point(0, 0);</p><p>+ this.Bounds = new Rectangle(0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);</p><p>+ this.ClientSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);</p><p>+ }</p><p> this.Update();</p><p> </p><p> Log.Info("D3D: Switching windowed mode -> fullscreen done - Maximized: {0}", isMaximized);</p><p>Index: MediaPortal.cs</p><p>===================================================================</p><p>--- MediaPortal.cs (revision 12447)</p><p>+++ MediaPortal.cs (working copy)</p><p>@@ -464,6 +464,7 @@</p><p> {</p><p> useScreenSaver = xmlreader.GetValueAsBool("general", "screensaver", true);</p><p> timeScreenSaver = xmlreader.GetValueAsInt("general", "screensavertime", 60);</p><p>+ this.monitor = xmlreader.GetValueAsInt("general", "monitor", -1);</p><p> clientSizeX = xmlreader.GetValueAsInt("general", "sizex", clientSizeX);</p><p> clientSizeY = xmlreader.GetValueAsInt("general", "sizey", clientSizeY);</p><p> //GUIGraphicsContext.UseSeparateRenderThread = xmlreader.GetValueAsBool("general", "userenderthread", true);</p><p>@@ -525,6 +526,11 @@</p><p> DoStartupJobs();</p><p> // startThread.Priority = ThreadPriority.BelowNormal;</p><p> // startThread.Start();</p><p>+</p><p>+ if (this.monitor >= 0)</p><p>+ {</p><p>+ this.Bounds = Screen.AllScreens[this.monitor].Bounds;</p><p>+ }</p><p> }</p><p> </p><p> private void MediaPortalApp_Deactivate(object sender, EventArgs e)</p><p>[/code]</p></blockquote><p></p>
[QUOTE="webrant, post: 100350, member: 28328"] I made some small changes to be able to specify which monitor to use. Save code content into secondarymonitorpatch.patch and apply it. You also have to specify monitor to use under general section in mediaportal.xml <entry name="monitor">1</entry> Search for loglevel to get the correct position. Works for me atleast ;-) [code] Index: d3dapp.cs =================================================================== --- d3dapp.cs (revision 12447) +++ d3dapp.cs (working copy) @@ -79,6 +79,8 @@ #endregion + protected int monitor = -1; + protected bool _minimizeOnStartup = false; // Minimize to tray on startup and on gui exit protected bool _minimizeOnGuiExit = false; protected bool _shuttingDown = false; @@ -314,7 +316,9 @@ frameStats = null; this.Text = "D3D9 Sample"; + this.ClientSize = new Size(720, 576); + this.KeyPreview = true; minDepthBits = 16; @@ -428,9 +432,18 @@ this.MaximizeBox = false; this.MinimizeBox = false; this.Menu = null; - this.Location = new Point(0, 0); - this.Bounds = new Rectangle(0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); - this.ClientSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); + + if (this.monitor >= 0) + { + this.Bounds = Screen.AllScreens[this.monitor].Bounds; + } + else + { + this.Location = new Point(0, 0); + this.Bounds = new Rectangle(0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); + this.ClientSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); + + } //GUIGraphicsContext.DX9Device.PresentationParameters.BackBufferWidth=Screen.PrimaryScreen.Bounds.Width; //GUIGraphicsContext.DX9Device.PresentationParameters.BackBufferHeight=Screen.PrimaryScreen.Bounds.Height; Log.Info("D3D: Client size: {0}x{1} - Screen: {2}x{3}", @@ -482,6 +495,9 @@ // Get display mode of primary adapter (which is assumed to be where the window // will appear) DisplayMode primaryDesktopDisplayMode = Manager.Adapters[0].CurrentDisplayMode; + + if (this.monitor >= 0) + primaryDesktopDisplayMode = Manager.Adapters[this.monitor].CurrentDisplayMode; GraphicsAdapterInfo bestAdapterInfo = null; GraphicsDeviceInfo bestDeviceInfo = null; @@ -489,6 +505,12 @@ foreach (GraphicsAdapterInfo adapterInfo in enumerationSettings.AdapterInfoList) { + if (this.monitor >= 0) + { + if (!Screen.AllScreens[this.monitor].DeviceName.StartsWith(adapterInfo.AdapterDetails.DeviceName)) + continue; + } + foreach (GraphicsDeviceInfo deviceInfo in adapterInfo.DeviceInfoList) { if (doesRequireHardware && deviceInfo.DevType != DeviceType.Hardware) @@ -587,6 +609,12 @@ foreach (GraphicsAdapterInfo adapterInfo in enumerationSettings.AdapterInfoList) { + if (this.monitor >= 0) + { + if (!Screen.AllScreens[this.monitor].DeviceName.StartsWith(adapterInfo.AdapterDetails.DeviceName)) + continue; + } + adapterDesktopDisplayMode = Manager.Adapters[adapterInfo.AdapterOrdinal].CurrentDisplayMode; foreach (GraphicsDeviceInfo deviceInfo in adapterInfo.DeviceInfoList) { @@ -1737,9 +1765,17 @@ this.MaximizeBox = false; this.MinimizeBox = false; this.Menu = null; - this.Location = new Point(0, 0); - this.Bounds = new Rectangle(0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); - this.ClientSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); + + if (this.monitor >= 0) + { + this.Bounds = Screen.AllScreens[this.monitor].Bounds; + } + else + { + this.Location = new Point(0, 0); + this.Bounds = new Rectangle(0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); + this.ClientSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); + } this.Update(); Log.Info("D3D: Switching windowed mode -> fullscreen done - Maximized: {0}", isMaximized); Index: MediaPortal.cs =================================================================== --- MediaPortal.cs (revision 12447) +++ MediaPortal.cs (working copy) @@ -464,6 +464,7 @@ { useScreenSaver = xmlreader.GetValueAsBool("general", "screensaver", true); timeScreenSaver = xmlreader.GetValueAsInt("general", "screensavertime", 60); + this.monitor = xmlreader.GetValueAsInt("general", "monitor", -1); clientSizeX = xmlreader.GetValueAsInt("general", "sizex", clientSizeX); clientSizeY = xmlreader.GetValueAsInt("general", "sizey", clientSizeY); //GUIGraphicsContext.UseSeparateRenderThread = xmlreader.GetValueAsBool("general", "userenderthread", true); @@ -525,6 +526,11 @@ DoStartupJobs(); // startThread.Priority = ThreadPriority.BelowNormal; // startThread.Start(); + + if (this.monitor >= 0) + { + this.Bounds = Screen.AllScreens[this.monitor].Bounds; + } } private void MediaPortalApp_Deactivate(object sender, EventArgs e) [/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
Improvement Suggestions
Run on secondary monitor
Contact us
RSS
Top
Bottom