gtkmm: Gdk::Event Class Reference

gtkmm 3.91.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Related Functions | List of all members
Gdk::Event Class Reference

Represents an event. More...

`#include <gdkmm/event.h>`

Inheritance diagram for Gdk::Event:
[legend]

## Public Types
enum | Type { Type::NOTHING = -1, Type::DELETE = 0, Type::DESTROY = 1, Type::EXPOSE = 2, Type::MOTION_NOTIFY = 3, Type::BUTTON_PRESS = 4, Type::DOUBLE_BUTTON_PRESS = 5, Type::TRIPLE_BUTTON_PRESS = 6, Type::BUTTON_RELEASE = 7, Type::KEY_PRESS = 8, Type::KEY_RELEASE = 9, Type::ENTER_NOTIFY = 10, Type::LEAVE_NOTIFY = 11, Type::FOCUS_CHANGE = 12, Type::CONFIGURE = 13, Type::MAP = 14, Type::UNMAP = 15, Type::PROPERTY_NOTIFY = 16, Type::SELECTION_CLEAR = 17, Type::SELECTION_REQUEST = 18, Type::SELECTION_NOTIFY = 19, Type::PROXIMITY_IN = 20, Type::PROXIMITY_OUT = 21, Type::DRAG_ENTER = 22, Type::DRAG_LEAVE = 23, Type::DRAG_MOTION = 24, Type::DRAG_STATUS = 25, Type::DROP_START = 26, Type::DROP_FINISHED = 27, Type::CLIENT_EVENT = 28, Type::VISIBILITY_NOTIFY = 29, Type::SCROLL = 31, Type::WINDOW_STATE = 32, Type::SETTING = 33, Type::OWNER_CHANGE = 34, Type::GRAB_BROKEN = 35, Type::DAMAGE = 36, Type::TOUCH_BEGIN = 37, Type::TOUCH_UPDATE = 38, Type::TOUCH_END = 39, Type::TOUCH_CANCEL = 40, Type::TOUCHPAD_SWIPE = 41, Type::TOUCHPAD_PINCH = 42, Type::PAD_BUTTON_PRESS = 43, Type::PAD_BUTTON_RELEASE = 44, Type::PAD_RING = 45, Type::PAD_STRIP = 46, Type::PAD_GROUP_MODE = 47, Type::EVENT_LAST = 48 }
| Specifies the type of the event. More...

