[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54226] trunk/blender: add ghost function getAllDisplayDimensions, GHOST_GetAllDisplayDimensions

Campbell Barton ideasman42 at gmail.com
Thu Jan 31 11:42:35 CET 2013


Revision: 54226
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54226
Author:   campbellbarton
Date:     2013-01-31 10:42:26 +0000 (Thu, 31 Jan 2013)
Log Message:
-----------
add ghost function getAllDisplayDimensions, GHOST_GetAllDisplayDimensions

This returns the desktop size, not just the size of the active monitor, useful since this constrains the mouse and we dont have to detect the active monitor (which isn't so straightforward with xlib).

carbon/cocoa are TODO, they still use getMainDisplayDimensions().

Modified Paths:
--------------
    trunk/blender/intern/ghost/GHOST_C-api.h
    trunk/blender/intern/ghost/GHOST_ISystem.h
    trunk/blender/intern/ghost/intern/GHOST_C-api.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h
    trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h
    trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
    trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.h
    trunk/blender/source/blender/windowmanager/intern/wm_window.c
    trunk/blender/source/blender/windowmanager/wm_window.h

Modified: trunk/blender/intern/ghost/GHOST_C-api.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_C-api.h	2013-01-31 09:53:34 UTC (rev 54225)
+++ trunk/blender/intern/ghost/GHOST_C-api.h	2013-01-31 10:42:26 UTC (rev 54226)
@@ -149,6 +149,20 @@
                                            GHOST_TUns32 *height);
 
 /**
+ * Returns the dimensions of all displays combine
+ * (the current workspace).
+ * No need to worrky about overlapping monitors.
+ * \param systemhandle The handle to the system
+ * \param width A pointer the width gets put in
+ * \param height A pointer the height gets put in
+ * \return void.
+ */
+extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
+                                           GHOST_TUns32 *width,
+                                           GHOST_TUns32 *height);
+
+
+/**
  * Create a new window.
  * The new window is added to the list of windows managed. 
  * Never explicitly delete the window, use disposeWindow() instead.

Modified: trunk/blender/intern/ghost/GHOST_ISystem.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_ISystem.h	2013-01-31 09:53:34 UTC (rev 54225)
+++ trunk/blender/intern/ghost/GHOST_ISystem.h	2013-01-31 10:42:26 UTC (rev 54226)
@@ -227,6 +227,12 @@
 	virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const = 0;
 
 	/**
+	 * Returns the combine dimensions of all monitors.
+	 * \return The dimension of the workspace.
+	 */
+	virtual void getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const = 0;
+
+	/**
 	 * Create a new window.
 	 * The new window is added to the list of windows managed.
 	 * Never explicitly delete the window, use disposeWindow() instead.

Modified: trunk/blender/intern/ghost/intern/GHOST_C-api.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_C-api.cpp	2013-01-31 09:53:34 UTC (rev 54225)
+++ trunk/blender/intern/ghost/intern/GHOST_C-api.cpp	2013-01-31 10:42:26 UTC (rev 54226)
@@ -123,7 +123,14 @@
 	system->getMainDisplayDimensions(*width, *height);
 }
 
+void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
+                                    GHOST_TUns32 *width,
+                                    GHOST_TUns32 *height)
+{
+	GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
 
+	system->getAllDisplayDimensions(*width, *height);
+}
 
 GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
                                       const char *title,

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp	2013-01-31 09:53:34 UTC (rev 54225)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp	2013-01-31 10:42:26 UTC (rev 54226)
@@ -396,6 +396,11 @@
 	height = bnds.bottom - bnds.top;
 }
 
+void GHOST_SystemCarbon::getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const
+{
+	/* TODO */
+	getMainDisplayDimensions(width, height);
+}
 
 GHOST_IWindow *GHOST_SystemCarbon::createWindow(
 		const STR_String& title,

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h	2013-01-31 09:53:34 UTC (rev 54225)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h	2013-01-31 10:42:26 UTC (rev 54226)
@@ -91,6 +91,12 @@
 	 * \return The dimension of the main display.
 	 */
 	virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
+
+	/**
+	 * Returns the combine dimensions of all monitors.
+	 * \return The dimension of the workspace.
+	 */
+	virtual void getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
 	
 	/**
 	 * Create a new window.

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h	2013-01-31 09:53:34 UTC (rev 54225)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h	2013-01-31 10:42:26 UTC (rev 54226)
@@ -89,6 +89,11 @@
 	 */
 	virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
 	
+	/** Returns the combine dimensions of all monitors.
+	 * \return The dimension of the workspace.
+	 */
+	virtual void getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
+
 	/**
 	 * Create a new window.
 	 * The new window is added to the list of windows managed.

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm	2013-01-31 09:53:34 UTC (rev 54225)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm	2013-01-31 10:42:26 UTC (rev 54226)
@@ -719,6 +719,11 @@
 	[pool drain];
 }
 
+void GHOST_SystemCocoa::getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const
+{
+	/* TODO! */
+	getMainDisplayDimensions(width, height);
+}
 
 GHOST_IWindow* GHOST_SystemCocoa::createWindow(
 	const STR_String& title, 

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp	2013-01-31 09:53:34 UTC (rev 54225)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp	2013-01-31 10:42:26 UTC (rev 54226)
@@ -215,6 +215,11 @@
 	height = ::GetSystemMetrics(SM_CYSCREEN);
 }
 
