summaryrefslogtreecommitdiff
path: root/gdk/broadway
diff options
context:
space:
mode:
authorBenjamin Otte <otte.benjamin@googlemail.com>2020-05-17 16:57:52 +0000
committerBenjamin Otte <otte.benjamin@googlemail.com>2020-05-17 16:57:52 +0000
commitb353221185c53ea7a96b9e27ba45bfe90e1cdf87 (patch)
tree54c570aec3d89210e59b157efbb9337740aebe06 /gdk/broadway
parent12854f1428dedd56da262c931f92e86b9ae9d00c (diff)
parent363c88cef7239064f90700e39b79a897a8c11c21 (diff)
downloadgtk+-b353221185c53ea7a96b9e27ba45bfe90e1cdf87.tar.gz
Merge branch 'wip/otte/monitors' into 'master'
various GDK cleanups See merge request GNOME/gtk!1920
Diffstat (limited to 'gdk/broadway')
-rw-r--r--gdk/broadway/gdkbroadway-server.c6
-rw-r--r--gdk/broadway/gdkbroadway-server.h1
-rw-r--r--gdk/broadway/gdkbroadwaysurface.h3
-rw-r--r--gdk/broadway/gdkdisplay-broadway.c51
-rw-r--r--gdk/broadway/gdkdisplay-broadway.h1
-rw-r--r--gdk/broadway/gdksurface-broadway.c21
6 files changed, 25 insertions, 58 deletions
diff --git a/gdk/broadway/gdkbroadway-server.c b/gdk/broadway/gdkbroadway-server.c
index 23207916db..6e235e1b52 100644
--- a/gdk/broadway/gdkbroadway-server.c
+++ b/gdk/broadway/gdkbroadway-server.c
@@ -160,12 +160,6 @@ _gdk_broadway_server_new (GdkDisplay *display,
return server;
}
-guint32
-_gdk_broadway_server_get_last_seen_time (GdkBroadwayServer *server)
-{
- return 0;
-}
-
static guint32
gdk_broadway_server_send_message_with_size (GdkBroadwayServer *server, BroadwayRequestBase *base,
gsize size, guint32 type, int fd)
diff --git a/gdk/broadway/gdkbroadway-server.h b/gdk/broadway/gdkbroadway-server.h
index e04d90f9b5..8bdcbb45c1 100644
--- a/gdk/broadway/gdkbroadway-server.h
+++ b/gdk/broadway/gdkbroadway-server.h
@@ -24,7 +24,6 @@ void _gdk_broadway_server_roundtrip (GdkBroadwaySer
gint32 id,
guint32 tag);
gulong _gdk_broadway_server_get_next_serial (GdkBroadwayServer *server);
-guint32 _gdk_broadway_server_get_last_seen_time (GdkBroadwayServer *server);
gboolean _gdk_broadway_server_lookahead_event (GdkBroadwayServer *server,
const char *types);
void _gdk_broadway_server_query_mouse (GdkBroadwayServer *server,
diff --git a/gdk/broadway/gdkbroadwaysurface.h b/gdk/broadway/gdkbroadwaysurface.h
index d05bf2627f..0e937d0a8d 100644
--- a/gdk/broadway/gdkbroadwaysurface.h
+++ b/gdk/broadway/gdkbroadwaysurface.h
@@ -46,9 +46,6 @@ typedef struct _GdkBroadwaySurfaceClass GdkBroadwaySurfaceClass;
GDK_AVAILABLE_IN_ALL
GType gdk_broadway_surface_get_type (void);
-GDK_AVAILABLE_IN_ALL
-guint32 gdk_broadway_get_last_seen_time (GdkSurface *surface);
-
G_END_DECLS
#endif /* __GDK_BROADWAY_SURFACE_H__ */
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index 0241769f00..98007d271d 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -64,7 +64,7 @@ gdk_broadway_display_init (GdkBroadwayDisplay *display)
gdk_monitor_set_manufacturer (display->monitor, "browser");
gdk_monitor_set_model (display->monitor, "0");
display->scale_factor = 1;
- gdk_monitor_set_size (display->monitor, 1024, 768);
+ gdk_monitor_set_geometry (display->monitor, &(GdkRectangle) { 0, 0, 1024, 768 });
gdk_monitor_set_physical_size (display->monitor, 1024 * 25.4 / 96, 768 * 25.4 / 96);
gdk_monitor_set_scale_factor (display->monitor, 1);
}
@@ -97,7 +97,7 @@ _gdk_broadway_display_size_changed (GdkDisplay *display,
broadway_display->scale_factor = msg->scale;
- gdk_monitor_set_size (monitor, msg->width, msg->height);
+ gdk_monitor_set_geometry (monitor, &(GdkRectangle) { 0, 0, msg->width, msg->height });
gdk_monitor_set_scale_factor (monitor, msg->scale);
gdk_monitor_set_physical_size (monitor, msg->width * 25.4 / 96, msg->height * 25.4 / 96);
@@ -274,13 +274,18 @@ gdk_broadway_display_get_default_group (GdkDisplay *display)
static void
gdk_broadway_display_dispose (GObject *object)
{
- GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object);
+ GdkBroadwayDisplay *self = GDK_BROADWAY_DISPLAY (object);
- if (broadway_display->event_source)
+ if (self->event_source)
+ {
+ g_source_destroy (self->event_source);
+ g_source_unref (self->event_source);
+ self->event_source = NULL;
+ }
+ if (self->monitors)
{
- g_source_destroy (broadway_display->event_source);
- g_source_unref (broadway_display->event_source);
- broadway_display->event_source = NULL;
+ g_list_store_remove_all (self->monitors);
+ g_clear_object (&self->monitors);
}
G_OBJECT_CLASS (gdk_broadway_display_parent_class)->dispose (object);
@@ -345,22 +350,18 @@ gdk_broadway_display_hide_keyboard (GdkBroadwayDisplay *display)
_gdk_broadway_server_set_show_keyboard (display->server, FALSE);
}
-static int
-gdk_broadway_display_get_n_monitors (GdkDisplay *display)
+static GListModel *
+gdk_broadway_display_get_monitors (GdkDisplay *display)
{
- return 1;
-}
-
-static GdkMonitor *
-gdk_broadway_display_get_monitor (GdkDisplay *display,
- int monitor_num)
-{
- GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display);
+ GdkBroadwayDisplay *self = GDK_BROADWAY_DISPLAY (display);
- if (monitor_num == 0)
- return broadway_display->monitor;
+ if (self->monitors == NULL)
+ {
+ self->monitors = g_list_store_new (GDK_TYPE_MONITOR);
+ g_list_store_append (self->monitors, self->monitor);
+ }
- return NULL;
+ return G_LIST_MODEL (self->monitors);
}
static gboolean
@@ -371,12 +372,6 @@ gdk_broadway_display_get_setting (GdkDisplay *display,
return FALSE;
}
-static guint32
-gdk_broadway_display_get_last_seen_time (GdkDisplay *display)
-{
- return _gdk_broadway_server_get_last_seen_time (GDK_BROADWAY_DISPLAY (display)->server);
-}
-
typedef struct {
int id;
GdkDisplay *display;
@@ -465,8 +460,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
display_class->create_surface = _gdk_broadway_display_create_surface;
display_class->get_keymap = _gdk_broadway_display_get_keymap;
- display_class->get_n_monitors = gdk_broadway_display_get_n_monitors;
- display_class->get_monitor = gdk_broadway_display_get_monitor;
+ display_class->get_monitors = gdk_broadway_display_get_monitors;
display_class->get_setting = gdk_broadway_display_get_setting;
- display_class->get_last_seen_time = gdk_broadway_display_get_last_seen_time;
}
diff --git a/gdk/broadway/gdkdisplay-broadway.h b/gdk/broadway/gdkdisplay-broadway.h
index e71b6f6201..78dfce9a06 100644
--- a/gdk/broadway/gdkdisplay-broadway.h
+++ b/gdk/broadway/gdkdisplay-broadway.h
@@ -54,6 +54,7 @@ struct _GdkBroadwayDisplay
GdkBroadwayServer *server;
gpointer move_resize_data;
+ GListStore *monitors;
GdkMonitor *monitor;
int scale_factor;
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c
index ac91d2887f..7862e1316f 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -587,7 +587,6 @@ static void
show_popup (GdkSurface *surface)
{
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
- _gdk_surface_update_viewable (surface);
gdk_broadway_surface_show (surface, FALSE);
gdk_surface_invalidate_rect (surface, NULL);
}
@@ -779,7 +778,6 @@ gdk_broadway_surface_maximize (GdkSurface *surface)
{
GdkBroadwaySurface *impl;
GdkDisplay *display;
- GdkMonitor *monitor;
GdkRectangle geom;
if (GDK_SURFACE_DESTROYED (surface))
@@ -800,8 +798,7 @@ gdk_broadway_surface_maximize (GdkSurface *surface)
impl->pre_maximize_height = surface->height;
display = gdk_surface_get_display (surface);
- monitor = gdk_display_get_monitor (display, 0);
- gdk_monitor_get_geometry (monitor, &geom);
+ gdk_monitor_get_geometry (GDK_BROADWAY_DISPLAY (display)->monitor, &geom);
gdk_broadway_surface_move_resize (surface,
geom.x, geom.y,
@@ -1284,15 +1281,6 @@ gdk_broadway_surface_beep (GdkSurface *surface)
return FALSE;
}
-guint32
-gdk_broadway_get_last_seen_time (GdkSurface *surface)
-{
- GdkDisplay *display;
-
- display = gdk_surface_get_display (surface);
- return _gdk_broadway_server_get_last_seen_time (GDK_BROADWAY_DISPLAY (display)->server);
-}
-
static void
gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
{
@@ -1580,15 +1568,10 @@ show_surface (GdkSurface *surface)
if (!was_mapped)
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
- _gdk_surface_update_viewable (surface);
-
gdk_broadway_surface_show (surface, FALSE);
if (!was_mapped)
- {
- if (gdk_surface_is_viewable (surface))
- gdk_surface_invalidate_rect (surface, NULL);
- }
+ gdk_surface_invalidate_rect (surface, NULL);
}
static gboolean