[gimp] Bug 793777 - CRITICALs on focus change in MWM with stylus.



commit 845eb522b607eac0f5c47247193fbe123600db89
Author: Jehan <jehan girinstud io>
Date:   Mon Mar 19 15:14:36 2018 +0100

    Bug 793777 - CRITICALs on focus change in MWM with stylus.
    
    Focus change events were expecting the current tool control to be
    inactive, which was the case most of the time. Yet with stylus, the
    canvas was sometimes receiving GDK_BUTTON_PRESS events before
    GDK_FOCUS_CHANGE. In particular the canvas was receiving a button press
    before the focus out, then button release and focus in. Therefore by the
    time the focus out event happens, the tool control is active, which
    broke a few calls.
    Therefore I add a few checks and returns immediately when
    gimp_tool_control_is_active() return TRUE, especially since we also run
    gimp_display_shell_update_focus() calls after a button press anyway so
    the state should already be consistent.

 app/tools/tool_manager.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/app/tools/tool_manager.c b/app/tools/tool_manager.c
index 74309f0..ccc1560 100644
--- a/app/tools/tool_manager.c
+++ b/app/tools/tool_manager.c
@@ -390,7 +390,8 @@ tool_manager_focus_display_active (Gimp        *gimp,
 
   tool_manager = tool_manager_get (gimp);
 
-  if (tool_manager->active_tool)
+  if (tool_manager->active_tool &&
+      ! gimp_tool_control_is_active (tool_manager->active_tool->control))
     {
       gimp_tool_set_focus_display (tool_manager->active_tool,
                                    display);
@@ -448,7 +449,8 @@ tool_manager_oper_update_active (Gimp             *gimp,
 
   tool_manager = tool_manager_get (gimp);
 
-  if (tool_manager->active_tool)
+  if (tool_manager->active_tool &&
+      ! gimp_tool_control_is_active (tool_manager->active_tool->control))
     {
       gimp_tool_oper_update (tool_manager->active_tool,
                              coords, state, proximity,
@@ -468,7 +470,8 @@ tool_manager_cursor_update_active (Gimp             *gimp,
 
   tool_manager = tool_manager_get (gimp);
 
-  if (tool_manager->active_tool)
+  if (tool_manager->active_tool &&
+      ! gimp_tool_control_is_active (tool_manager->active_tool->control))
     {
       gimp_tool_cursor_update (tool_manager->active_tool,
                                coords, state,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]