Commit 938448e0 authored by Mario Sanchez Prada's avatar Mario Sanchez Prada
Browse files

display: Add new virtual gdk_display_get_startup_notification_id() method.

Includes implementation for Wayland and X11, which are the only backends
implementing the Startup Notification Protocol, returns NULL otherwise.

#1084
parent ef342757
......@@ -1283,6 +1283,28 @@ gdk_display_notify_startup_complete (GdkDisplay *display,
GDK_DISPLAY_GET_CLASS (display)->notify_startup_complete (display, startup_id);
}
/**
* gdk_display_get_startup_notification_id:
* @display: (type GdkX11Display): a #GdkDisplay
*
* Gets the startup notification ID for a Wayland display, or %NULL
* if no ID has been defined.
*
* Returns: the startup notification ID for @display, or %NULL
*
* Since: 4.0
*/
const gchar *
gdk_display_get_startup_notification_id (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
if (GDK_DISPLAY_GET_CLASS (display)->get_startup_notification_id == NULL)
return NULL;
return GDK_DISPLAY_GET_CLASS (display)->get_startup_notification_id (display);
}
void
_gdk_display_pause_events (GdkDisplay *display)
{
......
......@@ -94,6 +94,8 @@ gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
void gdk_display_notify_startup_complete (GdkDisplay *display,
const gchar *startup_id);
GDK_AVAILABLE_IN_ALL
const gchar * gdk_display_get_startup_notification_id (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
GdkAppLaunchContext *gdk_display_get_app_launch_context (GdkDisplay *display);
......
......@@ -136,6 +136,8 @@ struct _GdkDisplayClass
void (*notify_startup_complete) (GdkDisplay *display,
const gchar *startup_id);
const gchar * (*get_startup_notification_id) (GdkDisplay *display);
void (*event_data_copy) (GdkDisplay *display,
const GdkEvent *event,
GdkEvent *new_event);
......
......@@ -857,6 +857,23 @@ gdk_wayland_display_get_next_serial (GdkDisplay *display)
return ++serial;
}
/**
* gdk_wayland_display_get_startup_notification_id:
* @display: (type GdkX11Display): a #GdkDisplay
*
* Gets the startup notification ID for a Wayland display, or %NULL
* if no ID has been defined.
*
* Returns: the startup notification ID for @display, or %NULL
*
* Since: 4.0
*/
const gchar *
gdk_wayland_display_get_startup_notification_id (GdkDisplay *display)
{
return GDK_WAYLAND_DISPLAY (display)->startup_notification_id;
}
/**
* gdk_wayland_display_set_startup_notification_id:
* @display: (type GdkWaylandDisplay): a #GdkDisplay
......@@ -1005,6 +1022,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
display_class->supports_input_shapes = gdk_wayland_display_supports_input_shapes;
display_class->get_app_launch_context = _gdk_wayland_display_get_app_launch_context;
display_class->get_next_serial = gdk_wayland_display_get_next_serial;
display_class->get_startup_notification_id = gdk_wayland_display_get_startup_notification_id;
display_class->notify_startup_complete = gdk_wayland_display_notify_startup_complete;
display_class->create_surface_impl = _gdk_wayland_display_create_surface_impl;
display_class->get_keymap = _gdk_wayland_display_get_keymap;
......
......@@ -54,6 +54,8 @@ void gdk_wayland_display_set_cursor_theme (GdkDisplay *di
const gchar *theme,
gint size);
GDK_AVAILABLE_IN_ALL
const gchar * gdk_wayland_display_get_startup_notification_id (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
void gdk_wayland_display_set_startup_notification_id (GdkDisplay *display,
const char *startup_id);
......
......@@ -3042,6 +3042,7 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
display_class->get_app_launch_context = _gdk_x11_display_get_app_launch_context;
display_class->get_next_serial = gdk_x11_display_get_next_serial;
display_class->get_startup_notification_id = gdk_x11_display_get_startup_notification_id;
display_class->notify_startup_complete = gdk_x11_display_notify_startup_complete;
display_class->create_surface_impl = _gdk_x11_display_create_surface_impl;
display_class->get_keymap = gdk_x11_display_get_keymap;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment