display: Remove the monitor signals

Applications can listen to GdkDisplay:monitors::items-changed if they
want to track monitor changes.
This commit is contained in:
Benjamin Otte 2020-05-17 05:47:07 +02:00
parent 972276436f
commit 9a30019268
5 changed files with 11 additions and 79 deletions

View File

@ -81,8 +81,6 @@ enum {
CLOSED,
SEAT_ADDED,
SEAT_REMOVED,
MONITOR_ADDED,
MONITOR_REMOVED,
SETTING_CHANGED,
LAST_SIGNAL
};
@ -264,38 +262,6 @@ gdk_display_class_init (GdkDisplayClass *class)
NULL,
G_TYPE_NONE, 1, GDK_TYPE_SEAT);
/**
* GdkDisplay::monitor-added:
* @display: the objedct on which the signal is emitted
* @monitor: the monitor that was just added
*
* The ::monitor-added signal is emitted whenever a monitor is
* added.
*/
signals[MONITOR_ADDED] =
g_signal_new (g_intern_static_string ("monitor-added"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
NULL,
G_TYPE_NONE, 1, GDK_TYPE_MONITOR);
/**
* GdkDisplay::monitor-removed:
* @display: the object on which the signal is emitted
* @monitor: the monitor that was just removed
*
* The ::monitor-removed signal is emitted whenever a monitor is
* removed.
*/
signals[MONITOR_REMOVED] =
g_signal_new (g_intern_static_string ("monitor-removed"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
NULL,
G_TYPE_NONE, 1, GDK_TYPE_MONITOR);
/**
* GdkDisplay::setting-changed:
* @display: the object on which the signal is emitted
@ -1648,21 +1614,6 @@ gdk_display_get_monitor_at_surface (GdkDisplay *display,
return best;
}
void
gdk_display_monitor_added (GdkDisplay *display,
GdkMonitor *monitor)
{
g_signal_emit (display, signals[MONITOR_ADDED], 0, monitor);
}
void
gdk_display_monitor_removed (GdkDisplay *display,
GdkMonitor *monitor)
{
g_signal_emit (display, signals[MONITOR_REMOVED], 0, monitor);
gdk_monitor_invalidate (monitor);
}
void
gdk_display_emit_opened (GdkDisplay *display)
{

View File

@ -241,10 +241,6 @@ void gdk_display_add_seat (GdkDisplay *display
GdkSeat *seat);
void gdk_display_remove_seat (GdkDisplay *display,
GdkSeat *seat);
void gdk_display_monitor_added (GdkDisplay *display,
GdkMonitor *monitor);
void gdk_display_monitor_removed (GdkDisplay *display,
GdkMonitor *monitor);
void gdk_display_emit_opened (GdkDisplay *display);
void gdk_display_setting_changed (GdkDisplay *display,

View File

@ -2521,7 +2521,6 @@ gdk_wayland_display_add_output (GdkWaylandDisplay *display_wayland,
gdk_wayland_display_get_xdg_output (monitor);
g_list_store_append (display_wayland->monitors, monitor);
gdk_display_monitor_added (GDK_DISPLAY (display_wayland), GDK_MONITOR (monitor));
g_object_unref (monitor);
}
@ -2567,7 +2566,7 @@ gdk_wayland_display_remove_output (GdkWaylandDisplay *self,
if (monitor->id == id)
{
g_list_store_remove (self->monitors, i);
gdk_display_monitor_removed (GDK_DISPLAY (self), GDK_MONITOR (monitor));
gdk_monitor_invalidate (GDK_MONITOR (monitor));
update_scale (GDK_DISPLAY (self));
}

View File

@ -186,7 +186,6 @@ _gdk_win32_display_find_matching_monitor (GdkWin32Display *win32_display,
void
_gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
{
GdkDisplay *display = GDK_DISPLAY (win32_display);
GPtrArray *new_monitors;
gint i;
GdkWin32Monitor *primary_to_move = NULL;
@ -286,23 +285,19 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
if (!w32_ex_monitor->remove)
continue;
gdk_display_monitor_removed (display, ex_monitor);
g_list_store_remove (G_LIST_STORE (win32_display->monitors), i);
gdk_monitor_invalidate (ex_monitor);
}
for (i = 0; i < new_monitors->len; i++)
{
GdkWin32Monitor *w32_m;
GdkMonitor *m;
w32_m = GDK_WIN32_MONITOR (g_ptr_array_index (new_monitors, i));
m = GDK_MONITOR (w32_m);
if (!w32_m->add)
continue;
gdk_display_monitor_added (display, m);
if (i == 0)
g_list_store_insert (G_LIST_STORE (win32_display->monitors), 0, w32_m);
else

View File

@ -610,16 +610,13 @@ init_randr15 (GdkX11Screen *x11_screen)
for (i = g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)) - 1; i >= 0; i--)
{
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
notify_surface_monitor_change (x11_display, GDK_MONITOR (monitor));
if (monitor->add)
{
gdk_display_monitor_added (display, GDK_MONITOR (monitor));
}
else if (monitor->remove)
if (monitor->remove)
{
g_object_ref (monitor);
g_list_store_remove (x11_display->monitors, i);
gdk_display_monitor_removed (display, GDK_MONITOR (monitor));
gdk_monitor_invalidate (GDK_MONITOR (monitor));
g_object_unref (monitor);
}
g_object_unref (monitor);
@ -765,16 +762,13 @@ init_randr13 (GdkX11Screen *x11_screen)
for (i = g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)) - 1; i >= 0; i--)
{
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
notify_surface_monitor_change (x11_display, GDK_MONITOR (monitor));
if (monitor->add)
{
gdk_display_monitor_added (display, GDK_MONITOR (monitor));
}
else if (monitor->remove)
if (monitor->remove)
{
g_object_ref (monitor);
g_list_store_remove (x11_display->monitors, i);
gdk_display_monitor_removed (display, GDK_MONITOR (monitor));
gdk_monitor_invalidate (GDK_MONITOR (monitor));
g_object_unref (monitor);
}
}
@ -857,16 +851,13 @@ init_no_multihead (GdkX11Screen *x11_screen)
for (i = g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)) - 1; i >= 0; i--)
{
monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
notify_surface_monitor_change (x11_display, GDK_MONITOR (monitor));
if (monitor->add)
{
gdk_display_monitor_added (GDK_DISPLAY (x11_display), GDK_MONITOR (monitor));
}
else if (monitor->remove)
if (monitor->remove)
{
g_object_ref (monitor);
g_list_store_remove (x11_display->monitors, i);
gdk_display_monitor_removed (GDK_DISPLAY (x11_display), GDK_MONITOR (monitor));
gdk_monitor_invalidate (GDK_MONITOR (monitor));
g_object_unref (monitor);
}
g_object_unref (monitor);