Changeset 4484


Ignore:
Timestamp:
2003-06-05T12:43:33+12:00 (21 years ago)
Author:
mdewsnip
Message:

Improved the window positioning code. With some window managers, setting the location of the window causes it to be offset by a certain amount. This is now detected and compensated for.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r4482 r4484  
    251251        g_man.display();
    252252
    253                 // Center the screen, if this is do-able (not under most linux window managers apparently. In fact you're lucky if they listen to any of your screen size requests).
    254         // g_man.setLocation((config.screen_size.width - size.width) / 2, (config.screen_size.height - size.height) / 2);
    255         g_man.setBounds(bounds);
     253        // Place the window in the desired location on the screen, if this is do-able (not under most linux window managers apparently. In fact you're lucky if they listen to any of your screen size requests).
     254        g_man.setLocation(bounds.x, bounds.y);
    256255        g_man.setVisible(true);
    257                 // The 'after-display' triggers several events which don't occur until after the visual components are actually available on screen. Examples of these would be the various html renderings, as they can't happen offscreen.
     256
     257        // After the window has been made visible, check that it is in the correct place
     258        Point location = g_man.getLocation();
     259        int x_offset = bounds.x - location.x;
     260        int y_offset = bounds.y - location.y;
     261        // If not, offset the window to move it into the correct location
     262        if (x_offset > 0 || y_offset > 0) {
     263        g_man.setLocation(bounds.x + x_offset, bounds.y + y_offset);
     264        }
     265
     266        // The 'after-display' triggers several events which don't occur until after the visual components are actually available on screen. Examples of these would be the various html renderings, as they can't happen offscreen.
    258267        g_man.afterDisplay();
    259268                // Hide the splash.
Note: See TracChangeset for help on using the changeset viewer.