Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gdk::Display Class Reference

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

`#include <xfc/gdk/display.hh>`

Inheritance diagram for Xfc::Gdk::Display:

List of all members.

## Signal Prototypes

- const ClosedSignalType closed_signal
    Closed signal (see signal_closed()).

## Public Member Functions

Constructors

- virtual ~Display ()
    Destructor.

Accessors

- GdkDisplay * gdk_display () const
    Get a pointer to the GdkDisplay 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.
- bool supports_cursor_alpha () const
    Determines if cursors can use an 8bit alpha channel on display, otherwise, cursors are restricted to bilevel alpha (i.e.
- bool supports_cursor_color () const
    Determines if multicolored cursors are supported on display.
- unsigned int get_default_cursor_size () const
    Gets the default size to use for cursors on the display.
- void get_maximal_cursor_size (unsigned int *width, unsigned int *height) const
    Gets the maximal size to use for cursors on the display.
- Window * get_default_group () const
    Gets the default group leader window for all toplevel windows on display.
- bool supports_selection_notification () const
    Determines whether Gdk::EventOwnerChange events will be sent when the owner of a selection changes.
- bool supports_clipboard_persistence () const
    Determines whether the speicifed display supports clipboard persistance.

Methods

- void pointer_ungrab (unsigned int time=GDK_CURRENT_TIME)
    Release any pointer grab.
- void keyboard_ungrab (unsigned int time=GDK_CURRENT_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 flush ()
    Flushes any requests queued for the windowing system.
- 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, GdkFilterFunc func, void *data)
    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).
- void set_double_click_distance (unsigned int distance)
    Sets the double click distance (two clicks within this distance count as a double click and result in a GDK_2BUTTON_PRESS event).
- bool request_selection_notification (Atom selection)
    Request Gdk::EventOwnerChange events for ownership changes of the selection named by the given atom.
- void store_clipboard (Window &clipboard_window, unsigned int time)
    Issues a request to the the clipboard manager to store the clipboard data for all available targets.
- void store_clipboard (Window &clipboard_window, unsigned int time, const std::vector< Atom > targets)
    Issues a request to the the clipboard manager to store the clipboard data.

Signal Proxies

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

## Static Public Member Functions

Accessors

- Display * get_default ()
    Gets the default display.

Methods

- Display * open (const String &display_name)
    Opens a display.

## Protected Member Functions

Constructors

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

## 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.

## Constructor & Destructor Documentation

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

  | Construct a new Display from an existing GdkDisplay. Parameters:
  | display | A pointer to a GdkDisplay.
  | owns_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 Xfc::Gdk::Display::add_client_message_filter | ( | Atom | message_type,
|  | GdkFilterFunc | func,
|  | void * | data
| ) |

  | 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.
  | func | The function to call to process the event.
  | data | User data to pass to func.

void Xfc::Gdk::Display::flush | ( |  | ) |

| Flushes any requests queued for the windowing system. This happens automatically when the main loop blocks waiting for new events, but if your application is drawing without returning control to the main loop, you may need to call this function explicitely. A common case where this function needs to be called is when an application is executing drawing commands from a thread other than the thread where the main loop is running. This method is most useful for X11. On windowing systems where requests are handled synchronously, this method will do nothing.

Device* Xfc::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* Xfc::Gdk::Display::get_default | ( |  | ) | `[static]`

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

unsigned int Xfc::Gdk::Display::get_default_cursor_size | ( |  | ) | const

| Gets the default size to use for cursors on the display. Returns: The default cursor size.

Window* Xfc::Gdk::Display::get_default_group | ( |  | ) | const

| Gets the default group leader window for all toplevel windows on display. Returns: The default group leader window for the display. This window is implicitly created by GDK (see Gdk::Window::set_group()).

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

| Get the default screen for the display. Returns: The default Screen object for the display.

Pointer<Event> Xfc::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.

void Xfc::Gdk::Display::get_maximal_cursor_size | ( | unsigned int * | width,
|  | unsigned int * | height
| ) | const

  | Gets the maximal size to use for cursors on the display. Parameters:
  | width | The return location for the maximal cursor width.
  | height | The return location for the maximal cursor height.

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

| Gets the number of screen managed by the display. Returns: The number of screens.

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

| Gets the name of the display. Returns: A String representing the display name.

Point Xfc::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 Xfc::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 Xfc::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* Xfc::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* Xfc::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* Xfc::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 Xfc::Gdk::Display::keyboard_ungrab | ( | unsigned int | time = `GDK_CURRENT_TIME` | ) |

  | Release any keyboard grab. Parameters:
  | time | A timestap (e.g. GDK_CURRENT_TIME).

bool Xfc::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+.

Display* Xfc::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> Xfc::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 Xfc::Gdk::Display::pointer_is_grabbed | ( |  | ) | const

| Test if the pointer is grabbed. Returns: true if an active X pointer grab is in effect

void Xfc::Gdk::Display::pointer_ungrab | ( | unsigned int | time = `GDK_CURRENT_TIME` | ) |

  | Release any pointer grab. Parameters:
  | time | A timestap (e.g. GDK_CURRENT_TIME).

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

bool Xfc::Gdk::Display::request_selection_notification | ( | Atom | selection | ) |

  | Request Gdk::EventOwnerChange events for ownership changes of the selection named by the given atom. Parameters:
  | selection | The Gdk::Atom naming the selection for which ownership change notification is requested.
Returns: Whether GdkEventOwnerChange events will be sent.

void Xfc::Gdk::Display::set_double_click_distance | ( | unsigned int | distance | ) |

  | Sets the double click distance (two clicks within this distance count as a double click and result in a GDK_2BUTTON_PRESS event). Parameters:
  | distance | The distance in pixels.
Applications should not set this, it is a global user-configured setting.

void Xfc::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 Xfc::Gdk::Display::store_clipboard | ( | Window & | clipboard_window,
|  | unsigned int | time,
|  | const std::vector< Atom > | targets
| ) |

  | Issues a request to the the clipboard manager to store the clipboard data. Parameters:
  | clipboard_window | A Gdk::Window belonging to the clipboard owner.
  | time | A timestamp.
  | targets | A vector of Gdk::Atom containing the targets that should be saved.
On X11, this is a special program that works according to the freedesktop clipboard specification, available at freedesktop.org.

void Xfc::Gdk::Display::store_clipboard | ( | Window & | clipboard_window,
|  | unsigned int | time
| ) |

  | Issues a request to the the clipboard manager to store the clipboard data for all available targets. Parameters:
  | clipboard_window | A Gdk::Window belonging to the clipboard owner.
  | time | A timestamp.
On X11, this is a special program that works according to the freedesktop clipboard specification, available at freedesktop.org.

bool Xfc::Gdk::Display::supports_clipboard_persistence | ( |  | ) | const

| Determines whether the speicifed display supports clipboard persistance. Returns: true if the display supports clipboard persistance. Persistance means if it's possible to store the clipboard data after an application has quit. On X11 this checks if a clipboard daemon is running.

bool Xfc::Gdk::Display::supports_cursor_alpha | ( |  | ) | const

| Determines if cursors can use an 8bit alpha channel on display, otherwise, cursors are restricted to bilevel alpha (i.e. a mask). Returns: true if cursors can have alpha channels.

bool Xfc::Gdk::Display::supports_cursor_color | ( |  | ) | const

| Determines if multicolored cursors are supported on display. Returns: true if cursors can have multiple colors. If multicolored cursors not supported cursors have only a forground and a background color.

bool Xfc::Gdk::Display::supports_selection_notification | ( |  | ) | const

| Determines whether Gdk::EventOwnerChange events will be sent when the owner of a selection changes. Returns: Whether Gdk::EventOwnerChange events will be sent.

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

## Member Data Documentation

const ClosedSignalType Xfc::Gdk::Display::closed_signal`[static, protected]`

| Closed signal (see signal_closed()). Calls a slot with the signature:
                 void function(bool is_error);
                 // is_error: Is true if the display was closed due to an error.

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

- display.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3