fix odd behaviour of gdk_window_get_pointer(), used to determine if the mouse pointer is inside the track canvas

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@11626 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-03-09 16:56:45 +00:00
parent c3fdfd2d56
commit 170514df72
3 changed files with 19 additions and 0 deletions

View File

@ -593,6 +593,7 @@ class Editor : public PublicEditor
ArdourCanvas::Canvas* track_canvas;
ArdourCanvas::NoEventText* verbose_canvas_cursor;
bool verbose_cursor_visible;
bool within_track_canvas;
void parameter_changed (const char *);

View File

@ -121,6 +121,7 @@ Editor::initialize_canvas ()
delete font;
verbose_cursor_visible = false;
within_track_canvas = false;
/* on the bottom, an image */
@ -795,6 +796,7 @@ Editor::stop_canvas_autoscroll ()
bool
Editor::left_track_canvas (GdkEventCrossing *ev)
{
within_track_canvas = false;
set_entered_track (0);
set_entered_regionview (0);
reset_canvas_action_sensitivity (false);
@ -804,6 +806,7 @@ Editor::left_track_canvas (GdkEventCrossing *ev)
bool
Editor::entered_track_canvas (GdkEventCrossing *ev)
{
within_track_canvas = true;
reset_canvas_action_sensitivity (true);
return FALSE;
}

View File

@ -73,6 +73,21 @@ using namespace Editing;
bool
Editor::mouse_frame (nframes64_t& where, bool& in_track_canvas) const
{
/* gdk_window_get_pointer() has X11's XQueryPointer semantics in that it only
pays attentions to subwindows. this means that menu windows are ignored, and
if the pointer is in a menu, the return window from the call will be the
the regular subwindow *under* the menu.
this matters quite a lot if the pointer is moving around in a menu that overlaps
the track canvas because we will believe that we are within the track canvas
when we are not. therefore, we track enter/leave events for the track canvas
and allow that to override the result of gdk_window_get_pointer().
*/
if (!within_track_canvas) {
return false;
}
int x, y;
double wx, wy;
Gdk::ModifierType mask;