Main Page Widgets Namespaces Book

# Gdk::Display Class Reference

Inheritance diagram for Gdk::Display:

[legend]
List of all members.

## Public Member Functions

virtual | ~Display ()
GdkDisplay* | gobj ()
| Provides access to the underlying C GObject.
const GdkDisplay* | gobj () const
| Provides access to the underlying C GObject.
GdkDisplay* | gobj_copy ()
Glib::ustring | get_name () const
| Gets the name of the display.
int | get_n_screens () const
| Gets the number of screen managed by the display .
Glib::RefPtr<Screen> | get_screen (int screen_num)
| Returns a screen object for one of the screens of the display.
Glib::RefPtr<Screen> | get_default_screen ()
| Get the default Gdk::Screen for display .
void | pointer_ungrab (guint32 time_)
| Release any pointer grab.
void | keyboard_ungrab (guint32 time_)
| Release any keyboard grab.
bool | pointer_is_grabbed () const
| Test if the pointer is grabbed.
void | beep ()
| Emits a short beep on display.
void | sync ()
| Flushes any requests queued for the windowing system and waits until all requests have been handled.
void | close ()
| Closes the connection windowing system for the given display, and cleans up associated resources.
Glib::ListHandle< Glib::RefPtr< Device > > | list_devices ()
| Returns the list of available input devices attached to display .
GdkEvent* | get_event ()
| Gets the next Gdk::Event to be processed for display , fetching events from the windowing system if necessary.
GdkEvent* | peek_event ()
| Gets a copy of the first Gdk::Event in the display 's event queue, without removing the event from the queue.
void | put_event (GdkEvent* event)
| Appends a copy of the given event onto the front of the event queue for display .
void | add_client_message_filter (GdkAtom message_type, GdkFilterFunc func, gpointer data)
| Adds a filter to be called when X ClientMessage events are received.
void | set_double_click_time (guint msec)
| Sets the double click time (two clicks within this time interval count as a double click and result in a Gdk::2BUTTON_PRESS event).
Glib::RefPtr<Device> | get_core_pointer ()
| Returns the core pointer device for the given display.
Glib::RefPtr<const Device> | get_core_pointer () const
| Returns the core pointer device for the given display.
void | get_pointer (Glib::RefPtr<Screen>& screen, int& x, int& y, ModifierType& mask)
| Gets the current location of the pointer and the current modifier mask for a given display.
void | get_pointer (int& x, int& y, ModifierType& mask)
| Gets the current location of the pointer and the current modifier mask for a given display.
Glib::RefPtr<Window> | get_window_at_pointer (int& win_x, int& win_y)
| Obtains the window underneath the mouse pointer, returning the location of that window in win_x , win_y for screen .
Glib::RefPtr<const Window> | get_window_at_pointer (int& win_x, int& win_y) const
| Obtains the window underneath the mouse pointer, returning the location of that window in win_x , win_y for screen .
Glib::RefPtr<Window> | get_window_at_pointer ()
| Obtains the window underneath the mouse pointer.
Glib::RefPtr<const Window> | get_window_at_pointer () const
| Obtains the window underneath the mouse pointer.
GdkDisplayPointerHooks* | set_pointer_hooks (const GdkDisplayPointerHooks* new_hooks)
| This function allows for hooking into the operation of getting the current location of the pointer on a particular display.
guint32 | get_drag_protocol (guint32 xid, GdkDragProtocol& protocol)
| Finds out the DND protocol supported by a window.
GdkKeymap* | get_keymap ()
const GdkKeymap* | get_keymap () const
bool | set_selection_owner (const Glib::RefPtr<Window>& owner, GdkAtom selection, guint32 time_, bool send_event)
Glib::RefPtr<Window> | get_selection_owner (GdkAtom selection)
void | selection_send_notify (guint32 requestor, GdkAtom selection, GdkAtom target, GdkAtom property, guint32 time_)
Glib::RefPtr<Pixmap> | lookup_pixmap (GdkNativeWindow anid)
| Looks up the Gdk::Pixmap that wraps the given native pixmap handle.
Glib::RefPtr<const Pixmap> | lookup_pixmap (GdkNativeWindow anid) const
| Looks up the Gdk::Pixmap that wraps the given native pixmap handle.
Glib::SignalProxy1< void, bool > | signal_closed ()

