Gtk2::TargetEntry(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– Gtk2::TargetEntry πŸ’–

okay so bestie, welcome to Gtk2::TargetEntry β€” that's the Gtk2::TargetEntry(3) page, straight outta the User Contributed Perl Documentation collection. sit down, grab a strawberry πŸ“, we're gonna talk about drag types. yes really. it's gonna be iconic, trust.


✨ SYNOPSIS ✨

you can write it two ways, and both are valid, no cap:

# as a HASH
$target_entry = {
    target => 'text/plain', # some string representing the drag type
    flags => [], # Gtk2::TargetFlags
    info => 42,  # some app-defined integer identifier
};

# as an ARRAY, for compactness
$target_entry = [ $target, $flags, $info ];

so like β€” hash if you wanna be ✨expressive✨, array if you're in your minimalism era. both eat. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so a Gtk2::TargetEntry data structure represents a single type of data that a widget can supply for a selection, or that gets supplied or received during drag-and-drop. it's giving tiny little ID card for one drag type. πŸŽ€

inside it there's:

  • a string representing the drag type,
  • a flags field β€” and heads up, this one is used only for drag and drop, see Gtk2::TargetFlags,
  • and an application assigned integer ID.

and the way that integer ID comes back?? it gets passed later as a signal parameter for signals like "selection_get". πŸ‘‘

why do we care, you ask? because it lets the application identify the target type without extensive string compares. no string compare grindset. we're just out here vibing with ints. periodt.


🌈 ENUMS AND FLAGS 🌈

flags Gtk2::TargetFlags

here's the whole menu, no skips, no substitutions:

  • 'same-app' / 'GTK_TARGET_SAME_APP'
  • 'same-widget' / 'GTK_TARGET_SAME_WIDGET'
  • 'other-app' / 'GTK_TARGET_OTHER_APP'
  • 'other-widget' / 'GTK_TARGET_OTHER_WIDGET'

four flags, all accounted for, iykyk. 🌸


πŸ”₯ SEE ALSO πŸ”₯

go check out Gtk2 and Gtk2::TargetList β€” they're the rest of this little friend group. 🫢


Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.

ngl, always read the license. it's the vibe check for legal stuff. πŸ’€

and that's the whole page, bestie!! ✨ this gorgeous little number shipped as perl v5.42.0 on 2025-07-25 β€” so when you cite it, cite it right. mwah, bye πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from