Not able to set window position

sheeri185adidam wrote on Wednesday, July 29, 2015:

Hi,

I am creating a window without the border by setting window hint GLFW_DECORATED to false.
If I am not wrong, this is not a fullscreen window but borderless window, right ?
The documentation says that we can not move(set position) fullscreen window.

I tried to move this borderless window by using glfwSetWindowPos() function but the window does not move.
Any idea what is wrong here ?

Thanks.

elmindreda wrote on Wednesday, July 29, 2015:

Did you specify a monitor?

sheeri185adidam wrote on Wednesday, July 29, 2015:

no. I did not.
I don’t want fullscreen windows but borderless ones.

sheeri185adidam wrote on Wednesday, July 29, 2015:

this is on X windows (suse linux)

elmindreda wrote on Wednesday, July 29, 2015:

Are you moving the window before or after you show it?

sheeri185adidam wrote on Wednesday, July 29, 2015:

I am trying to move the window immediately after creating it.

window_handle_ = glfwCreateWindow(bounds_.width, bounds_.height, name_.c_str(),NULL,NULL);
glfwSetWindowPos(window_handle_, bounds_.x, bounds_.y);

elmindreda wrote on Wednesday, July 29, 2015:

Window managers are free to override window placement. Perhaps yours is.

sheeri185adidam wrote on Thursday, July 30, 2015:

makes sense.
Thanks.

arampl wrote on Thursday, July 30, 2015:

Try to set window position twice like this:

glfwSetWindowPos(mainwindow, posx, posy);
glfwShowWindow(mainwindow);
glfwSetWindowSize(mainwindow, width, height);
glfwSetWindowPos(mainwindow, posx, posy);

Helped me on Linux (Xubuntu). (mainwindow is initially invisible)

1 Like

elmindreda wrote on Thursday, July 30, 2015:

Is it a small window or big? Where are you trying to move it to and why? Are you calculating the position and if so have you verified that it’s sane?

arampl wrote on Thursday, July 30, 2015:

Maybe OP just wanted his own window decorations - title bar, window buttons - and allow user to move this window around by dragging like normal window.

My application works fine with and without decorations, no matter what window size, even if it is partially outside screen or wider/taller. Can switch to fullscreen and back without problems.

I save last position and size of the window in external file on exit and load this values on start.

Already tested it once more without decorations - it appears exactly where I want it to be on start and can be moved to anywhere during execution with glfwSetWindowPos.

My own purpose for this is trivial - application must remember its window (maybe multiple windows) layout from last session. Never liked apps that don’t do that. For example I must always reposition and resize pdf viewer (Evince) to read books comfortably.

this worked for me! thank you so much