Ticket #8735: patch

File patch, 957 bytes (added by humdinger, 12 years ago)

Move window when it'd be outside the screen

  • src/apps/icon-o-matic/IconEditorApp.cpp

    diff --git a/src/apps/icon-o-matic/IconEditorApp.cpp b/src/apps/icon-o-matic/IconEditorApp.cpp
    index 27f73a9..c1f9760 100644
    a b  
    1818#include <Message.h>
    1919#include <Mime.h>
    2020#include <Path.h>
     21#include <Screen.h>
    2122#include <storage/FindDirectory.h>
    2223
    2324#include "support_settings.h"
    MainWindow*  
    273274IconEditorApp::_NewWindow()
    274275{
    275276    fLastWindowFrame.OffsetBy(kWindowOffset, kWindowOffset);
     277
     278    BScreen screen(B_MAIN_SCREEN_ID);
     279    if (!(screen.Frame().Contains(fLastWindowFrame))) {
     280        if (fLastWindowFrame.right > screen.Frame().right) {
     281            fLastWindowFrame.OffsetTo(5.0f, fLastWindowFrame.top);
     282        }
     283        if (fLastWindowFrame.bottom > screen.Frame().bottom) {
     284            fLastWindowFrame.OffsetTo(fLastWindowFrame.left, 26.0f);
     285        }
     286    }
     287
    276288    MainWindow* window = new MainWindow(fLastWindowFrame, this,
    277289        &fLastWindowSettings);
    278290    fWindowCount++;