Commit c1b8adde authored by Tristan Matthews's avatar Tristan Matthews

* #6850: gnome: fix build for gtk < 2.22.0

parent 6b7965fe
......@@ -30,7 +30,12 @@
*/
#include <gtk/gtk.h>
/* Backward compatibility for gtk < 2.22.0 */
#if GTK_CHECK_VERSION(2,22,0)
#include <gdk/gdkkeysyms-compat.h>
#else
#include <gdk/gdkkeysyms.h>
#endif
#include <glib/gprintf.h>
#include <stdlib.h>
#include <string.h>
......@@ -631,14 +636,14 @@ process_dialing (callable_obj_t *c, guint keyval, gchar *key)
dbus_start_tone (FALSE , 0);
switch (keyval) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
case GDK_Return:
case GDK_KP_Enter:
sflphone_place_call (c);
break;
case GDK_KEY_Escape:
case GDK_Escape:
sflphone_hang_up ();
break;
case GDK_KEY_BackSpace:
case GDK_BackSpace:
if (c->_state == CALL_STATE_TRANSFERT) {
if (*c->_trsft_to)
c->_trsft_to[strlen (c->_trsft_to) - 1] = '\0';
......@@ -653,16 +658,16 @@ process_dialing (callable_obj_t *c, guint keyval, gchar *key)
}
break;
case GDK_KEY_Tab:
case GDK_KEY_Alt_L:
case GDK_KEY_Control_L:
case GDK_KEY_Super_L:
case GDK_KEY_Caps_Lock:
case GDK_Tab:
case GDK_Alt_L:
case GDK_Control_L:
case GDK_Super_L:
case GDK_Caps_Lock:
break;
default:
if (keyval < 127 /* ascii */ ||
(keyval >= GDK_KEY_Mode_switch && keyval <= GDK_KEY_KP_9) /* num keypad */) {
(keyval >= GDK_Mode_switch && keyval <= GDK_KP_9) /* num keypad */) {
if (c->_state == CALL_STATE_TRANSFERT) {
gchar *new_trsft = g_strconcat (c->_trsft_to, key, NULL);
......@@ -714,9 +719,9 @@ sflphone_keypad (guint keyval, gchar * key)
if ( (active_calltree != current_calls) || (active_calltree == current_calls && !c)) {
switch (keyval) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
case GDK_KEY_Escape:
case GDK_Return:
case GDK_KP_Enter:
case GDK_Escape:
break;
default:
calltree_display (current_calls);
......@@ -732,7 +737,7 @@ sflphone_keypad (guint keyval, gchar * key)
case CALL_STATE_CURRENT:
switch (keyval) {
case GDK_KEY_Escape:
case GDK_Escape:
dbus_hang_up (c);
time (&c->_time_stop);
calltree_update_call (history, c, NULL);
......@@ -747,14 +752,14 @@ sflphone_keypad (guint keyval, gchar * key)
case CALL_STATE_INCOMING:
switch (keyval) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
case GDK_Return:
case GDK_KP_Enter:
c->_history_state = INCOMING;
calltree_update_call (history, c, NULL);
dbus_accept (c);
stop_notification();
break;
case GDK_KEY_Escape:
case GDK_Escape:
dbus_refuse (c);
stop_notification();
break;
......@@ -764,13 +769,13 @@ sflphone_keypad (guint keyval, gchar * key)
case CALL_STATE_TRANSFERT:
switch (keyval) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
case GDK_Return:
case GDK_KP_Enter:
dbus_transfert (c);
time (&c->_time_stop);
calltree_remove_call(current_calls, c, NULL);
break;
case GDK_KEY_Escape:
case GDK_Escape:
sflphone_unset_transfert ();
break;
default: // When a call is on transfert, typing new numbers will add it to c->_peer_number
......@@ -782,11 +787,11 @@ sflphone_keypad (guint keyval, gchar * key)
case CALL_STATE_HOLD:
switch (keyval) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
case GDK_Return:
case GDK_KP_Enter:
dbus_unhold (c);
break;
case GDK_KEY_Escape:
case GDK_Escape:
dbus_hang_up (c);
break;
default: // When a call is on hold, typing new numbers will create a new call
......@@ -800,7 +805,7 @@ sflphone_keypad (guint keyval, gchar * key)
case CALL_STATE_FAILURE:
switch (keyval) {
case GDK_KEY_Escape:
case GDK_Escape:
dbus_hang_up (c);
calltree_update_call (history, c, NULL);
break;
......
......@@ -46,7 +46,14 @@
#include <sys/stat.h>
#include <gtk/gtk.h>
/* Backward compatibility for gtk < 2.22.0 */
#if GTK_CHECK_VERSION(2,22,0)
#include <gdk/gdkkeysyms-compat.h>
#else
#include <gdk/gdkkeysyms.h>
#endif
#include <eel-gconf-extensions.h>
/** Local variables */
......@@ -135,7 +142,7 @@ on_key_released (GtkWidget *widget UNUSED, GdkEventKey *event, gpointer user_dat
if (focus_is_on_searchbar)
return TRUE;
if(event->keyval == GDK_KEY_Return) {
if (event->keyval == GDK_Return) {
if(active_calltree == current_calls) {
sflphone_keypad (event->keyval, event->string);
return TRUE;
......@@ -150,13 +157,13 @@ on_key_released (GtkWidget *widget UNUSED, GdkEventKey *event, gpointer user_dat
event->keyval == '<' ||
event->keyval == '>' ||
event->keyval == '\"' ||
event->keyval == GDK_KEY_Tab ||
event->keyval == GDK_KEY_Return ||
event->keyval == GDK_KEY_Left ||
event->keyval == GDK_KEY_Up ||
event->keyval == GDK_KEY_Right ||
event->keyval == GDK_KEY_Down ||
(event->keyval >= GDK_KEY_F1 && event->keyval <= GDK_KEY_F12)||
event->keyval == GDK_Tab ||
event->keyval == GDK_Return ||
event->keyval == GDK_Left ||
event->keyval == GDK_Up ||
event->keyval == GDK_Right ||
event->keyval == GDK_Down ||
(event->keyval >= GDK_F1 && event->keyval <= GDK_F12)||
event->keyval == ' '
)
return FALSE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment