From d2c26c471c574acc9199d8f032ae2a9d0894481b Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 7 Nov 2016 01:33:43 +0100 Subject: [PATCH] gdk: Remove attributes_mask from gdk_window_new() The only remaining values were always treated as 0, so we just hardcode them to 0. --- gdk/broadway/gdkprivate-broadway.h | 3 +- gdk/broadway/gdkwindow-broadway.c | 3 +- gdk/gdkdisplay.c | 6 ++-- gdk/gdkdisplayprivate.h | 6 ++-- gdk/gdkinternals.h | 9 +----- gdk/gdkwindow.c | 52 +++++++----------------------- gdk/mir/gdkmir-private.h | 2 +- gdk/mir/gdkmirdisplay.c | 5 ++- gdk/mir/gdkmirscreen.c | 2 +- gdk/mir/gdkmirwindowimpl.c | 2 +- gdk/quartz/gdkprivate-quartz.h | 3 +- gdk/quartz/gdkwindow-quartz.c | 7 ++-- gdk/wayland/gdkprivate-wayland.h | 3 +- gdk/wayland/gdkwindow-wayland.c | 6 ++-- gdk/win32/gdkwindow-win32.c | 21 +----------- gdk/x11/gdkprivate-x11.h | 3 +- gdk/x11/gdkwindow-x11.c | 3 +- 17 files changed, 33 insertions(+), 103 deletions(-) diff --git a/gdk/broadway/gdkprivate-broadway.h b/gdk/broadway/gdkprivate-broadway.h index 66e21b83ad..c1af87c2f7 100644 --- a/gdk/broadway/gdkprivate-broadway.h +++ b/gdk/broadway/gdkprivate-broadway.h @@ -123,8 +123,7 @@ void _gdk_broadway_display_create_window_impl (GdkDisplay *display, GdkWindow *real_parent, GdkScreen *screen, GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask); + GdkWindowAttr *attributes); gboolean _gdk_broadway_display_set_selection_owner (GdkDisplay *display, GdkWindow *owner, GdkAtom selection, diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c index c3c9adfa64..e54abd2a36 100644 --- a/gdk/broadway/gdkwindow-broadway.c +++ b/gdk/broadway/gdkwindow-broadway.c @@ -256,8 +256,7 @@ _gdk_broadway_display_create_window_impl (GdkDisplay *display, GdkWindow *real_parent, GdkScreen *screen, GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask) + GdkWindowAttr *attributes) { GdkWindowImplBroadway *impl; GdkBroadwayDisplay *broadway_display; diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index b5ca4b9846..cf61a63367 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -1931,16 +1931,14 @@ _gdk_display_create_window_impl (GdkDisplay *display, GdkWindow *real_parent, GdkScreen *screen, GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask) + GdkWindowAttr *attributes) { GDK_DISPLAY_GET_CLASS (display)->create_window_impl (display, window, real_parent, screen, event_mask, - attributes, - attributes_mask); + attributes); } GdkWindow * diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h index f22572189f..a9fce70e76 100644 --- a/gdk/gdkdisplayprivate.h +++ b/gdk/gdkdisplayprivate.h @@ -195,8 +195,7 @@ struct _GdkDisplayClass GdkWindow *real_parent, GdkScreen *screen, GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask); + GdkWindowAttr *attributes); GdkKeymap * (*get_keymap) (GdkDisplay *display); void (*push_error_trap) (GdkDisplay *display); @@ -324,8 +323,7 @@ void _gdk_display_create_window_impl (GdkDisplay *display GdkWindow *real_parent, GdkScreen *screen, GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask); + GdkWindowAttr *attributes); GdkWindow * _gdk_display_create_window (GdkDisplay *display); gboolean gdk_display_make_gl_context_current (GdkDisplay *display, diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index e29d97454d..9700627ccd 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -87,12 +87,6 @@ typedef enum { GDK_GL_GLES = 1 << 6 } GdkGLFlags; -typedef enum -{ - GDK_WA_X = 1 << 1, - GDK_WA_Y = 1 << 2 -} GdkWindowAttributesType; - extern GList *_gdk_default_filters; extern GdkWindow *_gdk_parent_root; @@ -429,8 +423,7 @@ cairo_surface_t * _gdk_window_ref_cairo_surface (GdkWindow *window); GdkWindow* gdk_window_new (GdkWindow *parent, - GdkWindowAttr *attributes, - gint attributes_mask); + GdkWindowAttr *attributes); void _gdk_window_destroy (GdkWindow *window, gboolean foreign_destroy); void _gdk_window_clear_update_area (GdkWindow *window); diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 0db6270f1f..cdd38895ce 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -1113,30 +1113,13 @@ sync_native_window_stack_position (GdkWindow *window) } } -/** - * gdk_window_new: (constructor) - * @parent: (allow-none): a #GdkWindow, or %NULL to create the window as a child of - * the default root window for the default display. - * @attributes: attributes of the new window - * @attributes_mask: (type GdkWindowAttributesType): mask indicating which - * fields in @attributes are valid - * - * Creates a new #GdkWindow using the attributes from - * @attributes. See #GdkWindowAttr and #GdkWindowAttributesType for - * more details. Note: to use this on displays other than the default - * display, @parent must be specified. - * - * Returns: (transfer full): the new #GdkWindow - **/ GdkWindow* gdk_window_new (GdkWindow *parent, - GdkWindowAttr *attributes, - gint attributes_mask) + GdkWindowAttr *attributes) { GdkWindow *window; GdkScreen *screen; GdkDisplay *display; - int x, y; gboolean native; GdkEventMask event_mask; GdkWindow *real_parent; @@ -1176,18 +1159,8 @@ gdk_window_new (GdkWindow *parent, window->focus_on_map = TRUE; window->event_compression = TRUE; - if (attributes_mask & GDK_WA_X) - x = attributes->x; - else - x = 0; - - if (attributes_mask & GDK_WA_Y) - y = attributes->y; - else - y = 0; - - window->x = x; - window->y = y; + window->x = attributes->x; + window->y = attributes->y; window->width = (attributes->width > 1) ? (attributes->width) : (1); window->height = (attributes->height > 1) ? (attributes->height) : (1); window->alpha = 255; @@ -1260,7 +1233,7 @@ gdk_window_new (GdkWindow *parent, event_mask = get_native_event_mask (window); /* Create the impl */ - _gdk_display_create_window_impl (display, window, real_parent, screen, event_mask, attributes, attributes_mask); + _gdk_display_create_window_impl (display, window, real_parent, screen, event_mask, attributes); window->impl_window = window; parent->impl_window->native_children = g_list_prepend (parent->impl_window->native_children, window); @@ -1321,13 +1294,14 @@ gdk_window_new_toplevel (GdkDisplay *display, attr.event_mask = event_mask; attr.wclass = GDK_INPUT_OUTPUT; + attr.x = 0; + attr.y = 0; attr.width = width; attr.height = height; attr.window_type = GDK_WINDOW_TOPLEVEL; return gdk_window_new (gdk_screen_get_root_window (gdk_display_get_default_screen (display)), - &attr, - 0); + &attr); } /** @@ -1362,8 +1336,7 @@ gdk_window_new_popup (GdkDisplay *display, attr.window_type = GDK_WINDOW_TEMP; return gdk_window_new (gdk_screen_get_root_window (gdk_display_get_default_screen (display)), - &attr, - GDK_WA_X | GDK_WA_Y); + &attr); } /** @@ -1395,8 +1368,7 @@ gdk_window_new_temp (GdkDisplay *display) attr.window_type = GDK_WINDOW_TEMP; return gdk_window_new (gdk_screen_get_root_window (gdk_display_get_default_screen (display)), - &attr, - GDK_WA_X | GDK_WA_Y); + &attr); } /** @@ -1428,7 +1400,7 @@ gdk_window_new_child (GdkWindow *parent, attr.height = position->height; attr.window_type = GDK_WINDOW_CHILD; - return gdk_window_new (parent, &attr, GDK_WA_X | GDK_WA_Y); + return gdk_window_new (parent, &attr); } /** @@ -1460,7 +1432,7 @@ gdk_window_new_input (GdkWindow *parent, attr.height = position->height; attr.window_type = GDK_WINDOW_CHILD; - return gdk_window_new (parent, &attr, GDK_WA_X | GDK_WA_Y); + return gdk_window_new (parent, &attr); } static gboolean @@ -1777,7 +1749,7 @@ gdk_window_ensure_native (GdkWindow *window) window, parent, screen, get_native_event_mask (window), - NULL, 0); + NULL); new_impl = window->impl; parent->impl_window->native_children = diff --git a/gdk/mir/gdkmir-private.h b/gdk/mir/gdkmir-private.h index 38f1d7a29d..69f927fab9 100644 --- a/gdk/mir/gdkmir-private.h +++ b/gdk/mir/gdkmir-private.h @@ -83,7 +83,7 @@ GdkCursor *_gdk_mir_cursor_new_for_name (GdkDisplay *display, const gchar *name) const gchar *_gdk_mir_cursor_get_name (GdkCursor *cursor); -GdkWindowImpl *_gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr *attributes, gint attributes_mask); +GdkWindowImpl *_gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window); void _gdk_mir_window_impl_set_surface_state (GdkMirWindowImpl *impl, MirSurfaceState state); diff --git a/gdk/mir/gdkmirdisplay.c b/gdk/mir/gdkmirdisplay.c index 0a44b7d1e5..c42962e389 100644 --- a/gdk/mir/gdkmirdisplay.c +++ b/gdk/mir/gdkmirdisplay.c @@ -393,8 +393,7 @@ gdk_mir_display_create_window_impl (GdkDisplay *display, GdkWindow *real_parent, GdkScreen *screen, GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask) + GdkWindowAttr *attributes) { //g_printerr ("gdk_mir_display_create_window_impl"); //g_printerr (" window=%p", window); @@ -404,7 +403,7 @@ gdk_mir_display_create_window_impl (GdkDisplay *display, if (attributes->wclass == GDK_INPUT_OUTPUT) { - window->impl = _gdk_mir_window_impl_new (display, window, attributes, attributes_mask); + window->impl = _gdk_mir_window_impl_new (display, window); window->impl_window = window; } else /* attributes->wclass == GDK_INPUT_ONLY */ diff --git a/gdk/mir/gdkmirscreen.c b/gdk/mir/gdkmirscreen.c index f9eea36cf6..668da6073b 100644 --- a/gdk/mir/gdkmirscreen.c +++ b/gdk/mir/gdkmirscreen.c @@ -255,7 +255,7 @@ gdk_mir_screen_get_root_window (GdkScreen *screen) s->root_window->width = width; s->root_window->height = height; s->root_window->viewable = TRUE; - s->root_window->impl = _gdk_mir_window_impl_new (s->display, s->root_window, NULL, 0); + s->root_window->impl = _gdk_mir_window_impl_new (s->display, s->root_window); return s->root_window; } diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c index 3ed04669c7..ec76ac554c 100644 --- a/gdk/mir/gdkmirwindowimpl.c +++ b/gdk/mir/gdkmirwindowimpl.c @@ -166,7 +166,7 @@ get_default_title (void) } GdkWindowImpl * -_gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr *attributes, gint attributes_mask) +_gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window) { GdkMirWindowImpl *impl = g_object_new (GDK_TYPE_MIR_WINDOW_IMPL, NULL); diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h index 05eace5553..7fcb2cbeca 100644 --- a/gdk/quartz/gdkprivate-quartz.h +++ b/gdk/quartz/gdkprivate-quartz.h @@ -124,8 +124,7 @@ void _gdk_quartz_display_create_window_impl (GdkDisplay *display, GdkWindow *real_parent, GdkScreen *screen, GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask); + GdkWindowAttr *attributes); /* Display methods - keymap */ GdkKeymap * _gdk_quartz_display_get_keymap (GdkDisplay *display); diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index 27babc480e..9349537135 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -774,8 +774,7 @@ _gdk_quartz_display_create_window_impl (GdkDisplay *display, GdkWindow *real_parent, GdkScreen *screen, GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask) + GdkWindowAttr *attributes) { GdkWindowImplQuartz *impl; GdkWindowImplQuartz *parent_impl; @@ -834,9 +833,7 @@ _gdk_quartz_display_create_window_impl (GdkDisplay *display, window->width, window->height); - if (window->window_type == GDK_WINDOW_TEMP || - ((attributes_mask & GDK_WA_TYPE_HINT) && - attributes->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN)) + if (window->window_type == GDK_WINDOW_TEMP) { style_mask = NSBorderlessWindowMask; } diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h index a95c925ca1..481bea78cf 100644 --- a/gdk/wayland/gdkprivate-wayland.h +++ b/gdk/wayland/gdkprivate-wayland.h @@ -137,8 +137,7 @@ void _gdk_wayland_display_create_window_impl (GdkDisplay *display, GdkWindow *real_parent, GdkScreen *screen, GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask); + GdkWindowAttr *attributes); GdkWindow *_gdk_wayland_display_get_selection_owner (GdkDisplay *display, GdkAtom selection); diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index d8e1ec5efa..e7fdd479a3 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -657,8 +657,7 @@ _gdk_wayland_display_create_window_impl (GdkDisplay *display, GdkWindow *real_parent, GdkScreen *screen, GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask) + GdkWindowAttr *attributes) { GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); GdkWindowImplWayland *impl; @@ -3703,8 +3702,7 @@ gdk_wayland_window_new_subsurface (GdkDisplay *display, attr.window_type = GDK_WINDOW_SUBSURFACE; return gdk_window_new (gdk_screen_get_root_window (gdk_display_get_default_screen (display)), - &attr, - GDK_WA_X | GDK_WA_Y); + &attr); } /** diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 4b51e91322..cddd9ef1b5 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -690,8 +690,7 @@ _gdk_win32_display_create_window_impl (GdkDisplay *display, GdkWindow *real_parent, GdkScreen *screen, GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask) + GdkWindowAttr *attributes) { HWND hwndNew; HANDLE hparent; @@ -705,8 +704,6 @@ _gdk_win32_display_create_window_impl (GdkDisplay *display, gint window_width, window_height; gint offset_x = 0, offset_y = 0; gint x, y, real_x = 0, real_y = 0; - /* check consistency of redundant information */ - guint remaining_mask = attributes_mask; g_return_if_fail (display == _gdk_display); @@ -719,22 +716,6 @@ _gdk_win32_display_create_window_impl (GdkDisplay *display, (attributes->wclass == GDK_INPUT_OUTPUT ? "" : "input-only")) ); - /* to ensure to not miss important information some additional check against - * attributes which may silently work on X11 */ - if ((attributes_mask & GDK_WA_X) != 0) - { - g_assert (attributes->x == window->x); - remaining_mask &= ~GDK_WA_X; - } - if ((attributes_mask & GDK_WA_Y) != 0) - { - g_assert (attributes->y == window->y); - remaining_mask &= ~GDK_WA_Y; - } - - if (remaining_mask != 0) - g_warning ("_gdk_window_impl_new: uexpected attribute 0x%X", remaining_mask); - hparent = GDK_WINDOW_HWND (real_parent); impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL); diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index c1496e87a0..15e1170c1e 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -272,8 +272,7 @@ void _gdk_x11_display_create_window_impl (GdkDisplay *display, GdkWindow *real_parent, GdkScreen *screen, GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask); + GdkWindowAttr *attributes); void _gdk_x11_precache_atoms (GdkDisplay *display, const gchar * const *atom_names, diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 371ba9e246..b13e246420 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -899,8 +899,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display, GdkWindow *real_parent, GdkScreen *screen, GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask) + GdkWindowAttr *attributes) { GdkWindowImplX11 *impl; GdkX11Screen *x11_screen;