1
/* sqUnixCustomWindow.c -- support for display via your custom window system.
3
* Last edited: 2008-04-21 14:06:20 by piumarta on emilia
5
* This is a template for creating your own window drivers for Squeak:
7
* - copy the entire contents of this directory to some other name
8
* - rename this file to be something more appropriate
9
* - modify acinclude.m4, Makefile.in, and ../vm/sqUnixMain accordingly
10
* - implement all the stubs in this file that currently do nothing
15
#include "sqMemoryAccess.h"
17
#include "sqUnixMain.h"
18
#include "sqUnixGlobals.h"
19
#include "sqUnixCharConv.h" /* not required, but probably useful */
20
#include "aio.h" /* ditto */
22
#include "SqDisplay.h"
26
#include "sqUnixEvent.c" /* see X11 and/or Quartz drivers for examples */
29
#define trace() fprintf(stderr, "%s:%d %s\n", __FILE__, __LINE__, __FUNCTION__)
31
static int handleEvents(void)
33
printf("handle custom events here...\n");
34
return 0; /* 1 if events processed */
37
static sqInt display_clipboardSize(void)
43
static sqInt display_clipboardWriteFromAt(sqInt count, sqInt byteArrayIndex, sqInt startIndex)
49
static sqInt display_clipboardReadIntoAt(sqInt count, sqInt byteArrayIndex, sqInt startIndex)
56
static char ** display_clipboardGetTypeNames(void)
62
static sqInt display_clipboardSizeWithType(char *typeName, int ntypeName)
68
static void display_clipboardWriteWithType(char *data, size_t ndata, char *typeName, size_t ntypeName, int isDnd, int isClaiming)
73
static sqInt display_dndOutStart(char *types, int ntypes)
79
static void display_dndOutSend (char *bytes, int nbytes)
84
static sqInt display_dndOutAcceptedType(char * buf, int nbuf)
90
static sqInt display_ioFormPrint(sqInt bitsIndex, sqInt width, sqInt height, sqInt depth, double hScale, double vScale, sqInt landscapeFlag)
96
static sqInt display_ioBeep(void)
102
static sqInt display_ioRelinquishProcessorForMicroseconds(sqInt microSeconds)
104
aioSleep(handleEvents() ? 0 : microSeconds);
108
static sqInt display_ioProcessEvents(void)
115
static sqInt display_ioScreenDepth(void)
121
static sqInt display_ioScreenSize(void)
124
return (600 << 16) | 400;
127
static sqInt display_ioSetCursorWithMask(sqInt cursorBitsIndex, sqInt cursorMaskIndex, sqInt offsetX, sqInt offsetY)
133
static sqInt display_ioSetCursorARGB(sqInt cursorBitsIndex, sqInt extentX, sqInt extentY, sqInt offsetX, sqInt offsetY)
139
static sqInt display_ioSetFullScreen(sqInt fullScreen)
145
static sqInt display_ioForceDisplayUpdate(void)
151
static sqInt display_ioShowDisplay(sqInt dispBitsIndex, sqInt width, sqInt height, sqInt depth,
152
sqInt affectedL, sqInt affectedR, sqInt affectedT, sqInt affectedB)
158
static sqInt display_ioHasDisplayDepth(sqInt i)
164
static sqInt display_ioSetDisplayMode(sqInt width, sqInt height, sqInt depth, sqInt fullscreenFlag)
170
static void display_winSetName(char *imageName)
175
static void *display_ioGetDisplay(void) { return 0; }
176
static void *display_ioGetWindow(void) { return 0; }
178
static sqInt display_ioGLinitialise(void) { trace(); return 0; }
179
static sqInt display_ioGLcreateRenderer(glRenderer *r, sqInt x, sqInt y, sqInt w, sqInt h, sqInt flags) { trace(); return 0; }
180
static void display_ioGLdestroyRenderer(glRenderer *r) { trace(); }
181
static void display_ioGLswapBuffers(glRenderer *r) { trace(); }
182
static sqInt display_ioGLmakeCurrentRenderer(glRenderer *r) { trace(); return 0; }
183
static void display_ioGLsetBufferRect(glRenderer *r, sqInt x, sqInt y, sqInt w, sqInt h) { trace(); }
185
static char *display_winSystemName(void)
191
static void display_winInit(void)
194
printf("Initialise your Custom Window system here\n");
197
static void display_winOpen(void)
200
printf("map your Custom Window here\n");
204
static void display_winExit(void)
207
printf("shut down your Custom Window system here\n");
210
static int display_winImageFind(char *buf, int len) { trace(); return 0; }
211
static void display_winImageNotFound(void) { trace(); }
213
static sqInt display_primitivePluginBrowserReady(void) { return primitiveFail(); }
214
static sqInt display_primitivePluginRequestURLStream(void) { return primitiveFail(); }
215
static sqInt display_primitivePluginRequestURL(void) { return primitiveFail(); }
216
static sqInt display_primitivePluginPostURL(void) { return primitiveFail(); }
217
static sqInt display_primitivePluginRequestFileHandle(void) { return primitiveFail(); }
218
static sqInt display_primitivePluginDestroyRequest(void) { return primitiveFail(); }
219
static sqInt display_primitivePluginRequestState(void) { return primitiveFail(); }
221
#if (SqDisplayVersionMajor >= 1 && SqDisplayVersionMinor >= 2)
222
static int display_hostWindowClose(int index) { return 0; }
223
static int display_hostWindowCreate(int w, int h, int x, int y,
224
char *list, int attributeListLength) { return 0; }
225
static int display_hostWindowShowDisplay(unsigned *dispBitsIndex, int width, int height, int depth,
226
int affectedL, int affectedR, int affectedT, int affectedB, int windowIndex) { return 0; }
227
static int display_hostWindowGetSize(int windowIndex) { return -1; }
228
static int display_hostWindowSetSize(int windowIndex, int w, int h) { return -1; }
229
static int display_hostWindowGetPosition(int windowIndex) { return -1; }
230
static int display_hostWindowSetPosition(int windowIndex, int x, int y) { return -1; }
231
static int display_hostWindowSetTitle(int windowIndex, char *newTitle, int sizeOfTitle) { return -1; }
232
static int display_hostWindowCloseAll(void) { return 0; }
235
SqDisplayDefine(custom); /* name must match that in makeInterface() below */
241
static void display_printUsage(void)
243
printf("\nCustom Window <option>s: (none)\n");
247
static void display_printUsageNotes(void)
252
static void display_parseEnvironment(void)
257
static int display_parseArgument(int argc, char **argv)
259
return 0; /* arg not recognised */
262
static void *display_makeInterface(void)
264
return &display_custom_itf; /* name must match that in SqDisplayDefine() above */
267
#include "SqModule.h"
269
SqModuleDefine(display, custom); /* name must match that in sqUnixMain.c's moduleDescriptions */