[gtk/present-toplevel-2: 73/79] surface: Don't implement subtypes in the frontend



commit 0824c8bff7cdacdcb48fefc9c9adcfea003057e0
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 8 09:21:18 2020 -0700

    surface: Don't implement subtypes in the frontend
    
    These are now provided by the backend.

 gdk/gdksurface.c | 211 +------------------------------------------------------
 1 file changed, 1 insertion(+), 210 deletions(-)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index d33d860a9e..4063f93b81 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -112,17 +112,7 @@ static void gdk_surface_set_frame_clock (GdkSurface      *surface,
 static guint signals[LAST_SIGNAL] = { 0 };
 static GParamSpec *properties[LAST_PROP] = { NULL, };
 
-static void gdk_surface_popup_init (GdkPopupInterface *iface);
-static void gdk_surface_toplevel_init (GdkToplevelInterface *iface);
-static void gdk_surface_drag_surface_init (GdkDragSurfaceInterface *iface);
-
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GdkSurface, gdk_surface, G_TYPE_OBJECT,
-                                  G_IMPLEMENT_INTERFACE (GDK_TYPE_POPUP,
-                                                         gdk_surface_popup_init)
-                                  G_IMPLEMENT_INTERFACE (GDK_TYPE_TOPLEVEL,
-                                                         gdk_surface_toplevel_init)
-                                  G_IMPLEMENT_INTERFACE (GDK_TYPE_DRAG_SURFACE,
-                                                         gdk_surface_drag_surface_init))
+G_DEFINE_ABSTRACT_TYPE (GdkSurface, gdk_surface, G_TYPE_OBJECT)
 
 static gboolean
 gdk_surface_real_beep (GdkSurface *surface)
