Search code examples
c++user-interfacegtkmm

Gtkmm - fixed window's position?


Is there a good way for preventing a window from being moved in gtkmm?

At first I tried to do this by overloading on_configure_event (forcibly move window to fixed position), but this caused some strange graphical glitches and huge slowdowns during a resize of window.


Solution

  • Window position is usually a responsibility of the Window Manager, not of the application. You are fighting the system, and hence the glitches.

    My advice is: just don't do it. The user should be able to move the window.

    If you really need this, the best thing is to tell the Window Manager not to manage your window, and then do the managing tasks you still need yourself (resizing the window, for example).

    For details, see the function gtk_window_set_decorated() and the GTK_WINDOW_POPUP argument to gtk_window_new().