mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-13 12:08:45 +02:00
More work on DnD kitten
This commit is contained in:
@@ -67,12 +67,12 @@ func (dnd *dnd) reset_drag() {
|
||||
dnd.drag_status = drag_status{}
|
||||
}
|
||||
|
||||
func (dnd *dnd) on_drag_event(x, y int) (err error) {
|
||||
func (dnd *dnd) on_drag_event(x, y, operation int) (err error) {
|
||||
switch x {
|
||||
case 1:
|
||||
dnd.drag_status.accepted_mime = y
|
||||
case 2:
|
||||
dnd.drag_status.accepted_operation = y
|
||||
dnd.drag_status.accepted_operation = operation
|
||||
case 3:
|
||||
dnd.drag_status.dropped = true
|
||||
case 4:
|
||||
|
||||
@@ -222,6 +222,10 @@ func (dnd *dnd) run_loop() (err error) {
|
||||
dnd.send_test_response(strings.Join(dnd.drop_status.uri_list, "|"))
|
||||
case "DRAG_ACTIVE":
|
||||
dnd.send_test_response(utils.IfElse(dnd.drag_status.active, "DRAG_ACTIVE", "DRAG_INACTIVE"))
|
||||
case "DRAG_OK":
|
||||
dnd.send_test_response(utils.IfElse(dnd.drag_status.terminal_accepted_drag, "DRAG_OK", "DRAG_NOT_OK"))
|
||||
case "DRAG_STATUS":
|
||||
dnd.send_test_response(fmt.Sprintf("%s:%d:%v", dnd.drag_status.offered_mimes[dnd.drag_status.accepted_mime], dnd.drag_status.accepted_operation, dnd.drag_status.dropped))
|
||||
default:
|
||||
dnd.send_test_response("UNKNOWN TEST COMMAND: " + string(cmd.Payload))
|
||||
}
|
||||
@@ -249,7 +253,7 @@ func (dnd *dnd) run_loop() (err error) {
|
||||
case 'E':
|
||||
return dnd.on_drag_error(cmd)
|
||||
case 'e':
|
||||
return dnd.on_drag_event(cmd.X, cmd.Y)
|
||||
return dnd.on_drag_event(cmd.X, cmd.Y, cmd.Operation)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user