コード例 #1
0
ファイル: SDL_romvideo.c プロジェクト: 3bu1/crossbridge
static void ROM_UnsetVideoMode(_THIS, SDL_Surface *current)
{
	/* Free the current window, if any */
	if ( SDL_Window != nil ) {
		GWorldPtr memworld;
		
		/* Handle OpenGL support */
		Mac_GL_Quit(this);

		memworld = (GWorldPtr)GetWRefCon(SDL_Window);
		if ( memworld != nil ) {
			UnlockPixels(GetGWorldPixMap(memworld));
			DisposeGWorld(memworld);
		}
		if ( (current->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
#if USE_QUICKTIME
			EndFullScreen(fullscreen_ctx, nil);
			SDL_Window = nil;
#else
			ROM_ShowMenuBar(this);
#endif
		}
	}
	current->pixels = NULL;
	current->flags &= ~(SDL_HWSURFACE|SDL_FULLSCREEN);
}
コード例 #2
0
ファイル: WindowFun.c プロジェクト: fruitsamples/WindowFun
//	Creates an overlay window which will move with its parent.  This technique is typical for doing things like drawing on top of movies,
//	creating selection rectangles, drawing on top of GL windows, etc.
static	void	CreateOverlayWindow( WindowRef window )
{
	OSStatus					err;
	Rect						windowRect;
	WindowStorage				*windowStorage		= (WindowStorage*) GetWRefCon( window );
    WindowAttributes			overlayAttributes	= kWindowNoShadowAttribute | kWindowIgnoreClicksAttribute | kWindowNoActivatesAttribute | kWindowStandardHandlerAttribute;
	static	EventHandlerUPP		overlayWindowEventHandlerUPP;
	const EventTypeSpec	windowEvents[]	=
	    {
			{ kEventClassWindow, kEventWindowBoundsChanged },
			{ kEventClassWindow, kEventWindowShown },
			{ kEventClassWindow, kEventWindowClose }
		};

    SetPortWindowPort( window );
	GetWindowPortBounds( window, &windowRect );
	LocalToGlobalRect( &windowRect );											//	Window to be size of window it lies on
	err	= CreateNewWindow( kOverlayWindowClass, overlayAttributes, &windowRect, &windowStorage->overlayWindow );	
	if ( err != noErr ) goto Bail;

	SetWindowGroup( windowStorage->overlayWindow, GetWindowGroup(window) );		//	Put them in the same group so that their window layers are consistent

	if ( overlayWindowEventHandlerUPP == NULL ) overlayWindowEventHandlerUPP	= NewEventHandlerUPP( OverlayWindowEventHandlerProc );
	err	= InstallWindowEventHandler( windowStorage->overlayWindow, overlayWindowEventHandlerUPP, GetEventTypeCount(windowEvents), windowEvents, windowStorage, NULL );

	ShowWindow( windowStorage->overlayWindow );
Bail:
	return;
}
コード例 #3
0
ファイル: toplevel.cpp プロジェクト: Duion/Torsion
bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
{
    wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE,
                 _T("Shaped windows must be created with the wxFRAME_SHAPED style."));

#if TARGET_CARBON
    // The empty region signifies that the shape should be removed from the
    // window.
    if ( region.IsEmpty() )
    {
        wxSize sz = GetClientSize();
        wxRegion rgn(0, 0, sz.x, sz.y);
        return SetShape(rgn);
    }

    // Make a copy of the region
    RgnHandle  shapeRegion = NewRgn();
    CopyRgn( (RgnHandle)region.GetWXHRGN(), shapeRegion );

    // Dispose of any shape region we may already have
    RgnHandle oldRgn = (RgnHandle)GetWRefCon( (WindowRef)MacGetWindowRef() );
    if ( oldRgn )
        DisposeRgn(oldRgn);

    // Save the region so we can use it later
    SetWRefCon((WindowRef)MacGetWindowRef(), (SInt32)shapeRegion);

    // Tell the window manager that the window has changed shape
    ReshapeCustomWindow((WindowRef)MacGetWindowRef());
    return TRUE;
#else
    return FALSE;
#endif
}
コード例 #4
0
void DoUpdate(WindowRef win_ref)
{
	MacWindow* macwin;
	
	macwin = (MacWindow*)GetWRefCon(win_ref);
	if( macwin ) macwin->update();
}
コード例 #5
0
ファイル: macnte.c プロジェクト: ChristianeDufresne/GUD
/* track procedure for the horizontal scroll bar
 */