@@ -465,8 +455,6 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, LAST_PROP, properties);
-  gdk_popup_install_properties (object_class, LAST_PROP);
-  gdk_toplevel_install_properties (object_class, LAST_PROP + GDK_POPUP_NUM_PROPERTIES);
 
   /**
    * GdkSurface::popup-layout-changed
@@ -1959,203 +1947,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
   surface->y = 0;
 }
 
-static gboolean
-gdk_popup_surface_present (GdkPopup       *popup,
-                           int             width,
-                           int             height,
-                           GdkPopupLayout *layout)
-{
-  GdkSurface *surface = GDK_SURFACE (popup);
-
-  g_return_val_if_fail (surface->surface_type == GDK_SURFACE_POPUP, FALSE);
-  g_return_val_if_fail (surface->parent, FALSE);
-  g_return_val_if_fail (!GDK_SURFACE_DESTROYED (surface), FALSE);
-
-  return GDK_SURFACE_GET_CLASS (surface)->present_popup (surface, width, height, layout);
-}
-
-static GdkGravity
-gdk_popup_surface_get_surface_anchor (GdkPopup *popup)
-{
-  GdkSurface *surface = GDK_SURFACE (popup);
-
-  g_return_val_if_fail (surface->surface_type == GDK_SURFACE_POPUP, GDK_GRAVITY_STATIC);
-
-  return surface->popup.surface_anchor;
-}
-
-static GdkGravity
-gdk_popup_surface_get_rect_anchor (GdkPopup *popup)
-{
-  GdkSurface *surface = GDK_SURFACE (popup);
-
-  g_return_val_if_fail (surface->surface_type == GDK_SURFACE_POPUP, GDK_GRAVITY_STATIC);
-
-  return surface->popup.rect_anchor;
-}
-
-static int
-gdk_popup_surface_get_position_x (GdkPopup *popup)
-{
-  GdkSurface *surface = GDK_SURFACE (popup);
-
-  g_return_val_if_fail (surface->surface_type == GDK_SURFACE_POPUP, 0);
-
-  return surface->x;
-}
-
-static int
-gdk_popup_surface_get_position_y (GdkPopup *popup)
-{
-  GdkSurface *surface = GDK_SURFACE (popup);
-
-  g_return_val_if_fail (surface->surface_type == GDK_SURFACE_POPUP, 0);
-
-  return surface->y;
-}
-
-static void
-gdk_surface_popup_init (GdkPopupInterface *iface)
-{
-  iface->present = gdk_popup_surface_present;
-  iface->get_surface_anchor = gdk_popup_surface_get_surface_anchor;
-  iface->get_rect_anchor = gdk_popup_surface_get_rect_anchor;
-  iface->get_position_x = gdk_popup_surface_get_position_x;
-  iface->get_position_y = gdk_popup_surface_get_position_y;
-}
-
-static gboolean
-gdk_toplevel_surface_present (GdkToplevel       *toplevel,
-                              int                width,
-                              int                height,
-                              GdkToplevelLayout *layout)
-{
-  GdkSurface *surface = GDK_SURFACE (toplevel);
-  GdkGeometry geometry;
-  GdkSurfaceHints mask;
-
-  g_return_val_if_fail (surface->surface_type == GDK_SURFACE_TOPLEVEL, FALSE);
-  g_return_val_if_fail (!GDK_SURFACE_DESTROYED (surface), FALSE);
-
-  GDK_SURFACE_GET_CLASS (surface)->unminimize (surface);
-
-  if (gdk_toplevel_layout_get_resizable (layout))
-    {
-      geometry.min_width = gdk_toplevel_layout_get_min_width (layout);
-      geometry.min_height = gdk_toplevel_layout_get_min_height (layout);
-      mask = GDK_HINT_MIN_SIZE;
-    }
-  else
-    {
-      geometry.max_width = geometry.min_width = width;
-      geometry.max_height = geometry.min_height = height;
-      mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
-    }
-
-  GDK_SURFACE_GET_CLASS (surface)->set_geometry_hints (surface, &geometry, mask);
-  gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
-  GDK_SURFACE_GET_CLASS (surface)->toplevel_resize (surface, width, height);
-
-  if (gdk_toplevel_layout_get_maximized (layout))
-    GDK_SURFACE_GET_CLASS (surface)->maximize (surface);
-  else
-    GDK_SURFACE_GET_CLASS (surface)->unmaximize (surface);
-
-  if (gdk_toplevel_layout_get_fullscreen (layout))
-    {
-      GdkMonitor *monitor = gdk_toplevel_layout_get_fullscreen_monitor (layout);
-      if (monitor)
-        GDK_SURFACE_GET_CLASS (surface)->fullscreen_on_monitor (surface, monitor);
-      else
-        GDK_SURFACE_GET_CLASS (surface)->fullscreen (surface);
-    }
-  else
-    GDK_SURFACE_GET_CLASS (surface)->unfullscreen (surface);
-
-  GDK_SURFACE_GET_CLASS (surface)->set_modal_hint (surface, gdk_toplevel_layout_get_modal (layout));
-
-  gdk_surface_show_internal (surface, TRUE);
-
-  return TRUE;
-}
-
-static gboolean
-gdk_toplevel_surface_minimize (GdkToplevel *toplevel)
-{
-  GdkSurface *surface = GDK_SURFACE (toplevel);
-
-  g_return_val_if_fail (surface->surface_type == GDK_SURFACE_TOPLEVEL, FALSE);
-  
-  GDK_SURFACE_GET_CLASS (surface)->minimize (surface);
-
-  return TRUE;
-}
-
-static gboolean
-gdk_toplevel_surface_lower (GdkToplevel *toplevel)
-{
-  GdkSurface *surface = GDK_SURFACE (toplevel);
-
-  g_return_val_if_fail (surface->surface_type == GDK_SURFACE_TOPLEVEL, FALSE);
-
-  GDK_SURFACE_GET_CLASS (surface)->lower (surface);
-
-  return TRUE;
-}
-
-static void
-gdk_toplevel_surface_focus (GdkToplevel *toplevel,
-                            guint32      timestamp)
-{
-  GdkSurface *surface = GDK_SURFACE (toplevel);
-
-  g_return_if_fail (surface->surface_type == GDK_SURFACE_TOPLEVEL);
-  
-  GDK_SURFACE_GET_CLASS (surface)->focus (surface, timestamp);
-}
-
-static gboolean
-gdk_toplevel_surface_show_window_menu (GdkToplevel *toplevel,
-                                       GdkEvent    *event)
-{
-  GdkSurface *surface = GDK_SURFACE (toplevel);
-
-  g_return_val_if_fail (surface->surface_type == GDK_SURFACE_TOPLEVEL, FALSE);
-
-  return GDK_SURFACE_GET_CLASS (surface)->show_window_menu (surface, event);
-}
-
-static void
-gdk_surface_toplevel_init (GdkToplevelInterface *iface)
-{
-  iface->present = gdk_toplevel_surface_present;
-  iface->minimize = gdk_toplevel_surface_minimize;
-  iface->lower = gdk_toplevel_surface_lower;
-  iface->focus = gdk_toplevel_surface_focus;
-  iface->show_window_menu = gdk_toplevel_surface_show_window_menu;
-}
-
-static gboolean
-gdk_drag_surface_real_present (GdkDragSurface *drag_surface,
-                               int             width,
-                               int             height)
-{
-  GdkSurface *surface = GDK_SURFACE (drag_surface);
-
-  g_return_val_if_fail (surface->surface_type == GDK_SURFACE_TEMP, FALSE);
-
-  GDK_SURFACE_GET_CLASS (surface)->toplevel_resize (surface, width, height);
-  gdk_surface_show_internal (surface, TRUE);
-
-  return TRUE;
-}
-
-static void
-gdk_surface_drag_surface_init (GdkDragSurfaceInterface *iface)
-{
-  iface->present = gdk_drag_surface_real_present;
-}
-
 static void
 gdk_surface_set_cursor_internal (GdkSurface *surface,
                                  GdkDevice *device,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]