merge with Dev

This commit is contained in:
Desmis
2017-07-17 20:37:05 +02:00
4 changed files with 26 additions and 14 deletions

View File

@@ -88,7 +88,7 @@ void EditWindow::restoreWindow() {
int meowMonitor = 0;
if(isMultiDisplayEnabled()) {
if(options.meowMonitor >= 0) { // use display from last session if available
meowMonitor = std::min(options.meowMonitor, Gdk::Screen::get_default()->get_n_monitors());
meowMonitor = std::min(options.meowMonitor, Gdk::Screen::get_default()->get_n_monitors() - 1);
} else { // Determine the other display
const Glib::RefPtr< Gdk::Window >& wnd = parent->get_window();
meowMonitor = parent->get_screen()->get_monitor_at_window(wnd) == 0 ? 1 : 0;

View File

@@ -299,6 +299,7 @@ void Options::setDefaults ()
windowX = 0;
windowY = 0;
windowMaximized = true;
windowMonitor = 0;
meowMonitor = -1;
meowFullScreen = false;
meowMaximized = true;
@@ -1311,6 +1312,10 @@ int Options::readFromFile (Glib::ustring fname)
windowY = keyFile.get_integer ("GUI", "WindowY");
}
if (keyFile.has_key ("GUI", "WindowMonitor")) {
windowMonitor = keyFile.get_integer ("GUI", "WindowMonitor");
}
if (keyFile.has_key ("GUI", "MeowMonitor")) {
meowMonitor = keyFile.get_integer ("GUI", "MeowMonitor");
}
@@ -2106,6 +2111,7 @@ int Options::saveToFile (Glib::ustring fname)
keyFile.set_integer ("GUI", "WindowHeight", windowHeight);
keyFile.set_integer ("GUI", "WindowX", windowX);
keyFile.set_integer ("GUI", "WindowY", windowY);
keyFile.set_integer ("GUI", "WindowMonitor", windowMonitor);
keyFile.set_integer ("GUI", "MeowMonitor", meowMonitor);
keyFile.set_boolean ("GUI", "MeowFullScreen", meowFullScreen);
keyFile.set_boolean ("GUI", "MeowMaximized", meowMaximized);

View File

@@ -138,6 +138,7 @@ public:
int windowWidth;
int windowHeight;
bool windowMaximized;
int windowMonitor;
int meowMonitor;
bool meowFullScreen;
bool meowMaximized;

View File

@@ -128,11 +128,19 @@ RTWindow::RTWindow ()
set_default_size(options.windowWidth, options.windowHeight);
set_modal(false);
Gdk::Rectangle lMonitorRect;
get_screen()->get_monitor_geometry(std::min(options.windowMonitor, Gdk::Screen::get_default()->get_n_monitors() - 1), lMonitorRect);
if (options.windowMaximized) {
move(lMonitorRect.get_x(), lMonitorRect.get_y());
maximize();
} else {
unmaximize();
move(options.windowX, options.windowY);
resize(options.windowWidth, options.windowHeight);
if(options.windowX <= lMonitorRect.get_x() + lMonitorRect.get_width() && options.windowY <= lMonitorRect.get_y() + lMonitorRect.get_height()) {
move(options.windowX, options.windowY);
} else {
move(lMonitorRect.get_x(), lMonitorRect.get_y());
}
}
on_delete_has_run = false;
@@ -597,15 +605,11 @@ bool RTWindow::on_delete_event(GdkEventAny* event)
bool isProcessing = false;
EditWindow* editWindow = nullptr;
if (isSingleTabMode() || simpleEditor) {
isProcessing = epanel->getIsProcessing();
} else if (options.multiDisplayMode > 0) {
editWindow = EditWindow::getInstance(this, false);
if (editWindow->isProcessing ()) {
return true;
}
isProcessing = editWindow->isProcessing();
} else {
int pageCount = mainNB->get_n_pages();
@@ -631,15 +635,14 @@ bool RTWindow::on_delete_event(GdkEventAny* event)
if ((isSingleTabMode() || simpleEditor) && epanel->isRealized()) {
epanel->saveProfile();
epanel->writeOptions ();
}
else {
if (options.multiDisplayMode > 0) {
} else {
if (options.multiDisplayMode > 0 && editWindow) {
editWindow->closeOpenEditors();
editWindow->writeOptions();
}
// Storing the options of the last EditorPanel before Gtk destroys everything
// Look at the active panel first, if any, otherwise look at the first one (sorted on the filename)
else if (epanels.size()) {
} else if (epanels.size()) {
// Storing the options of the last EditorPanel before Gtk destroys everything
// Look at the active panel first, if any, otherwise look at the first one (sorted on the filename)
int page = mainNB->get_current_page();
Gtk::Widget *w = mainNB->get_nth_page(page);
bool optionsWritten = false;
@@ -668,6 +671,8 @@ bool RTWindow::on_delete_event(GdkEventAny* event)
get_position (options.windowX, options.windowY);
}
options.windowMonitor = get_screen()->get_monitor_at_window(get_window());
Options::save ();
hide();