static pascal void hscroll(ControlHandle ctrl, short part)
{
	short		amount, value, max;
	
	if (part) {
		TEHandle hTE = (* (nate_win**) GetWRefCon((*ctrl)->contrlOwner))->hTE;
		
		value = (*hTE)->viewRect.right - (*hTE)->viewRect.left;
		switch (part) {
			case inUpButton:
				amount = -6;
				break;
			case inDownButton:
				amount = 6;
				break;
			case inPageUp:
				amount = - value;
				break;
			case inPageDown:
				amount = value;
				break;
		}
		if ((amount += (value = GetCtlValue(ctrl))) < 0) amount = 0;
		if (amount > (max = GetCtlMax(ctrl))) amount = max;
		SetCtlValue(ctrl, amount);
		TEScroll(value - amount, 0, hTE);
	}
}
コード例 #6
0
ファイル: macnte.c プロジェクト: ChristianeDufresne/GUD
/* track procedure for the vertical scroll bar
 */
static pascal void vscroll(ControlHandle ctrl, short part)
{
	short		amount, value, max, lh;
	na_win		*winp;
	TEHandle	hTE;
	
	if (part == 0) return;
	winp = * (na_win**) GetWRefCon((*ctrl)->contrlOwner);
	hTE = teinfo->hTE;
	value = ((*hTE)->viewRect.bottom - (*hTE)->viewRect.top) /
		(lh = teinfo->lheight);
	switch (part) {
		case inUpButton:
			amount = -1;
			break;
		case inDownButton:
			amount = 1;
			break;
		case inPageUp:
			amount = - value;
			break;
		case inPageDown:
			amount = value;
			break;
	}
	if ((amount += (value = GetCtlValue(ctrl))) < 0) amount = 0;
	if (amount > (max = GetCtlMax(ctrl))) amount = max;
	SetCtlValue(ctrl, amount);
	TEScroll(0, (value - amount) * lh, hTE);
}
コード例 #7
0
static
void CloseDemoWindow(
	WindowRef windowRef )
{
	WindowListItem 		*currentItem = gWindowList;
	WindowListItem 		*previousItem = NULL;
	DrawContextStruct	*windowContext;

	// search through the window list, looking for the windowRef
	while( currentItem != NULL )
	{
		// check to see if the current item is the one that we're looking for
		if ( currentItem->windowRef == windowRef )
		{
			// we've got a match, so set the previous item's next item pointer
			// to the current item's next item pointer
			if ( previousItem != NULL )
			{
				previousItem->nextItem = currentItem->nextItem;
			}
			else
			{
				gWindowList = currentItem->nextItem;
			}
			
			// free up the current item
			free( currentItem );
			break;
		}
		
		// move on to the next item
		previousItem = currentItem;
		currentItem = currentItem->nextItem;
	}
	
	// get the draw context struct from the window's refCon
	windowContext = (DrawContextStruct *) GetWRefCon( windowRef );
	
	// if we have a context, then we need to make sure to dispose of everything
	// that's in the context before we free the context.
	if ( windowContext != NULL )
	{		
		// dispose of the text layout object
		if ( windowContext->layoutObject != NULL ) 
		{
			verify_noerr( 
				ATSUDisposeTextLayout( windowContext->layoutObject ) );
		}
		
		// free the text buffer, if there is one
		if( windowContext->textBuffer != NULL )
		{
			free( windowContext->textBuffer );
		}
		
		// free the context itself
		free( windowContext );
	}
}
コード例 #8
0
ファイル: dmmain.c プロジェクト: hackqiang/gs
void doUpdateWindow(EventRecord *eventStrucPtr)
{
    IMAGE *img;
    WindowRef    windowRef;
    Rect         srcRect, destRect, fillRect;
    PixMapHandle srcPixmapHdl, destPixmapHdl;
    RGBColor     grayColour = { 0xC000,0xC000,0xC000 };
    SInt32  hScroll, vScroll;

    windowRef = (WindowRef) eventStrucPtr->message;
    img = (IMAGE*)GetWRefCon(windowRef);
    srcPixmapHdl = img->pixmapHdl;
    destPixmapHdl = GetPortPixMap(GetWindowPort(windowRef));
    hScroll = GetControl32BitValue(img->scrollbarHorizRef);
    vScroll = GetControl32BitValue(img->scrollbarVertRef);

    if (srcPixmapHdl)
    {
        PixMap *pixmap = *srcPixmapHdl;
        PixPatHandle hdlPixPat = NewPixPat();
        MakeRGBPat(hdlPixPat, &grayColour);

        GetWindowPortBounds(windowRef,&destRect);
        destRect.right  -= kScrollBarWidth;
        destRect.bottom -= kScrollBarWidth;

        if (destRect.right > pixmap->bounds.right)
        {
            fillRect.top = destRect.top;
            fillRect.bottom = destRect.bottom;
            fillRect.left = pixmap->bounds.right;
            fillRect.right = destRect.right;
            FillCRect(&fillRect, hdlPixPat);
            destRect.right = pixmap->bounds.right;
        }
        if (destRect.bottom > pixmap->bounds.bottom)
        {
            fillRect.top = pixmap->bounds.bottom;
            fillRect.bottom = destRect.bottom;
            fillRect.left = destRect.left;
            fillRect.right = destRect.right;
            FillCRect(&fillRect, hdlPixPat);
            destRect.bottom = pixmap->bounds.bottom;
        }
        DisposePixPat(hdlPixPat);

        srcRect = destRect;
        srcRect.left += hScroll;
        srcRect.right += hScroll;
        srcRect.top += vScroll;
        srcRect.bottom += vScroll;

        CopyBits((BitMap*)*srcPixmapHdl, (BitMap*)*destPixmapHdl,
                 &srcRect, &destRect, srcCopy, NULL);
    }

    DrawGrowIcon(windowRef);
}
コード例 #9
0
ファイル: macpgen.c プロジェクト: LapsedAcademicsInc/putty
/*
 * Work out what kind of window we're dealing with.
 */