+void GHOST_SystemWin32::getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const
+{
+	width = ::GetSystemMetrics(SM_XVIRTUALSCREEN);
+	height = ::GetSystemMetrics(SM_YVIRTUALSCREEN);
+}
 
 GHOST_IWindow *GHOST_SystemWin32::createWindow(
 		const STR_String& title,

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h	2013-01-31 09:53:34 UTC (rev 54225)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h	2013-01-31 10:42:26 UTC (rev 54226)
@@ -100,8 +100,14 @@
 	 * \return The dimension of the main display.
 	 */
 	virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
-	
+
 	/**
+	 * Returns the dimensions of all displays on this system.
+	 * \return The dimension of the main display.
+	 */
+	virtual void getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
+
+	/**
 	 * Create a new window.
 	 * The new window is added to the list of windows managed. 
 	 * Never explicitly delete the window, use disposeWindow() instead.

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp	2013-01-31 09:53:34 UTC (rev 54225)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp	2013-01-31 10:42:26 UTC (rev 54226)
@@ -242,7 +242,24 @@
 	}
 }
 
+
 /**
+ * Returns the dimensions of the main display on this system.
+ * \return The dimension of the main display.
+ */
+void
+GHOST_SystemX11::
+getAllDisplayDimensions(
+		GHOST_TUns32& width,
+		GHOST_TUns32& height) const
+{
+	if (m_display) {
+		width  = DisplayWidth(m_display, DefaultScreen(m_display));
+		height = DisplayHeight(m_display, DefaultScreen(m_display));
+	}
+}
+
+/**
  * Create a new window.
  * The new window is added to the list of windows managed.
  * Never explicitly delete the window, use disposeWindow() instead.

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemX11.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemX11.h	2013-01-31 09:53:34 UTC (rev 54225)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemX11.h	2013-01-31 10:42:26 UTC (rev 54226)
@@ -117,6 +117,16 @@
 	    ) const;
 
 	/**
+	 * Returns the dimensions of all displays on this system.
+	 * \return The dimension of the main display.
+	 */
+	void
+	getAllDisplayDimensions(
+	    GHOST_TUns32& width,
+	    GHOST_TUns32& height
+	    ) const;
+
+	/**
 	 * Create a new window.
 	 * The new window is added to the list of windows managed. 
 	 * Never explicitly delete the window, use disposeWindow() instead.

Modified: trunk/blender/source/blender/windowmanager/intern/wm_window.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_window.c	2013-01-31 09:53:34 UTC (rev 54225)
+++ trunk/blender/source/blender/windowmanager/intern/wm_window.c	2013-01-31 10:42:26 UTC (rev 54226)
@@ -114,6 +114,17 @@
 	*height_r = uiheight;
 }
 
+/* size of all screens, useful since the mouse is bound by this */
+void wm_get_screensize_all(int *width_r, int *height_r)
+{
+	unsigned int uiwidth;
+	unsigned int uiheight;
+
+	GHOST_GetAllDisplayDimensions(g_system, &uiwidth, &uiheight);
+	*width_r = uiwidth;
+	*height_r = uiheight;
+}
+
 /* keeps offset and size within monitor bounds */
 /* XXX solve dual screen... */
 static void wm_window_check_position(rcti *rect)
@@ -829,7 +840,7 @@
 					
 					GHOST_DisposeRectangle(client_rect);
 					
-					wm_get_screensize(&scr_w, &scr_h);
+					wm_get_screensize_all(&scr_w, &scr_h);
 					sizex = r - l;
 					sizey = b - t;
 					posx = l;

Modified: trunk/blender/source/blender/windowmanager/wm_window.h
===================================================================
--- trunk/blender/source/blender/windowmanager/wm_window.h	2013-01-31 09:53:34 UTC (rev 54225)
+++ trunk/blender/source/blender/windowmanager/wm_window.h	2013-01-31 10:42:26 UTC (rev 54226)
@@ -40,6 +40,7 @@
 void		wm_ghost_exit(void);
 
 void wm_get_screensize(int *width_r, int *height_r);
+void wm_get_screensize_all(int *width_r, int *height_r);
 
 wmWindow	*wm_window_new			(bContext *C);
 void		wm_window_free			(bContext *C, wmWindowManager *wm, wmWindow *win);




More information about the Bf-blender-cvs mailing list