Method

GtkMenupopup_for_device

Declaration [src]

void
gtk_menu_popup_for_device (
  GtkMenu* menu,
  GdkDevice* device,
  GtkWidget* parent_menu_shell,
  GtkWidget* parent_menu_item,
  GtkMenuPositionFunc func,
  gpointer data,
  GDestroyNotify destroy,
  guint button,
  guint32 activate_time
)

Description [src]

Displays a menu and makes it available for selection.

Applications can use this function to display context-sensitive menus, and will typically supply NULL for the parent_menu_shell, parent_menu_item, func, data and destroy parameters. The default menu positioning function will position the menu at the current position of device (or its corresponding pointer).

The button parameter should be the mouse button pressed to initiate the menu popup. If the menu popup was initiated by something other than a mouse button press, such as a mouse button release or a keypress, button should be 0.

The activate_time parameter is used to conflict-resolve initiation of concurrent requests for mouse/keyboard grab requests. To function properly, this needs to be the time stamp of the user event (such as a mouse click or key press) that caused the initiation of the popup. Only if no such event is available, gtk_get_current_event_time() can be used instead.

Note that this function does not work very well on GDK backends that do not have global coordinates, such as Wayland or Mir. You should probably use one of the gtk_menu_popup_at_ variants, which do not have this problem.

Available since:3.0
Deprecated since:3.22

Please use gtk_menu_popup_at_widget(), gtk_menu_popup_at_pointer(). or gtk_menu_popup_at_rect() instead.

Parameters

device GdkDevice
 

A GdkDevice.

 The argument can be NULL.
 The data is owned by the caller of the function.
parent_menu_shell GtkWidget
 

The menu shell containing the triggering menu item, or NULL.

 The argument can be NULL.
 The data is owned by the caller of the function.
parent_menu_item GtkWidget
 

The menu item whose activation triggered the popup, or NULL.

 The argument can be NULL.
 The data is owned by the caller of the function.
func GtkMenuPositionFunc
 

A user supplied function used to position the menu, or NULL.

 The argument can be NULL.
data gpointer
 

User supplied data to be passed to func.

 The argument can be NULL.
destroy GDestroyNotify
 

Destroy notify for data.

 The argument can be NULL.
button guint
 

The mouse button which was pressed to initiate the event.

activate_time guint32
 

The time at which the activation event occurred.