mirror of
https://github.com/glfw/glfw.git
synced 2025-06-08 00:34:56 +00:00
A lot of changes, fixes and implementations to keep in line with official branch
This commit is contained in:
parent
55fb33c689
commit
7547245298
3
.gitignore
vendored
3
.gitignore
vendored
@ -17,6 +17,7 @@ Release
|
|||||||
MinSizeRel
|
MinSizeRel
|
||||||
RelWithDebInfo
|
RelWithDebInfo
|
||||||
*.opensdf
|
*.opensdf
|
||||||
|
.vscode
|
||||||
|
|
||||||
# Xcode clutter
|
# Xcode clutter
|
||||||
GLFW.build
|
GLFW.build
|
||||||
@ -100,5 +101,3 @@ tests/title
|
|||||||
tests/triangle-vulkan
|
tests/triangle-vulkan
|
||||||
tests/window
|
tests/window
|
||||||
tests/windows
|
tests/windows
|
||||||
|
|
||||||
.vscode
|
|
@ -236,10 +236,6 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
#include <OpenGL/gl.h>
|
#include <OpenGL/gl.h>
|
||||||
|
|
||||||
#elif defined(__amigaos4__) && defined(GL4ES)
|
|
||||||
|
|
||||||
#include <GL4ES/gl.h>
|
|
||||||
|
|
||||||
#else /*__APPLE__*/
|
#else /*__APPLE__*/
|
||||||
|
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
@ -6434,4 +6430,3 @@ GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _glfw3_h_ */
|
#endif /* _glfw3_h_ */
|
||||||
|
|
||||||
|
@ -30,51 +30,23 @@
|
|||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifndef GL4ES
|
#ifndef OGLES2_OGLES2_DEFS_H
|
||||||
#include <proto/ogles2.h>
|
// it would be better to have an include with only the CreateContextTags enum difed, to avoid conflict
|
||||||
#include <GLES2/gl2.h>
|
// of other typedef with full OpenGL header file...
|
||||||
#define GETPROCADDRESS getProcAddressGL
|
#include <ogles2/ogles2_defs.h>
|
||||||
#else
|
|
||||||
extern void *aglGetProcAddress(const char *name);
|
|
||||||
enum CreateContextTags {
|
|
||||||
OGLES2_CCT_MIN=(1UL<<31),
|
|
||||||
OGLES2_CCT_WINDOW,
|
|
||||||
OGLES2_CCT_MODEID,
|
|
||||||
OGLES2_CCT_DEPTH,
|
|
||||||
OGLES2_CCT_STENCIL,
|
|
||||||
OGLES2_CCT_VSYNC,
|
|
||||||
OGLES2_CCT_SINGLE_GET_ERROR_MODE,
|
|
||||||
OGLES2_CCT_GET_WIDTH,
|
|
||||||
OGLES2_CCT_GET_HEIGHT,
|
|
||||||
OGLES2_CCT_BITMAP,
|
|
||||||
OGLES2_CCT_SHADER_COMPAT_PATCH,
|
|
||||||
OGLES2_CCT_CONTEXT_FOR_MODEID,
|
|
||||||
OGLES2_CCT_RESIZE_VIEWPORT,
|
|
||||||
OGLES2_CCT_DEBUG_SHADER_LOG,
|
|
||||||
OGLES2_CCT_SPIRV_OPLINES,
|
|
||||||
OGLES2_CCT_SPIRV_OPLINES_OFFSET,
|
|
||||||
OGLES2_CCT_SPIRV_OPTIMIZE,
|
|
||||||
OGLES2_CCT_SHARE_WITH,
|
|
||||||
};
|
|
||||||
typedef int GLint;
|
|
||||||
typedef int GLsizei;
|
|
||||||
|
|
||||||
extern void aglMakeCurrent(void* context);
|
|
||||||
extern void aglSetParams2(struct TagItem * tags);
|
|
||||||
extern void aglDestroyContext(void* context);
|
|
||||||
extern void aglMakeCurrent(void* context);
|
|
||||||
extern void aglSwapBuffers();
|
|
||||||
extern void glFinish();
|
|
||||||
extern void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
|
|
||||||
extern void *aglCreateContext2(ULONG * errcode, struct TagItem * tags);
|
|
||||||
extern void *gl4es_aglGetProcAddress(const char *name);
|
|
||||||
extern void gl4es_glXSwapInterval(int interval);
|
|
||||||
#define GETPROCADDRESS gl4es_aglGetProcAddress
|
|
||||||
|
|
||||||
extern struct OGLES2IFace *IOGLES2;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void* aglCreateContext2(ULONG * errcode, struct TagItem * tags);
|
||||||
|
void aglDestroyContext(void* context);
|
||||||
|
void aglMakeCurrent(void* context);
|
||||||
|
void aglSwapBuffers();
|
||||||
|
void aglSetBitmap(struct BitMap *bitmap);
|
||||||
|
void aglSetParams2(struct TagItem * tags);
|
||||||
|
void* aglGetProcAddress(const char* name);
|
||||||
|
#define GETPROCADDRESS aglGetProcAddress
|
||||||
|
|
||||||
static void makeContextCurrentGL(_GLFWwindow* window)
|
static void makeContextCurrentGL(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window)
|
if (window)
|
||||||
@ -97,13 +69,18 @@ static void swapBuffersGL(_GLFWwindow* window)
|
|||||||
// First flush the render pipeline, so that everything gets drawn
|
// First flush the render pipeline, so that everything gets drawn
|
||||||
glFinish();
|
glFinish();
|
||||||
|
|
||||||
|
if (window->context.gl.vsyncEnabled) {
|
||||||
|
IGraphics->WaitTOF();
|
||||||
|
}
|
||||||
|
|
||||||
// Swap the buffers (if any)
|
// Swap the buffers (if any)
|
||||||
aglSwapBuffers();
|
aglSwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLFWglproc getProcAddressGL(const char* procname)
|
static GLFWglproc getProcAddressGL(const char* procname)
|
||||||
{
|
{
|
||||||
const GLFWglproc proc = (GLFWglproc) aglGetProcAddress(procname);
|
dprintf("Searching for %s\n", procname);
|
||||||
|
const GLFWglproc proc = (GLFWglproc) GETPROCADDRESS(procname);
|
||||||
return proc;
|
return proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +92,16 @@ static int extensionSupportedGL(const char* extension)
|
|||||||
|
|
||||||
static void swapIntervalGL(int interval)
|
static void swapIntervalGL(int interval)
|
||||||
{
|
{
|
||||||
// TODO - Should we implement this?
|
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
|
||||||
|
switch (interval) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
window->context.gl.vsyncEnabled = interval ? TRUE : FALSE;
|
||||||
|
dprintf("VSYNC %d\n", interval);
|
||||||
|
default:
|
||||||
|
dprintf("Unsupported interval %d\n", interval);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the OpenGL or OpenGL ES context
|
// Create the OpenGL or OpenGL ES context
|
||||||
@ -151,7 +137,8 @@ GLFWbool _glfwCreateContextGL(_GLFWwindow* window,
|
|||||||
{OGLES2_CCT_STENCIL, fbconfig->stencilBits},
|
{OGLES2_CCT_STENCIL, fbconfig->stencilBits},
|
||||||
{OGLES2_CCT_VSYNC, 0},
|
{OGLES2_CCT_VSYNC, 0},
|
||||||
{OGLES2_CCT_RESIZE_VIEWPORT, TRUE},
|
{OGLES2_CCT_RESIZE_VIEWPORT, TRUE},
|
||||||
{OGLES2_CCT_SHARE_WITH, sharedContext},
|
{OGLES2_CCT_SINGLE_GET_ERROR_MODE, 1},
|
||||||
|
{OGLES2_CCT_SHARE_WITH, (ULONG)sharedContext},
|
||||||
{TAG_DONE, 0}
|
{TAG_DONE, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -160,7 +147,21 @@ GLFWbool _glfwCreateContextGL(_GLFWwindow* window,
|
|||||||
|
|
||||||
/* Set the context as current */
|
/* Set the context as current */
|
||||||
if (window->context.gl.glContext) {
|
if (window->context.gl.glContext) {
|
||||||
|
window->context.client = GLFW_OPENGL_ES_API;
|
||||||
|
|
||||||
|
dprintf("GL Extensions: %s\n", glGetString(GL_EXTENSIONS));
|
||||||
aglMakeCurrent(window->context.gl.glContext);
|
aglMakeCurrent(window->context.gl.glContext);
|
||||||
|
|
||||||
|
// Some games (like q3) doesn't clear the z-buffer prior to use. Since we're using a floating-point depth buffer in warp3dnova,
|
||||||
|
// that means it may contain illegal floating-point values, which causes some pixels to fail the depth-test when they shouldn't,
|
||||||
|
// so we clear the depth buffer to a constant value when it's first created.
|
||||||
|
// Pandora may well use an integer depth-buffer, in which case this can't happen.
|
||||||
|
// On MiniGL it didn't happens as there is workaround inside of old warp3d (and probabaly inside of MiniGL itself too).
|
||||||
|
// in SDL1 with gl4es (so warp3dnova/ogles2, where no such workaround) it didn't happens probabaly because SDL1 doing something like that (but not glClear).
|
||||||
|
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
|
glViewport(0, 0, window->os4.width, window->os4.height);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
IIntuition->CloseWindow(window->os4.handle);
|
IIntuition->CloseWindow(window->os4.handle);
|
||||||
@ -173,7 +174,7 @@ GLFWbool _glfwCreateContextGL(_GLFWwindow* window,
|
|||||||
window->context.swapBuffers = swapBuffersGL;
|
window->context.swapBuffers = swapBuffersGL;
|
||||||
window->context.swapInterval = swapIntervalGL;
|
window->context.swapInterval = swapIntervalGL;
|
||||||
window->context.extensionSupported = extensionSupportedGL;
|
window->context.extensionSupported = extensionSupportedGL;
|
||||||
window->context.getProcAddress = GETPROCADDRESS;
|
window->context.getProcAddress = getProcAddressGL;
|
||||||
window->context.destroy = destroyContextGL;
|
window->context.destroy = destroyContextGL;
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
|
@ -60,13 +60,6 @@ struct Library *IconBase = NULL;
|
|||||||
struct WorkbenchIFace *IWorkbench = NULL;
|
struct WorkbenchIFace *IWorkbench = NULL;
|
||||||
struct Library *WorkbenchBase = NULL;
|
struct Library *WorkbenchBase = NULL;
|
||||||
|
|
||||||
#ifndef GL4ES
|
|
||||||
struct Library *OGLES2Base = NULL;
|
|
||||||
struct OGLES2IFace *IOGLES2 = NULL;
|
|
||||||
#else
|
|
||||||
extern struct OGLES2IFace *IOGLES2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MIN_LIB_VERSION 51
|
#define MIN_LIB_VERSION 51
|
||||||
|
|
||||||
static void OS4_FindApplicationName();
|
static void OS4_FindApplicationName();
|
||||||
@ -184,14 +177,6 @@ static int loadLibraries(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GL4ES
|
|
||||||
OGLES2Base = openLib("ogles2.library", MIN_OGLES2_VERSION, (struct Interface **)&IOGLES2);
|
|
||||||
if (!OGLES2Base)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// AmigaInput
|
// AmigaInput
|
||||||
AIN_Base = openLib("AmigaInput.library", MIN_LIB_VERSION, (struct Interface **)&IAIN);
|
AIN_Base = openLib("AmigaInput.library", MIN_LIB_VERSION, (struct Interface **)&IAIN);
|
||||||
if (!AIN_Base)
|
if (!AIN_Base)
|
||||||
@ -228,17 +213,6 @@ static void closeLibraries(void)
|
|||||||
IExec->CloseLibrary(AIN_Base);
|
IExec->CloseLibrary(AIN_Base);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GL4ES
|
|
||||||
if (IOGLES2)
|
|
||||||
{
|
|
||||||
IExec->DropInterface((struct Interface *)IOGLES2);
|
|
||||||
}
|
|
||||||
if (OGLES2Base)
|
|
||||||
{
|
|
||||||
IExec->CloseLibrary(OGLES2Base);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Close workbench.library
|
// Close workbench.library
|
||||||
if (IWorkbench)
|
if (IWorkbench)
|
||||||
{
|
{
|
||||||
@ -571,9 +545,9 @@ OS4_FindApplicationName()
|
|||||||
char pathBuffer[MAXPATHLEN];
|
char pathBuffer[MAXPATHLEN];
|
||||||
|
|
||||||
if (IDOS->GetCliProgramName(pathBuffer, MAXPATHLEN - 1)) {
|
if (IDOS->GetCliProgramName(pathBuffer, MAXPATHLEN - 1)) {
|
||||||
printf("GetCliProgramName: '%s'\n", pathBuffer);
|
dprintf("GetCliProgramName: '%s'\n", pathBuffer);
|
||||||
} else {
|
} else {
|
||||||
printf("Failed to get CLI program name, checking task node\n");
|
dprintf("Failed to get CLI program name, checking task node\n");
|
||||||
|
|
||||||
struct Task* me = IExec->FindTask(NULL);
|
struct Task* me = IExec->FindTask(NULL);
|
||||||
snprintf(pathBuffer, MAXPATHLEN, "%s", ((struct Node *)me)->ln_Name);
|
snprintf(pathBuffer, MAXPATHLEN, "%s", ((struct Node *)me)->ln_Name);
|
||||||
@ -587,5 +561,5 @@ OS4_FindApplicationName()
|
|||||||
snprintf(_glfw.os4.appName, size, pathBuffer);
|
snprintf(_glfw.os4.appName, size, pathBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Application name: '%s'\n", _glfw.os4.appName);
|
dprintf("Application name: '%s'\n", _glfw.os4.appName);
|
||||||
}
|
}
|
@ -196,7 +196,7 @@ AMIGAINPUT_Open(_GLFWjoystick * joysticks, int device_index)
|
|||||||
if (result) {
|
if (result) {
|
||||||
char guid[33];
|
char guid[33];
|
||||||
// Generate a joystick GUID that matches the SDL 2.0.5+ one
|
// Generate a joystick GUID that matches the SDL 2.0.5+ one
|
||||||
sprintf(guid, "78696e707574%02x000000000000000000", handle->DeviceID & 0xff);
|
sprintf(guid, "78696e707574%02lx000000000000000000", handle->DeviceID & 0xff);
|
||||||
_glfwAllocJoystick(joystick->name, guid, joystick->axisCount, joystick->buttonCount, joystick->hatCount);
|
_glfwAllocJoystick(joystick->name, guid, joystick->axisCount, joystick->buttonCount, joystick->hatCount);
|
||||||
|
|
||||||
printf("Successful\n");
|
printf("Successful\n");
|
||||||
@ -257,7 +257,7 @@ AMIGAINPUT_EnumerateJoysticks(AIN_Device *device, void *UserData)
|
|||||||
joy->id = device->DeviceID;
|
joy->id = device->DeviceID;
|
||||||
joy->name = _glfw_strdup(device->DeviceName);
|
joy->name = _glfw_strdup(device->DeviceName);
|
||||||
|
|
||||||
printf("Found joystick #%d (AI ID=%ld) '%s'\n", *count, joy->id, joy->name);
|
printf("Found joystick #%ld (AI ID=%ld) '%s'\n", *count, joy->id, joy->name);
|
||||||
|
|
||||||
(*count)++;
|
(*count)++;
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ GLFWbool _glfwInitJoysticksOS4(void)
|
|||||||
BOOL result = GLFW_IAIN->EnumDevices(_glfw.os4js.joystickContext, AMIGAINPUT_EnumerateJoysticks, &packet);
|
BOOL result = GLFW_IAIN->EnumDevices(_glfw.os4js.joystickContext, AMIGAINPUT_EnumerateJoysticks, &packet);
|
||||||
#endif
|
#endif
|
||||||
printf("EnumDevices returned %d\n", result);
|
printf("EnumDevices returned %d\n", result);
|
||||||
printf("Found %d joysticks\n", _glfw.os4js.joystickCount);
|
printf("Found %ld joysticks\n", _glfw.os4js.joystickCount);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
/*
|
/*
|
||||||
|
@ -116,10 +116,33 @@ void _glfwPollMonitorsOS4(void)
|
|||||||
{
|
{
|
||||||
const float dpi = 141.f;
|
const float dpi = 141.f;
|
||||||
const GLFWvidmode mode = getVideoMode();
|
const GLFWvidmode mode = getVideoMode();
|
||||||
_GLFWmonitor* monitor = _glfwAllocMonitor("OS4 Monitor 0",
|
struct DimensionInfo diminfo;
|
||||||
(int) (mode.width * 25.4f / dpi),
|
APTR handle;
|
||||||
(int) (mode.height * 25.4f / dpi));
|
ULONG modeid;
|
||||||
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_FIRST);
|
|
||||||
|
IIntuition->GetScreenAttrs(_glfw.os4.publicScreen, SA_DisplayID, &modeid, TAG_DONE);
|
||||||
|
|
||||||
|
handle = IGraphics->FindDisplayInfo(modeid);
|
||||||
|
if (handle) {
|
||||||
|
if (IGraphics->GetDisplayInfoData(handle, (UBYTE *)&diminfo, sizeof(diminfo), DTAG_DIMS, 0)) {
|
||||||
|
GLFW_DisplayModeData *data;
|
||||||
|
data = (GLFW_DisplayModeData *) malloc(sizeof(*data));
|
||||||
|
if (data) {
|
||||||
|
data->modeid = modeid;
|
||||||
|
data->x = diminfo.Nominal.MinX;
|
||||||
|
data->y = diminfo.Nominal.MinY;
|
||||||
|
data->depth = diminfo.MaxDepth;
|
||||||
|
|
||||||
|
_GLFWmonitor* monitor = _glfwAllocMonitor("OS4 Monitor 0",
|
||||||
|
(int) (mode.width * 25.4f / dpi),
|
||||||
|
(int) (mode.height * 25.4f / dpi));
|
||||||
|
|
||||||
|
monitor->userPointer = data;
|
||||||
|
|
||||||
|
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_FIRST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@ -128,6 +151,9 @@ void _glfwPollMonitorsOS4(void)
|
|||||||
|
|
||||||
void _glfwFreeMonitorOS4(_GLFWmonitor* monitor)
|
void _glfwFreeMonitorOS4(_GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
|
if (monitor->userPointer)
|
||||||
|
free(monitor->userPointer);
|
||||||
|
|
||||||
_glfwFreeGammaArrays(&monitor->os4.ramp);
|
_glfwFreeGammaArrays(&monitor->os4.ramp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,12 +62,6 @@
|
|||||||
#include <amigainput/amigainput.h>
|
#include <amigainput/amigainput.h>
|
||||||
#include <proto/amigainput.h>
|
#include <proto/amigainput.h>
|
||||||
|
|
||||||
/* GL Stuff */
|
|
||||||
#ifndef GL4ES
|
|
||||||
#include <proto/ogles2.h>
|
|
||||||
#include <proto/minigl.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "os4_joystick.h"
|
#include "os4_joystick.h"
|
||||||
|
|
||||||
#define MIN_MINIGLVERSION 2
|
#define MIN_MINIGLVERSION 2
|
||||||
@ -106,39 +100,51 @@ struct MyIntuiMessage
|
|||||||
int16 Height;
|
int16 Height;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ULONG modeid;
|
||||||
|
long depth;
|
||||||
|
LONG x;
|
||||||
|
LONG y;
|
||||||
|
} GLFW_DisplayModeData;
|
||||||
|
|
||||||
// OS4-specific per-window data
|
// OS4-specific per-window data
|
||||||
//
|
//
|
||||||
typedef struct _GLFWwindowOS4
|
typedef struct _GLFWwindowOS4
|
||||||
{
|
{
|
||||||
struct Window *handle;
|
struct Window *handle;
|
||||||
int xpos;
|
int xpos;
|
||||||
int ypos;
|
int ypos;
|
||||||
int lastCursorPosX;
|
int oldxpos;
|
||||||
int lastCursorPosY;
|
int oldypos;
|
||||||
int width;
|
int lastCursorPosX;
|
||||||
int height;
|
int lastCursorPosY;
|
||||||
char *title;
|
int width;
|
||||||
GLFWbool visible;
|
int height;
|
||||||
GLFWbool iconified;
|
char *title;
|
||||||
GLFWbool maximized;
|
GLFWbool visible;
|
||||||
GLFWbool resizable;
|
GLFWbool iconified;
|
||||||
GLFWbool decorated;
|
GLFWbool maximized;
|
||||||
GLFWbool floating;
|
GLFWbool resizable;
|
||||||
GLFWbool transparent;
|
GLFWbool decorated;
|
||||||
float opacity;
|
GLFWbool floating;
|
||||||
int windowType; // NORMAL - GL - GLES
|
GLFWbool transparent;
|
||||||
|
GLFWbool fullscreen;
|
||||||
|
float opacity;
|
||||||
|
int windowType; // NORMAL - GL - GLES
|
||||||
|
|
||||||
struct AppIcon *appIcon;
|
struct AppIcon *appIcon;
|
||||||
struct AppWindow *appWin;
|
struct AppWindow *appWin;
|
||||||
|
struct Screen *screen;
|
||||||
|
|
||||||
struct Gadget *gadget;
|
struct Gadget *gadget;
|
||||||
struct Image *image;
|
struct Image *image;
|
||||||
|
|
||||||
} _GLFWwindowOS4;
|
} _GLFWwindowOS4;
|
||||||
|
|
||||||
typedef struct _GLFWcontextGL {
|
typedef struct _GLFWcontextGL {
|
||||||
struct BitMap *bm;
|
struct BitMap *bm;
|
||||||
void* glContext;
|
void* glContext;
|
||||||
|
BOOL vsyncEnabled;
|
||||||
} _GLFWcontextGL;
|
} _GLFWcontextGL;
|
||||||
|
|
||||||
// OS4-specific per-monitor data
|
// OS4-specific per-monitor data
|
||||||
|
289
src/os4_window.c
289
src/os4_window.c
@ -32,6 +32,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <proto/intuition.h>
|
#include <proto/intuition.h>
|
||||||
#include <intuition/pointerclass.h>
|
#include <intuition/pointerclass.h>
|
||||||
@ -45,7 +46,7 @@ static int OS4_GetButtonState(uint16_t code);
|
|||||||
static int OS4_GetButton(uint16_t code);
|
static int OS4_GetButton(uint16_t code);
|
||||||
static char OS4_TranslateUnicode(uint16_t code, uint32_t qualifier);
|
static char OS4_TranslateUnicode(uint16_t code, uint32_t qualifier);
|
||||||
static int OS4_TranslateState(int state);
|
static int OS4_TranslateState(int state);
|
||||||
static uint32_t OS4_GetWindowFlags(_GLFWwindow* window, BOOL fullscreen);
|
static uint32_t OS4_GetWindowFlags(_GLFWwindow* window, GLFWbool fullscreen);
|
||||||
static void OS4_SetWindowLimits(_GLFWwindow * window);
|
static void OS4_SetWindowLimits(_GLFWwindow * window);
|
||||||
static void OS4_CreateIconifyGadget(_GLFWwindow * window);
|
static void OS4_CreateIconifyGadget(_GLFWwindow * window);
|
||||||
static struct DiskObject *OS4_GetDiskObject();
|
static struct DiskObject *OS4_GetDiskObject();
|
||||||
@ -67,6 +68,148 @@ static struct Hook OS4_BackFillHook = {
|
|||||||
0, /* h_SubEntry */
|
0, /* h_SubEntry */
|
||||||
0 /* h_Data */
|
0 /* h_Data */
|
||||||
};
|
};
|
||||||
|
static void
|
||||||
|
OS4_GetWindowSize(struct Window * window, int * width, int * height)
|
||||||
|
{
|
||||||
|
LONG ret = IIntuition->GetWindowAttrs(
|
||||||
|
window,
|
||||||
|
WA_InnerWidth, width,
|
||||||
|
WA_InnerHeight, height,
|
||||||
|
TAG_DONE);
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
dprintf("GetWindowAttrs() returned %d\n", ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
OS4_WaitForResize(_GLFWwindow* window, int * width, int * height)
|
||||||
|
{
|
||||||
|
int counter = 0;
|
||||||
|
int activeWidth, activeHeight;
|
||||||
|
int w = 0;
|
||||||
|
int h = 0;
|
||||||
|
|
||||||
|
_glfwGetWindowSizeOS4(window, &activeWidth, &activeHeight);
|
||||||
|
|
||||||
|
while (counter++ < 100) {
|
||||||
|
OS4_GetWindowSize(window->os4.handle, &w, &h);
|
||||||
|
|
||||||
|
if (w == activeWidth && h == activeHeight) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
dprintf("Waiting for Intuition %d\n", counter);
|
||||||
|
dprintf("System window size (%d * %d), GLFW window size (%d * %d)\n", w, h, activeWidth, activeHeight);
|
||||||
|
usleep(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (width) {
|
||||||
|
*width = w;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (height) {
|
||||||
|
*height = h;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
OS4_ResizeWindow(_GLFWwindow* window, int width, int height, int posx, int posy)
|
||||||
|
{
|
||||||
|
if (width > 0 && height > 0) {
|
||||||
|
LONG ret = IIntuition->SetWindowAttrs(window->os4.handle,
|
||||||
|
WA_InnerWidth, width,
|
||||||
|
WA_InnerHeight, height,
|
||||||
|
WA_Left, posx,
|
||||||
|
WA_Top, posy,
|
||||||
|
TAG_DONE);
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
dprintf("SetWindowAttrs() returned %d\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
OS4_WaitForResize(window, NULL, NULL);
|
||||||
|
#if 0
|
||||||
|
if (window->os4.glwindow->context.gl.glContext) {
|
||||||
|
OS4_ResizeGlContext(window);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
dprintf("Invalid width %d or height %d\n", width, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32
|
||||||
|
OS4_GetIDCMPFlags(_GLFWwindow* window, GLFWbool fullscreen)
|
||||||
|
{
|
||||||
|
uint32 IDCMPFlags = IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE
|
||||||
|
| IDCMP_DELTAMOVE | IDCMP_RAWKEY | IDCMP_ACTIVEWINDOW
|
||||||
|
| IDCMP_INACTIVEWINDOW | IDCMP_INTUITICKS
|
||||||
|
| IDCMP_EXTENDEDMOUSE;
|
||||||
|
|
||||||
|
dprintf("Called\n");
|
||||||
|
|
||||||
|
if (!fullscreen) {
|
||||||
|
if (window->decorated) {
|
||||||
|
IDCMPFlags |= IDCMP_CLOSEWINDOW | IDCMP_GADGETUP | IDCMP_CHANGEWINDOW;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->resizable) {
|
||||||
|
//IDCMPFlags |= IDCMP_SIZEVERIFY; no handling so far
|
||||||
|
IDCMPFlags |= IDCMP_NEWSIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return IDCMPFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct Screen *
|
||||||
|
OS4_GetScreenForWindow(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
if (window->os4.screen) {
|
||||||
|
dprintf("Fullscreen\n");
|
||||||
|
return window->os4.screen;
|
||||||
|
} else {
|
||||||
|
dprintf("Window mode (public screen)\n");
|
||||||
|
return _glfw.os4.publicScreen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
OS4_DefineWindowBox(_GLFWwindow* window, const _GLFWwndconfig *wndconfig, struct Screen * screen, GLFWbool fullscreen, struct IBox *box)
|
||||||
|
{
|
||||||
|
if (fullscreen && screen) {
|
||||||
|
box->Left = 0;
|
||||||
|
box->Top = 0;
|
||||||
|
box->Width = screen->Width;
|
||||||
|
box->Height = screen->Height;
|
||||||
|
} else {
|
||||||
|
box->Left = wndconfig->xpos;
|
||||||
|
box->Top = wndconfig->ypos;
|
||||||
|
box->Width = wndconfig->width;
|
||||||
|
box->Height = wndconfig->height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
OS4_CloseScreen(struct Screen* screen)
|
||||||
|
{
|
||||||
|
if (screen) {
|
||||||
|
if (screen != _glfw.os4.publicScreen) {
|
||||||
|
dprintf("Closing screen %p\n", screen);
|
||||||
|
|
||||||
|
if (IIntuition->CloseScreen(screen) == FALSE) {
|
||||||
|
dprintf("Screen has open window(s), cannot close\n");
|
||||||
|
} else {
|
||||||
|
dprintf("Screen closed successfully\n");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dprintf("Public screen, not closing\n");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dprintf("NULL pointer\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static ULONG
|
static ULONG
|
||||||
OS4_MapCursorIdToNative(int id)
|
OS4_MapCursorIdToNative(int id)
|
||||||
@ -150,34 +293,24 @@ static void enableCursor(_GLFWwindow* window)
|
|||||||
_glfw.os4.disabledCursorWindow = NULL;
|
_glfw.os4.disabledCursorWindow = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns whether the cursor is in the content area of the specified window
|
|
||||||
//
|
|
||||||
static GLFWbool cursorInContentArea(_GLFWwindow* window)
|
|
||||||
{
|
|
||||||
return GLFW_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Updates the cursor image according to its cursor mode
|
// Updates the cursor image according to its cursor mode
|
||||||
//
|
//
|
||||||
static void updateCursorImage(_GLFWwindow* window)
|
static void updateCursorImage(_GLFWwindow* window, int shape)
|
||||||
{
|
{
|
||||||
if (window->cursorMode == GLFW_CURSOR_NORMAL)
|
if (!window)
|
||||||
{
|
return;
|
||||||
if (window->cursor) {
|
|
||||||
IIntuition->SetWindowPointer(
|
if (shape < 0 && window->cursor && window->cursor->os4.handle) {
|
||||||
window->os4.handle,
|
IIntuition->SetWindowPointer(
|
||||||
WA_Pointer, window->cursor->os4.handle,
|
window->os4.handle,
|
||||||
TAG_DONE);
|
WA_Pointer, window->cursor->os4.handle,
|
||||||
}
|
TAG_DONE);
|
||||||
else {
|
|
||||||
IIntuition->SetWindowPointer(
|
|
||||||
window->os4.handle,
|
|
||||||
//WA_PointerType, type,
|
|
||||||
TAG_DONE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else if (shape >= 0) {
|
||||||
//SetCursor(NULL);
|
IIntuition->SetWindowPointer(
|
||||||
|
window->os4.handle,
|
||||||
|
WA_PointerType, shape,
|
||||||
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,12 +319,28 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
const _GLFWfbconfig* fbconfig,
|
const _GLFWfbconfig* fbconfig,
|
||||||
int windowType)
|
int windowType)
|
||||||
{
|
{
|
||||||
|
window->autoIconify = GLFW_FALSE;
|
||||||
if (window->monitor) {
|
if (window->monitor) {
|
||||||
|
GLFW_DisplayModeData *data = (GLFW_DisplayModeData *) window->monitor->userPointer;
|
||||||
|
|
||||||
|
IIntuition->OpenScreenTags(NULL,
|
||||||
|
SA_Width, window->monitor->currentMode.width,
|
||||||
|
SA_Height, window->monitor->currentMode.height,
|
||||||
|
SA_Depth, data->depth,
|
||||||
|
SA_DisplayID, data->modeid,
|
||||||
|
SA_Quiet, TRUE,
|
||||||
|
SA_Title, wndconfig->title,
|
||||||
|
SA_ShowTitle, FALSE,
|
||||||
|
SA_LikeWorkbench, TRUE,
|
||||||
|
SA_Compositing, FALSE,
|
||||||
|
TAG_DONE);
|
||||||
dprintf("fitToMonitor\n");
|
dprintf("fitToMonitor\n");
|
||||||
fitToMonitor(window);
|
fitToMonitor(window);
|
||||||
|
window->os4.fullscreen = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
window->os4.fullscreen = GLFW_FALSE;
|
||||||
window->os4.xpos = 17;
|
window->os4.xpos = 17;
|
||||||
window->os4.ypos = 17;
|
window->os4.ypos = 17;
|
||||||
window->os4.width = wndconfig->width;
|
window->os4.width = wndconfig->width;
|
||||||
@ -209,33 +358,29 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
window->os4.opacity = 1.f;
|
window->os4.opacity = 1.f;
|
||||||
|
|
||||||
window->os4.windowType = windowType;
|
window->os4.windowType = windowType;
|
||||||
uint32_t windowFlags = OS4_GetWindowFlags(window, FALSE);
|
uint32_t windowFlags = OS4_GetWindowFlags(window, window->os4.fullscreen);
|
||||||
|
uint32 IDCMPFlags = OS4_GetIDCMPFlags(window, window->os4.fullscreen);
|
||||||
|
|
||||||
|
struct Screen *screen = OS4_GetScreenForWindow(window);
|
||||||
|
|
||||||
OS4_BackFillHook.h_Data = IGraphics; // Smuggle interface ptr for the hook
|
OS4_BackFillHook.h_Data = IGraphics; // Smuggle interface ptr for the hook
|
||||||
|
|
||||||
|
struct IBox box;
|
||||||
|
OS4_DefineWindowBox(window, wndconfig, screen, window->os4.fullscreen, &box);
|
||||||
|
|
||||||
window->os4.handle = IIntuition->OpenWindowTags(NULL,
|
window->os4.handle = IIntuition->OpenWindowTags(NULL,
|
||||||
WA_Left, window->os4.xpos,
|
WA_PubScreen, screen,
|
||||||
WA_Top, window->os4.ypos,
|
WA_Left, box.Left,
|
||||||
WA_InnerWidth, wndconfig->width,
|
WA_Top, box.Top,
|
||||||
WA_InnerHeight, wndconfig->height,
|
WA_InnerWidth, box.Width,
|
||||||
WA_Title, wndconfig->title,
|
WA_InnerHeight, box.Height,
|
||||||
|
WA_Title, window->os4.fullscreen ? NULL: wndconfig->title,
|
||||||
WA_ScreenTitle, wndconfig->title,
|
WA_ScreenTitle, wndconfig->title,
|
||||||
WA_MaxWidth, _glfw.os4.publicScreen->Width,
|
WA_MaxWidth, _glfw.os4.publicScreen->Width,
|
||||||
WA_MaxHeight, _glfw.os4.publicScreen->Height,
|
WA_MaxHeight, _glfw.os4.publicScreen->Height,
|
||||||
WA_Flags, windowFlags,
|
WA_Flags, windowFlags,
|
||||||
WA_Activate, TRUE,
|
WA_Activate, TRUE,
|
||||||
WA_IDCMP, IDCMP_CLOSEWINDOW |
|
WA_IDCMP, IDCMPFlags,
|
||||||
IDCMP_MOUSEMOVE |
|
|
||||||
IDCMP_MOUSEBUTTONS |
|
|
||||||
IDCMP_EXTENDEDMOUSE |
|
|
||||||
IDCMP_RAWKEY |
|
|
||||||
IDCMP_NEWSIZE |
|
|
||||||
IDCMP_DELTAMOVE |
|
|
||||||
IDCMP_ACTIVEWINDOW |
|
|
||||||
IDCMP_INACTIVEWINDOW |
|
|
||||||
IDCMP_INTUITICKS |
|
|
||||||
IDCMP_GADGETUP |
|
|
||||||
IDCMP_CHANGEWINDOW,
|
|
||||||
WA_Hidden, !wndconfig->visible,
|
WA_Hidden, !wndconfig->visible,
|
||||||
WA_UserPort, _glfw.os4.userPort,
|
WA_UserPort, _glfw.os4.userPort,
|
||||||
WA_BackFill, &OS4_BackFillHook,
|
WA_BackFill, &OS4_BackFillHook,
|
||||||
@ -244,20 +389,21 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
/* If we have a valid handle return GLFW_TRUE */
|
/* If we have a valid handle return GLFW_TRUE */
|
||||||
if (window->os4.handle) {
|
if (window->os4.handle) {
|
||||||
window->os4.title = (char *) wndconfig->title;
|
window->os4.title = (char *) wndconfig->title;
|
||||||
|
window->maxwidth = _glfw.os4.publicScreen->Width;
|
||||||
|
window->maxheight = _glfw.os4.publicScreen->Height;
|
||||||
|
|
||||||
_glfwGetWindowPosOS4(window, &window->os4.xpos, &window->os4.ypos);
|
_glfwGetWindowPosOS4(window, &window->os4.xpos, &window->os4.ypos);
|
||||||
_glfwGetWindowSizeOS4(window, &window->os4.width, &window->os4.height);
|
_glfwGetWindowSizeOS4(window, &window->os4.width, &window->os4.height);
|
||||||
window->os4.lastCursorPosX = window->os4.xpos;
|
window->os4.lastCursorPosX = window->os4.xpos;
|
||||||
window->os4.lastCursorPosY = window->os4.ypos;
|
window->os4.lastCursorPosY = window->os4.ypos;
|
||||||
|
|
||||||
if (wndconfig->decorated && wndconfig->width > 99 && wndconfig->height) {
|
if (wndconfig->decorated && wndconfig->width > 99 && wndconfig->height ) {
|
||||||
OS4_CreateIconifyGadget(window);
|
OS4_CreateIconifyGadget(window);
|
||||||
}
|
}
|
||||||
window->os4.appWin = IWorkbench->AddAppWindow(0, (ULONG)window, window->os4.handle, _glfw.os4.appMsgPort, TAG_DONE);
|
window->os4.appWin = IWorkbench->AddAppWindow(0, (ULONG)window, window->os4.handle, _glfw.os4.appMsgPort, TAG_DONE);
|
||||||
|
|
||||||
if (wndconfig->autoIconify) {
|
_glfwWindowFocusedOS4(window);
|
||||||
OS4_IconifyWindow(window);
|
|
||||||
}
|
|
||||||
dprintf("Window Created\n");
|
dprintf("Window Created\n");
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
@ -290,6 +436,10 @@ int _glfwCreateWindowOS4(_GLFWwindow* window,
|
|||||||
dprintf("Error creating context\n");
|
dprintf("Error creating context\n");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_glfwRefreshContextAttribs(window, ctxconfig))
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
dprintf("Context created\n");
|
dprintf("Context created\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,8 +469,12 @@ void _glfwDestroyWindowOS4(_GLFWwindow* window)
|
|||||||
if (window->context.destroy)
|
if (window->context.destroy)
|
||||||
window->context.destroy(window);
|
window->context.destroy(window);
|
||||||
|
|
||||||
|
struct Screen *screen = window->os4.handle->WScreen;
|
||||||
|
|
||||||
IIntuition->CloseWindow(window->os4.handle);
|
IIntuition->CloseWindow(window->os4.handle);
|
||||||
|
|
||||||
|
OS4_CloseScreen(screen);
|
||||||
|
|
||||||
if (window->os4.gadget) {
|
if (window->os4.gadget) {
|
||||||
IIntuition->DisposeObject((Object *)window->os4.gadget);
|
IIntuition->DisposeObject((Object *)window->os4.gadget);
|
||||||
window->os4.gadget = NULL;
|
window->os4.gadget = NULL;
|
||||||
@ -503,14 +657,19 @@ void _glfwGetWindowContentScaleOS4(_GLFWwindow* window, float* xscale, float* ys
|
|||||||
|
|
||||||
void _glfwIconifyWindowOS4(_GLFWwindow* window)
|
void _glfwIconifyWindowOS4(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
|
printf("_glfwIconifyWindowOS4\n");
|
||||||
if (_glfw.os4.focusedWindow == window)
|
if (_glfw.os4.focusedWindow == window)
|
||||||
{
|
{
|
||||||
|
printf("_glfwIconifyWindowOS4 1\n");
|
||||||
_glfw.os4.focusedWindow = NULL;
|
_glfw.os4.focusedWindow = NULL;
|
||||||
_glfwInputWindowFocus(window, GLFW_FALSE);
|
_glfwInputWindowFocus(window, GLFW_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!window->os4.iconified)
|
if (!window->os4.iconified)
|
||||||
{
|
{
|
||||||
|
OS4_IconifyWindow(window);
|
||||||
|
|
||||||
|
printf("_glfwIconifyWindowOS4 2\n");
|
||||||
window->os4.iconified = GLFW_TRUE;
|
window->os4.iconified = GLFW_TRUE;
|
||||||
_glfwInputWindowIconify(window, GLFW_TRUE);
|
_glfwInputWindowIconify(window, GLFW_TRUE);
|
||||||
|
|
||||||
@ -523,6 +682,8 @@ void _glfwRestoreWindowOS4(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
if (window->os4.iconified)
|
if (window->os4.iconified)
|
||||||
{
|
{
|
||||||
|
OS4_UniconifyWindow(window);
|
||||||
|
|
||||||
window->os4.iconified = GLFW_FALSE;
|
window->os4.iconified = GLFW_FALSE;
|
||||||
_glfwInputWindowIconify(window, GLFW_FALSE);
|
_glfwInputWindowIconify(window, GLFW_FALSE);
|
||||||
|
|
||||||
@ -531,6 +692,7 @@ void _glfwRestoreWindowOS4(_GLFWwindow* window)
|
|||||||
}
|
}
|
||||||
else if (window->os4.maximized)
|
else if (window->os4.maximized)
|
||||||
{
|
{
|
||||||
|
OS4_ResizeWindow(window, window->os4.width, window->os4.height, window->os4.oldxpos, window->os4.oldypos);
|
||||||
window->os4.maximized = GLFW_FALSE;
|
window->os4.maximized = GLFW_FALSE;
|
||||||
_glfwInputWindowMaximize(window, GLFW_FALSE);
|
_glfwInputWindowMaximize(window, GLFW_FALSE);
|
||||||
}
|
}
|
||||||
@ -540,6 +702,11 @@ void _glfwMaximizeWindowOS4(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
if (!window->os4.maximized)
|
if (!window->os4.maximized)
|
||||||
{
|
{
|
||||||
|
window->os4.oldxpos = window->os4.xpos;
|
||||||
|
window->os4.oldypos = window->os4.ypos;
|
||||||
|
|
||||||
|
OS4_ResizeWindow(window, window->maxwidth, window->maxheight, 0, 0);
|
||||||
|
|
||||||
window->os4.maximized = GLFW_TRUE;
|
window->os4.maximized = GLFW_TRUE;
|
||||||
_glfwInputWindowMaximize(window, GLFW_TRUE);
|
_glfwInputWindowMaximize(window, GLFW_TRUE);
|
||||||
}
|
}
|
||||||
@ -646,7 +813,7 @@ void _glfwFocusWindowOS4(_GLFWwindow* window)
|
|||||||
if (previous)
|
if (previous)
|
||||||
{
|
{
|
||||||
_glfwInputWindowFocus(previous, GLFW_FALSE);
|
_glfwInputWindowFocus(previous, GLFW_FALSE);
|
||||||
if (previous->monitor && previous->autoIconify)
|
if (!previous->monitor && previous->autoIconify)
|
||||||
_glfwIconifyWindowOS4(previous);
|
_glfwIconifyWindowOS4(previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -765,7 +932,11 @@ void _glfwPollEventsOS4(void)
|
|||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
enableCursor(window);
|
enableCursor(window);
|
||||||
|
|
||||||
|
if (!window->monitor && window->autoIconify) {
|
||||||
|
OS4_IconifyWindow(window);
|
||||||
|
}
|
||||||
_glfwInputWindowFocus(window, GLFW_FALSE);
|
_glfwInputWindowFocus(window, GLFW_FALSE);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDCMP_CLOSEWINDOW:
|
case IDCMP_CLOSEWINDOW:
|
||||||
@ -844,8 +1015,8 @@ void _glfwSetCursorModeOS4(_GLFWwindow* window, int mode)
|
|||||||
}
|
}
|
||||||
else if (_glfw.os4.disabledCursorWindow == window)
|
else if (_glfw.os4.disabledCursorWindow == window)
|
||||||
enableCursor(window);
|
enableCursor(window);
|
||||||
else if (cursorInContentArea(window))
|
else
|
||||||
updateCursorImage(window);
|
updateCursorImage(window, POINTERTYPE_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _glfwCreateCursorOS4(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot) {
|
int _glfwCreateCursorOS4(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot) {
|
||||||
@ -880,11 +1051,14 @@ int _glfwCreateCursorOS4(_GLFWcursor* cursor, const GLFWimage* image, int xhot,
|
|||||||
|
|
||||||
int _glfwCreateStandardCursorOS4(_GLFWcursor* cursor, int shape)
|
int _glfwCreateStandardCursorOS4(_GLFWcursor* cursor, int shape)
|
||||||
{
|
{
|
||||||
int id = OS4_MapCursorIdToNative(shape);
|
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
printf("_glfwCreateStandardCursorOS4 %02x %d\n", shape, id);
|
if (window) {
|
||||||
|
int id = OS4_MapCursorIdToNative(shape);
|
||||||
//updateCursorImage
|
printf("_glfwCreateStandardCursorOS4 %02x %d\n", shape, id);
|
||||||
return GLFW_TRUE;
|
updateCursorImage(window, id);
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwDestroyCursorOS4(_GLFWcursor* cursor)
|
void _glfwDestroyCursorOS4(_GLFWcursor* cursor)
|
||||||
@ -901,6 +1075,7 @@ void _glfwDestroyCursorOS4(_GLFWcursor* cursor)
|
|||||||
void _glfwSetCursorOS4(_GLFWwindow* window, _GLFWcursor* cursor)
|
void _glfwSetCursorOS4(_GLFWwindow* window, _GLFWcursor* cursor)
|
||||||
{
|
{
|
||||||
printf("_glfwSetCursorOS4\n");
|
printf("_glfwSetCursorOS4\n");
|
||||||
|
updateCursorImage(window, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwSetClipboardStringOS4(const char* string)
|
void _glfwSetClipboardStringOS4(const char* string)
|
||||||
@ -1150,7 +1325,7 @@ static int OS4_TranslateState(int state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
OS4_GetWindowFlags(_GLFWwindow* window, BOOL fullscreen)
|
OS4_GetWindowFlags(_GLFWwindow* window, GLFWbool fullscreen)
|
||||||
{
|
{
|
||||||
uint32_t windowFlags = WFLG_ACTIVATE | WFLG_REPORTMOUSE | WFLG_RMBTRAP | WFLG_SMART_REFRESH | WFLG_NOCAREREFRESH;
|
uint32_t windowFlags = WFLG_ACTIVATE | WFLG_REPORTMOUSE | WFLG_RMBTRAP | WFLG_SMART_REFRESH | WFLG_NOCAREREFRESH;
|
||||||
|
|
||||||
@ -1309,10 +1484,10 @@ OS4_UniconifyWindow(_GLFWwindow* window)
|
|||||||
}
|
}
|
||||||
IIntuition->SetWindowAttrs(window->os4.handle,
|
IIntuition->SetWindowAttrs(window->os4.handle,
|
||||||
WA_Hidden, FALSE,
|
WA_Hidden, FALSE,
|
||||||
|
WA_Activate, TRUE,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
|
||||||
window->os4.iconified = FALSE;
|
window->os4.iconified = FALSE;
|
||||||
//SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user