Commit c82892da7897ed9e40b93da54868116da6674811
1 parent
3b6d0324
Exists in
master
and in
5 other branches
Iniciando reimplementação de seleção
Showing
4 changed files
with
25 additions
and
11 deletions
Show diff stats
pw3270.cbp
| ... | ... | @@ -105,6 +105,9 @@ |
| 105 | 105 | <Unit filename="src/gtk/v3270/keyboard.c"> |
| 106 | 106 | <Option compilerVar="CC" /> |
| 107 | 107 | </Unit> |
| 108 | + <Unit filename="src/gtk/v3270/mouse.c"> | |
| 109 | + <Option compilerVar="CC" /> | |
| 110 | + </Unit> | |
| 108 | 111 | <Unit filename="src/gtk/v3270/oia.c"> |
| 109 | 112 | <Option compilerVar="CC" /> |
| 110 | 113 | </Unit> | ... | ... |
src/gtk/v3270/mouse.c
| ... | ... | @@ -35,12 +35,12 @@ |
| 35 | 35 | |
| 36 | 36 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 37 | 37 | |
| 38 | -static int decode_position(v3270 *widget, GdkPoint *point, GdkEventButton *event) | |
| 38 | +static int decode_position(v3270 *widget, GdkPoint *point, gdouble x, gdouble y) | |
| 39 | 39 | { |
| 40 | 40 | int r,c; |
| 41 | 41 | |
| 42 | - point->x = ((event->x-widget->metrics.left)/widget->metrics.width); | |
| 43 | - point->y = ((event->y-widget->metrics.top)/widget->metrics.spacing); | |
| 42 | + point->x = ((x-widget->metrics.left)/widget->metrics.width); | |
| 43 | + point->y = ((y-widget->metrics.top)/widget->metrics.spacing); | |
| 44 | 44 | |
| 45 | 45 | lib3270_get_screen_size(widget->host,&r,&c); |
| 46 | 46 | |
| ... | ... | @@ -53,7 +53,7 @@ static int decode_position(v3270 *widget, GdkPoint *point, GdkEventButton *event |
| 53 | 53 | gboolean v3270_button_press_event(GtkWidget *widget, GdkEventButton *event) |
| 54 | 54 | { |
| 55 | 55 | GdkPoint point; |
| 56 | - int baddr = decode_position(GTK_V3270(widget),&point,event); | |
| 56 | + int baddr = decode_position(GTK_V3270(widget),&point,event->x,event->y); | |
| 57 | 57 | |
| 58 | 58 | if(baddr < 0) |
| 59 | 59 | return FALSE; |
| ... | ... | @@ -80,3 +80,12 @@ gboolean v3270_button_release_event(GtkWidget *widget, GdkEventButton*event) |
| 80 | 80 | |
| 81 | 81 | return FALSE; |
| 82 | 82 | } |
| 83 | + | |
| 84 | + | |
| 85 | +gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event) | |
| 86 | +{ | |
| 87 | +// trace("%s",__FUNCTION__); | |
| 88 | + | |
| 89 | + | |
| 90 | + return FALSE; | |
| 91 | +} | ... | ... |
src/gtk/v3270/private.h
| ... | ... | @@ -82,6 +82,8 @@ G_BEGIN_DECLS |
| 82 | 82 | |
| 83 | 83 | /*--[ Prototipes ]-----------------------------------------------------------------------------------*/ |
| 84 | 84 | |
| 85 | +const GtkWidgetClass * v3270_get_parent_class(void); | |
| 86 | + | |
| 85 | 87 | gboolean v3270_draw(GtkWidget * widget, cairo_t * cr); |
| 86 | 88 | void v3270_draw_oia(cairo_t *cr, H3270 *host, int row, int cols, struct v3270_metrics *metrics, GdkColor *color, GdkRectangle *rect); |
| 87 | 89 | |
| ... | ... | @@ -123,5 +125,6 @@ gboolean v3270_key_release_event(GtkWidget *widget, GdkEventKey *event); |
| 123 | 125 | void v3270_key_commit(GtkIMContext *imcontext, gchar *str, v3270 *widget); |
| 124 | 126 | gboolean v3270_button_press_event(GtkWidget *widget, GdkEventButton *event); |
| 125 | 127 | gboolean v3270_button_release_event(GtkWidget *widget, GdkEventButton*event); |
| 128 | +gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event); | |
| 126 | 129 | |
| 127 | 130 | G_END_DECLS | ... | ... |
src/gtk/v3270/widget.c
| ... | ... | @@ -42,13 +42,6 @@ |
| 42 | 42 | #define CONTENTS_WIDTH(terminal) (cols * terminal->metrics.width) |
| 43 | 43 | #define CONTENTS_HEIGHT(terminal) (((rows+1) * terminal->metrics.spacing)+OIA_TOP_MARGIN+2) |
| 44 | 44 | |
| 45 | - | |
| 46 | -/* | |
| 47 | - * http://gnomejournal.org/article/34/writing-a-widget-using-cairo-and-gtk28 | |
| 48 | - * http://developer.gnome.org/gtk3/3.3/ch25s02.html | |
| 49 | - * http://zetcode.com/tutorials/cairographicstutorial/cairotext | |
| 50 | - */ | |
| 51 | - | |
| 52 | 45 | /*--[ Widget definition ]----------------------------------------------------------------------------*/ |
| 53 | 46 | |
| 54 | 47 | G_DEFINE_TYPE(v3270, v3270, GTK_TYPE_WIDGET); |
| ... | ... | @@ -128,6 +121,7 @@ static void v3270_class_init(v3270Class *klass) |
| 128 | 121 | widget_class->focus_out_event = v3270_focus_out_event; |
| 129 | 122 | widget_class->button_press_event = v3270_button_press_event; |
| 130 | 123 | widget_class->button_release_event = v3270_button_release_event; |
| 124 | + widget_class->motion_notify_event = v3270_motion_notify_event; | |
| 131 | 125 | |
| 132 | 126 | klass->activate = v3270_activate; |
| 133 | 127 | klass->toggle_changed = v3270_toggle_changed; |
| ... | ... | @@ -854,3 +848,8 @@ static void v3270_activate(GtkWidget *widget) |
| 854 | 848 | else |
| 855 | 849 | v3270_connect(widget,NULL); |
| 856 | 850 | } |
| 851 | + | |
| 852 | +const GtkWidgetClass * v3270_get_parent_class(void) | |
| 853 | +{ | |
| 854 | + return GTK_WIDGET_CLASS(v3270_parent_class); | |
| 855 | +} | ... | ... |