[gspell/wip/gtk4: 140/141] Adapt to GdkEvent API changes



commit 8c6ab722d29fc7ef7f66743c9c9935e861b22063
Author: Timm Bäder <mail baedert org>
Date:   Wed Oct 25 11:50:53 2017 +0200

    Adapt to GdkEvent API changes

 gspell/gspell-entry-utils.c                |    5 ++++-
 gspell/gspell-entry.c                      |    6 +++++-
 gspell/gspell-inline-checker-text-buffer.c |   11 +++++++++--
 3 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/gspell/gspell-entry-utils.c b/gspell/gspell-entry-utils.c
index de65c21..fcf0349 100644
--- a/gspell/gspell-entry-utils.c
+++ b/gspell/gspell-entry-utils.c
@@ -235,12 +235,15 @@ _gspell_entry_utils_get_char_position_at_event (GtkEntry       *entry,
        gint layout_index; /* in bytes */
        gint text_index; /* in bytes */
        const gchar *buffer_text;
+       double event_x, event_y;
 
        g_object_get (entry,
                      "scroll-offset", &scroll_offset,
                      NULL);
 
-       x = event->x + scroll_offset;
+       gdk_event_get_coords ((GdkEvent *)event, &event_x, &event_y);
+
+       x = event_x + scroll_offset;
 
        layout_index = get_layout_index (entry, x);
        text_index = gtk_entry_layout_index_to_text_index (entry, layout_index);
diff --git a/gspell/gspell-entry.c b/gspell/gspell-entry.c
index 80e042c..9032466 100644
--- a/gspell/gspell-entry.c
+++ b/gspell/gspell-entry.c
@@ -602,7 +602,11 @@ button_press_event_cb (GtkEntry       *gtk_entry,
                       GdkEventButton *event,
                       GspellEntry    *gspell_entry)
 {
-       if (event->button == GDK_BUTTON_SECONDARY)
+       guint button;
+
+       gdk_event_get_button ((GdkEvent *)event, &button);
+
+       if (button == GDK_BUTTON_SECONDARY)
        {
                gspell_entry->popup_char_position =
                        _gspell_entry_utils_get_char_position_at_event (gtk_entry, event);
diff --git a/gspell/gspell-inline-checker-text-buffer.c b/gspell/gspell-inline-checker-text-buffer.c
index f458450..b6b9c99 100644
--- a/gspell/gspell-inline-checker-text-buffer.c
+++ b/gspell/gspell-inline-checker-text-buffer.c
@@ -1002,16 +1002,23 @@ button_press_event_cb (GtkTextView                   *view,
                       GdkEventButton                *event,
                       GspellInlineCheckerTextBuffer *spell)
 {
-       if (event->button == GDK_BUTTON_SECONDARY)
+       guint button;
+
+       gdk_event_get_button ((GdkEvent *)event, &button);
+
+       if (button == GDK_BUTTON_SECONDARY)
        {
                GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
                GtkTextIter iter;
+               double event_x, event_y;
                gint x;
                gint y;
 
+               gdk_event_get_coords ((GdkEvent *)event, &event_x, &event_y);
+
                gtk_text_view_window_to_buffer_coords (view,
                                                       GTK_TEXT_WINDOW_TEXT,
-                                                      event->x, event->y,
+                                                      event_x, event_y,
                                                       &x, &y);
 
                gtk_text_view_get_iter_at_location (view, &iter, x, y);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]