## Static Public Member Functions

Glib::RefPtr<Display> | open (const Glib::ustring& display_name)
| Opens a display.
Glib::RefPtr<Display> | get_default ()
| Gets the default Gdk::Display.
Glib::RefPtr<Display> | open_default_libgtk_only ()
| Opens the default display specified by command line arguments or environment variables, sets it as the default display, and returns it.

## Protected Member Functions

| Display ()
virtual void | on_closed (bool is_error)

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr<Gdk::Display> | wrap (GdkDisplay* object, bool take_copy=false)

## Constructor & Destructor Documentation

virtual Gdk::Display::~Display | ( |  | ) | `[virtual]`

Gdk::Display::Display | ( |  | ) | `[protected]`

## Member Function Documentation

void Gdk::Display::add_client_message_filter | ( | GdkAtom | message_type,
|  | GdkFilterFunc | func,
|  | gpointer | data
| ) |

Adds a filter to be called when X ClientMessage events are received.

Since: 2.2

Parameters:

  message_type | The type of ClientMessage events to receive. This will be checked against the message_type field of the XClientMessage event struct.
  func | The function to call to process the event.
  data | User data to pass to func .

void Gdk::Display::beep | ( |  | ) |

| Emits a short beep on display. Since: 2.2

void Gdk::Display::close | ( |  | ) |

| Closes the connection windowing system for the given display, and cleans up associated resources. Since: 2.2

Glib::RefPtr<const Device> Gdk::Display::get_core_pointer | ( |  | ) | const

Returns the core pointer device for the given display.

Returns:
  The core pointer device; this is owned by the display and should not be freed.

Since: 2.2.

Glib::RefPtr<Device> Gdk::Display::get_core_pointer | ( |  | ) |

Returns the core pointer device for the given display.

Returns:
  The core pointer device; this is owned by the display and should not be freed.

Since: 2.2.

Glib::RefPtr<Display> Gdk::Display::get_default | ( |  | ) | `[static]`

Gets the default Gdk::Display.

This is a convenience function for:

gdk_display_manager_get_default_display (manager_get())

Returns:
  A Gdk::Display, or `0` if there is no default display.

Since: 2.2.

Glib::RefPtr<Screen> Gdk::Display::get_default_screen | ( |  | ) |

Get the default Gdk::Screen for display .

Returns:
  The default Gdk::Screen object for display

Since: 2.2.

guint32 Gdk::Display::get_drag_protocol | ( | guint32 | xid,
|  | GdkDragProtocol& | protocol
| ) |

Finds out the DND protocol supported by a window.

Since: 2.2

Parameters:

  display | The Gdk::Display where the destination window resides.
  xid | The X id of the destination window.
  protocol | Location where the supported DND protocol is returned.

Returns:
  The X id of the window where the drop should happen. This may be xid or the X id of a proxy window, or None if xid doesn't support Drag and Drop.

GdkEvent* Gdk::Display::get_event | ( |  | ) |

Gets the next Gdk::Event to be processed for display , fetching events from the windowing system if necessary.

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

Since: 2.2.

const GdkKeymap* Gdk::Display::get_keymap | ( |  | ) | const

Parameters:

  display | The Gdk::Display.

Returns:
  The Gdk::Keymap attached to display . the Gdk::Keymap attached to display .

Since: 2.2.

GdkKeymap* Gdk::Display::get_keymap | ( |  | ) |

Parameters:

  display | The Gdk::Display.

Returns:
  The Gdk::Keymap attached to display . the Gdk::Keymap attached to display .

Since: 2.2.

int Gdk::Display::get_n_screens | ( |  | ) | const

Gets the number of screen managed by the display .

Returns:
  Number of screens.

Since: 2.2.

Glib::ustring Gdk::Display::get_name | ( |  | ) | const

Gets the name of the display.

Returns:
  A string representing the display name. This string is owned by GDK and should not be modified or freed.

Since: 2.2.

