0
votes

I am hiding a preference window with gtk_widget_hide, but when I unhide it using gtk_widget_show, it shows up at the location where it was created, i.e. on the center of the screen, instead of where I left it. Looks like I'm overlooking a triviality: any help is appreciated.

1
This might be the way your window manager is set up. If my answer didn't help, please post your WM for reference.theGtknerd
I'm using Ubuntu 16.04 with window manager compiz.user2186577
A bit OT but why keep the window hidden instead of creating it every time the users need it? A preference window doesn't seem an recurrent action that deserves this kind of behavior. Other than that, @theGtknerd answer it's a very practical solution. Ĩ've used it in the past but even then, the window would be destroyed, recreated and moved to the last position before being shown. Good luck.José Fonte
The preference window has subpanels, which may or may not be visible, and I would like to maintain this state. Also, I would like to use the same principle for another window, with a tree view which may be partially collapsed/expanded. The easiest way to maintain the state of the internals of the window is to stick to that same window.user2186577

1 Answers

1
votes

You probably need gtk_window_get_position before hiding.

And then gtk_window_move after showing.