Gdk::Display Class Reference
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. More...Inherits Glib::Object.
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 () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
Glib::ustring | get_name () const |
Gets the name of the display. | |
int | get_n_screens () const |
Glib::RefPtr< Screen > | get_screen (int screen_num) |
Returns: the Gdk::Screen object. | |
Glib::RefPtr< const Screen > | get_screen (int screen_num) const |
Returns: the Gdk::Screen object. | |
Glib::RefPtr< Screen > | get_default_screen () |
Get the default Gdk::Screen for display. | |
Glib::RefPtr< const Screen > | get_default_screen () const |
Get the default Gdk::Screen for display. | |
void | pointer_ungrab (guint32 timestamp) |
void | keyboard_ungrab (guint32 timestamp) |
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 to the windowing system for the given display, and cleans up associated resources. | |
Glib::ListHandle< Glib::RefPtr < Device > > | list_devices () |
Return value: a list of Gdk::Device. | |
Glib::ListHandle< Glib::RefPtr < const Device > > | list_devices () const |
Return value: a list of Gdk::Device. | |
GdkEvent* | get_event () |
Gets the next Gdk::Event to be processed for display, fetching events from the windowing system if necessary. | |
const GdkEvent* | get_event () const |
Gets the next Gdk::Event to be processed for display, fetching events from the windowing system if necessary. | |
GdkEvent* | peek_event () |
GdkEvent* | peek_event () const |
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 (Glib::ustring& 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). | |
void | 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). | |
Glib::RefPtr< Device > | get_core_pointer () |
Return value: the core pointer device; this is owned by the. | |
Glib::RefPtr< const Device > | get_core_pointer () const |
Return value: the core pointer device; this is owned by the. | |
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) |
Glib::RefPtr< const Window > | get_window_at_pointer (int& win_x, int& win_y) const |
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. | |
void | 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. | |
GdkDisplayPointerHooks* | set_pointer_hooks (const GdkDisplayPointerHooks* new_hooks) |
GdkDisplayPointerHooks* | unset_pointer_hooks () |
GdkNativeWindow | get_drag_protocol (GdkNativeWindow 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, Glib::ustring& selection, guint32 time_, bool send_event) |
Glib::RefPtr< Window > | get_selection_owner (const Glib::ustring& selection) |
void | selection_send_notify (GdkNativeWindow requestor, Glib::ustring& selection, Glib::ustring& target, Glib::ustring& property, guint32 time_) |
Send a response to SelectionRequest event. | |
Glib::RefPtr< Pixmap > | lookup_pixmap (NativeWindow anid) |
Looks up the Gdk::Pixmap that wraps the given native pixmap handle. | |
Glib::RefPtr< const Pixmap > | lookup_pixmap (NativeWindow anid) const |
Looks up the Gdk::Pixmap that wraps the given native pixmap handle. | |
void | flush () |
bool | supports_cursor_alpha () const |
Returns: whether cursors can have alpha channels. | |
bool | supports_cursor_color () const |
Returns: whether cursors can have multiple colors. | |
guint | get_default_cursor_size () const |
Returns: the default cursor size. | |
void | get_maximal_cursor_size (guint& width, guint& height) |
Gets the maximal size to use for cursors on display. | |
Glib::RefPtr< Window > | get_default_group () |
Return value: The default group leader window for display. | |
Glib::RefPtr< const Window > | get_default_group () const |
Return value: The default group leader window for display. | |
bool | supports_selection_notification () const |
Return value: whether Gdk::EventOwnerChange events will. | |
bool | request_selection_notification (const Glib::ustring& selection) |
Request Gdk::EventOwnerChange events for ownership changes of the selection named by the given atom. | |
bool | supports_clipboard_persistence () const |
Returns: true if the display supports clipboard persistance. | |
void | 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. | |
void | store_clipboard (const Glib::RefPtr< Gdk::Window >& clipboard_window, guint32 time_, const Glib::StringArrayHandle& targets) |
bool | supports_shapes () const |
Returns: true if shaped windows are supported. | |
bool | supports_input_shapes () const |
Returns: true if windows with modified input shape are supported. | |
bool | supports_composite () const |
Glib::SignalProxy1< void, bool > | signal_closed () |
The closed signal is emitted when the connection to the windowing system for this display is closed. | |
Static Public Member Functions | |
static Glib::RefPtr< Display > | open (const Glib::ustring& display_name) |
Opens a display. | |
static Glib::RefPtr< Display > | get_default () |
Gets the default Gdk::Display. | |
static 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) |
A Glib::wrap() method for this object. |
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.
Constructor& Destructor Documentation
virtual Gdk::Display::~Display | ( | ) | [virtual] |
Gdk::Display::Display | ( | ) | [protected] |
Member Function Documentation
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_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 | ( | ) |
void Gdk::Display::close | ( | ) |
Closes the connection to the windowing system for the given display, and cleans up associated resources.
void Gdk::Display::flush | ( | ) |
Glib::RefPtr<const Device> Gdk::Display::get_core_pointer | ( | ) | const |
Return value: the core pointer device; this is owned by the.
- Returns:
- The core pointer device; this is owned by the display and should not be freed.
Glib::RefPtr<Device> Gdk::Display::get_core_pointer | ( | ) |
Return value: the core pointer device; this is owned by the.
- Returns:
- The core pointer device; this is owned by the display and should not be freed.
static Glib::RefPtr<Display> Gdk::Display::get_default | ( | ) | [static] |
Gets the default Gdk::Display.
This is a convenience function for <literal>gdk_display_manager_get_default_display (manager_get())</literal>.
- Returns:
- A Gdk::Display, or
0
if there is no default display.
guint Gdk::Display::get_default_cursor_size | ( | ) | const |
Glib::RefPtr<const Window> Gdk::Display::get_default_group | ( | ) | const |
Return value: The default group leader window for display.
- Returns:
- The default group leader window for display
Glib::RefPtr<Window> Gdk::Display::get_default_group | ( | ) |
Return value: The default group leader window for display.
- Returns:
- The default group leader window for display
Glib::RefPtr<const Screen> Gdk::Display::get_default_screen | ( | ) | const |
Glib::RefPtr<Screen> Gdk::Display::get_default_screen | ( | ) |
GdkNativeWindow Gdk::Display::get_drag_protocol | ( | GdkNativeWindow | xid, | |
GdkDragProtocol & | protocol | |||
) |
Finds out the DND protocol supported by a window.
- Parameters:
-
display The Gdk::Display where the destination window resides. xid The windowing system id of the destination window. protocol Location 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.
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().
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().
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.
GdkKeymap* Gdk::Display::get_keymap | ( | ) |
- Parameters:
-
display The Gdk::Display.
- Returns:
- The Gdk::Keymap attached to display. the Gdk::Keymap attached to display.
void Gdk::Display::get_maximal_cursor_size | ( | guint & | width, | |
guint & | height | |||
) |
Gets the maximal size to use for cursors on display.
- Parameters:
-
width The return location for the maximal cursor width. height The return location for the maximal cursor height.
int Gdk::Display::get_n_screens | ( | ) | const |
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.
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:
-
x location to store root window X coordinate of pointer. y location to store root window Y coordinate of pointer. mask 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. x location to store root window X coordinate of pointer. y location to store root window Y coordinate of pointer. mask location to store current modifier mask.
Glib::RefPtr<const Screen> Gdk::Display::get_screen | ( | int | screen_num | ) | const |
Returns: the Gdk::Screen object.
- Parameters:
-
screen_num The screen number.
- Returns:
- The Gdk::Screen object
Glib::RefPtr<Screen> Gdk::Display::get_screen | ( | int | screen_num | ) |
Returns: the Gdk::Screen object.
- Parameters:
-
screen_num The screen number.
- Returns:
- The Gdk::Screen object
Glib::RefPtr<Window> Gdk::Display::get_selection_owner | ( | const Glib::ustring & | 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).
- Returns:
- The window underneath the mouse pointer.
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.
Glib::RefPtr<const Window> Gdk::Display::get_window_at_pointer | ( | int & | win_x, | |
int & | win_y | |||
) | const |
Glib::RefPtr<Window> Gdk::Display::get_window_at_pointer | ( | int & | win_x, | |
int & | win_y | |||
) |
const GdkDisplay* Gdk::Display::gobj | ( | ) | const [inline] |
GdkDisplay* Gdk::Display::gobj | ( | ) | [inline] |
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.
void Gdk::Display::keyboard_ungrab | ( | guint32 | timestamp | ) |
Glib::ListHandle< Glib::RefPtr<const Device> > Gdk::Display::list_devices | ( | ) | const |
Glib::ListHandle< Glib::RefPtr<Device> > Gdk::Display::list_devices | ( | ) |
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 <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.
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 <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.
virtual void Gdk::Display::on_closed | ( | bool | is_error | ) | [protected, virtual] |
static Glib::RefPtr<Display> Gdk::Display::open | ( | const Glib::ustring & | display_name | ) | [static] |
Opens a display.
- Parameters:
-
display_name The name of the display to open.
- Returns:
- A Gdk::Display, or
0
if the display could not be opened.
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
.
GdkEvent* Gdk::Display::peek_event | ( | ) | const |
GdkEvent* Gdk::Display::peek_event | ( | ) |
bool Gdk::Display::pointer_is_grabbed | ( | ) | const |
Test if the pointer is grabbed.
- Returns:
true
if an active X pointer grab is in effect
void Gdk::Display::pointer_ungrab | ( | guint32 | timestamp | ) |
void Gdk::Display::put_event | ( | GdkEvent * | event | ) |
Appends a copy of the given event onto the front of the event queue for display.
- Parameters:
-
event A Gdk::Event.
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:
-
selection The Gdk::Atom naming the selection for which ownership change notification is requested.
- Returns:
- Whether Gdk::EventOwnerChange events will be sent.
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:
-
requestor Window to which to deliver response. selection Selection that was requested. target Target that was selected. property Property in which the selection owner stored the data, or "None" to indicate that the request was rejected. time_ Timestamp.
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 <emphasis>not</emphasis> set this, it is a global user-configured setting.
- Parameters:
-
distance Distance in pixels.
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 <emphasis>not</emphasis> set this, it is a global user-configured setting.
- Parameters:
-
msec Double click time in milliseconds (thousandths of a second).
GdkDisplayPointerHooks* Gdk::Display::set_pointer_hooks | ( | const GdkDisplayPointerHooks * | new_hooks | ) |
bool Gdk::Display::set_selection_owner | ( | const Glib::RefPtr< Window >& | owner, | |
Glib::ustring & | selection, | |||
guint32 | time_, | |||
bool | send_event | |||
) |
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_error true if the display was closed due to an error
- Prototype:
void on_my_closed(bool is_error)
void Gdk::Display::store_clipboard | ( | const Glib::RefPtr< Gdk::Window >& | clipboard_window, | |
guint32 | time_, | |||
const Glib::StringArrayHandle & | targets | |||
) |
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_window A Gdk::Window belonging to the clipboard owner. time_ A timestamp.
bool Gdk::Display::supports_clipboard_persistence | ( | ) | const |
Returns: true
if the display supports clipboard persistance.
- Returns:
true
if the display supports clipboard persistance.
bool Gdk::Display::supports_composite | ( | ) | const |
bool Gdk::Display::supports_cursor_alpha | ( | ) | const |
Returns: whether cursors can have alpha channels.
- Returns:
- Whether cursors can have alpha channels.
bool Gdk::Display::supports_cursor_color | ( | ) | const |
Returns: whether cursors can have multiple colors.
- Returns:
- Whether cursors can have multiple colors.
bool Gdk::Display::supports_input_shapes | ( | ) | const |
Returns: true
if windows with modified input shape are supported.
- Returns:
true
if windows with modified input shape are supported
bool Gdk::Display::supports_selection_notification | ( | ) | const |
Return value: whether Gdk::EventOwnerChange events will.
- Returns:
- Whether Gdk::EventOwnerChange events will be sent.
bool Gdk::Display::supports_shapes | ( | ) | const |
Returns: true
if shaped windows are supported.
- Returns:
true
if shaped windows are supported
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.
GdkDisplayPointerHooks* Gdk::Display::unset_pointer_hooks | ( | ) |
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:
-
screen The screen of display to warp the pointer to. x The x coordinate of the destination. y The y coordinate of the destination.
Friends And Related Function Documentation
Glib::RefPtr< Gdk::Display > wrap | ( | GdkDisplay * | 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 or ref.
- Returns:
- A C++ instance that wraps this C instance.
The documentation for this class was generated from the following file:
- gdkmm/display.h