gui2: Delegate mouse cursor reset to modal dialogs

Currently it's the gui2::window class' responsibility, by inheriting
from cursor::setter (yes) and offering absolutely no way to control it.
Unfortunately, it turns out that this can cause issues with tooltips
resetting the cursor at unexpected times when they get
displayed/hidden while having widgets change the cursor depending on
whether they have the mouse focus or not.

Right now the only modeless dialog we have is the tooltip dialog, and
really there's no reason to say that modeless dialogs should have the
ability to reset the cursor without explicitly asking for it. As for
modal dialogs... I don't entirely agree that they should do it either,
but for tradition's sake, let's just keep the current behaviour with
them.

(In an ideal world the cursor business would be managed by the window
managaer IMO, but I'm not ready to argue my case.)
This commit is contained in:
Iris Morelle 2019-11-12 23:50:42 -03:00
parent 14c91f6e99
commit 47ddf8877f
3 changed files with 3 additions and 3 deletions

View File

@ -16,6 +16,7 @@
#include "gui/dialogs/modal_dialog.hpp"
#include "cursor.hpp"
#include "gui/auxiliary/field.hpp"
#include "gui/widgets/integer_selector.hpp"
#include "scripting/plugins/context.hpp"
@ -85,6 +86,7 @@ bool modal_dialog::show(const unsigned auto_close_time)
pre_show(*window_);
{ // Scope the window stack
cursor::setter{cursor::NORMAL};
window_stack_handler push_window_stack(window_);
retval_ = window_->show(restore_, auto_close_time);
}

View File

@ -273,7 +273,6 @@ window* manager::get_window(const unsigned id)
window::window(const builder_window::window_resolution* definition)
: panel(implementation::builder_window(::config {"definition", definition->definition}), type())
, cursor::setter(cursor::NORMAL)
, video_(CVideo::get_singleton())
, status_(NEW)
, show_mode_(none)

View File

@ -20,7 +20,6 @@
#pragma once
#include "cursor.hpp"
#include "formula/callable.hpp"
#include "formula/function.hpp"
#include "gui/auxiliary/typed_formula.hpp"
@ -60,7 +59,7 @@ class distributor;
* base class of top level items, the only item
* which needs to store the final canvases to draw on
*/
class window : public panel, public cursor::setter
class window : public panel
{
friend class debug_layout_graph;
friend window* build(const builder_window::window_resolution*);