Improves RT window position management, fixes #6233 (#6239)

* Improves RT window events detection and RT window position computation

* Fixes some limitations in specific cases for Windows and MacOS

* Fixes RT window not restoring saved position at startup

- When maximized at startup, RT window position wasn't restored from
options file. So when unmaximazing RT, position was set to up left
corner instead of restored one
- Other fix: Removed some uses of deprecated Gtk functions

* Improves RT window management for independant edit window mode

Other fixes:
- Monitor ID wasn't correctly computed
- Removes some other deprecated functions uses
- Removes debug printf

* Fixes editor window aspects not restored in MEOW mode on Linux

Other fixes:
- Removes some Gtk warnings when adding a new editor panel in MEOW mode
- Adds robustness to avoid RT windows outside screen at startup loading
corrupted options file with negative position values

* Fixes incorrect max position saturation in dual screen configurations
This commit is contained in:
Pandagrapher
2021-06-21 21:22:14 +02:00
committed by GitHub
parent 7e36240f3a
commit 491b57bee7
6 changed files with 232 additions and 101 deletions

View File

@@ -21,6 +21,7 @@
#include <gtkmm.h>
#include "rtimage.h"
#include "guiutils.h"
class EditorPanel;
class RTWindow;
@@ -40,17 +41,20 @@ private:
bool isFullscreen;
bool isClosed;
bool isMinimized;
sigc::connection onConfEventConn;
void toggleFullscreen ();
void restoreWindow();
bool updateResolution();
void setAppIcon();
IdleRegister idle_register;
public:
// Check if the system has more than one display and option is set
static bool isMultiDisplayEnabled();
// Should only be created once, auto-creates window on correct display
static EditWindow* getInstance(RTWindow* p, bool restore = true);
// Should only be created once
static EditWindow* getInstance(RTWindow* p);
explicit EditWindow (RTWindow* p);
@@ -65,8 +69,10 @@ public:
bool keyPressed (GdkEventKey* event);
bool on_configure_event(GdkEventConfigure* event) override;
bool on_delete_event(GdkEventAny* event) override;
//bool on_window_state_event(GdkEventWindowState* event);
bool on_window_state_event(GdkEventWindowState* event) override;
void on_mainNB_switch_page(Gtk::Widget* page, guint page_num);
void set_title_decorated(Glib::ustring fname);
void on_realize () override;
void get_position(int& x, int& y) const;
void restoreWindow();
};