static int mac_windowtype(WindowPtr window)
{

#if !TARGET_API_MAC_CARBON
    if (GetWindowKind(window) < 0)
	return wDA;
#endif
    return ((WinInfo *)GetWRefCon(window))->wtype;
}
コード例 #10
0
ファイル: macevlog.c プロジェクト: rdebath/sgt
void mac_freeeventlog(Session *s)
{

    if (s->eventlog != NULL)
	LDispose(s->eventlog);
    if (s->eventlog_window != NULL) {
	sfree((WinInfo *)GetWRefCon(s->eventlog_window));
	DisposeWindow(s->eventlog_window);
    }
}
コード例 #11
0
void NCarbonWindowManager::HandleMacActivate(WindowRef aWind, bool bActivate)
{
	NWindow *nWind = NULL;
	NUInt32 wRef = GetWRefCon(aWind);
	if(NObject::CheckValidNObject(wRef))
		nWind = (NWindow*)wRef;

	if(nWind)
		nWind->SetActive(bActivate);
}
コード例 #12
0
ファイル: nsMacMain.cpp プロジェクト: rn10950/RetroZilla
static void CloseFrontWindow()
{
    WindowPtr       wind = ::FrontWindow();
    if (!wind) return;
    
    nsBrowserWindow     *browserWindow = (nsBrowserWindow *)GetWRefCon(wind);
    if (!browserWindow) return;
    
    browserWindow->Destroy();
}
コード例 #13
0
NWindow* NCarbonWindowManager::GetFrontWindow() const
{
	WindowRef winFront = FrontWindow();
	if(winFront)
	{
		NUInt32 wRef = GetWRefCon(winFront);
		if(NObject::CheckValidNObject(wRef))
			return (NWindow*)wRef;
	}
	
	return NULL;
}
コード例 #14
0
ファイル: macintosh_utilities.c プロジェクト: DrItanium/moo
long whats_on_top(
	void)
{
	WindowPtr window= FrontWindow(); /* FLOATS */
	
	if (window)
	{
		return GetWRefCon(window);
	}
	
	return NONE;
}
コード例 #15
0
extern
OSStatus InvalidateAndRedrawWindows( void )
{
	OSStatus			err = noErr;
	WindowListItem 		*currentItem = gWindowList;
	DrawContextStruct	*windowContext;
	
	// search through the window list
	while( currentItem != NULL )
	{
		// get the draw context struct from the window's refCon
		windowContext = (DrawContextStruct *) GetWRefCon( 
			currentItem->windowRef );
		
		// make sure that we have a context
		if ( windowContext != NULL )
		{	
			// if we have a text layout, then make sure that we get rid of it.
			// This really is invalidation!
			if ( windowContext->layoutObject != NULL )
			{
				err = ATSUDisposeTextLayout( windowContext->layoutObject );
				require_noerr( err, InvalidateAndRedrawWindows_err );
				
				windowContext->layoutObject = NULL;
			}
		
			// nifty. Now, we need to redraw the window
			HIViewSetNeedsDisplay( ((DrawContextStruct*)GetWRefCon(currentItem->windowRef))->viewRef, true);
		}
		
		// grab the next context
		currentItem = currentItem->nextItem;
	}

InvalidateAndRedrawWindows_err:

	return err;

}
コード例 #16
0
static
OSStatus DrawWindow(
	WindowRef windowRef )
{
	OSStatus 				err = noErr;
	DrawContextStruct		*context;
		
	// get the context from windowRef		
	context = (DrawContextStruct *) GetWRefCon( windowRef );

	// skip any drawing if the context has not yet been initialized
	if ( context->cgContext == NULL )
		return err;


	// we only need to do this if there are characters in the buffer. If there
	// aren't any characters, then there's nothing to draw.
	if ( context->characterCount > 0 )
	{	
		// if there isn't a layout object, then we need to add one to the
		// context
		if ( context->layoutObject == NULL )
		{			
			err = AddNewTextLayoutToContext( context );
			require_noerr( err, DrawContext_err );
		}
		
		// based on the current options selection, either just draw a single
		// line, or do the fancy glyph rotate stuff.
		switch ( gOptionsMenuSelection )
		{
			case kOptionsMenuTextBurst:
				err = DrawGlyphBurst( context );
				require_noerr( err, DrawContext_err );
				break;
			
			case kOptionsMenuItemNone:
			default:
				err = DrawSingleLine( context );
				require_noerr( err, DrawContext_err );
				break;
		}

		// flush the CGContext
		CGContextFlush( context->cgContext );
	}
		
DrawContext_err:

	return err;

}
コード例 #17
0
ファイル: dmmain.c プロジェクト: hackqiang/gs
static void window_adjust_scrollbars(WindowRef windowRef)
{
    IMAGE *img;
    Rect   portRect;

    img = (IMAGE*)GetWRefCon(windowRef);
    GetWindowPortBounds(windowRef,&portRect);

    /* Move the crollbars to the edges of the window */
    HideControl(img->scrollbarVertRef);
    HideControl(img->scrollbarHorizRef);

    MoveControl(img->scrollbarVertRef,portRect.right - kScrollBarWidth,
                portRect.top - 1);
    MoveControl(img->scrollbarHorizRef,portRect.left - 1,
                portRect.bottom - kScrollBarWidth);

    SizeControl(img->scrollbarVertRef,kScrollBarWidth + 1,
                portRect.bottom - portRect.top - kScrollBarWidth + 1);
    SizeControl(img->scrollbarHorizRef, portRect.right - portRect.left - kScrollBarWidth + 1,
                kScrollBarWidth + 1);

    /* Adjust the scroll position showing */
    if (img->pixmapHdl)
    {
        PixMap *pixmap = *(img->pixmapHdl);
        int visibleHeight = portRect.bottom - portRect.top - kScrollBarWidth;
        int visibleWidth = portRect.right - portRect.left - kScrollBarWidth;

        if (pixmap->bounds.bottom > visibleHeight)
        {
            SetControl32BitMaximum(img->scrollbarVertRef,
                                   pixmap->bounds.bottom - visibleHeight);
            SetControlViewSize(img->scrollbarVertRef,visibleHeight);
        }
        else
            SetControlMaximum(img->scrollbarVertRef, 0);

        if (pixmap->bounds.right > visibleWidth)
        {
            SetControl32BitMaximum(img->scrollbarHorizRef,
                                   pixmap->bounds.right - visibleWidth);
            SetControlViewSize(img->scrollbarHorizRef, visibleWidth);
        }
        else
            SetControlMaximum(img->scrollbarHorizRef, 0);
    }

    ShowControl(img->scrollbarVertRef);
    ShowControl(img->scrollbarHorizRef);
}
コード例 #18
0
NWindow* NCarbonWindowManager::FindWindowAt(const NPoint2D & ptTarget) const
{
	WindowRef macWindow = NULL;
	Point pt = ptTarget.AsQDPoint();
	FindWindow(pt, &macWindow);
	if(macWindow)
	{
		NUInt32 wRef = GetWRefCon(macWindow);
		if(NObject::CheckValidNObject(wRef))
			return (NWindow*)wRef;
	}
	
	return NULL;
}
コード例 #19
0
void HandleMouseDown(EventRecord *event)
{
	short	part;
	WindowRef	window;
	MacWindow   *macwin;
	Rect		growRect={100,100,32000,32000};
	long		size;
	
	part=FindWindow(event->where, &window);
	macwin = (MacWindow*)GetWRefCon(window);
	
	switch(part)
	{
	case inMenuBar:
		mac_AdjustMenus(event->modifiers);
		mac_HandleMenuSelect(MenuSelect(event->where), event->modifiers);
		HiliteMenu(0);
		break;
	case inContent:
		SetPortWindowPort(window);
		SelectWindow(window);
		GlobalToLocal(&event->where);
		if(macwin) macwin->click(event->where, event->modifiers);
		break;
	case inDrag:
		DragWindow(window, event->where, &qd.screenBits.bounds);
		break;
	case inGrow:
		SetPortWindowPort(window);
		size=GrowWindow(window, event->where, &growRect);
		if( size )
		{
			SizeWindow(window, size&0x0000FFFF, size>>16, 0);
			EraseRect(&GetWindowPort(window)->portRect);
			InvalRect(&GetWindowPort(window)->portRect);
			if( macwin ) macwin->message(MW_GROW, size);
		}
		break;
	case inGoAway:
		if( TrackGoAway(window, event->where) ){
			if( macwin ){
				macwin->goaway(macwin);
			}
		}
		break;
	//case inZoomIn:
	//case inZoomOut:
	//	break;
	}
}
コード例 #20
0
ファイル: toplevel.cpp プロジェクト: Duion/Torsion
// The structure region is set to the shape given to the SetShape method.
static void wxShapedMacWindowStructureRegion(WindowRef window, RgnHandle rgn)
{
    RgnHandle cachedRegion = (RgnHandle) GetWRefCon(window);

    SetEmptyRgn(rgn);
    if (cachedRegion)
    {
        Rect windowRect;
        wxShapedMacWindowGetPos(window, &windowRect);	//how big is the window
        CopyRgn(cachedRegion, rgn);		//make a copy of our cached region
        OffsetRgn(rgn, windowRect.left, windowRect.top); // position it over window
        //MapRgn(rgn, &mMaskSize, &windowRect);	//scale it to our actual window size
    }
}
コード例 #21
0
ファイル: RequestVideo.c プロジェクト: spippolatore/abuse
pascal Boolean ConfirmAlertFilter(DialogPtr theDialog, EventRecord *theEvent, short *itemHit)
{
	char charCode;
	Boolean enterORreturn;
	Boolean returnValue = false;

	if (0 == GetWRefCon(theDialog))
		SetWRefCon (theDialog,TickCount());
	else
	{
		if (GetWRefCon(theDialog) + kSecondsToConfirm * 60 < TickCount())
		{
			returnValue = true;
			theEvent->what = nullEvent;
			*itemHit = 1;
		}
		else
		{
			if (theEvent->what == keyDown)
			{
				charCode = (char)theEvent->message & charCodeMask;
				enterORreturn = (charCode == (char)char_Return) || (charCode == (char)char_Enter);
				if (enterORreturn)
				{
					theEvent->what = nullEvent;
					returnValue = true;
					*itemHit = iRevertItem;
					if (enterORreturn && (0 != (theEvent->modifiers & optionKey)))
					{
						*itemHit = iConfirmItem;
					}
				}
			}
		}
	}
	return (returnValue);
}
コード例 #22
0
/*****************************************************
*
* Handle_WindowIsClosing(inHandlerCallRef, inEvent, inUserData) 
*
* Purpose:  called as notification that a window is being destroyed
*
* Inputs:   inHandlerCallRef    - reference to the current handler call chain
*			inEvent             - the event
*           inUserData          - app-specified data you passed in the call to InstallEventHandler
*
* Returns:  OSStatus            - noErr indicates the event was handled
*                                 eventNotHandledErr indicates the event was not handled and the Toolbox should take over
*/
static pascal OSStatus Handle_WindowIsClosing(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData)
{
	OSStatus status = eventNotHandledErr;
	WindowRef aWindowRef = (WindowRef)inUserData;

	// freeing the private data associated with the window
	WindowDataPtr wdr = (WindowDataPtr)GetWRefCon(aWindowRef);
	require(wdr != NULL, CantGetData);
	
	free(wdr);
	
CantGetData:

	return status;
}   // Handle_WindowIsClosing
コード例 #23
0
 void WindowBase::MainLoop()
 {
     OSXWindowData *windowData = (OSXWindowData*) GetWRefCon (mWindowHandle);
     windowData->StartedApplicationLoop = true;
     windowData->MainLoopEventHandler = NewEventLoopTimerUPP(MainLoopEventHandler);
     PRCORE_ASSERT_EXCEPTION( noErr !=  InstallEventLoopTimer (GetCurrentEventLoop(),
                                     0,
                                     mMainFreq,
                                     windowData->MainLoopEventHandler,
                                     (void *) windowData,
                                     &windowData->EventMainLoopReference
                                     ));
     
     
     RunApplicationEventLoop();
 }
