GtkGesture ラスト、GtkGestureDrag を。
マウスでドラッグすると文字列が着いてくるサンプルコード。
#!/usr/bin/env python3
 
import gi, sys
gi.require_version('Gtk', '4.0')
from gi.repository import Gtk
class Win(Gtk.ApplicationWindow):
    '''
        GtkGestureDrag Sample Code
    '''
    def __init__(self, app):
        Gtk.ApplicationWindow.__init__(self, application=app)
        # var
        self.offset_x = 50
        self.offset_y = 50
        self.draw_x = 0
        self.draw_y = 0
        # gesture drag
        drag = Gtk.GestureDrag()
        drag.connect('drag-begin', self.on_gesture_drag_begin)
        drag.connect('drag-update', self.on_gesture_drag_update)
        drag.connect('drag-end', self.on_gesture_drag_end)
        self.add_controller(drag)
        # view
        self.view = Gtk.DrawingArea()
        self.view.set_draw_func(self.view_draw_func)
        self.set_child(self.view)
        # resize
        self.set_default_size(400, 300)
    def view_draw_func(self, da, cr, width, height):
        cr.move_to(self.draw_x + self.offset_x, self.draw_y + self.offset_y)
        cr.set_font_size(36)
        cr.show_text('Drag and Drop')
    def on_gesture_drag_begin(self, ges, offset_x, offset_y):
        pass
    def on_gesture_drag_end(self, ges, offset_x, offset_y):
        self.offset_x += offset_x
        self.offset_y += offset_y
    def on_gesture_drag_update(self, ges, offset_x, offset_y):
        self.draw_x = offset_x
        self.draw_y = offset_y
        self.view.queue_draw()
class App(Gtk.Application):
    def __init__(self):
        Gtk.Application.__init__(self)
    def do_startup(self):
        Gtk.Application.do_startup(self)
        Win(self)
    def do_activate(self):
        self.props.active_window.present()
app = App()
app.run(sys.argv)
それと残りに GtkGestureStylus なんてのがあるけど。
どう考えてもスタイラスペン用途だよなって。
持っていないし GNOME てか Linux での使い道も思いつかない。
クリスタが Linux 対応するはずがないし、適材適所だよ。
なので無視でいいかなって。
ところでコレはファイルマネージャからのドロップではない。
GTK4 は drag_dest_add_uri_targets が使えないね。
Drag & dropping files with GTK4 – Platform – GNOME Discourse
こんなのを見つけたけど同じ所でクラッシュする。
うーん、今日もゲンナリするくらい進まない。
