Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gdk::Display Class Reference

A GdkDisplay C++ wrapper class. More...

`#include <inti/gdk/display.h>`

Inheritance diagram for Inti::Gdk::Display:

List of all members.

## Public Types

- typedef Slot2< FilterReturn,
  GdkXEvent *, GdkEvent * > FilterSlot
    Signature of the callback slot to be called to filter native events before they are converted to GDK events.

## Public Member Functions

Constructors

- virtual ~Display ()
    Destructor.

Accessors

- GdkDisplay * gdk_display () const
    Get a pointer to the GdkDisplay structure.
- GdkDisplayClass * gdk_display_class () const
    Get a pointer to the GdkDisplayClass structure.
- operator GdkDisplay * () const
    Conversion operator; safely converts a Display to a GdkDisplay pointer.
- String get_name () const
    Gets the name of the display.
- int get_n_screens () const
    Gets the number of screen managed by the display.
- Screen * get_screen (int screen_num) const
    Returns a screen object for one of the screens of the display.
- Screen * get_default_screen () const
    Get the default screen for the display.
- bool pointer_is_grabbed () const
    Test if the pointer is grabbed.
- bool list_devices (std::vector< Device * > &devices) const
    Returns the list of available input devices attached to the display.
- Device * get_core_pointer () const
    Returns the core pointer device for the given display.
- void get_pointer (Screen **screen, int *x, int *y, ModifierType *mask=0) const
    Gets the current location of the pointer and the current modifier mask for the display.
- void get_pointer (Screen **screen, Point *point, ModifierType *mask=0) const
    Gets the current location of the pointer and the current modifier mask for the display.
- Point get_pointer (Screen **screen=0, ModifierType *mask=0) const
    Gets the current location of the pointer and the current modifier mask for the display.
- 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 the screen.
- Window * get_window_at_pointer (Point *win_origin) const
    Obtains the window underneath the mouse pointer, returning the location of that window in win_origin for the screen.

Methods

- void pointer_ungrab (unsigned int time)
    Release any pointer grab.
- void keyboard_ungrab (unsigned int time)
    Release any keyboard grab.
- void beep ()
    Emits a short beep on the 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 display, and cleans up associated resources.
- Pointer< Event > get_event ()
    Gets the next GdkEvent to be processed for display, fetching events from the windowing system if necessary.
- Pointer< Event > peek_event ()
    Gets a copy of the first GdkEvent in the display's event queue, without removing the event from the queue.
- void put_event (const Gdk::Event &event)
    Appends a copy of the given event onto the front of the event queue for display.
- void add_client_message_filter (Atom message_type, const FilterSlot *filter)
    Adds a filter to be called when X ClientMessage events are received.
- void set_double_click_time (unsigned int 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).

Signal Proxies

- const ClosedSignalProxy sig_closed ()
    Connect to the closed_signal; emitted when the display is closed.

## Static Public Member Functions

- Display * get_default ()
    Gets the default display.
- Display * open (const String &display_name)
    Opens a display.

## Protected Member Functions

Constructors

- Display (GdkDisplay *display, bool reference=true)
    Construct a new Display from an existing GdkDisplay.

Signal Handlers

- virtual void on_closed (bool is_error)
    Called when the display is closed.

## Detailed Description

A GdkDisplay C++ wrapper class.

The purpose of Display objects are two fold:

- To grab/ungrab the keyboard focus and mouse pointer.
- To manage and provide information about the Screen(s) available for this Display.

Display objects are the GDK representation of the X Display which can be described as a workstation consisting of a keyboard, a pointing device (such as a mouse) and one or more screens. It is used to open and keep track of various Screen objects currently instantiated by the application. It is also used to grab and release the keyboard and mouse pointer.

## Member Typedef Documentation

typedef Slot2<FilterReturn, GdkXEvent*, GdkEvent*> Inti::Gdk::Display::FilterSlot

Signature of the callback slot to be called to filter native events before they are converted to GDK events.

Example: Method signature for FilterSlot.

                 FilterReturn method(GdkXEvent *xevent, GdkEvent *event);

                 // xevent: The native event to filter.
                 // event: The GDK event to which the X event will be translated.
                 // return: A FilterReturn value.

Specifies the type of method used to filter native events before they are converted to GDK events. A filter may translate the native event to a GDK event or handle it without translation.

## Constructor & Destructor Documentation

Inti::Gdk::Display::Display | ( | GdkDisplay * | display,
|  | bool | reference = true
| ) | `[explicit, protected]`

Construct a new Display from an existing GdkDisplay.

