[nautilus/wip/ernestask/gtk4-continued: 24/144] general: Rename GdkWindow to GdkSurface
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/ernestask/gtk4-continued: 24/144] general: Rename GdkWindow to GdkSurface
- Date: Mon, 11 Feb 2019 13:21:27 +0000 (UTC)
commit d0aa8caf0ffaaf5ae450e1897c3d7862ad6b266d
Author: Ernestas Kulik <ernestask gnome org>
Date: Mon Jul 2 10:19:31 2018 +0300
general: Rename GdkWindow to GdkSurface
eel/eel-event.c | 22 ++++++++--------
eel/eel-event.h | 6 ++---
src/animation/ide-box-theatric.c | 10 ++++----
src/nautilus-canvas-container.c | 6 ++---
src/nautilus-dnd.c | 4 +--
src/nautilus-files-view.c | 17 ++++++++-----
src/nautilus-list-view.c | 7 -----
src/nautilus-mime-actions.c | 8 +++---
src/nautilus-pathbar.c | 2 +-
src/nautilus-program-choosing.c | 52 ++++++++++++++++++++++++--------------
src/nautilus-properties-window.c | 2 +-
src/nautilus-tree-view-drag-dest.c | 19 +++++++-------
src/nautilus-window.c | 41 +++++++++++++++---------------
13 files changed, 103 insertions(+), 93 deletions(-)
---
diff --git a/eel/eel-event.c b/eel/eel-event.c
index 13582692d..f0bf17ea3 100644
--- a/eel/eel-event.c
+++ b/eel/eel-event.c
@@ -24,7 +24,7 @@ struct _EelEvent
GdkEventType type;
- GdkWindow *window;
+ GdkSurface *surface;
gdouble x;
gdouble y;
@@ -42,7 +42,7 @@ static void
eel_event_init (EelEvent *self)
{
self->type = GDK_NOTHING;
- self->window = NULL;
+ self->surface = NULL;
self->x = 0.0;
self->y = 0.0;
self->button = 0;
@@ -73,22 +73,22 @@ eel_event_set_event_type (EelEvent *self,
self->type = type;
}
-GdkWindow *
-eel_event_get_window (EelEvent *self)
+GdkSurface *
+eel_event_get_surface (EelEvent *self)
{
g_return_val_if_fail (EEL_IS_EVENT (self), NULL);
- return self->window;
+ return self->surface;
}
void
-eel_event_set_window (EelEvent *self,
- GdkWindow *window)
+eel_event_set_surface (EelEvent *self,
+ GdkSurface *surface)
{
g_return_if_fail (EEL_IS_EVENT (self));
- g_return_if_fail (GDK_IS_WINDOW (window));
+ g_return_if_fail (GDK_IS_SURFACE (surface));
- self->window = window;
+ self->surface = surface;
}
void
@@ -162,7 +162,7 @@ eel_event_copy (EelEvent *self)
event = eel_event_new ();
event->type = self->type;
- event->window = self->window;
+ event->surface = self->surface;
event->x = self->x;
event->y = self->y;
event->button = self->button;
@@ -188,7 +188,7 @@ eel_event_new_from_gdk_event (const GdkEvent *gdk_event)
event = eel_event_new ();
event->type = gdk_event_get_event_type (gdk_event);
- event->window = gdk_event_get_window (gdk_event);
+ event->surface = gdk_event_get_surface (gdk_event);
event->time = gdk_event_get_time (gdk_event);
gdk_event_get_coords (gdk_event, &event->x, &event->y);
diff --git a/eel/eel-event.h b/eel/eel-event.h
index 26dc3c458..2265dc2af 100644
--- a/eel/eel-event.h
+++ b/eel/eel-event.h
@@ -30,9 +30,9 @@ GdkEventType eel_event_get_event_type (EelEvent *event);
void eel_event_set_event_type (EelEvent *event,
GdkEventType type);
-GdkWindow *eel_event_get_window (EelEvent *event);
-void eel_event_set_window (EelEvent *event,
- GdkWindow *window);
+GdkSurface *eel_event_get_surface (EelEvent *event);
+void eel_event_set_surface (EelEvent *event,
+ GdkSurface *surface);
void eel_event_get_coords (EelEvent *event,
gdouble *x,
diff --git a/src/animation/ide-box-theatric.c b/src/animation/ide-box-theatric.c
index cad8d4a44..2db67c6ef 100644
--- a/src/animation/ide-box-theatric.c
+++ b/src/animation/ide-box-theatric.c
@@ -167,7 +167,7 @@ ide_box_theatric_notify (GObject *object,
if (self->target && self->toplevel)
{
- GdkWindow *window;
+ GdkSurface *surface;
GdkRectangle area;
get_toplevel_rect (IDE_BOX_THEATRIC (object), &area);
@@ -177,12 +177,12 @@ ide_box_theatric_notify (GObject *object,
area.x, area.y, area.width, area.height);
#endif
- window = gtk_widget_get_window (self->toplevel);
+ surface = gtk_widget_get_surface (self->toplevel);
- if (window != NULL)
+ if (surface != NULL)
{
- gdk_window_invalidate_rect (window, &self->last_area, TRUE);
- gdk_window_invalidate_rect (window, &area, TRUE);
+ gdk_surface_invalidate_rect (surface, &self->last_area);
+ gdk_surface_invalidate_rect (surface, &area);
}
}
}
diff --git a/src/nautilus-canvas-container.c b/src/nautilus-canvas-container.c
index b842d14df..97402513c 100644
--- a/src/nautilus-canvas-container.c
+++ b/src/nautilus-canvas-container.c
@@ -1627,9 +1627,9 @@ rubberband_timeout_callback (gpointer data)
adj_changed = TRUE;
}
- gdk_window_get_device_position (gtk_widget_get_window (widget),
- band_info->device,
- &x, &y, NULL);
+ gdk_surface_get_device_position (gtk_widget_get_surface (widget),
+ band_info->device,
+ &x, &y, NULL);
if (x < RUBBERBAND_SCROLL_THRESHOLD)
{
diff --git a/src/nautilus-dnd.c b/src/nautilus-dnd.c
index 8071d5b80..ed2d7dfb1 100644
--- a/src/nautilus-dnd.c
+++ b/src/nautilus-dnd.c
@@ -863,8 +863,8 @@ nautilus_drag_autoscroll_calculate_delta (GtkWidget *widget,
display = gtk_widget_get_display (widget);
seat = gdk_display_get_default_seat (display);
pointer = gdk_seat_get_pointer (seat);
- gdk_window_get_device_position (gtk_widget_get_window (widget), pointer,
- &x, &y, NULL);
+ gdk_surface_get_device_position (gtk_widget_get_surface (widget), pointer,
+ &x, &y, NULL);
/* Find out if we are anywhere close to the tree view edges
* to see if we need to autoscroll.
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 591d87b52..afebb7803 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -1234,17 +1234,20 @@ nautilus_files_view_preview_files (NautilusFilesView *view,
{
gchar *uri;
guint xid = 0;
- GtkWidget *toplevel;
- GdkWindow *window;
uri = nautilus_file_get_uri (files->data);
- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));
#ifdef GDK_WINDOWING_X11
- window = gtk_widget_get_window (toplevel);
- if (GDK_IS_X11_WINDOW (window))
{
- xid = gdk_x11_window_get_xid (gtk_widget_get_window (toplevel));
+ GtkWidget *toplevel;
+ GdkSurface *surface;
+
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));
+ surface = gtk_widget_get_surface (toplevel);
+ if (GDK_IS_X11_SURFACE (surface))
+ {
+ xid = gdk_x11_surface_get_xid (surface);
+ }
}
#endif
@@ -8101,7 +8104,7 @@ nautilus_files_view_pop_up_selection_context_menu (NautilusFilesView *view,
g_return_if_fail (rectangle != NULL);
gtk_menu_popup_at_rect (GTK_MENU (gtk_menu),
- gtk_widget_get_window (GTK_WIDGET (view)),
+ gtk_widget_get_surface (GTK_WIDGET (view)),
rectangle,
GDK_GRAVITY_SOUTH_WEST,
GDK_GRAVITY_NORTH_WEST,
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index fcd48f5c0..d53c4fab8 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -561,12 +561,6 @@ on_tree_view_multi_press_gesture_pressed (GtkGestureMultiPress *gesture,
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
- /* Remove after switching to GTK+ 4. */
- if (gdk_event_get_window (event) != gtk_tree_view_get_bin_window (tree_view))
- {
- return;
- }
-
nautilus_list_model_set_drag_view
(NAUTILUS_LIST_MODEL (gtk_tree_view_get_model (tree_view)),
tree_view,
@@ -3517,7 +3511,6 @@ nautilus_list_view_is_zoom_level_default (NautilusFilesView *view)
static void
nautilus_list_view_click_policy_changed (NautilusFilesView *directory_view)
{
- GdkWindow *win;
GdkDisplay *display;
NautilusListView *view;
GtkTreeIter iter;
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
index 5d1d5234e..0ef46444a 100644
--- a/src/nautilus-mime-actions.c
+++ b/src/nautilus-mime-actions.c
@@ -1198,17 +1198,17 @@ static void
search_for_application_mime_type (ActivateParametersInstall *parameters_install,
const gchar *mime_type)
{
- GdkWindow *window;
+ GdkSurface *surface;
guint xid = 0;
const char *mime_types[2];
g_assert (parameters_install->proxy != NULL);
/* get XID from parent window */
- window = gtk_widget_get_window (GTK_WIDGET (parameters_install->parent_window));
- if (window != NULL)
+ surface = gtk_widget_get_surface (GTK_WIDGET (parameters_install->parent_window));
+ if (surface != NULL)
{
- xid = GDK_WINDOW_XID (window);
+ xid = GDK_SURFACE_XID (surface);
}
mime_types[0] = mime_type;
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 3abf165b4..5b580f7c5 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -220,7 +220,7 @@ nautilus_path_bar_init (NautilusPathBar *self)
G_MENU_MODEL
(self->button_menu))));
g_object_unref (builder);
- gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
+ gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (self), FALSE);
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
diff --git a/src/nautilus-program-choosing.c b/src/nautilus-program-choosing.c
index 7ce31ffe4..2b8ed8d9b 100644
--- a/src/nautilus-program-choosing.c
+++ b/src/nautilus-program-choosing.c
@@ -506,14 +506,14 @@ typedef struct
GtkWindow *window;
GtkWindowHandleExported callback;
gpointer user_data;
-} WaylandWindowHandleExportedData;
+} WaylandSurfaceHandleExportedData;
static void
-wayland_window_handle_exported (GdkWindow *window,
- const char *wayland_handle_str,
- gpointer user_data)
+wayland_surface_handle_exported (GdkSurface *surface,
+ const char *wayland_handle_str,
+ gpointer user_data)
{
- WaylandWindowHandleExportedData *data = user_data;
+ WaylandSurfaceHandleExportedData *data = user_data;
char *handle_str;
handle_str = g_strdup_printf ("wayland:%s", wayland_handle_str);
@@ -527,12 +527,19 @@ window_export_handle (GtkWindow *window,
GtkWindowHandleExported callback,
gpointer user_data)
{
+ GtkWidget *widget;
+ GdkDisplay *display;
+ GdkSurface *surface;
+
+ widget = GTK_WIDGET (window);
+ display = gtk_widget_get_display (widget);
+ surface = gtk_widget_get_surface (widget);
+
#ifdef GDK_WINDOWING_X11
- if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
+ if (GDK_IS_X11_DISPLAY (display))
{
- GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
char *handle_str;
- guint32 xid = (guint32) gdk_x11_window_get_xid (gdk_window);
+ guint32 xid = (guint32) gdk_x11_surface_get_xid (surface);
handle_str = g_strdup_printf ("x11:%x", xid);
callback (window, handle_str, user_data);
@@ -541,20 +548,19 @@ window_export_handle (GtkWindow *window,
}
#endif
#ifdef GDK_WINDOWING_WAYLAND
- if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
+ if (GDK_IS_WAYLAND_DISPLAY (display))
{
- GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
- WaylandWindowHandleExportedData *data;
+ WaylandSurfaceHandleExportedData *data;
+
+ data = g_new0 (WaylandSurfaceHandleExportedData, 1);
- data = g_new0 (WaylandWindowHandleExportedData, 1);
data->window = window;
data->callback = callback;
data->user_data = user_data;
- if (!gdk_wayland_window_export_handle (gdk_window,
- wayland_window_handle_exported,
- data,
- g_free))
+ if (!gdk_wayland_surface_export_handle (surface,
+ wayland_surface_handle_exported,
+ data, g_free))
{
g_free (data);
return FALSE;
@@ -575,11 +581,19 @@ static void
gtk_window_unexport_handle (GtkWindow *window)
{
#ifdef GDK_WINDOWING_WAYLAND
- if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
+ GtkWidget *widget;
+ GdkDisplay *display;
+
+ widget = GTK_WIDGET (window);
+ display = gtk_widget_get_display (widget);
+
+ if (GDK_IS_WAYLAND_DISPLAY (display))
{
- GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+ GdkSurface *surface;
+
+ surface = gtk_widget_get_surface (widget);
- gdk_wayland_window_unexport_handle (gdk_window);
+ gdk_wayland_surface_unexport_handle (surface);
}
#endif
}
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 464a131ca..0c569cd0f 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -5054,7 +5054,7 @@ create_properties_window (StartupData *startup_data)
window = NAUTILUS_PROPERTIES_WINDOW (gtk_widget_new (NAUTILUS_TYPE_PROPERTIES_WINDOW,
"use-header-bar", TRUE,
- "type-hint", GDK_WINDOW_TYPE_HINT_DIALOG,
+ "type-hint", GDK_SURFACE_TYPE_HINT_DIALOG,
"modal", TRUE,
NULL));
diff --git a/src/nautilus-tree-view-drag-dest.c b/src/nautilus-tree-view-drag-dest.c
index c32f86568..567e2ffb9 100644
--- a/src/nautilus-tree-view-drag-dest.c
+++ b/src/nautilus-tree-view-drag-dest.c
@@ -100,19 +100,18 @@ gtk_tree_view_vertical_autoscroll (GtkTreeView *tree_view)
GdkDisplay *display;
GdkSeat *seat;
GdkDevice *pointer;
- GdkWindow *window;
+ GdkSurface *surface;
int y;
int offset;
float value;
- window = gtk_tree_view_get_bin_window (tree_view);
+ surface = gtk_widget_get_surface (GTK_WIDGET (tree_view));
vadjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (tree_view));
display = gtk_widget_get_display (GTK_WIDGET (tree_view));
seat = gdk_display_get_default_seat (display);
pointer = gdk_seat_get_pointer (seat);
- gdk_window_get_device_position (window, pointer,
- NULL, &y, NULL);
+ gdk_surface_get_device_position (surface, pointer, NULL, &y, NULL);
y += gtk_adjustment_get_value (vadjustment);
@@ -598,7 +597,7 @@ drag_motion_callback (GtkWidget *widget,
GtkTreePath *path;
GtkTreePath *drop_path, *old_drop_path;
GtkTreeViewDropPosition pos;
- GdkWindow *bin_window;
+ GdkSurface *surface;
guint action;
gboolean res = TRUE;
@@ -626,12 +625,12 @@ drag_motion_callback (GtkWidget *widget,
drop_path = get_drop_path (dest, path);
action = 0;
- bin_window = gtk_tree_view_get_bin_window (GTK_TREE_VIEW (widget));
- if (bin_window != NULL)
+ surface = gtk_widget_get_surface (widget);
+ if (surface != NULL)
{
- int bin_x, bin_y;
- gdk_window_get_position (bin_window, &bin_x, &bin_y);
- if (bin_y <= y)
+ int surface_x, surface_y;
+ gdk_surface_get_position (surface, &surface_x, &surface_y);
+ if (surface_y <= y)
{
/* ignore drags on the header */
action = get_drop_action (dest, context, drop_path);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index c23a3b7a1..22bc5aef3 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1225,11 +1225,13 @@ action_format (GSimpleAction *action,
NautilusWindow *window = NAUTILUS_WINDOW (user_data);
GAppInfo *app_info;
gchar *cmdline, *device_identifier, *xid_string;
+ GdkSurface *surface;
gint xid;
device_identifier = g_volume_get_identifier (window->selected_volume,
G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
- xid = (gint) gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (window)));
+ surface = gtk_widget_get_surface (GTK_WIDGET (window));
+ xid = (gint) gdk_x11_surface_get_xid (surface);
xid_string = g_strdup_printf ("%d", xid);
cmdline = g_strconcat ("gnome-disks ",
@@ -2360,33 +2362,32 @@ nautilus_window_finalize (GObject *object)
static void
nautilus_window_save_geometry (NautilusWindow *window)
{
+ GdkSurface *surface;
+ gint width;
+ gint height;
+ GVariant *initial_size;
gboolean is_maximized;
g_assert (NAUTILUS_IS_WINDOW (window));
- if (gtk_widget_get_window (GTK_WIDGET (window)))
+ surface = gtk_widget_get_surface (GTK_WIDGET (window));
+ if (surface == NULL)
{
- gint width;
- gint height;
- GVariant *initial_size;
-
- gtk_window_get_size (GTK_WINDOW (window), &width, &height);
-
- initial_size = g_variant_new_parsed ("(%i, %i)", width, height);
- is_maximized = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window)))
- & GDK_WINDOW_STATE_MAXIMIZED;
+ return;
+ }
- if (!is_maximized)
- {
- g_settings_set_value (nautilus_window_state,
- NAUTILUS_WINDOW_STATE_INITIAL_SIZE,
- initial_size);
- }
+ gtk_window_get_size (GTK_WINDOW (window), &width, &height);
- g_settings_set_boolean
- (nautilus_window_state, NAUTILUS_WINDOW_STATE_MAXIMIZED,
- is_maximized);
+ initial_size = g_variant_new_parsed ("(%i, %i)", width, height);
+ is_maximized = gtk_window_is_maximized (GTK_WINDOW (window));
+ if (!is_maximized)
+ {
+ g_settings_set_value (nautilus_window_state,
+ NAUTILUS_WINDOW_STATE_INITIAL_SIZE, initial_size);
}
+
+ g_settings_set_boolean (nautilus_window_state,
+ NAUTILUS_WINDOW_STATE_MAXIMIZED, is_maximized);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]