fullscreen improvements attempts

main
Dominik Madarász 2024-08-15 19:49:41 +02:00
parent 42779f47e6
commit 79f75e141b
6 changed files with 61 additions and 0 deletions

View File

@ -2049,6 +2049,7 @@ enum WINDOW_FLAGS {
WINDOW_FIXED = 0x200,
WINDOW_TRANSPARENT = 0x400,
WINDOW_BORDERLESS = 0x800,
WINDOW_TRUE_BORDERLESS = 0x4000,
WINDOW_VSYNC_DISABLED = 0,
WINDOW_VSYNC_ADAPTIVE = 0x1000,
WINDOW_VSYNC = 0x2000,

View File

@ -18710,6 +18710,7 @@ enum WINDOW_FLAGS {
WINDOW_FIXED = 0x200, // disable resizing
WINDOW_TRANSPARENT = 0x400,
WINDOW_BORDERLESS = 0x800,
WINDOW_TRUE_BORDERLESS = 0x4000,
WINDOW_VSYNC_DISABLED = 0,
WINDOW_VSYNC_ADAPTIVE = 0x1000,
@ -391375,7 +391376,9 @@ void window_hints(unsigned flags) {
#endif
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //osx+ems
glfwWindowHint(GLFW_STENCIL_BITS, 8); //osx
#if DEBUG
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
#endif
//glfwWindowHint( GLFW_RED_BITS, 8 );
//glfwWindowHint( GLFW_GREEN_BITS, 8 );
@ -391467,12 +391470,19 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
bool FLAGS_FULLSCREEN = scale > 100;
bool FLAGS_FULLSCREEN_DESKTOP = scale == 100;
bool FLAGS_WINDOWED = scale < 100;
bool FLAGS_TRUE_BORDERLESS = flags & WINDOW_TRUE_BORDERLESS;
bool FLAGS_TRANSPARENT = flag("--transparent") || (flags & WINDOW_TRANSPARENT);
if( FLAGS_TRANSPARENT ) FLAGS_FULLSCREEN = 0, FLAGS_FULLSCREEN_DESKTOP = 0, FLAGS_WINDOWED = 1;
scale = (scale > 100 ? 100 : scale) / 100.f;
int winWidth = window_canvas().w * scale;
int winHeight = window_canvas().h * scale;
if (FLAGS_TRUE_BORDERLESS) {
FLAGS_FULLSCREEN = FLAGS_FULLSCREEN_DESKTOP = 0;
FLAGS_WINDOWED = 1;
flags |= WINDOW_BORDERLESS;
}
/*
if (tests_captureframes()) {
winWidth = 1280;
@ -391504,6 +391514,7 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE);
}
if( flags & WINDOW_BORDERLESS ) {
// glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE);
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
}
#endif
@ -391579,6 +391590,10 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
glfwSetWindowAttrib(window, GLFW_DECORATED, GLFW_FALSE); // @todo: is decorated an attrib or a hint?
if( scale >= 1 ) glfwMaximizeWindow(window);
}
if ( FLAGS_TRUE_BORDERLESS ) {
if( scale >= 1 ) glfwMaximizeWindow(window);
glfwSetWindowSize(window, w, h);
}
#endif
g->ctx = ui_ctx;
@ -391586,6 +391601,11 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
g->window = window;
g->width = window_width();
g->height = window_height();
PRINTF("Window: %dx%d\n", g->width, g->height);
if (glfwRawMouseMotionSupported()) {
glfwSetInputMode(window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
}
// window_cursor(flags & WINDOW_NO_MOUSE ? false : true);
glfwSetDropCallback(window, window_drop_callback);

View File

@ -197,7 +197,9 @@ void window_hints(unsigned flags) {
#endif
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //osx+ems
glfwWindowHint(GLFW_STENCIL_BITS, 8); //osx
#if DEBUG
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
#endif
//glfwWindowHint( GLFW_RED_BITS, 8 );
//glfwWindowHint( GLFW_GREEN_BITS, 8 );
@ -289,12 +291,19 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
bool FLAGS_FULLSCREEN = scale > 100;
bool FLAGS_FULLSCREEN_DESKTOP = scale == 100;
bool FLAGS_WINDOWED = scale < 100;
bool FLAGS_TRUE_BORDERLESS = flags & WINDOW_TRUE_BORDERLESS;
bool FLAGS_TRANSPARENT = flag("--transparent") || (flags & WINDOW_TRANSPARENT);
if( FLAGS_TRANSPARENT ) FLAGS_FULLSCREEN = 0, FLAGS_FULLSCREEN_DESKTOP = 0, FLAGS_WINDOWED = 1;
scale = (scale > 100 ? 100 : scale) / 100.f;
int winWidth = window_canvas().w * scale;
int winHeight = window_canvas().h * scale;
if (FLAGS_TRUE_BORDERLESS) {
FLAGS_FULLSCREEN = FLAGS_FULLSCREEN_DESKTOP = 0;
FLAGS_WINDOWED = 1;
flags |= WINDOW_BORDERLESS;
}
/*
if (tests_captureframes()) {
winWidth = 1280;
@ -326,6 +335,7 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE);
}
if( flags & WINDOW_BORDERLESS ) {
// glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE);
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
}
#endif
@ -401,6 +411,10 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
glfwSetWindowAttrib(window, GLFW_DECORATED, GLFW_FALSE); // @todo: is decorated an attrib or a hint?
if( scale >= 1 ) glfwMaximizeWindow(window);
}
if ( FLAGS_TRUE_BORDERLESS ) {
if( scale >= 1 ) glfwMaximizeWindow(window);
glfwSetWindowSize(window, w, h);
}
#endif
g->ctx = ui_ctx;
@ -408,6 +422,11 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
g->window = window;
g->width = window_width();
g->height = window_height();
PRINTF("Window: %dx%d\n", g->width, g->height);
if (glfwRawMouseMotionSupported()) {
glfwSetInputMode(window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
}
// window_cursor(flags & WINDOW_NO_MOUSE ? false : true);
glfwSetDropCallback(window, window_drop_callback);

View File

@ -18,6 +18,7 @@ enum WINDOW_FLAGS {
WINDOW_FIXED = 0x200, // disable resizing
WINDOW_TRANSPARENT = 0x400,
WINDOW_BORDERLESS = 0x800,
WINDOW_TRUE_BORDERLESS = 0x4000,
WINDOW_VSYNC_DISABLED = 0,
WINDOW_VSYNC_ADAPTIVE = 0x1000,

View File

@ -26559,7 +26559,9 @@ void window_hints(unsigned flags) {
#endif
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //osx+ems
glfwWindowHint(GLFW_STENCIL_BITS, 8); //osx
#if DEBUG
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
#endif
//glfwWindowHint( GLFW_RED_BITS, 8 );
//glfwWindowHint( GLFW_GREEN_BITS, 8 );
@ -26651,12 +26653,19 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
bool FLAGS_FULLSCREEN = scale > 100;
bool FLAGS_FULLSCREEN_DESKTOP = scale == 100;
bool FLAGS_WINDOWED = scale < 100;
bool FLAGS_TRUE_BORDERLESS = flags & WINDOW_TRUE_BORDERLESS;
bool FLAGS_TRANSPARENT = flag("--transparent") || (flags & WINDOW_TRANSPARENT);
if( FLAGS_TRANSPARENT ) FLAGS_FULLSCREEN = 0, FLAGS_FULLSCREEN_DESKTOP = 0, FLAGS_WINDOWED = 1;
scale = (scale > 100 ? 100 : scale) / 100.f;
int winWidth = window_canvas().w * scale;
int winHeight = window_canvas().h * scale;
if (FLAGS_TRUE_BORDERLESS) {
FLAGS_FULLSCREEN = FLAGS_FULLSCREEN_DESKTOP = 0;
FLAGS_WINDOWED = 1;
flags |= WINDOW_BORDERLESS;
}
/*
if (tests_captureframes()) {
winWidth = 1280;
@ -26688,6 +26697,7 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE);
}
if( flags & WINDOW_BORDERLESS ) {
// glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE);
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
}
#endif
@ -26763,6 +26773,10 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
glfwSetWindowAttrib(window, GLFW_DECORATED, GLFW_FALSE); // @todo: is decorated an attrib or a hint?
if( scale >= 1 ) glfwMaximizeWindow(window);
}
if ( FLAGS_TRUE_BORDERLESS ) {
if( scale >= 1 ) glfwMaximizeWindow(window);
glfwSetWindowSize(window, w, h);
}
#endif
g->ctx = ui_ctx;
@ -26770,6 +26784,11 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) {
g->window = window;
g->width = window_width();
g->height = window_height();
PRINTF("Window: %dx%d\n", g->width, g->height);
if (glfwRawMouseMotionSupported()) {
glfwSetInputMode(window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
}
// window_cursor(flags & WINDOW_NO_MOUSE ? false : true);
glfwSetDropCallback(window, window_drop_callback);

View File

@ -4777,6 +4777,7 @@ enum WINDOW_FLAGS {
WINDOW_FIXED = 0x200, // disable resizing
WINDOW_TRANSPARENT = 0x400,
WINDOW_BORDERLESS = 0x800,
WINDOW_TRUE_BORDERLESS = 0x4000,
WINDOW_VSYNC_DISABLED = 0,
WINDOW_VSYNC_ADAPTIVE = 0x1000,