fix:Win+Up Win+Down to restore and save geometry

the above shortkey can not restore geometry after resize the window
clean code .
This commit is contained in:
xiaoyifang 2022-02-25 22:54:34 +08:00
parent aeee511859
commit 434dbd6e45

View file

@ -59,10 +59,6 @@
#include <windows.h>
#include "wstring.hh"
#include "wstring_qt.hh"
#define gdStoreNormalGeometryEvent ( ( QEvent::Type )( QEvent::User + 1 ) )
#define gdApplyNormalGeometryEvent ( ( QEvent::Type )( QEvent::User + 2 ) )
#endif
#ifdef HAVE_X11
@ -2473,25 +2469,6 @@ bool MainWindow::handleBackForwardMouseButtons ( QMouseEvent * event) {
bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
{
#ifdef Q_OS_WIN
// if( obj == this && ev->type() == gdStoreNormalGeometryEvent )
// {
// if( !isMaximized() && !isMinimized() && !isFullScreen() )
// cfg.normalMainWindowGeometry = normalGeometry();
// ev->accept();
// return true;
// }
// if( obj == this && ev->type() == gdApplyNormalGeometryEvent )
// {
// if( !isMaximized() && !isMinimized() && !isFullScreen() )
// {
// setGeometry( cfg.normalMainWindowGeometry );
// }
// ev->accept();
// return true;
// }
#endif
if ( ev->type() == QEvent::ShortcutOverride
|| ev->type() == QEvent::KeyPress )
{
@ -2544,14 +2521,6 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
{
QWindowStateChangeEvent *stev = static_cast< QWindowStateChangeEvent *>( ev );
wasMaximized = ( stev->oldState() == Qt::WindowMaximized && isMinimized() );
#ifdef Q_OS_WIN
if( stev->oldState() == Qt::WindowMaximized && !isMinimized() && cfg.normalMainWindowGeometry.width() > 0 )
{
QEvent *ev = new QEvent( gdApplyNormalGeometryEvent );
qApp->postEvent( this, ev );
}
#endif
}
if ( ev->type() == QEvent::MouseButtonPress ) {