// Carbon Events
// ---------------------------------------------------------------------------
-extern long wxMacTranslateKey(unsigned char key, unsigned char code) ;
-
static const EventTypeSpec eventList[] =
{
// TODO: remove control related event like key and mouse (except for WindowLeave events)
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
#if wxUSE_UNICODE
- UInt32 dataSize = 0 ;
+ ByteCount dataSize = 0 ;
if ( GetEventParameter( event, kEventParamKeyUnicodes, typeUnicodeText, NULL, 0 , &dataSize, NULL ) == noErr )
{
UniChar buf[2] ;
wxWindow* g_MacLastWindow = NULL ;
-static EventMouseButton lastButton = 0 ;
+EventMouseButton g_lastButton = 0 ;
-static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
+void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
{
UInt32 modifiers = cEvent.GetParameter<UInt32>(kEventParamKeyModifiers, typeUInt32) ;
Point screenMouseLocation = cEvent.GetParameter<Point>(kEventParamMouseLocation) ;
button = kEventMouseButtonSecondary ;
// otherwise we report double clicks by connecting a left click with a ctrl-left click
- if ( clickCount > 1 && button != lastButton )
+ if ( clickCount > 1 && button != g_lastButton )
clickCount = 1 ;
// we must make sure that our synthetic 'right' button corresponds in
// mouse down, moved and mouse up, and does not deliver a right down and left up
if ( cEvent.GetKind() == kEventMouseDown )
- lastButton = button ;
+ g_lastButton = button ;
if ( button == 0 )
- lastButton = 0 ;
- else if ( lastButton )
- button = lastButton ;
+ g_lastButton = 0 ;
+ else if ( g_lastButton )
+ button = g_lastButton ;
// determine the correct down state, wx does not want a 'down' for a mouseUp event,
// while mac delivers this button
{
wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ;
- // EventMouseWheelAxis axis = cEvent.GetParameter<EventMouseWheelAxis>(kEventParamMouseWheelAxis, typeMouseWheelAxis) ;
- SInt32 delta = cEvent.GetParameter<SInt32>(kEventParamMouseWheelDelta, typeLongInteger) ;
+ EventMouseWheelAxis axis = cEvent.GetParameter<EventMouseWheelAxis>(kEventParamMouseWheelAxis, typeMouseWheelAxis) ;
+ SInt32 delta = cEvent.GetParameter<SInt32>(kEventParamMouseWheelDelta, typeSInt32) ;
wxevent.m_wheelRotation = delta;
wxevent.m_wheelDelta = 1;
wxevent.m_linesPerAction = 1;
+ if ( axis == kEventMouseWheelAxisX )
+ wxevent.m_wheelAxis = 1;
}
break ;
if ( window )
{
- QDGlobalToLocalPoint( UMAGetWindowPort(window ) , &windowMouseLocation ) ;
+ wxMacGlobalToLocal( window, &windowMouseLocation ) ;
if ( wxApp::s_captureWindow
#if !NEW_CAPTURE_HANDLING
wxPoint m_position ;
wxSize m_size ;
bool m_wasResizable ;
-}
-FullScreenData ;
+} FullScreenData ;
void wxTopLevelWindowMac::Init()
{
m_windowId = id == -1 ? NewControlId() : id;
wxWindow::SetLabel( title ) ;
- MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
+ MacCreateRealWindow( title, pos , size , style , name ) ;
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
Point idealSize = { 0 , 0 } ;
if ( maximize )
{
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+ HIRect bounds ;
+ HIWindowGetAvailablePositioningBounds(kCGNullDirectDisplay,kHICoordSpace72DPIGlobal,
+ &bounds);
+ idealSize.h = bounds.size.width;
+ idealSize.v = bounds.size.height;
+#else
Rect rect ;
GetAvailableWindowPositioningBounds(GetMainDevice(),&rect) ;
idealSize.h = rect.right - rect.left ;
idealSize.v = rect.bottom - rect.top ;
+#endif
}
ZoomWindowIdeal( (WindowRef)m_macWindow , maximize ? inZoomOut : inZoomIn , &idealSize ) ;
}
wclass = kPlainWindowClass ;
}
}
+ else if ( HasFlag( wxPOPUP_WINDOW ) )
+ {
+ // TEMPORARY HACK!
+ // Until we've got a real wxPopupWindow class on wxMac make it a
+ // little easier for wxFrame to be used to emulate it and workaround
+ // the lack of wxPopupWindow.
+ if ( HasFlag( wxBORDER_NONE ) )
+ wclass = kHelpWindowClass ; // has no border
+ else
+ wclass = kPlainWindowClass ; // has a single line border, it will have to do for now
+ //attr |= kWindowNoShadowAttribute; // turn off the shadow Should we??
+ group = GetWindowGroupOfClass( // float above other windows
+ kFloatingWindowClass) ;
+ }
else if ( HasFlag( wxCAPTION ) )
{
wclass = kDocumentWindowClass ;
if ( HasFlag(wxSTAY_ON_TOP) )
group = GetWindowGroupOfClass(kUtilityWindowClass) ;
+ if ( HasFlag( wxFRAME_FLOAT_ON_PARENT ) )
+ group = GetWindowGroupOfClass(kFloatingWindowClass) ;
+
attr |= kWindowCompositingAttribute;
#if 0 // wxMAC_USE_CORE_GRAPHICS ; TODO : decide on overall handling of high dpi screens (pixel vs userscale)
attr |= kWindowFrameworkScaledAttribute;
{
WindowDefSpec customWindowDefSpec;
customWindowDefSpec.defType = kWindowDefProcPtr;
- customWindowDefSpec.u.defProc = NewWindowDefUPP(wxShapedMacWindowDef);
-
+ customWindowDefSpec.u.defProc =
+#ifdef __LP64__
+ (WindowDefUPP) wxShapedMacWindowDef;
+#else
+ NewWindowDefUPP(wxShapedMacWindowDef);
+#endif
err = ::CreateCustomWindow( &customWindowDefSpec, wclass,
attr, &theBoundsRect,
(WindowRef*) &m_macWindow);
wxCHECK_RET( err == noErr, wxT("Mac OS error when trying to create new window") );
+ // setup a separate group for each window, so that overlays can be handled easily
+ verify_noerr( CreateWindowGroup( kWindowGroupAttrMoveTogether | kWindowGroupAttrLayerTogether | kWindowGroupAttrHideOnCollapse, &group ));
+ verify_noerr( SetWindowGroupParent( group, GetWindowGroup( (WindowRef) m_macWindow )));
+ verify_noerr( SetWindowGroup( (WindowRef) m_macWindow , group ));
+
// the create commands are only for content rect,
// so we have to set the size again as structure bounds
SetWindowBounds( (WindowRef) m_macWindow , kWindowStructureRgn , &theBoundsRect ) ;
EventRef currentEvent = (EventRef) wxTheApp->MacGetCurrentEvent() ;
UInt32 currentEventClass = 0 ;
- UInt32 currentEventKind = 0 ;
if ( currentEvent != NULL )
{
currentEventClass = ::GetEventClass( currentEvent ) ;
- currentEventKind = ::GetEventKind( currentEvent ) ;
+ ::GetEventKind( currentEvent ) ;
}
if ( currentEventClass != kEventClassMenu )
{
// when tracking a menu, strange redraw errors occur if we flush now, so leave..
EventRef theEvent;
- OSStatus status = noErr ;
- status = ReceiveNextEvent( 0 , NULL , kEventDurationNoWait , false , &theEvent ) ;
+ ReceiveNextEvent( 0 , NULL , kEventDurationNoWait , false , &theEvent ) ;
}
}
}
DisposeRgn(oldRgn);
// Save the region so we can use it later
- SetWRefCon((WindowRef)MacGetWindowRef(), (SInt32)shapeRegion);
+ SetWRefCon((WindowRef)MacGetWindowRef(), (URefCon)shapeRegion);
// inform the window manager that the window has changed shape
ReshapeCustomWindow((WindowRef)MacGetWindowRef());
static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect)
{
GetWindowPortBounds(window, inRect);
- Point pt = { inRect->left, inRect->top };
-
- QDLocalToGlobalPoint( GetWindowPort(window), &pt ) ;
+ Point pt = { inRect->top ,inRect->left };
+ wxMacLocalToGlobal( window, &pt ) ;
+ inRect->bottom += pt.v - inRect->top;
+ inRect->right += pt.h - inRect->left;
inRect->top = pt.v;
inRect->left = pt.h;
- inRect->bottom += pt.v;
- inRect->right += pt.h;
}
static SInt32 wxShapedMacWindowGetFeatures(WindowRef window, SInt32 param)