コード例 #24
0
static OSStatus myWEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData) {
	WindowRef mywindow;
	GHOST_WindowCarbon *ghost_window;
	OSStatus err;
	int theState;
	
	if (::GetEventKind(event) == kEventWindowZoom) {
		err =  ::GetEventParameter (event,kEventParamDirectObject,typeWindowRef,NULL,sizeof(mywindow),NULL, &mywindow);
		ghost_window = (GHOST_WindowCarbon *) GetWRefCon(mywindow);
		theState = ghost_window->getMac_windowState();
		if (theState == 1) 
			ghost_window->setMac_windowState(2);
		else if (theState == 2)
			ghost_window->setMac_windowState(1);

	}
	return eventNotHandledErr;
}
コード例 #25
0
void NCarbonWindowManager::HandleMacUpdate(WindowRef aWind)
{
	// get dirty rect
	Rect r;
	GetWindowBounds(aWind, kWindowContentRgn, &r);
	OffsetRect(&r, -r.left, -r.top);
	NRect rToUpdate(r);

	// get NWindow
	NWindow *nWind = NULL;
	NUInt32 wRef = GetWRefCon(aWind);
	if(NObject::CheckValidNObject(wRef))
		nWind = (NWindow*)wRef;

	// tell window to redraw afflicted area	
	if(nWind)
		nWind->UpdateRect(rToUpdate);
}
コード例 #26
0
extern
OSStatus RedrawWindows( void )
{
	OSStatus			err = noErr;
	WindowListItem 		*currentItem = gWindowList;
	
	// search through the window list
	while( currentItem != NULL )
	{
		HIViewSetNeedsDisplay( ((DrawContextStruct*)GetWRefCon(currentItem->windowRef))->viewRef, true);
		
		// grab the next context
		currentItem = currentItem->nextItem;
	}

	return err;

}
コード例 #27
0
void NCarbonWindowManager::CloseMacWindow(WindowRef aWind)
{
	NWindow *nWind = NULL;
	NUInt32 wRef = GetWRefCon(aWind);
	if(NObject::CheckValidNObject(wRef))
		nWind = (NWindow*)wRef;

	if(nWind)
	{
		if(nWind->GetImplementation()->CloseRequest())
		{
			delete nWind;
			DisposeWindow(aWind);
		}
	}
	else
		DisposeWindow(aWind);
}
コード例 #28
0
    void WindowBase::DisableEvent()
    {
        if( !mIsEventEnable )
            return;
        OSXWindowData *windowData = (OSXWindowData *) GetWRefCon(mWindowHandle);
        if(windowData != NULL)
        {
            if( windowData->StartedApplicationLoop )
                QuitApplicationEventLoop(); 
            PRCORE_ASSERT_EXCEPTION( noErr != RemoveEventHandler (windowData->EventHandlerReference) );
            
            PRCORE_ASSERT_EXCEPTION( noErr != RemoveEventLoopTimer (windowData->EventMainLoopReference) );
            windowData->EventMainLoopReference = NULL;
            
            delete windowData;
        }

        mIsEventEnable=false;
    }
