Esempio n. 1
0
int ioPositionOfWindow(wIndexType windowIndex)
{
	Rect portRect;
	if (windowHandleFromIndex(windowIndex) == nil)
		return -1;
		
	GetPortBounds(GetWindowPort(windowHandleFromIndex(windowIndex)),&portRect);
 	QDLocalToGlobalRect(GetWindowPort(windowHandleFromIndex(windowIndex)), &portRect);
	return (portRect.left << 16) | (portRect.top & 0xFFFF);  /* left is high 16 bits; top is low 16 bits */
}
Esempio n. 2
0
int ioSizeOfWindow(wIndexType windowIndex)
{
	Rect portRect;
	int w, h;

	if (windowHandleFromIndex(windowIndex) == nil)
		return -1;


	GetPortBounds(GetWindowPort(windowHandleFromIndex(windowIndex)),&portRect);
	w =  portRect.right -  portRect.left;
	h =  portRect.bottom - portRect.top;
	return (w << 16) | (h & 0xFFFF);  /* w is high 16 bits; h is low 16 bits */
}
Esempio n. 3
0
size_t sqImageFileWrite(void *ptr, size_t sz, size_t count, sqImageFile f) {
int remaining, actuallyWritten=0;
unsigned char *dstPtr;
	remaining = sz * count;
	dstPtr = (unsigned char *)ptr;

	while (remaining >= CHUNK_SIZE) {
		actuallyWritten = fwrite(dstPtr, (size_t)1, (size_t)CHUNK_SIZE, f);
		/* if we didnt write enough, return an error case */
		if ( actuallyWritten != CHUNK_SIZE) return 0;
		dstPtr += CHUNK_SIZE;
		remaining -= CHUNK_SIZE;
		/* drop this for now; it seems to clash with
		 * the threading of Oregano at least, causing loss
		 * of the image !!
		 dummyWimpPoll();
		 */
	}

	/* update the window title to reflect the new image name, if that *
	 * is what it is showing */
	if (actualOSLevel >= 380) {
		extern wimp_w windowHandleFromIndex(int windowIndex);
		xwimp_force_redraw_furniture(windowHandleFromIndex(1), wimp_FURNITURE_TITLE);
	}

	actuallyWritten = fwrite(dstPtr, (size_t)1, (size_t)remaining, f);
	/* if we didnt write enough, return an error case */
	if ( actuallyWritten != remaining) return 0;
	/* return the number of bytes written */
	return count;
}
Esempio n. 4
0
int ioSetTitleOfWindow(int windowIndex, char * newTitle, int sizeOfTitle) {
	char string[256];
	if (sizeOfTitle > 255) 
		return -1;

	memcpy(string,newTitle,sizeOfTitle);
	string[sizeOfTitle] = 0x00;
	
	CFStringRef windowTitleCFString = CFStringCreateWithCString (nil,string,kCFStringEncodingUTF8);

	SetWindowTitleWithCFString (windowHandleFromIndex(windowIndex),windowTitleCFString);
	
	CFRelease(windowTitleCFString);
	return 1;
}
Esempio n. 5
0
int ioSizeOfWindowSetxy(wIndexType windowIndex, int x, int y)
{
	void * giLocker;
	int return_value=0;
	if (windowHandleFromIndex(windowIndex) == nil)
		return -1;
	giLocker = interpreterProxy->ioLoadFunctionFrom("getUIToLock", "");
	if (giLocker != 0) {
		sqInt *foo;
		foo = malloc(sizeof(sqInt)*7);
		foo[0] = 4;
		foo[1] = (sqInt) SizeWindow;
		foo[2] = (sqInt) windowHandleFromIndex(windowIndex);
		foo[3] = x;
		foo[4] = y;
		foo[5] = true;
		foo[6] = 0;
		((sqInt (*) (void *)) giLocker)(foo);
		return_value = interpreterProxy->positive32BitIntegerFor(foo[6]);
		free(foo);
	}
	setWindowTrackingRgn(windowIndex);
	return ioSizeOfWindow(windowIndex);
}
Esempio n. 6
0
int closeWindow(int windowIndex) {
	wHandleType	windowHandle;
	windowHandle = windowHandleFromIndex(windowIndex);
	if(windowHandle == NULL) 
		return 0;
	if (windowBlockFromIndex(windowIndex)->context)
		QDEndCGContext(GetWindowPort(windowBlockFromIndex(windowIndex)->handle),&windowBlockFromIndex(windowIndex)->context);
		//CGContextRelease(windowBlockFromIndex(windowIndex)->context);
	

	if (windowBlockFromIndex(windowIndex)->windowTrackingRef) {
		ReleaseMouseTrackingRegion(windowBlockFromIndex(windowIndex)->windowTrackingRef );
		windowBlockFromIndex(windowIndex)->windowTrackingRef = NULL;
	}

	windowBlockFromIndex(windowIndex)->context = NULL;
	RemoveWindowBlock(windowBlockFromIndex(windowIndex));	
	DisposeWindow(windowHandle);
	return 1;
}
Esempio n. 7
0
WindowPtr getSTWindow(void) {
	if (gSqueakHeadless && !browserActiveAndDrawingContextOk()) return NULL;	
    return  windowHandleFromIndex(1);
}