Hello. I was wondering if anybody has GLFW3 knowledge, I can't figure out how to make the window floating. I tried defining GLFW_FLOATING to GLFW_TRUE but still nothing. Thank you ~mutex ~~~ #define GLFW_FLOATING GLFW_TRUE
#include <GLFW/glfw3.h> #include <stdio.h>
void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); }
int main(void) { glfwSetErrorCallback(error_callback);
GLFWwindow* window;
if (!glfwInit()) return -1;
window = glfwCreateWindow(SCRW, SCRH, "redacted", NULL, NULL); if (!window) { glfwTerminate(); return -1; }
/* Make the window's context current */ glfwMakeContextCurrent(window);
/* Loop until the user closes the window */ while (!glfwWindowShouldClose(window)) { /* Render here */ glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */ glfwSwapBuffers(window);
/* Poll for and process events */ glfwPollEvents(); }
glfwTerminate(); return 0; } ~~~
Looks like I can send attachments, my GPG signature got sent. I will resend the file as an attachment. Sorry.
On Mon, Jun 26, 2023 at 11:15:46AM +0100, Nathan wrote:
Hello. I was wondering if anybody has GLFW3 knowledge, I can't figure out how to make the window floating. I tried defining GLFW_FLOATING to GLFW_TRUE but still nothing. Thank you ~mutex
...
On 26 June 2023 13:18:08 EEST, Nathan mutex@tilde.club wrote:
Looks like I can send attachments, my GPG signature got sent. I will resend the file as an attachment. Sorry.
On Mon, Jun 26, 2023 at 11:15:46AM +0100, Nathan wrote:
Hello. I was wondering if anybody has GLFW3 knowledge, I can't figure out how to make the window floating. I tried defining GLFW_FLOATING to GLFW_TRUE but still nothing. Thank you ~mutex
...
Hi ~mutex,
I'm not sure what you mean by floating, as GLFW uses that word to mean "always on top". Assuming that's what you meant...
You need to call glfwWindowHint(GLFW_FLOATING, GLFW_TRUE);
...before `glfwCreateWindow'.
You should have also gotten a compiler warning about `GLFW_FLOATING' being already defined. Macros are defined with the `define' preprocessor directive, but that's not what "they" meant. :-) "They" usually don't ask you to define preprocessor macros, unless (very) explicitly stated (e.g. `#define NOMINMAX'). Usually you need to look around for an accompanying "set" function or bitfield.
If you meant floating vs tiled windows (in the X11 sense), you'll need to provide a bit more context...
Refs: https://www.glfw.org/docs/latest/group__window.html#ga7d9c8c62384b1e2821c4dc... https://www.glfw.org/docs/latest/window_guide.html#window_hints
Off topic, but it's probably better to include (minified) code snippets in the email text than requiring someone (e.g. me) to open the attachment to look at 3 lines of C(++). Of course, for 100s of lines of code, attachments or a link to a tildegit repo works better ;-)
Cheers, ~alzwded
Nathan wrote:
I was wondering if anybody has GLFW3 knowledge, I can't figure out how to make the window floating. I tried defining GLFW_FLOATING to GLFW_TRUE but still nothing.
#define GLFW_FLOATING GLFW_TRUE // ...
Don't redefine GLFW's constants. Window hints are intended to be set before creating the window with glfwWindowHint. Window creation hints are documented here: https://www.glfw.org/docs/latest/window.html#window_hints
glfwSetWindowHint(GLFW_FLOATING, GLFW_TRUE); GLFWwindow* window = glfwCreateWindow(...);
In the case of GLFW_FLOATING, it is also a window attribute and can be set after the window is created as well, if you wish. Window attributes are documented here: https://www.glfw.org/docs/latest/window_guide.html#window_attribs
GLFWwindow* window = glfwCreateWindow(...); if (window == NULL) { /* ... */ } glfwSetWindowAttrib(window, GLFW_FLOATING, GLFW_TRUE);
On Mon, Jun 26, 2023 at 12:24:36PM +0000, entoreor wrote:
Don't redefine GLFW's constants. Window hints are intended to be set before creating the window with glfwWindowHint. Window creation hints are documented here: https://www.glfw.org/docs/latest/window.html#window_hints
Hello, I have tried all 3 options, non of them give the effect I was looking for. Another user pointed out that `GLFW_FLOATING` might not be what i'm looking for, how would I make a window floating (in the context of a tiling window manager)
Thank you! ~mutex
Nathan wrote:
Another user pointed out that `GLFW_FLOATING` might not be what i'm looking for, how would I make a window floating (in the context of a tiling window manager)
Make the window not able to be resized. This can be done by setting the GLFW_RESIZABLE hint or attribute to GLFW_FALSE. I'm not sure how dwm or other window managers handle it, but i3 at least will respect it by putting the window into floating mode automatically if it is spawned with GLFW_RESIZABLE GLFW_FALSE. The window can still be forced into tiling mode or made fullscreen if the user presses the right shortcut though, which will cause the window to be resized anyway. Many applications don't respond well to this.
On 23/06/26 10:13PM, entoreor wrote:
Nathan wrote: ... Make the window not able to be resized. This can be done by setting the GLFW_RESIZABLE hint or attribute to GLFW_FALSE. I'm not sure how dwm or other window managers handle it, but i3 at least will respect it by putting the window into floating mode automatically if it is spawned with GLFW_RESIZABLE GLFW_FALSE.
Hello, I tried setting `glfwSetWindowAttrib(window, GLFW_RESIZABLE, GLFW_FALSE)` but DWM refuses to float it :(.
The window can still be forced into tiling mode or made fullscreen if the user presses the right shortcut though, which will cause the window to be resized anyway. Many applications don't respond well to this.
True, The size isn't preserved when toggling floating, meaning the window will be the same size as before the float.
Thank you. ~mutex
tildeclub@lists.tildeverse.org