diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-03-23 01:59:47 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-03-26 19:18:40 -0400 |
commit | a21a59c90fc78c7e09f0c51237ccc5482561d823 (patch) | |
tree | e6611ffa1434bc08ac349547af2973916bd825b8 | |
parent | 3180f0d65f64380fbf367a8a8051dbd2e8ccd021 (diff) | |
download | gtk+-a21a59c90fc78c7e09f0c51237ccc5482561d823.tar.gz |
a11y: Stop supporting ATK_XY_SCREEN
We were already not supporting ATK_XY_PARENT, and we can't
support global positions, so just always do ATK_XY_WINDOW.
-rw-r--r-- | gtk/a11y/gtkentryaccessible.c | 35 | ||||
-rw-r--r-- | gtk/a11y/gtklabelaccessible.c | 36 | ||||
-rw-r--r-- | gtk/a11y/gtktextaccessible.c | 35 | ||||
-rw-r--r-- | gtk/a11y/gtktextcellaccessible.c | 1 | ||||
-rw-r--r-- | gtk/a11y/gtktextviewaccessible.c | 46 | ||||
-rw-r--r-- | gtk/a11y/gtktreeviewaccessible.c | 12 | ||||
-rw-r--r-- | gtk/a11y/gtkwidgetaccessible.c | 93 |
7 files changed, 18 insertions, 240 deletions
diff --git a/gtk/a11y/gtkentryaccessible.c b/gtk/a11y/gtkentryaccessible.c index ccdd8cc948..1c3ca4fcd5 100644 --- a/gtk/a11y/gtkentryaccessible.c +++ b/gtk/a11y/gtkentryaccessible.c @@ -974,8 +974,6 @@ gtk_entry_accessible_get_character_extents (AtkText *atk_text, PangoRectangle char_rect; gchar *entry_text; gint index, x_layout, y_layout; - GdkSurface *surface; - gint x_surface, y_surface; GtkAllocation allocation; textw = get_text (atk_text); @@ -993,22 +991,10 @@ gtk_entry_accessible_get_character_extents (AtkText *atk_text, gtk_widget_get_allocation (GTK_WIDGET (textw), &allocation); - surface = gtk_widget_get_surface (GTK_WIDGET (textw)); - gdk_surface_get_origin (surface, &x_surface, &y_surface); - - *x = x_surface + allocation.x + x_layout + char_rect.x; - *y = y_surface + allocation.y + y_layout + char_rect.y; + *x = allocation.x + x_layout + char_rect.x; + *y = allocation.y + y_layout + char_rect.y; *width = char_rect.width; *height = char_rect.height; - - if (coords == ATK_XY_WINDOW) - { - surface = gdk_surface_get_toplevel (surface); - gdk_surface_get_origin (surface, &x_surface, &y_surface); - - *x -= x_surface; - *y -= y_surface; - } } static gint @@ -1020,9 +1006,7 @@ gtk_entry_accessible_get_offset_at_point (AtkText *atk_text, GtkText *textw; gchar *text; gint index, x_layout, y_layout; - gint x_surface, y_surface; gint x_local, y_local; - GdkSurface *surface; glong offset; textw = get_text (atk_text); @@ -1032,20 +1016,9 @@ gtk_entry_accessible_get_offset_at_point (AtkText *atk_text, gtk_text_get_layout_offsets (textw, &x_layout, &y_layout); - surface = gtk_widget_get_surface (GTK_WIDGET (textw)); - gdk_surface_get_origin (surface, &x_surface, &y_surface); + x_local = x - x_layout; + y_local = y - y_layout; - x_local = x - x_layout - x_surface; - y_local = y - y_layout - y_surface; - - if (coords == ATK_XY_WINDOW) - { - surface = gdk_surface_get_toplevel (surface); - gdk_surface_get_origin (surface, &x_surface, &y_surface); - - x_local += x_surface; - y_local += y_surface; - } if (!pango_layout_xy_to_index (gtk_text_get_layout (textw), x_local * PANGO_SCALE, y_local * PANGO_SCALE, diff --git a/gtk/a11y/gtklabelaccessible.c b/gtk/a11y/gtklabelaccessible.c index 7361aa627e..e46f137384 100644 --- a/gtk/a11y/gtklabelaccessible.c +++ b/gtk/a11y/gtklabelaccessible.c @@ -995,8 +995,6 @@ gtk_label_accessible_get_character_extents (AtkText *text, PangoRectangle char_rect; const gchar *label_text; gint index, x_layout, y_layout; - GdkSurface *surface; - gint x_surface, y_surface; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); if (widget == NULL) @@ -1010,22 +1008,10 @@ gtk_label_accessible_get_character_extents (AtkText *text, pango_layout_index_to_pos (gtk_label_get_layout (label), index, &char_rect); pango_extents_to_pixels (&char_rect, NULL); - surface = gtk_widget_get_surface (widget); - gdk_surface_get_origin (surface, &x_surface, &y_surface); - - *x = x_surface + x_layout + char_rect.x; - *y = y_surface + y_layout + char_rect.y; + *x = x_layout + char_rect.x; + *y = y_layout + char_rect.y; *width = char_rect.width; *height = char_rect.height; - - if (coords == ATK_XY_WINDOW) - { - surface = gdk_surface_get_toplevel (surface); - gdk_surface_get_origin (surface, &x_surface, &y_surface); - - *x -= x_surface; - *y -= y_surface; - } } static gint @@ -1038,9 +1024,7 @@ gtk_label_accessible_get_offset_at_point (AtkText *atk_text, GtkLabel *label; const gchar *text; gint index, x_layout, y_layout; - gint x_surface, y_surface; gint x_local, y_local; - GdkSurface *surface; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); if (widget == NULL) @@ -1050,20 +1034,8 @@ gtk_label_accessible_get_offset_at_point (AtkText *atk_text, gtk_label_get_layout_offsets (label, &x_layout, &y_layout); - surface = gtk_widget_get_surface (widget); - gdk_surface_get_origin (surface, &x_surface, &y_surface); - - x_local = x - x_layout - x_surface; - y_local = y - y_layout - y_surface; - - if (coords == ATK_XY_WINDOW) - { - surface = gdk_surface_get_toplevel (surface); - gdk_surface_get_origin (surface, &x_surface, &y_surface); - - x_local += x_surface; - y_local += y_surface; - } + x_local = x - x_layout; + y_local = y - y_layout; if (!pango_layout_xy_to_index (gtk_label_get_layout (label), x_local * PANGO_SCALE, diff --git a/gtk/a11y/gtktextaccessible.c b/gtk/a11y/gtktextaccessible.c index 6a0bd453b1..2f5fb80aab 100644 --- a/gtk/a11y/gtktextaccessible.c +++ b/gtk/a11y/gtktextaccessible.c @@ -414,8 +414,6 @@ gtk_text_accessible_get_character_extents (AtkText *text, PangoRectangle char_rect; gchar *entry_text; gint index, x_layout, y_layout; - GdkSurface *surface; - gint x_surface, y_surface; GtkAllocation allocation; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); @@ -434,22 +432,10 @@ gtk_text_accessible_get_character_extents (AtkText *text, gtk_widget_get_allocation (widget, &allocation); - surface = gtk_widget_get_surface (widget); - gdk_surface_get_origin (surface, &x_surface, &y_surface); - - *x = x_surface + allocation.x + x_layout + char_rect.x; - *y = y_surface + allocation.y + y_layout + char_rect.y; + *x = allocation.x + x_layout + char_rect.x; + *y = allocation.y + y_layout + char_rect.y; *width = char_rect.width; *height = char_rect.height; - - if (coords == ATK_XY_WINDOW) - { - surface = gdk_surface_get_toplevel (surface); - gdk_surface_get_origin (surface, &x_surface, &y_surface); - - *x -= x_surface; - *y -= y_surface; - } } static gint @@ -462,9 +448,7 @@ gtk_text_accessible_get_offset_at_point (AtkText *atk_text, GtkText *entry; gchar *text; gint index, x_layout, y_layout; - gint x_surface, y_surface; gint x_local, y_local; - GdkSurface *surface; glong offset; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); @@ -475,20 +459,9 @@ gtk_text_accessible_get_offset_at_point (AtkText *atk_text, gtk_text_get_layout_offsets (entry, &x_layout, &y_layout); - surface = gtk_widget_get_surface (widget); - gdk_surface_get_origin (surface, &x_surface, &y_surface); + x_local = x - x_layout; + y_local = y - y_layout; - x_local = x - x_layout - x_surface; - y_local = y - y_layout - y_surface; - - if (coords == ATK_XY_WINDOW) - { - surface = gdk_surface_get_toplevel (surface); - gdk_surface_get_origin (surface, &x_surface, &y_surface); - - x_local += x_surface; - y_local += y_surface; - } if (!pango_layout_xy_to_index (gtk_text_get_layout (entry), x_local * PANGO_SCALE, y_local * PANGO_SCALE, diff --git a/gtk/a11y/gtktextcellaccessible.c b/gtk/a11y/gtktextcellaccessible.c index 0fd83f95c7..fe80bc6371 100644 --- a/gtk/a11y/gtktextcellaccessible.c +++ b/gtk/a11y/gtktextcellaccessible.c @@ -488,7 +488,6 @@ get_origins (GtkWidget *widget, surface = gtk_widget_get_surface (widget); gdk_surface_get_origin (surface, x_surface, y_surface); - surface = gdk_surface_get_toplevel (gtk_widget_get_surface (widget)); gdk_surface_get_origin (surface, x_toplevel, y_toplevel); if (GTK_IS_TREE_VIEW (widget)) diff --git a/gtk/a11y/gtktextviewaccessible.c b/gtk/a11y/gtktextviewaccessible.c index b6b5a657f2..7369266050 100644 --- a/gtk/a11y/gtktextviewaccessible.c +++ b/gtk/a11y/gtktextviewaccessible.c @@ -449,35 +449,19 @@ gtk_text_view_accessible_get_offset_at_point (AtkText *text, { GtkTextView *view; GtkTextIter iter; - gint x_widget, y_widget, x_surface, y_surface, buff_x, buff_y; + gint buff_x, buff_y; GtkWidget *widget; - GdkSurface *surface; GdkRectangle rect; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); if (widget == NULL) return -1; - view = GTK_TEXT_VIEW (widget); - surface = gtk_widget_get_surface (widget); - gdk_surface_get_origin (surface, &x_widget, &y_widget); - - if (coords == ATK_XY_SCREEN) - { - x = x - x_widget; - y = y - y_widget; - } - else if (coords == ATK_XY_WINDOW) - { - surface = gdk_surface_get_toplevel (surface); - gdk_surface_get_origin (surface, &x_surface, &y_surface); - - x = x - x_widget + x_surface; - y = y - y_widget + y_surface; - } - else + if (coords != ATK_XY_WINDOW) return -1; + view = GTK_TEXT_VIEW (widget); + gtk_text_view_window_to_buffer_coords (view, GTK_TEXT_WINDOW_WIDGET, x, y, &buff_x, &buff_y); gtk_text_view_get_visible_rect (view, &rect); @@ -511,8 +495,6 @@ gtk_text_view_accessible_get_character_extents (AtkText *text, GtkTextIter iter; GtkWidget *widget; GdkRectangle rectangle; - GdkSurface *surface; - gint x_widget, y_widget, x_surface, y_surface; *x = 0; *y = 0; @@ -528,30 +510,12 @@ gtk_text_view_accessible_get_character_extents (AtkText *text, gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset); gtk_text_view_get_iter_location (view, &iter, &rectangle); - surface = gtk_widget_get_surface (widget); - if (surface == NULL) - return; - - gdk_surface_get_origin (surface, &x_widget, &y_widget); - *height = rectangle.height; *width = rectangle.width; gtk_text_view_buffer_to_surface_coords (view, GTK_TEXT_WINDOW_WIDGET, rectangle.x, rectangle.y, x, y); - if (coords == ATK_XY_WINDOW) - { - surface = gdk_surface_get_toplevel (surface); - gdk_surface_get_origin (surface, &x_surface, &y_surface); - *x += x_widget - x_surface; - *y += y_widget - y_surface; - } - else if (coords == ATK_XY_SCREEN) - { - *x += x_widget; - *y += y_widget; - } - else + if (coords != ATK_XY_WINDOW) { *x = 0; *y = 0; diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c index 79008638e4..ac17d40860 100644 --- a/gtk/a11y/gtktreeviewaccessible.c +++ b/gtk/a11y/gtktreeviewaccessible.c @@ -1094,18 +1094,6 @@ gtk_tree_view_accessible_get_cell_extents (GtkCellAccessibleParent *parent, 0, 0, &w_x, &w_y); - if (coord_type != ATK_XY_WINDOW) - { - GdkSurface *surface; - gint x_toplevel, y_toplevel; - - surface = gdk_surface_get_toplevel (gtk_widget_get_surface (widget)); - gdk_surface_get_origin (surface, &x_toplevel, &y_toplevel); - - w_x += x_toplevel; - w_y += y_toplevel; - } - *width = cell_rect.width; *height = cell_rect.height; if (is_cell_showing (tree_view, &cell_rect)) diff --git a/gtk/a11y/gtkwidgetaccessible.c b/gtk/a11y/gtkwidgetaccessible.c index ebdee94276..05e1376c6e 100644 --- a/gtk/a11y/gtkwidgetaccessible.c +++ b/gtk/a11y/gtkwidgetaccessible.c @@ -533,9 +533,6 @@ gtk_widget_accessible_get_extents (AtkComponent *component, gint *height, AtkCoordType coord_type) { - GdkSurface *surface; - gint x_surface, y_surface; - gint x_toplevel, y_toplevel; GtkWidget *widget; GtkAllocation allocation; @@ -557,25 +554,11 @@ gtk_widget_accessible_get_extents (AtkComponent *component, { *x = allocation.x; *y = allocation.y; - surface = gtk_widget_get_parent_surface (widget); } else { *x = 0; *y = 0; - surface = gtk_widget_get_surface (widget); - } - gdk_surface_get_origin (surface, &x_surface, &y_surface); - *x += x_surface; - *y += y_surface; - - if (coord_type == ATK_XY_WINDOW) - { - surface = gdk_surface_get_toplevel (gtk_widget_get_surface (widget)); - gdk_surface_get_origin (surface, &x_toplevel, &y_toplevel); - - *x -= x_toplevel; - *y -= y_toplevel; } } @@ -625,38 +608,6 @@ gtk_widget_accessible_set_extents (AtkComponent *component, gint height, AtkCoordType coord_type) { - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component)); - if (widget == NULL) - return FALSE; - - if (!gtk_widget_is_toplevel (widget)) - return FALSE; - - if (coord_type == ATK_XY_WINDOW) - { - gint x_current, y_current; - GdkSurface *surface = gtk_widget_get_surface (widget); - - gdk_surface_get_origin (surface, &x_current, &y_current); - x_current += x; - y_current += y; - if (x_current < 0 || y_current < 0) - return FALSE; - else - { - gtk_window_move (GTK_WINDOW (widget), x_current, y_current); - gtk_widget_set_size_request (widget, width, height); - return TRUE; - } - } - else if (coord_type == ATK_XY_SCREEN) - { - gtk_window_move (GTK_WINDOW (widget), x, y); - gtk_widget_set_size_request (widget, width, height); - return TRUE; - } return FALSE; } @@ -666,36 +617,6 @@ gtk_widget_accessible_set_position (AtkComponent *component, gint y, AtkCoordType coord_type) { - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component)); - if (widget == NULL) - return FALSE; - - if (gtk_widget_is_toplevel (widget)) - { - if (coord_type == ATK_XY_WINDOW) - { - gint x_current, y_current; - GdkSurface *surface = gtk_widget_get_surface (widget); - - gdk_surface_get_origin (surface, &x_current, &y_current); - x_current += x; - y_current += y; - if (x_current < 0 || y_current < 0) - return FALSE; - else - { - gtk_window_move (GTK_WINDOW (widget), x_current, y_current); - return TRUE; - } - } - else if (coord_type == ATK_XY_SCREEN) - { - gtk_window_move (GTK_WINDOW (widget), x, y); - return TRUE; - } - } return FALSE; } @@ -704,19 +625,7 @@ gtk_widget_accessible_set_size (AtkComponent *component, gint width, gint height) { - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component)); - if (widget == NULL) - return FALSE; - - if (gtk_widget_is_toplevel (widget)) - { - gtk_widget_set_size_request (widget, width, height); - return TRUE; - } - else - return FALSE; + return FALSE; } static void |