[2.x] Event when second monitor is switched on
-
- Gnoll
- Posts: 659
- Joined: Mon Aug 06, 2007 12:53 pm
- Location: Saarland, Germany
- x 63
[2.x] Event when second monitor is switched on
Hi,
is there a way to detect via graphics card event etc. whether a second monitor/tv is swiched on?
I have the issue, then when I have an Ogre application running and my wife does switch on the tv, which is also connected with the graphics card, my PC monitor will become black for a small amount of time and all my MyGUI widgets are placed in the middle of the monitor screen (positions resetted). This is really annoying.
Is there an event, I could attach, to get notified, that a device is switched, or lost/restored? So I could react on that event and re-place all widgets at that time to the correct position again.
Best Regards
Lax
is there a way to detect via graphics card event etc. whether a second monitor/tv is swiched on?
I have the issue, then when I have an Ogre application running and my wife does switch on the tv, which is also connected with the graphics card, my PC monitor will become black for a small amount of time and all my MyGUI widgets are placed in the middle of the monitor screen (positions resetted). This is really annoying.
Is there an event, I could attach, to get notified, that a device is switched, or lost/restored? So I could react on that event and re-place all widgets at that time to the correct position again.
Best Regards
Lax
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
-
- OGRE Team Member
- Posts: 5446
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1348
Re: [2.x] Event when second monitor is switched on
I'm not familiar, but I'd suspect when such thing happen, you'd get at least a window event message that the window has been moved and/or resized; hence you should check if monitor count or desktop resolution has changed from a previous known state (e.g. SDL_GetWindowDisplayIndex, SDL_GetNumVideoDisplays).
If you're using SDL, you should look for event type SDL_WINDOWEVENT, events SDL_WINDOWEVENT_SIZE_CHANGED and SDL_WINDOWEVENT_RESIZED, and SDL_WINDOWEVENT_MOVED
If you're not using SDL, use WindowEventUtilities::addWindowEventListener.
See this tutorial.
If you're using SDL, you should look for event type SDL_WINDOWEVENT, events SDL_WINDOWEVENT_SIZE_CHANGED and SDL_WINDOWEVENT_RESIZED, and SDL_WINDOWEVENT_MOVED
If you're not using SDL, use WindowEventUtilities::addWindowEventListener.
See this tutorial.
-
- Ogre Magi
- Posts: 1172
- Joined: Mon Aug 04, 2008 7:51 pm
- Location: Manchester - England
- x 76
Re: [2.x] Event when second monitor is switched on
See here for Win32 API specific https://stackoverflow.com/questions/598 ... -windows-7
There are 10 types of people in the world: Those who understand binary, and those who don't...
-
- Gnoll
- Posts: 659
- Joined: Mon Aug 06, 2007 12:53 pm
- Location: Saarland, Germany
- x 63
Re: [2.x] Event when second monitor is switched on
Thanks, sounds promising! I will check this out.See here for Win32 API specific https://stackoverflow.com/questions/598 ... -windows-7
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62