Ardour  9.0-pre0-582-g084a23a80d
Gdk::Display Class Reference

#include <display.h>

Inheritance diagram for Gdk::Display:
[legend]

Public Member Functions

virtual ~Display ()
 
GdkDisplaygobj ()
 Provides access to the underlying C GObject. More...
 
const GdkDisplaygobj () const
 Provides access to the underlying C GObject. More...
 
GdkDisplaygobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
Glib::ustring get_name () const
 
int get_n_screens () const
 
Glib::RefPtr< Screenget_screen (int screen_num)
 
Glib::RefPtr< const Screenget_screen (int screen_num) const
 
Glib::RefPtr< Screenget_default_screen ()
 
Glib::RefPtr< const Screenget_default_screen () const
 
void pointer_ungrab (guint32 timestamp)
 
void keyboard_ungrab (guint32 timestamp)
 
bool pointer_is_grabbed () const
 
void beep ()
 
void sync ()
 
void close ()
 
Glib::ListHandle< Glib::RefPtr< Device > > list_devices ()
 
Glib::ListHandle< Glib::RefPtr< const Device > > list_devices () const
 
GdkEventget_event ()
 
const GdkEventget_event () const
 
GdkEventpeek_event ()
 
GdkEventpeek_event () const
 
void put_event (GdkEvent *event)
 
void add_client_message_filter (Glib::ustring &message_type, GdkFilterFunc func, gpointer data)
 
void set_double_click_time (guint msec)
 
void set_double_click_distance (guint distance)
 
Glib::RefPtr< Deviceget_core_pointer ()
 
Glib::RefPtr< const Deviceget_core_pointer () const
 
void get_pointer (Glib::RefPtr< Screen > &screen, int &x, int &y, ModifierType &mask)
 
void get_pointer (int &x, int &y, ModifierType &mask)
 
Glib::RefPtr< Windowget_window_at_pointer (int &win_x, int &win_y)
 
Glib::RefPtr< const Windowget_window_at_pointer (int &win_x, int &win_y) const
 
Glib::RefPtr< Windowget_window_at_pointer ()
 
Glib::RefPtr< const Windowget_window_at_pointer () const
 
void warp_pointer (const Glib::RefPtr< Screen > &screen, int x, int y)
 
GdkDisplayPointerHooksset_pointer_hooks (const GdkDisplayPointerHooks *new_hooks)
 
GdkDisplayPointerHooksunset_pointer_hooks ()
 
GdkNativeWindow get_drag_protocol (GdkNativeWindow xid, GdkDragProtocol &protocol)
 
GdkKeymapget_keymap ()
 
const GdkKeymapget_keymap () const
 
bool set_selection_owner (const Glib::RefPtr< Window > &owner, Glib::ustring &selection, guint32 time_, bool send_event)
 
Glib::RefPtr< Windowget_selection_owner (const Glib::ustring &selection)
 
void selection_send_notify (GdkNativeWindow requestor, Glib::ustring &selection, Glib::ustring &target, Glib::ustring &property, guint32 time_)
 
Glib::RefPtr< Pixmaplookup_pixmap (NativeWindow anid)
 
Glib::RefPtr< const Pixmaplookup_pixmap (NativeWindow anid) const
 
void flush ()
 
bool supports_cursor_alpha () const
 
bool supports_cursor_color () const
 
guint get_default_cursor_size () const
 
void get_maximal_cursor_size (guint &width, guint &height)
 
Glib::RefPtr< Windowget_default_group ()
 
Glib::RefPtr< const Windowget_default_group () const
 
bool supports_selection_notification () const
 
bool request_selection_notification (const Glib::ustring &selection)
 
bool supports_clipboard_persistence () const
 
void store_clipboard (const Glib::RefPtr< Gdk::Window > &clipboard_window, guint32 time_)
 
void store_clipboard (const Glib::RefPtr< Gdk::Window > &clipboard_window, guint32 time_, const Glib::StringArrayHandle &targets)
 
bool supports_shapes () const
 
bool supports_input_shapes () const
 
bool supports_composite () const
 
Glib::SignalProxy1< void, bool > signal_closed ()
 

Static Public Member Functions

static GType get_type () G_GNUC_CONST
 
