Formatting.

This commit is contained in:
Camilla Berglund 2013-04-08 15:16:32 +02:00
parent 8e2e7b37a1
commit 49db3b2a9e
8 changed files with 59 additions and 38 deletions

View File

@ -482,7 +482,7 @@ extern "C" {
#define GLFW_ICONIFIED 0x00020002
#define GLFW_RESIZABLE 0x00022007
#define GLFW_VISIBLE 0x00022008
#define GLFW_UNDECORATED 0x00022009
#define GLFW_DECORATED 0x00022009
#define GLFW_CONTEXT_REVISION 0x00020004
#define GLFW_RED_BITS 0x00021000

View File

@ -481,6 +481,24 @@ static int convertMacKeyCode(unsigned int macKeyCode)
@end
//------------------------------------------------------------------------
// GLFW window class
//------------------------------------------------------------------------
@interface GLFWWindow : NSWindow {}
@end
@implementation GLFWWindow
- (BOOL)canBecomeKeyWindow
{
// Required for NSBorderlessWindowMask windows
return YES;
}
@end
//------------------------------------------------------------------------
// GLFW application class
//------------------------------------------------------------------------
@ -636,14 +654,6 @@ static GLboolean initializeAppKit(void)
return GL_TRUE;
}
@interface GLFWWindow : NSWindow {}
@end
@implementation GLFWWindow
- (BOOL)canBecomeKeyWindow {
return YES; // Required for NSBorderlessWindowMask windows.
}
@end
// Create the Cocoa window
//
static GLboolean createWindow(_GLFWwindow* window,
@ -651,7 +661,7 @@ static GLboolean createWindow(_GLFWwindow* window,
{
unsigned int styleMask = 0;
if (wndconfig->monitor || wndconfig->undecorated)
if (wndconfig->monitor || !wndconfig->decorated)
styleMask = NSBorderlessWindowMask;
else
{

View File

@ -145,8 +145,8 @@ struct _GLFWhints
int auxBuffers;
GLboolean stereo;
GLboolean resizable;
GLboolean undecorated;
GLboolean visible;
GLboolean decorated;
int samples;
GLboolean sRGB;
int clientAPI;
@ -171,8 +171,8 @@ struct _GLFWwndconfig
int height;
const char* title;
GLboolean resizable;
GLboolean undecorated;
GLboolean visible;
GLboolean decorated;
int clientAPI;
int glMajor;
int glMinor;
@ -218,7 +218,7 @@ struct _GLFWwindow
// Window settings and state
GLboolean iconified;
GLboolean resizable;
GLboolean undecorated;
GLboolean decorated;
GLboolean visible;
GLboolean closed;
void* userPointer;

View File

@ -731,17 +731,20 @@ static int createWindow(_GLFWwindow* window,
}
else
{
window->win32.dwStyle |= WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
if (wndconfig->resizable)
if (wndconfig->decorated)
{
window->win32.dwStyle |= WS_MAXIMIZEBOX | WS_SIZEBOX;
window->win32.dwExStyle |= WS_EX_WINDOWEDGE;
}
window->win32.dwStyle |= WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
if (wndconfig->undecorated) {
window->win32.dwStyle = WS_POPUP;
window->win32.dwExStyle = 0;
if (wndconfig->resizable)
{
window->win32.dwStyle |= WS_MAXIMIZEBOX | WS_SIZEBOX;
window->win32.dwExStyle |= WS_EX_WINDOWEDGE;
}
}
else
{
window->win32.dwStyle = WS_POPUP;
window->win32.dwExStyle = 0;
}
xpos = CW_USEDEFAULT;

View File

@ -176,8 +176,8 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
wndconfig.height = height;
wndconfig.title = title;
wndconfig.resizable = _glfw.hints.resizable ? GL_TRUE : GL_FALSE;
wndconfig.undecorated = _glfw.hints.undecorated ? GL_TRUE : GL_FALSE;
wndconfig.visible = _glfw.hints.visible ? GL_TRUE : GL_FALSE;
wndconfig.decorated = _glfw.hints.decorated ? GL_TRUE : GL_FALSE;
wndconfig.clientAPI = _glfw.hints.clientAPI;
wndconfig.glMajor = _glfw.hints.glMajor;
wndconfig.glMinor = _glfw.hints.glMinor;
@ -216,7 +216,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
window->monitor = wndconfig.monitor;
window->resizable = wndconfig.resizable;
window->undecorated = wndconfig.undecorated;
window->decorated = wndconfig.decorated;
window->cursorMode = GLFW_CURSOR_NORMAL;
// Save the currently current context so it can be restored later
@ -278,10 +278,10 @@ void glfwDefaultWindowHints(void)
_glfw.hints.glMajor = 1;
_glfw.hints.glMinor = 0;
// The default is to show the window and allow window resizing
// The default is a visible, resizable window with decorations
_glfw.hints.resizable = GL_TRUE;
_glfw.hints.undecorated = GL_FALSE;
_glfw.hints.visible = GL_TRUE;
_glfw.hints.decorated = GL_TRUE;
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil
_glfw.hints.redBits = 8;
@ -336,8 +336,8 @@ GLFWAPI void glfwWindowHint(int target, int hint)
case GLFW_RESIZABLE:
_glfw.hints.resizable = hint;
break;
case GLFW_UNDECORATED:
_glfw.hints.undecorated = hint;
case GLFW_DECORATED:
_glfw.hints.decorated = hint;
break;
case GLFW_VISIBLE:
_glfw.hints.visible = hint;
@ -546,8 +546,8 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow* handle, int param)
return window->iconified;
case GLFW_RESIZABLE:
return window->resizable;
case GLFW_UNDECORATED:
return window->undecorated;
case GLFW_DECORATED:
return window->decorated;
case GLFW_VISIBLE:
return window->visible;
case GLFW_CLIENT_API:

View File

@ -442,6 +442,9 @@ static GLboolean initDisplay(void)
_glfw.x11.WM_DELETE_WINDOW = XInternAtom(_glfw.x11.display,
"WM_DELETE_WINDOW",
False);
_glfw.x11.MOTIF_WM_HINTS = XInternAtom(_glfw.x11.display,
"_MOTIF_WM_HINTS",
False);
// Check for XF86VidMode extension
_glfw.x11.vidmode.available =

View File

@ -118,6 +118,7 @@ typedef struct _GLFWlibraryX11
Atom NET_WM_STATE;
Atom NET_WM_STATE_FULLSCREEN;
Atom NET_ACTIVE_WINDOW;
Atom MOTIF_WM_HINTS;
// Selection atoms
Atom TARGETS;

View File

@ -57,6 +57,7 @@ typedef struct
#define MWM_HINTS_DECORATIONS (1L << 1)
// Translates an X Window key to internal coding
//
static int translateKey(int keycode)
@ -140,15 +141,18 @@ static GLboolean createWindow(_GLFWwindow* window,
return GL_FALSE;
}
if (wndconfig->undecorated) {
Atom motif_hints_atom = XInternAtom(_glfw.x11.display, "_MOTIF_WM_HINTS", False);
MotifWmHints motif_hints;
motif_hints.flags = MWM_HINTS_DECORATIONS;
motif_hints.decorations = 0;
if (!wndconfig->decorated)
{
MotifWmHints hints;
hints.flags = MWM_HINTS_DECORATIONS;
hints.decorations = 0;
XChangeProperty(_glfw.x11.display, window->x11.handle,
motif_hints_atom, motif_hints_atom, 32,
PropModeReplace,
(unsigned char *)&motif_hints, sizeof(MotifWmHints) / sizeof(long));
_glfw.x11.MOTIF_WM_HINTS,
_glfw.x11.MOTIF_WM_HINTS, 32,
PropModeReplace,
(unsigned char*) &hints,
sizeof(MotifWmHints) / sizeof(long));
}
}