Commit 302d2a04 authored by Matthias Clasen's avatar Matthias Clasen

Stop using gtk_widget_get_surface

Replace all uses of gtk_widget_get_surface by
gtk_native_get_surface.
parent 9765aabe
......@@ -477,7 +477,7 @@ surface_state_changed (GtkWidget *widget)
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
GdkSurfaceState new_state;
new_state = gdk_surface_get_state (gtk_widget_get_surface (widget));
new_state = gdk_surface_get_state (gtk_native_get_surface (GTK_NATIVE (widget)));
window->maximized = (new_state & GDK_SURFACE_STATE_MAXIMIZED) != 0;
window->fullscreen = (new_state & GDK_SURFACE_STATE_FULLSCREEN) != 0;
}
......@@ -487,14 +487,14 @@ demo_application_window_realize (GtkWidget *widget)
{
GTK_WIDGET_CLASS (demo_application_window_parent_class)->realize (widget);
g_signal_connect_swapped (gtk_widget_get_surface (widget), "notify::state",
g_signal_connect_swapped (gtk_native_get_surface (GTK_NATIVE (widget)), "notify::state",
G_CALLBACK (surface_state_changed), widget);
}
static void
demo_application_window_unrealize (GtkWidget *widget)
{
g_signal_handlers_disconnect_by_func (gtk_widget_get_surface (widget),
g_signal_handlers_disconnect_by_func (gtk_native_get_surface (GTK_NATIVE (widget)),
surface_state_changed, widget);
GTK_WIDGET_CLASS (demo_application_window_parent_class)->unrealize (widget);
......
......@@ -120,7 +120,7 @@ query_for_toplevel (GdkDisplay *display,
device = gtk_get_current_event_device ();
if (gdk_seat_grab (gdk_device_get_seat (device),
gtk_widget_get_surface (popup),
gtk_native_get_surface (GTK_NATIVE (popup)),
GDK_SEAT_CAPABILITY_ALL_POINTING,
FALSE, cursor, NULL, NULL, NULL) == GDK_GRAB_SUCCESS)
{
......
......@@ -299,7 +299,7 @@ pressed_cb (GtkGesture *gesture,
rect.height = 0;
gtk_menu_popup_at_rect (GTK_MENU (menu),
gtk_widget_get_surface (widget),
gtk_native_get_surface (gtk_widget_get_native (widget)),
&rect,
GDK_GRAVITY_NORTH_WEST,
GDK_GRAVITY_NORTH_WEST,
......
......@@ -547,7 +547,7 @@ node_editor_window_add_renderer (NodeEditorWindow *self,
GdkSurface *surface;
GdkPaintable *paintable;
surface = gtk_widget_get_surface (GTK_WIDGET (self));
surface = gtk_native_get_surface (GTK_NATIVE (self));
g_assert (surface != NULL);
if (renderer != NULL && !gsk_renderer_realize (renderer, surface, NULL))
......
......@@ -64,7 +64,7 @@ get_idle (gpointer data)
GtkApplication *app = gtk_window_get_application (GTK_WINDOW (window));
gtk_widget_set_sensitive (window, TRUE);
gdk_surface_set_cursor (gtk_widget_get_surface (window), NULL);
gdk_surface_set_cursor (gtk_native_get_surface (GTK_NATIVE (window)), NULL);
g_application_unmark_busy (G_APPLICATION (app));
return G_SOURCE_REMOVE;
......@@ -81,7 +81,7 @@ get_busy (GSimpleAction *action,
g_application_mark_busy (G_APPLICATION (app));
cursor = gdk_cursor_new_from_name ("wait", NULL);
gdk_surface_set_cursor (gtk_widget_get_surface (window), cursor);
gdk_surface_set_cursor (gtk_native_get_surface (GTK_NATIVE (window)), cursor);
g_object_unref (cursor);
g_timeout_add (5000, get_idle, window);
......
......@@ -235,7 +235,7 @@ shoot_one (WidgetInfo *info)
gtk_main_quit ();
}
window = gtk_widget_get_surface (info->window);
window = gtk_native_get_surface (GTK_NATIVE (info->window));
id = gdk_x11_surface_get_xid (window);
if (window_is_csd (window))
decor = (info->include_decorations) ? DECOR_NONE : DECOR_WINDOW_FRAME;
......
......@@ -29,9 +29,9 @@ size_allocate_cb (GtkWidget *widget,
surface = NULL;
}
if (gtk_widget_get_surface (widget))
if (gtk_native_get_surface (gtk_widget_get_native (widget)))
{
surface = gdk_surface_create_similar_surface (gtk_widget_get_surface (widget),
surface = gdk_surface_create_similar_surface (gtk_native_get_surface (gtk_widget_get_native (widget)),
CAIRO_CONTENT_COLOR,
gtk_widget_get_width (widget),
gtk_widget_get_height (widget));
......
......@@ -487,7 +487,7 @@ get_origins (GtkWidget *widget,
{
GdkSurface *surface;
surface = gtk_widget_get_surface (widget);
surface = gtk_native_get_surface (gtk_widget_get_native (widget));
gdk_surface_get_origin (surface, x_surface, y_surface);
gdk_surface_get_origin (surface, x_toplevel, y_toplevel);
......
......@@ -1161,17 +1161,9 @@ gtk_tree_view_accessible_grab_cell_focus (GtkCellAccessibleParent *parent,
toplevel = gtk_widget_get_toplevel (widget);
if (gtk_widget_is_toplevel (toplevel))
{
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (toplevel)))
gtk_window_present_with_time (GTK_WINDOW (toplevel),
gdk_x11_get_server_time (gtk_widget_get_surface (widget)));
else
#endif
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_window_present (GTK_WINDOW (toplevel));
G_GNUC_END_IGNORE_DEPRECATIONS
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_window_present (GTK_WINDOW (toplevel));
G_GNUC_END_IGNORE_DEPRECATIONS
}
return TRUE;
......
......@@ -587,14 +587,9 @@ gtk_widget_accessible_grab_focus (AtkComponent *component)
toplevel = gtk_widget_get_toplevel (widget);
if (gtk_widget_is_toplevel (toplevel))
{
#ifdef GDK_WINDOWING_X11
gtk_window_present_with_time (GTK_WINDOW (toplevel),
gdk_x11_get_server_time (gtk_widget_get_surface (widget)));
#else
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_window_present (GTK_WINDOW (toplevel));
G_GNUC_END_IGNORE_DEPRECATIONS
#endif
}
return TRUE;
......
......@@ -27,6 +27,7 @@
#include "gtklabel.h"
#include "gtkwidgetprivate.h"
#include "gtkwindowprivate.h"
#include "gtknative.h"
/* atkcomponent.h */
......@@ -243,7 +244,7 @@ gtk_window_accessible_ref_state_set (AtkObject *accessible)
if (gtk_window_is_active (window))
atk_state_set_add_state (state_set, ATK_STATE_ACTIVE);
gdk_surface = gtk_widget_get_surface (widget);
gdk_surface = gtk_native_get_surface (GTK_NATIVE (window));
if (gdk_surface)
{
state = gdk_surface_get_state (gdk_surface);
......@@ -388,7 +389,7 @@ gtk_window_accessible_get_extents (AtkComponent *component,
return;
}
surface = gtk_widget_get_surface (widget);
surface = gtk_native_get_surface (GTK_NATIVE (widget));
if (surface == NULL)
return;
......@@ -435,7 +436,7 @@ gtk_window_accessible_get_size (AtkComponent *component,
return;
}
surface = gtk_widget_get_surface (widget);
surface = gtk_native_get_surface (GTK_NATIVE (widget));
if (surface == NULL)
return;
......
......@@ -21,6 +21,7 @@
#include "config.h"
#include "gtkapplicationprivate.h"
#include "gtknative.h"
#include <gdk/wayland/gdkwayland.h>
......@@ -44,7 +45,7 @@ gtk_application_impl_wayland_handle_window_realize (GtkApplicationImpl *impl,
GdkSurface *gdk_surface;
gchar *window_path;
gdk_surface = gtk_widget_get_surface (GTK_WIDGET (window));
gdk_surface = gtk_native_get_surface (GTK_NATIVE (window));
if (!GDK_IS_WAYLAND_SURFACE (gdk_surface))
return;
......
......@@ -21,6 +21,7 @@
#include "config.h"
#include "gtkapplicationprivate.h"
#include "gtknative.h"
#include <gdk/x11/gdkx.h>
......@@ -42,7 +43,7 @@ gtk_application_impl_x11_handle_window_realize (GtkApplicationImpl *impl,
GdkSurface *gdk_surface;
gchar *window_path;
gdk_surface = gtk_widget_get_surface (GTK_WIDGET (window));
gdk_surface = gtk_native_get_surface (GTK_NATIVE (window));
if (!GDK_IS_X11_SURFACE (gdk_surface))
return;
......@@ -65,7 +66,7 @@ gtk_application_impl_x11_get_window_system_id (GtkApplicationImplDBus *dbus,
{
GdkSurface *gdk_surface;
gdk_surface = gtk_widget_get_surface (GTK_WIDGET (window));
gdk_surface = gtk_native_get_surface (GTK_NATIVE (window));
if (GDK_IS_X11_SURFACE (gdk_surface))
return g_variant_new_uint32 (GDK_SURFACE_XID (gdk_surface));
......
......@@ -28,6 +28,7 @@
#include "gtktypebuiltins.h"
#include "gtkprivate.h"
#include "gtkeventcontrollerkey.h"
#include "gtknative.h"
/**
......@@ -475,7 +476,7 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
if (!is_editable)
return NULL;
surface = gtk_widget_get_surface (widget);
surface = gtk_native_get_surface (gtk_widget_get_native (widget));
if (event)
seat = gdk_event_get_seat (event);
......
......@@ -38,6 +38,7 @@
#include "gtkwidgetprivate.h"
#include "gtkwindowgroup.h"
#include "gtkwindowprivate.h"
#include "gtknative.h"
#include "gdk/gdkcontentformatsprivate.h"
#include "gdk/gdktextureprivate.h"
......@@ -880,7 +881,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
int y)
{
GtkDragSourceInfo *info;
GtkRoot *root;
GtkNative *native;
GdkDrag *drag;
double px, py;
int dx, dy;
......@@ -889,9 +890,9 @@ gtk_drag_begin_internal (GtkWidget *widget,
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
device = gdk_device_get_associated_device (device);
root = gtk_widget_get_root (widget);
gtk_widget_translate_coordinates (widget, GTK_WIDGET (root), x, y, &x, &y);
gdk_surface_get_device_position (gtk_widget_get_surface (widget),
native = gtk_widget_get_native (widget);
gtk_widget_translate_coordinates (widget, GTK_WIDGET (native), x, y, &x, &y);
gdk_surface_get_device_position (gtk_native_get_surface (native),
device,
&px, &py,
NULL);
......@@ -902,7 +903,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
content->widget = g_object_ref (widget);
content->formats = gdk_content_formats_ref (target_list);
drag = gdk_drag_begin (gtk_widget_get_surface (GTK_WIDGET (root)), device, GDK_CONTENT_PROVIDER (content), actions, dx, dy);
drag = gdk_drag_begin (gtk_native_get_surface (native), device, GDK_CONTENT_PROVIDER (content), actions, dx, dy);
if (drag == NULL)
{
g_object_unref (content);
......
......@@ -29,14 +29,15 @@
#include "gtkdnd.h"
#include "gtkdndprivate.h"
#include "gtkintl.h"
#include "gtknative.h"
static void
gtk_drag_dest_realized (GtkWidget *widget)
{
GtkRoot *root = gtk_widget_get_root (widget);
GtkNative *native = gtk_widget_get_native (widget);
gdk_surface_register_dnd (gtk_widget_get_surface (GTK_WIDGET (root)));
gdk_surface_register_dnd (gtk_native_get_surface (native));
}
static void
......@@ -44,10 +45,10 @@ gtk_drag_dest_hierarchy_changed (GtkWidget *widget,
GParamSpec *pspec,
gpointer data)
{
GtkRoot *root = gtk_widget_get_root (widget);
GtkNative *native = gtk_widget_get_native (widget);
if (root && gtk_widget_get_realized (GTK_WIDGET (root)))
gdk_surface_register_dnd (gtk_widget_get_surface (GTK_WIDGET (root)));
if (native && gtk_widget_get_realized (GTK_WIDGET (native)))
gdk_surface_register_dnd (gtk_native_get_surface (native));
}
static void
......@@ -132,7 +133,7 @@ gtk_drag_dest_set_internal (GtkWidget *widget,
* {
* GdkModifierType mask;
*
* gdk_surface_get_pointer (gtk_widget_get_surface (widget),
* gdk_surface_get_pointer (gtk_native_get_surface (gtk_widget_get_native (widget)),
* NULL, NULL, &mask);
* if (mask & GDK_CONTROL_MASK)
* gdk_drag_status (context, GDK_ACTION_COPY, time);
......
......@@ -89,6 +89,7 @@
#include "gtkprivate.h"
#include "gtkwindowprivate.h"
#include "gtkwidgetprivate.h"
#include "gtknative.h"
#include <string.h>
......@@ -1345,7 +1346,7 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
GtkTreeViewColumn *action_column;
gint action_height;
surface = gtk_widget_get_surface (completion->priv->entry);
surface = gtk_native_get_surface (gtk_widget_get_native (completion->priv->entry));
if (!surface)
return;
......
......@@ -529,7 +529,7 @@ gtk_file_chooser_native_quartz_show (GtkFileChooserNative *self)
if (transient_for)
{
gtk_widget_realize (GTK_WIDGET (transient_for));
data->parent = gdk_quartz_surface_get_nswindow (gtk_widget_get_surface (GTK_WIDGET (transient_for)));
data->parent = gdk_quartz_surface_get_nswindow (gtk_native_get_surface (GTK_NATIVE (transient_for)));
if (gtk_native_dialog_get_modal (GTK_NATIVE_DIALOG (self)))
data->modal = TRUE;
......
......@@ -46,6 +46,7 @@
#include "gtklabel.h"
#include "gtkfilechooserentry.h"
#include "gtkfilefilterprivate.h"
#include "gtknative.h"
#include "win32/gdkwin32.h"
#include <shlobj.h>
......@@ -790,7 +791,7 @@ gtk_file_chooser_native_win32_show (GtkFileChooserNative *self)
if (transient_for)
{
gtk_widget_realize (GTK_WIDGET (transient_for));
data->parent = gdk_win32_surface_get_handle (gtk_widget_get_surface (GTK_WIDGET (transient_for)));
data->parent = gdk_win32_surface_get_handle (gtk_native_get_surface (GTK_NATIVE (transient_for)));
if (gtk_native_dialog_get_modal (GTK_NATIVE_DIALOG (self)))
data->modal = TRUE;
......
......@@ -123,6 +123,7 @@
#include "gtkprivate.h"
#include "gtkmain.h"
#include "gtkintl.h"
#include "gtknative.h"
typedef struct _GtkGesturePrivate GtkGesturePrivate;
typedef struct _PointData PointData;
......@@ -605,7 +606,7 @@ gesture_within_surface (GtkGesture *gesture,
GtkWidget *widget;
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
return surface == gtk_widget_get_surface (widget);
return surface == gtk_native_get_surface (gtk_widget_get_native (widget));
}
static gboolean
......
......@@ -28,6 +28,7 @@
#include "gtkprivate.h"
#include "gtkrender.h"
#include "gtksnapshot.h"
#include "gtknative.h"
#include <epoxy/gl.h>
......@@ -312,7 +313,7 @@ gtk_gl_area_real_create_context (GtkGLArea *area)
GError *error = NULL;
GdkGLContext *context;
context = gdk_surface_create_gl_context (gtk_widget_get_surface (widget), &error);
context = gdk_surface_create_gl_context (gtk_native_get_surface (gtk_widget_get_native (widget)), &error);
if (error != NULL)
{
gtk_gl_area_set_error (area, error);
......
......@@ -36,6 +36,7 @@
#include "gtktypebuiltins.h"
#include "gtkwidgetprivate.h"
#include "gtkwindowprivate.h"
#include "gtknative.h"
#include "a11y/gtkcontaineraccessible.h"
......@@ -1694,7 +1695,7 @@ gtk_header_bar_realize (GtkWidget *widget)
G_CALLBACK (_gtk_header_bar_update_window_buttons), widget);
g_signal_connect_swapped (settings, "notify::gtk-decoration-layout",
G_CALLBACK (_gtk_header_bar_update_window_buttons), widget);
g_signal_connect_swapped (_gtk_widget_get_surface (widget), "notify::state",
g_signal_connect_swapped (gtk_native_get_surface (gtk_widget_get_native (widget)), "notify::state",
G_CALLBACK (surface_state_changed), widget);
_gtk_header_bar_update_window_buttons (GTK_HEADER_BAR (widget));
}
......@@ -1707,7 +1708,7 @@ gtk_header_bar_unrealize (GtkWidget *widget)
settings = gtk_widget_get_settings (widget);
g_signal_handlers_disconnect_by_func (settings, _gtk_header_bar_update_window_buttons, widget);
g_signal_handlers_disconnect_by_func (_gtk_widget_get_surface (widget), surface_state_changed, widget);
g_signal_handlers_disconnect_by_func (gtk_native_get_surface (gtk_widget_get_native (widget)), surface_state_changed, widget);
GTK_WIDGET_CLASS (gtk_header_bar_parent_class)->unrealize (widget);
}
......@@ -1719,7 +1720,7 @@ surface_state_changed (GtkWidget *widget)
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
GdkSurfaceState changed, new_state;
new_state = gdk_surface_get_state (_gtk_widget_get_surface (widget));
new_state = gdk_surface_get_state (gtk_native_get_surface (gtk_widget_get_native (widget)));
changed = new_state ^ priv->state;
priv->state = new_state;
......
......@@ -251,13 +251,11 @@ gtk_im_context_ime_set_client_widget (GtkIMContext *context,
GtkWidget *widget)
{
GtkIMContextIME *context_ime;
GtkWidget *toplevel;
GdkSurface *client_surface;
g_return_if_fail (GTK_IS_IM_CONTEXT_IME (context));
context_ime = GTK_IM_CONTEXT_IME (context);
toplevel = gtk_widget_get_toplevel (widget);
client_surface = gtk_widget_get_surface (toplevel);
client_surface = gtk_native_get_surface (gtk_widget_get_native (widget));
if (client_surface)
{
......
......@@ -576,7 +576,7 @@ gtk_im_context_xim_set_client_widget (GtkIMContext *context,
GdkSurface *surface = NULL;
if (widget != NULL)
surface = gtk_widget_get_surface (gtk_widget_get_toplevel (widget));
surface = gtk_native_get_surface (gtk_widget_get_native (widget));
set_ic_client_surface (context_xim, surface);
}
......
......@@ -1471,7 +1471,12 @@ synth_crossing (GtkWidget *widget,
gdouble x, y;
event = gdk_event_new (enter ? GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY);
if (related_target)
event->crossing.child_surface = g_object_ref (gtk_widget_get_surface (related_target));
{
GdkSurface *surface;
surface = gtk_native_get_surface (gtk_widget_get_native (related_target));
event->crossing.child_surface = g_object_ref (surface);
}
gdk_event_get_coords (source, &x, &y);
event->crossing.x = x;
event->crossing.y = y;
......@@ -1486,7 +1491,7 @@ synth_crossing (GtkWidget *widget,
gdk_event_set_device (event, gdk_event_get_device (source));
gdk_event_set_source_device (event, gdk_event_get_source_device (source));
event->any.surface = gtk_widget_get_surface (toplevel);
event->any.surface = gtk_native_get_surface (gtk_widget_get_native (toplevel));
if (event->any.surface)
g_object_ref (event->any.surface);
......
......@@ -116,6 +116,7 @@
#include "gtkwindowgroup.h"
#include "gtkwindowprivate.h"
#include "gtkeventcontrollerkey.h"
#include "gtknative.h"
#include "a11y/gtkmenuaccessible.h"
......@@ -1283,7 +1284,7 @@ associate_menu_grab_transfer_surface (GtkMenu *menu)
GdkSurface *toplevel_surface;
GdkSurface *transfer_surface;
toplevel_surface = gtk_widget_get_surface (priv->toplevel);
toplevel_surface = gtk_native_get_surface (GTK_NATIVE (priv->toplevel));
transfer_surface = g_object_get_data (G_OBJECT (menu), "gtk-menu-transfer-surface");
if (toplevel_surface == NULL || transfer_surface == NULL)
......@@ -1388,7 +1389,7 @@ gtk_menu_popup_internal (GtkMenu *menu,
if (xgrab_shell && xgrab_shell != widget)
{
if (popup_grab_on_surface (gtk_widget_get_surface (xgrab_shell), pointer))
if (popup_grab_on_surface (gtk_native_get_surface (gtk_widget_get_native (xgrab_shell)), pointer))
{
_gtk_menu_shell_set_grab_device (GTK_MENU_SHELL (xgrab_shell), pointer);
GTK_MENU_SHELL (xgrab_shell)->priv->have_xgrab = TRUE;
......@@ -1483,7 +1484,7 @@ gtk_menu_popup_internal (GtkMenu *menu,
gtk_widget_show (priv->toplevel);
if (xgrab_shell == widget)
popup_grab_on_surface (gtk_widget_get_surface (widget), pointer); /* Should always succeed */
popup_grab_on_surface (gtk_native_get_surface (gtk_widget_get_native (widget)), pointer); /* Should always succeed */
gtk_grab_add (GTK_WIDGET (menu));
......@@ -2221,7 +2222,7 @@ menu_grab_transfer_surface_destroy (GtkMenu *menu)
gdk_surface_destroy (surface);
g_object_set_data (G_OBJECT (menu), I_("gtk-menu-transfer-surface"), NULL);
widget_surface = gtk_widget_get_surface (GTK_WIDGET (menu));
widget_surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (menu)));
g_object_set_data (G_OBJECT (widget_surface), I_("gdk-attached-grab-surface"), surface);
}
}
......@@ -2600,7 +2601,7 @@ pointer_in_menu_surface (GtkWidget *widget,
GtkMenuShell *menu_shell;
gint surface_x, surface_y;
gdk_surface_get_position (gtk_widget_get_surface (priv->toplevel),
gdk_surface_get_position (gtk_native_get_surface (GTK_NATIVE (priv->toplevel)),
&surface_x, &surface_y);
gtk_widget_get_allocation (widget, &allocation);
......@@ -2825,7 +2826,7 @@ gtk_menu_scroll_by (GtkMenu *menu,
if ((priv->scroll_offset >= 0) && (offset < 0))
offset = 0;
view_height = gdk_surface_get_height (gtk_widget_get_surface (widget));
view_height = gdk_surface_get_height (gtk_native_get_surface (gtk_widget_get_native (widget)));
if (priv->scroll_offset == 0 &&
view_height >= priv->requested_height)
......@@ -2891,7 +2892,7 @@ get_arrows_sensitive_area (GtkMenu *menu,
&bottom_arrow_height, NULL,
NULL, NULL);
surface = gtk_widget_get_surface (widget);
surface = gtk_native_get_surface (gtk_widget_get_native (widget));
width = gdk_surface_get_width (surface);
height = gdk_surface_get_height (surface);
......@@ -2929,7 +2930,7 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
menu_shell = GTK_MENU_SHELL (menu);
gdk_surface_get_position (gtk_widget_get_surface (priv->toplevel),
gdk_surface_get_position (gtk_native_get_surface (GTK_NATIVE (priv->toplevel)),
&top_x, &top_y);
x -= top_x;
y -= top_y;
......@@ -3146,7 +3147,7 @@ pointer_on_menu_widget (GtkMenu *menu,
gint surface_x, surface_y;
gtk_widget_get_allocation (GTK_WIDGET (menu), &allocation);
gdk_surface_get_position (gtk_widget_get_surface (priv->toplevel),
gdk_surface_get_position (gtk_native_get_surface (GTK_NATIVE (priv->toplevel)),
&surface_x, &surface_y);
if (x_root >= surface_x && x_root < surface_x + allocation.width &&
......@@ -3237,7 +3238,7 @@ gtk_menu_captured_event (GtkWidget *widget,
y_diff = y_root - priv->drag_start_y;
offset = priv->initial_drag_offset - y_diff;
view_height = gdk_surface_get_height (gtk_widget_get_surface (widget));
view_height = gdk_surface_get_height (gtk_native_get_surface (gtk_widget_get_native (widget)));
get_arrows_border (menu, &arrow_border);
if (gtk_widget_get_child_visible (priv->top_arrow_widget))
......@@ -3414,7 +3415,7 @@ gtk_menu_position (GtkMenu *menu,
}
else if (priv->widget)
{
rect_surface = gtk_widget_get_surface (priv->widget);
rect_surface = gtk_native_get_surface (gtk_widget_get_native (priv->widget));
gtk_widget_get_surface_allocation (priv->widget, &rect);
text_direction = gtk_widget_get_direction (priv->widget);
}
......@@ -3440,7 +3441,7 @@ gtk_menu_position (GtkMenu *menu,
menu_anchor = get_horizontally_flipped_anchor (menu_anchor);
}
toplevel = gtk_widget_get_surface (priv->toplevel);
toplevel = gtk_native_get_surface (GTK_NATIVE (priv->toplevel));
gdk_surface_set_transient_for (toplevel, rect_surface);
......@@ -3565,7 +3566,7 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
if (compute_child_offset (menu, menu_item, &child_offset, &child_height))
{
y = priv->scroll_offset;
height = gdk_surface_get_height (gtk_widget_get_surface (widget));
height = gdk_surface_get_height (gtk_native_get_surface (gtk_widget_get_native (widget)));
if (child_offset < y)
{
......
......@@ -46,6 +46,7 @@
#include "gtkstylecontextprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkiconprivate.h"
#include "gtknative.h"
#define MENU_POPUP_DELAY 225
......@@ -1398,7 +1399,7 @@ gtk_menu_item_real_popup_submenu (GtkWidget *widget,
/* Position the submenu at the menu item if it is mapped.
* Otherwise, position the submenu at the pointer device.
*/
if (gtk_widget_get_surface (widget))
if (gtk_native_get_surface (gtk_widget_get_native (widget)))
{
switch (priv->submenu_placement)
{
......
......@@ -17,7 +17,10 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkmnemonichash.h"
#include "gtknative.h"
struct _GtkMnemnonicHash
{
......@@ -124,7 +127,7 @@ _gtk_mnemonic_hash_activate (GtkMnemonicHash *mnemonic_hash,
for (list = targets; list; list = list->next)
{
widget = GTK_WIDGET (list->data);
surface = gtk_widget_get_surface (widget);
surface = gtk_native_get_surface (gtk_widget_get_native (widget));
if (gtk_widget_is_sensitive (widget) &&
gtk_widget_get_mapped (widget) &&
......
......@@ -4205,7 +4205,7 @@ gtk_notebook_remove_tab_label (GtkNotebook *notebook,
page->mnemonic_activate_signal);
page->mnemonic_activate_signal = 0;
if (gtk_widget_get_surface (page->tab_label) != gtk_widget_get_surface (GTK_WIDGET (notebook)) ||
if (gtk_widget_get_native (page->tab_label) != gtk_widget_get_native (GTK_WIDGET (notebook)) ||
!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page))
{
GtkWidget *parent;
......
......@@ -347,7 +347,7 @@ surface_state_changed (GtkWidget *widget)
GdkSurfaceState new_surface_state;
GdkSurfaceState changed_mask;
new_surface_state = gdk_surface_get_state (_gtk_widget_get_surface (widget));
new_surface_state = gdk_surface_get_state (priv->surface);
changed_mask = new_surface_state ^ priv->state;
priv->state = new_surface_state;
......@@ -548,12 +548,14 @@ gtk_popover_realize (GtkWidget *widget)
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
GdkRectangle parent_rect;
GdkDisplay *display;
GdkSurface *parent;
gtk_widget_get_surface_allocation (priv->relative_to, &parent_rect);
display = gtk_widget_get_display (priv->relative_to);
priv->surface = gdk_surface_new_popup (display, gtk_widget_get_surface (priv->relative_to), priv->autohide);
parent = gtk_native_get_surface (gtk_widget_get_native (priv->relative_to));
priv->surface = gdk_surface_new_popup (display, parent, priv->autohide);
gdk_surface_set_widget (priv->surface, widget);
......@@ -960,23 +962,22 @@ gtk_popover_fill_border_path (GtkPopover *popover,
static void
gtk_popover_update_shape (GtkPopover *popover)
{
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
GtkWidget *widget = GTK_WIDGET (popover);
cairo_surface_t *cairo_surface;
cairo_region_t *region;
GdkSurface *surface;
cairo_t *cr;
#ifdef GDK_WINDOWING_WAYLAND
#ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
return;
#endif
surface = gtk_widget_get_surface (widget);
cairo_surface =
gdk_surface_create_similar_surface (surface,
gdk_surface_create_similar_surface (priv->surface,
CAIRO_CONTENT_COLOR_ALPHA,
gdk_surface_get_width (surface),
gdk_surface_get_height (surface));
gdk_surface_get_width (priv->surface),
gdk_surface_get_height (priv->surface));
cr = cairo_create (cairo_surface);
gtk_popover_fill_border_path (popover, cr);
......
......@@ -676,8 +676,11 @@ op_win32_free (GtkPrintOperationWin32 *op_win32)
static HWND
get_parent_hwnd (GtkWidget *widget)
{
gtk_widget_realize (widget);
return gdk_win32_surface_get_handle (gtk_widget_get_surface (widget));
GtkNative *native;
native = gtk_widget_get_native (widget);
gtk_widget_realize (GTK_WIDGET (native));
return gdk_win32_surface_get_handle (gtk_native_get_surface (native));
}
static void
......@@ -1362,7 +1365,7 @@ plug_grab_notify (GtkWidget *widget,
gboolean was_grabbed,
GtkPrintOperation *op)
{
EnableWindow (GetAncestor (GDK_SURFACE_HWND (gtk_widget_get_surface (widget)), GA_ROOT),
EnableWindow (GetAncestor (GDK_SURFACE_HWND (gtk_native_get_surface (gtk_widget_get_native (widget))), GA_ROOT),
was_grabbed);
}