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)
This commit is contained in:
@@ -144,6 +144,7 @@ typedef enum {
|
||||
GHOST_kEventWindowDeactivate,
|
||||
GHOST_kEventWindowUpdate,
|
||||
GHOST_kEventWindowSize,
|
||||
GHOST_kEventWindowMove,
|
||||
|
||||
GHOST_kNumEventTypes
|
||||
} GHOST_TEventType;
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user