Adding rudimentary multi-monitor suport

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
rraallvv
Posts: 0
Joined: Thu Apr 04, 2013 5:59 pm

Adding rudimentary multi-monitor suport

Post by rraallvv » Mon Jul 22, 2013 7:26 pm

I've added rudimentary multimonitor support for my build, since I'm not familiar with the blender source code conbentions I'm not sure if it would benefit the project so I'm sharing it here.

Added one more parameter to the functions that create a window GHOST_CreateWindow, createWindow, createFullScreenWindow, also to the
GHOST_WindowCocoa constructor.

The parameter is 0 by default wich means the main/only monitor.

Added the method getMonitor to GHOST_WindowCocoa

Code: Select all

short GHOST_WindowCocoa::getMonitor() const
{
    return (short)[[NSScreen screens] indexOfObject: [m_window screen]];
}
Wich is called from the API like this

Code: Select all

short GHOST_GetWindowMonitor(GHOST_WindowHandle windowhandle)
{
	GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
    
	return window->getMonitor();
}
Then I update the wmWindow property monitor in ghost_event_proc()

Code: Select all

			case GHOST_kEventWindowSize:
			case GHOST_kEventWindowMove:
			{
//....


					if (win->sizex != sizex ||
					    win->sizey != sizey ||
					    win->posx != posx ||
					    win->posy != posy)
					{
//...
                        win->monitor = GHOST_GetWindowMonitor(win->ghostwin);
And finaly I pass the monitor parameter to GHOST_CreateWindow in wm_window_add_ghostwindow

Post Reply