// Generated by gmmproc 2.82.0 -- DO NOT MODIFY! #ifndef _GDKMM_DISPLAY_H #define _GDKMM_DISPLAY_H #include #include /* * Copyright (C) 1998-2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #ifndef DOXYGEN_SHOULD_SKIP_THIS using GdkDisplay = struct _GdkDisplay; using GdkDisplayClass = struct _GdkDisplayClass; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ #ifndef DOXYGEN_SHOULD_SKIP_THIS namespace Gdk { class GDKMM_API Display_Class; } // namespace Gdk #endif //DOXYGEN_SHOULD_SKIP_THIS namespace Gio { class GDKMM_API ListModel; } namespace Gdk { class GDKMM_API Clipboard; class GDKMM_API DmabufFormats; class GDKMM_API Device; class GDKMM_API GLContext; class GDKMM_API Seat; class GDKMM_API Monitor; class GDKMM_API Surface; /** Gdk::Display object's purpose is two fold: * To grab/ungrab keyboard focus and mouse pointer * To manage and provide information about the Gdk::Monitor(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::Monitor objects currently instantiated by the application. It is also used to grab and release the keyboard * and the mouse pointer. */ class GDKMM_API Display : public Glib::Object { #ifndef DOXYGEN_SHOULD_SKIP_THIS public: using CppObjectType = Display; using CppClassType = Display_Class; using BaseObjectType = GdkDisplay; using BaseClassType = GdkDisplayClass; // noncopyable Display(const Display&) = delete; Display& operator=(const Display&) = delete; private: friend class Display_Class; static CppClassType display_class_; protected: explicit Display(const Glib::ConstructParams& construct_params); explicit Display(GdkDisplay* castitem); #endif /* DOXYGEN_SHOULD_SKIP_THIS */ public: Display(Display&& src) noexcept; Display& operator=(Display&& src) noexcept; ~Display() noexcept override; /** Get the GType for this class, for use with the underlying GObject type system. */ static GType get_type() G_GNUC_CONST; #ifndef DOXYGEN_SHOULD_SKIP_THIS static GType get_base_type() G_GNUC_CONST; #endif ///Provides access to the underlying C GObject. GdkDisplay* gobj() { return reinterpret_cast(gobject_); } ///Provides access to the underlying C GObject. const GdkDisplay* gobj() const { return reinterpret_cast(gobject_); } ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. GdkDisplay* gobj_copy(); private: protected: Display(); public: /** Opens a display. * * If opening the display fails, nullptr is returned. * * @param display_name The name of the display to open. * @return A `Gdk::Display`. */ static Glib::RefPtr open(const Glib::ustring& display_name); /** Gets the name of the display. * * @return A string representing the display name. This string is owned * by GDK and should not be modified or freed. */ Glib::ustring get_name() const; /** Returns true if there is an ongoing grab on @a device for @a display. * * @param device A `Gdk::Device`. * @return true if there is a grab in effect for @a device. */ bool device_is_grabbed(const Glib::RefPtr& device) const; /** Emits a short beep on @a display */ void beep(); /** 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 GdkX11::Display::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. */ void sync(); /** Closes the connection to the windowing system for the given display. * * This cleans up associated resources. */ void close(); /** Finds out if the display has been closed. * * @return true if the display is closed. */ bool is_closed() const; /** Returns whether surfaces can reasonably be expected to have * their alpha channel drawn correctly on the screen. * * Check is_rgba() for whether the display * supports an alpha channel. * * On X11 this function returns whether a compositing manager is * compositing on @a display. * * On modern displays, this value is always true. * * @return Whether surfaces with RGBA visuals can reasonably * be expected to have their alpha channels drawn correctly * on the screen. */ bool is_composited() const; /** Returns whether surfaces on this @a display are created with an * alpha channel. * * Even if a true is returned, it is possible that the * surface’s alpha channel won’t be honored when displaying the * surface on the screen: in particular, for X an appropriate * windowing manager and compositing manager must be running to * provide appropriate display. Use is_composited() * to check if that is the case. * * On modern displays, this value is always true. * * @return true if surfaces are created with an alpha channel or * false if the display does not support this functionality. */ bool is_rgba() const; /** Returns whether it's possible for a surface to draw outside of the window area. * * If true is returned the application decides if it wants to draw shadows. * If false is returned, the compositor decides if it wants to draw shadows. * * @newin{4,14} * * @return true if surfaces can draw shadows or * false if the display does not support this functionality. */ bool supports_shadow_width() const; #ifndef GDKMM_DISABLE_DEPRECATED /** Adds the given event to the event queue for @a display. * * Deprecated: 4.10: This function is only useful in very * special situations and should not be used by applications. * * @deprecated This function is only useful in very special situations and should not be used by applications. * * @param event A `Gdk::Event`. */ void put_event(const Glib::RefPtr& event); #endif // GDKMM_DISABLE_DEPRECATED /** Gets the default `Gdk::Display`. * * This is a convenience function for: * * gdk_display_manager_get_default_display (Gdk::DisplayManager::get()) * * @return A `Gdk::Display`, or nullptr if * there is no default display. */ static Glib::RefPtr get_default(); /** 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 explicitly. 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. */ void flush(); /** Gets the clipboard used for copy/paste operations. * * @return The display's clipboard. */ Glib::RefPtr get_clipboard(); /** Gets the clipboard used for copy/paste operations. * * @return The display's clipboard. */ Glib::RefPtr get_clipboard() const; /** Gets the clipboard used for the primary selection. * * On backends where the primary clipboard is not supported natively, * GDK emulates this clipboard locally. * * @return The primary clipboard. */ Glib::RefPtr get_primary_clipboard(); /** Gets the clipboard used for the primary selection. * * On backends where the primary clipboard is not supported natively, * GDK emulates this clipboard locally. * * @return The primary clipboard. */ Glib::RefPtr get_primary_clipboard() const; /** Returns true if the display supports input shapes. * * This means that Gdk::Surface::set_input_region() can * be used to modify the input shape of surfaces on @a display. * * On modern displays, this value is always true. * * @return true if surfaces with modified input shape are supported. */ bool supports_input_shapes() const; /** Checks that OpenGL is available for this display and ensures that it is * properly initialized. * * When this fails, an exception will be thrown describing the error. * * Note that even if this function succeeds, creating a `Gdk::GLContext` * may still fail. * * This function is idempotent. Calling it multiple times will just * return the same value or error. * * You never need to call this function, GDK will call it automatically * as needed. But you can use it as a check when setting up code that * might make use of OpenGL. * * @newin{4,4} * * @throws Glib::Error */ void prepare_gl(); /** Creates a new `Gdk::GLContext` for the `Gdk::Display`. * * The context is disconnected from any particular surface or surface * and cannot be used to draw to any surface. It can only be used to * draw to non-surface framebuffers like textures. * * If the creation of the `Gdk::GLContext` failed, @a error will be set. * Before using the returned `Gdk::GLContext`, you will need to * call Gdk::GLContext::make_current() or Gdk::GLContext::realize(). * * @newin{4,6} * * @return The newly created `Gdk::GLContext`. * * @throws Glib::Error */ Glib::RefPtr create_gl_context(); #ifndef GDKMM_DISABLE_DEPRECATED /** Indicates to the GUI environment that the application has * finished loading, using a given identifier. * * GTK will call this function automatically for [GtkWindow](../gtk4/class.Window.html) * with custom startup-notification identifier unless * [gtk_window_set_auto_startup_notification()](../gtk4/method.Window.set_auto_startup_notification.html) * is called to disable that feature. * * Deprecated: 4.10: Using Gdk::Toplevel::set_startup_id() is sufficient * * @deprecated Using Gdk::Toplevel::set_startup_id() is sufficient. * * @param startup_id A startup-notification identifier, for which * notification process should be completed. */ void notify_startup_complete(const Glib::ustring& startup_id); #endif // GDKMM_DISABLE_DEPRECATED #ifndef GDKMM_DISABLE_DEPRECATED /** Gets the startup notification ID for a Wayland display, or nullptr * if no ID has been defined. * * Deprecated: 4.10 * * @return The startup notification ID for @a display. */ Glib::ustring get_startup_notification_id() const; #endif // GDKMM_DISABLE_DEPRECATED /** Returns a `Gdk::AppLaunchContext` suitable for launching * applications on the given display. * * @return A new `Gdk::AppLaunchContext` for @a display. */ Glib::RefPtr get_app_launch_context(); /** Returns a `Gdk::AppLaunchContext` suitable for launching * applications on the given display. * * @return A new `Gdk::AppLaunchContext` for @a display. */ Glib::RefPtr get_app_launch_context() const; /** Returns the default `Gdk::Seat` for this display. * * Note that a display may not have a seat. In this case, * this function will return nullptr. * * @return The default seat. */ Glib::RefPtr get_default_seat(); /** Returns the default `Gdk::Seat` for this display. * * Note that a display may not have a seat. In this case, * this function will return nullptr. * * @return The default seat. */ Glib::RefPtr get_default_seat() const; /** Returns the list of seats known to @a display. * * @return The * list of seats known to the `Gdk::Display`. */ std::vector> list_seats(); /** Returns the list of seats known to @a display. * * @return The * list of seats known to the `Gdk::Display`. */ std::vector> list_seats() const; /** Gets the list of monitors associated with this display. * * Subsequent calls to this function will always return the * same list for the same display. * * You can listen to the GListModel::items-changed signal on * this list to monitor changes to the monitor of this display. * * @return A `Gio::ListModel` of `Gdk::Monitor`. */ Glib::RefPtr get_monitors(); /** Gets the list of monitors associated with this display. * * Subsequent calls to this function will always return the * same list for the same display. * * You can listen to the GListModel::items-changed signal on * this list to monitor changes to the monitor of this display. * * @return A `Gio::ListModel` of `Gdk::Monitor`. */ Glib::RefPtr get_monitors() const; /** Gets the monitor in which the largest area of @a surface * resides. * * @param surface A `Gdk::Surface`. * @return The monitor with the largest * overlap with @a surface. */ Glib::RefPtr get_monitor_at_surface(const Glib::RefPtr& surface); /** Gets the monitor in which the largest area of @a surface * resides. * * @param surface A `Gdk::Surface`. * @return The monitor with the largest * overlap with @a surface. */ Glib::RefPtr get_monitor_at_surface(const Glib::RefPtr& surface) const; template bool get_setting(const Glib::ustring& name, ValueType& value) const; /** Returns the dma-buf formats that are supported on this display. * * GTK may use OpenGL or Vulkan to support some formats. * Calling this function will then initialize them if they aren't yet. * * The formats returned by this function can be used for negotiating * buffer formats with producers such as v4l, pipewire or GStreamer. * * To learn more about dma-bufs, see Gdk::DmabufTextureBuilder. * * @newin{4,14} * * @return A `Gdk::DmabufFormats` object. */ Glib::RefPtr get_dmabuf_formats(); /** Returns the dma-buf formats that are supported on this display. * * GTK may use OpenGL or Vulkan to support some formats. * Calling this function will then initialize them if they aren't yet. * * The formats returned by this function can be used for negotiating * buffer formats with producers such as v4l, pipewire or GStreamer. * * To learn more about dma-bufs, see Gdk::DmabufTextureBuilder. * * @newin{4,14} * * @return A `Gdk::DmabufFormats` object. */ Glib::RefPtr get_dmabuf_formats() const; //We use no_default_handler because GdkDisplayClass is private. /** * @par Slot Prototype: * void on_my_%closed(bool is_error) * * Flags: Run Last * * Emitted when the connection to the windowing system for @a display is closed. * * @param is_error true if the display was closed due to an error. */ Glib::SignalProxy signal_closed(); /** * @par Slot Prototype: * void on_my_%opened() * * Flags: Run Last * * Emitted when the connection to the windowing system for @a display is opened. */ Glib::SignalProxy signal_opened(); /** * @par Slot Prototype: * void on_my_%seat_added(const Glib::RefPtr& seat) * * Flags: Run Last * * Emitted whenever a new seat is made known to the windowing system. * * @param seat The seat that was just added. */ Glib::SignalProxy&)> signal_seat_added(); /** * @par Slot Prototype: * void on_my_%seat_removed(const Glib::RefPtr& seat) * * Flags: Run Last * * Emitted whenever a seat is removed by the windowing system. * * @param seat The seat that was just removed. */ Glib::SignalProxy&)> signal_seat_removed(); /** * @par Slot Prototype: * void on_my_%setting_changed(const Glib::ustring& setting) * * Flags: Run Last * * Emitted whenever a setting changes its value. * * @param setting The name of the setting that changed. */ Glib::SignalProxy signal_setting_changed(); /** true if the display properly composites the alpha channel. * * Default value: true * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< bool > property_composited() const; /** true if the display supports an alpha channel. * * Default value: true * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< bool > property_rgba() const; /** true if the display supports extensible frames. * * @newin{4,14} * * Default value: true * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< bool > property_shadow_width() const; /** true if the display supports input shapes. * * Default value: true * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< bool > property_input_shapes() const; /** The dma-buf formats that are supported on this display * * @newin{4,14} * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_dmabuf_formats() const; // We don't wrap the vfuncs because GdkDisplayClass is private. public: public: //C++ methods used to invoke GTK+ virtual functions: protected: //GTK+ Virtual Functions (override these to change behaviour): //Default Signal Handlers:: }; template bool Display::get_setting(const Glib::ustring& name, ValueType& value) const { Glib::Value glibmmvalue; glibmmvalue.init(Glib::Value::value_type()); gboolean result = gdk_display_get_setting(const_cast(gobj()), name.c_str(), glibmmvalue.gobj()); value = glibmmvalue.get(); return result; } } // namespace Gdk namespace Glib { /** A Glib::wrap() method for this object. * * @param object The C instance. * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. * @result A C++ instance that wraps this C instance. * * @relates Gdk::Display */ GDKMM_API Glib::RefPtr wrap(GdkDisplay* object, bool take_copy = false); } #endif /* _GDKMM_DISPLAY_H */