From 40a47584d8c96b6fe31d1948048ee411cd8b9431 Mon Sep 17 00:00:00 2001 From: infirit Date: Tue, 9 Dec 2014 12:15:24 +0100 Subject: GDK_KEY_* keys are Gtk+2 as well. --- libview/ev-view-presentation.c | 65 ++++++++++++++++++++---------------------- libview/ev-view.c | 29 +++++++++---------- shell/eggfindbar.c | 17 +++++------ shell/ev-sidebar.c | 11 +++---- 4 files changed, 55 insertions(+), 67 deletions(-) diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c index f30ef806..56ffa61c 100644 --- a/libview/ev-view-presentation.c +++ b/libview/ev-view-presentation.c @@ -24,9 +24,6 @@ #include #include #include -#if GTK_CHECK_VERSION (3, 0, 0) -#include -#endif #include "ev-view-presentation.h" #include "ev-jobs.h" @@ -541,7 +538,7 @@ ev_view_presentation_previous_page (EvViewPresentation *pview) /* Goto Window */ #define KEY_IS_NUMERIC(keyval) \ - ((keyval >= GDK_0 && keyval <= GDK_9) || (keyval >= GDK_KP_0 && keyval <= GDK_KP_9)) + ((keyval >= GDK_KEY_0 && keyval <= GDK_KEY_9) || (keyval >= GDK_KEY_KP_0 && keyval <= GDK_KEY_KP_9)) /* Cut and paste from gtkwindow.c */ static void @@ -586,17 +583,17 @@ ev_view_presentation_goto_window_key_press_event (GtkWidget *widget, EvViewPresentation *pview) { switch (event->keyval) { - case GDK_Escape: - case GDK_Tab: - case GDK_KP_Tab: - case GDK_ISO_Left_Tab: + case GDK_KEY_Escape: + case GDK_KEY_Tab: + case GDK_KEY_KP_Tab: + case GDK_KEY_ISO_Left_Tab: ev_view_presentation_goto_window_hide (pview); return TRUE; - case GDK_Return: - case GDK_KP_Enter: - case GDK_ISO_Enter: - case GDK_BackSpace: - case GDK_Delete: + case GDK_KEY_Return: + case GDK_KEY_KP_Enter: + case GDK_KEY_ISO_Enter: + case GDK_KEY_BackSpace: + case GDK_KEY_Delete: return FALSE; default: if (!KEY_IS_NUMERIC (event->keyval)) @@ -1163,31 +1160,31 @@ ev_view_presentation_key_press_event (GtkWidget *widget, #endif switch (event->keyval) { - case GDK_b: - case GDK_B: - case GDK_period: - case GDK_KP_Decimal: + case GDK_KEY_b: + case GDK_KEY_B: + case GDK_KEY_period: + case GDK_KEY_KP_Decimal: if (pview->state == EV_PRESENTATION_BLACK) ev_view_presentation_set_normal (pview); else ev_view_presentation_set_black (pview); return TRUE; - case GDK_w: - case GDK_W: + case GDK_KEY_w: + case GDK_KEY_W: if (pview->state == EV_PRESENTATION_WHITE) ev_view_presentation_set_normal (pview); else ev_view_presentation_set_white (pview); return TRUE; - case GDK_Home: + case GDK_KEY_Home: if (pview->state == EV_PRESENTATION_NORMAL) { ev_view_presentation_update_current_page (pview, 0); return TRUE; } break; - case GDK_End: + case GDK_KEY_End: if (pview->state == EV_PRESENTATION_NORMAL) { gint page; @@ -1399,7 +1396,7 @@ add_change_page_binding_keypad (GtkBindingSet *binding_set, GdkModifierType modifiers, GtkScrollType scroll) { - guint keypad_keyval = keyval - GDK_Left + GDK_KP_Left; + guint keypad_keyval = keyval - GDK_KEY_Left + GDK_KEY_KP_Left; gtk_binding_entry_add_signal (binding_set, keyval, modifiers, "change_page", 1, @@ -1558,32 +1555,32 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass) G_TYPE_OBJECT); binding_set = gtk_binding_set_by_class (klass); - add_change_page_binding_keypad (binding_set, GDK_Left, 0, GTK_SCROLL_PAGE_BACKWARD); - add_change_page_binding_keypad (binding_set, GDK_Right, 0, GTK_SCROLL_PAGE_FORWARD); - add_change_page_binding_keypad (binding_set, GDK_Up, 0, GTK_SCROLL_PAGE_BACKWARD); - add_change_page_binding_keypad (binding_set, GDK_Down, 0, GTK_SCROLL_PAGE_FORWARD); - gtk_binding_entry_add_signal (binding_set, GDK_space, 0, + add_change_page_binding_keypad (binding_set, GDK_KEY_Left, 0, GTK_SCROLL_PAGE_BACKWARD); + add_change_page_binding_keypad (binding_set, GDK_KEY_Right, 0, GTK_SCROLL_PAGE_FORWARD); + add_change_page_binding_keypad (binding_set, GDK_KEY_Up, 0, GTK_SCROLL_PAGE_BACKWARD); + add_change_page_binding_keypad (binding_set, GDK_KEY_Down, 0, GTK_SCROLL_PAGE_FORWARD); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_space, 0, "change_page", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_FORWARD); - gtk_binding_entry_add_signal (binding_set, GDK_BackSpace, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_BackSpace, 0, "change_page", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_BACKWARD); - gtk_binding_entry_add_signal (binding_set, GDK_Page_Down, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_Page_Down, 0, "change_page", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_FORWARD); - gtk_binding_entry_add_signal (binding_set, GDK_Page_Up, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_Page_Up, 0, "change_page", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_BACKWARD); - gtk_binding_entry_add_signal (binding_set, GDK_J, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_J, 0, "change_page", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_FORWARD); - gtk_binding_entry_add_signal (binding_set, GDK_H, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_H, 0, "change_page", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_BACKWARD); - gtk_binding_entry_add_signal (binding_set, GDK_L, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_L, 0, "change_page", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_FORWARD); - gtk_binding_entry_add_signal (binding_set, GDK_K, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_K, 0, "change_page", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_BACKWARD); } diff --git a/libview/ev-view.c b/libview/ev-view.c index deabbeab..5f570379 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -27,9 +27,6 @@ #include #include #include -#if GTK_CHECK_VERSION (3, 0, 0) -#include -#endif #include "ev-mapping-list.h" #include "ev-document-forms.h" @@ -863,7 +860,7 @@ add_scroll_binding_keypad (GtkBindingSet *binding_set, GtkScrollType scroll, gboolean horizontal) { - guint keypad_keyval = keyval - GDK_Left + GDK_KP_Left; + guint keypad_keyval = keyval - GDK_KEY_Left + GDK_KEY_KP_Left; gtk_binding_entry_add_signal (binding_set, keyval, modifiers, "binding_activated", 2, @@ -4989,21 +4986,21 @@ ev_view_class_init (EvViewClass *class) binding_set = gtk_binding_set_by_class (class); - add_scroll_binding_keypad (binding_set, GDK_Left, 0, GTK_SCROLL_STEP_BACKWARD, TRUE); - add_scroll_binding_keypad (binding_set, GDK_Right, 0, GTK_SCROLL_STEP_FORWARD, TRUE); - add_scroll_binding_keypad (binding_set, GDK_Left, GDK_MOD1_MASK, GTK_SCROLL_STEP_DOWN, TRUE); - add_scroll_binding_keypad (binding_set, GDK_Right, GDK_MOD1_MASK, GTK_SCROLL_STEP_UP, TRUE); - add_scroll_binding_keypad (binding_set, GDK_Up, 0, GTK_SCROLL_STEP_BACKWARD, FALSE); - add_scroll_binding_keypad (binding_set, GDK_Down, 0, GTK_SCROLL_STEP_FORWARD, FALSE); - add_scroll_binding_keypad (binding_set, GDK_Up, GDK_MOD1_MASK, GTK_SCROLL_STEP_DOWN, FALSE); - add_scroll_binding_keypad (binding_set, GDK_Down, GDK_MOD1_MASK, GTK_SCROLL_STEP_UP, FALSE); - gtk_binding_entry_add_signal (binding_set, GDK_H, 0, "binding_activated", 2, GTK_TYPE_SCROLL_TYPE, + add_scroll_binding_keypad (binding_set, GDK_KEY_Left, 0, GTK_SCROLL_STEP_BACKWARD, TRUE); + add_scroll_binding_keypad (binding_set, GDK_KEY_Right, 0, GTK_SCROLL_STEP_FORWARD, TRUE); + add_scroll_binding_keypad (binding_set, GDK_KEY_Left, GDK_MOD1_MASK, GTK_SCROLL_STEP_DOWN, TRUE); + add_scroll_binding_keypad (binding_set, GDK_KEY_Right, GDK_MOD1_MASK, GTK_SCROLL_STEP_UP, TRUE); + add_scroll_binding_keypad (binding_set, GDK_KEY_Up, 0, GTK_SCROLL_STEP_BACKWARD, FALSE); + add_scroll_binding_keypad (binding_set, GDK_KEY_Down, 0, GTK_SCROLL_STEP_FORWARD, FALSE); + add_scroll_binding_keypad (binding_set, GDK_KEY_Up, GDK_MOD1_MASK, GTK_SCROLL_STEP_DOWN, FALSE); + add_scroll_binding_keypad (binding_set, GDK_KEY_Down, GDK_MOD1_MASK, GTK_SCROLL_STEP_UP, FALSE); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_H, 0, "binding_activated", 2, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_BACKWARD, G_TYPE_BOOLEAN, TRUE); - gtk_binding_entry_add_signal (binding_set, GDK_J, 0, "binding_activated", 2, GTK_TYPE_SCROLL_TYPE, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_J, 0, "binding_activated", 2, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_FORWARD, G_TYPE_BOOLEAN, FALSE); - gtk_binding_entry_add_signal (binding_set, GDK_K, 0, "binding_activated", 2, GTK_TYPE_SCROLL_TYPE, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_K, 0, "binding_activated", 2, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_BACKWARD, G_TYPE_BOOLEAN, FALSE); - gtk_binding_entry_add_signal (binding_set, GDK_L, 0, "binding_activated", 2, GTK_TYPE_SCROLL_TYPE, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_L, 0, "binding_activated", 2, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_FORWARD, G_TYPE_BOOLEAN, TRUE); } diff --git a/shell/eggfindbar.c b/shell/eggfindbar.c index fff123c7..6744d371 100644 --- a/shell/eggfindbar.c +++ b/shell/eggfindbar.c @@ -23,9 +23,6 @@ #include #include #include -#if GTK_CHECK_VERSION (3, 0, 0) -#include -#endif #include "eggfindbar.h" @@ -184,25 +181,25 @@ egg_find_bar_class_init (EggFindBarClass *klass) binding_set = gtk_binding_set_by_class (klass); - gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "close", 0); - gtk_binding_entry_add_signal (binding_set, GDK_Up, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, 0, "scroll", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_BACKWARD); - gtk_binding_entry_add_signal (binding_set, GDK_Down, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, 0, "scroll", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_FORWARD); - gtk_binding_entry_add_signal (binding_set, GDK_Page_Up, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_Page_Up, 0, "scroll", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_BACKWARD); - gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Up, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Page_Up, 0, "scroll", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_BACKWARD); - gtk_binding_entry_add_signal (binding_set, GDK_Page_Down, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_Page_Down, 0, "scroll", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_FORWARD); - gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Down, 0, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Page_Down, 0, "scroll", 1, GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_FORWARD); } diff --git a/shell/ev-sidebar.c b/shell/ev-sidebar.c index 4d8a1de0..49413010 100644 --- a/shell/ev-sidebar.c +++ b/shell/ev-sidebar.c @@ -28,9 +28,6 @@ #include #include -#if GTK_CHECK_VERSION (3, 0, 0) -#include -#endif #include "ev-sidebar.h" #include "ev-sidebar-page.h" @@ -281,10 +278,10 @@ ev_sidebar_select_button_key_press_cb (GtkWidget *widget, { EvSidebar *ev_sidebar = EV_SIDEBAR (user_data); - if (event->keyval == GDK_space || - event->keyval == GDK_KP_Space || - event->keyval == GDK_Return || - event->keyval == GDK_KP_Enter) { + if (event->keyval == GDK_KEY_space || + event->keyval == GDK_KEY_KP_Space || + event->keyval == GDK_KEY_Return || + event->keyval == GDK_KEY_KP_Enter) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); gtk_menu_popup (GTK_MENU (ev_sidebar->priv->menu), NULL, NULL, ev_sidebar_menu_position_under, widget, -- cgit v1.2.1