void Gdk::Display::get_pointer | ( | int& | x,
|  | int& | y,
|  | ModifierType& | mask
| ) |

| Gets the current location of the pointer and the current modifier mask for a given display. : location to store root window X coordinate of pointer. : location to store root window Y coordinate of pointer. : location to store current modifier mask

void Gdk::Display::get_pointer | ( | Glib::RefPtr<Screen>& | screen,
|  | int& | x,
|  | int& | y,
|  | ModifierType& | mask
| ) |

Gets the current location of the pointer and the current modifier mask for a given display.

Parameters:

  screen | location to store the screen that the cursor is on, or NULL. : location to store root window X coordinate of pointer. : location to store root window Y coordinate of pointer. : location to store current modifier mask

Glib::RefPtr<Screen> Gdk::Display::get_screen | ( | int | screen_num | ) |

Returns a screen object for one of the screens of the display.

Parameters:

  screen_num | The screen number.

Returns:
  The Gdk::Screen object

Since: 2.2.

Glib::RefPtr<Window> Gdk::Display::get_selection_owner | ( | GdkAtom | selection | ) |

Glib::RefPtr<const Window> Gdk::Display::get_window_at_pointer | ( |  | ) | const

| Obtains the window underneath the mouse pointer. Returns a null RefPtr if the window under the mouse pointer is not known to GDK (for example, belongs to another application).

Glib::RefPtr<Window> Gdk::Display::get_window_at_pointer | ( |  | ) |

| Obtains the window underneath the mouse pointer. Returns a null RefPtr if the window under the mouse pointer is not known to GDK (for example, belongs to another application).

Glib::RefPtr<const Window> Gdk::Display::get_window_at_pointer | ( | int& | win_x,
|  | int& | win_y
| ) | const

Obtains the window underneath the mouse pointer, returning the location of that window in win_x , win_y for screen .

Returns `0` if the window under the mouse pointer is not known to GDK (for example, belongs to another application).

Parameters:

  win_x | Return location for origin of the window under the pointer.
  win_y | Return location for origin of the window under the pointer.

Returns:
  The window under the mouse pointer, or `0`

Since: 2.2.

Glib::RefPtr<Window> Gdk::Display::get_window_at_pointer | ( | int& | win_x,
|  | int& | win_y
| ) |

Obtains the window underneath the mouse pointer, returning the location of that window in win_x , win_y for screen .

Returns `0` if the window under the mouse pointer is not known to GDK (for example, belongs to another application).

Parameters:

  win_x | Return location for origin of the window under the pointer.
  win_y | Return location for origin of the window under the pointer.

Returns:
  The window under the mouse pointer, or `0`

Since: 2.2.

const GdkDisplay* Gdk::Display::gobj | ( |  | ) | const`[inline]`

| Provides access to the underlying C GObject. Reimplemented from Glib::ObjectBase.

GdkDisplay* Gdk::Display::gobj | ( |  | ) | `[inline]`

| Provides access to the underlying C GObject. Reimplemented from Glib::ObjectBase.

GdkDisplay* Gdk::Display::gobj_copy | ( |  | ) |

void Gdk::Display::keyboard_ungrab | ( | guint32 | time_ | ) |

Release any keyboard grab.

Since: 2.2

Parameters:

  time_ | A timestap (e.g Gdk::CURRENT_TIME).

Glib::ListHandle<Glib::RefPtr<Device>> Gdk::Display::list_devices | ( |  | ) |

Returns the list of available input devices attached to display .

The list is statically allocated and should not be freed.

Returns:
  A list of Gdk::Device

Since: 2.2.

Glib::RefPtr<const Pixmap> Gdk::Display::lookup_pixmap | ( | GdkNativeWindow | anid | ) | const

Looks up the Gdk::Pixmap that wraps the given native pixmap handle.

For example in the X backend, a native pixmap handle is an Xlib <type>XID</type>.

Parameters:

  display | The Gdk::Display associated with anid .
  anid | A native pixmap handle.

Returns:
  The Gdk::Pixmap wrapper for the native pixmap, or `0` if there is none.

Since: 2.2.

Glib::RefPtr<Pixmap> Gdk::Display::lookup_pixmap | ( | GdkNativeWindow | anid | ) |

