x11: Get rid of sizes when constructing surfaces

Just call XCreateWindow with 0, 0, 1, 1 size.
This commit is contained in:
Benjamin Otte 2023-04-17 02:17:03 +02:00
parent 2d827978a6
commit cbe89b955a
4 changed files with 19 additions and 62 deletions

View File

@ -1391,11 +1391,9 @@ gdk_x11_display_init_leader_surface (GdkX11Display *self)
gdk_event_init (display); gdk_event_init (display);
self->leader_gdk_surface = self->leader_gdk_surface = gdk_x11_display_create_surface (display,
_gdk_x11_display_create_surface (display,
GDK_SURFACE_DRAG, GDK_SURFACE_DRAG,
NULL, NULL);
-100, -100, 1, 1);
(_gdk_x11_surface_get_toplevel (self->leader_gdk_surface))->is_leader = TRUE; (_gdk_x11_surface_get_toplevel (self->leader_gdk_surface))->is_leader = TRUE;
self->leader_window = GDK_SURFACE_XID (self->leader_gdk_surface); 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; 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 * static GdkKeymap *
gdk_x11_display_get_keymap (GdkDisplay *display) gdk_x11_display_get_keymap (GdkDisplay *display)
{ {

View File

@ -1260,10 +1260,9 @@ create_drag_surface (GdkDisplay *display)
{ {
GdkSurface *surface; GdkSurface *surface;
surface = _gdk_x11_display_create_surface (display, surface = gdk_x11_display_create_surface (display,
GDK_SURFACE_DRAG, GDK_SURFACE_DRAG,
NULL, NULL);
0, 0, 100, 100);
return surface; return surface;
} }
@ -2001,10 +2000,9 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
display = gdk_surface_get_display (surface); display = gdk_surface_get_display (surface);
ipc_surface = _gdk_x11_display_create_surface (display, ipc_surface = gdk_x11_display_create_surface (display,
GDK_SURFACE_DRAG, GDK_SURFACE_DRAG,
NULL, NULL);
-99, -99, 1, 1);
drag = (GdkDrag *) g_object_new (GDK_TYPE_X11_DRAG, drag = (GdkDrag *) g_object_new (GDK_TYPE_X11_DRAG,
"surface", ipc_surface, "surface", ipc_surface,

View File

@ -173,13 +173,9 @@ void _gdk_x11_display_get_maximal_cursor_size (GdkDisplay *display,
guint *width, guint *width,
guint *height); guint *height);
GdkSurface * _gdk_x11_display_create_surface (GdkDisplay *display, GdkSurface * gdk_x11_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type, GdkSurfaceType surface_type,
GdkSurface *parent, GdkSurface *parent);
int x,
int y,
int width,
int height);
GList * gdk_x11_display_get_toplevel_windows (GdkDisplay *display); GList * gdk_x11_display_get_toplevel_windows (GdkDisplay *display);
void _gdk_x11_precache_atoms (GdkDisplay *display, void _gdk_x11_precache_atoms (GdkDisplay *display,

View File

@ -1197,13 +1197,9 @@ static void gdk_x11_surface_set_type_hint (GdkSurface *surface,
GdkSurfaceTypeHint hint); GdkSurfaceTypeHint hint);
GdkSurface * GdkSurface *
_gdk_x11_display_create_surface (GdkDisplay *display, gdk_x11_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type, GdkSurfaceType surface_type,
GdkSurface *parent, GdkSurface *parent)
int x,
int y,
int width,
int height)
{ {
GdkSurface *surface; GdkSurface *surface;
GdkFrameClock *frame_clock; GdkFrameClock *frame_clock;
@ -1255,11 +1251,6 @@ _gdk_x11_display_create_surface (GdkDisplay *display,
g_object_unref (frame_clock); g_object_unref (frame_clock);
surface->x = x;
surface->y = y;
surface->width = width;
surface->height = height;
impl = GDK_X11_SURFACE (surface); impl = GDK_X11_SURFACE (surface);
impl->surface_scale = x11_screen->surface_scale; impl->surface_scale = x11_screen->surface_scale;
@ -1292,25 +1283,8 @@ _gdk_x11_display_create_surface (GdkDisplay *display,
impl->override_redirect = TRUE; 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, impl->xid = XCreateWindow (xdisplay, xparent,
surface->x * impl->surface_scale, 0, 0, 1, 1,
surface->y * impl->surface_scale,
MAX (1, surface->width * impl->surface_scale),
MAX (1, surface->height * impl->surface_scale),
0, 0,
gdk_x11_display_get_window_depth (display_x11), gdk_x11_display_get_window_depth (display_x11),
InputOutput, InputOutput,
@ -4435,10 +4409,9 @@ create_moveresize_surface (MoveResizeData *mv_resize,
g_assert (mv_resize->moveresize_emulation_surface == NULL); g_assert (mv_resize->moveresize_emulation_surface == NULL);
mv_resize->moveresize_emulation_surface = mv_resize->moveresize_emulation_surface =
_gdk_x11_display_create_surface (mv_resize->display, gdk_x11_display_create_surface (mv_resize->display,
GDK_SURFACE_DRAG, GDK_SURFACE_DRAG,
NULL, NULL);
-100, -100, 1, 1);
gdk_surface_set_is_mapped (mv_resize->moveresize_emulation_surface, TRUE); gdk_surface_set_is_mapped (mv_resize->moveresize_emulation_surface, TRUE);
gdk_x11_surface_show (mv_resize->moveresize_emulation_surface, FALSE); gdk_x11_surface_show (mv_resize->moveresize_emulation_surface, FALSE);