Skip to content

Commit cd2d299

Browse files
committed
Added mouse button and modifiers to the mouse press event
1 parent f53c346 commit cd2d299

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/giv-win.gob

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ my_lasso_draw_rectangle(cairo_t *cr,
261261
DovtkLassoContext context,
262262
gpointer user_data);
263263
static void create_remote_commands(GivWin *self);
264-
static void giv_win_json_pick_reply(GivWin *self, const gchar *error, double x, double y);
264+
static void giv_win_json_pick_reply(GivWin *self, const gchar *error, double x, double y, int button, size_t modifiers);
265265

266266
// The following tables contain all the actions for both the menubar
267267
// and the popup menus.
@@ -1717,12 +1717,15 @@ cb_button_press_event (GtkWidget * widget,
17171717

17181718
giv_widget_popdown_balloon(GIV_WIDGET(selfp->w_imgv));
17191719

1720-
if (event->button == 1 && selfp->do_pick_coordinate) {
1720+
if (button!= 2 && selfp->do_pick_coordinate) {
17211721
double world_x, world_y;
17221722
gtk_image_viewer_canv_coord_to_img_coord(GTK_IMAGE_VIEWER(selfp->w_imgv),
17231723
event->x, event->y,
17241724
&world_x, &world_y);
1725-
giv_win_json_pick_reply(self, NULL, world_x, world_y);
1725+
giv_win_json_pick_reply(self, NULL,
1726+
world_x, world_y,
1727+
event->button,
1728+
event->state);
17261729

17271730
return true;
17281731
}
@@ -1850,7 +1853,7 @@ cb_key_press_event (GtkWidget * widget,
18501853
if (k==GDK_KEY_Escape)
18511854
{
18521855
if (selfp->do_pick_coordinate)
1853-
giv_win_json_pick_reply(self, "Aborted", -1,-1);
1856+
giv_win_json_pick_reply(self, "Aborted", -1,-1,0,0);
18541857
}
18551858
if (// reload
18561859
k == GDK_KEY_KP_Enter
@@ -2286,7 +2289,7 @@ static void cb_view_auto_reload (GtkAction *action, gpointer data)
22862289
fmt::print("Autoreload = {}\n", selfp->do_auto_reload);
22872290

22882291
if (selfp->do_auto_reload)
2289-
g_timeout_add(250, auto_reload_function, self);
2292+
g_timeout_add(100, auto_reload_function, self);
22902293
}
22912294

22922295
static void
@@ -4600,7 +4603,7 @@ static int cmd_pick_coordinate(GLibJsonRpcServer *server,
46004603
return 0;
46014604
}
46024605

4603-
static void giv_win_json_pick_reply(GivWin *self, const gchar *error, double x, double y)
4606+
static void giv_win_json_pick_reply(GivWin *self, const gchar *error, double x, double y, int button, size_t modifiers)
46044607
{
46054608
selfp->do_pick_coordinate = false;
46064609

@@ -4611,6 +4614,8 @@ static void giv_win_json_pick_reply(GivWin *self, const gchar *error, double x,
46114614
json_builder_begin_array (builder);
46124615
json_builder_add_double_value(builder,x);
46134616
json_builder_add_double_value(builder,y);
4617+
json_builder_add_int_value(builder,button);
4618+
json_builder_add_int_value(builder,modifiers);
46144619
json_builder_end_array (builder);
46154620
JsonNode *response = json_node_copy(json_builder_get_root (builder));
46164621
g_object_unref(builder);

0 commit comments

Comments
 (0)