diff options
author | infirit <[email protected]> | 2014-12-09 12:15:24 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-12-09 23:02:27 +0100 |
commit | 40a47584d8c96b6fe31d1948048ee411cd8b9431 (patch) | |
tree | d8cee9dd7566562e08267c405fcae329b908e3c4 /libview | |
parent | d205c55d5e18977aa5fe2f522c38ec6746a6aaaf (diff) | |
download | atril-40a47584d8c96b6fe31d1948048ee411cd8b9431.tar.bz2 atril-40a47584d8c96b6fe31d1948048ee411cd8b9431.tar.xz |
GDK_KEY_* keys are Gtk+2 as well.
Diffstat (limited to 'libview')
-rw-r--r-- | libview/ev-view-presentation.c | 65 | ||||
-rw-r--r-- | libview/ev-view.c | 29 |
2 files changed, 44 insertions, 50 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 <glib/gi18n-lib.h> #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> -#if GTK_CHECK_VERSION (3, 0, 0) -#include <gdk/gdkkeysyms-compat.h> -#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 <glib/gi18n-lib.h> #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> -#if GTK_CHECK_VERSION (3, 0, 0) -#include <gdk/gdkkeysyms-compat.h> -#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); } |