talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 72e28208e3e98fe44e795c78e605bc4715a760fe
parent 6f8ce65f565493b38a3d5213f3adf1bc7114240b
Author: paul <paul@claws-mail.org>
Date:   Tue, 10 Dec 2019 11:20:20 +0000

replace deprecated gtk_widget_get_child_requisition(), and remove other unnecessary cruft

Diffstat:
Msrc/gtk/gtkaspell.c | 20+-------------------
Msrc/gtk/spell_entry.c | 6+-----
2 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/src/gtk/gtkaspell.c b/src/gtk/gtkaspell.c @@ -2068,13 +2068,10 @@ static void set_menu_pos(GtkMenu *menu, gint *x, gint *y, { GtkAspell *gtkaspell = (GtkAspell *) data; gint xx = 0, yy = 0; - gint sx, sy; - gint wx, wy; GtkTextView *text = GTK_TEXT_VIEW(gtkaspell->gtktext); GtkTextBuffer *textbuf; GtkTextIter iter; GdkRectangle rect; - GtkRequisition r; textbuf = gtk_text_view_get_buffer(gtkaspell->gtktext); gtk_text_buffer_get_iter_at_mark(textbuf, &iter, @@ -2087,22 +2084,7 @@ static void set_menu_pos(GtkMenu *menu, gint *x, gint *y, gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(gtkaspell->gtktext)), &xx, &yy); - sx = gdk_screen_width(); - sy = gdk_screen_height(); - - gtk_widget_get_child_requisition(GTK_WIDGET(menu), &r); - - wx = r.width; - wy = r.height; - - *x = rect.x + xx + 8; - - *y = rect.y + rect.height + yy; - - if (*x + wx > sx) - *x = sx - wx; - if (*y + wy > sy) - *y = *y - wy - 10; + gtk_widget_get_preferred_size(GTK_WIDGET(menu), NULL, NULL); } /* change the current dictionary of gtkaspell diff --git a/src/gtk/spell_entry.c b/src/gtk/spell_entry.c @@ -566,11 +566,10 @@ static void set_menu_pos(GtkMenu *menu, gint *x, gint *y, GtkAspell *gtkaspell = entry->gtkaspell; gint pango_offset, win_x, win_y, scr_x, scr_y, text_index, entry_x; gchar *text; - GtkRequisition subject_rq; PangoLayout *layout = gtk_entry_get_layout(GTK_ENTRY(entry)); PangoLayoutLine *line = pango_layout_get_lines(layout)->data; - gtk_widget_get_child_requisition(GTK_WIDGET(entry), &subject_rq); + gtk_widget_get_preferred_size(GTK_WIDGET(entry), NULL, NULL); /* screen -> compose window coords */ gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(gtkaspell->parent_window)), @@ -587,9 +586,6 @@ static void set_menu_pos(GtkMenu *menu, gint *x, gint *y, pango_offset = gtk_entry_text_index_to_layout_index(GTK_ENTRY(entry), text_index); pango_layout_line_index_to_x(line, pango_offset, TRUE, &entry_x); - - *x = scr_x + win_x + PANGO_PIXELS(entry_x) + 8; - *y = scr_y + win_y + subject_rq.height; } void claws_spell_entry_context_set(ClawsSpellEntry *entry)