## Public Member Functions
| Event ()
| Creates an invalid event object. More...
| Event (GdkEvent* gobject, bool make_a_copy=false)
| Wraps a C event instance. More...
| Event (const Event& other)
Event& | operator= (const Event& other)
| Event (Event&& other) noexcept
Event& | operator= (Event&& other) noexcept
| ~Event () noexcept
void | swap (Event& other) noexcept
GdkEvent* | gobj ()
| Provides access to the underlying C instance. More...
const GdkEvent* | gobj () const
| Provides access to the underlying C instance. More...
GdkEvent* | gobj_copy () const
| Provides access to the underlying C instance. More...
Event::Type | get_event_type () const
| Retrieves the type of the event. More...
Glib::RefPtr< Gdk::Window > | get_window ()
| Returns the window which received the event. More...
Glib::RefPtr< const Gdk::Window > | get_window () const
bool | is_send_event () const
| Returns `true` if the event was sent explicitly (e.g. More...
Glib::RefPtr< Screen > | get_screen ()
| Returns the screen for the event. More...
Glib::RefPtr< const Screen > | get_screen () const
| Returns the screen for the event. More...
Glib::RefPtr< Seat > | get_seat ()
| Returns the Gdk::Seat this event was generated for. More...
Glib::RefPtr< const Seat > | get_seat () const
| Returns the Gdk::Seat this event was generated for. More...
void | put ()
| Appends a copy of the given event onto the front of the event queue for event->any.window’s display, or the default event queue if event->any.window is `nullptr`. More...

## Static Public Member Functions
static void | set_show_events (bool show_events)
| Sets whether a trace of received events is output. More...
static bool | get_show_events ()
| Gets whether event debugging output is enabled. More...
static Event | get ()
| Checks all open displays for a Gdk::Event to process,to be processed on, fetching events from the windowing system if necessary. More...
static Event | peek ()
| If there is an event waiting in the event queue of some open display, returns a copy of it. More...
static bool | events_pending ()
| Checks if any events are ready to be processed for any display. More...

## Related Functions
(Note that these are not member functions.)
void | swap (Event& lhs, Event& rhs) noexcept
const Event& | wrap_event (const GdkEvent*& event)
| Wraps a C event instance without making unnecessary copy when the ownership can not be acquired. More...
Event& | wrap_event (GdkEvent*& event)
| See wrap_event(const GdkEvent*& event). More...
Gdk::Event | wrap (GdkEvent* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Detailed Description

Represents an event.

## Constructor & Destructor Documentation

Gdk::Event::Event | ( |  | ) |

Creates an invalid event object.

Calling any member functions is undefined behavior.

Gdk::Event::Event | ( | GdkEvent * | gobject,
|  | bool | make_a_copy = `false`
| ) |  |
| explicit

Wraps a C event instance.

This constructor either acquires ownership of gobject, or copies it.

Parameters

  gobject | Event to wrap.
  make_a_copy | If `false`, the ownership of gobject is acquired, otherwise, a copy is made.

Gdk::Event::Event | ( | const Event& | other | ) |

Gdk::Event::Event | ( | Event&& | other | ) |
| noexcept

Gdk::Event::~Event | ( |  | ) |
| noexcept

## Member Function Documentation

static bool Gdk::Event::events_pending | ( |  | ) |
| static

Checks if any events are ready to be processed for any display.

Returns
  `true` if any events are pending.

static Event Gdk::Event::get | ( |  | ) |
| static

Checks all open displays for a Gdk::Event to process,to be processed on, fetching events from the windowing system if necessary.

See Gdk::Display::get_event().

Returns
  The next Gdk::Event to be processed, or `nullptr` if no events are pending. The returned Gdk::Event should be freed with free().

Event::Type Gdk::Event::get_event_type | ( |  | ) | const

Retrieves the type of the event.

Since gtkmm 3.10:

Returns
  A Gdk::Event::Type.

Glib::RefPtr<Screen> Gdk::Event::get_screen | ( |  | ) |

Returns the screen for the event.

The screen is typically the screen for `event->any.window`, but for events such as mouse events, it is the screen where the pointer was when the event occurs - that is, the screen which has the root window to which `event->motion.x_root` and `event->motion.y_root` are relative.

Since gtkmm 2.2:

Returns
  The screen for the event.

Glib::RefPtr<const Screen> Gdk::Event::get_screen | ( |  | ) | const

Returns the screen for the event.

The screen is typically the screen for `event->any.window`, but for events such as mouse events, it is the screen where the pointer was when the event occurs - that is, the screen which has the root window to which `event->motion.x_root` and `event->motion.y_root` are relative.

Since gtkmm 2.2:

Returns
  The screen for the event.

Glib::RefPtr<Seat> Gdk::Event::get_seat | ( |  | ) |

Returns the Gdk::Seat this event was generated for.

Since gtkmm 3.90:

Returns
  The Gdk::Seat of this event.

Glib::RefPtr<const Seat> Gdk::Event::get_seat | ( |  | ) | const

Returns the Gdk::Seat this event was generated for.

Since gtkmm 3.90:

Returns
  The Gdk::Seat of this event.

static bool Gdk::Event::get_show_events | ( |  | ) |
| static

Gets whether event debugging output is enabled.

Returns
  `true` if event debugging output is enabled.

Glib::RefPtr<Gdk::Window> Gdk::Event::get_window | ( |  | ) |

Returns the window which received the event.

Glib::RefPtr<const Gdk::Window> Gdk::Event::get_window | ( |  | ) | const

GdkEvent* Gdk::Event::gobj | ( |  | ) |
| inline

Provides access to the underlying C instance.

const GdkEvent* Gdk::Event::gobj | ( |  | ) | const
| inline

Provides access to the underlying C instance.

GdkEvent* Gdk::Event::gobj_copy | ( |  | ) | const

Provides access to the underlying C instance.

The caller is responsible for freeing it with gdk_event_free(). Use when directly setting fields in structs.

bool Gdk::Event::is_send_event | ( |  | ) | const

Returns `true` if the event was sent explicitly (e.g.

using `XSendEvent`)

Event& Gdk::Event::operator= | ( | const Event& | other | ) |

Event& Gdk::Event::operator= | ( | Event&& | other | ) |
| noexcept

static Event Gdk::Event::peek | ( |  | ) |
| static

If there is an event waiting in the event queue of some open display, returns a copy of it.

See Gdk::Display::peek_event().

Returns
  A copy of the first Gdk::Event on some event queue, or `nullptr` if no events are in any queues. The returned Gdk::Event should be freed with free().

void Gdk::Event::put | ( |  | ) |

Appends a copy of the given event onto the front of the event queue for event->any.window’s display, or the default event queue if event->any.window is `nullptr`.

See Gdk::Display::put_event().

static void Gdk::Event::set_show_events | ( | bool | show_events | ) |
| static

Sets whether a trace of received events is output.

Note that GTK+ must be compiled with debugging (that is, configured using the `--enable-debug` option) to use this option.

Parameters

  show_events | `true` to output event debugging information.

void Gdk::Event::swap | ( | Event& | other | ) |
| noexcept

## Friends And Related Function Documentation

void swap | ( | Event& | lhs,
|  | Event& | rhs
| ) |  |
| related

Parameters

  lhs | The left-hand side
  rhs | The right-hand side

Gdk::Event wrap | ( | GdkEvent * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy.

Returns
  A C++ instance that wraps this C instance.

const Event& wrap_event | ( | const GdkEvent *& | event | ) |
| related

Wraps a C event instance without making unnecessary copy when the ownership can not be acquired.

The event pointer must not be deleted until last usage of the returned instance. Note, that this requirement applies to the pointer itself, in addition to the object it is pointing to.

Event& wrap_event | ( | GdkEvent *& | event | ) |
| related

See wrap_event(const GdkEvent*& event).