static Glib::RefPtr< Displayopen (const Glib::ustring &display_name)
 
static Glib::RefPtr< Displayget_default ()
 
static Glib::RefPtr< Displayopen_default_libgtk_only ()
 

Protected Member Functions

 Display ()
 
virtual void on_closed (bool is_error)
 This is a default handler for the signal signal_closed(). More...
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gdk::Displaywrap (GdkDisplay *object, bool take_copy=false)
 

Detailed Description

Gdk::Display object's purpose is two fold: To grab/ungrab keyboard focus and mouse pointer To manage and provide information about the Gdk::Screen(s) available for this Gdk::Display

Gdk::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 Gdk::Screen objects currently instantiated by the application. It is also used to grab and release the keyboard and the mouse pointer.

Definition at line 63 of file display.h.

Constructor & Destructor Documentation

◆ ~Display()

virtual Gdk::Display::~Display ( )
virtual

◆ Display()

Gdk::Display::Display ( )
protected

Member Function Documentation

◆ add_client_message_filter()

void Gdk::Display::add_client_message_filter ( Glib::ustring &  message_type,
GdkFilterFunc  func,
gpointer  data 
)

Adds a filter to be called when X ClientMessage events are received. See Gdk::Window::add_filter() if you are interested in filtering other types of events.

Parameters
message_typeThe type of ClientMessage events to receive. This will be checked against the message_type field of the XClientMessage event struct.
funcThe function to call to process the event.
dataUser data to pass to func.

◆ beep()

void Gdk::Display::beep ( )

Emits a short beep on display

◆ close()

void Gdk::Display::close ( )

Closes the connection to the windowing system for the given display, and cleans up associated resources.

◆ flush()

void 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 is most useful for X11. On windowing systems where requests are handled synchronously, this function will do nothing.

