@@ -1278,7 +1278,8 @@ def populate(self, active_person):
12781278 # set the busy cursor, so the user knows that we are working
12791279 self .uistate .set_busy_cursor (True )
12801280
1281- self ._in_drag = False
1281+ self ._in_drag = False # True - when drag can be started
1282+ self ._do_drag = False # True - when drag is started
12821283 self .clear ()
12831284 self .active_person_handle = active_person
12841285
@@ -1448,7 +1449,10 @@ def motion_notify_event(self, _item, _target, event):
14481449 self .vadjustment .set_value (new_y )
14491450 return True
14501451
1451- if self ._in_drag and (event .type == Gdk .EventType .MOTION_NOTIFY ):
1452+ if not (event .type == Gdk .EventType .MOTION_NOTIFY ):
1453+ return False
1454+
1455+ if self ._in_drag and (not self ._do_drag ):
14521456 # start drag when cursor moved more then 5
14531457 # to separate it from simple click
14541458 if ((abs (self ._last_x - event .x_root ) > 5 )
@@ -1462,11 +1466,8 @@ def motion_notify_event(self, _item, _target, event):
14621466
14631467 # translate to drag_widget coords
14641468 scale_coef = self .canvas .get_scale ()
1465- bounds = self .canvas .get_root_item ().get_bounds ()
1466- height_canvas = bounds .y2 - bounds .y1
14671469 x = self ._last_x * scale_coef - self .hadjustment .get_value ()
1468- y = ((height_canvas + self ._last_y ) * scale_coef -
1469- self .vadjustment .get_value ())
1470+ y = self ._last_y * scale_coef - self .vadjustment .get_value ()
14701471
14711472 # setup targets
14721473 tglist = Gtk .TargetList .new ([])
@@ -1485,14 +1486,12 @@ def motion_notify_event(self, _item, _target, event):
14851486 # allow drag to a text document, info on drag_get will be 1
14861487 tglist .add_text_targets (1 )
14871488
1488- drag_widget = self .get_widget ()
1489- # change event window
1490- event .window = drag_widget .get_window ()
14911489 # start drag
1490+ drag_widget = self .get_widget ()
14921491 drag_widget .drag_begin_with_coordinates (
14931492 tglist ,
14941493 Gdk .DragAction .COPY ,
1495- Gdk . KEY_Pointer_Button1 ,
1494+ 1 , # left mouse button = 1
14961495 event ,
14971496 x , y )
14981497 return True
@@ -1591,6 +1590,7 @@ def cb_drag_begin(self, widget, context):
15911590 """
15921591 Called on start drag.
15931592 """
1593+ self ._do_drag = True
15941594 tgs = [x .name () for x in context .list_targets ()]
15951595 # set icon depending on person or family drag
15961596 if DdTargets .PERSON_LINK .drag_type in tgs :
@@ -1603,6 +1603,7 @@ def cb_drag_end(self, widget, context):
16031603 Called when drag is end.
16041604 """
16051605 self ._in_drag = False
1606+ self ._do_drag = False
16061607
16071608 def cb_drag_data_get (self , widget , context , sel_data , info , time ):
16081609 """
0 commit comments