[Tickit-dev] Drag/Drop events on Windows - same event structure?
Paul "LeoNerd" Evans
leonerd at leonerd.org.uk
Sat Dec 26 22:06:22 GMT 2015
Merry Christmas all :)
I'm doing that most traditional of christmas-time activities; namely
the parental visit involving spending spare time sitting writing code.
Today I thought I'd have a quick hack at putting mouse drag/drop events
into libtickit. As ever, this takes as its inspiration the perl unit
tests, on the aim to recreate the same API shape.
https://metacpan.org/source/PEVANS/Tickit-0.54/t/29window-dragndrop.t
Currently, the drag/drop events just contain the same mouse button and
position information that regular mouse events have, so these could be
implemented by extending the TickitMouseEventType enumeration:
typedef enum {
...,
TICKIT_MOUSEEV_DRAG_START,
TICKIT_MOUSEEV_DRAG_OUTSIDE,
TICKIT_MOUSEEV_DRAG_DROP,
TICKIT_MOUSEEV_DRAG_STOP,
} TickitMouseEventType;
Something I've been considering for a later version though is to put
window information in the events too. That on a drag-over/outside/drop
event you'd also be told what the start window was, and on a stop
event you'd be told where the drag eventually stopped. This would
involve adding some TickitWindow*-typed fields to whatever event info
structure was representing drag events.
The summary of the question then is:
Should window drag events reuse the existing mouse structure, or
invent their own?
Issues on each side:
Reuse:
- Needs adding a 'source' or 'destination' window field that
term-level events don't use
+ Simplifies handling code
New structure:
- Two different kinds of events with similar routing/handling
structure that have to be handled the same in the window layer
+ Cleaner API split
I'm slightly leaning toward the first idea, largely because it involves
less code duplication and gets something working currently; but I'd be
interested to hear people's thoughts...
--
Paul "LeoNerd" Evans
leonerd at leonerd.org.uk
http://www.leonerd.org.uk/ | https://metacpan.org/author/PEVANS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://mail.leonerd.org.uk/pipermail/tickit-dev/attachments/20151226/9e7982d2/attachment.sig>
More information about the Tickit-dev
mailing list