Looks up the Gdk::Pixmap that wraps the given native pixmap handle.

For example in the X backend, a native pixmap handle is an Xlib <type>XID</type>.

Parameters:

  display | The Gdk::Display associated with anid .
  anid | A native pixmap handle.

Returns:
  The Gdk::Pixmap wrapper for the native pixmap, or `0` if there is none.

Since: 2.2.

virtual void Gdk::Display::on_closed | ( | bool | is_error | ) | `[protected, virtual]`

Glib::RefPtr<Display> Gdk::Display::open | ( | const Glib::ustring& | display_name | ) | `[static]`

Opens a display.

Since: 2.2

Parameters:

  display_name | The name of the display to open.

Returns:
  A Gdk::Display, or `0` if the display could not be opened.

Glib::RefPtr<Display> Gdk::Display::open_default_libgtk_only | ( |  | ) | `[static]`

Opens the default display specified by command line arguments or environment variables, sets it as the default display, and returns it.

gdk_parse_args must have been called first. If the default display has previously been set, simply returns that. An internal function that should not be used by applications.

Returns:
  The default display, if it could be opened, otherwise `0`.

GdkEvent* Gdk::Display::peek_event | ( |  | ) |

Gets a copy of the first Gdk::Event in the display 's event queue, without removing the event from the queue.

(Note that this function will not get more events from the windowing system. It only checks the events that have already been moved to the GDK event queue.)

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

Since: 2.2.

bool Gdk::Display::pointer_is_grabbed | ( |  | ) | const

Test if the pointer is grabbed.

Returns:
  `true` if an active X pointer grab is in effect

Since: 2.2.

void Gdk::Display::pointer_ungrab | ( | guint32 | time_ | ) |

Release any pointer grab.

Since: 2.2

Parameters:

  time_ | A timestap (e.g. GDK_CURRENT_TIME).

void Gdk::Display::put_event | ( | GdkEvent* | event | ) |

Appends a copy of the given event onto the front of the event queue for display .

Since: 2.2

Parameters:

  event | A Gdk::Event.

void Gdk::Display::selection_send_notify | ( | guint32 | requestor,
|  | GdkAtom | selection,
|  | GdkAtom | target,
|  | GdkAtom | property,
|  | guint32 | time_
| ) |

void Gdk::Display::set_double_click_time | ( | guint | msec | ) |

Sets the double click time (two clicks within this time interval count as a double click and result in a Gdk::2BUTTON_PRESS event).

Applications should NOT set this, it is a global user-configured setting.

Since: 2.2

Parameters:

  msec | Double click time in milliseconds (thousandths of a second).

GdkDisplayPointerHooks* Gdk::Display::set_pointer_hooks | ( | const GdkDisplayPointerHooks* | new_hooks | ) |

This function allows for hooking into the operation of getting the current location of the pointer on a particular display.

This is only useful for such low-level tools as an event recorder. Applications should never have any reason to use this facility.

Parameters:

  new_hooks | A table of pointers to functions for getting quantities related to the current pointer position.

Returns:
  The previous pointer hook table

Since: 2.2.

bool Gdk::Display::set_selection_owner | ( | const Glib::RefPtr<Window>& | owner,
|  | GdkAtom | selection,
|  | guint32 | time_,
|  | bool | send_event
| ) |

Glib::SignalProxy1<void,bool> Gdk::Display::signal_closed | ( |  | ) |

Prototype:
  `void closed(bool is_error)`

void Gdk::Display::sync | ( |  | ) |

Flushes any requests queued for the windowing system and waits until all requests have been handled.

This is often used for making sure that the display is synchronized with the current state of the program. Calling sync() before gdk_error_trap_pop() makes sure that any errors generated from earlier requests are handled before the error trap is removed.

This is most useful for X11. On windowing systems where requests are handled synchronously, this function will do nothing.

Since: 2.2

## Friends And Related Function Documentation

Glib::RefPtr<Gdk::Display> wrap | ( | GdkDisplay* | object,
|  | bool | take_copy = false
| ) | `[related]`

The documentation for this class was generated from the following file:

- display.h