◆ get_core_pointer() [1/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.

◆ get_core_pointer() [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.

◆ get_default()

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

◆ get_default_cursor_size()

guint Gdk::Display::get_default_cursor_size ( ) const

Returns the default size to use for cursors on display.

Returns
The default cursor size.

◆ get_default_group() [1/2]

Glib::RefPtr<Window> Gdk::Display::get_default_group ( )

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

Returns
The default group leader window for display.

◆ get_default_group() [2/2]

Glib::RefPtr<const Window> Gdk::Display::get_default_group ( ) const

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

Returns
The default group leader window for display.

◆ get_default_screen() [1/2]

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

Get the default Gdk::Screen for display.

Returns
The default Gdk::Screen object for display.

◆ get_default_screen() [2/2]

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

Get the default Gdk::Screen for display.

Returns
The default Gdk::Screen object for display.

◆ get_drag_protocol()

GdkNativeWindow Gdk::Display::get_drag_protocol ( GdkNativeWindow  xid,
GdkDragProtocol protocol 
)

Finds out the DND protocol supported by a window.

Parameters
xidThe windowing system id of the destination window.
protocolLocation where the supported DND protocol is returned.
Returns
The windowing system id of the window where the drop should happen. This may be xid or the id of a proxy window, or zero if xid doesn't support Drag and Drop.

◆ get_event() [1/2]

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().

◆ get_event() [2/2]

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

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().

◆ get_keymap() [1/2]

GdkKeymap* Gdk::Display::get_keymap ( )

Returns the Gdk::Keymap attached to display.

Returns
The Gdk::Keymap attached to display.

◆ get_keymap() [2/2]

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

Returns the Gdk::Keymap attached to display.

Returns
The Gdk::Keymap attached to display.

◆ get_maximal_cursor_size()

void Gdk::Display::get_maximal_cursor_size ( guint &  width,
guint &  height 
)

Gets the maximal size to use for cursors on display.

Parameters
widthThe return location for the maximal cursor width.
heightThe return location for the maximal cursor height.

◆ get_n_screens()

int Gdk::Display::get_n_screens ( ) const

Gets the number of screen managed by the display.

Returns
Number of screens.

◆ get_name()

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.

◆ get_pointer() [1/2]

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
screenlocation to store the screen that the cursor is on.
xlocation to store root window X coordinate of pointer.
ylocation to store root window Y coordinate of pointer.
masklocation to store current modifier mask.

◆ get_pointer() [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.

Parameters
xlocation to store root window X coordinate of pointer.
ylocation to store root window Y coordinate of pointer.
masklocation to store current modifier mask.

◆ get_screen() [1/2]

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

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

Parameters
screen_numThe screen number.
Returns
The Gdk::Screen object.

◆ get_screen() [2/2]

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

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

Parameters
screen_numThe screen number.
Returns
The Gdk::Screen object.

◆ get_selection_owner()

Glib::RefPtr<Window> Gdk::Display::get_selection_owner ( const Glib::ustring &  selection)

◆ get_type()

static GType Gdk::Display::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ get_window_at_pointer() [1/4]

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

Returns
The window underneath the mouse pointer.

◆ get_window_at_pointer() [2/4]

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

Returns
The window underneath the mouse pointer.

◆ get_window_at_pointer() [3/4]

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 the pointer in 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_xReturn location for x coordinate of the pointer location relative to the window origin, or 0.
win_yReturn location for y coordinate of the pointer location relative & to the window origin, or 0.
Returns
The window under the mouse pointer, or 0.

◆ get_window_at_pointer() [4/4]

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 the pointer in 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_xReturn location for x coordinate of the pointer location relative to the window origin, or 0.
win_yReturn location for y coordinate of the pointer location relative & to the window origin, or 0.
Returns
The window under the mouse pointer, or 0.

◆ gobj() [1/2]

GdkDisplay* Gdk::Display::gobj ( )
inline

Provides access to the underlying C GObject.

Definition at line 102 of file display.h.

◆ gobj() [2/2]

const GdkDisplay* Gdk::Display::gobj ( ) const
inline

Provides access to the underlying C GObject.

Definition at line 105 of file display.h.

◆ gobj_copy()

GdkDisplay* Gdk::Display::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

◆ keyboard_ungrab()

void Gdk::Display::keyboard_ungrab ( guint32  timestamp)

Release any keyboard grab

Parameters
timestampA timestap (e.g Gdk::CURRENT_TIME).

◆ list_devices() [1/2]

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.

◆ list_devices() [2/2]

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

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.

◆ lookup_pixmap() [1/2]

Glib::RefPtr<Pixmap> Gdk::Display::lookup_pixmap ( NativeWindow  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 XID.

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

◆ lookup_pixmap() [2/2]

Glib::RefPtr<const Pixmap> Gdk::Display::lookup_pixmap ( NativeWindow  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 XID.

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

◆ on_closed()

virtual void Gdk::Display::on_closed ( bool  is_error)
protectedvirtual

This is a default handler for the signal signal_closed().

◆ open()

static Glib::RefPtr<Display> Gdk::Display::open ( const Glib::ustring &  display_name)
static

Opens a display.

Parameters
display_nameThe name of the display to open.
Returns
A Gdk::Display, or 0 if the display could not be opened.

◆ open_default_libgtk_only()

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

◆ peek_event() [1/2]

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().

◆ peek_event() [2/2]

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

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().

◆ pointer_is_grabbed()

bool Gdk::Display::pointer_is_grabbed ( ) const

Test if the pointer is grabbed.

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

◆ pointer_ungrab()

void Gdk::Display::pointer_ungrab ( guint32  timestamp)

Release any pointer grab.

Parameters
timestampA timestap (e.g. GDK_CURRENT_TIME).

◆ put_event()

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

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

Parameters
eventA Gdk::Event.

◆ request_selection_notification()

bool Gdk::Display::request_selection_notification ( const Glib::ustring &  selection)

Request Gdk::EventOwnerChange events for ownership changes of the selection named by the given atom.

Parameters
selectionThe Gdk::Atom naming the selection for which ownership change notification is requested.
Returns
Whether Gdk::EventOwnerChange events will be sent.

◆ selection_send_notify()

void Gdk::Display::selection_send_notify ( GdkNativeWindow  requestor,
Glib::ustring &  selection,
Glib::ustring &  target,
Glib::ustring &  property,
guint32  time_ 
)

Send a response to SelectionRequest event.

Parameters
requestorWindow to which to deliver response.
selectionSelection that was requested.
targetTarget that was selected.
propertyProperty in which the selection owner stored the data, or "None" to indicate that the request was rejected.
time_Timestamp.

◆ set_double_click_distance()

void Gdk::Display::set_double_click_distance ( guint  distance)

Sets the double click distance (two clicks within this distance count as a double click and result in a Gdk::2BUTTON_PRESS event). See also set_double_click_time(). Applications should not set this, it is a global user-configured setting.

Parameters
distanceDistance in pixels.

◆ set_double_click_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.

Parameters
msecDouble click time in milliseconds (thousandths of a second).

◆ set_pointer_hooks()

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_hooksA table of pointers to functions for getting quantities related to the current pointer position.
Returns
The previous pointer hook table.

◆ set_selection_owner()

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

◆ signal_closed()

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

The closed signal is emitted when the connection to the windowing system for this display is closed.

Parameters
is_errortrue if the display was closed due to an error
Slot Prototype:
void on_my_closed(bool is_error)

◆ store_clipboard() [1/2]

void Gdk::Display::store_clipboard ( const Glib::RefPtr< Gdk::Window > &  clipboard_window,
guint32  time_ 
)

Issues a request to the clipboard manager to store the clipboard data, saving all available targets. On X11, this is a special program that works according to the freedesktop clipboard specification, available at http://www.freedesktop.org/Standards/clipboard-manager-spec.

Parameters
clipboard_windowA Gdk::Window belonging to the clipboard owner.
time_A timestamp.

◆ store_clipboard() [2/2]

void Gdk::Display::store_clipboard ( const Glib::RefPtr< Gdk::Window > &  clipboard_window,
guint32  time_,
const Glib::StringArrayHandle &  targets 
)

◆ supports_clipboard_persistence()

bool Gdk::Display::supports_clipboard_persistence ( ) const

Returns whether the speicifed display supports clipboard persistance; i.e. if it's possible to store the clipboard data after an application has quit. On X11 this checks if a clipboard daemon is running.

Returns
true if the display supports clipboard persistance.

◆ supports_composite()

bool Gdk::Display::supports_composite ( ) const

Returns true if Gdk::Window::set_composited() can be used to redirect drawing on the window using compositing.

Currently this only works on X11 with XComposite and XDamage extensions available.

Returns
true if windows may be composited.

◆ supports_cursor_alpha()

bool Gdk::Display::supports_cursor_alpha ( ) const

Returns true if cursors can use an 8bit alpha channel on display. Otherwise, cursors are restricted to bilevel alpha (i.e. a mask).

Returns
Whether cursors can have alpha channels.

◆ supports_cursor_color()

bool Gdk::Display::supports_cursor_color ( ) const

Returns true if multicolored cursors are supported on display. Otherwise, cursors have only a forground and a background color.

Returns
Whether cursors can have multiple colors.

◆ supports_input_shapes()

bool Gdk::Display::supports_input_shapes ( ) const

Returns true if Gdk::Window::input_shape_combine_mask() can be used to modify the input shape of windows on display.

Returns
true if windows with modified input shape are supported.

◆ supports_selection_notification()

bool Gdk::Display::supports_selection_notification ( ) const

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

Returns
Whether Gdk::EventOwnerChange events will be sent.

◆ supports_shapes()

bool Gdk::Display::supports_shapes ( ) const

Returns true if Gdk::Window::shape_combine_mask() can be used to create shaped windows on display.

Returns
true if shaped windows are supported.

◆ sync()

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.

◆ unset_pointer_hooks()

GdkDisplayPointerHooks* Gdk::Display::unset_pointer_hooks ( )

◆ warp_pointer()

void Gdk::Display::warp_pointer ( const Glib::RefPtr< Screen > &  screen,
int  x,
int  y 
)

Warps the pointer of display to the point x, y on the screen screen, unless the pointer is confined to a window by a grab, in which case it will be moved as far as allowed by the grab. Warping the pointer creates events as if the user had moved the mouse instantaneously to the destination.

Note that the pointer should normally be under the control of the user. This function was added to cover some rare use cases like keyboard navigation support for the color picker in the Gtk::ColorSelectionDialog.

Parameters
screenThe screen of display to warp the pointer to.
xThe x coordinate of the destination.
yThe y coordinate of the destination.

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gdk::Display > wrap ( GdkDisplay object,
bool  take_copy = false 
)
related

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

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.

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