Skip to content
  • Li Kai's avatar
    gesture: set widget x and y if coordinate translation between widgets fails · a1046a13
    Li Kai authored
    
    
    Bug Description: In a GTK+ application with a menu bar, clicking the
    menu item displays a dialog. However, when the user opens this dialog
    and drags the parent window's menu bar with the cursor, the dialog
    gets moved.
    Issue: When _gtk_gesture_update_point calls the _update_widget_coordinates
    function, the local variables x and y are not explicitly initialized, leading
    to arbitrary values. For instance, in my case, x was 32767 and y was
    -145750164 . These values are used in the subsequent call to
    gtk_widget_translate_coordinates. In gtk_widget_translate_coordinates,
    if ancestor is NULL, the function returns FALSE, and dest_x and dest_y
    are not updated. The incorrect values of x and y cause data->widget_x
    and data->widget_y to be incorrect, ultimately leading to abnormal
    x and y values in the gtk_gesture_drag_update function.
    
    To avoid this, we should set x and y to values clearly outside the widget.
    
    Signed-off-by: default avatarLi Kai <likai@kylinos.cn>
    a1046a13