x11 - Saving window positions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • calris
    Adept
    • Mar 2016
    • 194

    x11 - Saving window positions

    I just did a MAJOR cleanup of main-x11 - I split the core X11 stuff out leaving main-x11.c as a more Angband Term centric file.

    I managed to get rid of practically all of the global variables, apart from metadpy which is kind of a global 'Display' object, so not too fussed about that.

    All that ugly xxx_set() crap is gone - side effect being a few more parameters to several functions, but now the code make more sense.

    And I fixed the issue with Angband not remembering where you moved windows too - YAY!... BUT... there could be a problem...

    Does anyone know what this is all about?
    Code:
    			/*
    			 * This doesn't seem to work under various WMs
    			 * since the decoration messes the position up
    			 *
    			 * Hack -- Use saved window positions.
    			 * This means that we won't remember ingame repositioned
    			 * windows, but also means that WMs won't screw predefined
    			 * positions up. -CJN-
    			 */
    This:
    Code:
    			/* Window specific location (x) */
    			file_putf(fff, "AT_X_%d=%d\n", i, td->win->x);
    
    			/* Window specific location (y) */
    			file_putf(fff, "AT_Y_%d=%d\n", i, td->win->y);
    was changed to this:

    Code:
    			/* Window specific location (x) */
    			file_putf(fff, "AT_X_%d=%d\n", i, td->win->x_save);
    
    			/* Window specific location (y) */
    			file_putf(fff, "AT_Y_%d=%d\n", i, td->win->y_save);
    Now when a window is moved, X Windows generates a ConfigureNotify event which we pick up in CheckEvent(). The handler updates td->win->x and ts->win->y which USED to be saved to the x11 preferences file.

    Long short short - if I revert the code, it works perfectly fine on my machine - Fedora, Mutter (Muffin). Question is, which window managers 'didn't work' which resulted in the nuking of a very useful feature?
  • takkaria
    Veteran
    • Apr 2007
    • 1951

    #2
    Originally posted by calris
    Does anyone know what this is all about? [snip]

    Long short short - if I revert the code, it works perfectly fine on my machine - Fedora, Mutter (Muffin). Question is, which window managers 'didn't work' which resulted in the nuking of a very useful feature?
    I vaguely remember this. I think the issue was that under some window managers, saving the position and then re-loading with that position actually offsets the windows by however much space the WM's window decorations take up. I could be wrong, though.
    takkaria whispers something about options. -more-

    Comment

    • AnonymousHero
      Veteran
      • Jun 2007
      • 1393

      #3
      Just to add a little to that: WMs under X11 are notoriously inconsistent about this kind of thing. However, I think most major ones should probably be alright at this point. (I think it might be that there's very little in the way of specs or that the extant specs are vague.) Even if they aren't I think it might be better to at least try to put the windows in the right place.

      Comment

      Working...
      😀
      😂
      🥰
      😘
      🤢
      😎
      😞
      😡
      👍
      👎