x11: Get rid of sizes when constructing surfaces
authorBenjamin Otte <otte@redhat.com>
Mon, 17 Apr 2023 00:17:03 +0000 (02:17 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 26 Apr 2023 19:03:34 +0000 (21:03 +0200)
Just call XCreateWindow with 0, 0, 1, 1 size.

gdk/x11/gdkdisplay-x11.c
gdk/x11/gdkdrag-x11.c
gdk/x11/gdkprivate-x11.h
gdk/x11/gdksurface-x11.c

index 793a65081c05240f60384a313577fb7f4ec56535..ba03482b8c99f40a4bd7ec1920e80b6ef0689304 100644 (file)
@@ -1391,11 +1391,9 @@ gdk_x11_display_init_leader_surface (GdkX11Display *self)
 
   gdk_event_init (display);
 
-  self->leader_gdk_surface =
-      _gdk_x11_display_create_surface (display,
-                                       GDK_SURFACE_DRAG,
-                                       NULL,
-                                       -100, -100, 1, 1);
+  self->leader_gdk_surface = gdk_x11_display_create_surface (display,
+                                                             GDK_SURFACE_DRAG,
+                                                             NULL);
 
   (_gdk_x11_surface_get_toplevel (self->leader_gdk_surface))->is_leader = TRUE;
   self->leader_window = GDK_SURFACE_XID (self->leader_gdk_surface);
@@ -2753,14 +2751,6 @@ gdk_x11_display_get_screen (GdkDisplay *display)
   return GDK_X11_DISPLAY (display)->screen;
 }
 
-static GdkSurface *
-gdk_x11_display_create_surface (GdkDisplay     *display,
-                                GdkSurfaceType  surface_type,
-                                GdkSurface     *parent)
-{
-  return _gdk_x11_display_create_surface (display, surface_type, parent, 0, 0, 100, 100);
-}
-
 static GdkKeymap *
 gdk_x11_display_get_keymap (GdkDisplay *display)
 {
index ade46a7970292b563ae13a95a01e65d75c8adf54..abd2f138ab2a577354e49b703c03386c0857965b 100644 (file)
@@ -1260,10 +1260,9 @@ create_drag_surface (GdkDisplay *display)
 {
   GdkSurface *surface;
 
-  surface = _gdk_x11_display_create_surface (display,
-                                             GDK_SURFACE_DRAG,
-                                             NULL,
-                                             0, 0, 100, 100);
+  surface = gdk_x11_display_create_surface (display,
+                                            GDK_SURFACE_DRAG,
+                                            NULL);
 
   return surface;
 }
@@ -2001,10 +2000,9 @@ _gdk_x11_surface_drag_begin (GdkSurface         *surface,
 
   display = gdk_surface_get_display (surface);
 
-  ipc_surface = _gdk_x11_display_create_surface (display,
-                                                 GDK_SURFACE_DRAG,
-                                                 NULL,
-                                                 -99, -99, 1, 1);
+  ipc_surface = gdk_x11_display_create_surface (display,
+                                                GDK_SURFACE_DRAG,
+                                                NULL);
 
   drag = (GdkDrag *) g_object_new (GDK_TYPE_X11_DRAG,
                                    "surface", ipc_surface,
index cf095b6cb2b2716ec29b9ece1f52fe875a2d40d9..1bedb10703b3650f5159d13c91d84c8c0fd07701 100644 (file)
@@ -173,13 +173,9 @@ void       _gdk_x11_display_get_maximal_cursor_size (GdkDisplay *display,
                                                      guint      *width,
                                                      guint      *height);
 
-GdkSurface * _gdk_x11_display_create_surface (GdkDisplay     *display,
-                                              GdkSurfaceType  surface_type,
-                                              GdkSurface     *parent,
-                                              int             x,
-                                              int             y,
-                                              int             width,
-                                              int             height);
+GdkSurface * gdk_x11_display_create_surface (GdkDisplay     *display,
+                                             GdkSurfaceType  surface_type,
+                                             GdkSurface     *parent);
 GList *    gdk_x11_display_get_toplevel_windows     (GdkDisplay *display);
 
 void _gdk_x11_precache_atoms (GdkDisplay          *display,
index f0b54d54113726bbc76391d4a106b1a1347d970c..b190b8ff34abe88235080ebfef8873801cde70c3 100644 (file)
@@ -1197,13 +1197,9 @@ static void gdk_x11_surface_set_type_hint (GdkSurface        *surface,
                                            GdkSurfaceTypeHint hint);
 
 GdkSurface *
-_gdk_x11_display_create_surface (GdkDisplay     *display,
-                                 GdkSurfaceType  surface_type,
-                                 GdkSurface     *parent,
-                                 int             x,
-                                 int             y,
-                                 int             width,
-                                 int             height)
+gdk_x11_display_create_surface (GdkDisplay     *display,
+                                GdkSurfaceType  surface_type,
+                                GdkSurface     *parent)
 {
   GdkSurface *surface;
   GdkFrameClock *frame_clock;
@@ -1255,11 +1251,6 @@ _gdk_x11_display_create_surface (GdkDisplay     *display,
 
   g_object_unref (frame_clock);
 
-  surface->x = x;
-  surface->y = y;
-  surface->width = width;
-  surface->height = height;
-
   impl = GDK_X11_SURFACE (surface);
   impl->surface_scale = x11_screen->surface_scale;
 
@@ -1292,25 +1283,8 @@ _gdk_x11_display_create_surface (GdkDisplay     *display,
       impl->override_redirect = TRUE;
     }
 
-  if (surface->width * impl->surface_scale > 32767 ||
-      surface->height * impl->surface_scale > 32767)
-    {
-      g_warning ("Native Windows wider or taller than 32767 pixels are not supported");
-
-      if (surface->width * impl->surface_scale > 32767)
-        surface->width = 32767 / impl->surface_scale;
-      if (surface->height  * impl->surface_scale > 32767)
-        surface->height = 32767 /  impl->surface_scale;
-    }
-
-  impl->unscaled_width = surface->width * impl->surface_scale;
-  impl->unscaled_height = surface->height * impl->surface_scale;
-
   impl->xid = XCreateWindow (xdisplay, xparent,
-                             surface->x * impl->surface_scale,
-                             surface->y * impl->surface_scale,
-                             MAX (1, surface->width * impl->surface_scale),
-                             MAX (1, surface->height * impl->surface_scale),
+                             0, 0, 1, 1,
                              0,
                              gdk_x11_display_get_window_depth (display_x11),
                              InputOutput,
@@ -4435,10 +4409,9 @@ create_moveresize_surface (MoveResizeData *mv_resize,
   g_assert (mv_resize->moveresize_emulation_surface == NULL);
 
   mv_resize->moveresize_emulation_surface =
-      _gdk_x11_display_create_surface (mv_resize->display,
-                                       GDK_SURFACE_DRAG,
-                                       NULL,
-                                       -100, -100, 1, 1);
+      gdk_x11_display_create_surface (mv_resize->display,
+                                      GDK_SURFACE_DRAG,
+                                      NULL);
 
   gdk_surface_set_is_mapped (mv_resize->moveresize_emulation_surface, TRUE);
   gdk_x11_surface_show (mv_resize->moveresize_emulation_surface, FALSE);