Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-01-31 14:42:26 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-01-31 14:42:26 +0400
commit73f301c3a8a28dd25ea850a54d968fc6c4f2b83e (patch)
treed8f26b84286c7468aa3d1cc71b929e890fb59a2e
parent4d2efa877e305fc29121030120b7c53ae57950c4 (diff)
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().
-rw-r--r--intern/ghost/GHOST_C-api.h14
-rw-r--r--intern/ghost/GHOST_ISystem.h6
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp7
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp5
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.h6
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.h5
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm5
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp5
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h8
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp17
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h10
-rw-r--r--source/blender/windowmanager/intern/wm_window.c13
-rw-r--r--source/blender/windowmanager/wm_window.h1
13 files changed, 100 insertions, 2 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index ffdee6c1550..a92d0d33b65 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -149,6 +149,20 @@ extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
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.
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 1b3509c1ac3..841293e09e4 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -227,6 +227,12 @@ public:
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.
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index be64acf8c94..7622a2a7330 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -123,7 +123,14 @@ void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
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,
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index f5784c7d451..bb6b1bfd4af 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -396,6 +396,11 @@ void GHOST_SystemCarbon::getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUn
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,
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h
index 61e5a086a0f..b6821bc7419 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.h
+++ b/intern/ghost/intern/GHOST_SystemCarbon.h
@@ -91,6 +91,12 @@ public:
* \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.
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index a1b372dac9a..257aeb52a37 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -89,6 +89,11 @@ public:
*/
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.
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 1665180b687..e4245aaf095 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -719,6 +719,11 @@ void GHOST_SystemCocoa::getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns
[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,
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 50d7b372dd6..138109ce48b 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -215,6 +215,11 @@ void GHOST_SystemWin32::getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns
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,
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index 6a756d35872..e47dbda2e92 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -100,7 +100,13 @@ public:
* \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.
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 10c93db64d8..1e815870fc9 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -242,6 +242,23 @@ getMainDisplayDimensions(
}
}
+
+/**
+ * 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.
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index a5d5d9b7a99..5fd494637f9 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -117,6 +117,16 @@ public:
) 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.
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 83eadf6e833..a5f30fc5c62 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -114,6 +114,17 @@ void wm_get_screensize(int *width_r, int *height_r)
*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 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
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;
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
index ce360f5ef56..739ead27bdb 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -40,6 +40,7 @@ void wm_ghost_init (bContext *C);
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);