[gtk+] broadway: No more screen
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] broadway: No more screen
- Date: Thu, 2 Nov 2017 00:48:19 +0000 (UTC)
commit bee74e8243a7c1bc959476e235f24abb3841da59
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Nov 1 14:46:26 2017 -0400
broadway: No more screen
This gets rid of the GdkBroadwayScreen object and all
remnants of GdkScreen in the broadway backend.
gdk/broadway/gdkdisplay-broadway.c | 66 ++++++++++--------
gdk/broadway/gdkdisplay-broadway.h | 3 +-
gdk/broadway/gdkdnd-broadway.c | 1 -
gdk/broadway/gdkeventsource.c | 5 +-
gdk/broadway/gdkmonitor-broadway.c | 1 -
gdk/broadway/gdkprivate-broadway.h | 7 +-
gdk/broadway/gdkproperty-broadway.c | 2 +-
gdk/broadway/gdkscreen-broadway.c | 137 -----------------------------------
gdk/broadway/gdkscreen-broadway.h | 63 ----------------
gdk/broadway/gdkwindow-broadway.c | 15 ++--
gdk/broadway/meson.build | 1 -
11 files changed, 50 insertions(+), 251 deletions(-)
---
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index 15302a4..515b524 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -26,8 +26,6 @@
#include "gdkdisplay.h"
#include "gdkeventsource.h"
-#include "gdkscreen.h"
-#include "gdkscreen-broadway.h"
#include "gdkmonitor-broadway.h"
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
@@ -73,6 +71,38 @@ gdk_event_init (GdkDisplay *display)
broadway_display->event_source = _gdk_broadway_event_source_new (display);
}
+void
+_gdk_broadway_display_size_changed (GdkDisplay *display,
+ BroadwayInputScreenResizeNotify *msg)
+{
+ GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display);
+ GdkMonitor *monitor;
+ GdkRectangle size;
+ GList *toplevels, *l;
+
+ monitor = broadway_display->monitor;
+ gdk_monitor_get_geometry (monitor, &size);
+
+ if (msg->width == size.width && msg->height == size.height)
+ return;
+
+ gdk_monitor_set_size (monitor, msg->width, msg->height);
+ gdk_monitor_set_physical_size (monitor, msg->width * 25.4 / 96, msg->height * 25.4 / 96);
+
+ toplevels = gdk_display_get_toplevel_windows (display);
+ for (l = toplevels; l != NULL; l = l->next)
+ {
+ GdkWindow *toplevel = l->data;
+ GdkWindowImplBroadway *toplevel_impl = GDK_WINDOW_IMPL_BROADWAY (toplevel->impl);
+
+ if (toplevel_impl->maximized)
+ gdk_window_move_resize (toplevel, 0, 0, msg->width, msg->height);
+ }
+
+ g_list_free (toplevels);
+}
+
+
GdkDisplay *
_gdk_broadway_display_open (const gchar *display_name)
{
@@ -83,17 +113,7 @@ _gdk_broadway_display_open (const gchar *display_name)
display = g_object_new (GDK_TYPE_BROADWAY_DISPLAY, NULL);
broadway_display = GDK_BROADWAY_DISPLAY (display);
- /* initialize the display's screens */
- broadway_display->screens = g_new (GdkScreen *, 1);
- broadway_display->screens[0] = _gdk_broadway_screen_new (display, 0);
-
- /* We need to initialize events after we have the screen
- * structures in places
- */
- _gdk_broadway_screen_events_init (broadway_display->screens[0]);
-
- /*set the default screen */
- broadway_display->default_screen = broadway_display->screens[0];
+ _gdk_broadway_display_init_root_window (broadway_display);
display->device_manager = _gdk_broadway_device_manager_new (display);
@@ -125,14 +145,6 @@ gdk_broadway_display_get_name (GdkDisplay *display)
return (gchar *) "Broadway";
}
-static GdkScreen *
-gdk_broadway_display_get_default_screen (GdkDisplay *display)
-{
- g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
-
- return GDK_BROADWAY_DISPLAY (display)->default_screen;
-}
-
static void
gdk_broadway_display_beep (GdkDisplay *display)
{
@@ -178,7 +190,8 @@ gdk_broadway_display_dispose (GObject *object)
{
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object);
- _gdk_screen_close (broadway_display->screens[0]);
+ if (broadway_display->root_window)
+ _gdk_window_destroy (broadway_display->root_window, TRUE);
if (broadway_display->event_source)
{
@@ -201,10 +214,7 @@ gdk_broadway_display_finalize (GObject *object)
_gdk_broadway_cursor_display_finalize (GDK_DISPLAY(broadway_display));
- /* Free all GdkScreens */
- g_object_unref (broadway_display->screens[0]);
- g_free (broadway_display->screens);
-
+ g_object_unref (broadway_display->root_window);
g_object_unref (broadway_display->monitor);
G_OBJECT_CLASS (gdk_broadway_display_parent_class)->finalize (object);
@@ -321,7 +331,7 @@ gdk_broadway_display_get_root_window (GdkDisplay *display)
{
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display);
- return GDK_BROADWAY_SCREEN (broadway_display->default_screen)->root_window;
+ return broadway_display->root_window;
}
static void
@@ -336,7 +346,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
display_class->window_type = GDK_TYPE_BROADWAY_WINDOW;
display_class->get_name = gdk_broadway_display_get_name;
- display_class->get_default_screen = gdk_broadway_display_get_default_screen;
display_class->beep = gdk_broadway_display_beep;
display_class->sync = gdk_broadway_display_sync;
display_class->flush = gdk_broadway_display_flush;
@@ -375,4 +384,3 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
display_class->get_setting = gdk_broadway_display_get_setting;
display_class->get_root_window = gdk_broadway_display_get_root_window;
}
-
diff --git a/gdk/broadway/gdkdisplay-broadway.h b/gdk/broadway/gdkdisplay-broadway.h
index d8b094c..8c9dc83 100644
--- a/gdk/broadway/gdkdisplay-broadway.h
+++ b/gdk/broadway/gdkdisplay-broadway.h
@@ -37,8 +37,6 @@ G_BEGIN_DECLS
struct _GdkBroadwayDisplay
{
GdkDisplay parent_instance;
- GdkScreen *default_screen;
- GdkScreen **screens;
GHashTable *id_ht;
GList *toplevels;
@@ -56,6 +54,7 @@ struct _GdkBroadwayDisplay
gpointer move_resize_data;
GdkMonitor *monitor;
+ GdkWindow *root_window;
};
struct _GdkBroadwayDisplayClass
diff --git a/gdk/broadway/gdkdnd-broadway.c b/gdk/broadway/gdkdnd-broadway.c
index 46a82d4..abbd715 100644
--- a/gdk/broadway/gdkdnd-broadway.c
+++ b/gdk/broadway/gdkdnd-broadway.c
@@ -30,7 +30,6 @@
#include "gdkproperty.h"
#include "gdkprivate-broadway.h"
#include "gdkinternals.h"
-#include "gdkscreen-broadway.h"
#include "gdkdisplay-broadway.h"
#include <string.h>
diff --git a/gdk/broadway/gdkeventsource.c b/gdk/broadway/gdkeventsource.c
index e02421a..c230c9a 100644
--- a/gdk/broadway/gdkeventsource.c
+++ b/gdk/broadway/gdkeventsource.c
@@ -95,7 +95,6 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
GdkDisplay *display;
GdkBroadwayDisplay *display_broadway;
GdkBroadwayDeviceManager *device_manager;
- GdkScreen *screen;
GdkWindow *window;
GdkEvent *event = NULL;
GList *node;
@@ -350,13 +349,11 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
break;
case BROADWAY_EVENT_SCREEN_SIZE_CHANGED:
- screen = gdk_display_get_default_screen (display);
window = gdk_display_get_root_window (display);
window->width = message->screen_resize_notify.width;
window->height = message->screen_resize_notify.height;
-
_gdk_window_update_size (window);
- _gdk_broadway_screen_size_changed (screen, &message->screen_resize_notify);
+ _gdk_broadway_display_size_changed (display, &message->screen_resize_notify);
break;
case BROADWAY_EVENT_FOCUS:
diff --git a/gdk/broadway/gdkmonitor-broadway.c b/gdk/broadway/gdkmonitor-broadway.c
index aebc280..08be52a 100644
--- a/gdk/broadway/gdkmonitor-broadway.c
+++ b/gdk/broadway/gdkmonitor-broadway.c
@@ -21,7 +21,6 @@
#include <gio/gio.h>
#include "gdkmonitor-broadway.h"
-#include "gdkscreen-broadway.h"
G_DEFINE_TYPE (GdkBroadwayMonitor, gdk_broadway_monitor, GDK_TYPE_MONITOR)
diff --git a/gdk/broadway/gdkprivate-broadway.h b/gdk/broadway/gdkprivate-broadway.h
index e5e7235..91871f9 100644
--- a/gdk/broadway/gdkprivate-broadway.h
+++ b/gdk/broadway/gdkprivate-broadway.h
@@ -88,13 +88,12 @@ void _gdk_keymap_add_virtual_modifiers_compat (GdkKeymap *keymap,
gboolean _gdk_keymap_key_is_modifier (GdkKeymap *keymap,
guint keycode);
-void _gdk_broadway_screen_events_init (GdkScreen *screen);
-void _gdk_broadway_screen_size_changed (GdkScreen *screen,
- BroadwayInputScreenResizeNotify *msg);
+void _gdk_broadway_display_size_changed (GdkDisplay *display,
+ BroadwayInputScreenResizeNotify *msg);
void _gdk_broadway_events_got_input (BroadwayInputMsg *message);
-void _gdk_broadway_screen_init_root_window (GdkScreen *screen);
+void _gdk_broadway_display_init_root_window (GdkDisplay *display);
void _gdk_broadway_display_init_dnd (GdkDisplay *display);
GdkDisplay * _gdk_broadway_display_open (const gchar *display_name);
void _gdk_broadway_display_queue_events (GdkDisplay *display);
diff --git a/gdk/broadway/gdkproperty-broadway.c b/gdk/broadway/gdkproperty-broadway.c
index 85bb8be..09dae2c 100644
--- a/gdk/broadway/gdkproperty-broadway.c
+++ b/gdk/broadway/gdkproperty-broadway.c
@@ -30,7 +30,7 @@
#include "gdkprivate.h"
#include "gdkinternals.h"
#include "gdkdisplay-broadway.h"
-#include "gdkscreen-broadway.h"
+#include "gdkprivate-broadway.h"
#include "gdkselection.h"
#include <string.h>
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index 01ce2c3..0c73434 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -26,7 +26,6 @@
#include "config.h"
#include "gdkwindow-broadway.h"
-#include "gdkscreen-broadway.h"
#include "gdkbroadwaydisplay.h"
#include "gdkdisplay.h"
@@ -196,19 +195,19 @@ gdk_window_impl_broadway_finalize (GObject *object)
}
void
-_gdk_broadway_screen_init_root_window (GdkScreen * screen)
+_gdk_broadway_display_init_root_window (GdkDisplay *display)
{
GdkWindow *window;
GdkWindowImplBroadway *impl;
- GdkBroadwayScreen *broadway_screen;
+ GdkBroadwayDisplay *broadway_display;
- broadway_screen = GDK_BROADWAY_SCREEN (screen);
+ broadway_display = GDK_BROADWAY_DISPLAY (display);
- g_assert (broadway_screen->root_window == NULL);
+ g_assert (broadway_display->root_window == NULL);
- broadway_screen->root_window = g_object_new (GDK_TYPE_BROADWAY_WINDOW, NULL);
+ broadway_display->root_window = g_object_new (GDK_TYPE_BROADWAY_WINDOW, NULL);
- window = broadway_screen->root_window;
+ window = broadway_display->root_window;
window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_BROADWAY, NULL);
window->impl_window = window;
@@ -227,7 +226,7 @@ _gdk_broadway_screen_init_root_window (GdkScreen * screen)
window->height = 768;
window->viewable = TRUE;
- _gdk_window_update_size (broadway_screen->root_window);
+ _gdk_window_update_size (broadway_display->root_window);
}
static void
diff --git a/gdk/broadway/meson.build b/gdk/broadway/meson.build
index 10bec67..59f486d 100644
--- a/gdk/broadway/meson.build
+++ b/gdk/broadway/meson.build
@@ -14,7 +14,6 @@ gdk_broadway_sources = files([
'gdkkeys-broadway.c',
'gdkmonitor-broadway.c',
'gdkproperty-broadway.c',
- 'gdkscreen-broadway.c',
'gdkselection-broadway.c',
'gdkwindow-broadway.c',
])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]