コード例 #29
0
ファイル: shell.c プロジェクト: MaddTheSane/tntbasic
/* Return true if the user aborted.. */
static NMBoolean handle_close(
	WindowPtr wp)
{
	struct endpoint_data *endpoint_data;
	
	endpoint_data= (struct endpoint_data *) GetWRefCon(wp);
	if(endpoint_data)
	{
		NMErr err;
	
		err= ProtocolCloseEndpoint(endpoint_data->endpoint, true);
		DEBUG_PRINTonERR("Err %d closing endpoint!", err);
		free(endpoint_data);
	}
	/* Check if it is dirty? */
	dispose_log(wp);
	DisposeWindow(wp);
	
	return false; 
}
コード例 #30
0
ファイル: SDL_romvideo.c プロジェクト: 3bu1/crossbridge
static void ROM_WindowUpdate(_THIS, int numrects, SDL_Rect *rects)
{
	GWorldPtr memworld;
	GrafPtr saveport;
	CGrafPtr thePort;
	const BitMap *memBits;
	const BitMap *winBits;
	int i;
	Rect update;
	
	/* Copy from the offscreen GWorld to the window port */
	GetPort(&saveport);
	SetPortWindowPort(SDL_Window);
	thePort = GetWindowPort(SDL_Window);
	memworld = (GWorldPtr)GetWRefCon(SDL_Window);
#if TARGET_API_MAC_CARBON && ACCESSOR_CALLS_ARE_FUNCTIONS
	memBits = GetPortBitMapForCopyBits((CGrafPtr) memworld);
#else
	memBits = &((GrafPtr)memworld)->portBits;
#endif
#if TARGET_API_MAC_CARBON && ACCESSOR_CALLS_ARE_FUNCTIONS
	winBits = GetPortBitMapForCopyBits(thePort);
#else
	winBits = &SDL_Window->portBits;
#endif
	for ( i=0; i<numrects; ++i ) {
		update.left = rects[i].x;
		update.right = rects[i].x+rects[i].w;
		update.top = rects[i].y;
		update.bottom = rects[i].y+rects[i].h;
		CopyBits(memBits, winBits,
			 &update, &update, srcCopy, nil);
	}
#if TARGET_API_MAC_CARBON
	if ( QDIsPortBuffered(thePort) ) {
		QDFlushPortBuffer(thePort, NULL);
	}
#endif
	SetPort(saveport);
}