Parameters:

  display | A pointer to a GdkDisplay.
  reference | Set false if the initial reference count is floating, set true if it's not.

The display can be a newly created GdkDisplay or an existing GdkDisplay. (see G::Object::Object).

## Member Function Documentation

void Inti::Gdk::Display::add_client_message_filter | ( | Atom | message_type,
|  | const FilterSlot * | filter
| ) |

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

Parameters:

  message_type | The type of ClientMessage events to receive; This will be checked against the message_type field of the XClientMessage event struct.
  filter | The slot to call to process the event.

Device* Inti::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 must not be unreferenced.

Display* Inti::Gdk::Display::get_default | ( |  | ) | `[static]`

Gets the default display.

Returns:
  The default Display, or null if there is no default display.

Screen* Inti::Gdk::Display::get_default_screen | ( |  | ) | const

Get the default screen for the display.

Returns:
  The default Screen object for the display.

Pointer<Event> Inti::Gdk::Display::get_event | ( |  | ) |

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

Returns:
  The next GdkEvent to be processed, or null if no events are pending.

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

Gets the number of screen managed by the display.

Returns:
  The number of screens.

String Inti::Gdk::Display::get_name | ( |  | ) | const

Gets the name of the display.

Returns:
  A String representing the display name.

Point Inti::Gdk::Display::get_pointer | ( | Screen ** | screen = 0,
|  | ModifierType * | mask = 0
| ) | const

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

Parameters:

  screen | The location to store the screen that the cursor is on, or null.
  mask | The location to store current modifier mask, or null.

Returns:
  A Point storing root window X and Y coordinates of the pointer.

void Inti::Gdk::Display::get_pointer | ( | Screen ** | screen,
|  | Point * | point,
|  | ModifierType * | mask = 0
| ) | const

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

Parameters:

  screen | The location to store the screen that the cursor is on, or null.
  point | The location to store root window X and Y coordinates of the pointer, or null.
  mask | The location to store current modifier mask, or null.

void Inti::Gdk::Display::get_pointer | ( | Screen ** | screen,
|  | int * | x,
|  | int * | y,
|  | ModifierType * | mask = 0
| ) | const

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

Parameters:

  screen | The location to store the screen that the cursor is on, or null.
  x | The location to store root window X coordinate of pointer, or null.
  y | The location to store root window Y coordinate of pointer, or null.
  mask | The location to store current modifier mask, or null.

Screen* Inti::Gdk::Display::get_screen | ( | int | screen_num | ) | const

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

Parameters:

  screen_num | The screen number.

Returns:
  The Screen object.

Window* Inti::Gdk::Display::get_window_at_pointer | ( | Point * | win_origin | ) | const

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

Parameters:

  win_origin | The return location for the X and Y origin of the window under the pointer.

Returns:
  The window under the mouse pointer, or null.

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

Window* Inti::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 the screen.

Parameters:

  win_x | The return location for the X origin of the window under the pointer.
  win_y | The return location for the Y origin of the window under the pointer.

Returns:
  The window under the mouse pointer, or null.

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

void Inti::Gdk::Display::keyboard_ungrab | ( | unsigned int | time | ) |

Release any keyboard grab.

Parameters:

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

bool Inti::Gdk::Display::list_devices | ( | std::vector< Device * > & | devices | ) | const

Returns the list of available input devices attached to the display.

Parameters:

  devices | A reference to a vector of Device* to hold the list of devices.

Returns:
  true if the vector is not empty.

The devices in this list are statically allocated and will be freed by GTK+.

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

Called when the display is closed.

Parameters:

  is_error |

Display* Inti::Gdk::Display::open | ( | const String & | display_name | ) | `[static]`

Opens a display.

Parameters:

  display_name | The name of the display to open.

Returns:
  A Display, or null if the display could not be opened.

Pointer<Event> Inti::Gdk::Display::peek_event | ( |  | ) |

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

Returns:
  A copy of the first GdkEvent on the event queue, or null if no events are in the queue.

This method will not get more events from the windowing system. It only checks the events that have already been moved to the GDK event queue.

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

Test if the pointer is grabbed.

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

void Inti::Gdk::Display::pointer_ungrab | ( | unsigned int | time | ) |

Release any pointer grab.

Parameters:

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

void Inti::Gdk::Display::put_event | ( | const Gdk::Event & | event | ) |

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

Parameters:

  event | A GdkEvent.

void Inti::Gdk::Display::set_double_click_time | ( | unsigned int | 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).

Parameters:

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

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

void Inti::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.

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

- display.h

Main Page - Footer