From 907fc4edf3d743213b0f101ba023a2903de5771d Mon Sep 17 00:00:00 2001 From: thrust26 Date: Thu, 12 Nov 2020 14:37:50 +0100 Subject: [PATCH] minimized ContextMenu redraws fixed shading caused by ContextMenu --- src/gui/ContextMenu.cxx | 8 ++++++-- src/gui/Dialog.cxx | 11 ++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx index 9cf626657..a53f1c4ae 100644 --- a/src/gui/ContextMenu.cxx +++ b/src/gui/ContextMenu.cxx @@ -346,8 +346,12 @@ int ContextMenu::findItem(int x, int y) const void ContextMenu::drawCurrentSelection(int item) { // Change selection - _selectedOffset = item; - setDirty(); + if(_selectedOffset != item) + { + _selectedOffset = item; + cerr << "ContextMenu" << endl; + setDirty(); + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 6f8867cfb..fe0d06d37 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -240,7 +240,15 @@ void Dialog::render() surface->render(); }); } - if(parent().myDialogStack.top() != this) + + //cerr << "is ContextMenu " + // << (typeid(*parent().myDialogStack.top()) == typeid(ContextMenu)) << endl; + + // Dialog is still on top if e.g a ContextMenu is opened + if(!(parent().myDialogStack.top() == this) + && !((parent().myDialogStack.get(parent().myDialogStack.size() - 2) == this + //&& !(typeid(*parent().myDialogStack.top()) == typeid(ContextMenu))) + && !parent().myDialogStack.top()->hasTitle()))) { if(_shadeSurface == nullptr) { @@ -432,6 +440,7 @@ void Dialog::drawDialog() || (parent().myDialogStack.get(parent().myDialogStack.size() - 2) == this && !parent().myDialogStack.top()->hasTitle()); + cerr << "on top " << isOnTop() << endl; if(clearsBackground()) { // cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl;