diff options
author | Ton Roosendaal <ton@blender.org> | 2007-12-30 16:30:31 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2007-12-30 16:30:31 +0300 |
commit | 1039bc26fb466e41cea11bb77ed7b3b2d335f594 (patch) | |
tree | e53ef0ebbff6ff4ab0a43f960b944bdda6fd3063 | |
parent | 81035f6e21c6bf7d427634dc49eea48d9b4b4e0b (diff) |
Windowmanager, ghost side:
- Added GHOST_kEventWindowMove event, for sending event that the
window has moved
- Fixed GHOST_GetClientBounds() for OSX (get window rect)
Todos:
- add same event for X11 and Windows
- solve why ghost doesn't call client event-proc while scaling window
(at least, not in osx)
-rw-r--r-- | intern/ghost/GHOST_Types.h | 1 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCarbon.cpp | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCarbon.cpp | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 12 |
4 files changed, 16 insertions, 7 deletions
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index d5575354370..b11e7c922f0 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -144,6 +144,7 @@ typedef enum { GHOST_kEventWindowDeactivate, GHOST_kEventWindowUpdate, GHOST_kEventWindowSize, + GHOST_kEventWindowMove, GHOST_kNumEventTypes } GHOST_TEventType; diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index e1e3853e8a8..ad2088c8b14 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -936,10 +936,16 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event) * events. By setting m_ignoreWindowSizedMessages these are suppressed. * @see GHOST_SystemCarbon::handleWindowEvent(EventRef event) */ + /* even worse: scale window also generates a load of events, and nothing + is handled (read: client's event proc called) until you release mouse (ton) */ + GHOST_ASSERT(validWindow(ghostWindow), "GHOST_SystemCarbon::handleMouseDown: invalid window"); m_ignoreWindowSizedMessages = true; ::DragWindow(window, mousePos, &GetQDGlobalsScreenBits(&screenBits)->bounds); m_ignoreWindowSizedMessages = false; + + pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowMove, ghostWindow) ); + break; case inContent: diff --git a/intern/ghost/intern/GHOST_WindowCarbon.cpp b/intern/ghost/intern/GHOST_WindowCarbon.cpp index 04debe36191..0473b16335a 100644 --- a/intern/ghost/intern/GHOST_WindowCarbon.cpp +++ b/intern/ghost/intern/GHOST_WindowCarbon.cpp @@ -255,7 +255,9 @@ void GHOST_WindowCarbon::getClientBounds(GHOST_Rect& bounds) const { Rect rect; GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getClientBounds(): window invalid") - ::GetPortBounds(m_grafPtr, &rect); +// ::GetPortBounds(m_grafPtr, &rect); + ::GetWindowBounds(m_windowRef, kWindowContentRgn, &rect); + bounds.m_b = rect.bottom; bounds.m_l = rect.left; bounds.m_r = rect.right; diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 4a6a3c572d3..16ed2e7b4e5 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -369,12 +369,12 @@ int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) // window_handle(win, REDRAW, 1); break; } - case GHOST_kEventWindowSize: { + case GHOST_kEventWindowSize: + case GHOST_kEventWindowMove: { GHOST_RectangleHandle client_rect; int l, t, r, b, scr_w, scr_h; - /* was GetClientBounds, doesnt work (at least osx) */ - client_rect= GHOST_GetWindowBounds(win->ghostwin); + client_rect= GHOST_GetClientBounds(win->ghostwin); GHOST_GetRectangle(client_rect, &l, &t, &r, &b); GHOST_DisposeRectangle(client_rect); @@ -384,9 +384,9 @@ int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) win->sizey= b-t; win->posx= l; win->posy= scr_h - t - win->sizey; -#ifdef __APPLE__ - win->posy-= 24; /* gutter... see ghost, bad stuff */ -#endif + + if(type!=GHOST_kEventWindowSize) + printf("win move event pos %d %d size %d %d\n", win->posx, win->posy, win->sizex, win->sizey); // window_handle(win, RESHAPE, 1); break; |