mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
display: Remove x/y/w/h from create_surface()
This commit is contained in:
parent
9364da673f
commit
7ef5f6ef1a
@ -488,7 +488,7 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
|
||||
|
||||
display_class->get_next_serial = gdk_broadway_display_get_next_serial;
|
||||
display_class->notify_startup_complete = gdk_broadway_display_notify_startup_complete;
|
||||
display_class->create_surface = _gdk_broadway_display_create_surface;
|
||||
display_class->create_surface = gdk_broadway_display_create_surface;
|
||||
display_class->get_keymap = _gdk_broadway_display_get_keymap;
|
||||
|
||||
display_class->get_monitors = gdk_broadway_display_get_monitors;
|
||||
|
@ -103,13 +103,9 @@ void _gdk_broadway_display_get_default_cursor_size (GdkDisplay *display,
|
||||
void _gdk_broadway_display_get_maximal_cursor_size (GdkDisplay *display,
|
||||
guint *width,
|
||||
guint *height);
|
||||
GdkSurface * _gdk_broadway_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
GdkSurface * gdk_broadway_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent);
|
||||
GdkKeymap* _gdk_broadway_display_get_keymap (GdkDisplay *display);
|
||||
void _gdk_broadway_display_consume_all_input (GdkDisplay *display);
|
||||
BroadwayInputMsg * _gdk_broadway_display_block_for_input (GdkDisplay *display,
|
||||
|
@ -208,13 +208,9 @@ disconnect_frame_clock (GdkSurface *surface)
|
||||
}
|
||||
|
||||
GdkSurface *
|
||||
_gdk_broadway_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
gdk_broadway_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent)
|
||||
{
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
GdkFrameClock *frame_clock;
|
||||
@ -251,27 +247,22 @@ _gdk_broadway_display_create_surface (GdkDisplay *display,
|
||||
g_object_unref (frame_clock);
|
||||
|
||||
surface->parent = parent;
|
||||
surface->x = x;
|
||||
surface->y = y;
|
||||
surface->width = width;
|
||||
surface->height = height;
|
||||
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (display);
|
||||
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
impl->root_x = x;
|
||||
impl->root_y = y;
|
||||
impl->root_x = 0;
|
||||
impl->root_y = 0;
|
||||
if (parent)
|
||||
{
|
||||
impl->root_x += GDK_BROADWAY_SURFACE (parent)->root_x;
|
||||
impl->root_y += GDK_BROADWAY_SURFACE (parent)->root_y;
|
||||
impl->root_x = GDK_BROADWAY_SURFACE (parent)->root_x;
|
||||
impl->root_y = GDK_BROADWAY_SURFACE (parent)->root_y;
|
||||
}
|
||||
|
||||
impl->id = _gdk_broadway_server_new_surface (broadway_display->server,
|
||||
impl->root_x,
|
||||
impl->root_y,
|
||||
surface->width,
|
||||
surface->height);
|
||||
1, 1);
|
||||
g_hash_table_insert (broadway_display->id_ht, GINT_TO_POINTER(impl->id), surface);
|
||||
|
||||
g_object_ref (surface);
|
||||
@ -1108,11 +1099,11 @@ create_moveresize_surface (MoveResizeData *mv_resize,
|
||||
g_assert (mv_resize->moveresize_emulation_surface == NULL);
|
||||
|
||||
mv_resize->moveresize_emulation_surface =
|
||||
_gdk_broadway_display_create_surface (mv_resize->display,
|
||||
GDK_SURFACE_DRAG,
|
||||
NULL,
|
||||
-100, -100, 1, 1);
|
||||
gdk_broadway_display_create_surface (mv_resize->display,
|
||||
GDK_SURFACE_DRAG,
|
||||
NULL);
|
||||
|
||||
gdk_broadway_surface_move_resize_internal (mv_resize->moveresize_emulation_surface, TRUE, -100, -100, 1, 1);
|
||||
gdk_broadway_surface_show (mv_resize->moveresize_emulation_surface, FALSE);
|
||||
|
||||
seat = gdk_display_get_default_seat (mv_resize->display);
|
||||
|
@ -1199,16 +1199,11 @@ _gdk_display_unpause_events (GdkDisplay *display)
|
||||
GdkSurface *
|
||||
gdk_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
GdkSurface *parent)
|
||||
{
|
||||
return GDK_DISPLAY_GET_CLASS (display)->create_surface (display,
|
||||
surface_type,
|
||||
parent,
|
||||
x, y, width, height);
|
||||
parent);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
|
@ -134,15 +134,11 @@ struct _GdkDisplayClass
|
||||
const char *startup_id);
|
||||
const char * (*get_startup_notification_id) (GdkDisplay *display);
|
||||
|
||||
GdkSurface * (*create_surface) (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
GdkSurface * (*create_surface) (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent);
|
||||
|
||||
GdkKeymap * (*get_keymap) (GdkDisplay *display);
|
||||
GdkKeymap * (*get_keymap) (GdkDisplay *display);
|
||||
|
||||
GdkGLContext * (* init_gl) (GdkDisplay *display,
|
||||
GError **error);
|
||||
@ -209,11 +205,7 @@ void _gdk_display_pause_events (GdkDisplay *display
|
||||
void _gdk_display_unpause_events (GdkDisplay *display);
|
||||
GdkSurface * gdk_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
GdkSurface *parent);
|
||||
|
||||
GdkGLContext * gdk_display_get_gl_context (GdkDisplay *display);
|
||||
|
||||
|
@ -848,16 +848,11 @@ _gdk_surface_update_size (GdkSurface *surface)
|
||||
static GdkSurface *
|
||||
gdk_surface_new (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
GdkSurface *parent)
|
||||
{
|
||||
return gdk_display_create_surface (display,
|
||||
surface_type,
|
||||
parent,
|
||||
x, y, width, height);
|
||||
parent);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -874,7 +869,7 @@ gdk_surface_new_toplevel (GdkDisplay *display)
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
|
||||
return gdk_surface_new (display, GDK_SURFACE_TOPLEVEL,
|
||||
NULL, 0, 0, 1, 1);
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -898,7 +893,7 @@ gdk_surface_new_popup (GdkSurface *parent,
|
||||
g_return_val_if_fail (GDK_IS_SURFACE (parent), NULL);
|
||||
|
||||
surface = gdk_surface_new (parent->display, GDK_SURFACE_POPUP,
|
||||
parent, 0, 0, 100, 100);
|
||||
parent);
|
||||
|
||||
surface->autohide = autohide;
|
||||
|
||||
|
@ -542,11 +542,7 @@ _gdk_macos_display_surface_resigned_main (GdkMacosDisplay *self,
|
||||
static GdkSurface *
|
||||
gdk_macos_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
GdkSurface *parent)
|
||||
{
|
||||
GdkMacosDisplay *self = (GdkMacosDisplay *)display;
|
||||
GdkMacosSurface *surface;
|
||||
@ -554,7 +550,7 @@ gdk_macos_display_create_surface (GdkDisplay *display,
|
||||
g_assert (GDK_IS_MACOS_DISPLAY (self));
|
||||
g_assert (!parent || GDK_IS_MACOS_SURFACE (parent));
|
||||
|
||||
surface = _gdk_macos_surface_new (self, surface_type, parent, x, y, width, height);
|
||||
surface = _gdk_macos_surface_new (self, surface_type, parent, 0, 0, 100, 100);
|
||||
|
||||
if (surface != NULL)
|
||||
_gdk_macos_display_surface_added (self, surface);
|
||||
|
@ -987,7 +987,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
display_class->get_startup_notification_id = gdk_wayland_display_get_startup_notification_id;
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
display_class->notify_startup_complete = gdk_wayland_display_notify_startup_complete;
|
||||
display_class->create_surface = _gdk_wayland_display_create_surface;
|
||||
display_class->create_surface = gdk_wayland_display_create_surface;
|
||||
display_class->get_keymap = _gdk_wayland_display_get_keymap;
|
||||
|
||||
display_class->init_gl = gdk_wayland_display_init_gl;
|
||||
|
@ -382,7 +382,7 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
|
||||
drag = GDK_DRAG (drag_wayland);
|
||||
|
||||
drag_wayland->dnd_surface = _gdk_wayland_display_create_surface (display, GDK_SURFACE_DRAG, NULL, 0, 0, 100, 100);
|
||||
drag_wayland->dnd_surface = gdk_wayland_display_create_surface (display, GDK_SURFACE_DRAG, NULL);
|
||||
drag_wayland->dnd_wl_surface = gdk_wayland_surface_get_wl_surface (drag_wayland->dnd_surface);
|
||||
|
||||
gdk_wayland_drag_create_data_source (drag);
|
||||
|
@ -157,13 +157,9 @@ void gdk_wayland_drop_set_source_actions (GdkDrop
|
||||
void gdk_wayland_drop_set_action (GdkDrop *drop,
|
||||
uint32_t action);
|
||||
|
||||
GdkSurface * _gdk_wayland_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
GdkSurface * gdk_wayland_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent);
|
||||
|
||||
void _gdk_wayland_display_create_seat (GdkWaylandDisplay *display,
|
||||
guint32 id,
|
||||
|
@ -832,13 +832,9 @@ gdk_wayland_surface_destroy_wl_surface (GdkWaylandSurface *self)
|
||||
}
|
||||
|
||||
GdkSurface *
|
||||
_gdk_wayland_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
gdk_wayland_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
GdkSurface *surface;
|
||||
@ -880,22 +876,6 @@ _gdk_wayland_display_create_surface (GdkDisplay *display,
|
||||
break;
|
||||
}
|
||||
|
||||
if (width > 65535)
|
||||
{
|
||||
g_warning ("Native Surfaces wider than 65535 pixels are not supported");
|
||||
width = 65535;
|
||||
}
|
||||
if (height > 65535)
|
||||
{
|
||||
g_warning ("Native Surfaces taller than 65535 pixels are not supported");
|
||||
height = 65535;
|
||||
}
|
||||
|
||||
surface->x = x;
|
||||
surface->y = y;
|
||||
surface->width = width;
|
||||
surface->height = height;
|
||||
|
||||
/* More likely to be right than just assuming 1 */
|
||||
if (wl_compositor_get_version (display_wayland->compositor) >= WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
|
||||
{
|
||||
|
@ -428,10 +428,9 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
||||
#endif
|
||||
/* Create a dummy window to receive wintab events */
|
||||
wintab_window =
|
||||
_gdk_win32_display_create_surface (display,
|
||||
GDK_SURFACE_DRAG,
|
||||
NULL,
|
||||
-100, -100, 2, 2);
|
||||
gdk_win32_display_create_surface (display,
|
||||
GDK_SURFACE_DRAG,
|
||||
NULL);
|
||||
|
||||
g_object_ref (wintab_window);
|
||||
|
||||
|
@ -1281,7 +1281,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
|
||||
|
||||
display_class->get_next_serial = gdk_win32_display_get_next_serial;
|
||||
display_class->notify_startup_complete = gdk_win32_display_notify_startup_complete;
|
||||
display_class->create_surface = _gdk_win32_display_create_surface;
|
||||
display_class->create_surface = gdk_win32_display_create_surface;
|
||||
|
||||
display_class->get_keymap = _gdk_win32_display_get_keymap;
|
||||
|
||||
|
@ -1649,10 +1649,9 @@ create_drag_surface (GdkDisplay *display)
|
||||
{
|
||||
GdkSurface *surface;
|
||||
|
||||
surface = _gdk_win32_display_create_surface (display,
|
||||
GDK_SURFACE_DRAG,
|
||||
NULL,
|
||||
0, 0, 100, 100);
|
||||
surface = gdk_win32_display_create_surface (display,
|
||||
GDK_SURFACE_DRAG,
|
||||
NULL);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
@ -381,13 +381,9 @@ GdkModifierType _gdk_win32_keymap_get_mod_mask (GdkWin32Keymap *keymap);
|
||||
|
||||
GdkKeymap *_gdk_win32_display_get_keymap (GdkDisplay *display);
|
||||
|
||||
GdkSurface *_gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
GdkSurface *gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent);
|
||||
|
||||
/* stray GdkSurfaceImplWin32 members */
|
||||
void _gdk_win32_surface_register_dnd (GdkSurface *window);
|
||||
|
@ -447,25 +447,10 @@ RegisterGdkClass (GdkSurfaceType wtype)
|
||||
return klass;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create native windows.
|
||||
*
|
||||
* With the default Gdk the created windows are mostly toplevel windows.
|
||||
*
|
||||
* Placement of the window is derived from the passed in window,
|
||||
* except for toplevel window where OS/Window Manager placement
|
||||
* is used.
|
||||
*
|
||||
* [1] http://mail.gnome.org/archives/gtk-devel-list/2010-August/msg00214.html
|
||||
*/
|
||||
GdkSurface *
|
||||
_gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
GdkSurfaceType surface_type,
|
||||
GdkSurface *parent)
|
||||
{
|
||||
HWND hwndNew;
|
||||
HANDLE owner;
|
||||
@ -477,9 +462,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
GdkSurface *surface;
|
||||
const char *title;
|
||||
wchar_t *wtitle;
|
||||
int window_width, window_height;
|
||||
int window_x, window_y;
|
||||
int real_x = 0, real_y = 0;
|
||||
GdkFrameClock *frame_clock;
|
||||
|
||||
g_return_val_if_fail (display == _gdk_display, NULL);
|
||||
@ -522,12 +504,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
break;
|
||||
}
|
||||
|
||||
surface = GDK_SURFACE (impl);
|
||||
surface->x = x;
|
||||
surface->y = y;
|
||||
surface->width = width;
|
||||
surface->height = height;
|
||||
|
||||
impl->surface_scale = gdk_win32_display_get_monitor_scale_factor (display_win32, NULL, NULL);
|
||||
|
||||
dwExStyle = 0;
|
||||
@ -557,32 +533,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
rect.left = x * impl->surface_scale;
|
||||
rect.top = y * impl->surface_scale;
|
||||
rect.right = rect.left + width * impl->surface_scale;
|
||||
rect.bottom = rect.top + height * impl->surface_scale;
|
||||
|
||||
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
|
||||
|
||||
real_x = x * impl->surface_scale;
|
||||
real_y = y * impl->surface_scale;
|
||||
|
||||
if (surface_type == GDK_SURFACE_TOPLEVEL)
|
||||
{
|
||||
/* We initially place it at default so that we can get the
|
||||
default window positioning if we want */
|
||||
window_x = window_y = CW_USEDEFAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TEMP: Put these where requested */
|
||||
window_x = real_x;
|
||||
window_y = real_y;
|
||||
}
|
||||
|
||||
window_width = rect.right - rect.left;
|
||||
window_height = rect.bottom - rect.top;
|
||||
|
||||
title = get_default_title ();
|
||||
if (!title || !*title)
|
||||
title = "";
|
||||
@ -595,8 +545,8 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
MAKEINTRESOURCEW (klass),
|
||||
wtitle,
|
||||
dwStyle,
|
||||
window_x, window_y,
|
||||
window_width, window_height,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
owner,
|
||||
NULL,
|
||||
_gdk_dll_hinstance,
|
||||
@ -607,15 +557,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
impl->initial_x = rect.left;
|
||||
impl->initial_y = rect.top;
|
||||
|
||||
/* Now we know the initial position, move to actually specified position */
|
||||
if (real_x != window_x || real_y != window_y)
|
||||
{
|
||||
API_CALL (SetWindowPos, (hwndNew,
|
||||
SWP_NOZORDER_SPECIFIED,
|
||||
real_x, real_y, 0, 0,
|
||||
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
|
||||
}
|
||||
|
||||
g_object_ref (impl);
|
||||
/* Take note: we're inserting a pointer into a heap-allocated
|
||||
* object (impl). Inserting a pointer to a stack variable
|
||||
|
@ -2753,6 +2753,14 @@ 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)
|
||||
{
|
||||
@ -3052,7 +3060,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
display_class->get_startup_notification_id = gdk_x11_display_get_startup_notification_id;
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
display_class->notify_startup_complete = gdk_x11_display_notify_startup_complete;
|
||||
display_class->create_surface = _gdk_x11_display_create_surface;
|
||||
display_class->create_surface = gdk_x11_display_create_surface;
|
||||
display_class->get_keymap = gdk_x11_display_get_keymap;
|
||||
|
||||
display_class->init_gl = gdk_x11_display_init_gl;
|
||||
|
Loading…
Reference in New Issue
Block a user