Commit 8df52aa9569ae235250d86857e7cd8b920ca0e3f
1 parent
1dfbf3ee
Exists in
master
and in
1 other branch
Refactoring keyboard management engine.
Showing
11 changed files
with
253 additions
and
92 deletions
Show diff stats
Makefile.in
| ... | ... | @@ -38,6 +38,7 @@ SOURCES= \ |
| 38 | 38 | $(wildcard src/terminal/properties/*.c) \ |
| 39 | 39 | $(wildcard src/terminal/drawing/*.c) \ |
| 40 | 40 | $(wildcard src/terminal/font/*.c) \ |
| 41 | + $(wildcard src/terminal/keyboard/*.c) \ | |
| 41 | 42 | $(wildcard src/filetransfer/*.c) \ |
| 42 | 43 | $(wildcard src/selection/*.c) \ |
| 43 | 44 | $(wildcard src/selection/@OSNAME@/*.c) \ | ... | ... |
src/include/internals.h
| ... | ... | @@ -309,7 +309,6 @@ G_GNUC_INTERNAL void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned |
| 309 | 309 | |
| 310 | 310 | G_GNUC_INTERNAL void v3270_blink_ssl(v3270 *terminal); |
| 311 | 311 | |
| 312 | - G_GNUC_INTERNAL void v3270_init_properties(GObjectClass * gobject_class); | |
| 313 | 312 | G_GNUC_INTERNAL void v3270_queue_draw_area(GtkWidget *widget, gint x, gint y, gint width, gint height); |
| 314 | 313 | |
| 315 | 314 | G_GNUC_INTERNAL void v3270_disable_updates(GtkWidget *widget); |
| ... | ... | @@ -340,9 +339,13 @@ G_GNUC_INTERNAL void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned |
| 340 | 339 | G_GNUC_INTERNAL gchar * v3270_translate_rgba_to_text(GdkRGBA *clr); |
| 341 | 340 | |
| 342 | 341 | // Properties |
| 342 | + G_GNUC_INTERNAL void v3270_init_properties(GObjectClass * gobject_class); | |
| 343 | 343 | G_GNUC_INTERNAL gboolean v3270_update_associated_lu(v3270 *terminal); |
| 344 | 344 | G_GNUC_INTERNAL void v3270_update_toggle(GtkWidget *widget, LIB3270_TOGGLE_ID id, unsigned char value, const char *name); |
| 345 | 345 | |
| 346 | + // Accelerators | |
| 347 | + G_GNUC_INTERNAL void v3270_init_accelerators(v3270 *widget); | |
| 348 | + | |
| 346 | 349 | G_END_DECLS |
| 347 | 350 | |
| 348 | 351 | #endif // V3270_INTERNALS_H_INCLUDED | ... | ... |
src/include/terminal.h
| ... | ... | @@ -217,6 +217,9 @@ G_BEGIN_DECLS |
| 217 | 217 | |
| 218 | 218 | GtkWidget * trace; ///< @brief Trace window handle. |
| 219 | 219 | |
| 220 | + // Keyboard accelerators. | |
| 221 | + GSList * accelerators; ///< @brief Keyboard accelerators. | |
| 222 | + | |
| 220 | 223 | }; |
| 221 | 224 | |
| 222 | 225 | G_GNUC_INTERNAL void v3270_activate(GtkWidget *widget); | ... | ... |
src/include/v3270.h
| ... | ... | @@ -273,11 +273,6 @@ |
| 273 | 273 | LIB3270_EXPORT void v3270_set_remap_filename(GtkWidget *widget, const gchar *path); |
| 274 | 274 | LIB3270_EXPORT const gchar * v3270_get_remap_filename(GtkWidget *widget); |
| 275 | 275 | |
| 276 | - // Actions | |
| 277 | - LIB3270_EXPORT void v3270_set_scroll_action(GtkWidget *widget, GdkScrollDirection direction, GtkAction *action) G_GNUC_DEPRECATED; | |
| 278 | - LIB3270_EXPORT void v3270_tab(GtkWidget *widget); | |
| 279 | - LIB3270_EXPORT void v3270_backtab(GtkWidget *widget); | |
| 280 | - | |
| 281 | 276 | // SSL & Security |
| 282 | 277 | LIB3270_EXPORT const gchar * v3270_get_ssl_state_icon_name(GtkWidget *widget); |
| 283 | 278 | LIB3270_EXPORT const gchar * v3270_get_ssl_state_message(GtkWidget *widget); | ... | ... |
| ... | ... | @@ -0,0 +1,50 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como - e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Contatos: | |
| 24 | + * | |
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + | |
| 30 | +#ifndef V3270_ACTIONS_H_INCLUDED | |
| 31 | + | |
| 32 | + #define V3270_ACTIONS_H_INCLUDED 1 | |
| 33 | + | |
| 34 | + #include <gtk/gtk.h> | |
| 35 | + | |
| 36 | + G_BEGIN_DECLS | |
| 37 | + | |
| 38 | + typedef struct _V3270Accelerator V3270Accelerator; | |
| 39 | + | |
| 40 | + LIB3270_EXPORT void v3270_set_scroll_action(GtkWidget *widget, GdkScrollDirection direction, GtkAction *action) G_GNUC_DEPRECATED; | |
| 41 | + LIB3270_EXPORT void v3270_tab(GtkWidget *widget); | |
| 42 | + LIB3270_EXPORT void v3270_backtab(GtkWidget *widget); | |
| 43 | + | |
| 44 | + LIB3270_EXPORT void v3270_accelerator_activate(V3270Accelerator * accell, GtkWidget *terminal); | |
| 45 | + LIB3270_EXPORT gboolean v3270_accelerator_compare(const V3270Accelerator * accell, const guint keyval, const GdkModifierType mods); | |
| 46 | + | |
| 47 | + | |
| 48 | + G_END_DECLS | |
| 49 | + | |
| 50 | +#endif // V3270_ACTIONS_H_INCLUDED | ... | ... |
src/include/v3270/keyboard.h
| ... | ... | @@ -1,73 +0,0 @@ |
| 1 | -/* | |
| 2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | - * | |
| 6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | - * | |
| 8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | - * Free Software Foundation. | |
| 11 | - * | |
| 12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | - * obter mais detalhes. | |
| 16 | - * | |
| 17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | - * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | - * | |
| 21 | - * Este programa está nomeado como - e possui - linhas de código. | |
| 22 | - * | |
| 23 | - * Contatos: | |
| 24 | - * | |
| 25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | - * | |
| 28 | - */ | |
| 29 | - | |
| 30 | -#ifndef V3270_KEYBOARD_H_INCLUDED | |
| 31 | - | |
| 32 | - #define V3270_KEYBOARD_H_INCLUDED 1 | |
| 33 | - | |
| 34 | - #include <gtk/gtk.h> | |
| 35 | - | |
| 36 | - G_BEGIN_DECLS | |
| 37 | - | |
| 38 | - #define GTK_TYPE_V3270_ACCELERATOR (V3270Accelerator_get_type ()) | |
| 39 | - #define GTK_V3270_ACCELERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270_ACCELERATOR, V3270Accelerator)) | |
| 40 | - #define GTK_V3270_ACCELERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270_ACCELERATOR, V3270AcceleratorClass)) | |
| 41 | - #define GTK_IS_V3270_ACCELERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_V3270_ACCELERATOR)) | |
| 42 | - #define GTK_IS_V3270_ACCELERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_V3270_ACCELERATOR)) | |
| 43 | - #define GTK_V3270_ACCELERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_V3270_ACCELERATOR, V3270AcceleratorClass)) | |
| 44 | - | |
| 45 | - typedef struct _V3270Accelerator | |
| 46 | - { | |
| 47 | - GObject parent; | |
| 48 | - guint accel_key; | |
| 49 | - GdkModifierType accel_mods; | |
| 50 | - } V3270Accelerator; | |
| 51 | - | |
| 52 | - typedef struct _V3270AcceleratorClass | |
| 53 | - { | |
| 54 | - GObjectClass parent_class; | |
| 55 | - | |
| 56 | - void (*activate)(GObject *accelerator, GtkWidget *widget); | |
| 57 | - const gchar * (*get_name)(GObject *accelerator); | |
| 58 | - | |
| 59 | - } V3270AcceleratorClass; | |
| 60 | - | |
| 61 | - LIB3270_EXPORT GType V3270Accelerator_get_type(void); | |
| 62 | - | |
| 63 | - LIB3270_EXPORT GObject * v3270_accelerator_new_from_lib3270_action(const LIB3270_ACTION *action); | |
| 64 | - | |
| 65 | - LIB3270_EXPORT void v3270_accelerator_activate(GtkWidget *widget); | |
| 66 | - LIB3270_EXPORT const gchar * v3270_accelerator_get_name(GObject *accelerator); | |
| 67 | - LIB3270_EXPORT void v3270_accelerator_parse(GObject *object, const gchar *accelerator); | |
| 68 | - | |
| 69 | - LIB3270_EXPORT void v3270_append_accelerator(GtkWidget *terminal, GObject *accelerator); | |
| 70 | - | |
| 71 | - G_END_DECLS | |
| 72 | - | |
| 73 | -#endif // V3270_DIALOGS_H_INCLUDED |
src/terminal/keyboard.c
| ... | ... | @@ -32,6 +32,7 @@ |
| 32 | 32 | |
| 33 | 33 | #include <lib3270.h> |
| 34 | 34 | #include <lib3270/actions.h> |
| 35 | + #include <v3270/actions.h> | |
| 35 | 36 | #include <lib3270/log.h> |
| 36 | 37 | #include <gtk/gtk.h> |
| 37 | 38 | #include <string.h> |
| ... | ... | @@ -57,6 +58,7 @@ |
| 57 | 58 | |
| 58 | 59 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
| 59 | 60 | |
| 61 | + /* | |
| 60 | 62 | static struct _keycode |
| 61 | 63 | { |
| 62 | 64 | guint keyval; |
| ... | ... | @@ -64,20 +66,17 @@ |
| 64 | 66 | int (*exec)(H3270 *session); |
| 65 | 67 | } keycode[] = |
| 66 | 68 | { |
| 67 | - { GDK_Left, 0, lib3270_cursor_left }, | |
| 68 | - { GDK_Up, 0, lib3270_cursor_up }, | |
| 69 | - { GDK_Right, 0, lib3270_cursor_right }, | |
| 70 | - { GDK_Down, 0, lib3270_cursor_down }, | |
| 71 | - { GDK_Tab, 0, lib3270_nextfield }, | |
| 72 | - { GDK_ISO_Left_Tab, GDK_SHIFT_MASK, lib3270_previousfield }, | |
| 69 | + { GDK_Left, 0, lib3270_cursor_left }, // OK | |
| 70 | + { GDK_Up, 0, lib3270_cursor_up }, // OK | |
| 71 | + { GDK_Right, 0, lib3270_cursor_right }, // OK | |
| 72 | + { GDK_Down, 0, lib3270_cursor_down }, // OK | |
| 73 | + { GDK_Tab, 0, lib3270_nextfield }, // OK | |
| 74 | + { GDK_ISO_Left_Tab, GDK_SHIFT_MASK, lib3270_previousfield }, // OK | |
| 73 | 75 | { GDK_KP_Left, 0, lib3270_cursor_left }, |
| 74 | 76 | { GDK_KP_Up, 0, lib3270_cursor_up }, |
| 75 | 77 | { GDK_KP_Right, 0, lib3270_cursor_right }, |
| 76 | 78 | { GDK_KP_Down, 0, lib3270_cursor_down }, |
| 77 | 79 | |
| 78 | -// { GDK_KP_Add, GDK_NUMLOCK_MASK, NULL }, | |
| 79 | -// { GDK_KP_Subtract, GDK_NUMLOCK_MASK, NULL }, | |
| 80 | - | |
| 81 | 80 | { GDK_3270_PrintScreen, 0, lib3270_print_all }, |
| 82 | 81 | { GDK_P, GDK_CONTROL_MASK, lib3270_print_all }, |
| 83 | 82 | |
| ... | ... | @@ -85,14 +84,14 @@ |
| 85 | 84 | |
| 86 | 85 | { GDK_Print, GDK_CONTROL_MASK, lib3270_print_all }, |
| 87 | 86 | { GDK_Print, GDK_SHIFT_MASK, lib3270_sysreq }, |
| 88 | -// { GDK_Control_R, 0, NULL }, | |
| 89 | -// { GDK_Control_L, 0, NULL }, | |
| 90 | 87 | |
| 91 | 88 | |
| 92 | 89 | //#ifdef WIN32 |
| 93 | 90 | // { GDK_Pause, 0, NULL }, |
| 94 | 91 | //#endif |
| 92 | + | |
| 95 | 93 | }; |
| 94 | + */ | |
| 96 | 95 | |
| 97 | 96 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 98 | 97 | |
| ... | ... | @@ -124,7 +123,7 @@ |
| 124 | 123 | |
| 125 | 124 | static gboolean check_keypress(v3270 *widget, GdkEventKey *event) |
| 126 | 125 | { |
| 127 | - int f; | |
| 126 | +// int f; | |
| 128 | 127 | GdkModifierType state = event->state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK|GDK_ALT_MASK); |
| 129 | 128 | gboolean handled = FALSE; |
| 130 | 129 | |
| ... | ... | @@ -150,6 +149,19 @@ |
| 150 | 149 | } |
| 151 | 150 | #endif // DEBUG |
| 152 | 151 | |
| 152 | + // Check accelerator table. | |
| 153 | + GSList * acccelerator; | |
| 154 | + for(acccelerator = widget->accelerators; acccelerator; acccelerator = g_slist_next(acccelerator)) | |
| 155 | + { | |
| 156 | + if(v3270_accelerator_compare((V3270Accelerator *) acccelerator->data, event->keyval, state)) | |
| 157 | + { | |
| 158 | + v3270_accelerator_activate((V3270Accelerator *) acccelerator->data,GTK_WIDGET(widget)); | |
| 159 | + return TRUE; | |
| 160 | + } | |
| 161 | + | |
| 162 | + } | |
| 163 | + | |
| 164 | + // Check PFKeys | |
| 153 | 165 | if(event->keyval >= GDK_F1 && event->keyval <= GDK_F12 && !(state & (GDK_CONTROL_MASK|GDK_ALT_MASK))) |
| 154 | 166 | { |
| 155 | 167 | int pfcode = (event->keyval - GDK_F1) + ((state & GDK_SHIFT_MASK) ? 13 : 1); |
| ... | ... | @@ -161,6 +173,7 @@ |
| 161 | 173 | } |
| 162 | 174 | } |
| 163 | 175 | |
| 176 | + /* | |
| 164 | 177 | for(f=0; f < (int) G_N_ELEMENTS(keycode);f++) |
| 165 | 178 | { |
| 166 | 179 | if(keycode[f].keyval == event->keyval && state == keycode[f].state) |
| ... | ... | @@ -173,6 +186,7 @@ |
| 173 | 186 | |
| 174 | 187 | } |
| 175 | 188 | } |
| 189 | + */ | |
| 176 | 190 | |
| 177 | 191 | return FALSE; |
| 178 | 192 | } | ... | ... |
| ... | ... | @@ -0,0 +1,109 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como properties.c e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Contatos: | |
| 24 | + * | |
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + | |
| 30 | + #include "private.h" | |
| 31 | + #include <errno.h> | |
| 32 | + #include <internals.h> | |
| 33 | + #include <terminal.h> | |
| 34 | + #include <lib3270/actions.h> | |
| 35 | + | |
| 36 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
| 37 | + | |
| 38 | + static int fire_lib3270_action(GtkWidget *widget, const LIB3270_ACTION * action) | |
| 39 | + { | |
| 40 | + int rc = EPERM; | |
| 41 | + | |
| 42 | + H3270 *hSession = v3270_get_session(widget); | |
| 43 | + | |
| 44 | + debug("%s(%s)",__FUNCTION__,action->name); | |
| 45 | + | |
| 46 | + if(action->activatable(hSession)) | |
| 47 | + rc = action->activate(hSession); | |
| 48 | + | |
| 49 | + debug("%s(%s)=%d %s",__FUNCTION__,action->name,rc,strerror(rc)); | |
| 50 | + return rc; | |
| 51 | + | |
| 52 | + } | |
| 53 | + | |
| 54 | + void v3270_init_accelerators(v3270 *widget) | |
| 55 | + { | |
| 56 | + size_t ix; | |
| 57 | + | |
| 58 | + // Create accelerators for lib3270 actions. | |
| 59 | + const LIB3270_ACTION * actions = lib3270_get_actions(); | |
| 60 | + | |
| 61 | + for(ix = 0; actions[ix].name; ix++) | |
| 62 | + { | |
| 63 | + if(actions[ix].keys) | |
| 64 | + { | |
| 65 | + size_t key; | |
| 66 | + | |
| 67 | + gchar ** keys = g_strsplit(actions[ix].keys,",",-1); | |
| 68 | + | |
| 69 | + for(key = 0; keys[key]; key++) | |
| 70 | + { | |
| 71 | + | |
| 72 | + V3270Accelerator * accelerator = g_new0(V3270Accelerator,1); | |
| 73 | + | |
| 74 | + accelerator->type = ACCELERATOR_TYPE_LIB3270_ACTION; | |
| 75 | + accelerator->arg = (gconstpointer) &actions[ix]; | |
| 76 | + accelerator->activate = G_CALLBACK(fire_lib3270_action); | |
| 77 | + | |
| 78 | + debug("%s=%s",actions[ix].name,keys[key]); | |
| 79 | + | |
| 80 | + gtk_accelerator_parse(keys[key],&accelerator->key,&accelerator->mods); | |
| 81 | + | |
| 82 | + widget->accelerators = g_slist_prepend(widget->accelerators,accelerator); | |
| 83 | + | |
| 84 | + } | |
| 85 | + | |
| 86 | + g_strfreev(keys); | |
| 87 | + | |
| 88 | + } | |
| 89 | + | |
| 90 | + } | |
| 91 | + | |
| 92 | + | |
| 93 | + } | |
| 94 | + | |
| 95 | + gboolean v3270_accelerator_compare(const V3270Accelerator * accell, const guint keyval, const GdkModifierType mods) | |
| 96 | + { | |
| 97 | + return accell->key == keyval && accell->mods == mods; | |
| 98 | + } | |
| 99 | + | |
| 100 | + void v3270_accelerator_activate(V3270Accelerator * accell, GtkWidget *terminal) | |
| 101 | + { | |
| 102 | + int rc = ((int (*)(GtkWidget *, const void *)) accell->activate)(terminal,accell->arg); | |
| 103 | + | |
| 104 | + if(rc) | |
| 105 | + gdk_display_beep(gdk_display_get_default()); | |
| 106 | + | |
| 107 | + } | |
| 108 | + | |
| 109 | + | ... | ... |
| ... | ... | @@ -0,0 +1,46 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como - e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Contatos: | |
| 24 | + * | |
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + | |
| 30 | + #include <config.h> | |
| 31 | + #include <v3270.h> | |
| 32 | + #include <v3270/actions.h> | |
| 33 | + | |
| 34 | + enum | |
| 35 | + { | |
| 36 | + ACCELERATOR_TYPE_LIB3270_ACTION, ///< @brief Accelerator is a lib3270 action | |
| 37 | + }; | |
| 38 | + | |
| 39 | + struct _V3270Accelerator | |
| 40 | + { | |
| 41 | + unsigned short type; | |
| 42 | + guint key; | |
| 43 | + GdkModifierType mods; | |
| 44 | + gconstpointer arg; | |
| 45 | + GCallback activate; | |
| 46 | + }; | ... | ... |
src/terminal/widget.c
| ... | ... | @@ -180,6 +180,12 @@ static void finalize(GObject *object) |
| 180 | 180 | terminal->host = NULL; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | + if(terminal->accelerators) | |
| 184 | + { | |
| 185 | + g_slist_free_full(terminal->accelerators,g_free); | |
| 186 | + terminal->accelerators = NULL; | |
| 187 | + } | |
| 188 | + | |
| 183 | 189 | G_OBJECT_CLASS(v3270_parent_class)->finalize(object); |
| 184 | 190 | } |
| 185 | 191 | |
| ... | ... | @@ -526,6 +532,9 @@ static void v3270_init(v3270 *widget) |
| 526 | 532 | for(ix = 0; ix < G_N_ELEMENTS(widget->responses); ix++) |
| 527 | 533 | widget->responses[ix] = GTK_RESPONSE_NONE; |
| 528 | 534 | |
| 535 | + // Init accelerators | |
| 536 | + v3270_init_accelerators(widget); | |
| 537 | + | |
| 529 | 538 | } |
| 530 | 539 | |
| 531 | 540 | LIB3270_EXPORT GtkWidget * v3270_new(void) | ... | ... |
v3270.cbp
| ... | ... | @@ -173,11 +173,11 @@ |
| 173 | 173 | <Unit filename="src/include/terminal.h" /> |
| 174 | 174 | <Unit filename="src/include/v3270.h" /> |
| 175 | 175 | <Unit filename="src/include/v3270/accessible.h" /> |
| 176 | + <Unit filename="src/include/v3270/actions.h" /> | |
| 176 | 177 | <Unit filename="src/include/v3270/colorscheme.h" /> |
| 177 | 178 | <Unit filename="src/include/v3270/dialogs.h" /> |
| 178 | 179 | <Unit filename="src/include/v3270/filetransfer.h" /> |
| 179 | 180 | <Unit filename="src/include/v3270/ftprogress.h" /> |
| 180 | - <Unit filename="src/include/v3270/keyboard.h" /> | |
| 181 | 181 | <Unit filename="src/include/v3270/print.h" /> |
| 182 | 182 | <Unit filename="src/include/v3270/security.h" /> |
| 183 | 183 | <Unit filename="src/include/v3270/settings.h" /> |
| ... | ... | @@ -268,6 +268,10 @@ |
| 268 | 268 | <Unit filename="src/terminal/keyboard.c"> |
| 269 | 269 | <Option compilerVar="CC" /> |
| 270 | 270 | </Unit> |
| 271 | + <Unit filename="src/terminal/keyboard/init.c"> | |
| 272 | + <Option compilerVar="CC" /> | |
| 273 | + </Unit> | |
| 274 | + <Unit filename="src/terminal/keyboard/private.h" /> | |
| 271 | 275 | <Unit filename="src/terminal/keyfile.c"> |
| 272 | 276 | <Option compilerVar="CC" /> |
| 273 | 277 | </Unit> | ... | ... |